• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CSession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: actionIndex

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


示例17: __construct

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


示例18: open

 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;
     }
 }
开发者ID:nbaiwan,项目名称:yav,代码行数:11,代码来源:CSession.php


示例19: getCurrentPerson

 /**
  * Объект сотрудника текущего пользователя
  *
  * @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;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:18,代码来源:CSession.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CSite类代码示例发布时间:2022-05-20
下一篇:
PHP CService类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap