本文整理汇总了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);
}