function chooseType($task, $action, $listType, $actionType, $message = '', $title = '') { $results = ''; switch ($actionType) { case 'titles': if ($listType > 0) { $results = $title . _ACA_ALL . ' ' . @constant($GLOBALS[ACA . 'listnames' . $listType]); } else { $results = _ACA_MAILING_ALL; } break; case 'mailing_header': if ($listType > 0) { backHTML::_header(@constant($GLOBALS[ACA . 'listnames' . $listType]), $GLOBALS[ACA . 'listlogo' . $listType], $message, $task, $action); } else { backHTML::_header(_ACA_MAILING_ALL, $GLOBALS[ACA . 'listlogo' . $listType], $message, $task, $action); } break; case 'mailing_edit_header': backHTML::_header(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $listType]), $GLOBALS[ACA . 'listlogo' . $listType], $message, $task, $action); break; default: $results = 'not prossible case , or not yet implemented'; break; } return $results; }
public static function chooseType($task, $action, $listType, $actionType, $message = '', $title = '') { //css injection $mainPath = JNEWS_PATH_ADMIN_IMAGES2 . 'header/'; $doc = JFactory::getDocument(); $css = '.icon-48-newsletter { background-image:url(' . $mainPath . 'newsletter.png)}'; $css .= '.icon-48-autoresponder { background-image:url(' . $mainPath . 'autoresponder.png)}'; $css .= '.icon-48-smartnewsletter { background-image:url(' . $mainPath . 'smartnewsletter.png)}'; $doc->addStyleDeclaration($css, $type = 'text/css'); $results = ''; switch ($actionType) { case 'titles': if ($listType > 0) { $results = $title . _JNEWS_ALL . ' ' . @constant($GLOBALS[JNEWS . 'listnames' . $listType]); } else { $results = _JNEWS_MAILING_ALL; } break; case 'mailing_header': if ($listType > 0) { backHTML::_header(@constant($GLOBALS[JNEWS . 'listnames' . $listType]), $GLOBALS[JNEWS . 'listlogo' . $listType], $message, $task, $action); } else { backHTML::_header(_JNEWS_MAILING_ALL, 'newsletter.png', $message, $task, $action); } break; case 'mailing_edit_header': backHTML::_header(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $listType]), 'newsletter', $message, $task, $action); break; default: $results = 'not prossible case , or not yet implemented'; break; } return $results; }
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; } }
/** * <p>Templates controller</p> * <p>This function is the controller to view the templates view</p> * @author Joobi Limited <wwww.joobi.co> */ function templates($action, $task, $template_id) { $my = JFactory::getUser(); $css = '.icon-48-templates { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/templates.png)}'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'templates.png'; $templatesearch = JRequest::getVar('templatesearch', ''); $showTemplates = true; // defined toggle for publish and unpublish of mailings $willRedirect = false; $checkToggle = false; $cid = JRequest::getVar('cid'); if (empty($template_id)) { if (!empty($cid) && is_array($cid)) { $template_id = $cid[key($cid)]; } } else { if (empty($cid)) { $cid[] = $template_id; } } if (!empty($task) && $task == 'togle') { $checkToggle = true; // $id = JRequest::getVar( 'templateid' ); $id = $template_id; $col = JRequest::getVar('col'); $template_id = !empty($id) && !empty($col) ? $id : $template_id; $task = !empty($template_id) && !empty($col) ? $col : $task; $willRedirect = true; } switch ($task) { case 'new': case 'add': $showTemplates = false; $template = null; $form['main'] = " <form action='index.php' method='post' name='adminForm' enctype='multipart/form-data' id=\"adminForm\"> \n"; $message = isset($message) ? $message : ''; backHTML::_header(_JNEWS_TEMPLATES, 'templates.png', $message, $task, $action); backHTML::formStart('template', 0, ''); echo jNews_TemplatesHTML::createTemplate($template, $form); $go[] = jnews::makeObj('act', $action); backHTML::formEnd($go); break; case 'edit': $showTemplates = false; $template = jNews_Templates::loadOneTemplate('*', $template_id); $form['main'] = " <form action='index.php' method='post' name='adminForm' enctype='multipart/form-data' id=\"adminForm\">"; $message = isset($message) ? $message : ''; backHTML::_header(_JNEWS_TEMPLATES, 'templates.png', $message, $task, $action); backHTML::formStart('template', 0, ''); echo jNews_TemplatesHTML::createTemplate($template, $form); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('template_id', $template_id); backHTML::formEnd($go); break; case 'save': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Templates::saveTemplate($task, $template_id), _JNEWS_TEMPLATE_SAVED, _JNEWS_ERROR); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message); break; case 'apply': JRequest::checkToken() or die('Invalid Token'); $message = ''; $message .= jnews::printYN(jNews_Templates::saveTemplate($task, $template_id), _JNEWS_TEMPLATE_SAVED, _JNEWS_ERROR); $id = empty($template_id) ? jNews_Templates::loadOneTemplate('template_id', '', 'template_id', 'DESC') : $template_id; $converMessage = JRequest::getVar('message', '', '', 'string', JREQUEST_ALLOWRAW); if (!empty($converMessage)) { $message .= '<br/>'; $message .= implode("", $converMessage); } jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates&task=edit&template_id=' . $id, $message); break; case 'publish': if (!$checkToggle) { JRequest::checkToken() or die('Invalid Token'); } $message = jnews::printYN(jNews_Templates::updateTemplate($cid, 'published', true), 'Successfully published template!', 'Error publishing the template!'); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message); break; case 'unpublish': if (!$checkToggle) { JRequest::checkToken() or die('Invalid Token'); } $condition = jNews_Templates::updateTemplate($cid, 'published', false); if ($condition) { $message = jnews::printM('ok', 'Successfully unpublished template!'); } else { $message = jnews::printM('defaulterror', 'Unable to unpublished default template!'); } // $message = jnews::defaultYN( jNews_Templates::updateTemplate($template_id,'published', false) , 'Successfully unpublished template!' , 'Unable to unpublished default template!' ); if ($willRedirect) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message); } break; case 'copy': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Templates::copyTemplate($template_id), _JNEWS_TEMPLATE . _JNEWS_SUCCESS_COPIED, _JNEWS_ERROR); $showTemplates = true; break; case 'default': $success = false; //set all the templates to premium = 0 if (jNews_Templates::updateTemplate($template_id, 'default', false, false)) { $success = true; } //set the template published and premium if ($success) { jNews_Templates::updateTemplate($template_id, 'default', true, true); } $message = jnews::printYN($success, 'Successfully set the template to default!', 'Unable to set template to default!'); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates', $message); break; case 'delete': JRequest::checkToken() or die('Invalid Token'); $showTemplates = true; $isDefault = jNews_Templates::loadOneTemplate('premium', $template_id); if (!$isDefault) { $message = jnews::printYN(jNews_Templates::deleteTemplate($cid), _JNEWS_TEMPLATE . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR); } else { $message = jnews::printM('red', _JNEWS_TEMPLATE_DEFAULT_NODEL); } break; case 'cpanel': backHTML::controlPanel(); return true; break; case 'toggle': JRequest::checkToken() or die('Invalid Token'); // main toggle for all usage $listid = JRequest::getVar('listid'); $column = JRequest::getVar('col'); if (!empty($listid) && !empty($column)) { $passObj = new stdClass(); $passObj->tableName = '#__jnews_lists'; $passObj->columnName = $column; $passObj->whereColumn = 'id'; $passObj->whereColumnValue = $listid; jnews::toggle($passObj); } jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates'); break; case 'tempupload': // HTML for upload template // JRequest::checkToken() or die( 'Invalid Token' ); $html = '<form action="index.php?option=' . JNEWS_OPTION . '&act=templates&task=upload" method="post" name="adminForm" enctype="multipart/form-data" id="adminForm">'; $html .= '<table style="width:100%;padding:100px;">'; $html .= '<tr>'; $html .= '<td style="text-align:center;"> <input type="FILE" name="tempupload"> </td>'; $html .= '</tr><tr">'; $html .= '<td style="text-align:center;padding:20px;"> <input type="submit" value="Upload Template" style="width:130px;height:25px;"> </td>'; $html .= '</tr>'; $html .= '</table>'; if (version_compare(JVERSION, '3.0.0', '<')) { $html .= JHTML::_('form.token'); } else { $html .= JHtml::_('form.token'); } $html .= '</form><br/><br/>'; echo $html; $showTemplates = false; break; case 'sendtest': JRequest::checkToken() or die('Invalid Token'); //we save first the template $saveStatus = jNews_Templates::saveTemplate($task, $template_id); //then we send it if the template is successfully saved if ($saveStatus) { $message = jnews::printM('ok', _JNEWS_TEMPLATE_SAVED); $my = JFactory::getUser(); $mailing = new stdClass(); $receiver = new stdClass(); $status = false; $mailing->id = 1; $mailing->html = 1; $mailing->images = ''; $mailing->attachments = ''; $mailing->subject = jNews_Templates::loadOneTemplate('name', $template_id); $mailing->htmlcontent = jNews_Templates::loadOneTemplate('body', $template_id); $mailing->template_id = $template_id; $receiver->name = $my->name; $receiver->email = $my->email; $receiver->receive_html = 1; $receiver->user_id = $my->id; $mailerC = new jNews_ProcessMail(); $sendStatus = $mailerC->send($mailing, $receiver); $success = 'Template ' . $mailing->subject . ' successfully sent to ' . $receiver->email; $error = 'There is a problem in sending the template ' . $mailing->subject . ' <br/>' . _JNEWS_SENDTEST_CONFIGERROR; $message = $sendStatus ? jnews::printM('ok', $success) : jnews::printM('error', $error); } else { //otherwise we give an error message $message = jnews::printM('error', _JNEWS_ERROR); } jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=templates&task=edit&template_id=' . $template_id, $message); break; case 'upload': JRequest::checkToken() or die('Invalid Token'); $db = JFactory::getDBO(); $fileName = $_FILES['tempupload']['name']; $folderName = substr($fileName, 0, -4); // explode to array to compare and check if the uploaded file is a zip file $type = $_FILES['tempupload']['type']; // if zip is not found then return to previous upload page if (strtolower($type) != 'application/zip') { if (strtolower(substr($fileName, -4)) != '.zip') { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 echo "<script> alert('" . addslashes(_JNEWS_UPLOAD_ZIP_INVALID) . "'); document.location.href='index.php?option='.JNEWS_OPTION.'&act=templates';</script>"; } else { if (version_compare(JVERSION, '3.0.0', '<')) { echo "<script> alert('" . addslashes(_JNEWS_UPLOAD_ZIP_INVALID) . "'); window.parent.SqueezeBox.close();</script>"; } else { echo "<script> alert('" . addslashes(_JNEWS_UPLOAD_ZIP_INVALID) . "'); jQuery(window.top.document).find(\"div.modal-backdrop\").click(); </script>"; } } break; } } $result = jNews_Templates::uploadTemplate(); if ($result) { // if success // read index.html of file for template body content $tempPath = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS; $file = fopen($tempPath . $folderName . DS . 'index.html', "r") or exit("Unable to open file!"); $tempbody = array(); while (!feof($file)) { $tempbody[] = fgets($file); } //endwhile fclose($file); $tempbody = implode(' ', $tempbody); $standardCSSA = array(); $extraCSSStyles = ''; if (is_file($tempPath . $folderName . DS . 'css' . DS . 'style.css')) { //new template package with style.css file //we get here the css codes from the uploaded template $cssfile = fopen($tempPath . $folderName . DS . 'css' . DS . 'style.css', "r") or exit("Unable to open file!"); $cssstyle = array(); while (!feof($cssfile)) { $cssstyle[] = fgets($cssfile); } //endwhile fclose($cssfile); $cssstyle = implode(' ', $cssstyle); $cleanCSSstyle = jNews_Templates::cleanCSSComments($cssstyle); //cleancsscomments @(require_once JNEWSPATH_CLASS . 'class.cssinlinestyles.php'); if (class_exists('CSSToInlineStyles')) { $newCSSProcess = new CSSToInlineStyles(); $newCSSProcess->setCSS($cleanCSSstyle); $newCSSProcess->processCSS(); //we define the predefined selectors for the css $standardSelectorsA = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'ul', 'li', '.unsubscribe', '.subscriptions', '.content', '.title', '.readmore', '.online', '.aca_content', '.aca_title', '.aca_readmore', '.aca_online', '.aca_subscribe', '.aca_unsubscribe', '.aca_subscriptions'); $standardCSSA = $newCSSProcess->getStandardCSSTag($newCSSProcess->cssRules, $standardSelectorsA); $extraCSSStyles = $newCSSProcess->getExtraCSSTag($newCSSProcess->cssRules, $standardSelectorsA); } } // replace source image paths from 'images/' to 'media/.../templates/$FOLDERNAME/' $bodyImgA = JRequest::getVar('bodyImg'); if (is_file($tempPath . $folderName . DS . 'css' . DS . 'style.css')) { //new template package // $body = preg_replace('#images\/#', JNEWS_JPATH_LIVE . '/media/'. JNEWS_OPTION . '/templates/' . $folderName .'/images/', $tempbody); $origin = '"images/'; $destination = '"' . JNEWS_JPATH_LIVE . '/media/' . JNEWS_OPTION . '/templates/' . $folderName . '/images/'; $body = str_replace($origin, $destination, $tempbody); } else { // $body = preg_replace('#images\/#', JNEWS_JPATH_LIVE . '/media/'. JNEWS_OPTION . '/templates/'. $folderName.'/' , $tempbody); $origin = 'media/' . JNEWS_OPTION . '/templates/' . $folderName . '/'; $destination = JNEWS_JPATH_LIVE . '/media/' . JNEWS_OPTION . '/templates/' . $folderName . '/'; $body = str_replace($origin, $destination, $tempbody); } $template = null; $template->name = ucfirst($folderName); $template->description = ''; $template->created = time(); $template->body = addslashes($body); $template->altbody = ''; $template->premium = 0; $template->namekey = $folderName; $template->published = 1; $template->styles = addslashes(serialize($standardCSSA)); $template->csstyle = addslashes($extraCSSStyles); $template->thumbnail = ''; $templateA = (array) $template; $query = 'SELECT * FROM `#__jnews_templates` WHERE `namekey` = \'' . $template->namekey . '\' '; $db->setQuery($query); $findresult = $db->loadObject(); if (empty($findresult)) { // store template $status = jNews_Templates::storeTemplate($templateA); } else { //update template $query = 'UPDATE `#__jnews_templates` SET `body` = \'' . $template->body . '\' , `availability` = 1 WHERE `namekey`= \'' . $template->namekey . '\' AND `template_id`=' . $findresult->template_id; $db->setQuery($query); $status = $db->query(); } // upload success // display success message if ($status) { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_SUCCESS) . "'); document.location.href='index.php?option=" . JNEWS_OPTION . "&act=templates';</script>"; } else { //j16 echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_SUCCESS) . "'); window.parent.location.reload();</script>"; } } } else { // failed uploading // display an error message if (version_compare(JVERSION, '1.6.0', '<')) { //j15 echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_FAIL) . "'); document.location.href='index.php?option=" . JNEWS_OPTION . "&act=templates';</script>"; } else { if (version_compare(JVERSION, '3.0.0', '<')) { echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_FAIL) . "'); window.parent.SqueezeBox.close();</script>"; } else { echo "<script> alert('" . addslashes(_JNEWS_TEMPLATE_UPLOAD_FAIL) . "'); jQuery(window.top.document).find(\"div.modal-backdrop\").click(); </script>"; } } } $showTemplates = false; break; case 'preview': $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; $forms['filter'] = " <form name='jnewsFilterForm' method='POST' action='index.php'> \n"; $id = JRequest::getInt('template_id', 0, 'request'); $body = jNews_Templates::loadOneTemplate('body', $id); jNews_Templates::includeStyles($body, $id); jNews_TemplatesHTML::previewTemplate($body, $forms); $showTemplates = false; break; case 'assign': $templatesearch = JRequest::getVar('templatesearch', ''); $linkTh = jNews_Tools::completeLink('option=' . JNEWS_OPTION, true, false, true); $forms['main'] = "<form action=" . $linkTh . " method='post' name='adminForm' id=\"adminForm\">"; $paginationStart = JRequest::getVar('pg'); if (!empty($paginationStart)) { $limitstart = 0; $limitend = $paginationStart; } else { $app = JFactory::getApplication(); $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); } $limittotal = jNews_Templates::countTemplates(1, 1); $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : 20; $templates = jNews_Templates::getTemplates(true, false, $templatesearch, $setLimit->start, $setLimit->end, null, 1); //first param to true to show only the published jNews_TemplatesHTML::assignTemplate($templates, $forms, $setLimit, $templatesearch); $showTemplates = false; break; } if ($showTemplates) { $start = JRequest::getVar('start', '0'); $templatesearch = JRequest::getVar('templatesearch', ''); $limit = -1; $message = isset($message) ? $message : ''; backHTML::_header(_JNEWS_TEMPLATES, $img, $message, $task, $action); $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; $forms['filter'] = " <form name='jnewsFilterForm' method='POST' action='index.php'> \n"; backHTML::formStart('show_template', '', ''); // added this code for pagination =========================== $paginationStart = JRequest::getVar('pg'); $app = JFactory::getApplication(); if (!empty($paginationStart)) { $limitstart = 0; $limitend = $paginationStart; } else { $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); } $setSort = new stdClass(); $setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.templates.filter_order', 'filter_order', 'premium', 'cmd'); $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.templates.filter_order_Dir', 'filter_order_Dir', 'desc', 'word'); $limittotal = jNews_Templates::countTemplates(); $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : $limittotal; // recheck start if ($setLimit->total == $setLimit->end) { $setLimit->start = 0; } $templates = jNews_Templates::getTemplates(false, false, $templatesearch, $setLimit->start, $setLimit->end, $setSort); //recheck limit total [pagination] if (isset($setLimit->total) && !empty($templatesearch)) { $setLimit->total = !empty($temps) ? count($templates) : $setLimit->total; } jNews_TemplatesHTML::displayTemplateList($templates, $forms, $setLimit->start, $setLimit->end, $templatesearch, $action, $setLimit, $setSort); $go[] = jnews::makeObj('act', 'templates'); $go[] = jnews::makeObj('filter_order', $setSort->orderValue); $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir); backHTML::formEnd($go); } 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 queue($action, $task, $listid, $mailingid, $lists, $cid) { $db = JFactory::getDBO(); $my = JFactory::getUser(); $start = JRequest::getInt('start'); $css = '.icon-48-queue { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/queue.png)}'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'queue.png'; $message = ''; $xf = new jNews_Config(); $conf = JFactory::getConfig(); $mail = new stdClass(); $mail->Mailer = $conf->get('config.mailer'); $mailingsearch = JRequest::getVar('mailingsearch', ''); $start = JRequest::getInt('start'); $limit = JRequest::getInt('limit', $conf->get('config.list_limit')); ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cpanel') { form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=cpanel'; }else if (pressbutton == 'pqueue') { var $ok = confirm('Are you sure you want to process queue?'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=pqueue'; }else{ return; } }else if (pressbutton == 'stopqueue') { var $ok = confirm('Are you sure you want to stop the queue?'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=stopqueue'; }else{ return; } }else if (pressbutton == 'startqueue') { var $ok = confirm('Are you sure you want to start the queue?'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=startqueue'; }else{ return; } }else if (pressbutton == 'delq') { var $ok = confirm('Are you sure you want to delete?'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=delq'; }else{ return; } }else if (pressbutton == 'cleanq') { var $ok = confirm('Are you sure you want to clear the queue?'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=cleanq'; }else{ return; } }else if (pressbutton == 'block') { var $ok = confirm('Are you sure you want to block selected entries?'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=block'; }else{ return; } }else if (pressbutton == 'unblock') { var $ok = confirm('Are you sure you want to unblock selected entries?'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=queue&task=unblock'; }else{ return; } } submitform( pressbutton ); } </script> <?php $message = JRequest::getVar('message', ''); $showqueue = true; switch ($task) { case 'pqueue': if (!$GLOBALS[JNEWS . 'queue_status']) { //we start the processing of queue $xf->update('queue_status', 1); $GLOBALS[JNEWS . 'queue_status'] = 1; } //create smart-newsletter if necessary if (class_exists('jNews_Autonews')) { $SmartNewsMessageHTML = jNews_Autonews::createSmartNewsletters(); } else { $SmartNewsMessageHTML = ''; } $queueC = new jNews_Queue(); $queuedMails = $queueC->queueStatus($mailingid); $nextQueuedMails = $queueC->queueStatus($mailingid); // , true if ($GLOBALS[JNEWS . 'level'] > 1) { $scheduledMails = $queueC->getScheduled(); } else { $scheduledMails = null; } jNews_QueueHTML::processQueueHTML($queuedMails, $nextQueuedMails, $scheduledMails, $mailingid, false, $SmartNewsMessageHTML); return; break; case 'stopqueue': //we need to implement here how we can stop the queue $xf->update('queue_status', 0); //we start the processing of queue $GLOBALS[JNEWS . 'queue_status'] = 0; //we turn off the queue_process to make sure we only have one process going on //$xf->update('queue_process', 0); //$GLOBALS[JNEWS.'queue_process']=0; JToolBarHelper::custom('startqueue', 'start-queue.png', 'start-queue.png', _JNEWS_MENU_STARTQ, false); JToolBarHelper::spacer(); $message = jnews::printYN(true, _JNEWS_MENU_STOPQ_MSG, $message); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=queue' . $message); break; case 'startqueue': //we need to implement here how we can start back the queue $xf->update('queue_status', 1); //we stop the processing of queue $GLOBALS[JNEWS . 'queue_status'] = 1; //we turn off the queue_process to make sure we only have one process going on //$xf->update('queue_process', 0); //$GLOBALS[JNEWS.'queue_process']=0; JToolBarHelper::custom('stopqueue', 'stop-queue.png', 'stop-queue.png', _JNEWS_MENU_STOPQ, false); JToolBarHelper::spacer(); $message = jnews::printYN(true, _JNEWS_MENU_STARTQ_MSG, $message); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=queue' . $message); break; case 'cpanel': jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); break; case 'delq': JRequest::checkToken() or die('Invalid Token'); 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; if (!empty($cid)) { $db = JFactory::getDBO(); $query = 'DELETE from `#__jnews_queue` where `qid` IN (' . implode(',', $cid) . ')'; $db->setQuery($query); $db->query(); } $message = jnews::printYN(true, 'Successfully deleted the mailing(s) in the queue.', _JNEWS_ERROR); } break; case 'block': JRequest::checkToken() or die('Invalid Token'); if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Select an item to block'); window.history.go(-1);</script>\n"; return false; } else { $status = true; if (!empty($cid)) { $message = jnews::printYN(jNews_Queue::updateQueueBlock($cid, 1), 'Successfully blocked the mailing(s) in the queue.', _JNEWS_ERROR); } } break; case 'unblock': JRequest::checkToken() or die('Invalid Token'); if (!is_array($cid) || count($cid) < 1) { echo "<script> alert('Select an item to unblock'); window.history.go(-1);</script>\n"; return false; } else { $status = true; if (!empty($cid)) { $message = jnews::printYN(jNews_Queue::updateQueueBlock($cid, 0), 'Successfully blocked the mailing(s) in the queue.', _JNEWS_ERROR); } } break; case 'cleanq': JRequest::checkToken() or die('Invalid Token'); $db = JFactory::getDBO(); $query = 'DELETE from `#__jnews_queue` WHERE `type` < 7'; //do not delete the smartnewsletter type 7 and type 8 $db->setQuery($query); $db->query(); $message = jnews::printYN(true, ' Successfully cleared the mailings in the queue! ', _JNEWS_ERROR); break; default: if ($GLOBALS[JNEWS . 'queue_status'] == 1) { JToolBarHelper::custom('stopqueue', 'stop-queue.png', 'stop-queue.png', _JNEWS_MENU_STOPQ, false); } else { JToolBarHelper::custom('startqueue', 'start-queue.png', 'start-queue.png', _JNEWS_MENU_STARTQ, false); } JToolBarHelper::spacer(); } if ($showqueue) { $paginationStart = JRequest::getVar('pg'); $app = JFactory::getApplication(); if (!empty($paginationStart)) { $limitstart = 0; $limitend = $paginationStart; } else { $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); } $limittotal = jNews_Queue::getQueueCount($mailingid); $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : $limittotal; $setSort = new stdClass(); $setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.queue.filter_order', 'filter_order', 'q.send_date', 'cmd'); $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.queue.filter_order_Dir', 'filter_order_Dir', 'asc', 'word'); //count only the search result if (!empty($mailingsearch)) { $mailingq = jNews_Queue::getMailingqueue($mailingsearch, $mailingid, 0, 0, $setSort); $setLimit->total = count($mailingq); } // recheck start if ($setLimit->total <= $setLimit->start) { $setLimit->start = 0; } //perform query for all or specific search $mailingq = jNews_Queue::getMailingqueue($mailingsearch, $mailingid, $setLimit->start, $setLimit->end, $setSort); $form['main'] = " <form name='adminForm' method='POST' action='index.php' id=\"adminForm\">"; $form['select'] = " <form name='jnewsFilterForm' method='POST' action='index.php'> \n"; backHTML::_header('Mailing Queue', $img, $message, $task, $action); jNews_QueueHTML::showMailingQueue($mailingq, $lists, $form, $setLimit->start, $setLimit->end, $mailingsearch, $setLimit, $setSort); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('filter_order', $setSort->orderValue); $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir); backHTML::formEnd($go); } 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 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 mailing($action, $task, $listId, $listType, $mailingId, $message) { $showMailings = false; $db = JFactory::getDBO(); switch ($task) { case 'edit': $issue_nb = JRequest::getInt('issue_nb', 1); $mailingType = JRequest::getVar('listype'); $isEdit = JRequest::getVar('isEdit', true); $mySess = JFactory::getSession(); $mySess->set('listype', $mailingType, 'LType'); if (!empty($listId)) { $list = jNews_Lists::getOneList($listId); } else { $list = jNews_Lists::getListFirstEntry(); } $new = empty($mailingId) || $mailingId == 0 ? true : false; $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new, false, true); $mailing->mailing_type = $mailingType; // if(empty($isEdit)) $isEdit = true; // set default mailing parameters $my = JFactory::getUser(); $subscribers = jNews_Subscribers::getSubscriberInfoFromUserId($my->id); if (!isset($subscribers)) { $subscribers = new stdClass(); } $subscribers->name = isset($subscribers->name) ? $subscribers->name : ''; $subscribers->email = isset($subscribers->email) ? $subscribers->email : ''; // $mailing->fromname = ( !isset( $mailing->fromname ) || empty( $mailing->fromname ) ) ? $subscribers->name : $mailing->fromname; // $mailing->fromemail = ( !isset( $mailing->fromemail ) || empty( $mailing->fromemail ) ) ? $subscribers->email : $mailing->fromemail; // $mailing->frombounce = ( !isset( $mailing->frombounce ) || empty( $mailing->frombounce ) ) ? $GLOBALS[JNEWS.'sendmail_from'] : $mailing->frombounce; $show = jNews_ListType::showType($mailing->mailing_type, 'editmailing'); if ($mailing->published != 1 or $mailing->mailing_type != 1 or isset($show['admin']) and $show['admin']) { $forms['main'] = " <form action='index.php' method='post' enctype='multipart/form-data' name='adminForm' id=\"adminForm\">"; jNews_Mailing::_header($task, $action, $mailing->mailing_type, $message, 'edit'); jNews_MailingsHTML::editMailing($mailing, $new, $listId, $forms, $show, $isEdit); $go[] = jnews::makeObj('act', $action); backHTML::formEnd($go); } else { $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; jNews_Mailing::_header($task, $action, $mailing->mailing_type, $message); //backHTML::formStart(); jNews_MailingsHTML::viewMailing($mailing, $forms); $go[] = jnews::makeObj('act', 'mailing'); $go[] = jnews::makeObj('task', 'viewmailing'); $go[] = jnews::makeObj('mailingid', $mailing->id); backHTML::formEnd($go); } break; case 'new': case 'add': // check if atleast one list exist and published // if false then restrict entry $mailingType = JRequest::getVar('listype'); $type = $mailingType == 2 ? 2 : 1; $result = jNews_Lists::checkListNotEmpty($type); if (!$result) { if ($type == 2) { $disp = addslashes(_JNEWS_CHECKCAMPAIGNFOUND); } else { $disp = addslashes(_JNEWS_CHECKLISTFOUND); } echo "<script> alert('" . $disp . "'); window.history.go(-1);</script>\n"; break; } $mailingType = JRequest::getVar('listype'); if (empty($listId)) { $listId = JRequest::getVar('listid'); } if (!empty($listId)) { $mailingType = jNews_Lists::getListType($listId) == 2 ? 2 : 1; } JRequest::setVar('listype', $mailingType); $total = jNews_Mailing::countMailings($listId, $mailingType); $total++; jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listype=' . $mailingType . '&listid=' . $listId . '&isEdit=0'); //mariap break; case 'saveSend': JRequest::checkToken() or die('Invalid Token'); $mySess = JFactory::getSession(); $mailingType = $mySess->get('listype', '', 'LType'); $status = checkMailingSave($mailingType); if (!$status) { return false; } jNews_Mailing::saveMailing($mailingId, $listId); case 'sendready': //we update the senddate of the newsletter jNews_Mailing::updatesenddate($mailingId); jNews_MailingsHTML::sendReady($mailingId, $listId, $listType); break; case 'generate': if (class_exists('jNews_Auto')) { $still = false; $message = jnews::printYN(jNews_Auto::processQueue(true, true, $still, true), 'Queue processed', _JNEWS_ERROR); jNews_Auto::displayStatus(); } return; break; case 'send': $queueC = new jNews_Queue(); $queueC->checkForNewsletters($mailingId); $queueCount = jNews_Queue::getQueueCount($mailingId); $totalSub = JRequest::setVar('totalsend', $queueCount); $linkURL = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=continuesend&mailingid=' . $mailingId . '&totalsend=' . $totalSub, true, false, true); jNews_Tools::redirect($linkURL); break; case 'continuesend': $queueC = new jNews_Queue(); //we update the senddate of the mailing to be now to be able to continue the sending and send it after we click continue // $queueC->updateSenddateToNow($mailingId); $totalSend = JRequest::getVar('totalsend', 0, '', 'int'); $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int'); $queueC->start = $alreadySent; $queueC->total = $totalSend; $queueC->pause = $GLOBALS[JNEWS . 'pause_time']; $queueC->sendQueue(false, $mailingId, false, true); ob_start(); exit; break; case 'testspam': if (empty($message)) { $message = _JNEWS_MESSAGE_NOT; } $mailingId = $mailingId == 0 ? jNews_Mailing::getLastMailingId() : $mailingId; $my = JFactory::getUser(); if ($listId > 0) { $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId); } else { $archivemailing = jNews_Mailing::getMailingView($mailingId); } $mailing = new stdClass(); $receivers = new stdClass(); $receivers->email = '*****@*****.**'; $receivers->name = $archivemailing->fromname; $receivers->receive_html = 1; $receivers->id = jNews_Subscribers::getSubscriberIdFromUserId($my->id); //if email are different we dont replace because we want to make sure the spam cehck count the fact that //sender and bounce back are different if ($archivemailing->fromemail == $archivemailing->frombounce) { $archivemailing->frombounce = $my->email; } $archivemailing->fromemail = $my->email; $mailerC = new jNews_ProcessMail(); $status = $mailerC->send($archivemailing, $receivers); $message = jnews::printYN($status, _JNEWS_SPAMTEXT_MESSAGE_SENT_SUCCESSFULLY, $message); $link = 'http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=SpamCheck&alt=jnewsdoc_glossary'; $iFrame = '<iframe src="' . $link . '" width="100%" height="680px" scrolling="auto"></iframe>'; echo $iFrame; break; case 'savePreview': JRequest::checkToken() or die('Invalid Token'); $status = checkMailingSave($mailingType); if (!$status) { return false; } if ($mailingType == 7) { $mailing = JRequest::getVar('mailing', ''); $ContentStatus = checkTag(); if (!$ContentStatus) { return false; } } jNews_Mailing::saveMailing($mailingId, $listId); case 'preview': $emailaddress = JRequest::getVar('emailaddress', ''); $mailingId = $mailingId == 0 ? jNews_Mailing::getLastMailingId() : $mailingId; if (!empty($emailaddress)) { $status = jNews_Mailing::sendTestEmail($mailingId, $listId); if (empty($message)) { $message = _JNEWS_MESSAGE_NOT; } $message = jnews::printYN($status, _JNEWS_MESSAGE_SENT_SUCCESSFULLY, $message); } if ($listId > 0) { $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId); } else { $archivemailing = jNews_Mailing::getMailingView($mailingId); } $doc = JFactory::getDocument(); $css = '.icon-48-preview{ background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/preview.png)}'; $doc->addStyleDeclaration($css, $type = 'text/css'); $title = _JNEWS_PREVIEW_TITLE . ': ' . $archivemailing->subject; backHTML::_header(_JNEWS_PREVIEW_TITLE, 'preview.png', $message, $task, $action); //new view for the preview mailing echo '<table cellpadding="0" cellspacing="2" border="0" width="100%"><tr><td width="40%">'; jNews_MailingsHTML::previewMailingHTML($mailingId, $listId, $listType, $archivemailing->html); echo '</td><td width="60%">'; $forms['main'] = ''; $list = jNews_Lists::getOneList($archivemailing->list_id); $textonly = ''; $mailerC = new jNews_ProcessMail(); $queueInfo = new stdClass(); $queueInfo->mailingid = $mailingId; $queueInfo->listid = @$listId; $mailerC->getContent($archivemailing->images, $archivemailing->html, $archivemailing->textonly, $archivemailing->subject, false, true, $queueInfo); //new $archivemailing->subject if ($archivemailing->html == 1) { if (empty($template_id)) { $template_id = $archivemailing->template_id; } if (!empty($template_id)) { jNews_Templates::includeStyles($archivemailing->htmlcontent, $template_id); } } else { $archivemailing->textonly = jNews_ProcessMail::htmlToText($archivemailing->textonly); } //new view for the preview mailing jNews_MailingsHTML::viewHeading($archivemailing); echo '</td></tr><tr><td colspan="2">'; jNews_MailingsHTML::viewMailing($archivemailing, $forms); echo '</td></tr></tbody></table>'; if ($mailingId == 0) { JRequest::setVar('mailingid', $mailingId); } break; case 'view': $mailingType = JRequest::getVar('listype'); if (!empty($mailingType)) { $mySess = JFactory::getSession(); $mySess->set('listype', $mailingType, 'LType'); } if ($mailingId != 0) { if ($listId > 0) { $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId); } else { $archivemailing = jNews_Mailing::getMailingView($mailingId); } if (empty($template_id)) { $template_id = $archivemailing->template_id; } if (!empty($template_id)) { jNews_Templates::includeStyles($archivemailing->htmlcontent, $template_id); } $forms['main'] = "<form action='index.php?option=" . JNEWS_OPTION . "&act=mailing&listype=" . $listType . "&listid=" . $listId . "' method='post' name='adminForm' id=\"adminForm\">"; jNews_Mailing::_header($task, $action, $listType, $message); backHTML::formStart('show_mailing', 0, ''); jNews_MailingsHTML::viewMailing($archivemailing, $forms); $go[] = jnews::makeObj('act', 'mailing'); $go[] = jnews::makeObj('task', 'viewmailing'); $go[] = jnews::makeObj('listId', $archivemailing->list_id); //listid to listId--original backHTML::formEnd($go); } break; case 'deletequeue': //implement here what are we going to do with the delete queueu column on the mailing $mailingID = JRequest::getVar('mailingid'); $mailingType = JRequest::getVar('listype'); if (!empty($mailingID)) { $db = JFactory::getDBO(); $db->setQuery('DELETE FROM `#__jnews_queue` WHERE `mailing_id` = ' . $mailingID); $db->query(); $message = jnews::printYN(true, _JNEWS_MAILING_QUEUE_DELETED, _JNEWS_ERROR); } else { $message = jnews::printYN(false, _JNEWS_MAILING_QUEUE_DELETED, _JNEWS_ERROR); } jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType, $message); break; case 'deleteMailing': JRequest::checkToken() or die('Invalid Token'); $d['mailing'] = jNews_Mailing::getOneMailing('', $mailingId, '', $new); $message = jnews::printYN(jNews_Mailing::delete($d), @constant($GLOBALS[JNEWS . 'listname' . $d['mailing']->list_type]) . '"' . $d['mailing']->subject . '"' . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR); $showMailings = true; break; case 'cancel': $url = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&mailingid=' . $mailingId; $url .= (!empty($listId) ? '&listid=' . $listId : '') . '&listype=' . $mailingType; jNews_Tools::redirect($url); break; case 'copy': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Mailing::copyMailing($mailingId), _JNEWS_MAILING_COPY, _JNEWS_ERROR); $showMailings = true; break; case 'cancelMailing': $showMailings = true; break; case 'publishMailing': JRequest::checkToken() or die('Invalid Token'); $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new); $message = jnews::printYN(jNews_Mailing::publishMailing($mailingId), @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]) . ' ' . _JNEWS_PUBLISHED, _JNEWS_ERROR); $mailingType = jNews_Mailing::getMailingInfoz($mailingId); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType); break; case 'unpublishMailing': JRequest::checkToken() or die('Invalid Token'); $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new); $message = jnews::printYN(jNews_Mailing::unpublishMailing($mailingId), @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]) . ' ' . _JNEWS_UNPUBLISHED, _JNEWS_ERROR); $mailingType = jNews_Mailing::getMailingInfoz($mailingId); jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId); break; case 'cpanel': backHTML::controlPanel(); break; case 'save': JRequest::checkToken() or die('Invalid Token'); $subject = JRequest::getVar('subject', ''); if (empty($subject)) { echo "<script> alert('subject needs to be not empty'); window.history.go(-1);</script>\n"; return false; } if (!isset($mailingType)) { $mySess = JFactory::getSession(); $mailingType = $mySess->get('listype', '', 'LType'); } $status = checkMailingSave($mailingType); if ($mailingType == 7) { $mailing = JRequest::getVar('mailing', ''); $ContentStatus = checkTag(); if (!$ContentStatus) { return false; } } if (!$status) { return false; } $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR); if (!empty($mailingtype)) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId); $showMailings = true; unset($GLOBALS["task"]); unset($_REQUEST["task"]); } break; case 'apply': JRequest::checkToken() or die('Invalid Token'); $mailingid = JRequest::getVar('mailingid', '0'); if (!isset($mailingType)) { $mySess = JFactory::getSession(); $mailingType = $mySess->get('listype', '', 'LType'); } $status = checkMailingSave($mailingType); if ($mailingType == 7) { $mailing = JRequest::getVar('mailing', ''); $ContentStatus = checkTag(); if (!$ContentStatus) { return false; } } if (!$status) { return false; } $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR); $mailingid = $mailingid == 0 ? jNews_Mailing::getLastMailingId() : $mailingid; if (!empty($mailingtype)) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&task=edit&listype=' . $mailingType . '&mailingid=' . $mailingid . '&listid=' . $listId); $showMailings = true; unset($GLOBALS["task"]); unset($_REQUEST["task"]); } break; case 'show': $id = JRequest::getVar('mailingid'); $mySess = JFactory::getSession(); $mailingType = JRequest::getVar('listype', 0); $listId = JRequest::getVar('listid', 0); $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=' . $mailingType . '&listid=' . $listId; jNews_Tools::redirect($link); $showMailings = true; break; case 'toggle': $listid = JRequest::getVar('listid'); $column = JRequest::getVar('col'); $mailingid = JRequest::getVar('mailingid'); if (!empty($mailingid) && !empty($column)) { $passObj = new stdClass(); $passObj->tableName = '#__jnews_mailings'; $passObj->columnName = $column; $passObj->whereColumn = 'id'; $passObj->whereColumnValue = $mailingid; jnews::toggle($passObj); } if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listid . '&listype=1'); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listid . '&listype=2'); } break; default: $showMailings = true; break; } if ($showMailings) { if (empty($listType)) { $listType = JRequest::getVar('listype', 0); } if (empty($listId)) { $listId = JRequest::getVar('listid', 0); } $paginationStart = JRequest::getVar('pg'); if (!empty($paginationStart)) { $limitstart = 0; $limitend = $paginationStart; } else { $app = JFactory::getApplication(); $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); } $limittotal = jNews_Mailing::countMailings(0, $listType); $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : $limittotal; if ($setLimit->total == $setLimit->end) { $setLimit->start = 0; } jNews_Mailing::showMailings($task, $action, $listId, $listType, $message, true, _JNEWS_MENU_MAILING, $setLimit); } 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 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 about($message, $task, $action) { switch ($task) { case 'cpanel': backHTML::controlPanel(); break; default: backHTML::_header(_ACA_MENU_ABOUT . ' Acajoom', 'credits.png', $message, $task, $action); backHTML::about(); } }
/** * @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 update($action, $task) { $update = new wupdate(); $showListing = true; $showComplete = false; if (ACA_CMSTYPE) { // joomla 15 $message = JRequest::getVar('message', ''); } else { //joomla 1x $message = mosGetParam($_REQUEST, 'message', ''); } //endif if (ini_get('safe_mode')) { } else { @set_time_limit(60 * $GLOBALS[ACA . 'script_timeout']); } /*if ((ini_get('allow_url_fopen') == false && !in_array('curl', get_loaded_extensions())) || ini_get('safe_mode') == true) { echo _ACA_WARNING_1011; return; }*/ switch ($task) { case 'doUpdate': backHTML::_header(_ACA_MENU_UPDATE, 'update', $message, $task, $action); $update->doUpdate(); $showListing = false; $showComplete = false; break; case 'version': $update->getVersion(); break; case 'complete': $showComplete = true; $showListing = false; break; case 'cancel': compa::redirect('index2.php?option=com_acajoom&act=update'); $showListing = false; break; case 'cpanel': compa::redirect('index2.php?option=com_acajoom'); $showListing = false; break; case 'new1': backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action); $message = acajoom::printYN(acajoom::upgrade_News1(), '<br />' . _ACA_IMPORT_SUCCESS . ' Anjel data', _ACA_ERROR); acajoom::resetUpgrade(1); echo '<br />' . $message; break; case 'new2': backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action); $message = acajoom::printYN(acajoom::upgrade_News2(), '<br />' . _ACA_IMPORT_SUCCESS . ' Letterman data', _ACA_ERROR); acajoom::resetUpgrade(2); echo '<br />' . $message; break; case 'new3': backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action); $message = acajoom::printYN(acajoom::upgrade_News3(), '<br />' . _ACA_IMPORT_SUCCESS . ' YaNC data', _ACA_ERROR); acajoom::resetUpgrade(3); echo '<br />' . $message; break; } if ($showListing) { backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action); backHTML::_upgrade(); $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n"; echo $forms['main']; backHTML::formStart('', '', ''); backHTML::showCompsList($update); $go[] = acajoom::makeObj('act', $action); backHTML::formEnd($go); } elseif ($showComplete) { backHTML::_header(_ACA_MENU_UPDATE, 'backup.png', $message, $task, $action); $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n"; echo $forms['main']; backHTML::formStart('', '', ''); backHTML::showUpdateOptions($update); $go[] = acajoom::makeObj('act', $action); backHTML::formEnd($go); } }
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; }
function about($message, $task, $action) { switch ($task) { case 'cpanel': backHTML::controlPanel(); break; default: backHTML::_header(_JNEWS_MENU_ABOUT . ' jNews', 'about.png', $message, $task, $action); backHTML::about(); } }
function lists($action, $task, $listId, $listType) { $db = JFactory::getDBO(); $my = JFactory::getUser(); $css = '.icon-48-lists { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/lists.png)}'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'lists.png'; $listsearch = JRequest::getVar('listsearch', ''); $message = ''; $xf = new jNews_Config(); $showLists = true; $checkToggle = false; // defined toggle for publish and unpublish of mailings if (!empty($task) && $task == 'togle') { $checkToggle = true; $id = JRequest::getVar('listid'); $col = JRequest::getVar('col'); $listId = !empty($id) && !empty($col) ? $id : $listId; $task = !empty($listId) && !empty($col) ? $col : $task; } switch ($task) { case 'new': case 'add': $subscriber = jNews_Subscribers::getSubscriberInfoFromUserId($my->id); if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $acl = JFactory::getACL(); $groups = $acl->get_group_children_tree(null, 'USERS', false); } else { //j16 $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $groups = $db->loadObjectList(); } $allGroupIds = array(); foreach ($groups as $oneGroup) { $allGroupIds[] = $oneGroup->value; } $newList = new stdClass(); $showLists = false; $newList->id = ''; $newList->html = 1; $newList->new_letter = 1; $newList->list_name = ''; $newList->list_desc = ''; $newList->template = ''; if (empty($subscriber)) { $newList->sendername = ''; $newList->senderemail = ''; $newList->bounceadres = ''; } else { $newList->sendername = ''; $newList->senderemail = ''; $newList->bounceadres = ''; } $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:0'; $newList->follow_up = ''; $newList->notify_id = 0; $newList->owner = $my->id; $newList->acc_level = '24,25,7,8'; $newList->acc_id = implode(',', $allGroupIds); $newList->published = 1; $newList->start_date = date('Y-m-d', time()); $newList->next_date = jnews::getNow(); $newList->subscribemessage = _JNEWS_DEFAULT_SUBSCRIBE_MESS; $newList->unsubscribemessage = _JNEWS_DEFAULT_UNSUBSCRIBE_MESS; $newList->notifyadminmsg = _JNEWS_UNSUBSCRIBE_ADMIN_NOTIFICATION; $newList->subnotifymsg = _JNEWS_SUBSDEFAULT_NOTIFYMSG; $newList->subnotifysend = 1; $newList->unsubscribesend = 1; $newList->unsubscribenotifyadmin = 1; $newList->footer = 1; $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; $show = jNews_ListType::showType($newList->list_type, 'editlist'); if ($listType == 1) { backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_LIST, $img, $message, $task, $action); } else { backHTML::_header(_JNEWS_NEW . ' ' . _JNEWS_AUTORESP . ' ' . _JNEWS_LIST, $img, $message, $task, $action); } backHTML::formStart('editlist', $newList->html, ''); jNews_ListsHTML::editList($newList, $forms, $show, $listType); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('listid', $newList->id); backHTML::formEnd($go); break; case 'doNew': JRequest::checkToken() or die('Invalid Token'); $listname = JRequest::getVar('list_name', ''); if (empty($listname)) { echo "<script> alert(' List name must be filled out. '); window.history.go(-1);</script>\n"; return false; } $now = jnews::getNow(); $query = "SELECT `id` FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' "; $db->setQuery($query); $lId = $db->loadResult(); 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 `#__jnews_lists` (`list_name`,`createdate`) VALUES ( '" . addslashes($listname) . "' , '{$now}' )"; $db->setQuery($query); $db->query(); } $query = "SELECT * FROM `#__jnews_lists` WHERE `list_name`= '" . addslashes($listname) . "' "; $db->setQuery($query); $mynewlist = $db->loadObject(); $mynewlist->list_name = stripslashes($mynewlist->list_name); $mynewlist->list_desc = stripslashes($mynewlist->list_desc); $mynewlist->template = $mynewlist->template; $mynewlist->layout = stripslashes($mynewlist->layout); $mynewlist->subscribemessage = stripslashes($mynewlist->subscribemessage); $mynewlist->unsubscribemessage = stripslashes($mynewlist->unsubscribemessage); $mynewlist->notifyadminmsg = stripslashes($mynewlist->notifyadminmsg); $mynewlist->subnotifysend = stripslashes($mynewlist->subnotifysend); $mynewlist->subnotifymsg = stripslashes($mynewlist->subnotifymsg); $listId = $mynewlist->id; $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', true, $listType), _JNEWS_LIST_ADDED, _JNEWS_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(_JNEWS_SELECT_LIST) . "'); window.history.go(-1);</script>\n"; return false; } else { $showLists = false; $query = 'SELECT * FROM `#__jnews_lists` WHERE `id` = ' . intval($listId); $db->setQuery($query); $listEdit = $db->loadObject(); if ($listEdit->acc_id == 'all') { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $acl = JFactory::getACL(); $groups = $acl->get_group_children_tree(null, 'USERS', false); } else { //j16 $db = JFactory::getDBO(); $db->setQuery('SELECT a.*, a.title as text, a.id as value FROM #__usergroups AS a ORDER BY a.lft ASC'); $groups = $db->loadObjectList(); } $allGroupIds = array(); foreach ($groups as $oneGroup) { $allGroupIds[] = $oneGroup->value; } $listEdit->acc_id = implode(',', $allGroupIds); } $listEdit->list_name = stripslashes($listEdit->list_name); $listEdit->list_desc = stripslashes($listEdit->list_desc); $listEdit->template = $listEdit->template; $listEdit->layout = stripslashes($listEdit->layout); $listEdit->subscribemessage = stripslashes($listEdit->subscribemessage); $listEdit->unsubscribemessage = stripslashes($listEdit->unsubscribemessage); $listEdit->notifyadminmsg = stripslashes($listEdit->notifyadminmsg); $listEdit->subnotifysend = stripslashes($listEdit->subnotifysend); $listEdit->subnotifymsg = stripslashes($listEdit->subnotifymsg); $listEdit->new_letter = 0; $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; $show = jNews_ListType::showType($listEdit->list_type, 'editlist'); backHTML::_header(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $listEdit->list_type]) . ' ' . _JNEWS_LIST, $img, $message, $task, $action); backHTML::formStart('listedit', $listEdit->html, ''); jNews_ListsHTML::editList($listEdit, $forms, $show, $listType); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('listid', $listEdit->id); backHTML::formEnd($go); } break; case 'update': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Lists::updateListFromEdit($listId, '', false, $listType), _JNEWS_LIST_UPDATED, _JNEWS_ERROR); break; case 'delete': JRequest::checkToken() or die('Invalid Token'); $query = "SELECT list_name FROM #__jnews_lists WHERE id = {$listId}"; $db->setQuery($query); $listName = $db->loadResult(); $message = jnews::printYN(jNews_Lists::deleteList($listId), '"' . $listName . '"' . _JNEWS_LIST . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR); break; case 'copy': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Lists::copyList($listId), _JNEWS_LIST_COPY, _JNEWS_ERROR); break; case 'publish': if (!$checkToggle) { JRequest::checkToken() or die('Invalid Token'); } $message = jnews::printYN(jNews_Lists::updateListFromList($listId, true, false), _JNEWS_PUBLISHED, _JNEWS_ERROR); if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType); } break; case 'unpublish': if (!$checkToggle) { JRequest::checkToken() or die('Invalid Token'); } $message = jnews::printYN(jNews_Lists::updateListFromList($listId, false, false), _JNEWS_UNPUBLISHED, _JNEWS_ERROR); if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=' . $listType . '&listid=' . $listId); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=' . $listType . '&listid=' . $listId); } break; case 'forms': case 'make': if (class_exists('jNews_CreateForm')) { jNews_CreateForm::taskOptions($task); $showLists = false; } else { $showLists = true; } break; case 'cpanel': backHTML::controlPanel(); return true; break; case 'toggle': $listid = JRequest::getVar('listid'); $column = JRequest::getVar('col'); if (!empty($listid) && !empty($column)) { $passObj = new stdClass(); $passObj->tableName = '#__jnews_lists'; $passObj->columnName = $column; $passObj->whereColumn = 'id'; $passObj->whereColumnValue = $listid; jnews::toggle($passObj); } if ($listType == 1) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=list&listype=1'); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=arlist&listype=2'); } break; } if ($showLists) { $limit = -1; //Title header if ($listType == 1) { backHTML::_header(_JNEWS_MENU_LIST, $img, $message, $task, $action); } else { backHTML::_header(_JNEWS_ARLIST, $img, $message, $task, $action); } $show = jNews_ListType::showType(0, 'showListsBack'); $forms['main'] = "<form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; backHTML::formStart('show_mailing', '', ''); $paginationStart = JRequest::getVar('pg'); $app = JFactory::getApplication(); if (!empty($paginationStart)) { $limitstart = 0; $limitend = $paginationStart; } else { $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); } $limittotal = jNews_Lists::getListCount($listType); $limittotal = $limittotal[0]; $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : $limittotal; // recheck start if ($setLimit->total == $setLimit->end) { $setLimit->start = 0; } $setSort = new stdClass(); if ($listType == '2') { //autoresponder $key = JNEWS_OPTION . '.arlist'; $column = 'id'; $direction = 'desc'; } else { //newsletter $key = JNEWS_OPTION . '.list'; $column = 'list_name'; $direction = 'asc'; } $setSort->orderValue = $app->getUserStateFromRequest($key . 'filter_order', 'filter_order', $column, 'cmd'); $setSort->orderDir = $app->getUserStateFromRequest($key . 'filter_order_Dir', 'filter_order_Dir', $direction, 'word'); if ($listType == 2) { ?> <script language="javascript" type="text/javascript"> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'delete') { var $ok = confirm('Are you sure you want to delete?\r\nAll of the mailings attached in this auto-responder will be deleted as well.'); if ( $ok == true ){ form.action = 'index.php?option=<?php echo JNEWS_OPTION; ?> &act=arlist&task=delete'; }else{ return; } } submitform( pressbutton ); } </script> <?php } $listing = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setLimit, $setSort); if (isset($setLimit->total) && !empty($listsearch)) { $lists = jNews_Lists::getLists(0, $listType, 1, '', false, false, false, false, false, $listsearch, $setSort); $setLimit->total = !empty($lists) ? count($lists) : $setLimit->total; } $totalSubs = array(); $totalUnSubs = array(); $db = JFactory::getDBO(); if (!empty($listing)) { foreach ($listing as $list) { $totalSubs[] = jNews_Subscribers::getSubscribersCount($list->id, true); $totalUnSubs[] = jNews_Subscribers::getSubscribersCount($list->id, 2); } } jNews_ListsHTML::showListingLists($listing, $action, 'edit', $forms, $show, $listsearch, $setLimit->end, $setLimit, $totalSubs, $setSort, $totalUnSubs); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('filter_order', $setSort->orderValue); $go[] = jnews::makeObj('filter_order_Dir', $setSort->orderDir); backHTML::formEnd($go); return true; } }
function statistics($listId, $listType, $mailingId, $message, $task, $action) { //From Specified fieldset $sDate = JRequest::getVar('startdate'); $eDate = JRequest::getVar('enddate'); if ($task == 'cpanel') { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); } //Predefined fieldset $currentInterval = JRequest::getVar('rptinterval'); $currentRange = JRequest::getVar('rptrange'); if (empty($currentRange)) { $currentRange = 'this-month'; } if (empty($currentInterval)) { $currentInterval = 'weekly'; } if ($sDate == '0000-00-00' && $eDate == '0000-00-00') { $sDate = 0; $eDate = 0; } if (!empty($sDate) && !empty($eDate)) { if ($sDate != '0000-00-00' && $eDate != '0000-00-00') { $sDate = strtotime($sDate); $sDate = $sDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); $eDate = strtotime($eDate); $eDate = $eDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); } elseif ($sDate != '0000-00-00' && $eDate == '0000-00-00') { $sDate = strtotime($sDate); $sDate = $sDate - jnews::calculateOffset(JNEWS_TIME_OFFSET) + date('Z'); $eDate = time(); // - JNEWS_TIME_OFFSET * 3600 ; } elseif ($sDate == '0000-00-00' && $eDate != '0000-00-00') { echo jnews::printM('warning', _JNEWS_REPORT_WARN_MESSAGE); $sDate = 0; $eDate = 0; } } else { //Set the correct startDateTime and endDateTime //Set also the correct intervals appropriate for each range //current datetime base on the website setting configuration $currDate = $eDate = time(); // - JNEWS_TIME_OFFSET * 3600 ; switch ($currentRange) { case 'today': //today $sDate = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $eDate = mktime(23, 59, 59, date('m'), date('d'), date('Y')); $currentInterval = 'daily'; break; case 'yesterday': //yesterday $sDate = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')); $eDate = mktime(23, 59, 59, date('m'), date('d') - 1, date('Y')); $currentInterval = 'daily'; break; case 'this-week': //this week $sDate = mktime(0, 0, 0, date('n'), date('j'), date('Y')) - (date('N') - 1) * 3600 * 24; //if selected intervals is monthly or yearly if ($currentInterval == 'monthly' || $currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'last-week': //last week..start of the week is Monday at 00:00:00 and will end on Sunday at 23:59:59: $sDate = mktime(0, 0, 0, date('n'), date('j') - 6, date('Y')) - date('N') * 3600 * 24; $eDate = mktime(23, 59, 59, date('n'), date('j'), date('Y')) - date('N') * 3600 * 24; //if selected intervals is monthly or yearly if ($currentInterval == 'monthly' || $currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'last-2-weeks': //last 2 weeks $sDate = mktime(0, 0, 0, date('n'), date('j') - 13, date('Y')) - date('N') * 3600 * 24; $eDate = mktime(23, 59, 59, date('n'), date('j'), date('Y')) - date('N') * 3600 * 24; //if selected intervals is monthly or yearly if ($currentInterval == 'monthly' || $currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'last-month': //last month..starts at the first day to the last day $sDate = strtotime(date('m') - 1 . '/01/' . date('Y'), $currDate); $eDate = $sDate + 30 * 24 * 3600; //mktime(23, 59, 59, date('m')); if ($currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; case 'this-year': //this year..starts $sDate = strtotime('01/01/' . date('Y'), $currDate); break; case 'last-year': //last year...starts jan 1 and ends dec 31 $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 1); $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 1); break; case '2-years-ago': //2 Years ago if ($currentInterval == 'yearly') { //if the interval is yearly $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 2); //starts jan 1 } else { $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 2); //ends dec 31 $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 2); //starts jan 1 } break; case '3-years-ago': //3 Years ago if ($currentInterval == 'yearly') { //if the interval is yearly $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 3); //starts jan 1 } else { $eDate = mktime(23, 59, 59, 12, 31, date('Y') - 3); //ends dec 31 $sDate = mktime(0, 0, 0, 1, 1, date('Y') - 3); //starts jan 1 } break; case 'this-month': //this month //this month default: $sDate = strtotime(date('m') . '/01/' . date('Y'), $currDate); if ($currentInterval == 'yearly') { $currentInterval = 'weekly'; } break; } } //Still need to double check if there's really values on the start and end date if (!empty($sDate) && !empty($eDate)) { //Title header $doc = JFactory::getDocument(); $css = '.icon-48-statistics_header { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/statistics.png)}'; $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'statistics_header.png'; $message = ''; $start = date('F j, Y', jnews::getNow(0, true, $sDate)); $end = date('F j, Y', jnews::getNow(0, true, $eDate)); if ($currentRange == 'today' || $currentRange == 'yesterday') { $title = _JNEWS_REPORT_HEADER . ': ' . $start; $fileNameExport = $start; } else { $title = _JNEWS_REPORT_HEADER . ': ' . $start . ' ' . _JNEWS_REPORT_HEADER_TO . ' ' . $end; $fileNameExport = $start . ' ' . _JNEWS_REPORT_HEADER_TO . ' ' . $end; } backHTML::_header($title, $img, $message, $task, $action); } $dateFormat = 'FROM_UNIXTIME('; switch ($currentInterval) { case 'yearly': //yearly $specialFormat = ',\'%Y\''; $dateFormat4DateNumber = 'FROM_UNIXTIME('; //.$columnModif.', \'' .substr($special, 10).'\'))'; $specialNo = ',\'%Y\')'; break; case 'weekly': //weekly $specialFormat = ',\'%M %d, %Y\''; $dateFormat4DateNumber = 'WEEK(' . $dateFormat; $dateFormat4DateNumber = 'WEEK(FROM_UNIXTIME('; //'dtfrmtweek%Y-%m-%d'; // WEEK(DATE_FORMAT(cdate, '%Y-%m-%d')) $specialNo = ',\'%Y-%m-%d\'))'; break; case 'daily': //daily $specialFormat = ',\'%M %d, %Y\''; $dateFormat4DateNumber = 'FROM_UNIXTIME('; //'dateformat%Y%m%d'; $specialNo = ',\'%Y%m%d\')'; break; case 'monthly': //monthly //monthly default: $specialFormat = ',\'%M, %Y\''; $dateFormat4DateNumber = 'FROM_UNIXTIME('; //'dateformat%Y%m%d'; $specialNo = ',\'%Y%m\')'; break; } $queryfilters = array(); $queryfilters['enddate'] = '\'' . $eDate . '\''; $queryfilters['startdate'] = '\'' . $sDate . '\''; $queryfilters['dateFormat'] = $dateFormat; $queryfilters['specialFormat'] = $specialFormat; $queryfilters['dateFormat4DateNumber'] = $dateFormat4DateNumber; $queryfilters['specialNo'] = $specialNo; $queryfilters['mailingId'] = $mailingId; $queryfilters['task'] = $task; //go to class.stats to display the view of stats require_once JNEWSPATH_CLASS . 'class.statistics.php'; outputReportGraph::initIncludes(); echo '<form action="index.php" method="post" name="adminForm" id="adminForm">'; if ($task == 'graph') { $results = array(); $results['subject'] = JRequest::getVar('subject', ''); $results['html_sent'] = JRequest::getVar('html_sent', '0'); $results['text_sent'] = JRequest::getVar('text_sent', '0'); $results['html_views'] = JRequest::getVar('html_views', '0'); $results['html_unread'] = JRequest::getVar('html_unread', '0'); $results['pending'] = JRequest::getVar('pending', '0'); // $results['failed'] = JRequest::getVar( 'failed', '0' ); // $results['bounces'] = JRequest::getVar( 'bounces', '0' ); $results['sent'] = JRequest::getVar('sent', '0'); // $results['sent'] = intval( $results['html_sent'] + $results['text_sent'] ); //fixed $results['id'] = JRequest::getVar('id'); $queryfilters['startdate'] = '\'' . JRequest::getInt('startdate') . '\''; $queryfilters['enddate'] = '\'' . JRequest::getVar('enddate') . '\''; outputReportGraph::mailingSpecificGraph($results, $queryfilters); } else { outputReportGraph::headerFilter($currentInterval); if (empty($fileNameExport)) { $fileNameExport = null; } outputReportGraph::tabReports($queryfilters, $task, $fileNameExport); } echo '</form>'; return true; }
function update($action, $task) { require_once JNEWSPATH_CLASS . 'class.update.php'; $update = new jNews_Update(); $showListing = true; $showComplete = false; $message = JRequest::getVar('message', ''); if (!ini_get('safe_mode')) { @set_time_limit(60 * $GLOBALS[JNEWS . 'script_timeout']); } //css injection for the images $doc = JFactory::getDocument(); $css = '.icon-48-import { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/import.png)}'; $doc->addStyleDeclaration($css, $type = 'text/css'); switch ($task) { case 'doUpdate': backHTML::_header(_JNEWS_MENU_UPDATE, 'update', $message, $task, $action); $update->doUpdate(); $showListing = false; $showComplete = false; break; case 'version': $update->getVersion(); break; case 'complete': $showComplete = true; $showListing = false; break; case 'cancel': jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=update'); $showListing = false; break; case 'cpanel': jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); $showListing = false; break; case 'new1': backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action); $message = jnews::printYN(jnews::upgrade_News1(), '<br />' . _JNEWS_IMPORT_SUCCESS . ' Anjel data', _JNEWS_ERROR); jnews::resetUpgrade(1); echo '<br />' . $message; break; case 'new2': backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action); $message = jnews::printYN(jnews::upgrade_News2(), '<br />' . _JNEWS_IMPORT_SUCCESS . ' Letterman data', _JNEWS_ERROR); jnews::resetUpgrade(2); echo '<br />' . $message; break; case 'new3': backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action); $message = jnews::printYN(jnews::upgrade_News3(), '<br />' . _JNEWS_IMPORT_SUCCESS . ' YaNC data', _JNEWS_ERROR); jnews::resetUpgrade(3); echo '<br />' . $message; break; } if ($showListing) { backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action); backHTML::_upgrade(); $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; echo $forms['main']; backHTML::formStart('', '', ''); backHTML::showCompsList($update); $go[] = jnews::makeObj('act', $action); backHTML::formEnd($go); } elseif ($showComplete) { backHTML::_header(_JNEWS_MENU_UPDATE, 'import.png', $message, $task, $action); $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; echo $forms['main']; backHTML::formStart('', '', ''); backHTML::showUpdateOptions($update); $go[] = jnews::makeObj('act', $action); backHTML::formEnd($go); } }
function subscribers($action, $task, $userid, $listId, $cid, $front = false) { $Itemid = JRequest::getInt('Itemid'); $mainframe = JFactory::getApplication(); $newSubscriber = null; $subscriberId = JRequest::getInt('subscriber_id'); $message = JRequest::getVar('message', ''); $css = '.icon-48-subscribers { background-image:url(' . JNEWS_PATH_ADMIN_IMAGES2 . 'header/subscribers.png)}'; $doc = JFactory::getDocument(); $doc->addStyleDeclaration($css, $type = 'text/css'); $img = 'subscribers.png'; $emailField = JRequest::getVar('email', ''); $new = true; //new subscriber $my = JFactory::getUser(); //START OF DATA FROM REQUEST $subscriber = new stdClass(); $subscriber->user_id = JRequest::getInt('user_id'); $subscriber->name = JRequest::getVar('name', ''); $subscriber->email = JRequest::getVar('email', '', '', 'STRING'); if (!jNews_Subscribers::validEmail($subscriber->email)) { $subscriber->email = ''; } $subscriber->receive_html = JRequest::getInt('receive_html', 0); if (empty($subscriberId)) { //if it is a new user the confirmed depends if the require confirmation is turned on if ($GLOBALS[JNEWS . 'require_confirmation'] == '1') { $subscriber->confirmed = 0; } else { $subscriber->confirmed = JRequest::getInt('confirmed'); } } else { $subscriber->confirmed = JRequest::getInt('confirmed'); } $subscriber->blacklist = JRequest::getVar('blacklist', 0); $subscriber->timezone = JRequest::getVar('timezone', ''); $subscriber->language_iso = JRequest::getVar('language_iso', ''); if (empty($subscriber->ip)) { $subscriber->ip = jNews_Subscribers::getIP(); } if ($subscriber->ip == '0.0.0.0') { $subscriber->ip = '0'; } $subscriber->subscribe_date = time(); $subscriber->params = JRequest::getVar('params', ''); //column if ($GLOBALS[JNEWS . 'level'] > 2) { $subscriber->column1 = JRequest::getVar('column1', ''); $subscriber->column2 = JRequest::getVar('column2', ''); $subscriber->column3 = JRequest::getVar('column3', ''); $subscriber->column4 = JRequest::getVar('column4', ''); $subscriber->column5 = JRequest::getVar('column5', ''); } //end check of version pro //END OF DATA FROM REQUEST $doShowSubscribers = true; switch ($task) { case 'updateOneSub': JRequest::checkToken() or die('Invalid Token'); $doShowSubscribers = true; $new = false; //we addslashes the name incase an ' is entered in the name $subscriber->name = addslashes($subscriber->name); $message = jnews::printYN(jNews_Subscribers::saveSubscriber($subscriber, $subscriberId, $new), _JNEWS_UPDATED_SUCCESSFULLY, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'deleteOneSub': JRequest::checkToken() or die('Invalid Token'); $doShowSubscribers = true; $message = jnews::printYN(jNews_Subscribers::deleteSubscriber($subscriberId), _JNEWS_SUBSCRIBER_DELETED, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'cancelSub': $doShowSubscribers = true; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'edit': foreach ($cid as $id) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&task=show&userid=' . $id); } break; case 'show': $doShowSubscribers = false; $qid[0] = $userid; $subscriber = jNews_Subscribers::getSubscribersFromId($qid, false); $lists = jNews_Lists::getLists(0, 0, 1, '', false, false); $queues = jNews_ListsSubs::getSubscriberLists($userid); $forms['main'] = " <form action='index.php' method='post' name='adminForm' id=\"adminForm\">"; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); backHTML::formStart('', 0, ''); echo jNews_SubscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('subscriber_id', $subscriber->id); $go[] = jnews::makeObj('user_id', $subscriber->user_id); backHTML::formEnd($go); break; case 'new': case 'add': $doShowSubscribers = false; $newSubscriber = new stdClass(); $newSubscriber->id = ''; $newSubscriber->user_id = 0; $newSubscriber->name = ''; $newSubscriber->email = ''; $newSubscriber->ip = jNews_Subscribers::getIP(); $newSubscriber->receive_html = 1; $newSubscriber->confirmed = 1; $newSubscriber->blacklist = 0; $newSubscriber->timezone = '00:00:00'; $newSubscriber->language_iso = 'eng'; $newSubscriber->params = ''; $newSubscriber->subscribe_date = time(); //column if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro $newSubscriber->column1 = ''; $newSubscriber->column2 = ''; $newSubscriber->column3 = ''; $newSubscriber->column4 = ''; $newSubscriber->column5 = ''; } $lists = jNews_Lists::getLists(0, 0, 1, '', false, false); $queues = ''; $forms['main'] = " <form action='index.php' method='post' name=\"adminForm\" id=\"adminForm\">"; if ($mainframe->isAdmin() || $GLOBALS[JNEWS . 'use_backendview']) { backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); backHTML::formStart('addsubsback', 0, ''); echo jNews_SubscribersHTML::editSubscriber($newSubscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false); } else { backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); backHTML::formStart('addsubsfront', 0, ''); echo jNews_SubscribersHTML::editSubscriberFE($newSubscriber, $lists, $queues, $forms, jnews::checkPermissions('admin'), false, false); } $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('subscriber_id', $newSubscriber->id); $go[] = jnews::makeObj('user_id', $newSubscriber->user_id); backHTML::formEnd($go); break; case 'doNew': JRequest::checkToken() or die('Invalid Token'); $doShowSubscribers = true; if ($mainframe->isAdmin() || $GLOBALS[JNEWS . 'use_backendview']) { $message = jnews::printYN(jNews_Subscribers::saveSubscriber($subscriber, $subscriberId, $new), _JNEWS_NEW_SUBSCRIBER, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); } else { $status = jNews_Subscribers::importBis(); if ($mainframe->isAdmin()) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2'); } else { $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2'); jNews_Tools::redirect($mainLink); } } break; case 'delete': JRequest::checkToken() or die('Invalid Token'); 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) { if (!jNews_Subscribers::deleteSubscriber($id)) { $status = false; } } $message = jnews::printYN($status, _JNEWS_SUBSCRIBER_DELETED, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); } break; case 'update': JRequest::checkToken() or die('Invalid Token'); 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) { $changes = JRequest::getVar($id, array(0)); if (!isset($changes['receive_html'])) { $changes['receive_html'] = 0; } if (!isset($changes['confirmed'])) { $changes['confirmed'] = 0; } } } $message = jnews::print_message(_JNEWS_UPDATED_SUCCESSFULLY, 1); break; case 'export': $doShowSubscribers = false; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); jNews_SubscribersHTML::export($action, $listId); break; case 'doExport': $message = jnews::printYN(jNews_Subscribers::export($listId), _EXPORT, _JNEWS_ERROR); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'import': $doShowSubscribers = false; backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); $lists = jNews_Lists::getLists('', 0, '', '', false, true, true, false, false); jNews_SubscribersHTML::import($action, $lists, $listId); break; case 'doImport': JRequest::checkToken() or die('Invalid Token'); $message = jNews_Subscribers::importBis(); backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); $message = !empty($message) && $message !== true ? $message : ($message === false ? 'Import failed' : _JNEWS_IMPORT_FINISHED); if ($mainframe->isAdmin()) { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers', $message); } else { $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION . '&act=subscribers&mid=2'); jNews_Tools::redirect($mainLink); } break; case 'subscribeAll': case 'unsubscribeAll': JRequest::checkToken() or die('Invalid Token'); break; case 'cancel': if ($listId != 0) { $listId = 0; } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); } backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; case 'cpanel': $mainframe = JFactory::getApplication(); if ($mainframe->isAdmin()) { backHTML::controlPanel(); } else { jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); } $doShowSubscribers = 0; break; case 'toggle': $subid = JRequest::getVar('subid'); $column = JRequest::getVar('col'); if (!empty($subid) && !empty($column)) { $passObj = new stdClass(); $passObj->tableName = '#__jnews_subscribers'; $passObj->columnName = $column; $passObj->whereColumn = 'id'; $passObj->whereColumnValue = $subid; jnews::toggle($passObj); // change suspend status if column toggled is confirmed if ($column == 'confirmed') { $passObj = new stdClass(); $passObj->tableName = '#__jnews_queue'; $passObj->columnName = 'suspend'; $passObj->whereColumn = 'subscriber_id'; $passObj->whereColumnValue = $subid; jnews::toggle($passObj); } } jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $listId); break; default: backHTML::_header(_JNEWS_MENU_SUBSCRIBERS, $img, $message, $task, $action); break; } if ($doShowSubscribers) { $limit = -1; $emailsearch = JRequest::getVar('emailsearch', '', '', 'STRING'); $emailsearch = htmlentities($emailsearch, ENT_COMPAT, "UTF-8"); $paginationStart = JRequest::getVar('pg'); $lll = JRequest::getVar('limitstart'); if (empty($lll)) { JRequest::setVar('limitstart', 0, 'int'); } $app = JFactory::getApplication(); $limitstart = $app->getUserStateFromRequest('limitstart', 'limitstart', 0, 'int'); $limitend = $app->getUserStateFromRequest('limit', 'limit', 0, 'int'); $subscirberTypeID = JRequest::getVar('subtype', 1); if (empty($listId) && in_array($subscirberTypeID, array(1, 2))) { $subscirberTypeID = 0; } if (!empty($listId) && in_array($subscirberTypeID, array(3, 4))) { $subscirberTypeID = 0; } if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } $ztozto = null; $limittotal = jNews_Subscribers::getSubscribers(0, 0, $emailsearch, $ztozto, $listId, '', '', '', 'sub_dateD', '', $ownedlists, '', $subscirberTypeID, true); //added one parameter for mailid $setLimit = new stdClass(); $setLimit->total = !empty($limittotal) ? $limittotal : 0; $setLimit->start = !empty($limitstart) ? $limitstart : 0; $setLimit->end = !empty($limitend) ? $limitend : 20; $setSort = new stdClass(); $setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.subscribers.filter_order', 'filter_order', 'subscribe_date', 'cmd'); $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.subscribers.filter_order_Dir', 'filter_order_Dir', 'desc', 'word'); if (empty($limitstart)) { $limitstart = 0; } if ($setLimit->end > 200) { $setLimit->end = 200; } if ($setLimit->total == $setLimit->end) { $setLimit->start = 0; } $subscribers = jNews_Subscribers::getSubscribers($setLimit->start, $setLimit->end, $emailsearch, $setLimit->total, $listId, '', '', '', 'sub_dateD', '', $ownedlists, $setSort, $subscirberTypeID); //added one parameter for mailid if ($listId != 0) { $showAdmin = true; } else { $showAdmin = false; } $dropDownList = jNews_ListType::getListsDropList(0, '', ''); $subTypeA = array(); $subTypeA[0] = new stdClass(); $subTypeA[0]->id = 0; $subTypeA[0]->subtype = _JNEWS_SUB_LISTTYPE_ALL; if ($listId != 0) { $subTypeA[1] = new stdClass(); $subTypeA[1]->id = 1; $subTypeA[1]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_SUBCRIBED; $subTypeA[2] = new stdClass(); $subTypeA[2]->id = 2; $subTypeA[2]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_UNSUBCRIBED; } else { $subTypeA[3] = new stdClass(); $subTypeA[3]->id = 3; $subTypeA[3]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_WAITINGCONF; $subTypeA[4] = new stdClass(); $subTypeA[4]->id = 4; $subTypeA[4]->subtype = _JNEWS_SUB_LISTTYPE_ONLY_BLOCKED; } $lists['listid'] = jnews::HTML_GenericList($dropDownList, 'listid', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'list_name', $listId); $lists['subscirberType'] = jnews::HTML_GenericList($subTypeA, 'subtype', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'subtype', $subscirberTypeID); if ($mainframe->isAdmin()) { $forms['main'] = " <form action='index.php' method='post' name=\"adminForm\" id=\"adminForm\">"; } else { if (empty($setLimit->start)) { $setLimit->start = 0; } $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); $forms['main'] = "<form action='" . $mainLink . "' method='post' name=\"adminForm\" id=\"adminForm\">"; } $forms['select'] = " <form method='post' name='jNewsFilterForm'> \n"; backHTML::formStart('show_mailing', 0, ''); jNews_SubscribersHTML::showSubscribers($subscribers, $action, $listId, $lists, $setLimit->start, $setLimit->end, $setLimit->total, $showAdmin, $listId, $emailsearch, $forms, $setLimit, $front, $setSort); } 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; }