示例#1
0
	public static function parseKunenaInstallFile($path) {
		$xml = simplexml_load_file($path);
		if (!$xml || $xml->getName() != 'kinstall') {
			return false;
		}

		$data = new stdClass();
		$data->name = (string) $xml->name;
		$data->type = (string) $xml->attributes()->type;
		$data->creationdate = (string) $xml->creationDate;
		$data->author = (string) $xml->author;
		$data->copyright = (string) $xml->copyright;
		$data->authorEmail = (string) $xml->authorEmail;
		$data->authorUrl = (string) $xml->authorUrl;
		$data->version = (string) $xml->version;
		$data->description = (string) $xml->description;
		$data->thumbnail = (string) $xml->thumbnail;

		if ($data->version == '@kunenaversion@') $data->version = KunenaForum::version();
		if ($data->creationdate == '@kunenaversiondate@') $data->creationdate = KunenaForum::versionDate();

		if (!$data->version) $data->version = JText::_('Unknown');
		if (!$data->creationdate) $data->creationdate = JText::_('Unknown');
		if (!$data->author) $data->author = JText::_('Unknown');

		return $data;
	}
示例#2
0
 /**
  * Display Kunena backend icon in Joomla 2.5+
  *
  * @param string $context
  */
 public function onGetIcons($context)
 {
     if (!$context == 'mod_quickicon' || !JFactory::getUser()->authorise('core.manage', 'com_kunena')) {
         return;
     }
     KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
     if (KunenaForum::installed() && KunenaFactory::getConfig()->version_check && JFactory::getUser()->authorise('core.manage', 'com_installer')) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_kunena'));
         $db->setQuery($query);
         $cparams = new JRegistry((string) $db->loadResult());
         //$cparams = JComponentHelper::getParams('com_kunena');
         $liveupdate = new JRegistry($cparams->get('liveupdate', null));
         $lastCheck = $liveupdate->get('lastcheck', 0);
         $updateInfo = json_decode(trim((string) $liveupdate->get('updatedata', ''), '"'));
         $valid = abs(time() - $lastCheck) <= 24 * 3600;
         // 24 hours
         if (!$valid) {
             // If information is not valid, update it asynchronously.
             $ajax_url = JURI::base() . 'index.php?option=com_kunena&view=liveupdate&task=ajax';
             $script = "window.addEvent('domready', function() {\n\tvar com_kunena_updatecheck_ajax_structure = {\n\t\tonSuccess: function(msg, responseXML) {\n\t\t\tvar updateInfo = JSON.decode(msg, true);\n\t\t\tif (updateInfo.html) {\n\t\t\t\tdocument.id('com_kunena_icon').getElement('img').setProperty('src',updateInfo.img);\n\t\t\t\tdocument.id('com_kunena_icon').getElement('span').set('html', updateInfo.html);\n\t\t\t\tdocument.id('com_kunena_icon').getElement('a').set('href', updateInfo.link);\n\t\t\t}\n\t\t},\n\t\turl: '{$ajax_url}'\n\t};\n\tajax_object = new Request(com_kunena_updatecheck_ajax_structure);\n\tajax_object.send();\n});";
             $document = JFactory::getDocument();
             $document->addScriptDeclaration($script);
         }
     }
     $link = 'index.php?option=com_kunena';
     if (!KunenaForum::installed()) {
         // Not fully installed
         $img = 'kunena/icons/icon-48-kupdate-alert-white.png';
         $text = JText::_('PLG_QUICKICON_KUNENA_COMPLETE_INSTALLATION');
     } elseif (empty($updateInfo->supported)) {
         // Unsupported
         $img = 'kunena/icons/kunena-logo-48-white.png';
         $text = JText::_('COM_KUNENA');
     } elseif ($updateInfo->stuck) {
         // Stuck
         $img = 'kunena/icons/icon-48-kupdate-alert-white.png';
         $text = JText::_('COM_KUNENA') . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_CRASH');
     } elseif (version_compare(KunenaForum::version(), $updateInfo->version, '<')) {
         // Has updates
         $img = 'kunena/icons/icon-48-kupdate-update-white.png';
         $text = 'Kunena ' . $updateInfo->version . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_AVAILABLE');
         $link .= '&view=liveupdate';
     } else {
         // Already in the latest release
         $img = 'kunena/icons/icon-48-kupdate-good-white.png';
         $text = JText::_('COM_KUNENA');
     }
     return array(array('link' => JRoute::_($link), 'image' => $img, 'text' => $text, 'access' => array('core.manage', 'com_kunena'), 'id' => 'com_kunena_icon'));
 }
