Example #1
0
	protected function populateState() {
		$layout = $this->getCmd ( 'layout', 'default' );
		$this->setState ( 'layout', $layout );

		// Administrator state
		if ($layout == 'manage' || $layout == 'create' || $layout == 'edit') {
			return parent::populateState();
		}

		$app = JFactory::getApplication ();
		$this->config = KunenaFactory::getConfig ();
		$this->me = KunenaUserHelper::get();

		$active = $app->getMenu ()->getActive ();
		$active = $active ? (int) $active->id : 0;
		$catid = $this->getInt ( 'catid', 0 );
		$this->setState ( 'item.id', $catid );

		// List state information
		$value = $this->getUserStateFromRequest ( "com_kunena.category{$catid}_list_limit", 'limit', 0, 'int' );
		if ($value < 1) $value = $this->config->threads_per_page;
		$this->setState ( 'list.limit', $value );

		$value = $this->getUserStateFromRequest ( "com_kunena.category{$catid}_{$active}_list_ordering", 'filter_order', 'time', 'cmd' );
		//$this->setState ( 'list.ordering', $value );

		$value = $this->getUserStateFromRequest ( "com_kunena.category{$catid}_list_start", 'limitstart', 0, 'int' );
		$this->setState ( 'list.start', $value );

		$value = $this->getUserStateFromRequest ( "com_kunena.category{$catid}_{$active}_list_direction", 'filter_order_Dir', 'desc', 'word' );
		if ($value != 'asc')
			$value = 'desc';
		$this->setState ( 'list.direction', $value );
	}
Example #2
0
 /**
  * @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}";
 }
Example #3
0
	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)));
		}
	}
Example #4
0
	function displayDefault() {
		JToolBarHelper::title ( '&nbsp;', 'kunena.png' );
		$this->config = KunenaFactory::getConfig ();
		$this->versioncheck = $this->get('latestversion');

		$this->display ();
	}
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 );
}
Example #6
0
	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);
	}
Example #7
0
	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();
	}
Example #8
0
	function displayEdit() {
		$this->setToolBarEdit();
		$this->config = KunenaFactory::getConfig ();
		$this->user = $this->get('user');
		$this->sub = $this->get('subscriptions');
		$this->subscatslist = $this->get('catsubcriptions');
		$this->ipslist = $this->get('IPlist');

		$avatarint = KunenaFactory::getAvatarIntegration();
		$this->editavatar = is_a($avatarint, 'KunenaAvatarKunena') ? true : false;
		$this->avatar = $avatarint->getLink($this->user, '', 'profile');

		// make the select list for the moderator flag
		$yesnoMod [] = JHTML::_ ( 'select.option', '1', JText::_('COM_KUNENA_ANN_YES') );
		$yesnoMod [] = JHTML::_ ( 'select.option', '0', JText::_('COM_KUNENA_ANN_NO') );
		// build the html select list
		$this->selectMod = JHTML::_ ( 'select.genericlist', $yesnoMod, 'moderator', 'class="inputbox" size="2"', 'value', 'text', $this->user->moderator );
		// make the select list for the moderator flag
		$yesnoOrder [] = JHTML::_ ( 'select.option', '0', JText::_('COM_KUNENA_USER_ORDER_ASC') );
		$yesnoOrder [] = JHTML::_ ( 'select.option', '1', JText::_('COM_KUNENA_USER_ORDER_DESC') );
		// build the html select list
		$this->selectOrder = JHTML::_ ( 'select.genericlist', $yesnoOrder, 'neworder', 'class="inputbox" size="2"', 'value', 'text', $this->user->ordering );
		$this->modCats = $this->get('listmodcats');
		$this->selectRank = $this->get('listuserranks');
		$this->display();
	}
Example #9
0
 function warning($msg, $where = 'default')
 {
     if (JDEBUG || KunenaFactory::getConfig()->debug) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::sprintf('COM_KUNENA_WARNING_' . strtoupper($where), $msg), 'notice');
     }
 }
 function __construct()
 {
     $this->_db =& JFactory::getDBO();
     $this->_my =& JFactory::getUser();
     $this->_config = KunenaFactory::getConfig();
     $this->_session = KunenaFactory::getSession();
 }
Example #11
0
	public static function isDefault($template)
	{
		$config = KunenaFactory::getConfig ();
		$defaultemplate = $config->template;

		return $defaultemplate == $template ? 1 : 0;
	}
Example #12
0
	function displayDefault() {
		$this->setToolBarDefault();
		$this->lists = $this->get('Configlists');
		$this->config = KunenaFactory::getConfig ();

		$this->display ();
	}
Example #13
0
	public static function enabled() {
		if (!JComponentHelper::isEnabled ( 'com_kunena', true )) {
			return false;
		}
		$config = KunenaFactory::getConfig ();
		return !$config->board_offline;
	}
Example #14
0
	/**
	 * Method to get the RSS URL link with image
	 *
	 * @return string
	 */
	protected function getRSS()
	{
		$config = KunenaFactory::getConfig();

		if ($config->enablerss)
		{
			$mode = $config->rss_type;

			switch ($mode)
			{
				case 'topic' :
					$rss_type = 'mode=topics';
					break;
				case 'recent' :
					$rss_type = 'mode=replies';
					break;
				case 'post' :
					$rss_type = 'layout=posts';
					break;
			}

			return '<a href="' . KunenaRoute::_("index.php?option=com_kunena&view=topics&format=feed&layout=default&{$rss_type}", true) . '"><span class="icon-feed" title="' . JText::_('COM_KUNENA_CATEGORIES_LABEL_GETRSS') . '"></span></a>';
		}
		else
		{
			return null;
		}
	}
