function listing() { $app = JFactory::getApplication(); $config = acymailing_config(); if (!class_exists('plgSystemAcymailingClassMail')) { $app->enqueueMessage('AcyMailing can customize some Joomla messages. If you want to do this, please first <a href="index.php?option=com_acymailing&ctrl=cpanel">enable the plugin acymailingclassmail</a>', 'notice'); } $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'mailid', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $db = JFactory::getDBO(); $query = 'SELECT mailid, subject, alias, fromname, published, fromname, fromemail, replyname, replyemail FROM #__acymailing_mail WHERE `type` = ' . $db->Quote($this->type); if (!empty($pageInfo->filter->order->value)) { $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } $db->setQuery($query); $rows = $db->loadObjectList(); acymailing_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('preview', 'acypreview', '', JText::_('ACY_PREVIEW'), true); JToolBarHelper::editList(); JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', $this->doc); $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('pageInfo', $pageInfo); $this->assign('config', $config); $this->assign('rows', $rows); }
function update() { $config = acymailing_config(); if (!acymailing_isAllowed($config->get('acl_config_manage', 'all'))) { acymailing_display(JText::_('ACY_NOTALLOWED'), 'error'); return false; } acymailing_setTitle(JText::_('UPDATE_ABOUT'), 'acyupdate', 'update'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'back', JText::_('ACY_CLOSE'), acymailing_completeLink('dashboard')); return $this->_iframe(ACYMAILING_UPDATEURL . 'update'); }
static function setTitle($name, $picture, $link) { return acymailing_setTitle($name, $picture, $link); }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->elements = new stdClass(); $config = acymailing_config(); JHTML::_('behavior.modal', 'a.modal'); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . $this->getLayout(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); if (strtolower($pageInfo->filter->order->dir) !== 'desc') { $pageInfo->filter->order->dir = 'asc'; } $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int'); $database = JFactory::getDBO(); $filters = array(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}"; } $query = 'SELECT ' . implode(' , ', $this->selectFields); $query .= ', CASE WHEN (a.senthtml+a.senttext-a.bounceunique) = 0 THEN 0 ELSE (a.openunique/(a.senthtml+a.senttext-a.bounceunique)) END AS openprct'; $query .= ', CASE WHEN (a.senthtml+a.senttext-a.bounceunique) = 0 THEN 0 ELSE (a.clickunique/(a.senthtml+a.senttext-a.bounceunique)) END AS clickprct'; $query .= ', CASE WHEN a.openunique = 0 THEN 0 ELSE (a.clickunique/a.openunique) END AS efficiencyprct'; $query .= ', CASE WHEN (a.senthtml+a.senttext-a.bounceunique) = 0 THEN 0 ELSE (a.unsub/(a.senthtml+a.senttext-a.bounceunique)) END AS unsubprct'; $query .= ', (a.senthtml+a.senttext) as totalsent'; $query .= ', CASE WHEN (a.senthtml+a.senttext) = 0 THEN 0 ELSE (a.bounceunique/(a.senthtml+a.senttext)) END AS bounceprct'; $query .= ' FROM ' . acymailing_table('stats') . ' as a'; $query .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; if (!empty($filters)) { $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; } if (!empty($pageInfo->filter->order->value)) { $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); if ($rows === null) { acymailing_display(substr(strip_tags($database->getErrorMsg()), 0, 200) . '...', 'error'); if (file_exists(ACYMAILING_BACK . 'install.acymailing.php')) { include_once ACYMAILING_BACK . 'install.acymailing.php'; $installClass = new acymailingInstall(); $installClass->fromVersion = '3.6.0'; $installClass->update = true; $installClass->updateSQL(); } } $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('stats') . ' as a'; if (!empty($pageInfo->search)) { $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; } if (!empty($filters)) { $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')'; } $database->setQuery($queryCount); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); jimport('joomla.html.pagination'); $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value); acymailing_setTitle(JText::_('GLOBAL_STATISTICS'), 'stats', 'stats'); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('exportglobal', 'acyexport', '', JText::_('ACY_EXPORT'), false); JToolBarHelper::spacer(); if (acymailing_isAllowed($config->get('acl_statistics_delete', 'all'))) { JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS')); } JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'statistics'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); }
function abtesting() { $app = JFactory::getApplication(); $mailids = JRequest::getString('mailid'); $validationStatus = JRequest::getString('validationStatus'); $noMsg = false; $noBtn = false; if (!empty($mailids) && strpos($mailids, ',') !== false) { $db = JFactory::getDBO(); $warningMsg = array(); $mailsArray = explode(',', $mailids); JArrayHelper::toInteger($mailsArray); $mailids = implode(',', $mailsArray); $this->assign('mailid', $mailids); $query = 'SELECT abtesting FROM #__acymailing_mail WHERE mailid IN (' . implode(',', $mailsArray) . ') AND abtesting IS NOT NULL'; $db->setQuery($query); $resDetail = acymailing_loadResultArray($db); if (!empty($resDetail) && count($resDetail) != count($mailsArray)) { $titlePage = JText::_('ABTESTING'); acymailing_display(JText::_('ABTESTING_MISSINGEMAIL'), 'warning'); $this->assign('missingMail', true); } else { $abTestDetail = array(); if (empty($resDetail)) { $abTestDetail['mailids'] = $mailids; $abTestDetail['prct'] = 10; $abTestDetail['delay'] = 2; $abTestDetail['action'] = 'manual'; } else { $abTestDetail = unserialize($resDetail[0]); $savedIds = explode(',', $abTestDetail['mailids']); sort($savedIds); sort($mailsArray); if (!empty($abTestDetail['status']) && in_array($abTestDetail['status'], array('inProgress', 'testSendOver', 'abTestFinalSend')) && $savedIds != $mailsArray) { $warningMsg[] = JText::_('ABTESTING_TESTEXIST'); $mailsArray = $savedIds; $mailids = implode(',', $mailsArray); } $this->assign('savedValues', true); if ($abTestDetail['status'] == 'inProgress') { $warningMsg[] = JText::_('ABTESTING_INPROGRESS'); } } if ($validationStatus == 'abTestAdd') { $noMsg = true; } if (!empty($abTestDetail['status']) && $abTestDetail['status'] == 'abTestFinalSend' && !empty($abTestDetail['newMail'])) { $mailInQueueErrorMsg = JText::_('ABTESTING_FINALMAILINQUEUE'); $mailTocheck = '=' . $abTestDetail['newMail']; } else { $mailInQueueErrorMsg = JText::_('ABTESTING_TESTMAILINQUEUE'); $mailTocheck = ' IN (' . implode(',', $mailsArray) . ')'; } $query = "SELECT COUNT(*) FROM #__acymailing_queue WHERE mailid" . $mailTocheck; $db->setQuery($query); $queueCheck = $db->loadResult(); if (!empty($queueCheck) && $validationStatus != 'abTestAdd') { acymailing_display($mailInQueueErrorMsg, 'error'); $noMsg = true; } if (!empty($resDetail) && empty($queueCheck) && in_array($abTestDetail['status'], array('inProgress', 'abTestFinalSend'))) { if ($abTestDetail['status'] == 'inProgress') { $abTestDetail['status'] = 'testSendOver'; } else { $abTestDetail['status'] = 'completed'; } $query = "UPDATE #__acymailing_mail SET abtesting=" . $db->quote(serialize($abTestDetail)) . " WHERE mailid IN (" . implode(',', $mailsArray) . ")"; $db->setQuery($query); $db->query(); } if (!empty($abTestDetail['status']) && $abTestDetail['status'] == 'testSendOver') { acymailing_display(JText::_('ABTESTING_READYTOSEND'), 'info'); } if (!empty($abTestDetail['status']) && $abTestDetail['status'] == 'completed') { acymailing_display(JText::_('ABTESTING_COMPLETE'), 'info'); } $this->assign('abTestDetail', $abTestDetail); $nbMails = count($mailsArray); $titleStr = "A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z"; $titlePage = JText::sprintf('ABTESTING_TITLE', substr($titleStr, 0, min($nbMails, 26) * 2 - 1)); $mailClass = acymailing_get('class.mail'); $mailsDetails = array(); foreach ($mailsArray as $mailid) { $mailsDetails[] = $mailClass->get($mailid); } $this->assign('mailsdetails', $mailsDetails); $mailerHelper = acymailing_get('helper.mailer'); $mailerHelper->loadedToSend = false; $mailReceiver = $mailerHelper->load($mailsArray[0]); $listmailClass = acymailing_get('class.listmail'); $lists = $listmailClass->getReceivers($mailReceiver->mailid, true, false); $this->assign('lists', $lists); $this->assign('mailReceiver', $mailReceiver); $filterClass = acymailing_get('class.filter'); $this->assign('filterClass', $filterClass); $listids = array(); foreach ($lists as $oneList) { $listids[] = $oneList->listid; } $nbTotalReceivers = $filterClass->countReceivers($listids, $this->mailReceiver->filter, $this->mailReceiver->mailid); if ($nbTotalReceivers < 50) { $warningMsg[] = JText::sprintf('ABTESTING_NOTENOUGHUSER', $nbTotalReceivers); $noBtn = true; } $this->assign('nbTotalReceivers', $nbTotalReceivers); $this->assign('nbTestReceivers', floor($nbTotalReceivers * $abTestDetail['prct'] / 100)); if ($noMsg || $noBtn) { $this->assign('noButton', true); } $queryStat = 'SELECT mailid, openunique, clickunique, senthtml, senttext, bounceunique FROM #__acymailing_stats WHERE mailid IN (' . $mailids . ')'; $db->setQuery($queryStat); $resStat = $db->loadObjectList('mailid'); if (!empty($resStat)) { $this->assign('statMail', $resStat); $warningMsg[] = JText::_('ABTESTING_STAT_WARNING'); } if (!empty($warningMsg) && $noMsg == false) { acymailing_display(implode('<br />', $warningMsg), 'warning'); } } } else { $titlePage = JText::_('ABTESTING'); } $this->assign('validationStatus', $validationStatus); $this->assign('titlePage', $titlePage); $this->assign('app', $app); if ($app->isAdmin()) { acymailing_setTitle(JText::_('ABTESTING'), $this->icon, $this->ctrl . '&task=abtesting'); $bar = JToolBar::getInstance('toolbar'); } }
function display($tpl = null) { JHTML::_('behavior.modal', 'a.modal'); $toggleClass = acymailing_get('helper.toggle'); $config = acymailing_config(); $db = JFactory::getDBO(); $doc = JFactory::getDocument(); $app = JFactory::getApplication(); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $lg = JFactory::getLanguage(); $language = $lg->getTag(); $styleRemind = 'float:right;margin-right:30px;position:relative;'; $loadLink = '<a onclick="window.document.getElementById(\'acymailing_messages_warning\').style.display = \'none\';return true;" class="modal" rel="{handler: \'iframe\', size:{x:800, y:500}}" href="index.php?option=com_acymailing&tmpl=component&ctrl=file&task=latest&code=' . $language . '">' . JText::_('LOAD_LATEST_LANGUAGE') . '</a>'; if (!file_exists(ACYMAILING_ROOT . 'language' . DS . $language . DS . $language . '.com_acymailing.ini')) { if ($config->get('errorlanguagemissing', 1)) { $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguagemissing_0', 'config', false, JText::_('DONT_REMIND')) . '</small>'; acymailing_display(JText::_('MISSING_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning'); } } elseif (version_compare(JText::_('ACY_LANG_VERSION'), $config->get('version'), '<')) { if ($config->get('errorlanguageupdate', 1)) { $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguageupdate_0', 'config', false, JText::_('DONT_REMIND')) . '</small>'; acymailing_display(JText::_('UPDATE_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning'); } } if (ACYMAILING_J30 && $app->getTemplate() == 'hathor') { if ($config->get('errortemplatenotisis', 1)) { $message = ' You can change the default Back-end template <a href="index.php?option=com_templates&view=styles">Here</a> or change your personnal default Back-end template by editing your user profile <a href="index.php?option=com_users&view=users">Here</a>, tab "Basic Settings".'; $personalTemplate = JFactory::getUser()->getParam('admin_style'); if (!empty($personalTemplate)) { $message = ' You can change your personnal default Back-end template by editing your user profile <a href="index.php?option=com_users&view=users">Here</a>, tab "Basic Settings".'; } $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errortemplatenotisis_0', 'config', false, JText::_('DONT_REMIND')) . '</small>'; acymailing_display('You should rather use the isis template in the Back-End which suits more AcyMailing.' . $message . $notremind, 'warning'); } } $indexes = array('listsub', 'stats', 'list', 'mail', 'userstats', 'urlclick', 'history', 'template', 'queue', 'subscriber'); $addIndexes = array('We recenty optimized our database...'); foreach ($indexes as $oneTable) { if ($config->get('optimize_' . $oneTable, 1)) { continue; } $addIndexes[] = 'Please ' . $toggleClass->toggleText('addindex', $oneTable, 'config', 'click here') . ' to add indexes on the ' . $oneTable . ' table'; } if (count($addIndexes) > 1) { acymailing_display($addIndexes, 'warning'); } acymailing_setTitle(JText::_('CONFIGURATION'), 'acyconfig', 'cpanel'); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('test', 'acysend', '', JText::_('SEND_TEST'), false); JToolBarHelper::divider(); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel('cancel', JText::_('ACY_CLOSE')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'config'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } $elements = new stdClass(); $elements->add_names = JHTML::_('acyselect.booleanlist', "config[add_names]", '', $config->get('add_names', true)); $elements->embed_images = JHTML::_('acyselect.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0)); $elements->embed_files = JHTML::_('acyselect.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1)); $elements->multiple_part = JHTML::_('acyselect.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0)); $mailerMethods = array('elasticemail', 'smtp', 'sendmail'); $js = "function updateMailer(mailermethod){" . "\n"; foreach ($mailerMethods as $oneMethod) { $js .= " window.document.getElementById('" . $oneMethod . "_config').style.display = 'none'; " . "\n"; } $js .= "if(window.document.getElementById(mailermethod+'_config')) {window.document.getElementById(mailermethod+'_config').style.display = 'block';} }"; $js .= 'window.addEvent(\'domready\', function(){ updateMailer(\'' . $config->get('mailer_method', 'phpmail') . '\'); });'; $doc->addScriptDeclaration($js); $encodingval = array(); $encodingval[] = JHTML::_('select.option', 'binary', 'Binary'); $encodingval[] = JHTML::_('select.option', 'quoted-printable', 'Quoted-printable'); $encodingval[] = JHTML::_('select.option', '7bit', '7 Bit'); $encodingval[] = JHTML::_('select.option', '8bit', '8 Bit'); $encodingval[] = JHTML::_('select.option', 'base64', 'Base 64'); $elements->encoding_format = JHTML::_('select.genericlist', $encodingval, "config[encoding_format]", 'size="1" style="width:150px;"', 'value', 'text', $config->get('encoding_format', 'base64')); $charset = acymailing_get('type.charset'); $elements->charset = $charset->display("config[charset]", $config->get('charset', 'UTF-8')); $securedVals = array(); $securedVals[] = JHTML::_('select.option', '', '- - -'); $securedVals[] = JHTML::_('select.option', 'ssl', 'SSL'); $securedVals[] = JHTML::_('select.option', 'tls', 'TLS'); $elements->smtp_secured = JHTML::_('select.genericlist', $securedVals, "config[smtp_secured]", 'size="1" style="width:100px;"', 'value', 'text', $config->get('smtp_secured')); $elements->smtp_auth = JHTML::_('acyselect.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0)); $elements->smtp_keepalive = JHTML::_('acyselect.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1)); $elements->allow_visitor = JHTML::_('acyselect.booleanlist', "config[allow_visitor]", '', $config->get('allow_visitor', 1)); $editorType = acymailing_get('type.editor'); $elements->editor = $editorType->display('config[editor]', $config->get('editor')); $elements->subscription_message = JHTML::_('acyselect.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1)); $elements->confirmation_message = JHTML::_('acyselect.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1)); $elements->unsubscription_message = JHTML::_('acyselect.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1)); $elements->welcome_message = JHTML::_('acyselect.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1)); $elements->unsub_message = JHTML::_('acyselect.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1)); $elements->confirm_message = JHTML::_('acyselect.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0)); $elements->show_footer = JHTML::_('acyselect.booleanlist', "config[show_footer]", '', $config->get('show_footer', 1)); if (acymailing_level(1)) { $forwardValues = array(); $forwardValues[] = JHTML::_('select.option', 0, JTEXT::_('JOOMEXT_NO')); $forwardValues[] = JHTML::_('select.option', 1, JTEXT::_('JOOMEXT_YES')); $forwardValues[] = JHTML::_('select.option', 2, JTEXT::_('JOOMEXT_YES_FORWARD')); $elements->forward = JHTML::_('acyselect.radiolist', $forwardValues, "config[forward]", '', 'value', 'text', $config->get('forward', 0)); } else { $elements->forward = acymailing_getUpgradeLink('essential'); } if (acymailing_level(1)) { $js = "function updateDKIM(dkimval){if(dkimval == 1){document.getElementById('dkim_config').style.display = 'block';}else{document.getElementById('dkim_config').style.display = 'none';}}\n\t\t\t\t\twindow.addEvent('load', function(){ updateDKIM(" . $config->get('dkim', 0) . ");});"; $doc->addScriptDeclaration($js); if (function_exists('openssl_sign')) { $elements->dkim = JHTML::_('acyselect.booleanlist', "config[dkim]", 'onclick="updateDKIM(this.value)"', $config->get('dkim', 0)); } else { $elements->dkim = '<input type="hidden" name="config[dkim]" value="0" />PHP Extension openssl not enabled'; } $js = "function updateQueueProcess(newvalue){"; $js .= "if(newvalue == 'onlyauto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = 'none';}"; $js .= "if(newvalue == 'auto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = '';}"; $js .= "if(newvalue == 'manual') {window.document.getElementById('method_auto').style.display = 'none'; window.document.getElementById('method_manual').style.display = '';}"; $js .= '}'; $js .= 'window.addEvent(\'domready\', function(){ updateQueueProcess(\'' . $config->get('queue_type', 'auto') . '\'); });'; $doc->addScriptDeclaration($js); $queueType = array(); $queueType[] = JHTML::_('select.option', 'onlyauto', JText::_('AUTO_ONLY')); $queueType[] = JHTML::_('select.option', 'auto', JText::_('AUTO_MAN')); $queueType[] = JHTML::_('select.option', 'manual', JText::_('MANUAL_ONLY')); $elements->queue_type = JHTML::_('acyselect.radiolist', $queueType, "config[queue_type]", 'onclick="updateQueueProcess(this.value);"', 'value', 'text', $config->get('queue_type', 'auto')); } else { $elements->dkim = acymailing_getUpgradeLink('essential'); } $js = 'var selectedHTTPS = ' . ($config->get('ssl_links', 0) == 0 ? 'false;' : 'true;') . 'function confirmHTTPS(element){' . 'var clickedHTTPS = (element == 1);' . 'if(clickedHTTPS == selectedHTTPS) return true;' . 'if(clickedHTTPS){' . 'var cnfrm = confirm(\'' . str_replace("'", "\\'", JText::_('ACY_SSLCHOICE_CONFIRMATION')) . '\');' . 'if(!cnfrm){'; if (ACYMAILING_J30) { $js .= 'var labels = document.getElementById(\'config_ssl_links\').getElementsByTagName(\'label\');' . 'if(labels[0].hasClass(\'btn-success\')){' . 'labels[1].click();return true;' . '}else{' . 'labels[0].click();return true;' . '}'; } else { $js .= 'return false;'; } $js .= '}' . '}' . 'selectedHTTPS = clickedHTTPS;' . 'return true;' . '}'; $doc->addScriptDeclaration($js); $elements->ssl_links = JHTML::_('acyselect.booleanlist', "config[ssl_links]", 'onclick="return confirmHTTPS(this.value);"', $config->get('ssl_links', 0)); $delayTypeManual = acymailing_get('type.delay'); $elements->queue_pause = $delayTypeManual->display('config[queue_pause]', $config->get('queue_pause'), 0); $delayTypeAuto = acymailing_get('type.delay'); $elements->cron_frequency = $delayTypeAuto->display('config[cron_frequency]', $config->get('cron_frequency'), 2); $js = "function detectTimeout(id){\n\t\t\t\ttry{\n\t\t\t\t\twindow.document.getElementById(id).className = 'onload';\n\t\t\t\t\twindow.document.getElementById(id).innerHTML = '" . str_replace("'", "\\'", JText::_('ACY_CLOSE_TIMEOUT')) . "';\n\n\t\t\t\t\ttry{\n\t\t\t\t\t\tnew Ajax('" . rtrim(JURI::root(), '/') . "/index.php?option=com_acymailing&tmpl=component&ctrl=stats&task=detecttimeout&seckey=" . $config->get('security_key') . "',{ method: 'get', onComplete: function() { document.id(id).innerHTML = 'Done!'; window.document.getElementById(id).className = 'loading'; }}).request();\n\t\t\t\t\t}catch(err){\n\t\t\t\t\t\tnew Request({url:'" . rtrim(JURI::root(), '/') . "/index.php?option=com_acymailing&tmpl=component&ctrl=stats&task=detecttimeout&seckey=" . $config->get('security_key') . "',method: 'get', onComplete: function(response) { document.id(id).innerHTML = 'Done!'; window.document.getElementById(id).className = 'loading'; }}).send();\n\t\t\t\t\t}\n\t\t\t\t}catch(err){alert('Could not load the max execution time value : '+err);}\n\t\t\t\treturn;\n\t\t}"; $maxexecutiontime = $config->get('max_execution_time'); if (empty($maxexecutiontime) && intval($config->get('last_maxexec_check')) < time() - 60) { $js .= 'window.addEvent(\'domready\', function(){ detectTimeout(\'timeoutcheck\');return; });'; } $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); $cssval = array('css_frontend' => 'component', 'css_module' => 'module', 'css_backend' => 'component'); foreach ($cssval as $configval => $type) { $myvals = array(); $myvals[] = JHTML::_('select.option', '', JText::_('ACY_NONE')); $regex = '^' . $type . '_([-_a-z0-9]*)\\.css$'; $allCSSFiles = JFolder::files(ACYMAILING_MEDIA . 'css', $regex); $family = ''; foreach ($allCSSFiles as $oneFile) { preg_match('#' . $regex . '#i', $oneFile, $results); $fileName = str_replace('default_', '', $results[1]); $fileNameArray = explode('_', $fileName); if (count($fileNameArray) == 2) { if ($fileNameArray[0] != $family) { if (!empty($family)) { $myvals[] = JHTML::_('select.option', '</OPTGROUP>'); } $family = $fileNameArray[0]; $myvals[] = JHTML::_('select.option', '<OPTGROUP>', ucfirst($family)); } unset($fileNameArray[0]); $fileName = implode('_', $fileNameArray); } $fileName = ucwords(str_replace('_', ' ', $fileName)); $myvals[] = JHTML::_('select.option', $results[1], $fileName); } if (!empty($family)) { $myvals[] = JHTML::_('select.option', '</OPTGROUP>'); } $js = 'onchange="updateCSSLink(\'' . $configval . '\',\'' . $type . '\',this.value);"'; $currentVal = $config->get($configval, 'default'); $aStyle = empty($currentVal) ? 'style="display:none"' : ''; $elements->{$configval} = JHTML::_('select.genericlist', $myvals, 'config[' . $configval . ']', 'class="inputbox" size="1" ' . $js, 'value', 'text', $config->get($configval, 'default'), $configval . '_choice'); $linkEdit = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=css&file=' . $type . '_' . $config->get($configval, 'default') . '&var=' . $configval; $elements->{$configval} .= ' <a id="' . $configval . '_link" ' . $aStyle . ' class="modal" title="' . JText::_('ACY_EDIT', true) . '" href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('ACY_EDIT', true) . '"/></a>'; } $js = "function updateCSSLink(myid,type,newval){\n\t\t\tif(newval){document.getElementById(myid+'_link').style.display = '';}else{document.getElementById(myid+'_link').style.display = 'none'}\n\t\t\tdocument.getElementById(myid+'_link').href = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=css&file='+type+'_'+newval+'&var='+myid;\n\t\t}"; $doc->addScriptDeclaration($js); $bootstrapFrontValues = array(); $bootstrapFrontValues[] = JHTML::_('select.option', 0, JTEXT::_('JOOMEXT_NO')); $bootstrapFrontValues[] = JHTML::_('select.option', 1, 'Bootstrap 2'); $bootstrapFrontValues[] = JHTML::_('select.option', 2, 'Bootstrap 3'); $elements->bootstrap_frontend = JHTML::_('acyselect.radiolist', $bootstrapFrontValues, "config[bootstrap_frontend]", '', 'value', 'text', $config->get('bootstrap_frontend', 0)); $elements->colortype = acymailing_get('type.color'); $elements->use_sef = JHTML::_('acyselect.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0)); if (acymailing_level(1)) { $trackingMode = $config->get('trackingsystem', 'acymailing'); $tracking_system = '<input type="checkbox" name="config[trackingsystem][]" id="trackingsystem[0]" value="acymailing" style="margin-left:10px" ' . (stripos($trackingMode, 'acymailing') !== false ? 'checked="checked"' : '') . '/> <label for="trackingsystem[0]">Acymailing</label>'; $tracking_system .= '<input type="checkbox" name="config[trackingsystem][]" id="trackingsystem[1]" value="google" style="margin-left:10px;" ' . (stripos($trackingMode, 'google') !== false ? 'checked="checked"' : '') . '/> <label for="trackingsystem[1]">Google Analytics</label>'; $tracking_system .= '<input type="hidden" name="config[trackingsystem][]" value="1"/>'; $tracking_system_external_website = JHTML::_('acyselect.booleanlist', "config[trackingsystemexternalwebsite]", ' id="trackingsystemexternalwebsite"', $config->get('trackingsystemexternalwebsite', 1)); } else { $tracking_system = acymailing_getUpgradeLink('essential'); $tracking_system_external_website = acymailing_getUpgradeLink('essential'); } $elements->tracking_system = $tracking_system; $elements->tracking_system_external_website = $tracking_system_external_website; $indexType = $config->get('indexFollow', ''); $indexFollow = '<input type="checkbox" name="config[indexFollow][]" id="indexFollow[0]" value="noindex" style="margin-left:10px" ' . (stripos($indexType, 'noindex') !== false ? 'checked="checked"' : '') . '/> <label for="indexFollow[0]">noindex</label>'; $indexFollow .= '<input type="checkbox" name="config[indexFollow][]" id="indexFollow[1]" value="nofollow" style="margin-left:10px" ' . (stripos($indexType, 'nofollow') !== false ? 'checked="checked"' : '') . '/> <label for="indexFollow[1]">nofollow</label>'; $indexFollow .= '<input type="hidden" name="config[indexFollow][]" value="1"/>'; $elements->indexFollow = $indexFollow; if (acymailing_level(3)) { $geolocAvailable = true; $geolocation = '<input type="hidden" name="config[geolocation]" value="0"/>'; $geoloc_api_key = ''; if (!function_exists('curl_init')) { $geolocAvailable = false; $geolocation .= 'The AcyMailing geolocation plugin needs the CURL library installed but it seems that it is not available on your server. Please contact your web hosting to set it up.'; } if (!function_exists('json_decode')) { if (!$geolocAvailable) { $geolocation .= '<br />'; } $geolocAvailable = false; $geolocation .= 'The AcyMailing geolocation plugin can only work with PHP 5.2 at least. Please ask your web hosting to update your PHP version.'; } if ($geolocAvailable) { $geoloc = $config->get('geolocation', ''); $geolocation = '<span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_0" value="creation" style="margin-left:10px" ' . (stripos($geoloc, 'creation') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_0">' . JText::_('ON_USER_CREATE') . '</label></span>'; $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_1" value="modify" style="margin-left:10px;" ' . (stripos($geoloc, 'modify') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_1">' . JText::_('ON_USER_CHANGE') . '</label></span>'; $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_2" value="confirm" style="margin-left:10px;" ' . (stripos($geoloc, 'confirm') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_2">' . JText::_('GEOLOC_CONFIRM_SUB') . '</label></span>'; $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_3" value="clic" style="margin-left:10px;" ' . (stripos($geoloc, 'clic') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_3">' . JText::_('ON_USER_CLICK') . '</label></span>'; $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_4" value="open" style="margin-left:10px;" ' . (stripos($geoloc, 'open') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_4">' . JText::_('ON_OPEN_NEWS') . '</label></span>'; $geolocation .= ' <span style="white-space:nowrap"><input type="checkbox" name="config[geolocation][]" id="geolocation_5" value="unsubscription" style="margin-left:10px;" ' . (stripos($geoloc, 'unsubscription') !== false ? 'checked="checked"' : '') . '/> <label for="geolocation_5">' . JText::_('GEOLOC_UNSUB') . '</label></span>'; $geolocation .= '<input type="hidden" name="config[geolocation][]" value="1"/>'; $geoloc_api_key = '<input class="inputbox" type="text" id="geoloc_api_key" name="config[geoloc_api_key]" style="width:450px" value="' . $this->escape($config->get('geoloc_api_key', '')) . '">'; } } else { $geolocation = acymailing_getUpgradeLink('enterprise'); $geoloc_api_key = false; } $elements->geolocation = $geolocation; $elements->geoloc_api_key = $geoloc_api_key; if (!ACYMAILING_J16) { $query = 'SELECT a.name, a.id as itemid, b.title FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC'; } else { $orderby = ACYMAILING_J30 ? 'a.lft' : 'a.ordering'; $query = 'SELECT a.alias as name, a.id as itemid, b.title FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access NOT IN (2, 3) AND a.client_id=0 AND a.parent_id != 0 ORDER BY b.title ASC,' . $orderby . ' ASC'; } $db->setQuery($query); $joomMenus = $db->loadObjectList(); $menuvalues = array(); $menuvalues[] = JHTML::_('select.option', '0', JText::_('ACY_NONE')); $lastGroup = ''; foreach ($joomMenus as $oneMenu) { if ($oneMenu->title != $lastGroup) { if (!empty($lastGroup)) { $menuvalues[] = JHTML::_('select.option', '</OPTGROUP>'); } $menuvalues[] = JHTML::_('select.option', '<OPTGROUP>', $oneMenu->title); $lastGroup = $oneMenu->title; } $menuvalues[] = JHTML::_('select.option', $oneMenu->itemid, $oneMenu->name); } $elements->acymailing_menu = JHTML::_('select.genericlist', $menuvalues, 'config[itemid]', 'size="1"', 'value', 'text', $config->get('itemid')); $menupositions = array(); $menupositions[] = JHTML::_('select.option', 'under', JText::_('UNDER_TITLE')); $menupositions[] = JHTML::_('select.option', 'above', JText::_('ABOVE_MAIN_AREA')); $elements->menu_position = JHTML::_('acyselect.radiolist', $menupositions, 'config[menu_position]', 'size="1"', 'value', 'text', $config->get('menu_position', 'under')); if (ACYMAILING_J30) { $elements->menu_position = '<input type="hidden" name="config[menu_position]" value="above" />' . JText::_('ABOVE_MAIN_AREA'); } $acyrss_format = array(); $acyrss_format[] = JHTML::_('select.option', '', JText::_('ACY_NONE')); $acyrss_format[] = JHTML::_('select.option', 'rss', 'RSS feed'); $acyrss_format[] = JHTML::_('select.option', 'atom', 'Atom feed'); $acyrss_format[] = JHTML::_('select.option', 'both', JText::_('ACY_ALL')); $elements->acyrss_format = JHTML::_('select.genericlist', $acyrss_format, "config[acyrss_format]", 'size="1"', 'value', 'text', $config->get('acyrss_format', '')); $acyrss_order = array(); $acyrss_order[] = JHTML::_('select.option', 'senddate', JText::_('SEND_DATE')); $acyrss_order[] = JHTML::_('select.option', 'mailid', JText::_('ACY_ID')); $acyrss_order[] = JHTML::_('select.option', 'subject', JText::_('ACY_TITLE')); $elements->acyrss_order = JHTML::_('select.genericlist', $acyrss_order, "config[acyrss_order]", 'size="1"', 'value', 'text', $config->get('acyrss_order', 'senddate')); $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=confirmation'; $elements->editConfEmail = '<a class="modal" id="confirmemail" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_CONF_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_created'; $elements->edit_notification_created = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_refuse'; $elements->edit_notification_refuse = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_unsuball'; $elements->edit_notification_unsuball = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_unsub'; $elements->edit_notification_unsub = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_contact'; $elements->edit_notification_contact = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_contact_menu'; $elements->edit_notification_contact_menu = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_confirm'; $elements->edit_notification_confirm = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=modif'; $elements->editModifEmail = '<a class="modal" id="modifemail" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=cpanel&task=checkDB'; $elements->checkDB = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('DATABASE_INTEGRITY') . '</button></a>'; $js = "function addUnsubReason(){\n\t\t\tvar input = document.createElement('input');\n\t\t\tinput.name = 'unsub_reasons[]';\n\t\t\tinput.style.width = '300px';\n\t\t\tinput.type = 'text';\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(input);\n\t\t\tvar br = document.createElement('br');\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(br);\n\t\t}\n\t\tfunction displaySurvey(surveyval){\n\t\t\tif(surveyval == 1){\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'block';\n\t\t\t}else{\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'none';\n\t\t\t}\n\t\t}\n\t\t"; $doc->addScriptDeclaration($js); $path = JLanguage::getLanguagePath(JPATH_ROOT); $dirs = JFolder::folders($path); $languages = array(); foreach ($dirs as $dir) { if (strlen($dir) != 5 || $dir == "xx-XX") { continue; } $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$'); $xmlFile = reset($xmlFiles); if (empty($xmlFile)) { $data = array(); } else { $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile); } $oneLanguage = new stdClass(); $oneLanguage->language = $dir; $oneLanguage->name = empty($data['name']) ? $dir : $data['name']; $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.com_acymailing\\.ini$'); $languageFile = reset($languageFiles); if (!empty($languageFile)) { $linkEdit = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=language&code=' . $oneLanguage->language; $oneLanguage->edit = ' <a class="modal" title="' . JText::_('EDIT_LANGUAGE_FILE', true) . '" href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"/></a>'; } else { $linkEdit = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=language&code=' . $oneLanguage->language; $oneLanguage->edit = ' <a class="modal" title="' . JText::_('ADD_LANGUAGE_FILE', true) . '" href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-add.png" alt="' . JText::_('ADD_LANGUAGE_FILE', true) . '"/></a>'; } $languages[] = $oneLanguage; } $js = "function updateConfirmation(newvalue){"; $js .= "if(newvalue == 0) {window.document.getElementById('confirmemail').style.display = 'none'; window.document.getElementById('confirm_redirect').disabled = true;}else{window.document.getElementById('confirmemail').style.display = 'inline'; window.document.getElementById('confirm_redirect').disabled = false;}"; $js .= '}'; $js .= "function updateModification(newvalue){ if(newvalue != 'none') {window.document.getElementById('modifemail').style.display = 'none';}else{window.document.getElementById('modifemail').style.display = 'inline';}} "; $js .= 'window.addEvent(\'load\', function(){ updateModification(\'' . $config->get('allow_modif', 'data') . '\'); updateConfirmation(' . $config->get('require_confirmation', 0) . '); });'; $doc->addScriptDeclaration($js); $elements->require_confirmation = JHTML::_('acyselect.booleanlist', "config[require_confirmation]", 'onclick="updateConfirmation(this.value)"', $config->get('require_confirmation', 0)); $allowmodif = array(); $allowmodif[] = JHTML::_('select.option', "none", JText::_('JOOMEXT_NO')); $allowmodif[] = JHTML::_('select.option', "data", JText::_('ONLY_SUBSCRIPTION')); $allowmodif[] = JHTML::_('select.option', "all", JText::_('JOOMEXT_YES')); $elements->allow_modif = JHTML::_('acyselect.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data')); if (!ACYMAILING_J16) { $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE `folder` = 'acymailing' AND `element` NOT LIKE 'plg%' ORDER BY published DESC, ordering ASC"); } else { $db->setQuery("SELECT name,enabled as published,extension_id as id FROM `#__extensions` WHERE `folder` = 'acymailing' AND `type`= 'plugin' AND `element` NOT LIKE 'plg%' ORDER BY enabled DESC, ordering ASC"); } $plugins = $db->loadObjectList(); if (!ACYMAILING_J16) { $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY published DESC, ordering ASC"); } else { $db->setQuery("SELECT name,enabled as published ,extension_id as id FROM `#__extensions` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND `type` = 'plugin' AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY enabled DESC, ordering ASC"); } $integrationplugins = $db->loadObjectList(); $bounceaction = acymailing_get('type.bounceaction'); $this->assignRef('bounceaction', $bounceaction); $this->assignRef('config', $config); $this->assignRef('languages', $languages); $this->assignRef('elements', $elements); $this->assignRef('plugins', $plugins); $this->assignRef('integrationplugins', $integrationplugins); $tabs = acymailing_get('helper.acytabs'); $tabs->setOptions(array('useCookie' => true)); $this->assignRef('tabs', $tabs); $this->assignRef('toggleClass', $toggleClass); if (!ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php') or ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber' . DS . 'tagsubscriber.php')) { $errorPluginTxt = JText::_('ERROR_PLUGINS') . '<br /><a href="index.php?option=com_acymailing&ctrl=update&task=install">' . JText::_('ACY_ERROR_INSTALLAGAIN') . '</a>'; acymailing_display($errorPluginTxt, 'warning'); } return parent::display($tpl); }
function form() { $subid = acymailing_getCID('subid'); $db =& JFactory::getDBO(); $app =& JFactory::getApplication(); if (!empty($subid)) { $subscriberClass = acymailing_get('class.subscriber'); $subscriber = $subscriberClass->getFull($subid); $subscription = $app->isAdmin() ? $subscriberClass->getSubscription($subid) : $subscriberClass->getFrontendSubscription($subid); } else { $listType = acymailing_get('class.list'); $subscription = $app->isAdmin() ? $listType->getLists() : $listType->getFrontendLists(); $subscriber = null; $subscriber->created = time(); $subscriber->html = 1; $subscriber->confirmed = 1; $subscriber->blocked = 0; $subscriber->accept = 1; $subscriber->enabled = 1; $iphelper = acymailing_get('helper.user'); $subscriber->ip = $iphelper->getIP(); } if ($app->isAdmin()) { acymailing_setTitle(JText::_('ACY_USER'), 'acyusers', 'subscriber&task=edit&subid=' . $subid); $bar =& JToolBar::getInstance('toolbar'); } if (!empty($subid)) { $query = 'SELECT a.`mailid`, a.`html`, a.`sent`, a.`senddate`,a.`open`, a.`opendate`, a.`bounce`, a.`fail`,b.`subject`,b.`alias`'; $query .= ' FROM `#__acymailing_userstats` as a'; $query .= ' LEFT JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; $query .= ' WHERE a.subid = ' . intval($subid) . ' ORDER BY a.senddate DESC LIMIT 30'; $db->setQuery($query); $open = $db->loadObjectList(); $this->assignRef('open', $open); $query = 'SELECT a.*,b.`subject`,b.`alias`'; $query .= ' FROM `#__acymailing_queue` as a'; $query .= ' LEFT JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; $query .= ' WHERE a.subid = ' . intval($subid) . ' ORDER BY a.senddate ASC LIMIT 60'; $db->setQuery($query); $queue = $db->loadObjectList(); $this->assignRef('queue', $queue); $query = 'SELECT h.*,m.subject FROM #__acymailing_history as h LEFT JOIN #__acymailing_mail as m ON h.mailid = m.mailid WHERE h.subid = ' . intval($subid) . ' ORDER BY h.`date` DESC LIMIT 30'; $db->setQuery($query); $history = $db->loadObjectList(); $this->assignRef('history', $history); } if ($app->isAdmin()) { if (!empty($subscriber->userid)) { if (file_exists(ACYMAILING_ROOT . 'components' . DS . 'com_comprofiler' . DS . 'comprofiler.php')) { $editLink = 'index.php?option=com_comprofiler&task=edit&cid[]='; } elseif (version_compare(JVERSION, '1.6.0', '<')) { $editLink = 'index.php?option=com_users&task=edit&cid[]='; } else { $editLink = 'index.php?option=com_users&task=user.edit&id='; } $bar->appendButton('Link', 'edit', JText::_('EDIT_JOOMLA_USER'), $editLink . $subscriber->userid); JToolBarHelper::spacer(); } JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'subscriber-form'); } $filters = null; $quickstatusType = acymailing_get('type.statusquick'); $filters->statusquick = $quickstatusType->display('statusquick'); $this->assignRef('subscriber', $subscriber); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('subscription', $subscription); $this->assignRef('filters', $filters); $statusType = acymailing_get('type.status'); $this->assignRef('statusType', $statusType); }
function form() { $subid = acymailing_getCID('subid'); $db = JFactory::getDBO(); $app = JFactory::getApplication(); $config = acymailing_config(); if (!empty($subid)) { $subscriberClass = acymailing_get('class.subscriber'); $subscriber = $subscriberClass->getFull($subid); $subscription = $app->isAdmin() ? $subscriberClass->getSubscription($subid) : $subscriberClass->getFrontendSubscription($subid); if (empty($subscriber->subid)) { acymailing_display('User ' . $subid . ' not found', 'error'); $subid = 0; } } if (empty($subid)) { $listType = acymailing_get('class.list'); $subscription = $app->isAdmin() ? $listType->getLists() : $listType->getFrontendLists(); $subscriber = new stdClass(); $subscriber->created = time(); $subscriber->html = 1; $subscriber->confirmed = 1; $subscriber->blocked = 0; $subscriber->accept = 1; $subscriber->enabled = 1; $iphelper = acymailing_get('helper.user'); $subscriber->ip = $iphelper->getIP(); } if ($app->isAdmin()) { acymailing_setTitle(JText::_('ACY_USER'), 'acyusers', 'subscriber&task=edit&subid=' . $subid); $bar = JToolBar::getInstance('toolbar'); } if (!empty($subid)) { $query = 'SELECT a.`mailid`, a.`html`, a.`sent`, a.`senddate`,a.`open`, a.`opendate`, a.`bounce`, a.`fail`,b.`subject`,b.`alias`'; $query .= ' FROM `#__acymailing_userstats` as a'; $query .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; $query .= ' WHERE a.subid = ' . intval($subid) . ' ORDER BY a.senddate DESC LIMIT 30'; $db->setQuery($query); $open = $db->loadObjectList(); $this->assignRef('open', $open); if (acymailing_level(3)) { $db->setQuery('SELECT DISTINCT `mailid` FROM `#__acymailing_urlclick` WHERE `subid` = ' . intval($subid)); $clickedNews = $db->loadObjectList('mailid'); $this->assignRef('clickedNews', $clickedNews); } $query = 'SELECT a.*,b.`subject`,b.`alias`'; $query .= ' FROM `#__acymailing_queue` as a'; $query .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; $query .= ' WHERE a.subid = ' . intval($subid) . ' ORDER BY a.senddate ASC LIMIT 60'; $db->setQuery($query); $queue = $db->loadObjectList(); $this->assignRef('queue', $queue); $query = 'SELECT h.*,m.subject FROM #__acymailing_history as h LEFT JOIN #__acymailing_mail as m ON h.mailid = m.mailid WHERE h.subid = ' . intval($subid) . ' ORDER BY h.`date` DESC LIMIT 30'; $db->setQuery($query); $history = $db->loadObjectList(); $this->assignRef('history', $history); $query = 'SELECT * FROM #__acymailing_geolocation WHERE geolocation_subid=' . intval($subid) . ' ORDER BY geolocation_created DESC LIMIT 100'; $db->setQuery($query); $geoloc = $db->loadObjectList(); if (!empty($geoloc)) { $markCities = array(); $diffCountries = false; $dataDetails = array(); foreach ($geoloc as $mark) { $indexCity = array_search($mark->geolocation_city, $markCities); if ($indexCity === false) { array_push($markCities, $mark->geolocation_city); array_push($dataDetails, array('nbInCity' => 1, 'actions' => $mark->geolocation_type)); } else { $dataDetails[$indexCity]['nbInCity'] += 1; $dataDetails[$indexCity]['actions'] .= ", " . $mark->geolocation_type; } if (!$diffCountries) { if (!empty($region) && $region != $mark->geolocation_country_code) { $region = 'world'; $diffCountries = true; } else { $region = $mark->geolocation_country_code; } } } $this->assignRef('geoloc_region', $region); $this->assignRef('geoloc_city', $markCities); $this->assignRef('geoloc', $geoloc); $this->assignRef('geoloc_details', $dataDetails); } if (!empty($subscriber->ip)) { $query = 'SELECT * FROM #__acymailing_subscriber WHERE ip=' . $db->Quote($subscriber->ip) . ' AND subid != ' . intval($subid) . ' LIMIT 30'; $db->setQuery($query); $neighbours = $db->loadObjectList(); if (!empty($neighbours)) { $this->assignRef('neighbours', $neighbours); } } } if ($app->isAdmin()) { if (!empty($subscriber->userid)) { if (file_exists(ACYMAILING_ROOT . 'components' . DS . 'com_comprofiler' . DS . 'comprofiler.php')) { $editLink = 'index.php?option=com_comprofiler&task=edit&cid[]='; } elseif (!ACYMAILING_J16) { $editLink = 'index.php?option=com_users&task=edit&cid[]='; } else { $editLink = 'index.php?option=com_users&task=user.edit&id='; } $bar->appendButton('Link', 'edit', JText::_('EDIT_JOOMLA_USER'), $editLink . $subscriber->userid); JToolBarHelper::spacer(); } JToolBarHelper::save(); JToolBarHelper::apply(); if (ACYMAILING_J30) { JToolBarHelper::save2new(); } JToolBarHelper::cancel(); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'subscriber-form'); } $filters = new stdClass(); $quickstatusType = acymailing_get('type.statusquick'); $filters->statusquick = $quickstatusType->display('statusquick'); $this->assignRef('subscriber', $subscriber); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('subscription', $subscription); $this->assignRef('filters', $filters); $statusType = acymailing_get('type.status'); $this->assignRef('statusType', $statusType); }
function preview() { $app = JFactory::getApplication(); $mailid = acymailing_getCID('mailid'); $config = acymailing_config(); JHTML::_('behavior.modal', 'a.modal'); $mailerHelper = acymailing_get('helper.mailer'); $mailerHelper->loadedToSend = false; $mail = $mailerHelper->load($mailid); $user = JFactory::getUser(); $userClass = acymailing_get('class.subscriber'); $receiver = $userClass->get($user->email); $mail->sendHTML = true; $mailerHelper->dispatcher->trigger('acymailing_replaceusertags', array(&$mail, &$receiver, false)); if (!empty($mail->altbody)) { $mail->altbody = $mailerHelper->textVersion($mail->altbody, false); } $listmailClass = acymailing_get('class.listmail'); $lists = $listmailClass->getReceivers($mail->mailid, true, false); $receiversClass = acymailing_get('type.testreceiver'); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $infos = new stdClass(); $infos->receiver_type = $app->getUserStateFromRequest($paramBase . ".receiver_type", 'receiver_type', '', 'string'); $infos->test_html = $app->getUserStateFromRequest($paramBase . ".test_html", 'test_html', 1, 'int'); $infos->test_email = $app->getUserStateFromRequest($paramBase . ".test_email", 'test_email', '', 'string'); acymailing_setTitle(JText::_('ACY_PREVIEW') . ' : ' . $mail->subject, $this->icon, $this->ctrl . '&task=preview&mailid=' . $mailid); $bar = JToolBar::getInstance('toolbar'); if ($this->type == 'news') { if (acymailing_level(1) && acymailing_isAllowed($config->get('acl_newsletters_schedule', 'all'))) { if ($mail->published == 2) { JToolBarHelper::custom('unschedule', 'unschedule', '', JText::_('UNSCHEDULE'), false); } else { $bar->appendButton('Acypopup', 'schedule', JText::_('SCHEDULE'), "index.php?option=com_acymailing&ctrl=send&task=scheduleready&tmpl=component&mailid=" . $mailid); } } if (acymailing_isAllowed($config->get('acl_newsletters_send', 'all'))) { $bar->appendButton('Acypopup', 'acysend', JText::_('SEND'), "index.php?option=com_acymailing&ctrl=send&task=sendready&tmpl=component&mailid=" . $mailid); } JToolBarHelper::divider(); } JToolBarHelper::custom('edit', 'edit', '', JText::_('ACY_EDIT'), false); JToolBarHelper::cancel('cancel', JText::_('ACY_CLOSE')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', $this->doc); $this->assignRef('lists', $lists); $this->assignRef('infos', $infos); $this->assignRef('receiverClass', $receiversClass); $this->assignRef('mail', $mail); }
function export() { $listClass = acymailing_get('class.list'); $db = JFactory::getDBO(); $fields = acymailing_getColumns('#__acymailing_subscriber'); $config = acymailing_config(); $selectedFields = explode(',', $config->get('export_fields', 'email,name')); $selectedLists = explode(',', $config->get('export_lists')); acymailing_setTitle(JText::_('ACY_EXPORT'), 'acyexport', 'data&task=export'); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('doexport', 'acyexport', '', JText::_('ACY_EXPORT'), false); $bar->appendButton('Link', 'cancel', JText::_('ACY_CANCEL'), acymailing_completeLink('subscriber')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'data-export'); $charsetType = acymailing_get('type.charset'); $this->assignRef('charset', $charsetType); $lists = $listClass->getLists(); $this->assignRef('lists', $lists); $this->assignRef('fields', $fields); $this->assignRef('selectedfields', $selectedFields); $this->assignRef('selectedlists', $selectedLists); $this->assignRef('config', $config); $whereSubscribers = ''; if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) { $i = 1; $subids = array(); foreach ($_SESSION['acymailing']['exportusers'] as $subid) { $subids[] = (int) $subid; $i++; if ($i > 10) { break; } } $whereSubscribers = implode(',', $subids); } if (JRequest::getInt('sessionquery')) { $currentSession = JFactory::getSession(); $exportQuery = $currentSession->get('acyexportquery'); if (!empty($exportQuery)) { $whereSubscribers = $exportQuery; } } if (!empty($whereSubscribers)) { $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . $whereSubscribers . ') LIMIT 10'); $users = $db->loadObjectList(); $this->assignRef('users', $users); } }
function form() { $db = JFactory::getDBO(); $config = acymailing_config(); if (JRequest::getVar('task') == 'filterDisplayUsers') { $action = array(); $action['type'] = array('displayUsers'); $action[] = array('displayUsers' => array()); $filterClass = acymailing_get('class.filter'); $filterClass->subid = JRequest::getString('subid'); $filterClass->execute(JRequest::getVar('filter'), $action); if (!empty($filterClass->report)) { $this->assignRef('filteredUsers', $filterClass->report[0]); } } $filid = acymailing_getCID('filid'); $filterClass = acymailing_get('class.filter'); if (!empty($filid)) { $filter = $filterClass->get($filid); } else { $filter = new stdClass(); $filter->action = JRequest::getVar('action'); $filter->filter = JRequest::getVar('filter'); $filter->published = 1; } JPluginHelper::importPlugin('acymailing'); $this->dispatcher = JDispatcher::getInstance(); $typesFilters = array(); $typesActions = array(); $outputFilters = implode('', $this->dispatcher->trigger('onAcyDisplayFilters', array(&$typesFilters, 'massactions'))); $outputActions = implode('', $this->dispatcher->trigger('onAcyDisplayActions', array(&$typesActions))); $typevaluesFilters = array(); $typevaluesActions = array(); $typevaluesFilters[] = JHTML::_('select.option', '', JText::_('FILTER_SELECT')); $typevaluesActions[] = JHTML::_('select.option', '', JText::_('ACTION_SELECT')); $doc = JFactory::getDocument(); foreach ($typesFilters as $oneType => $oneName) { $typevaluesFilters[] = JHTML::_('select.option', $oneType, $oneName); } foreach ($typesActions as $oneType => $oneName) { $typevaluesActions[] = JHTML::_('select.option', $oneType, $oneName); } $js = "function updateAction(actionNum){\r\n\t\t\t\tcurrentActionType =window.document.getElementById('actiontype'+actionNum).value;\r\n\t\t\t\tif(!currentActionType){\r\n\t\t\t\t\twindow.document.getElementById('actionarea_'+actionNum).innerHTML = '';\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tactionArea = 'action__num__'+currentActionType;\r\n\t\t\t\twindow.document.getElementById('actionarea_'+actionNum).innerHTML = window.document.getElementById(actionArea).innerHTML.replace(/__num__/g,actionNum);\r\n\t\t\t\tif(typeof(window['onAcyDisplayAction_'+currentActionType]) == 'function') {\r\n\t\t\t\t\ttry{ window['onAcyDisplayAction_'+currentActionType](actionNum); }catch(e){alert('Error in the onAcyDisplayAction_'+currentActionType+' function : '+e); }\r\n\t\t\t\t}\r\n\r\n\t\t\t}"; $js .= "var numActions = 0;\r\n\t\t\t\tfunction addAction(){\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\t\t\tnewdiv.id = 'action'+numActions;\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\n\t\t\t\t\tnewdiv.innerHTML = document.getElementById('actions_original').innerHTML.replace(/__num__/g, numActions);\r\n\t\t\t\t\tdocument.getElementById('allactions').appendChild(newdiv); updateAction(numActions); numActions++;\r\n\t\t\t\t}"; $js .= "window.addEvent('domready', function(){ addAcyFilter(); addAction(); });"; if (!ACYMAILING_J16) { $js .= 'function submitbutton(pressbutton){ if (pressbutton != \'save\') { submitform( pressbutton ); return; }'; } else { $js .= 'Joomla.submitbutton = function(pressbutton) { if (pressbutton != \'save\') { Joomla.submitform(pressbutton,document.adminForm); return; }'; } if (ACYMAILING_J30) { $js .= "if(window.document.getElementById('filterinfo').style.display == 'none'){\r\n\t\t\t\t\t\twindow.document.getElementById('filterinfo').style.display = 'block';\r\n\t\t\t\t\t\ttry{allspans = window.document.getElementById('toolbar-save').getElementsByTagName(\"span\"); allspans[0].className = 'icon-apply';}catch(err){}\r\n\t\t\t\t\t\ttry{alli = window.document.getElementById('toolbar-save').getElementsByTagName(\"i\"); alli[0].className = 'icon-apply';}catch(err){}\r\n\t\t\t\t\t\treturn false;}\r\n\t\t\t\t\tif(window.document.getElementById('title').value.length < 2){alert('" . JText::_('ENTER_TITLE', true) . "'); return false;}"; } else { $js .= "if(window.document.getElementById('filterinfo').style.display == 'none'){\r\n\t\t\t\t\t\twindow.document.getElementById('filterinfo').style.display = 'block';\r\n\t\t\t\t\t\ttry{allspans = window.document.getElementById('toolbar-save').getElementsByTagName(\"span\"); allspans[0].className = 'icon-32-apply';}catch(err){}\r\n\t\t\t\t\t\treturn false;}\r\n\t\t\t\t\tif(window.document.getElementById('title').value.length < 2){alert('" . JText::_('ENTER_TITLE', true) . "'); return false;}"; } if (!ACYMAILING_J16) { $js .= "submitform( pressbutton );} "; } else { $js .= "Joomla.submitform(pressbutton,document.adminForm);}; "; } $doc->addScriptDeclaration($js); $filterClass->addJSFilterFunctions(); $js = ''; $data = array('addAction' => 'action', 'addAcyFilter' => 'filter'); foreach ($data as $jsFunction => $datatype) { if (empty($filter->{$datatype})) { continue; } foreach ($filter->{$datatype}['type'] as $num => $oneType) { if (empty($oneType)) { continue; } $js .= "while(!document.getElementById('" . $datatype . "type{$num}')){" . $jsFunction . "();}\r\n\t\t\t\t\t\tdocument.getElementById('" . $datatype . "type{$num}').value= '{$oneType}';\r\n\t\t\t\t\t\tupdate" . ucfirst($datatype) . "({$num});"; if (empty($filter->{$datatype}[$num][$oneType])) { continue; } foreach ($filter->{$datatype}[$num][$oneType] as $key => $value) { if (is_array($value)) { $js .= "try{"; foreach ($value as $subkey => $subval) { $js .= "document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].value = '" . addslashes(str_replace(array("\n", "\r"), ' ', $subval)) . "';"; $js .= "if(document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].type && document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].type == 'checkbox'){ document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}][{$subkey}]'].checked = 'checked'; }"; } $js .= "}catch(e){}"; } $myVal = is_array($value) ? implode(',', $value) : $value; $js .= "try{"; $js .= "document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].value = '" . addslashes(str_replace(array("\n", "\r"), ' ', $myVal)) . "';"; $js .= "if(document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].type && document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].type == 'checkbox'){ document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].checked = 'checked'; }"; $js .= "}catch(e){}"; } $js .= "\n" . " if(typeof(onAcyDisplay" . ucfirst($datatype) . "_" . $oneType . ") == 'function'){\r\n\t\t\t\t\ttry{ onAcyDisplay" . ucfirst($datatype) . "_" . $oneType . "({$num}); }catch(e){alert('Error in the onAcyDisplay" . ucfirst($datatype) . "_" . $oneType . " function : '+e); }\r\n\t\t\t\t}"; if ($datatype == 'filter') { $js .= " countresults({$num});"; } } } $listid = JRequest::getInt('listid'); if (!empty($listid)) { $js .= "document.getElementById('actiontype0').value = 'list'; updateAction(0); document.adminForm.elements['action[0][list][selectedlist]'].value = '" . $listid . "';"; } $doc->addScriptDeclaration("window.addEvent('domready', function(){ {$js} });"); $triggers = array(); $triggers['daycron'] = JText::_('AUTO_CRON_FILTER'); $nextDate = $config->get('cron_plugins_next'); $listHours = array(); $listMinutess = array(); for ($i = 0; $i < 24; $i++) { $listHours[] = JHTML::_('select.option', $i, $i < 10 ? '0' . $i : $i); } $hours = JHTML::_('select.genericlist', $listHours, 'triggerhours', 'class="inputbox" size="1" style="width:50px;"', 'value', 'text', acymailing_getDate($nextDate, 'H')); for ($i = 0; $i < 60; $i += 5) { $listMinutess[] = JHTML::_('select.option', $i, $i < 10 ? '0' . $i : $i); } $defaultMin = floor(acymailing_getDate($nextDate, 'i') / 5) * 5; $minutes = JHTML::_('select.genericlist', $listMinutess, 'triggerminutes', 'class="inputbox" size="1" style="width:50px;"', 'value', 'text', $defaultMin); $this->assign('hours', $hours); $this->assign('minutes', $minutes); $this->assign('nextDate', !empty($nextDate) ? ' (' . JText::_('NEXT_RUN') . ' : ' . acymailing_getDate($nextDate, '%d %B %Y %H:%M') . ')' : ''); $triggers['allcron'] = JText::_('ACY_EACH_TIME'); $triggers['subcreate'] = JText::_('ON_USER_CREATE'); $triggers['subchange'] = JText::_('ON_USER_CHANGE'); $this->dispatcher->trigger('onAcyDisplayTriggers', array(&$triggers)); $name = empty($filter->name) ? '' : ' : ' . $filter->name; acymailing_setTitle(JText::_('ACY_FILTER') . $name, 'filter', 'filter&task=edit&filid=' . $filid); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('filterDisplayUsers', 'acyusers', '', JText::_('FILTER_VIEW_USERS'), false); JToolBarHelper::divider(); $bar->appendButton('Confirm', JText::_('PROCESS_CONFIRMATION'), 'process', JText::_('PROCESS'), 'process', false, false); JToolBarHelper::divider(); if (acymailing_level(3)) { JToolBarHelper::custom('save', 'save', '', JText::_('ACY_SAVE'), false); if (!empty($filter->filid)) { $bar->appendButton('Link', 'new', JText::_('ACY_NEW'), acymailing_completeLink('filter&task=edit&filid=0')); } } $bar->appendButton('Link', 'cancel', JText::_('ACY_CLOSE'), acymailing_completeLink('dashboard')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'filter'); $subid = JRequest::getString('subid'); if (!empty($subid)) { $subArray = explode(',', trim($subid, ',')); JArrayHelper::toInteger($subArray); $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . implode(',', $subArray) . ')'); $users = $db->loadObjectList(); if (!empty($users)) { $this->assignRef('users', $users); $this->assignRef('subid', $subid); } } $this->assignRef('typevaluesFilters', $typevaluesFilters); $this->assignRef('typevaluesActions', $typevaluesActions); $this->assignRef('outputFilters', $outputFilters); $this->assignRef('outputActions', $outputActions); $this->assignRef('filter', $filter); $this->assignRef('triggers', $triggers); if (JRequest::getCmd('tmpl') == 'component') { $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css')); } if (acymailing_level(3) and JRequest::getCmd('tmpl') != 'component') { $db->setQuery('SELECT * FROM #__acymailing_filter ORDER BY `published` DESC, `filid` DESC'); $filters = $db->loadObjectList(); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('filters', $filters); } }
function listing() { $config =& acymailing_config(); acymailing_setTitle(JText::_('CHARTS'), 'stats', 'diagram'); $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'cancel', JText::_('GLOBAL_STATISTICS'), acymailing_completeLink('stats')); JToolBarHelper::divider(); JToolBarHelper::custom('export', 'acyexport', '', JText::_('ACY_EXPORT'), false); $bar->appendButton('Directprint'); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'charts'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } $db = JFactory::getDBO(); $app = JFactory::getApplication(); $where = array(); $groupby = array(); $groupingtype = array(); $groupby[] = 'groupingdate'; $groupby[] = 'groupingtype'; $selectfield = 'sub.created'; $listsneeded = false; $listClass = acymailing_get('class.list'); $allLists = $listClass->getLists('listid'); $this->assignRef('lists', $allLists); $display = JRequest::getVar('display', array()); $this->assignRef('display', $display); foreach ($display as $var => $val) { $var = acymailing_securefield($var); $this->{$var} = acymailing_securefield($val); } if (empty($display)) { return; } $compares = JRequest::getVar('compares', array()); $this->assignRef('compares', $compares); if (!empty($compares['lists'])) { $groupingtype[] = 'list.name'; $listsneeded = true; $selectfield = 'listsub.subdate'; $where[] = "list.type = 'list'"; $filterLists = JRequest::getVar('filterlists', array()); JArrayHelper::toInteger($filterLists); if (!empty($filterLists)) { $where[] = "listsub.listid IN (" . implode(',', $filterLists) . ")"; } $this->assignRef('filterlists', $filterLists); } if ($this->interval == 'day') { $groupingdate = "DATE_FORMAT(FROM_UNIXTIME(" . $selectfield . "),'%Y-%m-%d')"; $this->dateformat = '%d %B %Y'; } elseif ($this->interval == 'month') { $groupingdate = "DATE_FORMAT(FROM_UNIXTIME(" . $selectfield . "),'%Y-%m-01')"; $this->dateformat = '%B %Y'; } elseif ($this->interval == 'year') { $groupingdate = "DATE_FORMAT(FROM_UNIXTIME(" . $selectfield . "),'%Y-01-01')"; $this->dateformat = '%Y'; } else { return; } if (!empty($compares['years'])) { $groupingtype[] = "DATE_FORMAT(FROM_UNIXTIME(" . $selectfield . "),'%Y')"; $this->dateformat = str_replace('%Y', '', $this->dateformat); $groupingdate = str_replace('%Y', '2000', $groupingdate); } $fieldtotal = 'COUNT(sub.subid)'; $fieldtype = empty($groupingtype) ? "'Total'" : "CONCAT('Total - '," . implode(", ' - ' ,", $groupingtype) . ")"; if (!empty($this->sumup)) { $min = empty($this->datemin) ? 0 : acymailing_getTime($this->datemin); $max = empty($this->datemax) ? time() : acymailing_getTime($this->datemax); if (empty($min)) { $db->setQuery('SELECT min(created) FROM #__acymailing_subscriber WHERE created > 0 LIMIT 1'); $min = $db->loadResult(); } $this->results = array(); $maxInter = $min; $nbqueries = 0; while ($maxInter < $max) { $nbqueries++; if ($nbqueries > 100) { if ($nbqueries == 101) { acymailing_display('There are too many requests, please reduce the date range or change the interval'); } continue; } $previous = $maxInter; if ($this->interval == 'day') { $maxInter = mktime(0, 0, 0, date("n", $maxInter), date("j", $maxInter) + 1, date("Y", $maxInter)); } elseif ($this->interval == 'month') { $maxInter = mktime(0, 0, 0, date("n", $maxInter) + 1, 1, date("Y", $maxInter)); } elseif ($this->interval == 'year') { $maxInter = mktime(0, 0, 0, 1, 1, date("Y", $maxInter) + 1); } $whereCond = array(); if ($listsneeded) { $whereCond[] = 'listsub.status != 2'; $whereCond[] = 'listsub.subdate > 0'; $whereCond[] = 'listsub.subdate < ' . $maxInter; $whereCond[] = '(listsub.status = 1 OR listsub.unsubdate >' . $maxInter . ')'; $query = "SELECT COUNT(listsub.subid) as total, " . $fieldtype . " as groupingtype, '" . acymailing_getDate($previous + 43200, '%Y-%m-%d') . "' as groupingdate"; $query .= " FROM #__acymailing_listsub as listsub "; $query .= " JOIN #__acymailing_list as list ON listsub.listid = list.listid "; $query .= " WHERE (" . implode(") AND (", array_merge($where, $whereCond)) . ")"; $query .= " GROUP BY listsub.listid"; } else { $whereCond[] = 'sub.created < ' . $maxInter; $whereCond[] = 'sub.created > 0'; $query = "SELECT COUNT(sub.subid) as total, " . $fieldtype . " as groupingtype, '" . acymailing_getDate($previous + 43200, '%Y-%m-%d') . "' as groupingdate"; $query .= " FROM #__acymailing_subscriber as sub"; $query .= " WHERE (" . implode(") AND (", array_merge($where, $whereCond)) . ")"; } $db->setQuery($query); $this->results = array_merge($this->results, $db->loadObjectList()); } } else { if (!empty($this->datemin)) { $where[] = $groupingdate . ' >= ' . $db->Quote($this->datemin); } if (!empty($this->datemax)) { $where[] = $groupingdate . ' < ' . $db->Quote($this->datemax); } $where[] = 'sub.created > 0'; $query = "SELECT " . $fieldtotal . " as total, " . $fieldtype . " as groupingtype, " . $groupingdate . " as groupingdate"; if ($listsneeded) { $query .= " FROM #__acymailing_listsub as listsub "; $query .= " JOIN #__acymailing_subscriber as sub ON listsub.subid = sub.subid "; $query .= " JOIN #__acymailing_list as list ON listsub.listid = list.listid "; } else { $query .= " FROM #__acymailing_subscriber as sub "; } if (!empty($where)) { $query .= " WHERE (" . implode(") AND (", $where) . ")"; } if (!empty($groupby)) { $query .= " GROUP BY " . implode(',', $groupby); } $query .= " ORDER BY groupingdate ASC"; $db->setQuery($query); $this->results = $db->loadObjectList(); } if (empty($this->results)) { $app->enqueueMessage(JText::_('NO_SUBSCRIBER'), 'notice'); } return $this->displayResult(); }
function listing() { $app =& JFactory::getApplication(); $pageInfo = null; $config = acymailing_config(); JHTML::_('behavior.modal', 'a.modal'); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . $this->getLayout(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower($pageInfo->search); $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int'); $database =& JFactory::getDBO(); $filters = array(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . $database->getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}"; } $query = 'SELECT ' . implode(' , ', $this->selectFields); $query .= ' FROM ' . acymailing_table('stats') . ' as a'; $query .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; if (!empty($filters)) { $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; } if (!empty($pageInfo->filter->order->value)) { $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('stats') . ' as a'; if (!empty($pageInfo->search)) { $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid'; } if (!empty($filters)) { $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')'; } $database->setQuery($queryCount); $pageInfo->elements->total = $database->loadResult(); if (!empty($pageInfo->search)) { $rows = acymailing_search($pageInfo->search, $rows); } $pageInfo->elements->page = count($rows); jimport('joomla.html.pagination'); $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value); acymailing_setTitle(JText::_('GLOBAL_STATISTICS'), 'stats', 'stats'); $bar =& JToolBar::getInstance('toolbar'); if (acymailing_level(1)) { $bar->appendButton('Link', 'stats', JText::_('CHARTS'), acymailing_completeLink('diagram')); } JToolBarHelper::spacer(); JToolBarHelper::spacer(); if (acymailing_isAllowed($config->get('acl_statistics_delete', 'all'))) { JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS')); } JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'stats-listing'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); }
function display($tpl = null) { $doc =& JFactory::getDocument(); $config = acymailing_config(); $buttons = array(); $desc = array(); $desc['subscriber'] = '<ul><li>' . JText::_('USERS_DESC_CREATE') . '</li><li>' . JText::_('USERS_DESC_MANAGE') . '</li><li>' . JText::_('USERS_DESC_IMPORT') . '</li></ul>'; $desc['list'] = '<ul><li>' . JText::_('LISTS_DESC_CREATE') . '</li><li>' . JText::_('LISTS_DESC_SUBSCRIPTION') . '</li></ul>'; $desc['newsletter'] = '<ul><li>' . JText::_('NEWSLETTERS_DESC_CREATE') . '</li><li>' . JText::_('NEWSLETTERS_DESC_TEST') . '</li><li>' . JText::_('NEWSLETTERS_DESC_SEND') . '</li></ul>'; $desc['template'] = '<ul><li>' . JText::_('TEMPLATES_DESC_CREATE') . '</li></ul>'; $desc['queue'] = '<ul><li>' . JText::_('QUEUE_DESC_CONTROL') . '</li></ul>'; $desc['cpanel'] = '<ul><li>' . JText::_('CONFIG_DESC_CONFIG') . '</li><li>' . JText::_('CONFIG_DESC_MODIFY') . '</li><li>' . JText::_('CONFIG_DESC_PLUGIN') . '</li><li>' . JText::_('QUEUE_DESC_BOUNCE'); if (!acymailing_level(3)) { $desc['cpanel'] .= acymailing_getUpgradeLink('enterprise'); } $desc['cpanel'] .= '</li></ul>'; $desc['stats'] = '<ul><li>' . JText::_('STATS_DESC_VIEW') . '</li><li>' . JText::_('STATS_DESC_CLICK'); if (!acymailing_level(1)) { $desc['stats'] .= acymailing_getUpgradeLink('essential'); } $desc['stats'] .= '</li><li>' . JText::_('STATS_DESC_CHARTS'); if (!acymailing_level(1)) { $desc['stats'] .= acymailing_getUpgradeLink('essential'); } $desc['stats'] .= '</li></ul>'; $desc['autonews'] = '<ul><li>' . JText::_('AUTONEWS_DESC'); if (!acymailing_level(2)) { $desc['autonews'] .= acymailing_getUpgradeLink('business'); } $desc['autonews'] .= '</li></ul>'; $desc['campaign'] = '<ul><li>' . JText::_('CAMPAIGN_DESC_CREATE'); if (!acymailing_level(3)) { $desc['campaign'] .= acymailing_getUpgradeLink('enterprise'); } $desc['campaign'] .= '</li><li>' . JText::_('CAMPAIGN_DESC_AFFECT'); if (!acymailing_level(3)) { $desc['campaign'] .= acymailing_getUpgradeLink('enterprise'); } $desc['campaign'] .= '</li></ul>'; $desc['update'] = '<ul><li>' . JText::_('UPDATE_DESC') . '</li><li>' . JText::_('CHANGELOG_DESC') . '</li><li>' . JText::_('ABOUT_DESC') . '</li></ul>'; $buttons[] = array('link' => 'subscriber', 'level' => 0, 'image' => 'acyusers', 'text' => JText::_('USERS'), 'acl' => 'acl_subscriber_manage'); $buttons[] = array('link' => 'list', 'level' => 0, 'image' => 'acylist', 'text' => JText::_('LISTS'), 'acl' => 'acl_lists_manage'); $buttons[] = array('link' => 'newsletter', 'level' => 0, 'image' => 'newsletter', 'text' => JText::_('NEWSLETTERS'), 'acl' => 'acl_newsletters_manage'); $buttons[] = array('link' => 'autonews', 'level' => 2, 'image' => 'autonewsletter', 'text' => JText::_('AUTONEWSLETTERS'), 'acl' => 'acl_autonewsletters_manage'); $buttons[] = array('link' => 'campaign', 'level' => 3, 'image' => 'campaign', 'text' => JText::_('CAMPAIGN'), 'acl' => 'acl_campaign_manage'); $buttons[] = array('link' => 'template', 'level' => 0, 'image' => 'acytemplate', 'text' => JText::_('ACY_TEMPLATES'), 'acl' => 'acl_templates_manage'); $buttons[] = array('link' => 'queue', 'level' => 0, 'image' => 'process', 'text' => JText::_('QUEUE'), 'acl' => 'acl_queue_manage'); $buttons[] = array('link' => 'stats', 'level' => 0, 'image' => 'stats', 'text' => JText::_('STATISTICS'), 'acl' => 'acl_statistics_manage'); $buttons[] = array('link' => 'cpanel', 'level' => 0, 'image' => 'acyconfig', 'text' => JText::_('CONFIGURATION'), 'acl' => 'acl_configuration_manage'); $buttons[] = array('link' => 'update', 'level' => 0, 'image' => 'acyupdate', 'text' => JText::_('UPDATE_ABOUT'), 'acl' => 'acl_configuration_manage'); $htmlbuttons = array(); foreach ($buttons as $oneButton) { if (acymailing_isAllowed($config->get($oneButton['acl'], 'all'))) { $htmlbuttons[] = $this->_quickiconButton($oneButton['link'], $oneButton['image'], $oneButton['text'], $desc[$oneButton['link']], $oneButton['level']); } } acymailing_setTitle(ACYMAILING_NAME, 'acymailing', 'dashboard'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Pophelp', 'dashboard'); $this->assignRef('buttons', $htmlbuttons); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $db = JFactory::getDBO(); $db->setQuery('SELECT name,email,html,confirmed,subid,created FROM ' . acymailing_table('subscriber') . ' ORDER BY created DESC LIMIT 15'); $users10 = $db->loadObjectList(); $this->assignRef('users', $users10); $db->setQuery('SELECT a.*, b.subject FROM ' . acymailing_table('stats') . ' as a LEFT JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid ORDER BY a.senddate DESC LIMIT 15'); $newsletters10 = $db->loadObjectList(); $this->assignRef('stats', $newsletters10); $doc->addScript(((empty($_SERVER['HTTPS']) or strtolower($_SERVER['HTTPS']) != "on") ? 'http://' : 'https://') . "www.google.com/jsapi"); $today = acymailing_getTime(date('Y-m-d')); $joomConfig =& JFactory::getConfig(); $diff = date('Z') + intval($joomConfig->getValue('config.offset') * 60 * 60); $db->setQuery("SELECT count(`subid`) as total, DATE_FORMAT(FROM_UNIXTIME(`created` - {$diff}),'%Y-%m-%d') as subday FROM " . acymailing_table('subscriber') . " GROUP BY subday ORDER BY subday DESC LIMIT 15"); $statsusers = $db->loadObjectList(); $this->assignRef('statsusers', $statsusers); jimport('joomla.html.pane'); $tabs =& JPane::getInstance('tabs'); $this->assignRef('tabs', $tabs); $this->assignRef('config', $config); parent::display($tpl); }
function form() { $db =& JFactory::getDBO(); $config = acymailing_config(); $filid = acymailing_getCID('filid'); $filterClass = acymailing_get('class.filter'); if (!empty($filid)) { $filter = $filterClass->get($filid); } else { $filter = null; $filter->action = JRequest::getVar('action'); $filter->filter = JRequest::getVar('filter'); $filter->published = 1; } JPluginHelper::importPlugin('acymailing'); $this->dispatcher =& JDispatcher::getInstance(); $typesFilters = array(); $typesActions = array(); $outputFilters = implode('', $this->dispatcher->trigger('onAcyDisplayFilters', array(&$typesFilters, 'massactions'))); $outputActions = implode('', $this->dispatcher->trigger('onAcyDisplayActions', array(&$typesActions))); $typevaluesFilters = array(); $typevaluesActions = array(); $typevaluesFilters[] = JHTML::_('select.option', '', JText::_('FILTER_SELECT')); $typevaluesActions[] = JHTML::_('select.option', '', JText::_('ACTION_SELECT')); $doc =& JFactory::getDocument(); foreach ($typesFilters as $oneType => $oneName) { $typevaluesFilters[] = JHTML::_('select.option', $oneType, $oneName); } foreach ($typesActions as $oneType => $oneName) { $typevaluesActions[] = JHTML::_('select.option', $oneType, $oneName); } $js = "function updateFilter(filterNum){\r\r\n\t\t\t\tcurrentFilterType =window.document.getElementById('filtertype'+filterNum).value;\r\r\n\t\t\t\tif(!currentFilterType){\r\r\n\t\t\t\t\twindow.document.getElementById('filterarea_'+filterNum).innerHTML = '';\r\r\n\t\t\t\t\tdocument.getElementById('countresult_'+filterNum).innerHTML = '';\r\r\n\t\t\t\t\treturn;\r\r\n\t\t\t\t}\r\r\n\t\t\t\tfilterArea = 'filter__num__'+currentFilterType;\r\r\n\t\t\t\twindow.document.getElementById('filterarea_'+filterNum).innerHTML = window.document.getElementById(filterArea).innerHTML.replace(/__num__/g,filterNum);\r\r\n\t\t\t}\r\n\t\t\tfunction updateAction(actionNum){\r\r\n\t\t\t\tcurrentActionType =window.document.getElementById('actiontype'+actionNum).value;\r\r\n\t\t\t\tif(!currentActionType){\r\r\n\t\t\t\t\twindow.document.getElementById('actionarea_'+actionNum).innerHTML = '';\r\r\n\t\t\t\t\treturn;\r\r\n\t\t\t\t}\r\r\n\t\t\t\tactionArea = 'action__num__'+currentActionType;\r\r\n\t\t\t\twindow.document.getElementById('actionarea_'+actionNum).innerHTML = window.document.getElementById(actionArea).innerHTML.replace(/__num__/g,actionNum);\r\r\n\t\t\t}"; $js .= "var numFilters = 0;\r\r\n\t\t\t\tvar numActions = 0;\r\r\n\t\t\t\tfunction addAcyFilter(){\r\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\r\n\t\t\t\t\tnewdiv.id = 'filter'+numFilters;\r\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\r\n\t\t\t\t\tnewdiv.innerHTML = '';\r\r\n\t\t\t\t\tif(numFilters > 0) newdiv.innerHTML += '" . JText::_('FILTER_AND') . "';\r\r\n\t\t\t\t\tnewdiv.innerHTML += document.getElementById('filters_original').innerHTML.replace(/__num__/g, numFilters);\r\r\n\t\t\t\t\tif(document.getElementById('allfilters')){\r\r\n\t\t\t\t\t\tdocument.getElementById('allfilters').appendChild(newdiv); updateFilter(numFilters); numFilters++;\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}\r\n\t\t\t\tfunction addAction(){\r\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\r\n\t\t\t\t\tnewdiv.id = 'action'+numActions;\r\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\r\n\t\t\t\t\tnewdiv.innerHTML = document.getElementById('actions_original').innerHTML.replace(/__num__/g, numActions);\r\r\n\t\t\t\t\tdocument.getElementById('allactions').appendChild(newdiv); updateAction(numActions); numActions++; }"; $js .= "window.addEvent('domready', function(){ addAcyFilter(); addAction(); });"; if (version_compare(JVERSION, '1.6.0', '<')) { $js .= 'function submitbutton(pressbutton){ if (pressbutton != \'save\') { submitform( pressbutton ); return; }'; } else { $js .= 'Joomla.submitbutton = function(pressbutton) { if (pressbutton != \'save\') { Joomla.submitform(pressbutton,document.adminForm); return; }'; } $js .= "if(window.document.getElementById('filterinfo').style.display == 'none'){\r\r\n\t\t\t\t\t\twindow.document.getElementById('filterinfo').style.display = 'block';\r\r\n\t\t\t\t\t\ttry{allspans = window.document.getElementById('toolbar-save').getElementsByTagName(\"span\"); allspans[0].className = 'icon-32-apply';}catch(err){}\r\r\n\t\t\t\t\t\treturn false;}\r\r\n\t\t\t\t\tif(window.document.getElementById('title').value.length < 2){alert('" . JText::_('ENTER_TITLE', true) . "'); return false;}"; if (version_compare(JVERSION, '1.6.0', '<')) { $js .= "submitform( pressbutton );} "; } else { $js .= "Joomla.submitform(pressbutton,document.adminForm);}; "; } $js .= "function countresults(num){\r\r\n\t\t\t\t\tdocument.getElementById('countresult_'+num).innerHTML = '<span class=\"onload\"></span>';\r\r\n\t\t\t\t\ttry{\r\r\n\t\t\t\t\t\tnew Ajax('index.php?'+\$('adminForm').toQueryString()+'&option=com_acymailing&tmpl=component&ctrl=filter&task=countresults&num='+num,{ method: 'post', update: document.getElementById('countresult_'+num)}).request();\r\r\n\t\t\t\t\t}catch(err){\r\r\n\t\t\t\t\t\tnew Request({\r\r\n\t\t\t\t\t\tmethod: 'post',\r\r\n\t\t\t\t\t\turl: 'index.php?'+\$('adminForm').toQueryString()+'&option=com_acymailing&tmpl=component&ctrl=filter&task=countresults&num='+num,\r\r\n\t\t\t\t\t\tonSuccess: function(responseText, responseXML) {\r\r\n\t\t\t\t\t\t\tdocument.getElementById('countresult_'+num).innerHTML = responseText;\r\r\n\t\t\t\t\t\t}\r\r\n\t\t\t\t\t\t}).send();\r\r\n\t\t\t\t\t}\r\r\n\t\t\t\t}"; $doc->addScriptDeclaration($js); $js = ''; $data = array('addAction' => 'action', 'addAcyFilter' => 'filter'); foreach ($data as $jsFunction => $datatype) { if (empty($filter->{$datatype})) { continue; } foreach ($filter->{$datatype}['type'] as $num => $oneType) { if (empty($oneType)) { continue; } $js .= "while(!document.getElementById('" . $datatype . "type{$num}')){" . $jsFunction . "();}\r\r\n\t\t\t\t\t\tdocument.getElementById('" . $datatype . "type{$num}').value= '{$oneType}';\r\r\n\t\t\t\t\t\tupdate" . ucfirst($datatype) . "({$num});"; if (empty($filter->{$datatype}[$num][$oneType])) { continue; } foreach ($filter->{$datatype}[$num][$oneType] as $key => $value) { $js .= "document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].value = '" . addslashes(str_replace(array("\n", "\r"), ' ', $value)) . "';"; $js .= "if(document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].type && document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].type == 'checkbox'){ document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].checked = 'checked'; }"; } if ($datatype == 'filter') { $js .= " countresults({$num});"; } } } $listid = JRequest::getInt('listid'); if (!empty($listid)) { $js .= "document.getElementById('actiontype0').value = 'list'; updateAction(0); document.adminForm.elements['action[0][list][selectedlist]'].value = '" . $listid . "';"; } $doc->addScriptDeclaration("window.addEvent('domready', function(){ {$js} });"); $triggers = array(); $triggers['daycron'] = JText::_('AUTO_CRON_FILTER'); $nextDate = $config->get('cron_plugins_next'); if (!empty($nextDate)) { $triggers['daycron'] .= ' (' . JText::_('NEXT_RUN') . ' : ' . acymailing_getDate($nextDate, '%d %B %H:%M') . ')'; } $triggers['subcreate'] = JText::_('ON_USER_CREATE'); $triggers['subchange'] = JText::_('ON_USER_CHANGE'); $this->dispatcher->trigger('onAcyDisplayTriggers', array(&$triggers)); $name = empty($filter->name) ? '' : ' : ' . $filter->name; acymailing_setTitle(JText::_('ACY_FILTER') . $name, 'filter', 'filter&task=edit&filid=' . $filid); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Confirm', JText::_('PROCESS_CONFIRMATION'), 'process', JText::_('PROCESS'), 'process', false, false); JToolBarHelper::divider(); if (acymailing_level(3)) { JToolBarHelper::save(); if (!empty($filter->filid)) { $bar->appendButton('Link', 'new', JText::_('ACY_NEW'), acymailing_completeLink('filter&task=edit&filid=0')); } } $bar->appendButton('Link', 'cancel', JText::_('ACY_CLOSE'), acymailing_completeLink('dashboard')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'filter'); $subid = JRequest::getString('subid'); if (!empty($subid)) { $subArray = explode(',', trim($subid, ',')); JArrayHelper::toInteger($subArray); $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . implode(',', $subArray) . ')'); $users = $db->loadObjectList(); if (!empty($users)) { $this->assignRef('users', $users); $this->assignRef('subid', $subid); } } $this->assignRef('typevaluesFilters', $typevaluesFilters); $this->assignRef('typevaluesActions', $typevaluesActions); $this->assignRef('outputFilters', $outputFilters); $this->assignRef('outputActions', $outputActions); $this->assignRef('filter', $filter); $this->assignRef('triggers', $triggers); $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css'); if (acymailing_level(3) and JRequest::getCmd('tmpl') != 'component') { $db->setQuery('SELECT * FROM #__acymailing_filter ORDER BY `published` DESC, `filid` DESC'); $filters = $db->loadObjectList(); $this->assignRef('toggleClass', acymailing_get('helper.toggle')); $this->assignRef('filters', $filters); } }
function display($tpl = null) { $doc = JFactory::getDocument(); $config = acymailing_config(); $buttons = array(); $desc = array(); $desc['subscriber'] = '<ul><li>' . JText::_('USERS_DESC_CREATE') . '</li><li>' . JText::_('USERS_DESC_MANAGE') . '</li><li>' . JText::_('USERS_DESC_IMPORT') . '</li></ul>'; $desc['list'] = '<ul><li>' . JText::_('LISTS_DESC_CREATE') . '</li><li>' . JText::_('LISTS_DESC_SUBSCRIPTION') . '</li></ul>'; $desc['newsletter'] = '<ul><li>' . JText::_('NEWSLETTERS_DESC_CREATE') . '</li><li>' . JText::_('NEWSLETTERS_DESC_TEST') . '</li><li>' . JText::_('NEWSLETTERS_DESC_SEND') . '</li></ul>'; $desc['template'] = '<ul><li>' . JText::_('TEMPLATES_DESC_CREATE') . '</li></ul>'; $desc['queue'] = '<ul><li>' . JText::_('QUEUE_DESC_CONTROL') . '</li></ul>'; $desc['cpanel'] = '<ul><li>' . JText::_('CONFIG_DESC_CONFIG') . '</li><li>' . JText::_('CONFIG_DESC_MODIFY') . '</li><li>' . JText::_('CONFIG_DESC_PLUGIN') . '</li><li>' . JText::_('QUEUE_DESC_BOUNCE'); if (!acymailing_level(3)) { $desc['cpanel'] .= acymailing_getUpgradeLink('enterprise'); } $desc['cpanel'] .= '</li></ul>'; $desc['stats'] = '<ul><li>' . JText::_('STATS_DESC_VIEW') . '</li><li>' . JText::_('STATS_DESC_CLICK'); if (!acymailing_level(1)) { $desc['stats'] .= acymailing_getUpgradeLink('essential'); } $desc['stats'] .= '</li><li>' . JText::_('STATS_DESC_CHARTS'); if (!acymailing_level(1)) { $desc['stats'] .= acymailing_getUpgradeLink('essential'); } $desc['stats'] .= '</li></ul>'; $desc['autonews'] = '<ul><li>' . JText::_('AUTONEWS_DESC'); if (!acymailing_level(2)) { $desc['autonews'] .= acymailing_getUpgradeLink('business'); } $desc['autonews'] .= '</li></ul>'; $desc['campaign'] = '<ul><li>' . JText::_('CAMPAIGN_DESC_CREATE'); if (!acymailing_level(3)) { $desc['campaign'] .= acymailing_getUpgradeLink('enterprise'); } $desc['campaign'] .= '</li><li>' . JText::_('CAMPAIGN_DESC_AFFECT'); if (!acymailing_level(3)) { $desc['campaign'] .= acymailing_getUpgradeLink('enterprise'); } $desc['campaign'] .= '</li></ul>'; $desc['update'] = '<ul><li>' . JText::_('UPDATE_DESC') . '</li><li>' . JText::_('CHANGELOG_DESC') . '</li><li>' . JText::_('ABOUT_DESC') . '</li></ul>'; $buttons[] = array('link' => 'subscriber', 'level' => 0, 'image' => 'acyusers', 'text' => JText::_('USERS'), 'acl' => 'acl_subscriber_manage'); $buttons[] = array('link' => 'list', 'level' => 0, 'image' => 'acylist', 'text' => JText::_('LISTS'), 'acl' => 'acl_lists_manage'); $buttons[] = array('link' => 'newsletter', 'level' => 0, 'image' => 'newsletter', 'text' => JText::_('NEWSLETTERS'), 'acl' => 'acl_newsletters_manage'); $buttons[] = array('link' => 'autonews', 'level' => 2, 'image' => 'autonewsletter', 'text' => JText::_('AUTONEWSLETTERS'), 'acl' => 'acl_autonewsletters_manage'); $buttons[] = array('link' => 'campaign', 'level' => 3, 'image' => 'campaign', 'text' => JText::_('CAMPAIGN'), 'acl' => 'acl_campaign_manage'); $buttons[] = array('link' => 'template', 'level' => 0, 'image' => 'acytemplate', 'text' => JText::_('ACY_TEMPLATES'), 'acl' => 'acl_templates_manage'); $buttons[] = array('link' => 'queue', 'level' => 0, 'image' => 'process', 'text' => JText::_('QUEUE'), 'acl' => 'acl_queue_manage'); $buttons[] = array('link' => 'stats', 'level' => 0, 'image' => 'stats', 'text' => JText::_('STATISTICS'), 'acl' => 'acl_statistics_manage'); if (!ACYMAILING_J16 || JFactory::getUser()->authorise('core.admin', 'com_acymailing')) { $buttons[] = array('link' => 'cpanel', 'level' => 0, 'image' => 'acyconfig', 'text' => JText::_('CONFIGURATION'), 'acl' => 'acl_configuration_manage'); } $buttons[] = array('link' => 'update', 'level' => 0, 'image' => 'acyupdate', 'text' => JText::_('UPDATE_ABOUT'), 'acl' => 'acl_configuration_manage'); $htmlbuttons = array(); foreach ($buttons as $oneButton) { if (acymailing_isAllowed($config->get($oneButton['acl'], 'all'))) { $htmlbuttons[] = $this->_quickiconButton($oneButton['link'], $oneButton['image'], $oneButton['text'], $desc[$oneButton['link']], $oneButton['level']); } } $geolocParam = $config->get('geolocation'); if (!empty($geolocParam) && $geolocParam != 1) { $condition = ''; if (strpos($geolocParam, 'creation') !== false) { $condition = " WHERE geolocation_type='creation'"; } $db = JFactory::getDBO(); $query = 'SELECT geolocation_type, geolocation_subid, geolocation_country_code, geolocation_city'; $query .= ' FROM #__acymailing_geolocation' . $condition . ' GROUP BY geolocation_subid ORDER BY geolocation_created DESC LIMIT 100'; $db->setQuery($query); $geoloc = $db->loadObjectList(); if (!empty($geoloc)) { $markCities = array(); $diffCountries = false; $dataDetails = array(); foreach ($geoloc as $mark) { $indexCity = array_search($mark->geolocation_city, $markCities); if ($indexCity === false) { array_push($markCities, $mark->geolocation_city); array_push($dataDetails, 1); } else { $dataDetails[$indexCity] += 1; } if (!$diffCountries) { if (!empty($region) && $region != $mark->geolocation_country_code) { $region = 'world'; $diffCountries = true; } else { $region = $mark->geolocation_country_code; } } } $this->assignRef('geoloc_city', $markCities); $this->assignRef('geoloc_details', $dataDetails); $this->assignRef('geoloc_region', $region); } } acymailing_setTitle(ACYMAILING_NAME, 'acymailing', 'dashboard'); $bar = JToolBar::getInstance('toolbar'); if (ACYMAILING_J16 && JFactory::getUser()->authorise('core.admin', 'com_acymailing')) { JToolBarHelper::preferences('com_acymailing'); } $bar->appendButton('Pophelp', 'dashboard'); $this->assignRef('buttons', $htmlbuttons); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $db = JFactory::getDBO(); $db->setQuery('SELECT name,email,html,confirmed,subid,created FROM ' . acymailing_table('subscriber') . ' ORDER BY subid DESC LIMIT 15'); $users10 = $db->loadObjectList(); $this->assignRef('users', $users10); $db->setQuery('SELECT a.*, b.subject FROM ' . acymailing_table('stats') . ' as a JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid ORDER BY a.senddate DESC LIMIT 15'); $newsletters10 = $db->loadObjectList(); $this->assignRef('stats', $newsletters10); $doc->addScript("https://www.google.com/jsapi"); $today = acymailing_getTime(date('Y-m-d')); $joomConfig = JFactory::getConfig(); $offset = ACYMAILING_J30 ? $joomConfig->get('offset') : $joomConfig->getValue('config.offset'); $diff = date('Z') + intval($offset * 60 * 60); $db->setQuery("SELECT count(`subid`) as total, DATE_FORMAT(FROM_UNIXTIME(`created` - {$diff}),'%Y-%m-%d') as subday FROM " . acymailing_table('subscriber') . " WHERE `created` > 100000 GROUP BY subday ORDER BY subday DESC LIMIT 15"); $statsusers = $db->loadObjectList(); $this->assignRef('statsusers', $statsusers); $tabs = acymailing_get('helper.acytabs'); $tabs->setOptions(array('useCookie' => true)); $this->assignRef('tabs', $tabs); $this->assignRef('config', $config); parent::display($tpl); }
function form() { $tempid = acymailing_getCID('tempid'); $app =& JFactory::getApplication(); $config = acymailing_config(); if (!empty($tempid)) { $templateClass = acymailing_get('class.template'); $template = $templateClass->get($tempid); if (!empty($template->body)) { $template->body = acymailing_absoluteURL($template->body); } } else { $template->body = ''; $template->tempid = 0; $template->published = 1; } $editor = acymailing_get('helper.editor'); $editor->setTemplate($template->tempid); $editor->name = 'editor_body'; $editor->content = $template->body; $editor->prepareDisplay(); if (version_compare(JVERSION, '1.6.0', '<')) { $script = 'function submitbutton(pressbutton){ if (pressbutton == \'cancel\') { submitform( pressbutton ); return; }'; } else { $script = 'Joomla.submitbutton = function(pressbutton) { if (pressbutton == \'cancel\') { Joomla.submitform(pressbutton,document.adminForm); return; }'; } $script .= 'if(window.document.getElementById("name").value.length < 2){alert(\'' . JText::_('ENTER_TITLE', true) . '\'); return false;}'; $script .= "if(pressbutton == 'test' && window.document.getElementById('sendtest') && window.document.getElementById('sendtest').style.display == 'none'){ window.document.getElementById('sendtest').style.display = 'block'; return false;}"; $script .= $editor->jsCode(); if (version_compare(JVERSION, '1.6.0', '<')) { $script .= 'submitform( pressbutton );} '; } else { $script .= 'Joomla.submitform(pressbutton,document.adminForm);}; '; } $script .= "function insertTag(tag){ try{jInsertEditorText(tag,'editor_body'); return true;} catch(err){alert('Your editor does not enable AcyMailing to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;}}"; $script .= 'function addStyle(){ var myTable=window.document.getElementById("classtable"); var newline = document.createElement(\'tr\'); var column = document.createElement(\'td\'); var column2 = document.createElement(\'td\'); var input = document.createElement(\'input\'); var input2 = document.createElement(\'input\'); input.type = \'text\'; input2.type = \'text\'; input.size = \'30\'; input2.size = \'50\'; input.name = \'otherstyles[classname][]\'; input2.name = \'otherstyles[style][]\'; input.value = "' . JText::_('CLASS_NAME', true) . '"; input2.value = "' . JText::_('CSS_STYLE', true) . '"; column.appendChild(input); column2.appendChild(input2); newline.appendChild(column); newline.appendChild(column2); myTable.appendChild(newline); }'; $script .= 'var currentValueId = \'\'; function showthediv(valueid,e) { if(currentValueId != valueid){ try{ document.getElementById(\'wysija\').style.left = e.pageX-50+"px"; document.getElementById(\'wysija\').style.top = e.pageY-40+"px"; }catch(err){ document.getElementById(\'wysija\').style.left = e.x-50+"px"; document.getElementById(\'wysija\').style.top = e.y-40+"px"; } currentValueId = valueid; } document.getElementById(\'wysija\').style.display = \'block\'; initDiv(); } function spanChange(span) { input = currentValueId; if (document.getElementById(span).className == span.toLowerCase()+"elementselected") { document.getElementById(span).className = span.toLowerCase()+"element"; if(span == "B"){ document.getElementById("name_"+currentValueId).style.fontWeight = ""; document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value.replace(/font-weight *: *bold(;)?/i, ""); } if(span == "I"){ document.getElementById("name_"+currentValueId).style.fontStyle = ""; document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value.replace(/font-style *: *italic(;)?/i, ""); } if(span == "U"){ document.getElementById("name_"+currentValueId).style.textDecoration=""; document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value.replace(/text-decoration *: *underline(;)?/i,""); } } else{ document.getElementById(span).className = span.toLowerCase()+"elementselected"; if(span == "B"){ document.getElementById("name_"+currentValueId).style.fontWeight = "bold"; document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value + "font-weight:bold;"; } if(span == "I"){ document.getElementById("name_"+currentValueId).style.fontStyle = "italic"; document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value + "font-style:italic;"; } if(span == "U"){ document.getElementById("name_"+currentValueId).style.textDecoration="underline"; document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value + "text-decoration:underline;"; } } } function getValueSelect() { selec = currentValueId; var myRegex2 = new RegExp(/font-size *:[^;]*;/i); var MyValue = document.getElementById("style_select_wysija").value; document.getElementById("name_"+currentValueId).style.fontSize = MyValue; if(document.getElementById("style_"+currentValueId).value.search(myRegex2) != -1){ if(MyValue == ""){ document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value.replace(myRegex2, ""); } else{ document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value.replace(myRegex2, "font-size:"+MyValue+";"); } } else{ document.getElementById("style_"+currentValueId).value = document.getElementById("style_"+currentValueId).value + "font-size:"+MyValue+";"; } } function initDiv(){ var RegexSize = new RegExp(/font-size *:[^;]*(;)?/gi); var RegexColor = new RegExp(/([^a-z-])color *:[^;]*(;)?/gi); document.getElementById("colorexamplewysijacolor").style.backgroundColor = "#000000"; document.getElementById("colordivwysijacolor").style.display = "none"; spaced = document.getElementById("style_"+currentValueId).value.substr(0,1); if(spaced != " "){ stringToQuery = \' \' + document.getElementById("style_"+currentValueId).value; } else{ stringToQuery = document.getElementById("style_"+currentValueId).value; } NewColor = stringToQuery.match(RegexColor); if(NewColor != null){ NewColor = NewColor[0].match(/:[^;!]*/gi); NewColor = NewColor[0].replace(/(:| )/gi,""); document.getElementById("colorexamplewysijacolor").style.backgroundColor = NewColor; } document.getElementById("U").className = "uelement"; document.getElementById("I").className = "ielement"; document.getElementById("B").className = "belement"; if(document.getElementById("style_"+currentValueId).value.search(/font-weight: *bold(;)?/i) != -1){ document.getElementById("B").className += "selected"; } if(document.getElementById("style_"+currentValueId).value.search(/font-style: *italic(;)?/i) != -1){ document.getElementById("I").className += "selected"; } if(document.getElementById("style_"+currentValueId).value.search(/text-decoration: *underline(;)?/i) != -1){ document.getElementById("U").className += "selected"; } NewSize = stringToQuery.match(RegexSize); document.getElementById("style_select_wysija").options[0].selected = true; if(NewSize != null){ NewSize = NewSize[0].match(/:[^;]*/gi); NewSize = NewSize[0].replace(" ",""); NewSize = NewSize.substr(1); for(var i = 0; i < document.getElementById("style_select_wysija").length; i++) { if(document.getElementById("style_select_wysija").options[i].value == NewSize){ document.getElementById("style_select_wysija").options[i].selected = true; } } } }'; $doc =& JFactory::getDocument(); $doc->addScriptDeclaration($script); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $infos = null; $infos->receiver_type = $app->getUserStateFromRequest($paramBase . ".receiver_type", 'receiver_type', '', 'string'); $infos->test_email = $app->getUserStateFromRequest($paramBase . ".test_email", 'test_email', '', 'string'); acymailing_setTitle(JText::_('ACY_TEMPLATE'), 'acytemplate', 'template&task=edit&tempid=' . $tempid); $bar =& JToolBar::getInstance('toolbar'); if (acymailing_isAllowed($config->get('acl_tags_view', 'all'))) { $bar->appendButton('Acytags'); } JToolBarHelper::divider(); JToolBarHelper::custom('test', 'send', '', JText::_('SEND_TEST'), false); JToolBarHelper::spacer(); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'template-form'); $this->assignRef('editor', $editor); $receiverClass = acymailing_get('type.testreceiver'); $this->assignRef('receiverClass', $receiverClass); $this->assignRef('template', $template); $colorBox = acymailing_get('type.color'); $this->assignRef('colorBox', $colorBox); $this->assignRef('infos', $infos); jimport('joomla.html.pane'); $tabs =& JPane::getInstance('tabs'); $this->assignRef('tabs', $tabs); }
function listing(){ $app = JFactory::getApplication(); $config = acymailing_config(); JHTML::_('behavior.modal','a.modal'); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->elements = new stdClass(); $paramBase = ACYMAILING_COMPONENT.'.'.$this->getName().$this->getLayout(); $pageInfo->filter->order->value = $app->getUserStateFromRequest( $paramBase.".filter_order", 'filter_order', '','cmd' ); $pageInfo->filter->order->dir = $app->getUserStateFromRequest( $paramBase.".filter_order_Dir", 'filter_order_Dir', 'desc', 'word' ); if(strtolower($pageInfo->filter->order->dir) !== 'desc') $pageInfo->filter->order->dir = 'asc'; $pageInfo->search = $app->getUserStateFromRequest( $paramBase.".search", 'search', '', 'string' ); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $selectedMail = $app->getUserStateFromRequest( $paramBase."filter_mail",'filter_mail',0,'int'); $selectedUrl = $app->getUserStateFromRequest( $paramBase."filter_url",'filter_url',0,'int'); $pageInfo->limit->value = $app->getUserStateFromRequest( $paramBase.'.list_limit', 'limit', $app->getCfg('list_limit'), 'int' ); $pageInfo->limit->start = $app->getUserStateFromRequest( $paramBase.'.limitstart', 'limitstart', 0, 'int' ); $database = JFactory::getDBO(); $filters = array(); if(!empty($pageInfo->search)){ $searchVal = '\'%'.acymailing_getEscaped($pageInfo->search,true).'%\''; $filters[] = implode(" LIKE $searchVal OR ",$this->searchFields)." LIKE $searchVal"; } if(!empty($selectedMail)) $filters[] = 'a.mailid = '.$selectedMail; if(!empty($selectedUrl)) $filters[] = 'a.urlid = '.$selectedUrl; $query = 'SELECT SQL_CALC_FOUND_ROWS '.implode(' , ',$this->selectFields); $query .= ' FROM '.acymailing_table('urlclick').' as a'; $query .= ' JOIN '.acymailing_table('mail').' as b on a.mailid = b.mailid'; $query .= ' JOIN '.acymailing_table('url').' as c on a.urlid = c.urlid'; if(!empty($filters)) $query .= ' WHERE ('.implode(') AND (',$filters).')'; $query .= ' GROUP BY a.mailid,a.urlid'; if(!empty($pageInfo->filter->order->value)){ $query .= ' ORDER BY '.$pageInfo->filter->order->value.' '.$pageInfo->filter->order->dir; } $database->setQuery($query,$pageInfo->limit->start,$pageInfo->limit->value); $rows = $database->loadObjectList(); $database->setQuery('SELECT FOUND_ROWS()'); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); jimport('joomla.html.pagination'); $pagination = new JPagination( $pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value ); $filtersType = new stdClass(); $mailType = acymailing_get('type.urlmail'); $urlType = acymailing_get('type.url'); $filtersType->mail = $mailType->display('filter_mail',$selectedMail); $filtersType->url = $urlType->display('filter_url',$selectedUrl); acymailing_setTitle(JText::_('CLICK_STATISTICS'),'stats','statsurl'); $bar = JToolBar::getInstance('toolbar'); $bar->appendButton( 'Link', 'cancel', JText::_('GLOBAL_STATISTICS'), acymailing_completeLink('stats') ); JToolBarHelper::divider(); $bar->appendButton( 'Pophelp','statsurl-listing'); if(acymailing_isAllowed($config->get('acl_cpanel_manage','all'))) $bar->appendButton( 'Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard') ); $this->assignRef('filters',$filtersType); $this->assignRef('rows',$rows); $this->assignRef('pageInfo',$pageInfo); $this->assignRef('pagination',$pagination); }
function form() { $listid = acymailing_getCID('listid'); $listClass = acymailing_get('class.list'); if (!empty($listid)) { $list = $listClass->get($listid); if (empty($list->listid)) { acymailing_display('List ' . $listid . ' not found', 'error'); $listid = 0; } } if (empty($listid)) { $list = new stdClass(); $list->visible = 1; $list->description = ''; $list->category = ''; $list->published = 1; $user = JFactory::getUser(); $list->creatorname = $user->name; $list->access_manage = 'none'; $list->access_sub = 'all'; $list->languages = 'all'; $colors = array('#3366ff', '#7240A4', '#7A157D', '#157D69', '#ECE649'); $list->color = $colors[rand(0, count($colors) - 1)]; } $editor = acymailing_get('helper.editor'); $editor->name = 'editor_description'; $editor->content = $list->description; $editor->setDescription(); if (!ACYMAILING_J16) { $script = 'function submitbutton(pressbutton){ if (pressbutton == \'cancel\') { submitform( pressbutton ); return; }'; } else { $script = 'Joomla.submitbutton = function(pressbutton) { if (pressbutton == \'cancel\') { Joomla.submitform(pressbutton,document.adminForm); return; }'; } $script .= 'if(window.document.getElementById("name").value.length < 2){alert(\'' . JText::_('ENTER_TITLE', true) . '\'); return false;}'; $script .= $editor->jsCode(); if (!ACYMAILING_J16) { $script .= 'submitform( pressbutton );}'; } else { $script .= 'Joomla.submitform(pressbutton,document.adminForm);}; '; } $script .= 'function affectUser(idcreator,name,email){ window.document.getElementById("creatorname").innerHTML = name; window.document.getElementById("listcreator").value = idcreator; }'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($script); $colorBox = acymailing_get('type.color'); acymailing_setTitle(JText::_('LIST'), 'acylist', 'list&task=edit&listid=' . $listid); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'list-form'); $this->assignRef('colorBox', $colorBox); if (acymailing_level(1)) { $this->assign('welcomeMsg', acymailing_get('type.welcome')); $this->assign('languages', acymailing_get('type.listslanguages')); } $unsubMsg = acymailing_get('type.unsub'); $this->assignRef('unsubMsg', $unsubMsg); $this->assignRef('list', $list); $this->assignRef('editor', $editor); }
function export() { $listClass = acymailing_get('class.list'); $db = JFactory::getDBO(); $fields = acymailing_getColumns('#__acymailing_subscriber'); $fieldsList = array(); $fieldsList['listid'] = 'smallint unsigned'; $fieldsList['listname'] = 'varchar'; $config = acymailing_config(); $selectedFields = explode(',', $config->get('export_fields', 'email,name')); $selectedLists = explode(',', $config->get('export_lists')); $selectedFilters = explode(',', $config->get('export_filters', 'subscribed')); $app = JFactory::getApplication(); if ($app->isAdmin()) { acymailing_setTitle(JText::_('ACY_EXPORT'), 'acyexport', 'data&task=export'); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('doexport', 'acyexport', '', JText::_('ACY_EXPORT'), false); $bar->appendButton('Link', 'cancel', JText::_('ACY_CANCEL'), acymailing_completeLink('subscriber')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'data-export'); } $charsetType = acymailing_get('type.charset'); $this->assignRef('charset', $charsetType); if ($app->isAdmin()) { $lists = $listClass->getLists(); } else { $lists = $listClass->getFrontendLists(); } $this->assignRef('lists', $lists); $this->assignRef('fields', $fields); $this->assignRef('fieldsList', $fieldsList); $this->assignRef('selectedfields', $selectedFields); $this->assignRef('selectedlists', $selectedLists); $this->assignRef('selectedFilters', $selectedFilters); $this->assignRef('config', $config); $whereSubscribers = ''; if (JRequest::getInt('sessionvalues')) { if (!empty($_SESSION['acymailing']['exportusers'])) { $i = 1; $subids = array(); foreach ($_SESSION['acymailing']['exportusers'] as $subid) { $subids[] = (int) $subid; $i++; if ($i > 10) { break; } } if (!empty($subids)) { $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . implode(',', $subids) . ') LIMIT 10'); $users = $db->loadObjectList(); $this->assignRef('users', $users); } } elseif (!empty($_SESSION['acymailing']['exportlist'])) { $filterList = $_SESSION['acymailing']['exportlist']; $this->assignRef('exportlist', $filterList); } } if (JRequest::getInt('sessionquery')) { $currentSession = JFactory::getSession(); $exportQuery = $currentSession->get('acyexportquery'); if (!empty($exportQuery)) { $db->setQuery('SELECT s.`name`,s.`email` ' . $exportQuery . ' LIMIT 10'); $users = $db->loadObjectList(); $this->assignRef('users', $users); if (strpos($exportQuery, 'userstats')) { $otherFields = array('userstats.senddate', 'userstats.open', 'userstats.opendate', 'userstats.bounce', 'userstats.ip', 'userstats.html', 'userstats.fail', 'userstats.sent'); $this->assignRef('otherfields', $otherFields); } if (strpos($exportQuery, 'urlclick')) { $otherFields = array('url.name', 'url.url', 'urlclick.date', 'urlclick.ip', 'urlclick.click'); $this->assignRef('otherfields', $otherFields); } if (strpos($exportQuery, 'history')) { $otherFields = array('hist.data', 'hist.date'); $this->assignRef('otherfields', $otherFields); } } } if (acymailing_level(3)) { $geolocFields = acymailing_getColumns('#__acymailing_geolocation'); $this->assign('geolocfields', $geolocFields); } }
function listing() { JHTML::_('behavior.modal', 'a.modal'); $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->elements = new stdClass(); $config = acymailing_config(); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word'); $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $selectedMail = $app->getUserStateFromRequest($paramBase . "filter_mail", 'filter_mail', 0, 'int'); $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int'); $database = JFactory::getDBO(); $filters = array(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}"; } if (!empty($selectedMail)) { $filters[] = 'a.mailid = ' . intval($selectedMail); } $query = 'SELECT ' . implode(' , ', $this->selectFields); $query .= ' FROM ' . acymailing_table('queue') . ' as a'; $query .= ' JOIN ' . acymailing_table('subscriber') . ' as b on a.subid = b.subid'; $query .= ' JOIN ' . acymailing_table('mail') . ' as c on a.mailid = c.mailid'; if (!empty($filters)) { $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; } if (!empty($pageInfo->filter->order->value)) { $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir . ', a.`subid` ASC'; } if (empty($pageInfo->limit->value)) { $pageInfo->limit->value = 100; } $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); $pageInfo->elements->page = count($rows); if ($pageInfo->limit->value > $pageInfo->elements->page) { $pageInfo->elements->total = $pageInfo->limit->start + $pageInfo->elements->page; } else { $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('queue') . ' as a'; if (!empty($pageInfo->search)) { $queryCount .= ' JOIN ' . acymailing_table('subscriber') . ' as b on a.subid = b.subid'; $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as c on a.mailid = c.mailid'; } if (!empty($filters)) { $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')'; } $database->setQuery($queryCount); $pageInfo->elements->total = $database->loadResult(); } jimport('joomla.html.pagination'); $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value); $mailqueuetype = acymailing_get('type.queuemail'); $filtersType = new stdClass(); $filtersType->mail = $mailqueuetype->display('filter_mail', $selectedMail); acymailing_setTitle(JText::_('QUEUE'), 'process', 'queue'); $bar = JToolBar::getInstance('toolbar'); if (acymailing_isAllowed($config->get('acl_queue_process', 'all'))) { $bar->appendButton('Acypopup', 'process', JText::_('PROCESS'), "index.php?option=com_acymailing&ctrl=queue&task=process&tmpl=component&mailid=" . $selectedMail); } if (!empty($pageInfo->elements->total) and acymailing_isAllowed($config->get('acl_queue_delete', 'all'))) { JToolBarHelper::spacer(); JToolBarHelper::spacer(); $bar->appendButton('Confirm', JText::sprintf('CONFIRM_DELETE_QUEUE', $pageInfo->elements->total), 'delete', JText::_('ACY_DELETE'), 'remove', false, false); } JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'queue-listing'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('filters', $filtersType); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); }
function display($tpl = null) { JHTML::_('behavior.modal', 'a.modal'); $toggleClass = acymailing_get('helper.toggle'); $config = acymailing_config(); $db = JFactory::getDBO(); $doc = JFactory::getDocument(); $app = JFactory::getApplication(); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $lg = JFactory::getLanguage(); $language = $lg->getTag(); $styleRemind = 'float:right;margin-right:30px;position:relative;'; $loadLink = '<a onclick="window.document.getElementById(\'acymailing_messages_warning\').style.display = \'none\';return true;" class="modal" rel="{handler: \'iframe\', size:{x:800, y:500}}" href="index.php?option=com_acymailing&tmpl=component&ctrl=file&task=latest&code=' . $language . '">' . JText::_('LOAD_LATEST_LANGUAGE') . '</a>'; if (!file_exists(ACYMAILING_ROOT . 'language' . DS . $language . DS . $language . '.com_acymailing.ini')) { if ($config->get('errorlanguagemissing', 1)) { $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguagemissing_0', 'config', false, JText::_('DONT_REMIND')) . '</small>'; acymailing_display(JText::_('MISSING_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning'); } } elseif (version_compare(JText::_('ACY_LANG_VERSION'), $config->get('version'), '<')) { if ($config->get('errorlanguageupdate', 1)) { $notremind = '<small style="' . $styleRemind . '">' . $toggleClass->delete('acymailing_messages_warning', 'errorlanguageupdate_0', 'config', false, JText::_('DONT_REMIND')) . '</small>'; acymailing_display(JText::_('UPDATE_LANGUAGE') . ' ' . $loadLink . ' ' . $notremind, 'warning'); } } $indexes = array('listsub', 'stats', 'list', 'mail', 'userstats', 'urlclick', 'history', 'template', 'queue', 'subscriber'); $addIndexes = array('We recenty optimized our database...'); foreach ($indexes as $oneTable) { if ($config->get('optimize_' . $oneTable, 1)) { continue; } $addIndexes[] = 'Please ' . $toggleClass->toggleText('addindex', $oneTable, 'config', 'click here') . ' to add indexes on the ' . $oneTable . ' table'; } if (count($addIndexes) > 1) { acymailing_display($addIndexes, 'warning'); } acymailing_setTitle(JText::_('CONFIGURATION'), 'acyconfig', 'cpanel'); $bar = JToolBar::getInstance('toolbar'); JToolBarHelper::custom('test', 'acysend', '', JText::_('SEND_TEST'), false); JToolBarHelper::divider(); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel('cancel', JText::_('ACY_CLOSE')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'config'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } $elements = new stdClass(); $elements->add_names = JHTML::_('acyselect.booleanlist', "config[add_names]", '', $config->get('add_names', true)); $elements->embed_images = JHTML::_('acyselect.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0)); $elements->embed_files = JHTML::_('acyselect.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1)); $elements->multiple_part = JHTML::_('acyselect.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0)); $mailerMethods = array('smtp_com', 'elasticemail', 'smtp', 'sendmail'); $js = "function updateMailer(mailermethod){" . "\n"; foreach ($mailerMethods as $oneMethod) { $js .= " window.document.getElementById('" . $oneMethod . "_config').style.display = 'none'; " . "\n"; } $js .= "if(window.document.getElementById(mailermethod+'_config')) {window.document.getElementById(mailermethod+'_config').style.display = 'block';} }"; $js .= 'window.addEvent(\'domready\', function(){ updateMailer(\'' . $config->get('mailer_method', 'phpmail') . '\'); });'; $doc->addScriptDeclaration($js); $encodingval = array(); $encodingval[] = JHTML::_('select.option', 'binary', 'Binary'); $encodingval[] = JHTML::_('select.option', 'quoted-printable', 'Quoted-printable'); $encodingval[] = JHTML::_('select.option', '7bit', '7 Bit'); $encodingval[] = JHTML::_('select.option', '8bit', '8 Bit'); $encodingval[] = JHTML::_('select.option', 'base64', 'Base 64'); $elements->encoding_format = JHTML::_('select.genericlist', $encodingval, "config[encoding_format]", 'size="1"', 'value', 'text', $config->get('encoding_format', 'base64')); $charset = acymailing_get('type.charset'); $elements->charset = $charset->display("config[charset]", $config->get('charset', 'UTF-8')); $securedVals = array(); $securedVals[] = JHTML::_('select.option', '', '- - -'); $securedVals[] = JHTML::_('select.option', 'ssl', 'SSL'); $securedVals[] = JHTML::_('select.option', 'tls', 'TLS'); $elements->smtp_secured = JHTML::_('select.genericlist', $securedVals, "config[smtp_secured]", 'size="1"', 'value', 'text', $config->get('smtp_secured')); $elements->smtp_auth = JHTML::_('acyselect.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0)); $elements->smtp_keepalive = JHTML::_('acyselect.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1)); $elements->allow_visitor = JHTML::_('acyselect.booleanlist', "config[allow_visitor]", '', $config->get('allow_visitor', 1)); $editorType = acymailing_get('type.editor'); $elements->editor = $editorType->display('config[editor]', $config->get('editor')); $elements->subscription_message = JHTML::_('acyselect.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1)); $elements->confirmation_message = JHTML::_('acyselect.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1)); $elements->unsubscription_message = JHTML::_('acyselect.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1)); $elements->welcome_message = JHTML::_('acyselect.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1)); $elements->unsub_message = JHTML::_('acyselect.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1)); $elements->confirm_message = JHTML::_('acyselect.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0)); $elements->show_footer = JHTML::_('acyselect.booleanlist', "config[show_footer]", '', $config->get('show_footer', 1)); if (acymailing_level(1)) { $elements->forward = JHTML::_('acyselect.booleanlist', "config[forward]", '', $config->get('forward', false)); } else { $elements->forward = acymailing_getUpgradeLink('essential'); } if (acymailing_level(1)) { $js = "function updateDKIM(dkimval){if(dkimval == 1){document.getElementById('dkim_config').style.display = 'block';}else{document.getElementById('dkim_config').style.display = 'none';}}\r\n\t\t\t\t\twindow.addEvent('load', function(){ updateDKIM(" . $config->get('dkim', 0) . ");});"; $doc->addScriptDeclaration($js); if (function_exists('openssl_sign')) { $elements->dkim = JHTML::_('acyselect.booleanlist', "config[dkim]", 'onclick="updateDKIM(this.value)"', $config->get('dkim', 0)); } else { $elements->dkim = '<input type="hidden" name="config[dkim]" value="0" />PHP Extension openssl not enabled'; } $js = "function updateQueueProcess(newvalue){"; $js .= "if(newvalue == 'onlyauto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = 'none';}"; $js .= "if(newvalue == 'auto') {window.document.getElementById('method_auto').style.display = ''; window.document.getElementById('method_manual').style.display = '';}"; $js .= "if(newvalue == 'manual') {window.document.getElementById('method_auto').style.display = 'none'; window.document.getElementById('method_manual').style.display = '';}"; $js .= '}'; $js .= 'window.addEvent(\'domready\', function(){ updateQueueProcess(\'' . $config->get('queue_type', 'auto') . '\'); });'; $doc->addScriptDeclaration($js); $queueType = array(); $queueType[] = JHTML::_('select.option', 'onlyauto', JText::_('AUTO_ONLY')); $queueType[] = JHTML::_('select.option', 'auto', JText::_('AUTO_MAN')); $queueType[] = JHTML::_('select.option', 'manual', JText::_('MANUAL_ONLY')); $elements->queue_type = JHTML::_('acyselect.radiolist', $queueType, "config[queue_type]", 'onclick="updateQueueProcess(this.value);"', 'value', 'text', $config->get('queue_type', 'auto')); } else { $elements->dkim = acymailing_getUpgradeLink('essential'); } $delayTypeManual = acymailing_get('type.delay'); $elements->queue_pause = $delayTypeManual->display('config[queue_pause]', $config->get('queue_pause'), 0); $delayTypeAuto = acymailing_get('type.delay'); $elements->cron_frequency = $delayTypeAuto->display('config[cron_frequency]', $config->get('cron_frequency'), 2); $cssval = array('css_frontend' => 'component', 'css_module' => 'module', 'css_backend' => 'component'); foreach ($cssval as $configval => $type) { $myvals = array(); $myvals[] = JHTML::_('select.option', '', JText::_('ACY_NONE')); $regex = '^' . $type . '_([-_a-z0-9]*)\\.css$'; $allCSSFiles = JFolder::files(ACYMAILING_MEDIA . 'css', $regex); $family = ''; foreach ($allCSSFiles as $oneFile) { preg_match('#' . $regex . '#i', $oneFile, $results); $fileName = str_replace('default_', '', $results[1]); $fileNameArray = explode('_', $fileName); if (count($fileNameArray) == 2) { if ($fileNameArray[0] != $family) { if (!empty($family)) { $myvals[] = JHTML::_('select.option', '</OPTGROUP>'); } $family = $fileNameArray[0]; $myvals[] = JHTML::_('select.option', '<OPTGROUP>', ucfirst($family)); } unset($fileNameArray[0]); $fileName = implode('_', $fileNameArray); } $fileName = ucwords(str_replace('_', ' ', $fileName)); $myvals[] = JHTML::_('select.option', $results[1], $fileName); } if (!empty($family)) { $myvals[] = JHTML::_('select.option', '</OPTGROUP>'); } $js = 'onchange="updateCSSLink(\'' . $configval . '\',\'' . $type . '\',this.value);"'; $currentVal = $config->get($configval, 'default'); $aStyle = empty($currentVal) ? 'style="display:none"' : ''; $elements->{$configval} = JHTML::_('select.genericlist', $myvals, 'config[' . $configval . ']', 'class="inputbox" size="1" ' . $js, 'value', 'text', $config->get($configval, 'default'), $configval . '_choice'); $linkEdit = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=css&file=' . $type . '_' . $config->get($configval, 'default') . '&var=' . $configval; $elements->{$configval} .= ' <a id="' . $configval . '_link" ' . $aStyle . ' class="modal" title="' . JText::_('ACY_EDIT', true) . '" href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('ACY_EDIT', true) . '"/></a>'; } $js = "function updateCSSLink(myid,type,newval){\r\n\t\t\tif(newval){document.getElementById(myid+'_link').style.display = '';}else{document.getElementById(myid+'_link').style.display = 'none'}\r\n\t\t\tdocument.getElementById(myid+'_link').href = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=css&file='+type+'_'+newval+'&var='+myid;\r\n\t\t}"; $doc->addScriptDeclaration($js); $elements->colortype = acymailing_get('type.color'); $elements->use_sef = JHTML::_('acyselect.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0)); if (!ACYMAILING_J16) { $query = 'SELECT a.name, a.id as itemid, b.title FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC'; } else { $orderby = ACYMAILING_J30 ? 'a.lft' : 'a.ordering'; $query = 'SELECT a.alias as name, a.id as itemid, b.title FROM `#__menu` as a JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.client_id=0 AND a.parent_id != 0 ORDER BY b.title ASC,' . $orderby . ' ASC'; } $db->setQuery($query); $joomMenus = $db->loadObjectList(); $menuvalues = array(); $menuvalues[] = JHTML::_('select.option', '0', JText::_('ACY_NONE')); $lastGroup = ''; foreach ($joomMenus as $oneMenu) { if ($oneMenu->title != $lastGroup) { if (!empty($lastGroup)) { $menuvalues[] = JHTML::_('select.option', '</OPTGROUP>'); } $menuvalues[] = JHTML::_('select.option', '<OPTGROUP>', $oneMenu->title); $lastGroup = $oneMenu->title; } $menuvalues[] = JHTML::_('select.option', $oneMenu->itemid, $oneMenu->name); } $elements->acymailing_menu = JHTML::_('select.genericlist', $menuvalues, 'config[itemid]', 'size="1"', 'value', 'text', $config->get('itemid')); $menupositions = array(); $menupositions[] = JHTML::_('select.option', 'under', JText::_('UNDER_TITLE')); $menupositions[] = JHTML::_('select.option', 'above', JText::_('ABOVE_MAIN_AREA')); $elements->menu_position = JHTML::_('acyselect.radiolist', $menupositions, 'config[menu_position]', 'size="1"', 'value', 'text', $config->get('menu_position', 'under')); if (ACYMAILING_J30) { $elements->menu_position = '<input type="hidden" name="config[menu_position]" value="above" />' . JText::_('ABOVE_MAIN_AREA'); } $acyrss_format = array(); $acyrss_format[] = JHTML::_('select.option', '', JText::_('ACY_NONE')); $acyrss_format[] = JHTML::_('select.option', 'rss', 'RSS feed'); $acyrss_format[] = JHTML::_('select.option', 'atom', 'Atom feed'); $acyrss_format[] = JHTML::_('select.option', 'both', JText::_('ACY_ALL')); $elements->acyrss_format = JHTML::_('select.genericlist', $acyrss_format, "config[acyrss_format]", 'size="1"', 'value', 'text', $config->get('acyrss_format', '')); $acyrss_order = array(); $acyrss_order[] = JHTML::_('select.option', 'senddate', JText::_('SEND_DATE')); $acyrss_order[] = JHTML::_('select.option', 'mailid', JText::_('ACY_ID')); $acyrss_order[] = JHTML::_('select.option', 'subject', JText::_('ACY_TITLE')); $elements->acyrss_order = JHTML::_('select.genericlist', $acyrss_order, "config[acyrss_order]", 'size="1"', 'value', 'text', $config->get('acyrss_order', 'senddate')); $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=confirmation'; $elements->editConfEmail = '<a class="modal" id="confirmemail" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_CONF_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_created'; $elements->edit_notification_created = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_refuse'; $elements->edit_notification_refuse = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_unsuball'; $elements->edit_notification_unsuball = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=notification_unsub'; $elements->edit_notification_unsub = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=modif'; $elements->editModifEmail = '<a class="modal" id="modifemail" href="' . $link . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><button class="btn" onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $js = "function addUnsubReason(){\r\n\t\t\tvar input = document.createElement('input');\r\n\t\t\tinput.name = 'unsub_reasons[]';\r\n\t\t\tinput.style.width = '300px';\r\n\t\t\tinput.type = 'text';\r\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(input);\r\n\t\t\tvar br = document.createElement('br');\r\n\t\t\tdocument.getElementById('unsub_reasons').appendChild(br);\r\n\t\t}\r\n\t\tfunction displaySurvey(surveyval){\r\n\t\t\tif(surveyval == 1){\r\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'block';\r\n\t\t\t}else{\r\n\t\t\t\tdocument.getElementById('unsub_reasons_area').style.display = 'none';\r\n\t\t\t}\r\n\t\t}\r\n\t\t"; $doc->addScriptDeclaration($js); $path = JLanguage::getLanguagePath(JPATH_ROOT); $dirs = JFolder::folders($path); $languages = array(); foreach ($dirs as $dir) { if (strlen($dir) != 5 || $dir == "xx-XX") { continue; } $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$'); $xmlFile = reset($xmlFiles); if (empty($xmlFile)) { $data = array(); } else { $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile); } $oneLanguage = new stdClass(); $oneLanguage->language = $dir; $oneLanguage->name = empty($data['name']) ? $dir : $data['name']; $languageFiles = JFolder::files($path . DS . $dir, '^(.*)\\.com_acymailing\\.ini$'); $languageFile = reset($languageFiles); if (!empty($languageFile)) { $linkEdit = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=language&code=' . $oneLanguage->language; $oneLanguage->edit = ' <a class="modal" title="' . JText::_('EDIT_LANGUAGE_FILE', true) . '" href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-edit.png" alt="' . JText::_('EDIT_LANGUAGE_FILE', true) . '"/></a>'; } else { $linkEdit = 'index.php?option=com_acymailing&tmpl=component&ctrl=file&task=language&code=' . $oneLanguage->language; $oneLanguage->edit = ' <a class="modal" title="' . JText::_('ADD_LANGUAGE_FILE', true) . '" href="' . $linkEdit . '" rel="{handler: \'iframe\', size:{x:800, y:500}}"><img id="image' . $oneLanguage->language . '" class="icon16" src="' . ACYMAILING_IMAGES . 'icons/icon-16-add.png" alt="' . JText::_('ADD_LANGUAGE_FILE', true) . '"/></a>'; } $languages[] = $oneLanguage; } $js = "function updateConfirmation(newvalue){"; $js .= "if(newvalue == 0) {window.document.getElementById('confirmemail').style.display = 'none'; window.document.getElementById('confirm_redirect').disabled = true;}else{window.document.getElementById('confirmemail').style.display = 'inline'; window.document.getElementById('confirm_redirect').disabled = false;}"; $js .= '}'; $js .= "function updateModification(newvalue){ if(newvalue != 'none') {window.document.getElementById('modifemail').style.display = 'none';}else{window.document.getElementById('modifemail').style.display = 'inline';}} "; $js .= 'window.addEvent(\'load\', function(){ updateModification(\'' . $config->get('allow_modif', 'data') . '\'); updateConfirmation(' . $config->get('require_confirmation', 0) . '); });'; $doc->addScriptDeclaration($js); $elements->require_confirmation = JHTML::_('acyselect.booleanlist', "config[require_confirmation]", 'onclick="updateConfirmation(this.value)"', $config->get('require_confirmation', 0)); $allowmodif = array(); $allowmodif[] = JHTML::_('select.option', "none", JText::_('JOOMEXT_NO')); $allowmodif[] = JHTML::_('select.option', "data", JText::_('ONLY_SUBSCRIPTION')); $allowmodif[] = JHTML::_('select.option', "all", JText::_('JOOMEXT_YES')); $elements->allow_modif = JHTML::_('acyselect.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data')); if (!ACYMAILING_J16) { $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE `folder` = 'acymailing' AND `element` NOT LIKE 'plg%' ORDER BY published DESC, ordering ASC"); } else { $db->setQuery("SELECT name,enabled as published,extension_id as id FROM `#__extensions` WHERE `folder` = 'acymailing' AND `type`= 'plugin' AND `element` NOT LIKE 'plg%' ORDER BY enabled DESC, ordering ASC"); } $plugins = $db->loadObjectList(); if (!ACYMAILING_J16) { $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY published DESC, ordering ASC"); } else { $db->setQuery("SELECT name,enabled as published ,extension_id as id FROM `#__extensions` WHERE (`folder` != 'acymailing' OR `element` LIKE 'plg%') AND `type` = 'plugin' AND (`name` LIKE '%acymailing%' OR `element` LIKE '%acymailing%') ORDER BY enabled DESC, ordering ASC"); } $integrationplugins = $db->loadObjectList(); $bounceaction = acymailing_get('type.bounceaction'); $this->assignRef('bounceaction', $bounceaction); $this->assignRef('config', $config); $this->assignRef('languages', $languages); $this->assignRef('elements', $elements); $this->assignRef('plugins', $plugins); $this->assignRef('integrationplugins', $integrationplugins); $tabs = acymailing_get('helper.acytabs'); $tabs->setOptions(array('useCookie' => true)); $this->assignRef('tabs', $tabs); $this->assignRef('toggleClass', $toggleClass); if (!ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php') or ACYMAILING_J16 and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber' . DS . 'tagsubscriber.php')) { acymailing_display(JText::sprintf('ERROR_PLUGINS', 'href="index.php?option=com_acymailing&ctrl=update&task=install"'), 'warning'); } return parent::display($tpl); }