示例#3
0
 function getLatestVersion()
 {
     $latestVersion = $this->getLatestKunenaVersion();
     if ($latestVersion['connect']) {
         if (version_compare($latestVersion['latest_version'], KunenaForum::version(), '<=')) {
             $needUpgrade = JText::sprintf('COM_KUNENA_COM_A_CHECK_VERSION_CORRECT', KunenaForum::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;
 }
 /**
  * Get forum version
  *
  * @param object $forum
  * @return string
  */
 function getVersion($forum)
 {
     global $_CB_database;
     static $version = null;
     if ($version === null) {
         if ($forum->prefix != 'kunena' || $forum->prefix == 'kunena' && !class_exists('KunenaForum')) {
             if (isset($forum->config['version'])) {
                 $version = $forum->config['version'];
             } elseif ($forum->component == 'com_fireboard' || $forum->component == 'com_kunena') {
                 $query = 'SELECT ' . $_CB_database->NameQuote('version') . "\n FROM " . $_CB_database->NameQuote('#__' . $forum->prefix . '_version') . "\n ORDER BY " . $_CB_database->NameQuote('id') . " DESC";
                 $_CB_database->setQuery($query, 0, 1);
                 $version = $_CB_database->loadResult();
             } else {
                 $version = '0.0.0';
             }
         } elseif (class_exists('KunenaForum')) {
             $version = KunenaForum::version();
         } else {
             $version = '0.0.0';
         }
     }
     return $version;
 }
示例#5
0
 function prepare()
 {
     if (!JRequest::checkToken('get')) {
         $this->setRedirect('index.php?option=com_kunena');
         return;
     }
     $start = JRequest::getBool('start', false);
     // Workaround situation where KunenaForum class doesn't exist (api.php was cached)
     if (!class_exists('KunenaForum')) {
         // TODO: add version check
         $app = JFactory::getApplication();
         $try = $app->getUserState('kunena-prepare', 0) + 1;
         clearstatcache();
         if (function_exists('apc_clear_cache')) {
             apc_clear_cache('system');
         }
         sleep(1);
         $app->setUserState('kunena-prepare', $try);
         $start = $start ? '&start=1' : '';
         $this->setRedirect('index.php?option=com_kunena&view=install&task=prepare&try=' . $try . $start . '&' . JUtility::getToken() . '=1');
         $this->redirect();
     }
     $this->model->install();
     if ($start) {
         // Make sure that the code is identical to the installer (we can improve it later on)
         $versions = $this->model->getDetectVersions();
         $version = reset($versions);
         if (!empty($version->state) || $version->version == KunenaForum::version() && $version->versiondate == KunenaForum::versionDate()) {
             unset($version);
         }
     }
     if (isset($version)) {
         $this->setRedirect($version->link);
     } else {
         $this->setRedirect('index.php?option=com_kunena&view=install');
     }
 }
示例#6
0
 /**
  * Retrieve installed Kunena version as string.
  *
  * @return string "Kunena X.Y.Z | YYYY-MM-DD [versionname]"
  */
 static function getVersionHTML()
 {
     return 'Kunena ' . KunenaForum::version() . ' | ' . KunenaForum::versionDate() . ' [ ' . KunenaForum::versionName() . ' ]';
 }
示例#7
0
文件: view.php 项目: madcsaba/li-de
 /**
  * Private method to set the toolbar for this view
  *
  * @access private
  *
  * @return null
  **/
 function setToolBar()
 {
     // Set the titlebar text
     JToolBarHelper::title('<span>Kunena ' . KunenaForum::version() . '</span> ' . JText::_('COM_KUNENA_INSTALLER'), 'kunena.png');
 }
示例#8
0
 /**
  * Display Kunena backend icon in Joomla 2.5+
  *
  * @param string $context
  *
  * @return array|null
  */
 public function onGetIcons($context)
 {
     if ($context != $this->params->get('context', 'mod_quickicon') || !JFactory::getUser()->authorise('core.manage', 'com_kunena')) {
         return null;
     }
     KunenaFactory::loadLanguage('com_kunena.sys', 'admin');
     $updateInfo = null;
     if (KunenaForum::installed() && JFactory::getUser()->authorise('core.manage', 'com_installer')) {
         $updateSite = 'http://update.kunena.org/%';
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select('*')->from($db->qn('#__updates'))->where($db->qn('extension_id') . ' > 0')->where($db->qn('detailsurl') . ' LIKE ' . $db->q($updateSite));
         $db->setQuery($query);
         $list = (array) $db->loadObjectList();
         if ($list) {
             $updateInfo = new stdClass();
             $updateInfo->addons = 0;
             $updateInfo->version = 0;
             foreach ($list as $item) {
                 if ($item->element == 'pkg_kunena') {
                     $updateInfo->version = $item->version;
                 } else {
                     $updateInfo->addons++;
                 }
             }
         } else {
             $query = $db->getQuery(true)->select('update_site_id')->from($db->qn('#__update_sites'))->where($db->qn('enabled') . ' = 0')->where($db->qn('location') . ' LIKE ' . $db->q($updateSite));
             $db->setQuery($query);
             $updateInfo = !$db->loadResult();
         }
     }
     $link = 'index.php?option=com_kunena';
     $useIcons = version_compare(JVERSION, '3.0', '>');
     if (!KunenaForum::installed()) {
         // Not fully installed
         $img = $useIcons ? 'warning' : 'kunena/icons/icon-48-kupdate-alert-white.png';
         $icon = 'kunena/icons/icon-48-kupdate-alert-white.png';
         $text = JText::_('PLG_QUICKICON_KUNENA_COMPLETE_INSTALLATION');
     } elseif ($updateInfo === null) {
         // Unsupported
         $img = $useIcons ? 'remove' : 'kunena/icons/kunena-logo-48-white.png';
         $icon = 'kunena/icons/kunena-logo-48-white.png';
         $text = JText::_('COM_KUNENA');
     } elseif ($updateInfo === false) {
         // Disabled
         $img = $useIcons ? 'minus' : 'kunena/icons/icon-48-kupdate-alert-white.png';
         $icon = 'kunena/icons/icon-48-kupdate-alert-white.png';
         $text = JText::_('COM_KUNENA') . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_DISABLED');
     } elseif (!empty($updateInfo->version) && version_compare(KunenaForum::version(), $updateInfo->version, '<')) {
         // Has updates
         $img = $useIcons ? 'download' : 'kunena/icons/icon-48-kupdate-update-white.png';
         $icon = 'kunena/icons/icon-48-kupdate-update-white.png';
         $text = 'Kunena ' . $updateInfo->version . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_NOW');
         $link = 'index.php?option=com_installer&view=update&filter_search=kunena';
     } elseif (!empty($updateInfo->addons)) {
         // Has updated add-ons
         $img = $useIcons ? 'download' : 'kunena/icons/icon-48-kupdate-update-white.png';
         $icon = 'kunena/icons/icon-48-kupdate-update-white.png';
         $text = JText::_('COM_KUNENA') . '<br />' . JText::sprintf('PLG_QUICKICON_KUNENA_UPDATE_ADDONS', $updateInfo->addons);
         $link = 'index.php?option=com_installer&view=update&filter_search=kunena';
     } else {
         // Already in the latest release
         $img = $useIcons ? 'comments' : 'kunena/icons/icon-48-kupdate-good-white.png';
         $icon = 'kunena/icons/icon-48-kupdate-good-white.png';
         $text = JText::_('COM_KUNENA');
     }
     // Use one line in J!3.0.
     if (version_compare(JVERSION, '3.0', '>')) {
         $text = preg_replace('|<br />|', ' - ', $text);
     }
     return array(array('link' => JRoute::_($link), 'image' => $img, 'text' => $text, 'icon' => $icon, 'access' => array('core.manage', 'com_kunena'), 'id' => 'com_kunena_icon'));
 }
示例#9
0
 /**
  * Migrate custom information.
  *
  * This function gets called after all folders and tables have been copied.
  *
  * If you want to split this task into smaller chunks,
  * please store your custom state variables into $this->state and return false.
  * Returning false will force jUpgrade to call this function again,
  * which allows you to continue import by reading $this->state before continuing.
  *
  * @return	boolean Ready (true/false)
  * @since	1.6.4
  * @throws	Exception
  */
 protected function migrateExtensionCustom()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_kunena/api.php';
     // Need to initialize application
     jimport('joomla.environment.uri');
     $app = JFactory::getApplication('administrator');
     // Get component object
     $component = JTable::getInstance('extension', 'JTable', array('dbo' => $this->db_new));
     $component->load(array('type' => 'component', 'element' => $this->name));
     // First fix all broken menu items
     $query = "UPDATE #__menu SET component_id={$this->db_new->quote($component->extension_id)} WHERE type = 'component' AND link LIKE '%option={$this->name}%'";
     $this->db_new->setQuery($query);
     $this->db_new->query();
     $menumap = $this->getMapList('menus');
     // Get all menu items from the component (JMenu style)
     $query = $this->db_new->getQuery(true);
     $query->select('*');
     $query->from('#__menu');
     $query->where("component_id = {$component->extension_id}");
     $query->where('client_id = 0');
     $query->order('lft');
     $this->db_new->setQuery($query);
     $menuitems = $this->db_new->loadObjectList('id');
     foreach ($menuitems as &$menuitem) {
         // Get parent information.
         $parent_tree = array();
         if (isset($menuitems[$menuitem->parent_id])) {
             $parent_tree = $menuitems[$menuitem->parent_id]->tree;
         }
         // Create tree.
         $parent_tree[] = $menuitem->id;
         $menuitem->tree = $parent_tree;
         // Create the query array.
         $url = str_replace('index.php?', '', $menuitem->link);
         $url = str_replace('&amp;', '&', $url);
         parse_str($url, $menuitem->query);
     }
     // Update menu items
     foreach ($menuitems as $menuitem) {
         if (!isset($menuitem->query['view'])) {
             continue;
         }
         $update = false;
         switch ($menuitem->query['view']) {
             case 'home':
                 // Update default menu item
                 if (!empty($menuitem->query['defaultmenu'])) {
                     $menuitem->query['defaultmenu'] = isset($menumap[$menuitem->query['defaultmenu']]) ? $menumap[$menuitem->query['defaultmenu']]->new : 0;
                     $update = true;
                 }
                 break;
         }
         if ($update) {
             // Update menuitem link
             $query_string = array();
             foreach ($menuitem->query as $k => $v) {
                 $query_string[] = $k . '=' . $v;
             }
             $menuitem->link = 'index.php?' . implode('&', $query_string);
             // Save menu object
             $menu = JTable::getInstance('menu', 'JTable', array('dbo' => $this->db_new));
             $menu->bind(get_object_vars($menuitem), array('tree', 'query'));
             $success = $menu->check();
             if ($success) {
                 $success = $menu->store();
             }
             if (!$success) {
                 echo "ERROR";
             }
         }
     }
     // Replace Joomla! 1.5 manifest file with Joomla! 2.5 version
     jimport('joomla.filesystem.file');
     $manifest25 = JPATH_ADMINISTRATOR . '/components/com_kunena/kunena.j25.xml';
     $manifest15 = JPATH_ADMINISTRATOR . '/components/com_kunena/kunena.xml';
     if (file_exists($manifest25)) {
         $content = file_get_contents($manifest25);
         // Take care of Git install
         $content = preg_replace('/@kunenaversion@/', preg_replace('/-GIT/i', '', KunenaForum::version()), $content);
         $content = preg_replace('/@kunenaversiondate@/', KunenaForum::versionDate(), $content);
         $content = preg_replace('/@kunenaversionname@/', KunenaForum::versionName(), $content);
         JFile::write($manifest15, $content);
         JFile::delete($manifest25);
     }
     jimport('joomla.plugin.helper');
     // Mark Kunena as discovered and install it
     $component->client_id = 1;
     $component->state = -1;
     $component->store();
     jimport('joomla.installer.installer');
     $installer = JInstaller::getInstance();
     $installer->discover_install($component->extension_id);
     // Start Kunena installer
     require_once dirname(__FILE__) . '/model.php';
     $kunena = new KunenaModelInstall();
     // Install all plugins
     $kunena->stepPlugins();
     // Install English language
     $kunena->installLanguage('en-GB', 'English');
     return true;
 }
示例#10
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(KunenaForum::version()), strtolower($version->version), '>')) {
                 $this->_action = 'UPGRADE';
             } else {
                 if (version_compare(strtolower(KunenaForum::version()), strtolower($version->version), '<')) {
                     $this->_action = 'DOWNGRADE';
                 } else {
                     $this->_action = 'REINSTALL';
                 }
             }
         }
     }
     return $this->_action;
 }
