예제 #1
0
파일: Kunena.php 프로젝트: pashakiz/crowdf
 /**
  * Create an object.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = Prism\Integration\Profile\Kunena::getInstance(\JFactory::getDbo(), $userId);
  * </code>
  *
  * @param  \JDatabaseDriver $db
  * @param  int $id
  *
  * @return null|Kunena
  */
 public static function getInstance(\JDatabaseDriver $db, $id)
 {
     if (empty(self::$instances[$id])) {
         $item = new Kunena($db);
         $item->load($id);
         self::$instances[$id] = $item;
     }
     return self::$instances[$id];
 }
예제 #2
0
 /**
  * Create an object.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = Prism\Integration\Profile\Kunena::getInstance(\JFactory::getDbo(), $userId);
  * </code>
  *
  * @param  \JDatabaseDriver $db
  * @param  int $id
  *
  * @return null|Kunena
  */
 public static function getInstance(\JDatabaseDriver $db, $id)
 {
     if (!array_key_exists($id, self::$instances)) {
         $item = new Kunena($db);
         $item->load($id);
         self::$instances[$id] = $item;
     }
     return self::$instances[$id];
 }
예제 #3
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     if (!class_exists('Kunena') || !Kunena::installed()) {
         echo '<a href="index.php?option=com_kunena">PLEASE COMPLETE KUNENA INSTALLATION</a>';
         return;
     }
     $kunena_db = JFactory::getDBO();
     require_once KUNENA_PATH . '/class.kunena.php';
     $items = JJ_categoryArray();
     $sections = $node->attributes('sections');
     $none = $node->attributes('none');
     $ctrl = $control_name . '[' . $name . ']';
     $options = array();
     $options[] = JHTML::_('select.option', '0', $none ? JText::_($none) : '&nbsp;');
     foreach ($items as $cat) {
         $options[] = JHTML::_('select.option', $cat->id, $cat->treename, 'value', 'text', !$sections && $cat->section);
     }
     $ctrl = $control_name . '[' . $name . ']';
     $size = $node->attributes('size');
     $class = $node->attributes('class');
     $attribs = ' ';
     if ($size) {
         $attribs .= 'size="' . $size . '"';
     }
     if ($class) {
         $attribs .= 'class="' . $class . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if ($node->attributes('multiple')) {
         $attribs .= ' multiple="multiple"';
         $ctrl .= '[]';
     }
     return JHTML::_('select.genericlist', $options, $ctrl, $attribs, 'value', 'text', $value, $control_name . $name);
 }
예제 #4
0
 function onSystemStart()
 {
     if (!self::kunenaInstalled()) {
         return;
     }
     //initialize the toolbar object
     $toolbar = CFactory::getToolbar();
     // Kunena online check
     if (!Kunena::enabled()) {
         $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENAMENU_KUNENA_OFFLINE'), JRoute::_('index.php?option=com_kunena'));
         return;
     }
     //adding new 'tab' 'Forum Settings' to JomSocial toolbar
     $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENANENU_FORUM'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
     if ($this->params->get('sh_editprofile')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_EDITPROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_EDITPROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile&task=edit'));
     }
     if ($this->params->get('sh_myprofile')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_PROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_PROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
     }
     if ($this->params->get('sh_myposts')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_POSTS', JText::_('PLG_COMMUNITY_KUNENAMENU_POSTS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=userposts'));
     }
     if ($this->params->get('sh_mysubscriptions')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_SUBSCRIBES', JText::_('PLG_COMMUNITY_KUNENAMENU_SUBSCRIBTIONS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=subscriptions'));
     }
     if ($this->params->get('sh_myfavorites')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_FAVORITES', JText::_('PLG_COMMUNITY_KUNENAMENU_FAVORITES'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=favorites'));
     }
 }
예제 #5
0
 protected function getInput()
 {
     if (!class_exists('Kunena') || !Kunena::installed()) {
         echo '<a href="index.php?option=com_kunena">PLEASE COMPLETE KUNENA INSTALLATION</a>';
         return;
     }
     $kunena_db = JFactory::getDBO();
     require_once KUNENA_PATH . '/class.kunena.php';
     $items = JJ_categoryArray();
     $sections = $this->element['sections'];
     $none = $this->element['none'];
     $options = array();
     $options[] = JHTML::_('select.option', '0', $none ? JText::_($none) : '&nbsp;');
     foreach ($items as $cat) {
         $options[] = JHTML::_('select.option', $cat->id, $cat->treename, 'value', 'text', !$sections && $cat->section);
     }
     $size = $this->element['size'];
     $class = $this->element['class'];
     $attribs = ' ';
     if ($size) {
         $attribs .= 'size="' . $size . '"';
     }
     if ($class) {
         $attribs .= 'class="' . $class . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if (!empty($this->element['multiple'])) {
         $attribs .= ' multiple="multiple"';
     }
     return JHTML::_('select.genericlist', $options, $this->name, $attribs, 'value', 'text', $this->value);
 }
예제 #6
0
파일: rules.php 프로젝트: q0821/esportshop
 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);
 }
