Index: branches/5.2.x/core/kernel/db/db_event_handler.php =================================================================== --- branches/5.2.x/core/kernel/db/db_event_handler.php +++ branches/5.2.x/core/kernel/db/db_event_handler.php @@ -243,12 +243,16 @@ // 1. get id from post (used in admin) $ret = $this->Application->GetVar($event->getPrefixSpecial(true) . '_id'); if ( ($ret !== false) && ($ret != '') ) { + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + return $ret; } // 2. get id from env (used in front) $ret = $this->Application->GetVar($event->getPrefixSpecial() . '_id'); if ( ($ret !== false) && ($ret != '') ) { + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + return $ret; } @@ -258,11 +262,20 @@ $ids = explode(',', $ids); if ( $ids ) { $ret = array_shift($ids); + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); } } else { // if selected ids are not yet stored $this->StoreSelectedIDs($event); - return $this->Application->GetVar($event->getPrefixSpecial() . '_id'); // StoreSelectedIDs sets this variable + + // StoreSelectedIDs sets this variable. + $ret = $this->Application->GetVar($event->getPrefixSpecial() . '_id'); + + if ( ($ret !== false) && ($ret != '') ) { + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + + return $ret; + } } return $ret; @@ -554,8 +567,12 @@ $status_checked = true; $editing_mode = defined('EDITING_MODE') ? EDITING_MODE : false; + $id_from_request = $event->getEventParam(kEvent::FLAG_ID_FROM_REQUEST); - if ( $user_id != USER_ROOT && !$this->Application->isAdmin && !($editing_mode || $this->checkItemStatus($event)) ) { + if ( $user_id != USER_ROOT + && !$this->Application->isAdmin + && !($editing_mode || ($id_from_request ? $this->checkItemStatus($event) : true)) + ) { // non-root user AND on front-end AND (not editing mode || incorrect status) $perm_status = false; } Index: branches/5.2.x/core/kernel/utility/event.php =================================================================== --- branches/5.2.x/core/kernel/utility/event.php +++ branches/5.2.x/core/kernel/utility/event.php @@ -47,6 +47,11 @@ const erSTOP = -4; /** + * Flag, set as event parameter, that indicates that ID is coming from Web Request. + */ + const FLAG_ID_FROM_REQUEST = 'id_from_request'; + + /** * Reference to event, that created given event * * @var kEvent @@ -441,4 +446,4 @@ { return $this->getPrefixSpecial() . ':' . $this->Name; } - } \ No newline at end of file + } Index: branches/5.2.x/core/units/categories/categories_event_handler.php =================================================================== --- branches/5.2.x/core/units/categories/categories_event_handler.php +++ branches/5.2.x/core/units/categories/categories_event_handler.php @@ -605,6 +605,8 @@ return parent::getPassedID($event); } + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + return $this->Application->GetVar('m_cat_id'); } @@ -619,6 +621,8 @@ static $page_by_template = Array (); if ( $event->Special == 'current' ) { + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + return $this->Application->GetVar('m_cat_id'); } @@ -657,6 +661,7 @@ if ( !$page_id && !$this->Application->isAdmin ) { $page_id = $this->Application->GetVar('m_cat_id'); + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); } return $page_id; Index: branches/5.2.x/core/units/languages/languages_event_handler.php =================================================================== --- branches/5.2.x/core/units/languages/languages_event_handler.php +++ branches/5.2.x/core/units/languages/languages_event_handler.php @@ -93,6 +93,9 @@ if ( !$language_id ) { $language_id = 'default'; } + else { + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + } $this->Application->SetVar('m_lang', $language_id); $this->Application->SetVar($event->getPrefixSpecial() . '_id', $language_id); Index: branches/5.2.x/core/units/themes/themes_eh.php =================================================================== --- branches/5.2.x/core/units/themes/themes_eh.php +++ branches/5.2.x/core/units/themes/themes_eh.php @@ -84,6 +84,9 @@ if ( !$theme_id ) { $theme_id = 'default'; } + else { + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + } $this->Application->SetVar('m_theme', $theme_id); $this->Application->SetVar($event->getPrefixSpecial() . '_id', $theme_id); Index: branches/5.2.x/core/units/users/users_event_handler.php =================================================================== --- branches/5.2.x/core/units/users/users_event_handler.php +++ branches/5.2.x/core/units/users/users_event_handler.php @@ -1107,12 +1107,14 @@ case 'profile': $id = $this->Application->GetVar('user_id'); - if ( !$id ) { - // if none user_id given use current user id - $id = $this->Application->RecallVar('user_id'); + if ( $id ) { + $event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); + + return $id; } - return $id; + // If none user_id given use current user id. + return $this->Application->RecallVar('user_id'); break; case 'forgot':