Exemple #1
0
 function remove()
 {
     if (!$this->isAllowed($this->aclCat, 'delete')) {
         return;
     }
     JRequest::checkToken() or die('Invalid Token');
     $mailid = JRequest::getVar('filter_mail', 0, 'post', 'int');
     $queueClass = acymailing::get('class.queue');
     $search = JRequest::getString('search');
     $filters = array();
     if (!empty($search)) {
         $db = JFactory::getDBO();
         $searchVal = '\'%' . $db->getEscaped($search, true) . '%\'';
         $searchFields = array('b.name', 'b.email', 'c.subject', 'a.mailid', 'a.subid');
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchFields) . " LIKE {$searchVal}";
     }
     if (!empty($mailid)) {
         $filters[] = 'a.mailid = ' . intval($mailid);
     }
     $total = $queueClass->delete($filters);
     $app =& JFactory::getApplication();
     $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $total), 'message');
     JRequest::setVar('filter_mail', 0, 'post');
     JRequest::setVar('search', '', 'post');
     return $this->listing();
 }
    function acymailingtagmodule_show()
    {
        ?>

<script language="javascript" type="text/javascript">
		<!--
			function insertModule(id){
				tagString = '{module:'+id;
				if(window.document.getElementById('jflang')  && window.document.getElementById('jflang').value != ''){
					tagString += '|lang:';
					tagString += window.document.getElementById('jflang').value;
				}
				tagString += '}';
				setTag(tagString);
				insertTag();
			}
		//-->
</script>
	<?php 
        $jflanguages = acymailing::get('type.jflanguages');
        echo $jflanguages->display('lang');
        $excludedModules = array('mod_poll', 'mod_login', 'mod_breadcrumbs', 'mod_acymailing', 'mod_wrapper');
        $text = '<table class="adminlist" cellpadding="1" width="100%">';
        $db =& JFactory::getDBO();
        $db->setQuery('SELECT id, title, position, module FROM #__modules WHERE `module` NOT IN (\'' . implode('\',\'', $excludedModules) . '\') ORDER BY `position`,`ordering`');
        $modules = $db->loadObjectList();
        $k = 0;
        foreach ($modules as $oneModule) {
            $text .= '<tr style="cursor:pointer" class="row' . $k . '" onclick="insertModule(\'' . $oneModule->id . '\');" ><td>' . $oneModule->title . '</td><td nowrap="nowrap" width="60px">' . $oneModule->module . '</td><td nowrap="nowrap" width="40px">' . $oneModule->position . '</td></tr>';
            $k = 1 - $k;
        }
        $text .= '</table>';
        echo $text;
    }
 /**
  * Event "onNewsletterSubscribe"
  * 
  * @access private
  * @param null
  * @return int
  */
 public function onNewsletterSubscribe($user, $state)
 {
     if ($this->isEnabled() == false) {
         return false;
     }
     $list_id = $this->getParams()->get('newsletter');
     if (empty($list_id)) {
         return true;
     }
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, '/') . '/components/com_acymailing/helpers/helper.php')) {
         return false;
     }
     // See if the user exists in the database
     $acyUser = null;
     $acyUser->email = $user->email;
     $acyUser->name = $user->name;
     $acyUser->userid = $user->id;
     $subscriberClass = acymailing::get('class.subscriber');
     $subscriberClass->checkVisitor = false;
     $subid = $subscriberClass->save($acyUser);
     if (empty($subid)) {
         return false;
     }
     $newSubscription = array();
     $newList = array();
     $newList['status'] = $state == 0 ? 0 : 1;
     $newSubscription[intval($list_id)] = $newList;
     $subscriberClass->saveSubscription($subid, $newSubscription);
     return true;
 }