示例#11
0
文件: kunena.php 项目: madcsaba/li-de
 /**
  * Prevent downgrades to Kunena 1.7 and older releases
  */
 public function onExtensionBeforeUpdate($type, $manifest)
 {
     if ($type != 'component') {
         return true;
     }
     // Generate component name
     $name = strtolower(JFilterInput::getInstance()->clean((string) $manifest->name, 'cmd'));
     $element = substr($name, 0, 4) == "com_" ? $name : "com_{$name}";
     if ($element != 'com_kunena') {
         return true;
     }
     // Kunena 2.0.0-BETA2 and later support this feature in their installer
     if (version_compare($manifest->version, '2.0.0', '>=')) {
         return true;
     }
     // Check if we can downgrade to the current version
     if (class_exists('KunenaInstaller') && KunenaInstaller::canDowngrade($manifest->version)) {
         return true;
     }
     // Old version detected: emulate failed installation
     $app = JFactory::getApplication();
     $app->enqueueMessage(sprintf('Sorry, it is not possible to downgrade Kunena %s to version %s.', KunenaForum::version(), $manifest->version), 'warning');
     $app->enqueueMessage(JText::_('JLIB_INSTALLER_ABORT_COMP_INSTALL_CUSTOM_INSTALL_FAILURE'), 'error');
     $app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATE_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($type))));
     $app->redirect('index.php?option=com_installer');
     return true;
 }
