1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 12:41:51 +02:00

Improved detection of deprecated functions/methods and display in DEBUG mode: deprecated.

This commit is contained in:
Cameron 2020-12-21 10:00:28 -08:00
parent 63527c4f19
commit 630f3f415f
30 changed files with 224 additions and 82 deletions

View File

@ -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('<b>getip() is deprecated.</b> 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('<b>get_user_data() is deprecated.</b> 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('<b>save_prefs() is deprecated.</b> 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('<b>cachevars() is deprecated.</b> 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('<b>getcachedvars() is deprecated.</b> 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('<b>include_lan() is deprecated.</b> 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('<b>loadLanFiles() is deprecated.</b> 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('<b>plugInstalled() is deprecated.</b> Use <e107::isInstalled() instead.', E_USER_DEPRECATED); // NO LAN
return e107::isInstalled($plugname);
/*global $pref;
// Could add more checks here later if appropriate

View File

@ -493,7 +493,8 @@ class admin_shortcodes
include_once(e_PLUGIN.$val.'/e_latest.php');
if(!class_exists($val."_latest"))
{
$mes->addDebug("<strong>".$val ."</strong> using deprecated e_latest method");
trigger_error("<strong>".$val ."</strong> 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("<strong>".$val ."</strong> using deprecated e_status method. See the chatbox plugin folder for a working example of the new one. ");
trigger_error("<strong>".$val ."</strong> is using a deprecated e_status method method. See plugin: _blank/e_dashboard.php ", E_USER_DEPRECATED);
// $mes->addDebug("<strong>".$val ."</strong> using deprecated e_status method. See the chatbox plugin folder for a working example of the new one. ");
}
$oldconfigs[$val] = admin_shortcodes::legacyToConfig($text);

View File

@ -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('<b>THEME_ONLOAD is deprecated.</b> 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 <head> and start of <body>
@ -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 "<body".$body_onload.">\n";
}
else
{
trigger_error('<b>BODYTAG is deprecated.</b> 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";
}
}

View File

@ -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('<b>admin_handler.php file is deprecated.</b>', 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");

View File

@ -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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> Use e107::getLog()->addError($arrayData)->save($event) instead.', E_USER_DEPRECATED); // no LAN
return $this->addError($text,$message,$session);
}

View File

@ -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('<b>ArrayData class is deprecated.</b> 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);
}
}

View File

@ -17,11 +17,13 @@ if (!defined('e107_INIT'))
exit;
}
/**
* @DEPRECATED
* @deprecated
* Use e107::getParser()->toAvatar() instead.
*/
function avatar($avatar)
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b> Use e107::getParser()->toAvatar() instead.', E_USER_DEPRECATED); // no LAN
$data = array('user_image' => $avatar);
return e107::getParser()->toAvatar($data, array('type'=>'url'));

View File

@ -68,6 +68,7 @@ function defset($str, $default='')
*/
function varsettrue(&$val, $default='')
{
trigger_error('<b>varsettrue() is deprecated.</b> 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('<b>defsettrue() is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> Use e107::unserialize() instead.', E_USER_DEPRECATED); // NO LAN
return $this->unserialize($ArrayData);
}

View File

@ -217,6 +217,8 @@ class e_date
*/
function convert($string=null, $mask = 'inputdate')
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> 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));

View File

@ -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 = "<table class='table table-striped table-condensed' style='width: 100%'>
<tr><th colspan='4'><b>The following deprecated functions were used:</b></td></tr>
<thead>
<tr>
<th style='width: 10%;'>Function</th>
<th style='width: 10%;'>File</th>
<th style='width: 10%;'>Line</th>
</tr>
</thead>
<tbody>\n";
foreach($this->deprecated_funcs as $funcs)
$text = "
<table class='table table-striped table-condensed' style='width: 100%'>
<thead>
<tr>
<th style='width: 40%;'>Info</th>
<th style='width: 30%;'>File</th>
<th>Line</th>
</tr>
</thead>
<tbody>\n";
if(empty($this->deprecated_funcs))
{
$text .= "<tr>
<td style='width: 10%;'>{$funcs['func']}()</td>
<td style='width: 10%;'>{$funcs['file']}</td>
<td style='width: 10%;'>{$funcs['line']}</td>
</tr>\n";
<td colspan='3'><span class='label label-success'>None Found</span></td>
</tr>";
}
else
{
// $unique = array_unique($this->deprecated_funcs);
foreach($this->deprecated_funcs as $funcs)
{
$text .= "<tr>
<td>{$funcs['func']}</td>
<td>".(is_array($funcs['file']) ? print_a($funcs['file'],true) : $funcs['file'])."</td>
<td>{$funcs['line']}</td>
</tr>\n";
}
}
$text .= "</tbody></table>";
return $text;
}
}

View File

@ -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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> Use getIPHandler()->get_host_name() instead.', E_USER_DEPRECATED); // NO LAN
return self::getIPHandler()->get_host_name($ip_address);
}