Exemple #4
0
 function saveStats()
 {
     $subid = JRequest::getInt('subid');
     $mailid = JRequest::getInt('mailid');
     if (empty($subid) or empty($mailid)) {
         return false;
     }
     $db = JFactory::getDBO();
     $db->setQuery('SELECT open FROM ' . acymailing::table('userstats') . ' WHERE mailid = ' . $mailid . ' AND subid = ' . $subid . ' LIMIT 1');
     $actual = $db->loadObject();
     if (empty($actual)) {
         return false;
     }
     $open = 0;
     if (empty($actual->open)) {
         $open = 1;
         $unique = ',openunique = openunique +1';
     } elseif ($this->countReturn) {
         $open = $actual->open + 1;
         $unique = '';
     }
     if (empty($open)) {
         return true;
     }
     $db->setQuery('UPDATE ' . acymailing::table('userstats') . ' SET open = ' . $open . ', opendate = ' . time() . ' WHERE mailid = ' . $mailid . ' AND subid = ' . $subid . ' LIMIT 1');
     $db->query();
     $db->setQuery('UPDATE ' . acymailing::table('stats') . ' SET opentotal = opentotal +1 ' . $unique . ' WHERE mailid = ' . $mailid . ' LIMIT 1');
     $db->query();
     if (!empty($subid)) {
         $filterClass = acymailing::get('class.filter');
         $filterClass->subid = $subid;
         $filterClass->trigger('opennews');
     }
     return true;
 }
Exemple #5
0
 function insert($subid, $action, $data = array())
 {
     $user =& JFactory::getUser();
     if (!empty($user->id)) {
         $data[] = 'EXECUTED_BY::' . $user->id . ' ( ' . $user->username . ' )';
     }
     $history = null;
     $history->subid = intval($subid);
     $history->action = strip_tags($action);
     $history->data = implode("\n", $data);
     $history->date = time();
     $userHelper = acymailing::get('helper.user');
     $history->ip = $userHelper->getIP();
     if (!empty($_SERVER)) {
         $source = array();
         $vars = array('HTTP_REFERER', 'HTTP_USER_AGENT', 'HTTP_HOST', 'SERVER_ADDR', 'REMOTE_ADDR', 'REQUEST_URI', 'QUERY_STRING');
         foreach ($vars as $oneVar) {
             if (!empty($_SERVER[$oneVar])) {
                 $source[] = $oneVar . '::' . strip_tags($_SERVER[$oneVar]);
             }
         }
         $history->source = implode("\n", $source);
     }
     return $this->database->insertObject(acymailing::table('history'), $history);
 }
Exemple #6
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_acymailing' . DS . 'helpers' . DS . 'helper.php';
     $listType = acymailing::get('type.lists');
     array_shift($listType->values);
     return $listType->display($control_name . '[listid]', (int) $value, false);
 }
Exemple #7
0
 function listing()
 {
     JRequest::setVar('tmpl', 'component');
     $statsClass = acymailing::get('class.stats');
     $statsClass->saveStats();
     header('Cache-Control: no-store, no-cache, must-revalidate');
     header('Cache-Control: post-check=0, pre-check=0', false);
     header('Pragma: no-cache');
     ob_end_clean();
     JPluginHelper::importPlugin('acymailing');
     $this->dispatcher =& JDispatcher::getInstance();
     $results = $this->dispatcher->trigger('acymailing_getstatpicture');
     $picture = reset($results);
     if (empty($picture)) {
         $picture = 'components/com_acymailing/images/statpicture.png';
     }
     $picture = ltrim(str_replace(array('\\', '/'), DS, $picture), DS);
     $imagename = ACYMAILING_ROOT . $picture;
     $handle = fopen($imagename, 'r');
     if (!$handle) {
         exit;
     }
     header("Content-type: image/png");
     $contents = fread($handle, filesize($imagename));
     fclose($handle);
     echo $contents;
     exit;
 }
