Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/managers/request_manager.php
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | |||||
$false = false; | $false = false; | ||||
return $false; | return $false; | ||||
} | } | ||||
$event->SetRedirectParam('opener', 's'); // stay on same page after event is called | $event->SetRedirectParam('opener', 's'); // stay on same page after event is called | ||||
$event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true)); | $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true)); | ||||
/** @var kEventHandler $event_handler */ | |||||
$event_handler = $this->Application->recallObject($event->Prefix . '_EventHandler'); | $event_handler = $this->Application->recallObject($event->Prefix . '_EventHandler'); | ||||
/* @var $event_handler kEventHandler */ | |||||
if ( ($this->Application->RecallVar('user_id') == USER_ROOT) || $event_handler->CheckPermission($event) ) { | if ( ($this->Application->RecallVar('user_id') == USER_ROOT) || $event_handler->CheckPermission($event) ) { | ||||
$this->Application->HandleEvent($event); | $this->Application->HandleEvent($event); | ||||
$this->Application->notifyEventSubscribers($event); | $this->Application->notifyEventSubscribers($event); | ||||
} | } | ||||
return $event; | return $event; | ||||
} | } | ||||
/** | /** | ||||
* Processes case, when event finished with permission error | * Processes case, when event finished with permission error | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function processPermissionError($event) | protected function processPermissionError($event) | ||||
{ | { | ||||
// should do redirect but to no_permissions template | // should do redirect but to no_permissions template | ||||
$event->redirect = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); | $event->redirect = $this->Application->isAdmin ? 'no_permission' : $this->Application->ConfigValue('NoPermissionTemplate'); | ||||
$event->SetRedirectParam('pass', 'm'); | $event->SetRedirectParam('pass', 'm'); | ||||
/** @var kThemesHelper $themes_helper */ | |||||
$themes_helper = $this->Application->recallObject('ThemesHelper'); | $themes_helper = $this->Application->recallObject('ThemesHelper'); | ||||
/* @var $themes_helper kThemesHelper */ | |||||
$event->SetRedirectParam( 'm_cat_id', $themes_helper->getPageByTemplate($event->redirect) ); | $event->SetRedirectParam( 'm_cat_id', $themes_helper->getPageByTemplate($event->redirect) ); | ||||
// restore stuff, that processOpener() changed | // restore stuff, that processOpener() changed | ||||
$wid = $this->Application->GetVar('m_wid'); | $wid = $this->Application->GetVar('m_wid'); | ||||
$this->Application->RestoreVar( rtrim('opener_stack_' . $wid, '_') ); | $this->Application->RestoreVar( rtrim('opener_stack_' . $wid, '_') ); | ||||
// don't save last_template, because no_permission template does js history.back and could cause invalid opener_stack content | // don't save last_template, because no_permission template does js history.back and could cause invalid opener_stack content | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Processes window opener stack | * Processes window opener stack | ||||
* | * | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function processOpener() | protected function processOpener() | ||||
{ | { | ||||
/** @var kOpenerStack $opener_stack */ | |||||
$opener_stack = $this->Application->makeClass('kOpenerStack'); | $opener_stack = $this->Application->makeClass('kOpenerStack'); | ||||
/* @var $opener_stack kOpenerStack */ | |||||
switch ( $this->Application->GetVar('m_opener') ) { | switch ( $this->Application->GetVar('m_opener') ) { | ||||
case 'r': | case 'r': | ||||
$opener_stack->reset(); | $opener_stack->reset(); | ||||
break; | break; | ||||
case 'd': | case 'd': | ||||
// "down/push" new template to opener stack, deeplevel++ | // "down/push" new template to opener stack, deeplevel++ | ||||
if ( $this->Application->GetVar('front') ) { | if ( $this->Application->GetVar('front') ) { | ||||
/** @var Session $front_session */ | |||||
$front_session = $this->Application->recallObject('Session.front'); | $front_session = $this->Application->recallObject('Session.front'); | ||||
/* @var $front_session Session */ | |||||
$opener_stack->pushRaw( '../' . $front_session->RecallVar('last_template') ); | $opener_stack->pushRaw( '../' . $front_session->RecallVar('last_template') ); | ||||
} | } | ||||
else { | else { | ||||
$opener_stack->pushRaw( $this->Application->RecallVar('last_template') ); | $opener_stack->pushRaw( $this->Application->RecallVar('last_template') ); | ||||
} | } | ||||
break; | break; | ||||
case 'u': | case 'u': | ||||
// "up/pop" last template from opener stack, deeplevel-- | // "up/pop" last template from opener stack, deeplevel-- | ||||
$opener_stack->pop(); | $opener_stack->pop(); | ||||
break; | break; | ||||
case 'p': | case 'p': | ||||
// pop-up - generate new wid | // pop-up - generate new wid | ||||
$parent_wid = $this->Application->GetVar('m_wid'); // window_id of popup's parent window | $parent_wid = $this->Application->GetVar('m_wid'); // window_id of popup's parent window | ||||
$popup_wid = (int)$this->Application->RecallVar('last_wid') + 1; | $popup_wid = (int)$this->Application->RecallVar('last_wid') + 1; | ||||
$this->Application->StoreVar('last_wid', $popup_wid); | $this->Application->StoreVar('last_wid', $popup_wid); | ||||
$this->Application->SetVar('m_wid', $popup_wid); | $this->Application->SetVar('m_wid', $popup_wid); | ||||
/** @var kOpenerStack $popup_opener_stack */ | |||||
$popup_opener_stack = $this->Application->makeClass('kOpenerStack', Array ($popup_wid)); | $popup_opener_stack = $this->Application->makeClass('kOpenerStack', Array ($popup_wid)); | ||||
Lint: CodingStandard.Array.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
/* @var $popup_opener_stack kOpenerStack */ | |||||
$popup_opener_stack->pushRaw( $this->getLastTemplate($parent_wid) ); | $popup_opener_stack->pushRaw( $this->getLastTemplate($parent_wid) ); | ||||
$popup_opener_stack->save(); | $popup_opener_stack->save(); | ||||
$this->Application->SetVar('m_opener', 's'); | $this->Application->SetVar('m_opener', 's'); | ||||
/*// store window relations | /*// store window relations | ||||
$window_relations = $this->Application->RecallVar('window_relations'); | $window_relations = $this->Application->RecallVar('window_relations'); | ||||
Show All 17 Lines | |||||
* | * | ||||
* @param int $window_id | * @param int $window_id | ||||
* @return string | * @return string | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function getLastTemplate($window_id) | protected function getLastTemplate($window_id) | ||||
{ | { | ||||
if ( $this->Application->GetVar('front') ) { | if ( $this->Application->GetVar('front') ) { | ||||
/** @var Session $front_session */ | |||||
$front_session = $this->Application->recallObject('Session.front'); | $front_session = $this->Application->recallObject('Session.front'); | ||||
/* @var $front_session Session */ | |||||
return '../' . $front_session->RecallVar( rtrim('last_template_popup_' . $window_id, '_') ); | return '../' . $front_session->RecallVar( rtrim('last_template_popup_' . $window_id, '_') ); | ||||
} | } | ||||
if ( $this->Application->GetVar('merge_opener_stack') ) { | if ( $this->Application->GetVar('merge_opener_stack') ) { | ||||
// get last template from parent (that was closed) window opener stack | // get last template from parent (that was closed) window opener stack | ||||
Inline comments must start with a capital letter Lint: CodingStandard.Commenting.InlineComment.NotCapital: Inline comments must start with a capital letter | |||||
Inline comments must end in full-stops, exclamation marks, or question marks Lint: CodingStandard.Commenting.InlineComment.InvalidEndChar: Inline comments must end in full-stops, exclamation marks, or question marks | |||||
/** @var kOpenerStack $parent_opener_stack */ | |||||
$parent_opener_stack = $this->Application->makeClass('kOpenerStack', Array ($window_id)); | $parent_opener_stack = $this->Application->makeClass('kOpenerStack', Array ($window_id)); | ||||
There must be no space between the Array keyword and the opening parenthesis Lint: CodingStandard.Array.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
/* @var $parent_opener_stack kOpenerStack */ | |||||
$last_template = $parent_opener_stack->pop(true); | $last_template = $parent_opener_stack->pop(true); | ||||
$parent_opener_stack->save(true); | $parent_opener_stack->save(true); | ||||
} | } | ||||
else { | else { | ||||
$last_template = $this->Application->RecallVar( rtrim('last_template_popup_' . $window_id, '_') ); | $last_template = $this->Application->RecallVar( rtrim('last_template_popup_' . $window_id, '_') ); | ||||
} | } | ||||
Show All 14 Lines | |||||
$params['pass'] = 'all'; | $params['pass'] = 'all'; | ||||
} | } | ||||
/*// get parent window wid, when this was popup | /*// get parent window wid, when this was popup | ||||
$window_relations = $this->Application->RecallVar('window_relations'); | $window_relations = $this->Application->RecallVar('window_relations'); | ||||
$window_relations = $window_relations ? unserialize($window_relations) : Array (); | $window_relations = $window_relations ? unserialize($window_relations) : Array (); | ||||
$wid = isset($window_relations[$wid]) ? $window_relations[$wid] : false;*/ | $wid = isset($window_relations[$wid]) ? $window_relations[$wid] : false;*/ | ||||
/** @var kOpenerStack $opener_stack */ | |||||
$opener_stack = $this->Application->makeClass('kOpenerStack', Array ($wid)); | $opener_stack = $this->Application->makeClass('kOpenerStack', Array ($wid)); | ||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
There must be no space between the Array keyword and the opening parenthesis Lint: CodingStandard.Array.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
/* @var $opener_stack kOpenerStack */ | |||||
// change opener stack | // change opener stack | ||||
$default_params = Array ('m_opener' => 'u'); | $default_params = Array ('m_opener' => 'u'); | ||||
if ( !$this->Application->ConfigValue('UsePopups') && $opener_stack->getWindowID() ) { | if ( !$this->Application->ConfigValue('UsePopups') && $opener_stack->getWindowID() ) { | ||||
// remove wid to show combined header block in editing window | // remove wid to show combined header block in editing window | ||||
$default_params['m_wid'] = ''; | $default_params['m_wid'] = ''; | ||||
list ($last_template, $last_params, ) = $opener_stack->get(kOpenerStack::LAST_ELEMENT); | list ($last_template, $last_params, ) = $opener_stack->get(kOpenerStack::LAST_ELEMENT); | ||||
Show All 14 Lines | |||||
* Allows to change last element in opener stack | * Allows to change last element in opener stack | ||||
* | * | ||||
* @param string $new_template | * @param string $new_template | ||||
* @param Array $new_params | * @param Array $new_params | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function openerStackChange($new_template = null, $new_params = null) | protected function openerStackChange($new_template = null, $new_params = null) | ||||
{ | { | ||||
/** @var kOpenerStack $opener_stack */ | |||||
$opener_stack = $this->Application->makeClass('kOpenerStack'); | $opener_stack = $this->Application->makeClass('kOpenerStack'); | ||||
/* @var $opener_stack kOpenerStack */ | |||||
list ($template, $params, $index_file) = $opener_stack->pop(); | list ($template, $params, $index_file) = $opener_stack->pop(); | ||||
if ( isset($new_template) ) { | if ( isset($new_template) ) { | ||||
$template = $new_template; | $template = $new_template; | ||||
} | } | ||||
if ( isset($new_params) ) { | if ( isset($new_params) ) { | ||||
$params = array_merge($params, $new_params); | $params = array_merge($params, $new_params); | ||||
} | } | ||||
if ( !isset($params['pass_events']) ) { | if ( !isset($params['pass_events']) ) { | ||||
// don't pass events, unless requested | // don't pass events, unless requested | ||||
$params['pass_events'] = false; | $params['pass_events'] = false; | ||||
} | } | ||||
$opener_stack->push($template, $params, $index_file); | $opener_stack->push($template, $params, $index_file); | ||||
$opener_stack->save(); | $opener_stack->save(); | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |
There must be no space between the Array keyword and the opening parenthesis