Example #1
0
 /**
  * Log-out the current user.
  */
 public static function logout()
 {
     self::$data['sessionid'] = self::getSessionCookie();
     self::$data = API::User()->logout([]);
     CSession::destroy();
     zbx_unsetcookie('zbx_sessionid');
 }
 public function actionAdd()
 {
     $biography = new CBiography();
     $biography->user_id = CSession::getCurrentUser()->getId();
     $this->setData("biography", $biography);
     $this->renderView("_biography/add.tpl");
 }
 public function actionSave()
 {
     $quest = new CQuestion();
     $quest->setAttributes(CRequest::getArray($quest::getClassName()));
     if ($quest->validate()) {
         if (!CSession::isAuth()) {
             $user = "";
         } else {
             $user = CStaffManager::getUser(CSession::getCurrentUser()->getId())->getName();
         }
         $quest->contact_info .= " " . $user . '; ip ' . $_SERVER["REMOTE_ADDR"];
         if ($quest->answer_text != '') {
             $quest->datetime_answ = date("Y-d-m H:i:s", time());
         }
         $quest->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $quest->getId());
         } else {
             $this->redirect(WEB_ROOT);
         }
         return true;
     }
     $this->setData("quest", $quest);
     $this->renderView("__public/_question_add/edit.tpl");
 }
Example #4
0
function isSessionIDValid($config, $xsid)
{
    $bValid = false;
    //Instantiate the CR3DCQuery Class
    $oR3DCQuery = new CR3DCQuery($config);
    //$oR3DCQuery->CheckSIDTimeout();
    CSession::initialise($config);
    CSession::CheckSIDTimeout();
    if ($xsid != "") {
        //if($oR3DCQuery->CheckLogin($config, $xsid))
        if (CSession::CheckLogin($xsid)) {
            $session = base64_decode($xsid);
            // list($uniq, $player_id) = preg_split("/\|/", $session);
            list($uniq, $player_id) = explode("|", $session);
            if ($uniq != "" && is_numeric($player_id)) {
                $bValid = true;
                //$oR3DCQuery->UpdateSIDTimeout($config, $xsid);
                CSession::UpdateSIDTimeout($xsid);
                $oR3DCQuery->SetPlayerCreditsInit($player_id);
            }
        }
    }
    if ($oR3DCQuery->ELOIsActive()) {
        $oR3DCQuery->ELOCreateRatings();
    }
    $oR3DCQuery->MangeGameTimeOuts();
    $oR3DCQuery->Close();
    unset($oR3DCQuery);
    return $bValid;
}
 /**
  * 是否有权限
  */
 public static function checkRight($thisRoute = null)
 {
     // 用户资源
     $userData = CSession::get('user');
     if ($userData['groupId'] == 1) {
         return true;
     }
     $userRightList = isset($userData['rightAll']) ? $userData['rightAll'] : array();
     // 附加公共资源
     array_push($userRightList, 'system@welcome');
     array_push($userRightList, 'system@navList');
     array_push($userRightList, 'system@addNav');
     array_push($userRightList, 'system@addNavHandle');
     array_push($userRightList, 'system@ajaxAddNav');
     array_push($userRightList, 'system@editNav');
     array_push($userRightList, 'system@editNavHandle');
     array_push($userRightList, 'system@delNav');
     array_push($userRightList, 'system@changeMyPassword');
     array_push($userRightList, 'system@changeMyPassHandle');
     array_push($userRightList, 'adminRole@messageCenterForClient');
     array_push($userRightList, 'system@seeHelp');
     // 转小写
     foreach ($userRightList as $key => $val) {
         $userRightList[$key] = strtolower($val);
     }
     // 获取当前请求的路由
     if ($thisRoute == null) {
         $route = CRequest::getController() . '@' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction());
     } else {
         $route = $thisRoute;
     }
     return in_array(strtolower($route), $userRightList);
 }
 protected function doAction()
 {
     $data = ['theme' => getUserTheme(CWebUser::$data), 'messages' => []];
     if (CSession::keyExists('messages')) {
         $data['messages'] = CSession::getValue('messages');
         CSession::unsetValue(['messages']);
     }
     $this->setResponse(new CControllerResponseData($data));
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление моделями данных");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление доступом пользователей");
     parent::__construct();
 }
Example #9
0
 public function TemplateValues()
 {
     $sFootError = '';
     if (CSession::Has('wm_install_pass_error')) {
         $sFootError = CSession::Get('wm_install_pass_error', '');
         CSession::Clear('wm_install_pass_error');
     }
     return array('Login' => $this->oSettings->GetConf('Common/AdminLogin'), 'Password1' => '', 'Password2' => '', 'FootError' => $sFootError);
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Вопросы к ГОС экзаменам");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         //$this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Личные настройки");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Генерация кода по шаблону");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Генератор контроллеров");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         //$this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Справочник видов работ");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление наборами шаблонов");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Класс-описатели полей");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         //$this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление валидаторами полей");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Индивидуальные учебные планы");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Справочная система Портала");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         if (!in_array(CRequest::getString("action"), $this->allowedAnonymous)) {
             $this->redirectNoAccess();
         }
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление таблицами доступа");
     parent::__construct();
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         if (!in_array(CRequest::getString("action"), $this->allowedAnonymous)) {
             $this->redirectNoAccess();
         }
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Подсистема архивирования");
     parent::__construct();
 }