Exemple #8
0
 function addClick($urlid, $mailid, $subid)
 {
     $mailid = intval($mailid);
     $urlid = intval($urlid);
     $subid = intval($subid);
     if (empty($mailid) or empty($urlid) or empty($subid)) {
         return false;
     }
     $statsClass = acymailing::get('class.stats');
     $statsClass->countReturn = false;
     if (!$statsClass->saveStats()) {
         return false;
     }
     $date = time();
     $query = 'INSERT IGNORE INTO ' . acymailing::table('urlclick') . ' (urlid,mailid,subid,date,click) VALUES (' . $urlid . ',' . $mailid . ',' . $subid . ',' . $date . ',1)';
     $this->database->setQuery($query);
     $this->database->query();
     if (!$this->database->getAffectedRows()) {
         $query = 'UPDATE ' . acymailing::table('urlclick') . ' SET click = click +1,`date` = ' . $date . ' WHERE mailid = ' . $mailid . ' AND urlid = ' . $urlid . ' AND subid = ' . $subid . ' LIMIT 1';
         $this->database->setQuery($query);
         $this->database->query();
     }
     $query = 'SELECT SUM(click) FROM ' . acymailing::table('urlclick') . ' WHERE mailid = ' . $mailid . ' AND subid = ' . $subid;
     $this->database->setQuery($query);
     $totalUserClick = $this->database->loadResult();
     $query = 'UPDATE ' . acymailing::table('stats') . ' SET clicktotal = clicktotal + 1 ';
     if ($totalUserClick <= 1) {
         $query .= ' , clickunique = clickunique + 1';
     }
     $query .= ' WHERE mailid = ' . $mailid . ' LIMIT 1';
     $this->database->setQuery($query);
     $this->database->query();
     return true;
 }