示例#12
0
 /**
  * Retrieves a list of categories in Kunena
  *
  * @param	null
  * @return	string	A JSON string
  **/
 private function getKunenaCategories()
 {
     require_once JPATH_ROOT . '/administrator/components/com_kunena/api.php';
     $columnName = 'parent';
     if (class_exists('KunenaForum') && KunenaForum::version() >= '2.0') {
         $columnName = 'parent_id';
     }
     $db = DiscussHelper::getDBO();
     $query = 'SELECT * FROM ' . $db->nameQuote('#__kunena_categories') . ' where ' . $db->nameQuote($columnName) . ' = ' . $db->Quote('0') . ' ORDER BY ' . $db->nameQuote('ordering') . ' ASC';
     $db->setQuery($query);
     $result = $db->loadObjectList();
     if (!$result) {
         return false;
     }
     return $result;
 }
示例#13
0
 function ajax()
 {
     // Note: we don't do a token check as we're fetching information
     // asynchronously. This means that between requests the token might
     // change, making it impossible for AJAX to work.
     $info = self::getUpdateInformation();
     $lang = JFactory::getLanguage();
     $lang->load('plg_quickicon_kunena.sys', JPATH_ADMINISTRATOR) || $lang->load('plg_quickicon_kunena.sys', KPATH_ADMIN);
     $obj = new stdClass();
     $obj->link = 'index.php?option=com_kunena';
     if (empty($info->supported)) {
         // Unsupported
         $obj->img = 'kunena/images/icons/kunena-logo-48-white.png';
         $obj->html = JText::_('COM_KUNENA');
     } elseif ($info->stuck) {
         // Stuck
         $obj->img = 'kunena/images/icons/icon-48-kupdate-alert-white.png';
         $obj->html = JText::_('COM_KUNENA') . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_CRASH');
     } elseif (version_compare(KunenaForum::version(), $info->version, '<')) {
         // Has updates
         $obj->img = 'kunena/images/icons/icon-48-kupdate-update-white.png';
         $obj->html = 'Kunena ' . $info->version . '<br />' . JText::_('PLG_QUICKICON_KUNENA_UPDATE_AVAILABLE');
         $obj->link .= '&view=liveupdate';
     } else {
         // Already in the latest release
         $obj->img = 'kunena/images/icons/icon-48-kupdate-good-white.png';
         $obj->html = JText::_('COM_KUNENA');
     }
     $obj->img = JUri::root() . '/media/' . $obj->img;
     $obj->link = JRoute::_($obj->link, false);
     echo json_encode($obj);
     JFactory::getApplication()->close();
 }
