Esempio n. 1
0
 function acymailing_replacetags(&$email)
 {
     $match = '#{date:?([^:]*)}#Ui';
     $variables = array('subject', 'body', 'altbody');
     foreach ($variables as $var) {
         $email->{$var} = str_replace(array('{mailid}'), array($email->mailid), $email->{$var});
     }
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return;
     }
     $tags = array();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($tags[$oneTag])) {
                 continue;
             }
             if (empty($allresults[1][$i]) or is_numeric($allresults[1][$i])) {
                 $tags[$oneTag] = acymailing::getDate(time(), JText::_('DATE_FORMAT_LC' . $allresults[1][$i]));
             } else {
                 $tags[$oneTag] = acymailing::getDate(time(), $allresults[1][$i]);
             }
         }
     }
     foreach (array_keys($results) as $var) {
         $email->{$var} = str_replace(array_keys($tags), $tags, $email->{$var});
     }
 }
Esempio n. 2
0
    function form()
    {
        $db =& JFactory::getDBO();
        $config = acymailing::config();
        $filid = acymailing::getCID('filid');
        $filterClass = acymailing::get('class.filter');
        if (!empty($filid)) {
            $filter = $filterClass->get($filid);
        } else {
            $filter = null;
            $filter->action = JRequest::getVar('action');
            $filter->filter = JRequest::getVar('filter');
            $filter->published = 1;
        }
        JPluginHelper::importPlugin('acymailing');
        $this->dispatcher =& JDispatcher::getInstance();
        $typesFilters = array();
        $typesActions = array();
        $outputFilters = implode('', $this->dispatcher->trigger('onAcyDisplayFilters', array(&$typesFilters)));
        $outputActions = implode('', $this->dispatcher->trigger('onAcyDisplayActions', array(&$typesActions)));
        $typevaluesFilters = array();
        $typevaluesActions = array();
        $typevaluesFilters[] = JHTML::_('select.option', '', JText::_('FILTER_SELECT'));
        $typevaluesActions[] = JHTML::_('select.option', '', JText::_('ACTION_SELECT'));
        $doc =& JFactory::getDocument();
        $js = "function updateFilter(filterNum){";
        foreach ($typesFilters as $oneType => $oneName) {
            $typevaluesFilters[] = JHTML::_('select.option', $oneType, $oneName);
            $js .= "filterArea = 'filter'+filterNum+'{$oneType}';\r\n\t\t\t\tif(window.document.getElementById(filterArea)){window.document.getElementById(filterArea).style.display = 'none';}";
        }
        $js .= "filterArea = 'filter'+filterNum+window.document.getElementById('filtertype'+filterNum).value;\r\n\t\t\t\tif(window.document.getElementById(filterArea)){window.document.getElementById(filterArea).style.display = 'block';}\r\n\t\t\t}";
        $js .= "function updateAction(actionNum){";
        foreach ($typesActions as $oneType => $oneName) {
            $typevaluesActions[] = JHTML::_('select.option', $oneType, $oneName);
            $js .= "actionArea = 'action'+actionNum+'{$oneType}';\r\n\t\t\t\tif(window.document.getElementById(actionArea)){window.document.getElementById(actionArea).style.display = 'none';}";
        }
        $js .= "actionArea = 'action'+actionNum+window.document.getElementById('actiontype'+actionNum).value;\r\n\t\t\t\tif(window.document.getElementById(actionArea)){window.document.getElementById(actionArea).style.display = 'block';}\r\n\t\t\t}";
        $js .= "var numFilters = 0;\r\n\t\t\t\tvar numActions = 0;\r\n\t\t\t\tfunction addFilter(){\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\t\t\tnewdiv.id = 'filter'+numFilters;\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\n\t\t\t\t\tnewdiv.innerHTML = document.getElementById('filters_original').innerHTML.replace(/__num__/g, numFilters);\r\n\t\t\t\t\tdocument.getElementById('allfilters').appendChild(newdiv); updateFilter(numFilters); numFilters++; }\n\t\t\t\tfunction addAction(){\r\n\t\t\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\t\t\tnewdiv.id = 'action'+numActions;\r\n\t\t\t\t\tnewdiv.className = 'plugarea';\r\n\t\t\t\t\tnewdiv.innerHTML = document.getElementById('actions_original').innerHTML.replace(/__num__/g, numActions);\r\n\t\t\t\t\tdocument.getElementById('allactions').appendChild(newdiv); updateAction(numActions); numActions++; }";
        $js .= "window.addEvent('domready', function(){ addFilter(); addAction(); });";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            $js .= 'function submitbutton(pressbutton){
						if (pressbutton != \'save\') {
							submitform( pressbutton );
							return;
						}';
        } else {
            $js .= 'Joomla.submitbutton = function(pressbutton) {
						if (pressbutton != \'save\') {
							Joomla.submitform(pressbutton,document.adminForm);
							return;
						}';
        }
        $js .= "if(window.document.getElementById('filterinfo').style.display == 'none'){\r\n\t\t\t\t\t\twindow.document.getElementById('filterinfo').style.display = 'block';\r\n\t\t\t\t\t\ttry{allspans = window.document.getElementById('toolbar-save').getElementsByTagName(\"span\"); allspans[0].className = 'icon-32-apply';}catch(err){}\r\n\t\t\t\t\t\treturn false;}\r\n\t\t\t\t\tif(window.document.getElementById('title').value.length < 2){alert('" . JText::_('ENTER_TITLE', true) . "'); return false;}";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            $js .= "submitform( pressbutton );} ";
        } else {
            $js .= "Joomla.submitform(pressbutton,document.adminForm);}; ";
        }
        $doc->addScriptDeclaration($js);
        $js = '';
        $data = array('action', 'filter');
        foreach ($data as $datatype) {
            if (empty($filter->{$datatype})) {
                continue;
            }
            foreach ($filter->{$datatype}['type'] as $num => $oneType) {
                if (empty($oneType)) {
                    continue;
                }
                $js .= "while(!document.getElementById('" . $datatype . "type{$num}')){add" . ucfirst($datatype) . "();}\r\n\t\t\t\t\t\tdocument.getElementById('" . $datatype . "type{$num}').value= '{$oneType}';\r\n\t\t\t\t\t\tupdate" . ucfirst($datatype) . "({$num});";
                if (empty($filter->{$datatype}[$num][$oneType])) {
                    continue;
                }
                foreach ($filter->{$datatype}[$num][$oneType] as $key => $value) {
                    $js .= "document.adminForm.elements['" . $datatype . "[{$num}][{$oneType}][{$key}]'].value = '" . addslashes(str_replace(array("\n", "\r"), ' ', $value)) . "';";
                }
            }
        }
        $listid = JRequest::getInt('listid');
        if (!empty($listid)) {
            $js .= "document.getElementById('actiontype0').value = 'list'; updateAction(0); document.adminForm.elements['action[0][list][selectedlist]'].value = '" . $listid . "';";
        }
        $doc->addScriptDeclaration("window.addEvent('domready', function(){ {$js} });");
        $triggers = array();
        $triggers['daycron'] = JText::_('AUTO_CRON_FILTER');
        $nextDate = $config->get('cron_plugins_next');
        if (!empty($nextDate)) {
            $triggers['daycron'] .= ' (' . JText::_('NEXT_RUN') . ' : ' . acymailing::getDate($nextDate, '%d %B %H:%M') . ')';
        }
        $triggers['subcreate'] = JText::_('ON_USER_CREATE');
        $triggers['subchange'] = JText::_('ON_USER_CHANGE');
        $this->dispatcher->trigger('onAcyDisplayTriggers', array(&$triggers));
        $name = empty($filter->name) ? '' : ' : ' . $filter->name;
        acymailing::setTitle(JText::_('ACY_FILTER') . $name, 'filter', 'filter&task=edit&filid=' . $filid);
        $bar =& JToolBar::getInstance('toolbar');
        $bar->appendButton('Confirm', JText::_('PROCESS_CONFIRMATION'), 'process', JText::_('PROCESS'), 'process', false, false);
        JToolBarHelper::divider();
        if (acymailing::level(3)) {
            JToolBarHelper::save();
            if (!empty($filter->filid)) {
                $bar->appendButton('Link', 'new', JText::_('NEW'), acymailing::completeLink('filter&task=edit&filid=0'));
            }
        }
        $bar->appendButton('Link', 'cancel', JText::_('ACY_CLOSE'), acymailing::completeLink('list'));
        JToolBarHelper::divider();
        $bar->appendButton('Pophelp', 'filter');
        $subid = JRequest::getString('subid');
        if (!empty($subid)) {
            $subArray = explode(',', trim($subid, ','));
            JArrayHelper::toInteger($subArray);
            $db->setQuery('SELECT `name`,`email` FROM `#__acymailing_subscriber` WHERE `subid` IN (' . implode(',', $subArray) . ')');
            $users = $db->loadObjectList();
            if (!empty($users)) {
                $this->assignRef('users', $users);
                $this->assignRef('subid', $subid);
            }
        }
        $this->assignRef('typevaluesFilters', $typevaluesFilters);
        $this->assignRef('typevaluesActions', $typevaluesActions);
        $this->assignRef('outputFilters', $outputFilters);
        $this->assignRef('outputActions', $outputActions);
        $this->assignRef('filter', $filter);
        $this->assignRef('triggers', $triggers);
        $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css');
        if (acymailing::level(3) and JRequest::getCmd('tmpl') != 'component') {
            $db->setQuery('SELECT * FROM #__acymailing_filter ORDER BY `published` DESC, `filid` DESC');
            $filters = $db->loadObjectList();
            $this->assignRef('toggleClass', acymailing::get('helper.toggle'));
            $this->assignRef('filters', $filters);
        }
    }
