From 630f3f415f33e29fdf36ffc0a5cf27edc6407b0f Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 21 Dec 2020 10:00:28 -0800 Subject: [PATCH] Improved detection of deprecated functions/methods and display in DEBUG mode: deprecated. --- class2.php | 56 +++++++++------- .../shortcodes/batch/admin_shortcodes.php | 7 +- e107_core/templates/header_default.php | 19 +++++- e107_handlers/admin_handler.php | 7 +- e107_handlers/admin_log_class.php | 11 +++- e107_handlers/arraystorage_class.php | 12 ++-- e107_handlers/avatar_handler.php | 4 +- e107_handlers/core_functions.php | 15 +++-- e107_handlers/date_handler.php | 4 ++ e107_handlers/db_debug_class.php | 66 +++++++++++++------ e107_handlers/e107_class.php | 7 +- e107_handlers/e_db_legacy_trait.php | 19 ++++++ e107_handlers/e_parse_class.php | 15 +++-- e107_handlers/file_class.php | 2 + e107_handlers/form_handler.php | 4 +- e107_handlers/language_class.php | 2 + e107_handlers/model_class.php | 2 +- e107_handlers/mysql_class.php | 4 ++ e107_handlers/pref_class.php | 6 +- e107_handlers/ren_help.php | 2 +- e107_handlers/shortcode_handler.php | 4 ++ e107_handlers/sitelinks_class.php | 8 ++- e107_handlers/theme_handler.php | 3 + e107_handlers/user_select_class.php | 1 + e107_handlers/userclass_class.php | 6 ++ .../comment_menu/comment_menu_shortcodes.php | 2 + e107_plugins/download/download_shortcodes.php | 10 ++- .../login_menu/login_menu_shortcodes.php | 2 + e107_plugins/pm/pm.php | 1 + e107_plugins/pm/pm_class.php | 5 +- 30 files changed, 224 insertions(+), 82 deletions(-) diff --git a/class2.php b/class2.php index 76020d1a6..6454aec64 100755 --- a/class2.php +++ b/class2.php @@ -395,7 +395,7 @@ $sql2 = e107::getDb('sql2'); //TODO find & replace all $sql2 calls $dbg->logTime('Prefs, misc tables'); //DEPRECATED, BC, call the method only when needed, $e107->admin_log caught by __get() -$admin_log = e107::getAdminLog(); //TODO - find & replace $admin_log, $e107->admin_log +$admin_log = e107::getLog(); //TODO - find & replace $admin_log, $e107->admin_log if($merror === 'e1') { @@ -452,7 +452,7 @@ if(!e107::getConfig()->hasData()) { // Core prefs error - admin log - e107::getAdminLog()->add('CORE_LAN8', 'CORE_LAN7', E_LOG_WARNING); + e107::getLog()->add('CORE_LAN8', 'CORE_LAN7', E_LOG_WARNING); // Try for the automatic backup.. if(e107::getConfig('core_backup')->hasData()) @@ -469,7 +469,7 @@ if(!e107::getConfig()->hasData()) if(!e107::getConfig('core_old')->hasData()) { // Core could not restore from automatic backup. Execution halted. - e107::getAdminLog()->add('CORE_LAN8', 'CORE_LAN9', E_LOG_FATAL); + e107::getLog()->add('CORE_LAN8', 'CORE_LAN9', E_LOG_FATAL); message_handler('CRITICAL_ERROR', 3, __LINE__, __FILE__); // No old system, so point in the direction of resetcore :( @@ -721,6 +721,8 @@ init_session(); // Set up a lot of the user-related constants */ function getip() { + trigger_error('getip() is deprecated. Use e107::getIPHandler()->ipDecode(USERIP) instead.', E_USER_DEPRECATED); // NO LAN + return e107::getIPHandler()->ipDecode(USERIP); } @@ -1869,9 +1871,11 @@ function getperms($arg, $ap = ADMINPERMS) */ function get_user_data($uid, $extra = '') { + trigger_error('get_user_data() is deprecated. Use e107::user($uid) instead.', E_USER_DEPRECATED); // NO LAN + if(e107::getPref('developer')) { - e107::getAdminLog()->add( + e107::getLog()->add( 'Deprecated call - get_user_data()', 'Call to deprecated function get_user_data() (class2.php) '."\n".print_r(debug_backtrace(null,2), true), E_LOG_INFORMATIVE, @@ -1904,6 +1908,8 @@ function get_user_data($uid, $extra = '') */ function save_prefs($table = 'core', $uid = USERID, $row_val = '') { + trigger_error('save_prefs() is deprecated. Use e107::getConfig(table)->->setPref($array)->save() instead.', E_USER_DEPRECATED); // NO LAN + global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage, $theme_pref; unset($row_val); @@ -1911,7 +1917,7 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '') { $backtrace = debug_backtrace(false); - e107::getAdminLog()->add( + e107::getLog()->add( 'Deprecated call - save_prefs()', "Call to deprecated function save_prefs() (class2.php). Backtrace:\n".print_r($backtrace, true), E_LOG_INFORMATIVE, @@ -1933,7 +1939,7 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '') { $backtrace = debug_backtrace(false); - e107::getAdminLog()->add( + e107::getLog()->add( 'Core pref corruption avoided', "Call to deprecated function save_prefs() (class2.php) with too few prefs. Backtrace:\n".print_r($backtrace, true), E_LOG_INFORMATIVE, @@ -1956,7 +1962,7 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '') default: $_user_pref = $tp->toDB($user_pref, true, true, 'pReFs'); - $tmp = $eArrayStorage->WriteArray($_user_pref); + $tmp = e107::serialize($_user_pref); $sql->update('user', "user_prefs='$tmp' WHERE user_id=". (int)$uid); return $tmp; break; @@ -1975,6 +1981,8 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '') */ function cachevars($id, $var) { + trigger_error('cachevars() is deprecated. Use e107::setRegistry() instead.', E_USER_DEPRECATED); // NO LAN + e107::setRegistry('core/cachedvars/'.$id, $var); } @@ -1986,6 +1994,8 @@ function cachevars($id, $var) */ function getcachedvars($id) { + trigger_error('getcachedvars() is deprecated. Use e107::getRegistry() instead.', E_USER_DEPRECATED); // NO LAN + return e107::getRegistry('core/cachedvars/'.$id, false); } @@ -2375,25 +2385,19 @@ function class_list($uid = '') /** - * @Deprecated by e107::lan(); + * @deprecated by e107::lan(); * @param string $path * @param boolean $force [optional] Please use the default * @return bool */ function include_lan($path, $force = false) { + trigger_error('include_lan() is deprecated. Use e107::lan() instead.', E_USER_DEPRECATED); // NO LAN + return e107::includeLan($path, $force); } -/* -withdrawn - use loadLanFiles($path, 'admin') instead -// Searches a defined set of paths and file names to load language files used for admin (including install etc) -function include_lan_admin($path) -{ - include_lan($path.'languages/'.e_LANGUAGE.'/lan_config.php'); - include_lan($path.'languages/admin/'.e_LANGUAGE.'.php'); -} -*/ + // Routine looks in standard paths for language files associated with a plugin or theme - primarily for core routines, which won't know @@ -2420,6 +2424,8 @@ function include_lan_admin($path) */ function loadLanFiles($unitName, $type='runtime') { + trigger_error('loadLanFiles() is deprecated. Use e107::loadLanFiles() instead.', E_USER_DEPRECATED); // NO LAN + $info = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2); e107::getMessage()->addDebug("Using deprecated function loanLanFiles(). Replace with e107::loadLanFiles().".print_a($info,true)); return e107::loadLanFiles($unitName, $type); @@ -2574,17 +2580,21 @@ class error_handler function handle_error($type, $message, $file, $line, $context = null) { $startup_error = (!defined('E107_DEBUG_LEVEL')); // Error before debug system initialized + switch($type) + { + case E_USER_DEPRECATED: + if($this->deftrue('E107_DBG_DEPRECATED')) + { + $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,3); + e107::getDebug()->logDeprecated($message, varset($trace[2]['file']), varset($trace[2]['line'])); + } + break; - - switch($type) { case E_NOTICE: - case E_DEPRECATED: // case E_STRICT: if ($startup_error || $this->deftrue('E107_DBG_ALLERRORS') || $this->deftrue('E107_DBG_ERRBACKTRACE')) { - - $this->addError($type, $message,$line,$file); } break; @@ -2977,6 +2987,8 @@ function e107_ini_set($var, $value) */ function plugInstalled($plugname) { + trigger_error('plugInstalled() is deprecated. Use addDebug("".$val ." using deprecated e_latest method"); + trigger_error("".$val ." is using a deprecated e_latest method. See plugin: _blank/e_dashboard.php ", E_USER_DEPRECATED); + $oldconfigs[$val] = admin_shortcodes::legacyToConfig($text); } } @@ -1328,7 +1329,9 @@ class admin_shortcodes include_once(e_PLUGIN.$val.'/e_status.php'); if(!class_exists($val."_status")) { - $mes->addDebug("".$val ." using deprecated e_status method. See the chatbox plugin folder for a working example of the new one. "); + trigger_error("".$val ." is using a deprecated e_status method method. See plugin: _blank/e_dashboard.php ", E_USER_DEPRECATED); + + // $mes->addDebug("".$val ." using deprecated e_status method. See the chatbox plugin folder for a working example of the new one. "); } $oldconfigs[$val] = admin_shortcodes::legacyToConfig($text); diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index 5cf47038e..a617bc132 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -532,9 +532,18 @@ elseif (file_exists(e_BASE."favicon.ico")) // Theme JS /** const THEME_ONLOAD @deprecated */ -if (defined('THEME_ONLOAD')) $js_body_onload[] = THEME_ONLOAD; -$body_onload=''; -if (count($js_body_onload)) $body_onload = " onload=\"".implode(" ",$js_body_onload)."\""; +if (defined('THEME_ONLOAD')) +{ + trigger_error('THEME_ONLOAD is deprecated. Use e107::js() instead.', E_USER_DEPRECATED); // NO LAN + + $js_body_onload[] = THEME_ONLOAD; +} + +$body_onload = ''; +if (count($js_body_onload)) +{ + $body_onload = " onload=\"" . implode(" ", $js_body_onload) . "\""; +} // // J: Send end of and start of @@ -662,11 +671,14 @@ if($noBody === true) // New in v2.2.2 - remove need for BODYTAG. } elseif(!defined('BODYTAG')) // @deprecated. { + $body_onload .= " id='layout-".e107::getForm()->name2id(THEME_LAYOUT)."' "; echo "\n"; } else { + trigger_error('BODYTAG is deprecated. Use a theme.html file instead.', E_USER_DEPRECATED); // NO LAN + if ($body_onload) { // Kludge to get the CHAP code included @@ -674,6 +686,7 @@ else } else { + echo BODYTAG."\n"; } } diff --git a/e107_handlers/admin_handler.php b/e107_handlers/admin_handler.php index bc4769718..5ed1efdb6 100644 --- a/e107_handlers/admin_handler.php +++ b/e107_handlers/admin_handler.php @@ -7,10 +7,15 @@ * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * Administration UI handlers, admin helper functions - * @DEPRECATED FILE + * @deprecated FILE */ +/** + * @deprecated + */ + if (!defined('e107_INIT')) { exit; } +trigger_error('admin_handler.php file is deprecated.', E_USER_DEPRECATED); // NO LAN // DEBUG INFO ONLY - do NOT translate. e107::getMessage()->addDebug("admin_handler.php is deprecated. You can simply remove it from your script and continue to use its functions which can now be found inside core_functions.php"); diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php index 7f15fc0b6..74b118a1c 100644 --- a/e107_handlers/admin_log_class.php +++ b/e107_handlers/admin_log_class.php @@ -134,6 +134,7 @@ class e_admin_log */ public function log_event($event_title, $event_detail, $event_type = E_LOG_INFORMATIVE , $event_code = '') { + trigger_error(''.__METHOD__.' is deprecated. Use add() instead.', E_USER_DEPRECATED); return $this->add($event_title, $event_detail, $event_type, $event_code); } @@ -429,6 +430,8 @@ class e_admin_log */ public function e_log_event($importance, $source_call, $eventcode = 'GEN', $event_title = 'Untitled', $explain = '', $finished = FALSE, $target_logs = LOG_TO_AUDIT, $userData=null ) { + trigger_error(''.__METHOD__.' is deprecated. Use add()->save() or addEvent() instead.', E_USER_DEPRECATED); + return addEvent($importance, $source_call, $eventcode, $event_title, $explain, $finished, $target_logs, $userData); } @@ -617,7 +620,7 @@ class e_admin_log */ public function logArrayAll($event, $target, $extra = '', $niceNames = NULL) { - + trigger_error(''.__METHOD__.' is deprecated. Use e107::getLog()->addArray($arrayData)->save($event) instead.', E_USER_DEPRECATED); // no LAN if($extra == '' && $niceNames == null) { return $this->add($event, $target, E_LOG_INFORMATIVE, ''); // supports arrays @@ -699,11 +702,12 @@ class e_admin_log /** - * @DEPRECATED + * @deprecated * BC Alias for addSuccess(); */ public function logSuccess($text, $message = true, $session = false) { + trigger_error(''.__METHOD__.' is deprecated. Use e107::getLog()->addSuccess($arrayData)->save($event) instead.', E_USER_DEPRECATED); // no LAN return $this->addSuccess($text,$message,$session); } @@ -715,7 +719,8 @@ class e_admin_log */ public function logError($text, $message = true, $session = false) { - return $this->addError($text,$message,$session); + trigger_error(''.__METHOD__.' is deprecated. Use e107::getLog()->addError($arrayData)->save($event) instead.', E_USER_DEPRECATED); // no LAN + return $this->addError($text,$message,$session); } diff --git a/e107_handlers/arraystorage_class.php b/e107_handlers/arraystorage_class.php index dc5b841ea..cce736b7e 100644 --- a/e107_handlers/arraystorage_class.php +++ b/e107_handlers/arraystorage_class.php @@ -14,19 +14,21 @@ if (!defined('e107_INIT')) { exit; } * @deprecated: Allows Storage of arrays without use of serialize functions * */ -class ArrayData { +class ArrayData +{ function __construct() { // DO Not translate - debug info only. - - $log = e107::getAdminLog(); + trigger_error('ArrayData class is deprecated. Use e107::serialize() and e107::unserialize instead of WriteArray() and ReadArray().', E_USER_DEPRECATED); + if(E107_DEBUG_LEVEL > 0 || e107::getPref('developer')) { $dep = debug_backtrace(false); - + $log = e107::getLog(); + foreach($dep as $d) { $log->addDebug("Deprecated ArrayStorage Class called by ".str_replace(e_ROOT,"",$d['file'])." on line ".$d['line']); @@ -46,6 +48,7 @@ class ArrayData { */ function WriteArray($ArrayData, $AddSlashes = true) { + trigger_error('Method ' . __METHOD__ . ' is deprecated. Use e107::serialize() instead.', E_USER_DEPRECATED); return e107::serialize($ArrayData, $AddSlashes); } @@ -58,6 +61,7 @@ class ArrayData { */ function ReadArray($ArrayData) { + trigger_error('Method ' . __METHOD__ . ' is deprecated. Use e107::unserialize() instead.', E_USER_DEPRECATED); return e107::unserialize($ArrayData); } } diff --git a/e107_handlers/avatar_handler.php b/e107_handlers/avatar_handler.php index 709c6d4d9..ebad2bf63 100644 --- a/e107_handlers/avatar_handler.php +++ b/e107_handlers/avatar_handler.php @@ -17,11 +17,13 @@ if (!defined('e107_INIT')) exit; } /** - * @DEPRECATED + * @deprecated * Use e107::getParser()->toAvatar() instead. */ function avatar($avatar) { + trigger_error(''.__METHOD__.' is deprecated. Use e107::getParser()->toAvatar() instead.', E_USER_DEPRECATED); // no LAN + $data = array('user_image' => $avatar); return e107::getParser()->toAvatar($data, array('type'=>'url')); diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index c92acbed2..8a7edf2ee 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -68,6 +68,7 @@ function defset($str, $default='') */ function varsettrue(&$val, $default='') { + trigger_error('varsettrue() is deprecated. Use vartrue() instead.', E_USER_DEPRECATED); // NO LAN return vartrue($val, $default); } @@ -94,6 +95,7 @@ function vartrue(&$val, $default='') */ function defsettrue($str, $default='') { + trigger_error('defsettrue() is deprecated. Use deftrue() instead.', E_USER_DEPRECATED); // NO LAN if (defined($str) && constant($str)) { return constant($str); } return $default; } @@ -599,25 +601,27 @@ class e_array { /** - * @DEPRECATED - Backwards Compatible. Use e107::serialize() instead; + * @deprecated - Backwards Compatible. Use e107::serialize() instead; * @param array $ArrayData array to be stored * @param bool $AddSlashes default true, add slashes for db storage, else false * @return string a string containg exported array data. */ - function WriteArray($ArrayData, $AddSlashes = true) { - + function WriteArray($ArrayData, $AddSlashes = true) + { + trigger_error(''.__METHOD__.' is deprecated. Use e107::serialize() instead.', E_USER_DEPRECATED); // no LAN return $this->serialize($ArrayData, $AddSlashes); } - function write($ArrayData, $AddSlashes = true) { + function write($ArrayData, $AddSlashes = true) + { return $this->serialize($ArrayData, $AddSlashes); } /** - * @DEPRECATED: Use e107::unserialize(); instead. + * @deprecated: Use e107::unserialize(); instead. * Returns an array from stored array data. * @deprecated * @param string $ArrayData @@ -625,6 +629,7 @@ class e_array { */ function ReadArray($ArrayData) { + trigger_error(''.__METHOD__.' is deprecated. Use e107::unserialize() instead.', E_USER_DEPRECATED); // NO LAN return $this->unserialize($ArrayData); } diff --git a/e107_handlers/date_handler.php b/e107_handlers/date_handler.php index 79d1466a4..80df1181c 100644 --- a/e107_handlers/date_handler.php +++ b/e107_handlers/date_handler.php @@ -217,6 +217,8 @@ class e_date */ function convert($string=null, $mask = 'inputdate') { + trigger_error(''.__METHOD__.' is deprecated. Use $tp->toDate() instead.', E_USER_DEPRECATED); // NO LAN + if($string == null) return false; return is_numeric($string) ? $this->convert_date($string, $mask) : $this->toTime($string, $mask); } @@ -779,6 +781,8 @@ class e_date */ public function strptime($str, $format) { + trigger_error(''.__METHOD__.' is deprecated. Use eShims::strptime() instead', E_USER_DEPRECATED); // NO LAN + $vals = eShims::strptime($str, $format); // PHP5 is more accurate than below. $vals['tm_amon'] = strftime('%b', mktime(0, 0, 0, $vals['tm_mon'] + 1)); $vals['tm_fmon'] = strftime('%B', mktime(0, 0, 0, $vals['tm_mon'] + 1)); diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php index 506b05b40..31da726a3 100644 --- a/e107_handlers/db_debug_class.php +++ b/e107_handlers/db_debug_class.php @@ -109,7 +109,7 @@ $this->ShowIf('SQL Analysis', $this->Show_SQL_Details()); $this->ShowIf('Shortcodes / BBCode', $this->Show_SC_BB()); $this->ShowIf('Paths', $this->Show_PATH()); - $this->ShowIf('Deprecated Function Usage', $this->Show_DEPRECATED()); + $this->ShowIf('Deprecated Methods/Function Usage', $this->Show_DEPRECATED()); if(E107_DBG_INCLUDES) { @@ -719,14 +719,26 @@ return $text; } - function logDeprecated() + function logDeprecated($message=null, $file=null, $line=null) { + if(!empty($message) || !empty($file)) + { + $this->deprecated_funcs[] = array( + 'func' => $message, + 'file' => $file, + 'line' => $line + ); + + return null; + } + $back_trace = debug_backtrace(); // print_r($back_trace); $this->deprecated_funcs[] = array( + 'message' => varset($message), 'func' => (isset($back_trace[1]['type']) && ($back_trace[1]['type'] === '::' || $back_trace[1]['type'] === '->') ? $back_trace[1]['class'] . $back_trace[1]['type'] . $back_trace[1]['function'] : $back_trace[1]['function']), 'file' => $back_trace[1]['file'], 'line' => $back_trace[1]['line'] @@ -925,36 +937,48 @@ function Show_DEPRECATED($force = false) { - if(!E107_DBG_DEPRECATED && ($force === false)) { return false; } - else - { - $text = " - - - - - - - - - \n"; - foreach($this->deprecated_funcs as $funcs) + $text = " +
The following deprecated functions were used:
FunctionFileLine
+ + + + + + + + + \n"; + + if(empty($this->deprecated_funcs)) { $text .= " - - - - \n"; + + "; } + else + { + + // $unique = array_unique($this->deprecated_funcs); + + foreach($this->deprecated_funcs as $funcs) + { + $text .= " + + + + \n"; + } + } + $text .= "
InfoFileLine
{$funcs['func']}(){$funcs['file']}{$funcs['line']}
None Found
{$funcs['func']}".(is_array($funcs['file']) ? print_a($funcs['file'],true) : $funcs['file'])."{$funcs['line']}
"; return $text; - } + } diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index c1c5fb4c0..b3017250f 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -1714,11 +1714,12 @@ class e107 /** * Retrieve admin log singleton object - * @Deprecated - use e107::getLog(); + * @deprecated - use e107::getLog(); * @return e_admin_log */ public static function getAdminLog() { + trigger_error(''.__METHOD__.' is deprecated. Use e107::getLog() instead', E_USER_DEPRECATED); // NO LAN return self::getSingleton('e_admin_log'); } @@ -1833,6 +1834,8 @@ class e107 */ public static function getHybridAuth($config = null) { + trigger_error(''.__METHOD__.' is deprecated. Use the e_user_provider interfaces instead (e107::getUserProvider())', E_USER_DEPRECATED); // NO LAN + $e_user_provider = new e_user_provider(null, $config); $reflection = new ReflectionClass('e_user_provider'); $reflection_property = $reflection->getProperty('hybridauth'); @@ -5124,6 +5127,8 @@ class e107 */ public function get_host_name($ip_address) { + trigger_error(''.__METHOD__.' is deprecated. Use getIPHandler()->get_host_name() instead.', E_USER_DEPRECATED); // NO LAN + return self::getIPHandler()->get_host_name($ip_address); } diff --git a/e107_handlers/e_db_legacy_trait.php b/e107_handlers/e_db_legacy_trait.php index aa599cec7..31a6212fd 100644 --- a/e107_handlers/e_db_legacy_trait.php +++ b/e107_handlers/e_db_legacy_trait.php @@ -15,17 +15,22 @@ public function db_Select($table, $fields = '*', $arg = '', $mode = 'default', $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_Select() is deprecated. Use $sql->select() or $sql->retrieve() instead.', E_USER_DEPRECATED); return $this->select($table, $fields, $arg, $mode !== 'default', $debug, $log_type, $log_remark); } public function db_Insert($tableName, $arg, $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_Insert() is deprecated. Use $sql->insert() instead.', E_USER_DEPRECATED); + return $this->insert($tableName, $arg, $debug, $log_type, $log_remark); } function db_Update($tableName, $arg, $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_Update() is deprecated. Use $sql->update() instead.', E_USER_DEPRECATED); + return $this->update($tableName, $arg, $debug, $log_type, $log_remark); } @@ -38,24 +43,31 @@ public function db_Fetch($type = null) { + trigger_error('$sql->db_Fetch() is deprecated. Use $sql->fetch() instead.', E_USER_DEPRECATED); + return $this->fetch($type); } public function db_Delete($table, $arg = '', $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_Delete() is deprecated. Use $sql->delete() instead.', E_USER_DEPRECATED); + return $this->delete($table, $arg, $debug, $log_type, $log_remark); } function db_Replace($table, $arg, $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_Replace() is deprecated. Use $sql->replace() instead.', E_USER_DEPRECATED); + return $this->replace($table, $arg, $debug, $log_type, $log_remark); } function db_Count($table, $fields = '(*)', $arg = '', $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_Count is deprecated. Use $sql->count() instead.', E_USER_DEPRECATED); return $this->count($table, $fields, $arg, $debug, $log_type, $log_remark); } @@ -69,6 +81,7 @@ public function db_Select_gen($query, $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_Select_gen() is deprecated. Use $sql->gen() instead.', E_USER_DEPRECATED); return $this->gen($query, $debug, $log_type, $log_remark); } @@ -99,6 +112,8 @@ function db_IsLang($table, $multiple=false) { + trigger_error('$sql->db_IsLang() is deprecated. Use $sql->hasLanguage() instead.', E_USER_DEPRECATED); + return $this->hasLanguage($table, $multiple); } @@ -120,6 +135,8 @@ public function db_UpdateArray($table, $vars=array(), $arg='', $debug = false, $log_type = '', $log_remark = '') { + trigger_error('$sql->db_UpdateArray() is deprecated. Use $sql->update() with "WHERE" instead.', E_USER_DEPRECATED); + $vars['WHERE'] = str_replace('WHERE', '', $arg); return $this->update($table,$vars,$debug,$log_type,$log_remark); @@ -134,6 +151,8 @@ */ public function db_CopyRow($table, $fields = '*', $args='') { + trigger_error('$sql->db_CopyRow() is deprecated.Use $sql->copyRow() instead.', E_USER_DEPRECATED); // NO LAN + return $this->copyRow($table,$fields,$args); } diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 75ebe2727..11d7872a4 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -612,7 +612,7 @@ class e_parse extends e_parser /** * Check for umatched 'dangerous' HTML tags * (these can destroy page layout where users are able to post HTML) - * @DEPRECATED + * @deprecated * @param string $data * @param string $tagList - if empty, uses default list of input tags. Otherwise a CSV list of tags to check (any type) * @@ -621,7 +621,8 @@ class e_parse extends e_parser */ public function htmlAbuseFilter($data, $tagList = '') { - + trigger_error(''.__METHOD__.' is deprecated.', E_USER_DEPRECATED); // NO LAN + if (empty($tagList)) { $checkTags = array('textarea', 'input', 'td', 'tr', 'table'); @@ -1956,8 +1957,11 @@ class e_parse extends e_parser */ if ($opts['hook']) //Run any hooked in parsers { - if ( varset($pref['tohtml_hook'])) + + if (!empty($pref['tohtml_hook'])) { + // trigger_error('tohtml_hook is deprecated. Use e_parse.php instead.', E_USER_DEPRECATED); // NO LAN + //Process the older tohtml_hook pref (deprecated) foreach(explode(',', $pref['tohtml_hook']) as $hook) { @@ -1980,6 +1984,7 @@ class e_parse extends e_parser */ if(isset($pref['e_tohtml_list']) && is_array($pref['e_tohtml_list'])) { + foreach($pref['e_tohtml_list'] as $hook) { if(empty($hook)) @@ -4606,7 +4611,7 @@ class e_parser if(empty($path)) { - $log = e107::getAdminLog(); + $log = e107::getLog(); $log->addDebug('Broken Icon Path: '.$icon."\n".print_r(debug_backtrace(null,2), true), false)->save('IMALAN_00'); e107::getDebug()->log('Broken Icon Path: '.$icon); return null; @@ -4726,7 +4731,7 @@ class e_parser } else { - $log = e107::getAdminLog(); + $log = e107::getLog(); $log->addDebug('Broken Image Path: '.$legacyPath."\n".print_r(debug_backtrace(null,2), true), false)->save('IMALAN_00'); e107::getDebug()->log('Broken Image Path: ' .$legacyPath); } diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php index a8c3cb9f5..d6eadca55 100644 --- a/e107_handlers/file_class.php +++ b/e107_handlers/file_class.php @@ -430,6 +430,8 @@ */ public function get_file_info($path_to_file, $imgcheck = true, $auto_fix_ext = true) { + trigger_error(''.__METHOD__.' is deprecated. Use getFileInfo() instead.', E_USER_DEPRECATED); // NO LAN + return $this->getFileInfo($path_to_file, $imgcheck, $auto_fix_ext); } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index e469b7c4e..9f9652c95 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -2919,10 +2919,12 @@ class e_form /** - * @DEPRECATED - use select() instead. + * @deprecated - use select() instead. */ function selectbox($name, $option_array, $selected = false, $options = array(), $defaultBlank= false) { + trigger_error(''.__METHOD__.' is deprecated. Use select() instead.', E_USER_DEPRECATED); // NO LAN + return $this->select($name, $option_array, $selected, $options, $defaultBlank); } diff --git a/e107_handlers/language_class.php b/e107_handlers/language_class.php index fc7de90ec..2f383ef8f 100644 --- a/e107_handlers/language_class.php +++ b/e107_handlers/language_class.php @@ -373,6 +373,8 @@ class language{ */ function translate($lan, $array= array()) { + trigger_error(''.__METHOD__.' is deprecated. Use $tp->lanVars() instead.', E_USER_DEPRECATED); // NO LAN + foreach($array as $k=>$v) { $search[] = "[".$k."]"; diff --git a/e107_handlers/model_class.php b/e107_handlers/model_class.php index 517c19521..0cc6f79df 100755 --- a/e107_handlers/model_class.php +++ b/e107_handlers/model_class.php @@ -3808,7 +3808,7 @@ class e_tree_model extends e_front_model { return $this->getNode($node_id)->toString($AddSlashes); } - return (string) e107::getArrayStorage()->WriteArray($this->toArray($total), $AddSlashes); + return (string) e107::getArrayStorage()->serialize($this->toArray($total), $AddSlashes); } public function update($from_post = true, $force = false, $session_messages = false) diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 0ce68ac31..5b98ebe39 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -316,6 +316,8 @@ class e_db_mysql implements e_db */ function db_Mark_Time($sMarker) { + trigger_error(''.__METHOD__.' is deprecated. Use e107::getDebug()->logTime() instead.', E_USER_DEPRECATED); // NO LAN + if($this->debugMode !== true) { return null; @@ -660,6 +662,8 @@ class e_db_mysql implements e_db */ public function db_Select($table, $fields = '*', $arg = '', $mode = 'default', $debug = FALSE, $log_type = '', $log_remark = '') { + trigger_error(''.__METHOD__.' is deprecated. Use e107::getDb()->select() instead.', E_USER_DEPRECATED); // NO LAN + return $this->select($table, $fields, $arg, $mode !== 'default', $debug, $log_type, $log_remark); } diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php index 4b8ce7223..16cf67fb1 100644 --- a/e107_handlers/pref_class.php +++ b/e107_handlers/pref_class.php @@ -424,7 +424,7 @@ class e_pref extends e_front_model $data = e107::getParser()->toDB($data); } parent::setData($data, null, false); - $this->pref_cache = e107::getArrayStorage()->WriteArray($data, false); //runtime cache + $this->pref_cache = e107::getArrayStorage()->serialize($data, false); //runtime cache //BC if($this->alias === 'core') { @@ -471,7 +471,7 @@ class e_pref extends e_front_model if(!empty($data)) { - $this->pref_cache = e107::getArrayStorage()->WriteArray($data, false); //runtime cache + $this->pref_cache = e107::getArrayStorage()->serialize($data, false); //runtime cache $this->loadData((array) $data, false); return $this; } @@ -483,7 +483,7 @@ class e_pref extends e_front_model if($this->serial_bc) { $data = unserialize($row['e107_value']); - $row['e107_value'] = e107::getArrayStorage()->WriteArray($data, false); + $row['e107_value'] = e107::getArrayStorage()->serialize($data, false); } else { diff --git a/e107_handlers/ren_help.php b/e107_handlers/ren_help.php index 8e807eeb6..2b562acb8 100644 --- a/e107_handlers/ren_help.php +++ b/e107_handlers/ren_help.php @@ -14,7 +14,7 @@ if (!defined('e107_INIT')) { exit; } // IMPORTANT : Entire file is deprecated. see: bbcode_shortcodes.php and bbcode_hanlder.php // Left in place only for BC. /** - * @DEPRECATED use $frm->bbarea() instead. + * @deprecated use $frm->bbarea() instead. */ function ren_help($mode = 1, $addtextfunc = "addtext", $helpfunc = "help") { diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index f7cf38532..0605e70c0 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -38,6 +38,8 @@ if (!defined('e107_INIT')) */ function register_shortcode($classFunc, $codes, $path = '', $force = false) { + trigger_error(''.__METHOD__.' is deprecated.', E_USER_DEPRECATED); // NO LAN + return e107::getScParser()->registerShortcode($classFunc, $codes, $path, $force); } @@ -74,6 +76,8 @@ if (!defined('e107_INIT')) */ function initShortcodeClass($class, $force = false, $eVars = null) { + trigger_error(''.__METHOD__.' is deprecated.', E_USER_DEPRECATED); // NO LAN + return e107::getScParser()->initShortcodeClass($class, $force); } diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 0121eb3a1..9b927b9f4 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -1143,7 +1143,8 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } */ function pluginLinksOld($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb') { - + trigger_error(''.__METHOD__.' is deprecated.', E_USER_DEPRECATED); // NO LAN + $sql = e107::getDb(); $tp = e107::getParser(); @@ -2100,11 +2101,12 @@ class navigation_shortcodes extends e_shortcode } /** - * @Deprecated - Use {LINK_ICON} instead. + * @deprecated - Use {LINK_ICON} instead. */ function sc_link_image($parm='') { - e107::getMessage()->addDebug("Using deprecated shortcode: {LINK_IMAGE} - use {LINK_ICON} instead."); + trigger_error('{LINK_IMAGE} is deprecated. Use {LINK_ICON} instead', E_USER_DEPRECATED); // NO LAN + return $this->sc_link_icon($parm); } diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 3037dac45..addb23c6b 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -547,6 +547,9 @@ class e_theme */ public static function getThemeList($mode = false, $force = false) { + trigger_error(''.__METHOD__.' is deprecated.', E_USER_DEPRECATED); // NO LAN + + $themeArray = array(); $tloop = 1; diff --git a/e107_handlers/user_select_class.php b/e107_handlers/user_select_class.php index 2a206979b..0e598f86a 100644 --- a/e107_handlers/user_select_class.php +++ b/e107_handlers/user_select_class.php @@ -28,6 +28,7 @@ class user_select */ function user_list($class, $form_name) { + trigger_error(''.__METHOD__.' is deprecated. Use e107::getForm()->userlist() instead.', E_USER_DEPRECATED); // NO LAN // e107::getMessage()->addDebug("Deprecated user_list Method used ".debug_backtrace()); diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index db6d11a11..6f5958fb9 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -999,6 +999,8 @@ class user_class */ public function uc_get_classname($id) { + trigger_error(''.__METHOD__.' is deprecated. Use $uc->getName() instead.', E_USER_DEPRECATED); // NO LAN + return $this->getName($id); } @@ -1013,6 +1015,8 @@ class user_class */ public function uc_get_classdescription($id) { + trigger_error(''.__METHOD__.' is deprecated. Use $uc->getDescription($id) instead.', E_USER_DEPRECATED); // NO LAN + return $this->getDescription($id); } @@ -1135,6 +1139,8 @@ class user_class */ public function get_users_in_class($classes, $fieldList = 'user_name, user_loginname', $includeAncestors = FALSE, $orderBy = 'user_id') { + trigger_error(''.__METHOD__.' is deprecated. Use $uc->getUsersInClass() instead.', E_USER_DEPRECATED); // NO LAN + return $this->getUsersInClass($classes, $fieldList, $includeAncestors, $orderBy); } diff --git a/e107_plugins/comment_menu/comment_menu_shortcodes.php b/e107_plugins/comment_menu/comment_menu_shortcodes.php index a4295c442..6021677f0 100644 --- a/e107_plugins/comment_menu/comment_menu_shortcodes.php +++ b/e107_plugins/comment_menu/comment_menu_shortcodes.php @@ -26,6 +26,8 @@ class comment_menu_shortcodes extends e_shortcode */ function sc_cm_icon() { + trigger_error(''.__METHOD__.' is deprecated.', E_USER_DEPRECATED); // NO LAN + //TODO review bullet $bullet = ''; if(defined('BULLET')) diff --git a/e107_plugins/download/download_shortcodes.php b/e107_plugins/download/download_shortcodes.php index d27cfb95d..716ed999d 100644 --- a/e107_plugins/download/download_shortcodes.php +++ b/e107_plugins/download/download_shortcodes.php @@ -638,18 +638,22 @@ class download_shortcodes extends e_shortcode } /** - * @Deprecated DOWNLOAD_VIEW_DATE should be used instead. + * @deprecated DOWNLOAD_VIEW_DATE should be used instead. */ function sc_download_view_date_short() { - return $this->sc_download_view_date('short'); + trigger_error('{DOWNLOAD_VIEW_DATE_SHORT} is deprecated. Use {DOWNLOAD_VIEW_DATE} instead.', E_USER_DEPRECATED); // NO LAN + + return $this->sc_download_view_date('short'); } /** - * @Deprecated DOWNLOAD_VIEW_DATE should be used instead. + * @deprecated DOWNLOAD_VIEW_DATE should be used instead. */ function sc_download_view_date_long() { + trigger_error('{DOWNLOAD_VIEW_DATE_LONG} is deprecated. Use {DOWNLOAD_VIEW_DATE} instead.', E_USER_DEPRECATED); // NO LAN + return $this->sc_download_view_date('long'); } diff --git a/e107_plugins/login_menu/login_menu_shortcodes.php b/e107_plugins/login_menu/login_menu_shortcodes.php index 4c82cfe12..7a89a378a 100755 --- a/e107_plugins/login_menu/login_menu_shortcodes.php +++ b/e107_plugins/login_menu/login_menu_shortcodes.php @@ -140,6 +140,8 @@ e107::getLanguage()->bcDefs($bcDefs); */ function sc_lm_imagecode($parm='') { + trigger_error('{LM_IMAGECODE} is deprecated. Use {LM_IMAGECODE_NUMBER}, {LM_IMAGECODE_BOX} instead.', E_USER_DEPRECATED); // NO LAN + //DEPRECATED - use LM_IMAGECODE_NUMBER, LM_IMAGECODE_BOX instead if($this->use_imagecode) { diff --git a/e107_plugins/pm/pm.php b/e107_plugins/pm/pm.php index dc4ae497f..f197ee360 100755 --- a/e107_plugins/pm/pm.php +++ b/e107_plugins/pm/pm.php @@ -142,6 +142,7 @@ */ function show_send($to_uid) { + // trigger_error('Method ' . __METHOD__ . ' is deprecated. Use e107::serialize() instead.', E_USER_DEPRECATED); $pm_info = array(); $pm_outbox = $this->pmManager->pm_getInfo('outbox'); diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php index 1cf614dd4..9188b502a 100755 --- a/e107_plugins/pm/pm_class.php +++ b/e107_plugins/pm/pm_class.php @@ -111,6 +111,7 @@ class private_message */ function add($vars) { + $tp = e107::getParser(); $sql = e107::getDb(); $pmsize = 0; @@ -200,7 +201,7 @@ class private_message $totalSend = count($tolist); $targets = array_chunk($tolist, $maxSendNow); // Split into a number of lists, each with the maximum number of elements (apart from the last block, of course) unset($tolist); - $array = new ArrayData; + $pmInfo = $info; $genInfo = array( 'gen_type' => 'pm_bulk', @@ -212,7 +213,7 @@ class private_message { // Save the list in the 'generic' table $pmInfo['to_array'] = $targets[$i]; // Should be in exactly the right format $genInfo['gen_intdata'] = count($targets[$i]); - $genInfo['gen_chardata'] = $array->WriteArray($pmInfo,TRUE); + $genInfo['gen_chardata'] = e107::serialize($pmInfo,TRUE); $sql->insert('generic', array('data' => $genInfo, '_FIELD_TYPES' => array('gen_chardata' => 'string'))); // Don't want any of the clever sanitising now } $toclass .= ' ['.$totalSend.']';