Пример #1
0
 function continuesend()
 {
     $config = acymailing_config();
     if (acymailing_level(1) && $config->get('queue_type') == 'onlyauto') {
         JRequest::setVar('tmpl', 'component');
         acymailing_display(JText::_('ACY_ONLYAUTOPROCESS'), 'warning');
         return;
     }
     $newcrontime = time() + 120;
     if ($config->get('cron_next') < $newcrontime) {
         $newValue = new stdClass();
         $newValue->cron_next = $newcrontime;
         $config->save($newValue);
     }
     $mailid = acymailing_getCID('mailid');
     $totalSend = JRequest::getVar('totalsend', 0, '', 'int');
     $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int');
     $helperQueue = acymailing_get('helper.queue');
     $helperQueue->mailid = $mailid;
     $helperQueue->report = true;
     $helperQueue->total = $totalSend;
     $helperQueue->start = $alreadySent;
     $helperQueue->pause = $config->get('queue_pause');
     $helperQueue->process();
     JRequest::setVar('tmpl', 'component');
 }
Пример #2
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);
 }
Пример #3
0
		function getInput() {

			$listType = acymailing_get('type.lists');
			array_shift($listType->values);

			return $listType->display($this->name,(int) $this->value,false);
		}
Пример #4
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 = '\'%' . acymailing_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();
 }
Пример #5
0
 function insert($subid, $action, $data = array(), $mailid = 0)
 {
     $user =& JFactory::getUser();
     if (!empty($user->id)) {
         $data[] = 'EXECUTED_BY::' . $user->id . ' ( ' . $user->username . ' )';
     }
     $history = new stdClass();
     $history->subid = intval($subid);
     $history->action = strip_tags($action);
     $history->data = implode("\n", $data);
     if (strlen($history->data) > 100000) {
         $history->data = substr($history->data, 0, 10000);
     }
     $history->date = time();
     $history->mailid = $mailid;
     $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);
 }
Пример #6
0
 function test()
 {
     if (!$this->isAllowed('configuration', 'manage')) {
         return;
     }
     $app =& JFactory::getApplication();
     $this->store();
     acymailing_displayErrors();
     $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 ($config->get('mailer_method') == 'smtp' && $config->get('smtp_secured') == 'ssl' && !function_exists('openssl_sign')) {
             $app->enqueueMessage('The PHP Extension openssl is not enabled on your server, this extension is required to use an SSL connection, please enable it', 'notice');
         } elseif (!empty($bounce) and !in_array($config->get('mailer_method'), array('smtp', 'smtp_com', 'elasticemail'))) {
             $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 in_array($config->get('mailer_method'), array('sendmail', 'qmail', 'mail'))) {
             $app->enqueueMessage(JText::_('ADVICE_LOCALHOST'), 'notice');
         }
     }
     return $this->display();
 }
Пример #7
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;
 }
Пример #8
0
	public function onBeforeMailPrepare(&$mail, &$mailer, &$do){
		if(empty($mail->mail_name)) return false;
		require_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');
		$alias_email = 'hikashop-'.str_replace('_', '-', $mail->mail_name);
		$mailClass = acymailing_get('class.mail');
		$overrideEmail = $mailClass->get($alias_email);
		if(empty($overrideEmail) || $overrideEmail->published == 0) return false;

		$acymailer = acymailing_get('helper.acymailer');
		$acymailer->checkConfirmField = false;
		$acymailer->checkEnabled = false;
		$acymailer->checkAccept = false;
		$acymailer->autoAddUser = true;
		$acymailer->report = false;
		$acymailer->trackEmail = true;

		foreach($mail->data as $dataName => $dataValue){
			if(is_string($dataValue)){
				$acymailer->addParam($dataName, $dataValue);
			} else{
				foreach($dataValue as $dataSName => $dataSValue){
					if(is_string($dataSValue)) $acymailer->addParam($dataName.'_'.$dataSName, $dataSValue);
				}
			}
		}

		$statusSend = $acymailer->sendOne($overrideEmail->mailid, $mail->data->email);
		$app = JFactory::getApplication();
		if(!$statusSend) $app->enqueueMessage(nl2br($acymailer->reportMessage), 'error');
		$mail->mail_success = $statusSend;

		$do = false;
		return $statusSend;
	}
