public function check() { if (!UsersLogin::isLogined()) { $this->user = null; } $needAuth = empty($this->user); if ($needAuth) { $authDataPresent = !empty($this->login) || !empty($this->password); try { if ($authDataPresent || UsersLogin::isLogined()) { if ($authDataPresent) { UsersLogin::login($this->login, $this->password); } } $this->user = UsersLogin::getCurrentUser(); $this->processUser(); } catch (ForbiddenException $e) { $this->authProc(); return false; } catch (\NotFoundException $e) { $this->authProc(); return false; } } return true; }
public function exec($source, $initData = null) { $auth = CMSDesign::getInstance(); $initData = json_decode($initData, true); if (!empty($initData)) { $source = $initData . $source; } if (!$auth->isSuperAdmin(UsersLogin::getCurrentUser())) { print 'Only system administrator can use this feature'; die; } else { print UParser::parsePHPCode($source, array()); } die; }
protected function initAdministrativeMenu() { $auth = \CMSAuth::getInstance(); if ($auth->isSuperAdmin(\UsersLogin::getCurrentUser())) { $this->view->set('showAdministrativeMenu', true); } }
/** * Отображает форму редактирования */ protected function outputEditingForm($sheets, $controls) { $sheetsEmpty = false; if (empty($sheets)) { $sheetsEmpty = true; $sheets = array(array('id' => 'mainTab', 'title' => 'Ошибка')); } if ($this->schema->getSitemapLink()) { $sitemapInfo = Sitemap_Sample::get($this->schema->getSitemapLink()); array_push($sheets, array('id' => 'sitemapTab', 'title' => 'Свойства')); } // $design = CMSDesign::getInstance(); $design->forms->begin(); // Вывод вкладок $design->tabs->sheetsBegin($sheets); // По вкладкам вывод $i = 0; if (!empty($controls)) { foreach ($controls as $list) { $design->tabs->contentBegin($sheets[$i]['id']); $design->table->begin(); foreach ($list as $control) { $design->table->row2cell($control->getTitle(), $control->outputInForm()); } $design->table->end(); $design->tabs->contentEnd(); $i++; } } else { $design->tabs->contentBegin($sheets[0]['id']); $design->decor->contentBegin(); printf('У данной схемы пока нету вкладок для редактирования<br/>'); $auth = CMSAuth::getInstance(); if ($auth->isSuperAdmin(UsersLogin::getCurrentUser())) { printf('Перейти к <a href="%scconfig/manage.php?schema=%s&edit=1">управлению</a> конфигом', \Extasy\CMS::getDashboardWWWRoot(), $this->schema->getName()); } $design->decor->contentEnd(); $design->tabs->contentEnd(); } if (!empty($sitemapInfo)) { $auth = CMSAuth::getInstance(); if ($auth->isSuperAdmin(UsersLogin::getCurrentUser())) { $link = sprintf('<a href="%scconfig/manage.php?schema=%s" target="_blank">Управление конфигом</a>', \Extasy\CMS::getDashboardWWWRoot(), $this->schema->getName()); $property = array('' => $link); } else { $property = array(); } SitemapCMSForms::outputSitemapTabSheet($sitemapInfo, $sheets[sizeof($sheets) - 1]['id'], $property); } $design->tabs->sheetsEnd(); $design->forms->hidden('schema', $this->schema->getName()); // Вывод конца $design->forms->submit('submit', 'Сохранить'); $design->forms->end(); $this->outputFooter(); }