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';
    } else {
        global $mainframe;
        $msg = '';
        $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';
        // install libraries for Joomla 1.0
        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')) {
            // prepare language files
            require_once dirname(__FILE__) . DS . 'install' . DS . 'helpers' . DS . 'language.php';
            JCommentsInstallerLanguageHelper::convertLanguages();
        } else {
            $msg = 'Error unpacking JCommentsUtf8 library!';
        }
        $url = $mainframe->getCfg('live_site') . '/administrator/index2.php?option=com_jcomments&task=postinstall';
        if ($msg != '') {
            $url = $url . '&mosmsg=' . $msg;
        }
    }
    if (headers_sent()) {
        echo "<script>document.location.href='{$url}';</script>\n";
    } else {
        header('Location: ' . $url);
    }
}
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);
    }
}
function com_uninstall()
{
    require_once dirname(__FILE__) . DS . 'version.php';
    $version = new JCommentsVersion();
    ?>
<style type="text/css">
div#jc {width: 600px;margin: 0 auto;}
span.copyright {color: #777;display: block;margin-top: 12px;}
div#element-box span.componentname {color: #FF9900;font-family: Arial, Helvetica, sans-serif;font-size: 16px;font-weight: bold;}
div#element-box span.componentdate {color: #FF9900;font-family: Arial, Helvetica, sans-serif;font-size: 16px;font-weight: normal;}
div#element-box span.installheader {color: #FF9900;font-family: Arial, Helvetica, sans-serif;font-size: 16px;font-weight: bold;}
div#jc table td {padding: 0}
</style>

<div id="jc">

<div id="element-box">
<div class="t">
<div class="t">
<div class="t"></div>
</div>
</div>
<div class="m">

<table width="95%" border="0" cellpadding="0" cellspacing="0">
	<tr valign="top" align="left">
		<td width="50px"><img src="http://www.joomlatune.com/images/logo/jcomments.png" width="48" height="48" border="0" alt="" /></td>
		<td><span class="componentname"><?php 
    echo $version->getLongVersion();
    ?>
</span>
		<span class="componentdate">[<?php 
    echo $version->getReleaseDate();
    ?>
]</span><br />
		<span class="copyright">&copy; 2006-<?php 
    echo date('Y');
    ?>
 smart (<a href="http://www.joomlatune.ru" target="_blank">JoomlaTune.ru</a> | <a href="http://www.joomlatune.com" target="_blank">JoomlaTune.com</a>). <?php 
    echo JText::_('A_ABOUT_COPYRIGHT');
    ?>
<br /></span></td>
	</tr>
	<tr valign="top" align="left">
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>

		<tr valign="top" align="left">
			<td>&nbsp;</td>
			<td><span class="installheader"><?php 
    echo JText::_('A_UNINSTALL_LOG');
    ?>
</span></td>
		</tr>
		<tr valign="top" align="left">
			<td>&nbsp;</td>
			<td>
			<ul style="padding: 0 0 0 20px; margin: 0;">
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcomments', 'content');
    ?>
			<li><?php 
    echo JText::_('A_UNINSTALL_PLUGIN_CONTENT');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcomments', 'search');
    ?>
			<li><?php 
    echo JText::_('A_UNINSTALL_PLUGIN_SEARCH');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcomments', 'system');
    ?>
			<li><?php 
    echo JText::_('A_UNINSTALL_PLUGIN_SYSTEM');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcommentson', 'editors-xtd', array('jcommentson.gif'));
    JCommentsInstallerHelper::uninstallPlugin('jcommentsoff', 'editors-xtd', array('jcommentsoff.gif'));
    ?>
			<li><?php 
    echo JText::_('A_UNINSTALL_PLUGIN_EDITORS_XTD');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    if (JCOMMENTS_JVERSION == '1.0') {
        global $mainframe;
        $app = $mainframe;
    } else {
        JCommentsInstallerHelper::uninstallPlugin('jcomments', 'user');
        $app = JFactory::getApplication('administrator');
    }
    // Clean all caches for components with comments
    if ($app->getCfg('caching') == 1) {
        $db = JCommentsFactory::getDBO();
        $db->setQuery("SELECT DISTINCT(object_group) AS name FROM #__jcomments");
        $rows = $db->loadObjectList();
        foreach ($rows as $row) {
            $cache = JCommentsFactory::getCache($row->name);
            $cache->clean();
        }
        unset($rows);
        ?>
			<li><?php 
        echo JText::_('A_UNINSTALL_CLEAN_CACHE');
        ?>
: <span style="color: green">OK</span></li>
<?php 
    }
    ?>
			<li><span style="color: green"><strong><?php 
    echo JText::_('A_UNINSTALL_COMPLETE');
    ?>
</strong></span></li>
			</ul>
			</td>
		</tr>
	</table>

	</div>
	<div class="b">
	<div class="b">
	<div class="b"></div>
	</div>
	</div>
	</div>

	</div>
<?php 
    if (JCOMMENTS_JVERSION == '1.0') {
        global $mainframe;
        $componentPath = $mainframe->getCfg('absolute_path') . DS . 'components' . DS . 'com_jcomments';
        require_once $componentPath . DS . 'libraries' . DS . 'joomlatune' . DS . 'filesystem.php';
        $files = JoomlaTuneFS::readDirectory($componentPath . DS . 'languages', '\\.ini', false, true);
        foreach ($files as $file) {
            if (!preg_match('/[a-z]{2}-[A-Z]{2}\\.com_jcomments/', (string) $file)) {
                @unlink((string) $file);
            }
        }
    }
}
 public static function restoreSettings()
 {
     JCommentsSecurity::checkToken();
     $db = JCommentsFactory::getDBO();
     $db->setQuery("DELETE FROM `#__jcomments_settings`");
     $db->query();
     require_once dirname(__FILE__) . '/admin.jcomments.installer.php';
     $defaultSettings = dirname(__FILE__) . '/install/sql/settings.sql';
     JCommentsInstaller::executeSQL($defaultSettings);
     require_once dirname(__FILE__) . '/install/helpers/installer.php';
     JCommentsInstallerHelper::fixUsergroups();
     return JText::_('A_SETTINGS_RESTORED');
 }
function com_uninstall()
{
    global $mainframe;
    $versionInfo = JCommentsInstallerHelper::getVersionInfo('jcomments');
    ?>
<style type="text/css">
div#jc {width: 600px;margin: 0 auto;}
span.copyright {color: #777;display: block;margin-top: 12px;}
div#element-box span.componentname {color: #FF9900;font-family: Arial, Helvetica, sans-serif;font-size: 16px;font-weight: bold;}
div#element-box span.componentdate {color: #FF9900;font-family: Arial, Helvetica, sans-serif;font-size: 16px;font-weight: normal;}
div#element-box span.installheader {color: #FF9900;font-family: Arial, Helvetica, sans-serif;font-size: 16px;font-weight: bold;}
</style>

<div id="jc">

<div id="element-box">
<div class="t">
<div class="t">
<div class="t"></div>
</div>
</div>
<div class="m">

<table width="95%" border="0" cellpadding="0" cellspacing="0">
	<tr valign="top" align="left">
		<td width="50px"><img src="http://www.joomlatune.com//images/banners/jcomments_logo.png" width="48" height="48" border="0" alt="" /></td>
		<td><span class="componentname">JComments <?php 
    echo $versionInfo->releaseVersion;
    ?>
</span>
		<span class="componentdate">[<?php 
    echo $versionInfo->releaseDate;
    ?>
]</span><br />
		<span class="copyright">&copy; 2006-2010 smart (<a href="http://www.joomlatune.ru" target="_blank">JoomlaTune.ru</a> | <a href="http://www.joomlatune.com" target="_blank">JoomlaTune.com</a>). <?php 
    echo JText::_('All rights reserved!');
    ?>
<br /></span></td>
	</tr>
	<tr valign="top" align="left">
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>

		<tr valign="top" align="left">
			<td>&nbsp;</td>
			<td><span class="installheader"><?php 
    echo JText::_('Uninstall log');
    ?>
</span></td>
		</tr>
		<tr valign="top" align="left">
			<td>&nbsp;</td>
			<td>
			<ul style="padding: 0 0 0 20px; margin: 0;">
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcomments', 'content');
    ?>
			<li><?php 
    echo JText::_('Uninstall content plugin');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcomments', 'search');
    ?>
			<li><?php 
    echo JText::_('Uninstall search plugin');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcomments', 'system');
    ?>
			<li><?php 
    echo JText::_('Uninstall system plugin');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    JCommentsInstallerHelper::uninstallPlugin('jcommentson', 'editors-xtd', array('jcommentson.gif'));
    JCommentsInstallerHelper::uninstallPlugin('jcommentsoff', 'editors-xtd', array('jcommentsoff.gif'));
    JCommentsInstallerHelper::uninstallPlugin('jcomments', 'k2');
    ?>
			<li><?php 
    echo JText::_('Uninstall editors-xtd plugins');
    ?>
: <span style="color: green">OK</span></li>
<?php 
    if (defined('JPATH_ROOT')) {
        JCommentsInstallerHelper::uninstallPlugin('jcomments', 'user');
        if (!isset($mainframe)) {
            $mainframe =& JFactory::getApplication('administrator');
        }
    }
    // Clean all caches for components with comments
    if ($mainframe->getCfg('caching') == 1) {
        $db =& JCommentsFactory::getDBO();
        $db->setQuery("SELECT DISTINCT(object_group) AS name FROM #__jcomments");
        $rows = $db->loadObjectList();
        foreach ($rows as $row) {
            JCommentsCache::cleanCache($row->name);
        }
        unset($rows);
        ?>
			<li><?php 
        echo JText::_('Clean components cache');
        ?>
: <span style="color: green">OK</span></li>
<?php 
    }
    ?>
			<li><span style="color: green"><strong><?php 
    echo JText::_('JComments uninstalled');
    ?>
</strong></span></li>
			</ul>
			</td>
		</tr>
	</table>

	</div>
	<div class="b">
	<div class="b">
	<div class="b"></div>
	</div>
	</div>
	</div>

	</div>
<?php 
    if (JCOMMENTS_JVERSION == '1.0') {
        $componentPath = $mainframe->getCfg('absolute_path') . DS . 'components' . DS . 'com_jcomments';
        require_once $componentPath . DS . 'libraries' . DS . 'joomlatune' . DS . 'filesystem.php';
        $path = $componentPath . DS . 'languages';
        $filter = '\\.ini';
        $files = JoomlaTuneFS::readDirectory($path, $filter, false, true);
        foreach ($files as $file) {
            if (!preg_match('/[a-z]{2}-[A-Z]{2}\\.com_jcomments/', (string) $file)) {
                @unlink((string) $file);
            }
        }
    }
}
 function HTML_JCommentsInstaller()
 {
     $versionInfo = JCommentsInstallerHelper::getVersionInfo('jcomments');
     $this->releaseDate = $versionInfo->releaseDate;
     $this->releaseVersion = $versionInfo->releaseVersion;
 }
 public static function postInstall()
 {
     $app = JCommentsFactory::getApplication('administrator');
     $db = JCommentsFactory::getDBO();
     $installer = new HTML_JCommentsInstaller();
     JCommentsInstallerHelper::extractJCommentsPlugins();
     // create database tables
     if (JCOMMENTS_JVERSION == '1.0') {
         $sql = dirname(__FILE__) . DS . 'install' . DS . 'sql' . DS . 'install.mysql.nonutf8.sql';
         JCommentsInstaller::executeSQL($sql);
         // collation synchronization (for MySQL 4.1.2 or higher)
         if (version_compare(preg_replace('~\\-.+?$~', '', $db->getVersion()), '4.1.2') >= 0) {
             JCommentsInstallerDatabaseHelper::setupCollation();
         }
     } else {
         $config = JFactory::getConfig();
         $app = JFactory::getApplication();
         @ob_start();
         if ($config->getValue('config.legacy')) {
             $installSQL = dirname(__FILE__) . DS . 'install' . DS . 'sql' . DS . 'install.mysql.utf8.sql';
             JCommentsInstaller::executeSQL($installSQL);
         }
         jimport('joomla.filesystem.folder');
         jimport('joomla.filesystem.file');
         $jomSocialRuleSrc = dirname(__FILE__) . DS . 'install' . DS . 'xml' . DS . 'jomsocial_rule.xm';
         $jomSocialRuleDst = JCOMMENTS_BASE . DS . 'jomsocial_rule.xml';
         if (!is_file($jomSocialRuleDst)) {
             JFile::copy($jomSocialRuleSrc, $jomSocialRuleDst);
         }
         if (is_dir(JCOMMENTS_BASE . DS . 'languages')) {
             JFolder::delete(JCOMMENTS_BASE . DS . 'languages');
         }
         if (is_file(JCOMMENTS_BASE . DS . 'plugins' . DS . 'plugins.zip')) {
             JFile::delete(JCOMMENTS_BASE . DS . 'plugins' . DS . 'plugins.zip');
         }
         @ob_end_clean();
         $app->setUserState('com_installer.message', '');
         $app->setUserState('com_installer.extension_message', '');
         $app->setUserState('com_installer.redirect_url', '');
     }
     $jxml10 = dirname(__FILE__) . DS . 'jcomments10.xml';
     $jxml15 = dirname(__FILE__) . DS . 'jcomments15.xml';
     $jxml = dirname(__FILE__) . DS . 'jcomments.xml';
     if (is_file($jxml10)) {
         @rename($jxml10, $jxml);
     } else {
         if (is_file($jxml15)) {
             @rename($jxml15, $jxml);
             // fix version in xml manifest file
             if (JCOMMENTS_JVERSION == '1.7') {
                 $contents = str_replace('1.5.0', '1.7.0', implode('', file($jxml)));
                 $fh = fopen($jxml, 'w');
                 if ($fh) {
                     fputs($fh, $contents);
                     fclose($fh);
                 }
             }
         }
     }
     unset($jxml10, $jxml15, $jxml);
     if (JCOMMENTS_JVERSION != '1.7') {
         // remove files from previous version
         $files = array(dirname(__FILE__) . DS . 'admin.jcomments.subcription.php', dirname(__FILE__) . DS . 'table' . DS . 'custombbcodes.php', JCOMMENTS_BASE . DS . 'model' . DS . 'index.html', JCOMMENTS_BASE . DS . 'model' . DS . 'jcomments.php', JCOMMENTS_BASE . DS . 'model');
         foreach ($files as $file) {
             if (is_file($file)) {
                 @unlink($file);
             } else {
                 if (is_dir($file)) {
                     @rmdir($file);
                 }
             }
         }
     }
     // small stuff for future update system
     $db->setQuery('SELECT `version` FROM `#__jcomments_version`');
     $version = $db->loadResult();
     require_once dirname(__FILE__) . DS . 'version.php';
     $jcommentsVersion = new JCommentsVersion();
     $currentVersion = $jcommentsVersion->getVersion();
     $currentDate = date('Y-m-d H:i:s');
     if (empty($version)) {
         $db->setQuery("INSERT IGNORE INTO `#__jcomments_version` (`version`,`installed`) VALUES ('{$currentVersion}', '{$currentDate}')");
         @$db->query();
         // if version isn't specified - we think that it was 2.2.0.0 or earlier...
         $version = '2.2.0.0';
     } else {
         $db->setQuery("UPDATE `#__jcomments_version` SET `version` = '{$currentVersion}', `updated` = '{$currentDate}';");
         @$db->query();
     }
     // install content plugin
     $result = JCommentsInstallerHelper::installPlugin('Content - JComments', 'jcomments', 'content');
     $installer->addMessage(JText::_('A_INSTALL_PLUGIN_CONTENT'), $result);
     // install search plugin
     $result = JCommentsInstallerHelper::installPlugin('Search - JComments', 'jcomments', 'search');
     $installer->addMessage(JText::_('A_INSTALL_PLUGIN_SEARCH'), $result);
     // install system plugin
     $result = JCommentsInstallerHelper::installPlugin('System - JComments', 'jcomments', 'system');
     $installer->addMessage(JText::_('A_INSTALL_PLUGIN_SYSTEM'), $result);
     // install editor buttons
     $result = JCommentsInstallerHelper::installPlugin('Editor Button - JComments ON', 'jcommentson', 'editors-xtd', array('jcommentson.gif'));
     $result = $result && JCommentsInstallerHelper::installPlugin('Editor Button - JComments OFF', 'jcommentsoff', 'editors-xtd', array('jcommentsoff.gif'));
     $installer->addMessage(JText::_('A_INSTALL_PLUGIN_EDITORS_XTD'), $result);
     if (JCOMMENTS_JVERSION != '1.0') {
         // install user plugin
         $result = JCommentsInstallerHelper::installPlugin('User - JComments', 'jcomments', 'user');
         $installer->addMessage(JText::_('A_INSTALL_PLUGIN_USER'), $result);
     }
     // Fix component menu icon
     if (JCOMMENTS_JVERSION == '1.0') {
         $menuiconpath = $app->getCfg('absolute_path') . DS . 'includes' . DS . 'js' . DS . 'ThemeOffice';
         $adminIconsPath = '../administrator/components/com_jcomments/assets';
         if (is_writable($menuiconpath)) {
             $currentIconsPath = dirname(__FILE__) . DS . 'images';
             ob_start();
             $res1 = @copy($currentIconsPath . DS . 'icon-16-jcomments.png', $menuiconpath . DS . 'icon-16-jcomments.png');
             $res2 = @copy($currentIconsPath . DS . 'icon-16-import.png', $menuiconpath . DS . 'icon-16-import.png');
             $res3 = @copy($currentIconsPath . DS . 'icon-16-settings.png', $menuiconpath . DS . 'icon-16-settings.png');
             $res4 = @copy($currentIconsPath . DS . 'icon-16-smiles.png', $menuiconpath . DS . 'icon-16-smiles.png');
             $res5 = @copy($currentIconsPath . DS . 'icon-16-comments.png', $menuiconpath . DS . 'icon-16-comments.png');
             $res6 = @copy($currentIconsPath . DS . 'icon-16-subscriptions.png', $menuiconpath . DS . 'icon-16-subscriptions.png');
             $res7 = @copy($currentIconsPath . DS . 'icon-16-custombbcodes.png', $menuiconpath . DS . 'icon-16-custombbcodes.png');
             $res8 = @copy($currentIconsPath . DS . 'icon-16-blacklist.png', $menuiconpath . DS . 'icon-16-blacklist.png');
             ob_end_clean();
             $result = $res1 && $res2 && $res3 && $res4 && $res5 && $res6 && $res7 && $res8;
             if ($result && is_file($menuiconpath . DS . 'jcomments16x16.png')) {
                 $adminIconsPath = 'js/ThemeOffice';
             }
         }
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-jcomments.png' " . "\n WHERE admin_menu_link='option=com_jcomments'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-comments.png', name='" . JText::_('A_SUBMENU_COMMENTS') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=comments'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-settings.png', name='" . JText::_('A_SUBMENU_SETTINGS') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=settings'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-smiles.png', name='" . JText::_('A_SUBMENU_SMILES') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=smiles'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-subscriptions.png', name='" . JText::_('A_SUBMENU_SUBSCRIPTIONS') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=subscriptions'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-custombbcodes.png', name='" . JText::_('A_SUBMENU_CUSTOM_BBCODE') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=custombbcodes'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-blacklist.png', name='" . JText::_('A_SUBMENU_BLACKLIST') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=blacklist'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-import.png', name='" . JText::_('A_SUBMENU_IMPORT') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=import'");
         @$db->query();
         $db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-jcomments.png', name='" . JText::_('A_SUBMENU_ABOUT') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=about'");
         @$db->query();
     }
     if (version_compare($version, '2.3.0', 'le')) {
         // update db tables
         if (JCommentsInstallerDatabaseHelper::upgradeStructure()) {
             $installer->addMessage(JText::_('A_INSTALL_UPGRADE_TABLES'), true);
         }
         JCommentsInstallerDatabaseHelper::updateJoomGallery();
         if (JCOMMENTS_JVERSION != '1.7') {
             $db->setQuery("UPDATE `#__jcomments_settings` SET `value` = REPLACE(`value`, 'Unregistered', 'Public') ");
             $db->query();
             $db->setQuery("UPDATE `#__jcomments_settings` SET `value` = REPLACE(`value`, 'Super Administrator', 'Super Users') ");
             $db->query();
             $db->setQuery("UPDATE `#__jcomments_custom_bbcodes` SET `button_acl` = REPLACE(`button_acl`, 'Unregistered', 'Public') ");
             $db->query();
             $db->setQuery("UPDATE `#__jcomments_custom_bbcodes` SET `button_acl` = REPLACE(`button_acl`, 'Super Administrator', 'Super Users') ");
             $db->query();
         }
     }
     if (isset($_COOKIE['jcommentsadmin_group'])) {
         if (!headers_sent()) {
             setcookie('jcommentsadmin_group', '', time() - 3600, '/');
         }
         unset($_COOKIE['jcommentsadmin_group']);
     }
     $db->setQuery("SELECT `name`, `value` FROM `#__jcomments_settings`");
     $paramsList = $db->loadObjectList('name');
     if (count($paramsList) == 0) {
         $defaultSettings = dirname(__FILE__) . DS . 'install' . DS . 'sql' . DS . 'settings.sql';
         JCommentsInstaller::executeSQL($defaultSettings);
     } else {
         JCommentsInstaller::checkParam($paramsList, 'delete_mode', '0');
         JCommentsInstaller::checkParam($paramsList, 'can_publish_for_my_object', '');
         JCommentsInstaller::checkParam($paramsList, 'can_edit_for_my_object', '');
         JCommentsInstaller::checkParam($paramsList, 'can_delete_for_my_object', '');
         JCommentsInstaller::checkParam($paramsList, 'enable_blacklist', '0');
         JCommentsInstaller::checkParam($paramsList, 'can_ban', 'Administrator,Super Administrator');
         JCommentsInstaller::checkParam($paramsList, 'feed_limit', '100');
         JCommentsInstaller::checkParam($paramsList, 'report_reason_required', '1');
         if (version_compare($version, '2.2.0.0') <= 0) {
             $smilesPath = DS . 'components' . DS . 'com_jcomments' . DS . 'images' . DS . 'smiles' . DS;
             JCommentsInstaller::checkParam($paramsList, 'smiles_path', $smilesPath, true);
         }
     }
     unset($paramsList);
     if (JCOMMENTS_JVERSION == '1.7') {
         // TODO remove this hack
         JCommentsInstallerHelper::fixComponentName();
     }
     JCommentsInstallerHelper::fixUsergroups();
     $joomfish = $app->getCfg('absolute_path') . DS . 'components' . DS . 'com_joomfish' . DS . 'joomfish.php';
     if (is_file($joomfish) || JCommentsMultilingual::isEnabled()) {
         JCommentsInstaller::upgradeLanguages();
     }
     $db->setQuery("SELECT COUNT(*) FROM `#__jcomments_custom_bbcodes`;");
     $cnt = $db->loadResult();
     if ($cnt == 0) {
         $sql = dirname(__FILE__) . DS . 'install' . DS . 'sql' . DS . 'custom_bbcodes.sql';
         JCommentsInstaller::executeSQL($sql);
     }
     JCommentsInstallerHelper::fixCustomBBCodeACL();
     $installer->showInstallLog();
     $cache = JCommentsFactory::getCache('com_jcomments');
     $cache->clean();
 }
Beispiel #8
0
 function extractJCommentsPlugins()
 {
     $source = JCOMMENTS_BASE . DS . 'plugins' . DS . 'plugins.zip';
     $destination = JCOMMENTS_BASE . DS . 'plugins' . DS;
     return JCommentsInstallerHelper::extractArchive($source, $destination);
 }