Пример #9
0
 public function Process()
 {
     // Newsletter component disabled or not found. Aborting.
     if (!$this->enabled) {
         return true;
     }
     $config = acymailing_config();
     // Build subscriber object
     $subscriber = new stdClass();
     // Name field may be absent. AcyMailing will guess the user's name from his email address
     $subscriber->name = isset($this->FieldsBuilder->Fields['sender0']) ? $this->FieldsBuilder->Fields['sender0']['Value'] : "";
     // AcyMailing refuses to save the user (return false) if the email address is empty, so we don't care to check it
     $subscriber->email = empty($this->FieldsBuilder->Fields['sender1']['Value']) ? NULL : JMailHelper::cleanAddress($this->FieldsBuilder->Fields['sender1']['Value']);
     // It seems that $subscriber->confirmed defaults to unconfirmed if unset, so we need to read and pass the actual value from the configuration
     //ADRIEN : not necessary, you should keep the user as unconfirmed, Acy will take care of that
     //$subscriber->confirmed = !(bool)$config->get('require_confirmation');
     $userClass = acymailing_get('class.subscriber');
     $userClass->checkVisitor = false;
     // Add or update the user
     $sub_id = $userClass->save($subscriber);
     if (empty($sub_id)) {
         // User save failed. Probably email address is empty or invalid
         $this->logger->Write(get_class($this) . " Process(): User save failed");
         return true;
     }
     // Lists
     $cumulative = JRequest::getVar("acymailing_subscribe_cumulative", NULL, "POST");
     $checkboxes = array(FAcyMailing::subscribe => JRequest::getVar("acymailing_subscribe", array(), "POST"));
     $lists = $cumulative ? $checkboxes : array();
     // Subscription
     //$listsubClass = acymailing_get('class.listsub');
     //$listsubClass->addSubscription($sub_id, $lists);
     // ADRIEN : we use an other function so Acy will check the subscription and only subscribe the user if he was not already subscribed to that list.
     /*
     $newSubscription = array();
     if(!empty($lists)){
     foreach($lists[FAcyMailing::subscribe] as $listId){
     $newList = array();
     $newList['status'] = FAcyMailing::subscribe;
     $newSubscription[$listId] = $newList;
     }
     $userClass->saveSubscription($sub_id, $newSubscription);
     }
     */
     // When in mode "one checkbox for each list" and no lists selected the code above produce an SQL error because passes an empty array to saveSubscription()
     $newSubscription = array();
     foreach ($lists[FAcyMailing::subscribe] as $listId) {
         $newList = array();
         $newList['status'] = FAcyMailing::subscribe;
         $newSubscription[$listId] = $newList;
     }
     if (!empty($newSubscription)) {
         $userClass->saveSubscription($sub_id, $newSubscription);
     }
     // implode() doesn't accept NULL values :(
     @$lists[FAcyMailing::subscribe] or $lists[FAcyMailing::subscribe] = array();
     // Log
     $this->logger->Write(get_class($this) . " Process(): subscribed " . $this->FieldsBuilder->Fields['sender0']['Value'] . " (" . $this->FieldsBuilder->Fields['sender1']['Value'] . ") to lists " . implode(",", $lists[FAcyMailing::subscribe]));
     return true;
 }
