本文整理汇总了PHP中acymailing类的典型用法代码示例。如果您正苦于以下问题:PHP acymailing类的具体用法?PHP acymailing怎么用?PHP acymailing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了acymailing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: language
function language()
{
$this->setLayout('default');
$code = JRequest::getString('code');
if (empty($code)) {
acymailing::display('Code not specified', 'error');
return;
}
$file = null;
$file->name = $code;
$path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini';
$file->path = $path;
jimport('joomla.filesystem.file');
$showLatest = true;
$loadLatest = false;
if (JFile::exists($path)) {
$file->content = JFile::read($path);
if (empty($file->content)) {
acymailing::display('File not found : ' . $path, 'error');
}
} else {
$loadLatest = true;
acymailing::display(JText::_('LOAD_ENGLISH_1') . '<br/>' . JText::_('LOAD_ENGLISH_2') . '<br/>' . JText::_('LOAD_ENGLISH_3'), 'info');
$file->content = JFile::read(JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'en-GB' . DS . 'en-GB.com_acymailing.ini');
}
if ($loadLatest or JRequest::getString('task') == 'latest') {
$doc =& JFactory::getDocument();
$doc->addScript(ACYMAILING_UPDATEURL . 'languageload&code=' . JRequest::getString('code'));
$showLatest = false;
} elseif (JRequest::getString('task') == 'save') {
$showLatest = false;
}
$this->assignRef('showLatest', $showLatest);
$this->assignRef('file', $file);
}
示例2: export
function export()
{
$selectedMail = JRequest::getInt('filter_mail', 0);
$selectedStatus = JRequest::getString('filter_status', '');
$filters = array();
if (!empty($selectedMail)) {
$filters[] = 'a.mailid = ' . $selectedMail;
}
if (!empty($selectedStatus)) {
if ($selectedStatus == 'bounce') {
$filters[] = 'a.bounce > 0';
} elseif ($selectedStatus == 'open') {
$filters[] = 'a.open > 0';
} elseif ($selectedStatus == 'notopen') {
$filters[] = 'a.open < 1';
} elseif ($selectedStatus == 'failed') {
$filters[] = 'a.fail > 0';
}
}
$query = 'SELECT `subid` FROM `#__acymailing_userstats` as a ';
if (!empty($filters)) {
$query .= ' WHERE (' . implode(') AND (', $filters) . ')';
}
$db =& JFactory::getDBO();
$db->setQuery($query);
$_SESSION['acymailing']['exportusers'] = $db->loadResultArray();
$this->setRedirect(acymailing::completeLink('data&task=export&sessionvalues=1', false, true));
}
示例3: acymailing_replaceusertags
function acymailing_replaceusertags(&$email, &$user)
{
if (!empty($email->altbody)) {
$email->altbody = str_replace(array('{statpicture}', '{nostatpicture}'), '', $email->altbody);
}
if (!$email->sendHTML or empty($email->type) or !in_array($email->type, array('news', 'autonews', 'followup')) or strpos($email->body, '{nostatpicture}')) {
$email->body = str_replace(array('{statpicture}', '{nostatpicture}'), '', $email->body);
return;
}
if (empty($user->subid)) {
return $this->acymailing_replaceusertagspreview($email, $user);
}
$widthsize = $this->params->get('width', 50);
$heightsize = $this->params->get('height', 1);
$width = empty($widthsize) ? '' : ' width="' . $widthsize . '" ';
$height = empty($heightsize) ? '' : ' height="' . $heightsize . '" ';
$statPicture = '<img alt="' . $this->params->get('alttext', '') . '" src="' . acymailing::frontendLink('index.php?option=com_acymailing&ctrl=stats&mailid=' . $email->mailid . '&subid=' . $user->subid) . '" border="0" ' . $height . $width . '/>';
if (strpos($email->body, '{statpicture}')) {
$email->body = str_replace('{statpicture}', $statPicture, $email->body);
} elseif (strpos($email->body, '</body>')) {
$email->body = str_replace('</body>', $statPicture . '</body>', $email->body);
} else {
$email->body .= $statPicture;
}
}
示例4: export
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);
}
}
示例5: onNewsletterSubscribe
/**
* 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;
}
示例6: remove
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();
}
示例7: listing
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;
}
示例8: generate
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();
}
示例9: addClick
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;
}
示例10: insert
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);
}
示例11: display
function display()
{
static $i = 0;
$i++;
$this->filters['group'] = JHTML::_('select.genericlist', $this->groups, "filter[{$i}][group]", 'class="inputbox" size="1"', 'value', 'text');
$this->filters['list'] = $this->status->display("filter[{$i}][list_status]", 1, false) . ' ' . JHTML::_('select.genericlist', $this->lists, "filter[{$i}][list]", 'class="inputbox" size="1"', 'value', 'text');
$this->filters['acymailingfield'] = JHTML::_('select.genericlist', $this->acymailingfields, "filter[{$i}][acymailingfield]", 'class="inputbox" size="1"', 'value', 'text');
$this->filters['acymailingfield'] .= ' ' . $this->operators->display("filter[{$i}][acymailingfield_operator]") . ' <input class="inputbox" type="text" name="filter[' . $i . '][acymailingfield_value]" size="50" value="">';
$this->filters['joomlafield'] = JHTML::_('select.genericlist', $this->joomlafields, "filter[{$i}][joomlafield]", 'class="inputbox" size="1"', 'value', 'text');
$this->filters['joomlafield'] .= ' ' . $this->operators->display("filter[{$i}][joomlafield_operator]") . ' <input class="inputbox" type="text" name="filter[' . $i . '][joomlafield_value]" size="50" value="">';
if (!empty($this->cbfield)) {
$this->filters['cbfield'] = JHTML::_('select.genericlist', $this->cbfield, "filter[{$i}][cbfield]", 'class="inputbox" size="1"', 'value', 'text');
$this->filters['cbfield'] .= ' ' . $this->operators->display("filter[{$i}][cbfield_operator]") . ' <input class="inputbox" type="text" name="filter[' . $i . '][cbfield_value]" size="50" value="">';
}
if (acymailing::level(3)) {
include dirname(__FILE__) . DS . 'filterenterprisedisplay.php';
}
$return = '<div id="filter_' . $i . '">';
$return .= JHTML::_('select.genericlist', $this->type, "filter[type][{$i}]", 'class="inputbox" size="1" onchange="updateFilter(' . $i . ');"', 'value', 'text');
foreach ($this->filters as $oneFilterName => $content) {
$return .= '<div id="filter_' . $i . $oneFilterName . '" style="display:none;margin-left:150px">';
$return .= $content;
$return .= '</div>';
}
$return .= '</div>';
return $return;
}
示例12: saveStats
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();
return true;
}
示例13: getMails
public static function getMails()
{
$db = JFactory::getDbo();
$query = "SELECT * FROM " . acymailing::table('mail') . " WHERE published = 1 AND visible = 1";
$db->setQuery($query);
return $db->loadObjectList();
}
示例14: getInput
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);
}
示例15: save
function save($list)
{
if (empty($list->listid)) {
if (empty($list->userid)) {
$user =& JFactory::getUser();
$list->userid = $user->id;
}
if (empty($list->alias)) {
$list->alias = $list->name;
}
}
if (isset($list->alias)) {
if (empty($list->alias)) {
$list->alias = $list->name;
}
$list->alias = JFilterOutput::stringURLSafe(trim($list->alias));
}
if (empty($list->listid)) {
$status = $this->database->insertObject(acymailing::table('list'), $list);
} else {
$status = $this->database->updateObject(acymailing::table('list'), $list, 'listid');
}
if ($status) {
return empty($list->listid) ? $this->database->insertid() : $list->listid;
}
return false;
}