public function __construct() { if (!auto::isCliMode()) { throw new exception_base('cannot run daemon with http request!', -1); } $this->_init(); }
public function add($level, $msg) { //as a logger, i won't throw any exception to interrupt your program if (!isset($this->_conf[$level])) { if (auto::isDebugMode() || auto::isDevMode()) { auto::dqueue('<font color=red>warning</font>', 'log got no conf for level:' . $level); } else { return false; } } $rotation = $this->_getRotationByLevel($level); if (!$rotation) { $rotation = 'default'; } $dir = $this->_conf[$level]['path']; if (!is_dir($dir)) { $mk = @mkdir($dir, 777, true); if (!$mk) { auto::isDebugMode() && auto::dqueue('<font color=red>warning</font>', 'failed for make log dir:' . $dir); return false; } } $logFile = $dir . DS . $rotation . '.log'; if (!is_scalar($msg)) { $msg = var_export($msg, true); } $msg = date('Y-m-d H:i:s') . "\t" . $level . "\t" . $msg . "\n"; file_put_contents($logFile, $msg, FILE_APPEND); }
public static function topDeal404($e) { if (!auto::isDebugMode() && !auto::isCliMode()) { echo '404, page not found!'; } else { //debugmode or in sapi mode var_dump($e->getMessage(), $e->getCode()); } }
public static function topDeal($e) { if (!auto::isDebugMode() && !auto::isCliMode()) { //response::top404(); echo 'error occured!'; } else { //debugmode or in sapi mode var_dump($e->getMessage(), $e->getCode()); } }
public function __call($funcName, $arguments) { auto::isDebugMode() && ($_debugMicrotime = microtime(true)); if (!$this->_memcached) { throw new exception_cache('connection error!' . (auto::isDebugMode() ? var_export($this->_confs, true) : ''), exception_cache::type_server_connection_error); } $ret = call_user_func_array(array($this->_memcached, $funcName), $arguments); auto::isDebugMode() && auto::dqueue(__CLASS__ . '::' . $funcName, 'cost ' . (microtime(true) - $_debugMicrotime) . 's, arguments: ' . var_export($arguments, true)); return $ret; }
public function connect($type = null) { if ($type === null) { throw new exception_mysqlpdo('no type specified for mysqlpdo connection!', exception_mysqlpdo::type_conf_error); } auto::isDebugMode() && ($_debugMicrotime = microtime(true)); //$type = self::TYPE_SERVER_MASTER; //every time run "new db_mysqlpdo($conf)->connect($type)" would reconnect the mysql database! $this->_pdoCon = $this->_getPdo($type); auto::isDebugMode() && auto::dqueue(__METHOD__, 'cost ' . (microtime(true) - $_debugMicrotime) . 's, alias: ' . $this->_alias . ',conf ' . var_export($this->_confs, true)); return $this->_pdoCon; }
public function getAutosCliente($rut) { $vectorData; $link = $this->conexionBD->getConexion(); //conexion a la bd $query = "SELECT * FROM auto where rut_cliente='{$rut}';"; $result = mysql_query($query, $link) or die(mysql_error()); //ejecuto la query $i = 0; while ($row = mysql_fetch_array($result)) { $auto = new auto(); $auto->setPatente($row['patente']); $auto->setMarca($row['marca']); $auto->setModelo($row['modelo']); $auto->setColor($row['color']); $auto->setRut($row['rut_cliente']); $vectorData[$i] = $auto; $i++; } mysql_close($link); if (empty($vectorData)) { return null; } return $vectorData; }
/** * run plugins of this type * @param type $type */ public static function run($type) { if (isset(self::$_plugins[$type]) && is_array(self::$_plugins[$type])) { while (self::$_plugins[$type]) { $plugin = array_shift(self::$_plugins[$type]); auto::isDebugMode() && ($_debugMicrotime = microtime(true)); auto::isDebugMode() && auto::dqueue(__METHOD__ . " ('{$plugin}') ", 'start ---->>>>'); self::_execPlugin($plugin); auto::isDebugMode() && auto::dqueue(__METHOD__ . " ('{$plugin}') ", 'end,<<<<---- cost ' . (microtime(true) - $_debugMicrotime) . 's'); self::$_pluginsHasRun[] = $plugin; } } }
public function fetch($path = '') { auto::isDebugMode() && ($_debugMicrotime = microtime(true)); if ($path) { $ret = $this->_render->fetch($path); auto::isDebugMode() && auto::dqueue(__METHOD__ . '(' . $path . ')', 'cost ' . (microtime(true) - $_debugMicrotime) . 's '); return $ret; } $dir = dispatcher::instance()->getModuleName(); $controller = dispatcher::instance()->getControllerName(); $action = dispatcher::instance()->getActionName(); if (dispatcher::instance()->getPathDeep() == dispatcher::path_deep3) { $path = $dir . DS . $controller . DS . $action; } else { $path = $controller . DS . $action; } $ret = $this->_render->fetch($path); auto::isDebugMode() && auto::dqueue(__METHOD__ . '(' . $path . ')', 'cost ' . (microtime(true) - $_debugMicrotime) . 's '); return $ret; }
function saveConfig($config) { $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $configKeys = array_keys($config); $size = sizeof($configKeys); for ($index = 0; $index < $size; $index++) { if (get_magic_quotes_gpc()) { $key = stripslashes($configKeys[$index]); $text = stripslashes($config[$configKeys[$index]]); } else { $key = $configKeys[$index]; $text = $config[$configKeys[$index]]; } $key = stripslashes($key); $key = str_replace("'", "", $key); if ($key == 'token_new' && !empty($text)) { $key = 'token'; $erro->ck = $this->update('license', ''); } if ($key == 'license1') { $text = trim($text); $key = 'license'; } if (isset($GLOBALS[ACA . $key]) and $GLOBALS[ACA . $key] != $text) { if ($key == 'token') { $code = auto::getToken($text); } $erro->ck = $this->update($key, $text); } $erro->E(__LINE__, '9010', $config); } if (class_exists('auto')) { auto::good(); } return $erro->R(); }
* @desc http request entrance file * */ //============================ 定义 app 路径(必须)================================ define('APP_PATH', dirname(dirname(__FILE__))); define('DS', DIRECTORY_SEPARATOR); //============================ 定义框架地址(必须)============================ define('AUTOPHP_PATH', APP_PATH . DS . 'framework'); try { //============================ 开始加载框架!============================ require AUTOPHP_PATH . DS . 'auto.php'; //auto::run() 当前主要负责加载autoload 和一些常量定义的检测 auto::run(); //关掉或开启debugMode,此处可以不处理,默认为关闭! $debugMode = true; auto::setDebugMode($debugMode); //设置时区 date_default_timezone_set("Asia/Shanghai"); //============================ 失效的plugin ============================ //停用了 CLI 模式下的 route,因此最简单的damon 方式中,plugin 不会执行! // plugin::add('Plugin_Wbinit', plugin::TYPE_BEFORE_RUN); // plugin::add('Plugin_BackEnd', plugin::TYPE_AFTER_RUN); //plugin::add('Plugin_Requestend', plugin::TYPE_AFTER_RUN); //============================ 对request 的数据进行处理 ============================ //是否开启对 $_POST, $_GET, $_COOKIE 的防跨站处理 //request::setAntiXssMode(false); //(必要)此处主要是为了提高一些获取效率,进行一次读入,同时也对原生 $_POST 等做了销毁 //request::init(); //其实 request 应该废弃,但如果需要的话,可以自己模拟一些 $_POST 和 $_GET 数据 //$data = array('name'=>'rico', 'gender'=>'man'); //request::setParams($data, 'post');
<?php include_once '../TO/auto.php'; include_once '../logica/principalAuto.php'; //recibo los datos del formulario cliente $patente = $_POST['patente']; $marca = $_POST['marca']; $modelo = $_POST['modelo']; $color = $_POST['color']; $rut = $_POST['rut']; //creo el objeto cliente $elAuto = new auto(); //empaqueto la informacion del cliente en el objeto $elAuto->setPatente($patente); $elAuto->setMarca($marca); $elAuto->setModelo($modelo); $elAuto->setColor($color); $elAuto->setRut($rut); //derivar la trasacción a donde corresponde.---> a la logica $jefa = principalAuto::getInstance(); $jefa->modificarAutoDos($elAuto); $message = "Auto actualizado correctamente"; echo "<script type='text/javascript'>alert('{$message}');</script>"; $yourURL = "listarAutos.php"; echo "<script>location.href='{$yourURL}'</script>";
<?php include_once 'auto.php'; $ditprogramma = new auto(); $ditprogramma->setNaam("Mijn eerste programma"); $ditprogramma->setOmschrijving("Even testen"); foreach ($ditprogramma->getProgramma() as $p) { echo $p . "<br>"; }
function lang($key, $args = null) { if (!class_exists('i18n') || !auto::hasRun()) { return null; } if ($args === null) { return call_user_func_array(array('i18n', 'get'), array($key)); } return call_user_func_array(array('i18n', 'vget'), array($key, $args)); }
function updateList($listId, $listUpdated, $status, $new) { $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $total = 0; @set_time_limit(0); if ($listUpdated->list_type != '7' and $listUpdated->delay_min > $listUpdated->delay_max) { $listUpdated->delay_min = $listUpdated->delay_max; } $erro->ck = lists::updateListData($listUpdated); if (!$erro->Eck(__LINE__, '8304')) { return false; } else { if ($listUpdated->auto_add == 2) { subscribers::updateSubscribers(true); $subscribers = subscribers::getSubscribers(-1, -1, '', $total, 0, '', 1, 1, ''); $subId = acajoom::convertObjectToIdList($subscribers, 'id'); if (!empty($subId)) { $erro->ck = queue::updateQueues($subId, '', $listId, $listUpdated->acc_id, $new); if (!$erro->Eck(__LINE__, '8305')) { return false; } } } elseif ($status == '' and $listUpdated->list_type == 2) { $queues = queue::getAllOneList($listId); $qid = acajoom::convertObjectToIdList($queues, 'qid'); $erro->ck = queue::updatePublished($qid, $status); if (!$erro->Eck(__LINE__, '8306')) { return false; } } else { if (class_exists('auto')) { auto::updateListNb($listUpdated->list_type, $listUpdated->id); } } } lisType::updateNewsletters(); return true; }
function saveMailing(&$mailingId, $listId) { global $database; $list = lists::getOneList($listId); $allow_html = compa::allow_html(); $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $xf = new xonfig(); $listType = mosGetParam($_REQUEST, 'listype', 0); $senddate = mosGetParam($_REQUEST, 'senddate', '0000-00-00 00:00:00'); if (mosGetParam($_REQUEST, 'task', '') == 'saveSend') { $senddate = acajoom::getNow(); } $subject = mosGetParam($_REQUEST, 'subject', '', $allow_html); $content = mosGetParam($_REQUEST, 'content', '', $allow_html); $alt_content = mosGetParam($_REQUEST, 'alt_content', '', _MOS_ALLOWRAW); $published = mosGetParam($_REQUEST, 'published', 0); $visible = mosGetParam($_REQUEST, 'visible', 1); $html = mosGetParam($_REQUEST, 'html', 1); $new_list = mosGetParam($_REQUEST, 'new_list', 0); $fromname = mosGetParam($_REQUEST, 'fromname', ''); $fromemail = mosGetParam($_REQUEST, 'fromemail', ''); $frombounce = mosGetParam($_REQUEST, 'frombounce', ''); $userid = mosGetParam($_REQUEST, 'userid', 0); $delay = mosGetParam($_REQUEST, 'delay', 1); $acc_level = mosGetParam($_REQUEST, 'acc_level', $list->acc_id); $issue_nb = mosGetParam($_REQUEST, 'issue_nb', 1); $delay = $delay * 24 * 60; $attachments = mosGetParam($_REQUEST, 'attachments', ''); $attach = ''; if (!empty($attachments)) { foreach ($attachments as $attachment) { $attach .= $attachment . "\n"; } } if (!empty($_FILES['file_0']['name'])) { $otherAttachs = xmailing::uploadFiles(); if (!empty($otherAttachs)) { foreach ($otherAttachs as $otherAttach) { $attach .= '/' . $otherAttach . "\n"; } } } $images = mosGetParam($_REQUEST, 'images', ''); if ($html == 0) { $alt_content = $content; } if ($senddate != '0000-00-00 00:00:00' and $senddate > acajoom::getNow()) { $published = 2; } if ($new_list != 0) { $query = 'INSERT INTO `#__acajoom_mailings` (`list_id`, `list_type`, `send_date`, `subject`, `htmlcontent`, `textonly`, `attachments`, `images`, `published`, `html`, `visible`, `fromname`, `fromemail`, `frombounce`, `author_id`, `delay`, `issue_nb` , `acc_level` , `createdate`) VALUES( \'' . $listId . '\', \'' . $listType . '\', \'' . $senddate . '\', \'' . addslashes($subject) . '\', \'' . addslashes($content) . '\', \'' . addslashes($alt_content) . '\', \'' . $attach . '\', \'' . $images . '\', \'' . $published . '\', \'' . $html . '\', \'' . $visible . '\', \'' . $fromname . '\', \'' . $fromemail . '\', \'' . $frombounce . '\', \'' . $userid . '\', \'' . $delay . '\', \'' . $issue_nb . '\', \'' . $acc_level . '\' , \'' . acajoom::getNow() . '\' ) '; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); $query = 'SELECT max(id) FROM `#__acajoom_mailings` WHERE `list_id` = ' . $listId . ' AND `issue_nb` = \'' . $issue_nb . '\''; $query .= ' AND `published` != -1 '; $database->setQuery($query); $mailingId = $database->loadResult(); $erro->err .= $database->getErrorMsg(); if ($mailingId == 1) { $xf->update('firstmailing', $listType); } $xf->plus('totalmailing0', 1); $xf->plus('act_totalmailing0', 1); $xf->plus('totalmailing' . $listType, 1); $xf->plus('act_totalmailing' . $listType, 1); xmailing::insertStatsGlobal($mailingId); } else { $query = "UPDATE `#__acajoom_mailings` SET " . "\t`subject` = '" . addslashes($subject) . "', " . "\t`htmlcontent` = '" . addslashes($content) . "', " . "\t`textonly` = '" . addslashes($alt_content) . "', " . "\t`attachments` = '{$attach}', " . "\t`images` = '{$images}', " . "\t`published` = '{$published}', " . "\t`html` = {$html} , " . "\t`visible` = {$visible} , " . "\t`fromname` = '{$fromname}', " . "\t`fromemail` = '{$fromemail}', " . "\t`frombounce` = '{$frombounce}', " . "\t`author_id` = '{$userid}' , " . "\t`delay` = {$delay} , " . "\t`acc_level` = {$acc_level} , " . "\t`send_date` = '{$senddate}' " . "\tWHERE `id` = {$mailingId} "; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); } if (!$erro->E(__LINE__, '8414', $database)) { return false; } else { lisType::updateNewsletters(); if ($listType == 2) { if ($new_list) { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, ''); } else { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, $mailingId, 1, 1, ''); } $subsId = acajoom::convertObjectToIdList($subscribers, 'id'); if (!empty($subsId)) { $queues = queue::getAllOneList($listId); if (!empty($queues)) { if ($queues[0]->mailing_id == 0) { $qids = acajoom::convertObjectToIdList($queues, 'qid'); $erro->ck = queue::updateQueues('', $qids, $listId, $acc_level, false); } else { $erro->ck = queue::updateQueues($subsId, '', $listId, $acc_level, false); } } else { return true; } if (!$erro->Eck(__LINE__, '8415')) { return false; } } } elseif ($listType == 1 and $senddate > acajoom::getNow()) { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, ''); $subsId = acajoom::convertObjectToIdList($subscribers, 'id'); if (!empty($subsId)) { if ($new_list == 1) { if (class_exists('auto')) { $erro->ck = auto::insertQueuesForScheduledNews($subsId, $listId, $acc_level, $mailingId, $senddate); } } else { $queues = queue::getQueueFromMailingId($mailingId); if (!empty($queues)) { $erro->ck = queue::updateQueueData('', $subsId, 1, $listId, $mailingId, $issue_nb, $senddate, 0, $acc_level, 2); return $erro->Eck(__LINE__, '8417', 'put here 1 $d'); } else { if (class_exists('auto')) { $erro->ck = auto::insertQueuesForScheduledNews($subsId, $listId, $acc_level, $mailingId, $senddate); } } } return $erro->Eck(__LINE__, '8416', 'put here 2 $d'); } } return true; } }
public function structure($fullType = false) { auto::isDebugMode() && ($_debugMicrotime = microtime(true)); if (isset(self::$_tableStructure[$this->_dbAlias][$this->_table])) { return self::$_tableStructure[$this->_dbAlias][$this->_table]; } $sql = "DESC " . $this->_table; $this->_lastQuery = $sql; $sth = $this->_getPdoByMethodName()->prepare($sql); $res = $sth->execute(array()); if (!$res) { $this->_raiseError('select query failed~', exception_mysqlpdo::type_query_error); } $dt = $sth->fetchAll(PDO::FETCH_ASSOC); if (!$fullType && is_array($dt)) { $fields = array(); foreach ($dt as $v) { $fields[] = $v['Field']; } $dt = $fields; } self::$_tableStructure[$this->_dbAlias][$this->_table] = $dt; auto::isDebugMode() && auto::dqueue(__METHOD__, 'cost ' . (microtime(true) - $_debugMicrotime) . 's of query: ' . var_export($this->_lastQuery, true)); return $dt; }
function updateQueues($subId, $qids, $listId, $acc_level, $new) { if (ACA_CMSTYPE) { $database =& JFactory::getDBO(); } else { global $database; } //endif $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $list = lists::getOneList($listId); if ($list->list_type == 1) { if ($new) { if (!empty($subId)) { $erro->ck = queue::insertQueuesForNews($subId, $listId, $acc_level); $erro->Eck(__LINE__, '8504'); } else { if (!empty($qids)) { $qid = implode(',', $qids); $query = 'SELECT `subscriber_id` FROM `#__acajoom_queue` WHERE `qid` IN ( ' . $qid . ' ) '; $database->setQuery($query); $subIds = $database->loadObjectList(); $erro->err = $database->getErrorMsg(); } foreach ($subIds as $v) { $subId[] = $v->subscriber_id; } $erro->ck = queue::insertQueuesForNews($subId, $listId, $acc_level); $erro->E(__LINE__, '8505'); } } else { if (!empty($subId)) { $erro->ck = queue::updateQueueData('', $subId, 0, $listId, 0, 0, 0, 0, $acc_level, 0); $erro->Eck(__LINE__, '8506'); } elseif (!empty($qids)) { $erro->ck = queue::updateQueueData($qids, '', 0, $listId, 0, 0, 0, 0, $acc_level, 0); $erro->Eck(__LINE__, '8507'); } } } elseif ($list->list_type == 7) { $newQueue->list_id = $list->id; $newQueue->mailing_id = 0; $newQueue->issue_nb = 0; $newQueue->send_date = 0; $newQueue->delay = 0; $newQueue->acc_level = $acc_level; $newQueue->published = $list->published; $erro->ck = autonews::insertQueuesForAutoNews($subId, $newQueue); $erro->Eck(__LINE__, '8508'); } else { if ($new) { if (!empty($subId)) { $mailingId = 0; $mailing = queue::getValidMailing($list, $mailingId); if (!empty($mailing)) { if (class_exists('auto')) { if ($mailing->list_type == 2) { $newQueue->list_id = $mailing->list_id; $newQueue->mailing_id = $mailing->id; $newQueue->issue_nb = $mailing->issue_nb; $newQueue->send_date = acajoom::getNow($mailing->delay); $newQueue->delay = $mailing->delay; $newQueue->acc_level = $acc_level; $newQueue->published = $list->published; $erro->ck = auto::insertQueuesForAuto($subId, $newQueue); $erro->Eck(__LINE__, '8508'); } else { $erro->ck = queue::insertQueuesForNews($subId, $mailing->list_id, $acc_level); $erro->Eck(__LINE__, '8509'); } } } else { if (class_exists('auto')) { $newQueue->list_id = $list->id; $newQueue->mailing_id = 0; $newQueue->issue_nb = 0; $newQueue->send_date = 0; $newQueue->delay = 0; $newQueue->acc_level = $acc_level; $newQueue->published = $list->published; $erro->ck = auto::insertQueuesForAuto($subId, $newQueue); $erro->Eck(__LINE__, '8510'); } } } elseif (!empty($qids)) { //On r�cup�re le premier mail du follow up $mailingId = xmailing::getFirstMailingId($listId); if (!empty($mailingId)) { $mailing = queue::getValidMailing($list, $mailingId); if (!empty($mailing)) { if ($mailing->list_type == 2) { //$subscribers = subscribers::getSubscribers( -1 , -1 , '' , $total , $listId, '', 1, 1,'' ); //$subId = acajoom::convertObjectToIdList($subscribers , 'id'); if (!empty($subId)) { $erro->ck = queue::updateQueueData('', $subId, $mailing->list_type, $listId, $mailing->id, $mailing->issue_nb, 0, $mailing->delay, 0, 1); $erro->Eck(__LINE__, '8511'); } else { $erro->ck = queue::updateQueueData($qids, '', $mailing->list_type, $listId, $mailing->id, $mailing->issue_nb, 0, $mailing->delay, 0, 1); $erro->Eck(__LINE__, '8511'); } } else { $subscribers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, ''); $subId = acajoom::convertObjectToIdList($subscribers, 'id'); $erro->ck = queue::insertQueuesForNews($subId, $mailing->list_id, $acc_level); $erro->Eck(__LINE__, '8512'); } } } } } else { if (!empty($subId)) { $mailing = queue::getValidMailing($list, 0); if (!empty($mailing)) { $erro->ck = queue::updateQueueData('', $subId, $list->list_type, $listId, '', '', 0, '', 0, $list->published); } else { $erro->ck = queue::updateQueueData('', $subId, $mailing->list_type, $mailing->list_id, $mailing->id, $mailing->issue_nb, acajoom::getNow(), $mailing->delay, $acc_level, $mailing->published); } $erro->E(__LINE__, '8513'); } elseif (!empty($qids)) { $mailing = queue::getValidMailing($list, 0); if (!empty($mailing)) { if ($mailing->list_type == 2) { $erro->ck = queue::updateQueueData($qids, '', $list->list_type, $listId, $mailing->id, $mailing->issue_nb, acajoom::getNow(), $mailing->delay, 0, 1); $erro->E(__LINE__, '8514'); } else { $subId = acajoom::convertObjectToIdList($qids, 'subscriber_id'); $erro->ck = queue::deleteQueues($qids); $erro->Eck(__LINE__, '8515'); $erro->ck = queue::insertQueuesForNews($subId, $mailing->list_id, $acc_level); $erro->Eck(__LINE__, '8516'); } } } } } return $erro->R(); }
function sendSchedule($d, $showHTML, $receivers, $list, &$message, &$max, $tags = null) { static $countEmails = 0; $mailing = $d['mailing']; $h = ''; $xf = new xonfig(); if (empty($mailing)) { $message = _ACA_NO_MAILING_ENTERED; return false; } elseif (empty($receivers)) { $message = _ACA_NO_ADDRESS_ENTERED; return false; } elseif (empty($list)) { $message = _ACA_NO_LIST_ENTERED; return false; } else { $message = ''; } $mailingId = $mailing->id; $issue_nb = $mailing->issue_nb; $subject = $mailing->subject; $content = $mailing->htmlcontent; $textonly = $mailing->textonly; $fromname = $mailing->fromname; $fromemail = $mailing->fromemail; $images = $mailing->images; $listId = $list->id; $html = $list->html; $layout = $list->layout; $totalsofar = number_format(0, 4, ',', ''); $nbPause = 0; $tags['issuenb'] = $issue_nb; //Just in case of... @ini_set('max_execution_time', 0); @ini_set('memory_limit', '128M'); ignore_user_abort(true); ### create the mail $mail = acajoom_mail::getMailer($mailing); ### create content acajoom_mail::getContent($images, $layout, $content, $textonly, true); $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; $html_sent = 0; $text_sent = 0; $size = sizeof($receivers); $format = defined('_DATE_FORMAT_LC') ? _DATE_FORMAT_LC : JText::_('DATE_FORMAT_LC'); $log_detailed = "\r\n" . "\r\n" . '*** ' . strftime($format) . ' ***' . "\r\n"; //variables used in integration of jLinks $mailCatID = null; $convertedLinks = null; foreach ($receivers as $receiver) { $tags['user_id'] = $receiver->user_id; if ($html && intval($receiver->receive_html) == 1) { $mail->IsHTML(true); $ashtml = 1; $Altbody = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, 0, $tags); $mail->AltBody = acajoom_mail::safe_utf8_encode($Altbody, $mail->CharSet); $html_sent++; $mail->Body = acajoom_mail::replaceTags($content, $receiver, $list, $mailingId, $ashtml, $tags); acajoom_mail::replaceClass($mail->Body, $mail->AltBody, $receiver); } else { $mail->IsHTML(false); $mail->AltBody = ''; $ashtml = 0; $text_sent++; $mail->Body = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, $ashtml, $tags); $simpleText = ''; acajoom_mail::replaceClass($mail->Body, $simpleText, $receiver); } $tname = explode(" ", $receiver->name); $firstname = $tname[0]; $toUser = $GLOBALS[ACA . 'minisendmail'] ? '' : $receiver->name; $mail->AddAddress($receiver->email, $toUser); if (!empty($receiver->id)) { $mail->addCustomHeader("X-SubscriberID: {$receiver->id}"); } $username = empty($receiver->username) ? $firstname : $receiver->username; $date = ACA_CMSTYPE ? JHTML::_('date', acajoom::getNow(), JText::_('DATE_FORMAT_LC1'), 0) : mosFormatDate(acajoom::getNow(), '', 0); $replaceWhat = array('[NAME]', '[FIRSTNAME]', '[USERNAME]', '[DATE]'); $replaceBy = array($receiver->name, $firstname, $username, $date); $sujetReplaced = str_replace($replaceWhat, $replaceBy, $subject); if (class_exists('auto')) { auto::tags($sujetReplaced, $tags); } $mail->Subject = $sujetReplaced; if ($GLOBALS[ACA . 'embed_images']) { acajoom_mail::embedImages($mail); } $mailssend = $mail->Send(); $countEmails++; if ($countEmails >= $GLOBALS[ACA . 'cron_max_emails']) { $max = true; } if (!$mailssend || $mail->error_count > 0) { static $info = false; if (!$info and acajoom::checkPermissions('admin')) { echo '<br/>Mailer Error : ' . $mail->ErrorInfo; echo " : Newsletter '{$sujetReplaced}' to {$receiver->email}"; $info = true; } $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_NOT . "\r\n" . _ACA_MAILER_ERROR . ': ' . $mail->ErrorInfo . "\r\n"; if ($html && intval($receiver->receive_html) == 1) { $html_sent--; } else { $text_sent--; } if (!subscribers::validEmail($receiver->email, true)) { $deleteQueue = array(); $deleteQueue[0] = queue::whatQID($mailingId, $receiver->id, $d['listype']); queue::deleteQueues($deleteQueue); } } else { $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_SENT_SUCCESSFULLY . "\r\n"; if ($GLOBALS[ACA . 'enable_statistics'] == 1 and $GLOBALS[ACA . 'statistics_per_subscriber'] == 1) { xmailing::insertStats($mailingId, $receiver->id, $ashtml); } $d['qids'] = array(); $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); if ($d['listype'] == '2') { $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']); $erro->ck = auto::updateAutoresponderSent($d); $erro->Eck(__LINE__, '8137', $d); } elseif ($d['listype'] == '1' || $d['listype'] == '7') { $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']); $erro->ck = queue::deleteQueues($d['qids']); $erro->Eck(__LINE__, '8127', $d); } } $mail->ClearAddresses(); } if ($GLOBALS[ACA . 'enable_statistics'] == 1) { xmailing::updateStatsGlobal($mailingId, $html_sent, $text_sent, false); } $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; if ($totalsofar > 0) { $totaltime = $totalsofar; $totalstr = strval($totaltime); } else { $totaltime = number_format($endtime - $starttime - $nbPause * $GLOBALS[ACA . 'pause_time'], 4, ',', ''); $totalstr = strval($totaltime); } $xf->plus('totalmailingsent' . $list->list_type, $html_sent + $text_sent); $xf->plus('totalmailingsent0', $html_sent + $text_sent); $log_simple = 'Time to send: ' . $totalstr . ' ' . _ACA_SECONDS . "\r\n" . 'Number of subscribers: ' . ($text_sent + $html_sent) . "\r\n" . 'HTML format: ' . $html_sent . "\r\n" . 'Text format: ' . $text_sent . "\r\n"; $log_detailed = $log_simple . 'Details: ' . "\r\n" . $log_detailed . "\r\n"; if (class_exists('lisType')) { acajoom_mail::writeLogs($list, $log_simple, $log_detailed); } if ($d['listype'] == '2') { echo '<br/>' . _ACA_QUEUE_AUTO_PROCESSED; } elseif ($d['listype'] == '1') { echo '<br/>' . _ACA_QUEUE_NEWS_PROCESSED; } if ($html_sent + $text_sent > 0) { return true; } else { $message = xmailing::M('no', _ACA_NO_MAILING_SENT); return false; } }
public function render($path) { auto::isDebugMode() && auto::dqueue('render data for ' . $path, '<pre>' . rico::export($this->data) . '</pre>'); $data = $this->fetch($path); response::output($data); }
/** * @copyright Copyright (C) 2009 Joobi Limited All rights reserved. * @license This file is released under the GPL license (http://www.gnu.org/licenses ) * @link http://www.ijoobi.com */ function mailing($action, $task, $listId, $listType, $mailingId, $message) { $showMailings = false; switch ($task) { case 'edit': if (ACA_CMSTYPE) { // joomla 15 $issue_nb = intval(JRequest::getVar('issue_nb', 1)); } else { //joomla 1x $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 1)); } //endif $list = lists::getOneList($listId); $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new); $show = lisType::showType($mailing->list_type, 'editmailing'); if ($mailing->published != 1 or $mailing->list_type != 1 or isset($show['admin']) and $show['admin']) { $forms['main'] = " <form action='index2.php' method='post' enctype='multipart/form-data' name='adminForm'> \n "; xmailing::_header($task, $action, $mailing->list_type, $message, 'edit'); mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show); $go[] = acajoom::makeObj('act', $action); backHTML::formEnd($go); } else { $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r"; xmailing::_header($task, $action, $mailing->list_type, $message); //backHTML::formStart(); mailingsHTML::viewMailing($mailing, $forms); $go[] = acajoom::makeObj('act', 'mailing'); $go[] = acajoom::makeObj('task', 'viewmailing'); $go[] = acajoom::makeObj('listid', $mailing->list_id); backHTML::formEnd($go); } break; case 'new': case 'add': if ($listId == 0) { echo "<script> alert('" . addslashes(_ACA_SELCT_MAILING) . "'); window.history.go(-1);</script>\n"; return false; } else { $total = xmailing::countMailings($listId, ''); $total++; compa::redirect('index2.php?option=com_acajoom&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listid=' . $listId); } break; case 'saveSend': xmailing::saveMailing($mailingId, $listId); case 'sendNewsletter': if ($listId < 1 or $listType < 0) { $mailing = xmailing::getOneMailing('', $mailingId, '', $new, true); $listId = $mailing->list_id; $listType = $mailing->list_type; } if (lisType::sendType($listType)) { $checkStatus = lists::checkStatus($listId); if ($checkStatus == false) { $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NOT_PUBLISHED); $showMailings = true; } else { $receivers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, 'sub_emailA'); if (empty($receivers)) { $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NO_SUSCRIBERS); $showMailings = true; } else { $status = queue::sendNewsletter(true, $mailingId, $listId, $receivers, $message); $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message); $showMailings = true; flush(); sleep(5); compa::redirect('index2.php?option=com_acajoom&act=mailing&listype=' . $listType, $message); } } } else { if (class_exists('auto')) { $message = acajoom::printYN(auto::processQueue(true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR); } $showMailings = true; } break; case 'savePreview': xmailing::saveMailing($mailingId, $listId); case 'preview': if (ACA_CMSTYPE) { // joomla 15 $emailaddress = JRequest::getVar('emailaddress', ''); } else { //joomla 1x $emailaddress = mosGetParam($_REQUEST, 'emailaddress', ''); } //endif if (!empty($emailaddress)) { $status = xmailing::preview($mailingId, $listId, $message); $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message); } backHTML::_header(_ACA_PREVIEW_TITLE, 'preview_f2.png', $message, $task, $action); mailingsHTML::previewMailingHTML($mailingId, $listId, $listType); if ($listId > 0) { $archivemailing = xmailing::getMailingView($mailingId, $listId); } else { $archivemailing = xmailing::getMailingView($mailingId); } $forms['main'] = ''; $list = lists::getOneList($archivemailing->list_id); $textonly = ''; acajoom_mail::getContent($archivemailing->images, $list->layout, $archivemailing->htmlcontent, $textonly); acajoom_mail::replaceClass($archivemailing->htmlcontent, $textonly); mailingsHTML::viewMailing($archivemailing, $forms); break; case 'view': if ($mailingId != 0) { if ($listId > 0) { $archivemailing = xmailing::getMailingView($mailingId, $listId); } else { $archivemailing = xmailing::getMailingView($mailingId); } $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r"; xmailing::_header($task, $action, $listType, $message); backHTML::formStart('', 0, ''); mailingsHTML::viewMailing($archivemailing, $forms); $go[] = acajoom::makeObj('act', 'mailing'); $go[] = acajoom::makeObj('task', 'viewmailing'); $go[] = acajoom::makeObj('listid', $archivemailing->list_id); backHTML::formEnd($go); } break; case 'deleteMailing': $d['mailing'] = xmailing::getOneMailing('', $mailingId, '', $new); $message = acajoom::printYN(xmailing::delete($d), @constant($GLOBALS[ACA . 'listname' . $d['mailing']->list_type]) . _ACA_SUCCESS_DELETED, _ACA_ERROR); $showMailings = true; break; case 'cancel': compa::redirect('index2.php?option=com_acajoom'); break; case 'copy': $message = acajoom::printYN(xmailing::copyMailing($mailingId), _ACA_MAILING_COPY, _ACA_ERROR); $showMailings = true; break; case 'cancelMailing': $showMailings = true; break; case 'publishMailing': $mailing = xmailing::getOneMailing('', $mailingId, '', $new); $message = acajoom::printYN(xmailing::publishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_PUBLISHED, _ACA_ERROR); $showMailings = true; break; case 'unpublishMailing': $mailing = xmailing::getOneMailing('', $mailingId, '', $new); $message = acajoom::printYN(xmailing::unpublishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_UNPUBLISHED, _ACA_ERROR); $showMailings = true; break; case 'cpanel': backHTML::controlPanel(); break; case 'save': $message = acajoom::printYN(xmailing::saveMailing($mailingId, $listId), _ACA_MAILING_SAVED, _ACA_ERROR); $showMailings = true; unset($GLOBALS["task"]); unset($_REQUEST["task"]); break; case 'show': default: $showMailings = true; break; } if ($showMailings) { xmailing::showMailings($task, $action, $listId, $listType, $message, true, _ACA_MENU_MAILING); } return true; }
} $showMessage = mosGetParam($_REQUEST, 'listname', 0); if (!empty($redirectlink)) { if (!$showMessage) { $message = ''; } compa::redirect($redirectlink, $message); } else { $showPanel = true; } break; case 'list': frontEnd::showLists($subscriberId, $listId, $lisType, $action, $task); break; case 'token': auto::receiveToken(); break; default: if (class_exists('auto')) { $showPanel = auto::getCase($action); } else { $showPanel = true; } break; } echo $message; if ($showPanel) { frontEnd::introduction($subscriberId, $listId, $lisType); } frontHTML::_footer(); echo "\n\r" . '<!-- End : ' . acajoom::version() . ' -->' . "\n\r";
function delete($d) { if (ACA_CMSTYPE) { $database =& JFactory::getDBO(); } else { global $database; } //endif $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); $xf = new xonfig(); $query = 'DELETE FROM `#__acajoom_stats_global` WHERE `mailing_id` = \'' . $d['mailing']->id . '\''; $database->setQuery($query); $database->query(); $erro->err .= $database->getErrorMsg(); $query = 'DELETE FROM `#__acajoom_stats_details` WHERE `mailing_id` = \'' . $d['mailing']->id . '\''; $database->setQuery($query); $database->query(); $erro->err .= $database->getErrorMsg(); $query = 'DELETE FROM `#__acajoom_queue` WHERE `mailing_id` = \'' . $d['mailing']->id . '\''; $database->setQuery($query); $database->query(); $erro->err .= $database->getErrorMsg(); $query = 'DELETE FROM `#__acajoom_mailings` '; $query .= ' WHERE `id` = \'' . $d['mailing']->id . '\' '; $database->setQuery($query); $database->query(); $erro->err = $database->getErrorMsg(); if (class_exists('auto') and $d['mailing']->list_type == 2) { auto::delete($d); } if (!$erro->E(__LINE__, '8406', $database)) { return false; } else { $xf->plus('act_totalmailing0', -1); $xf->plus('act_totalmailing' . $d['mailing']->list_type, -1); return true; } }
* @desc http request entrance file * */ //============================ 定义 app 路径(必须)================================ define('APP_PATH', dirname(dirname(__FILE__))); define('DS', DIRECTORY_SEPARATOR); //============================ 定义框架地址(必须)============================ define('AUTOPHP_PATH', dirname(APP_PATH) . '/framework'); try { //============================ 开始加载框架!============================ require AUTOPHP_PATH . DS . 'auto.php'; //auto::run() 当前主要负责加载autoload 和一些常量定义的检测 //关掉或开启debugMode,此处可以不处理,默认为关闭! $debugMode = true; auto::setDebugMode($debugMode); auto::run(); //设置时区 date_default_timezone_set("Asia/Shanghai"); //============================ 对 plugin 进行定义 ============================ //如果需要,定义一些(个数不限)在 action 执行之前预执行 和 后执行的程序 plugin::add('plugin_wbinit', plugin::type_before_run); plugin::add('plugin_backEnd', plugin::type_after_run); //plugin::add('Plugin_Requestend', plugin::TYPE_AFTER_RUN); //============================ 对request 的数据进行处理 ============================ //(必要)此处主要是为了提高一些获取效率,进行一次读入,同时也对原生 $_POST 等做了销毁 $antiXssModeOn = true; //是否开启对 $_POST, $_GET, $_COOKIE 的防跨站处理 $addslashesModeOn = true; request::init($antiXssModeOn, $addslashesModeOn); //add log conf $logconf = config::get('log.default');
<?php include_once '../TO/auto.php'; include_once '../logica/principalAuto.php'; //recibo los datos del formulario cliente $patente = $_POST['patente']; $marca = $_POST['marca']; $modelo = $_POST['modelo']; $color = $_POST['color']; $rut = $_POST['rut']; //creo el objeto cliente $elAuto = new auto(); //empaqueto la informacion del cliente en el objeto $elAuto->setPatente($patente); $elAuto->setMarca($marca); $elAuto->setModelo($modelo); $elAuto->setColor($color); $elAuto->setRut($rut); //derivar la trasacción a donde corresponde.---> a la logica $jefe = principalAuto::getInstance(); //dentro de un if $lala = $jefe->modificarAuto($patente); if (empty($lala)) { $jefe->guardarAuto($elAuto); $message = "Auto guardado correctamente"; echo "<script type='text/javascript'>alert('{$message}');</script>"; $yourURL = "listarAutos.php"; echo "<script>location.href='{$yourURL}'</script>"; } else { $message = "La patente ya existe"; echo "<script type='text/javascript'>alert('{$message}');</script>";
function configuration($action, $task) { global $database; $config = array(); $redirect = true; $xf = new xonfig(); $message = mosGetParam($_REQUEST, 'message', ''); switch ($task) { case 'sendQueue': if (class_exists('auto')) { echo acajoom::printYN(auto::processQueue(true, true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR); } backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; case 'reset': $xf->update('next_autonews', ''); $xf->update('last_cron', ''); $xf->update('last_sub_update', ''); $query = "UPDATE #__acajoom_lists SET `next_date` = '0' WHERE list_type = 7"; $database->setQuery($query); $database->query(); echo acajoom::printYN(true, ' Smart-Newsletter counter reset successful! ', _ACA_ERROR); backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); case 'syncUsers': echo acajoom::printYN(subscribers::syncSubscribers(), _ACA_SYNC_USERS_SUCCESS, _ACA_ERROR); backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); case 'apply': $clear_log = mosGetParam($_REQUEST, 'clear_log', 0); if ($clear_log != 0) { unlink($GLOBALS['save_log_file']); } if (empty($config)) { $config = $_REQUEST['config']; } $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR); $xf->updateActiveList(); compa::redirect('index2.php?option=com_acajoom&act=configuration&message=' . $message); break; case 'save': $clear_log = mosGetParam($_REQUEST, 'clear_log', 0); if ($clear_log != 0) { @unlink($GLOBALS['save_log_file']); } if (empty($config)) { $config = $_REQUEST['config']; } $message = acajoom::printYN($xf->saveConfig($config), _ACA_CONFIG_UPDATED, _ACA_ERROR); $xf->updateActiveList(); backHTML::controlPanel(); break; case 'cancel': compa::redirect('index2.php?option=com_acajoom'); break; case 'cpanel': backHTML::controlPanel(); break; default: backHTML::_header(_ACA_MENU_CONF, 'menu.png', $message, $task, $action); configHTML::showConfigEdit($GLOBALS); break; } return true; }
public function run() { plugin::run('before_run'); auto::isDebugMode() && ($_debugMicrotime = microtime(true)); if (self::$_pathDeep == self::path_deep3) { $className = 'controller_' . self::$_currentModule . '_' . self::$_currentController; } else { $className = 'controller_' . self::$_currentController; } if (!class_exists($className)) { throw new exception_404('controller not exist: ' . $className, exception_404::type_controller_not_exist); } $actionName = self::$_currentAction . 'Action'; auto::isDebugMode() && auto::dqueue(__METHOD__ . '(' . $className . '->' . $actionName . ')', 'start ---->>>>'); $class = new ReflectionClass($className); if ($class->isAbstract()) { throw new exception_404('can not run abstract class: ' . $className, exception_404::type_controller_is_abstract); } $method = $class->getMethod($actionName); if (!$method || !$method->isPublic()) { throw new exception_404('no public method ' . $method . ' exist in class:' . $className, exception_404::type_action_not_public); } $method->invoke($class->newInstance()); auto::isDebugMode() && auto::dqueue(__METHOD__ . '(' . $className . '->' . $actionName . ')', 'end,<<<<---- cost ' . (microtime(true) - $_debugMicrotime) . 's'); plugin::run('after_run'); }
function sendSchedule($d, $showHTML, $receivers, $list, &$message, &$max, $tags = null) { static $countEmails = 0; $mailing = $d['mailing']; $h = ''; $xf = new xonfig(); if (empty($mailing)) { $message = _ACA_NO_MAILING_ENTERED; return false; } elseif (empty($receivers)) { $message = _ACA_NO_ADDRESS_ENTERED; return false; } elseif (empty($list)) { $message = _ACA_NO_LIST_ENTERED; return false; } else { $message = ''; } $mailingId = $mailing->id; $issue_nb = $mailing->issue_nb; $subject = $mailing->subject; $content = $mailing->htmlcontent; $textonly = $mailing->textonly; $fromname = $mailing->fromname; $fromemail = $mailing->fromemail; $images = $mailing->images; $listId = $list->id; $html = $list->html; $layout = $list->layout; $totalsofar = number_format(0, 4, ',', ''); $nbPause = 0; $tags['issuenb'] = $issue_nb; if (ini_get('safe_mode')) { } else { @set_time_limit(60 * $GLOBALS[ACA . 'script_timeout']); } ignore_user_abort(true); ### create the mail $mail = acajoom_mail::getMailer($mailing); ### create content acajoom_mail::getContent($images, $layout, $content, $textonly); $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; $html_sent = 0; $text_sent = 0; $size = sizeof($receivers); $log_detailed = "\r\n" . "\r\n" . '*** ' . strftime(_DATE_FORMAT_LC) . ' ***' . "\r\n"; foreach ($receivers as $receiver) { $tags['user_id'] = $receiver->user_id; if ($html && intval($receiver->receive_html) == 1) { $mail->IsHTML(true); $ashtml = 1; $Altbody = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, 0, $tags); $mail->AltBody = acajoom_mail::safe_utf8_encode($Altbody, $mail->CharSet); $html_sent++; $mail->Body = acajoom_mail::replaceTags($content, $receiver, $list, $mailingId, $ashtml, $tags); } else { $mail->IsHTML(false); $mail->AltBody = ''; $ashtml = 0; $text_sent++; $mail->Body = acajoom_mail::replaceTags($textonly, $receiver, $list, $mailingId, $ashtml, $tags); // if we are in TEXT Mode, Why do we add embedded images??? if (!empty($images)) { foreach ($images as $image) { $img = explode('|', $image); $attrib = explode("/", $img[0]); $path = $GLOBALS['mosConfig_absolute_path'] . '/images/stories/'; if (count($img) == 1) { $imageName = $img[0]; } else { $imageName = $attrib[count($attrib) - 1]; for ($index = 0; $index < sizeof($attrib) - 1; $index++) { $path .= $attrib[$index] . '/'; } } $mail->AddAttachment($path . $imageName); } } } $tname = explode(" ", $receiver->name); $firstname = $tname[0]; $mail->AddAddress($receiver->email, $receiver->name); $sujetReplaced = str_replace('[NAME]', $receiver->name, $subject); $sujetReplaced = str_replace('[FIRSTNAME]', $firstname, $sujetReplaced); if (class_exists('auto')) { auto::tags($sujetReplaced, $tags); } $mail->Subject = $sujetReplaced; $mailssend = $mail->Send(); $countEmails++; if ($countEmails >= $GLOBALS[ACA . 'cron_max_emails']) { $max = true; } if ($mail->error_count > 0) { static $info = false; if (!$info and acajoom::checkPermissions('admin')) { echo '<br/>Mailer Error : ' . $mail->ErrorInfo; $info = true; } $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_NOT . "\r\n" . _ACA_MAILER_ERROR . ': ' . $mail->ErrorInfo . "\r\n"; if ($html && intval($receiver->receive_html) == 1) { $html_sent--; } else { $text_sent--; } } else { $log_detailed .= '[' . $mailingId . '] ' . $subject . ' : ' . $receiver->email . ' -> ' . _ACA_MESSAGE_SENT_SUCCESSFULLY . "\r\n"; if ($GLOBALS[ACA . 'enable_statistics'] == 1 and $GLOBALS[ACA . 'statistics_per_subscriber'] == 1) { xmailing::insertStats($mailingId, $receiver->id, $ashtml); } $d['qids'] = array(); $erro = new xerr(__FILE__, __FUNCTION__, __CLASS__); if ($d['listype'] == '2') { $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']); $erro->ck = auto::updateAutoresponderSent($d); $erro->Eck(__LINE__, '8137', $d); } elseif ($d['listype'] == '1' || $d['listype'] == '7') { $d['qids'][0] = queue::whatQID($mailingId, $receiver->id, $d['listype']); $erro->ck = queue::deleteQueues($d['qids']); $erro->Eck(__LINE__, '8127', $d); } } $mail->ClearAddresses(); } if ($GLOBALS[ACA . 'enable_statistics'] == 1) { xmailing::updateStatsGlobal($mailingId, $html_sent, $text_sent, false); } $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; if ($totalsofar > 0) { $totaltime = $totalsofar; $totalstr = strval($totaltime); } else { $totaltime = number_format($endtime - $starttime - $nbPause * $GLOBALS[ACA . 'pause_time'], 4, ',', ''); $totalstr = strval($totaltime); } if ($GLOBALS[ACA . 'send_data'] == 1) { acajoom_mail::sendReport($fromemail, $totalstr, $html_sent, $text_sent); } $xf->plus('totalmailingsent' . $list->list_type, $html_sent + $text_sent); $xf->plus('totalmailingsent0', $html_sent + $text_sent); $log_simple = 'Time to send: ' . $totalstr . ' ' . _ACA_SECONDS . "\r\n" . 'Number of subscribers: ' . ($text_sent + $html_sent) . "\r\n" . 'HTML format: ' . $html_sent . "\r\n" . 'Text format: ' . $text_sent . "\r\n"; $log_detailed = $log_simple . 'Details: ' . "\r\n" . $log_detailed . "\r\n"; if (class_exists('lisType')) { acajoom_mail::writeLogs($list, $log_simple, $log_detailed); } if ($d['listype'] == '2') { echo '<br/>' . _ACA_QUEUE_AUTO_PROCESSED; } elseif ($d['listype'] == '1') { echo '<br/>' . _ACA_QUEUE_NEWS_PROCESSED; } if ($html_sent + $text_sent > 0) { return true; } else { $message = xmailing::M('no', _ACA_NO_MAILING_SENT); return false; } }
public function testAutoloaderReturnsFalseWhenCallingNonExistingClass() { $this->assertFalse(auto::loader('foo2501bar42'), 'calling non existent class'); }
function controlPanel() { //hack for JOomla 13 ADRIEN unset($GLOBALS["task"]); unset($_REQUEST["task"]); ?> <link rel="stylesheet" href="components/com_acajoom/cssadmin/acajoom.css" type="text/css" > <div align="center" class="centermain"> <div id="acajoom"> <table class="acajoomcss"> <tr> <td width="58%" valign="top"> <?php echo backHTML::iconsPanel(); ?> </td> <td width="42%" valign="top"> <div style="width=100%;"> <form action="index2.php" method="post" name="adminForm"> <?php $tabs = new mosTabs(1); $tabs->startPane('acaControlPanel'); $tabs->startTab(_ACA_MENU_TAB_SUM, "acaControlPanel.Summary"); ?> <table class="acajoom_stats" style="text-align: left; width: 100%; " cellpadding="2" cellspacing="0"> <tbody> <tr> <th style="text-align: center;"><?php echo '#'; ?> </th> <th style="text-align: center;"><?php echo _ACA_MENU_TAB_LIST; ?> </th> <th style="text-align: center;"><?php echo _ACA_MENU_MAILING_TITLE; ?> </th> <th style="text-align: center;"><?php echo _ACA_SENT_MAILING; ?> </th> <th style="text-align: center;"><?php echo _ACA_DESC_SUBSCRIBERS; ?> </th> </tr> <?php $html = ''; $totalist = 0; $totalmail = 0; $totalsub = 0; $totalsent = 0; $nb = explode(',', $GLOBALS[ACA . 'activelist']); $size = sizeof($nb); for ($i = 0; $i < $size; $i++) { $index = $nb[$i]; if ($GLOBALS[ACA . 'listshow' . $index] > 0 and $GLOBALS[ACA . 'listype' . $index] == 1) { $html .= '<tr>'; $html .= '<td><b>' . @constant($GLOBALS[ACA . 'listnames' . $index]) . '</b></td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totallist' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totalmailing' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'totalmailingsent' . $index] . ' </td>'; $html .= '<td style="text-align: center; ">' . $GLOBALS[ACA . 'act_totalsubcribers' . $index] . ' </td>'; $html .= '</tr>'; $totalist = $totalist + $GLOBALS[ACA . 'act_totallist' . $index]; $totalmail = $totalmail + $GLOBALS[ACA . 'act_totalmailing' . $index]; $totalsent = $totalsent + $GLOBALS[ACA . 'totalmailingsent' . $index]; if ($GLOBALS[ACA . 'act_totalsubcribers' . $index] < $totalsub) { $totalsub = $GLOBALS[ACA . 'act_totalsubcribers' . $index]; } } } $html .= '<tr>'; $html .= '<td><b>' . _ACA_CP_TOTAL . '</b></td>'; $html .= '<td style="text-align: center; ">' . $totalist . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalmail . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalsent . ' </td>'; $html .= '<td style="text-align: center; ">' . $totalsub . ' </td>'; $html .= '</tr>'; echo $html; ?> </tbody></table> <br /> <?php if (class_exists('auto')) { echo auto::showQueue(); } $tabs->endTab(); $tabs->startTab(_ACA_MENU_SUBSCRIBERS, "acaControlPanel.Subscribers"); $emailsearch = ''; $listId = 0; $start = mosGetParam($_REQUEST, 'start', 0); $limit = mosGetParam($_REQUEST, 'limit', 15); $order = mosGetParam($_REQUEST, 'order', 'date'); $total = 0; $subscribers = subscribers::getSubscribers($start, $limit, $emailsearch, $total, $listId, '', 1, 1, 'sub_dateD'); mosCommonHTML::loadOverlib(); ?> <script type="text/javascript"> function checkcid(myField) { myField.checked = true; isChecked(true); } </script> <!-- <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div> --> <form action="index2.php" method="post" name="adminForm"> <input type="hidden" name="option" value="com_acajoom" /> <input type="hidden" name="act" value="acajoom" /> <input type="hidden" name="task" value="" /> <input type="hidden" name="userid" value="" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="listid" value="<?php echo $listId; ?> " /> <input type="hidden" name="start" value="<?php echo $start; ?> " /> <input type="hidden" name="limit" value="<?php echo $limit; ?> " /> <input type="hidden" name="emailsearch" value="<?php echo $emailsearch; ?> " /> <table width="100%" border="0" cellspacing="0" cellpadding="4" class="adminlist"> <tr> <th class="title">#</th> <th class="title" style="text-align: left;"><?php echo _ACA_INPUT_NAME; ?> </th> <th class="title" style="text-align: left;"><?php echo _ACA_INPUT_EMAIL; ?> </th> <th class="title" style="text-align: center;"><?php echo _ACA_SIGNUP_DATE; ?> </th> </tr> <?php $i = 0; foreach ($subscribers as $subscriber) { ?> <tr class="row<?php echo $i++ % 2; ?> "> <td><?php echo $i + $start; ?> </td> <td style="text-align: left;"> <a href="index2.php?option=com_acajoom&act=subscribers&task=show&userid=<?php echo $subscriber->id; ?> " > <?php echo $subscriber->name; ?> </a></td> <td style="text-align: left;"><?php echo $subscriber->email; ?> </td> <td style="text-align: center;"><?php echo mosFormatDate($subscriber->subscribe_date, '%x'); ?> </td> </tr> <?php } ?> </table> </form> <?php backHTML::footerCounts($start, $limit, $emailsearch, $total, 4, '', $listId, ''); $tabs->endTab(); $tabs->startTab(_ACA_MENU_TAB_LIST, "acaControlPanel.Lists"); $lists = lists::getLists(0, 0, 1, '', false, false, false); ?> <table class="adminlist"> <tr> <th class="title">#</th> <th class="title" width="65%" style="text-align: left;"><?php echo _ACA_LIST_NAME; ?> </th> <th class="title" width="25%" style="text-align: left;"><?php echo _ACA_LIST_TYPE; ?> </th> <th class="title" style="text-align: center;">#id</th> </tr> <?php $i = 0; foreach ($lists as $list) { $i++; $link = 'index2.php?option=com_acajoom&act=mailing&task=show&listid=' . $list->id; ?> <tr> <td><?php echo $i; ?> </td> <td style="text-align: left;"> <a href="<?php echo $link; ?> "> <?php echo $list->list_name; ?> </a> </td> <td style="text-align: left;"><a href='index2.php?option=com_acajoom&act=mailing&listype=<?php echo $list->list_type; ?> '><?php echo @constant($GLOBALS[ACA . 'listname' . $list->list_type]); ?> </a></td> <td style="text-align: center;"><?php echo $list->id; ?> </td> </tr> <?php } ?> <tr> <th colspan="4"> </th> </tr> </table> <?php $tabs->endTab(); $tabs->endPane(); ?> </form> </div> <div style="clear:both; float:left;"> <?php echo acajoom::printM('blue', _ACA_SERVER_LOCAL_TIME . ' :' . mosFormatDate(acajoom::getNow(), '%A, %d %B %Y %H:%M', 0)); ?> </div> <td> </tr> </table> </div> </div> <?php }