Пример #10
0
 function listing()
 {
     $app = JFactory::getApplication();
     global $Itemid;
     $config = acymailing_config();
     $jsite = JFactory::getApplication('site');
     $menus = $jsite->getMenu();
     $menu = $menus->getActive();
     if (empty($menu) and !empty($Itemid)) {
         $menus->setActive($Itemid);
         $menu = $menus->getItem($Itemid);
     }
     if (empty($menu)) {
         acymailing_enqueueMessage(JText::_('ACY_NOTALLOWED'));
         $app->redirect('index.php');
     }
     $selectedLists = 'all';
     if (is_object($menu)) {
         jimport('joomla.html.parameter');
         $menuparams = new acyParameter($menu->params);
         $this->assign('listsintrotext', $menuparams->get('listsintrotext'));
         $this->assign('listsfinaltext', $menuparams->get('listsfinaltext'));
         $selectedLists = $menuparams->get('lists', 'all');
         $document = JFactory::getDocument();
         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'));
         }
     }
     if (empty($menuparams)) {
         $pathway = $app->getPathway();
         $pathway->addItem(JText::_('MAILING_LISTS'));
     }
     $document = JFactory::getDocument();
     $link = '&format=feed&limitstart=';
     if ($config->get('acyrss_format') == 'rss' || $config->get('acyrss_format') == 'both') {
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
     }
     if ($config->get('acyrss_format') == 'atom' || $config->get('acyrss_format') == 'both') {
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     }
     $listsClass = acymailing_get('class.list');
     $allLists = $listsClass->getLists('', $selectedLists);
     if (acymailing_level(1)) {
         $allLists = $listsClass->onlyCurrentLanguage($allLists);
     }
     $myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid;
     $this->assignRef('rows', $allLists);
     $this->assignRef('item', $myItem);
 }
Пример #11
0
 function listing()
 {
     $app = JFactory::getApplication();
     $config = acymailing_config();
     if (!class_exists('plgSystemAcymailingClassMail')) {
         $app->enqueueMessage('AcyMailing can customize some Joomla messages. If you want to do this, please first <a href="index.php?option=com_acymailing&ctrl=cpanel">enable the plugin acymailingclassmail</a>', 'notice');
     }
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'mailid', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $db = JFactory::getDBO();
     $query = 'SELECT mailid, subject, alias, fromname, published, fromname, fromemail, replyname, replyemail FROM #__acymailing_mail WHERE `type` = ' . $db->Quote($this->type);
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     acymailing_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::custom('preview', 'acypreview', '', JText::_('ACY_PREVIEW'), true);
     JToolBarHelper::editList();
     JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS'));
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', $this->doc);
     $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     $toggleClass = acymailing_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assign('config', $config);
     $this->assign('rows', $rows);
 }
Пример #12
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');
     header("Expires: Wed, 17 Sep 1975 21:32:10 GMT");
     ob_end_clean();
     JPluginHelper::importPlugin('acymailing');
     $this->dispatcher = JDispatcher::getInstance();
     $results = $this->dispatcher->trigger('acymailing_getstatpicture');
     $picture = reset($results);
     if (empty($picture)) {
         $picture = 'media/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;
 }
Пример #13
0
 function onAfterRender()
 {
     if (empty($this->urlid)) {
         return;
     }
     $urlClass = acymailing_get('class.url');
     $urlClass->saveCurrentUrlName($this->urlid);
 }
Пример #14
0
 function getInput()
 {
     $listType = acymailing_get('type.lists');
     if (empty($this->element['menu']) || (string) $this->element['menu'] != 'archive') {
         array_shift($listType->values);
     }
     return $listType->display($this->name, (int) $this->value, false);
 }
Пример #15
0
 function view()
 {
     $statsClass = acymailing_get('class.stats');
     $statsClass->countReturn = false;
     $statsClass->saveStats();
     JRequest::setVar('layout', 'view');
     return parent::display();
 }
Пример #16
0
 function plgtrigger()
 {
     if (!(require_once ACYMAILING_BACK . DS . 'controllers' . DS . 'cpanel.php')) {
         return;
     }
     $cPanelController = acymailing_get('controller.cpanel');
     $cPanelController->plgtrigger();
     return;
 }
