function _load_rules() { $app = JFactory::getApplication(); $db = JFactory::getDBO(); $total = 0; $filter_category = $app->getUserStateFromRequest('com_alphauserpoints' . '.filter_category', 'filter_category', 'all', 'word'); // Get the pagination request variables $limit = $app->getUserStateFromRequest('com_alphauserpoints.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitstart = JFactory::getApplication()->input->get('limitstart', 0, 'int'); // In case limit has been changed, adjust limitstart accordingly $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; if ($filter_category != 'all') { $filter = "WHERE r.category = '{$filter_category}'"; } else { $filter = ""; } // check if Kunena forum is installed to show pre-installed rules for Kunena // Dectects Kunena 2.0+ if (class_exists('KunenaForum') && KunenaForum::enabled()) { $filter != '' ? $filter .= " AND " : ($filter .= "WHERE "); $filter .= "(r.plugin_function!='plgaup_newtopic_kunena' AND r.plugin_function!='plgaup_reply_kunena' )"; // Detects Kunena 1.6 and 1.7 } elseif (class_exists('Kunena') && Kunena::enabled()) { if (substr(Kunena::version(), 0, 3) == '1.7') { $filter != '' ? $filter .= " AND " : ($filter .= "WHERE "); $filter .= "(r.plugin_function!='plgaup_newtopic_kunena' AND r.plugin_function!='plgaup_reply_kunena' )"; } else { $filter != '' ? $filter .= " AND " : ($filter .= "WHERE "); $filter .= "(r.plugin_function!='plgaup_kunena_topic_create' AND r.plugin_function!='plgaup_kunena_topic_reply' AND r.plugin_function!='plgaup_kunena_message_delete' AND r.plugin_function!='plgaup_kunena_message_thankyou')"; } } // end check Kunena pre_installed rules $query = "SELECT r.*, g.title AS groupname FROM #__alpha_userpoints_rules AS r LEFT JOIN #__viewlevels AS g ON g.id=r.access " . $filter . " ORDER BY r.category"; $total = @$this->_getListCount($query); $result = $this->_getList($query, $limitstart, $limit); $lists = array(); $options[] = JHTML::_('select.option', '', JText::_('AUP_NONE')); $options[] = JHTML::_('select.option', 'us', JText::_('AUP_CAT_USER')); $options[] = JHTML::_('select.option', 'co', JText::_('AUP_CAT_COMMUNITY')); $options[] = JHTML::_('select.option', 'ar', JText::_('AUP_CAT_ARTICLE')); $options[] = JHTML::_('select.option', 'li', JText::_('AUP_CAT_LINK')); $options[] = JHTML::_('select.option', 'po', JText::_('AUP_CAT_POLL_QUIZZ')); $options[] = JHTML::_('select.option', 're', JText::_('AUP_CAT_RECOMMEND_INVITE')); $options[] = JHTML::_('select.option', 'fo', JText::_('AUP_CAT_COMMENT_FORUM')); $options[] = JHTML::_('select.option', 'vi', JText::_('AUP_CAT_VIDEO')); $options[] = JHTML::_('select.option', 'ph', JText::_('CAT_CAT_PHOTO')); $options[] = JHTML::_('select.option', 'mu', JText::_('AUP_CAT_MUSIC')); $options[] = JHTML::_('select.option', 'sh', JText::_('AUP_CAT_SHOPPING')); $options[] = JHTML::_('select.option', 'pu', JText::_('AUP_CAT_PURCHASING')); $options[] = JHTML::_('select.option', 'cd', JText::_('AUP_CAT_COUPON_CODE')); $options[] = JHTML::_('select.option', 'su', JText::_('AUP_CAT_SUBSCRIPTION')); $options[] = JHTML::_('select.option', 'sy', JText::_('AUP_CAT_SYSTEM')); $options[] = JHTML::_('select.option', 'ot', JText::_('AUP_CAT_OTHER')); $options[] = JHTML::_('select.option', 'all', JText::_('AUP_ALL')); $lists['filter_category'] = JHTML::_('select.genericlist', $options, 'filter_category', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter_category); return array($result, $total, $limit, $limitstart, $lists); }
function installLanguage($parent, $tag, $name) { $exists = false; $success = true; $source = $parent->getParent()->getPath('source') . '/language'; $destinations = array('site' => JPATH_SITE . '/components/com_kunena', 'admin' => JPATH_ADMINISTRATOR . '/components/com_kunena'); $version = Kunena::version(); $file = "com_kunena.en-GB.site_v{$version}"; if (file_exists("{$source}/{$file}.zip")) { $ext = "zip"; } elseif (file_exists("{$source}/{$file}.tar")) { $ext = "tar"; } elseif (file_exists("{$source}/{$file}.tar.gz")) { $ext = "tar.gz"; } elseif (file_exists("{$source}/{$file}.tar.bz2")) { $ext = "tar.bz2"; } foreach ($destinations as $key => $dest) { if ($success != true) { continue; } // If we are installing Kunena from archive, we need to unzip language file $file = "{$source}/com_kunena.{$tag}.{$key}_v{$version}.{$ext}"; $installdir = "{$dest}/language/{$tag}"; if (file_exists($file)) { if (!JFolder::exists($installdir)) { $success = JFolder::create($installdir); } if ($success) { $success = JArchive::extract($file, $installdir); } } // Install language from dest/language/xx-XX if ($success == true && is_dir($installdir)) { $exists = true; // Older versions installed language files into main folders // Those files need to be removed to bring language up to date! jimport('joomla.filesystem.folder'); $files = JFolder::files($installdir, '\\.ini$'); foreach ($files as $filename) { if (file_exists(JPATH_SITE . "/language/{$tag}/{$filename}")) { JFile::delete(JPATH_SITE . "/language/{$tag}/{$filename}"); } if (file_exists(JPATH_ADMINISTRATOR . "/language/{$tag}/{$filename}")) { JFile::delete(JPATH_ADMINISTRATOR . "/language/{$tag}/{$filename}"); } } } } if ($exists && $name) { return sprintf('Installing %s - %s ... ', $tag, $name) . ($success ? sprintf('%s DONE %s', '<span style="color:darkgreen">', '</span>') : sprintf('%s FAILED %s', '<span style="color:darkred">', '</span>')) . '<br />'; } }
public static function buildVersion() { if (self::$version === false) { if ('@kunenaversion@' == '@' . 'kunenaversion' . '@') { $changelog = file_get_contents(KPATH_SITE . '/CHANGELOG.php', NULL, NULL, 0, 1000); preg_match('|\\$Id\\: CHANGELOG.php (\\d+) (\\S+) (\\S+) (\\S+) \\$|', $changelog, $svn); preg_match('|~~\\s+Kunena\\s(\\d+\\.\\d+.\\d+\\S*)|', $changelog, $version); } self::$version = '@kunenaversion@' == '@' . 'kunenaversion' . '@' ? strtoupper($version[1] . '-SVN') : strtoupper('@kunenaversion@'); self::$version_date = '@kunenaversiondate@' == '@' . 'kunenaversiondate' . '@' ? $svn[2] : '@kunenaversiondate@'; self::$version_name = '@kunenaversionname@' == '@' . 'kunenaversionname' . '@' ? 'SVN Revision' : '@kunenaversionname@'; self::$version_build = '@kunenaversionbuild@' == '@' . 'kunenaversionbuild' . '@' ? $svn[1] : '@kunenaversionbuild@'; } return self::$version; }
/** * Submits an HTTP POST to a reCAPTCHA server * @param string $path * @param array $data * @param int port * @return array response */ private function _query($path, $data, $port = 80) { $req = $this->_encode($data); $host = 'www.google.com'; $http_request = "POST {$path} HTTP/1.0\r\n"; $http_request .= "Host: {$host}\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($req) . "\r\n"; $http_request .= "User-Agent: Kunena Forum/" . Kunena::version() . "\r\n"; $http_request .= "\r\n"; $http_request .= $req; $response = ''; if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { return null; } fwrite($fs, $http_request); while (!feof($fs)) { $response .= fgets($fs, 1160); } // One TCP-IP packet fclose($fs); $response = explode("\r\n\r\n", $response, 2); return $response; }
function checkLatestVersion() { $latestVersion = getLatestKunenaVersion(); if ($latestVersion['connect']) { if (version_compare($latestVersion['latest_version'], Kunena::version(), '<=')) { $needUpgrade = JText::sprintf('COM_KUNENA_COM_A_CHECK_VERSION_CORRECT', Kunena::version()); } else { $needUpgrade = JText::sprintf('COM_KUNENA_COM_A_CHECK_VERSION_NEED_UPGRADE', $latestVersion['latest_version'], $latestVersion['released']); } } else { $needUpgrade = JText::_('COM_KUNENA_COM_A_CHECK_VERSION_CANNOT_CONNECT'); } return $needUpgrade; }
/** * Retrieve installed Kunena version as string. * * @return string "Kunena X.Y.Z | YYYY-MM-DD | BUILDNUMBER [versionname]" */ function getVersionHTML() { return 'Kunena ' . Kunena::version() . ' | ' . Kunena::versionDate() . ' | ' . Kunena::versionBuild() . ' [ ' . Kunena::versionName() . ' ]'; }
public function plgContentKunenaDiscuss(&$subject, $params) { $this->_app = JFactory::getApplication(); if ($this->_app->isAdmin()) { return; } // If plugin is not enabled in current scope, do not register it if (!$this->enabled()) { return; } if (version_compare(JVERSION, '1.6', '>')) { $this->basepath = 'plugins/content/kunenadiscuss'; } else { $this->basepath = 'plugins/content'; } // Load language files $this->loadLanguage('plg_content_kunenadiscuss', JPATH_ADMINISTRATOR); // Kunena detection and version check $minKunenaVersion = '1.7'; if (!class_exists('Kunena') || version_compare(Kunena::version(), $minKunenaVersion, '<')) { $this->_app->enqueueMessage(JText::sprintf('PLG_KUNENADISCUSS_DEPENDENCY_FAIL', $minKunenaVersion)); return; } // Kunena online check if (!Kunena::enabled()) { return; } // Initialize session $session = KunenaFactory::getSession(); $session->updateAllowedForums(); // Initialize plugin parent::__construct($subject, $params); // Store Joomla version self::$j15 = version_compare(JVERSION, '1.6', '<'); // Initialize variables $this->_db = JFactory::getDbo(); $this->_my = JFactory::getUser(); require_once KUNENA_PATH . DS . 'class.kunena.php'; $this->config = KunenaFactory::getConfig(); // load Kunena main language file so we can leverage language strings from it KunenaFactory::loadLanguage(); // Create plugin table if doesn't exist $query = "SHOW TABLES LIKE '{$this->_db->getPrefix()}kunenadiscuss'"; $this->_db->setQuery($query); if (!$this->_db->loadResult()) { CKunenaTools::checkDatabaseError(); $query = "CREATE TABLE IF NOT EXISTS `#__kunenadiscuss`\n\t\t\t\t\t(`content_id` int(11) NOT NULL default '0',\n\t\t\t\t\t `thread_id` int(11) NOT NULL default '0',\n\t\t\t\t\t PRIMARY KEY (`content_id`)\n\t\t\t\t\t )"; $this->_db->setQuery($query); $this->_db->query(); CKunenaTools::checkDatabaseError(); $this->debug("Created #__kunenadiscuss cross reference table."); // Migrate data from old FireBoard discussbot if it exists $query = "SHOW TABLES LIKE '{$this->_db->getPrefix()}fb_discussbot'"; $this->_db->setQuery($query); if ($this->_db->loadResult()) { $query = "REPLACE INTO `#__kunenadiscuss`\n\t\t\t\t\tSELECT `content_id` , `thread_id`\n\t\t\t\t\tFROM `#__fb_discussbot`"; $this->_db->setQuery($query); $this->_db->query(); CKunenaTools::checkDatabaseError(); $this->debug("Migrated old data."); } } $this->debug("Constructor called in " . $this->_app->scope); }
/** * Based on Matias' version (Thanks) * See: http://docs.kunena.org/index.php/Developing_Kunena_Router */ static function getKunenaMajorVersion() { static $version; if (!$version) { if (class_exists('KunenaForum')) { $version = KunenaForum::versionMajor(); } elseif (class_exists('Kunena')) { $version = substr(Kunena::version(), 0, 3); } elseif (is_file(JPATH_ROOT . '/components/com_kunena/lib/kunena.defines.php')) { $version = '1.5'; } elseif (is_file(JPATH_ROOT . '/components/com_kunena/lib/kunena.version.php')) { $version = '1.0'; } } return $version; }
define('KUNENA_PATH_LIB', KUNENA_PATH . '/lib'); define('KUNENA_PATH_FUNCS', KUNENA_PATH . '/funcs'); define('KUNENA_PATH_TEMPLATE', KUNENA_PATH . '/template'); define('KUNENA_PATH_TEMPLATE_DEFAULT', KUNENA_PATH_TEMPLATE . '/' . KUNENA_TEMPLATE_DEFAULT); define('KUNENA_PATH_ADMIN', KUNENA_ROOT_PATH_ADMIN . '/' . KUNENA_COMPONENT_RELPATH); define('KUNENA_PATH_ADMIN_LIB', KUNENA_PATH_ADMIN . '/lib'); define('KUNENA_PATH_ADMIN_INSTALL', KUNENA_PATH_ADMIN . '/install'); define('KUNENA_PATH_ADMIN_IMAGES', KUNENA_PATH_ADMIN . '/images'); // Kunena uploaded files directory define('KUNENA_RELPATH_UPLOADED', 'media/kunena/attachments'); define('KUNENA_PATH_UPLOADED', KUNENA_ROOT_PATH . '/' . KUNENA_RELPATH_UPLOADED); // Kunena uploaded avatars directory define('KUNENA_RELPATH_AVATAR_UPLOADED', '/media/kunena/avatars'); define('KUNENA_PATH_AVATAR_UPLOADED', KUNENA_ROOT_PATH . KUNENA_RELPATH_AVATAR_UPLOADED); // Kunena legacy uploaded files directory define('KUNENA_RELPATH_UPLOADED_LEGACY', '/images/fbfiles'); define('KUNENA_PATH_UPLOADED_LEGACY', KUNENA_ROOT_PATH . KUNENA_RELPATH_UPLOADED_LEGACY); // The tunmbnail folder is relative to any image file folder define('KUNENA_FOLDER_THUMBNAIL', 'thumb'); // Files define('KUNENA_FILE_INSTALL', KUNENA_PATH_ADMIN . '/kunena.xml'); // Legacy version information define('KUNENA_VERSION', Kunena::version()); define('KUNENA_VERSION_DATE', Kunena::versionDate()); define('KUNENA_VERSION_NAME', Kunena::versionName()); define('KUNENA_VERSION_BUILD', Kunena::versionBuild()); // Time related define('KUNENA_SECONDS_IN_HOUR', 3600); define('KUNENA_SECONDS_IN_YEAR', 31536000); // Database defines define('KUNENA_DB_MISSING_COLUMN', 1054);
/** * Return path to topic emoticons * Sadly, for now, we will only return default, emoticons */ public static function getTopicImoticon(&$item) { $version = 1.5; if (class_exists('Kunena')) { $version = Kunena::version(); } $emoticonPath = ''; if (!defined('JB_URLEMOTIONSPATH')) { if ($version < '1.6.0') { $emoticonPath = JURI::base() . 'components/com_kunena/template/default/images/english/emoticons/'; } else { $emoticonPath = JURI::base() . 'components/com_kunena/template/default/images/icons/'; } } else { $emoticonPath = JB_URLEMOTIONSPATH; } // Emotions $topic_emoticons = array(); if ($version < '1.6.0') { $topic_emoticons[0] = $emoticonPath . 'default.gif'; $topic_emoticons[1] = $emoticonPath . 'exclam.gif'; $topic_emoticons[2] = $emoticonPath . 'question.gif'; $topic_emoticons[3] = $emoticonPath . 'arrow.gif'; $topic_emoticons[4] = $emoticonPath . 'love.gif'; $topic_emoticons[5] = $emoticonPath . 'grin.gif'; $topic_emoticons[6] = $emoticonPath . 'shock.gif'; $topic_emoticons[7] = $emoticonPath . 'smile.gif'; } else { $topic_emoticons[0] = $emoticonPath . 'topic-default.png'; $topic_emoticons[1] = $emoticonPath . 'topic-exclam.png'; $topic_emoticons[2] = $emoticonPath . 'topic-question.png'; $topic_emoticons[3] = $emoticonPath . 'topic-arrow.png'; $topic_emoticons[4] = $emoticonPath . 'topic-love.png'; $topic_emoticons[5] = $emoticonPath . 'topic-grin.png'; $topic_emoticons[6] = $emoticonPath . 'topic-shock.png'; $topic_emoticons[7] = $emoticonPath . 'topic-smile.png'; } return $topic_emoticons[$item->topic_emoticon]; }
/** * Private method to set the toolbar for this view * * @access private * * @return null **/ function setToolBar() { // Set the titlebar text JToolBarHelper::title('<span>' . Kunena::version() . '</span> ' . JText::_('COM_KUNENA_INSTALLER'), 'kunena.png'); }
public function getInstallAction($version = null) { if ($version->component === null) { $this->_action = 'INSTALL'; } else { if ($version->prefix != 'kunena_') { $this->_action = 'MIGRATE'; } else { if (version_compare(strtolower(Kunena::version()), strtolower($version->version), '>')) { $this->_action = 'UPGRADE'; } else { if (version_compare(strtolower(Kunena::version()), strtolower($version->version), '<')) { $this->_action = 'DOWNGRADE'; } else { if (Kunena::versionBuild() && Kunena::versionBuild() > $version->build) { $this->_action = 'UP_BUILD'; } else { if (Kunena::versionBuild() && Kunena::versionBuild() < $version->build) { $this->_action = 'DOWN_BUILD'; } else { $this->_action = 'REINSTALL'; } } } } } } return $this->_action; }
/** * @version $Id$ * * @package SW KBirthday Module * * @Copyright (C) 2010 Schultschik Websolution All rights reserved * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.schultschik.de **/ // Dont allow direct linking defined('_JEXEC') or die; require_once dirname(__FILE__) . '/helper/' . strtolower($params->get('connection')) . 'php'; // Kunena detection and version check $minKunenaVersion = '1.6.0'; $minPHPVersion = '5.3.0'; if (!class_exists('Kunena') || !version_compare(Kunena::version(), $minKunenaVersion, '>=')) { // Kunena 1.6 is not installed or enabled $res = JText::sprintf('SW_KBIRTHDAY_NOT_INSTALLED', $minKunenaVersion); } elseif (!Kunena::enabled()) { // Kunena 1.6 is not online, DO NOT use Kunena! $res = JText::_('SW_KBIRTHDAY_NOT_ENABLED'); } elseif (phpversion() < $minPHPVersion) { $res = JText::sprintf('SW_KBIRTHDAY_MIN_PHP', $minPHPVersion); } else { //get the birthday list with connection links $class = "ModSWKbirthdayHelper{$params->get('connection')}(\$params)"; $bday = new $class(); $res = $bday->getUserBirthday(); } if (empty($res)) { $res = JText::_('SW_KBIRTHDAY_NOUPCOMING');
/** * See: http://docs.kunena.org/index.php/Developing_Kunena_Router */ function getKunenaMajorVersion() { // Make sure that Kunena API (if exists) has been loaded $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; if (is_file($api)) { require_once $api; } if (class_exists('KunenaForum')) { return KunenaForum::versionMajor(); } elseif (class_exists('Kunena')) { return substr(Kunena::version(), 0, 3); } elseif (is_file(JPATH_ROOT . '/components/com_kunena/lib/kunena.defines.php')) { return '1.5'; } elseif (is_file(JPATH_ROOT . '/components/com_kunena/lib/kunena.version.php')) { return '1.0'; } return false; }