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


PHP SessionHandler类代码示例

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


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

示例1: tagFullname

 /**
  * Outputs the current users full name (if any)
  */
 protected function tagFullname()
 {
     $user = SessionHandler::user();
     if ($user) {
         return $user->getFullName();
     }
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:10,代码来源:UserTagLib.php

示例2: get

 public static function get($name)
 {
     if (!SessionHandler::instance()->hasSession()) {
         return null;
     }
     return self::instance()->getSession()->get($name);
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:7,代码来源:SessionHandler.php

示例3: __construct

 public function __construct()
 {
     $session = SessionHandler::getInstance();
     $this->expire_time = $session->getTimeout();
     session_set_save_handler(array($this, "open"), array($this, "close"), array($this, "read"), array($this, "write"), array($this, "destroy"), array($this, "gc"));
     register_shutdown_function('session_write_close');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:7,代码来源:SessionStorageHandler.php

示例4: save

 public function save()
 {
     if (count($this->messages) > 0) {
         $this->flash = array_merge($this->flash, $this->messages);
         $this->clear();
     }
     SessionHandler::set('PIMPLE_FLASH', $this->flash);
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:8,代码来源:MessageHandler.php

示例5: markHandled

 /**
  * Mark feedback item as handled
  * @param $message_id optionally refer to a response message
  */
 public static function markHandled($id, $message_id = 0)
 {
     $session = SessionHandler::getInstance();
     $i = self::get($id);
     $i->time_answered = sql_datetime(time());
     $i->answered_by = $session->id;
     $i->message = $message_id;
     $i->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:13,代码来源:Feedback.php

示例6: send

 /**
  * Creates a new poke
  * @param $to
  */
 public static function send($to)
 {
     $session = SessionHandler::getInstance();
     $o = new Poke();
     $o->from = $session->id;
     $o->to = $to;
     $o->time = sql_datetime(time());
     $o->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:13,代码来源:Poke.php

示例7: hasAccess

 public function hasAccess($tag)
 {
     $entry = $this->tagRoles[strtoupper($tag)];
     if (!$entry) {
         return true;
     }
     $user = SessionHandler::instance()->getUser();
     return $entry->isValid($user ? $user->getRole() : self::R_GUEST);
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:9,代码来源:AccessHandler.php

示例8: save

 public static function save()
 {
     try {
         MessageHandler::instance()->save();
         SessionHandler::instance()->save();
     } catch (Exception $e) {
         //Do nothing...
     }
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:9,代码来源:Pimple.php

示例9: remove

 /**
  *
  * @param $type
  * @param $object_id   the object who owns the bookmark
  */
 public static function remove($type, $object_id, $owner = 0)
 {
     if (!is_numeric($type) || !is_numeric($object_id) || !is_numeric($owner)) {
         throw new \Exception('noo');
     }
     $session = SessionHandler::getInstance();
     $q = 'DELETE FROM ' . self::$tbl_name . ' WHERE owner = ?' . ' AND value = ?' . ' AND type = ?';
     return Sql::pDelete($q, 'iii', $owner ? $owner : $session->id, $object_id, $type);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:14,代码来源:Bookmark.php

示例10: delete

 public static function delete($projectId)
 {
     $projectDoc = self::get($projectId);
     $userId = SessionHandler::user()->getUserId();
     if ($projectDoc->type == 'project' && in_array($projectDoc->users, $userId)) {
         CouchDB::client()->deleteDoc($projectDoc);
         return true;
     }
     return false;
 }
开发者ID:hofmeister,项目名称:ScrumBanana.com,代码行数:10,代码来源:ProjectService.php

示例11: editHandler

 function editHandler($p)
 {
     $session = SessionHandler::getInstance();
     $o = FaqItem::get($p['id']);
     $o->question = $p['q'];
     $o->answer = $p['a'];
     $o->creator = $session->id;
     $o->time_created = sql_datetime(time());
     $o->store();
     js_redirect('a/faq');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:11,代码来源:faq.php

示例12: init

 public static function init($room_id, $div_name, $form_id)
 {
     $header = XhtmlHeader::getInstance();
     $header->includeJs('http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js');
     $session = SessionHandler::getInstance();
     $interval = 1000 * parse_duration('1s');
     // milliseconds
     $locale = 'sv-SE';
     $header->registerJsFunction('function scroll_to_bottom(div)' . '{' . 'var elm = get_el(div);' . 'try {' . 'elm.scrollTop = elm.scrollHeight;' . '} catch(e) {' . 'var f = document.createElement("input");' . 'if (f.setAttribute) f.setAttribute("type","text");' . 'if (elm.appendChild) elm.appendChild(f);' . 'f.style.width = "0px";' . 'f.style.height = "0px";' . 'if (f.focus) f.focus();' . 'if (elm.removeChild) elm.removeChild(f);' . '}' . '}');
     $header->embedJs('YUI({lang:"' . $locale . '"}).use("io-form","node","json-parse","datatype-date", function(Y)' . '{' . 'Y.on("load", function() {' . 'Init();' . '});' . 'function Init(ts)' . '{' . 'var latest;' . 'if (typeof ts === "undefined") {' . 'var uri = "/u/chatroom/update/" + ' . $room_id . ';' . '} else {' . 'var uri = "/u/chatroom/update/" + ' . $room_id . ' + "?ts=" + ts;' . '}' . 'function complete(id, o)' . '{' . 'var data = o.responseText;' . 'var node = Y.one("#' . $div_name . '");' . 'try {' . 'var data = Y.JSON.parse(data);' . '} catch (e) {' . 'console.log("invalid data from " + uri);' . 'return;' . '}' . 'if (typeof ts === "undefined")' . 'node.setContent("");' . 'for (var i = data.length-1; i >= 0; --i) {' . 'var p = data[i];' . 'if ((typeof ts === "undefined") || p.from != ' . $session->id . ')' . 'msg_render(p,node);' . '}' . 'if (data.length)' . 'scroll_to_bottom("' . $div_name . '");' . 'latest = data[0] ? data[0].ts : ts;' . 'setTimeout(Init,' . $interval . ',latest);' . '};' . 'Y.once("io:complete",complete,Y);' . 'var request = Y.io(uri);' . '}' . 'Y.one("#' . $form_id . '").on("submit", function(e)' . '{' . 'e.preventDefault();' . 'e.stopPropagation();' . 'frm = get_el( this.get("id") );' . 'if (!frm.msg.value)' . 'return false;' . 'var uri = "/u/chatroom/send/" + ' . $room_id . ' + "?m=" + frm.msg.value;' . 'var request = Y.io(uri);' . 'var node = Y.one("#' . $div_name . '");' . 'var p = {' . '"name":"' . $session->username . '",' . '"from":' . $session->id . ',' . '"msg":frm.msg.value,' . '"ts":new Date().getTime()/1000' . '};' . 'msg_render(p,node);' . 'scroll_to_bottom("' . $div_name . '");' . 'frm.msg.value = "";' . 'return false;' . '});' . 'function msg_render(p,node)' . '{' . 'var d = new Date(p.ts*1000);' . 'var today = new Date( new Date().getFullYear(), new Date().getMonth(), new Date().getDate(),0,0,0);' . 'node.append("[");' . 'if (d >= today) {' . 'node.append( Y.DataType.Date.format(d, {format:"%H:%M"}) );' . '} else {' . 'node.append( Y.DataType.Date.format(d, {format:"%a %d %b %H:%M"}) );' . '}' . 'node.append("]&nbsp;");' . 'var who = Y.Node.create("<span class=\\"yui3-hastooltip\\" id=\\"tt_usr_"+p.from+"\\">"+p.name+"</span>");' . 'who.addClass("yui3-hastooltip");' . 'node.append(who);' . 'node.append(": "+p.msg+"<br/>");' . '}' . '});');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:11,代码来源:ChatRoomUpdater.php

示例13: run

 public function run()
 {
     //this part is to test Admin cookies only - start.
     $params = ['uuid' => 'fake_uuid', 'username' => 'test@test.com', 'password' => 'fake password', 'name' => 'fake name', 'created' => ''];
     $adminUserDto = new AdminUserDto($params);
     $this->sessionHandler->setAdminUserCookie($adminUserDto);
     //this part is to test Admin cookies only - end.
     $this->pipeFilter->run();
     $controller = $this->request->controller;
     $controllerMethod = strtolower($this->request->request_method());
     $controller->{$controllerMethod}();
     echo "<br><br>" . __METHOD__;
 }
开发者ID:marcyniu,项目名称:ai,代码行数:13,代码来源:FrontController.php

示例14: close

 public function close()
 {
     parent::close();
     if ($this->isCurrentSessionExceeded()) {
         $this->log->error(sprintf("[SessionLock] Session lock was held for %s seconds which is longer than the maximum of %s seconds. Request details: \n                SERVER_NAME     | %s \n                SERVER_ADDR     | %s \n                SCRIPT_FILENAME | %s \n                REQUEST_METHOD  | %s \n                SCRIPT_NAME     | %s \n                REQUEST_URI     | %s \n                QUERY_STRING    | %s ", $this->session_time, $this->max_session_time, $_SERVER['SERVER_NAME'], $_SERVER['SERVER_ADDR'], $_SERVER['SCRIPT_FILENAME'], $_SERVER['REQUEST_METHOD'], $_SERVER['SCRIPT_NAME'], $_SERVER['REQUEST_URI'], $_SERVER['QUERY_STRING']));
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:7,代码来源:SugarSessionHandler.php

示例15: Userdata

 function __construct($request)
 {
     parent::__construct($request);
     global $project_datapath;
     global $project_webroot;
     $this->projectpath = $project_webroot;
     $this->userdata = new Userdata($request);
 }
开发者ID:Jayriq,项目名称:mmslides,代码行数:8,代码来源:Projects.php


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