Пример #17
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 true;

		$statsClass = acymailing_get('class.stats');
		$statsClass->countReturn = false;
		$statsClass->mailid = $mailid;
		$statsClass->subid = $subid;
		if(!$statsClass->saveStats()) return true;

		$date = time();
		$ipClass = acymailing_get('helper.user');
		$ip = $ipClass->getIP();

		$query = 'INSERT IGNORE INTO '.acymailing_table('urlclick').' (urlid,mailid,subid,date,click,ip) VALUES ('.$urlid.','.$mailid.','.$subid.','.$date.',1,'.$this->database->Quote($ip).')';
		$this->database->setQuery($query);
		if(!$this->database->query()){
			acymailing_display($this->database->getErrorMsg(),'error');
			exit;
		}

		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();

		$this->database->setQuery('UPDATE #__acymailing_subscriber SET lastclick_date = '.time().' WHERE subid = '.$subid);
		$this->database->query();

		$filterClass = acymailing_get('class.filter');
		$filterClass->subid = $subid;
		$filterClass->trigger('clickurl');

		$classGeoloc = acymailing_get('class.geolocation');
		$classGeoloc->saveGeolocation('clic', $subid);

		JPluginHelper::importPlugin('acymailing');
		$dispatcher = JDispatcher::getInstance();
		$dispatcher->trigger('onAcyClickLink',array($subid,$mailid,$urlid));

		return true;
	}
Пример #18
0
 function listsType()
 {
     $listClass = acymailing_get('class.list');
     $this->data = $listClass->getLists('listid');
     $this->values = array();
     $this->values[] = JHTML::_('select.option', '0', JText::_('ALL_LISTS'));
     foreach ($this->data as $onelist) {
         $this->values[] = JHTML::_('select.option', $onelist->listid, $onelist->name);
     }
 }
Пример #19
0
 function unsubscribe($subid, $listids)
 {
     $app = JFactory::getApplication();
     if (acymailing_level(3)) {
         $campaignClass = acymailing_get('helper.campaign');
         $campaignClass->stop($subid, $listids);
     }
     $config = acymailing_config();
     static $alreadySent = false;
     if ($this->sendNotif and !$alreadySent and $config->get('notification_unsub') and !$app->isAdmin()) {
         $alreadySent = true;
         $mailer = acymailing_get('helper.mailer');
         $mailer->report = false;
         $mailer->autoAddUser = true;
         $mailer->checkConfirmField = false;
         $userClass = acymailing_get('class.subscriber');
         $subscriber = $userClass->get($subid);
         $ipClass = acymailing_get('helper.user');
         $mailer->addParam('survey', $this->survey);
         $listSubClass = acymailing_get('class.listsub');
         $mailer->addParam('user:subscription', $listSubClass->getSubscriptionString($subscriber->subid));
         $mailer->addParam('user:subscriptiondates', $listSubClass->getSubscriptionString($subscriber->subid, true));
         $mailer->addParamInfo();
         $subscriber->ip = $ipClass->getIP();
         foreach ($subscriber as $fieldname => $value) {
             $mailer->addParam('user:'******',', $config->get('notification_unsub'));
         foreach ($allUsers as $oneUser) {
             $mailer->sendOne('notification_unsub', $oneUser);
         }
     }
     $db = JFactory::getDBO();
     if ($this->forceConf || ($this->sendConf and !$app->isAdmin())) {
         $db->setQuery('SELECT DISTINCT `unsubmailid` FROM ' . acymailing_table('list') . ' WHERE `listid` IN (' . implode(',', $listids) . ') AND `published` = 1  AND `unsubmailid` > 0');
         $messages = acymailing_loadResultArray($db);
         if (!empty($messages)) {
             $config = acymailing_config();
             $mailHelper = acymailing_get('helper.mailer');
             $mailHelper->report = $config->get('unsub_message', true);
             $mailHelper->checkAccept = false;
             foreach ($messages as $mailid) {
                 $mailHelper->trackEmail = true;
                 $mailHelper->sendOne($mailid, $subid);
             }
         }
     }
     //end only frontend
     $db->setQuery('DELETE  FROM ' . acymailing_table('queue') . ' WHERE `subid` = ' . (int) $subid . ' AND `mailid` IN (SELECT `mailid` FROM ' . acymailing_table('listmail') . ' WHERE `listid` IN (' . implode(',', $listids) . '))');
     $db->query();
     JPluginHelper::importPlugin('acymailing');
     $dispatcher = JDispatcher::getInstance();
     $resultsTrigger = $dispatcher->trigger('onAcyUnsubscribe', array($subid, $listids));
 }
Пример #20
0
 function remove()
 {
     if (!$this->isAllowed($this->aclCat, 'delete')) {
         return;
     }
     JRequest::checkToken() or die('Invalid Token');
     $listIds = JRequest::getVar('cid', array(), '', 'array');
     $subscriberObject = acymailing_get('class.list');
     $num = $subscriberObject->delete($listIds);
     acymailing_enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $num), 'message');
     JRequest::setVar('layout', 'listing');
     return parent::display();
 }
