コード例 #1
0
function com_install()
{
    if (defined('_JEXEC') && class_exists('JApplication')) {
        $config = JFactory::getConfig();
        $config->setValue('config.live_site', substr_replace(JURI::root(), '', -1, 1));
        $url = JURI::root() . 'administrator/index.php?option=com_jcomments&task=postinstall';
        $version = new JVersion();
        if (version_compare('1.6.0', $version->getShortVersion()) > 0) {
            require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'language.php';
            JCommentsInstallerLanguageHelper::convertLanguages15();
        }
    } else {
        global $mainframe;
        $componentPath = $mainframe->getCfg('absolute_path') . DS . 'components' . DS . 'com_jcomments';
        require_once $componentPath . DS . 'libraries' . DS . 'joomlatune' . DS . 'filesystem.php';
        require_once $componentPath . DS . 'jcomments.legacy.php';
        require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'installer.php';
        JCommentsInstallerHelper::extractJCommentsLibraryConvert();
        if (is_file($componentPath . DS . 'libraries' . DS . 'convert' . DS . 'utf8.class.php')) {
            require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'language.php';
            JCommentsInstallerLanguageHelper::convertLanguages10();
        }
        $url = $mainframe->getCfg('live_site') . '/administrator/index2.php?option=com_jcomments&task=postinstall';
    }
    if (headers_sent()) {
        echo '<script type="text/javascript">document.location.href="' . $url . '";</script>';
    } else {
        header('Location: ' . $url);
    }
}