Example #15
0
 /**
  * @param object $subject
  * @param array  $params
  */
 public function __construct(&$subject, $params)
 {
     $this->app = JFactory::getApplication();
     // Do not register plug-in in administration.
     if ($this->app->isAdmin()) {
         return;
     }
     // If scope isn't articles or Kunena, do not register plug-in.
     if ($this->app->scope != 'com_content' && $this->app->scope != 'com_kunena') {
         return;
     }
     // Kunena detection and version check
     $minKunenaVersion = '3.0';
     if (!class_exists('KunenaForum') || !KunenaForum::isCompatible($minKunenaVersion)) {
         $this->loadLanguage();
         $this->app->enqueueMessage(JText::sprintf('PLG_KUNENADISCUSS_DEPENDENCY_FAIL', $minKunenaVersion));
         return;
     }
     // Kunena online check
     if (!KunenaForum::enabled()) {
         return;
     }
     // Initialize variables
     $this->db = JFactory::getDbo();
     $this->user = KunenaFactory::getUser();
     $this->config = KunenaFactory::getConfig();
     // Initialize plugin
     parent::__construct($subject, $params);
     $this->debug("Constructor called in {$this->app->scope}");
 }
Example #16
0
 public function getTopHits($limit = 0)
 {
     if (!$limit) {
         $limit = KunenaFactory::getConfig()->popusercount;
     }
     return (array) $this->_getTopHits($limit);
 }
 /**
  * @access public
  * @return void
  */
 public function __construct()
 {
     $this->_db = JFactory::getDBO();
     $this->_my = JFactory::getUser();
     $this->_config = KunenaFactory::getConfig();
     $this->_ResetErrorMessage();
 }
Example #18
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaFactory::getConfig();
 }
Example #19
0
 public function display($cachable = false, $urlparams = false)
 {
     // Redirect profile to integrated component if profile integration is turned on
     $redirect = 1;
     $active = $this->app->getMenu()->getActive();
     if (!empty($active)) {
         $params = $active->params;
         $redirect = $params->get('integration', 1);
     }
     if ($redirect && JRequest::getCmd('format', 'html') == 'html') {
         $profileIntegration = KunenaFactory::getProfile();
         $layout = JRequest::getCmd('layout', 'default');
         if ($profileIntegration instanceof KunenaProfileKunena) {
             // Continue
         } elseif ($layout == 'default') {
             $url = $this->me->getUrl(false);
         } elseif ($layout == 'list') {
             $url = $profileIntegration->getUserListURL('', false);
         }
         if (!empty($url)) {
             $this->setRedirect($url);
             return;
         }
     }
     $layout = JRequest::getCmd('layout', 'default');
     if ($layout == 'list') {
         if (KunenaFactory::getConfig()->userlist_allowed && JFactory::getUser()->guest) {
             $this->redirectBack();
         }
     }
     parent::display();
 }
Example #20
0
 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;
 }