Exemple #9
0
 function send()
 {
     JRequest::checkToken() or die('Invalid Token');
     $bodyEmail = JRequest::getString('mailbody');
     $code = JRequest::getString('code');
     JRequest::setVar('code', $code);
     if (empty($code)) {
         return;
     }
     $config = acymailing::config();
     $mailer = acymailing::get('helper.mailer');
     $mailer->Subject = '[ACYMAILING LANGUAGE FILE] ' . $code;
     $mailer->Body = 'The website ' . ACYMAILING_LIVE . ' using AcyMailing ' . $config->get('level') . $config->get('version') . ' sent a language file : ' . $code;
     $mailer->Body .= "\n" . "\n" . "\n" . $bodyEmail;
     $user = JFactory::getUser();
     $mailer->AddAddress($user->email, $user->name);
     $mailer->AddAddress('*****@*****.**', 'Acyba Translation Team');
     $mailer->report = false;
     jimport('joomla.filesystem.file');
     $path = JPath::clean(JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini');
     $mailer->AddAttachment($path);
     $result = $mailer->Send();
     if ($result) {
         acymailing::display(JText::_('THANK_YOU_SHARING'), 'success');
         acymailing::display($mailer->reportMessage, 'success');
     } else {
         acymailing::display($mailer->reportMessage, 'error');
     }
 }
Exemple #10
0
 function generate()
 {
     $app =& JFactory::getApplication();
     $autoNewsHelper = acymailing::get('helper.autonews');
     if (!$autoNewsHelper->generate()) {
         $app->enqueueMessage(JText::_('NO_AUTONEWS'), 'notice');
         $db =& JFactory::getDBO();
         $db->setQuery("SELECT * FROM " . acymailing::table('mail') . " WHERE `type` = 'autonews'");
         $allAutonews = $db->loadObjectList();
         if (!empty($allAutonews)) {
             $time = time();
             foreach ($allAutonews as $oneAutonews) {
                 if ($oneAutonews->published != 1) {
                     $app->enqueueMessage(JText::sprintf('AUTONEWS_NOT_PUBLISHED', $oneAutonews->subject), 'notice');
                 } elseif ($oneAutonews->senddate >= $time) {
                     $app->enqueueMessage(JText::sprintf('AUTONEWS_NOT_READY', $oneAutonews->subject), 'notice');
                 }
             }
         }
     } else {
         foreach ($autoNewsHelper->messages as $oneMessage) {
             $app->enqueueMessage($oneMessage);
         }
     }
     return $this->listing();
 }
Exemple #11
0
 function getInput()
 {
     include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_acymailing' . DS . 'helpers' . DS . 'helper.php';
     $listType = acymailing::get('type.lists');
     array_shift($listType->values);
     return $listType->display($this->name, (int) $this->value, false);
 }
Exemple #12
0
 function queue($mailid, $time, $onlyNew = false)
 {
     $mailid = intval($mailid);
     if (empty($mailid)) {
         return false;
     }
     $classLists = acymailing::get('class.listmail');
     $lists = $classLists->getReceivers($mailid, false);
     if (empty($lists)) {
         return 0;
     }
     $config = acymailing::config();
     $querySelect = 'SELECT DISTINCT a.subid,' . $mailid . ',' . $time . ',' . (int) $config->get('priority_newsletter', 3);
     $querySelect .= ' FROM ' . acymailing::table('listsub') . ' as a ';
     $querySelect .= 'LEFT JOIN ' . acymailing::table('subscriber') . ' as b ON a.subid = b.subid ';
     $querySelect .= 'WHERE b.enabled = 1 AND b.accept = 1 ';
     $querySelect .= 'AND a.listid IN (' . implode(',', array_keys($lists)) . ') AND a.status = 1 ';
     $config = acymailing::config();
     if ($config->get('require_confirmation', '0')) {
         $querySelect .= 'AND b.confirmed = 1 ';
     }
     $query = 'INSERT IGNORE INTO ' . acymailing::table('queue') . ' (subid,mailid,senddate,priority) ' . $querySelect;
     $this->database->setQuery($query);
     if (!$this->database->query()) {
         acymailing::display($this->database->ErrorMsg(), 'error');
     }
     $totalinserted = $this->database->getAffectedRows();
     if ($onlyNew) {
         $this->database->setQuery('DELETE b.* FROM `#__acymailing_userstats` as a LEFT JOIN `#__acymailing_queue` as b on a.subid = b.subid WHERE a.mailid = ' . $mailid);
         $this->database->query();
         $totalinserted = $totalinserted - $this->database->getAffectedRows();
     }
     return $totalinserted;
 }
Exemple #13
0
 function test()
 {
     if (!$this->isAllowed('configuration', 'manage')) {
         return;
     }
     $app =& JFactory::getApplication();
     $this->store();
     $config = acymailing::config();
     $user =& JFactory::getUser();
     $mailClass = acymailing::get('helper.mailer');
     $addedName = $config->get('add_names', true) ? $mailClass->cleanText($user->name) : '';
     $mailClass->AddAddress($user->email, $addedName);
     $mailClass->Subject = 'Test e-mail from ' . ACYMAILING_LIVE;
     $mailClass->Body = JText::_('TEST_EMAIL');
     $mailClass->SMTPDebug = 1;
     $result = $mailClass->send();
     if (!$result) {
         $bounce = $config->get('bounce_email');
         if (!empty($bounce)) {
             $app->enqueueMessage(JText::sprintf('ADVICE_BOUNCE', $bounce), 'notice');
         } elseif ($config->get('mailer_method') == 'smtp' and !$config->get('smtp_auth') and strlen($config->get('smtp_password')) > 1) {
             $app->enqueueMessage(JText::_('ADVICE_SMTP_AUTH'), 'notice');
         } elseif ((strpos(ACYMAILING_LIVE, 'localhost') or strpos(ACYMAILING_LIVE, '127.0.0.1')) and $config->get('mailer_method') != 'smtp') {
             $app->enqueueMessage(JText::_('ADVICE_LOCALHOST'), 'notice');
         }
     }
     return $this->display();
 }
Exemple #14
0
 function export()
 {
     $listClass = acymailing::get('class.list');
     $db =& JFactory::getDBO();
     $fields = reset($db->getTableFields(acymailing::table('subscriber')));
     acymailing::setTitle(JText::_('ACY_EXPORT'), 'acyexport', 'data&task=export');
     $bar =& JToolBar::getInstance('toolbar');
     JToolBarHelper::custom('doexport', 'acyexport', '', JText::_('ACY_EXPORT'), false);
     $bar->appendButton('Link', 'cancel', JText::_('ACY_CANCEL'), acymailing::completeLink('subscriber'));
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'data-export');
     $this->assignRef('charset', $charsetType = acymailing::get('type.charset'));
     $this->assignRef('lists', $listClass->getLists());
     $this->assignRef('fields', $fields);
     if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) {
         $i = 1;
         $subids = array();
         foreach ($_SESSION['acymailing']['exportusers'] as $subid) {
             $subids[] = (int) $subid;
             $i++;
             if ($i > 10) {
                 break;
             }
         }
         $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . implode(',', $subids) . ')');
         $users = $db->loadObjectList();
         $this->assignRef('users', $users);
     }
 }
