function export() { $listClass = acymailing::get('class.list'); $db =& JFactory::getDBO(); $fields = reset($db->getTableFields(acymailing::table('subscriber'))); 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'); $this->assignRef('charset', $charsetType = acymailing::get('type.charset')); $this->assignRef('lists', $listClass->getLists()); $this->assignRef('fields', $fields); 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; } } $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . implode(',', $subids) . ')'); $users = $db->loadObjectList(); $this->assignRef('users', $users); } }
function update() { acymailing::setTitle(JText::_('UPDATE_ABOUT'), 'install', 'update'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'back', JText::_('BACK'), acymailing::completeLink('dashboard')); return $this->_iframe(ACYMAILING_UPDATEURL . 'update'); }
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'), 'install', 'update'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'back', JText::_('ACY_CLOSE'), acymailing::completeLink('dashboard')); return $this->_iframe(ACYMAILING_UPDATEURL . 'update'); }
function listing() { $db =& JFactory::getDBO(); $db->setQuery('SELECT * FROM `#__acymailing_fields` ORDER BY `ordering` ASC'); $rows = $db->loadObjectList(); $bar =& JToolBar::getInstance('toolbar'); JToolBarHelper::addNew(); JToolBarHelper::editList(); JToolBarHelper::deleteList(JText::_('VALIDDELETEITEMS')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'fields-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); jimport('joomla.html.pagination'); $total = count($rows); $pagination = new JPagination($total, 0, $total); acymailing::setTitle(JText::_('EXTRA_FIELDS'), 'fields', 'fields'); $this->assignRef('rows', $rows); $this->assignRef('toggleClass', acymailing::get('helper.toggle')); $this->assignRef('pagination', $pagination); $this->assignRef('fieldtype', acymailing::get('type.fields')); $this->assignRef('fieldsClass', acymailing::get('class.fields')); }
function listing() { $app =& JFactory::getApplication(); $pageInfo = null; 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 SQL_CALC_FOUND_ROWS ' . implode(' , ', $this->selectFields); $query .= ' FROM ' . acymailing::table('stats') . ' as a'; $query .= ' LEFT 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(); $database->setQuery('SELECT FOUND_ROWS()'); $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(); JToolBarHelper::deleteList(JText::_('VALIDDELETEITEMS')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'stats-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); }
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); }'; $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); $this->assignRef('receiverClass', acymailing::get('type.testreceiver')); $this->assignRef('template', $template); $this->assignRef('colorBox', acymailing::get('type.color')); $this->assignRef('infos', $infos); jimport('joomla.html.pane'); $tabs =& JPane::getInstance('tabs'); $this->assignRef('tabs', $tabs); }
function preview() { $app =& JFactory::getApplication(); $mailid = acymailing::getCID('mailid'); $mailerHelper = acymailing::get('helper.mailer'); $mail = $mailerHelper->load($mailid); $user =& JFactory::getUser(); $userClass = acymailing::get('class.subscriber'); $receiver = $userClass->get($user->email); $mail->sendHTML = true; $mailerHelper->dispatcher->trigger('acymailing_replaceusertagspreview', array(&$mail, &$receiver)); 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 = null; $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::_('PREVIEW') . ' : ' . $mail->subject, $this->icon, $this->ctrl . '&task=preview&mailid=' . $mailid); $bar =& JToolBar::getInstance('toolbar'); if ($this->type == 'news') { if (acymailing::level(1)) { if ($mail->published == 2) { JToolBarHelper::custom('unschedule', 'unschedule', '', JText::_('UNSCHEDULE'), false); } else { $bar->appendButton('Popsched', acymailing::completeLink("send&task=scheduleready&mailid=" . $mailid, true)); } } $bar->appendButton('Popup', 'send', JText::_('SEND'), acymailing::completeLink("send&task=sendready&mailid=" . $mailid, true)); JToolBarHelper::divider(); } JToolBarHelper::custom(JText::_('EDIT'), 'edit', '', JText::_('EDIT'), false); JToolBarHelper::cancel('cancel', JText::_('CLOSE')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', $this->ctrl . '-preview'); $this->assignRef('lists', $lists); $this->assignRef('infos', $infos); $this->assignRef('receiverClass', $receiversClass); $this->assignRef('mail', $mail); }
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'); } } acymailing::setTitle(JText::_('CONFIGURATION'), 'config', 'config'); $bar =& JToolBar::getInstance('toolbar'); if (acymailing::level(3)) { $bar->appendButton('Link', 'fields', JText::_('EXTRA_FIELDS'), acymailing::completeLink('fields')); JToolBarHelper::custom('bounce', 'process', '', JText::_('BOUNCE_PROCESS'), false); } JToolBarHelper::custom('test', 'send', '', 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 = null; $elements->add_names = JHTML::_('select.booleanlist', "config[add_names]", '', $config->get('add_names', true)); $elements->embed_images = JHTML::_('select.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0)); $elements->embed_files = JHTML::_('select.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1)); $elements->multiple_part = JHTML::_('select.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0)); $mailermethod = array(); $mailermethod[] = JHTML::_('select.option', 'phpmail', 'PHP Mail Function'); $mailermethod[] = JHTML::_('select.option', 'sendmail', 'SendMail'); $mailermethod[] = JHTML::_('select.option', 'qmail', 'QMail'); $mailermethod[] = JHTML::_('select.option', 'smtp', 'SMTP Server'); $js = "function updateMailer(){"; $js .= "mailermethod = window.document.getElementById('mailer_method').value;"; $js .= "if(mailermethod == 'phpmail') {window.document.getElementById('smtp_config').style.display = 'none'; window.document.getElementById('sendmail_config').style.display = 'none';}"; $js .= "if(mailermethod == 'smtp') {window.document.getElementById('smtp_config').style.display = 'block'; window.document.getElementById('sendmail_config').style.display = 'none';}"; $js .= "if(mailermethod == 'qmail') {window.document.getElementById('smtp_config').style.display = 'none'; window.document.getElementById('sendmail_config').style.display = 'none';}"; $js .= "if(mailermethod == 'sendmail') {window.document.getElementById('smtp_config').style.display = 'none'; window.document.getElementById('sendmail_config').style.display = 'block';}"; $js .= '}'; $js .= 'window.addEvent(\'domready\', function(){ updateMailer(); });'; $doc->addScriptDeclaration($js); $elements->mailer_method = JHTML::_('select.genericlist', $mailermethod, "config[mailer_method]", 'size="1" onchange="updateMailer()"', 'value', 'text', $config->get('mailer_method', 'phpmail'), 'mailer_method'); $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::_('select.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0)); $elements->smtp_keepalive = JHTML::_('select.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1)); $elements->allow_visitor = JHTML::_('select.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::_('select.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1)); $elements->confirmation_message = JHTML::_('select.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1)); $elements->unsubscription_message = JHTML::_('select.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1)); $elements->welcome_message = JHTML::_('select.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1)); $elements->unsub_message = JHTML::_('select.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1)); $elements->confirm_message = JHTML::_('select.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0)); $elements->show_footer = JHTML::_('select.booleanlist', "config[show_footer]", '', $config->get('show_footer', 1)); if (acymailing::level(1)) { $elements->forward = JHTML::_('select.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::_('select.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::_('select.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'), 0); $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); foreach ($allCSSFiles as $oneFile) { preg_match('#' . $regex . '#i', $oneFile, $results); $myvals[] = JHTML::_('select.option', $results[1], $results[1]); } $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::_('select.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0)); if (version_compare(JVERSION, '1.6.0', '<')) { $query = 'SELECT a.name, a.id as itemid, b.title FROM `#__menu` as a LEFT JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC'; } else { $query = 'SELECT a.alias as name, a.id as itemid, b.title FROM `#__menu` as a LEFT 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,a.ordering 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')); $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 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 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 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 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 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 onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; $path = JLanguage::getLanguagePath(JPATH_ROOT); $dirs = JFolder::folders($path); foreach ($dirs as $dir) { if (strlen($dir) != 5) { continue; } $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$'); $xmlFile = reset($xmlFiles); if (empty($xmlFile)) { continue; } $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile); $oneLanguage = null; $oneLanguage->language = $dir; $oneLanguage->name = $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::_('select.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::_('select.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data')); $delayType4 = acymailing::get('type.delay'); $elements->queue_delay = $delayType4->display('config[queue_delay]', $config->get('queue_delay', 0), 2); if (version_compare(JVERSION, '1.6.0', '<')) { $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 (version_compare(JVERSION, '1.6.0', '<')) { $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(); $this->assignRef('bounceaction', acymailing::get('type.bounceaction')); $this->assignRef('config', $config); $this->assignRef('languages', $languages); $this->assignRef('elements', $elements); $this->assignRef('plugins', $plugins); $this->assignRef('integrationplugins', $integrationplugins); jimport('joomla.html.pane'); $tabs =& JPane::getInstance('tabs'); $this->assignRef('tabs', $tabs); $this->assignRef('toggleClass', $toggleClass); $images = array('icon-32-apply.png', 'icon-32-save.png', 'icon-32-cancel.png', 'icon-32-send.png', 'icon-32-preview.png', 'icon-32-edit.png', 'icon-32-help.png'); foreach ($images as $oneImage) { $to = ACYMAILING_MEDIA . 'images' . DS . 'icons' . DS . $oneImage; if (version_compare(JVERSION, '1.6.0', '<')) { $from = rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'khepri' . DS . 'images' . DS . 'toolbar' . DS . $oneImage; } else { $from = rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'bluestork' . DS . 'images' . DS . 'toolbar' . DS . $oneImage; } if (!file_exists($to) and file_exists($from)) { if (!JFile::copy($from, $to)) { acymailing::display('Could not copy the file from ' . $from . ' to ' . $to, 'warning'); } } } if (version_compare(JVERSION, '1.6.0', '<') and !file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php') or !version_compare(JVERSION, '1.6.0', '<') 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); }
function subscription() { acymailing::setTitle(JText::_('CHARTS'), 'stats', 'diagram&task=subscription'); $listsClass = acymailing::get('class.list'); $lists = $listsClass->getLists('listid'); $db =& JFactory::getDBO(); $db->setQuery('SELECT min(subdate) as minsubdate, min(unsubdate) as minunsubdate FROM ' . acymailing::table('listsub')); $dates = $db->loadObject(); $spaces = array(); $intervals = 10; $dates->maxsubdate = time(); $delay = ($dates->maxsubdate - $dates->minsubdate) / $intervals; for ($i = 0; $i < $intervals; $i++) { $spaces[$i] = (int) ($dates->minsubdate + $delay * $i); } $spaces[$intervals] = $dates->maxsubdate; $results = array(); $legendX = array(); for ($i = 0; $i <= $intervals; $i++) { $legendX[] = acymailing::getDate($spaces[$i]); $db->setQuery('SELECT count(subid) as total, listid FROM ' . acymailing::table('listsub') . ' WHERE `status` != 2 AND `subdate` < ' . $spaces[$i] . ' AND (`status` = 1 OR `unsubdate`>' . $spaces[$i] . ') GROUP BY listid'); $results[$i] = $db->loadObjectList('listid'); } $title = new title(JText::_('SUB_HISTORY')); $title->set_style('font-size:20px; color: #FF8040'); $lines = array(); $maxSub = 0; foreach ($lists as $listid => $oneList) { $lines[$listid] = new line_base(); $values = array(); for ($i = 0; $i <= $intervals; $i++) { $values[] = empty($results[$i][$listid]->total) ? 0 : (int) $results[$i][$listid]->total; } $lines[$listid]->set_values($values); $lines[$listid]->set_text($oneList->name); $lines[$listid]->set_colour($oneList->color); $maxSub = max($maxSub, max($values)); } $x_axis = new x_axis(); $xlabelobject = new x_axis_labels(); $xlabelobject->rotate(-20); $xlabelobject->set_labels($legendX); $x_axis->set_labels($xlabelobject); $y_axis = new y_axis(); $y_axis->range(0, $maxSub, intval($maxSub / 10)); $chart = new open_flash_chart(); $chart->set_x_axis($x_axis); $chart->set_y_axis($y_axis); $chart->set_title($title); foreach ($lines as $oneLine) { $chart->add_element($oneLine); } $this->assignRef('chart', $chart); }
function display($tpl = null) { $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['config'] = '<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['config'] .= ' <small style="color:red">' . JText::_('ONLY_FROM_ENTERPRISE') . '</small>'; } $desc['config'] .= '</li></ul>'; $desc['stats'] = '<ul><li>' . JText::_('STATS_DESC_VIEW') . '</li><li>' . JText::_('STATS_DESC_CLICK'); if (!acymailing::level(1)) { $desc['stats'] .= ' <small style="color:red">' . JText::_('ONLY_FROM_ESSENTIAL') . '</small>'; } $desc['stats'] .= '</li><li>' . JText::_('STATS_DESC_CHARTS'); if (!acymailing::level(1)) { $desc['stats'] .= ' <small style="color:red">' . JText::_('ONLY_FROM_ESSENTIAL') . '</small>'; } $desc['stats'] .= '</li></ul>'; $desc['autonews'] = '<ul><li>' . JText::_('AUTONEWS_DESC'); if (!acymailing::level(2)) { $desc['autonews'] .= ' <small style="color:red">' . JText::_('ONLY_FROM_BUSINESS') . '</small>'; } $desc['autonews'] .= '</li></ul>'; $desc['campaign'] = '<ul><li>' . JText::_('CAMPAIGN_DESC_CREATE'); if (!acymailing::level(3)) { $desc['campaign'] .= ' <small style="color:red">' . JText::_('ONLY_FROM_ENTERPRISE') . '</small>'; } $desc['campaign'] .= '</li><li>' . JText::_('CAMPAIGN_DESC_AFFECT'); if (!acymailing::level(3)) { $desc['campaign'] .= ' <small style="color:red">' . JText::_('ONLY_FROM_ENTERPRISE') . '</small>'; } $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' => 'user', 'text' => JText::_('USERS')); $buttons[] = array('link' => 'list', 'level' => 0, 'image' => 'categories', 'text' => JText::_('LISTS')); $buttons[] = array('link' => 'newsletter', 'level' => 0, 'image' => 'newsletter', 'text' => JText::_('NEWSLETTERS')); $buttons[] = array('link' => 'autonews', 'level' => 2, 'image' => 'autonewsletter', 'text' => JText::_('AUTONEWS')); $buttons[] = array('link' => 'campaign', 'level' => 3, 'image' => 'campaign', 'text' => JText::_('CAMPAIGN')); $buttons[] = array('link' => 'template', 'level' => 0, 'image' => 'acytemplate', 'text' => JText::_('TEMPLATES')); $buttons[] = array('link' => 'queue', 'level' => 0, 'image' => 'process', 'text' => JText::_('QUEUE')); $buttons[] = array('link' => 'stats', 'level' => 0, 'image' => 'stats', 'text' => JText::_('STATISTICS')); $buttons[] = array('link' => 'config', 'level' => 0, 'image' => 'config', 'text' => JText::_('CONFIGURATION')); $buttons[] = array('link' => 'update', 'level' => 0, 'image' => 'install', 'text' => JText::_('UPDATE_ABOUT')); $htmlbuttons = array(); foreach ($buttons as $oneButton) { $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); $this->assignRef('toggleClass', acymailing::get('helper.toggle')); $db = JFactory::getDBO(); $db->setQuery('SELECT name,email,html,confirmed,subid,created FROM ' . acymailing::table('subscriber') . ' ORDER BY created DESC LIMIT 15'); $this->assignRef('users', $db->loadObjectList()); $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'); $this->assignRef('stats', $db->loadObjectList()); jimport('joomla.html.pane'); $tabs =& JPane::getInstance('tabs'); $this->assignRef('tabs', $tabs); $this->assignRef('config', acymailing::config()); parent::display($tpl); }
function listing() { $app =& JFactory::getApplication(); $pageInfo = null; $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($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 = '\'%' . $database->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 .= ' LEFT JOIN ' . acymailing::table('subscriber') . ' as b on a.subid = b.subid'; $query .= ' LEFT 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'; } $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing::table('queue') . ' as a'; if (!empty($filters)) { $queryCount .= ' LEFT JOIN ' . acymailing::table('subscriber') . ' as b on a.subid = b.subid'; $queryCount .= ' LEFT JOIN ' . acymailing::table('mail') . ' as c on a.mailid = c.mailid'; $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); $mailqueuetype = acymailing::get('type.queuemail'); $filtersType = null; $filtersType->mail = $mailqueuetype->display('filter_mail', $selectedMail); acymailing::setTitle(JText::_('QUEUE'), 'process', 'queue'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Popup', 'process', JText::_('PROCESS'), acymailing::completeLink("queue&task=process&mailid=" . $selectedMail, true)); if (!empty($pageInfo->elements->total)) { JToolBarHelper::spacer(); JToolBarHelper::spacer(); $bar->appendButton('Confirm', JText::sprintf('CONFIRM_DELETE_QUEUE', $pageInfo->elements->total), 'delete', JText::_('DELETE'), 'remove', false, false); } JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'queue-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_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 form() { $subid = acymailing::getCID('subid'); $db =& JFactory::getDBO(); if (!empty($subid)) { $subscriberClass = acymailing::get('class.subscriber'); $subscriber = $subscriberClass->getFull($subid); $subscription = $subscriberClass->getSubscription($subid); } else { $listType = acymailing::get('class.list'); $subscription = $listType->getLists(); $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(); } acymailing::setTitle(JText::_('ACY_USER'), 'user', '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 * FROM #__acymailing_history WHERE subid = ' . intval($subid) . ' ORDER BY `date` DESC LIMIT 30'; $db->setQuery($query); $history = $db->loadObjectList(); $this->assignRef('history', $history); } 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); $this->assignRef('toggleClass', acymailing::get('helper.toggle')); $this->assignRef('subscription', $subscription); $this->assignRef('filters', $filters); $this->assignRef('statusType', acymailing::get('type.status')); }
function show() { $listid = acymailing::getCID('listid'); $listClass = acymailing::get('class.list'); $list = $listClass->get($listid); $followupClass = acymailing::get('class.listmail'); $followup = $followupClass->getFollowup($listid); $listCampaign = acymailing::get('class.listcampaign'); $lists = $listCampaign->getAffectedLists($listid); acymailing::setTitle($list->name, 'campaign', 'campaign&task=show&listid=' . $listid); $bar =& JToolBar::getInstance('toolbar'); JToolBarHelper::custom('edit', 'edit', '', JText::_('EDIT'), false); JToolBarHelper::cancel(); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'campaign-show'); $this->assignRef('toggleClass', acymailing::get('helper.toggle')); $this->assignRef('followup', $followup); $this->assignRef('delay', acymailing::get('type.delaydisp')); $this->assignRef('lists', $lists); $this->assignRef('list', $list); $this->assignRef('config', acymailing::config()); }
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))); $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(); $js = "function updateFilter(filterNum){"; foreach ($typesFilters as $oneType => $oneName) { $typevaluesFilters[] = JHTML::_('select.option', $oneType, $oneName); $js .= "filterArea = 'filter'+filterNum+'{$oneType}';\r\n\t\t\t\tif(window.document.getElementById(filterArea)){window.document.getElementById(filterArea).style.display = 'none';}"; } $js .= "filterArea = 'filter'+filterNum+window.document.getElementById('filtertype'+filterNum).value;\r\n\t\t\t\tif(window.document.getElementById(filterArea)){window.document.getElementById(filterArea).style.display = 'block';}\r\n\t\t\t}"; $js .= "function updateAction(actionNum){"; foreach ($typesActions as $oneType => $oneName) { $typevaluesActions[] = JHTML::_('select.option', $oneType, $oneName); $js .= "actionArea = 'action'+actionNum+'{$oneType}';\r\n\t\t\t\tif(window.document.getElementById(actionArea)){window.document.getElementById(actionArea).style.display = 'none';}"; } $js .= "actionArea = 'action'+actionNum+window.document.getElementById('actiontype'+actionNum).value;\r\n\t\t\t\tif(window.document.getElementById(actionArea)){window.document.getElementById(actionArea).style.display = 'block';}\r\n\t\t\t}"; $js .= "var numFilters = 0;\r\n\t\t\t\tvar numActions = 0;\r\n\t\t\t\tfunction addFilter(){\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\t\t\tnewdiv.id = 'filter'+numFilters;\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\n\t\t\t\t\tnewdiv.innerHTML = document.getElementById('filters_original').innerHTML.replace(/__num__/g, numFilters);\r\n\t\t\t\t\tdocument.getElementById('allfilters').appendChild(newdiv); updateFilter(numFilters); numFilters++; }\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++; }"; $js .= "window.addEvent('domready', function(){ addFilter(); 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\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 (version_compare(JVERSION, '1.6.0', '<')) { $js .= "submitform( pressbutton );} "; } else { $js .= "Joomla.submitform(pressbutton,document.adminForm);}; "; } $doc->addScriptDeclaration($js); $js = ''; $data = array('action', 'filter'); foreach ($data as $datatype) { if (empty($filter->{$datatype})) { continue; } foreach ($filter->{$datatype}['type'] as $num => $oneType) { if (empty($oneType)) { continue; } $js .= "while(!document.getElementById('" . $datatype . "type{$num}')){add" . ucfirst($datatype) . "();}\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) { $js .= "document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].value = '" . addslashes(str_replace(array("\n", "\r"), ' ', $value)) . "';"; } } } $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::_('NEW'), acymailing::completeLink('filter&task=edit&filid=0')); } } $bar->appendButton('Link', 'cancel', JText::_('ACY_CLOSE'), acymailing::completeLink('list')); 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) { JHTML::_('behavior.modal', 'a.modal'); $config = acymailing::config(); $db =& JFactory::getDBO(); acymailing::setTitle(JText::_('CONFIGURATION'), 'config', 'config'); $bar =& JToolBar::getInstance('toolbar'); if (acymailing::level(3)) { $bar->appendButton('Link', 'fields', JText::_('EXTRA_FIELDS'), acymailing::completeLink('fields')); JToolBarHelper::custom('bounce', 'process', '', JText::_('BOUNCE_PROCESS'), false); } JToolBarHelper::custom('test', 'send', '', JText::_('SEND_TEST'), false); JToolBarHelper::divider(); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel('cancel', JText::_('CLOSE')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'config'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); $elements = null; $elements->add_names = JHTML::_('select.booleanlist', "config[add_names]", '', $config->get('add_names', true)); $elements->embed_images = JHTML::_('select.booleanlist', "config[embed_images]", '', $config->get('embed_images', 0)); $elements->embed_files = JHTML::_('select.booleanlist', "config[embed_files]", '', $config->get('embed_files', 1)); $elements->multiple_part = JHTML::_('select.booleanlist', "config[multiple_part]", '', $config->get('multiple_part', 0)); $mailerMethod = acymailing::get('type.mailermethod'); $elements->mailer_method = $mailerMethod->display("config[mailer_method]", $config->get('mailer_method', 'phpmail')); $encoding = acymailing::get('type.encoding'); $elements->encoding_format = $encoding->display("config[encoding_format]", $config->get('encoding_format', 'base64')); $charset = acymailing::get('type.charset'); $elements->charset = $charset->display("config[charset]", $config->get('charset', 'UTF-8')); $secured = acymailing::get('type.secured'); $elements->smtp_secured = $secured->display("config[smtp_secured]", $config->get('smtp_secured')); $elements->smtp_auth = JHTML::_('select.booleanlist', "config[smtp_auth]", '', $config->get('smtp_auth', 0)); $elements->smtp_keepalive = JHTML::_('select.booleanlist', "config[smtp_keepalive]", '', $config->get('smtp_keepalive', 1)); $queueType = acymailing::get('type.queuetype'); $elements->queue_type = $queueType->display("config[queue_type]", $config->get('queue_type', 'auto')); $elements->allow_visitor = JHTML::_('select.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::_('select.booleanlist', "config[subscription_message]", '', $config->get('subscription_message', 1)); $elements->confirmation_message = JHTML::_('select.booleanlist', "config[confirmation_message]", '', $config->get('confirmation_message', 1)); $elements->unsubscription_message = JHTML::_('select.booleanlist', "config[unsubscription_message]", '', $config->get('unsubscription_message', 1)); $elements->welcome_message = JHTML::_('select.booleanlist', "config[welcome_message]", '', $config->get('welcome_message', 1)); $elements->unsub_message = JHTML::_('select.booleanlist', "config[unsub_message]", '', $config->get('unsub_message', 1)); $elements->confirm_message = JHTML::_('select.booleanlist', "config[confirm_message]", '', $config->get('confirm_message', 0)); if (acymailing::level(1)) { $elements->show_footer = JHTML::_('select.booleanlist', "config[show_footer]", '', $config->get('show_footer', 1)); $elements->forward = JHTML::_('select.booleanlist', "config[forward]", '', $config->get('forward', false)); } else { $elements->show_footer = '<small style="color:red">' . JText::_('ONLY_FROM_ESSENTIAL') . '</small>'; $elements->forward = '<small style="color:red">' . JText::_('ONLY_FROM_ESSENTIAL') . '</small>'; } $cssFiles = acymailing::get('type.css'); $cssFiles->type = 'component'; $elements->css_frontend = $cssFiles->display('config[css_frontend]', $config->get('css_frontend', 'default')); $cssFiles->type = 'module'; $elements->css_module = $cssFiles->display('config[css_module]', $config->get('css_module', 'default')); $cssFiles->type = 'component'; $elements->css_backend = $cssFiles->display('config[css_backend]', $config->get('css_backend', 'default')); $elements->colortype = acymailing::get('type.color'); $elements->use_sef = JHTML::_('select.booleanlist', "config[use_sef]", '', $config->get('use_sef', 0)); $query = 'SELECT a.name, a.id as itemid, b.title FROM `#__menu` as a LEFT JOIN `#__menu_types` as b on a.menutype = b.menutype WHERE a.access = 0 ORDER BY b.title ASC,a.ordering ASC'; $db->setQuery($query); $joomMenus = $db->loadObjectList(); $menuvalues = array(); $menuvalues[] = JHTML::_('select.option', '0', JText::_('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')); if (acymailing::level(1)) { $cronTypeReport = acymailing::get('type.cronreport'); $elements->cron_sendreport = $cronTypeReport->display('config[cron_sendreport]', $config->get('cron_sendreport', 2)); $cronTypeReportSave = acymailing::get('type.cronreportsave'); $elements->cron_savereport = $cronTypeReportSave->display('config[cron_savereport]', $config->get('cron_savereport', 0)); $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=config&task=cleanreport'; $elements->deleteReport = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 400, y: 100}}"><button onclick="return false">' . JText::_('REPORT_DELETE') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=config&task=seereport'; $elements->seeReport = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('REPORT_SEE') . '</button></a>'; $link = 'index.php?option=com_acymailing&tmpl=component&ctrl=email&task=edit&mailid=report'; $elements->editReportEmail = '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('REPORT_EDIT') . '</button></a>'; $delayType = acymailing::get('type.delay'); $elements->cron_frequency = $delayType->display('config[cron_frequency]', $config->get('cron_frequency', 0), 0); $elements->cron_url = ACYMAILING_LIVE . 'index.php?option=com_acymailing&ctrl=cron'; $item = $config->get('itemid'); if (!empty($item)) { $elements->cron_url .= '&Itemid=' . $item; } $informations = null; $informations->version = $config->get('version'); $informations->level = $config->get('level'); $informations->website = str_replace('~', 'tildsymb', ACYMAILING_LIVE); $informations->component = 'acymailing'; $informations->cronurl = str_replace('~', 'tildsymb', $elements->cron_url); $infos = urlencode(base64_encode(serialize($informations))); $urlCron = 'http://www.acyba.com/index.php?option=com_doc>ask=launcher&task=edit&infos=' . $infos; $elements->cron_edit = '<a class="modal" href="' . $urlCron . '" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"><button onclick="return false">' . JText::_('CREATE_CRON') . '</button></a>'; } $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 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 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 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 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 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 onclick="return false">' . JText::_('EDIT_NOTIFICATION_MAIL') . '</button></a>'; if (acymailing::level(3)) { $elements->bounce = JHTML::_('select.booleanlist', "config[bounce]", '', $config->get('bounce', 0)); $connectionType = acymailing::get('type.connection'); $elements->bounce_connection = $connectionType->display('config[bounce_connection]', $config->get('bounce_connection', 'imap')); $elements->bounce_secured = $secured->display("config[bounce_secured]", $config->get('bounce_secured')); $elements->bounce_certif = JHTML::_('select.booleanlist', "config[bounce_certif]", '', $config->get('bounce_certif', 0)); $this->assignRef('emailaction', acymailing::get('type.emailaction')); $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 displayBounceFrequency(newvalue){ if(newvalue == '1') {window.document.getElementById('bouncefrequency').style.display = 'block';}else{window.document.getElementById('bouncefrequency').style.display = 'none';}} "; $js .= 'window.addEvent(\'load\', function(){ displayBounceFrequency(\'' . $config->get('auto_bounce', 0) . '\');});'; $doc =& JFactory::getDocument(); $doc->addScriptDeclaration($js); } jimport('joomla.filesystem.folder'); $path = JLanguage::getLanguagePath(JPATH_ROOT); $dirs = JFolder::folders($path); foreach ($dirs as $dir) { $xmlFiles = JFolder::files($path . DS . $dir, '^([-_A-Za-z]*)\\.xml$'); $xmlFile = reset($xmlFiles); if (empty($xmlFile)) { continue; } $data = JApplicationHelper::parseXMLLangMetaFile($path . DS . $dir . DS . $xmlFile); $oneLanguage = null; $oneLanguage->language = $dir; $oneLanguage->name = $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 . '" src="../images/M_images/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 . '" src="../images/M_images/new.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 =& JFactory::getDocument(); $doc->addScriptDeclaration($js); $elements->require_confirmation = JHTML::_('select.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::_('select.radiolist', $allowmodif, "config[allow_modif]", 'size="1" onclick="updateModification(this.value)"', 'value', 'text', $config->get('allow_modif', 'data')); $delayType2 = acymailing::get('type.delay'); $elements->queue_delay = $delayType2->display('config[queue_delay]', $config->get('queue_delay', 0), 2); $db->setQuery("SELECT name,published,id FROM `#__plugins` WHERE `folder` = 'acymailing' AND `element` NOT LIKE 'plg%' ORDER BY published DESC, ordering ASC"); $plugins = $db->loadObjectList(); $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"); $integrationplugins = $db->loadObjectList(); $this->assignRef('bounceaction', acymailing::get('type.bounceaction')); $this->assignRef('config', $config); $this->assignRef('languages', $languages); $this->assignRef('elements', $elements); $this->assignRef('plugins', $plugins); $this->assignRef('integrationplugins', $integrationplugins); $toggleClass = acymailing::get('helper.toggle'); jimport('joomla.html.pane'); $tabs =& JPane::getInstance('tabs'); $this->assignRef('tabs', $tabs); $this->assignRef('toggleClass', $toggleClass); if (!file_exists(ACYMAILING_FRONT . 'images' . DS . 'icons' . DS . 'icon-32-apply.png') || !file_exists(ACYMAILING_FRONT . 'images' . DS . 'icons' . DS . 'icon-32-edit.png') and file_exists(rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'khepri' . DS . 'images' . DS . 'toolbar' . DS . 'icon-32-apply.png')) { $images = array('icon-32-apply.png', 'icon-32-save.png', 'icon-32-cancel.png', 'icon-32-send.png', 'icon-32-preview.png', 'icon-32-edit.png'); jimport('joomla.filesystem.file'); foreach ($images as $oneImage) { JFile::copy(rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'templates' . DS . 'khepri' . DS . 'images' . DS . 'toolbar' . DS . $oneImage, ACYMAILING_FRONT . 'images' . DS . 'icons' . DS . $oneImage); } } if (!file_exists(rtrim(JPATH_SITE, DS) . DS . 'plugins' . DS . 'acymailing' . DS . 'tagsubscriber.php')) { acymailing::display(JText::sprintf('ERROR_PLUGINS', 'index.php?option=com_acymailing&ctrl=update&task=install'), 'warning'); } return parent::display($tpl); }
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['config'] = '<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['config'] .= acymailing::getUpgradeLink('enterprise'); } $desc['config'] .= '</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' => 'user', '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' => 'config', 'level' => 0, 'image' => 'config', 'text' => JText::_('CONFIGURATION'), 'acl' => 'acl_configuration_manage'); $buttons[] = array('link' => 'update', 'level' => 0, 'image' => 'install', '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); $this->assignRef('toggleClass', acymailing::get('helper.toggle')); $db = JFactory::getDBO(); $db->setQuery('SELECT name,email,html,confirmed,subid,created FROM ' . acymailing::table('subscriber') . ' ORDER BY created DESC LIMIT 15'); $this->assignRef('users', $db->loadObjectList()); $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'); $this->assignRef('stats', $db->loadObjectList()); $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 addusers() { $listClass = acymailing::get('class.list'); $this->assignRef('lists', $listClass->getLists()); $this->assignRef('filter', acymailing::get('type.filter')); acymailing::setTitle(JText::_('SUB_USERS'), 'import', 'list&task=addusers'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Confirm', JText::_('PROCESS_CONFIRMATION'), 'new', JText::_('SUBSCRIBE'), 'massadd', false, false); $bar->appendButton('Confirm', JText::_('PROCESS_CONFIRMATION'), 'delete', JText::_('REMOVE'), 'massremove', false, false); JToolBarHelper::cancel(); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'list-addusers'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); }
function form() { $subid = acymailing::getCID('subid'); if (!empty($subid)) { $subscriberClass = acymailing::get('class.subscriber'); $subscriber = $subscriberClass->getFull($subid); $subscription = $subscriberClass->getSubscription($subid); } else { $listType = acymailing::get('class.list'); $subscription = $listType->getLists(); $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 (acymailing::level(3)) { $fieldsClass = acymailing::get('class.fields'); $this->assignRef('fieldsClass', $fieldsClass); $this->assignRef('extraFields', $fieldsClass->getFields('backend', $subscriber)); } acymailing::setTitle(JText::_('USER'), 'user', 'subscriber&task=edit&subid=' . $subid); $bar =& JToolBar::getInstance('toolbar'); if (!empty($subid) && acymailing::level(2)) { $bar->appendButton('Popup', 'send', JText::_('SEND'), acymailing::completeLink("send&task=addqueue&subid=" . $subid, true)); JToolBarHelper::divider(); } if (!empty($subscriber->userid)) { $bar->appendButton('Link', 'edit', JText::_('EDIT_JOOMLA_USER'), 'index.php?option=com_users&task=edit&cid[]=' . $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); $this->assignRef('subscription', $subscription); $this->assignRef('filters', $filters); $this->assignRef('statusType', acymailing::get('type.status')); }
function form() { $listid = acymailing::getCID('listid'); $listClass = acymailing::get('class.list'); if (!empty($listid)) { $list = $listClass->get($listid); } else { $list->published = 0; $list->visible = 1; $list->description = ''; $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 (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 .= $editor->jsCode(); if (version_compare(JVERSION, '1.6.0', '<')) { $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->assignRef('welcomeMsg', acymailing::get('type.welcome')); $this->assignRef('languages', acymailing::get('type.listslanguages')); } $this->assignRef('unsubMsg', acymailing::get('type.unsub')); $this->assignRef('list', $list); $this->assignRef('editor', $editor); }