Example #22
0
 public function open()
 {
     $session_class = "C{$this->driver}Session";
     if (!self::$__opened && class_exists($session_class)) {
         $handler = new $session_class($this);
         session_set_save_handler(array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
         register_shutdown_function('session_write_close');
         session_start();
         self::$__opened = true;
     }
 }
 public function actionIndex()
 {
     $parent = 0;
     $title = "Нормативные документы";
     if (CRequest::getInt("parent")) {
         $parent = CRequest::getInt("parent");
         $parentFolder = CDocumentsManager::getFolder($parent);
         if (!is_null($parentFolder)) {
             $title = $parentFolder->title;
         }
     }
     // извлекаем все папки с учетом иерархии
     $query = new CQuery();
     $query->select("f.*")->from(TABLE_DOCUMENT_FOLDERS . " as f")->condition("f.parent_id = " . $parent)->order("f.title asc");
     $objects = new CArrayList();
     foreach ($query->execute()->getItems() as $ar) {
         $folder = new CDocumentFolder(new CActiveRecord($ar));
         $objects->add($objects->getCount(), $folder);
     }
     // теперь извлекаем все файлы
     $query = new CQuery();
     $query->select("f.*")->from(TABLE_DOCUMENTS . " as f")->condition("f.folder_id = " . $parent . " and f.nameFolder like 'gost%'")->order("f.browserFile asc");
     foreach ($query->execute()->getItems() as $ar) {
         $file = new CDocumentFile(new CDocumentActiveRecord($ar));
         $objects->add($objects->getCount(), $file);
     }
     $this->setData("title", $title);
     $this->setData("objects", $objects);
     /**
      * Генерация меню
      */
     // если есть родительская папка, то переходим в нее
     if ($parent != 0) {
         $parentFolder = CDocumentsManager::getFolder($parent);
         if (!is_null($parentFolder)) {
             $this->addActionsMenuItem(array("title" => "Назад", "link" => "index.php?action=index&parent=" . $parentFolder->parent_id, "icon" => "actions/edit-undo.png"));
         }
     }
     // если пользователь может чего-нибудь добавлять, то пусть добавит
     $this->setData("canEdit", false);
     if (CSession::isAuth()) {
         if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_ALL || CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_OWN_ONLY) {
             $this->addActionsMenuItem(array("title" => "Создать папку", "link" => "index.php?action=add&parent=" . $parent, "icon" => "actions/folder-new.png"));
             $this->addActionsMenuItem(array("title" => "Загрузить файл", "link" => "files.php?action=add&parent=" . $parent, "icon" => "actions/bookmark-new.png"));
             $this->setData("canEdit", true);
         }
     }
     /**
      * Отображение представления
      */
     $this->addCSSInclude("_modules/_documents/style.css");
     $this->renderView("_documents/_folder/index.tpl");
 }
Example #24
0
 /**
  * Объект сотрудника текущего пользователя
  *
  * @static
  * @return CPerson
  */
 public static function getCurrentPerson()
 {
     if (is_null(self::$_person)) {
         if (self::isAuth()) {
             $person = CStaffManager::getPersonById(self::getPersonId());
             if (!is_null($person)) {
                 self::$_person = $person;
             }
         }
     }
     return self::$_person;
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         if (!in_array(CRequest::getString("action"), $this->allowedAnonymous)) {
             $this->redirectNoAccess();
         }
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Учебные группы студентов");
     $this->_useDojo = true;
     parent::__construct();
 }
Example #26
0
 /**
  * Уровень доступа к текущей задаче
  *
  * @return int
  */
 public function getLevelForCurrentTask()
 {
     $level = ACCESS_LEVEL_NO_ACCESS;
     $task = CSession::getCurrentTask();
     if (!is_null($task)) {
         if ($this->getRoles()->hasElement($task->getId())) {
             $personTask = $this->getRoles()->getItem($task->getId());
             $level = $personTask->level;
         }
     }
     return $level;
 }
 public function onCreate(CModel $model)
 {
     $result = false;
     if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_ALL) {
         /**
          * Пользователь может создавать что-нибудь только если у него уровень
          * Чтение и запись всех записей.
          */
         $result = true;
     }
     return $result;
 }
 public function actionAdd()
 {
     $newsItem = new CNewsItem();
     $newsItem->user_id_insert = CSession::getCurrentUser()->getId();
     $newsItem->date_time = date("d.m.Y");
     $newsItem->news_type = "notice";
     $this->addJSInclude(JQUERY_UI_JS_PATH);
     $this->addCSSInclude(JQUERY_UI_CSS_PATH);
     $this->addCSSInclude("_modules/_redactor/redactor.css");
     $this->addJSInclude("_modules/_redactor/redactor.min.js");
     $this->setData("newsItem", $newsItem);
     $this->renderView("_news/add.tpl");
 }
 public function actionIndex()
 {
     $settings = new CUserSettings();
     $settings->user_id = CSession::getCurrentUser()->getId();
     if (!is_null(CSession::getCurrentUser()->getPersonalSettings())) {
         $settings = CSession::getCurrentUser()->getPersonalSettings();
     }
     $sizes = array(5, 6, 7, 8);
     $this->setData("sizes", $sizes);
     $this->setData("settings", $settings);
     $this->addActionsMenuItem(array("title" => "Добавить инфографику", "link" => "reports.php?action=add&id=" . $settings->getId(), "icon" => "actions/list-add.png"));
     $this->renderView("_settings/index.tpl");
 }
 public function __construct()
 {
     if (!CSession::isAuth()) {
         $action = CRequest::getString("action");
         if ($action == "") {
             $action = "index";
         }
         if (!in_array($action, $this->allowedAnonymous)) {
             $this->redirectNoAccess();
         }
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление сотрудниками кафедры");
     parent::__construct();
 }