Exemple #15
0
 function view()
 {
     $statsClass = acymailing::get('class.stats');
     $statsClass->countReturn = false;
     $statsClass->saveStats();
     JRequest::setVar('layout', 'view');
     return parent::display();
 }
Exemple #16
0
 function acymailing_replaceusertags(&$email, &$user, $addbody = true)
 {
     if (!$email->sendHTML) {
         return;
     }
     $email->body = preg_replace('#< *(tr|td|table)([^>]*)(style="[^"]*)background-image *: *url\\(\'?([^)\']*)\'?\\);?#Ui', '<$1 background="$4" $2 $3', $email->body);
     $email->body = acymailing::absoluteURL($email->body);
     $email->body = preg_replace('#< *img([^>]*)(style="[^"]*)(float *: *)(right|left|top|bottom|middle)#Ui', '<img$1 align="$4" hspace="5" $2$3$4', $email->body);
     if (empty($email->tempid)) {
         return;
     }
     if (!isset($this->templates[$email->tempid])) {
         $this->templates[$email->tempid] = array();
         if (empty($this->templateClass)) {
             $this->templateClass = acymailing::get('class.template');
         }
         $template = $this->templateClass->get($email->tempid);
         if (!empty($template->stylesheet)) {
             $this->stylesheets[$email->tempid] = $template->stylesheet;
         }
         if (!empty($template->styles)) {
             foreach ($template->styles as $class => $style) {
                 if (preg_match('#^tag_(.*)$#', $class, $result)) {
                     $this->tags[$email->tempid]['#< *' . $result[1] . '((?:(?!style).)*)>#Ui'] = '<' . $result[1] . ' style="' . $style . '" $1>';
                 } elseif ($class == 'color_bg') {
                     $this->others[$email->tempid][$class] = $style;
                 } else {
                     $this->templates[$email->tempid]['class="' . $class . '"'] = 'style="' . $style . '"';
                 }
             }
         }
     }
     if ($addbody and !strpos($email->body, '</body>')) {
         $before = '<html><head>' . "\n";
         $before .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $this->config->get('charset') . '">' . "\n";
         $before .= '<title>' . $email->subject . '</title>' . "\n";
         $before .= '</head>' . "\n" . '<body';
         if (!empty($this->others[$email->tempid]['color_bg'])) {
             $before .= ' bgcolor="' . $this->others[$email->tempid]['color_bg'] . '" ';
         }
         $before .= '>' . "\n";
         $email->body = $before . $email->body . '</body>' . "\n" . '</html>';
     }
     if (!empty($this->templates[$email->tempid])) {
         $email->body = str_replace(array_keys($this->templates[$email->tempid]), $this->templates[$email->tempid], $email->body);
     }
     if (!empty($this->tags[$email->tempid])) {
         $email->body = preg_replace(array_keys($this->tags[$email->tempid]), $this->tags[$email->tempid], $email->body);
     }
     if (!empty($this->stylesheets[$email->tempid]) and class_exists('Emogrifier')) {
         $emogrifier = new Emogrifier($email->body, $this->stylesheets[$email->tempid]);
         $email->body = $emogrifier->emogrify();
         if (!$addbody and strpos($email->body, '<!DOCTYPE') !== false) {
             $email->body = preg_replace('#<\\!DOCTYPE.*<body([^>]*)>#Usi', '', $email->body);
             $email->body = preg_replace('#</body>.*$#si', '', $email->body);
         }
     }
 }
Exemple #17
0
 function massremove()
 {
     JRequest::checkToken() or die('Invalid Token');
     $importHelper = acymailing::get('helper.import');
     if (!$importHelper->mass(false)) {
         return $this->addusers();
     }
     $this->setRedirect(acymailing::completeLink('list', false, true));
 }
