diff --git a/class2.php b/class2.php index 213e0dd73..0262854f1 100644 --- a/class2.php +++ b/class2.php @@ -724,6 +724,11 @@ else define('XURL_VIMEO', false); } +if(!defined('MAIL_IDENTIFIER')) +{ + define('MAIL_IDENTIFIER', 'X-e107-id'); +} + /* Withdrawn 0.8 // legacy module.php file loading. if (isset($pref['modules']) && $pref['modules']) { diff --git a/cron.php b/cron.php index 780986058..aeeaa07af 100644 --- a/cron.php +++ b/cron.php @@ -31,6 +31,11 @@ $_E107['no_menus'] = TRUE; require_once(realpath(dirname(__FILE__)."/class2.php")); $pwd = ($_E107['debug'] && $_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : trim($_SERVER['argv'][1]); + + if(empty($pwd) && !empty($_GET['token'])) + { + $pwd = $_GET['token']; + } if($pref['e_cron_pwd'] != $pwd) { @@ -42,11 +47,17 @@ require_once(realpath(dirname(__FILE__)."/class2.php")); Stored in e107: ".$pref['e_cron_pwd']."

You should regenerate the cron command in admin and enter it again in your server configuration. "; + + $message .= "

Debug Info

"; + $message .= print_a($_SERVER,true); + $message .= print_a($_ENV,true); + $message .= print_a($_GET,true); sendemail($pref['siteadminemail'], "e107 - Cron Schedule Misconfigured.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']); exit; } + e107::getCache()->CachePageMD5 = '_'; e107::getCache()->set('cronLastLoad',time(),TRUE,FALSE,TRUE); diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php index 9cd4521ff..44d7c30e6 100644 --- a/e107_admin/admin_log.php +++ b/e107_admin/admin_log.php @@ -123,7 +123,7 @@ class admin_log_ui extends e_admin_ui { protected $pluginTitle = ADLAN_155; - protected $pluginName = 'adminlog'; + protected $pluginName = 'core'; protected $table = 'admin_log'; protected $pid = 'dblog_id'; protected $perPage = 10; @@ -159,7 +159,7 @@ class admin_log_ui extends e_admin_ui 'user_audit_class' => array('title'=> RL_LAN_123, 'type'=>'userclass', 'data' => 'int','help'=>''), 'user_audit_opts' => array('title'=> RL_LAN_031, 'type'=>'method', 'data' => 'array','help'=>''), 'roll_log_active' => array('title'=> RL_LAN_008, 'type'=>'boolean', 'data' => 'int','help'=>''), - 'roll_log_days' => array('title'=> RL_LAN_009, 'type'=>'text', 'data' => 'string','help'=>''), + 'roll_log_days' => array('title'=> RL_LAN_009, 'type'=>'number', 'data' => 'string','help'=>''), // 'Delete admin log events older than ' => array('title'=> RL_LAN_045, 'type'=>'method', 'data' => 'string','help'=>'Help Text goes here'), // 'Delete user audit trail log events older' => array('title'=> 'Delete user audit trail log events older', 'type'=>'method', 'data' => 'string','help'=>'Help Text goes here'), ); @@ -184,7 +184,10 @@ class admin_log_ui extends e_admin_ui // optional public function init() { - $this->prefs['sys_log_perpage']['writeParms'] = array(10, 20, 30, 40, 50); + $perPage = e107::getConfig()->get('sys_log_perpage'); + $this->perPage = vartrue($perPage,10); + + $this->prefs['sys_log_perpage']['writeParms'] = array(10=>10, 20=>20, 30=>30, 40=>40, 50=>50); $sql = e107::getDb(); @@ -382,7 +385,7 @@ class admin_log_form_ui extends e_admin_form_ui function user_audit_opts($curVal,$mode) { - $pref = e107::getPref(); + $frm = e107::getForm(); // User Audit log options (for info) @@ -407,15 +410,14 @@ class admin_log_form_ui extends e_admin_form_ui USER_AUDIT_ADD_ADMIN => RL_LAN_080, USER_AUDIT_MAIL_BOUNCE => RL_LAN_081, USER_AUDIT_BANNED => RL_LAN_082, USER_AUDIT_BOUNCE_RESET => RL_LAN_083, USER_AUDIT_TEMP_ACCOUNT => RL_LAN_084); - - $user_signup_opts = array_flip(explode(',', varset($pref['user_audit_opts'], ''))); + $userAuditOpts = e107::getConfig()->get('user_audit_opts'); $text = ""; foreach($audit_checkboxes as $k => $t) { - $checked = isset($user_signup_opts[$k]) ? true : false; - $text .= $frm->checkbox('user_audit_opts[]',$k, $checked, array('label'=>$t)); + $checked = isset($userAuditOpts[$k]) ? true : false; + $text .= $frm->checkbox('user_audit_opts['.$k.']',$k, $checked, array('label'=>$t)); } $text .= $frm->admin_button('check_all', 'jstarget:user_audit_opts', 'checkall', LAN_CHECKALL).$frm->admin_button('uncheck_all', 'jstarget:user_audit_opts', 'checkall', LAN_UNCHECKALL); @@ -477,6 +479,13 @@ class admin_log_form_ui extends e_admin_form_ui // Custom Method/Function function dblog_type($curVal,$mode) { + /* + define("E_LOG_INFORMATIVE", 0); // Minimal Log Level, including really minor stuff + define("E_LOG_NOTICE", 1); // More important than informative, but less important than notice + define("E_LOG_WARNING", 2); // Not anything serious, but important information + define("E_LOG_FATAL", 3); // An event so bad your site ceased execution. + define("E_LOG_PLUGIN", 4); // Plugin information + */ $array = array( ' ', // Minimal Log Level, including really minor stuff @@ -492,12 +501,12 @@ class admin_log_form_ui extends e_admin_form_ui switch($mode) { case 'read': // List Page - return varset($array[$curVal], $curval); + return varset($array[$curVal], $curVal); break; case 'filter': case 'batch': - return $array; + return array('Informative','Notice','Warning','Fatal'); break; } } @@ -681,26 +690,27 @@ class dblog_ui extends e_admin_ui protected $pluginName = 'adminlog'; protected $table = 'dblog'; protected $pid = 'dblog_id'; - protected $perPage = 10; + protected $perPage = 15; + protected $listOrder = 'dblog_id desc'; protected $fields = array ( // 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'dblog_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'dblog_datestamp' => array ( 'title' => LAN_DATESTAMP, 'type' => 'method', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), + 'dblog_datestamp' => array ( 'title' => LAN_DATESTAMP, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'dblog_microtime' => array ( 'title' => 'Microtime', 'type' => 'method', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), 'dblog_type' => array ( 'title' => LAN_TYPE, 'type' => 'method', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'dblog_eventcode' => array ( 'title' => 'Eventcode', 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), 'dblog_user_id' => array ( 'title' => LAN_ID, 'type' => 'user', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'dblog_user_name' => array ( 'title' => LAN_USER, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'dblog_ip' => array ( 'title' => LAN_IP, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'dblog_ip' => array ( 'title' => LAN_IP, 'type' => 'ip', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), 'dblog_caller' => array ( 'title' => 'Caller', 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), 'dblog_title' => array ( 'title' => LAN_TITLE, 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), - 'dblog_remarks' => array ( 'title' => 'Remarks', 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), + 'dblog_remarks' => array ( 'title' => 'Remarks', 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'options' => array ( 'title' => 'Options', 'type' => null, 'nolist'=>true, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ), - ); - + ); + protected $fieldpref = array('dblog_id', 'dblog_datestamp', 'dblog_microtime', 'dblog_type', 'dblog_eventcode', 'dblog_user_id', 'dblog_user_name', 'dblog_ip', 'dblog_caller', 'dblog_title', 'dblog_remarks'); - + } @@ -807,7 +817,7 @@ $mes = e107::getMessage(); $frm = e107::getForm(); define('AL_DATE_TIME_FORMAT', 'y-m-d H:i:s'); - +/* if(isset($_POST['setoptions'])) { unset($temp); @@ -839,6 +849,7 @@ if(isset($_POST['setoptions'])) } } +*/ $ns->tablerender($caption, $mes->render() . $text); @@ -863,7 +874,7 @@ if(isset($_POST['deleteitems']) && ($action == 'comments')) { //$text = str_replace('--NUMBER--', $count,RL_LAN_112); $emessage->add(str_replace('--NUMBER--', $count, RL_LAN_112), E_MESSAGE_SUCCESS); - $admin_log->log_event('COMMENT_01', 'ID: '.implode(',', $_POST['del_item']), E_LOG_INFORMATIVE, ''); + e107::getLog()->add('COMMENT_01', 'ID: '.implode(',', $_POST['del_item']), E_LOG_INFORMATIVE, ''); } else { @@ -941,7 +952,7 @@ if(($action == "backdel") && isset($_POST['backdeltype'])) // Add in a log event $message = $db_name.str_replace(array('--OLD--', '--NUM--'), array($old_string, $del_count), RL_LAN_057); $mes->addSuccess($message); - $admin_log->log_event($db_msg, "db_Delete - earlier than {$old_string} (past {$qs[2]} days)[!br!]".$message.'[!br!]'.$db_table.' '.$qry, E_LOG_INFORMATIVE, ''); + e107::getLog()->add($db_msg, "db_Delete - earlier than {$old_string} (past {$qs[2]} days)[!br!]".$message.'[!br!]'.$db_table.' '.$qry, E_LOG_INFORMATIVE, ''); } else { @@ -1104,7 +1115,7 @@ if(! defined("USER_WIDTH")) // CONFIGURATION OPTIONS MENU //==================================================================== - +/* if($action == "config") { // User Audit log options (for info) @@ -1243,6 +1254,7 @@ if($action == "config") $ns->tablerender(ADLAN_155.SEP.LAN_OPTIONS, $mes->render().$text); } +*/ //==================================================================== // LOG VIEW MENU diff --git a/e107_admin/administrator.php b/e107_admin/administrator.php index 5865338b3..c3938426c 100644 --- a/e107_admin/administrator.php +++ b/e107_admin/administrator.php @@ -94,7 +94,7 @@ if (isset($_POST['del_admin']) && count($_POST['del_admin'])) $mes->addAuto($sql -> db_Update("user", "user_admin=0, user_perms='' WHERE user_id= ".$aID), 'update', ADMSLAN_61, LAN_DELETED_FAILED, false); $logMsg = str_replace(array('--ID--', '--NAME--'),array($aID, $row['user_name']),ADMSLAN_73); - $admin_log->log_event('ADMIN_02',$logMsg,E_LOG_INFORMATIVE,''); + e107::getLog()->add('ADMIN_02',$logMsg,E_LOG_INFORMATIVE,''); } diff --git a/e107_admin/auth.php b/e107_admin/auth.php index be6ec6df9..28b02a1da 100644 --- a/e107_admin/auth.php +++ b/e107_admin/auth.php @@ -151,7 +151,8 @@ else $class_list[] = e_UC_MEMBER; $class_list[] = e_UC_PUBLIC; - $user_logging_opts = array_flip(explode(',', varset($pref['user_audit_opts'], ''))); + + $user_logging_opts = e107::getConfig()->get('user_audit_opts'); if (isset($user_logging_opts[USER_AUDIT_LOGIN]) && in_array(varset($pref['user_audit_class'], ''), $class_list)) { // Need to note in user audit trail e107::getAdminLog()->user_audit(USER_AUDIT_LOGIN, '', $user_id, $user_name); diff --git a/e107_admin/cron.php b/e107_admin/cron.php index e6780d329..65183594e 100644 --- a/e107_admin/cron.php +++ b/e107_admin/cron.php @@ -383,7 +383,7 @@ class cron_admin_ui extends e_admin_ui elseif (!$active) // show instructions { $setpwd_message = $frm->open("generate")."" - .LAN_CRON_15.":
".rtrim($_SERVER['DOCUMENT_ROOT'], '/').e_HTTP."cron.php ".$pref['e_cron_pwd'];
+				.LAN_CRON_15.":
".rtrim($_SERVER['DOCUMENT_ROOT'], '/').e_HTTP."cron.php token=".$pref['e_cron_pwd'].' >/dev/null 2>&1';
 				
 				$setpwd_message .= "
". LAN_CRON_16.""; if(e_DOMAIN && file_exists("/usr/local/cpanel/version")) diff --git a/e107_admin/emoticon.php b/e107_admin/emoticon.php index f6db23dc9..14dde8c4c 100644 --- a/e107_admin/emoticon.php +++ b/e107_admin/emoticon.php @@ -40,7 +40,7 @@ if (isset($_POST['active'])) if ($pref['smiley_activate'] != $_POST['smiley_activate']) { $pref['smiley_activate'] = $_POST['smiley_activate']; - $admin_log->log_event($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03', $pref['emotepack'], E_LOG_INFORMATIVE, ''); + e107::getLog()->add($pref['smiley_activate'] ? 'EMOTE_02' : 'EMOTE_03', $pref['emotepack'], E_LOG_INFORMATIVE, ''); save_prefs(); $update = true; } @@ -88,7 +88,7 @@ foreach($_POST as $key => $value) { $mes->addInfo(LAN_NO_CHANGE); } - $admin_log->log_event('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, ''); + e107::getLog()->add('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, ''); break; } diff --git a/e107_admin/filemanager.php b/e107_admin/filemanager.php index 07900c9dc..d237c65cd 100644 --- a/e107_admin/filemanager.php +++ b/e107_admin/filemanager.php @@ -114,11 +114,11 @@ if (isset($_POST['deleteconfirm'])) } if (count($deleteList)) { - $admin_log->log_event('FILEMAN_01',implode('[!br!]',$deleteList),E_LOG_INFORMATIVE,''); + e107::getLog()->add('FILEMAN_01',implode('[!br!]',$deleteList),E_LOG_INFORMATIVE,''); } if (count($moveList)) { - $admin_log->log_event('FILEMAN_02',implode('[!br!]',$moveList),E_LOG_INFORMATIVE,''); + e107::getLog()->add('FILEMAN_02',implode('[!br!]',$moveList),E_LOG_INFORMATIVE,''); } } @@ -173,7 +173,7 @@ if (isset($_POST['upload'])) } if (count($uploadList)) { - $admin_log->log_event('FILEMAN_03',implode('[!br!]',$uploadList),E_LOG_INFORMATIVE,''); + e107::getLog()->add('FILEMAN_03',implode('[!br!]',$uploadList),E_LOG_INFORMATIVE,''); } } diff --git a/e107_admin/image.php b/e107_admin/image.php index 7d3e7ca60..a11a040ce 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -168,9 +168,9 @@ class media_cat_ui extends e_admin_ui 'media_cat_image' => array('title'=> LAN_IMAGE, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE), 'media_cat_owner' => array('title'=> LAN_OWNER, 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE), - 'media_cat_type' => array('title'=> LAN_TYPE, 'type' => 'radio', 'data'=>false, 'width' => 'auto', 'thclass' => 'left', 'validate' => true, 'nolist'=>true), + 'media_cat_type' => array('title'=> LAN_TYPE, 'type' => 'radio', 'data'=>false, 'width' => 'auto', 'thclass' => 'left', 'validate' => true, 'nolist'=>true), - 'media_cat_category' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE), + 'media_cat_category' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>TRUE), 'media_cat_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'validate' => true), 'media_cat_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE), 'media_cat_diz' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=150&bb=1','readonly'=>FALSE), // Display name @@ -210,25 +210,31 @@ class media_cat_ui extends e_admin_ui $sql = e107::getDb(); - if($sql->db_Select_gen("SELECT media_cat_owner, count(media_cat_id) as number FROM `#core_media_cat` GROUP BY media_cat_owner")) + if($sql->gen("SELECT media_cat_owner, MAX(CAST(SUBSTRING_INDEX(media_cat_category, '_', -1 ) AS UNSIGNED)) as maxnum, count(media_cat_id) as number FROM `#core_media_cat` GROUP BY media_cat_owner")) { - while($row = $sql->db_Fetch()) + while($row = $sql->fetch()) { $this->ownerCount[$row['media_cat_owner']] = $row['number']; - $own = $row['media_cat_owner']; + $own = $row['media_cat_owner']; if(!in_array($own,$restricted)) - { - + { $this->fields['media_cat_owner']['writeParms'][$own] = $own; + if($row['maxnum'] > 0) + { + $this->ownerCount[$row['media_cat_owner']] = $row['maxnum']; // $maxnum; + } } } } - + e107::getMessage()->addDebug("Max value for category names: ".print_a($this->ownerCount,true)); } + + + public function createPage() { if(!count($this->fields['media_cat_owner']['writeParms'])) @@ -723,7 +729,8 @@ class media_admin_ui extends e_admin_ui 'youtube_showinfo' => array('title'=> "Show Video Info", 'tab'=>2, 'type' => 'boolean', 'data'=>'int', 'help'=>''), 'youtube_cc_load_policy' => array('title'=> "Show Closed-Captions by default", 'tab'=>2, 'type' => 'boolean', 'data'=>'int', 'help'=>''), 'youtube_modestbranding' => array('title'=> "Use Modest Branding", 'tab'=>2, 'type' => 'boolean', 'data'=>'int', 'help'=>''), - + 'youtube_bbcode_responsive' => array('title'=> "Make the YouTube bbcode responsive", 'tab'=>2, 'type' => 'boolean', 'data'=>'int', 'help'=>''), + // ); @@ -2301,7 +2308,7 @@ if (isset($_POST['submit_show_delete_multi'])) //Format system message if(!empty($message)) { - $admin_log->log_event('IMALAN_01', implode('[!br!]', $message), E_LOG_INFORMATIVE, ''); + e107::getLog()->add('IMALAN_01', implode('[!br!]', $message), E_LOG_INFORMATIVE, ''); $mes->addSuccess(implode(', ', $message).' '.IMALAN_28); } } @@ -2339,7 +2346,7 @@ if (isset($_POST['submit_show_deleteall'])) $message = $count." ".IMALAN_26; $mes->addSuccess($message); - $admin_log->log_event('IMALAN_02', $message.$imgList,E_LOG_INFORMATIVE, ''); + e107::getLog()->add('IMALAN_02', $message.$imgList,E_LOG_INFORMATIVE, ''); unset($imgList); } } @@ -2384,7 +2391,7 @@ if (isset($_POST['submit_avdelete_multi'])) } $mes->addSuccess(IMALAN_51.''.implode(', ', $tmp).' '.IMALAN_28); - $admin_log->log_event('IMALAN_03', implode('[!br!]', $avList), E_LOG_INFORMATIVE, ''); + e107::getLog()->add('IMALAN_03', implode('[!br!]', $avList), E_LOG_INFORMATIVE, ''); unset($search_users); } diff --git a/e107_admin/language.php b/e107_admin/language.php index ccdb35d9e..49f3cc7d9 100644 --- a/e107_admin/language.php +++ b/e107_admin/language.php @@ -92,7 +92,7 @@ if (isset($_POST['del_existing']) && $_POST['lang_choices'] && getperms('0')) } } } - $admin_log->log_event('LANG_02', $message.'[!br!]', E_LOG_INFORMATIVE, ''); + e107::getLog()->add('LANG_02', $message.'[!br!]', E_LOG_INFORMATIVE, ''); $sql->db_ResetTableList(); if ($action == 'modify') @@ -158,7 +158,7 @@ if (isset($_POST['create_tables']) && $_POST['language']) } } } - $admin_log->log_event('LANG_03', $message, E_LOG_INFORMATIVE, ''); + e107::getLog()->add('LANG_03', $message, E_LOG_INFORMATIVE, ''); $sql->db_ResetTableList(); } /* @@ -194,7 +194,7 @@ if (varset($_POST['ziplang']) && varset($_POST['language'])) if(varset($pref['lancheck'][$_POST['language']]) == 1) { $text = zip_up_lang($_POST['language']); - $admin_log->log_event('LANG_04', $_POST['language'], E_LOG_INFORMATIVE, ''); + e107::getLog()->add('LANG_04', $_POST['language'], E_LOG_INFORMATIVE, ''); $mes->addInfo(LANG_LAN_25.': '.$text); } else diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php index 57bd802a8..9a6d1c041 100644 --- a/e107_admin/mailout.php +++ b/e107_admin/mailout.php @@ -66,7 +66,7 @@ Valid subparameters (where required): $_GET['m'] - id of mail info in db $_GET['t'] - id of target info in db */ -header('Content-Encoding: none'); // turn off gzip. +// header('Content-Encoding: none'); // turn off gzip. require_once('../class2.php'); if (!getperms('W')) @@ -74,28 +74,84 @@ if (!getperms('W')) header('location:'.e_BASE.'index.php'); exit; } - -$e_sub_cat = 'mail'; - -if(vartrue($_GET['mode']) == "progress") -{ - session_write_close(); - sendProgress(); - exit; -} - -require_once(e_HANDLER.'ren_help.php'); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_users.php'); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_mailout.php'); + +require_once(e_HANDLER.'ren_help.php'); + require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER.'mailout_class.php'); // Class handler for core mailout functions require_once(e_HANDLER.'mailout_admin_class.php'); // Admin tasks handler require_once(e_HANDLER.'mail_manager_class.php'); // Mail DB API -require_once (e_HANDLER.'message_handler.php'); + +/** + * Display Progress-bar of real-time mail-out. + * @return + */ +function sendProgress($id) +{ + +// return rand(92,100); + + $pref = e107::getPref(); + + ob_start(); + + $mailManager = new e107MailManager(); + $mailManager->doEmailTask(varset($pref['mail_workpertick'],5)); + + $sqld = e107::getDb('progress'); + + $sqld->select("mail_content","mail_total_count,mail_togo_count,mail_sent_count,mail_fail_count","mail_source_id= ".intval($id) ); + $row = $sqld->fetch(); + + $rand = ($row['mail_sent_count'] + $row['mail_fail_count']); + $total = ($row['mail_total_count']); + + $errors = ob_get_clean(); + + $errors .= " id=".$id; + + + e107::getMessage()->addDebug($errors); + + + + $inc = round(($rand / $total) * 100); + + $errors .= " inc=".$inc; + + file_put_contents(e_LOG.'send-mail-progress.txt',$errors); + + e107::getMessage()->addDebug("Returned: ".$inc); + + return $inc; + + +} + +if(e_AJAX_REQUEST) +{ + $id = intval($_GET['mode']); + echo sendProgress($id); + exit; + +} + + + +if(vartrue($_GET['mode']) == "progress") +{ +// session_write_close(); +// sendProgress(); +// exit; +} + + $mes = e107::getMessage(); $tp = e107::getParser(); - +/* if($_GET['mode']=="process") { session_write_close(); // allow other scripts to run in parallel. @@ -111,6 +167,1297 @@ if($_GET['mode']=="process") echo "Completed Mailout ID: ".$_GET['id']; exit; } +*/ + + +class mailout_admin extends e_admin_dispatcher +{ + + protected $modes = array( + 'main' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'saved' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'pending' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'held' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'sent' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'prefs' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'maint' => array( + 'controller' => 'mailout_main_ui', + 'path' => null, + 'ui' => 'mailout_admin_form_ui', + 'uipath' => null + ), + 'recipients' => array( + 'controller' => 'mailout_recipients_ui', + 'path' => null, + 'ui' => 'mailout_recipients_form_ui', + 'uipath' => null + ) + + ); + + protected $adminMenu = array( + // 'makemail/makemail' => array('caption'=> LAN_MAILOUT_190, 'perm' => 'W', 'url'=>e_SELF), + 'main/list' => array('caption'=> LAN_MANAGE, 'perm'=> 'W'), + 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'W'), + + 'recipients/list' => array('caption'=> "Recipients", 'perm' => 'W'), + // 'main/send' => array('caption'=> "Send", 'perm' => 'W'), + 'other' => array('divider'=> true), + // 'saved/list' => array('caption'=> LAN_MAILOUT_191, 'perm' => 'W'), + 'pending/list' => array('caption'=> LAN_MAILOUT_193, 'perm' => 'W'), + 'held/list' => array('caption'=> LAN_MAILOUT_194, 'perm' => 'W'), + 'sent/list' => array('caption'=> LAN_MAILOUT_192, 'perm' => 'W'), + 'other2' => array('divider'=> true), + 'prefs/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'), + 'maint/maint' => array('caption'=> ADLAN_40, 'perm' => '0'), + + ); + + + + protected $adminMenuAliases = array( + 'main/send' => 'main/create', + ); + + protected $menuTitle = LAN_MAILOUT_15; +} + +class mailout_main_ui extends e_admin_ui +{ + + //TODO Move to Class above. + protected $pluginTitle = LAN_MAILOUT_15; + protected $pluginName = LAN_MAILOUT_15; + protected $table = "mail_content"; + + // protected $listQry = null; + + + // protected $editQry = "SELECT * FROM #mail_content WHERE cust_id = {ID}"; + + protected $pid = "mail_source_id"; + protected $perPage = 10; + protected $listOrder = "mail_source_id desc"; + + protected $batchDelete = true; + protected $batchCopy = true; + + protected $tabs = array('Basic','Advanced'); //TODO Add LAN_BASIC and LAN_ADVANCED to lan_admin.php + + protected $fields = array( + 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), + 'mail_source_id' => array('title' => LAN_MAILOUT_137, 'width' =>'5%', 'thclass' => 'center', 'class'=>'center', 'forced' => TRUE), + + 'mail_selectors' => array('title' => LAN_MAILOUT_03, 'type'=>'method', 'data'=>false, 'nolist' => true, 'writeParms'=>'nolabel=0'), + 'mail_title' => array('title' => LAN_MAILOUT_135, 'type'=>'text', 'forced' => TRUE, 'data'=>'str', 'inline'=>true, 'writeParms'=>'size=xxlarge&required=1', 'help'=>'whatever'), + 'mail_sender_name' => array('title' => LAN_MAILOUT_150, 'type'=>'method', 'data'=>false), + 'mail_sender_email' => array('title' => LAN_MAILOUT_149,'type'=>'method','data'=>false), + 'mail_copy_to' => array('title' => LAN_MAILOUT_151,'tab'=>1, 'type'=>'method','data'=>false), + 'mail_bcopy_to' => array('title' => LAN_MAILOUT_152,'tab'=>1, 'type'=>'method','data'=>false), + 'mail_subject' => array('title' => LAN_MAILOUT_06, 'type'=>'text', 'forced' => TRUE,'data'=>'str', 'inline'=>true, 'writeParms'=>'size=xxlarge&required=1'), + 'mail_content_status' => array('title' => LAN_MAILOUT_136, 'tab'=>1, 'type'=> 'dropdown', 'data'=>'int', 'filter'=>false, 'inline'=>false, 'thclass' => 'left', 'class'=>'left'), + 'mail_total_count' => array('title' => "Total Recipients", 'noedit'=>true, 'type'=>'number'), + 'mail_sent_count' => array('title' => LAN_MAILOUT_82, 'noedit'=>true, 'type'=>'number'), + 'mail_togo_count' => array('title' => LAN_MAILOUT_83, 'noedit'=>true, 'type'=>'number'), + + 'mail_fail_count' => array('title' => LAN_MAILOUT_128, 'noedit'=>true, 'type'=>'number'), + 'mail_bounce_count' => array('title' => LAN_MAILOUT_144, 'noedit'=>true, 'type'=>'number'), + 'mail_start_send' => array('title' => LAN_MAILOUT_131,'noedit'=>true, 'type'=>'number', 'proc' => 'sdatetime'), + 'mail_end_send' => array('title' => LAN_MAILOUT_132, 'noedit'=>true, 'type'=>'number', 'proc' => 'sdatetime'), + 'mail_create_date' => array('title' => LAN_MAILOUT_130, 'type'=>null, 'noedit'=>true, 'data'=>'int', 'type'=>'number'), + 'mail_creator' => array('title' => LAN_MAILOUT_85, 'type'=>null, 'noedit'=>true, 'data'=>'int'), + 'mail_create_app' => array('title' => LAN_MAILOUT_133, 'type'=>null, 'noedit'=>true,'data'=>'str'), + 'mail_e107_priority' => array('title' => LAN_MAILOUT_134, 'noedit'=>true), + 'mail_notify_complete' => array('title' => LAN_MAILOUT_243, 'noedit'=>true, 'nolist' => true), + 'mail_last_date' => array('title' => LAN_MAILOUT_129, 'noedit'=>true, 'type'=>'int', 'proc' => 'sdatetime'), + 'mail_attach' => array('title' => LAN_MAILOUT_153, 'tab'=>1, 'type'=>'method','data'=>false), + 'mail_include_images' => array('title' => LAN_MAILOUT_224, 'tab'=>1, 'type'=>'boolean','data'=>false, 'proc' => 'yesno'), + 'mail_send_style' => array('title' => LAN_MAILOUT_154,'type'=>'method','data'=>false), + 'mail_media' => array('title' => 'Embed Media', 'type' => 'images', 'data' => 'array', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => 'video=1', 'class' => 'center', 'thclass' => 'center', ), + + 'mail_body' => array('title' => LAN_MAILOUT_100, 'type'=>'bbarea', 'proc' => 'trunc200'), + 'mail_body_templated' => array('title' => LAN_MAILOUT_257, 'noedit'=>true, 'proc' => 'chars'), + 'mail_other' => array('title' => LAN_MAILOUT_84, 'type'=>null, 'noedit'=>true, 'data'=>'array', 'nolist'=>true), + + 'options' => array('title' => LAN_OPTIONS, 'type'=>'method', 'width'=>'10%', 'forced' => TRUE) + + ); + + + + + protected $fieldpref = array('checkboxes', 'mail_source_id', 'mail_title', 'mail_subject', 'mail_content_status', 'options'); + + + // optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName); + protected $prefs = array( + // 'after_submit' => array('title'=> 'Custom After Submit Text:', 'type'=>'bbarea') + // 'submit_question' => array('title'=> 'Allow submitting of Questions by:', 'type'=>'userclass'), + // 'classic_look' => array('title'=> 'Use Classic Layout', 'type'=>'boolean') + ); + + + + + public $mailAdmin = null; + + private $selectFields = array('email_to', + 'extended_1_name','extended_1_value', + 'extended_2_name', 'extended_2_value', + 'user_search_name', 'user_search_value', + 'last_visit_match', 'last_visit_date' + ); + + + private $mailOtherFields = array( + 'mail_sender_email', + 'mail_sender_name', + 'mail_copy_to', + 'mail_bcopy_to', + 'mail_attach', + 'mail_send_style', // HTML, text, template name etc + 'mail_selectors', // Only used internally + 'mail_include_images', // Used to determine whether to embed images, or link to them + 'mail_body_alt' , // If non-empty, use for alternate email text (generally the 'plain text' alternative) + 'mail_overrides' + ); + + + function init() + { + $action = varset($_GET['mode'], 'main'); + + $this->mailAdmin = new mailoutAdminClass($action); + + if($_GET['action'] == 'preview') + { + echo $this->previewPage(); + exit; + } + + if ($this->mailAdmin->loadMailHandlers() == 0) + { + e107::getMessage()->addDebug('No mail handlers loaded!!'); + + } + + /* + define('MAIL_STATUS_SENT', 0); // Mail sent. Email handler happy, but may have bounced (or may be yet to bounce) + define('MAIL_STATUS_BOUNCED', 1); + define('MAIL_STATUS_CANCELLED', 2); + define('MAIL_STATUS_PARTIAL', 3); // A run which was abandoned - errors, out of time etc + define('MAIL_STATUS_FAILED', 5); // Failure on initial send - rejected by selected email handler + // This must be the numerically highest 'processing complete' code + define('MAIL_STATUS_PENDING', 10); // Mail which is in the sending list (even if outside valid sending window) + // This must be the numerically lowest 'not sent' code + // E107_EMAIL_MAX_TRIES values used in here for retry counting + define('MAIL_STATUS_MAX_ACTIVE', 19); // Highest allowable 'not sent or processed' code + define('MAIL_STATUS_SAVED', 20); // Identifies an email which is just saved (or in process of update) + define('MAIL_STATUS_HELD',21); // Held pending release + define('MAIL_STATUS_TEMP', 22); // Tags entries which aren't yet in any list + */ + + $types = array(10=>'Pending',20=>"Saved", 21=>"Held", 0=>'Sent', 1=>'Bounced', 2=>'Cancelled', 3=> 'Partial', 5=>'Failed', 19 => "Max Active", 22=>"Temp"); + + + $qr = array('saved'=>20,'pending'=>10,'held'=>21,'sent'=>0); + + if($action !== 'main' ) + { + $this->listQry = "SELECT * FROM #mail_content WHERE mail_content_status = ".varset($qr[$action],20); + } + else + { + $this->listQry = "SELECT * FROM #mail_content WHERE (mail_content_status = ".MAIL_STATUS_TEMP ." OR mail_content_status = ".MAIL_STATUS_SAVED.")"; + } + + + if($action == 'sent' || $action == 'pending' || $action == 'held') + { + $this->fieldpref = array('checkboxes', 'mail_source_id', 'mail_title', 'mail_subject','mail_total_count', 'mail_togo_count', 'mail_sent_count', 'mail_fail_count', 'mail_bounce_count', 'options'); + } + + $this->fields['mail_content_status']['writeParms'] = $types; + + $this->processSendActions(); + + $mes = e107::getMessage(); + + if (getperms('0')) + { + if (isset($_POST['testemail'])) + { + $this->sendTestEmail(); // Send test email - uses standard 'single email' handler + } + elseif (isset($_POST['updateprefs'])) + { + $this->saveMailPrefs($mes); // TODO check if functional, $emessage -> $mes + } + } + + + + } + + private function sendTestEmail() + { + $mes = e107::getMessage(); + $pref = e107::getPref(); + + if(trim($_POST['testaddress']) == '') + { + $mes->addError(LAN_MAILOUT_19); + $subAction = 'error'; + } + else + { + $mailheader_e107id = USERID; + + $add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).")" : ' (PHP)'; + $sendto = trim($_POST['testaddress']); + + $eml = array( + 'e107_header' => 9999999, + 'subject' => LAN_MAILOUT_113." ".$add, + 'body' => str_replace("[br]", "\n", LAN_MAILOUT_114), + 'template' => vartrue($_POST['testtemplate'],null), + 'shortcodes' => array('USERID'=>555, 'USERNAME'=>'John Smith', 'LOGINNAME'=>'TestName', 'PASSWORD'=>'xxxxxxx', 'ACTIVATION_LINK'=>SITEURL."signup.php#activate") + ); + + if (!e107::getEmail()->sendEmail($sendto, LAN_MAILOUT_189, $eml)) + { + $mes->addError(($pref['mailer'] == 'smtp') ? LAN_MAILOUT_67 : LAN_MAILOUT_106); + } + else + { + $mes->addSuccess(LAN_MAILOUT_81. ' ('.$sendto.')'); + e107::getAdminLog()->log_event('MAIL_01',$sendto,E_LOG_INFORMATIVE,''); + } + } + + + } + + + public function beforeCreate($new_data, $old_data) + { + $ret = $this->processData($new_data); + + $ret['mail_create_date'] = time(); + $ret['mail_creator'] = USERID; + $ret['mail_create_app'] = 'core'; + $ret['mail_content_status'] = MAIL_STATUS_TEMP; + + return $ret; + + } + + + public function beforeUpdate($new_data, $old_data, $id) + { + $ret = $this->processData($new_data); + + return $ret; + } + + + + + + private function processSendActions() + { + + if((vartrue($_POST['email_send']) || vartrue($_POST['email_hold']) || vartrue($_POST['email_cancel'])) && !vartrue($_POST['email_id'])) + { + e107::getMessage()->addError("No Message ID submitted"); + return; + } + + $id = intval($_POST['email_id']); + + if(vartrue($_POST['email_send'])) + { + $this->emailSend($id); + } + + if(vartrue($_POST['email_hold'])) + { + $this->emailHold($id); + } + + if(vartrue($_POST['email_cancel'])) + { + $this->emailCancel($id); + } + + } + + + private function emailSendNow($id) + { + + } + + + + private function emailSend($mailId) + { + $log = e107::getAdminLog(); + + $notify = isset($_POST['mail_notify_complete']) ? 3 : 2; + $first = 0; + $last = 0; // Set defaults for earliest and latest send times. + + + + if (isset($_POST['mail_earliest_time'])) + { + $first = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, FALSE); + } + if (isset($_POST['mail_latest_time'])) + { + $last = e107::getDateConvert()->decodeDateTime($_POST['mail_earliest_time'], 'datetime', CORE_DATE_ORDER, TRUE); + } + + if ($this->mailAdmin->activateEmail($mailId, FALSE, $notify, $first, $last)) + { + e107::getMessage()->addSuccess(LAN_MAILOUT_185); + $log->log_event('MAIL_06','ID: '.$mailId,E_LOG_INFORMATIVE,''); + } + else + { + $errors[] = str_replace('--ID--', $mailId, LAN_MAILOUT_188); + } + } + + + + private function emailHold($mailId) + { + if ($this->mailAdmin->activateEmail($mailId, TRUE)) + { + e107::getMessage()->addSuccess(str_replace('--ID--', $mailId, LAN_MAILOUT_187)); + } + else + { + $errors[] = str_replace('--ID--', $mailId, LAN_MAILOUT_166); + } + } + + + + private function emailCancel($mailId) + { + if ($this->mailAdmin->cancelEmail($mailId)) + { + e107::getMessage()->addSuccess(str_replace('--ID--', $mailId, LAN_MAILOUT_220)); + } + else + { + $errors[] = str_replace('--ID--', $mailId, LAN_MAILOUT_221); + } + } + + + /** + * Preview the Email. + */ + function previewPage() + { + $mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($_GET['id'])." LIMIT 1"); + + $data = $this->mailAdmin->dbToMail($mailData); + + $eml = array( + 'subject' => $data['mail_subject'], + 'body' => $data['mail_body'], + 'template' => $data['mail_send_style'], + 'shortcodes' => array('USERNAME'=>'John Example', 'DISPLAYNAME'=> 'John Example', 'USERID'=>'555', 'MAILREF'=>$_GET['id'], 'NEWSLETTER'=>SITEURL."newsletter/?id=example1234567", 'UNSUBSCRIBE'=>SITEURL."unsubscribe/?id=example1234567"), + 'media' => $data['mail_media'], + ); + + return e107::getEmail()->preview($eml); + exit; + + } + + + + /** + * Process Posted Data + */ + private function processData($new_data) + { + $other = array(); + + $ret = $new_data; + + foreach($new_data as $k=>$v) + { + if(in_array($k, $this->mailOtherFields)) + { + $other[$k] = $v; + unset($ret[$k]); + } + } + + $other['mail_selectors'] = $this->mailAdmin->getAllSelectors(); + + + $ret['mail_attach'] = trim($new_data['mail_attach']); + $ret['mail_send_style'] = varset($new_data['mail_send_style'],'textonly'); + $ret['mail_include_images'] = (isset($new_data['mail_include_images']) ? 1 : 0); + $ret['mail_other'] = $other; // type is set to 'array' in $fields. + + // e107::getMessage()->addInfo(print_a($ret,true)); + return $ret; + } + + + /* + function createPage() + { + if (!isset($mailData) || !is_array($mailData)) + { + $mailData = array(); // Empty array just in case + } + + if($id = $this->getId()) + { + $mailData = e107::getDB()->retrieve('mail_content','*','mail_source_id='.$id); + } + + return $this->mailAdmin->show_mailform($mailData); + + } + */ + + function sendnowPage() + { + $id = $this->getId(); + + e107::getDb()->update('mail_content', 'mail_content_status='.MAIL_STATUS_PENDING.' WHERE mail_source_id = '.intval($id)); + e107::getDb()->update('mail_recipients', 'mail_status='.MAIL_STATUS_PENDING.' WHERE mail_detail_id = '.intval($id)); + + if(E107_DEBUG_LEVEL > 0) + { + echo "

Debug Mode : Mail is sent and data displayed below.

"; + sendProgress($id); + } + else + { + $text = "

Ready to Process Mail Queue

"; + $text .= e107::getForm()->progressBar('mail-progress',1, array('btn-label'=>'Start #'.$id, 'url'=> e_SELF, 'mode'=>$id)); + } + + return $text; + } + + + function sendPage() + { + + $id = $this->getId(); + + $mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($id)); + + if(empty($mailData)) + { + e107::getMessage()->addError("Couldn't retrieve mail data for id: ".$id); + return ''; + } + + $fromHold = false; + + $mailData = $this->mailAdmin->dbToMail($mailData); + + e107::getMessage()->addDebug("Regenerating recipient list"); + + e107::getDb()->delete('mail_recipients','mail_detail_id='.intval($id)); + + return $this->mailAdmin->sendEmailCircular($mailData, $fromHold); + + + } + + function maintPage() + { + if (!getperms('0')) + { + return; + } + + $mes = e107::getMessage(); + $ns = e107::getRender(); + $frm = e107::getForm(); + + $text = " +
+
+ + + + + + + "; + + $text .= ""; + $text .= "
".LAN_MAILOUT_182." + + ".$frm->admin_button('email_dross','no-value','delete', LAN_RUN)." +
".LAN_MAILOUT_252."
\n
"; + + return $text; + + // return $ns->tablerender(ADLAN_136.SEP.ADLAN_40, $text, 'maint',true); + + } + + function prefsPage() + { + if (!getperms('0')) + { + return; + } + $pref = e107::getPref(); + $e107 = e107::getInstance(); + $frm = e107::getForm(); + $mes = e107::getMessage(); + $ns = e107::getRender(); + + if($pref['mail_bounce'] == 'auto' && !empty($pref['mail_bounce_email']) && !is_executable(e_HANDLER."bounce_handler.php")) + { + $mes->addWarning('Your bounce_handler.php file is NOT executable'); + } + + + e107::getCache()->CachePageMD5 = '_'; + $lastload = e107::getCache()->retrieve('emailLastBounce',FALSE,TRUE,TRUE); + $lastBounce = round((time() - $lastload) / 60); + + $lastBounceText = ($lastBounce > 1256474) ? "Never" : "".$lastBounce . " minutes ago."; + + $text = " +
+
+ ".LAN_MAILOUT_110." + + + + + + + + + + + + + + + + + + + + + \n + + + + + + \n + + + + + \n"; + + if (isset($pref['e_mailout_list'])) // Allow selection of email address sources + { + $text .= " + + + \n"; + } + + list($mail_log_option,$mail_log_email) = explode(',',varset($pref['mail_log_options'],'0,0')); + + $check = ($mail_log_email == 1) ? " checked='checked'" : ""; + + + $logOptions = array(LAN_MAILOUT_73,LAN_MAILOUT_74,LAN_MAILOUT_75,LAN_MAILOUT_119); + + $text .= " + + \n"; + /* + $text .= " + \n + ".LAN_MAILOUT_76. + " + \n"; + */ + + + $text .= "
".LAN_MAILOUT_110."
".$frm->admin_button('testemail', LAN_MAILOUT_112,'other')."  + + ".$this->mailAdmin->sendStyleSelect(varset($_POST['testtemplate'], 'textonly'), 'testtemplate')." +
".LAN_MAILOUT_115."
+ ".LAN_MAILOUT_116."
"; + + + +// SMTP. --------------> + $smtp_opts = explode(',',varset($pref['smtp_options'],'')); + $smtpdisp = ($pref['mailer'] != 'smtp') ? "style='display:none;'" : ''; + $text .= "
+ + + + + + "; + $text .= " + + + + + + + + + + + + + + + + + "; + + $text .= " + + "; + + $checked = (in_array('useVERP',$smtp_opts) ? "checked='checked'" : ""); + $text .= " + + +
".LAN_MAILOUT_87.":   + +
".LAN_MAILOUT_88.": (".LAN_OPTIONAL.")   + +
".LAN_MAILOUT_89.": (".LAN_OPTIONAL.")   + +
".LAN_MAILOUT_90." + \n
".LAN_MAILOUT_94."
".LAN_MAILOUT_57." + "; + $checked = (varsettrue($pref['smtp_keepalive']) ) ? "checked='checked'" : ''; + $text .= " +
".LAN_MAILOUT_95." + +
"; + + + /* FIXME - posting SENDMAIL path triggers Mod-Security rules. + // Sendmail. --------------> + $senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : ''; + $text .= "
"; + $text .= " + + + + + +
".LAN_MAILOUT_20.":   + +
"; + */ + + $text .="
".LAN_MAILOUT_222.""; + $text .= $this->mailAdmin->sendStyleSelect(varset($pref['mail_sendstyle'], 'textonly'), 'mail_sendstyle'); + $text .= + "".LAN_MAILOUT_223." +
".LAN_MAILOUT_25." ".LAN_MAILOUT_26." ".$frm->number('mail_pause', $pref['mail_pause'])." ".LAN_MAILOUT_27." ". + $frm->number('mail_pausetime', $pref['mail_pausetime'])." ".LAN_MAILOUT_29.".
+ ".LAN_MAILOUT_30." +
".LAN_MAILOUT_156."".$frm->number('mail_workpertick',varset($pref['mail_workpertick'],5))."".LAN_MAILOUT_157." +
".LAN_MAILOUT_77." "; + + $mail_enable = explode(',',$pref['mailout_enabled']); + + $coreCheck = (in_array('core',$mail_enable)) ? "checked='checked'" : ""; + $text .= $frm->checkbox('mail_mailer_enabled[]','core', $coreCheck, 'users'); + + foreach ($pref['e_mailout_list'] as $mailer => $v) + { + $check = (in_array($mailer,$mail_enable)) ? "checked='checked'" : ""; + $text .= $frm->checkbox('mail_mailer_enabled[]',$mailer,$check,$mailer); + // $text .= "  {$mailer}
"; + } + + $text .= "
".LAN_MAILOUT_72." + ".$frm->select('mail_log_option',$logOptions,$mail_log_option); + $text .= " ".$frm->checkbox('mail_log_email', 1, $check, 'label='.LAN_MAILOUT_76); + $text .= "
+
+ ".LAN_MAILOUT_31." + + + + + + + + +
".LAN_MAILOUT_231.""; + + // bounce divs = mail_bounce_none, mail_bounce_auto, mail_bounce_mail + $autoDisp = ($pref['mail_bounce'] != 'auto') ? "style='display:none;'" : ''; + $autoMail = ($pref['mail_bounce'] != 'mail') ? "style='display:none;'" : ''; + $bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234); + $text .= "\n
+ + + + + + + + + + + + + + + + +
".LAN_MAILOUT_32."".$frm->text('mail_bounce_email2', $pref['mail_bounce_email'], 40, 'size=xxlarge')."
".LAN_MAILOUT_233."".(e_DOCROOT).e107::getFolder('handlers')."bounce_handler.php"; + + + if(!is_readable(e_HANDLER.'bounce_handler.php')) + { + $text .= "
".LAN_MAILOUT_161.''; + } + elseif(!is_executable(e_HANDLER.'bounce_handler.php')) // Seems to give wrong answers on Windoze + { + $text .= "
".LAN_MAILOUT_162.''; + } + $text .= "
".LAN_MAILOUT_235."
".LAN_MAILOUT_236."".$lastBounceText."
"; + + // Parameters for mail-account based bounce processing + $text .= " + + + + + + "; + + $bouncePrefs = array('mail_bounce_email'=>LAN_MAILOUT_32, 'mail_bounce_pop3'=>LAN_MAILOUT_33, 'mail_bounce_user'=>LAN_MAILOUT_34, 'mail_bounce_pass'=>LAN_MAILOUT_35); + + foreach($bouncePrefs as $key =>$label) + { + $text .= ""; + } + + /* + $text .= " + + + + + "; + */ + + $text .= " + \n + "; + + $check = ($pref['mail_bounce_delete']==1) ? " checked='checked'" : ""; + $text .= ""; + + $check = ($pref['mail_bounce_auto']==1) ? " checked='checked'" : ""; + $text .= " + + +
".$label."".$frm->text($key,$pref[$key],40,'size=xlarge')."
".LAN_MAILOUT_32."
".LAN_MAILOUT_33."
".LAN_MAILOUT_34."
".LAN_MAILOUT_35."
".LAN_MAILOUT_120."
".LAN_MAILOUT_36."
".LAN_MAILOUT_245." ".LAN_MAILOUT_246."
+ +
".$frm->admin_button('updateprefs',LAN_MAILOUT_28,'update')."
+ +
"; + + return $text; +// $caption = ADLAN_136.SEP.LAN_PREFS; +// $ns->tablerender($caption, $mes->render(). $text); + + } + + + + + + + + + // Update Preferences. (security handled elsewhere) + function saveMailPrefs(&$mes) // $emessage to $mes, working? + { + if(!getperms('0')) + { + return; + } + + //$pref = e107::getPref(); + $e107 = e107::getInstance(); + $tp = e107::getParser(); + $mes = e107::getMessage(); + + $bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234); + unset($temp); + if (!in_array($_POST['mailer'], array('smtp', 'sendmail', 'php'))) $_POST['mailer'] = 'php'; + $temp['mailer'] = $_POST['mailer']; + // Allow qmail as an option as well - works much as sendmail + if ((strpos($_POST['sendmail'],'sendmail') !== FALSE) || (strpos($_POST['sendmail'],'qmail') !== FALSE)) + { + $temp['sendmail'] = $tp->toDB($_POST['sendmail']); + } + else + { + $temp['sendmail'] = ''; + } + $temp['smtp_server'] = $tp->toDB($_POST['smtp_server']); + $temp['smtp_username'] = $tp->toDB($_POST['smtp_username']); + $temp['smtp_password'] = $tp->toDB($_POST['smtp_password']); + + $smtp_opts = array(); + switch (trim($_POST['smtp_options'])) + { + case 'smtp_ssl' : + $smtp_opts[] = 'secure=SSL'; + break; + case 'smtp_tls' : + $smtp_opts[] = 'secure=TLS'; + break; + case 'smtp_pop3auth' : + $smtp_opts[] = 'pop3auth'; + break; + } + if (varsettrue($_POST['smtp_keepalive'])) $smtp_opts[] = 'keepalive'; + if (varsettrue($_POST['smtp_useVERP'])) $smtp_opts[] = 'useVERP'; + + $temp['smtp_options'] = implode(',',$smtp_opts); + + $temp['mail_sendstyle'] = $tp->toDB($_POST['mail_sendstyle']); + $temp['mail_pause'] = intval($_POST['mail_pause']); + $temp['mail_pausetime'] = intval($_POST['mail_pausetime']); + $temp['mail_workpertick'] = intval($_POST['mail_workpertick']); + $temp['mail_workpertick'] = min($temp['mail_workpertick'],1000); + $temp['mail_bounce'] = isset($bounceOpts[$_POST['mail_bounce']]) ? $_POST['mail_bounce'] : 'none'; + $temp['mail_bounce_auto'] = 0; // Make sure this is always defined + switch ($temp['mail_bounce']) + { + case 'none' : + $temp['mail_bounce_email'] = ''; + break; + case 'auto' : + $temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email2']); + break; + case 'mail' : + $temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email']); + $temp['mail_bounce_auto'] = intval($_POST['mail_bounce_auto']); + break; + } + $temp['mail_bounce_pop3'] = $tp->toDB($_POST['mail_bounce_pop3']); + $temp['mail_bounce_user'] = $tp->toDB($_POST['mail_bounce_user']); + $temp['mail_bounce_pass'] = $tp->toDB($_POST['mail_bounce_pass']); + $temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']); + $temp['mail_bounce_delete'] = intval(varset($_POST['mail_bounce_delete'], 0)); + + $temp['mailout_enabled'] = implode(',', varset($_POST['mail_mailer_enabled'], '')); + $temp['mail_log_options'] = intval($_POST['mail_log_option']).','.intval($_POST['mail_log_email']); + + foreach ($temp as &$t) + { + if ($t === NULL) $t = ''; + } + $pref = e107::pref('core'); // Core Prefs Array. + if (e107::getAdminLog()->logArrayDiffs($temp, $pref, 'MAIL_03')) + { + e107::getConfig()->updatePref($temp); + e107::getConfig()->save(false); // Only save if changes - generates its own message + } + else + { + $mes->addInfo(LAN_NO_CHANGE); + } + } + + + +} + +class mailout_admin_form_ui extends e_admin_form_ui +{ + + public function mail_selectors($curval, $mode) + { + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + + switch($mode) + { + case 'read': + return varset($data['mail_selectors'], ''); + break; + + case 'write': + return $this->getController()->mailAdmin->emailSelector('all', varset($data['mail_selectors'], FALSE)); + break; + + case 'filter': + case 'batch': + // return $controller->getcustCategoryTree(); + break; + + } + + } + + + + + public function mail_send_style($curVal, $mode) + { + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + + switch($mode) + { + case 'read': + return varset($data['mail_send_style'], ''); + break; + + case 'write': + return $this->getController()->mailAdmin->sendStyleSelect(varset($data['mail_send_style'], ''),'mail_send_style'); + break; + + case 'filter': + case 'batch': + // return $controller->getcustCategoryTree(); + break; + + } + + + } + + + private function mailDetails($field, $mode) + { + + switch($mode) + { + case 'read': + $val = stripslashes($this->getController()->getListModel()->get('mail_other')); + $data = e107::unserialize($val); + return $data[$field]; + break; + + case 'write': + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + + if($field == 'mail_sender_name' && !vartrue($data['mail_sender_name'])) + { + $data['mail_sender_name'] = USERNAME; + } + + if($field == 'mail_sender_email' && !vartrue($data['mail_sender_email'])) + { + $data['mail_sender_email'] = USEREMAIL; + } + + + return $this->text($field, $data[$field],70, 'size=xxlarge'); + break; + + case 'filter': + case 'batch': + // return $controller->getcustCategoryTree(); + break; + + } + } + + + public function mail_sender_name($curVal,$mode) + { + return $this->mailDetails('mail_sender_name', $mode); + } + + public function mail_sender_email($curVal,$mode) + { + return $this->mailDetails('mail_sender_email', $mode); + } + + public function mail_copy_to($curVal,$mode) + { + return $this->mailDetails('mail_copy_to', $mode); + } + + public function mail_bcopy_to($curVal,$mode) + { + return $this->mailDetails('mail_bcopy_to', $mode); + } + + public function mail_attach($curVal,$mode) + { + if($mode == 'read') + { + $val = stripslashes($this->getController()->getListModel()->get('mail_other')); + $data = e107::unserialize($val); + return basename($data['mail_attach']); + } + + if($mode == 'write') + { + $val = stripslashes($this->getController()->getModel()->get('mail_other')); + $data = e107::unserialize($val); + return $this->filepicker('mail_attach',$data['mail_attach'], $mode); + } + + } + + + function options($parms, $value, $id, $attributes) + { + $controller = $this->getController(); + + + + $mode = $this->getController()->getMode(); + + if($mode == 'main') + { + $text = ""; + + $link = e_SELF."?mode=main&action=send&id=".$id; + $preview = e_SELF."?mode=main&action=preview&id=".$id; + $text .= "".E_32_MAIL.""; + $text .= "".E_32_SEARCH.""; + $text .= $this->renderValue('options',$value,$att,$id); + + return $text; + } + + if($mode == 'sent' || $mode == 'pending' || $mode == 'held') + { + $link = e_SELF."?searchquery=&filter_options=mail_detail_id__".$id."&mode=recipients&action=list"; + $preview = e_SELF."?mode=main&action=preview&id=".$id; + $text .= "".E_32_USER.""; + $text .= "".E_32_SEARCH.""; + + $att['readParms']['editClass'] = e_UC_NOBODY; + $text .= $this->renderValue('options',$value,$att,$id); + return $text; + } + + $mode = $controller->getMode(); + $mailData = $controller->getListModel()->getData(); + + return $controller->mailAdmin->makeMailOptions($mode,$mailData); + + } + +} + + + + + +class mailout_recipients_ui extends e_admin_ui +{ + + //TODO Move to Class above. + protected $pluginTitle = LAN_MAILOUT_15; + protected $pluginName = LAN_MAILOUT_15; + protected $table = "mail_recipients"; + + // protected $listQry = "SELECT * FROM #mail_content WHERE mail_content_status = 20 "; + + + // protected $editQry = "SELECT * FROM #mail_content WHERE cust_id = {ID}"; + + protected $pid = "mail_target_id"; + protected $perPage = 10; + protected $listOrder = "mail_target_id desc"; + + protected $batchDelete = true; + + // protected $tabs = array('General','Details', 'Questionnaire', 'Correspondence'); + + protected $fields = array( + 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), + 'mail_target_id' => array('title' => LAN_MAILOUT_143, 'thclass' => 'center', 'forced' => TRUE), + 'mail_recipient_id' => array('title' => LAN_MAILOUT_142, 'thclass' => 'center'), + 'mail_recipient_name' => array('title' => LAN_MAILOUT_141, 'forced' => TRUE), + 'mail_recipient_email' => array('title' => LAN_MAILOUT_140, 'thclass' => 'left', 'forced' => TRUE), + 'mail_status' => array('title' => LAN_MAILOUT_138, 'type'=>'method', 'thclass' => 'left', 'class'=>'left', 'proc' => 'contentstatus'), + 'mail_detail_id' => array('title' => LAN_MAILOUT_137, 'type'=>'dropdown', 'filter'=>true), + 'mail_send_date' => array('title' => LAN_MAILOUT_139, 'proc' => 'sdatetime'), + 'mail_target_info' => array('title' => LAN_MAILOUT_148, 'proc' => 'array'), + 'options' => array('title' => LAN_OPTIONS, 'width'=>'10%', 'forced' => TRUE) + ); + + + protected $fieldpref = array('checkboxes', 'mail_target_id', 'mail_recipient_name', 'mail_recipient_email', 'mail_detail_id', 'mail_status', 'options'); + + public $mailManager = null; + + function init() + { + + $this->mailManager = new e107MailManager; + + + + $sql = e107::getDb(); + $sql->gen("SELECT r.mail_detail_id,c.mail_title FROM #mail_recipients AS r LEFT JOIN #mail_content as c ON r.mail_detail_id = c.mail_source_id GROUP BY r.mail_detail_id"); + + while($row = $sql->fetch()) + { + $id = $row['mail_detail_id']; + $array[$id] = vartrue($row['mail_title'], "(No Name)"); + } + $this->fields['mail_detail_id']['writeParms'] = $array; + + + if(strpos($_GET['filter_options'],'mail_detail_id__')===false) + { + $ns = e107::getRender(); + e107::getMessage()->addInfo("Please select a mailing list from the filter menu below to view recipients."); + $this->listQry = "SELECT * FROM #mail_recipients WHERE mail_target_id = 0"; // simulated empty result. + return false; + } + + + + + } + + +} + + + +class mailout_recipients_form_ui extends e_admin_form_ui +{ + + public function mail_status($curVal,$mode) + { + if($mode == 'read') + { + return $this->getController()->mailManager->statusToText($curVal); + } + + if($mode == 'write') + { + return $curVal; + } + + } + +} + + +new mailout_admin(); + + + + + + + + + + + + + + + +$e_sub_cat = 'mail'; + + @@ -125,12 +1472,15 @@ $mailAdmin = new mailoutAdminClass($action); // This decodes parts of the quer e107::setRegistry('_mailout_admin', $mailAdmin); if ($mailAdmin->loadMailHandlers() == 0) { // No mail handlers loaded - echo 'No mail handlers loaded!!'; - exit; +// echo 'No mail handlers loaded!!'; + //exit; } require_once(e_ADMIN.'auth.php'); +e107::getAdminUI()->runPage(); + +require_once(e_ADMIN.'footer.php'); @@ -174,6 +1524,8 @@ if (isset($_POST['targetaction'])) } } + +// e107::getMessage()->addDebug("Action=".$action); //echo "Action: {$action} MailId: {$mailId} Target: {$targetId}
"; // ----------------- Actions -------------------> @@ -181,6 +1533,7 @@ if (isset($_POST['targetaction'])) switch ($action) { + /* case 'prefs' : if (getperms('0')) { @@ -214,7 +1567,8 @@ switch ($action) } } break; - + */ + /* case 'mailcopy' : // Copy existing email and go to edit screen if (isset($_POST['mailaction'])) { @@ -228,7 +1582,8 @@ switch ($action) unset($mailData['mail_source_id']); } break; - + */ + /* case 'mailedit' : // Edit existing mail if (isset($_POST['mailaction'])) { @@ -241,7 +1596,8 @@ switch ($action) } } break; - + */ + case 'makemail' : $newMail = TRUE; @@ -398,7 +1754,7 @@ switch ($action) case 'mailshowtemplate' : if (isset($_POST['etrigger_ecolumns'])) { - $mailAdmin->mailbodySaveColumnPref($action); + // $mailAdmin->mailbodySaveColumnPref($action); } break; @@ -424,8 +1780,8 @@ switch ($action) default : - $mes->addError('Code malfunction 23! ('.$action.')'); - $ns->tablerender(LAN_MAILOUT_97, $mes->render()); + // $mes->addError('Code malfunction 23! ('.$action.')'); + // $ns->tablerender(LAN_MAILOUT_97, $mes->render()); exit; // Could be a hack attempt } // switch($action) - end of 'executive' tasks @@ -497,7 +1853,7 @@ switch ($midAction) if(isset($_POST['email_sendnow'])) { - sendImmediately($mailId); +// sendImmediately($mailId); } // --------------------- Display errors and results ------------------------ @@ -548,7 +1904,7 @@ switch ($action) case 'sent' : case 'pending' : case 'held' : - $mailAdmin->showEmailList($action, -1, -1); + // $mailAdmin->showEmailList($action, -1, -1); break; case 'mailshowtemplate' : // Show the templated email @@ -564,7 +1920,7 @@ switch ($action) break; case 'recipients' : - $mailAdmin->showmailRecipients($mailId, $action); + // $mailAdmin->showmailRecipients($mailId, $action); break; case 'makemail' : @@ -573,7 +1929,7 @@ switch ($action) { $mailData = array(); // Empty array just in case } - $mailAdmin->show_mailform($mailData); + // $mailAdmin->show_mailform($mailData); break; } @@ -586,6 +1942,7 @@ require_once(e_ADMIN.'footer.php'); * @param integer $id (mailing id) * @return */ + /* function sendImmediately($id) { $mes = e107::getMessage(); @@ -629,142 +1986,20 @@ function sendImmediately($id) e107::getRender()->tablerender("Sending...", $mes->render()); } - -/** - * Display Progress-bar of real-time mail-out. - * @return - */ -function sendProgress() -{ - $sqld = e107::getDb(); - - $sqld->db_Select("mail_content","mail_togo_count,mail_sent_count,mail_fail_count","mail_source_id= ".intval($_GET['id']) ); - $row = $sqld -> db_Fetch(); - - $rand = $row['mail_sent_count'] + $row['mail_fail_count']; - - $total = $row['mail_togo_count'] + $row['mail_sent_count'] + $row['mail_fail_count']; - - // $rand = rand(1,20); - //$total = 20; - - $inc = round(($rand / $total) * 100); - - if($rand >= $total && $total !=0) - { - echo ""; - echo "
- Complete
"; - echo "
".$rand." / ".$total."
"; - return; - } - - echo "
"; - for($j=1;$j<=$inc;$j++) - { - echo ""; - } - echo " $inc %
"; - echo "
".$rand." / ".$total."
"; - return; -} +*/ -// Update Preferences. (security handled elsewhere) -function saveMailPrefs(&$mes) // $emessage to $mes, working? -{ - //$pref = e107::getPref(); - $e107 = e107::getInstance(); - $tp = e107::getParser(); - - $bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234); - unset($temp); - if (!in_array($_POST['mailer'], array('smtp', 'sendmail', 'php'))) $_POST['mailer'] = 'php'; - $temp['mailer'] = $_POST['mailer']; - // Allow qmail as an option as well - works much as sendmail - if ((strpos($_POST['sendmail'],'sendmail') !== FALSE) || (strpos($_POST['sendmail'],'qmail') !== FALSE)) - { - $temp['sendmail'] = $tp->toDB($_POST['sendmail']); - } - else - { - $temp['sendmail'] = ''; - } - $temp['smtp_server'] = $tp->toDB($_POST['smtp_server']); - $temp['smtp_username'] = $tp->toDB($_POST['smtp_username']); - $temp['smtp_password'] = $tp->toDB($_POST['smtp_password']); - - $smtp_opts = array(); - switch (trim($_POST['smtp_options'])) - { - case 'smtp_ssl' : - $smtp_opts[] = 'secure=SSL'; - break; - case 'smtp_tls' : - $smtp_opts[] = 'secure=TLS'; - break; - case 'smtp_pop3auth' : - $smtp_opts[] = 'pop3auth'; - break; - } - if (varsettrue($_POST['smtp_keepalive'])) $smtp_opts[] = 'keepalive'; - if (varsettrue($_POST['smtp_useVERP'])) $smtp_opts[] = 'useVERP'; - - $temp['smtp_options'] = implode(',',$smtp_opts); - - $temp['mail_sendstyle'] = $tp->toDB($_POST['mail_sendstyle']); - $temp['mail_pause'] = intval($_POST['mail_pause']); - $temp['mail_pausetime'] = intval($_POST['mail_pausetime']); - $temp['mail_workpertick'] = intval($_POST['mail_workpertick']); - $temp['mail_workpertick'] = min($temp['mail_workpertick'],1000); - $temp['mail_bounce'] = isset($bounceOpts[$_POST['mail_bounce']]) ? $_POST['mail_bounce'] : 'none'; - $temp['mail_bounce_auto'] = 0; // Make sure this is always defined - switch ($temp['mail_bounce']) - { - case 'none' : - $temp['mail_bounce_email'] = ''; - break; - case 'auto' : - $temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email2']); - break; - case 'mail' : - $temp['mail_bounce_email'] = $tp->toDB($_POST['mail_bounce_email']); - $temp['mail_bounce_auto'] = intval($_POST['mail_bounce_auto']); - break; - } - $temp['mail_bounce_pop3'] = $tp->toDB($_POST['mail_bounce_pop3']); - $temp['mail_bounce_user'] = $tp->toDB($_POST['mail_bounce_user']); - $temp['mail_bounce_pass'] = $tp->toDB($_POST['mail_bounce_pass']); - $temp['mail_bounce_type'] = $tp->toDB($_POST['mail_bounce_type']); - $temp['mail_bounce_delete'] = intval(varset($_POST['mail_bounce_delete'], 0)); - - $temp['mailout_enabled'] = implode(',',varset($_POST['mail_mailer_enabled'], '')); - $temp['mail_log_options'] = intval($_POST['mail_log_option']).','.intval($_POST['mail_log_email']); - - foreach ($temp as &$t) - { - if ($t === NULL) $t = ''; - } - $pref = e107::pref('core'); // Core Prefs Array. - if (e107::getAdminLog()->logArrayDiffs($temp, $pref, 'MAIL_03')) - { - e107::getConfig()->updatePref($temp); - e107::getConfig()->save(false); // Only save if changes - generates its own message - } - else - { - $mes->addInfo(LAN_NO_CHANGE); - } -} //---------------------------------------------------- // MAILER OPTIONS //---------------------------------------------------- - +/* function show_prefs($mailAdmin) { + return; + $pref = e107::getPref(); $e107 = e107::getInstance(); $frm = e107::getForm(); @@ -790,7 +2025,7 @@ function show_prefs($mailAdmin) ".LAN_MAILOUT_110."
- ".$frm->admin_button('testemail', LAN_MAILOUT_112,'other')."  + ".$frm->admin_button('testemail', LAN_MAILOUT_112,'other')."  @@ -868,7 +2103,7 @@ function show_prefs($mailAdmin) "; - +*/ /* FIXME - posting SENDMAIL path triggers Mod-Security rules. // Sendmail. --------------> $senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : ''; @@ -883,7 +2118,7 @@ function show_prefs($mailAdmin) "; */ - +/* $text .=" @@ -1036,7 +2271,7 @@ function show_prefs($mailAdmin) $caption = ADLAN_136.SEP.LAN_PREFS; $ns->tablerender($caption, $mes->render(). $text); } - +*/ //----------------------------------------------------------- @@ -1044,6 +2279,8 @@ function show_prefs($mailAdmin) //----------------------------------------------------------- function show_maint($debug = FALSE) { + return; + $mes = e107::getMessage(); $ns = e107::getRender(); $frm = e107::getForm(); @@ -1069,7 +2306,7 @@ function show_maint($debug = FALSE) } - +/* function mailout_adminmenu() { $tp = e107::getParser(); @@ -1111,6 +2348,8 @@ function mailout_adminmenu() } show_admin_menu(LAN_MAILOUT_15, $action, $var); } +*/ + function headerjs() diff --git a/e107_admin/meta.php b/e107_admin/meta.php index 3fdf7234d..0b561e142 100644 --- a/e107_admin/meta.php +++ b/e107_admin/meta.php @@ -56,7 +56,7 @@ if (isset($_POST['metasubmit'])) unset($meta_tag[e_LANGUAGE]); }*/ - $admin_log->log_event('META_01', 'meta_news_summary=>'.$pref['meta_news_summary'].'[!br!]'.e_LANGUAGE, E_LOG_INFORMATIVE, ''); + e107::getLog()->add('META_01', 'meta_news_summary=>'.$pref['meta_news_summary'].'[!br!]'.e_LANGUAGE, E_LOG_INFORMATIVE, ''); save_prefs(); } diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 6f67aadac..be9f415c6 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -1287,7 +1287,7 @@ class admin_newspost e107::getEvent()->trigger("newsdel", $del_id); if($sql->delete("news", "news_id={$del_id}")) { - $admin_log->log_event('NEWS_01',$del_id,E_LOG_INFORMATIVE,''); + e107::getLog()->add('NEWS_01',$del_id,E_LOG_INFORMATIVE,''); $this->show_message(NWSLAN_31." #".$del_id." ".NWSLAN_32, E_MESSAGE_SUCCESS); $this->clear_cache(); @@ -1314,7 +1314,7 @@ class admin_newspost e107::getEvent()->trigger("newscatdel", $del_id); if ($sql->delete("news_category", "category_id={$del_id}")) { - $admin_log->log_event('NEWS_02',$del_id,E_LOG_INFORMATIVE,''); + e107::getLog()->add('NEWS_02',$del_id,E_LOG_INFORMATIVE,''); $this->show_message(NWSLAN_33." #".$del_id." ".NWSLAN_32, E_MESSAGE_SUCCESS); $this->clear_cache(); } @@ -1324,7 +1324,7 @@ class admin_newspost case 'sn': if ($sql->delete("submitnews", "submitnews_id={$del_id}")) { - $admin_log->log_event('NEWS_03',$del_id,E_LOG_INFORMATIVE,''); + e107::getLog()->add('NEWS_03',$del_id,E_LOG_INFORMATIVE,''); $this->show_message(NWSLAN_34." #".$del_id." ".NWSLAN_32); $this->clear_cache(); } diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index 3693e3d10..aef2154fc 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -695,7 +695,7 @@ class pluginManager{ } $logInfo = deftrue($plug['plugin_name'],$plug['plugin_name']). " v".$plug['plugin_version']." ({e_PLUGIN}".$plug['plugin_path'].")"; - $admin_log->log_event('PLUGMAN_03', $logInfo, E_LOG_INFORMATIVE, ''); + e107::getLog()->add('PLUGMAN_03', $logInfo, E_LOG_INFORMATIVE, ''); } if($_POST['delete_files']) @@ -930,7 +930,7 @@ class pluginManager{ $name = deftrue($info['plugin_name'],$info['plugin_name']). " v".$eplug_version. "({e_PLUGIN}".$info['plugin_path'].")"; - $admin_log->log_event('PLUGMAN_02', $name, E_LOG_INFORMATIVE, ''); + e107::getLog()->add('PLUGMAN_02', $name, E_LOG_INFORMATIVE, ''); $text .= (isset($eplug_upgrade_done)) ? '
'.$eplug_upgrade_done : "
".LAN_UPGRADE_SUCCESSFUL; $sql->update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$this->id' "); $pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version @@ -959,7 +959,7 @@ class pluginManager{ if(file_exists($_path.'plugin.xml')) { $text .= $plugin->install_plugin_xml($this->id, 'refresh'); - $admin_log->log_event('PLUGMAN_04', $this->id.':'.$plug['plugin_path'], E_LOG_INFORMATIVE, ''); + e107::getLog()->add('PLUGMAN_04', $this->id.':'.$plug['plugin_path'], E_LOG_INFORMATIVE, ''); } } diff --git a/e107_admin/search.php b/e107_admin/search.php index c2ac44205..33ab986eb 100644 --- a/e107_admin/search.php +++ b/e107_admin/search.php @@ -81,7 +81,7 @@ if (vartrue($save_search)) // $sql -> db_Update("core", "e107_value='".$serialpref."' WHERE e107_name='search_prefs'"); e107::getConfig('search')->setPref($search_prefs)->save(false,true,false); - $admin_log->log_event('SEARCH_03','',E_LOG_INFORMATIVE,''); + e107::getLog()->add('SEARCH_03','',E_LOG_INFORMATIVE,''); } @@ -142,7 +142,7 @@ if (isset($_POST['update_handler'])) if($check) { $mes->addSuccess(LAN_UPDATED); - $admin_log->log_event('SEARCH_05', $handler_type.', '.$query[2], E_LOG_INFORMATIVE, ''); + e107::getLog()->add('SEARCH_05', $handler_type.', '.$query[2], E_LOG_INFORMATIVE, ''); } elseif(0 === $check) $mes->addInfo(LAN_NO_CHANGE); else @@ -174,7 +174,7 @@ if (isset($_POST['update_prefs'])) if($check) { $mes->addSuccess(LAN_UPDATED); - $admin_log->log_event('SEARCH_05', $handler_type.', '.$query[2], E_LOG_INFORMATIVE, ''); + e107::getLog()->add('SEARCH_05', $handler_type.', '.$query[2], E_LOG_INFORMATIVE, ''); } else //it's an error { diff --git a/e107_admin/ugflag.php b/e107_admin/ugflag.php index 069697b82..c03497bc4 100644 --- a/e107_admin/ugflag.php +++ b/e107_admin/ugflag.php @@ -48,7 +48,7 @@ if(isset($_POST['updatesettings'])) if($changed) { - $admin_log->log_event(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, ''); + e107::getLog()->add(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, ''); save_prefs(); $mes->addSuccess(UGFLAN_1); } diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 8a164b59d..b8392bc12 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -444,7 +444,7 @@ function update_core_prefs($type='') e107::getConfig('core')->setPref($pref)->save(); $admin_log->logMessage(LAN_UPDATE_14.$e107info['e107_version'], E_MESSAGE_NODISPLAY, E_MESSAGE_INFO); $admin_log->flushMessages('UPDATE_03',E_LOG_INFORMATIVE); - //$admin_log->log_event('UPDATE_03',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode(', ',$accum),E_LOG_INFORMATIVE,''); // Log result of actual update + //e107::getLog()->add('UPDATE_03',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode(', ',$accum),E_LOG_INFORMATIVE,''); // Log result of actual update } return $just_check; } @@ -1638,7 +1638,7 @@ function update_706_to_800($type='') - //$admin_log->log_event('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update + //e107::getLog()->add('UPDATE_01',LAN_UPDATE_14.$e107info['e107_version'].'[!br!]'.implode('[!br!]',$updateMessages),E_LOG_INFORMATIVE,''); // Log result of actual update return $just_check; } @@ -1773,7 +1773,7 @@ function update_70x_to_706($type='') // If we get to here, in checking mode no updates are required. In update mode, all done. if ($just_check) return TRUE; - $admin_log->log_event('UPDATE_02',LAN_UPDATE_14.$e107info['e107_version'],E_LOG_INFORMATIVE,''); // Log result of actual update + e107::getLog()->add('UPDATE_02',LAN_UPDATE_14.$e107info['e107_version'],E_LOG_INFORMATIVE,''); // Log result of actual update return $just_check; // TRUE if no updates needed, FALSE if updates needed and completed } diff --git a/e107_admin/updateadmin.php b/e107_admin/updateadmin.php index 81e994d8e..c79473d54 100644 --- a/e107_admin/updateadmin.php +++ b/e107_admin/updateadmin.php @@ -50,7 +50,7 @@ if (isset($_POST['update_settings'])) $check = $sql -> db_Update('user',$userData); if ($check) { - $admin_log->log_event('ADMINPW_01', '', E_LOG_INFORMATIVE, ''); + e107::getLog()->add('ADMINPW_01', '', E_LOG_INFORMATIVE, ''); $userMethods->makeUserCookie(array('user_id' => USERID,'user_password' => $userData['data']['user_password']), FALSE); // Can't handle autologin ATM $mes->addSuccess(UDALAN_3." ".ADMINNAME); $e_event -> trigger('adpword'); diff --git a/e107_admin/upload.php b/e107_admin/upload.php index f26f31b9b..ec8db5d09 100644 --- a/e107_admin/upload.php +++ b/e107_admin/upload.php @@ -199,7 +199,7 @@ if ($action == "dis" && isset($_POST['updelete']['upload_'.$id]) ) unlink(e_UPLOAD.$row['upload_ss']); } $message = ($sql->db_Delete("upload", "upload_id='".intval($id)."'")) ? UPLLAN_1 : LAN_DELETED_FAILED; - $admin_log->log_event('UPLOAD_01',$row['upload_file'],E_LOG_INFORMATIVE,''); + e107::getLog()->add('UPLOAD_01',$row['upload_file'],E_LOG_INFORMATIVE,''); } if ($action == "dlm") diff --git a/e107_admin/users.php b/e107_admin/users.php index 29459758d..25413f1e0 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -454,7 +454,7 @@ class users_admin_ui extends e_admin_ui { if ($sql->update("user","user_ban='1' WHERE user_id='".$userid."' ")) { - $admin_log->log_event('USET_05', str_replace(array('--UID--','--NAME--'), array($row['user_id'], $row['user_name']), USRLAN_161), E_LOG_INFORMATIVE); + e107::getLog()->add('USET_05', str_replace(array('--UID--','--NAME--'), array($row['user_id'], $row['user_name']), USRLAN_161), E_LOG_INFORMATIVE); $mes->addSuccess("(".$userid.".".$row['user_name']." - {$row['user_email']}) ".USRLAN_8); } if (trim($row['user_ip']) == "") @@ -513,7 +513,7 @@ class users_admin_ui extends e_admin_ui $userMethods->addNonDefaulted($row); $sysuser->setData($row)->save(); - $admin_log->log_event('USET_10', str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_166), E_LOG_INFORMATIVE); + e107::getLog()->add('USET_10', str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_166), E_LOG_INFORMATIVE); $e_event->trigger('userfull', $row); $mes->addSuccess(USRLAN_86." (#".$sysuser->getId()." : ".$sysuser->getName().' - '.$sysuser->getValue('email').")"); @@ -683,7 +683,7 @@ class users_admin_ui extends e_admin_ui $search = array('--UID--', '--NAME--', '--EMAIL--', '--ADMIN_UID--', '--ADMIN_NAME--', '--ADMIN_EMAIL--'); $replace = array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email'), $user->getId(), $user->getName(), $user->getValue('email')); - $admin_log->log_event('USET_08', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE); + e107::getLog()->add('USET_08', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE); $this->redirect('list', 'main', true); } @@ -699,7 +699,7 @@ class users_admin_ui extends e_admin_ui { $sysuser->set('user_admin', 1)->save(); //"user","user_admin='1' WHERE user_id={$userid}" $lan = str_replace(array('--UID--', '--NAME--', '--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_164); - $admin_log->log_event('USET_08', $lan, E_LOG_INFORMATIVE); + e107::getLog()->add('USET_08', $lan, E_LOG_INFORMATIVE); $mes->addSuccess($lan); } @@ -825,7 +825,7 @@ class users_admin_ui extends e_admin_ui $sysuser->email('email', $options); //sendemail($send_to,$subject,$message); } - $admin_log->log_event('USET_14', str_replace(array('--UID--','--CLASSES--'), array($id, $svar), UCSLAN_11), E_LOG_INFORMATIVE); + e107::getLog()->add('USET_14', str_replace(array('--UID--','--CLASSES--'), array($id, $svar), UCSLAN_11), E_LOG_INFORMATIVE); $mes->addSuccess(nl2br($message)); } @@ -969,6 +969,7 @@ class users_admin_ui extends e_admin_ui // custom header now auto-added in email() method //$mailheader_e107id = $id; + $check = $sysuser->email('email', array( 'mail_subject' => LAN_SIGNUP_96." ".SITENAME, @@ -977,7 +978,7 @@ class users_admin_ui extends e_admin_ui if ($check) { - $admin_log->log_event('USET_11', str_replace(array('--ID--','--NAME--','--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_167), E_LOG_INFORMATIVE); + e107::getLog()->add('USET_11', str_replace(array('--ID--','--NAME--','--EMAIL--'), array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email')), USRLAN_167), E_LOG_INFORMATIVE); $mes->addSuccess(USRLAN_140.": ".$sysuser->getName()." (".$sysuser->getValue('email').") ({$lan}) "); } else @@ -1237,7 +1238,7 @@ class users_admin_ui extends e_admin_ui $user_data['user_id'] = $userid; // Add to admin log - $admin_log->log_event('USET_02',"UName: {$user_data['user_name']}; Email: {$user_data['user_email']}", E_LOG_INFORMATIVE); + e107::getLog()->add('USET_02',"UName: {$user_data['user_name']}; Email: {$user_data['user_email']}", E_LOG_INFORMATIVE); // Add to user audit trail $admin_log->user_audit(USER_AUDIT_ADD_ADMIN, $user_data, 0, $user_data['user_loginname']); @@ -1260,7 +1261,7 @@ class users_admin_ui extends e_admin_ui // activate and send password $check = $sysuser->email('quickadd', array( 'user_password' => $savePassword, - 'email_subject' => USRLAN_187.SITENAME, + 'mail_subject' => USRLAN_187.SITENAME, // TODO lan 'activation_url' => 'Your current status is Active', )); @@ -1274,7 +1275,7 @@ class users_admin_ui extends e_admin_ui $check = $sysuser->email('quickadd', array( 'user_password' => $savePassword, - 'email_subject' => USRLAN_187.SITENAME, + 'mail_subject' => USRLAN_187.SITENAME, 'activation_url' => SITEURL."signup.php?activate.".$sysuser->getId().".".$sysuser->getValue('sess'), )); break; @@ -1751,7 +1752,7 @@ class users_admin_ui extends e_admin_ui } if ($count) { - $admin_log->log_event('USET_12',str_replace('--COUNT--',$count,USRLAN_168),E_LOG_INFORMATIVE); + e107::getLog()->add('USET_12',str_replace('--COUNT--',$count,USRLAN_168),E_LOG_INFORMATIVE); } } @@ -1858,13 +1859,16 @@ class users_admin_ui extends e_admin_ui $DEL = ($pref['mail_bounce_delete']) ? true : false; $text = "
\n"; + + $identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id'); + for ($i = 1; $i <= $tot; $i++) { $head = $obj->getHeaders($i); if ($head['bounce']) { // Its a 'bounce' email - if (preg_match('/.*X-e107-id:(.*)MIME/',$obj->getBody($i),$result)) + if (preg_match('/.*'.$identifier.':(.*)MIME/',$obj->getBody($i),$result)) { if ($result[1]) { @@ -1913,7 +1917,7 @@ class users_admin_ui extends e_admin_ui } if ($del_count) { - $admin_log->log_event('USET_13',str_replace('--COUNT--',$del_count,USRLAN_169),E_LOG_INFORMATIVE); + e107::getLog()->add('USET_13',str_replace('--COUNT--',$del_count,USRLAN_169),E_LOG_INFORMATIVE); } if ($tot) { @@ -1965,7 +1969,7 @@ class users_admin_ui extends e_admin_ui // $sql->db_Delete("user","user_id='{$u['user_id']}' "); // $sql->db_Delete("user_extended","user_extended_id='{$u['user_id']}' "); // } - // $admin_log->log_event('USET_04',str_replace(array('--COUNT--','--TYPE--'),array(count($uList),$bantype),USRLAN_160),E_LOG_INFORMATIVE); + // e107::getLog()->add('USET_04',str_replace(array('--COUNT--','--TYPE--'),array(count($uList),$bantype),USRLAN_160),E_LOG_INFORMATIVE); // } // $ns->tablerender(USRLAN_57,"
".$text."
"); // unset ($text); diff --git a/e107_admin/users_extended.php b/e107_admin/users_extended.php index 16f2d1d3f..d7df6adbd 100755 --- a/e107_admin/users_extended.php +++ b/e107_admin/users_extended.php @@ -67,7 +67,7 @@ if ($tmp) { $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_order ='".($_order-1)."'"); $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_id='".$_id."'"); - $admin_log->log_event('EUF_01',$_id.', '.$_order.', '.$_parent,E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_01',$_id.', '.$_order.', '.$_parent,E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -85,7 +85,7 @@ if ($tmp) { $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_order='".($_order+1)."'"); $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_id='".$_id."'"); - $admin_log->log_event('EUF_02',$_id.', '.$_order.', '.$_parent,E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_02',$_id.', '.$_order.', '.$_parent,E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -100,7 +100,7 @@ if (isset($_POST['catup_x']) || isset($_POST['catup'])) { $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type = 0 AND user_extended_struct_order='".($_order-1)."'"); $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type = 0 AND user_extended_struct_id='".$_id."'"); - $admin_log->log_event('EUF_03',$_id.', '.$_order,E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_03',$_id.', '.$_order,E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -115,7 +115,7 @@ if (isset($_POST['catdown_x']) || isset($_POST['catdown'])) { $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type = 0 AND user_extended_struct_order='".($_order+1)."'"); $sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type = 0 AND user_extended_struct_id='".$_id."'"); - $admin_log->log_event('EUF_04',$_id.', '.$_order,E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_04',$_id.', '.$_order,E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -153,7 +153,7 @@ if (isset($_POST['add_field'])) } else { - $admin_log->log_event('EUF_05',$ue_field_name.'[!br!]'.$tp->toDB($_POST['user_text']).'[!br!]'.intval($_POST['user_type']),E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_05',$ue_field_name.'[!br!]'.$tp->toDB($_POST['user_text']).'[!br!]'.intval($_POST['user_type']),E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -177,7 +177,7 @@ if (isset($_POST['update_field'])) $result = $mes->addAuto($ue->user_extended_modify($sub_action, $tp->toDB($_POST['user_field']), $tp->toDB($_POST['user_text']), intval($_POST['user_type']), $upd_parms, $upd_values, $tp->toDB($_POST['user_default']), intval($_POST['user_required']), intval($_POST['user_read']), intval($_POST['user_write']), intval($_POST['user_applicable']), intval($_POST['user_parent'])), 'update', EXTLAN_29, false, false); if($result) { - $admin_log->log_event('EUF_06',$tp->toDB($_POST['user_field']).'[!br!]'.$tp->toDB($_POST['user_text']).'[!br!]'.intval($_POST['user_type']),E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_06',$tp->toDB($_POST['user_field']).'[!br!]'.$tp->toDB($_POST['user_text']).'[!br!]'.intval($_POST['user_type']),E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -199,7 +199,7 @@ if (isset($_POST['update_category'])) ); if($result) { - $admin_log->log_event('EUF_09',$name,E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_09',$name,E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -219,7 +219,7 @@ if (isset($_POST['add_category'])) $result = $mes->addAuto($sql->db_Insert("user_extended_struct","'0', '{$name}', '".$tp->toDB($_POST['user_text'])."', 0, '', '', '', '".intval($_POST['user_read'])."', '".intval($_POST['user_write'])."', '0', '0', '".intval($_POST['user_applicable'])."', '0', '0'"), 'insert', EXTLAN_40, false, false); if($result) { - $admin_log->log_event('EUF_08',$name,E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_08',$name,E_LOG_INFORMATIVE,''); e107::getCache()->clear_sys('user_extended_struct', true); } } @@ -242,7 +242,7 @@ if (varset($_POST['eu_action'],'') == "delcat") } elseif($ue->user_extended_remove($_id, $_name)) { - $admin_log->log_event('EUF_10',$_id.', '.$_name,E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_10',$_id.', '.$_name,E_LOG_INFORMATIVE,''); $message = EXTLAN_41; e107::getCache()->clear_sys('user_extended_struct', true); } @@ -1182,7 +1182,7 @@ class users_ext $ret .= EXTLAN_70." $f ".EXTLAN_71."
"; } } - $admin_log->log_event('EUF_11',implode(', ',$_POST['activate']),E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_11',implode(', ',$_POST['activate']),E_LOG_INFORMATIVE,''); return $ret; } @@ -1205,7 +1205,7 @@ class users_ext $ret .= EXTLAN_70." $f ".EXTLAN_73."
"; } } - $admin_log->log_event('EUF_12',implode(', ',$_POST['deactivate']),E_LOG_INFORMATIVE,''); + e107::getLog()->add('EUF_12',implode(', ',$_POST['deactivate']),E_LOG_INFORMATIVE,''); return $ret; } diff --git a/e107_admin/wmessage.php b/e107_admin/wmessage.php index f5a76bb06..613fb699a 100644 --- a/e107_admin/wmessage.php +++ b/e107_admin/wmessage.php @@ -308,6 +308,6 @@ function welcome_adminlog($msg_num='00', $id=0, $woffle='') if ($msg) $msg .= '[!br!]'; $msg .= $woffle; } - $admin_log->log_event('WELCOME_'.$msg_num,$msg,E_LOG_INFORMATIVE,''); + e107::getLog()->add('WELCOME_'.$msg_num,$msg,E_LOG_INFORMATIVE,''); } ?> \ No newline at end of file diff --git a/e107_core/bbcodes/bb_youtube.php b/e107_core/bbcodes/bb_youtube.php index 64909e8ff..0395b5987 100644 --- a/e107_core/bbcodes/bb_youtube.php +++ b/e107_core/bbcodes/bb_youtube.php @@ -333,17 +333,27 @@ class bb_youtube extends e_bb_base $class = "bbcode ".e107::getBB()->getClass('youtube'); // consistent classes across all themes. $ret = "\n"; // <-- DO NOT MODIFY - used for detection by bbcode handler. - $ret .= ' - - - - - '; - - // Not XHTML - but needed for compatibility. - $ret .= ''; - $ret .= ''; + + if(e107::getConfig()->get('youtube_bbcode_responsive') == 1) // Responsive Mode. + { + $ret .= e107::getParser()->toVideo($yID.".youtube"); + } + else // Legacy Mode. + { + $ret .= ' + + + + + '; + + // Not XHTML - but needed for compatibility. + $ret .= ''; + + $ret .= ''; + } + $ret .= ""; // <-- DO NOT MODIFY. diff --git a/e107_core/shortcodes/batch/user_shortcodes.php b/e107_core/shortcodes/batch/user_shortcodes.php index 8a18c748a..1d7ce1f77 100644 --- a/e107_core/shortcodes/batch/user_shortcodes.php +++ b/e107_core/shortcodes/batch/user_shortcodes.php @@ -60,7 +60,7 @@ class user_shortcodes extends e_shortcode function sc_user_commentposts($parm) { - return $this->var['user_comments']; + return "".$this->var['user_comments'].""; } @@ -110,7 +110,7 @@ class user_shortcodes extends e_shortcode $commentposts = intval($sql->count("comments")); e107::setRegistry('total_commentposts', $commentposts); } - return ($commentposts > 0) ? round(($this->var['user_comments']/$commentposts) * 100, 2) : 0; + return ($commentposts > 0) ? "".round(($this->var['user_comments']/$commentposts) * 100, 2)."" : 0; } @@ -505,11 +505,11 @@ class user_shortcodes extends e_shortcode if (USERID == $this->var['user_id']) { //return "".LAN_USER_38.""; - return "".LAN_USER_38.""; // TODO: repair dirty fix for usersettings + return "".LAN_USER_38.""; // TODO: repair dirty fix for usersettings } else if(ADMIN && getperms("4") && !$this->var['user_admin']) { - return " $this->var['user_id'], 'name' => $this->var['user_name']))."'>".LAN_USER_39.""; + return " $this->var['user_id'], 'name' => $this->var['user_name']))."'>".LAN_USER_39.""; } } @@ -519,6 +519,8 @@ class user_shortcodes extends e_shortcode { global $full_perms; $sql = e107::getDb(); + $tp = e107::getParser(); + if (!$full_perms) return; $url = e107::getUrl(); if(!$userjump = e107::getRegistry('userjump')) @@ -539,13 +541,23 @@ class user_shortcodes extends e_shortcode } e107::setRegistry('userjump', $userjump); } + + + if($parm == 'prev') { - return isset($userjump['prev']['id']) ? "<< ".LAN_USER_40." [ ".$userjump['prev']['name']." ]" : " "; + + $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-left') : '<<'; + return isset($userjump['prev']['id']) ? "".$icon." ".LAN_USER_40."\n" : " "; + + // return isset($userjump['prev']['id']) ? "<< ".LAN_USER_40." [ ".$userjump['prev']['name']." ]" : " "; + } else { - return isset($userjump['next']['id']) ? "[ ".$userjump['next']['name']." ] ".LAN_USER_41." >>" : " "; + $icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-right') : '>>'; + return isset($userjump['next']['id']) ? "".LAN_USER_41." ".$icon."\n" : " "; + // return isset($userjump['next']['id']) ? "[ ".$userjump['next']['name']." ] ".LAN_USER_41." >>" : " "; } } @@ -599,7 +611,13 @@ class user_shortcodes extends e_shortcode $sql = e107::getDb(); $tp = e107::getParser(); - global $EXTENDED_CATEGORY_START, $EXTENDED_CATEGORY_END, $EXTENDED_CATEGORY_TABLE; + $template = e107::getCoreTemplate('user','extended'); + + + $EXTENDED_CATEGORY_START = $template['start']; + $EXTENDED_CATEGORY_END = $template['end']; + $EXTENDED_CATEGORY_TABLE = $template['item'];; + $qry = "SELECT f.*, c.user_extended_struct_name AS category_name, c.user_extended_struct_id AS category_id FROM #user_extended_struct as f LEFT JOIN #user_extended_struct as c ON f.user_extended_struct_parent = c.user_extended_struct_id ORDER BY c.user_extended_struct_order ASC, f.user_extended_struct_order ASC @@ -607,23 +625,37 @@ class user_shortcodes extends e_shortcode + require_once(e_HANDLER."user_extended_class.php"); $ue = new e107_user_extended; $ueCatList = $ue->user_extended_get_categories(); $ueFieldList = $ue->user_extended_get_fields(); + + + $ueCatList[0][0] = array('user_extended_struct_name' => LAN_USER_44, 'user_extended_struct_text' => ''); + + // print_a($ueFieldList); + $ret = ""; foreach($ueCatList as $catnum => $cat) { + + + $key = $cat[0]['user_extended_struct_text'] ? $cat[0]['user_extended_struct_text'] : $cat[0]['user_extended_struct_name']; - $cat_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE); + $cat_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE); //XXX FIXME Fails + + $cat_name = true; //XXX TEMP Fix. + if($cat_name != FALSE && count($ueFieldList[$catnum])) { - + $ret .= str_replace("{EXTENDED_NAME}", $key, $EXTENDED_CATEGORY_START); foreach($ueFieldList[$catnum] as $f) { + $key = $f['user_extended_struct_name']; if($ue_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE)) { @@ -739,11 +771,49 @@ class user_shortcodes extends e_shortcode } - - function sc_user_embed_userprofile($parm) + function sc_user_addons($parm='') { - global $pref, $USER_EMBED_USERPROFILE_TEMPLATE, $embed_already_rendered; + $template = e107::getCoreTemplate('user','addon'); + $tp = e107::getParser(); + $data = e107::getAddonConfig('e_user',null,'profile',$this->var); + if(empty($data)) + { + return; + } + + $text = ''; + + foreach($data as $plugin=>$val) + { + foreach($val as $v) + { + $value = vartrue($v['url']) ? "".$v['text']."" : $v['text']; + + $array = array( + 'USER_ADDON_LABEL' => $v['label'], + 'USER_ADDON_TEXT' => $value + ); + + $text .= $tp->parseTemplate($template, true, $array); + } + + } + + return $text; + + } + + + + + /** + * @Deprecated Use {USER_ADDONS} instead. + */ + function sc_user_embed_userprofile($parm='') + { + + return $this->sc_user_addons($parm); //if no parm, it means we render ALL embedded contents //so we're preloading all registerd e_userprofile files $key = varset($pref['e_userprofile_list']); diff --git a/e107_core/shortcodes/batch/usersettings_shortcodes.php b/e107_core/shortcodes/batch/usersettings_shortcodes.php index d1864e105..9a0b5ef5f 100755 --- a/e107_core/shortcodes/batch/usersettings_shortcodes.php +++ b/e107_core/shortcodes/batch/usersettings_shortcodes.php @@ -17,6 +17,7 @@ if (!defined('e107_INIT')) { exit; } class usersettings_shortcodes extends e_shortcode { + private $extendedTabs = false; function sc_username($parm) // This is the 'display name' { @@ -262,10 +263,12 @@ class usersettings_shortcodes extends e_shortcode - function sc_userextended_all($parm) - { + function sc_userextended_all($parm='') + { $sql = e107::getDb(); $tp = e107::getParser(); + $frm = e107::getForm(); + $qry = " SELECT * FROM #user_extended_struct @@ -276,28 +279,60 @@ class usersettings_shortcodes extends e_shortcode $ret=""; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { $catList = $sql->db_getList(); } + else + { + e107::getMessage()->addDebug("No extended fields found"); + } $catList[] = array("user_extended_struct_id" => 0, "user_extended_struct_name" => LAN_USET_7); + $tabs = array(); + + if($parm == 'tabs' && deftrue('BOOTSTRAP')) + { + $this->extendedTabs = true; + } + + foreach($catList as $cat) { cachevars("extendedcat_{$cat['user_extended_struct_id']}", $cat); - $ret .= $this->sc_userextended_cat($cat['user_extended_struct_id']); - // $ret .= $tp->parseTemplate("{USEREXTENDED_CAT={$cat['user_extended_struct_id']}}", TRUE, $usersettings_shortcodes); + $text = $this->sc_userextended_cat($cat['user_extended_struct_id']); + $ret .= $text; + $catName = vartrue($cat['user_extended_struct_text'], $cat['user_extended_struct_name']); + $tabs[] = array('caption'=>$catName, 'text'=>$text); } + + + if($parm == 'tabs' && deftrue('BOOTSTRAP')===3) + { + return e107::getForm()->tabs($tabs); + } + + return $ret; } - function sc_userextended_cat($parm) + function sc_userextended_cat($parm='') { - global $sql, $tp, $usersettings_shortcodes, $USER_EXTENDED_CAT, $extended_showed; + global $usersettings_shortcodes, $USER_EXTENDED_CAT, $extended_showed; + + if(deftrue('BOOTSTRAP')===3) + { + $USER_EXTENDED_CAT = e107::getCoreTemplate('usersettings','extended-category'); + } + + + $sql = e107::getDb(); + $tp = e107::getParser(); + if(isset($extended_showed['cat'][$parm])) { return ""; @@ -312,9 +347,9 @@ class usersettings_shortcodes extends e_shortcode AND user_extended_struct_write IN (".USERCLASS_LIST.") AND user_extended_struct_id = ".intval($parm)." "; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $catInfo = $sql->db_Fetch(); + $catInfo = $sql->fetch(); } } @@ -328,19 +363,20 @@ class usersettings_shortcodes extends e_shortcode AND user_extended_struct_type != 0 ORDER BY user_extended_struct_order ASC "; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { $fieldList = $sql->db_getList(); foreach($fieldList as $field) { cachevars("extendedfield_{$cat['user_extended_struct_name']}", $field); //TODO use $this instead of parseTemplate(); - $ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", TRUE, $usersettings_shortcodes); + $ret .= $this->sc_userextended_field($field['user_extended_struct_name']); + // $ret .= $tp->parseTemplate("{USEREXTENDED_FIELD={$field['user_extended_struct_name']}}", TRUE, $usersettings_shortcodes); } } } - if($ret) + if($ret && $this->extendedTabs == false) { $catName = $catInfo['user_extended_struct_text'] ? $catInfo['user_extended_struct_text'] : $catInfo['user_extended_struct_name']; if(defined($catName)) $catName = constant($catName); @@ -353,13 +389,25 @@ class usersettings_shortcodes extends e_shortcode - function sc_userextended_field($parm) - { - global $sql, $tp, $usersettings_shortcodes, $extended_showed, $ue, $USEREXTENDED_FIELD, $REQUIRED_FIELD; + function sc_userextended_field($parm='') + { + global $usersettings_shortcodes, $extended_showed, $ue, $USEREXTENDED_FIELD, $REQUIRED_FIELD; + + if(deftrue('BOOTSTRAP')===3) + { + $USEREXTENDED_FIELD = e107::getCoreTemplate('usersettings','extended-field'); + } + + if(isset($extended_showed['field'][$parm])) { return ""; } + + $sql = e107::getDb(); + $tp = e107::getParser(); + + $ret = ""; $fInfo = getcachedvars("extendeddata_{$parm}"); @@ -371,9 +419,9 @@ class usersettings_shortcodes extends e_shortcode AND user_extended_struct_write IN (".USERCLASS_LIST.") AND user_extended_struct_name = '".$tp -> toDB($parm, true)."' "; - if($sql->db_Select_gen($qry)) + if($sql->gen($qry)) { - $fInfo = $sql->db_Fetch(); + $fInfo = $sql->fetch(); } } @@ -383,7 +431,7 @@ class usersettings_shortcodes extends e_shortcode if(defined($fname)) $fname = constant($fname); $fname = $tp->toHTML($fname, "", "emotes_off, defs"); - if($fInfo['user_extended_struct_required'] == 1) + if($fInfo['user_extended_struct_required'] == 1 && !deftrue('BOOTSTRAP')) { $fname = str_replace("{FIELDNAME}", $fname, $REQUIRED_FIELD); } diff --git a/e107_core/sql/core_sql.php b/e107_core/sql/core_sql.php index b48f4aec3..2ed42e058 100644 --- a/e107_core/sql/core_sql.php +++ b/e107_core/sql/core_sql.php @@ -255,6 +255,7 @@ CREATE TABLE mail_recipients ( CREATE TABLE mail_content ( mail_source_id int(10) unsigned NOT NULL auto_increment, mail_content_status tinyint(1) unsigned NOT NULL default '0', + mail_total_count int(10) unsigned NOT NULL default '0', mail_togo_count int(10) unsigned NOT NULL default '0', mail_sent_count int(10) unsigned NOT NULL default '0', mail_fail_count int(10) unsigned NOT NULL default '0', @@ -272,6 +273,7 @@ CREATE TABLE mail_content ( mail_body text, mail_body_templated text, mail_other text, + mail_media text, PRIMARY KEY (mail_source_id), KEY mail_content_status (mail_content_status) ) ENGINE=MyISAM; diff --git a/e107_core/templates/contact_template.php b/e107_core/templates/contact_template.php index b58460e02..ba0a30cc0 100644 --- a/e107_core/templates/contact_template.php +++ b/e107_core/templates/contact_template.php @@ -65,10 +65,10 @@ $CONTACT_TEMPLATE['menu'] = ' $CONTACT_WRAPPER['form']['CONTACT_EMAIL_COPY'] = ""; $CONTACT_WRAPPER['form']['CONTACT_PERSON'] = ""; - + //FIXME Upgrade to bootstrap3 non-table format for phone/tablet compatibility. $CONTACT_TEMPLATE['form'] = " -
#e107-idemailSubjectBounce
{---}".LANCONTACT_07."
".LANCONTACT_14."
{---}
+
{CONTACT_PERSON} - - + "; @@ -96,6 +98,9 @@ $sc_style['USER_RATING']['post'] = ""; $sc_style['USER_LOGINNAME']['pre'] = " : "; + + + //FIXME TODO - Remove IF statements from template. if(isset($pref['photo_upload']) && $pref['photo_upload']) { @@ -173,44 +178,65 @@ $USER_FULL_TEMPLATE = "{SETIMAGE: w=250} - - + + +{USER_ADDONS} + + -{USER_COMMENTS_LINK} - - - - -{USER_FORUM_LINK} - - - - -{USER_EMBED_USERPROFILE} + {USER_UPDATE_LINK} - - - -
".LANCONTACT_03."
{CONTACT_NAME} diff --git a/e107_core/templates/email_template.php b/e107_core/templates/email_template.php index aecc3d9a9..67a563fa4 100644 --- a/e107_core/templates/email_template.php +++ b/e107_core/templates/email_template.php @@ -10,44 +10,10 @@ * */ - /** * This file defines the default templates for each type of email which may be sent. * In general it is assumed that HTML emails are being sent (with a plain text alternate part), although simple plain text emails are also possible. * - * Default values are defined for the key elements of an email: - * - * $EMAIL_HEADER - the first part of the email, usually defining the headers, and everything up to and including - * $EMAIL_FOOTER - the last part of the email - it may include a displayed footer, as well as and other 'closing' tags - * - * Taken as a pair, $EMAIL_HEADER.$EMAIL_FOOTER must generate standards-compliant XHTML - * - * $EMAIL_BODY - the body text of the email - essentially, the message. It gets sandwiched between $EMAIL_HEADER and $EMAIL_FOOTER - * This must generate standards-compliant XHTML in its own right, when taken with an appropriate header and footer section. - * Within the template definition, insert the shortcode '{BODY}' to indicate where the passed text of the email is to be stored. - * - * $EMAIL_OVERRIDES may optionally be defined, in which case it can override default mailout settings (see later). Only define this variable - * if you explicitly want overrides - a defined, but empty, variable may have unexpected consequences! - * - * $EMAIL_PLAINTEXT - an alternative template for the alternative text part of HTML emails. Set to empty string if hard-coded default to be used - * - * - * Templates may be defined for specific purposes - * Each template is given a name, which is the name of the variable. - * This variable may be a simple string, in which case it defines the email body, and is only available via code. - * Alternatively the variable may be an array, in which case each element of the array defines a different aspect of the email: - * - * $NAME['template_name'] is a user-friendly name shown in the mass mailer - * $NAME['template_type'] takes values (user|system|all) to define its purpose - only 'user' and 'all' templates are shown in the mass mailer - * $NAME['email_header'] defines the header - optional - * $NAME['email_footer'] defines the footer - optional - * $NAME['email_body'] defines the body text - * $NAME['email_overrides'] defines any mailout settings which are to be overridden (see later) - optional - * - * The format and functionality of these four main array elements correspond exactly to those of the defaults already described. - * - * The template need only define those variables which are to be overridden, in which case the default definitions will be used for the others. - * * * For templated HTML emails, a style sheet MUST be specified in the header field (if its required), in one of the following forms: * @@ -71,11 +37,9 @@ See e_HANDLER.mail.php for more information if (!defined('e107_INIT')) { exit; } - -// @TODO: Move signup email into templated form $includeSiteButton = e107::getPref('sitebutton'); - +/* $SIGNUPEMAIL_SUBJECT = LAN_SIGNUP_96.' {SITENAME}'; $SIGNUPEMAIL_USETHEME = 1; // Use CSS STYLE from THEME: 0 = Off, 1 = external, 2 = embedded $SIGNUPEMAIL_LINKSTYLE = ''; // css to use on links eg. color:red; @@ -84,7 +48,7 @@ $SIGNUPEMAIL_CC = ""; // comma separated email addresses to put in CC of th $SIGNUPEMAIL_BCC = ""; // comma separated email addresses to put in BCC of the signup email. $SIGNUPEMAIL_ATTACHMENTS = ""; // files-path array of attachments. eg. array(e_FILE."myfile.zip",e_FILE."myotherfile.zip"); $SIGNUPEMAIL_BACKGROUNDIMAGE = ""; // absolute path to a background image eg. e_IMAGE."mybackground.jpg"; - +*/ /*=========================================================================== @@ -121,6 +85,7 @@ $EMAIL_OVERRIDES = array( */ // Not used in signup email +/* $EMAIL_HEADER = " @@ -144,58 +109,15 @@ $EMAIL_FOOTER = " $EMAIL_PLAINTEXT = ''; - -/*=========================================================================== - TEMPLATES FOR SPECIFIC EMAIL TYPES -=============================================================================*/ - -/** -Each template is an array whose name must match that used in the code. -The array has two mandatory elements (name and type). -The array may have up to five optional elements, each of which overrides the corresponding default value if present -An empty element sets the field to empty. -An element that is not present results in the default being used. - -Elements are as follows: - 'template_name' - string - mandatory - a 'user-friendly' name for display - 'template_type' - string(user|system|all) - mandatory - 'all' and 'user' templates are available for selection in the bulk mailer - 'email_overrides' - an array - 'email_header' - string - 'email_body' - string - 'email_footer' - string - 'email_plainText' - string - -// If everything is standard apart from the body, the body can be defined as a simple variable - */ -//TODO - integrate into mailout routine -/* -$MAILOUT_HEADER = " - - - -{STYLESHEET} - - -
-"; -$MAILOUT_FOOTER = " -

