当前位置: 首页>>代码示例>>PHP>>正文


PHP CSession类代码示例

本文整理汇总了PHP中CSession的典型用法代码示例。如果您正苦于以下问题:PHP CSession类的具体用法?PHP CSession怎么用?PHP CSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logout

 /**
  * 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');
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:10,代码来源:CWebUser.php

示例2: actionAdd

 public function actionAdd()
 {
     $biography = new CBiography();
     $biography->user_id = CSession::getCurrentUser()->getId();
     $this->setData("biography", $biography);
     $this->renderView("_biography/add.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:7,代码来源:CBiographyController.class.php

示例3: actionSave

 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");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:25,代码来源:CQuestionAddController.class.php

示例4: isSessionIDValid

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;
}
开发者ID:robertohernando,项目名称:phpchess,代码行数:30,代码来源:mobile.php

示例5: checkRight

 /**
  * 是否有权限
  */
 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);
 }
开发者ID:seiven,项目名称:ACEAdminForMyframework,代码行数:36,代码来源:AdminController.php

示例6: doAction

 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));
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:9,代码来源:CControllerSystemWarning.php

示例7: __construct

 public function __construct()
 {
     if (!CSession::isAuth()) {
         $this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление моделями данных");
     parent::__construct();
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:9,代码来源:CCoreModelsController.class.php

示例8: TemplateValues

 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);
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:9,代码来源:admin-panel.php

示例9: __construct

 public function __construct()
 {
     if (!CSession::isAuth()) {
         //$this->redirectNoAccess();
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Личные настройки");
     parent::__construct();
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:9,代码来源:CConfigurationController.class.php

示例10: __construct

 public function __construct()
 {
     if (!CSession::isAuth()) {
         if (!in_array(CRequest::getString("action"), $this->allowedAnonymous)) {
             $this->redirectNoAccess();
         }
     }
     $this->_smartyEnabled = true;
     $this->setPageTitle("Управление таблицами доступа");
     parent::__construct();
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:11,代码来源:CACLTableController.class.php

示例11: actionIndex

 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");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:53,代码来源:CDocumentsController.class.php

示例12: __construct

 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();
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CStudentGroupsController.class.php

示例13: getLevelForCurrentTask

 /**
  * Уровень доступа к текущей задаче
  *
  * @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;
 }
开发者ID:Trozeman,项目名称:ASUPortalPHP,代码行数:17,代码来源:CUser.class.php

示例14: onCreate

 public function onCreate(CModel $model)
 {
     $result = false;
     if (CSession::getCurrentUser()->getLevelForCurrentTask() == ACCESS_LEVEL_WRITE_ALL) {
         /**
          * Пользователь может создавать что-нибудь только если у него уровень
          * Чтение и запись всех записей.
          */
         $result = true;
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CModelValidatorCreationOnlyWithWriteAccess.class.php

示例15: actionAdd

 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");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:13,代码来源:CNewsController.class.php


注:本文中的CSession类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。