Esempio n. 3
0
</legend>
			<table class="adminlist" cellspacing="1" align="center">
			<tbody>
		<?php 
    $k = 0;
    foreach ($this->nextqueue as $mailid => $row) {
        ?>

					<tr class="<?php 
        echo "row{$k}";
        ?>
">
						<td>
							<?php 
        echo JText::sprintf('EMAIL_READY', $row->mailid, $row->subject, $row->nbsub);
        echo '<br/>' . JText::sprintf('QUEUE_NEXT_SCHEDULE', acymailing::getDate($row->senddate));
        ?>

						</td>
					</tr>
					<?php 
        $k = 1 - $k;
    }
    ?>

				</tbody>
			</table>
		</fieldset>
	<?php 
}
?>
Esempio n. 4
0
            echo ACYMAILING_IMAGES;
            ?>
icons/icon-16-stats.png" alt="<?php 
            echo JText::_('STATISTICS', true);
            ?>
" /></a></span>
							<?php 
        }
        ?>
						<?php 
    }
    ?>
					</td>
					<?php 
    if ($this->values->show_senddate) {
        ?>
					<td align="center" nowrap="nowrap">
						<?php 
        echo acymailing::getDate($row->senddate, JText::_('DATE_FORMAT_LC3'));
        ?>
					</td>
					<?php 
    }
    ?>
				</tr>
			<?php 
    $k = 3 - $k;
}
?>
		</tbody>
	</table>
