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


PHP KunenaFactory::GetSession方法代码示例

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


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

示例1: buildWhere

 protected function buildWhere()
 {
     $db = JFactory::getDBO();
     $querystrings = array();
     foreach ($this->getSearchWords() as $searchword) {
         $searchword = $db->escape(JString::trim($searchword));
         if (empty($searchword)) {
             continue;
         }
         $not = '';
         $operator = ' OR ';
         if (substr($searchword, 0, 1) == '-' && strlen($searchword) > 1) {
             $not = 'NOT';
             $operator = 'AND';
             $searchword = JString::substr($searchword, 1);
         }
         if (!$this->getState('query.titleonly')) {
             $querystrings[] = "(t.message {$not} LIKE '%{$searchword}%' {$operator} m.subject {$not} LIKE '%{$searchword}%')";
         } else {
             $querystrings[] = "(m.subject {$not} LIKE '%{$searchword}%')";
         }
     }
     //User searching
     $username = $this->getState('query.searchuser');
     if ($username) {
         if ($this->getState('query.exactname') == '1') {
             $querystrings[] = "m.name LIKE '" . $db->escape($username) . "'";
         } else {
             $querystrings[] = "m.name LIKE '%" . $db->escape($username) . "%'";
         }
     }
     $time = 0;
     switch ($this->getState('query.searchdate')) {
         case 'lastvisit':
             $time = KunenaFactory::GetSession()->lasttime;
             break;
         case 'all':
             break;
         case '1':
         case '7':
         case '14':
         case '30':
         case '90':
         case '180':
         case '365':
             $time = time() - 86400 * intval($this->getState('query.searchdate'));
             //24*3600
             break;
         default:
             $time = time() - 86400 * 365;
     }
     if ($time) {
         if ($this->getState('query.beforeafter') == 'after') {
             $querystrings[] = "m.time > '{$time}'";
         } else {
             $querystrings[] = "m.time <= '{$time}'";
         }
     }
     $topic_id = $this->getState('query.topic_id');
     if ($topic_id) {
         $querystrings[] = "m.id = '{$topic_id}'";
     }
     return implode(' AND ', $querystrings);
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:64,代码来源:search.php


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