function writeLogs($list, $log_simple, $log_detailed) { if (ACA_CMSTYPE) { $database =& JFactory::getDBO(); } else { global $database; } //endif if ($GLOBALS[ACA . 'send_log_simple']) { $send = $log_simple; } else { $send = $log_detailed; } if (lisType::sendLogs($list->list_type)) { $database->setQuery("SELECT * FROM `#__users` WHERE `gid` = 25 LIMIT 1"); if (ACA_CMSTYPE) { // joomla 15 $admin = $database->loadObject(); $owner = subscribers::getSubscriberInfoFromUserId($list->owner); if ($GLOBALS[ACA . 'send_log'] == 1) { if (!empty($owner->email)) { JUTility::sendMail($admin->email, $admin->username, $owner->email, 'Acajoom mailing report', $send); } else { JUTility::sendMail($admin->email, $admin->username, $admin->email, 'Acajoom mailing report', $send); } } else { if ($GLOBALS[ACA . 'send_log_closed'] == 1 && connection_aborted()) { if (!empty($owner->email)) { JUTility::sendMail($admin->email, $admin->username, $owner->email, 'Acajoom mailing report', $send); } else { JUTility::sendMail($admin->email, $admin->username, $admin->email, 'Acajoom mailing report', $send); } } } } else { //joomla 1x $database->loadObject($admin); $owner = subscribers::getSubscriberInfoFromUserId($list->owner); if ($GLOBALS[ACA . 'send_log'] == 1) { if (!empty($owner->email)) { mosMail($admin->email, $admin->username, $owner->email, 'Acajoom mailing report', $send); } else { mosMail($admin->email, $admin->username, $admin->email, 'Acajoom mailing report', $send); } } else { if ($GLOBALS[ACA . 'send_log_closed'] == 1 && connection_aborted()) { if (!empty($owner->email)) { mosMail($admin->email, $admin->username, $owner->email, 'Acajoom mailing report', $send); } else { mosMail($admin->email, $admin->username, $admin->email, 'Acajoom mailing report', $send); } } } } //endif } if ($GLOBALS[ACA . 'save_log']) { if ($GLOBALS[ACA . 'save_log_simple']) { @file_put_contents(ACA_JPATH_ROOT_NO_ADMIN . $GLOBALS[ACA . 'save_log_file'], $log_simple, FILE_APPEND); } else { @file_put_contents(ACA_JPATH_ROOT_NO_ADMIN . $GLOBALS[ACA . 'save_log_file'], $log_detailed, FILE_APPEND); } } }
/** * @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; }
/** * @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 mailing($action, $task, $listId, $listType, $mailingId, $message) { $showMailings = false; switch ($task) { case 'edit': if (ACA_CMSTYPE) { // joomla 15 $issue_nb = intval(JRequest::getVar('issue_nb', 1)); } else { //joomla 1x $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 1)); } //endif $list = lists::getOneList($listId); $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new); $show = lisType::showType($mailing->list_type, 'editmailing'); if ($mailing->published != 1 or $mailing->list_type != 1 or isset($show['admin']) and $show['admin']) { $forms['main'] = " <form action='index2.php' method='post' enctype='multipart/form-data' name='adminForm'> \n "; xmailing::_header($task, $action, $mailing->list_type, $message, 'edit'); mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show); $go[] = acajoom::makeObj('act', $action); backHTML::formEnd($go); } else { $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r"; xmailing::_header($task, $action, $mailing->list_type, $message); //backHTML::formStart(); mailingsHTML::viewMailing($mailing, $forms); $go[] = acajoom::makeObj('act', 'mailing'); $go[] = acajoom::makeObj('task', 'viewmailing'); $go[] = acajoom::makeObj('listid', $mailing->list_id); backHTML::formEnd($go); } break; case 'new': case 'add': if ($listId == 0) { echo "<script> alert('" . addslashes(_ACA_SELCT_MAILING) . "'); window.history.go(-1);</script>\n"; return false; } else { $total = xmailing::countMailings($listId, ''); $total++; compa::redirect('index2.php?option=com_acajoom&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listid=' . $listId); } break; case 'saveSend': xmailing::saveMailing($mailingId, $listId); case 'sendNewsletter': if ($listId < 1 or $listType < 0) { $mailing = xmailing::getOneMailing('', $mailingId, '', $new, true); $listId = $mailing->list_id; $listType = $mailing->list_type; } if (lisType::sendType($listType)) { $checkStatus = lists::checkStatus($listId); if ($checkStatus == false) { $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NOT_PUBLISHED); $showMailings = true; } else { $receivers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, 'sub_emailA'); if (empty($receivers)) { $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NO_SUSCRIBERS); $showMailings = true; } else { $status = queue::sendNewsletter(true, $mailingId, $listId, $receivers, $message); $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message); $showMailings = true; flush(); sleep(5); compa::redirect('index2.php?option=com_acajoom&act=mailing&listype=' . $listType, $message); } } } else { if (class_exists('auto')) { $message = acajoom::printYN(auto::processQueue(true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR); } $showMailings = true; } break; case 'savePreview': xmailing::saveMailing($mailingId, $listId); case 'preview': if (ACA_CMSTYPE) { // joomla 15 $emailaddress = JRequest::getVar('emailaddress', ''); } else { //joomla 1x $emailaddress = mosGetParam($_REQUEST, 'emailaddress', ''); } //endif if (!empty($emailaddress)) { $status = xmailing::preview($mailingId, $listId, $message); $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message); } backHTML::_header(_ACA_PREVIEW_TITLE, 'preview_f2.png', $message, $task, $action); mailingsHTML::previewMailingHTML($mailingId, $listId, $listType); if ($listId > 0) { $archivemailing = xmailing::getMailingView($mailingId, $listId); } else { $archivemailing = xmailing::getMailingView($mailingId); } $forms['main'] = ''; $list = lists::getOneList($archivemailing->list_id); $textonly = ''; acajoom_mail::getContent($archivemailing->images, $list->layout, $archivemailing->htmlcontent, $textonly); acajoom_mail::replaceClass($archivemailing->htmlcontent, $textonly); mailingsHTML::viewMailing($archivemailing, $forms); break; case 'view': if ($mailingId != 0) { if ($listId > 0) { $archivemailing = xmailing::getMailingView($mailingId, $listId); } else { $archivemailing = xmailing::getMailingView($mailingId); } $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r"; xmailing::_header($task, $action, $listType, $message); backHTML::formStart('', 0, ''); mailingsHTML::viewMailing($archivemailing, $forms); $go[] = acajoom::makeObj('act', 'mailing'); $go[] = acajoom::makeObj('task', 'viewmailing'); $go[] = acajoom::makeObj('listid', $archivemailing->list_id); backHTML::formEnd($go); } break; case 'deleteMailing': $d['mailing'] = xmailing::getOneMailing('', $mailingId, '', $new); $message = acajoom::printYN(xmailing::delete($d), @constant($GLOBALS[ACA . 'listname' . $d['mailing']->list_type]) . _ACA_SUCCESS_DELETED, _ACA_ERROR); $showMailings = true; break; case 'cancel': compa::redirect('index2.php?option=com_acajoom'); break; case 'copy': $message = acajoom::printYN(xmailing::copyMailing($mailingId), _ACA_MAILING_COPY, _ACA_ERROR); $showMailings = true; break; case 'cancelMailing': $showMailings = true; break; case 'publishMailing': $mailing = xmailing::getOneMailing('', $mailingId, '', $new); $message = acajoom::printYN(xmailing::publishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_PUBLISHED, _ACA_ERROR); $showMailings = true; break; case 'unpublishMailing': $mailing = xmailing::getOneMailing('', $mailingId, '', $new); $message = acajoom::printYN(xmailing::unpublishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_UNPUBLISHED, _ACA_ERROR); $showMailings = true; break; case 'cpanel': backHTML::controlPanel(); break; case 'save': $message = acajoom::printYN(xmailing::saveMailing($mailingId, $listId), _ACA_MAILING_SAVED, _ACA_ERROR); $showMailings = true; unset($GLOBALS["task"]); unset($_REQUEST["task"]); break; case 'show': default: $showMailings = true; break; } if ($showMailings) { xmailing::showMailings($task, $action, $listId, $listType, $message, true, _ACA_MENU_MAILING); } return true; }
function userDeleted($user, $success) { require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/components/com_acajoom/classes/class.acajoom.php'; $erro = new xerr(__FILE__, __FUNCTION__); $erro->ck = subscribers::updateSubscribers(); $erro->Eck(__LINE__, '7009'); return true; }
function unsubscribe($subscriberId, $cle = '', $listId, $action) { global $Itemid; if (!empty($subscriberId) and !empty($cle) and $listId > 0) { $qid[0] = $subscriberId; $subscriber = subscribers::getSubscribersFromId($qid, false); if (md5($subscriber->email) == $cle) { $queues = queue::getSubscriberLists($subscriberId); $lists = lists::getLists($listId, 0, null, '', false, false, true); $list = $lists[0]; $mainLink = '.php?option=com_acajoom'; compa::completeLink($mainLink, false); $forms['main'] = '<form method="post" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r"; $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $link = '.php?option=com_acajoom&act=change&subscriber=' . $subscriberId . '&cle=' . $cle . '&listid=' . $listId . '&Itemid=' . $Itemid; compa::completeLink($link, false); frontHTML::formStart(_ACA_SUBSCRIPTIONS, 0, 'unsubscribe'); subscribersHTML::unsubscribe($subscriber, $list, $queues, $action, $forms); frontHTML::formEndYesNo($link, $cle, $subscriberId, $listId); } else { return false; } } else { return false; } }
function writeLogs($list, $log_simple, $log_detailed) { global $database; if ($GLOBALS[ACA . 'send_log_simple']) { $send = $log_simple; } else { $send = $log_detailed; } if (lisType::sendLogs($list->list_type)) { $database->setQuery("SELECT * FROM `#__users` WHERE `gid` = 25 LIMIT 1"); $database->loadObject($admin); if ($GLOBALS[ACA . 'send_log'] == 1) { $owner = subscribers::getSubscriberIdFromUserId($list->owner, false); if (!empty($owner->email)) { mosMail($admin->email, $admin->username, $owner->email, 'Acajoom mailing report', $send); } else { mosMail($admin->email, $admin->username, $admin->email, 'Acajoom mailing report', $send); } } else { if ($GLOBALS[ACA . 'send_log_closed'] == 1 && connection_aborted()) { if (!empty($owner->email)) { mosMail($admin->email, $admin->username, $owner->email, 'Acajoom mailing report', $send); } else { mosMail($admin->email, $admin->username, $admin->email, 'Acajoom mailing report', $send); } } } } if ($GLOBALS[ACA . 'save_log']) { if ($GLOBALS[ACA . 'save_log_simple']) { @file_put_contents($GLOBALS['mosConfig_absolute_path'] . $GLOBALS[ACA . 'save_log_file'], $log_simple, FILE_APPEND); } else { @file_put_contents($GLOBALS['mosConfig_absolute_path'] . $GLOBALS[ACA . 'save_log_file'], $log_detailed, FILE_APPEND); } } }
function saveMailing(&$mailingId, $listId) { global $database; $list = lists::getOneList($listId); $allow_html = compa::allow_html(); $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $xf = new xonfig(); $listType = mosGetParam($_REQUEST, 'listype', 0); $senddate = mosGetParam($_REQUEST, 'senddate', '0000-00-00 00:00:00'); if (mosGetParam($_REQUEST, 'task', '') == 'saveSend') { $senddate = acajoom::getNow(); } $subject = mosGetParam($_REQUEST, 'subject', '', $allow_html); $content = mosGetParam($_REQUEST, 'content', '', $allow_html); $alt_content = mosGetParam($_REQUEST, 'alt_content', '', _MOS_ALLOWRAW); $published = mosGetParam($_REQUEST, 'published', 0); $visible = mosGetParam($_REQUEST, 'visible', 1); $html = mosGetParam($_REQUEST, 'html', 1); $new_list = mosGetParam($_REQUEST, 'new_list', 0); $fromname = mosGetParam($_REQUEST, 'fromname', ''); $fromemail = mosGetParam($_REQUEST, 'fromemail', ''); $frombounce = mosGetParam($_REQUEST, 'frombounce', ''); $userid = mosGetParam($_REQUEST, 'userid', 0); $delay = mosGetParam($_REQUEST, 'delay', 1); $acc_level = mosGetParam($_REQUEST, 'acc_level', $list->acc_id); $issue_nb = mosGetParam($_REQUEST, 'issue_nb', 1); $delay = $delay * 24 * 60; $attachments = mosGetParam($_REQUEST, 'attachments', ''); $attach = ''; if (!empty($attachments)) { foreach ($attachments as $attachment) { $attach .= $attachment . "\n"; } } if (!empty($_FILES['file_0']['name'])) { $otherAttachs = xmailing::uploadFiles(); if (!empty($otherAttachs)) { foreach ($otherAttachs as $otherAttach) { $attach .= '/' . $otherAttach . "\n"; } } } $images = mosGetParam($_REQUEST, 'images', ''); if ($html == 0) { $alt_content = $content; } if ($senddate != '0000-00-00 00:00:00' and $senddate > acajoom::getNow()) { $published = 2; } if ($new_list != 0) { $query = 'INSERT INTO `#__acajoom_mailings` (`list_id`, `list_type`, `send_date`, `subject`, `htmlcontent`, `textonly`, `attachments`, `images`, `published`, `html`, `visible`, `fromname`, `fromemail`, `frombounce`, `author_id`, `delay`, `issue_nb` , `acc_level` , `createdate`) VALUES( \'' . $listId . '\', \'' . $listType . '\', \'' . $senddate . '\', \'' . addslashes($subject) . '\', \'' . addslashes($content) . '\', \'' . addslashes($alt_content) . '\', \'' . $attach . '\', \'' . $images . '\', \'' . $published . '\', \'' . $html . '\', \'' . $visible . '\', \'' . $fromname . '\', \'' . $fromemail . '\', \'' . $frombounce . '\', \'' . $userid . '\', \'' . $delay . '\', \'' . $issue_nb . '\', \'' . $acc_level . '\' , \'' . acajoom::getNow() . '\' ) '; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); $query = 'SELECT max(id) FROM `#__acajoom_mailings` WHERE `list_id` = ' . $listId . ' AND `issue_nb` = \'' . $issue_nb . '\''; $query .= ' AND `published` != -1 '; $database->setQuery($query); $mailingId = $database->loadResult(); $erro->err .= $database->getErrorMsg(); if ($mailingId == 1) { $xf->update('firstmailing', $listType); } $xf->plus('totalmailing0', 1); $xf->plus('act_totalmailing0', 1); $xf->plus('totalmailing' . $listType, 1); $xf->plus('act_totalmailing' . $listType, 1); xmailing::insertStatsGlobal($mailingId); } else { $query = "UPDATE `#__acajoom_mailings` SET " . "\t`subject` = '" . addslashes($subject) . "', " . "\t`htmlcontent` = '" . addslashes($content) . "', " . "\t`textonly` = '" . addslashes($alt_content) . "', " . "\t`attachments` = '{$attach}', " . "\t`images` = '{$images}', " . "\t`published` = '{$published}', " . "\t`html` = {$html} , " . "\t`visible` = {$visible} , " . "\t`fromname` = '{$fromname}', " . "\t`fromemail` = '{$fromemail}', " . "\t`frombounce` = '{$frombounce}', " . "\t`author_id` = '{$userid}' , " . "\t`delay` = {$delay} , " . "\t`acc_level` = {$acc_level} , " . "\t`send_date` = '{$senddate}' " . "\tWHERE `id` = {$mailingId} "; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); } if (!$erro->E(__LINE__, '8414', $database)) { return false; } else { lisType::updateNewsletters(); if ($listType == 2) { if ($new_list) { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, ''); } else { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, $mailingId, 1, 1, ''); } $subsId = acajoom::convertObjectToIdList($subscribers, 'id'); if (!empty($subsId)) { $queues = queue::getAllOneList($listId); if (!empty($queues)) { if ($queues[0]->mailing_id == 0) { $qids = acajoom::convertObjectToIdList($queues, 'qid'); $erro->ck = queue::updateQueues('', $qids, $listId, $acc_level, false); } else { $erro->ck = queue::updateQueues($subsId, '', $listId, $acc_level, false); } } else { return true; } if (!$erro->Eck(__LINE__, '8415')) { return false; } } } elseif ($listType == 1 and $senddate > acajoom::getNow()) { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, ''); $subsId = acajoom::convertObjectToIdList($subscribers, 'id'); if (!empty($subsId)) { if ($new_list == 1) { if (class_exists('auto')) { $erro->ck = auto::insertQueuesForScheduledNews($subsId, $listId, $acc_level, $mailingId, $senddate); } } else { $queues = queue::getQueueFromMailingId($mailingId); if (!empty($queues)) { $erro->ck = queue::updateQueueData('', $subsId, 1, $listId, $mailingId, $issue_nb, $senddate, 0, $acc_level, 2); return $erro->Eck(__LINE__, '8417', 'put here 1 $d'); } else { if (class_exists('auto')) { $erro->ck = auto::insertQueuesForScheduledNews($subsId, $listId, $acc_level, $mailingId, $senddate); } } } return $erro->Eck(__LINE__, '8416', 'put here 2 $d'); } } return true; } }
function updateQueues($subId, $qids, $listId, $acc_level, $new) { if (ACA_CMSTYPE) { $database =& JFactory::getDBO(); } else { global $database; } //endif $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $list = lists::getOneList($listId); if ($list->list_type == 1) { if ($new) { if (!empty($subId)) { $erro->ck = queue::insertQueuesForNews($subId, $listId, $acc_level); $erro->Eck(__LINE__, '8504'); } else { if (!empty($qids)) { $qid = implode(',', $qids); $query = 'SELECT `subscriber_id` FROM `#__acajoom_queue` WHERE `qid` IN ( ' . $qid . ' ) '; $database->setQuery($query); $subIds = $database->loadObjectList(); $erro->err = $database->getErrorMsg(); } foreach ($subIds as $v) { $subId[] = $v->subscriber_id; } $erro->ck = queue::insertQueuesForNews($subId, $listId, $acc_level); $erro->E(__LINE__, '8505'); } } else { if (!empty($subId)) { $erro->ck = queue::updateQueueData('', $subId, 0, $listId, 0, 0, 0, 0, $acc_level, 0); $erro->Eck(__LINE__, '8506'); } elseif (!empty($qids)) { $erro->ck = queue::updateQueueData($qids, '', 0, $listId, 0, 0, 0, 0, $acc_level, 0); $erro->Eck(__LINE__, '8507'); } } } elseif ($list->list_type == 7) { $newQueue->list_id = $list->id; $newQueue->mailing_id = 0; $newQueue->issue_nb = 0; $newQueue->send_date = 0; $newQueue->delay = 0; $newQueue->acc_level = $acc_level; $newQueue->published = $list->published; $erro->ck = autonews::insertQueuesForAutoNews($subId, $newQueue); $erro->Eck(__LINE__, '8508'); } else { if ($new) { if (!empty($subId)) { $mailingId = 0; $mailing = queue::getValidMailing($list, $mailingId); if (!empty($mailing)) { if (class_exists('auto')) { if ($mailing->list_type == 2) { $newQueue->list_id = $mailing->list_id; $newQueue->mailing_id = $mailing->id; $newQueue->issue_nb = $mailing->issue_nb; $newQueue->send_date = acajoom::getNow($mailing->delay); $newQueue->delay = $mailing->delay; $newQueue->acc_level = $acc_level; $newQueue->published = $list->published; $erro->ck = auto::insertQueuesForAuto($subId, $newQueue); $erro->Eck(__LINE__, '8508'); } else { $erro->ck = queue::insertQueuesForNews($subId, $mailing->list_id, $acc_level); $erro->Eck(__LINE__, '8509'); } } } else { if (class_exists('auto')) { $newQueue->list_id = $list->id; $newQueue->mailing_id = 0; $newQueue->issue_nb = 0; $newQueue->send_date = 0; $newQueue->delay = 0; $newQueue->acc_level = $acc_level; $newQueue->published = $list->published; $erro->ck = auto::insertQueuesForAuto($subId, $newQueue); $erro->Eck(__LINE__, '8510'); } } } elseif (!empty($qids)) { //On r�cup�re le premier mail du follow up $mailingId = xmailing::getFirstMailingId($listId); if (!empty($mailingId)) { $mailing = queue::getValidMailing($list, $mailingId); if (!empty($mailing)) { if ($mailing->list_type == 2) { //$subscribers = subscribers::getSubscribers( -1 , -1 , '' , $total , $listId, '', 1, 1,'' ); //$subId = acajoom::convertObjectToIdList($subscribers , 'id'); if (!empty($subId)) { $erro->ck = queue::updateQueueData('', $subId, $mailing->list_type, $listId, $mailing->id, $mailing->issue_nb, 0, $mailing->delay, 0, 1); $erro->Eck(__LINE__, '8511'); } else { $erro->ck = queue::updateQueueData($qids, '', $mailing->list_type, $listId, $mailing->id, $mailing->issue_nb, 0, $mailing->delay, 0, 1); $erro->Eck(__LINE__, '8511'); } } else { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, ''); $subId = acajoom::convertObjectToIdList($subscribers, 'id'); $erro->ck = queue::insertQueuesForNews($subId, $mailing->list_id, $acc_level); $erro->Eck(__LINE__, '8512'); } } } } } else { if (!empty($subId)) { $mailing = queue::getValidMailing($list, 0); if (!empty($mailing)) { $erro->ck = queue::updateQueueData('', $subId, $list->list_type, $listId, '', '', 0, '', 0, $list->published); } else { $erro->ck = queue::updateQueueData('', $subId, $mailing->list_type, $mailing->list_id, $mailing->id, $mailing->issue_nb, acajoom::getNow(), $mailing->delay, $acc_level, $mailing->published); } $erro->E(__LINE__, '8513'); } elseif (!empty($qids)) { $mailing = queue::getValidMailing($list, 0); if (!empty($mailing)) { if ($mailing->list_type == 2) { $erro->ck = queue::updateQueueData($qids, '', $list->list_type, $listId, $mailing->id, $mailing->issue_nb, acajoom::getNow(), $mailing->delay, 0, 1); $erro->E(__LINE__, '8514'); } else { $subId = acajoom::convertObjectToIdList($qids, 'subscriber_id'); $erro->ck = queue::deleteQueues($qids); $erro->Eck(__LINE__, '8515'); $erro->ck = queue::insertQueuesForNews($subId, $mailing->list_id, $acc_level); $erro->Eck(__LINE__, '8516'); } } } } } return $erro->R(); }
function upgrade_News3() { global $my, $database; $xf = new xonfig(); $newLists = array(); $idImportedList = array(); $i = 0; $database->setQuery("SELECT * FROM #__newsletter_letters"); $newsletters = $database->loadObjectList(); $error = $database->getErrorMsg(); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error getting newsletters. Database error: <br />' . $error . '</p>'; return false; } else { foreach ($newsletters as $newsletter) { $list->list_name = $newsletter->list_name; $list->list_desc = $newsletter->list_desc; $list->sendername = $newsletter->sendername; $list->senderemail = $newsletter->senderemail; $list->bounceadres = $newsletter->bounceadres; $list->layout = $newsletter->layout; $list->template = 0; $list->subscribemessage = $newsletter->subscribemessage; $list->unsubscribemessage = $newsletter->unsubscribemessage; $list->html = $newsletter->html; $list->hidden = !$newsletter->hidden; $list->unsubscribesend = 1; $list->list_type = '1'; $list->auto_add = 0; $list->user_choose = 0; $list->cat_id = 0; $list->delay_min = 0; $list->delay_max = 0; $list->follow_up = 0; $list->owner = $my->id; $list->auto_add = 0; $list->acc_level = $newsletter->aid; $list->acc_id = 29; $list->published = 1; $list->createdate = acajoom::getNow(); $list->footer = 1; $list->notify_id = 0; $list->notification = 0; $query = 'INSERT INTO `#__acajoom_lists` (`list_name`) VALUES (\'' . $list->list_name . '\' )'; $database->setQuery($query); $database->query(); $error = $database->getErrorMsg(); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error adding list to database. Database error: <br />' . $error . '</p><br /><br />Are you trying to insert a list name which is already in use? The list name has to be different for each list! <br /><br />'; } else { $query = 'SELECT * FROM `#__acajoom_lists` WHERE `list_name`= \'' . $list->list_name . '\''; $database->setQuery($query); $database->loadObject($mynewlist); $error = $database->getErrorMsg(); $xf->plus('totallist0', 1); $xf->plus('act_totallist0', 1); $xf->plus('totallist1', 1); $xf->plus('act_totallist1', 1); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting listname. Database error: <br />' . $error . '</p>'; return false; } else { $idImportedList[$newsletter->id] = $mynewlist->id; $newLists[$i] = $mynewlist->id; $i++; $list->id = $mynewlist->id; $error = lists::updateListData($list); if (!$error) { echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting list. Database error: <br />' . $error . '</p>'; } else { echo '<br /><b>' . @constant($GLOBALS[ACA . 'listnames1']) . ': </b>' . $list->list_name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS); $database->setQuery("SELECT * FROM #__newsletter_mailing WHERE `list_id`=" . $newsletter->id); $mailingsImports = $database->loadObjectList(); $error = $database->getErrorMsg(); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting mailings. Database error: <br />' . $error . '</p>'; return false; } else { $issue_nb = 1; foreach ($mailingsImports as $mailingsImport) { $mailings->list_id = $mynewlist->id; $mailings->list_type = '1'; $mailings->send_date = $mailingsImport->send_date; $mailings->subject = $mailingsImport->subject; $mailings->htmlcontent = $mailingsImport->htmlcontent; $mailings->textonly = $mailingsImport->textonly; $mailings->attachments = $mailingsImport->attachments; $mailings->images = $mailingsImport->images; $mailings->published = $mailingsImport->published; $mailings->visible = $mailingsImport->visible; $mailings->html = $mynewlist->html; $mailings->fromname = $list->sendername; $mailings->fromemail = $list->senderemail; $mailings->frombounce = $list->bounceadres; $mailings->author_id = $my->id; $mailings->delay = 0; $mailings->issue_nb = $issue_nb; $mailings->acc_level = 25; $mailings->createdate = $list->createdate; $issue_nb++; $error = xmailing::insertMailingData($mailings); if (!$error) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error inserting mailing. Database error: <br />' . $error . '</p>'; } else { echo '<br /><b>' . _ACA_MENU_MAILING_TITLE . ': </b>' . $mailingsImport->subject . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS); } } } } } } } $database->setQuery("SELECT * FROM #__newsletter_subscribers"); $subscribers = $database->loadObjectList(); $error = $database->getErrorMsg(); if (!empty($error)) { echo '<p><b>Error (class.upgrade.php->upgrade_News3() line ' . __LINE__ . '):</b> Error getting subscribers. Database error: <br />' . $error . '</p>'; return false; } else { foreach ($subscribers as $subscriber) { $newSubs = true; $acajoomsubscribers = subscribers::getSubscribers(-1, -1, '', $total, 0, '', '', '', ''); foreach ($acajoomsubscribers as $acajoomsubscriber) { if ($subscriber->subscriber_email == $acajoomsubscriber->email) { $newSubs = false; $subId[0] = $acajoomsubscriber->id; } } if ($newSubs) { $newSubscriber->user_id = $subscriber->userid; $newSubscriber->name = $subscriber->subscriber_name; $newSubscriber->email = $subscriber->subscriber_email; $newSubscriber->receive_html = $subscriber->receive_html; $newSubscriber->confirmed = $subscriber->confirmed; $newSubscriber->subscribe_date = $subscriber->subscribe_date; $newSubscriber->blacklist = 0; $newSubscriber->timezone = '00:00:00'; $newSubscriber->language_iso = 'eng'; $newSubscriber->params = ''; $error = subscribers::insertSubscriber($newSubscriber, $subscriberId); if (!empty($error)) { if ($subscriberId < 1) { echo ' Error inserting subscriber:' . $newSubscriber->name; } $error = ''; $subId[0] = $subscriberId; } else { echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $newSubscriber->name . ': ' . acajoom::printM('green', _ACA_IMPORT_SUCCESS); $d['email'] = $subscriber->email; $erro->ck = subscribers::getSubscriberIdFromEmail($d); $erro->Eck(__LINE__, '8304'); $subId[0] = $d['subscriberId']; } } else { echo '<br /><b>' . _ACA_MENU_SUBSCRIBERS . ': </b>' . $subscriber->subscriber_name . ': ' . acajoom::printM('red', _ACA_IMPORT_EXIST); } $j = 0; $queue = queue::suscriptionExist($subId[0], $idImportedList[$subscriber->list_id]); if (empty($queue)) { $error = queue::insertQueuesForNews($subId, $idImportedList[$subscriber->list_id], 29); if (!$error) { echo '<p><b>Error (class.upgrade.php->upgrade_News3 () line ' . __LINE__ . '):</b> Error inserting queue. Database error: <br />' . $error . '</p>'; } } } } } return true; }
function checkValidKey($subscriberId, $cle) { $qid[0] = $subscriberId; $subscriber = subscribers::getSubscribersFromId($qid, false); if (md5($subscriber->email) == $cle) { return true; } else { return false; } }
function configuration($action, $task) { global $database; $config = array(); $redirect = true; $xf = new xonfig(); $message = mosGetParam($_REQUEST, 'message', ''); switch ($task) { case 'sendQueue': if (class_exists('auto')) { echo acajoom::printYN(auto::processQueue(true, true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR); } backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; case 'reset': $xf->update('next_autonews', ''); $xf->update('last_cron', ''); $xf->update('last_sub_update', ''); $query = "UPDATE #__acajoom_lists SET `next_date` = '0' WHERE list_type = 7"; $database->setQuery($query); $database->query(); echo acajoom::printYN(true, ' Smart-Newsletter counter reset successful! ', _ACA_ERROR); backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); case 'syncUsers': echo acajoom::printYN(subscribers::syncSubscribers(), _ACA_SYNC_USERS_SUCCESS, _ACA_ERROR); backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); case 'apply': $clear_log = mosGetParam($_REQUEST, 'clear_log', 0); if ($clear_log != 0) { unlink($GLOBALS['save_log_file']); } if (empty($config)) { $config = $_REQUEST['config']; } $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR); $xf->updateActiveList(); compa::redirect('index2.php?option=com_acajoom&act=configuration&message=' . $message); break; case 'save': $clear_log = mosGetParam($_REQUEST, 'clear_log', 0); if ($clear_log != 0) { @unlink($GLOBALS['save_log_file']); } if (empty($config)) { $config = $_REQUEST['config']; } $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR); $xf->updateActiveList(); backHTML::controlPanel(); break; case 'cancel': compa::redirect('index2.php?option=com_acajoom'); break; case 'cpanel': backHTML::controlPanel(); break; default: backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; } return true; }
function userDeleted($user, $success) { require_once ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php'; $erro = new xerr(__FILE__, __FUNCTION__); if (!empty($user->user_id)) { $subscriberId = subscribers::getSubscriberIdFromUserId($user->user_id); if (!empty($subscriberId)) { subscribers::deleteOneSubscriber($subscriberId); } } $erro->ck = subscribers::updateSubscribers(); $erro->Eck(__LINE__, '7009'); return true; }
public function signup() { global $db; // check the anti-spam control expValidator::check_antispam($this->params, gt("Anti-spam verification failed. Please try again.")); // make sure we have what we need. if (empty($this->params['email'])) { expQueue::flashAndFlow('error', 'You must supply an email address to sign up for email alerts.'); } if (empty($this->params['ealerts'])) { expQueue::flashAndFlow('error', 'You did not select any E-Alert topics to subscribe to.'); } // find or create the subscriber $id = $db->selectValue('subscribers', 'id', 'email="' . $this->params['email'] . '"'); $subscriber = new subscribers($id); if (empty($subscriber->id)) { $subscriber->email = trim($this->params['email']); $subscriber->hash = md5($subscriber->email . time()); $subscriber->save(); } // delete any old subscriptions and add the user to new subscriptions $db->delete('expeAlerts_subscribers', 'subscribers_id=' . $subscriber->id); foreach ($this->params['ealerts'] as $ea_id) { $obj = null; $obj->subscribers_id = $subscriber->id; $obj->expeAlerts_id = $ea_id; $db->insertObject($obj, 'expeAlerts_subscribers'); } // send a confirmation email to the user. $ealerts = $db->selectObjects('expeAlerts', 'id IN (' . implode(',', $this->params['ealerts']) . ')'); $body = get_template_for_action($this, 'confirmation_email', $this->loc); $body->assign('ealerts', $ealerts); $body->assign('subscriber', $subscriber); $mail = new expMail(); $mail->quickSend(array('html_message' => $body->render(), 'to' => $subscriber->email, 'from' => SMTP_FROMADDRESS, 'subject' => 'Please confirm your E-Alert subscriptions')); redirect_to(array('controller' => 'ealert', 'action' => 'pending', 'id' => $subscriber->id)); }
function configuration($action, $task) { if (ACA_CMSTYPE) { $database =& JFactory::getDBO(); } else { global $database; } //endif $config = array(); $redirect = true; $xf = new xonfig(); if (ACA_CMSTYPE) { // joomla 15 $message = JRequest::getVar('message', ''); } else { //joomla 1x $message = mosGetParam($_REQUEST, 'message', ''); } //endif switch ($task) { case 'sendQueue': if (class_exists('auto')) { echo acajoom::printYN(auto::processQueue(true, true), 'Queue processed', _ACA_ERROR); } auto::displayStatus(); backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; case 'reset': $xf->update('next_autonews', ''); $xf->update('last_cron', ''); $xf->update('last_sub_update', ''); $query = "UPDATE #__acajoom_lists SET `next_date` = '0' WHERE list_type = 7"; $database->setQuery($query); $database->query(); echo acajoom::printYN(true, ' Smart-Newsletter counter reset successful! ', _ACA_ERROR); backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; case 'syncUsers': echo acajoom::printYN(subscribers::syncSubscribers(), _ACA_SYNC_USERS_SUCCESS, _ACA_ERROR); backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; case 'apply': if (ACA_CMSTYPE) { // joomla 15 $clear_log = JRequest::getVar('clear_log', '0'); } else { //joomla 1x $clear_log = mosGetParam($_REQUEST, 'clear_log', 0); } //endif if ($clear_log != 0) { unlink(ACA_JPATH_ROOT_NO_ADMIN . $GLOBALS[ACA . 'save_log_file']); } if (empty($config)) { $config = $_REQUEST['config']; } $message = strip_tags(acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR)); $xf->updateActiveList(); compa::redirect('index2.php?option=com_acajoom&act=configuration&message=' . $message); break; case 'save': if (ACA_CMSTYPE) { // joomla 15 $clear_log = JRequest::getVar('clear_log', '0'); } else { //joomla 1x $clear_log = mosGetParam($_REQUEST, 'clear_log', 0); } //endif if ($clear_log != 0) { @unlink(ACA_JPATH_ROOT_NO_ADMIN . $GLOBALS[ACA . 'save_log_file']); } if (empty($config)) { $config = $_REQUEST['config']; } $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR); $xf->updateActiveList(); backHTML::controlPanel(); break; case 'cancel': compa::redirect('index2.php?option=com_acajoom'); break; case 'cpanel': backHTML::controlPanel(); break; default: backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; } return true; }
/** * @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 subscribers($action, $task, $userid, $listId, $cid) { $erro = new xerr(__FILE__, __FUNCTION__); if (ACA_CMSTYPE) { // joomla 15 $subscriberId = intval(JRequest::getVar('subscriber_id', '')); $message = JRequest::getVar('message', ''); } else { //joomla 1x $subscriberId = intval(mosGetParam($_REQUEST, 'subscriber_id', '')); $message = mosGetParam($_REQUEST, 'message', ''); } //endif $doShowSubscribers = true; subscribers::updateSubscribers(); switch ($task) { case 'updateOneSub': $doShowSubscribers = true; $message = acajoom::printYN(subscribers::updateOneSubscriber(), _ACA_UPDATED_SUCCESSFULLY, _ACA_ERROR); backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; case 'deleteOneSub': $doShowSubscribers = true; $message = acajoom::printYN(subscribers::deleteOneSubscriber($subscriberId), _ACA_SUBSCRIBER_DELETED, _ACA_ERROR); backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; case 'cancelSub': $doShowSubscribers = true; backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; case 'edit': foreach ($cid as $id) { compa::redirect('index2.php?option=com_acajoom&act=subscribers&task=show&userid=' . $id); } break; case 'show': $doShowSubscribers = false; $qid[0] = $userid; $subscriber = subscribers::getSubscribersFromId($qid, false); $lists = lists::getLists(0, 0, 1, '', false, false); $queues = queue::getSubscriberLists($userid); $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n"; backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); backHTML::formStart('', 0, ''); echo subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, acajoom::checkPermissions('admin'), false, false); $go[] = acajoom::makeObj('act', $action); $go[] = acajoom::makeObj('subscriber_id', $subscriber->id); $go[] = acajoom::makeObj('user_id', $subscriber->user_id); backHTML::formEnd($go); break; case 'new': case 'add': $doShowSubscribers = false; $newSubscriber->id = ''; $newSubscriber->user_id = 0; $newSubscriber->name = ''; $newSubscriber->email = ''; $newSubscriber->receive_html = 1; $newSubscriber->confirmed = 1; $newSubscriber->blacklist = 0; $newSubscriber->timezone = '00:00:00'; $newSubscriber->language_iso = 'eng'; $newSubscriber->params = ''; $newSubscriber->subscribe_date = acajoom::getNow(); $lists = lists::getLists(0, 0, 1, '', false, false); $queues = ''; $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n"; backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); backHTML::formStart('', 0, ''); echo subscribersHTML::editSubscriber($newSubscriber, $lists, $queues, $forms, acajoom::checkPermissions('admin'), false, false); $go[] = acajoom::makeObj('act', $action); $go[] = acajoom::makeObj('subscriber_id', $newSubscriber->id); $go[] = acajoom::makeObj('user_id', $newSubscriber->user_id); backHTML::formEnd($go); break; case 'doNew': $doShowSubscribers = true; $message = acajoom::printYN(subscribers::insertOneSubscriber(), _ACA_UPDATED_SUCCESSFULLY, _ACA_ERROR); backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; case 'delete': if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n"; return false; } else { $status = true; foreach ($cid as $id) { $erro->ck = subscribers::deleteOneSubscriber($id); if (!$erro->ck) { $status = false; } } $message = acajoom::printYN($status, _ACA_SUBSCRIBER_DELETED, _ACA_ERROR); backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); } break; case 'update': if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Select an item to update'); window.history.go(-1);</script>\n"; return false; } else { foreach ($cid as $id) { if (ACA_CMSTYPE) { // joomla 15 $changes = JRequest::getVar($id, array(0)); } else { //joomla 1x $changes = mosGetParam($_REQUEST, $id, array(0)); } //endif if (!isset($changes['receive_html'])) { $changes['receive_html'] = 0; } if (!isset($changes['confirmed'])) { $changes['confirmed'] = 0; } } } $message = acajoom::print_message(_ACA_UPDATED_SUCCESSFULLY, 1); break; case 'export': $doShowSubscribers = false; subscribersHTML::export($action, $listId); break; case 'doExport': $message = acajoom::printYN(subscribers::export($listId), _EXPORT, _ACA_ERROR); backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; case 'import': $doShowSubscribers = false; $lists = lists::getLists(0, 0, 1, 'listnameA', false, false, true); subscribersHTML::import($action, $lists); break; case 'doImport': $message = acajoom::printYN(subscribers::import($listId), _ACA_IMPORT_FINISHED, _ACA_ERROR); backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; break; case 'subscribeAll': break; case 'unsubscribeAll': break; case 'cancel': if ($listId != 0) { $listId = 0; } else { compa::redirect('index2.php?option=com_acajoom'); } backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; case 'cpanel': backHTML::controlPanel(); $doShowSubscribers = 0; break; default: backHTML::_header(_ACA_MENU_SUBSCRIBERS, 'addusers.png', $message, $task, $action); break; } if ($doShowSubscribers) { if (ACA_CMSTYPE) { // joomla 15 $start = intval(JRequest::getVar('start', 0)); $conf =& JFactory::getConfig(); $mail->Mailer = $conf->getValue('config.mailer'); // $GLOBALS['mosConfig_mailer']; $limit = intval(JRequest::getVar('limit', $conf->getValue('config.list_limit'))); $emailsearch = JRequest::getVar('emailsearch', ''); } else { //joomla 1x $mail->Mailer = $GLOBALS['mosConfig_mailer']; $start = intval(mosGetParam($_REQUEST, 'start', 0)); $limit = intval(mosGetParam($_REQUEST, 'limit', $GLOBALS['mosConfig_list_limit'])); $emailsearch = mosGetParam($_REQUEST, 'emailsearch', ''); } //endif $total = 0; $subscribers = subscribers::getSubscribers($start, $limit, $emailsearch, $total, $listId, '', '', '', 'sub_dateD'); if ($listId != 0) { $showAdmin = true; } else { $showAdmin = false; } $dropDownList = lisType::getListsDropList(0, '', ''); if (ACA_CMSTYPE) { // joomla 15 $lists['listid'] = JHTML::_('select.genericlist', $dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'list_name', $listId); } else { //joomla 1x $lists['listid'] = mosHTML::selectList($dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'list_name', $listId); } //endif $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n"; $forms['select'] = " <form action='index2.php' method='post' name='AcajoomFilterForm'> \n"; backHTML::formStart('show_mailing', 0, ''); subscribersHTML::showSubscribers($subscribers, $action, $listId, $lists, $start, $limit, $total, $showAdmin, $listId, $emailsearch, $forms); } return true; }
function controlPanel() { //hack for JOomla 13 ADRIEN unset($GLOBALS["task"]); unset($_REQUEST["task"]); ?> <link rel="stylesheet" href="components/com_acajoom/cssadmin/acajoom.css" type="text/css" > <div align="center" class="centermain"> <div id="acajoom"> <table class="acajoomcss"> <tr> <td width="58%" valign="top"> <?php echo backHTML::iconsPanel(); ?> </td> <td width="42%" valign="top"> <div style="width=100%;"> <form action="index2.php" method="post" name="adminForm"> <?php $tabs = new mosTabs(1); $tabs->startPane('acaControlPanel'); $tabs->startTab(_ACA_MENU_TAB_SUM, "acaControlPanel.Summary"); ?> <table class="acajoom_stats" style="text-align: left; width: 100%; " cellpadding="2" cellspacing="0"> <tbody> <tr> <th style="text-align: center;"><?php echo '#'; ?> </th> <th style="text-align: center;"><?php echo _ACA_MENU_TAB_LIST; ?> </th> <th style="text-align: center;"><?php echo _ACA_MENU_MAILING_TITLE; ?> </th> <th style="text-align: center;"><?php echo _ACA_SENT_MAILING; ?> </th> <th style="text-align: center;"><?php echo _ACA_DESC_SUBSCRIBERS; ?> </th> </tr> <?php $html = ''; $totalist = 0; $totalmail = 0; $totalsub = 0; $totalsent = 0; $nb = explode(',', $GLOBALS[ACA . 'activelist']); $size = sizeof($nb); for ($i = 0; $i < $size; $i++) { $index = $nb[$i]; if ($GLOBALS[ACA . 'listshow' . $index] > 0 and $GLOBALS[ACA . 'listype' . $index] == 1) { $html .= '<tr>'; $html .= '<td><b>' . @constant($GLOBALS[ACA . 'listnames' . $index]) . '</b></td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totallist' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totalmailing' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'totalmailingsent' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totalsubcribers' . $index] . ' </td>'; $html .= '</tr>'; $totalist = $totalist + $GLOBALS[ACA . 'act_totallist' . $index]; $totalmail = $totalmail + $GLOBALS[ACA . 'act_totalmailing' . $index]; $totalsent = $totalsent + $GLOBALS[ACA . 'totalmailingsent' . $index]; if ($GLOBALS[ACA . 'act_totalsubcribers' . $index] < $totalsub) { $totalsub = $GLOBALS[ACA . 'act_totalsubcribers' . $index]; } } } $html .= '<tr>'; $html .= '<td><b>' . _ACA_CP_TOTAL . '</b></td>'; $html .= '<td style="text-align: center; ">' . $totalist . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalmail . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalsent . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalsub . ' </td>'; $html .= '</tr>'; echo $html; ?> </tbody></table> <br /> <?php if (class_exists('auto')) { echo auto::showQueue(); } $tabs->endTab(); $tabs->startTab(_ACA_MENU_SUBSCRIBERS, "acaControlPanel.Subscribers"); $emailsearch = ''; $listId = 0; $start = mosGetParam($_REQUEST, 'start', 0); $limit = mosGetParam($_REQUEST, 'limit', 15); $order = mosGetParam($_REQUEST, 'order', 'date'); $total = 0; $subscribers = subscribers::getSubscribers($start, $limit, $emailsearch, $total, $listId, '', 1, 1, 'sub_dateD'); mosCommonHTML::loadOverlib(); ?> <script type="text/javascript"> function checkcid(myField) { myField.checked = true; isChecked(true); } </script> <!-- <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> --> <form action="index2.php" method="post" name="adminForm"> <input type="hidden" name="option" value="com_acajoom" /> <input type="hidden" name="act" value="acajoom" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="userid" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="listid" value="<?php echo $listId; ?> " /> <input type="hidden" name="start" value="<?php echo $start; ?> " /> <input type="hidden" name="limit" value="<?php echo $limit; ?> " /> <input type="hidden" name="emailsearch" value="<?php echo $emailsearch; ?> " /> <table width="100%" border="0" cellspacing="0" cellpadding="4" class="adminlist"> <tr> <th class="title">#</th> <th class="title" style="text-align: left;"><?php echo _ACA_INPUT_NAME; ?> </th> <th class="title" style="text-align: left;"><?php echo _ACA_INPUT_EMAIL; ?> </th> <th class="title" style="text-align: center;"><?php echo _ACA_SIGNUP_DATE; ?> </th> </tr> <?php $i = 0; foreach ($subscribers as $subscriber) { ?> <tr class="row<?php echo $i++ % 2; ?> "> <td><?php echo $i + $start; ?> </td> <td style="text-align: left;"> <a href="index2.php?option=com_acajoom&act=subscribers&task=show&userid=<?php echo $subscriber->id; ?> " > <?php echo $subscriber->name; ?> </a></td> <td style="text-align: left;"><?php echo $subscriber->email; ?> </td> <td style="text-align: center;"><?php echo mosFormatDate($subscriber->subscribe_date, '%x'); ?> </td> </tr> <?php } ?> </table> </form> <?php backHTML::footerCounts($start, $limit, $emailsearch, $total, 4, '', $listId, ''); $tabs->endTab(); $tabs->startTab(_ACA_MENU_TAB_LIST, "acaControlPanel.Lists"); $lists = lists::getLists(0, 0, 1, '', false, false, false); ?> <table class="adminlist"> <tr> <th class="title">#</th> <th class="title" width="65%" style="text-align: left;"><?php echo _ACA_LIST_NAME; ?> </th> <th class="title" width="25%" style="text-align: left;"><?php echo _ACA_LIST_TYPE; ?> </th> <th class="title" style="text-align: center;">#id</th> </tr> <?php $i = 0; foreach ($lists as $list) { $i++; $link = 'index2.php?option=com_acajoom&act=mailing&task=show&listid=' . $list->id; ?> <tr> <td><?php echo $i; ?> </td> <td style="text-align: left;"> <a href="<?php echo $link; ?> "> <?php echo $list->list_name; ?> </a> </td> <td style="text-align: left;"><a href='index2.php?option=com_acajoom&act=mailing&listype=<?php echo $list->list_type; ?> '><?php echo @constant($GLOBALS[ACA . 'listname' . $list->list_type]); ?> </a></td> <td style="text-align: center;"><?php echo $list->id; ?> </td> </tr> <?php } ?> <tr> <th colspan="4"> </th> </tr> </table> <?php $tabs->endTab(); $tabs->endPane(); ?> </form> </div> <div style="clear:both; float:left;"> <?php echo acajoom::printM('blue', _ACA_SERVER_LOCAL_TIME . ' :' . mosFormatDate(acajoom::getNow(), '%A, %d %B %Y %H:%M', 0)); ?> </div> <td> </tr> </table> </div> </div> <?php }
function lists($action, $task, $listId, $listType) { global $database, $my; $message = ''; $xf = new xonfig(); $erro = new xerr(__FILE__, __FUNCTION__); $erro->show(); $showLists = true; switch ($task) { case 'new': if ($listType < 1) { $listType = 1; } $filename = $GLOBALS['mosConfig_absolute_path'] . '/components/com_acajoom/templates/default/default.html'; $handle = fopen($filename, "rb"); $template = fread($handle, filesize($filename)); fclose($handle); $template = str_replace('src="', 'src="' . $GLOBALS['mosConfig_live_site'] . '/', $template); $subscriber = subscribers::getSubscriberInfoFromUserId($my->id); $showLists = false; $newList->id = ''; $newList->html = 1; $newList->new_letter = 1; $newList->list_name = ''; $newList->list_desc = ''; $newList->sendername = $subscriber->name; $newList->senderemail = $subscriber->email; $newList->bounceadres = $subscriber->email; $newList->layout = $template; $newList->template = 0; $newList->hidden = 1; $newList->auto_add = 0; $newList->list_type = $listType; $newList->delay_min = 1; $newList->delay_max = 7; $newList->user_choose = 0; $newList->cat_id = 0; $newList->follow_up = ''; $newList->notify_id = 0; $newList->owner = $my->id; $newList->acc_level = 25; $newList->acc_id = 29; $newList->published = 0; $newList->start_date = date('Y-m-d', time()); $newList->next_date = time(); $newList->subscribemessage = _ACA_DEFAULT_SUBSCRIBE_MESS; $newList->unsubscribemessage = _ACA_DEFAULT_UNSUBSCRIBE_MESS; $newList->unsubscribesend = 1; $newList->footer = 1; $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n "; $show = lisType::showType($newList->list_type, 'editlist'); backHTML::_header(_ACA_NEW . ' ' . _ACA_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action); backHTML::formStart('listedit', $newList->html, ''); listsHTML::editList($newList, $forms, $show); $go[] = acajoom::makeObj('act', $action); $go[] = acajoom::makeObj('listid', $newList->id); backHTML::formEnd($go); break; case 'doNew': $listname = mosGetParam($_REQUEST, 'list_name', ''); $listType = mosGetParam($_REQUEST, 'list_type', 0); $now = acajoom::getNow(); $query = "SELECT `id` FROM `#__acajoom_lists` WHERE `list_name`= '{$listname}' "; $database->setQuery($query); $lId = $database->loadResult(); $erro->err = $database->getErrorMsg(); $erro->E(__LINE__, '1091', $database); if ($lId > 0) { echo "<script> alert(' This list already exist, please choose another name. '); window.history.go(-1);</script>\n"; return false; } else { $query = "INSERT INTO `#__acajoom_lists` (`list_name`,`createdate`) VALUES ( '" . addslashes($listname) . "' , '{$now}' )"; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); } if ($erro->E(__LINE__, '1001', $database)) { $query = "SELECT * FROM `#__acajoom_lists` WHERE `list_name`= '{$listname}' "; $database->setQuery($query); $database->loadObject($mynewlist); $mynewlist->list_name = stripslashes($mynewlist->list_name); $mynewlist->list_desc = stripslashes($mynewlist->list_desc); $mynewlist->layout = stripslashes($mynewlist->layout); $mynewlist->subscribemessage = stripslashes($mynewlist->subscribemessage); $mynewlist->unsubscribemessage = stripslashes($mynewlist->unsubscribemessage); $erro->err = $database->getErrorMsg(); $erro->E(__LINE__, '1005'); $listId = $mynewlist->id; $message = acajoom::printYN(lists::updateListFromEdit($listId, '', true), _ACA_LIST_ADDED, _ACA_ERROR); $xf->plus('totallist0', 1); $xf->plus('act_totallist0', 1); $xf->plus('totallist' . $listType, 1); $xf->plus('act_totallist' . $listType, 1); } break; case 'edit': if ($listId == 0) { echo "<script> alert('" . addslashes(_ACA_SELECT_LIST) . "'); window.history.go(-1);</script>\n"; return false; } else { $showLists = false; $query = 'SELECT * FROM `#__acajoom_lists` WHERE `id` = ' . intval($listId); $database->setQuery($query); $database->loadObject($listEdit); $erro->err = $database->getErrorMsg(); if (!$erro->E(__LINE__, '1002')) { return false; } else { $listEdit->list_name = stripslashes($listEdit->list_name); $listEdit->list_desc = stripslashes($listEdit->list_desc); $listEdit->layout = stripslashes($listEdit->layout); $listEdit->subscribemessage = stripslashes($listEdit->subscribemessage); $listEdit->unsubscribemessage = stripslashes($listEdit->unsubscribemessage); $listEdit->new_letter = 0; $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n "; $show = lisType::showType($listEdit->list_type, 'editlist'); backHTML::_header(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $listEdit->list_type]) . ' ' . _ACA_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action); backHTML::formStart('listedit', $listEdit->html, ''); listsHTML::editList($listEdit, $forms, $show); $go[] = acajoom::makeObj('act', $action); $go[] = acajoom::makeObj('listid', $listEdit->id); backHTML::formEnd($go); } } break; case 'update': $message = acajoom::printYN(lists::updateListFromEdit($listId, '', false), _ACA_LIST_UPDATED, _ACA_ERROR); break; case 'delete': $message = acajoom::printYN(lists::deleteList($listId), _ACA_LIST . _ACA_SUCCESS_DELETED, _ACA_ERROR); break; case 'copy': $message = acajoom::printYN(lists::copyList($listId), _ACA_LIST_COPY, _ACA_ERROR); break; case 'publish': $message = acajoom::printYN(lists::updateListFromList($listId, true, false), _ACA_PUBLISHED, _ACA_ERROR); break; case 'unpublish': $message = acajoom::printYN(lists::updateListFromList($listId, false, false), _ACA_UNPUBLISHED, _ACA_ERROR); break; case 'forms': case 'make': if (class_exists('createForm')) { createForm::taskOptions($task); $showLists = false; } else { $showLists = true; } break; case 'cpanel': backHTML::controlPanel(); return true; break; } if ($showLists) { backHTML::_header(_ACA_MENU_LIST, $GLOBALS[ACA . 'listlogo0'], $message, $task, $action); $show = lisType::showType(0, 'showListsBack'); $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n"; backHTML::formStart('show_mailing', '', ''); $listing = lists::getLists(0, 0, 1, '', false, false, false); if ($show['list_type']) { $show['list_type'] = lisType::checkOthers(); } listsHTML::showListingLists($listing, $action, 'edit', $forms, $show); $go[] = acajoom::makeObj('act', $action); backHTML::formEnd($go); return true; } }
function create() { global $my, $mainframe; $Itemid = $GLOBALS[ACA . 'itemidAca']; if (!empty($Itemid)) { $item = '&Itemid=' . $Itemid; } else { $item = ''; } $hidden = ''; $htmlOK = false; $h = ''; if (!empty($this->lists)) { if ($my->id > 0) { $loggedin = true; $subscriber = subscribers::getSubscriberInfoFromUserId($my->id); } else { $loggedin = false; } if (!$loggedin and $GLOBALS[ACA . 'allow_unregistered'] and $this->num == 1) { $h .= ' <script language="javascript" type="text/javascript"> function submitacajoommod(formname) { var form = eval(\'document.\'+formname);' . 'var place = form.email.value.indexOf("@",1);' . 'var point = form.email.value.indexOf(".",place+1);'; if ($this->shownamefield) { $h .= ' if (form.name.value == "" || form.name.value == "' . addslashes(_ACA_NAME) . '") { alert( "' . addslashes(_ACA_REGWARN_NAME) . '" );' . 'return false; } else '; } $h .= ' if (form.email.value == "" || form.email.value == "' . addslashes(_ACA_EMAIL) . '") {' . 'alert( "' . addslashes(_ACA_REGWARN_MAIL) . '" );' . 'return false; } else {' . 'if ((place > -1)&&(form.email.value.length >2)&&(point > 1)){' . 'form.submit();' . 'return true; } ' . 'else {' . 'alert( "' . addslashes(_ACA_REGWARN_MAIL) . '" );' . 'return false;' . '}' . '}' . '}' . '</script>'; } mosCommonHTML::loadOverlib(); $h .= '<link rel="stylesheet" href="' . $GLOBALS['mosConfig_live_site'] . '/components/com_acajoom/css/acajoom.css" type="text/css" >'; $linkForm = 'index.php?option=com_acajoom'; if ($GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) { $h .= '<form action="' . sefRelToAbs($linkForm) . '" method="post" name="modacajoomForm' . $this->num . '"> <div class="' . $this->moduleclass_sfx . '" style="text-align:' . $this->mod_align . '">'; } else { $h .= '<form action="' . $linkForm . '" method="post" name="modacajoomForm' . $this->num . '"> <div class="' . $this->moduleclass_sfx . '" style="text-align:' . $this->mod_align . '">'; } if (!empty($this->introtext)) { $text = '<span class="pretext' . $this->moduleclass_sfx . '">' . $this->introtext . '</span>'; $h .= acajoom::printLine($this->linear, $text); } $i = 0; $accessLevel = 0; if ($loggedin) { $queues = queue::getSubscriberLists($subscriber->id); } else { $queues = ''; } if ($this->showListName) { foreach ($this->lists as $list) { $i++; $subscribed = 0; $accessLevel = 0; if ($loggedin) { if (!empty($queues)) { foreach ($queues as $queue) { if ($list->id == $queue->list_id) { $subscribed = 1; $accessLevel = $queue->acc_level; } } } } if ($list->html == 1) { $htmlOK = true; } $checked = 0; if ($loggedin) { $checked = $subscribed; } else { if ($this->defaultchecked) { $checked = 1; } $subscriber->blacklist = 0; } if ($checked != 0) { $checkedPrint = ' checked="checked" '; } else { $checkedPrint = ''; } if ($list->hidden == 1) { if ($subscriber->blacklist == 0) { $text = "\n" . '<input id="wz_3' . $i . '" type="checkbox" class="inputbox" value="1" name="subscribed[' . $i . ']" ' . $checkedPrint . ' />'; } else { $text = "\n" . '<input type="checkbox" class="inputbox" value="1" name="subscribedfake[' . $i . ']" ' . $checkedPrint . ' />'; $text .= "\n" . '<input type="hidden" value="0" name="subscribed[' . $i . ']" />'; } $text .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />'; $link = ($list->list_type == '1' or $list->list_type == '7') && $GLOBALS[ACA . 'show_archive'] ? 'index.php?option=com_acajoom' . $item . '&act=mailing&task=archive&listid=' . $list->id . '&listype=' . $list->list_type : '#'; $text .= "\n" . '<span class="aca_list_name"'; if ($link == "#") { $text .= " onClick='return false;' "; } $text .= '>' . compa::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1) . '</span>'; $h .= acajoom::printLine($this->linear, $text); $h .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />' . "\n\r"; } else { if (!$loggedin) { $h .= '<input type="hidden" value="' . $checked . '" name="subscribed[' . $i . ']" />'; $h .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />'; } } } } else { foreach ($this->lists as $list) { $i++; $subscribed = 0; $accessLevel = 0; if ($loggedin) { if (!empty($queues)) { foreach ($queues as $queue) { if ($list->id == $queue->list_id) { $subscribed = 1; $accessLevel = $queue->acc_level; } } } } if ($list->html == 1) { $htmlOK = true; } $checked = 0; if ($loggedin) { $checked = $subscribed; } else { if ($this->defaultchecked) { $checked = 1; } } $h .= '<input type="hidden" value="' . $checked . '" name="subscribed[' . $i . ']" />'; $h .= "\n" . '<input type="hidden" name="sub_list_id[' . $i . ']" value="' . $list->id . '" />'; $h .= "\n" . '<input type="hidden" name="acc_level[' . $i . ']" value="' . $accessLevel . '" />'; if ($list->html == 1) { $htmlOK = true; } } } if (!$loggedin) { if ($GLOBALS[ACA . 'allow_unregistered']) { if ($this->shownamefield) { $text = '<input id="wz_11" type="text" size="' . $this->fieldsize . '" value="' . addslashes(_ACA_NAME) . '" class="inputbox" name="name" onblur="if(this.value==\'\') this.value=\'' . addslashes(_ACA_NAME) . '\';" onfocus="if(this.value==\'' . addslashes(_ACA_NAME) . '\') this.value=\'\' ; " />'; $h .= acajoom::printLine($this->linear, $text); } else { $text = '<input id="wz_11" type="hidden" value="" name="name" />'; } $text = '<input id="wz_12" type="text" size="' . $this->fieldsize . '" value="' . addslashes(_ACA_EMAIL) . '" class="inputbox" name="email" onblur="if(this.value==\'\') this.value=\'' . addslashes(_ACA_EMAIL) . '\';" onfocus="if(this.value==\'' . addslashes(_ACA_EMAIL) . '\') this.value=\'\' ; " />'; $h .= acajoom::printLine($this->linear, $text); } else { $h .= acajoom::printLine($this->linear, acajoom::printM('green', _ACA_REGISTER_REQUIRED)); $text = _NO_ACCOUNT . " "; if (isset($GLOBALS[ACA . 'cb_integration']) && $GLOBALS[ACA . 'cb_integration']) { $linkme = 'index.php?option=com_comprofiler&task=registers'; } else { $linkme = 'index.php?option=com_registration&task=register'; } if ($GLOBALS[ACA . 'use_sef'] and function_exists('sefRelToAbs')) { $text .= '<a href="' . sefRelToAbs($linkme) . '">'; } else { $text .= '<a href="' . $linkme . '">'; } $text .= _CREATE_ACCOUNT . "</a>"; $h .= acajoom::printLine($this->linear, $text); $htmlOK = false; } } if ($htmlOK) { if ($loggedin and !empty($subscriber)) { $checked = $subscriber->receive_html; } else { $checked = $this->receivehtmldefault; } if ($this->showreceivehtml) { if ($checked != 0) { $checkedPrint = ' checked="checked" '; } else { $checkedPrint = ''; } $text = '<input id="wz_2" type="checkbox" class="inputbox" value="1" name="receive_html" ' . $checkedPrint . ' />'; $text .= ' ' . _ACA_RECEIVE_HTML; $h .= acajoom::printLine($this->linear, $text); } else { $hidden .= '<input id="wz_2" type="hidden" value="' . $checked . '" name="receive_html" />' . "\n"; } } else { $hidden .= '<input id="wz_2" type="hidden" value="0" name="receive_html" />' . "\n"; } if (!empty($this->posttext)) { $text = '<span class="postext' . $this->moduleclass_sfx . '">' . $this->posttext . '</span>'; $h .= acajoom::printLine($this->linear, $text); } if (!$loggedin) { if ($GLOBALS[ACA . 'allow_unregistered']) { if (isset($this->imgUnregistered)) { $text = '<input id="aca_22" type="image" src="' . $this->imgUnregistered . '" value="' . $this->buttonUnregistered . '" alt="' . $this->buttonUnregistered . '" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />'; } else { $text = '<input id="aca_22" type="button" value="' . $this->buttonUnregistered . '" class="button" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />'; } $h .= acajoom::printLine($this->linear, $text); $h .= ' </div> <input type="hidden" name="act" value="subscribe" /> <input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" /> <input type="hidden" name="listname" value="' . $this->showListName . '" /> '; } else { $h .= '</div>'; } } else { if (isset($this->notifType) and $subscribed) { if (isset($this->imgUnregistered)) { $text = '<input id="aca_22" type="image" src="' . $this->imgUnregistered . '" value="' . $this->buttonUnregistered . '" alt="' . $this->buttonUnregistered . '" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />'; } else { $text = '<input id="aca_22" type="button" value="' . $this->buttonUnregistered . '" class="button" name="' . $this->buttonUnregistered . '" onclick="return submitacajoommod(\'modacajoomForm' . $this->num . '\');" />'; } $h .= acajoom::printLine($this->linear, $text); $h .= ' </div> <input type="hidden" name="act" value="subscribe" /> <input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" /> <input type="hidden" name="listname" value="' . $this->showListName . '" /> '; } else { if (isset($this->imgRegistered)) { $text = '<input id="aca_22" type="image" src="' . $this->imgRegistered . '" value="' . $this->buttonRegistered . '" alt="' . $this->buttonRegistered . '" name="' . $this->buttonRegistered . '">'; } else { $text = '<input id="aca_22" type="submit" value="' . $this->buttonRegistered . '" name="' . $this->buttonRegistered . '" class="button" />'; } $h .= acajoom::printLine($this->linear, $text); $h .= ' </div> <input type="hidden" name="act" value="updatesubscription" /> <input type="hidden" name="redirectlink" value="' . $this->redirectURL . '" /> <input type="hidden" name="listname" value="' . $this->showListName . '" /> '; } } $h .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $h .= $hidden . '</form>'; } else { $h .= acajoom::printM('blue', _ACA_LIST_NOT_AVAIL); } $this->_content = $h; return $h; }
function preview($mailingId, $listId, &$message) { $list = null; $new = null; $mailing = xmailing::getOneMailing($list, $mailingId, '', $new); if ($listId > 0) { $list = lists::getOneList($listId); } else { $list = lists::getOneList($mailing->list_id); } $message = ''; if (ACA_CMSTYPE) { // joomla 15 $previewemailaddress = JRequest::getVar('emailaddress', ''); $previewname = JRequest::getVar('name', ''); $previewhtml = JRequest::getVar('html', '0'); } else { //joomla 1x $previewemailaddress = mosGetParam($_REQUEST, 'emailaddress', ''); $previewname = mosGetParam($_REQUEST, 'name', ''); $previewhtml = mosGetParam($_REQUEST, 'html', 0); } //endif $receivers = null; if (ACA_CMSTYPE) { // joomla 15 $my =& JFactory::getUser(); } else { global $my; } $d['email'] = trim($previewemailaddress); $infos = subscribers::getSubscriberIdFromEmail($d); if (empty($infos['subscriberId'])) { $d['email'] = $my->email; $infos = subscribers::getSubscriberIdFromEmail($d); } if (!empty($infos['subscriberId'])) { $receivers = subscribers::getSubscribersFromId(array($infos['subscriberId'])); } else { $receivers->id = 0; } $receivers->email = $previewemailaddress; $receivers->name = $previewname; $receivers->receive_html = $previewhtml; return acajoom_mail::sendOne($mailing, $receivers, $list, $message); }
} break; case 'subscribe': $userid = intval(mosGetParam($_REQUEST, 'userid', 0)); if ($userid > 0) { global $database; $query = 'SELECT * FROM `#__users` WHERE `id` = \'' . $userid . '\''; $database->setQuery($query); $database->loadObject($user); if (!empty($user)) { $name = $user->name; $email = $user->email; } else { break; } } elseif (!subscribers::validEmail($email)) { echo '<br />' . acajoom::printM('red', _ACA_EMAIL_INVALID); echo "<script>alert('" . addslashes(_ACA_EMAIL_INVALID) . "'); window.history.go(-1);</script>\n"; break; } if ($userid > 0) { $message = frontEnd::newSubscriber($name, $email, true); } else { $message = frontEnd::newSubscriber($name, $email); } if ($GLOBALS[ACA . 'addEmailRedLink']) { if (preg_match('?', $redirectlink)) { $redirectlink .= '&email=' . $email; } else { $redirectlink .= '?email=' . $email; }
function updateList($listId, $listUpdated, $status, $new) { $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $total = 0; @set_time_limit(0); if ($listUpdated->list_type != '7' and $listUpdated->delay_min > $listUpdated->delay_max) { $listUpdated->delay_min = $listUpdated->delay_max; } $erro->ck = lists::updateListData($listUpdated); if (!$erro->Eck(__LINE__, '8304')) { return false; } else { if ($listUpdated->auto_add == 2) { subscribers::updateSubscribers(true); $subscribers = subscribers::getSubscribers(-1, -1, '', $total, 0, '', 1, 1, ''); $subId = acajoom::convertObjectToIdList($subscribers, 'id'); if (!empty($subId)) { $erro->ck = queue::updateQueues($subId, '', $listId, $listUpdated->acc_id, $new); if (!$erro->Eck(__LINE__, '8305')) { return false; } } } elseif ($status == '' and $listUpdated->list_type == 2) { $queues = queue::getAllOneList($listId); $qid = acajoom::convertObjectToIdList($queues, 'qid'); $erro->ck = queue::updatePublished($qid, $status); if (!$erro->Eck(__LINE__, '8306')) { return false; } } else { if (class_exists('auto')) { auto::updateListNb($listUpdated->list_type, $listUpdated->id); } } } lisType::updateNewsletters(); return true; }
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; }