Esempio n. 5
0
				</tr>
				<tr><td class="key"><?php 
echo JText::_('LAST_RUN');
?>
</td>
				<td><?php 
echo acymailing::getDate($this->config->get('auto_bounce_last'));
?>
</td>
				</tr>
				<tr><td class="key"><?php 
echo JText::_('NEXT_RUN');
?>
</td>
				<td><?php 
echo acymailing::getDate($this->config->get('auto_bounce_next'));
?>
</td>
				</tr>
				<tr><td class="key"><?php 
echo JText::_('REPORT');
?>
</td>
				<td><?php 
echo $this->config->get('auto_bounce_report');
?>
</td>
				</tr>
			</table>
		</td>
		</tr></table>
Esempio n. 6
0
		</td>
	</tr>
	<?php 
if (!empty($this->mail->senddate)) {
    ?>

	<tr>
		<td class="key" id="senddatekey">
			<?php 
    echo JText::_('SEND_DATE');
    ?>

		</td>
		<td id="senddateinput">
			<?php 
    echo acymailing::getDate(@$this->mail->senddate);
    ?>

		</td>
		<td class="key" id="sentbykey">
			<?php 
    if (!empty($this->mail->sentby)) {
        echo JText::_('SENT_BY');
    }
    ?>

		</td>
		<td id="sentbyinput">
			<?php 
    echo @$this->sentbyname;
    ?>
Esempio n. 7
0
        if ($map == 'email') {
            echo '</a>';
        }
        ?>

						</td>
					<?php 
    }
    if (acymailing::level(2)) {
        include dirname(__FILE__) . DS . 'level2.' . basename(__FILE__);
    }
    ?>

					<td align="center">
						<?php 
    echo acymailing::getDate($row->created);
    ?>

					</td>
					<td align="center">
						<?php 
    if (empty($row->username)) {
        echo $this->joomGroups[(int) $row->gid]->name;
    } else {
        $text = '<b>' . JText::_('USERNAME') . ' : </b>' . $row->username;
        $text .= '<br/><b>' . JText::_('USER_ID') . ' : </b>' . $row->userid;
        echo acymailing::tooltip($text, '', '', $this->joomGroups[(int) $row->gid]->name);
    }
    ?>

					</td>
Esempio n. 8
0
			</td>
			<td>
				<?php 
echo $this->emaildrop;
?>
			</td>
		</tr>
		<tr>
			<td class="key">
				<?php 
echo JText::_('SEND_DATE');
?>
			</td>
			<td>
				<?php 
echo JHTML::_('calendar', acymailing::getDate(time(), '%Y-%m-%d %H:%M'), 'senddate', 'senddate', '%Y-%m-%d %H:%M', 'size="50"');
?>
			</td>
		</tr>
		<tr>
			<td>
			</td>
			<td>
				<button type="submit"><?php 
echo JText::_('SCHEDULE');
?>
</button>
			</td>
		</tr>
	</table>
	<input type="hidden" name="subid" value="<?php 
Esempio n. 9
0
    ?>
					</td>
					<td align="center">
						<?php 
    echo $row->html ? JText::_('HTML') : JText::_('JOOMEXT_TEXT');
    ?>
					</td>
					<td align="center">
						<?php 
    echo $row->open;
    ?>
					</td>
					<td align="center">
						<?php 
    if (!empty($row->opendate)) {
        echo acymailing::getDate($row->opendate);
    }
    ?>
					</td>
					<?php 
    if (acymailing::level(3)) {
        ?>
					<td align="center">
						<?php 
        echo $row->bounce;
        ?>
					</td>
					<?php 
    }
    ?>
					<td align="center">
Esempio n. 10
0
 function scheduleone()
 {
     $mailid = JRequest::getInt('mailid');
     $subid = JRequest::getInt('subid');
     $senddate = JRequest::getString('senddate', '');
     JRequest::checkToken() && !empty($mailid) && !empty($subid) or die('Invalid Token');
     $realSendDate = acymailing::getTime($senddate);
     if ($realSendDate < time()) {
         acymailing::display(JText::_('DATE_FUTURE'), 'warning');
         return $this->addqueue();
     }
     $mailClass = acymailing::get('class.mail');
     $myNewsletter = $mailClass->get($mailid);
     $queueEntry = null;
     $queueEntry->mailid = $myNewsletter->mailid;
     $queueEntry->subid = $subid;
     $queueEntry->senddate = $realSendDate;
     $queueEntry->priority = 1;
     $db =& JFactory::getDBO();
     $status = $db->insertObject('#__acymailing_queue', $queueEntry);
     if ($status) {
         acymailing::display(JText::sprintf('AUTOSEND_DATE', $myNewsletter->subject, acymailing::getDate($realSendDate)), 'success');
     }
 }
Esempio n. 11
0
	<fieldset>
		<legend><?php 
echo JText::_('LAST_CRON');
?>
</legend>
		<table class="admintable" cellspacing="1">
			<tr>
				<td class="key" >
					<?php 
