From 706e79af1f07c4dc3868fec27a9bc9bd8c331395 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 7 Feb 2016 23:35:38 -0800 Subject: [PATCH] Cron Test email function updated to use new mailing method. --- e107_handlers/cron_class.php | 57 +++++++++++++++++++++++-- e107_plugins/forum/e_list.php | 3 +- e107_plugins/list_new/list_new_menu.php | 7 +-- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/e107_handlers/cron_class.php b/e107_handlers/cron_class.php index b25394095..92906edf5 100644 --- a/e107_handlers/cron_class.php +++ b/e107_handlers/cron_class.php @@ -167,12 +167,63 @@ class _system_cron global $pref, $_E107; if($_E107['debug']) { echo "
sendEmail() executed"; } - require_once(e_HANDLER.'mail.php'); - $message = "Your Cron test worked correctly. Sent at ".date("r")."."; + // require_once(e_HANDLER.'mail.php'); + $message = "Your Cron test worked correctly. Sent on ".date("r")."."; - sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron.".date("r"), $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']); + $message .= "

Environment Variables

"; + + $userCon = get_defined_constants(true); + ksort($userCon['user']); + + $userVars = array(); + foreach($userCon['user'] as $k=>$v) + { + if(substr($k,0,2) == 'e_') + { + $userVars[$k] = $v; + } + } + + $message .= "

e107 PATHS

"; + $message .= $this->renderTable($userVars); + + $message .= "

_SERVER

"; + $message .= $this->renderTable($_SERVER); + $message .= "

_ENV

"; + $message .= $this->renderTable($_ENV); + + $eml = array( + 'subject' => "TEST Email Sent by cron. ".date("r"), + // 'sender_email' => $email, + 'sender_name' => SITENAME . " Automation", + // 'replyto' => $email, + 'html' => true, + 'template' => 'default', + 'body' => $message + ); + + e107::getEmail()->sendEmail($pref['siteadminemail'], $pref['siteadmin'], $eml); + + // sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron.".date("r"), $message, $pref['siteadmin'],SITEEMAIL, $pref['siteadmin']); } + private function renderTable($array) + { + $text = ""; + + foreach($array as $k=>$v) + { + $text .= " + + + + "; + + } + + $text .= "
".$k."".print_a($v,true)."
"; + return $text; + } /** * Process the Mail Queue diff --git a/e107_plugins/forum/e_list.php b/e107_plugins/forum/e_list.php index 1b4e9fa12..9bf8385e1 100644 --- a/e107_plugins/forum/e_list.php +++ b/e107_plugins/forum/e_list.php @@ -30,7 +30,7 @@ class list_forum { // New posts since last visit, up to limit $lvisit = $this->parent->getlvisit(); $qry = " - SELECT tp.thread_name AS parent_name, tp.thread_id as parent_id, + SELECT t.thread_name AS parent_name, t.thread_id as parent_id, f.forum_id, f.forum_name, f.forum_class, u.user_name, lp.user_name AS lp_name, t.thread_id, t.thread_views as tviews, t.thread_name, t.thread_datestamp, t.thread_user, @@ -43,6 +43,7 @@ class list_forum WHERE find_in_set(forum_class, '".USERCLASS_LIST."') AND t.thread_lastpost > {$lvisit} ORDER BY tp.post_datestamp DESC LIMIT 0,".intval($this->parent->settings['amount']); + } else { // Most recently updated threads up to limit diff --git a/e107_plugins/list_new/list_new_menu.php b/e107_plugins/list_new/list_new_menu.php index 91e6acb72..c8e12bd10 100644 --- a/e107_plugins/list_new/list_new_menu.php +++ b/e107_plugins/list_new/list_new_menu.php @@ -45,9 +45,10 @@ $rc->mode = "new_menu"; $text = $rc->displayMenu(); $caption = vartrue($rc->list_pref[$rc->mode."_caption"], LIST_MENU_1); -$caption = $rc->e107->tp->toHtml($caption, FALSE, 'USER_TITLE'); -$text = $rc->e107->tp->toHtml($text, TRUE, 'USER_BODY'); -$rc->e107->ns->tablerender($caption, $text, 'list_new'); +$caption = e107::getParser()->toHtml($caption, FALSE, 'USER_TITLE'); +$text = e107::getParser()->toHtml($text, TRUE, 'USER_BODY'); +e107::getRender()->tablerender($caption, $text, 'list_new'); + unset($caption); unset($text);