function store() { if (!$this->isAllowed('configuration', 'manage')) { return; } $app = JFactory::getApplication(); JRequest::checkToken() or die('Invalid Token'); $source = is_array($_POST['config']) ? 'POST' : 'REQUEST'; $formData = JRequest::getVar('config', array(), $source, 'array'); $aclcats = JRequest::getVar('aclcat', array(), 'POST', 'array'); if (!empty($aclcats)) { if (JRequest::getString('acl_configuration', 'all') != 'all' && !acymailing_isAllowed($formData['acl_configuration_manage'])) { $app->enqueueMessage(JText::_('ACL_WRONG_CONFIG'), 'notice'); unset($formData['acl_configuration_manage']); } $deleteAclCats = array(); $unsetVars = array('save', 'create', 'manage', 'modify', 'delete', 'fields', 'export', 'import', 'view', 'send', 'schedule', 'bounce', 'test'); foreach ($aclcats as $oneCat) { if (JRequest::getString('acl_' . $oneCat) == 'all') { foreach ($unsetVars as $oneVar) { unset($formData['acl_' . $oneCat . '_' . $oneVar]); } $deleteAclCats[] = $oneCat; } } } if (!empty($formData['hostname'])) { $formData['hostname'] = preg_replace('#https?://#i', '', $formData['hostname']); $formData['hostname'] = preg_replace('#[^a-z0-9_.-]#i', '', $formData['hostname']); } $reasons = JRequest::getVar('unsub_reasons', array(), 'POST', 'array'); $unsub_reasons = array(); foreach ($reasons as $oneReason) { if (empty($oneReason)) { continue; } $unsub_reasons[] = strip_tags($oneReason); } $formData['unsub_reasons'] = serialize($unsub_reasons); $config =& acymailing_config(); $status = $config->save($formData); if (!empty($deleteAclCats)) { $db = JFactory::getDBO(); $db->setQuery("DELETE FROM `#__acymailing_config` WHERE `namekey` LIKE 'acl_" . implode("%' OR `namekey` LIKE 'acl_", $deleteAclCats) . "%'"); $db->query(); } if ($status) { $app->enqueueMessage(JText::_('JOOMEXT_SUCC_SAVED'), 'message'); } else { $app->enqueueMessage(JText::_('ERROR_SAVING'), 'error'); } $config->load(); }
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'); }
function update() { $config = acymailing_config(); if (!acymailing_isAllowed($config->get('acl_config_manage', 'all'))) { acymailing_display(JText::_('ACY_NOTALLOWED'), 'error'); return false; } $acyToolbar = acymailing::get('helper.toolbar'); $acyToolbar->setTitle(JText::_('UPDATE_ABOUT'), 'update'); $acyToolbar->link(acymailing_completeLink('dashboard'), JText::_('ACY_CLOSE'), 'cancel'); $acyToolbar->display(); return $this->_iframe(ACYMAILING_UPDATEURL . 'update'); }
function addSubscription($subid, $lists) { $app = JFactory::getApplication(); $my = JFactory::getUser(); $result = true; $time = time(); $subid = intval($subid); $listHelper = acymailing_get('helper.list'); foreach ($lists as $status => $listids) { $status = intval($status); JArrayHelper::toInteger($listids); $this->database->setQuery('SELECT `listid`,`access_sub` FROM ' . acymailing_table('list') . ' WHERE `listid` IN (' . implode(',', $listids) . ') AND `type` = \'list\''); $allResults = $this->database->loadObjectList('listid'); $listids = array_keys($allResults); if ($status == '-1') { $column = 'unsubdate'; } else { $column = 'subdate'; } $values = array(); foreach ($listids as $listid) { if (empty($listid)) { continue; } if ($status > 0 && acymailing_level(3)) { if ((!$app->isAdmin() || !empty($this->gid)) && $this->checkAccess && $allResults[$listid]->access_sub != 'all') { if (!acymailing_isAllowed($allResults[$listid]->access_sub, $this->gid)) { continue; } } } $values[] = intval($listid) . ',' . $subid . ',' . $status . ',' . $time; } if (empty($values)) { continue; } $query = 'INSERT INTO ' . acymailing_table('listsub') . ' (listid,subid,`status`,' . $column . ') VALUES (' . implode('),(', $values) . ')'; $this->database->setQuery($query); $result = $this->database->query() && $result; if ($status == 1) { $listHelper->subscribe($subid, $listids); } } return $result; }
function getFrontendLists($index = '') { $lists = $this->getLists($index); $copyAllLists = $lists; $my = JFactory::getUser(); foreach ($copyAllLists as $id => $oneList) { if (!$oneList->published or empty($my->id)) { unset($lists[$id]); continue; } if ((int) $my->id == (int) $oneList->userid) { continue; } if (!acymailing_isAllowed($oneList->access_manage)) { unset($lists[$id]); continue; } } return $lists; }
function store() { if (!$this->isAllowed('configuration', 'manage')) { return; } $app =& JFactory::getApplication(); JRequest::checkToken() or die('Invalid Token'); $formData = JRequest::getVar('config', array(), '', 'array'); $aclcats = JRequest::getVar('aclcat', array(), '', 'array'); if (!empty($aclcats)) { if (JRequest::getString('acl_configuration', 'all') != 'all' && !acymailing_isAllowed($formData['acl_configuration_manage'])) { $app->enqueueMessage(JText::_('ACL_WRONG_CONFIG'), 'notice'); unset($formData['acl_configuration_manage']); } $deleteAclCats = array(); $unsetVars = array('save', 'create', 'manage', 'modify', 'delete', 'fields', 'export', 'import', 'view', 'send', 'schedule', 'bounce', 'test'); foreach ($aclcats as $oneCat) { if (JRequest::getString('acl_' . $oneCat) == 'all') { foreach ($unsetVars as $oneVar) { unset($formData['acl_' . $oneCat . '_' . $oneVar]); } $deleteAclCats[] = $oneCat; } } } $config =& acymailing_config(); $status = $config->save($formData); if (!empty($deleteAclCats)) { $db =& JFactory::getDBO(); $db->setQuery("DELETE FROM `#__acymailing_config` WHERE `namekey` LIKE 'acl_" . implode("%' OR `namekey` LIKE 'acl_", $deleteAclCats) . "%'"); $db->query(); } if ($status) { $app->enqueueMessage(JText::_('JOOMEXT_SUCC_SAVED'), 'message'); } else { $app->enqueueMessage(JText::_('ERROR_SAVING'), 'error'); } $config->load(); }
<button class="btn button buttonreset" onclick="document.getElementById('acymailingsearch').value='';this.form.submit();"><?php echo JText::_( 'JOOMEXT_RESET' ); ?></button> <?php } $k = 1; for($i = 0,$a = count($this->rows);$i<$a;$i++){ $row =& $this->rows[$i]; echo '<div class="archiveRow archiveRow'.$k.$this->values->suffix.'">'; if(!empty($row->thumb)) echo '<img class="archiveItemPict" src="'.$row->thumb.'"/>'; echo '<span class="acyarchivetitle"><a '.($this->config->get('open_popup',1) ? 'class="modal" rel="{handler: \'iframe\', size: {x: '.intval($this->config->get('popup_width',750)).', y: '.intval($this->config->get('popup_height',550)).'}}"' : '').'href="'.acymailing_completeLink('archive&task=view&listid='.$this->list->listid.'-'.$this->list->alias.'&mailid='.$row->mailid.'-'.strip_tags($row->alias).$this->item,(bool)$this->config->get('open_popup',1)).'">'; echo acymailing_dispSearch($row->subject,$this->pageInfo->search).'</a>'; if($this->access->frontEndManagement){ if(($this->config->get('frontend_modif',1) || ($row->userid == $this->my->id)) && ($this->config->get('frontend_modif_sent',1) || empty($row->senddate))){ ?> <span class="acyeditbutton"><a href="<?php echo acymailing_completeLink('frontnewsletter&task=edit&mailid='.$row->mailid.'&listid='.$this->list->listid); ?>" title="<?php echo JText::_('ACY_EDIT',true) ?>" ><img class="icon16" src="<?php echo ACYMAILING_IMAGES ?>icons/icon-16-edit.png" alt="<?php echo JText::_('ACY_EDIT',true) ?>" /></a></span> <?php } if(!empty($row->senddate) && acymailing_isAllowed($this->config->get('acl_statistics_manage','all'))){ ?> <span class="acystatsbutton"><a class="modal" rel="{handler: 'iframe', size: {x: 800, y: 590}}" href="<?php echo acymailing_completeLink('frontnewsletter&task=stats&mailid='.$row->mailid.'&listid='.$this->list->listid,true); ?>"><img src="<?php echo ACYMAILING_IMAGES; ?>icons/icon-16-stats.png" alt="<?php echo JText::_('STATISTICS',true) ?>" /></a></span> <?php } ?> <?php } echo '</span>'; if($this->values->show_senddate && !empty($row->senddate)) { echo '<span class="sentondate">'.JText::sprintf('ACY_SENT_ON', acymailing_getDate($row->senddate,JText::_('DATE_FORMAT_LC3'))).'</span>'; } if($this->values->show_receiveemail){ ?> <span class="receiveviaemail"> <input onclick="changeReceiveEmail(this.checked)" type="checkbox" name="receivemail[]" value="<?php echo $row->mailid; ?>" id="receive_<?php echo $row->mailid; ?>" /> <label for="receive_<?php echo $row->mailid; ?>"><?php echo JText::_('RECEIVE_VIA_EMAIL'); ?></label> </span> <?php if(!empty($row->summary)) echo '<br/>'; } if(!empty($row->summary)) echo '<span class="archiveItemDesc">'.nl2br($row->summary).'</span>';
</td> </tr> </table> <?php if (!acymailing_isAllowed($this->config->get('acl_newsletters_sender_informations', 'all'))) { echo '</div>'; } else { echo $this->tabs->endPanel(); } if ($this->type == 'joomlanotification') { $doc = JFactory::getDocument(); $doc->addStyleDeclaration(" .mail_metadata_jnotif{display:none;} "); echo '<div class="mail_metadata_jnotif">'; } else { if (acymailing_isAllowed($this->config->get('acl_newsletters_meta_data', 'all'))) { echo $this->tabs->startPanel(JText::_('META_DATA'), 'mail_metadata'); ?> <br style="font-size:1px"/> <table width="100%" class="paramlist admintable" id="metadatatable"> <tr> <td class="paramlist_key"> <label for="metakey"><?php echo JText::_('META_KEYWORDS'); ?> </label> </td> <td class="paramlist_value"> <textarea id="metakey" name="data[mail][metakey]" rows="5" cols="30" ><?php echo @$this->mail->metakey; ?>
function GetInitialisationFunction($id) { JHtml::_('behavior.modal', 'a.modal'); $texteSuppression = JText::_('ACYEDITOR_DELETEAREA'); $tooltipSuppression = JText::_('ACY_DELETE'); $tooltipEdition = JText::_('ACY_EDIT'); $urlBase = JURI::root(); $urlAdminBase = JURI::base(); $cssurl = JRequest::getVar('acycssfile'); $forceComplet = JRequest::getCmd('option') != 'com_acymailing' || JRequest::getCmd('ctrl') == 'template' || JRequest::getCmd('ctrl') == 'list'; $modeList = JRequest::getCmd('option') == 'com_acymailing' && JRequest::getCmd('ctrl') == 'list'; $modeTemplate = JRequest::getCmd('option') == 'com_acymailing' && JRequest::getCmd('ctrl') == 'template'; $modeArticle = JRequest::getCmd('option') == 'com_content' && JRequest::getCmd('view') == 'article'; $joomla2_5 = ACYMAILING_J16; $joomla3 = ACYMAILING_J30; $titleTemplateDelete = JText::_('ACYEDITOR_TEMPLATEDELETE'); $titleTemplateText = JText::_('ACYEDITOR_TEMPLATETEXT'); $titleTemplatePicture = JText::_('ACYEDITOR_TEMPLATEPICTURE'); $titleShowAreas = JText::_('ACYEDITOR_SHOWAREAS'); $app = JFactory::getApplication(); $isBack = 0; if ($app->isAdmin()) { $isBack = 1; } $tagAllowed = 0; $config = acymailing_config(); if (JRequest::getCmd('option') == 'com_acymailing' && JRequest::getCmd('ctrl') != 'list' && JRequest::getCmd('ctrl') != 'campaign' && acymailing_isAllowed($config->get('acl_tags_view', 'all')) && JRequest::getCmd('tmpl') != 'component') { $tagAllowed = 1; } $type = 'news'; if (JRequest::getCmd('ctrl') == 'autonews' || JRequest::getCmd('ctrl') == 'followup') { $type = JRequest::getCmd('ctrl'); } $pasteType = $this->params->get('pasteType', 'plain'); $enterMode = $this->params->get('enterMode', 'br'); $inlineSource = $this->params->get('inlineSource', 0); $doc = JFactory::getDocument(); $js = "\n\t\tacyEnterMode='" . $enterMode . "';\n\t\tpasteType='" . $pasteType . "';\n\t\turlSite='" . $urlBase . "';\n\t\tdefaultText='" . str_replace("'", "\\'", JText::_('ACYEDITOR_DEFAULTTEXT')) . "';\n\t\ttitleBtnMore='" . str_replace("'", "\\'", JText::_('ACYEDITOR_TEMPLATEMORE')) . "';\n\t\ttitleBtnDupliAfter='" . str_replace("'", "\\'", JText::_('ACYEDITOR_DUPLICATE_AFTER')) . "';\n\t\ttooltipInitAreas='" . str_replace("'", "\\'", JText::_('ACYEDITOR_REINIT_ZONE_TOOLTIP')) . "';\n\t\tconfirmInitAreas='" . str_replace("'", "\\'", JText::_('ACYEDITOR_REINIT_ZONE_CONFIRMATION')) . "';\n\t\tinlineSource='" . $inlineSource . "';\n\t\t"; $doc->addScriptDeclaration($js); return "Initialisation(\"{$id}\", \"{$type}\", \"{$urlBase}\", \"{$urlAdminBase}\", \"{$cssurl}\", \"{$forceComplet}\", \"{$modeList}\", \"{$modeTemplate}\", \"{$modeArticle}\", \"{$joomla2_5}\", \"{$joomla3}\", \"{$isBack}\", \"{$tagAllowed}\", \"{$texteSuppression}\", \"{$tooltipSuppression}\", \"{$tooltipEdition}\", \"{$titleTemplateDelete}\", \"{$titleTemplateText}\", \"{$titleTemplatePicture}\", \"{$titleShowAreas}\");\n"; }
</a></span> <?php } } ?> </td> <td> <?php $subjectLine = acymailing_dispSearch($row->subject, $this->pageInfo->search); echo acymailing_tooltip('<b>' . JText::_('JOOMEXT_ALIAS') . ' : </b>' . acymailing_dispSearch($row->alias, $this->pageInfo->search), ' ', '', $subjectLine, acymailing_completeLink(($this->app->isAdmin() ? '' : 'front') . 'newsletter&task=edit&mailid=' . $row->mailid)); ?> </td> <td align="center" style="text-align:center"> <?php echo acymailing_getDate($row->senddate); if (!empty($row->countqueued) && acymailing_isAllowed($this->config->get('acl_queue_delete', 'all'))) { ?> <br/> <button class="acymailing_button" onclick="if(confirm('<?php echo str_replace("'", "\\'", JText::sprintf('ACY_VALID_DELETE_FROM_QUEUE', $row->countqueued)); ?> ')){ window.location.href = '<?php echo JURI::base(); ?> index.php?option=com_acymailing&ctrl=<?php if (!JFactory::getApplication()->isAdmin()) { echo 'front'; } ?> newsletter&task=cancelNewsletter&<?php
function listing() { $pageInfo = new stdClass(); $pageInfo->elements = new stdClass(); $app = JFactory::getApplication(); $config = acymailing_config(); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.subid', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $selectedList = $app->getUserStateFromRequest($paramBase . "filter_lists", 'filter_lists', 0, 'int'); $selectedStatus = $app->getUserStateFromRequest($paramBase . "filter_status", 'filter_status', 0, 'int'); $selectedStatusList = $app->getUserStateFromRequest($paramBase . "filter_statuslist", 'filter_statuslist', 0, 'int'); $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $pageInfo->limit = new stdClass(); $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(); $customFields = acymailing_get('class.fields'); $displayFields = array(); $displayFields['name'] = new stdClass(); $displayFields['name']->fieldname = 'JOOMEXT_NAME'; $displayFields['name']->type = 'text'; $displayFields['email'] = new stdClass(); $displayFields['email']->fieldname = 'JOOMEXT_EMAIL'; $displayFields['email']->type = 'text'; $displayFields['html'] = new stdClass(); $displayFields['html']->fieldname = 'RECEIVE_HTML'; $displayFields['html']->type = 'radio'; $filters = array(); if (!empty($pageInfo->search)) { foreach ($displayFields as $fieldname => $onefield) { if ($fieldname == 'html' or in_array('a.' . $fieldname, $this->searchFields) or $onefield->type == 'customtext') { continue; } $this->searchFields[] = 'a.`' . $fieldname . '`'; } if (!is_numeric($pageInfo->search)) { $this->searchFields = array_diff($this->searchFields, array('a.subid', 'a.userid')); } if (strpos($pageInfo->search, '@') !== false) { $this->searchFields = array_diff($this->searchFields, array('a.name', 'b.username')); } $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}"; } $leftJoinQuery = array(); $joinQuery = array(); if (empty($selectedList) || $selectedStatusList == -2 && $app->isAdmin()) { if (empty($selectedList) && $selectedStatusList == -2) { $selectedStatusList = 0; } $fromQuery = ' FROM ' . acymailing_table('subscriber') . ' as a '; $countField = "a.subid"; $leftJoinQuery[] = acymailing_table('users', false) . ' as b ON a.userid = b.id'; if ($selectedStatusList == -2) { $leftJoinQuery[] = acymailing_table('listsub') . ' as c on a.subid = c.subid AND listid = ' . intval($selectedList); $filters[] = 'c.listid IS NULL'; } } else { $fromQuery = ' FROM ' . acymailing_table('listsub') . ' as c'; $countField = "c.subid"; $joinQuery[] = acymailing_table('subscriber') . ' as a ON a.subid = c.subid'; $leftJoinQuery[] = acymailing_table('users', false) . ' as b ON a.userid = b.id'; $filters[] = 'c.listid = ' . intval($selectedList); if (!in_array($selectedStatusList, array(-1, 1, 2))) { $selectedStatusList = 1; } $filters[] = 'c.status = ' . intval($selectedStatusList); } if ($selectedStatus == 1) { $filters[] = 'a.accept > 0'; } elseif ($selectedStatus == -1) { $filters[] = 'a.accept < 1'; } elseif ($selectedStatus == 2) { $filters[] = 'a.confirmed < 1'; } elseif ($selectedStatus == 3) { $filters[] = 'a.enabled > 0'; } elseif ($selectedStatus == -3) { $filters[] = 'a.enabled < 1'; } $query = 'SELECT ' . implode(',', $this->selectedFields) . $fromQuery; if (!empty($joinQuery)) { $query .= ' JOIN ' . implode(' JOIN ', $joinQuery); } if (!empty($leftJoinQuery)) { $query .= ' LEFT JOIN ' . implode(' LEFT JOIN ', $leftJoinQuery); } 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, empty($pageInfo->limit->value) ? 500 : $pageInfo->limit->value); $rows = $database->loadObjectList('subid'); $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(' . $countField . ') ' . $fromQuery; if (!empty($pageInfo->search) || !empty($selectedStatus) || $selectedStatusList == -2) { if (!empty($joinQuery)) { $queryCount .= ' JOIN ' . implode(' JOIN ', $joinQuery); } if (!empty($leftJoinQuery)) { $queryCount .= ' LEFT JOIN ' . implode(' LEFT JOIN ', $leftJoinQuery); } } if (!empty($filters)) { $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')'; } $database->setQuery($queryCount); $pageInfo->elements->total = $database->loadResult(); } if (!empty($rows)) { $database->setQuery('SELECT * FROM `#__acymailing_listsub` WHERE `subid` IN (\'' . implode('\',\'', array_keys($rows)) . '\')'); $subscriptions = $database->loadObjectList(); if (!empty($subscriptions)) { foreach ($subscriptions as $onesub) { $sublistid = $onesub->listid; if (empty($rows[$onesub->subid]->subscription)) { $rows[$onesub->subid]->subscription = new stdClass(); } $rows[$onesub->subid]->subscription->{$sublistid} = $onesub; } } } if (empty($pageInfo->limit->value)) { if ($pageInfo->elements->total > 500) { acymailing_display('We do not want you to crash your server so we displayed only the first 500 users', 'warning'); } $pageInfo->limit->value = 100; } jimport('joomla.html.pagination'); $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value); $filters = new stdClass(); $statusType = acymailing_get('type.statusfilter'); if (!empty($selectedList)) { $statusList = acymailing_get('type.statusfilterlist'); if (!$app->isAdmin()) { array_pop($statusList->values); } $filters->statuslist = $statusList->display('filter_statuslist', $selectedStatusList); } $listsType = acymailing_get('type.lists'); if ($app->isAdmin()) { $filters->lists = $listsType->display('filter_lists', $selectedList); $filters->status = $statusType->display('filter_status', $selectedStatus); } else { $listClass = acymailing_get('class.list'); $allLists = $listClass->getFrontendLists(); if (count($allLists) > 1) { $filters->lists = JHTML::_('select.genericlist', $allLists, "filter_lists", 'class="inputbox" size="1" onchange="document.adminForm.limitstart.value=0;document.adminForm.submit( );"', 'listid', 'name', (int) $selectedList, "filter_lists"); } else { $filters->lists = '<input type="hidden" name="filter_lists" value="' . $selectedList . '"/>'; } $filters->status = '<input type="hidden" name="filter_status" value="0"/>'; } if ($app->isAdmin()) { acymailing_setTitle(JText::_('USERS'), 'acyusers', 'subscriber'); $bar = JToolBar::getInstance('toolbar'); if (acymailing_isAllowed($config->get('acl_lists_filter', 'all'))) { $bar->appendButton('Acyactions'); JToolBarHelper::divider(); } if (acymailing_isAllowed($config->get('acl_subscriber_import', 'all'))) { $bar->appendButton('Link', 'import', JText::_('IMPORT'), acymailing_completeLink('data&task=import&filter_lists=' . $selectedList)); } if (acymailing_isAllowed($config->get('acl_subscriber_export', 'all'))) { JToolBarHelper::custom('export', 'acyexport', '', JText::_('ACY_EXPORT'), false); } JToolBarHelper::divider(); if (acymailing_isAllowed($config->get('acl_subscriber_manage', 'all'))) { JToolBarHelper::addNew(); } if (acymailing_isAllowed($config->get('acl_subscriber_manage', 'all'))) { JToolBarHelper::editList(); } if (acymailing_isAllowed($config->get('acl_subscriber_delete', 'all'))) { JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS', true)); } JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'subscriber-listing'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } } $lists = $listsType->getData(); $this->assignRef('lists', $lists); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('filters', $filters); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); $config = acymailing_config(); $this->assignRef('config', $config); $this->assignRef('displayFields', $displayFields); $this->assignRef('customFields', $customFields); }
function view(){ global $Itemid; $app = JFactory::getApplication(); $document = JFactory::getDocument(); $this->addFeed(); $pathway = $app->getPathway(); $my = JFactory::getUser(); $frontEndManagement = false; $listid = acymailing_getCID('listid'); $values = new stdClass(); $values->suffix = ''; $jsite = JFactory::getApplication('site'); $menus = $jsite->getMenu(); $menu = $menus->getActive(); if(empty($menu) AND !empty($Itemid)){ $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } if (is_object( $menu )) { jimport('joomla.html.parameter'); $menuparams = new acyParameter( $menu->params ); } if(!empty($menuparams)){ $values->suffix = $menuparams->get('pageclass_sfx',''); } if(empty($listid) && !empty($menuparams)){ $listid = $menuparams->get('listid'); if ($menuparams->get('menu-meta_description')) $document->setDescription($menuparams->get('menu-meta_description')); if ($menuparams->get('menu-meta_keywords')) $document->setMetadata('keywords',$menuparams->get('menu-meta_keywords')); if ($menuparams->get('robots')) $document->setMetadata('robots',$menuparams->get('robots')); if ($menuparams->get('page_title')) acymailing_setPageTitle($menuparams->get('page_title')); } $config = acymailing_config(); $indexFollow = $config->get('indexFollow', ''); $tagIndFol = array(); if(strpos($indexFollow, 'noindex') !== false) $tagIndFol[] = 'noindex'; if(strpos($indexFollow, 'nofollow') !== false) $tagIndFol[] = 'nofollow'; if(!empty($tagIndFol)) $document->setMetadata('robots',implode(',',$tagIndFol)); if(!empty($listid)){ $listClass = acymailing_get('class.list'); $oneList = $listClass->get($listid); if(!empty($oneList->visible) AND $oneList->published AND (empty($menuparams) || !$menuparams->get('listid'))){ $pathway->addItem($oneList->name,acymailing_completeLink('archive&listid='.$oneList->listid.':'.$oneList->alias)); } if(!empty($oneList->listid) AND acymailing_level(3)){ if(!empty($my->id) AND (int)$my->id == (int)$oneList->userid){ $frontEndManagement = true; } if(!empty($my->id)){ if($oneList->access_manage == 'all' OR acymailing_isAllowed($oneList->access_manage)){ $frontEndManagement = true; } } } } $mailid = JRequest::getString('mailid','nomailid'); if(empty($mailid)){ die('This is a Newsletter-template... and you can not access the online version of a Newsletter-template!<br />Please <a href="administrator/index.php?option=com_acymailing&ctrl=newsletter&task=edit" >create a Newsletter</a> using your template and then try again your "view it online" link!'); exit; } if($mailid == 'nomailid'){ $db = JFactory::getDBO(); $query = 'SELECT m.`mailid` FROM `#__acymailing_list` as l JOIN `#__acymailing_listmail` as lm ON l.listid=lm.listid JOIN `#__acymailing_mail` as m on lm.mailid = m.mailid'; $query .= ' WHERE l.`visible` = 1 AND l.`published` = 1 AND m.`visible`= 1 AND m.`published` = 1 AND m.`type` = "news" AND l.`type` = "list"'; if(!empty($listid)) $query .= ' AND l.`listid` = '.(int) $listid; $query .= ' ORDER BY m.`senddate` DESC, m.`mailid` DESC LIMIT 1'; $db->setQuery($query); $mailid = $db->loadResult(); } $mailid = intval($mailid); if(empty($mailid)) return JError::raiseError( 404, 'Newsletter not found'); $access_sub = true; if(acymailing_level(3)){ $listmail = acymailing_get('class.listmail'); $allLists = $listmail->getLists($mailid); $access_sub = false; if(!empty($allLists)){ foreach($allLists as $alist){ if(empty($alist->mailid)) continue; if(!$alist->published OR !$alist->visible OR $alist->access_sub == 'none') continue; if(acymailing_isAllowed($alist->access_sub)){ $access_sub = true; break; } } } } $mailClass = acymailing_get('helper.mailer'); $mailClass->loadedToSend = false; $oneMail = $mailClass->load($mailid); if(empty($oneMail->mailid)){ return JError::raiseError( 404, 'Newsletter not found : '.$mailid ); } if(!$frontEndManagement AND (!$access_sub OR !$oneMail->published OR !$oneMail->visible)){ $key = JRequest::getCmd('key'); if(empty($key) OR $key !== $oneMail->key){ $reason = (!$oneMail->published) ? 'Newsletter not published' : (!$oneMail->visible ? 'Newsletter not visible' : (!$access_sub ? 'Access not allowed' : '')); $app->enqueueMessage('You can not have access to this e-mail : '.$reason,'error'); $app->redirect(acymailing_completeLink('lists',false,true)); return false; } } $fshare = ''; if(preg_match('#<img[^>]*id="pictshare"[^>]*>#i',$oneMail->body,$pregres) && preg_match('#src="([^"]*)"#i',$pregres[0],$pict)){ $fshare = $pict[1]; }elseif(preg_match('#<img[^>]*class="[^"]*pictshare[^"]*"[^>]*>#i',$oneMail->body,$pregres) && preg_match('#src="([^"]*)"#i',$pregres[0],$pict)){ $fshare = $pict[1]; }elseif(preg_match('#class="acymailing_content".*(<img[^>]*>)#is',$oneMail->body,$pregres) && preg_match('#src="([^"]*)"#i',$pregres[1],$pict)){ if(strpos($pregres[1],JText::_('JOOMEXT_READ_MORE')) === false) $fshare = $pict[1]; } if(!empty($fshare)){ $document->setMetadata('og:image', $fshare); } $document->setMetadata('og:url',acymailing_frontendLink('index.php?option=com_acymailing&ctrl=archive&task=view&mailid='.$oneMail->mailid,JRequest::getCmd('tmpl') == 'component' ? true : false)); $document->setMetadata('og:title',$oneMail->subject); if(!empty($oneMail->metadesc))$document->setMetadata('og:description',$oneMail->metadesc); $subkeys = JRequest::getString('subid',JRequest::getString('sub')); if(!empty($subkeys)){ $db = JFactory::getDBO(); $subid = intval(substr($subkeys,0,strpos($subkeys,'-'))); $subkey = substr($subkeys,strpos($subkeys,'-')+1); $db->setQuery('SELECT * FROM '.acymailing_table('subscriber').' WHERE `subid` = '.$db->Quote($subid).' AND `key` = '.$db->Quote($subkey).' LIMIT 1'); $receiver = $db->loadObject(); } if(empty($receiver) AND !empty($my->email)){ $userClass = acymailing_get('class.subscriber'); $receiver = $userClass->get($my->email); } if(empty($receiver)){ $receiver = new stdClass(); $receiver->name = JText::_('VISITOR'); } $oneMail->sendHTML = true; $mailClass->dispatcher->trigger('acymailing_replaceusertags',array(&$oneMail,&$receiver,false)); $pathway->addItem($oneMail->subject); $document = JFactory::getDocument(); acymailing_setPageTitle($oneMail->subject); if (!empty($oneMail->metadesc)) { $document->setDescription( $oneMail->metadesc ); } if (!empty($oneMail->metakey)) { $document->setMetadata('keywords', $oneMail->metakey); } $this->assignRef('mail',$oneMail); $this->assignRef('frontEndManagement',$frontEndManagement); $this->assignRef('list',$oneList); $config =& acymailing_config(); $this->assignRef('config',$config); $this->assignRef('my',$my); $this->assignRef('receiver',$receiver); $this->assignRef('values',$values); if($oneMail->html){ $templateClass = acymailing_get('class.template'); $templateClass->archiveSection = true; $templateClass->displayPreview('newsletter_preview_area',$oneMail->tempid,$oneMail->subject); } }
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 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 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); $testreceiverType = acymailing_get('type.testreceiver'); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $infos = new stdClass(); $infos->test_selection = $app->getUserStateFromRequest($paramBase . ".test_selection", 'test_selection', '', 'string'); $infos->test_group = $app->getUserStateFromRequest($paramBase . ".test_group", 'test_group', '', 'string'); $infos->test_emails = $app->getUserStateFromRequest($paramBase . ".test_emails", 'test_emails', '', 'string'); $infos->test_html = $app->getUserStateFromRequest($paramBase . ".test_html", 'test_html', 1, 'int'); if ($app->isAdmin()) { 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(); } if (acymailing_isAllowed($config->get('acl_' . $this->aclCat . '_spam_test', 'all'))) { if (acymailing_level(1)) { $height = 638; $width = 1000; } else { $height = 50; $width = 600; } $bar->appendButton('Acypopup', 'spamtest', JText::_('SPAM_TEST'), "index.php?option=com_acymailing&ctrl=send&task=spamtest&tmpl=component&mailid=" . $mailid, $width, $height); } JToolBarHelper::custom('edit', 'edit', '', JText::_('ACY_EDIT'), false); JToolBarHelper::cancel('cancel', JText::_('ACY_CLOSE')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', $this->doc); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } } $this->assignRef('lists', $lists); $this->assignRef('infos', $infos); $this->assignRef('testreceiverType', $testreceiverType); $this->assignRef('mail', $mail); if ($mail->html) { $templateClass = acymailing_get('class.template'); if (!empty($mail->tempid)) { $templateClass->createTemplateFile($mail->tempid); } $templateClass->displayPreview('newsletter_preview_area', $mail->tempid, $mail->subject); } }
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 display($tpl = null) { global $Itemid; $db = JFactory::getDBO(); $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author'; $siteEmail = $app->getCfg('mailfrom'); $jsite = JFactory::getApplication('site'); $menus = $jsite->getMenu(); $menu = $menus->getActive(); $listed = array(); if (empty($menu) and !empty($Itemid)) { $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } $myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid; $selectedLists = 'all'; if (is_object($menu)) { jimport('joomla.html.parameter'); $menuparams = new acyParameter($menu->params); $selectedLists = $menuparams->get('lists', 'all'); } $listsClass = acymailing_get('class.list'); $allLists = $listsClass->getLists('listid', $selectedLists); foreach ($allLists as $oneList) { if ($oneList->published && $oneList->visible && acymailing_isAllowed($oneList->access_sub)) { $listed[] = $oneList->listid; } } $config = acymailing_config(); $filters = array(); $filters[] = 'a.type = \'news\''; $filters[] = 'a.published = 1'; $filters[] = 'a.visible = 1'; $filters[] = 'c.listid IN (' . implode(',', $listed) . ')'; $query = 'SELECT a.*,c.listid'; $query .= ' FROM ' . acymailing_table('listmail') . ' as c'; $query .= ' LEFT JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid '; $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; $query .= ' GROUP BY a.mailid ORDER BY a.' . $config->get('acyrss_order', 'senddate') . ' ' . ($config->get('acyrss_order', 'senddate') == 'subject' ? 'ASC' : 'DESC'); $query .= ' LIMIT ' . $config->get('acyrss_element', '20'); $db->setQuery($query); $rows = $db->loadObjectList(); $doc->title = $config->get('acyrss_name', ''); $doc->description = $config->get('acyrss_description', ''); $receiver = new stdClass(); $receiver->name = JText::_('VISITOR'); $receiver->subid = 0; $mailClass = acymailing_get('helper.mailer'); $mailClass->loadedToSend = false; foreach ($rows as $row) { $oneMail = $mailClass->load($row->mailid); $oneMail->sendHTML = true; $mailClass->dispatcher->trigger('acymailing_replaceusertags', array(&$oneMail, &$receiver, false)); $title = $this->escape($oneMail->subject); $title = html_entity_decode($title); $oneList = $allLists[$row->listid]; $link = JRoute::_('index.php?option=com_acymailing&ctrl=archive&task=view&listid=' . $oneList->listid . '-' . $oneList->alias . '&mailid=' . $row->mailid . '-' . $row->alias); $description = $oneMail->body; $author = $oneMail->userid; $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $description; $item->date = acymailing_getDate($oneMail->senddate, '%Y-%m-%d %H:%M:%S'); $item->category = JText::_('NEWSLETTER'); $doc->addItem($item); } }
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(acymailing_level(3)){ $fieldsClass = acymailing_get('class.fields'); $this->assignRef('fieldsClass',$fieldsClass); $extraFields = $fieldsClass->getFields('backend',$subscriber); $this->assignRef('extraFields',$extraFields); $doc = JFactory::getDocument(); $js = $fieldsClass->prepareConditionalDisplay($extraFields, 'data[subscriber]', 'userProfile'); if(!empty($js)) $doc->addScriptDeclaration($js); } if(!empty($subid) && acymailing_level(2)){ if($app->isAdmin() && acymailing_isAllowed($config->get('acl_newsletters_send','all'))){ $bar->appendButton( 'Acypopup', 'acysend', JText::_('SEND'), "index.php?option=com_acymailing&ctrl=send&task=addqueue&tmpl=component&subid=".$subid); JToolBarHelper::divider(); } $query = 'SELECT a.date, a.mailid, b.subject, b.alias, a.urlid, a.click, c.name as urlname, c.url'; $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'; $query .= ' WHERE a.subid = '.intval($subid).' ORDER BY a.date DESC LIMIT 30'; $db->setQuery($query); $clicks = $db->loadObjectList(); $this->assignRef('clicks',$clicks); } 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 onlyAllowedLists($lists) { $my = JFactory::getUser(); $newLists = array(); foreach ($lists as $id => $oneList) { if (!$oneList->published) { continue; } if (!acymailing_isAllowed($oneList->access_sub)) { continue; } $newLists[$id] = $oneList; } return $newLists; }
echo $app->isAdmin() ? 'class="acymailing_table"' : 'class="adminlist"'; ?> cellspacing="10" cellpadding="10" align="center" id="importdata"> <?php if ($noHeader || !isset($this->lines[1])) { $firstValueLine = $columnNames; } else { $firstValueLine = explode($this->separator, $this->lines[1]); foreach ($firstValueLine as &$oneValue) { $oneValue = trim($oneValue, '\'" '); } } $fieldAssignment = array(); $fieldAssignment[] = JHTML::_('select.option', "0", '- - -'); $fieldAssignment[] = JHTML::_('select.option', "1", JText::_('ACY_IGNORE')); if (acymailing_isAllowed($this->config->get('acl_extra_fields_import', 'all'))) { $createField = JHTML::_('select.option', "2", JText::_('ACY_CREATE_FIELD')); if (!acymailing_level(3)) { $createField->disable = true; $createField->text .= ' (' . JText::_('ONLY_FROM_ENTERPRISE') . ')'; } $fieldAssignment[] = $createField; } $separator = JHTML::_('select.option', "3", '-------------------------------------'); $separator->disable = true; $fieldAssignment[] = $separator; $fields = array_keys(acymailing_getColumns('#__acymailing_subscriber')); $fields[] = 'listids'; $fields[] = 'listname'; foreach ($fields as $oneField) { $fieldAssignment[] = JHTML::_('select.option', $oneField, $oneField);
function display($selected = '') { if (!ACYMAILING_J16) { $doc = JFactory::getDocument(); $doc->addStyleDeclaration(" #submenu-box{display:none !important;} "); } $selected = substr($selected, 0, 5); if ($selected == 'field' || $selected == 'bounc' || $selected == 'updat') { $selected = 'cpane'; } if ($selected == 'data' || $selected == 'data&') { $selected = 'subsc'; } if ($selected == 'campa' || $selected == 'templ' || $selected == 'auton') { $selected = 'newsl'; } if ($selected == 'diagr') { $selected = 'stats'; } if ($selected == 'filte') { $selected = 'list'; } $config = acymailing_config(); $mainmenu = array(); $submenu = array(); if (acymailing_isAllowed($config->get('acl_subscriber_manage', 'all'))) { $mainmenu['subscriber'] = array(JText::_('USERS'), 'index.php?option=com_acymailing&ctrl=subscriber', 'acyicon-16-users'); $submenu['subscriber'] = array(); $submenu['subscriber'][] = array(JText::_('USERS'), 'index.php?option=com_acymailing&ctrl=subscriber', 'acyicon-16-users'); if (acymailing_isAllowed($config->get('acl_subscriber_import', 'all'))) { $submenu['subscriber'][] = array(JText::_('IMPORT'), 'index.php?option=com_acymailing&ctrl=data&task=import', 'acyicon-16-import'); } if (acymailing_isAllowed($config->get('acl_subscriber_export', 'all'))) { $submenu['subscriber'][] = array(JText::_('ACY_EXPORT'), 'index.php?option=com_acymailing&ctrl=data&task=export', 'acyicon-16-export'); } } if (acymailing_isAllowed($config->get('acl_lists_manage', 'all'))) { $mainmenu['list'] = array(JText::_('LISTS'), 'index.php?option=com_acymailing&ctrl=list', 'acyicon-16-acylist'); $submenu['list'] = array(); $submenu['list'][] = array(JText::_('LISTS'), 'index.php?option=com_acymailing&ctrl=list', 'acyicon-16-acylist'); if (acymailing_isAllowed($config->get('acl_lists_filter', 'all'))) { $submenu['list'][] = array(JText::_('ACY_FILTERS'), 'index.php?option=com_acymailing&ctrl=filter', 'acyicon-16-filter'); } } if (acymailing_isAllowed($config->get('acl_newsletters_manage', 'all'))) { $mainmenu['newsletter'] = array(JText::_('NEWSLETTERS'), 'index.php?option=com_acymailing&ctrl=newsletter', 'acyicon-16-newsletter'); $submenu['newsletter'] = array(); $submenu['newsletter'][] = array(JText::_('NEWSLETTERS'), 'index.php?option=com_acymailing&ctrl=newsletter', 'acyicon-16-newsletter'); if (acymailing_level(2) && acymailing_isAllowed($config->get('acl_autonewsletters_manage', 'all'))) { $submenu['newsletter'][] = array(JText::_('AUTONEWSLETTERS'), 'index.php?option=com_acymailing&ctrl=autonews', 'acyicon-16-autonewsletter'); } if (acymailing_level(3) && acymailing_isAllowed($config->get('acl_campaign_manage', 'all'))) { $submenu['newsletter'][] = array(JText::_('CAMPAIGN'), 'index.php?option=com_acymailing&ctrl=campaign', 'acyicon-16-campaign'); } if (acymailing_isAllowed($config->get('acl_templates_manage', 'all'))) { $submenu['newsletter'][] = array(JText::_('ACY_TEMPLATES'), 'index.php?option=com_acymailing&ctrl=template', 'acyicon-16-template'); } } if (acymailing_isAllowed($config->get('acl_queue_manage', 'all'))) { $mainmenu['queue'] = array(JText::_('QUEUE'), 'index.php?option=com_acymailing&ctrl=queue', 'acyicon-16-queue'); } if (acymailing_isAllowed($config->get('acl_statistics_manage', 'all'))) { $mainmenu['stats'] = array(JText::_('STATISTICS'), 'index.php?option=com_acymailing&ctrl=stats', 'acyicon-16-stats'); $submenu['stats'] = array(); $submenu['stats'][] = array(JText::_('STATISTICS'), 'index.php?option=com_acymailing&ctrl=stats', 'acyicon-16-stats'); $submenu['stats'][] = array(JText::_('DETAILED_STATISTICS'), 'index.php?option=com_acymailing&ctrl=stats&task=detaillisting', 'acyicon-16-stats'); if (acymailing_level(1)) { $submenu['stats'][] = array(JText::_('CLICK_STATISTICS'), 'index.php?option=com_acymailing&ctrl=statsurl', 'acyicon-16-stats'); } if (acymailing_level(1)) { $submenu['stats'][] = array(JText::_('CHARTS'), 'index.php?option=com_acymailing&ctrl=diagram', 'acyicon-16-stats'); } } if (acymailing_isAllowed($config->get('acl_configuration_manage', 'all')) && (!ACYMAILING_J16 || JFactory::getUser()->authorise('core.admin', 'com_acymailing'))) { $mainmenu['cpanel'] = array(JText::_('CONFIGURATION'), 'index.php?option=com_acymailing&ctrl=cpanel', 'acyicon-16-config'); $submenu['cpanel'] = array(); $submenu['cpanel'][] = array(JText::_('CONFIGURATION'), 'index.php?option=com_acymailing&ctrl=cpanel', 'acyicon-16-config'); if (acymailing_level(3)) { $submenu['cpanel'][] = array(JText::_('EXTRA_FIELDS'), 'index.php?option=com_acymailing&ctrl=fields', 'acyicon-16-fields'); $submenu['cpanel'][] = array(JText::_('BOUNCE_HANDLING'), 'index.php?option=com_acymailing&ctrl=bounces', 'acyicon-16-bounces'); } if (acymailing_level(1)) { $submenu['cpanel'][] = array(JText::_('JOOMLA_NOTIFICATIONS'), 'index.php?option=com_acymailing&ctrl=notification', 'acyicon-16-joomlanotification'); } $submenu['cpanel'][] = array(JText::_('UPDATE_ABOUT'), 'index.php?option=com_acymailing&ctrl=update', 'acyicon-16-update'); } $doc = JFactory::getDocument(); $doc->addStyleSheet(ACYMAILING_CSS . 'acymenu.css?v=' . str_replace('.', '', $config->get('version'))); if (!ACYMAILING_J30) { $menu = '<div id="acymenutop" class="donotprint"><ul>'; foreach ($mainmenu as $id => $oneMenu) { $menu .= '<li class="acymainmenu' . (!empty($submenu[$id]) ? ' parentmenu' : ' singlemenu') . '"'; if ($selected == substr($id, 0, 5)) { $menu .= ' id="acyselectedmenu"'; } $menu .= ' >'; $menu .= '<a class="acymainmenulink ' . $oneMenu[2] . '" href="' . $oneMenu[1] . '" >' . $oneMenu[0] . '</a>'; if (!empty($submenu[$id])) { $menu .= '<ul>'; foreach ($submenu[$id] as $subelement) { $menu .= '<li class="acysubmenu "><a class="acysubmenulink ' . $subelement[2] . '" href="' . $subelement[1] . '" title="' . $subelement[0] . '">' . $subelement[0] . '</a></li>'; } $menu .= '</ul>'; } $menu .= '</li>'; } $menu .= '</ul></div><div style="clear:left"></div>'; } else { $menu = '<div id="acynavbar" class="navbar"><div class="navbar-inner" style="display:block !important;"><div class="container"><div class="nav"><ul id="acymenutop_j3" class="nav">'; foreach ($mainmenu as $id => $oneMenu) { $sel = ''; if ($selected == substr($id, 0, 5)) { $sel = ' sel'; } $menu .= '<li class="dropdown' . $sel . '"><a class="dropdown-toggle' . $sel . '" ' . (!empty($submenu[$id]) ? 'data-toggle="dropdown"' : '') . ' href="' . (!empty($submenu[$id]) ? '#' : $oneMenu[1]) . '"><i class="' . $oneMenu[2] . '"></i> ' . $oneMenu[0] . (!empty($submenu[$id]) ? '<span class="caret"></span>' : '') . '</a>'; if (!empty($submenu[$id])) { $menu .= '<ul class="dropdown-menu">'; foreach ($submenu[$id] as $subelement) { $menu .= '<li class="acysubmenu "><a class="acysubmenulink" href="' . $subelement[1] . '" title="' . $subelement[0] . '"><i class="' . $subelement[2] . '"></i> ' . $subelement[0] . '</a></li>'; } $menu .= '</ul>'; } $menu .= '</li>'; } $menu .= '</ul></div></div></div></div>'; } return $menu; }
function isAllowed($cat, $action) { if (acymailing_level(3)) { $config = acymailing_config(); if (!acymailing_isAllowed($config->get('acl_' . $cat . '_' . $action, 'all'))) { acymailing_display(JText::_('ACY_NOTALLOWED'), 'error'); return false; } } return true; }
function listing() { $app = JFactory::getApplication(); $config = acymailing_config(); $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(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.ordering', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', '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)); $selectedCreator = $app->getUserStateFromRequest($paramBase . "filter_creator", 'filter_creator', 0, 'int'); $selectedCategory = $app->getUserStateFromRequest($paramBase . "filter_category", 'filter_category', 0, 'string'); $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[] = "a.name LIKE {$searchVal} OR a.description LIKE {$searchVal} OR a.listid LIKE {$searchVal}"; } $filters[] = "a.type = 'list'"; if (!empty($selectedCreator)) { $filters[] = 'a.userid = ' . $selectedCreator; } if (!empty($selectedCategory)) { $filters[] = 'a.category = ' . $database->Quote($selectedCategory); } $query = 'SELECT a.*, d.name as creatorname, d.username, d.email'; $query .= ' FROM ' . acymailing_table('list') . ' as a'; $query .= ' LEFT JOIN ' . acymailing_table('users', false) . ' as d on a.userid = d.id'; $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.listid) FROM ' . acymailing_table('list') . ' as a'; if (!empty($pageInfo->search)) { $queryCount .= ' LEFT JOIN ' . acymailing_table('users', false) . ' as d on a.userid = d.id'; } $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')'; $database->setQuery($queryCount); $pageInfo->elements->total = $database->loadResult(); $listids = array(); foreach ($rows as $oneRow) { $listids[] = $oneRow->listid; } $subscriptionresults = array(); if (!empty($listids)) { $querySubscription = 'SELECT count(subid) as total,listid,status FROM ' . acymailing_table('listsub') . ' WHERE listid IN (' . implode(',', $listids) . ') GROUP BY listid, status'; $database->setQuery($querySubscription); $countresults = $database->loadObjectList(); foreach ($countresults as $oneResult) { $subscriptionresults[$oneResult->listid][intval($oneResult->status)] = $oneResult->total; } } foreach ($rows as $i => $oneRow) { $rows[$i]->nbsub = intval(@$subscriptionresults[$oneRow->listid][1]); $rows[$i]->nbunsub = intval(@$subscriptionresults[$oneRow->listid][-1]); $rows[$i]->nbwait = intval(@$subscriptionresults[$oneRow->listid][2]); } $pageInfo->elements->page = count($rows); jimport('joomla.html.pagination'); $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value); acymailing_setTitle(JText::_('LISTS'), 'acylist', 'list'); $bar = JToolBar::getInstance('toolbar'); if (acymailing_isAllowed($config->get('acl_lists_filter', 'all'))) { $bar->appendButton('Link', 'filter', JText::_('ACY_FILTERS'), acymailing_completeLink('filter')); JToolBarHelper::divider(); } if (acymailing_isAllowed($config->get('acl_lists_manage', 'all'))) { JToolBarHelper::addNew(); } if (acymailing_isAllowed($config->get('acl_lists_manage', 'all'))) { JToolBarHelper::editList(); } if (acymailing_isAllowed($config->get('acl_lists_delete', 'all'))) { JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS')); } JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'list-listing'); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard')); } $order = new stdClass(); $order->ordering = false; $order->orderUp = 'orderup'; $order->orderDown = 'orderdown'; $order->reverse = false; if ($pageInfo->filter->order->value == 'a.ordering') { $order->ordering = true; if ($pageInfo->filter->order->dir == 'desc') { $order->orderUp = 'orderdown'; $order->orderDown = 'orderup'; $order->reverse = true; } } $filters = new stdClass(); $listcreatorType = acymailing_get('type.listcreator'); $filters->creator = $listcreatorType->display('filter_creator', $selectedCreator); $listcategoryType = acymailing_get('type.categoryfield'); $filters->category = $listcategoryType->getFilter('list', 'filter_category', $selectedCategory, ' onchange="document.adminForm.submit();"'); $this->assignRef('filters', $filters); $this->assignRef('order', $order); $toggleClass = acymailing_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $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'); 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); }
echo '<span class="acyblocktitle">' . $name . '</span>'; include dirname(__FILE__) . DS . $div . '.php'; echo '</div>'; } ?> </div> <div class="<?php echo $this->isAdmin ? 'acyblockoptions' : 'onelineblockoptions'; ?> " id="importlists"> <span class="acyblocktitle"><?php echo JText::_('SUBSCRIPTION'); ?> </span> <?php if (acymailing_isAllowed($this->config->get('acl_lists_manage', 'all'))) { ?> <table class="acymailing_table" cellpadding="1"> <tr class="<?php echo "row1"; ?> " id="importcreatelist"> <td colspan="2"> <?php echo JText::_('IMPORT_SUBSCRIBE_CREATE') . ' : <input type="text" name="createlist" placeholder="' . JText::_('LIST_NAME') . '" />'; ?> </td> </tr> </table> <?php }
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 display($selected = '') { $doc = JFactory::getDocument(); if (!ACYMAILING_J16) { $doc->addStyleDeclaration(" #submenu-box{display:none !important;} "); } $js = "function acyToggleClass(id,myclass){\r\n\t\t\telem = document.getElementById(id);\r\n\t\t\tif(elem.className.search(myclass) < 0){\r\n\r\n\t\t\t\tvar elements = document.querySelectorAll('.mainelement');\r\n\r\n\t\t\t\tfor(var i = 0; i < elements.length;i++){\r\n\t\t\t\t\telements[i].className = elements[i].className.replace('opened','');\r\n\t\t\t\t}\r\n\t\t\t\telem.className += ' '+myclass;\r\n\t\t\t\tif(myclass == 'iconsonly') sessionStorage.setItem('acyclosedmenu', '1');\r\n\t\t\t}else{\r\n\t\t\t\telem.className = elem.className.replace(' '+myclass,'');\r\n\t\t\t\tif(myclass == 'iconsonly') sessionStorage.setItem('acyclosedmenu', '0');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\twindow.addEvent('domready', function(){\r\n\t\t\tvar isClosed = sessionStorage.getItem('acyclosedmenu');\r\n\t\t\tif(isClosed == 1) acyToggleClass('acyallcontent', 'iconsonly');\r\n\t\t});\r\n\r\n\t\tfunction acyAddClass(id,myclass){\r\n\t\t\telem = document.getElementById(id);\r\n\t\t\tif(elem.className.search(myclass)>=0) return;\r\n\t\t\telem.className += ' '+myclass;\r\n\t\t}\r\n\r\n\t\tfunction acyRemoveClass(id,myclass){\r\n\t\t\telem = document.getElementById(id);\r\n\t\t\telem.className = elem.className.replace(' '+myclass,'');\r\n\t\t}\r\n\t\t"; $app = JFactory::getApplication(); if ($app->isAdmin()) { $doc->addScript(ACYMAILING_JS . 'acytoolbar.js?v=' . filemtime(ACYMAILING_MEDIA . 'js' . DS . 'acytoolbar.js')); } $doc->addScriptDeclaration($js); $selected = substr($selected, 0, 5); if ($selected == 'data' || $selected == 'data&' || $selected == 'field' || $selected == 'filte') { $selected = 'subsc'; } if ($selected == 'campa' || $selected == 'templ' || $selected == 'auton' || $selected == 'notif') { $selected = 'newsl'; } if ($selected == 'diagr') { $selected = 'stats'; } $config = acymailing_config(); $mainmenu = array(); $submenu = array(); if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) { $mainmenu['dashboard'] = array(JText::_('ACY_CPANEL'), 'index.php?option=com_acymailing', 'acyicon-dashboard'); } if (acymailing_isAllowed($config->get('acl_subscriber_manage', 'all'))) { $mainmenu['subscriber'] = array(JText::_('USERS'), 'index.php?option=com_acymailing&ctrl=subscriber', 'acyicon-user'); $submenu['subscriber'] = array(); $submenu['subscriber'][] = array(JText::_('USERS'), 'index.php?option=com_acymailing&ctrl=subscriber', 'acyicon-user'); if (acymailing_isAllowed($config->get('acl_subscriber_import', 'all'))) { $submenu['subscriber'][] = array(JText::_('IMPORT'), 'index.php?option=com_acymailing&ctrl=data&task=import', 'acyicon-import'); } if (acymailing_isAllowed($config->get('acl_subscriber_export', 'all'))) { $submenu['subscriber'][] = array(JText::_('ACY_EXPORT'), 'index.php?option=com_acymailing&ctrl=data&task=export', 'acyicon-export'); } if (acymailing_isAllowed($config->get('acl_configuration_manage', 'all')) && (!ACYMAILING_J16 || JFactory::getUser()->authorise('core.admin', 'com_acymailing'))) { $submenu['subscriber'][] = array(JText::_('EXTRA_FIELDS'), 'index.php?option=com_acymailing&ctrl=fields', 'acyicon-custom-field'); } if (acymailing_isAllowed($config->get('acl_lists_filter', 'all'))) { $submenu['subscriber'][] = array(JText::_('ACY_MASS_ACTIONS'), 'index.php?option=com_acymailing&ctrl=filter', 'acyicon-filter'); } } if (acymailing_isAllowed($config->get('acl_lists_manage', 'all'))) { $mainmenu['list'] = array(JText::_('LISTS'), 'index.php?option=com_acymailing&ctrl=list', 'acyicon-list'); } if (acymailing_isAllowed($config->get('acl_newsletters_manage', 'all'))) { $mainmenu['newsletter'] = array(JText::_('NEWSLETTERS'), 'index.php?option=com_acymailing&ctrl=newsletter', 'acyicon-newsletter'); $submenu['newsletter'] = array(); $submenu['newsletter'][] = array(JText::_('NEWSLETTERS'), 'index.php?option=com_acymailing&ctrl=newsletter', 'acyicon-newsletter'); if (acymailing_level(2) && acymailing_isAllowed($config->get('acl_autonewsletters_manage', 'all'))) { $submenu['newsletter'][] = array(JText::_('AUTONEWSLETTERS'), 'index.php?option=com_acymailing&ctrl=autonews', 'acyicon-autonewsletter'); } if (acymailing_level(3) && acymailing_isAllowed($config->get('acl_campaign_manage', 'all'))) { $submenu['newsletter'][] = array(JText::_('CAMPAIGN'), 'index.php?option=com_acymailing&ctrl=campaign', 'acyicon-campaign'); } if (acymailing_level(1) && acymailing_isAllowed($config->get('acl_configuration_manage', 'all')) && (!ACYMAILING_J16 || JFactory::getUser()->authorise('core.admin', 'com_acymailing'))) { $submenu['newsletter'][] = array(JText::_('JOOMLA_NOTIFICATIONS'), 'index.php?option=com_acymailing&ctrl=notification', 'acyicon-joomla'); } if (acymailing_isAllowed($config->get('acl_templates_manage', 'all'))) { $submenu['newsletter'][] = array(JText::_('ACY_TEMPLATES'), 'index.php?option=com_acymailing&ctrl=template', 'acyicon-template'); } } if (acymailing_isAllowed($config->get('acl_queue_manage', 'all'))) { $mainmenu['queue'] = array(JText::_('QUEUE'), 'index.php?option=com_acymailing&ctrl=queue', 'acyicon-queue'); } if (acymailing_isAllowed($config->get('acl_statistics_manage', 'all'))) { $mainmenu['stats'] = array(JText::_('STATISTICS'), 'index.php?option=com_acymailing&ctrl=stats', 'acyicon-statistic'); $submenu['stats'] = array(); $submenu['stats'][] = array(JText::_('STATISTICS'), 'index.php?option=com_acymailing&ctrl=stats', 'acyicon-statistic'); $submenu['stats'][] = array(JText::_('DETAILED_STATISTICS'), 'index.php?option=com_acymailing&ctrl=stats&task=detaillisting', 'acyicon-detailed-stat'); if (acymailing_level(1)) { $submenu['stats'][] = array(JText::_('CLICK_STATISTICS'), 'index.php?option=com_acymailing&ctrl=statsurl', 'acyicon-click'); } if (acymailing_level(1)) { $submenu['stats'][] = array(JText::_('CHARTS'), 'index.php?option=com_acymailing&ctrl=diagram', 'acyicon-chart'); } } if (acymailing_isAllowed($config->get('acl_configuration_manage', 'all')) && (!ACYMAILING_J16 || JFactory::getUser()->authorise('core.admin', 'com_acymailing'))) { $mainmenu['cpanel'] = array(JText::_('ACY_CONFIGURATION'), 'index.php?option=com_acymailing&ctrl=cpanel', 'acyicon-configuration'); $mainmenu['bounce'] = array(JText::_('BOUNCE_HANDLING'), 'index.php?option=com_acymailing&ctrl=bounces', 'acyicon-bounce'); } $doc = JFactory::getDocument(); $doc->addStyleSheet(ACYMAILING_CSS . 'acymenu.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'acymenu.css')); $menu = '<div id="acymenu_leftside" class="donotprint acyaffix-top">'; $menu .= '<div class="acymenu_slide"><span onclick="acyToggleClass(\'acyallcontent\',\'iconsonly\');"><i class="acyicon-open-close"></i></span></div>'; $menu .= '<div class="acymenu_mainmenus">'; $menu .= '<ul>'; foreach ($mainmenu as $id => $oneMenu) { $sel = ''; if ($selected == substr($id, 0, 5)) { $sel = ' sel opened'; } $menu .= '<li class="mainelement' . $sel . '" id="mainelement' . $id . '"><span onclick="acyToggleClass(\'mainelement' . $id . '\',\'opened\');"><a ' . (!empty($submenu[$id]) ? 'href="#" onclick="return false;"' : 'href="' . $oneMenu[1] . '"') . ' ><i class="' . $oneMenu[2] . '"></i><span class="subtitle">' . $oneMenu[0] . '</span>' . (!empty($submenu[$id]) ? '<i class="acyicon-down"></i>' : '') . '</a></span>'; if (!empty($submenu[$id])) { $menu .= '<ul>'; foreach ($submenu[$id] as $subelement) { $menu .= '<li class="acysubmenu" ><a class="acysubmenulink" href="' . $subelement[1] . '" title="' . $subelement[0] . '"><i class="' . $subelement[2] . '"></i><span>' . $subelement[0] . '</span></a></li>'; } $menu .= '</ul>'; } $menu .= '</li>'; } $menu .= '<li class="mainelement" id="mainelementmyacymailing">'; $menu .= '<div id="myacymailingarea">'; //DO NOT CHANGE THIS ID! we use it for ajax things... $menu .= $this->myacymailingarea(); $menu .= '</div>'; //End of acymailing myacymailingarea $menu .= '</li>'; $menu .= '</ul>'; $menu .= '</div>'; //end of acymenu_mainmenus $menu .= '</div>'; //end of acymenu_leftside return $menu; }
function display($tpl = null) { global $Itemid; $db = JFactory::getDBO(); $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $jsite = JFactory::getApplication('site'); $menus = $jsite->getMenu(); $menu = $menus->getActive(); if (empty($menu) and !empty($Itemid)) { $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } $myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid; if (is_object($menu)) { jimport('joomla.html.parameter'); $menuparams = new acyParameter($menu->params); } $listid = acymailing_getCID('listid'); if (empty($listid) and !empty($menuparams)) { $listid = $menuparams->get('listid'); } $doc->link = acymailing_completeLink('archive&listid=' . intval($listid)); $listClass = acymailing_get('class.list'); if (empty($listid)) { return JError::raiseError(404, 'Mailing List not found'); } $oneList = $listClass->get($listid); if (empty($oneList->listid)) { return JError::raiseError(404, 'Mailing List not found : ' . $listid); } if (!acymailing_isAllowed($oneList->access_sub) || !$oneList->published || !$oneList->visible) { return JError::raiseError(404, JText::_('ACY_NOTALLOWED')); } $config = acymailing_config(); $filters = array(); $filters[] = 'a.type = \'news\''; $filters[] = 'a.published = 1'; $filters[] = 'a.visible = 1'; $filters[] = 'c.listid = ' . $oneList->listid; $query = 'SELECT a.*'; $query .= ' FROM ' . acymailing_table('listmail') . ' as c'; $query .= ' LEFT JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid '; $query .= ' WHERE (' . implode(') AND (', $filters) . ')'; $query .= ' ORDER BY a.' . $config->get('acyrss_order', 'senddate') . ' ' . ($config->get('acyrss_order', 'senddate') == 'subject' ? 'ASC' : 'DESC'); $query .= ' LIMIT ' . $config->get('acyrss_element', '20'); $db->setQuery($query); $rows = $db->loadObjectList(); $doc->title = $config->get('acyrss_name', ''); $doc->description = $config->get('acyrss_description', ''); $receiver = new stdClass(); $receiver->name = JText::_('VISITOR'); $receiver->subid = 0; $mailClass = acymailing_get('helper.mailer'); foreach ($rows as $row) { $mailClass->loadedToSend = false; $oneMail = $mailClass->load($row->mailid); $oneMail->sendHTML = true; $mailClass->dispatcher->trigger('acymailing_replaceusertags', array(&$oneMail, &$receiver, false)); $title = $this->escape($oneMail->subject); $title = html_entity_decode($title); $link = JRoute::_('index.php?option=com_acymailing&ctrl=archive&task=view&listid=' . $oneList->listid . '-' . $oneList->alias . '&mailid=' . $row->mailid . '-' . $row->alias); $author = $oneMail->userid; $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $oneMail->body; $item->date = $oneMail->created; $item->category = $oneMail->type; $item->author = $author; $doc->addItem($item); } }
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); }
<tr> <td class="paramlist_key"> <?php echo JText::_('REPLYTO_ADDRESS'); ?> </td> <td class="paramlist_value"> <input onchange="validateEmail(this.value, '<?php echo addslashes(JText::_('REPLYTO_ADDRESS')); ?> ')" placeholder="<?php echo JText::_('USE_DEFAULT_VALUE'); ?> " class="inputbox" type="text" id="replyemail" name="data[mail][replyemail]" style="width:200px" value="<?php echo $this->escape($this->mail->replyemail); ?> " /> </td> </tr> </table> <?php echo acymailing_getFunctionsEmailCheck(); echo $this->tabs->endPanel(); $this->config = acymailing_config(); if (acymailing_level(3) && acymailing_isAllowed($this->config->get('acl_newsletters_inbox_actions', 'all')) && JPluginHelper::isEnabled('acymailing', 'plginboxactions')) { include ACYMAILING_BACK . 'views' . DS . 'newsletter' . DS . 'tmpl' . DS . 'inboxactions.php'; } echo $this->tabs->endPane(); ?> </div>