echo acymailing::tooltip(JText::_('LAST_RUN_DESC'), JText::_('LAST_RUN'), '', JText::_('LAST_RUN'));
?>

				</td>
				<td>
					<?php 
echo acymailing::getDate($this->config->get('cron_last'));
?>

				</td>
			</tr>
			<tr>
				<td class="key" >
					<?php 
echo acymailing::tooltip(JText::_('CRON_TRIGGERED_IP_DESC'), JText::_('CRON_TRIGGERED_IP'), '', JText::_('CRON_TRIGGERED_IP'));
?>

				</td>
				<td>
					<?php 
echo $this->config->get('cron_fromip');
?>
Esempio n. 12
0
 function acymailing_replaceusertags(&$email, &$user)
 {
     $match = '#(?:{|%7B)usertag:(.*)(?:}|%7D)#Ui';
     $variables = array('subject', 'body', 'altbody');
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return;
     }
     $values = null;
     if (!empty($user->userid)) {
         $db = JFactory::getDBO();
         $db->setQuery('SELECT * FROM ' . acymailing::table('users', false) . ' WHERE id = ' . $user->userid . ' LIMIT 1');
         $values = $db->loadObject();
     }
     $tags = array();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($tags[$oneTag])) {
                 continue;
             }
             $arguments = explode('|', $allresults[1][$i]);
             $field = $arguments[0];
             unset($arguments[0]);
             $mytag = null;
             $mytag->default = $this->params->get('default_' . $field, '');
             if (!empty($arguments)) {
                 foreach ($arguments as $onearg) {
                     $args = explode(':', $onearg);
                     if (isset($args[1])) {
                         $mytag->{$args}[0] = $args[1];
                     } else {
                         $mytag->{$args}[0] = 1;
                     }
                 }
             }
             $replaceme = isset($values->{$field}) ? $values->{$field} : $mytag->default;
             if (!empty($mytag->type)) {
                 if ($mytag->type == 'date') {
                     $replaceme = acymailing::getDate(strtotime($replaceme));
                 }
             }
             if (!empty($mytag->lower)) {
                 $replaceme = strtolower($replaceme);
             }
             if (!empty($mytag->ucwords)) {
                 $replaceme = ucwords($replaceme);
             }
             if (!empty($mytag->ucfirst)) {
                 $replaceme = ucfirst($replaceme);
             }
             if (!empty($mytag->urlencode)) {
                 $replaceme = urlencode($replaceme);
             }
             $tags[$oneTag] = $replaceme;
         }
     }
     foreach ($results as $var => $allresults) {
         $email->{$var} = str_replace(array_keys($tags), $tags, $email->{$var});
     }
 }
Esempio n. 13
0
 function subscription()
 {
     acymailing::setTitle(JText::_('CHARTS'), 'stats', 'diagram&task=subscription');
     $listsClass = acymailing::get('class.list');
     $lists = $listsClass->getLists('listid');
     $db =& JFactory::getDBO();
     $db->setQuery('SELECT min(subdate) as minsubdate, min(unsubdate) as minunsubdate FROM ' . acymailing::table('listsub'));
     $dates = $db->loadObject();
     $spaces = array();
     $intervals = 10;
     $dates->maxsubdate = time();
     $delay = ($dates->maxsubdate - $dates->minsubdate) / $intervals;
     for ($i = 0; $i < $intervals; $i++) {
         $spaces[$i] = (int) ($dates->minsubdate + $delay * $i);
     }
     $spaces[$intervals] = $dates->maxsubdate;
     $results = array();
     $legendX = array();
     for ($i = 0; $i <= $intervals; $i++) {
         $legendX[] = acymailing::getDate($spaces[$i]);
         $db->setQuery('SELECT count(subid) as total, listid FROM ' . acymailing::table('listsub') . ' WHERE `status` != 2 AND `subdate` < ' . $spaces[$i] . ' AND (`status` = 1 OR `unsubdate`>' . $spaces[$i] . ') GROUP BY listid');
         $results[$i] = $db->loadObjectList('listid');
     }
     $title = new title(JText::_('SUB_HISTORY'));
     $title->set_style('font-size:20px; color: #FF8040');
     $lines = array();
     $maxSub = 0;
     foreach ($lists as $listid => $oneList) {
         $lines[$listid] = new line_base();
         $values = array();
         for ($i = 0; $i <= $intervals; $i++) {
             $values[] = empty($results[$i][$listid]->total) ? 0 : (int) $results[$i][$listid]->total;
         }
         $lines[$listid]->set_values($values);
         $lines[$listid]->set_text($oneList->name);
         $lines[$listid]->set_colour($oneList->color);
         $maxSub = max($maxSub, max($values));
     }
     $x_axis = new x_axis();
     $xlabelobject = new x_axis_labels();
     $xlabelobject->rotate(-20);
     $xlabelobject->set_labels($legendX);
     $x_axis->set_labels($xlabelobject);
     $y_axis = new y_axis();
     $y_axis->range(0, $maxSub, intval($maxSub / 10));
     $chart = new open_flash_chart();
     $chart->set_x_axis($x_axis);
     $chart->set_y_axis($y_axis);
     $chart->set_title($title);
     foreach ($lines as $oneLine) {
         $chart->add_element($oneLine);
     }
     $this->assignRef('chart', $chart);
 }