Example #21
0
	public function __construct() {
		$this->integration = KunenaIntegration::getInstance ( 'jomsocial' );
		if (! $this->integration || ! $this->integration->isLoaded ())
			return;
		$this->priority = 40;
		$this->_config = KunenaFactory::getConfig ();
	}
Example #22
0
 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');
 }
Example #23
0
	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' ));
	}
Example #24
0
 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');
 }
function kunena_160_2010_05_30_timezone($parent)
{
    $result = null;
    $config = KunenaFactory::getConfig();
    $db = JFactory::getDbo();
    // We need to fix all timestamps to UTC (if not already done)
    if ($config->get('board_ofset', '0.00') != '0.00') {
        $timeshift = (double) date('Z') + (double) $config->get('board_ofset') * 3600;
        $db->setQuery("UPDATE #__kunena_categories SET time_last_msg = time_last_msg - {$timeshift}");
        $db->query();
        if ($db->getErrorNum()) {
            throw new KunenaInstallerException($db->getErrorMsg(), $db->getErrorNum());
        }
        $db->setQuery("UPDATE #__kunena_sessions SET lasttime = lasttime - {$timeshift}, currvisit  = currvisit  - {$timeshift}");
        $db->query();
        if ($db->getErrorNum()) {
            throw new KunenaInstallerException($db->getErrorMsg(), $db->getErrorNum());
        }
        $db->setQuery("UPDATE #__kunena_whoisonline SET time = time - {$timeshift}");
        $db->query();
        if ($db->getErrorNum()) {
            throw new KunenaInstallerException($db->getErrorMsg(), $db->getErrorNum());
        }
        $db->setQuery("UPDATE #__kunena_messages SET time = time - {$timeshift}, modified_time = modified_time - {$timeshift}");
        $db->query();
        if ($db->getErrorNum()) {
            throw new KunenaInstallerException($db->getErrorMsg(), $db->getErrorNum());
        }
        unset($config->board_ofset);
        $result = array('action' => '', 'name' => JText::sprintf('COM_KUNENA_INSTALL_160_TIMEZONE', sprintf('%+d:%02d', $timeshift / 3600, $timeshift / 60 % 60)), 'success' => true);
    }
    // Save configuration
    $config->save();
    return $result;
}
Example #26
0
	public function getUserListURL($action='', $xhtml = true)
	{
		$config = KunenaFactory::getConfig ();
		$my = JFactory::getUser();
		if ( $config->userlist_allowed == 1 && $my->id == 0  ) return false;
		return KunenaRoute::_('index.php?option=com_kunena&func=userlist'.$action, $xhtml);
	}
Example #27
0
 protected function _getURL($user, $sizex, $sizey)
 {
     $user = KunenaFactory::getUser($user);
     $avatar = $user->avatar;
     $config = KunenaFactory::getConfig();
     $path = KPATH_MEDIA . "/avatars";
     if (!is_file("{$path}/{$avatar}")) {
         // If avatar does not exist use default image
         if ($sizex <= 90) {
             $avatar = 's_nophoto.jpg';
         } else {
             $avatar = 'nophoto.jpg';
         }
     }
     $dir = dirname($avatar);
     $file = basename($avatar);
     if ($sizex == $sizey) {
         $resized = "resized/size{$sizex}/{$dir}";
     } else {
         $resized = "resized/size{$sizex}x{$sizey}/{$dir}";
     }
     if (!is_file("{$path}/{$resized}/{$file}")) {
         require_once KPATH_SITE . '/lib/kunena.image.class.php';
         CKunenaImageHelper::version("{$path}/{$avatar}", "{$path}/{$resized}", $file, $sizex, $sizey, intval($config->avatarquality));
     }
     return KURL_MEDIA . "avatars/{$resized}/{$file}";
 }
Example #28
0
 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;
 }
Example #29
0
 /**
  * Triggers CB events
  *
  * Current events: profileIntegration=0/1, avatarIntegration=0/1
  **/
 public static function trigger($event, &$params)
 {
     global $_PLUGINS;
     $config = KunenaFactory::getConfig();
     $params['config'] = $config;
     $_PLUGINS->loadPluginGroup('user');
     $_PLUGINS->trigger('kunenaIntegration', array($event, &$config, &$params));
 }
Example #30
0
	public function __construct() {
		$aup = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
		if (! file_exists ( $aup ))
			return;
		require_once ($aup);
		$this->priority = 50;
		$this->_config = KunenaFactory::getConfig ();
	}