예제 #7
0
 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 />';
     }
 }
예제 #8
0
 public function __construct($params)
 {
     require_once KPATH_SITE . '/lib/kunena.link.class.php';
     $this->params = $params;
     $this->type = $this->params->get('type', 'general');
     $this->items = (int) $this->params->get('items', 5);
     // load Kunena main language file so we can leverage langaueg strings from it
     KunenaFactory::loadLanguage();
     // Initialize session
     $session = KunenaFactory::getSession();
     $session->updateAllowedForums();
     $this->api = Kunena::getStatsAPI();
 }
function kunena_upgrade_161_delfiles($parent)
{
    if (Kunena::isSVN()) {
        return;
    }
    //Import filesystem libraries.
    jimport('joomla.filesystem.folder');
    $path = JPATH_COMPONENT . '/views/article';
    if (JFolder::exists($path)) {
        JFolder::delete($path);
    }
    return array('action' => '', 'name' => JText::_('COM_KUNENA_INSTALL_161_DELFILES'), 'success' => true);
}
예제 #10
0
파일: api.php 프로젝트: rich20/Kunena-1.6
 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;
 }
예제 #11
0
 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;
 }
예제 #12
0
 protected static function kunenaOnline()
 {
     // Kunena detection and version check
     $minKunenaVersion = '1.6.3';
     if (!class_exists('Kunena') || Kunena::versionBuild() < 4344) {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_COMMUNITY_KUNENAGROUPS_KUNENA_NOT_INSTALLED', $minKunenaVersion), 'notice');
         return false;
     }
     // Kunena online check
     if (!Kunena::enabled()) {
         JFactory::getApplication()->enqueueMessage(JText::_('PLG_COMMUNITY_KUNENAGROUPS_KUNENA_OFFLINE'), 'notice');
         return false;
     }
     // Initialize session
     $session = KunenaFactory::getSession();
     $session->updateAllowedForums();
     kimport('category');
     return true;
 }
예제 #13
0
	function plgContentKunenaDiscuss(&$subject, $params) {

		$this->_app = JFactory::getApplication ( 'site' );

		// If plugin is not enabled in current scope, do not register it
		if (! $this->enabled ())
			return null;

		$jversion = new JVersion();
		if ($jversion->RELEASE != '1.5') {
			$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.6.3';
		if (!class_exists('Kunena') || Kunena::versionBuild() < 4344) {
			$this->_app->enqueueMessage( JText::sprintf ( 'PLG_KUNENADISCUSS_DEPENDENCY_FAIL', $minKunenaVersion ) );
			return null;
		}
		// Kunena online check
		if (!Kunena::enabled()) {
			return null;
		}
		// Initialize session
		$session = KunenaFactory::getSession ();
		$session->updateAllowedForums();

		// Initialize plugin
		parent::__construct ( $subject, $params );

		// 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`
					(`content_id` int(11) NOT NULL default '0',
					 `thread_id` int(11) NOT NULL default '0',
					 PRIMARY KEY  (`content_id`)
					 )";
			$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`
					SELECT `content_id` , `thread_id`
					FROM `#__fb_discussbot`";
				$this->_db->setQuery ( $query );
				$this->_db->query ();
				CKunenaTools::checkDatabaseError ();
				$this->debug ( "Migrated old data." );
			}
		}

		$this->debug ( "Constructor called in " . $this->_app->scope );
	}
예제 #14
0
 /**
  * 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;
 }
예제 #15
0
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;
}
예제 #16
0
 /**
  * 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() . ' ]';
 }
예제 #17
0
 /**
  * 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;
 }
예제 #18
0
 /**
  * Wrapper to addScript
  *
  */
 function addScript($filename)
 {
     $document =& JFactory::getDocument();
     $kunena_config = KunenaFactory::getConfig();
     if ($kunena_config->debug || Kunena::isSvn()) {
         // If we are in debug more, make sure we load the unpacked css
         $filename = preg_replace('/\\-min\\./u', '.', $filename);
     }
     return $document->addScript($filename);
 }
