function com_install() { if (defined('JPATH_ROOT') and class_exists('JFactory')) { define('JNEWS_JPATH_ROOT', JPATH_ROOT); } if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (is_dir(JNEWS_JPATH_ROOT . DS . "administrator" . DS . "components" . DS . "com_jnews" . DS)) { $filename_for_del = JNEWS_JPATH_ROOT . DS . "administrator" . DS . "components" . DS . "com_jnews" . DS . "admin.jnews.php"; if (file_exists($filename_for_del)) { if (is_writable($filename_for_del)) { unlink($filename_for_del); } } } if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } require_once JNEWS_JPATH_ROOT . DS . 'components' . DS . 'com_jnews' . DS . 'defines.php'; require_once JNEWSPATH_ADMIN . 'classes' . DS . 'config.php'; require_once JNEWSPATH_ADMIN . 'admin.jnews.html.php'; require_once JNEWSPATH_CLASS . DS . 'class.jnews.php'; @ini_set('max_execution_time', 0); //If memory_limit less than 128M $limit = jnews::convertToBytes(@ini_get('memory_limit')); if ($limit < jnews::convertToBytes('128M')) { @ini_set('memory_limit', '128M'); } $xf = new jNews_Config(); $return = ''; //we install the jNews Menus installMenu(); $database = JFactory::getDBO(); $q = " SELECT `text` FROM `#__jnews_xonfig` WHERE `akey` = 'version' "; $database->setQuery($q); $vers = $database->loadResult(); $err = $database->getErrorMsg(); $version = jnews::getVersion(); //we check if availability column exists in jnews_templates $q = "SHOW FIELDS FROM `#__jnews_templates`"; $database->setQuery($q); $templateFields = $database->loadObjectList('Field'); if (!empty($version) and $version < '7.3.0') { $query[] = "ALTER TABLE `#__jnews_listssubscribers` ADD `params` TEXT NOT NULL"; $query[] = "ALTER TABLE `#__jnews_queue` ADD `params` TEXT NOT NULL"; } if (!empty($version) and $version < '7.2.0') { $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Newsletter' WHERE `text`='newsletter' AND `akey`='classes1' "; $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Autoresponder' WHERE `text`='autoresponder' AND `akey`='classes2' "; $query[] = "UPDATE `#__jnews_xonfig` SET `text`='jNews_Autonews' WHERE `text`='autonews' AND `akey`='classes7' "; } if (!empty($version) && $version < '7.1.0') { $query[] = "ALTER TABLE `#__jnews_lists` ADD `subnotifysend` TINYINT(1) NOT NULL DEFAULT '1', ADD `subnotifymsg` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL"; $query[] = "ALTER TABLE `#__jnews_templates` ADD `csstyle` TEXT NOT NULL"; $query[] = "UPDATE `#__jnews_templates` SET `body` = REPLACE(`body`,'components/com_jnews/templates/','media/com_jnews/templates/')"; } if (!empty($version) && $version < '7.0.2') { $xf->insert('cron_pass', 'ibHrqqFb'); $xf->insert('nextdate', '0'); $xf->insert('lastdate', '0'); } if (!empty($version) && $version < '6.1.2') { $xf->insert('url_pass', 'xfr1tyh6', 0); $xf->insert('create_newsubsrows', '5', 0); $xf->insert('use_backendview', '0', 0); $xf->insert('terms_condition', '0', 0); $xf->insert('show_terms', '0', 0); $xf->insert('check_terms', '0', 0); } if (empty($err) and !empty($version) and $version < '6.0.2') { if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social')) { $query[] = "ALTER TABLE `#__jnews_lists` ADD `siteend` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0'"; } } $query[] = "ALTER TABLE `#__jnews_lists` CHANGE `acc_id` `acc_id` VARCHAR( 200 ) NOT NULL DEFAULT 'all'"; $query[] = "ALTER TABLE `#__jnews_lists` CHANGE `acc_level` `acc_level` VARCHAR( 200 ) NOT NULL DEFAULT '24,25,7,8'"; $query[] = "UPDATE `#__jnews_lists` SET `acc_id`= 'all' WHERE `acc_id`= 29"; $query[] = "UPDATE `#__jnews_lists` SET `acc_level`='24,25,7,8' WHERE `acc_level`=25"; $xf->insert('use_tags', '1', 0); $xf->insert('allow_sn', '0', 0); $xf->insert('show_sub_email', '0', 0); $xf->insert('red_subscription', '0', 0); $xf->insert('module_message', '0', 0); $xf->update('upload_url', '/components/com_jnews/upload'); } if (empty($err) && !empty($version) && $version <= '4.2.2') { //alter the table template with the column availabiltity if (is_array($templateFields) && array_key_exists('availability', $templateFields) == false) { $query[] = "ALTER TABLE `#__jnews_templates` ADD `availability` TINYINT( 1 ) NOT NULL DEFAULT '1' "; } $xf->insert('captcha_width', '80', 0); $xf->insert('captcha_height', '25', 0); } if (empty($err) and !empty($version) and $version < '5.1.0') { //alter the table queue, we also add the type in the unique key $query[] = 'ALTER TABLE `#__jnews_queue` DROP INDEX `sub_mail` , ADD UNIQUE `sub_mail` ( `subscriber_id` , `mailing_id` , `type` )'; $xf->insert('forced_html', '1', 0); } if (empty($err) and !empty($version) and $version >= '1.2.0' and $version < '2.2.2') { $query[] = 'ALTER TABLE `#__jnews_lists` ADD `notifyadminmsg` text NOT NULL'; $xf->insert('j_cron', '1', 0); } if (empty($err) and !empty($version) and $version < '4.0.2') { //delete the params column $q = "SHOW FIELDS FROM `#__jnews_queue`"; $database->setQuery($q); $queueFields = $database->loadObjectList('Field'); $q = "SHOW FIELDS FROM `#__jnews_lists`"; $database->setQuery($q); $listFields = $database->loadObjectList('Field'); if (version_compare(JVERSION, '1.6.0', '<')) { //j15 //for the update in the jos_components table for the menu auto-responder $query[] = 'UPDATE `#__components`' . ' SET admin_menu_link = \'option=' . JNEWS_OPTION . '&act=arlist&listype=2\'' . ' WHERE `option`=\'com_jnews\'' . ' AND `name`=\'Auto-responders\''; //delete the name import in the _components table $query[] = 'DELETE FROM `#__components` WHERE `name`=\'Import\' AND `option`=\'com_jnews\''; } //update max_attempts to 5 $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'max_attempts\''; //update sched_prior to 5 $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'sched_prior\''; //update ar_prior $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 1 WHERE `akey`=\'ar_prior\''; //update sm_prior $query[] = 'UPDATE `#__jnews_xonfig` SET `text` = 5 WHERE `akey`=\'sm_prior\''; $xf->insert('priord_list', '0', 0); $xf->insert('priord_subs', '0', 0); $xf->insert('show_unsubscribe', '0', 0); $xf->insert('show_unsubscribelink', '1', 0); $xf->insert('show_subscriptionlink', '1', 0); $xf->insert('queue_status', '1', 0); } if (empty($err) and !empty($version) and $version <= '4.1.2') { $xf->insert('smtp_port', '25', 0); $xf->insert('smart_queue', '0', 0); $xf->insert('sub_info_fields', '0', 0); $xf->insert('enable_jsub', '0', 0); } if (!empty($version) && $version <= '7.2.2') { //add params column if not exists $q = "SHOW FIELDS FROM `#__jnews_mailings`"; $database->setQuery($q); $queueFields = $database->loadObjectList('Field'); //we drop the column params in the table jnews_queue if (!array_key_exists('params', $queueFields)) { $query[] = 'ALTER TABLE `#__jnews_mailings` ADD `params` TEXT NOT NULL'; } $q = "SHOW FIELDS FROM `#__jnews_lists`"; $database->setQuery($q); $queueFields = $database->loadObjectList('Field'); //we drop the column params in the table jnews_queue if (!array_key_exists('params', $queueFields)) { $query[] = 'ALTER TABLE `#__jnews_lists` ADD `params` TEXT NOT NULL'; } $xf->insert('smtp_secure', '', 0); } if (!empty($version) && $version <= '7.3.9') { $xf->insert('lasttime_cron_triggerred', '0', 0); $xf->insert('show_unsubscribe_all', '1', 0); $xf->insert('send_log_email', '0', 0); $query[] = 'ALTER TABLE `#__jnews_queue` ADD `block` TINYINT NOT NULL DEFAULT 0'; //add block column in the queue table //we get the values of red_subscription, module_message, enable_captcha, captcha_width, captcha_height, show_terms, check_terms, terms_condition from config table to be able to insert it the module params $red_subscription = $xf->getKeyValues("red_subscripition"); $module_message = $xf->getKeyValues("module_message"); $enable_captcha = $xf->getKeyValues("enable_captcha"); $captcha_width = $xf->getKeyValues("captcha_width"); $captcha_height = $xf->getKeyValues("captcha_height"); $show_terms = $xf->getKeyValues("show_terms"); $check_terms = $xf->getKeyValues("check_terms"); $terms_condition = $xf->getKeyValues("terms_condition"); $additionalParams = ''; $additionalParams .= "use_new=0" . "\n"; $additionalParams .= "red_subscripition=" . $red_subscription . "\n"; $additionalParams .= "module_message=" . $module_message . "\n"; $additionalParams .= "enable_captcha=" . $enable_captcha . "\n"; $additionalParams .= "captcha_width=" . $captcha_width . "\n"; $additionalParams .= "captcha_height=" . $captcha_height . "\n"; $additionalParams .= "show_terms=" . $show_terms . "\n"; $additionalParams .= "check_terms=" . $check_terms . "\n"; $additionalParams .= "terms_condition=" . $terms_condition . "\n"; //we get the module params from the modules table and append with the values we get from above $db = JFactory::getDBO(); $queryParam = "SELECT `id`,`params` FROM `#__modules` WHERE `module`='mod_jnews'"; $db->setQuery($queryParam); $db->query(); $jnewsModuleParamsO = $db->loadObjectList('id'); if (!empty($jnewsModuleParamsO)) { foreach ($jnewsModuleParamsO as $key => $value) { $params = ''; $params .= $value->params; $params .= $additionalParams; //we update the params of the module $queryUpdateParam = "UPDATE `#__modules` SET `params`='" . $params . "' WHERE `id`=" . $key; $db->setQuery($queryUpdateParam); $db->query(); } } //we insert here the simplicity template $templatessql = 'simplicitytemplate.sql'; //to be changed if we packaged the superpack $buffer = file_get_contents(JNEWSPATH_ADMIN . DS . $templatessql); // Graceful exit and rollback if read not successful if ($buffer) { // Create an array of queries from the sql file jimport('joomla.installer.helper'); $queries = JInstallerHelper::splitSql($buffer); // No queries to process if (count($queries) != 0) { // Process each query in the $queries array (split out of sql file). foreach ($queries as $simplicityquery) { $simplicityquery = trim($simplicityquery); if ($simplicityquery != '' && $simplicityquery[0] != '#') { $database->setQuery($simplicityquery); if (!$database->query()) { JError::raiseWarning(1, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $database->stderr(true)); } } } //endfoearch } } } if (!empty($version) && $version <= '7.4.5') { if (version_compare(JVERSION, '1.6.0', '>=')) { //j16 $query[] = 'UPDATE `#__assets` SET `rules`=\'{"core.admin":{"1":1},"core.manage":{"1":1}}\' WHERE `name`=\'com_jnews\''; } } // ALTER TABLE `jos_jnews_mailings` CHANGE `cat_id` `cat_id` VARCHAR( 250 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0:0' if (empty($version) || $version < '7.5.0') { $xf->update('show_unsubscribelink', '1'); $xf->update('show_subscriptionlink', '1'); $xf->update('upload_url', '/media/com_jnews/upload'); $q = "SHOW FIELDS FROM `#__jnews_mailings`"; $database->setQuery($q); $queueFields = $database->loadObjectList('Field'); if (!array_key_exists('smart_date', $queueFields)) { $query[] = 'ALTER TABLE `#__jnews_mailings` ADD `smart_date` TINYINT UNSIGNED NOT NULL DEFAULT 0'; } $q = "SHOW FIELDS FROM `#__jnews_queue`"; $database->setQuery($q); $queueFields = $database->loadObjectList('Field'); if (!array_key_exists('params', $queueFields)) { $query[] = 'ALTER TABLE `#__jnews_queue` ADD `params` TEXT NOT NULL'; } if (!array_key_exists('block', $queueFields)) { $query[] = 'ALTER TABLE `#__jnews_queue` ADD `block` TINYINT NOT NULL DEFAULT 0'; } } if (empty($version) || version_compare($version, '7.6.0', '<')) { $xf->insert('sntag_norequired', '1'); $conf = JFactory::getConfig(); $xf->insert('sendmail_email', $conf->get('config.mailfrom')); $xf->insert('subs_redirect_url', ''); $xf->insert('subscribe_notification', ''); $xf->insert('unsubscribe_notification', ''); $xf->insert('component_theme', 'joobilist'); $xf->insert('allow_fe_autoresponder', '0'); } if (empty($version) || version_compare($version, '7.7.0', '<')) { $xf->insert('archive_link', 'standard'); } //Query to quickly synchronise all your subscribers during the install! $query[] = "INSERT IGNORE INTO `#__jnews_subscribers` ( `user_id` , `name` , `email` , `receive_html` , `confirmed` , `blacklist` , `subscribe_date` )" . "SELECT U.id, U.name, U.email, '1', '1', U.block , UNIX_TIMESTAMP(U.registerDate) from `#__users` as U;"; if (empty($vers)) { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $query[] = "UPDATE #__components SET ordering = -2147483800 WHERE admin_menu_link='option=com_jnews'"; // }else{ //j16 // $query[] = "UPDATE #__extensions SET ordering = -2147483800 WHERE element='option=com_jnews'"; } } //We publish back the module $query[] = "UPDATE `#__modules` SET `published`= 1 WHERE `module` LIKE '%jnews%' "; $size = sizeof($query); for ($index = 0; $index < $size; $index++) { $database->setQuery($query[$index]); $database->query(); } if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social')) { if (!empty($version) && $version < '6.0.2') { $xf->insert('use_masterlists', '1', 0); $xf->insert('list_creatorfe', '24,25,7,8', 0); } jNews_Social::createMasterList(1); jNews_Social::createMasterList(2); jNews_Social::createMasterList(3); jNews_Social::createMasterList(4); } } //we call sql file for the additional templates if (is_array($templateFields) && array_key_exists('availability', $templateFields)) { //line to be removed code #7321011 $templatessql = 'dwntemplates.sql'; //to be changed if we packaged the superpack $buffer = file_get_contents(JNEWSPATH_ADMIN . DS . $templatessql); // Graceful exit and rollback if read not successful if ($buffer) { // Create an array of queries from the sql file jimport('joomla.installer.helper'); $queries = JInstallerHelper::splitSql($buffer); // No queries to process if (count($queries) != 0) { // Process each query in the $queries array (split out of sql file). foreach ($queries as $query) { $query = trim($query); if ($query != '' && $query[0] != '#') { $database->setQuery($query); if (!$database->query()) { JError::raiseWarning(1, 'JInstaller::install: ' . JText::_('SQL Error') . " " . $database->stderr(true)); //return false; } } } //endfoearch } } } if (empty($vers)) { $xf->filetoDatabase($confiX); } //create the upload directory jnews::createDirectory(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'upload' . DS); //check if CSS file exist if not move it jimport('joomla.filesystem.folder'); $cssLocation = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'modules' . DS; if (!JFolder::exists($cssLocation)) { JFolder::copy(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'components' . DS . JNEWS_OPTION . DS . 'modules' . DS, $cssLocation); } if (empty($vers)) { setupMaiOptions($confiX); } //we install the default templates installDefTemplate(); //we install the extensions installExtensions(); //we send a welcome message to the admin/logged in user of the site that jNews is successfully installed //we will only send email at fresh install if (empty($version)) { sendWelcomeEmail(); } if (jnews::checkCB()) { installPlugin(); } jNews_Subscribers::updateCBSubscribers(true, true); $xf->update('component', $confiX['component']); $xf->update('type', $confiX['type']); $xf->update('version', $confiX['version']); $xf->update('level', $confiX['level']); if (!($confiX['type'] == 'GPL' || $confiX['type'] == 'CORE')) { $message = jnews::M('noimage', _JNEWS_THANKYOU, false); } if (empty($message)) { $message = ''; } backHTML::_header(_JNEWS_MENU_INSTALL, 'install.png', $message, '', ''); $html = ''; $link = 'index.php?option=' . JNEWS_OPTION . '&act=start'; $docuLink = 'http://www.joobi.co/index.php?option=com_content&view=article&id=7871:installation-errors&catid=29:jnews&Itemid=72'; $html .= ' ' . _JNEWS_INSTALL_ERRORN . ' <a href="' . $docuLink . '">' . _JNEWS_INSTALL_DOC . '</a>'; // if acajoom component exist... means this would be an update // display an update button require_once JNEWSPATH_CLASS . 'class.update.php'; if (jNews_Update::checkAcajoom()) { //check if acajoom data are already transferred to jnews tables if (!jNews_Update::checkAcaUpdate()) { $html .= '<div style="border: 5px groove #F0F8FF; padding: 10px; position: fixed; right: 1px; top: 150px; background-color: #F0F8FF;">'; $html .= '<img border="0" align="right" alt="jNews Logo" src="components/' . JNEWS_OPTION . '/images/jnewsletter.png" width="25">'; $html .= '<br><br><span style="font-size:15px;text-decoration:none;">' . _JNEWS_INSTALL_ACAUPDATEMSG . '</span></b>'; $html .= '<a href="index.php?option=' . JNEWS_OPTION . '&act=acaupdate">'; $html .= '<div style="background-image: url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'btn_orange.png); background-repeat:no-repeat; height: 15px; width: 170px; border:none; padding:13px 40px 15px; position:relative; left:50px; top:10px;">'; $html .= '<span style="color: #FFF; font-weight: bold; padding-right:30px; margin-top: 5px; text-decoration: none;"> ' . _JNEWS_INSTALL_ACAUPDATEBTN . ' </span>'; $html .= '</div></a>'; $html .= '<br><br>'; $html .= '<b>' . _JNEWS_INSTALL_ACAUPDATENOTE . '</b>'; $html .= '<br><br>'; $html .= '</div>'; } } $html .= '<div style="float:center;padding: 20px; width:470px; margin-right: 10px;"><center>' . '<a href="index.php?option=' . JNEWS_OPTION . '&act=start"> <div style="background-image: url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'btn_orange.png); background-repeat:no-repeat; height: 40px; width: 232px; border:none; padding:12px 0 15px 0;"> <span style="color: #FFF; font-weight: bold; padding-right:30px; margin-top: 5px; text-decoration: none;">' . _JNEWS_INSTALL_CLICKSTART . '</span></div> </a></center></div><div style="clear:both;"></div>'; if ($confiX['level'] > 2) { backHTML::about(); echo '<center>' . $html; echo $return . '</center>'; } elseif ($confiX['level'] > 1) { backHTML::installPRO($html, $return); } else { backHTML::installPlus($html, $return); } return $return; }
/** * @copyright Copyright (C) 2009 Joobi Limited All rights reserved. * @license This file is released under the GPL license (http://www.gnu.org/licenses ) * @link http://www.ijoobi.com */ function com_install() { @ini_set('max_execution_time', 0); @ini_set('memory_limit', '128M'); if (defined('JPATH_ROOT') and class_exists('JFactory')) { // joomla 15 define('ACA_JPATH_ROOT', JPATH_ROOT); } else { define('ACA_JPATH_ROOT', $GLOBALS['mosConfig_absolute_path']); } //endif require_once ACA_JPATH_ROOT . '/components/com_acajoom/defines.php'; require_once WPATH_ADMIN . 'config.acajoom.php'; require_once WPATH_ADMIN . 'admin.acajoom.html.php'; require_once WPATH_CLASS . 'class.acajoom.php'; $update = new wupdate(); $xf = new xonfig(); $return = ''; if (ACA_CMSTYPE) { $database =& JFactory::getDBO(); } else { global $database; } //endif if (!is_writable(ACA_JPATH_ROOT_NO_ADMIN . $acajoomConfigFile['upload_url'])) { @chmod(ACA_JPATH_ROOT_NO_ADMIN . $acajoomConfigFile['upload_url'], 0777); } $query[] = "UPDATE #__components\n\t SET admin_menu_img='../administrator/components/com_acajoom/images/acajoom_icon.png'\n\t WHERE admin_menu_link='option=com_acajoom'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/edit.png',\n\t name='" . _ACA_MENU_LIST . "',\n\t admin_menu_alt='" . _ACA_MENU_LIST . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=list'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/users_add.png' ,\n\t name='" . _ACA_MENU_SUBSCRIBERS . "',\n\t admin_menu_alt='" . _ACA_MENU_SUBSCRIBERS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=subscribers'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/messaging_inbox.png' ,\n\t name='" . _ACA_MENU_NEWSLETTERS . "',\n\t admin_menu_alt='" . _ACA_MENU_NEWSLETTERS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=mailing&listype=1'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/messaging_config.png' ,\n\t name='" . _ACA_MENU_AUTOS . "',\n\t admin_menu_alt='" . _ACA_MENU_AUTOS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=mailing&listype=2'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/query.png' ,\n\t name='" . _ACA_MENU_STATS . "',\n\t admin_menu_alt='" . _ACA_MENU_STATS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=statistics'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/menus.png' ,\n\t name='" . _ACA_MENU_CONF . "',\n\t admin_menu_alt='" . _ACA_MENU_CONF . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=configuration'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/restore.png' ,\n\t name='" . _ACA_MENU_UPDATE . "',\n\t admin_menu_alt='" . _ACA_MENU_UPDATE . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=update'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/credits.png' ,\n\t name='" . _ACA_MENU_ABOUT . "',\n\t admin_menu_alt='" . _ACA_MENU_ABOUT . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=about'"; $q = " SELECT `text` FROM `#__acajoom_xonfig` WHERE `akey` = 'version' "; $database->setQuery($q); $vers = $database->loadResult(); $err = $database->getErrorMsg(); if (!empty($err)) { $q = " SELECT `text` FROM `#__acajoom_xonfig` WHERE `key` = 'version' "; $database->setQuery($q); $vers = $database->loadResult(); if (!empty($vers) and $update->checkVersion($vers, '1.0.6')) { ### UPDATE database if before 1.0.7 $query[] = "ALTER TABLE `#__acajoom_mailings` CHANGE `images` `images` TEXT NOT NULL "; $query[] = "ALTER TABLE `#__acajoom_lists` ADD `footer` TINYINT( 1 ) NOT NULL DEFAULT '1' "; $query[] = "ALTER TABLE `#__acajoom_lists` ADD `notify_id` INT( 10 ) NOT NULL DEFAULT '0' "; $query[] = "ALTER TABLE `#__acajoom_xonfig` DROP INDEX `key` "; $query[] = "ALTER TABLE `#__acajoom_xonfig` CHANGE `key` `akey` VARCHAR( 32 ) NOT NULL "; $query[] = "ALTER TABLE `#__acajoom_xonfig` CHANGE `value` `value` INT( 11 ) NOT NULL "; $query[] = "ALTER TABLE `#__acajoom_stats_global` DROP `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_global` DROP INDEX `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_global` ADD PRIMARY KEY ( `mailing_id` ) "; $query[] = "ALTER TABLE `#__acajoom_stats_details` DROP `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_details` DROP INDEX `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_details` ADD PRIMARY KEY ( `mailing_id` , `subscriber_id` ) "; ### 1.0.9 $query[] = " ALTER TABLE `#__acajoom_mailings` CHANGE `fromname` `fromname` VARCHAR( 64 ) NOT NULL "; $query[] = " ALTER TABLE `#__acajoom_lists` CHANGE `sendername` `sendername` VARCHAR( 64 ) NOT NULL "; } } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.0.8')) { $query[] = " ALTER TABLE `#__acajoom_mailings` CHANGE `fromname` `fromname` VARCHAR( 64 ) NOT NULL "; $query[] = " ALTER TABLE `#__acajoom_lists` CHANGE `sendername` `sendername` VARCHAR( 64 ) NOT NULL "; ### upgrade path for new versions $xf->insert('wait_for_user', '0', 0); $xf->insert('report_site', 'http://www.ijoobi.com', 0); $xf->insert('use_sef', '0', 0); $xf->insert('send_error', '1', 0); $xf->insert('report_error', '1', 0); $xf->insert('wait_for_user', '0', 0); $xf->insert('show_archive', '1', 0); $xf->insert('update_notification', '1', 0); $xf->update('send_log_address', '@ijoobi.com'); $xf->update('update_url', 'http://www.ijoobi.com/update/'); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.1.0')) { $query[] = "ALTER TABLE `#__acajoom_lists` ADD `notification` INT( 10 ) NOT NULL DEFAULT '0' "; $xf->update('listname1', '_ACA_NEWSLETTER'); $xf->update('listnames1', '_ACA_MENU_NEWSLETTERS'); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.1.4')) { $xf->insert('last_sub_update', '', 0); $xf->insert('level', '1', 0); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.3.0')) { $xf->insert('show_author', '0', 0); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.5.5')) { $xf->insert('addEmailRedLink', '0', 0); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.5.5')) { $query[] = " ALTER TABLE `#__acajoom_subscribers` ADD INDEX `subscribe_date` ( `subscribe_date` ) "; $query[] = " ALTER TABLE `#__acajoom_queue` CHANGE `subscriber_id` `subscriber_id` INT( 11 ) DEFAULT '0' NOT NULL "; } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.6.4')) { $xf->insert('show_jcalpro', '0', 0); $xf->insert('redirectconfirm', '', 0); $xf->insert('itemidAca', '99', 0); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '3.2.0')) { $xf->insert('fullcheck', '0', 0); } $query2 = "SHOW COLUMNS FROM `#__acajoom_lists` "; $database->setQuery($query2); $columns = $database->loadResultArray(); if (!in_array('cat_id', $columns)) { $query[] = "ALTER TABLE `#__acajoom_lists` CHANGE `choose_time` `cat_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"; } if (!in_array('next_date', $columns)) { $query[] = "ALTER TABLE `#__acajoom_lists` ADD `next_date` INT( 11 ) NOT NULL AFTER `notify_id` "; } if (!in_array('start_date', $columns)) { $query[] = "ALTER TABLE `#__acajoom_lists` ADD `start_date` DATE NOT NULL AFTER `next_date`"; } $query[] = 'UPDATE `#__acajoom_lists` SET `acc_level` = 24 WHERE `acc_level` = 0'; foreach ($acajoomConfigFile as $key => $val) { if (!isset($GLOBALS[ACA . $key])) { $xf->insert($key, $val, 0); } } if (!empty($vers) and $update->checkVersion($vers, '1.2.2')) { $query[] = "UPDATE `#__acajoom_lists` SET `acc_id` = '29' WHERE `acc_id` = '25' "; } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '3.0.0')) { $xf->insert('disabletooltip', '0', 0); $xf->insert('minisendmail', '0', 0); } $query[] = "ALTER TABLE `#__acajoom_lists` CHANGE `cat_id` `cat_id` VARCHAR( 250 ) NOT NULL DEFAULT ''"; if (empty($err) and !empty($vers) and $update->checkVersion($vers, '3.2.3')) { $xf->insert('embed_images', '0', 0); $xf->insert('clean_stats', '90', 0); $xf->insert('word_wrap', '0', 0); $query[] = "UPDATE `#__acajoom_lists` SET `cat_id` = CONCAT(`cat_id`,':',`notify_id`), `notify_id`= 0 WHERE `list_type` = 7 AND `notify_id` > 0"; } //Query to quickly synchronise all your subscribers during the install! $query[] = "INSERT IGNORE INTO `#__acajoom_subscribers` ( `user_id` , `name` , `email` , `receive_html` , `confirmed` , `blacklist` , `subscribe_date` )" . "SELECT U.id, U.name, U.email, '1', '1', U.block , U.registerDate from `#__users` as U;"; if (!defined('WADMIN')) { define('WADMIN', 'administrator' . DS . 'components' . DS . 'com_acajoom' . DS); } if (!defined('WFRONT')) { define('WFRONT', 'components' . DS . 'com_acajoom' . DS); } $file[] = 'templates'; $file[] = 'templates/default'; $file[] = 'templates/index.html'; $file[] = 'templates/default/default.html'; $file[] = 'templates/default/tpl0_abovefooter.jpg'; $file[] = 'templates/default/tpl0_powered_by.gif'; $file[] = 'templates/default/tpl0_spacer.gif'; $file[] = 'templates/default/tpl0_top_header.jpg'; $file[] = 'templates/default/tpl0_underban.jpg'; $file[] = 'templates/default/index.html'; foreach ($file as $key5 => $ins) { if (!file_exists(ACA_JPATH_ROOT . DS . WFRONT . $ins) && file_exists(ACA_JPATH_ROOT . DS . WADMIN . $ins)) { @rename(ACA_JPATH_ROOT . DS . WADMIN . $ins, ACA_JPATH_ROOT . DS . WFRONT . $ins); } } $size = sizeof($query); for ($index = 0; $index < $size; $index++) { $database->setQuery($query[$index]); $database->query(); } if (empty($vers)) { $xf->filetoDatabase($acajoomConfigFile); } $return .= setupMaiOptions($acajoomConfigFile); $return .= installBots(); $return .= installModule(); if (acajoom::checkCB()) { $return .= installPlugin(); } subscribers::updateSubscribers(true, true); require_once WPATH_ADMIN . 'version.php'; $xf->update('component', $localVersion['component']); $xf->update('type', $localVersion['type']); $xf->update('version', $localVersion['version']); $xf->update('level', $localVersion['level']); $message = acajoom::printM('noimage', _ACA_THANKYOU); backHTML::_header(_ACA_MENU_INSTALL, 'install.png', $message, '', ''); if ($acajoomConfigFile['type'] == 'PRO') { backHTML::about(); } elseif ($acajoomConfigFile['type'] == 'Plus') { backHTML::installPRO(); } else { backHTML::installPlus(); } $link = 'index2.php?option=com_acajoom&act=start'; echo '<table style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0"><tbody><tr>' . '<td style=" width: 140px;"> </td><td style="text-align: center; vertical-align: middle; width: 140px;"><div id="cpanel">'; backHTML::quickiconButton($link, 'inbox.png', _ACA_GET_STARTED, false, 'admin'); echo '</div><td></td></td></tr></tbody></table>' . '<div style="clear:both;"></div>'; echo '<br/><br/><br/><br/>'; echo '<a href="http://www.ijoobi.com/index.php?option=com_content&view=article&id=7871:installation-errors&catid=29:acajoom&Itemid=72" target="_blank">If you have any error during the install process, please refer to our documentation at http://www.ijoobi.com/index.php?option=com_content&view=article&id=7871:installation-errors&catid=29:acajoom&Itemid=72</a>'; echo '<br/><br/>'; echo $return; return $return; }
function com_install() { global $database; global $_VERSION; require_once $GLOBALS['mosConfig_absolute_path'] . '/components/com_acajoom/defines.php'; require_once WPATH_ADMIN . 'config.acajoom.php'; require_once WPATH_ADMIN . 'admin.acajoom.html.php'; require_once WPATH_CLASS . 'class.acajoom.php'; $update = new wupdate(); $xf = new xonfig(); $return = ''; if (!is_writable($GLOBALS['mosConfig_absolute_path'] . $acajoomConfigFile['upload_url'])) { @chmod($GLOBALS['mosConfig_absolute_path'] . $acajoomConfigFile['upload_url'], 0777); } $query[] = "UPDATE #__components\n\t SET admin_menu_img='../administrator/components/com_acajoom/images/acajoom_icon.png'\n\t WHERE admin_menu_link='option=com_acajoom'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/edit.png',\n\t name='" . compa::encodeutf(_ACA_MENU_LIST) . "',\n\t admin_menu_alt='" . _ACA_MENU_LIST . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=list'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/users_add.png' ,\n\t name='" . compa::encodeutf(_ACA_MENU_SUBSCRIBERS) . "',\n\t admin_menu_alt='" . _ACA_MENU_SUBSCRIBERS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=subscribers'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/messaging_inbox.png' ,\n\t name='" . compa::encodeutf(_ACA_MENU_NEWSLETTERS) . "',\n\t admin_menu_alt='" . _ACA_MENU_NEWSLETTERS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=mailing&listype=1'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/messaging_config.png' ,\n\t name='" . compa::encodeutf(_ACA_MENU_AUTOS) . "',\n\t admin_menu_alt='" . _ACA_MENU_AUTOS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=mailing&listype=2'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/query.png' ,\n\t name='" . compa::encodeutf(_ACA_MENU_STATS) . "',\n\t admin_menu_alt='" . _ACA_MENU_STATS . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=statistics'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/menus.png' ,\n\t name='" . compa::encodeutf(_ACA_MENU_CONF) . "',\n\t admin_menu_alt='" . _ACA_MENU_CONF . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=configuration'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/restore.png' ,\n\t name='" . compa::encodeutf(_ACA_MENU_UPDATE) . "',\n\t admin_menu_alt='" . _ACA_MENU_UPDATE . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=update'"; $query[] = "UPDATE #__components\n\t SET admin_menu_img='../includes/js/ThemeOffice/credits.png' ,\n\t name='" . compa::encodeutf(_ACA_MENU_ABOUT) . "',\n\t admin_menu_alt='" . _ACA_MENU_ABOUT . "'\n\t WHERE admin_menu_link='option=com_acajoom&act=about'"; $q = " SELECT `text` FROM `#__acajoom_xonfig` WHERE `akey` = 'version' "; $database->setQuery($q); $vers = $database->loadResult(); $err = $database->getErrorMsg(); if (!empty($err)) { $q = " SELECT `text` FROM `#__acajoom_xonfig` WHERE `key` = 'version' "; $database->setQuery($q); $vers = $database->loadResult(); if (!empty($vers) and $update->checkVersion($vers, '1.0.6')) { ### UPDATE database if before 1.0.7 $query[] = "ALTER TABLE `#__acajoom_mailings` CHANGE `images` `images` TEXT NOT NULL "; $query[] = "ALTER TABLE `#__acajoom_lists` ADD `footer` TINYINT( 1 ) NOT NULL DEFAULT '1' "; $query[] = "ALTER TABLE `#__acajoom_lists` ADD `notify_id` INT( 10 ) NOT NULL DEFAULT '0' "; $query[] = "ALTER TABLE `#__acajoom_xonfig` DROP INDEX `key` "; $query[] = "ALTER TABLE `#__acajoom_xonfig` CHANGE `key` `akey` VARCHAR( 32 ) NOT NULL "; $query[] = "ALTER TABLE `#__acajoom_xonfig` CHANGE `value` `value` INT( 11 ) NOT NULL "; $query[] = "ALTER TABLE `#__acajoom_stats_global` DROP `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_global` DROP INDEX `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_global` ADD PRIMARY KEY ( `mailing_id` ) "; $query[] = "ALTER TABLE `#__acajoom_stats_details` DROP `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_details` DROP INDEX `listid` "; $query[] = "ALTER TABLE `#__acajoom_stats_details` ADD PRIMARY KEY ( `mailing_id` , `subscriber_id` ) "; ### 1.0.9 $query[] = " ALTER TABLE `#__acajoom_mailings` CHANGE `fromname` `fromname` VARCHAR( 64 ) NOT NULL "; $query[] = " ALTER TABLE `#__acajoom_lists` CHANGE `sendername` `sendername` VARCHAR( 64 ) NOT NULL "; } } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.0.8')) { $query[] = " ALTER TABLE `#__acajoom_mailings` CHANGE `fromname` `fromname` VARCHAR( 64 ) NOT NULL "; $query[] = " ALTER TABLE `#__acajoom_lists` CHANGE `sendername` `sendername` VARCHAR( 64 ) NOT NULL "; ### upgrade path for new versions $xf->insert('wait_for_user', '0', 0); $xf->insert('report_site', 'http://www.acajoom.com', 0); $xf->insert('use_sef', '0', 0); $xf->insert('send_error', '1', 0); $xf->insert('report_error', '1', 0); $xf->insert('wait_for_user', '0', 0); $xf->insert('show_archive', '1', 0); $xf->insert('update_notification', '1', 0); $xf->update('send_log_address', '@acajoom.com'); $xf->update('update_url', 'http://www.acajoom.com/update/'); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.1.0')) { $query[] = "ALTER TABLE `#__acajoom_lists` ADD `notification` INT( 10 ) NOT NULL DEFAULT '0' "; $xf->update('listname1', '_ACA_NEWSLETTER'); $xf->update('listnames1', '_ACA_MENU_NEWSLETTERS'); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.1.4')) { $xf->insert('last_sub_update', '', 0); $xf->insert('level', '1', 0); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.3.0')) { $xf->insert('show_author', '0', 0); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.5.5')) { $xf->insert('addEmailRedLink', '0', 0); } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.5.5')) { $query[] = " ALTER TABLE `#__acajoom_subscribers` ADD INDEX `subscribe_date` ( `subscribe_date` ) "; $query[] = " ALTER TABLE `#__acajoom_queue` CHANGE `subscriber_id` `subscriber_id` INT( 11 ) DEFAULT '0' NOT NULL "; } if (empty($err) and !empty($vers) and $update->checkVersion($vers, '1.6.4')) { $xf->insert('show_jcalpro', '0', 0); $xf->insert('redirectconfirm', '', 0); $xf->insert('itemidAca', '99', 0); } $query2 = "SHOW COLUMNS FROM `#__acajoom_lists` "; $database->setQuery($query2); $columns = $database->loadResultArray(); if (!in_array('cat_id', $columns)) { $query[] = "ALTER TABLE `#__acajoom_lists` CHANGE `choose_time` `cat_id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"; } if (!in_array('next_date', $columns)) { $query[] = "ALTER TABLE `#__acajoom_lists` ADD `next_date` INT( 11 ) NOT NULL AFTER `notify_id` "; } if (!in_array('start_date', $columns)) { $query[] = "ALTER TABLE `#__acajoom_lists` ADD `start_date` DATE NOT NULL AFTER `next_date`"; } $query[] = 'UPDATE `#__acajoom_lists` SET `acc_level` = 24 WHERE `acc_level` = 0'; foreach ($acajoomConfigFile as $key => $val) { if (!isset($GLOBALS[ACA . $key])) { $xf->insert($key, $val, 0); } } if (!empty($vers) and $update->checkVersion($vers, '1.2.2')) { $query[] = "UPDATE `#__acajoom_lists` SET `acc_id` = '29' WHERE `acc_id` = '25' "; } if (!defined('WADMIN')) { define('WADMIN', 'administrator' . DS . 'components' . DS . 'com_acajoom' . DS); } if (!defined('WFRONT')) { define('WFRONT', 'components' . DS . 'com_acajoom' . DS); } $file[] = 'templates'; $file[] = 'templates/default'; $file[] = 'templates/index.html'; $file[] = 'templates/default/default.html'; $file[] = 'templates/default/tpl0_abovefooter.jpg'; $file[] = 'templates/default/tpl0_powered_by.gif'; $file[] = 'templates/default/tpl0_spacer.gif'; $file[] = 'templates/default/tpl0_top_header.jpg'; $file[] = 'templates/default/tpl0_underban.jpg'; $file[] = 'templates/default/index.html'; foreach ($file as $key5 => $ins) { if (!file_exists($GLOBALS['mosConfig_absolute_path'] . DS . WFRONT . $ins) && file_exists($GLOBALS['mosConfig_absolute_path'] . DS . WADMIN . $ins)) { @rename($GLOBALS['mosConfig_absolute_path'] . DS . WADMIN . $ins, $GLOBALS['mosConfig_absolute_path'] . DS . WFRONT . $ins); } } $size = sizeof($query); for ($index = 0; $index < $size; $index++) { $database->setQuery($query[$index]); $database->query(); } if (empty($vers)) { $xf->filetoDatabase($acajoomConfigFile); } $return .= setupMaiOptions($acajoomConfigFile); $return .= installBots(); $return .= installModule(); if (acajoom::checkCB()) { $return .= installPlugin(); } subscribers::updateSubscribers(true, true); require_once WPATH_ADMIN . 'version.php'; $xf->update('component', $localVersion['component']); $xf->update('type', $localVersion['type']); $xf->update('version', $localVersion['version']); $xf->update('level', $localVersion['level']); $message = acajoom::printM('noimage', _ACA_THANKYOU); backHTML::_header(_ACA_MENU_INSTALL, 'install.png', $message, '', ''); if ($acajoomConfigFile['type'] == 'PRO') { backHTML::about(); } elseif ($acajoomConfigFile['type'] == 'Plus') { backHTML::installPRO(); } else { backHTML::installPlus(); } $link = 'index2.php?option=com_acajoom&act=start'; echo '<table style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0"><tbody><tr>' . '<td style=" width: 140px;"> </td><td style="text-align: center; vertical-align: middle; width: 140px;"><div id="cpanel">'; backHTML::quickiconButton($link, 'inbox.png', _ACA_GET_STARTED, false, 'admin'); echo '</div><td></td></td></tr></tbody></table>' . '<div style="clear:both;"></div>'; echo '<br/><br/><br/><br/>'; echo compa::encodeutf($return); return $return; }