public function getBlockResponse(&$block) { if (!is_object($block['call'][0])) { $block['call'][0] = $this->application->getControllerInstance($block['call'][0]); } // pass the name of the current block container if ($block['call'][0] instanceof Controller) { $block['call'][0]->setBlockName($this->getBlockName()); $block['call'][0]->setParentController($this); } return $this->application->execute($block['call'][0], $block['call'][1], true); }
// to get LiveCart session (that uses custom session handler) need to initialize LiveCart. error_reporting(A_ALL ^ E_STRICT); ini_set('display_errors', 0); include '../../../../application/Initialize.php'; ClassLoader::import('application.LiveCart'); ClassLoader::import('application.controller.BaseController'); $app = new LiveCart(); if (is_numeric($app->getSession()->get('User')) == false) { // no livecart session with loged in user (if getting controller will redirect) exit; } // consider user as admin if he can access: $checkAgainst = array('backend.product' => array('create', 'update', 'delete')); foreach ($checkAgainst as $controllerName => $actionNames) { foreach ($actionNames as $actionName) { $controller = $app->getControllerInstance($controllerName); $roles = $controller->getRoles(); if ($controller->user->hasAccess($roles->getRole($actionName)) == false) { // cant access exit; } } } /** * sysem config setting * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @link www.phpletter.com * @version 1.0 * @since 22/April/2007 * */