Exemple #18
0
 function bounceHelper()
 {
     $this->config = acymailing::config();
     $this->mailer = acymailing::get('helper.mailer');
     $this->mailer->report = false;
     $this->subClass = acymailing::get('class.subscriber');
     $this->listsubClass = acymailing::get('class.listsub');
     $this->listsubClass->checkAccess = false;
     $this->db =& JFactory::getDBO();
 }
Exemple #19
0
 function remove()
 {
     JRequest::checkToken() or die('Invalid Token');
     $cids = JRequest::getVar('cid', array(), '', 'array');
     $class = acymailing::get('class.stats');
     $num = $class->delete($cids);
     $app =& JFactory::getApplication();
     $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $num), 'message');
     return $this->listing();
 }
Exemple #20
0
 function cron()
 {
     $cronHelper = acymailing::get('helper.cron');
     $cronHelper->report = true;
     $launched = $cronHelper->cron();
     if ($launched) {
         $cronHelper->report();
     }
     exit;
 }
 function listing()
 {
     if (!acymailing_level(3)) {
         $acyToolbar = acymailing::get('helper.toolbar');
         $acyToolbar->setTitle(JText::_('BOUNCE_HANDLING'), 'bounces');
         $acyToolbar->display();
         acymailing_display(JText::_('ACY_BOUNCE_AVAILABLE') . '<br /><br /><a target="_blank" href="' . ACYMAILING_REDIRECT . 'acymailing-features">' . JText::_('ACY_FEATURES') . '</a>', 'info');
         return;
     }
     return parent::listing();
 }
 function listing()
 {
     if (!acymailing_level(3)) {
         $acyToolbar = acymailing::get('helper.toolbar');
         $acyToolbar->setTitle(JText::_('EXTRA_FIELDS'), 'fields');
         $acyToolbar->display();
         acymailing_display(JText::_('ACY_CUSTOMFIELDS_UPGRADE') . '<br /><br /><a target="_blank" href="' . ACYMAILING_REDIRECT . 'acymailing-features">' . JText::_('ACY_FEATURES') . '</a>', 'info');
         return;
     }
     return parent::listing();
 }
 function remove()
 {
     JRequest::checkToken() or die('Invalid Token');
     $subscriberIds = JRequest::getVar('cid', array(), '', 'array');
     $subscriberObject = acymailing::get('class.subscriber');
     $num = $subscriberObject->delete($subscriberIds);
     $app =& JFactory::getApplication();
     $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $num), 'message');
     JRequest::setVar('layout', 'listing');
     return parent::display();
 }
Exemple #24
0
 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');
 }
Exemple #25
0
 function save()
 {
     JRequest::checkToken() or die('Invalid Token');
     $class = acymailing::get('class.url');
     $status = $class->saveForm();
     if ($status) {
         acymailing::display(JText::_('JOOMEXT_SUCC_SAVED'), 'success');
         return true;
     } else {
         acymailing::display(JText::_('ERROR_SAVING'), 'success');
     }
     return $this->edit();
 }