Esempio n. 14
0
    for ($i = 0, $a = count($this->history); $i < $a; $i++) {
        $row =& $this->history[$i];
        $id = 'history' . $i;
        ?>
							<tr class="<?php 
        echo "row{$k}";
        ?>
" >
								<td align="center">
								<?php 
        echo $i + 1;
        ?>
								</td>
								<td align="center">
									<?php 
        echo acymailing::getDate($row->date);
        ?>
								</td>
								<td align="center">
									<?php 
        echo JText::_('ACTION_' . strtoupper($row->action));
        ?>
								</td>
								<td>
									<?php 
        $data = explode("\n", $row->data);
        foreach ($data as $value) {
            if (!strpos($value, '::')) {
                continue;
            }
            list($part1, $part2) = explode("::", $value);
Esempio n. 15
0
 function replaceSubTag(&$allresults, $i, &$user)
 {
     $arguments = explode('|', strip_tags($allresults[1][$i]));
     $field = $arguments[0];
     unset($arguments[0]);
     $mytag = null;
     $mytag->default = $this->params->get('default_' . $field, '');
     if (!empty($arguments)) {
         foreach ($arguments as $onearg) {
             $args = explode(':', $onearg);
             if (isset($args[1])) {
                 $mytag->{$args}[0] = $args[1];
             } else {
                 $mytag->{$args}[0] = 1;
             }
         }
     }
     $replaceme = isset($user->{$field}) ? $user->{$field} : $mytag->default;
     if (!empty($mytag->part)) {
         $parts = explode(' ', $replaceme);
         if ($mytag->part == 'last') {
             $replaceme = count($parts) > 1 ? end($parts) : '';
         } else {
             $replaceme = reset($parts);
         }
     }
     if (!empty($mytag->type)) {
         if ($mytag->type == 'date') {
             $replaceme = acymailing::getDate(strtotime($replaceme));
         } elseif ($mytag->type == 'time') {
             $replaceme = acymailing::getDate($replaceme);
         }
     }
     if (!empty($mytag->lower)) {
         $replaceme = strtolower($replaceme);
     }
     if (!empty($mytag->ucwords)) {
         $replaceme = ucwords($replaceme);
     }
     if (!empty($mytag->ucfirst)) {
         $replaceme = ucfirst($replaceme);
     }
     return $replaceme;
 }
Esempio n. 16
0
 function doexport()
 {
     if (!$this->isAllowed('subscriber', 'export')) {
         return;
     }
     JRequest::checkToken() or die('Invalid Token');
     acymailing::increasePerf();
     $filtersExport = JRequest::getVar('exportfilter');
     $listsToExport = JRequest::getVar('exportlists');
     $fieldsToExport = JRequest::getVar('exportdata');
     $inseparator = JRequest::getString('exportseparator');
     if (!in_array($inseparator, array(',', ';'))) {
         $inseparator = ';';
     }
     $exportLists = array();
     if (!empty($filtersExport['subscribed'])) {
         foreach ($listsToExport as $listid => $checked) {
             if (!empty($checked)) {
                 $exportLists[] = (int) $listid;
             }
         }
     }
     $exportFields = array();
     foreach ($fieldsToExport as $fieldName => $checked) {
         if (!empty($checked)) {
             $exportFields[] = acymailing::secureField($fieldName);
         }
     }
     $where = array();
     if (empty($exportLists)) {
         $querySelect = 'SELECT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing::table('subscriber') . ' as s';
     } else {
         $querySelect = 'SELECT DISTINCT s.`' . implode('`,s.`', $exportFields) . '` FROM ' . acymailing::table('listsub') . ' as a LEFT JOIN ' . acymailing::table('subscriber') . ' as s on a.subid = s.subid';
         $where[] = 'a.listid IN (' . implode(',', $exportLists) . ')';
         $where[] = 'a.status = 1';
     }
     if (!empty($filtersExport['confirmed'])) {
         $where[] = 's.confirmed = 1';
     }
     if (!empty($filtersExport['registered'])) {
         $where[] = 's.userid > 0';
     }
     if (JRequest::getInt('sessionvalues') and !empty($_SESSION['acymailing']['exportusers'])) {
         $where[] = 's.subid IN (' . implode(',', $_SESSION['acymailing']['exportusers']) . ')';
     }
     $query = $querySelect;
     if (!empty($where)) {
         $query .= ' WHERE (' . implode(') AND (', $where) . ')';
     }
     $db =& JFactory::getDBO();
     $db->setQuery($query);
     $allData = $db->loadAssocList();
     $exportFormat = JRequest::getString('exportformat');
     $encodingClass = acymailing::get('helper.encoding');
     @ob_clean();
     header("Pragma: public");
     header("Expires: 0");
     // set expiration time
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Content-Type: application/force-download");
     header("Content-Type: application/octet-stream");
     header("Content-Type: application/download");
     header("Content-Disposition: attachment; filename=acymailingexport.csv;");
     header("Content-Transfer-Encoding: binary");
     $eol = "\r\n";
     $before = '"';
     $separator = '"' . $inseparator . '"';
     $after = '"';
     echo $before . implode($separator, $exportFields) . $after . $eol;
     for ($i = 0, $a = count($allData); $i < $a; $i++) {
         if (!empty($allData[$i]['created'])) {
             $allData[$i]['created'] = acymailing::getDate($allData[$i]['created'], '%Y-%m-%d %H:%M:%S');
         }
         echo $before . $encodingClass->change(implode($separator, $allData[$i]), 'UTF-8', $exportFormat) . $after . $eol;
     }
     exit;
 }
Esempio n. 17
0
 function acymailing_generateautonews(&$email)
 {
     $return = null;
     $return->status = true;
     $return->message = '';
     $time = time();
     $match = '#{autocontent:(.*)}#Ui';
     $variables = array('subject', 'body', 'altbody');
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return $return;
     }
     $this->tags = array();
     $db =& JFactory::getDBO();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($this->tags[$oneTag])) {
                 continue;
             }
             $arguments = explode('|', strip_tags($allresults[1][$i]));
             $allcats = explode('-', $arguments[0]);
             $parameter = null;
             for ($i = 1; $i < count($arguments); $i++) {
                 $args = explode(':', $arguments[$i]);
                 $arg0 = $args[0];
                 if (isset($args[1])) {
                     $parameter->{$arg0} = $args[1];
                 } else {
                     $parameter->{$arg0} = true;
                 }
             }
             $selectedArea = array();
             foreach ($allcats as $oneCat) {
                 if (version_compare(JVERSION, '1.6.0', '<')) {
                     $sectype = substr($oneCat, 0, 3);
                     $num = substr($oneCat, 3);
                     if (empty($num)) {
                         continue;
                     }
                     if ($sectype == 'cat') {
                         $selectedArea[] = 'catid = ' . (int) $num;
                     } elseif ($sectype == 'sec') {
                         $selectedArea[] = 'sectionid = ' . (int) $num;
                     }
                 } else {
                     if (empty($oneCat)) {
                         continue;
                     }
                     $selectedArea[] = (int) $oneCat;
                 }
             }
             $query = 'SELECT a.id FROM `#__content` as a ';
             $where = array();
             if (!empty($parameter->featured)) {
                 $query .= 'LEFT JOIN `#__content_frontpage` as b ON a.id = b.content_id ';
                 $where[] = 'b.content_id IS NOT NULL';
             }
             if (!empty($selectedArea)) {
                 if (version_compare(JVERSION, '1.6.0', '<')) {
                     $where[] = implode(' OR ', $selectedArea);
                 } else {
                     $where[] = '`catid` IN (' . implode(',', $selectedArea) . ')';
                 }
             }
             if (!empty($parameter->filter) and !empty($email->params['lastgenerateddate'])) {
                 $condition = '`publish_up` >\'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\'';
                 $condition .= ' OR `created` >\'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\'';
                 if ($parameter->filter == 'modify') {
                     $condition .= ' OR `modified` > \'' . date('Y-m-d H:i:s', $email->params['lastgenerateddate'] - date('Z')) . '\'';
                 }
                 $where[] = $condition;
             }
             if (!empty($parameter->meta)) {
                 $allMetaTags = explode(',', $parameter->meta);
                 $metaWhere = array();
                 foreach ($allMetaTags as $oneMeta) {
                     if (empty($oneMeta)) {
                         continue;
                     }
                     $metaWhere[] = "`metakey` LIKE '%" . $db->getEscaped($oneMeta, true) . "%'";
                 }
                 if (!empty($metaWhere)) {
                     $where[] = implode(' OR ', $metaWhere);
                 }
             }
             $where[] = '`publish_up` < \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\'';
             $where[] = '`publish_down` > \'' . date('Y-m-d H:i:s', $time - date('Z')) . '\' OR `publish_down` = 0';
             $where[] = 'state = 1';
             if (isset($parameter->access)) {
                 $where[] = 'access <= ' . intval($parameter->access);
             } else {
                 if ($this->params->get('contentaccess', 'registered') == 'registered') {
                     $where[] = 'access <= 1';
                 } elseif ($this->params->get('contentaccess', 'registered') == 'public') {
                     $where[] = 'access = 0';
                 }
             }
             $query .= ' WHERE (' . implode(') AND (', $where) . ')';
             if (!empty($parameter->order)) {
                 $ordering = explode(',', $parameter->order);
                 $query .= ' ORDER BY a.`' . acymailing::secureField($ordering[0]) . '` ' . acymailing::secureField($ordering[1]);
             }
             $start = '';
             if (!empty($parameter->start)) {
                 $start = intval($parameter->start) . ',';
             }
             if (!empty($parameter->max)) {
                 $query .= ' LIMIT ' . $start . (int) $parameter->max;
             } elseif (empty($email->params['lastgenerateddate'])) {
                 $query .= ' LIMIT ' . $start . '20';
             }
             $db->setQuery($query);
             $allArticles = $db->loadResultArray();
             if (!empty($parameter->min) and count($allArticles) < $parameter->min) {
                 $return->status = false;
                 $return->message = 'Not enough articles for the tag ' . $oneTag . ' : ' . count($allArticles) . ' / ' . $parameter->min . ' between ' . acymailing::getDate($email->params['lastgenerateddate']) . ' and ' . acymailing::getDate($time);
             }
             $stringTag = '';
             if (!empty($allArticles)) {
                 if (file_exists(ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php')) {
                     ob_start();
                     require ACYMAILING_MEDIA . 'plugins' . DS . 'autocontent.php';
                     $stringTag = ob_get_clean();
                 } else {
                     $stringTag .= '<table>';
                     foreach ($allArticles as $oneArticleId) {
                         $stringTag .= '<tr><td>';
                         $args = array();
                         $args[] = 'joomlacontent:' . $oneArticleId;
                         if (!empty($parameter->type)) {
                             $args[] = 'type:' . $parameter->type;
                         }
                         if (!empty($parameter->link)) {
                             $args[] = 'link';
                         }
                         if (!empty($parameter->author)) {
                             $args[] = 'author';
                         }
                         if (!empty($parameter->lang)) {
                             $args[] = 'lang:' . $parameter->lang;
                         }
                         if (!empty($parameter->notitle)) {
                             $args[] = 'notitle';
                         }
                         if (!empty($parameter->created)) {
                             $args[] = 'created';
                         }
                         if (!empty($parameter->noreadmore)) {
                             $args[] = 'noreadmore';
                         }
                         if (isset($parameter->pict)) {
                             $args[] = 'pict:' . $parameter->pict;
                         }
                         if (!empty($parameter->wrap)) {
                             $args[] = 'wrap:' . $parameter->wrap;
                         }
                         if (!empty($parameter->maxwidth)) {
                             $args[] = 'maxwidth:' . $parameter->maxwidth;
                         }
                         if (!empty($parameter->maxheight)) {
                             $args[] = 'maxheight:' . $parameter->maxheight;
                         }
                         if (!empty($parameter->readmore)) {
                             $args[] = 'readmore:' . $parameter->readmore;
                         }
                         $stringTag .= '{' . implode('|', $args) . '}';
                         $stringTag .= '</td></tr>';
                     }
                     $stringTag .= '</table>';
                 }
             }
             $this->tags[$oneTag] = $stringTag;
         }
     }
     return $return;
 }