示例#14
0
	protected static function buildVersion() {
		if ('@kunenaversion@' == '@' . 'kunenaversion' . '@') {
			$xml = KPATH_ADMIN . '/kunena.xml';
			$parser = JFactory::getXMLParser ( 'Simple' );
			$parser->loadFile ( $xml );
			self::$version = $parser->document->getElementByPath ( 'version' )->data () . '-SVN';
		} else {
			self::$version = strtoupper ( '@kunenaversion@' );
		}
		self::$version_date = ('@kunenaversiondate@' == '@' . 'kunenaversiondate' . '@') ? JFactory::getDate()->toMySQL() : '@kunenaversiondate@';
		self::$version_name = ('@kunenaversionname@' == '@' . 'kunenaversionname' . '@') ? 'SVN Revision' : '@kunenaversionname@';
	}
示例#15
0
 protected static function buildVersion()
 {
     if ('2.0.1' == '@' . 'kunenaversion' . '@') {
         $xml = KPATH_ADMIN . '/kunena.xml';
         $parser = JFactory::getXMLParser('Simple');
         $parser->loadFile($xml);
         self::$version = $parser->document->getElementByPath('version')->data() . '-GIT';
     } else {
         self::$version = strtoupper('2.0.1');
     }
     self::$version_major = substr(self::$version, 0, 3);
     self::$version_date = '2012-07-07' == '@' . 'kunenaversiondate' . '@' ? JFactory::getDate()->toMySQL() : '2012-07-07';
     self::$version_name = 'Balozi' == '@' . 'kunenaversionname' . '@' ? 'Git Repository' : 'Balozi';
 }
