| Server IP : 104.21.17.213 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/corbizre/gotofindhomes.com/components/LiteMail/Controllers/ |
Upload File : |
<?php
/**
* Documentation
* @author keeper
* @category
* @package
* @subpackage
* @copyright Copyright (c) 2005-2009 ITCrimea Ukraine Inc. (http://www.itcrimea.com)
* @license
*/
class LiteMail_SeriesController extends System_Controller_Db_Table
{
/**
* Logged in User_ID. Value setuped by init() function
*
* @var int
*/
//private $UserID = null;
/**
* Documentation
* @author keeper
* @return mixed
*/
function init()
{
parent::init();
//$this->UserID = $this->getRequest()->getParam('User_ID');
$this->_select->setIntegrityCheck(false);
$this->_selectCount->setIntegrityCheck(false);
}
/**
* Documentation
* @author keeper
* @return mixed
*/
function cronAction()
{
$this->_select->reset()->
from('mails_series', array('MailSeries_ID'=>'ID', 'Assign'=>'Assign', 'AssignID'=>'AssignID', 'Class'=>'Class', 'Method'=>'Method'))->
joinInner('mails_series_users', 'mails_series.ID = mails_series_users.MailSeries_ID', array('User_ID'=>'User_ID'))->
joinInner('mails_templates', 'mails_series.ID = mails_templates.MailSeries_ID', array('MailTemplate_ID'=>'ID'))->
joinLeft('mails_queues', 'mails_queues.User_ID = mails_series_users.User_ID AND mails_queues.MailTemplate_ID = mails_templates.ID', array())->
joinInner('users', 'users.ID = mails_series_users.User_ID', array())->
joinLeft('mails_unsubscribes', 'users.Email = mails_unsubscribes.Email', array())->
where(new Zend_Db_Expr('ISNULL(`mails_unsubscribes`.`ID`)'))->
where(new Zend_Db_Expr('ISNULL(mails_queues.ID)'))->
where('mails_templates.Active > 0')->
where(new Zend_Db_Expr('TO_DAYS(mails_series_users.AddedDate) <= (TO_DAYS(NOW())-mails_templates.Delay)'))->
//where(new Zend_Db_Expr('mails_series_users.User_ID IN (3,98)'))->
group(new Zend_Db_Expr('User_ID, MailTemplate_ID'));
$this->_select->setIntegrityCheck(false);
//echo $this->_select;
$objectData = $this->_model->fetchAll( $this->_select );
if (is_object($objectData) && $objectData->count() > 0) {
$tableUser = new User_Table();
$tableTemplate = new LiteMail_Template_Table();
foreach ($objectData as $objectRow) {
$objectUser = $tableUser->find($objectRow->User_ID)->current();
$objectTemplate = $tableTemplate->find($objectRow->MailTemplate_ID)->current();
if (!is_object($objectUser) || !is_object($objectTemplate)) {
continue;
}
// run remote function to get replacements array
$arrayReplacements = array();
if ($objectRow->Class && $objectRow->Method) {
try {
$Class = new $objectRow->Class();
$Method = $objectRow->Method;
$arrayReplacements = $Class->$Method($objectUser, $objectRow->AssignID);
if (!is_array($arrayReplacements)) $arrayReplacements = array();
} catch (Exception $e) {}
}
// add to queue
Zend_Loader::loadClass('LiteMail_Queue');
LiteMail_Queue::addToQueue( $objectTemplate,
$objectUser->Email,
$objectUser->Name .' '. $objectUser->LastName,
$arrayReplacements,
$objectUser->ID);
}
}
exit();
}
}