From 86143e2dffe88a809385fe6812dd1c4045108e13 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 20 May 2016 15:04:51 -0700 Subject: [PATCH] Email template simplification --- e107_core/templates/email_template.php | 2 +- e107_handlers/e_parse_class.php | 10 ++++-- e107_handlers/sitelinks_class.php | 2 +- e107_languages/English/admin/lan_mailout.php | 2 +- e107_plugins/news/templates/news_template.php | 29 ++++++++++++++-- e107_plugins/user/e_mailout.php | 33 +++++++++---------- 6 files changed, 53 insertions(+), 25 deletions(-) diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index 2b969d23f..f61ff199c 100644 --- a/e107_core/templates/email_template.php +++ b/e107_core/templates/email_template.php @@ -342,7 +342,7 @@ $EMAIL_TEMPLATE['monthly']['footer'] = $EMAIL_TEMPLATE['default']['footer']; $EMAIL_TEMPLATE['whatsnew']['name'] = "What's New"; $EMAIL_TEMPLATE['whatsnew']['subject'] = '{SITENAME}: {SUBJECT} '; $EMAIL_TEMPLATE['whatsnew']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. -$EMAIL_TEMPLATE['whatsnew']['body'] = "All the latest news and updates.
{BODY}
To find out more, simply click on the links!"; +$EMAIL_TEMPLATE['whatsnew']['body'] = "Hi {USERNAME},
{BODY}"; $EMAIL_TEMPLATE['whatsnew']['footer'] = $EMAIL_TEMPLATE['default']['footer']; diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 0ea7ac3ee..df910f0d3 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -247,11 +247,12 @@ class e_parse extends e_parser * Constructor - keep it public for backward compatibility still some new e_parse() in the core * - * @return void */ public function __construct() { // initialise the type of UTF-8 processing methods depending on PHP version and mb string extension + parent::__construct(); + $this->init(); $this->initCharset(); @@ -3188,7 +3189,10 @@ class e_parser private $scriptAccess = false; // nobody. - public function __construct() + /** + * e_parser constructor. + */ + public function __construct() { $this->init(); @@ -4421,7 +4425,7 @@ return; { $value = preg_replace('/^]*>/', '', $value); $value = str_replace("", "", $value); - $value = str_replace("

", PHP_EOL, $value); + $value = str_replace('

', PHP_EOL, $value); } if($node->nodeName == 'code') diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 6002eddbc..e0256b3e5 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -1844,7 +1844,7 @@ class navigation_shortcodes extends e_shortcode if(is_string($this->var['link_sub'])) // html override option. { - e107::getDebug()->log($this->var); + // e107::getDebug()->log($this->var); return $this->var['link_sub']; } diff --git a/e107_languages/English/admin/lan_mailout.php b/e107_languages/English/admin/lan_mailout.php index 798e0f0b2..a73b0257c 100644 --- a/e107_languages/English/admin/lan_mailout.php +++ b/e107_languages/English/admin/lan_mailout.php @@ -66,7 +66,7 @@ define("LAN_MAILOUT_52", "Last mod"); define("LAN_MAILOUT_53", "Admins"); define("LAN_MAILOUT_54", "Self"); define("LAN_MAILOUT_55", "Userclass"); -define("LAN_MAILOUT_56", "Last Visit (dd-mm-yy)"); +define("LAN_MAILOUT_56", "Last Visit"); define("LAN_MAILOUT_57", "Send bulk SMTP emails in blocks"); // SMTP KeepAlive option //define("LAN_MAILOUT_58", "There is a problem with the attachment:"); //define("LAN_MAILOUT_59", "Mailing Progress"); diff --git a/e107_plugins/news/templates/news_template.php b/e107_plugins/news/templates/news_template.php index a7c75e069..ef937ca94 100644 --- a/e107_plugins/news/templates/news_template.php +++ b/e107_plugins/news/templates/news_template.php @@ -169,18 +169,43 @@ $NEWS_TEMPLATE['view']['item'] = ' + + + +
{NEWSCOMMENTLINK: glyph=comments&class=btn btn-default}{PRINTICON: class=btn btn-default}{ADMINOPTIONS: class=btn btn-default}{SOCIALSHARE}
- + + + + + + +
{NEWSRELATED}
{NEWSNAVLINK} '; + +/* + *
+

About the Author

+
+
{SETIMAGE: w=80&h=80&crop=1}{NEWS_AUTHOR_AVATAR: shape=circle}
+
+

{NEWS_AUTHOR}

+ {NEWS_AUTHOR_SIGNATURE} + My Articles +
+
+ */ + + //$NEWS_MENU_TEMPLATE['view']['separator'] = '
'; @@ -215,6 +240,6 @@ $NEWS_TEMPLATE['related']['start'] = "

