Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/db/db_event_handler.php
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Line(s) | |||||
$id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); | $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); | ||||
return $main_object->GetDBField($id_field); | return $main_object->GetDBField($id_field); | ||||
} | } | ||||
// 1. get id from post (used in admin) | // 1. get id from post (used in admin) | ||||
$ret = $this->Application->GetVar($event->getPrefixSpecial(true) . '_id'); | $ret = $this->Application->GetVar($event->getPrefixSpecial(true) . '_id'); | ||||
if ( ($ret !== false) && ($ret != '') ) { | if ( ($ret !== false) && ($ret != '') ) { | ||||
$event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); | |||||
return $ret; | return $ret; | ||||
} | } | ||||
// 2. get id from env (used in front) | // 2. get id from env (used in front) | ||||
$ret = $this->Application->GetVar($event->getPrefixSpecial() . '_id'); | $ret = $this->Application->GetVar($event->getPrefixSpecial() . '_id'); | ||||
if ( ($ret !== false) && ($ret != '') ) { | if ( ($ret !== false) && ($ret != '') ) { | ||||
$event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); | |||||
return $ret; | return $ret; | ||||
} | } | ||||
// recall selected ids array and use the first one | // recall selected ids array and use the first one | ||||
$ids = $this->Application->GetVar($event->getPrefixSpecial() . '_selected_ids'); | $ids = $this->Application->GetVar($event->getPrefixSpecial() . '_selected_ids'); | ||||
if ( $ids != '' ) { | if ( $ids != '' ) { | ||||
$ids = explode(',', $ids); | $ids = explode(',', $ids); | ||||
if ( $ids ) { | if ( $ids ) { | ||||
$ret = array_shift($ids); | $ret = array_shift($ids); | ||||
$event->setEventParam(kEvent::FLAG_ID_FROM_REQUEST, true); | |||||
} | } | ||||
} | } | ||||
else { // if selected ids are not yet stored | else { // if selected ids are not yet stored | ||||
$this->StoreSelectedIDs($event); | $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; | return $ret; | ||||
} | } | ||||
/** | /** | ||||
* Prepares and stores selected_ids string | * Prepares and stores selected_ids string | ||||
* in Session and Application Variables | * in Session and Application Variables | ||||
▲ Show 20 Lines • Show All 275 Lines • ▼ Show 20 Line(s) | |||||
$status_checked = false; | $status_checked = false; | ||||
if ( $user_id == USER_ROOT || $this->CheckPermission($event) ) { | if ( $user_id == USER_ROOT || $this->CheckPermission($event) ) { | ||||
// don't autoload item, when user doesn't have view permission | // don't autoload item, when user doesn't have view permission | ||||
$this->LoadItem($event); | $this->LoadItem($event); | ||||
$status_checked = true; | $status_checked = true; | ||||
$editing_mode = defined('EDITING_MODE') ? EDITING_MODE : false; | $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) | // non-root user AND on front-end AND (not editing mode || incorrect status) | ||||
$perm_status = false; | $perm_status = false; | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
$perm_status = false; | $perm_status = false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3002 Lines • Show Last 20 Lines |