Esempio n. 18
0
					</td>
					<td>
						<a href="<?php 
    echo acymailing::completeLink('autonews&task=edit&cid[]=' . $row->mailid);
    ?>
">
							<?php 
    echo $row->subject;
    ?>

						</a>
					</td>
					<td align="center">
						<?php 
    echo acymailing::getDate($row->senddate);
    ?>

					</td>
					<td align="center">
						<?php 
    echo JText::_('EVERY') . ' ' . $this->delay->display($row->frequency);
    ?>

					</td>
					<td align="center">
						<?php 
    if (empty($row->fromname)) {
        $row->fromname = $this->config->get('from_name');
    }
    if (empty($row->fromemail)) {
Esempio n. 19
0
		</td>
		<td>
			<input class="inputbox" type="text" name="data[mail][params][issuenb]" size="10" value="<?php 
echo empty($this->mail->params['issuenb']) ? 1 : $this->mail->params['issuenb'];
?>
" />
		</td>
		<td>
			<?php 
echo JText::_('LAST_RUN');
?>

		</td>
		<td>
			<input type="text" class="inputbox"  value="<?php 
echo acymailing::getDate(@$this->mail->params['lastgenerateddate'], '%Y-%m-%d %H:%M');
?>
" name="data[mail][params][lastgenerateddate]"/>
		</td>
	</tr>
	<tr>
		<td>
			<?php 
echo JText::_('GENERATE_MODE');
?>

		</td>
		<td>
			<?php 
echo $this->generatingMode->display('data[mail][params][generate]', @$this->mail->params['generate']);
?>
Esempio n. 20
0
    echo $this->statusType->display('data[listsub][' . $row->listid . '][status]', @$row->status);
    ?>

						</td>
						<td align="center">
							<?php 
    if (!empty($row->subdate)) {
        echo acymailing::getDate($row->subdate);
    }
    ?>

						</td>
						<td align="center">
							<?php 
    if (!empty($row->unsubdate)) {
        echo acymailing::getDate($row->unsubdate);
    }
    ?>

						</td>
						<td align="center">
							<?php 
    echo $row->listid;
    ?>

						</td>
					</tr>
					<?php 
    $k = 1 - $k;
}
?>
Esempio n. 21
0
?>

		</td>
	</tr>
	<tr>
		<td>
			<?php 
