Example #1
0
 function preflight($type, $parent)
 {
     // Do not install if Kunena doesn't exist
     if (!class_exists('Kunena') || version_compare(Kunena::version(), '1.7', '<')) {
         echo sprintf('Kunena %s has not been installed, aborting!', '1.7');
         return false;
     }
     if (Kunena::isSvn()) {
         echo sprintf('You have installed Kunena from GitHub, aborting!');
         return false;
     }
     return true;
 }
Example #2
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;
 }
Example #3
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);
 }
Example #4
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>
Example #5
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>';
     }
 }
Example #6
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');
     }
 }