本文整理汇总了PHP中KunenaFactory::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaFactory::getSession方法的具体用法?PHP KunenaFactory::getSession怎么用?PHP KunenaFactory::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaFactory
的用法示例。
在下文中一共展示了KunenaFactory::getSession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($params)
{
static $cssadded = false;
require_once KUNENA_PATH_LIB . DS . 'kunena.link.class.php';
require_once KUNENA_PATH_LIB . DS . 'kunena.image.class.php';
require_once KUNENA_PATH_LIB . DS . 'kunena.timeformat.class.php';
require_once KUNENA_PATH_FUNCS . DS . 'latestx.php';
require_once JPATH_ADMINISTRATOR . '/components/com_kunena/libraries/html/parser.php';
$this->kunena_config = KunenaFactory::getConfig();
$this->myprofile = KunenaFactory::getUser();
// load Kunena main language file so we can leverage langaueg strings from it
KunenaFactory::loadLanguage();
// Initialize session
$session = KunenaFactory::getSession();
$session->updateAllowedForums();
$this->document = JFactory::getDocument();
$kloadcss = $params->get('kunena_load_css');
if ($cssadded == false && $kloadcss) {
$this->document->addStyleSheet(JURI::root() . 'modules/mod_kunenalatest/tmpl/css/kunenalatest.css');
$cssadded = true;
}
$this->latestdo = null;
if ($params->get('choosemodel') != 'latest') {
$this->latestdo = $params->get('choosemodel');
}
$this->params = $params;
$this->ktemplate = KunenaFactory::getTemplate();
$this->klistpost = modKunenaLatestHelper::getKunenaLatestList($params);
$this->topic_ordering = modKunenaLatestHelper::getTopicsOrdering($this->myprofile, $this->kunena_config);
require JModuleHelper::getLayoutPath('mod_kunenalatest');
}
示例2: display
public function display() {
static $cssadded = false;
require_once (KUNENA_PATH_LIB . DS . 'kunena.link.class.php');
require_once (KUNENA_PATH_LIB . DS . 'kunena.image.class.php');
require_once (KUNENA_PATH_LIB . DS . 'kunena.timeformat.class.php');
require_once (KUNENA_PATH_FUNCS . DS . 'latestx.php');
require_once (JPATH_ADMINISTRATOR . '/components/com_kunena/libraries/html/parser.php');
$this->kunena_config = KunenaFactory::getConfig ();
$this->myprofile = KunenaFactory::getUser ();
// load Kunena main language file so we can leverage langaueg strings from it
KunenaFactory::loadLanguage();
// Initialize session
$session = KunenaFactory::getSession ();
$session->updateAllowedForums();
$this->latestdo = null;
if ($this->params->get ( 'choosemodel' ) != 'latest') {
$this->latestdo = $this->params->get ( 'choosemodel' );
}
$this->ktemplate = KunenaFactory::getTemplate();
$this->klistpost = modKunenaLatestHelper::getKunenaLatestList ( $this->params );
$this->topic_ordering = modKunenaLatestHelper::getTopicsOrdering($this->myprofile, $this->kunena_config);
require (JModuleHelper::getLayoutPath ( 'mod_kunenalatest' ));
}
示例3: __construct
function __construct()
{
$this->_db =& JFactory::getDBO();
$this->_my =& JFactory::getUser();
$this->_config = KunenaFactory::getConfig();
$this->_session = KunenaFactory::getSession();
}
示例4: getNewTopics
static public function getNewTopics($catids) {
$session = KunenaFactory::getSession ();
if (!$session->userid || !KunenaFactory::getConfig()->shownew) {
return;
}
$readlist = $session->readtopics;
$prevCheck = $session->lasttime;
$categories = self::getCategories($catids);
$catlist = array();
foreach ($categories as $category) {
$catlist += $category->getChannels();
$catlist += $category->getChildren();
}
if (empty($catlist)) return;
$catlist = implode(',', array_keys($catlist));
$db = JFactory::getDBO ();
$query = "SELECT DISTINCT(category_id), COUNT(*) AS new
FROM #__kunena_topics
WHERE category_id IN ($catlist) AND hold='0' AND last_post_time>{$db->Quote($prevCheck)} AND id NOT IN ({$readlist})
GROUP BY category_id";
$db->setQuery ( $query );
$newlist = (array) $db->loadObjectList ('category_id');
if (KunenaError::checkDatabaseError()) return;
if (empty($newlist)) return;
$new = array();
foreach ($newlist AS $id=>$item) {
$new[$id] = (int) $item->new;
}
foreach ($categories as $category) {
$channels = $category->getChannels();
$channels += $category->getChildren();
$category->getNewCount(array_sum(array_intersect_key($new, $channels)));
}
}
示例5: __construct
function __construct()
{
$this->do = JRequest::getCmd('do', '');
$this->action = JRequest::getCmd('action', '');
$this->_app =& JFactory::getApplication();
$this->config = KunenaFactory::getConfig();
$this->_session = KunenaFactory::getSession();
$this->_db =& JFactory::getDBO();
$this->document = JFactory::getDocument();
require_once KPATH_SITE . '/lib/kunena.poll.class.php';
$this->poll =& CKunenaPolls::getInstance();
$this->my = JFactory::getUser();
$this->me = KunenaFactory::getUser();
$this->id = JRequest::getInt('id', 0);
if (!$this->id) {
$this->id = JRequest::getInt('parentid', 0);
}
if (!$this->id) {
// Support for old $replyto variable in post reply/quote
$this->id = JRequest::getInt('replyto', 0);
}
$this->catid = JRequest::getInt('catid', 0);
$this->msg_cat = null;
$this->allow = 1;
$this->cat_default_allow = null;
$this->allow_topic_icons = null;
$template = KunenaFactory::getTemplate();
$this->params = $template->params;
$this->numLink = null;
$this->replycount = null;
}
示例6: __construct
protected function __construct($db, $config)
{
$this->_db = $db;
$this->_my =& JFactory::getUser();
$this->_session = KunenaFactory::getSession();
$this->_allowed = $this->_session->allowed != '' ? explode(',', $this->_session->allowed) : array();
$this->_ResetErrorMessage();
$this->_config = $config;
}
示例7: __construct
protected function __construct($db, $config) {
$this->_db = $db;
$this->_my = &JFactory::getUser ();
$this->_me = KunenaUserHelper::getMyself();
$this->_session = KunenaFactory::getSession ();
// FIXME:
$this->_allowed = array();
$this->_ResetErrorMessage ();
$this->_config = $config;
}
示例8: __construct
function __construct($userid = null)
{
$this->_config = KunenaFactory::getConfig();
$this->_session = KunenaFactory::getSession();
$this->_db = JFactory::getDBO();
$this->_my = JFactory::getUser($userid);
$this->_myuser = KunenaFactory::getUser($userid);
$this->_app = JFactory::getApplication();
$this->setError('-load-', JText::_('COM_KUNENA_POSTING_NOT_LOADED'));
}
示例9: __construct
protected function __construct($db, $config) {
kimport('kunena.forum.category.helper');
$this->_db = $db;
$this->_my = &JFactory::getUser ();
$this->_me = KunenaFactory::getUser ();
$this->_session = KunenaFactory::getSession ();
// FIXME:
$this->_allowed = array();
$this->_ResetErrorMessage ();
$this->_config = $config;
}
示例10: isNew
public function isNew() {
static $readtopics = false;
if (!KunenaFactory::getConfig()->shownew) {
return false;
}
$session = KunenaFactory::getSession ();
if (!$session->userid)
return false;
if ($readtopics === false)
$readtopics = explode(',', $session->readtopics);
return $this->time > $session->lasttime && !in_array($this->thread, $readtopics);
}
示例11: __construct
function __construct($catid = null)
{
$this->_db = JFactory::getDBO();
$this->_my = JFactory::getUser();
$this->_session = KunenaFactory::getSession();
$this->_config = KunenaFactory::getConfig();
$this->_isimage = false;
$this->_isfile = false;
$me = KunenaUserHelper::getMyself();
$this->validImageExts = (array) KunenaForumMessageAttachmentHelper::getImageExtensions($catid, $me->userid);
$this->validFileExts = (array) KunenaForumMessageAttachmentHelper::getFileExtensions($catid, $me->userid);
$this->setImageResize(intval($this->_config->imagesize) * 1024, intval($this->_config->imagewidth), intval($this->_config->imageheight), intval($this->_config->imagequality));
}
示例12: __construct
function __construct() {
$this->_db = &JFactory::getDBO ();
$this->_my = &JFactory::getUser ();
$this->_session = &KunenaFactory::getSession ();
$this->_config = KunenaFactory::getConfig ();
$this->_isimage = false;
$this->_isfile = false;
$me = KunenaUserHelper::getMyself();
if (($me->isModerator()) || ($this->_my->id && $this->_config->allowimageregupload) || (!$this->_my->id && $this->_config->allowimageupload)) {
$this->validImageExts = explode ( ',', $this->_config->imagetypes );
}
if (($me->isModerator()) || ($this->_my->id && $this->_config->allowfileregupload) || (!$this->_my->id && $this->_config->allowfileupload)) {
$this->validFileExts = explode ( ',', $this->_config->filetypes );
}
$this->setImageResize(intval($this->_config->imagesize)*1024, intval($this->_config->imagewidth), intval($this->_config->imageheight), intval($this->_config->imagequality));
}
示例13: kunenaOnline
protected static function kunenaOnline()
{
// Kunena detection and version check
$minKunenaVersion = '1.6.3';
if (!class_exists('Kunena') || Kunena::versionBuild() < 4344) {
return false;
}
// Kunena online check
if (!Kunena::enabled()) {
return false;
}
// Initialize session
$session = KunenaFactory::getSession();
$session->updateAllowedForums();
return true;
}
示例14: markread
function markread() {
$app = JFactory::getApplication ();
if (! JRequest::checkToken ('request')) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->redirectBack ();
}
$catid = JRequest::getInt('catid', 0);
if (!$catid) {
// All categories
$session = KunenaFactory::getSession();
$session->markAllCategoriesRead ();
if (!$session->save ()) {
$app->enqueueMessage ( JText::_('COM_KUNENA_ERROR_SESSION_SAVE_FAILED'), 'error' );
} else {
$app->enqueueMessage ( JText::_('COM_KUNENA_GEN_ALL_MARKED') );
}
} else {
// One category
$category = KunenaForumCategoryHelper::get($catid);
if (!$category->authorise('read')) {
$app->enqueueMessage ( $category->getError(), 'error' );
$this->redirectBack ();
}
$db = JFactory::getDBO();
$session = KunenaFactory::getSession();
if ($session->userid) {
// Mark all unread topics in the category to read
$readTopics = $session->readtopics;
$db->setQuery ( "SELECT id FROM #__kunena_topics WHERE category_id={$db->quote($category->id)} AND id NOT IN ({$readTopics}) AND last_post_time>={$db->quote($session->lasttime)}" );
$readForum = $db->loadResultArray ();
if (KunenaError::checkDatabaseError()) $this->redirectBack ();
$readTopics = implode(',', array_merge(explode(',', $readTopics), $readForum));
$session->readtopics = $readTopics;
if (!$session->save ()) {
$app->enqueueMessage ( JText::_('COM_KUNENA_ERROR_SESSION_SAVE_FAILED'), 'error' );
} else {
$app->enqueueMessage ( JText::_('COM_KUNENA_GEN_FORUM_MARKED') );
}
}
}
$this->redirectBack ();
}
示例15: markread
function markread()
{
if (!JSession::checkToken('request')) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
$this->setRedirectBack();
return;
}
$catid = JRequest::getInt('catid', 0);
$children = JRequest::getBool('children', 0);
if (!$catid) {
// All categories
$session = KunenaFactory::getSession();
$session->markAllCategoriesRead();
if (!$session->save()) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_SESSION_SAVE_FAILED'), 'error');
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_GEN_ALL_MARKED'));
}
} else {
// One category
$category = KunenaForumCategoryHelper::get($catid);
if (!$category->authorise('read')) {
$this->app->enqueueMessage($category->getError(), 'error');
$this->setRedirectBack();
return;
}
$session = KunenaFactory::getSession();
if ($session->userid) {
$categories = array($category->id => $category);
if ($children) {
// Include all levels of child categories.
$categories += $category->getChildren(-1);
}
// Mark all unread topics in selected categories as read.
KunenaForumCategoryUserHelper::markRead(array_keys($categories));
if (count($categories) > 1) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_GEN_ALL_MARKED'));
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_GEN_FORUM_MARKED'));
}
}
}
$this->setRedirectBack();
}