function processAdminRequest($url) { global $modulesMgr, $structureMgr, $authenticationMgr, $permissionsMgr, $cacheMgr, $templatesMgr; $userID = $authenticationMgr->getUserID(); $userGroupID = $authenticationMgr->getUserGroup(); // Если пользователь - гость, то отправить логиниться if ($userID == 1 || $userGroupID != 5) { header('Status: 302 Moved'); header('Location: /login'); exit; } SetCfg('InAdmin', true); //$pageID = isset($_GET['pageID']) ? $_GET['pageID'] : -1; if ($url == '/') { $pageID = -1; } else { //direct link is provided to edit some content $pageID = $structureMgr->getPageIDByPath($url); //$md = $structureMgr->getMetaData($pageID); if (!$pageID) { trigger_error('Admin 404 will be provided later. But now it is just a fatal error.', PM_FATAL); } if (!$permissionsMgr->canUpdate($pageID, $userID)) { trigger_error('Beautiful 403 will be provided later. But now it is just a fatal error.', PM_FATAL); } } include '_kernel.edit.php'; $tpl = $templatesMgr->getTemplate(-1, GetCfg('TemplatesPath') . '/admin/page.html'); $tpl = str_replace('%site_name%', GetCfg('SiteName'), $tpl); $res = ''; $cmd = _var('cmd'); if ($pageID == -1) { $pageID = _var('pageID'); if (!$pageID) { $pageID = $structureMgr->getRootPageID(); } //print 'pageID='.$pageID; if ($permissionsMgr->canUpdate($pageID, $userID) == false) { trigger_error('Beautiful 403 will be provided later. But now it is just a fatal error.', PM_FATAL); } if (!$cmd) { $res .= navi($pageID, false); $res .= structure($pageID); // this very evil function. Very slowed. } else { $res .= processAdminCommand($cmd, $pageID); } } else { if ($permissionsMgr->canUpdate($pageID, $userID) == false) { trigger_error('Beautiful 403 will be provided later. But now it is just a fatal error.', PM_FATAL); } $res .= processAdminCommand('editPage', $pageID); } $admMenu = admMenu($cmd); $tpl = str_replace('%content%', $res, $tpl); $tpl = str_replace('%adm_menu%', $admMenu, $tpl); print $tpl; }
//admin pages headerDtp(); echo <<<TXT <script async src="common/dtpicker.js"></script> <script async src="common/cpicker.js"></script> </head> <body> TXT; headerHdr(); echo "<div class='navBar noPrint'>\n"; echo "<div class='floatR'>\n"; calButton(); prtButton(); admMenu(); hlpButton(); logButton(); echo "</div>\n"; optButton(); echo "</div>\n"; optPanel(); echo "<div class='content'>\n"; if ($pageTitle) { echo "<br><h3 class='pageTitle'>{$pageTitle}</h3>\n"; } break; case 'l': //log in page echo <<<TXT </head>