public static function hookRemoteCall(Context $ctx) { if ($ctx->get('action') and ($result = parent::hookRemoteCall($ctx, __CLASS__)) instanceof Response) { return $result; } $menu = new AdminMenu(); $menu->poll($ctx); if (false === ($result = $menu->dispatch($ctx))) { throw new PageNotFoundException(); } $xmlmenu = $menu->getPath($ctx->query()) . $menu->getXML(); $page = array('status' => 200, 'base' => $ctx->url()->getBase($ctx), 'host' => MCMS_HOST_NAME, 'folder' => $ctx->folder(), 'sitefolder' => os::webpath(MCMS_SITE_FOLDER), 'query' => $ctx->query(), 'version' => defined('MCMS_VERSION') ? MCMS_VERSION : 'unknown', 'cache' => cache::getInstance()->getName(), 'memory' => ini_get('memory_limit'), 'time' => microtime(true) - MCMS_START_TIME, 'back' => urlencode(MCMS_REQUEST_URI)); $page['debug'] = $ctx->canDebug(); if (is_string($result)) { $xslt = isset($ctx->theme) ? $ctx->theme : os::path('lib', 'modules', 'admin', 'template.xsl'); if (file_exists($fname = substr($xslt, 0, -3) . 'css')) { $ctx->addExtra('style', $fname); } if (file_exists($fname = substr($xslt, 0, -3) . 'js')) { $ctx->addExtra('script', $fname); } $result = html::em('request', array('remoteIP' => $_SERVER['REMOTE_ADDR'], 'uri' => urlencode(MCMS_REQUEST_URI)), $ctx->user->getNode()->getXML('user') . $ctx->url()->getArgsXML()) . $xmlmenu . $result . $ctx->getExtrasXML(); $output = html::em('page', $page, $result); $result = xslt::transform($output, $xslt); } return $result; }
public static function hookRemoteCall(Context $ctx) { if ($commit = $ctx->method('post')) { $ctx->db->beginTransaction(); } $next = parent::hookRemoteCall($ctx, __CLASS__); if ($commit) { $ctx->db->commit(); } if ($next instanceof Response) { return $next; } if (null === $next or true === $next) { return $ctx->getRedirect(); } return new Redirect($next); }
public static function on_rpc(Context $ctx) { return parent::hookRemoteCall($ctx, __CLASS__); }