Exemple #26
0
 function filterType()
 {
     $db =& JFactory::getDBO();
     $types = array('group', 'list', 'acymailingfield', 'joomlafield');
     $this->type = array();
     $this->type[] = JHTML::_('select.option', '', JText::_('FILTER_SELECT'));
     $this->type[] = JHTML::_('select.option', 'group', JText::_('GROUP'));
     $this->type[] = JHTML::_('select.option', 'list', JText::_('ACYMAILING_LIST'));
     $this->type[] = JHTML::_('select.option', 'acymailingfield', JText::_('ACYMAILING_FIELD'));
     $this->type[] = JHTML::_('select.option', 'joomlafield', JText::_('JOOMLA_FIELD'));
     $tables = $db->getTableList();
     if (in_array($db->getPrefix() . 'comprofiler', $tables)) {
         $this->type[] = JHTML::_('select.option', 'cbfield', JText::_('CB_FIELD'));
         $types[] = 'cbfield';
         $fields = reset($db->getTableFields($db->getPrefix() . 'comprofiler'));
         $this->cbfield = array();
         foreach ($fields as $oneField => $fieldType) {
             $this->cbfield[] = JHTML::_('select.option', $oneField, $oneField);
         }
     }
     if (acymailing::level(3)) {
         include dirname(__FILE__) . DS . 'filterenterprise.php';
     }
     $acl =& JFactory::getACL();
     $this->groups = $acl->get_group_children_tree(null, 'USERS', false);
     $list = acymailing::get('class.list');
     $lists = $list->getLists();
     $this->lists = array();
     foreach ($lists as $oneList) {
         $this->lists[] = JHTML::_('select.option', $oneList->listid, $oneList->name);
     }
     $fields = reset($db->getTableFields(acymailing::table('subscriber')));
     $this->acymailingfields = array();
     foreach ($fields as $oneField => $fieldType) {
         $this->acymailingfields[] = JHTML::_('select.option', $oneField, $oneField);
     }
     $fields = reset($db->getTableFields(acymailing::table('users', false)));
     $this->joomlafields = array();
     foreach ($fields as $oneField => $fieldType) {
         $this->joomlafields[] = JHTML::_('select.option', $oneField, $oneField);
     }
     $doc =& JFactory::getDocument();
     $js = "function updateFilter(filterNum){";
     foreach ($types as $oneType) {
         $js .= "filterArea = 'filter_'+filterNum+'{$oneType}';\r\r\n\t\t\t\tif(window.document.getElementById(filterArea)){window.document.getElementById(filterArea).style.display = 'none';}";
     }
     $js .= "filterArea = 'filter_'+filterNum+window.document.getElementById('filtertype'+filterNum).value;\r\r\n\t\t\t\tif(window.document.getElementById(filterArea)){window.document.getElementById(filterArea).style.display = 'block';}\r\r\n\t\t\t}";
     $doc->addScriptDeclaration($js);
     $this->operators = acymailing::get('type.operators');
     $this->status = acymailing::get('type.statusfilterlist');
 }
Exemple #27
0
 function display($tpl = null)
 {
     global $Itemid;
     $db =& JFactory::getDBO();
     $app =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $params =& $app->getParams();
     $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author';
     $siteEmail = $app->getCfg('mailfrom');
     $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 JParameter($menu->params);
     }
     $listid = acymailing::getCID('listid');
     if (empty($listid) and !empty($menuparams)) {
         $listid = $menuparams->get('listid');
     }
     $document->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'));
     }
     $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.senddate DESC, c.mailid DESC';
     $db->setQuery($query, 0, $app->getCfg('feed_limit'));
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
     }
 }
Exemple #28
0
 function install()
 {
     $newConfig = null;
     $newConfig->installcomplete = 1;
     $config = acymailing::config();
     $config->save($newConfig);
     $updateHelper = acymailing::get('helper.update');
     $updateHelper->initList();
     $updateHelper->installNotifications();
     $updateHelper->installTemplates();
     $updateHelper->installMenu();
     $updateHelper->installExtensions();
     $this->_iframe(ACYMAILING_UPDATEURL . 'install');
 }
Exemple #29
0
 function click()
 {
     $urlid = JRequest::getInt('urlid');
     $mailid = JRequest::getInt('mailid');
     $subid = JRequest::getInt('subid');
     $urlClass = acymailing::get('class.url');
     $urlObject = $urlClass->get($urlid);
     if (empty($urlObject->urlid)) {
         return JError::raiseError(404, JText::_('Page not found'));
     }
     $urlClickClass = acymailing::get('class.urlclick');
     $urlClickClass->addClick($urlObject->urlid, $mailid, $subid);
     $this->setRedirect($urlObject->url);
 }
Exemple #30
0
 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);
         //-1 is unsubscribe
         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() && $this->checkAccess && $allResults[$listid]->access_sub != 'all') {
                     $gid = (empty($my->id) or empty($my->gid)) ? $this->gid : $my->gid;
                     if ($allResults[$listid]->access_sub == 'none' or empty($gid)) {
                         continue;
                     }
                     if (!in_array($gid, explode(',', $allResults[$listid]->access_sub))) {
                         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;
 }