Пример #21
0
 function remove()
 {
     if (!$this->isAllowed('statistics', 'delete')) {
         return;
     }
     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();
 }
Пример #22
0
 function view()
 {
     $mailid = acymailing_getCID('mailid');
     if (empty($mailid)) {
         $db =& JFactory::getDBO();
         $query = 'SELECT m.`mailid` FROM `#__acymailing_list` as l LEFT JOIN `#__acymailing_listmail` as lm ON l.listid=lm.listid LEFT 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';
         if (!empty($listid)) {
             $query .= ' AND l.`listid` = ' . (int) $listid;
         }
         $query .= ' ORDER BY m.`mailid` DESC LIMIT 1';
         $db->setQuery($query);
         $mailid = $db->loadResult();
         if (empty($mailid)) {
             return JError::raiseError(404, 'Newsletter not found');
         }
     }
     $access_sub = true;
     $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 (!$access_sub or !$oneMail->published or !$oneMail->visible) {
         $key = JRequest::getString('key');
         if (empty($key) or $key !== $oneMail->key) {
             $app = JFactory::getApplication();
             $app->enqueueMessage('You can not have access to this e-mail', 'error');
             $app->redirect(acymailing_completeLink('lists', false, true));
             return false;
         }
     }
     $user = JFactory::getUser();
     if (!empty($user->email)) {
         $userClass = acymailing_get('class.subscriber');
         $receiver = $userClass->get($user->email);
     } else {
         $receiver = new stdClass();
         $receiver->name = JText::_('VISITOR');
     }
     $oneMail->sendHTML = true;
     $mailClass->dispatcher->trigger('acymailing_replaceusertags', array(&$oneMail, &$receiver, false));
     $document = JFactory::getDocument();
     $document->setTitle($oneMail->subject);
     if (!empty($oneMail->text)) {
         echo nl2br($mailClass->textVersion($oneMail->text, false));
     } else {
         echo nl2br($mailClass->textVersion($oneMail->body, true));
     }
 }
