Exemplo n.º 1
0
function com_install()
{
    global $installer_object;
    if (!isset($installer_object) || version_compare(JVERSION, '1.6', '>')) {
        JFactory::getApplication()->enqueueMessage('Oops, Joomla! 1.5 manifest file loaded! Aborting installation.', 'notice');
        return false;
    }
    // Check requirements.
    require_once dirname(__FILE__) . '/install.script.php';
    $installer = new Com_KunenaInstallerScript();
    $version = $installer_object->manifest->getElementByPath('version');
    if (!$installer->checkRequirements($version->data())) {
        return false;
    }
    $adminpath = JPATH_ADMINISTRATOR . '/components/com_kunena';
    // Remove old manifest files.
    $manifests = array('manifest.xml', 'kunena.j16.xml');
    foreach ($manifests as $filename) {
        if (JFile::exists("{$adminpath}/{$filename}")) {
            JFile::delete("{$adminpath}/{$filename}");
        }
    }
    // Create new bootstrap file for the installer and keep backup from the old version.
    if (JFile::exists("{$adminpath}/admin.kunena.php")) {
        $backuppath = "{$adminpath}/bak";
        if (JFolder::exists($backuppath)) {
            JFolder::delete($backuppath);
        }
        if (!JFolder::create($backuppath)) {
            return false;
        }
        $contents = file_get_contents("{$adminpath}/admin.kunena.php");
        if (!strstr($contents, '/* KUNENA FORUM INSTALLER */')) {
            JFile::move("{$adminpath}/admin.kunena.php", "{$backuppath}/admin.kunena.php");
        }
    }
    $success = JFile::copy("{$adminpath}/install/entrypoints/admin.kunena.php", "{$adminpath}/admin.kunena.php");
    if (!$success) {
        return false;
    }
    // Reset installer state.
    $app = JFactory::getApplication();
    $app->setUserState('kunena-old', 0);
    // This isn't called because of redirect.
    $installer_object->parent->copyManifest();
    // Redirect to Kunena Installer.
    $redirect_url = JURI::base() . 'index.php?option=com_kunena';
    header("HTTP/1.1 303 See Other");
    header("Location: {$redirect_url}");
}
Exemplo n.º 2
0
function com_uninstall()
{
    // Joomla 1.7 compatibility (class already exists)
    if (!class_exists('JVersion')) {
        // Joomla 1.5 and 1.6 compatibility (jimport needed)
        jimport('joomla.version');
    }
    $jversion = new JVersion();
    if ($jversion->RELEASE != '1.5') {
        return;
    }
    include_once dirname(__FILE__) . '/install.script.php';
    Com_KunenaInstallerScript::uninstall(null);
}
Exemplo n.º 3
0
function com_install() {
	if (version_compare ( phpversion (), '5.0.0', '<' )) {
		echo "ERROR: PHP 5.2 REQUIRED!";
		return false;
	}

	if (version_compare(JVERSION, '1.6','>')) {
		echo "ERROR: WRONG MANIFEST FILE LOADED, PLEASE TRY AGAIN WITH THE LATEST VERSION OF JOOMLA!";
		return false;
	}

	// Emulate J1.6 installer
	include_once(dirname(__FILE__).'/install.script.php');
	Com_KunenaInstallerScript::preflight( null, null );
	Com_KunenaInstallerScript::install ( null );

	// Redirect to Kunena Installer
	header ( "HTTP/1.1 303 See Other" );
	header ( "Location: " . JURI::base () . 'index.php?option=com_kunena&view=install&task=prepare&'.JUtility::getToken().'=1' );
}
Exemplo n.º 4
0
function com_install()
{
    if (version_compare(phpversion(), '5.0.0', '<')) {
        echo "ERROR: PHP 5.2 REQUIRED!";
        return false;
    }
    // Joomla 1.7 compatibility (class already exists)
    if (!class_exists('JVersion')) {
        // Joomla 1.5 and 1.6 compatibility (jimport needed)
        jimport('joomla.version');
    }
    $jversion = new JVersion();
    if ($jversion->RELEASE != '1.5') {
        echo "ERROR: WRONG MANIFEST FILE LOADED, PLEASE TRY AGAIN WITH THE LATEST VERSION OF JOOMLA!";
        return false;
    }
    // Emulate J1.6 installer
    include_once dirname(__FILE__) . '/install.script.php';
    Com_KunenaInstallerScript::preflight(null, null);
    Com_KunenaInstallerScript::install(null);
    // Redirect to Kunena Installer
    header("HTTP/1.1 303 See Other");
    header("Location: " . JURI::base() . "index.php?option=com_kunena&view=install");
}
Exemplo n.º 5
0
kimport('error');
KunenaError::initialize();
$kunena_app =& JFactory::getApplication();
require_once KPATH_ADMIN . '/install/version.php';
$kn_version = new KunenaVersion();
if ($view == 'install') {
    require_once KPATH_ADMIN . '/install/controller.php';
    $controller = new KunenaControllerInstall();
    $controller->execute($task);
    $controller->redirect();
    return;
}
if (!$kn_version->checkVersion() && $task != 'schema' && $task != 'schemadiff') {
    require_once dirname(__FILE__) . '/install.script.php';
    Com_KunenaInstallerScript::preflight(null, null);
    Com_KunenaInstallerScript::install(null);
    while (@ob_end_clean()) {
    }
    $kunena_app->redirect(JURI::root() . 'administrator/index.php?option=com_kunena&view=install');
}
require_once KPATH_SITE . '/lib/kunena.defines.php';
$lang = JFactory::getLanguage();
$lang->load('com_kunena', JPATH_SITE);
jimport('joomla.utilities.arrayhelper');
// Now that we have the global defines we can use shortcut defines
require_once KUNENA_PATH_LIB . '/kunena.config.class.php';
$kunena_config = KunenaFactory::getConfig();
$kunena_db = JFactory::getDBO();
// Class structure should be used after this and all the common task should be moved to this class
require_once KUNENA_PATH . '/class.kunena.php';
require_once KUNENA_PATH_ADMIN . '/admin.kunena.html.php';
Exemplo n.º 6
0
function com_uninstall() {
	$jversion = new JVersion ();
	if ($jversion->RELEASE != '1.5') return;
	include_once(dirname(__FILE__).'/install.script.php');
	Com_KunenaInstallerScript::uninstall ( null );
}
Exemplo n.º 7
0
function com_uninstall() {
	if (version_compare(JVERSION, '1.6','>')) return;
	include_once(dirname(__FILE__).'/install.script.php');
	Com_KunenaInstallerScript::uninstall ( null );
}