View File

@ -15,17 +15,22 @@
public function db_Select($table, $fields = '*', $arg = '', $mode = 'default', $debug = false, $log_type = '', $log_remark = '')
{
trigger_error('<b>$sql->db_Select() is deprecated.</b> 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('<b>$sql->db_Insert() is deprecated.</b> 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('<b>$sql->db_Update() is deprecated.</b> 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('<b>$sql->db_Fetch() is deprecated.</b> 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('<b>$sql->db_Delete() is deprecated.</b> 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('<b>$sql->db_Replace() is deprecated.</b> 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('<b>$sql->db_Count is deprecated.</b> 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('<b>$sql->db_Select_gen() is deprecated.</b> 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('<b>$sql->db_IsLang() is deprecated.</b> 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('<b>$sql->db_UpdateArray() is deprecated.</b> 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('<b>$sql->db_CopyRow() is deprecated.</b>Use $sql->copyRow() instead.', E_USER_DEPRECATED); // NO LAN
return $this->copyRow($table,$fields,$args);
}

View File

@ -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('<b>'.__METHOD__.' is deprecated.</b>', 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('<b>tohtml_hook is deprecated.</b> 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);
}

View File

@ -430,6 +430,8 @@
*/
public function get_file_info($path_to_file, $imgcheck = true, $auto_fix_ext = true)
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b> Use getFileInfo() instead.', E_USER_DEPRECATED); // NO LAN
return $this->getFileInfo($path_to_file, $imgcheck, $auto_fix_ext);
}

View File

@ -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('<b>'.__METHOD__.' is deprecated.</b> Use select() instead.', E_USER_DEPRECATED); // NO LAN
return $this->select($name, $option_array, $selected, $options, $defaultBlank);
}

View File

@ -373,6 +373,8 @@ class language{
*/
function translate($lan, $array= array())
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b> Use $tp->lanVars() instead.', E_USER_DEPRECATED); // NO LAN
foreach($array as $k=>$v)
{
$search[] = "[".$k."]";

View File

@ -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)

View File

@ -316,6 +316,8 @@ class e_db_mysql implements e_db
*/
function db_Mark_Time($sMarker)
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> Use e107::getDb()->select() instead.', E_USER_DEPRECATED); // NO LAN
return $this->select($table, $fields, $arg, $mode !== 'default', $debug, $log_type, $log_remark);
}

View File

@ -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
{

View File

@ -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")
{

View File

@ -38,6 +38,8 @@ if (!defined('e107_INIT'))
*/
function register_shortcode($classFunc, $codes, $path = '', $force = false)
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b>', 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('<b>'.__METHOD__.' is deprecated.</b>', E_USER_DEPRECATED); // NO LAN
return e107::getScParser()->initShortcodeClass($class, $force);
}

View File

@ -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('<b>'.__METHOD__.' is deprecated.</b>', 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('<b>{LINK_IMAGE} is deprecated. Use {LINK_ICON} instead</b>', E_USER_DEPRECATED); // NO LAN
return $this->sc_link_icon($parm);
}

View File

@ -547,6 +547,9 @@ class e_theme
*/
public static function getThemeList($mode = false, $force = false)
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b>', E_USER_DEPRECATED); // NO LAN
$themeArray = array();
$tloop = 1;

View File

@ -28,6 +28,7 @@ class user_select
*/
function user_list($class, $form_name)
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b> Use e107::getForm()->userlist() instead.', E_USER_DEPRECATED); // NO LAN
// e107::getMessage()->addDebug("Deprecated user_list Method used ".debug_backtrace());

View File

@ -999,6 +999,8 @@ class user_class
*/
public function uc_get_classname($id)
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> 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('<b>'.__METHOD__.' is deprecated.</b> Use $uc->getUsersInClass() instead.', E_USER_DEPRECATED); // NO LAN
return $this->getUsersInClass($classes, $fieldList, $includeAncestors, $orderBy);
}

View File

@ -26,6 +26,8 @@ class comment_menu_shortcodes extends e_shortcode
*/
function sc_cm_icon()
{
trigger_error('<b>'.__METHOD__.' is deprecated.</b>', E_USER_DEPRECATED); // NO LAN
//TODO review bullet
$bullet = '';
if(defined('BULLET'))

View File

@ -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('<b>{DOWNLOAD_VIEW_DATE_SHORT} is deprecated.</b> 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('<b>{DOWNLOAD_VIEW_DATE_LONG} is deprecated.</b> Use {DOWNLOAD_VIEW_DATE} instead.', E_USER_DEPRECATED); // NO LAN
return $this->sc_download_view_date('long');
}

View File

@ -140,6 +140,8 @@ e107::getLanguage()->bcDefs($bcDefs);
*/
function sc_lm_imagecode($parm='')
{
trigger_error('<b>{LM_IMAGECODE} is deprecated.</b> 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)
{

View File

@ -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');

View File

@ -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.']';