Пример #23
0
    function setTemplate($id)
    {
        if (empty($id)) {
            return;
        }
        $app = JFactory::getApplication();
        $cssurl = rtrim(JURI::root(), '/') . '/' . ($app->isAdmin() ? 'administrator/index.php?option=com_acymailing&ctrl=template' : 'index.php?option=com_acymailing&ctrl=fronttemplate') . '&task=load&tempid=' . $id . '&time=' . time();
        $name = $this->myEditor->get('_name');
        $classTemplate = acymailing_get('class.template');
        $filepath = $classTemplate->createTemplateFile($id);
        if ($name == 'tinymce') {
            $this->editorConfig['content_css_custom'] = $cssurl;
            $this->editorConfig['content_css'] = '0';
        } elseif ($name == 'jckeditor' || $name == 'fckeditor') {
            $this->editorConfig['content_css_custom'] = $filepath;
            $this->editorConfig['content_css'] = '0';
            $this->editorConfig['editor_css'] = '0';
        } else {
            $fileurl = 'media/com_acymailing/templates/css/template_' . $id . '.css?time=' . time();
            $this->editorConfig['custom_css_url'] = $cssurl;
            $this->editorConfig['custom_css_file'] = $fileurl;
            $this->editorConfig['custom_css_path'] = $filepath;
            JRequest::setVar('acycssfile', $fileurl);
            if ($name == 'jce') {
                $jcepath = ACYMAILING_ROOT . 'administrator' . DS . 'components' . DS . 'com_jce' . DS . 'models' . DS;
                if (file_exists($jcepath . 'editor.php')) {
                    jimport('joomla.filesystem.file');
                    $content = JFile::read($jcepath . 'editor.php');
                    if (!strpos($content, 'acycssfile')) {
                        $acycode = '
			if(JRequest::getCmd(\'option\') == \'com_acymailing\'){
				$acycssfile = JRequest::getString(\'acycssfile\');
				if(!empty($acycssfile)) $settings[\'content_css\'] = $acycssfile;
			}
			';
                        $content = preg_replace('#(\\$settings\\[\'content_css\'\\][^=]*= *[^;]*;)#', '$1' . $acycode, $content);
                        if (strpos($content, 'acycssfile')) {
                            if (!file_exists($jcepath . 'editor_backup.php')) {
                                if (JFile::copy($jcepath . 'editor.php', $jcepath . 'editor_backup.php') !== true) {
                                    acymailing_display('Could not copy the file from ' . $jcepath . 'editor.php to ' . $jcepath . 'editor_backup.php', 'error');
                                }
                            }
                            if (JFile::write($jcepath . 'editor.php', $content) !== true) {
                                acymailing_display('Could not write in ' . $jcepath . 'editor.php <br /> Please make sure this folder is writable', 'error');
                            }
                        }
                    }
                }
            }
        }
    }
Пример #24
0
 function view()
 {
     $statsClass = acymailing_get('class.stats');
     $statsClass->countReturn = false;
     $statsClass->saveStats();
     $printEnabled = JRequest::getVar('print', 0);
     if ($printEnabled) {
         $js = "setTimeout(function(){\r\n\t\t\t\t\tif(document.getElementById('iframepreview')){\r\n\t\t\t\t\t\tdocument.getElementById('iframepreview').contentWindow.focus();\r\n\t\t\t\t\t\tdocument.getElementById('iframepreview').contentWindow.print();\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\twindow.print();\r\n\t\t\t\t\t}\r\n\t\t\t\t},2000);";
         $doc = JFactory::getDocument();
         $doc->addScriptDeclaration($js);
     }
     JRequest::setVar('layout', 'view');
     return parent::display();
 }
Пример #25
0
 function addSubscription($subid, $lists)
 {
     $app = JFactory::getApplication();
     $my = JFactory::getUser();
     $result = true;
     $time = time();
     $subid = intval($subid);
     $listHelper = acymailing_get('helper.list');
     $listHelper->campaigndelay = $this->campaigndelay;
     $listHelper->skipedfollowups = $this->skipedfollowups;
     $listHelper->sendNotif = $this->sendNotif;
     $listHelper->sendConf = $this->sendConf;
     $listHelper->forceConf = $this->forceConf;
     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 IGNORE 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;
 }
Пример #26
0
 function cancelNewsletter()
 {
     if (!$this->isAllowed($this->aclCat, 'delete')) {
         return;
     }
     JRequest::checkToken() || JRequest::checkToken('get') || die('Invalid token');
     $mailid = JRequest::getInt('mailid', 0);
     if (empty($mailid)) {
         acymailing_enqueueMessage('Mail id not found', 'error');
         return;
     }
     $queueClass = acymailing_get('class.queue');
     acymailing_enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $queueClass->delete(array('a.mailid = ' . $mailid))), 'info');
 }
Пример #27
0
	function save(){
		if(!$this->isAllowed($this->aclCat,'manage')) return;
		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();
	}
Пример #28
0
 function exportOneData(&$exportdata, $fileName = 'export')
 {
     $config = acymailing_config();
     $encodingClass = acymailing_get('helper.encoding');
     $this->addHeaders($fileName);
     $eol = "\r\n";
     $before = '"';
     $separator = '"' . str_replace(array('semicolon', 'comma'), array(';', ','), $config->get('export_separator', ';')) . '"';
     $exportFormat = $config->get('export_format', 'UTF-8');
     $after = '"';
     foreach ($exportdata as $name => $total) {
         echo $before . $encodingClass->change($name . $separator . $total, 'UTF-8', $exportFormat) . $after . $eol;
     }
     exit;
 }
Пример #29
0
 function saveStats()
 {
     $subid = empty($this->subid) ? JRequest::getInt('subid') : $this->subid;
     $mailid = empty($this->mailid) ? JRequest::getInt('mailid') : $this->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` = ' . intval($subid) . ' LIMIT 1');
     $actual = $db->loadObject();
     if (empty($actual)) {
         return false;
     }
     $userHelper = acymailing_get('helper.user');
     $this->database->setQuery('UPDATE #__acymailing_subscriber SET `lastopen_date` = ' . time() . ', `lastopen_ip` = ' . $this->database->Quote($userHelper->getIP()) . ' WHERE `subid` = ' . intval($subid));
     $this->database->query();
     $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;
     }
     $ipClass = acymailing_get('helper.user');
     $ip = $ipClass->getIP();
     $db->setQuery('UPDATE ' . acymailing_table('userstats') . ' SET open = ' . $open . ', opendate = ' . time() . ', `ip`= ' . $db->Quote($ip) . ' WHERE mailid = ' . $mailid . ' AND subid = ' . $subid . ' LIMIT 1');
     if (!$db->query()) {
         acymailing_display($db->getErrorMsg(), 'error');
         exit;
     }
     $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');
     }
     $classGeoloc = acymailing_get('class.geolocation');
     $classGeoloc->saveGeolocation('open', $subid);
     JPluginHelper::importPlugin('acymailing');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onAcyOpenMail', array($subid, $mailid));
     return true;
 }
Пример #30
0
 public function Process()
 {
     // Newsletter component disabled or not found. Aborting.
     if (!$this->enabled) {
         return true;
     }
     //$config = acymailing_config();
     // Lists
     $cumulative = $this->JInput->post->get("acymailing_subscribe_cumulative", NULL, "int");
     $checkboxes = array(FAcyMailing::subscribe => $this->JInput->post->get("acymailing_subscribe", array(), "array"));
     $lists = $cumulative ? $checkboxes : array();
     // When subscription requires confirmation (double opt-in) AcyMailing sends a confirmation request to the user as soon as the user himself is saved. $userClass->save($subscriber)
     // Even in case of no list selected the user will be annoyed with a confirmation email
     // The confirmation status doesn't depend on the lists, which will be passed to AcyMailing only a few lines later. $userClass->saveSubscription($sub_id, $newSubscription)
     if (empty($lists[FAcyMailing::subscribe])) {
         return true;
     }
     // Build subscriber object
     $subscriber = new stdClass();
     // Name field may be absent. AcyMailing will guess the user's name from his email address
     $subscriber->name = isset($this->FieldsBuilder->Fields['sender0']) ? $this->FieldsBuilder->Fields['sender0']['Value'] : "";
     // AcyMailing refuses to save the user (return false) if the email address is empty, so we don't care to check it
     $subscriber->email = empty($this->FieldsBuilder->Fields['sender1']['Value']) ? NULL : JMailHelper::cleanAddress($this->FieldsBuilder->Fields['sender1']['Value']);
     $userClass = acymailing_get('class.subscriber');
     $userClass->checkVisitor = false;
     // Add or update the user
     $sub_id = $userClass->save($subscriber);
     if (empty($sub_id)) {
         // User save failed. Probably email address is empty or invalid
         $this->logger->Write(get_class($this) . " Process(): User save failed");
         return true;
     }
     // When in mode "one checkbox for each list" and no lists selected the code above produce an SQL error because passes an empty array to saveSubscription()
     $newSubscription = array();
     foreach ($lists[FAcyMailing::subscribe] as $listId) {
         $newList = array();
         $newList['status'] = FAcyMailing::subscribe;
         $newSubscription[$listId] = $newList;
     }
     if (!empty($newSubscription)) {
         $userClass->saveSubscription($sub_id, $newSubscription);
     }
     // implode() doesn't accept NULL values :(
     @$lists[FAcyMailing::subscribe] or $lists[FAcyMailing::subscribe] = array();
     // Log
     $this->logger->Write(get_class($this) . " Process(): subscribed " . $this->FieldsBuilder->Fields['sender0']['Value'] . " (" . $this->FieldsBuilder->Fields['sender1']['Value'] . ") to lists " . implode(",", $lists[FAcyMailing::subscribe]));
     return true;
 }