echo JText::_('DELAY');
?>

		</td>
		<td>
			<?php 
echo $this->values->delay->display('data[mail][senddate]', (int) @$this->mail->senddate);
?>

		</td>
		<td>
			<?php 
echo JText::_('CREATED_DATE');
?>

		</td>
		<td>
			<?php 
echo acymailing::getDate(@$this->mail->created);
?>

		</td>
	</tr>
</table>
Esempio n. 22
0
 function acymailing_replaceusertags(&$email, &$user)
 {
     $match = '#{cbtag:(.*)}#Ui';
     $variables = array('subject', 'body', 'altbody');
     $found = false;
     foreach ($variables as $var) {
         if (empty($email->{$var})) {
             continue;
         }
         $found = preg_match_all($match, $email->{$var}, $results[$var]) || $found;
         if (empty($results[$var][0])) {
             unset($results[$var]);
         }
     }
     if (!$found) {
         return;
     }
     $values = null;
     if (!empty($user->userid)) {
         $db = JFactory::getDBO();
         $db->setQuery('SELECT * FROM ' . acymailing::table('comprofiler', false) . ' WHERE user_id = ' . $user->userid . ' LIMIT 1');
         $values = $db->loadObject();
     }
     $tags = array();
     foreach ($results as $var => $allresults) {
         foreach ($allresults[0] as $i => $oneTag) {
             if (isset($tags[$oneTag])) {
                 continue;
             }
             $arguments = explode('|', $allresults[1][$i]);
             $field = $arguments[0];
             unset($arguments[0]);
             $mytag = null;
             $mytag->default = $this->params->get('default_' . $field, '');
             if (!empty($arguments)) {
                 foreach ($arguments as $onearg) {
                     $args = explode(':', $onearg);
                     if (isset($args[1])) {
                         $mytag->{$args}[0] = $args[1];
                     } else {
                         $mytag->{$args}[0] = 1;
                     }
                 }
             }
             $replaceme = isset($values->{$field}) ? $values->{$field} : $mytag->default;
             if (!empty($mytag->type)) {
                 if ($mytag->type == 'date') {
                     if (empty($mytag->format)) {
                         $mytag->format = JText::_('DATE_FORMAT_LC3');
                     }
                     $replaceme = acymailing::getDate(strtotime($replaceme), $mytag->format);
                 }
                 if ($mytag->type == 'image' and !empty($replaceme)) {
                     $replaceme = '<img src="' . ACYMAILING_LIVE . 'images/comprofiler/' . $replaceme . '"/>';
                 }
             }
             if ($field == 'thumb') {
                 $replaceme = '<img src="' . ACYMAILING_LIVE . 'images/comprofiler/tn' . $values->avatar . '"/>';
             } elseif ($field == 'avatar') {
                 $replaceme = '<img src="' . ACYMAILING_LIVE . 'images/comprofiler/' . $values->avatar . '"/>';
             }
             if (!empty($mytag->lower)) {
                 $replaceme = strtolower($replaceme);
             }
             if (!empty($mytag->ucwords)) {
                 $replaceme = ucwords($replaceme);
             }
             if (!empty($mytag->ucfirst)) {
                 $replaceme = ucfirst($replaceme);
             }
             if (!empty($mytag->urlencode)) {
                 $replaceme = urlencode($replaceme);
             }
             $tags[$oneTag] = $replaceme;
         }
     }
     foreach ($results as $var => $allresults) {
         $email->{$var} = str_replace(array_keys($tags), $tags, $email->{$var});
     }
 }