예제 #19
0
 /**
  * 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;
 }
예제 #20
0
 protected function checkKunena($version)
 {
     $app = JFactory::getApplication();
     // Always load Kunena API if it exists.
     $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
     if (file_exists($api)) {
         require_once $api;
     }
     // Do not install over Git repository (K1.6+).
     if (class_exists('Kunena') && method_exists('Kunena', 'isSvn') && Kunena::isSvn() || class_exists('KunenaForum') && method_exists('KunenaForum', 'isDev') && KunenaForum::isDev()) {
         $app->enqueueMessage('Oops! You should not install Kunena over your Git reporitory!', 'notice');
         return false;
     }
     $db = JFactory::getDBO();
     // Check if Kunena can be found from the database
     $table = $db->getPrefix() . 'kunena_version';
     $db->setQuery("SHOW TABLES LIKE {$db->quote($table)}");
     if ($db->loadResult() != $table) {
         return true;
     }
     // Get installed Kunena version
     $db->setQuery("SELECT version FROM {$db->quoteName($table)} ORDER BY `id` DESC", 0, 1);
     $installed = $db->loadResult();
     if (!$installed) {
         return true;
     }
     // Always allow upgrade to the newer version
     if (version_compare($version, $installed, '>=')) {
         return true;
     }
     // Check if we can downgrade to the current version
     if (class_exists('KunenaInstaller')) {
         if (KunenaInstaller::canDowngrade($version)) {
             return true;
         }
     } else {
         // Workaround when Kunena files were removed to allow downgrade between bugfix versions.
         $major = preg_replace('/(\\d+.\\d+)\\..*$/', '\\1', $version);
         if (version_compare($installed, $major, '>')) {
             return true;
         }
     }
     $app->enqueueMessage(sprintf('Sorry, it is not possible to downgrade Kunena %s to version %s.', $installed, $version), 'notice');
     return false;
 }
예제 #21
0
 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;
 }
예제 #22
0
 function displaySchemaDiff()
 {
     require_once KPATH_ADMIN . '/install/schema.php';
     $schema = new KunenaModelSchema();
     $diff = $schema->getDiffSchema();
     $sql = $schema->getSchemaSQL($diff);
     echo '<textarea cols="80" rows="20">';
     echo $this->escape($diff->saveXML());
     echo '</textarea>';
     if (Kunena::isSvn()) {
         echo '<textarea cols="80" rows="20">';
         foreach ($sql as $item) {
             echo $this->escape($item['sql']) . "\n\n";
         }
         echo '</textarea>';
     }
 }
예제 #23
0
 function uninstall()
 {
     JRequest::checkToken('get') or die('Invalid Token');
     $this->model->setAction('uninstall');
     $this->model->deleteTables('kunena_');
     $this->model->deleteMenu();
     $app = JFactory::getApplication();
     $app->enqueueMessage(JText::_('COM_KUNENA_INSTALL_REMOVED'));
     if (!Kunena::isSvn()) {
         jimport('joomla.filesystem.folder');
         JFolder::delete(KPATH_MEDIA);
         jimport('joomla.installer.installer');
         $installer = new JInstaller();
         jimport('joomla.application.component.helper');
         $component = JComponentHelper::getComponent('com_kunena');
         $installer->uninstall('component', $component->id);
         $this->setRedirect('index.php?option=com_installer');
     } else {
         $this->setRedirect('index.php?option=com_kunena&view=install');
     }
 }
예제 #24
0
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);
예제 #25
0
 /**
  * Retrieve installed Kunena version as array.
  *
  * @return array Contains fields: version, versiondate, build, versionname
  */
 function versionArray()
 {
     return Kunena::getVersionInfo();
 }
예제 #26
0
파일: kunena.php 프로젝트: Jougito/DynWeb
 /**
  * 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];
 }
예제 #27
0
<?php
/**
 * @version $Id$
 * KunenaStats Module
 * @package Kunena Stats
 *
 * @Copyright (C) 2010 www.kunena.com All rights reserved
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.kunena.com
 */
defined ( '_JEXEC' ) or die ();

// Kunena detection and version check
$minKunenaVersion = '1.6.3';
if (! class_exists ( 'Kunena' ) || Kunena::versionBuild () < 4344) {
	echo JText::sprintf ( 'MOD_KUNENASTATS_KUNENA_NOT_INSTALLED', $minKunenaVersion );
	return;
}
// Kunena online check
if (! Kunena::enabled ()) {
	echo JText::_ ( 'MOD_KUNENASTATS_KUNENA_OFFLINE' );
	return;
}
require_once dirname ( __FILE__ ) . '/class.php';

$params = ( object ) $params;
$kstats = new ModuleKunenaStats ( $params );
$kstats->display ();
예제 #28
0
						<div class="icon"> <a href="<?php 
echo JURI::base();
?>
index.php?option=com_kunena&amp;task=showsystemreport" title="<?php 
echo JText::_('COM_KUNENA_REPORT_SYSTEM');
?>
"> <img src="<?php 
echo JURI::base();
?>
components/com_kunena/images/report_conf.png"  align="middle" border="0" alt="" /> <span> <?php 
echo JText::_('COM_KUNENA_REPORT_SYSTEM');
?>
 </span></a> </div>
					</div>
					<?php 
if (Kunena::isSvn()) {
    ?>
					<div class="icon-container">
						<div class="icon"> <a href="<?php 
    echo JURI::base();
    ?>
index.php?option=com_kunena&amp;view=install" title="<?php 
    echo JText::_('COM_KUNENA_SVN_INSTALL');
    ?>
"> <img src="<?php 
    echo JURI::base();
    ?>
components/com_kunena/images/install.png"  align="middle" border="0" alt="" /> <span> <?php 
    echo JText::_('COM_KUNENA_SVN_INSTALL');
    ?>
 </span></a> </div>