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


PHP Context::getSessionStatus方法代码示例

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


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

示例1: updateReadedCount

 /**
  * Update read counts of the document
  * @param documentItem $oDocument
  * @return bool|void
  */
 function updateReadedCount(&$oDocument)
 {
     // Pass if Crawler access
     if (\Rhymix\Framework\UA::isRobot()) {
         return false;
     }
     $oDocumentModel = getModel('document');
     $config = $oDocumentModel->getDocumentConfig();
     if ($config->view_count_option == 'none') {
         return false;
     }
     $document_srl = $oDocument->document_srl;
     $member_srl = $oDocument->get('member_srl');
     $logged_info = Context::get('logged_info');
     // Call a trigger when the read count is updated (before)
     $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     // Pass if read count is increaded on the session information
     if ($_SESSION['readed_document'][$document_srl] && $config->view_count_option == 'once') {
         return false;
     } else {
         if ($config->view_count_option == 'some') {
             if ($_SESSION['readed_document'][$document_srl]) {
                 return false;
             }
         }
     }
     if ($config->view_count_option == 'once') {
         // Pass if the author's IP address is as same as visitor's.
         if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus()) {
             $_SESSION['readed_document'][$document_srl] = true;
             return false;
         }
         // Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
         if ($member_srl && $logged_info->member_srl == $member_srl) {
             $_SESSION['readed_document'][$document_srl] = true;
             return false;
         }
     }
     $oDB = DB::getInstance();
     $oDB->begin();
     // Update read counts
     $args = new stdClass();
     $args->document_srl = $document_srl;
     executeQuery('document.updateReadedCount', $args);
     // Call a trigger when the read count is updated (after)
     ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
     $oDB->commit();
     //remove document item from cache
     Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
     // Register session
     if (!$_SESSION['banned_document'][$document_srl] && Context::getSessionStatus()) {
         $_SESSION['readed_document'][$document_srl] = true;
     }
     return TRUE;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:63,代码来源:document.controller.php

示例2: getComments

 function getComments()
 {
     if (!$this->getCommentCount()) {
         return;
     }
     if (!$this->isGranted() && $this->isSecret()) {
         return;
     }
     // cpage is a number of comment pages
     $cpageStr = sprintf('%d_cpage', $this->document_srl);
     $cpage = Context::get($cpageStr);
     if (!$cpage) {
         $cpage = Context::get('cpage');
     }
     // Get a list of comments
     $oCommentModel = getModel('comment');
     $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
     if (!$output->toBool() || !count($output->data)) {
         return;
     }
     // Create commentItem object from a comment list
     // If admin priviledge is granted on parent posts, you can read its child posts.
     $accessible = array();
     $comment_list = array();
     $setAccessibleComments = Context::getSessionStatus();
     foreach ($output->data as $key => $val) {
         $oCommentItem = new commentItem();
         $oCommentItem->setAttribute($val);
         // If permission is granted to the post, you can access it temporarily
         if ($oCommentItem->isGranted()) {
             $accessible[$val->comment_srl] = true;
         }
         // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
         if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) {
             if ($setAccessibleComments) {
                 $oCommentItem->setAccessible();
             }
         }
         $comment_list[$val->comment_srl] = $oCommentItem;
     }
     // Variable setting to be displayed on the skin
     Context::set($cpageStr, $output->page_navigation->cur_page);
     Context::set('cpage', $output->page_navigation->cur_page);
     if ($output->total_page > 1) {
         $this->comment_page_navigation = $output->page_navigation;
     }
     return $comment_list;
 }
开发者ID:kkkyyy03,项目名称:coffeemix,代码行数:48,代码来源:document.item.php

示例3: isLogged

 /**
  * @brief Check if logged-in
  */
 function isLogged()
 {
     if ($_SESSION['is_logged']) {
         if (Mobile::isFromMobilePhone()) {
             return true;
         } elseif (filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
             // IPv6: require same /48
             if (strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) {
                 return true;
             }
         } else {
             // IPv4: require same /24
             if (ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) {
                 return true;
             }
         }
     }
     if (Context::getSessionStatus()) {
         $_SESSION['is_logged'] = false;
     }
     return false;
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:25,代码来源:member.model.php

示例4: setAccessible

 function setAccessible()
 {
     if (Context::getSessionStatus()) {
         $_SESSION['accessibled_comment'][$this->comment_srl] = TRUE;
     }
 }
开发者ID:kkkyyy03,项目名称:coffeemix,代码行数:6,代码来源:comment.item.php

示例5: updateReadedCount

 /**
  * Update read counts of the document
  * @param documentItem $oDocument
  * @return bool|void
  */
 function updateReadedCount(&$oDocument)
 {
     // Pass if Crawler access
     if (isCrawler()) {
         return false;
     }
     $document_srl = $oDocument->document_srl;
     $member_srl = $oDocument->get('member_srl');
     $logged_info = Context::get('logged_info');
     // Call a trigger when the read count is updated (before)
     $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     // Pass if read count is increaded on the session information
     if ($_SESSION['readed_document'][$document_srl]) {
         return false;
     }
     // Pass if the author's IP address is as same as visitor's.
     if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus()) {
         $_SESSION['readed_document'][$document_srl] = true;
         return false;
     }
     // Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
     if ($member_srl && $logged_info->member_srl == $member_srl) {
         $_SESSION['readed_document'][$document_srl] = true;
         return false;
     }
     $oDB = DB::getInstance();
     $oDB->begin();
     // Update read counts
     $args = new stdClass();
     $args->document_srl = $document_srl;
     $output = executeQuery('document.updateReadedCount', $args);
     // Call a trigger when the read count is updated (after)
     $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
     if (!$trigger_output->toBool()) {
         $oDB->rollback();
         return $trigger_output;
     }
     $oDB->commit();
     $oCacheHandler = CacheHandler::getInstance('object');
     if ($oCacheHandler->isSupport()) {
         //remove document item from cache
         $cache_key = 'document_item:' . getNumberingPath($document_srl) . $document_srl;
         $oCacheHandler->delete($cache_key);
     }
     // Register session
     if (!$_SESSION['banned_document'][$document_srl] && Context::getSessionStatus()) {
         $_SESSION['readed_document'][$document_srl] = true;
     }
     return TRUE;
 }
开发者ID:SoneYours,项目名称:rhymix,代码行数:58,代码来源:document.controller.php


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