Esempio n. 23
0
 * @copyright	Copyright (C) 2009-2010 ACYBA SARL - All rights reserved.
 * @license		http://www.acyba.com/commercial_license.php
 */
defined('_JEXEC') or die('Restricted access');
?>

<td align="right">
<?php 
foreach ($this->lists as $listid => $list) {
    if (empty($row->subscription->{$listid})) {
        continue;
    }
    $statuslistid = 'status_' . $listid . '_' . $row->subid;
    echo '<div id="' . $statuslistid . '" class="loading">';
    $extra = null;
    $extra['color'] = $this->lists[$listid]->color;
    $extra['tooltip'] = '<b>' . $this->lists[$listid]->name . '</b><br/><br/>';
    if ($row->subscription->{$listid}->status > 0) {
        $extra['tooltip'] .= '<b>Status : </b>';
        $extra['tooltip'] .= $row->subscription->{$listid}->status == '1' ? 'Subscribed' : 'Wait Confirmation';
        $extra['tooltip'] .= '<br/><b>Signed up date : </b>' . acymailing::getDate($row->subscription->{$listid}->subdate);
    } else {
        $extra['tooltip'] .= '<b>Status : </b>Unsubscribed<br/>';
        $extra['tooltip'] .= '<b>Unsubscribe date : </b>' . acymailing::getDate($row->subscription->{$listid}->unsubdate);
    }
    echo $this->toggleClass->toggle($statuslistid, $row->subscription->{$listid}->status, 'listsub', $extra);
    echo '</div>';
}
?>

</td>
Esempio n. 24
0
 function report()
 {
     $config = acymailing::config();
     $newConfig = null;
     $newConfig->cron_report = implode('<br/>', $this->messages);
     if (strlen($newConfig->cron_report) > 250) {
         $newConfig->cron_report = substr($newConfig->cron_report, 0, 245) . '...';
     }
     $config->save($newConfig);
     $saveReport = $config->get('cron_savereport');
     if (!empty($saveReport)) {
         $reportPath = JPath::clean(ACYMAILING_ROOT . trim(html_entity_decode($config->get('cron_savepath'))));
         file_put_contents($reportPath, "\r\n" . "\r\n" . str_repeat('*', 150) . "\r\n" . str_repeat('*', 20) . str_repeat(' ', 5) . acymailing::getDate(time()) . str_repeat(' ', 5) . str_repeat('*', 20) . "\r\n", FILE_APPEND);
         @file_put_contents($reportPath, implode("\r\n", $this->messages), FILE_APPEND);
         if ($saveReport == 2 and !empty($this->detailMessages)) {
             @file_put_contents($reportPath, "\r\n" . "---- Details ----" . "\r\n", FILE_APPEND);
             @file_put_contents($reportPath, implode("\r\n", $this->detailMessages), FILE_APPEND);
         }
     }
     $sendreport = $config->get('cron_sendreport');
     if (!empty($sendreport)) {
         $mailer = acymailing::get('helper.mailer');
         $mailer->autoAddUser = true;
         $mailer->report = false;
         $mailer->checkConfirmField = false;
         $receiverString = $config->get('cron_sendto');
         $receivers = explode(',', $receiverString);
         $mailer->addParam('report', implode('<br/>', $this->messages));
         $mailer->addParam('detailreport', implode('<br/>', $this->detailMessages));
         if ($sendreport == 1 or !empty($this->detailMessages)) {
             if (!empty($receivers)) {
                 foreach ($receivers as $oneReceiver) {
                     $mailer->sendOne('report', $oneReceiver);
                 }
             }
         }
     }
 }