示例#16
0
							<li><i class="icon icon-question"></i> <a href="https://www.kunena.org/docs/en/setup/sections-categories" target="_blank"><?php echo JText::_('COM_KUNENA_CPANEL_DESC_CATEGORIES') ?> </a></li>
							<li><i class="icon icon-question"></i> <a href="https://www.kunena.org/forum" target="_blank"><?php echo JText::_('COM_KUNENA_CPANEL_DESC_SUPPORT') ?> </a></li>
						</ul>
						<div class="clearfix"></div>
					</div>
				</div>

				<div class="span5">
					<div class="well well-small">
						<div class="center">
							<img src="components/com_kunena/media/icons/kunena_logo.png"/>
						</div>
						<dl class="dl-horizontal">
							<hr class="hr-condensed">
							<dt><?php echo JText::_('COM_KUNENA_CPANEL_LABEL_VERSION') ?>:</dt>
							<dd><?php echo KunenaForum::version(); ?></dd>
							<hr class="hr-condensed">
							<dt><?php echo JText::_('COM_KUNENA_CPANEL_LABEL_CODENAME') ?>:</dt>
							<dd><?php echo KunenaForum::versionName(); ?></dd>
							<hr class="hr-condensed">
							<dt><?php echo JText::_('COM_KUNENA_CPANEL_LABEL_DATE') ?>:</dt>
							<dd><?php echo KunenaForum::versionDate(); ?></dd>
							<hr class="hr-condensed">
							<dt><?php echo JText::_('COM_KUNENA_CPANEL_LABEL_AUTHOR') ?>:</dt>
							<dd><a href="https://www.kunena.org/team" target="_blank">Kunena Team</a></dd>
							<hr class="hr-condensed">
							<dt><?php echo JText::_('COM_KUNENA_CPANEL_LABEL_COPYRIGHT') ?>:</dt>
							<dd>&copy; 2008 - 2016 Kunena, All rights reserved.</dd>

							<hr class="hr-condensed">
