/** * Prepare menu display. * * @return bool */ protected function before() { parent::before(); $this->basemenu = $basemenu = KunenaRoute::getMenu(); if (!$basemenu) { return false; } $parameters = new JRegistry; $template = KunenaFactory::getTemplate(); $parameters->set('showAllChildren', $template->params->get('menu_showall', 0)); $parameters->set('menutype', $basemenu->menutype); $parameters->set('startLevel', $basemenu->level + 1); $parameters->set('endLevel', $basemenu->level + $template->params->get('menu_levels', 1)); $this->list = KunenaMenuHelper::getList($parameters); $this->menu = $this->app->getMenu(); $this->active = $this->menu->getActive(); $this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id; $this->path = isset($this->active) ? $this->active->tree : array(); $this->showAll = $parameters->get('showAllChildren'); $this->class_sfx = htmlspecialchars($parameters->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8'); return true; }
/** * @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}"; }
public function getRankspaths() { $template = KunenaFactory::getTemplate(); $selected = $this->getRank(); $rankpath = $template->getRankPath(); $files1 = (array) JFolder::Files(JPATH_SITE . '/' . $rankpath, false, false, false, array('index.php', 'index.html')); $files1 = (array) array_flip($files1); foreach ($files1 as $key => &$path) { $path = $rankpath . $key; } $rankpath = 'media/kunena/ranks/'; $files2 = (array) JFolder::Files(JPATH_SITE . '/' . $rankpath, false, false, false, array('index.php', 'index.html')); $files2 = (array) array_flip($files2); foreach ($files2 as $key => &$path) { $path = $rankpath . $key; } $rank_images = $files1 + $files2; ksort($rank_images); $rank_list = array(); foreach ($rank_images as $file => $path) { $rank_list[] = JHtml::_('select.option', $path, $file); } $list = JHtml::_('select.genericlist', $rank_list, 'rank_image', 'class="inputbox" onchange="update_rank(this.options[selectedIndex].value);" onmousemove="update_rank(this.options[selectedIndex].value);"', 'value', 'text', isset($selected->rank_image) ? $rank_images[$selected->rank_image] : ''); return $list; }
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; }
/** * Prepare user attachments list. * * @return void */ protected function before() { parent::before(); $userid = $this->input->getInt('userid'); $params = array('file' => '1', 'image' => '1', 'orderby' => 'desc', 'limit' => '30'); $this->template = KunenaFactory::getTemplate(); $this->me = KunenaUserHelper::getMyself(); $this->profile = KunenaUserHelper::get($userid); $this->attachments = KunenaAttachmentHelper::getByUserid($this->profile, $params); // Pre-load messages. $messageIds = array(); foreach ($this->attachments as $attachment) { $messageIds[] = (int) $attachment->mesid; } $messages = KunenaForumMessageHelper::getMessages($messageIds, 'none'); // Pre-load topics. $topicIds = array(); foreach ($messages as $message) { $topicIds[] = $message->thread; } KunenaForumTopicHelper::getTopics($topicIds, 'none'); $this->headerText = JText::_('COM_KUNENA_MANAGE_ATTACHMENTS'); }
function publish() { $cid = $this->app->input->get('cid', array(), 'method', 'array'); $id = array_shift($cid); if (!JSession::checkToken('post')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); return; } if ($id) { $this->config->template = $id; $this->config->save(); } $template = KunenaFactory::getTemplate($id); $template->clearCache(); $this->app->enqueueMessage(JText::_('COM_KUNENA_A_TEMPLATE_MANAGER_DEFAULT_SELECTED')); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); }
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' )); }
/** * 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)); }
public static function getEmoticons($grayscale = false, $emoticonbar = false) { $db = JFactory::getDBO (); $grayscale == true ? $column = "greylocation" : $column = "location"; $sql = "SELECT code, {$db->quoteName($column)} AS file FROM #__kunena_smileys"; if ($emoticonbar == true) { $sql .= " WHERE emoticonbar='1'"; } $db->setQuery ( $sql ); $smilies = $db->loadObjectList (); KunenaError::checkDatabaseError(); $smileyArray = array (); $template = KunenaFactory::getTemplate(); foreach ( $smilies as $smiley ) { // We load all smileys in array, so we can sort them $smileyArray [$smiley->code] = JUri::root(true) .'/'. $template->getSmileyPath($smiley->file); } if ($emoticonbar == 0) { // don't sort when it's only for use in the emoticonbar array_multisort ( array_keys ( $smileyArray ), SORT_DESC, $smileyArray ); reset ( $smileyArray ); } return $smileyArray; }
/** * Method to retrieve small category icon * * @param KunenaSubCategory $subcategory The KunenaCategory object * * @return string */ public function getSmallCategoryIcon($subcategory) { $this->ktemplate = KunenaFactory::getTemplate(); $defaultcategoryicon = $this->ktemplate->params->get('DefaultCategoryicon'); if ($subcategory->getNewCount()) { if (!empty($subcategory->icon)) { return '<i class="' . $subcategory->icon . ' icon-knewchar" alt="' . JText::_('COM_KUNENA_GEN_FORUM_NEWPOST') . '"> </i>'; } else { return '<i class="' . $defaultcategoryicon . ' icon-knewchar" alt="' . JText::_('COM_KUNENA_GEN_FORUM_NEWPOST') . '"> </i>'; } } else { if (!empty($subcategory->icon)) { return '<i class="' . $subcategory->icon . '" alt="' . JText::_('COM_KUNENA_GEN_FORUM_NEWPOST') . '"> </i>'; } else { return '<i class="' . $defaultcategoryicon . '" alt="' . JText::_('COM_KUNENA_GEN_FORUM_NEWPOST') . '"> </i>'; } } }
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'); }
public function getSmileyspaths() { $template = KunenaFactory::getTemplate(); $selected = $this->getSmiley(); $smileypath = $template->getSmileyPath(); $files1 = (array) KunenaFolder::Files(JPATH_SITE . '/' . $smileypath, false, false, false, array('index.php', 'index.html')); $files1 = (array) array_flip($files1); foreach ($files1 as $key => &$path) { $path = $smileypath . $key; } $smileypath = 'media/kunena/emoticons/'; $files2 = (array) KunenaFolder::Files(JPATH_SITE . '/' . $smileypath, false, false, false, array('index.php', 'index.html')); $files2 = (array) array_flip($files2); foreach ($files2 as $key => &$path) { $path = $smileypath . $key; } $smiley_images = $files1 + $files2; ksort($smiley_images); $smiley_list = array(); foreach ($smiley_images as $file => $path) { $smiley_list[] = JHtml::_('select.option', $path, $file); } $list = JHtml::_('select.genericlist', $smiley_list, 'smiley_url', 'class="inputbox" onchange="update_smiley(this.options[selectedIndex].value);" onmousemove="update_smiley(this.options[selectedIndex].value);"', 'value', 'text', !empty($selected->location) ? $smiley_images[$selected->location] : ''); return $list; }
/** * Prepare credits display. * * @return void */ protected function before() { parent::before(); $this->logo = KunenaFactory::getTemplate()->getImagePath('icons/kunena-logo-48-white.png'); $this->intro = JText::sprintf('COM_KUNENA_CREDITS_INTRO', 'http://www.kunena.org/team'); $this->memberList = array(array('name' => 'Florian Dal Fitto', 'url' => 'http://www.kunena.org/forum/user/1288-xillibit', 'title' => JText::_('COM_KUNENA_CREDITS_DEVELOPMENT')), array('name' => 'Jelle Kok', 'url' => 'http://www.kunena.org/forum/user/634-810', 'title' => JText::sprintf('COM_KUNENA_CREDITS_X_AND_Y', JText::_('COM_KUNENA_CREDITS_DEVELOPMENT'), JText::_('COM_KUNENA_CREDITS_DESIGN'))), array('name' => 'Richard Binder', 'url' => 'http://www.kunena.org/forum/user/2198-rich', 'title' => JText::sprintf('COM_KUNENA_CREDITS_X_AND_Y', JText::_('COM_KUNENA_CREDITS_MODERATION'), JText::_('COM_KUNENA_CREDITS_TESTING'))), array('name' => 'Sami Haaranen', 'url' => 'http://www.kunena.org/forum/user/151-mortti', 'title' => JText::sprintf('COM_KUNENA_CREDITS_X_AND_Y', JText::_('COM_KUNENA_CREDITS_MODERATION'), JText::_('COM_KUNENA_CREDITS_TESTING'))), array('name' => 'Matias Griese', 'url' => 'http://www.kunena.org/forum/user/63-matias', 'title' => JText::_('COM_KUNENA_CREDITS_DEVELOPMENT')), array('name' => 'Joshua Weiss', 'url' => 'http://www.kunena.org/forum/user/10809-coder4life', 'title' => JText::sprintf('COM_KUNENA_CREDITS_X_AND_Y', JText::_('COM_KUNENA_CREDITS_DESIGN'), JText::_('COM_KUNENA_CREDITS_DEVELOPMENT'))), array('name' => 'Oliver Ratzesberger', 'url' => 'http://www.kunena.org/forum/user/64-fxstein', 'title' => JText::_('COM_KUNENA_CREDITS_FOUNDER'))); $this->thanks = JText::sprintf('COM_KUNENA_CREDITS_THANKS', 'http://www.kunena.org/team#special_thanks', 'https://www.transifex.com/projects/p/Kunena', 'http://www.kunena.org', 'https://github.com/Kunena/Kunena-Forum/graphs/contributors'); }
function displayEdit() { $this->setToolBarEdit(); $this->state = $this->get('state'); $this->rank_selected = $this->get('rank'); $this->template = KunenaFactory::getTemplate(); $this->rankpath = $this->template->getRankPath(); $this->listranks = $this->get('Rankspaths'); $this->display (); }
function displayEdit() { $this->setToolBarEdit(); $this->state = $this->get('state'); $this->smiley_selected = $this->get('smiley'); $this->template = KunenaFactory::getTemplate(); $this->smileypath = $this->template->getSmileyPath(); $this->listsmileys = $this->get('Smileyspaths'); $this->display(); }
/** * Prepare topic reply form. * * @return void * * @throws RuntimeException * @throws KunenaExceptionAuthorise */ protected function before() { parent::before(); $catid = $this->input->getInt('catid'); $id = $this->input->getInt('id'); $mesid = $this->input->getInt('mesid'); $quote = $this->input->getBool('quote', false); $saved = $this->app->getUserState('com_kunena.postfields'); $this->me = KunenaUserHelper::getMyself(); $this->template = KunenaFactory::getTemplate(); if (!$mesid) { $this->topic = KunenaForumTopicHelper::get($id); $parent = KunenaForumMessageHelper::get($this->topic->first_post_id); } else { $parent = KunenaForumMessageHelper::get($mesid); $this->topic = $parent->getTopic(); } $this->category = $this->topic->getCategory(); if ($parent->isAuthorised('reply') && $this->me->canDoCaptcha()) { if (JPluginHelper::isEnabled('captcha')) { $plugin = JPluginHelper::getPlugin('captcha'); $params = new JRegistry($plugin[0]->params); $captcha_pubkey = $params->get('public_key'); $catcha_privkey = $params->get('private_key'); if (!empty($captcha_pubkey) && !empty($catcha_privkey)) { JPluginHelper::importPlugin('captcha'); $dispatcher = JDispatcher::getInstance(); $result = $dispatcher->trigger('onInit', 'dynamic_recaptcha_1'); $this->captchaEnabled = $result[0]; } } else { $this->captchaEnabled = false; } } $parent->tryAuthorise('reply'); // Run event. $params = new JRegistry(); $params->set('ksource', 'kunena'); $params->set('kunena_view', 'topic'); $params->set('kunena_layout', 'reply'); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('kunena'); $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0)); // Can user edit topic icons? if ($this->config->topicicons && $this->topic->isAuthorised('edit')) { $this->topicIcons = $this->template->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id); } list($this->topic, $this->message) = $parent->newReply($saved ? $saved : $quote); $this->action = 'post'; $this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category); $this->post_anonymous = $saved ? $saved['anonymous'] : !empty($this->category->post_anonymous); $this->subscriptionschecked = $saved ? $saved['subscribe'] : $this->config->subscriptionschecked == 1; $this->app->setUserState('com_kunena.postfields', null); $this->canSubscribe = $this->canSubscribe(); $this->headerText = JText::_('COM_KUNENA_BUTTON_MESSAGE_REPLY') . ' ' . $this->topic->subject; }
function __construct($total, $limitstart, $limit, $prefix = '') { // If out of range, use last page if ($total < (int) $limitstart) $limitstart = intval($total / $limit) * $limit; parent::__construct($total, $limitstart, $limit, $prefix); $this->setDisplay(); if ($limitstart === false) $this->set('pages.current', -1); $this->template = KunenaFactory::getTemplate(); }
public static function behavior() { static $loaded = false; if (!$loaded) { $template = KunenaFactory::getTemplate(); $document = JFactory::getDocument(); $document->addScript('media/kunena/js/plupload/plupload.js'); $document->addScript($template->getFile('uploader.js', false, 'js', 'media/kunena/js')); $loaded = true; } }
protected function populateState() { $app = JFactory::getApplication (); $this->me = KunenaUserHelper::get(); $config = KunenaFactory::getConfig (); $active = $app->getMenu ()->getActive (); $active = $active ? (int) $active->id : 0; $layout = $this->getWord ( 'layout', 'default' ); $layout = $this->me->getTopicLayout (); $this->setState ( 'layout', $layout ); $template = KunenaFactory::getTemplate(); $profile_location = $template->params->get('avatarPosition', 'left'); $profile_direction = $profile_location == 'left' || $profile_location == 'right' ? 'vertical' : 'horizontal'; $this->setState ( 'profile.location', $profile_location ); $this->setState ( 'profile.direction', $profile_direction ); $catid = $this->getInt ( 'catid', 0 ); $this->setState ( 'item.catid', $catid ); $id = $this->getInt ( 'id', 0 ); $this->setState ( 'item.id', $id ); $id = $this->getInt ( 'mesid', 0 ); $this->setState ( 'item.mesid', $id ); $access = KunenaFactory::getAccessControl(); $value = $access->getAllowedHold($this->me, $catid); $this->setState ( 'hold', $value ); $value = $this->getInt ( 'limit', 0 ); if ($value < 1) $value = $config->messages_per_page; $this->setState ( 'list.limit', $value ); $value = $this->getUserStateFromRequest ( "com_kunena.topic_{$active}_{$layout}_list_ordering", 'filter_order', 'time', 'cmd' ); //$this->setState ( 'list.ordering', $value ); $value = $this->getInt ( 'limitstart', 0 ); if ($value < 0) $value = 0; $this->setState ( 'list.start', $value ); $value = $this->getUserStateFromRequest ( "com_kunena.topic_{$active}_{$layout}_list_direction", 'filter_order_Dir', '', 'word' ); if (!$value) { if ($this->me->ordering != '0') { $value = $this->me->ordering == '1' ? 'desc' : 'asc'; } else { $value = $config->default_sort == 'asc' ? 'asc' : 'desc'; } } if ($value != 'asc') $value = 'desc'; $this->setState ( 'list.direction', $value ); }
public function getSize($sizex=90, $sizey=90) { $size = new StdClass(); $size->x = intval($sizex); $size->y = intval($sizey); if (!intval($sizex)) { $template = KunenaFactory::getTemplate(); $name = ucfirst(strtolower($sizex)); $size->x = intval($template->params->get('avatarSizeX'.$name, 90)); $size->y = intval($template->params->get('avatarSizeY'.$name, 90)); } return $size; }
/** * Template initialization. * * @return void */ public function initialize() { // Template requires Bootstrap javascript JHtml::_('bootstrap.framework'); JHtml::_('bootstrap.tooltip', '[data-toggle="tooltip"]'); // Template also requires jQuery framework. JHtml::_('jquery.framework'); JHtml::_('bootstrap.modal'); // Load JavaScript. $this->addScript('main.js'); // Compile CSS from LESS files. $this->compileLess('crypsis.less', 'kunena.css'); $this->addStyleSheet('kunena.css'); $filename = JPATH_SITE . '/components/com_kunena/template/crypsis/css/custom.css'; if (file_exists($filename)) { $this->addStyleSheet('custom.css'); } $this->ktemplate = KunenaFactory::getTemplate(); $fontawesome = $this->ktemplate->params->get('fontawesome'); if ($fontawesome) { ?> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <?php } // Load template colors settings $styles = <<<EOF \t\t/* Kunena Custom CSS */ EOF; $iconcolor = $this->ktemplate->params->get('IconColor'); if ($iconcolor) { $styles .= <<<EOF \t\t.layout#kunena [class*="category"] i, \t\t.layout#kunena .glyphicon-topic, \t\t.layout#kunena h3 i, \t\t.layout#kunena #kwho i.icon-users, \t\t.layout#kunena#kstats i.icon-bars { color: {$iconcolor}; } EOF; } $iconcolornew = $this->ktemplate->params->get('IconColorNew'); if ($iconcolornew) { $styles .= <<<EOF \t\t.layout#kunena [class*="category"] .icon-knewchar { color: {$iconcolornew} !important; } \t\t.layout#kunena sup.knewchar { color: {$iconcolornew} !important; } \t\t.layout#kunena .topic-item-unread { border-left-color: {$iconcolornew} !important;} \t\t.layout#kunena .topic-item-unread .icon { color: {$iconcolornew} !important;} \t\t.layout#kunena .topic-item-unread i.fa { color: {$iconcolornew} !important;} EOF; } $document = JFactory::getDocument(); $document->addStyleDeclaration($styles); parent::initialize(); }
public function initialize() { $this->loadMootools(); $rtl = JFactory::getLanguage()->isRTL(); $template = KunenaFactory::getTemplate(); $this->params = $template->params; $this->addScript ( 'js/default.js' ); $this->addScript ( 'js/tabcontent.js' ); $this->addScript ( 'js/switchcontent.js' ); if ( KunenaFactory::getConfig()->lightbox == 1 ) { $this->addScript( 'js/mediaboxAdv.js' ); $this->addStyleSheet ( 'css/mediaboxAdv.css'); } $this->addStyleSheet ( 'css/global.css' ); $this->addStyleSheet ( 'css/common.css' ); $this->addStyleSheet ( 'css/images.css' ); $this->addStyleSheet ( 'css/colours.css' ); $this->addStyleSheet ( 'css/category.css' ); $this->addStyleSheet ( 'css/editor.css' ); $this->addStyleSheet ( 'css/login.css' ); $this->addStyleSheet ( 'css/menu.css' ); $this->addStyleSheet ( 'css/moderation.css' ); $this->addStyleSheet ( 'css/misc.css' ); $this->addStyleSheet ( 'css/search.css' ); $this->addStyleSheet ( 'css/topic.css' ); $this->addStyleSheet ( 'css/topics.css' ); $this->addStyleSheet ( 'css/user.css' ); $this->addStyleSheet ( 'css/direction.css', $rtl ); $lang =& JFactory::getLanguage(); $lang->load( 'com_kunena.tpl_'.$template->name, KPATH_SITE.DS.'template'.DS.$template->name.'/' ); if (version_compare(JVERSION, '1.6','>')) { $this->addStyleSheet ( 'css/j16plus.css' ); include dirname(__FILE__).'/styles/j17style.php'; } include dirname(__FILE__).'/styles/preset.php'; include dirname(__FILE__).'/styles/style.php'; $document = JFactory::getDocument(); $document->addScriptDeclaration('// <![CDATA[ var kunena_toggler_close = "'.JText::_('COM_KUNENA_TOGGLER_COLLAPSE').'"; var kunena_toggler_open = "'.JText::_('COM_KUNENA_TOGGLER_EXPAND').'"; // ]]>'); }
/** * Prepare AJAX display. * * @return void */ protected function before() { // Load language files. KunenaFactory::loadLanguage('com_kunena.sys', 'admin'); KunenaFactory::loadLanguage('com_kunena.templates'); KunenaFactory::loadLanguage('com_kunena.models'); KunenaFactory::loadLanguage('com_kunena.views'); $this->me = KunenaUserHelper::getMyself(); $this->config = KunenaConfig::getInstance(); $this->document = JFactory::getDocument(); $this->template = KunenaFactory::getTemplate(); $this->template->initialize(); }
/** * Send list of topic icons in JSON for the category set selected * * @return string */ public function displayTopicIcons() { jimport('joomla.filesystem.folder'); $catid = $this->app->input->getInt('catid', 0); $category = KunenaForumCategoryHelper::get($catid); $category_iconset = $category->iconset; if (empty($category_iconset)) { $response = array(); // Set the MIME type and header for JSON output. $this->document->setMimeEncoding('application/json'); JResponse::setHeader('Content-Disposition', 'attachment; filename="' . $this->getName() . '.' . $this->getLayout() . '.json"'); echo json_encode($response); } $topicIcons = array(); $template = KunenaFactory::getTemplate(); $xmlfile = JPATH_ROOT . '/media/kunena/topic_icons/' . $category_iconset . '/topicicons.xml'; if (is_file($xmlfile)) { $xml = simplexml_load_file($xmlfile); foreach ($xml->icons as $icons) { $type = (string) $icons->attributes()->type; $width = (int) $icons->attributes()->width; $height = (int) $icons->attributes()->height; foreach ($icons->icon as $icon) { $attributes = $icon->attributes(); $icon = new stdClass(); $icon->id = (int) $attributes->id; $icon->type = (string) $attributes->type ? (string) $attributes->type : $type; $icon->name = (string) $attributes->name; if ($icon->type != 'user') { $icon->id = $icon->type . '_' . $icon->name; } $icon->iconset = $category_iconset; $icon->published = (int) $attributes->published; $icon->title = (string) $attributes->title; $icon->b2 = (string) $attributes->b2; $icon->b3 = (string) $attributes->b3; $icon->fa = (string) $attributes->fa; $icon->filename = (string) $attributes->src; $icon->width = (int) $attributes->width ? (int) $attributes->width : $width; $icon->height = (int) $attributes->height ? (int) $attributes->height : $height; $icon->path = JURI::root() . 'media/kunena/topic_icons/' . $category_iconset . '/' . $icon->filename; $icon->relpath = $template->getTopicIconPath("{$icon->filename}", false, $category_iconset); $topicIcons[] = $icon; } } } // Set the MIME type and header for JSON output. $this->document->setMimeEncoding('application/json'); JResponse::setHeader('Content-Disposition', 'attachment; filename="' . $this->getName() . '.' . $this->getLayout() . '.json"'); echo json_encode($topicIcons); }
protected function generate() { require_once KPATH_SITE.'/lib/kunena.link.class.php'; if (!isset($this->_shorttype)) { $this->_shorttype = $this->isImage($this->filetype) ? 'image' : $this->filetype; $this->_shortname = KunenaForumMessageAttachmentHelper::shortenFileName($this->filename); $config = KunenaFactory::getConfig(); $this->_imagelink = null; $template = KunenaFactory::getTemplate(); switch (strtolower ( $this->_shorttype )) { case 'image' : // Check for thumbnail and if available, use for display if (file_exists ( JPATH_ROOT . '/' . $this->folder . '/thumb/' . $this->filename )) { $thumb = $this->folder . '/thumb/' . $this->filename; $imgsize = ''; } else { $thumb = $this->folder . '/' . $this->filename; $imgsize = 'width="' . $config->thumbwidth . 'px" height="' . $config->thumbheight . 'px"'; } $img = '<img title="' . $this->escape ( $this->filename ) . '" ' . $imgsize . ' src="' . JURI::ROOT () . $thumb . '" alt="' . $this->escape ( $this->filename ) . '" />'; $this->_thumblink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $img, $this->escape ( $this->filename ), ($config->lightbox)? 'lightbox[thumb' . intval ( $this->mesid ). ']':'' ); $img = '<img title="' . $this->escape ( $this->filename ) . '" src="' . JURI::ROOT () . $this->escape ( $this->folder ) . '/' . $this->escape ( $this->filename ) . '" alt="' . $this->escape ( $this->filename ) . '" />'; $this->_imagelink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $img, $this->escape ( $this->filename ), ($config->lightbox)?'lightbox[imagelink' . intval ( $this->mesid ) .']':'' ); $this->_textLink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $this->escape ( $this->_shortname ), $this->escape ( $this->filename ), ($config->lightbox)?'lightbox[simple' . $this->mesid . ']' . ' nofollow':' nofollow' ) . ' (' . number_format ( intval ( $this->size ) / 1024, 0, '', ',' ) . 'KB)'; break; default : // Filetype without thumbnail or icon support - use default file icon $img = '<img src="' . $template->getImagePath('icons/attach_generic.png') . '" alt="' . JText::_ ( 'COM_KUNENA_ATTACH' ) . '" />'; $this->_thumblink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $img, $this->escape ( $this->filename ), 'nofollow' ); $this->_textLink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $this->escape ( $this->_shortname ), $this->escape ( $this->filename ), 'nofollow' ) . ' (' . number_format ( intval ( $this->size ) / 1024, 0, '', ',' ) . 'KB)'; } $this->_disabled = false; if (! KunenaUserHelper::getMyself()->exists()) { if ($this->_shorttype == 'image' && ! $config->showimgforguest) { $this->_disabled = true; $this->_textLink = JText::_ ( 'COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG' ); } if ($this->_shorttype != 'image' && ! $config->showfileforguest) { $this->_disabled = true; $this->_textLink = JText::_ ( 'COM_KUNENA_SHOWIMGFORGUEST_HIDEFILE' ); } if ($this->_disabled) { $this->_thumblink = '<img src="' . $template->getImagePath('icons/attach_generic.png') . '" alt="' . JText::_ ( 'COM_KUNENA_ATTACH' ) . '" />'; $this->_imagelink = null; $this->size = 0; } } } }
/** * Method to return array of actions sublayout * * @return array */ public function getCategoryActions() { $category = $this->category; $token = '&' . JSession::getFormToken() . '=1'; $actions = array(); // Is user allowed to post new topic? $url = $category->getNewTopicUrl(); $this->ktemplate = KunenaFactory::getTemplate(); $topicicontype = $this->ktemplate->params->get('topicicontype'); if ($category->getNewTopicCategory()->exists()) { if ($url && $topicicontype == 'B3') { $actions['create'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'create', 'scope' => 'topic', 'type' => 'communication', 'success' => true, 'icon' => 'glyphicon glyphicon-edit glyphicon-white')); } else { $actions['create'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'create', 'scope' => 'topic', 'type' => 'communication', 'success' => true, 'icon' => 'icon-edit icon-white')); } } if ($category->getTopics() > 0) { // Is user allowed to mark forums as read? $url = $category->getMarkReadUrl(); if ($this->me->exists() && $this->total) { if ($url && $topicicontype == 'B3') { $actions['markread'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'markread', 'scope' => 'category', 'type' => 'user', 'icon' => 'glyphicon glyphicon-check')); } else { $actions['markread'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'markread', 'scope' => 'category', 'type' => 'user', 'icon' => 'icon-drawer')); } } // Is user allowed to subscribe category? if ($category->isAuthorised('subscribe')) { $subscribed = $category->getSubscribed($this->me->userid); if ($url && $topicicontype == 'B3') { if (!$subscribed) { $url = "index.php?option=com_kunena&view=category&task=subscribe&catid={$category->id}{$token}"; $actions['subscribe'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'subscribe', 'scope' => 'category', 'type' => 'user', 'icon' => 'glyphicon glyphicon-bookmark')); } else { $url = "index.php?option=com_kunena&view=category&task=unsubscribe&catid={$category->id}{$token}"; $actions['unsubscribe'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'unsubscribe', 'scope' => 'category', 'type' => 'user')); } } else { if (!$subscribed) { $url = "index.php?option=com_kunena&view=category&task=subscribe&catid={$category->id}{$token}"; $actions['subscribe'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'subscribe', 'scope' => 'category', 'type' => 'user', 'icon' => 'icon-bookmark')); } else { $url = "index.php?option=com_kunena&view=category&task=unsubscribe&catid={$category->id}{$token}"; $actions['unsubscribe'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'unsubscribe', 'scope' => 'category', 'type' => 'user')); } } } } return $actions; }
/** * Template initialization. * * @return void */ public function initialize() { // Template requires Bootstrap javascript // Template also requires jQuery framework. // Load JavaScript. // Compile CSS from LESS files. if (jimport('jproofless.jproofless')) { $jproofLess = JProofLess::getInstance(); $cssFile = KPATH_MEDIA . "/cache/{$this->name}/css/" . $this->name . '.css'; $lessFile = KPATH_COMPONENT_RELATIVE . "/template/{$this->name}/less/{$this->name}.less"; $extraStyle = JPATH_SITE . '/components/com_kunena/template/crypsis/css/custom.css'; $jproofLess->setCssFile($cssFile)->setLessFile($lessFile)->setVariables($this->style_variables)->useStrategy('missingcss')->setExtraContent($extraStyle); $class = $this; $jproofLess->getLess()->registerFunction('url', function ($arg) use($class) { list($type, $q, $values) = $arg; $value = reset($values); return "url({$q}{$class->getFile($value, true, 'media', 'media/kunena')}{$q})"; }); // Load template colors settings $this->ktemplate = KunenaFactory::getTemplate(); $styles = <<<EOF \t\t/* Kunena Custom CSS */ EOF; $iconcolor = $this->ktemplate->params->get('IconColor'); if ($iconcolor) { $styles .= <<<EOF \t\t.layout#kunena [class*="category"] i, \t\t.layout#kunena #kwho i.icon-users, \t\t.layout#kunena#kstats i.icon-bars { color: {$iconcolor}; } EOF; } $iconcolornew = $this->ktemplate->params->get('IconColorNew'); if ($iconcolornew) { $styles .= <<<EOF \t\t.layout#kunena [class*="category"] .icon-knewchar { color: {$iconcolornew} !important; } \t\t.layout#kunena sup.knewchar { color: {$iconcolornew} !important; } \t\t.layout#kunena .topic-item-unread { border-left-color: {$iconcolornew} !important; } EOF; } $jproofLess->setExtraContent($styles); $jproofLess->autoCompile(); } else { // adding an Log message if it is an good choice to install the JProofLess JLog::add('JProofLess is missing: ' . __FILE__ . ' @see <a target="_blank" href="http://wiki.jproof.de/projects/joomla-library-jproof-less/wiki"><b>Wiki</b></a>', JLog::NOTICE); // Adding each time the regular already rendered css into the template if the LessCompiler not found //JFactory::getDocument()->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/template.css'); } parent::initialize(); }
/** * @param $filename * * @return JDocument */ public static function addStyleSheet($filename) { $document = JFactory::getDocument(); $config = KunenaFactory::getConfig(); $template = KunenaFactory::getTemplate(); if ($template->name != 'default') { $filename = preg_replace('#/com_kunena/template/default#', '/com_kunena/template/blue_eagle', $filename); } $filename = preg_replace('#^.*/(mediaboxAdv(-min)?.css)$#', KUNENA_DIRECTURL . 'template/blue_eagle/css/\\1', $filename); if (JDEBUG || $config->debug || KunenaForum::isDev()) { // If we are in debug more, make sure we load the unpacked css $filename = preg_replace('/\\-min\\./u', '.', $filename); } return $document->addStyleSheet($filename); }
public function getRankspaths() { $template = KunenaFactory::getTemplate(); if ($this->getState('item.id')) { $selected = $this->getRank(); } $rankpath = $template->getRankPath(); $rank_images = (array) JFolder::Files(JPATH_SITE . '/' . $rankpath, false, false, false, array('index.php', 'index.html')); $rank_list = array(); $i = 0; foreach ($rank_images as $id => $row) { $rank_list[] = JHTML::_('select.option', $rank_images[$id], $rank_images[$id]); } $list = JHTML::_('select.genericlist', $rank_list, 'rank_image', 'class="inputbox" onchange="update_rank(this.options[selectedIndex].value);" onmousemove="update_rank(this.options[selectedIndex].value);"', 'value', 'text', isset($selected) ? $selected->rank_image : ''); return $list; }
public static function addScript($filename) { $document = JFactory::getDocument(); $config = KunenaFactory::getConfig(); $template = KunenaFactory::getTemplate(); // Replace edit.js and mediaboxAdv.js with the new version of the file $filename = preg_replace('#^.*/(editor(-min)?.js)$#', KUNENA_DIRECTURL . 'template/blue_eagle/js/\\1', $filename); $filename = preg_replace('#^.*/(mediaboxAdv(-min)?.js)$#', JURI::root(true) . '/media/kunena/js/\\1', $filename); // Replace everything else that points to default template with media $filename = preg_replace('#/components/com_kunena/template/default/js/#', '/media/kunena/js/', $filename); if (JDEBUG || $config->debug || KunenaForum::isDev()) { // If we are in debug more, make sure we load the unpacked javascript $filename = preg_replace('/\\-min\\./u', '.', $filename); } return $document->addScript($filename); }