-{SITENAME=link} -
- -"; - - - -*/ //------------------------------------------------------------- // 'SIGNUP' TEMPLATE //------------------------------------------------------------- //@Deprecated +/* $SIGNUPEMAIL_TEMPLATE = "
@@ -224,82 +146,18 @@ LAN_SIGNUP_97." {SITENAME}
"; - -//------------------------------------------------------------- -// 'NOTIFY' TEMPLATE -//------------------------------------------------------------- +*/ - -//------------------------------------------------------------- -// USER-DEFINED TEMPLATES (for mass mailouts) -//------------------------------------------------------------- -/* -$TEST_TEMPLATE = array( - 'template_name' => 'TEst1', - 'template_type' => 'system', - 'email_overrides' => '', -// 'email_header' - any header information (usually loaded from the default) - 'email_body' => '{BODY}', - 'email_footer' => 'footer', - 'email_plainText' => '' - ); -$TEST2_TEMPLATE = array( - 'template_name' => 'TEst2', - 'template_type' => 'all', - 'email_overrides' => '', -// 'email_header' - any header information (usually loaded from the default) - 'email_body' => '{BODY}', - 'email_footer' => 'footer' - ); -$TEST3_TEMPLATE = array( - 'template_name' => 'TEst4', - 'template_type' => 'user', - 'email_overrides' => '', -// 'email_header' - any header information (usually loaded from the default) - 'email_body' => '{BODY}', - 'email_footer' => 'footer' - ); -$TEST4_TEMPLATE = array( - 'template_name' => 'TEst5', - 'email_overrides' => '', -// 'email_header' - any header information (usually loaded from the default) - 'email_body' => '{BODY}', - 'email_footer' => 'footer' - ); - */ -$WHATSNEW_TEMPLATE = array( - 'template_name' => 'WhatsNew', - 'template_type' => 'user', - 'email_overrides' => '', -// 'email_header' - any header information (usually loaded from the default) - 'email_body' => 'All the latest news and updates.
{BODY}
To find out more, simply click on the links!', -// 'email_footer' => 'footer' - ); -$MONTHLYUPDATE_TEMPLATE = array( - 'template_name' => 'MonthlyUpdate', - 'template_type' => 'user', - 'email_overrides' => '', -// 'email_header' - any header information (usually loaded from the default) - 'email_body' => 'Just to keep you up to date, here\'s a reminder of what\'s changed in the past month.
- {BODY}
To find out more, simply click on the links!', -// 'email_footer' => 'footer' - ); - - - - - - - - -// ----------------------- Everything above this line is deprecated but may continue to work for a while ------------------------------- // +// ----------------------- Everything above this line is deprecated ------------------------------- // /** Standardized v2 template rewrite + * * Format for individual emails sent by e107 (not bulk emails for now) - a work in progress - bulk could be ported later. * @see e107Email::sendEmail(); * Aim: to make email templates follow the same spec. as other templates while remaining as intuitive as other v2 templates in e107. + * Note: giving a template a 'name' value will make it available in the admin->mailout area. */ @@ -311,9 +169,11 @@ $EMAIL_TEMPLATE['default']['header'] = " - @@ -396,22 +256,37 @@ $EMAIL_TEMPLATE['quickadduser']['footer'] = $EMAIL_TEMPLATE['default']['footer' -// --------------------------------- +// ------- Notify (@see admin-> notify) - -// Notify (@see admin-> notify) $EMAIL_TEMPLATE['notify']['subject'] = '{SITENAME}: {SUBJECT} '; $EMAIL_TEMPLATE['notify']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. $EMAIL_TEMPLATE['notify']['body'] = $EMAIL_TEMPLATE['default']['body']; // will use default header above. $EMAIL_TEMPLATE['notify']['footer'] = $EMAIL_TEMPLATE['default']['footer']; // will use default header above. -// --------------------------------- +// ------ User-Specific Templates + + +$EMAIL_TEMPLATE['monthly']['name'] = 'Monthly Update'; +$EMAIL_TEMPLATE['monthly']['subject'] = '{SITENAME}: {SUBJECT} '; +$EMAIL_TEMPLATE['monthly']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. +$EMAIL_TEMPLATE['monthly']['body'] = "Just to keep you up to date, here's a reminder of what's changed in the past month.
{BODY}{MEDIA1}{MEDIA2}{MEDIA3}{MEDIA4}{MEDIA5}To find out more, simply click on the links!"; +$EMAIL_TEMPLATE['monthly']['footer'] = $EMAIL_TEMPLATE['default']['footer']; -// A Dummy Example for theme developers. + +$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']['footer'] = $EMAIL_TEMPLATE['default']['footer']; + + + +// ------ A Dummy Example for theme developers. + $EMAIL_TEMPLATE['example']['subject'] = '{SITENAME}: {SUBJECT} '; $EMAIL_TEMPLATE['example']['header'] = $EMAIL_TEMPLATE['default']['header']; // will use default header above. $EMAIL_TEMPLATE['example']['body'] = $EMAIL_TEMPLATE['default']['body']; // will use default header above. @@ -422,4 +297,7 @@ $EMAIL_TEMPLATE['example']['footer'] = "