".defset('LAN_RELATED', 'Related') $NEWS_TEMPLATE['related']['item'] = "
  • {RELATED_TITLE}
  • "; $NEWS_TEMPLATE['related']['end'] = "";*/ -$NEWS_TEMPLATE['related']['start'] = '{SETIMAGE: w=350&h=350&crop=1}

    YOU MIGHT ALSO LIKE

    '; +$NEWS_TEMPLATE['related']['start'] = '{SETIMAGE: w=350&h=350&crop=1}

    You Might Also Like

    '; $NEWS_TEMPLATE['related']['item'] = ''; $NEWS_TEMPLATE['related']['end'] = '
    '; \ No newline at end of file diff --git a/e107_plugins/user/e_mailout.php b/e107_plugins/user/e_mailout.php index 9553e321b..4674045e7 100644 --- a/e107_plugins/user/e_mailout.php +++ b/e107_plugins/user/e_mailout.php @@ -169,28 +169,23 @@ class user_mailout $where[]= "u.`".$selectVals['user_search_name']."` LIKE '%".$selectVals['user_search_value']."%' "; } - if (vartrue($selectVals['last_visit_match']) && vartrue($selectVals['last_visit_date'])) + if (!empty($selectVals['last_visit_match']) && !empty($selectVals['last_visit_date'])) { - foreach(array(':', '-', ',') as $sep) - { - if (strpos($selectVals['last_visit_date'], ':')) - { - $tmp = explode($sep, $selectVals['last_visit_date']); - break; - } - } - $lvDate = gmmktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]); // Require dd-mm-yy for now + $lvDate = $selectVals['last_visit_date']; + + e107::getDebug()->log(date('r',$lvDate)); + if (($lvDate > 0) && ($lvDate <= time())) { switch ($selectVals['last_visit_match']) { case '<' : case '>' : - $where[]= "u.`user_lastvisit`".$selectVals['last_visit_match'].$lvDate; + $where[]= "u.`user_lastvisit` ".$selectVals['last_visit_match']." ".$lvDate; break; case '=' : - $where[]= "u.`user_lastvisit`>=".$lvDate; - $where[]= "u.`user_lastvisit`<=".intval($lvDate + 86400); + $where[]= "u.`user_lastvisit` >= ".$lvDate; + $where[]= "u.`user_lastvisit` <= ".intval($lvDate + 86400); break; } } @@ -219,6 +214,7 @@ class user_mailout } } $qry .= " FROM `#user` AS u "; + if (count($incExtended)) { $qry .= "LEFT JOIN `#user_extended` AS ue ON ue.`user_extended_id` = u.`user_id`"; @@ -229,9 +225,12 @@ class user_mailout e107::getMessage()->addDebug("Selector query: ".$qry); - if (!( $this->mail_count = $sql->gen($qry))) return FALSE; + if (!( $this->mailCount = $sql->gen($qry))) return FALSE; + + e107::getDebug()->log($this->mailCount); + $this->mail_read = 0; - return $this->mail_count; + return $this->mailCount; } @@ -303,7 +302,7 @@ class user_mailout $var[0]['html'] = $admin->userClassesTotals('email_to', varset($selectVals['email_to'], '')); $var[1]['html'] = $frm->select('user_search_name', $u_array, varset($selectVals['user_search_name'], ''),'',TRUE)." ".LAN_MAILOUT_47." ".$frm->text('user_search_value', varset($selectVals['user_search_value'], '')); //$var[2]['html'] = $admin->comparisonSelect('last_visit_match', varset($selectVals['last_visit_match'], ''))." ".$frm->text('last_visit_date', varset($selectVals['last_visit_date'], 0)); - $var[2]['html'] = $admin->comparisonSelect('last_visit_match', varset($selectVals['last_visit_match'], ''))." ".$admin->makeCalendar('last_visit_date', varset($selectVals['last_visit_date'], 0)); + $var[2]['html'] = $admin->comparisonSelect('last_visit_match', varset($selectVals['last_visit_match'], ''))." ".e107::getForm()->datepicker('last_visit_date', varset($selectVals['last_visit_date'], 0), array('type'=>'datetime')); $var[1]['caption'] = LAN_MAILOUT_46; // User Search Field. $var[2]['caption'] = LAN_MAILOUT_56; // User last visit @@ -347,7 +346,7 @@ class user_mailout } if (vartrue($selectVals['last_visit_match']) && vartrue($selectVals['last_visit_date'])) { - $var[2]['html'] = $selectVals['last_visit_match'].' '.gmstrftime("%D-%M-%Y",$selectVals['last_visit_date']); //FIXME use e107 date function. + $var[2]['html'] = $selectVals['last_visit_match'].' '.e107::getParser()->toDate($selectVals['last_visit_date'],'long'); //FIXME use e107 date function. $var[2]['caption'] = LAN_MAILOUT_56; // User last visit } $extFields = $admin->ret_extended_field_list('extended_1_name', varset($selectVals['extended_1_name'], ''), TRUE);