Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support nested Actions

  • Loading branch information...
commit 6c6b5c9792f652663f2720591b09af3971dc5d75 1 parent fd602fa
@haraldpdl haraldpdl authored committed
Showing with 46 additions and 4 deletions.
  1. +46 −4 osCommerce/OM/Core/Site/Admin/ApplicationAbstract.php
View
50 osCommerce/OM/Core/Site/Admin/ApplicationAbstract.php
@@ -10,6 +10,7 @@
namespace osCommerce\OM\Core\Site\Admin;
+ use osCommerce\OM\Core\Registry;
use osCommerce\OM\Core\OSCOM;
abstract class ApplicationAbstract extends \osCommerce\OM\Core\ApplicationAbstract {
@@ -20,21 +21,62 @@
protected $_sort_order;
public function __construct($process = true) {
+ $OSCOM_Session = Registry::get('Session');
+
$this->initialize();
if ( $process === true ) {
$this->process();
- if ( isset($_GET['action']) && !empty($_GET['action']) ) {
- $action = osc_sanitize_string(basename($_GET['action']));
+ $action = null;
+ $action_index = 1;
+
+ if ( count($_GET) > 1 ) {
+ $requested_action = osc_sanitize_string(basename(key(array_slice($_GET, 1, 1, true))));
+
+ if ( $requested_action == OSCOM::getSiteApplication() ) {
+ $requested_action = null;
+
+ if ( count($_GET) > 2 ) {
+ $requested_action = osc_sanitize_string(basename(key(array_slice($_GET, 2, 1, true))));
+
+ $action_index = 2;
+ }
+ }
+
+ if ( !empty($requested_action) && self::siteApplicationActionExists($requested_action) ) {
+ $action = $requested_action;
+ }
+ }
+
+ if ( isset($action) ) {
+ call_user_func(array('osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this);
+
+ $action_index++;
+
+ if ( $action_index < count($_GET) ) {
+ $action = array($action);
- if ( class_exists('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action) ) {
- call_user_func(array('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action, 'execute'), $this);
+ for ( $i = $action_index, $n = count($_GET); $i < $n; $i++ ) {
+ $subaction = osc_sanitize_string(basename(key(array_slice($_GET, $i, 1, true))));
+
+ if ( $subaction != $OSCOM_Session->getName() && self::siteApplicationActionExists(implode('\\', $action) . '\\' . $subaction) ) {
+ call_user_func(array('osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . implode('\\', $action) . '\\' . $subaction, 'execute'), $this);
+
+ $action[] = $subaction;
+ } else {
+ break;
+ }
+ }
}
}
}
}
+ public function siteApplicationActionExists($action) {
+ return class_exists('osCommerce\\OM\\Core\\Site\\' . OSCOM::getSite() . '\\Application\\' . OSCOM::getSiteApplication() . '\\Action\\' . $action);
+ }
+
public function canLinkTo() {
return $this->_link_to;
}
Please sign in to comment.
Something went wrong with that request. Please try again.