"; + + + ?> \ No newline at end of file diff --git a/e107_core/templates/user_template.php b/e107_core/templates/user_template.php index cd57f6066..a5b94a82e 100644 --- a/e107_core/templates/user_template.php +++ b/e107_core/templates/user_template.php @@ -15,7 +15,11 @@ */ if (!defined('e107_INIT')) { exit; } -if (!defined("USER_WIDTH")){ define("USER_WIDTH", "width:95%"); } +if (!defined("USER_WIDTH")) +{ + $legacyWidth = deftrue('BOOTSTRAP') ? "" : "width:95%"; + define("USER_WIDTH", $legacyWidth); +} global $user_shortcodes, $pref, $user; //Set this to TRUE if you would like any extended user field that is empty to NOT be shown on the profile page @@ -25,11 +29,9 @@ $EXTENDED_CATEGORY_START = "
{EXTE $EXTENDED_CATEGORY_TABLE = "
- {EXTENDED_ICON}  - {EXTENDED_NAME} + {EXTENDED_ICON}{EXTENDED_NAME} {EXTENDED_VALUE}{EXTENDED_VALUE}
".LAN_USER_67."{USER_CHATPOSTS} ( {USER_CHATPER}% )".LAN_USER_66."{USER_VISITS}
".LAN_USER_68." {USER_COMMENTPOSTS} ( {USER_COMMENTPER}% )
".LAN_USER_69."{USER_FORUMPOSTS} ( {USER_FORUMPER}% )
".LAN_USER_66."{USER_VISITS}
- - - - - -
{USER_JUMP_LINK=prev}{USER_JUMP_LINK=next}
-
+ + + {PROFILE_COMMENTS} {PROFILE_COMMENT_FORM} "; $USER_EMBED_USERPROFILE_TEMPLATE = " -{USER_EMBED_USERPROFILE_CAPTION} -{USER_EMBED_USERPROFILE_TEXT}"; + + {USER_ADDON_LABEL} + {USER_ADDON_TEXT} +"; + + + +// Convert Templates from v1.x to v2.x Standards. + +$USER_TEMPLATE['view'] = $USER_FULL_TEMPLATE; +$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_START; +$USER_TEMPLATE['extended']['item'] = $EXTENDED_CATEGORY_TABLE ; +$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_END; +$USER_TEMPLATE['addon'] = $USER_EMBED_USERPROFILE_TEMPLATE; + +$USER_TEMPLATE['list']['start'] = $USER_SHORT_TEMPLATE_START; +$USER_TEMPLATE['list']['item'] = $USER_SHORT_TEMPLATE; +$USER_TEMPLATE['list']['end'] = $USER_SHORT_TEMPLATE_END; + +// Convert Shortcode Wrappers from v1.x to v2.x standards. + +$USER_WRAPPER['view']['USER_COMMENTS_LINK'] = $sc_style['USER_COMMENTS_LINK']['pre']."{---}".$sc_style['USER_COMMENTS_LINK']['post']; +$USER_WRAPPER['view']['USER_SIGNATURE'] = $sc_style['USER_SIGNATURE']['pre']."{---}".$sc_style['USER_SIGNATURE']['post']; +$USER_WRAPPER['view']['USER_UPDATE_LINK'] = $sc_style['USER_UPDATE_LINK']['pre']."{---}".$sc_style['USER_UPDATE_LINK']['post']; +$USER_WRAPPER['view']['USER_FORUM_LINK'] = $sc_style['USER_FORUM_LINK']['pre']."{---}".$sc_style['USER_FORUM_LINK']['post']; +$USER_WRAPPER['view']['USER_RATING'] = $sc_style['USER_RATING']['pre']."{---}".$sc_style['USER_RATING']['post']; +$USER_WRAPPER['view']['USER_SENDPM'] = $sc_style['USER_SENDPM']['pre']."{---}".$sc_style['USER_SENDPM']['post']; +$USER_WRAPPER['view']['USER_LOGINNAME'] = $sc_style['USER_LOGINNAME']['pre']."{---}"; ?> diff --git a/e107_core/templates/usersettings_template.php b/e107_core/templates/usersettings_template.php index 14fe71a8f..33ca024f1 100755 --- a/e107_core/templates/usersettings_template.php +++ b/e107_core/templates/usersettings_template.php @@ -181,7 +181,7 @@ $USERSETTINGS_EDIT = " -// e107 v2. bootstrap3 compatible. +// e107 v2. bootstrap3 compatible template. $USERSETTINGS_WRAPPER['edit']['USERNAME'] = "
@@ -246,7 +246,7 @@ $USERSETTINGS_WRAPPER['edit']['SIGNATURE'] = "
- +// Bootstrap 3 only. $USERSETTINGS_TEMPLATE['edit'] = " @@ -295,7 +295,7 @@ $USERSETTINGS_TEMPLATE['edit'] = " {PHOTO_UPLOAD} {USERCLASSES} - {USEREXTENDED_ALL} + {USEREXTENDED_ALL=tabs} {SIGNATURE=cols=58&rows=4} @@ -308,11 +308,16 @@ $USERSETTINGS_TEMPLATE['edit'] = "
- - "; - +$USERSETTINGS_TEMPLATE['extended-category'] = "

{CATNAME}

"; +$USERSETTINGS_TEMPLATE['extended-field'] = "
+ +
+ {FIELDVAL} {HIDEFIELD} +
+
+ "; diff --git a/e107_core/xml/user_extended.xml b/e107_core/xml/user_extended.xml index 9b77ff694..296b242a3 100644 --- a/e107_core/xml/user_extended.xml +++ b/e107_core/xml/user_extended.xml @@ -17,42 +17,42 @@ text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' 253 253 253 @@ -66,7 +66,7 @@ text - class='tbox' size='40' maxlength='254' + class='form-control tbox' size='40' maxlength='254' #^[a-z0-9]+://#si 253 253 diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php index 027547b3d..ee61b62be 100644 --- a/e107_handlers/admin_log_class.php +++ b/e107_handlers/admin_log_class.php @@ -136,7 +136,7 @@ class e_admin_log /** - * Add a Save an event into the admin log. + * Add a Save an event into the admin, rolloing or user log. * * Alternative admin log entry point - compatible with legacy calls, and a bit simpler to use than the generic entry point. * ($eventcode has been added - give it a reference to identify the source module, such as 'NEWS_12' or 'ECAL_03') @@ -150,11 +150,12 @@ class e_admin_log * * @param string $event_title * @param mixed $event_details - * @param integer $event_type [optional] Log level - * @param unknown $event_code [optional] + * @param integer $event_type [optional] Log level eg. E_LOG_INFORMATIVE, E_LOG_NOTICE, E_LOG_WARNING, E_LOG_FATAL + * @param string $event_code [optional] - eg. 'BOUNCE' + * @param integer $target [optional] LOG_TO_ADMIN, LOG_TO_AUDIT, LOG_TO_ROLLING * @return e_admin_log */ - public function add($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE , $event_code = '') + public function add($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE , $event_code = '', $target = LOG_TO_ADMIN ) { if ($event_code == '') { @@ -200,7 +201,7 @@ class e_admin_log } - $this->e_log_event($event_type, -1, $event_code, $event_title, $event_detail, FALSE, LOG_TO_ADMIN); + $this->e_log_event($event_type, -1, $event_code, $event_title, $event_detail, FALSE, $target); return $this; } @@ -383,12 +384,13 @@ class e_admin_log */ function user_audit($event_type, $event_data, $id = '', $u_name = '') { - global $e107,$tp,$pref; + global $e107,$tp; list($time_usec, $time_sec) = explode(" ", microtime()); // Log event time immediately to minimise uncertainty $time_usec = $time_usec * 1000000; // See whether we should log this - $user_logging_opts = array_flip(explode(',', varset($pref['user_audit_opts'], ''))); + $user_logging_opts = e107::getConfig()->get('user_audit_opts'); + if (!isset($user_logging_opts[$event_type])) return; // Finished if not set to log this event type diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 2ff2c34d4..578d4b853 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -5559,8 +5559,9 @@ class e_admin_form_ui extends e_form // TODO - core ui-batch-option class!!! REMOVE INLINE STYLE! // XXX Quick Fix for styling - correct. $text = " - "; - - e107::getRender()->tablerender(ADLAN_136.SEP.LAN_MAILOUT_179, $mes->render(). $text); - } // End of previewed email - - + return $text; + // e107::getRender()->tablerender(ADLAN_136.SEP.LAN_MAILOUT_179, $mes->render(). + // $text); + }// End of previewed email /** * @@ -1413,7 +1618,7 @@ class mailoutAdminClass extends e107MailManager // Separate table for advanced mailout options // mail_notify_complete field $text = " - ".LAN_MAILOUT_242." + " . LAN_MAILOUT_242 . "
@@ -1422,18 +1627,21 @@ class mailoutAdminClass extends e107MailManager "; - $text .= ""; - $text .= ""; - // Can comment the two lines above, uncomment two lines below, and default time/date is shown. May or may not be preferable -// $text .= ""; -// $text .= ""; - $text .= ""; + $text .= ""; + $text .= ""; + // Can comment the two lines above, uncomment two lines below, and default + // time/date is shown. May or may not be preferable + // $text .= + // ""; + // $text .= + // ""; + $text .= ""; $text .= "
".LAN_MAILOUT_238."".$this->makeCalendar('mail_earliest_time', '', CORE_DATE_ORDER)."
".LAN_MAILOUT_239."".$this->makeCalendar('mail_latest_time', '', CORE_DATE_ORDER)."
".LAN_MAILOUT_238."".$this->makeCalendar('mail_earliest_time', time(), CORE_DATE_ORDER)."
".LAN_MAILOUT_239."".$this->makeCalendar('mail_latest_time', time()+86400, CORE_DATE_ORDER)."
".LAN_MAILOUT_240."".LAN_MAILOUT_241."
" . LAN_MAILOUT_238 . "" . $this->makeCalendar('mail_earliest_time', '', CORE_DATE_ORDER) . "
" . LAN_MAILOUT_239 . "" . $this->makeCalendar('mail_latest_time', '', CORE_DATE_ORDER) . "
".LAN_MAILOUT_238."".$this->makeCalendar('mail_earliest_time', + // time(), CORE_DATE_ORDER)."
".LAN_MAILOUT_239."".$this->makeCalendar('mail_latest_time', + // time()+86400, CORE_DATE_ORDER)."
" . LAN_MAILOUT_240 . "" . LAN_MAILOUT_241 . "
\n
"; return $text; } - - /** * */ @@ -1442,41 +1650,42 @@ class mailoutAdminClass extends e107MailManager // Determine formatting strings this way, to give sensible default switch ($dateOrder) { - case 'mdy' : + case 'mdy': $dFormat = '%m/%d/%y'; $tFormat = '%H:%M'; - break; - case 'ymd' : + break; + case 'ymd': $dFormat = '%Y/%m/%d'; $tFormat = ' %H:%M'; - break; - case 'dmy' : - default : + break; + case 'dmy': + default: $dFormat = '%d/%m/%Y'; $tFormat = ' %H:%M'; } $options = array( 'type' => 'datetime', - 'format' => $dFormat." ".$tFormat, - // 'timeformat' => $tFormat, - 'firstDay' => 1, // 0 = Sunday. + 'format' => $dFormat . " " . $tFormat, + // 'timeformat' => $tFormat, + 'firstDay' => 1, // 0 = Sunday. 'size' => 12 - ); -// $options['dateFormat'] = $dformat; -// $options['timeFormat'] = $tformat; - - return e107::getForm()->datepicker($calName,$calVal,$options); + ); + // $options['dateFormat'] = $dformat; + // $options['timeFormat'] = $tformat; + + return e107::getForm()->datepicker($calName, $calVal, $options); } /** * Show recipients of an email - * + * * @param $mailid - number of email * @param $nextPage - 'mode' specification for page to return to following delete * @return text for display */ + /* public function showmailRecipients($mailID, $nextPage = 'saved') { $gen = new convert; @@ -1486,16 +1695,16 @@ class mailoutAdminClass extends e107MailManager $ns = e107::getRender(); $mailData = $this->retrieveEmail($mailID); - - if ($mailData === FALSE) + + if($mailData === FALSE) { $mes->addInfo(LAN_MAILOUT_79); - $ns-> tablerender(ADLAN_136.SEP.LAN_MAILOUT_171, $mes->render().$text); - exit; + $ns->tablerender(ADLAN_136 . SEP . LAN_MAILOUT_171, $mes->render() . $text); + exit ; } $text .= " -
+
@@ -1506,76 +1715,77 @@ class mailoutAdminClass extends e107MailManager "; $text .= $this->showMailDetail($mailData, 'basic'); - $text .= '"; - if ($mailData['mail_content_status'] != MAIL_STATUS_SAVED) + $text .= '"; + if($mailData['mail_content_status'] != MAIL_STATUS_SAVED) { - $text .= ''; + $text .= ''; } $text .= "
'.LAN_MAILOUT_172.''.$this->statusToText($mailData['mail_content_status'])."
' . LAN_MAILOUT_172 . '' . $this->statusToText($mailData['mail_content_status']) . "
'.LAN_MAILOUT_173.''.($mailData['mail_togo_count'] + $mailData['mail_sent_count'] + $mailData['mail_fail_count']).'
' . LAN_MAILOUT_173 . '' . ($mailData['mail_togo_count'] + $mailData['mail_sent_count'] + $mailData['mail_fail_count']) . '
\n
"; - // List of recipients // in $_GET, asc = sort order, fld = sort field $count = $this->selectTargetStatus($mailID, $this->showFrom, $this->showCount, '*', FALSE, $this->sortField, $this->sortOrder); $totalCount = $this->getTargetCount(); - if ($count == 0) + if($count == 0) { - $text .= "".LAN_MAILOUT_253.''; + $text .= "" . LAN_MAILOUT_253 . ''; } else { $text .= " -
+
"; - - $fieldPrefs = $this->calcFieldSpec('recipients', TRUE); // Get columns to display + $fieldPrefs = $this->calcFieldSpec('recipients', TRUE); + // Get columns to display // Must use '&' rather than '&' in query pattern - $text .= $frm->colGroup($this->fields['mail_recipients'],$this->fieldPref).$frm->thead($this->fields['mail_recipients'],$this->fieldPref,'mode='.'recipients&m='.$mailID."&fld=[FIELD]&asc=[ASC]&frm=[FROM]").""; + $text .= $frm->colGroup($this->fields['mail_recipients'], $this->fieldPref) . $frm->thead($this->fields['mail_recipients'], $this->fieldPref, 'mode=' . 'recipients&m=' . $mailID . "&fld=[FIELD]&asc=[ASC]&frm=[FROM]") . ""; - while ($row = $this->getNextTargetStatus(FALSE)) + while($row = $this->getNextTargetStatus(FALSE)) { // print_a($row); $text .= ''; - foreach ($fieldPrefs as $fieldName) - { // Output column data value + foreach($fieldPrefs as $fieldName) + { + // Output column data value $text .= ''; } // Add in options here - $text .= ''; + $text .= ''; $text .= ''; } $text .= "
'; - if (isset($row[$fieldName])) + if(isset($row[$fieldName])) { $proctype = varset($this->fields['mail_recipients'][$fieldName]['proc'], 'default'); switch ($proctype) { - case 'username' : + case 'username': $text .= $this->getUserName($row[$fieldName]); - break; - case 'sdatetime' : + break; + case 'sdatetime': $text .= $gen->convert_date($row[$fieldName], 'short'); - break; - case 'trunc200' : + break; + case 'trunc200': $text .= $tp->text_truncate($row[$fieldName], 200, '...'); - break; - case 'chars' : // Show generated html as is + break; + case 'chars': + // Show generated html as is $text .= htmlspecialchars($row[$fieldName], ENT_COMPAT, 'UTF-8'); - break; - case 'contentstatus' : + break; + case 'contentstatus': $text .= $this->statusToText($row[$fieldName]); - break; - case 'selectors' : + break; + case 'selectors': $text .= 'cannot display'; - break; - case 'array' : - if (is_array($row[$fieldName])) + break; + case 'array': + if(is_array($row[$fieldName])) { $nl = ''; - foreach ($row[$fieldName] as $k => $v) + foreach($row[$fieldName] as $k => $v) { - if ($v) + if($v) { - $text .= $nl.$k.' => '.$v; + $text .= $nl . $k . ' => ' . $v; $nl = '
'; } } @@ -1584,230 +1794,300 @@ class mailoutAdminClass extends e107MailManager { $text .= 'bad data: '; } - break; - case 'default' : - default : + break; + case 'default': + default: $text .= $row[$fieldName]; } } else - { // Special stuff + { + // Special stuff $text .= 'special'; } $text .= '
'.$this->makeTargetOptions('recipients',$row).'' . $this->makeTargetOptions('recipients', $row) . '
\n


"; - if ($totalCount > $count) + if($totalCount > $count) { - $parms = "{$totalCount},{$this->showCount},{$this->showFrom},".e_SELF."?mode=recipients&m={$mailID}&count={$this->showCount}&frm=[FROM]&fld={$this->sortField}&asc={$this->sortOrder}&savepage={$nextPage}"; + $parms = "{$totalCount},{$this->showCount},{$this->showFrom}," . e_SELF . "?mode=recipients&m={$mailID}&count={$this->showCount}&frm=[FROM]&fld={$this->sortField}&asc={$this->sortOrder}&savepage={$nextPage}"; $text .= $tp->parseTemplate("{NEXTPREV={$parms}}"); } } - $ns->tablerender(ADLAN_136.SEP.LAN_MAILOUT_181, $mes->render() . $text); + $ns->tablerender(ADLAN_136 . SEP . LAN_MAILOUT_181, $mes->render() . $text); } - - + */ + + /** * Clean up mailout DB * Dump array of results to admin log - * + * * @return boolean TRUE if no errors, FALSE if errors */ public function dbTidy() { $noError = TRUE; $results = array(); - $this->checkDB(2); // Make sure DB object created - + $this->checkDB(2); + // Make sure DB object created + // First thing, delete temporary records from both tables - if (($res = $this->db2->db_Delete('mail_content', '`mail_content_status` = '.MAIL_STATUS_TEMP)) === FALSE) + if(($res = $this->db2->db_Delete('mail_content', '`mail_content_status` = ' . MAIL_STATUS_TEMP)) === FALSE) { - $results[] = 'Error '.$this->db2->mySQLlastErrNum.':'.$this->db2->mySQLlastErrText.' deleting temporary records from mail_content'; + $results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' deleting temporary records from mail_content'; $noError = FALSE; } else { - if ($res) $results[] = str_replace(array('--COUNT--', '--TABLE--'), array($res, 'mail_content'), LAN_MAILOUT_227); + if($res) + $results[] = str_replace(array( + '--COUNT--', + '--TABLE--' + ), array( + $res, + 'mail_content' + ), LAN_MAILOUT_227); } - if (($res = $this->db2->delete('mail_recipients', '`mail_status` = '.MAIL_STATUS_TEMP)) === FALSE) + if(($res = $this->db2->delete('mail_recipients', '`mail_status` = ' . MAIL_STATUS_TEMP)) === FALSE) { - $results[] = 'Error '.$this->db2->mySQLlastErrNum.':'.$this->db2->mySQLlastErrText.' deleting temporary records from mail_recipients'; + $results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' deleting temporary records from mail_recipients'; $noError = FALSE; } else { - if ($res) $results[] = str_replace(array('--COUNT--', '--TABLE--'), array($res, 'mail_recipients'), LAN_MAILOUT_227); + if($res) + $results[] = str_replace(array( + '--COUNT--', + '--TABLE--' + ), array( + $res, + 'mail_recipients' + ), LAN_MAILOUT_227); } // Now look for 'orphaned' recipient records - if (($res = $this->db2->gen("DELETE `#mail_recipients` FROM `#mail_recipients` + if(($res = $this->db2->gen("DELETE `#mail_recipients` FROM `#mail_recipients` LEFT JOIN `#mail_content` ON `#mail_recipients`.`mail_detail_id` = `#mail_content`.`mail_source_id` WHERE `#mail_content`.`mail_source_id` IS NULL")) === FALSE) { - $results[] = 'Error '.$this->db2->mySQLlastErrNum.':'.$this->db2->mySQLlastErrText.' deleting orphaned records from mail_recipients'; + $results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' deleting orphaned records from mail_recipients'; $noError = FALSE; } - elseif ($res) + elseif($res) { - if ($res) $results[] = str_replace('--COUNT--', $res, LAN_MAILOUT_226); + if($res) + $results[] = str_replace('--COUNT--', $res, LAN_MAILOUT_226); } // Scan content table for anomalies, out of time records - if (($res = $this->db2->gen("SELECT * FROM `#mail_content` - WHERE (`mail_content_status` >".MAIL_STATUS_FAILED.") AND (`mail_content_status` <=".MAIL_STATUS_MAX_ACTIVE.") - AND ((`mail_togo_count`=0) OR ( (`mail_last_date` != 0) AND (`mail_last_date` < ".time().")))")) === FALSE) + if(($res = $this->db2->gen("SELECT * FROM `#mail_content` + WHERE (`mail_content_status` >" . MAIL_STATUS_FAILED . ") AND (`mail_content_status` <=" . MAIL_STATUS_MAX_ACTIVE . ") + AND ((`mail_togo_count`=0) OR ( (`mail_last_date` != 0) AND (`mail_last_date` < " . time() . ")))")) === FALSE) { - $results[] = 'Error '.$this->db2->mySQLlastErrNum.':'.$this->db2->mySQLlastErrText.' checking bad status in mail_content'; + $results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' checking bad status in mail_content'; $noError = FALSE; } else { - $items = array(); // Store record number of any content record that needs to be changed - while ($row = $this->db2->fetch(MYSQL_ASSOC)) + $items = array(); + // Store record number of any content record that needs to be changed + while($row = $this->db2->fetch(MYSQL_ASSOC)) { $items[] = $row['mail_source_id']; - if ($row['mail_source_id']) + if($row['mail_source_id']) { - if (FALSE == $this->cancelEmail($row['mail_source_id'])) + if(FALSE == $this->cancelEmail($row['mail_source_id'])) { - $results[] = 'Error cancelling email ref: '.$row['mail_source_id']; + $results[] = 'Error cancelling email ref: ' . $row['mail_source_id']; } else { - $results[] = 'Email cancelled: '.$row['mail_source_id']; + $results[] = 'Email cancelled: ' . $row['mail_source_id']; } } } - if (count($items)) $results[] = str_replace(array('--COUNT--', '--RECORDS--'), array(count($items), implode(', ', $items)), LAN_MAILOUT_228); + if(count($items)) + $results[] = str_replace(array( + '--COUNT--', + '--RECORDS--' + ), array( + count($items), + implode(', ', $items) + ), LAN_MAILOUT_228); } - - //Finally - check for inconsistent recipient and content status records - basically verify counts - if (($res = $this->db2->db_Select_gen("SELECT COUNT(mr.`mail_status`) AS mr_count, mr.`mail_status`, + //Finally - check for inconsistent recipient and content status records - + // basically verify counts + if(($res = $this->db2->db_Select_gen("SELECT COUNT(mr.`mail_status`) AS mr_count, mr.`mail_status`, mc.`mail_source_id`, mc.`mail_togo_count`, mc.`mail_sent_count`, mc.`mail_fail_count`, mc.`mail_bounce_count`, mc.`mail_source_id` FROM `#mail_recipients` AS mr LEFT JOIN `#mail_content` AS mc ON mr.`mail_detail_id` = mc.`mail_source_id` - WHERE mc.`mail_content_status` <= ".MAIL_STATUS_MAX_ACTIVE." + WHERE mc.`mail_content_status` <= " . MAIL_STATUS_MAX_ACTIVE . " GROUP BY mr.`mail_status`, mc.`mail_source_id` ORDER BY mc.`mail_source_id` ")) === FALSE) { - $results[] = 'Error '.$this->db2->mySQLlastErrNum.':'.$this->db2->mySQLlastErrText.' assembling email counts'; + $results[] = 'Error ' . $this->db2->mySQLlastErrNum . ':' . $this->db2->mySQLlastErrText . ' assembling email counts'; $noError = FALSE; } else { - $lastMail = 0; // May get several rows per mail - $notLast = TRUE; // This forces one more loop, so we can clean up for last record read + $lastMail = 0; + // May get several rows per mail + $notLast = TRUE; + // This forces one more loop, so we can clean up for last record read $changeCount = 0; $saveRow = array(); - while (($row = $this->db2->fetch(MYSQL_ASSOC)) || $notLast) + while(($row = $this->db2->fetch(MYSQL_ASSOC)) || $notLast) { - if (($lastMail > 0 && $row === FALSE) || ($lastMail != $row['mail_source_id'])) - { // Change of mail ID here - handle any accumulated info - if ($lastMail > 0) - { // Need to verify counts for mail just read + if(($lastMail > 0 && $row === FALSE) || ($lastMail != $row['mail_source_id'])) + { + // Change of mail ID here - handle any accumulated info + if($lastMail > 0) + { + // Need to verify counts for mail just read $changes = array(); - foreach ($counters as $k => $v) + foreach($counters as $k => $v) { - if ($saveRow[$k] != $v) + if($saveRow[$k] != $v) { - $changes[$k] = $v; // Assume the counters have got it right + $changes[$k] = $v; + // Assume the counters have got it right } } - if (count($changes)) + if(count($changes)) { - // *************** Update mail record here ********************* + // *************** Update mail record here ********************* $this->checkDB(1); - $this->db->update('mail_content', array('data' => $changes, 'WHERE' => '`mail_source_id` = '.$lastMail, '_FIELDS' => $this->dbTypes['mail_content'])); + $this->db->update('mail_content', array( + 'data' => $changes, + 'WHERE' => '`mail_source_id` = ' . $lastMail, + '_FIELDS' => $this->dbTypes['mail_content'] + )); $line = "Count update for {$saveRow['mail_source_id']} - {$saveRow['mail_togo_count']}, {$saveRow['mail_sent_count']}, {$saveRow['mail_fail_count']}, {$saveRow['mail_bounce_count']} => "; - $line .= implode (', ', $counters); + $line .= implode(', ', $counters); $results[] = $line; $changeCount++; //echo $line.'
'; } } - + // Now reset for current mail $lastMail = $row['mail_source_id']; - $counters = array('mail_togo_count' => 0, 'mail_sent_count' => 0, 'mail_fail_count' => 0, 'mail_bounce_count' => 0); + $counters = array( + 'mail_togo_count' => 0, + 'mail_sent_count' => 0, + 'mail_fail_count' => 0, + 'mail_bounce_count' => 0 + ); $saveRow = $row; } - if ($row === FALSE) $notLast = FALSE; - // We get one record for each mail_status value for a given email - use them to update counts - if ($notLast) + if($row === FALSE) + $notLast = FALSE; + // We get one record for each mail_status value for a given email - use them to + // update counts + if($notLast) { switch ($row['mail_status']) { - case MAIL_STATUS_SENT : // Mail sent. Email handler happy, but may have bounced (or may be yet to bounce) + case MAIL_STATUS_SENT: + // Mail sent. Email handler happy, but may have bounced (or may be yet to bounce) $counters['mail_sent_count'] += $row['mr_count']; - break; - case MAIL_STATUS_BOUNCED : - $counters['mail_sent_count'] += $row['mr_count']; // It was sent, so increment that counter - $counters['mail_bounce_count'] += $row['mr_count']; //...but bounced, so extra status - break; - case MAIL_STATUS_CANCELLED : // Cancelled email - treat as a failure - case MAIL_STATUS_FAILED : - $counters['mail_fail_count'] += $row['mr_count']; // Never sent at all - break; - case MAIL_STATUS_PARTIAL : // Shouldn't get this on individual emails - ignore if we do - break; - default : - if (($row['mail_status'] >= MAIL_STATUS_PENDING) && ($row['mail_status'] <= MAIL_STATUS_MAX_ACTIVE)) + break; + case MAIL_STATUS_BOUNCED: + $counters['mail_sent_count'] += $row['mr_count']; + // It was sent, so increment that counter + $counters['mail_bounce_count'] += $row['mr_count']; + //...but bounced, so extra status + break; + case MAIL_STATUS_CANCELLED: + // Cancelled email - treat as a failure + case MAIL_STATUS_FAILED: + $counters['mail_fail_count'] += $row['mr_count']; + // Never sent at all + break; + case MAIL_STATUS_PARTIAL: + // Shouldn't get this on individual emails - ignore if we do + break; + default: + if(($row['mail_status'] >= MAIL_STATUS_PENDING) && ($row['mail_status'] <= MAIL_STATUS_MAX_ACTIVE)) { - $counters['mail_togo_count'] += $row['mr_count']; // Still in the queue + $counters['mail_togo_count'] += $row['mr_count']; + // Still in the queue } } } } - if ($changeCount) $results[] = str_replace('--COUNT--', $changeCount, LAN_MAILOUT_237); + if($changeCount) + $results[] = str_replace('--COUNT--', $changeCount, LAN_MAILOUT_237); } - $this->e107->admin_log->log_event('MAIL_05', implode('[!br!]', $results), E_LOG_INFORMATIVE, ''); + e107::getLog()->add('MAIL_05', implode('[!br!]', $results), E_LOG_INFORMATIVE, ''); return $noError; } - - /** * Get a list of all the available email templates, by name and variable name * * @param string $sel - currently (all|system|user) - selects template type * - * @return array - key is the variable name of the template, value is the stored template name + * @return array - key is the variable name of the template, value is the stored + * template name */ public function getEmailTemplateNames($sel = 'all') { $ret = array(); - foreach (array(e_CORE.'templates/email_template.php', THEME.'templates/email_template.php') as $templateFileName ) // Override file then defaults - if (is_readable($templateFileName)) + + $templates = e107::getCoreTemplate('email', false, 'front', false); + + foreach($templates as $key => $layout) { - require($templateFileName); - $tVars = get_defined_vars(); - if (isset($tVars['GLOBALS'])) unset($tVars['GLOBALS']); - foreach ($tVars as $tKey => $tData) + if(vartrue($layout['name'])) { - if (is_array($tData) && isset($tData['template_name'])) - { - if (!isset($tData['template_type']) || ($tData['template_type'] == 'all') || ($tData['template_type'] == $sel)) - { - $ret[$tKey] = $tData['template_name']; - } - } - if ($tKey != 'ret') - { - unset($tVars[$tKey]); - } + $ret[$key] = $layout['name']; } + } + return $ret; + /* + + foreach (array(e_CORE.'templates/email_template.php', + THEME.'templates/email_template.php') as $templateFileName ) // Override file + then defaults + if (is_readable($templateFileName)) + { + require($templateFileName); + $tVars = get_defined_vars(); + if (isset($tVars['GLOBALS'])) unset($tVars['GLOBALS']); + foreach ($tVars as $tKey => $tData) + { + if (is_array($tData) && isset($tData['template_name'])) + { + if (!isset($tData['template_type']) || ($tData['template_type'] == 'all') || + ($tData['template_type'] == $sel)) + { + $ret[$tKey] = $tData['template_name']; + } + } + if ($tKey != 'ret') + { + unset($tVars[$tKey]); + } + } + } + + print_a($ret); + return $ret; + + */ } + } - - ?> \ No newline at end of file diff --git a/e107_handlers/mailout_class.php b/e107_handlers/mailout_class.php index 6a987e5d6..3db883d20 100644 --- a/e107_handlers/mailout_class.php +++ b/e107_handlers/mailout_class.php @@ -113,11 +113,10 @@ class core_mailout $where = array(); $incExtended = array(); - if ($selectVals === FALSE) - { - $selectVals = array('email_to' => 'all'); - } - switch (varset($selectVals['email_to'], 'all')) + + $emailTo = vartrue($selectVals['email_to'], false); + + switch ($emailTo) { // Build the query for the user database case 'all' : @@ -137,7 +136,7 @@ class core_mailout { $where[] = "u.`user_class` REGEXP concat('(^|,)',{$selectVals['email_to']},'(,|$)')"; } - $where[] = "u.`user_ban`=0"; + } if (vartrue($selectVals['extended_1_name']) && vartrue($selectVals['extended_1_value'])) @@ -183,8 +182,19 @@ class core_mailout } } } + + if(empty($where) && empty($incExtended)) + { + $this->mail_read = 0; + $this->mail_count = 0; + return $this->mail_count; + } + + $where[] = "u.`user_email` != ''"; // Ignore all records with empty email address + + // Now assemble the query from the pieces // Determine which fields we actually need (u.user_sess is the signup link) $qry = 'SELECT u.user_id, u.user_name, u.user_email, u.user_loginname, u.user_sess, u.user_lastvisit'; @@ -203,6 +213,9 @@ class core_mailout $qry .= ' WHERE '.implode(' AND ',$where).' ORDER BY u.user_name'; // echo "Selector query: ".$qry.'
'; + + e107::getMessage()->addDebug("Selector query: ".$qry); + if (!( $this->mail_count = $sql->db_Select_gen($qry))) return FALSE; $this->mail_read = 0; return $this->mail_count; @@ -268,7 +281,7 @@ class core_mailout $var = array(); - $var[0]['caption'] = LAN_MAILOUT_03; // User class select + $var[0]['caption'] = LAN_MAILOUT_260; // LAN_MAILOUT_03; // User class select if ($allow_edit) { diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index 971063d52..e3ea49a1f 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -272,28 +272,28 @@ class e_menuManager { $menu_count = $sql->count("menus", "(*)", " WHERE menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); $sql->db_Update("menus", "menu_order=".($menu_count+1)." WHERE menu_order='{$position}' AND menu_location='{$location}' AND menu_layout = '$this->dbLayout' "); $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location='{$location}' AND menu_order > {$position} AND menu_layout = '".$this->dbLayout."' "); - $admin_log->log_event('MENU_06',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_06',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } if ($menu_act == "top") { $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_location='{$location}' AND menu_order < {$position} AND menu_layout = '".$this->dbLayout."' ",$this->debug); $sql->db_Update("menus", "menu_order=1 WHERE menu_id='{$this->menuId}' "); - $admin_log->log_event('MENU_05',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_05',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } if ($menu_act == "dec") { $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_order='".($position+1)."' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' ",$this->debug); $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_id='{$this->menuId}' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); - $admin_log->log_event('MENU_08',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_08',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } if ($menu_act == "inc") { $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_order='".($position-1)."' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' ",$this->debug); $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_id='{$this->menuId}' AND menu_location='{$location}' AND menu_layout = '".$this->dbLayout."' "); - $admin_log->log_event('MENU_07',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_07',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } if (!isset($_GET['configure'])) @@ -345,7 +345,7 @@ class e_menuManager { ); $sql->db_Insert("menus",$insert); - $admin_log->log_event('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,''); } } @@ -657,7 +657,7 @@ class e_menuManager { $sql->db_Insert("menus",$insert, $this->debug); - $admin_log->log_event('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,''); $menu_count++; } } @@ -774,7 +774,7 @@ class e_menuManager { { return array('msg'=>'All Okay','error'=>false); // FIXME - menu log - //$admin_log->log_event('MENU_02',$_POST['menu_parms'].'[!br!]'.$parms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + //e107::getLog()->add('MENU_02',$_POST['menu_parms'].'[!br!]'.$parms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); // $this->menuAddMessage(LAN_SAVED,E_MESSAGE_SUCCESS); } elseif(false === $check) @@ -808,7 +808,7 @@ class e_menuManager { if($sql->db_Update("menus", "menu_class='".intval($_POST['menu_class'])."', menu_pages='{$pageparms}' WHERE menu_id=".intval($_POST['menu_id']))) { - $admin_log->log_event('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); return array('msg'=>LAN_UPDATED, 'error'=> false); //$this->menuAddMessage($message,E_MESSAGE_SUCCESS); @@ -862,7 +862,7 @@ class e_menuManager { } //Move all menus up (reduces order number) that have a higher menu order number than one deactivated, in the selected location. $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location={$row['menu_location']} AND menu_order > {$row['menu_order']} AND menu_layout = '".$this->dbLayout."' "); - $admin_log->log_event('MENU_04',$row['menu_name'].'[!br!]'.$row['menu_location'].'[!br!]'.$row['menu_order'].'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_04',$row['menu_name'].'[!br!]'.$row['menu_location'].'[!br!]'.$row['menu_order'].'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } else { @@ -892,7 +892,7 @@ class e_menuManager { $sql->db_Update("menus", "menu_location='{$this->menuNewLoc}', menu_order=".($menu_count+1)." WHERE menu_id=".$this->menuId); $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location='{$location}' AND menu_order > {$position} AND menu_layout='".$this->dbLayout ."' "); } - $admin_log->log_event('MENU_03',$row['menu_name'].'[!br!]'.$this->menuNewLoc.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); + e107::getLog()->add('MENU_03',$row['menu_name'].'[!br!]'.$this->menuNewLoc.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,''); } } diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index d37c8299e..d9e49e1d7 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -44,9 +44,9 @@ class e107plugin 'e_event', 'e_comment', 'e_sql', - 'e_userprofile', + // 'e_userprofile', @deprecated @see e_user 'e_header', - 'e_userinfo', + // 'e_userinfo', @deprecated @see e_user 'e_tagwords', 'e_url', @@ -56,6 +56,7 @@ class e107plugin 'e_featurebox', 'e_related', 'e_rss', + 'e_user' ); diff --git a/e107_handlers/pop_bounce_handler.php b/e107_handlers/pop_bounce_handler.php index 2d70cea70..ccaea400a 100644 --- a/e107_handlers/pop_bounce_handler.php +++ b/e107_handlers/pop_bounce_handler.php @@ -217,6 +217,8 @@ class pop3BounceHandler */ public function processBounces() { + $identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id'); + $this->connect(); $tot = $this->getTotalMails(); // Get all the emails for ($i = 1; $i <= $tot; $i++) @@ -227,7 +229,7 @@ class pop3BounceHandler //print_a($head); $body = $this->getBody($i); $e107Header = ''; - if (preg_match('#.*X-e107-id:(.*?)[\n\r]#',$body, $result)) + if (preg_match('#.*'.$identifier.':(.*?)[\n\r]#',$body, $result)) { $e107Header = varset($result[1],''); } diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 4c4e173f5..45374a7d1 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -1054,7 +1054,13 @@ class e_parse_shortcode if ($scCode) { - $ret = eval($scCode); + $ret = @eval($scCode); + + if($ret === false && E107_DEBUG_LEVEL > 0) // Error in Code. + { + $string = print_a($scCode,true); + e107::getMessage()->addDebug('Could not parse Shortcode '.$scFile.' :: {'.$code .'} '.$string); + } } if (isset($ret) && ($ret != '' || is_numeric($ret))) diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 1baa3f8a0..695c97c9b 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -1844,7 +1844,7 @@ class themeHandler } global $pref,$admin_log; // if (!varset($pref['admin_log_log']['admin_banlist'],0)) return; - $admin_log->log_event('THEME_'.$msg_num, $woffle, E_LOG_INFORMATIVE, ''); + e107::getLog()->add('THEME_'.$msg_num, $woffle, E_LOG_INFORMATIVE, ''); } function parse_theme_php($path) diff --git a/e107_handlers/user_extended_class.php b/e107_handlers/user_extended_class.php index 51a000911..9873762ef 100644 --- a/e107_handlers/user_extended_class.php +++ b/e107_handlers/user_extended_class.php @@ -675,10 +675,12 @@ class e107_user_extended $regex = $tp->toText($parms[1]); $regexfail = $tp->toText($parms[2]); $fname = "ue[user_".$struct['user_extended_struct_name']."]"; + $required = vartrue($struct['user_extended_struct_required']) ? "required" : ""; + $fid = $frm->name2id($fname); if(strpos($include, 'class') === FALSE) { - $include .= " class='tbox' "; + $include .= " class='form-control tbox' "; } @@ -686,7 +688,8 @@ class e107_user_extended { case EUF_TEXT : //textbox case EUF_INTEGER : //integer - $ret = ""; + $ret = ""; + return $ret; break; @@ -715,12 +718,12 @@ class e107_user_extended if(deftrue('BOOTSTRAP')) { - $ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label)); + $ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label, 'required'=> $struct['user_extended_struct_required'])); } else { $chk = ($curval == $val)? " checked='checked' " : ""; - $ret .= " {$label}"; + $ret .= " {$label}"; } } @@ -751,7 +754,7 @@ class e107_user_extended if(deftrue('BOOTSTRAP')) { - $ret .= $frm->checkbox($fname,$val,($curval == $val),array('label'=>$label)); + $ret .= $frm->checkbox($fname,$val,($curval == $val),array('label'=>$label, 'required'=> $struct['user_extended_struct_required'])); } else { @@ -764,7 +767,7 @@ class e107_user_extended break; case EUF_DROPDOWN : //dropdown - $ret = "\n"; $ret .= "\n"; // ensures that the user chose it. foreach($choices as $choice) { @@ -788,7 +791,7 @@ class e107_user_extended if (!method_exists($className, 'getValue')) return '???-???'; $temp->pointerReset(); - $ret = "\n"; $ret .= "\n"; // ensures that the user chooses it. while (FALSE !== ($row = $temp->getValue(0, 'next'))) { @@ -808,7 +811,7 @@ class e107_user_extended if($sql->db_Select($tp -> toDB($choices[0], true), $tp -> toDB($choices[1], true).",".$tp -> toDB($choices[2], true), "1 $order")){ $choiceList = $sql->db_getList('ALL',FALSE); - $ret = "\n"; $ret .= "\n"; // ensures that the user chose it. foreach($choiceList as $cArray) { @@ -825,7 +828,7 @@ class e107_user_extended break; case EUF_TEXTAREA : //textarea - return ""; + return ""; break; case EUF_DATE : //date @@ -839,11 +842,10 @@ class e107_user_extended break; case EUF_LANGUAGE : // language - require_once(e_HANDLER."file_class.php"); - $fl = new e_file; - $lanlist = $fl->get_dirs(e_LANGUAGEDIR); + $lanlist = e107::getLanguage()->installed(); sort($lanlist); - $ret = "\n"; $ret .= "\n"; // ensures that the user chose it. foreach($lanlist as $choice) { @@ -852,6 +854,7 @@ class e107_user_extended $ret .= "\n"; } $ret .= "\n"; + break; } diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index 52de07594..0b2c7eb05 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -1600,7 +1600,7 @@ class e_userperms //$sql->db_Update("user", "user_perms='{$perm}' WHERE user_id='{$modID}' ") e107::getMessage()->addAuto($sysuser->set('user_perms', $perm)->save(), 'update', sprintf(LAN_UPDATED, $tp->toDB($_POST['ad_name'])), false, false); $logMsg = str_replace(array('--ID--', '--NAME--'),array($modID, $a_name),ADMSLAN_72).$perm; - $admin_log->log_event('ADMIN_01',$logMsg,E_LOG_INFORMATIVE,''); + e107::getLog()->add('ADMIN_01',$logMsg,E_LOG_INFORMATIVE,''); } } diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php index 570c2ce1c..3ed0ad867 100644 --- a/e107_handlers/user_model.php +++ b/e107_handlers/user_model.php @@ -1055,7 +1055,8 @@ class e_system_user extends e_user_model { if($this->debug) { - echo '$eml returned nothing'; + echo '$eml returned nothing on Line 1050 of user_model.php using $type = '.$type; + print_a($userInfo); } return false; } @@ -1103,6 +1104,7 @@ class e_system_user extends e_user_model $pref = e107::getPref(); $ret = array(); $tp = e107::getParser(); + $mes = e107::getMessage(); // mailer options @@ -1166,7 +1168,11 @@ class e_system_user extends e_user_model break; } - if(!$template) return array(); + if(!$template) + { + $mes->addDebug('$template is empty in user_model.php line 1171.'); // Debug only, do not translate. + return array(); + } $pass_show = varset($userInfo['user_password']); @@ -1253,13 +1259,20 @@ class e_system_user extends e_user_model return $ret; } + + + // all other email types - if(!$userInfo['email_subject']) + if(!$userInfo['mail_subject']) { - return array(); + $mes->addDebug('No Email subject provided to renderEmail() method.'); // Debug only, do not translate. + return array(); } - $ret['email_subject'] = $userInfo['email_subject']; // $EMAIL_TEMPLATE['signup']['subject']; + + $templateName = $ret['template']; + + $ret['email_subject'] = varset($EMAIL_TEMPLATE[$templateName]['subject'], $EMAIL_TEMPLATE['default']['subject']) ; // $subject; $ret['e107_header'] = $userInfo['user_id']; if (vartrue($userInfo['email_copy_to'])) { $ret['email_copy_to'] = $userInfo['email_copy_to']; } @@ -1274,6 +1287,7 @@ class e_system_user extends e_user_model $sc['USERNAME'] = $userInfo['user_name']; $sc['USERURL'] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; $sc['PASSWORD'] = $pass_show ? $pass_show : '******'; + $sc['SUBJECT'] = $userInfo['mail_subject']; /* diff --git a/e107_languages/English/admin/help/mailout.php b/e107_languages/English/admin/help/mailout.php index 20065ba08..49240c5d2 100644 --- a/e107_languages/English/admin/help/mailout.php +++ b/e107_languages/English/admin/help/mailout.php @@ -37,6 +37,7 @@ $action = e107::getParser()->toDB(varset($_GET['mode'],'makemail')); break; case 'savedmail' : case 'makemail' : + case 'main' : $text = 'Create an email, give it a meaningful title, and select the list of recipients. You can save everything as a template for later, or send immediately.
'; $text .= 'Email addresses may be contributed by plugins (such as newsletter), and duplicates are removed when the mail is sent
'; $text .= 'Any attachment is selected from the list of valid downloads.
'; diff --git a/e107_languages/English/admin/lan_log_messages.php b/e107_languages/English/admin/lan_log_messages.php index 809303928..404591a03 100644 --- a/e107_languages/English/admin/lan_log_messages.php +++ b/e107_languages/English/admin/lan_log_messages.php @@ -379,10 +379,10 @@ define("LAN_AL_MISC_07", ""); define("LAN_AL_PING_01", "Ping to service"); -define("LAN_AL_ADMINUI_01", "Admin-UI DB Table Insert"); -define("LAN_AL_ADMINUI_02", "Admin-UI DB Table Update"); -define("LAN_AL_ADMINUI_03", "Admin-UI DB Table Delete"); -define("LAN_AL_ADMINUI_04", "Admin-UI DB Error"); +define("LAN_AL_ADMINUI_01", "Admin-UI DB Table Insert: [x]"); +define("LAN_AL_ADMINUI_02", "Admin-UI DB Table Update: [x]"); +define("LAN_AL_ADMINUI_03", "Admin-UI DB Table Delete: [x]"); +define("LAN_AL_ADMINUI_04", "Admin-UI DB Error: [x]"); ?> diff --git a/e107_languages/English/admin/lan_mailout.php b/e107_languages/English/admin/lan_mailout.php index 32e89880d..7cf1706f4 100644 --- a/e107_languages/English/admin/lan_mailout.php +++ b/e107_languages/English/admin/lan_mailout.php @@ -22,8 +22,8 @@ define("LAN_MAILOUT_08", "Send Email"); define("LAN_MAILOUT_09", "Send format"); define("LAN_MAILOUT_10", "User Subscribed"); define("LAN_MAILOUT_11", "Insert Variables"); -define("LAN_MAILOUT_12", "All Members"); -define("LAN_MAILOUT_13", "All Unverified Members "); +define("LAN_MAILOUT_12", "All Users"); +define("LAN_MAILOUT_13", "All Unverified Users "); define("LAN_MAILOUT_14", "Display Name"); define("LAN_MAILOUT_15", "Mailout"); define("LAN_MAILOUT_16", "Username"); @@ -250,7 +250,7 @@ define("LAN_MAILOUT_231", "Bounced emails - Processing method"); define("LAN_MAILOUT_232", "None"); define("LAN_MAILOUT_233", "Auto-process script"); define("LAN_MAILOUT_234", "Mail account"); -define("LAN_MAILOUT_235", "(Your server has to be configured to use this script)"); +define("LAN_MAILOUT_235", "(Your server must forward or 'pipe' from the email address above to the script path above.)"); define("LAN_MAILOUT_236", "Last Bounce Processed"); define("LAN_MAILOUT_237", "Summary counters updated on --COUNT-- emails"); define("LAN_MAILOUT_238", "Earliest time to send"); @@ -279,6 +279,8 @@ define("LAN_MAILOUT_259", ""); define("LAN_SEND", "Send"); define("LAN_HOLD", "Hold"); +define("LAN_MAILOUT_260", "User-Type"); + //define("LAN_SUBMIT", "Do it!"); LAN_RUN ?> \ No newline at end of file diff --git a/e107_plugins/alt_auth/alt_auth_adminmenu.php b/e107_plugins/alt_auth/alt_auth_adminmenu.php index f68ce3e40..18bcbf796 100755 --- a/e107_plugins/alt_auth/alt_auth_adminmenu.php +++ b/e107_plugins/alt_auth/alt_auth_adminmenu.php @@ -326,7 +326,7 @@ class alt_auth_admin extends alt_auth_base } } } - e107::getAdminLog()->log_event('AUTH_03',$prefix,E_LOG_INFORMATIVE,''); + e107::getLog()->add('AUTH_03',$prefix,E_LOG_INFORMATIVE,''); return LAN_ALT_UPDATED; } diff --git a/e107_plugins/alt_auth/alt_auth_conf.php b/e107_plugins/alt_auth/alt_auth_conf.php index b7e5eccae..0175055a2 100755 --- a/e107_plugins/alt_auth/alt_auth_conf.php +++ b/e107_plugins/alt_auth/alt_auth_conf.php @@ -74,7 +74,7 @@ if(isset($_POST['updateeufs'])) { $pref['auth_extended'] = $au; // @TODO: save_prefs(); - $admin_log->log_event('AUTH_02',$au,''); + e107::getLog()->add('AUTH_02',$au,''); } } diff --git a/e107_plugins/banner/admin_banner.php b/e107_plugins/banner/admin_banner.php index 7a2eca8ba..6579f83dc 100644 --- a/e107_plugins/banner/admin_banner.php +++ b/e107_plugins/banner/admin_banner.php @@ -687,7 +687,7 @@ function banners_adminlog($msg_num='00', $woffle='') $pref = e107::getPref(); // if (!varset($pref['admin_log_log']['admin_banners'],0)) return; - $admin_log->log_event('BANNER_'.$msg_num,$woffle, E_LOG_INFORMATIVE,''); + e107::getLog()->add('BANNER_'.$msg_num,$woffle, E_LOG_INFORMATIVE,''); } ?> \ No newline at end of file diff --git a/e107_plugins/chatbox_menu/admin_chatbox.php b/e107_plugins/chatbox_menu/admin_chatbox.php index 93a3b9020..f3e83fb06 100644 --- a/e107_plugins/chatbox_menu/admin_chatbox.php +++ b/e107_plugins/chatbox_menu/admin_chatbox.php @@ -62,7 +62,7 @@ if (isset($_POST['prune'])) $prunetime = time() - $chatbox_prune; $sql->db_Delete("chatbox", "cb_datestamp < '{$prunetime}' "); - $admin_log->log_event('CHBLAN_02', $chatbox_prune.', '.$prunetime, E_LOG_INFORMATIVE, ''); + e107::getLog()->add('CHBLAN_02', $chatbox_prune.', '.$prunetime, E_LOG_INFORMATIVE, ''); $e107cache->clear("nq_chatbox"); $mes->addSuccess(CHBLAN_28); } @@ -88,7 +88,7 @@ if (isset($_POST['recalculate'])) { $sql->db_Update("user", "user_chats = '{$cnt}' WHERE user_id = '{$uid}'"); } - $admin_log->log_event('CHBLAN_03','', E_LOG_INFORMATIVE, ''); + e107::getLog()->add('CHBLAN_03','', E_LOG_INFORMATIVE, ''); $mes->addSuccess(CHBLAN_33); } diff --git a/e107_plugins/chatbox_menu/e_user.php b/e107_plugins/chatbox_menu/e_user.php new file mode 100644 index 000000000..686b7b810 --- /dev/null +++ b/e107_plugins/chatbox_menu/e_user.php @@ -0,0 +1,40 @@ +count("chatbox"); + } + e107::setRegistry('total_chatposts', $chatposts); + } + + $perc = ($chatposts > 0) ? round(($udata['user_chats']/$chatposts) * 100, 2) : 0; + + + $var = array( + 0 => array('label' => LAN_PLUGIN_CHATBOX_MENU_POSTS, 'text' => $udata['user_chats']." ( ".$perc."% )") + ); + + return $var; + } + +} \ No newline at end of file diff --git a/e107_plugins/chatbox_menu/languages/English/English_global.php b/e107_plugins/chatbox_menu/languages/English/English_global.php index 63c3804f7..648a37cfb 100644 --- a/e107_plugins/chatbox_menu/languages/English/English_global.php +++ b/e107_plugins/chatbox_menu/languages/English/English_global.php @@ -3,6 +3,7 @@ define("LAN_PLUGIN_CHATBOX_MENU_NAME", "Chatbox"); define("LAN_PLUGIN_CHATBOX_MENU_DESCRIPTION", "Chatbox Menu"); +define("LAN_PLUGIN_CHATBOX_MENU_POSTS", "Chatbox Posts"); // Admin Log //FIXME - Global LANS must begin with LAN_PLUGIN_{FOLDER_NAME}_ diff --git a/e107_plugins/download/admin_download.php b/e107_plugins/download/admin_download.php index 686fd0786..17ebbe5b0 100644 --- a/e107_plugins/download/admin_download.php +++ b/e107_plugins/download/admin_download.php @@ -102,7 +102,7 @@ if (isset($_POST['update_catorder'])) $sql -> db_Update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'"); } } - $admin_log->log_event('DOWNL_08',implode(',',array_keys($_POST['catorder'])),E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_08',implode(',',array_keys($_POST['catorder'])),E_LOG_INFORMATIVE,''); $ns->tablerender("", "
".LAN_UPDATED."
"); } /* @@ -175,7 +175,7 @@ if (isset($_POST['addlimit'])) if ($sql->db_Insert('generic',$vals)) { $message = DOWLAN_117; - $admin_log->log_event('DOWNL_09',$valString,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_09',$valString,E_LOG_INFORMATIVE,''); } else { @@ -208,7 +208,7 @@ if (isset($_POST['updatelimits'])) if ($sql->db_Delete('generic',"gen_id = {$idLim}")) { $message .= $idLim." - ".DOWLAN_119."
"; - $admin_log->log_event('DOWNL_11','ID: '.$idLim,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_11','ID: '.$idLim,E_LOG_INFORMATIVE,''); } else { @@ -224,7 +224,7 @@ if (isset($_POST['updatelimits'])) } $valString = implode(',',$vals); $sql->db_UpdateArray('generic',$vals," WHERE gen_id = {$idLim}"); - $admin_log->log_event('DOWNL_10',$idLim.', '.$valString,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_10',$idLim.', '.$valString,E_LOG_INFORMATIVE,''); $message .= $idLim." - ".DOWLAN_121."
"; unset($vals); } diff --git a/e107_plugins/download/handlers/adminDownload_class.php b/e107_plugins/download/handlers/adminDownload_class.php index 711b18c89..cdf9d4a1a 100644 --- a/e107_plugins/download/handlers/adminDownload_class.php +++ b/e107_plugins/download/handlers/adminDownload_class.php @@ -1187,7 +1187,7 @@ class adminDownload extends download $logString .= '[!br!]'.$k.'=>'.$v; } } - $admin_log->log_event($aText,$logString,E_LOG_INFORMATIVE,''); + e107::getLog()->add($aText,$logString,E_LOG_INFORMATIVE,''); } */ // ----------------------------------------------------------------------------- @@ -1890,12 +1890,12 @@ class adminDownload extends download if ($id) { admin_update($sql->db_Update("download_category", "download_category_name='{$download_category_name}', download_category_description='{$download_category_description}', download_category_icon ='{$download_category_icon}', download_category_parent= '{$download_categoory_parent}', download_category_class='{$download_category_class}' WHERE download_category_id='{$id}'"), 'update', DOWLAN_48); - $admin_log->log_event('DOWNL_03',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_03',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,''); } else { admin_update($sql->db_Insert("download_category", "0, '{$download_category_name}', '{$download_category_description}', '{$download_category_icon}', '{$download_categoory_parent}', '{$download_category_class}', 0 "), 'insert', DOWLAN_47); - $admin_log->log_event('DOWNL_02',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_02',$download_category_name.'[!br!]'.$download_category_description,E_LOG_INFORMATIVE,''); } if ($subAction == "sn") { @@ -1914,7 +1914,7 @@ class adminDownload extends download if ($delete == "mirror") { admin_update($sql -> db_Delete("download_mirror", "mirror_id=".$del_id), delete, DOWLAN_135); - $admin_log->log_event('DOWNL_14','ID: '.$del_id,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_14','ID: '.$del_id,E_LOG_INFORMATIVE,''); } @@ -2059,12 +2059,12 @@ class adminDownload extends download if (isset($_POST['id'])) { admin_update($sql -> db_Update("download_mirror", "mirror_name='{$name}', mirror_url='{$url}', mirror_image='".$tp->toDB($_POST['mirror_image'])."', mirror_location='{$location}', mirror_description='{$description}' WHERE mirror_id=".intval($_POST['id'])), 'update', DOWLAN_133); - $admin_log->log_event('DOWNL_13','ID: '.intval($_POST['id']).'[!br!]'.$logString,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_13','ID: '.intval($_POST['id']).'[!br!]'.$logString,E_LOG_INFORMATIVE,''); } else { admin_update($sql -> db_Insert("download_mirror", "0, '{$name}', '{$url}', '".$tp->toDB($_POST['mirror_image'])."', '{$location}', '{$description}', 0"), 'insert', DOWLAN_134); - $admin_log->log_event('DOWNL_12',$logString,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_12',$logString,E_LOG_INFORMATIVE,''); } } }*/ diff --git a/e107_plugins/download/handlers/download_class.php b/e107_plugins/download/handlers/download_class.php index 46bc75871..35cb4d59a 100644 --- a/e107_plugins/download/handlers/download_class.php +++ b/e107_plugins/download/handlers/download_class.php @@ -379,8 +379,8 @@ class download unset($text); if ($dlrow['download_comment']) - { - $comments = e107::getComment()->compose_comment("download", "comment", $id, $width,$dlrow['download_name'], FALSE, true); + { + $comments = e107::getComment()->compose_comment("download", "comment", $dlrow['download_id'], $width, $dlrow['download_name'], FALSE, true); $ret .= $ns->tablerender($comments['caption'], $comments['comment'].$comments['comment_form'], 'download-comments', true); } diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php index 4466030b1..90361cea7 100644 --- a/e107_plugins/download/includes/admin.php +++ b/e107_plugins/download/includes/admin.php @@ -1783,7 +1783,7 @@ $columnInfo = array( if ($delete == "mirror") { $mes->addAuto($sql -> db_Delete("download_mirror", "mirror_id=".$del_id), delete, DOWLAN_135); - $admin_log->log_event('DOWNL_14','ID: '.$del_id,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_14','ID: '.$del_id,E_LOG_INFORMATIVE,''); } @@ -1934,12 +1934,12 @@ $columnInfo = array( if (isset($_POST['id'])) { $mes->addAuto($sql -> db_Update("download_mirror", "mirror_name='{$name}', mirror_url='{$url}', mirror_image='".$tp->toDB($_POST['mirror_image'])."', mirror_location='{$location}', mirror_description='{$description}' WHERE mirror_id=".intval($_POST['id'])), 'update', DOWLAN_133); - $admin_log->log_event('DOWNL_13','ID: '.intval($_POST['id']).'[!br!]'.$logString,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_13','ID: '.intval($_POST['id']).'[!br!]'.$logString,E_LOG_INFORMATIVE,''); } else { $mes->addAuto($sql -> db_Insert("download_mirror", "0, '{$name}', '{$url}', '".$tp->toDB($_POST['mirror_image'])."', '{$location}', '{$description}', 0"), 'insert', DOWLAN_134); - $admin_log->log_event('DOWNL_12',$logString,E_LOG_INFORMATIVE,''); + e107::getLog()->add('DOWNL_12',$logString,E_LOG_INFORMATIVE,''); } } } @@ -2120,7 +2120,7 @@ $columnInfo = array( $logString .= '[!br!]'.$k.'=>'.$v; } } - $admin_log->log_event($aText,$logString,E_LOG_INFORMATIVE,''); + e107::getLog()->add($aText,$logString,E_LOG_INFORMATIVE,''); } diff --git a/e107_plugins/forum/e_user.php b/e107_plugins/forum/e_user.php new file mode 100644 index 000000000..d3720759e --- /dev/null +++ b/e107_plugins/forum/e_user.php @@ -0,0 +1,41 @@ +count("forum_post")); + e107::setRegistry('total_forumposts', $total_forumposts); + } + + $count = $sql->retrieve('user_extended', 'user_plugin_forum_posts', 'user_extended_id = '.$udata['user_id']); + + $perc = ($total_forumposts > 0 && $count) ? round(($count / $total_forumposts) * 100, 2) : 0; + + $url = ($count> 0) ? e_HTTP."userposts.php?0.forums.".$udata['user_id'] : null; + + $var = array( + 0 => array('label' => LAN_PLUGIN_FORUM_POSTS, 'text' => intval($count)." ( ".$perc."% )", 'url'=> $url) + ); + + return $var; + } + +} \ No newline at end of file diff --git a/e107_plugins/forum/forum_update.php b/e107_plugins/forum/forum_update.php index 849ca103e..db6d8b1be 100644 --- a/e107_plugins/forum/forum_update.php +++ b/e107_plugins/forum/forum_update.php @@ -547,7 +547,7 @@ function renderProgress($caption, $step)
- '.$caption.' + '.$caption.' '; diff --git a/e107_plugins/forum/languages/English/English_global.php b/e107_plugins/forum/languages/English/English_global.php index 674b435f7..8976f3e3b 100644 --- a/e107_plugins/forum/languages/English/English_global.php +++ b/e107_plugins/forum/languages/English/English_global.php @@ -2,7 +2,7 @@ define("LAN_PLUGIN_FORUM_NAME", "Forum"); define("LAN_PLUGIN_FORUM_DESC", "This plugin is a fully featured forum system."); - +define("LAN_PLUGIN_FORUM_POSTS", "Forum posts"); // Notify // TODO - LAN cleanup (see e_notify) diff --git a/e107_plugins/gsitemap/e_module.php b/e107_plugins/gsitemap/e_module.php index 01004f2ad..89c31cffd 100644 --- a/e107_plugins/gsitemap/e_module.php +++ b/e107_plugins/gsitemap/e_module.php @@ -44,7 +44,7 @@ function pingit($vals) $pinger->ping($xml_rpc_server, $xml_rpc_port, $xml_rpc_path, $xml_rpc_method, $weblog_name, $weblog_url, $changes_url, $cat_or_rss, $extended); $log = strip_tags($vals['news_title']."\n".$changes_url."\n".$cat_or_rss."\n".$pinger->smessage); - $admin_log->log_event("Gsitemap Google-ping",$log, 4); + e107::getLog()->add("Gsitemap Google-ping",$log, 4); } diff --git a/e107_plugins/linkwords/admin_config.php b/e107_plugins/linkwords/admin_config.php index 1e5f27f1a..b526939ba 100644 --- a/e107_plugins/linkwords/admin_config.php +++ b/e107_plugins/linkwords/admin_config.php @@ -66,7 +66,7 @@ if(isset($deltest[LAN_DELETE])) if ($sql->db_Count('linkwords', '(*)', "WHERE linkword_id = ".$delete_id)) { $sql->db_Delete('linkwords', 'linkword_id='.$delete_id); - $admin_log->log_event('LINKWD_03','ID: '.$delete_id,''); + e107::getLog()->add('LINKWD_03','ID: '.$delete_id,''); $e107->ecache->clear_sys(LW_CACHE_TAG); //$message = LWLAN_19; $mes->addSuccess(LAN_DELETED); @@ -116,7 +116,7 @@ if (isset($_POST['saveopts_linkword'])) save_prefs(); $logString = implode(', ',$pref['lw_context_visibility']).'[!br!]'.$pref['lw_page_visibility'].'[!br!]'.$pref['lw_ajax_enable'].'[!br!]'.$pref['lw_notsamepage']; $e107->ecache->clear_sys(LW_CACHE_TAG); - $admin_log->log_event('LINKWD_04',$logString,''); + e107::getLog()->add('LINKWD_04',$logString,''); } @@ -140,7 +140,7 @@ if (isset($_POST['submit_linkword']) || isset($_POST['update_linkword'])) { if ($sql->db_Insert('linkwords', $data)) { - $admin_log->log_event('LINKWD_01',$logString,''); + e107::getLog()->add('LINKWD_01',$logString,''); $mes->addSuccess(LAN_CREATED); } else @@ -156,7 +156,7 @@ if (isset($_POST['submit_linkword']) || isset($_POST['update_linkword'])) { $mes->addSuccess(LAN_UPDATED); $logString = 'ID: '.$id.'[!br!]'.$logString; - $admin_log->log_event('LINKWD_02',$logString,''); + e107::getLog()->add('LINKWD_02',$logString,''); } else { diff --git a/e107_plugins/linkwords/linkwords.php b/e107_plugins/linkwords/linkwords.php index 2a33c20bd..08ad91083 100644 --- a/e107_plugins/linkwords/linkwords.php +++ b/e107_plugins/linkwords/linkwords.php @@ -57,7 +57,7 @@ class e_linkwords $pref['e_tohtml_list'][] = 'linkwords'; } save_prefs(); - $admin_log->log_event('LINKWD_05',LWLAN_58.'[!br!]'.$pref['tohtml_hook'],''); // Log that the update was done + e107::getLog()->add('LINKWD_05',LWLAN_58.'[!br!]'.$pref['tohtml_hook'],''); // Log that the update was done return; } diff --git a/e107_plugins/log/admin_config.php b/e107_plugins/log/admin_config.php index 7ee30e7ab..0b3172ba3 100644 --- a/e107_plugins/log/admin_config.php +++ b/e107_plugins/log/admin_config.php @@ -196,7 +196,7 @@ if(IsSet($_POST['wipeSubmit'])) } $logStr .= '[!br!]'.$key; } - $admin_log->log_event('STAT_01',ADSTAT_L81.$logStr,''); + e107::getLog()->add('STAT_01',ADSTAT_L81.$logStr,''); //$message = ADSTAT_L25; // TODO:$emessage $mes->addSuccess(LAN_UPDATED); @@ -237,7 +237,7 @@ if (isset($_POST['updatesettings'])) } save_prefs(); file_put_contents(e_LOG.LogFlagFile, "\n"); // Logging task uses to see if logging enabled - $admin_log->log_event('STAT_02',ADSTAT_L82.$logStr,''); + e107::getLog()->add('STAT_02',ADSTAT_L82.$logStr,''); } $ns->tablerender($caption, $mes->render() . $text); @@ -526,7 +526,7 @@ switch ($action) $logStr .= "[!br!]{$k} => ".$v; } $text .= ""; - $admin_log->log_event('STAT_04',ADSTAT_L83.$logStr,''); + e107::getLog()->add('STAT_04',ADSTAT_L83.$logStr,''); } $text .= "".ADSTAT_L70.""; $text .= "