示例#17
0
文件: model.php 项目: rich20/Kunena
	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(KunenaForum::version()), strtolower($version->version), '>' ))
			$this->_action = 'UPGRADE';
		else if (version_compare ( strtolower(KunenaForum::version()), strtolower($version->version), '<' ))
			$this->_action = 'DOWNGRADE';
		else if (KunenaForum::versionBuild() && KunenaForum::versionBuild() > $version->build)
			$this->_action = 'UP_BUILD';
		else if (KunenaForum::versionBuild() && KunenaForum::versionBuild() < $version->build)
			$this->_action = 'DOWN_BUILD';
		else
			$this->_action = 'REINSTALL';

		return $this->_action;
	}
示例#18
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/" . KunenaForum::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;
 }
示例#19
0
文件: forum.php 项目: rich20/Kunena
	protected static function buildVersion() {
		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@';
	}
示例#20
0
 public function detect()
 {
     // Kunena detection and version check
     $minKunenaVersion = '2.0.0-RC2';
     if (!class_exists('KunenaForum') || !KunenaForum::isCompatible($minKunenaVersion) || !KunenaForum::installed()) {
         $this->addMessage('<div>Kunena version: <b style="color:red">FAILED</b></div>');
         $this->addMessage('<br /><div><b>You need to install Kunena ' . $minKunenaVersion . '!</b></div>');
         $this->error = 'Kunena not detected!';
         return false;
     }
     $this->addMessage('<div>Kunena version: <b style="color:green">' . KunenaForum::version() . '</b></div>');
     if (get_class($this) == __CLASS__) {
         $this->addMessage('<br /><div><b>Please select forum software!</b></div>');
         $this->error = 'Forum not selected!';
         return false;
     }
     if ($this->external) {
         if (is_dir($this->basepath)) {
             $this->relpath = JPath::clean($this->relpath);
             $this->addMessage('<div>Using relative path: <b style="color:green">' . $this->relpath . '</b></div>');
         } else {
             $this->error = $this->exttitle . " not found from {$this->basepath}";
             $this->addMessage('<div>Using relative path: <b style="color:red">' . $this->relpath . '</b></div>');
             $this->addMessage('<div><b>Error:</b> ' . $this->error . '</div>');
             return false;
         }
     }
     if (!$this->detectComponent()) {
         $this->error = $this->exttitle . ' has not been installed into your system!';
         $this->addMessage('<div>Detecting ' . $this->exttitle . ': <b style="color:red">FAILED</b></div>');
         $this->addMessage('<br /><div><b>Error:</b> ' . $this->error . '</div>');
         return false;
     }
     $this->addMessage('<div>Detecting ' . $this->exttitle . ': <b style="color:green">OK</b></div>');
     if (JError::isError($this->ext_database)) {
         $this->error = $this->ext_database->toString();
     } elseif (!$this->ext_database) {
         $this->error = 'Database not configured.';
     }
     if ($this->error) {
         $this->addMessage('<div>Database connection: <b style="color:red">FAILED</b></div>');
         $this->addMessage('<br /><div><b>Please check that your external database settings are correct!</b></div><div><b>Error:</b> ' . $this->error . '</div>');
         return false;
     }
     $this->addMessage('<div>Database connection: <b style="color:green">OK</b></div>');
     // Check if version is compatible with importer
     $this->version = $this->getVersion();
     if (!$this->isCompatible($this->version)) {
         $this->error = "Unsupported forum: {$this->exttitle} {$this->version}";
         $this->addMessage('<div>' . $this->exttitle . ' version: <b style="color:red">' . $this->version . '</b></div>');
         $this->addMessage('<div><b>Error:</b> ' . $this->error . '</div>');
         return false;
     }
     $this->addMessage('<div>' . $this->exttitle . ' version: <b style="color:green">' . $this->version . '</b></div>');
     return true;
 }
