本文整理汇总了PHP中KunenaFactory类的典型用法代码示例。如果您正苦于以下问题:PHP KunenaFactory类的具体用法?PHP KunenaFactory怎么用?PHP KunenaFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KunenaFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserListURL
public function getUserListURL($action='', $xhtml = true)
{
$config = KunenaFactory::getConfig ();
$my = JFactory::getUser();
if ( $config->userlist_allowed == 1 && $my->id == 0 ) return false;
return CRoute::_('index.php?option=com_community&view=search&task=browse', $xhtml);
}
示例2: getQueryWhere
public function getQueryWhere()
{
$where = '';
// Hide super admins from the list
if (!KunenaFactory::getConfig()->superadmin_userlist) {
$db = JFactory::getDBO();
$query = "SELECT user_id FROM `#__user_usergroup_map` WHERE group_id =8";
$db->setQuery($query);
$superadmins = (array) $db->loadColumn();
if (!$superadmins) {
$superadmins = array(0);
}
$this->setState('list.exclude', implode(',', $superadmins));
$where = ' u.id NOT IN (' . $this->getState('list.exclude') . ') AND ';
}
if ($this->config->userlist_count_users == '1') {
$where .= '(u.block=0 OR u.activation="")';
} elseif ($this->config->userlist_count_users == '2') {
$where .= '(u.block=0 AND u.activation="")';
} elseif ($this->config->userlist_count_users == '3') {
$where .= 'u.block=0';
} else {
$where .= '1';
}
return $where;
}
示例3: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->app = JFactory::getApplication();
$this->me = KunenaUserHelper::getMyself();
$this->config = KunenaFactory::getConfig();
}
示例4: before
/**
* Prepare login display.
*
* @return boolean
*/
protected function before()
{
parent::before();
$login = KunenaLogin::getInstance();
if (!$login->enabled()) {
return false;
}
$this->me = KunenaUserHelper::getMyself();
$this->name = $this->me->exists() ? 'Widget/Login/Logout' : 'Widget/Login/Login';
$this->my = JFactory::getUser();
if ($this->my->guest) {
$this->registrationUrl = $login->getRegistrationUrl();
$this->resetPasswordUrl = $login->getResetUrl();
$this->remindUsernameUrl = $login->getRemindUrl();
$this->rememberMe = $login->getRememberMe();
} else {
$this->lastvisitDate = KunenaDate::getInstance($this->my->lastvisitDate);
$private = KunenaFactory::getPrivateMessaging();
if ($private) {
$count = $private->getUnreadCount($this->me->userid);
$this->inboxCount = $count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX');
$this->pm_link = $private->getInboxURL();
}
// Display announcements.
if ($this->me->isModerator()) {
$this->announcementsUrl = KunenaForumAnnouncementHelper::getUrl('list');
}
}
return true;
}
示例5: __construct
public function __construct()
{
$this->config = KunenaFactory::getConfig();
$this->publickey = $this->config->recaptcha_publickey;
$this->privatekey = $this->config->recaptcha_privatekey;
$this->host = JRequest::getVar('REMOTE_ADDR', null, 'server');
}
示例6: testGetInstance
/**
* Test getInstance()
*
* @param KunenaForumCategoryUser $categoryuser
* @return KunenaForumCategoryUser
* @depends testCreate
*/
public function testGetInstance(KunenaForumCategoryUser $categoryuser)
{
$admin = KunenaFactory::getUser('admin');
$categoryuser2 = KunenaForumCategoryUser::getInstance($categoryuser->category_id, $admin->userid);
$this->assertSame($categoryuser, $categoryuser2);
return $categoryuser;
}
示例7: display
/**
* Display module contents.
*/
public final function display()
{
// Load CSS only once
if (static::$css) {
$this->document->addStyleSheet(JURI::root(true) . static::$css);
static::$css = null;
}
// Use caching also for registered users if enabled.
if ($this->params->get('owncache', 0)) {
/** @var $cache JCacheControllerOutput */
$cache = JFactory::getCache('com_kunena', 'output');
$me = KunenaFactory::getUser();
$cache->setLifeTime($this->params->get('cache_time', 180));
$hash = md5(serialize($this->params));
if ($cache->start("display.{$me->userid}.{$hash}", 'mod_kunenalatest')) {
return;
}
}
// Initialize Kunena.
KunenaForum::setup();
// Display module.
$this->_display();
// Store cached page.
if (isset($cache)) {
$cache->end();
}
}
示例8: testGet
/**
* Test get()
*/
public function testGet()
{
$admin = KunenaFactory::getUser('admin');
$categoryuser = KunenaForumCategoryUserHelper::get(0, $admin->userid);
$this->assertEquals(0, $categoryuser->category_id);
$this->assertEquals($admin->userid, $categoryuser->user_id);
}
示例9: _getURL
/**
* @param $user
* @param $sizex
* @param $sizey
*
* @return string
*/
protected function _getURL($user, $sizex, $sizey)
{
$user = KunenaFactory::getUser($user);
$avatar = $user->avatar;
$config = KunenaFactory::getConfig();
$path = KPATH_MEDIA . "/avatars";
$origPath = "{$path}/{$avatar}";
if (!is_file($origPath)) {
// If avatar does not exist use default image.
if ($sizex <= 90) {
$avatar = 's_nophoto.jpg';
} else {
$avatar = 'nophoto.jpg';
}
// Search from the template.
$template = KunenaFactory::getTemplate();
$origPath = JPATH_SITE . '/' . $template->getAvatarPath($avatar);
$avatar = $template->name . '/' . $avatar;
}
$dir = dirname($avatar);
$file = basename($avatar);
if ($sizex == $sizey) {
$resized = "resized/size{$sizex}/{$dir}";
} else {
$resized = "resized/size{$sizex}x{$sizey}/{$dir}";
}
// TODO: make timestamp configurable?
$timestamp = '';
if (!is_file("{$path}/{$resized}/{$file}")) {
KunenaImageHelper::version($origPath, "{$path}/{$resized}", $file, $sizex, $sizey, intval($config->avatarquality), KunenaImage::SCALE_INSIDE, intval($config->avatarcrop));
$timestamp = '?' . round(microtime(true));
}
return KURL_MEDIA . "avatars/{$resized}/{$file}{$timestamp}";
}
示例10: kunena_upgrade_200_configuration
function kunena_upgrade_200_configuration($parent) {
$config = KunenaFactory::getConfig ();
if ($config->allowimageupload >= 0) {
$config->image_upload = 'nobody';
if ($config->allowimageregupload == 1) {
$config->image_upload = 'registered';
}
if ($config->allowimageupload == 1) {
$config->image_upload = 'everybody';
}
$config->allowimageupload = $config->allowimageregupload = -1;
}
if ($config->allowfileupload >= 0) {
$config->file_upload = 'nobody';
if ($config->allowfileregupload == 1) {
$config->file_upload = 'registered';
}
if ($config->allowfileupload == 1) {
$config->file_upload = 'everybody';
}
$config->allowfileupload = $config->allowfileregupload = -1;
}
// Save configuration
$config->remove ();
$config->create ();
return array ('action' => '', 'name' => JText::_ ( 'COM_KUNENA_INSTALL_200_CONFIGURATION' ), 'success' => true );
}
示例11: _getURL
protected function _getURL($user, $sizex, $sizey)
{
$user = KunenaFactory::getUser($user);
// Get CUser object
$avatar=AwdwallHelperUser::getBigAvatar51($user->userid);
return $avatar;
}
示例12: displayDefault
function displayDefault() {
JToolBarHelper::title ( ' ', 'kunena.png' );
$this->config = KunenaFactory::getConfig ();
$this->versioncheck = $this->get('latestversion');
$this->display ();
}
示例13: displayList
function displayList($tpl = null) {
$this->app = JFactory::getApplication();
$this->config = KunenaFactory::getConfig();
$this->assignRef ( 'announcements', $this->get ( 'Announcements' ) );
$this->assignRef ( 'canEdit', $this->get ( 'CanEdit' ) );
$this->display();
}
示例14: before
/**
* Prepare message actions display.
*
* @return void
*/
protected function before()
{
parent::before();
$catid = $this->input->getInt('id');
$me = KunenaUserHelper::getMyself();
$this->category = KunenaForumCategory::getInstance($catid);
$token = JSession::getFormToken();
$task = "index.php?option=com_kunena&view=category&task=%s&catid={$catid}&{$token}=1";
$layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}";
$this->template = KunenaFactory::getTemplate();
$this->categoryButtons = new JObject();
// Is user allowed to post new topic?
if ($this->category->getNewTopicCategory()->exists()) {
$this->categoryButtons->set('create', $this->getButton(sprintf($layout, 'create'), 'create', 'topic', 'communication', true));
}
// Is user allowed to mark forums as read?
if ($me->exists()) {
$this->categoryButtons->set('markread', $this->getButton(sprintf($task, 'markread'), 'markread', 'category', 'user', true));
}
// Is user allowed to subscribe category?
if ($this->category->isAuthorised('subscribe')) {
$subscribed = $this->category->getSubscribed($me->userid);
if (!$subscribed) {
$this->categoryButtons->set('subscribe', $this->getButton(sprintf($task, 'subscribe'), 'subscribe', 'category', 'user', true));
} else {
$this->categoryButtons->set('unsubscribe', $this->getButton(sprintf($task, 'unsubscribe'), 'unsubscribe', 'category', 'user', true));
}
}
JPluginHelper::importPlugin('kunena');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onKunenaGetButtons', array('category.action', $this->categoryButtons, $this));
}
示例15: testGetInstance
/**
* Test getInstance()
*
* @param KunenaForumTopicUser $topicuser
* @return KunenaForumTopicUser
* @depends testCreate
*/
public function testGetInstance(KunenaForumTopicUser $topicuser)
{
$admin = KunenaFactory::getUser('admin');
$topicuser2 = KunenaForumTopicUser::getInstance($topicuser->topic_id, $admin->userid);
$this->assertSame($topicuser, $topicuser2);
return $topicuser;
}