示例#21
0
					</div>
				</div>

				<div class="span5">
					<div class="well well-small">
						<div class="center">
							<img src="components/com_kunena/media/icons/kunena_logo.png" />
						</div>
						<hr class="hr-condensed">
						<dl class="dl-horizontal">
							<dt><?php 
echo JText::_('COM_KUNENA_CPANEL_LABEL_VERSION');
?>
:</dt>
							<dd><?php 
echo KunenaForum::version();
?>
</dd>
							<dt><?php 
echo JText::_('COM_KUNENA_CPANEL_LABEL_CODENAME');
?>
:</dt>
							<dd><?php 
echo KunenaForum::versionName();
?>
</dd>
							<dt><?php 
echo JText::_('COM_KUNENA_CPANEL_LABEL_DATE');
?>
:</dt>
							<dd><?php 
示例#22
0
define('KUNENA_PATH_ADMIN', KUNENA_ROOT_PATH_ADMIN .'/'. KUNENA_COMPONENT_RELPATH);

// 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);

// Legacy version information
define ('KUNENA_VERSION', KunenaForum::version());
define ('KUNENA_VERSION_DATE', KunenaForum::versionDate());
define ('KUNENA_VERSION_NAME', KunenaForum::versionName());
define ('KUNENA_VERSION_BUILD', 0);

// Joomla URL
define('KUNENA_JLIVEURL', JUri::base(true).'/');

// Joomla template dir
define('KUNENA_JTEMPLATEPATH', KUNENA_ROOT_PATH . "/templates/{$app->getTemplate()}");
define('KUNENA_JTEMPLATEURL', KUNENA_JLIVEURL. "templates/{$app->getTemplate()}");

// Kunena live URL
define('KUNENA_LIVEURL', KUNENA_JLIVEURL . 'index.php?option=com_kunena');
define('KUNENA_LIVEURLREL', 'index.php?option=com_kunena');
示例#23
0
 protected static function buildVersion()
 {
     if ('@kunenaversion@' == '@' . 'kunenaversion' . '@') {
         $file = JPATH_MANIFESTS . '/packages/pkg_kunena.xml';
         $manifest = simplexml_load_file($file);
         self::$version = (string) $manifest->version . '-GIT';
     } else {
         self::$version = strtoupper('@kunenaversion@');
     }
     self::$version_major = substr(self::$version, 0, 3);
     self::$version_date = '@kunenaversiondate@' == '@' . 'kunenaversiondate' . '@' ? JFactory::getDate()->format('Y-m-d') : '@kunenaversiondate@';
     self::$version_name = '@kunenaversionname@' == '@' . 'kunenaversionname' . '@' ? 'Git Repository' : '@kunenaversionname@';
 }