diff --git a/class2.php b/class2.php
index 5c03ba9e14..4e251e1244 100755
--- a/class2.php
+++ b/class2.php
@@ -135,7 +135,7 @@
{
foreach ($retrieve_prefs as $key => $pref_name)
{
- $retrieve_prefs[$key] = preg_replace("/\W/", '', $pref_name);
+ $retrieve_prefs[$key] = preg_replace("/\W/", '', (string) $pref_name);
}
}
else
@@ -647,7 +647,7 @@
if(!defined('SITENAME')) // Allow override by English_custom.php or English_global.php plugin files.
{
- define('SITENAME', trim($tp->toHTML($pref['sitename'], '', 'USER_TITLE,er_on,defs')));
+ define('SITENAME', trim((string) $tp->toHTML($pref['sitename'], '', 'USER_TITLE,er_on,defs')));
}
//
@@ -1195,7 +1195,7 @@ function check_email($email)
return false;
}
- if(is_numeric(substr($email,-1))) // fix for eCaptcha accidently typed on wrong line.
+ if(is_numeric(substr((string) $email,-1))) // fix for eCaptcha accidently typed on wrong line.
{
return false;
}
@@ -1204,9 +1204,9 @@ function check_email($email)
{
return $email;
}
-
+
return false;
-
+
// return preg_match("/^([_a-zA-Z0-9-+]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+)(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,6})$/" , $email) ? $email : false;
}
@@ -1250,14 +1250,14 @@ function check_class($var, $userclass = null, $uid = 0)
return false;
}
- $class_array = !is_array($userclass) ? explode(',', $userclass) : $userclass;
+ $class_array = !is_array($userclass) ? explode(',', (string) $userclass) : $userclass;
$varList = !is_array($var) ? explode(',', (string) $var) : $var;
$latchedAccess = false;
foreach ($varList as $v)
{
- $v = trim($v);
+ $v = trim((string) $v);
$invert = false;
//value to test is a userclass name (or garbage, of course), go get the id
if (!is_numeric($v))
@@ -1358,7 +1358,7 @@ function getperms($arg, $ap = null, $path = null)
return true;
}
- if ($arg === 'P' && preg_match('#(.*?)/' .e107::getFolder('plugins'). '(.*?)/(.*?)#', $path, $matches))
+ if ($arg === 'P' && preg_match('#(.*?)/' .e107::getFolder('plugins'). '(.*?)/(.*?)#', (string) $path, $matches))
{
$sql = e107::getDb('psql');
@@ -1876,7 +1876,7 @@ function session_set($name, $value, $expire='', $path = e_HTTP, $domain = '', $s
$path = '/';
}
- setcookie($name, $value, $expire, $path, $domain, $secure, true);
+ setcookie($name, (string) $value, $expire, $path, $domain, $secure, true);
$_COOKIE[$name] = $value;
}
}
@@ -1994,7 +1994,7 @@ function force_userupdate($currentUser)
}
}
- if (!e107::getPref('disable_emailcheck',true) && !trim($currentUser['user_email'])) return true;
+ if (!e107::getPref('disable_emailcheck',true) && !trim((string) $currentUser['user_email'])) return true;
if(e107::getDb()->select('user_extended_struct', 'user_extended_struct_applicable, user_extended_struct_write, user_extended_struct_name, user_extended_struct_type', 'user_extended_struct_required = 1 AND user_extended_struct_applicable != '.e_UC_NOBODY))
{
@@ -2068,7 +2068,7 @@ function __construct()
return;
}
- if ((isset($_SERVER['QUERY_STRING']) && (strpos($_SERVER['QUERY_STRING'], 'debug=') !== false)) || isset($_COOKIE['e107_debug_level']) && ((strpos($_SERVER['QUERY_STRING'], 'debug=-')) === false) )
+ if ((isset($_SERVER['QUERY_STRING']) && (strpos((string) $_SERVER['QUERY_STRING'], 'debug=') !== false)) || isset($_COOKIE['e107_debug_level']) && ((strpos((string) $_SERVER['QUERY_STRING'], 'debug=-')) === false) )
{
$this->debug = true;
error_reporting(E_ALL);
@@ -2192,7 +2192,7 @@ function render_trace($array)
" . $iconQ . "\\1
###QEND###", $tmp);
- $tmp = preg_replace('/###QEND###(.*?)###QSTART###/si', "" . $iconA . "\\1
", $tmp);
+ $tmp = preg_replace('/###QEND###(.*?)###QSTART###/si', "" . $iconA . "\\1
", (string) $tmp);
$tmp = str_replace(array('###QSTART###', '###QEND###'), array('', "" . $iconA), $tmp) . "
";
$id = 'doc-' . $key;
diff --git a/e107_admin/emoticon.php b/e107_admin/emoticon.php
index 2fea61139d..4bc75b6ef2 100644
--- a/e107_admin/emoticon.php
+++ b/e107_admin/emoticon.php
@@ -62,28 +62,28 @@
// Check for pack-related buttons pressed
foreach ($filtered as $key => $value)
{
- if (strpos($key, "subPack_") !== false)
+ if (strpos((string) $key, "subPack_") !== false)
{
$subpack = str_replace("subPack_", "", $key);
$emote->emoteConf($subpack);
break;
}
- if (strpos($key, "XMLPack_") !== false)
+ if (strpos((string) $key, "XMLPack_") !== false)
{
$subpack = str_replace("XMLPack_", "", $key);
$emote->emoteXML($subpack);
break;
}
- if (strpos($key, "defPack_") !== false)
+ if (strpos((string) $key, "defPack_") !== false)
{
e107::getConfig()->set('emotepack', str_replace("defPack_", "", $key))->save(true, true, true);
e107::getLog()->add('EMOTE_01', $pref['emotepack'], E_LOG_INFORMATIVE, '');
break;
}
- if (strpos($key, "scanPack_") !== false)
+ if (strpos((string) $key, "scanPack_") !== false)
{
$one_pack = str_replace("scanPack_", "", $key);
break;
@@ -204,9 +204,9 @@ function listPacks()
foreach ($emoteArray as $emote)
{
- if (strpos($emote['fname'], ".pak") !== false
- || strpos($emote['fname'], ".xml") !== false
- || strpos($emote['fname'], "phpBB") !== false)
+ if (strpos((string) $emote['fname'], ".pak") !== false
+ || strpos((string) $emote['fname'], ".xml") !== false
+ || strpos((string) $emote['fname'], "phpBB") !== false)
{
$can_scan = true; // Allow re-scan of config files
}
@@ -377,7 +377,7 @@ function emoteXML($packID, $strip_xtn = true)
$evalue = str_replace(".", "!", $emote);
if ($strip_xtn)
{
- $ename = substr($emote, 0, strrpos($emote, '.'));
+ $ename = substr((string) $emote, 0, strrpos((string) $emote, '.'));
}
$f_string .= "\n";
foreach (explode(' ', $tp->toForm($emotecode[$evalue])) as $v)
@@ -455,13 +455,13 @@ function installCheck($do_one = false)
{
while ($row = $sql->fetch())
{
- $pack_local[substr($row['e107_name'], 6)] = true;
+ $pack_local[substr((string) $row['e107_name'], 6)] = true;
}
}
foreach ($this->packArray as $value)
{
- if (strpos($value, ' ') !== false)
+ if (strpos((string) $value, ' ') !== false)
{ // Highlight any directory names containing spaces - not allowed
$msg = "
" . EMOLAN_17 . " " . EMOLAN_18 . ":
@@ -488,15 +488,15 @@ function installCheck($do_one = false)
$confFile = '';
foreach ($fileArray as $k => $file)
{
- if (strpos($file['fname'], ".xml") !== false)
+ if (strpos((string) $file['fname'], ".xml") !== false)
{
$confFile = array('file' => $file['fname'], 'type' => "xml");
}
- elseif (strpos($file['fname'], ".pak") !== false)
+ elseif (strpos((string) $file['fname'], ".pak") !== false)
{
$confFile = array('file' => $file['fname'], 'type' => "pak");
}
- elseif (strpos($file['fname'], ".php") !== false)
+ elseif (strpos((string) $file['fname'], ".php") !== false)
{
$confFile = array('file' => $file['fname'], 'type' => "php");
}
@@ -606,7 +606,7 @@ function installCheck($do_one = false)
{ // Check that the file exists
if (strpos($e_file, ".") === false)
{ // File extension not specified - accept any file extension for match
- if (strpos($emote['fname'], $e_file . ".") === 0)
+ if (strpos((string) $emote['fname'], $e_file . ".") === 0)
{
$file = str_replace(".", "!", $emote['fname']);
break;
diff --git a/e107_admin/eurl.php b/e107_admin/eurl.php
index 7c616afa8f..d3e5001cef 100644
--- a/e107_admin/eurl.php
+++ b/e107_admin/eurl.php
@@ -76,7 +76,7 @@ public function init()
{
$cfg = e107::getConfig();
- list($plug,$key) = explode("|", $_POST['pk']);
+ list($plug,$key) = explode("|", (string) $_POST['pk']);
if(is_string($cfg->get('e_url_alias')))
{
@@ -125,7 +125,7 @@ public function init()
if(isset($_POST['rebuild']) && is_array($_POST['rebuild']))
{
$table = key($_POST['rebuild']);
- list($primary, $input, $output) = explode("::",$_POST['rebuild'][$table]);
+ list($primary, $input, $output) = explode("::",(string) $_POST['rebuild'][$table]);
$this->rebuild($table, $primary, $input, $output);
}
@@ -169,7 +169,7 @@ private function rebuild($table, $primary='', $input='',$output='')
foreach($data as $row)
{
$sef = eHelper::title2sef($row[$input]);
-
+
if($sql->update($table, $output ." = '".$sef."' WHERE ".$primary. " = ".intval($row[$primary]). " LIMIT 1")!==false)
{
$success++;
@@ -178,7 +178,7 @@ private function rebuild($table, $primary='', $input='',$output='')
{
$failed++;
}
-
+
// echo $row[$input]." => ".$output ." = '".$sef."' WHERE ".$primary. " = ".intval($row[$primary]). " LIMIT 1 ";
}
@@ -314,7 +314,7 @@ protected function simplePage()
// $sefurl = (!empty($alias)) ? str_replace('{alias}', $alias, $v['sef']) : $v['sef'];
$pid = $plug."|".$k;
- $v['regex'] = preg_replace("/^\^/",$home,$v['regex']);
+ $v['regex'] = preg_replace("/^\^/",$home,(string) $v['regex']);
$aliasForm = $frm->renderInline('e_url_alias['.$plug.']['.$k.']', $pid, 'e_url_alias['.$plug.']['.$k.']', $alias, $alias,'text',null,array('title'=>LAN_EDIT." (Language-specific)", 'url'=>e_REQUEST_SELF));
$aliasRender = str_replace('{alias}', $aliasForm, $v['regex']);
@@ -408,7 +408,7 @@ public function AliasObserver()
foreach ($als as $module => $alias)
{
$alias = trim($alias);
- $module = trim($module);
+ $module = trim((string) $module);
if($module !== $alias)
{
$cindex = array_search($module, $locations);
@@ -486,7 +486,7 @@ public function ConfigObserver()
$config = is_array($_POST['eurl_config']) ? e107::getParser()->post_toForm($_POST['eurl_config']) : '';
$modules = eRouter::adminReadModules();
$locations = eRouter::adminBuildLocations($modules);
-
+
$aliases = eRouter::adminSyncAliases(e107::getPref('url_aliases'), $config);
if(!empty($_POST['eurl_profile']))
@@ -517,7 +517,7 @@ public function ConfigObserver()
// var_dump($_POST['eurl_config']);
-
+
eRouter::clearCache();
e107::getCache()->clearAll('content'); // clear content - it may be using old url scheme.
@@ -869,7 +869,7 @@ public function moduleRows($data)
}
- $label = vartrue($section['label'], $index == 0 ? LAN_EURL_DEFAULT : eHelper::labelize(ltrim(strstr($location, '/'), '/')));
+ $label = vartrue($section['label'], $index == 0 ? LAN_EURL_DEFAULT : eHelper::labelize(ltrim(strstr((string) $location, '/'), '/')));
// $cssClass = $checked ? 'e-showme' : 'e-hideme';
$cssClass = 'e-hideme'; // always hidden for now, some interface changes could come after pre-alpha
@@ -1027,7 +1027,7 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans)
{
$cfg = $obj->config->config();
if(isset($cfg['config']['noSingleEntry']) && $cfg['config']['noSingleEntry']) continue;
-
+
if($module == 'index')
{
$text .= "
@@ -1063,7 +1063,7 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans)
$url = e107::getUrl()->create($module, '', array('full' => 1, 'encode' => 0));
$defVal = isset($currentAliases[$lan]) && in_array($module, $currentAliases[$lan]) ? array_search($module, $currentAliases[$lan]) : $module;
$section = vartrue($admin['labels'], array());
-
+
$text .= "
@@ -1074,9 +1074,9 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans)
";
-
-
+
+
// default language
$text .= "
@@ -1152,7 +1152,7 @@ public function aliasesRows($currentAliases, $modules, $lanDef, $lans)
";
-
+
/*$text .= "
diff --git a/e107_admin/fileinspector.php b/e107_admin/fileinspector.php
index 4a9630a5b8..c6520aa66c 100755
--- a/e107_admin/fileinspector.php
+++ b/e107_admin/fileinspector.php
@@ -51,7 +51,7 @@
.e { width: 9px; height: 9px }
i.fa-folder-open-o, i.fa-times-circle-o { cursor:pointer }
span.tree-node { cursor: pointer }
-
+
";
e107::css('inline', $css);
@@ -376,9 +376,9 @@ function __construct()
$this->root_dir = $e107 -> file_path;
- if(substr($this->root_dir, -1) == '/')
+ if(substr((string) $this->root_dir, -1) == '/')
{
- $this->root_dir = substr($this->root_dir, 0, -1);
+ $this->root_dir = substr((string) $this->root_dir, 0, -1);
}
if(isset($_POST['core']) && $_POST['core'] == 'integrity_fail_only')
@@ -388,7 +388,7 @@ function __construct()
if(MAGIC_QUOTES_GPC && vartrue($_POST['regex']))
{
- $_POST['regex'] = stripslashes($_POST['regex']);
+ $_POST['regex'] = stripslashes((string) $_POST['regex']);
}
if(!empty($_POST['regex']))
@@ -541,7 +541,7 @@ public function scan_config()
".FC_LAN_18.":
- # #
+ # #
";
@@ -618,7 +618,7 @@ private function inspect_existing($baseDir)
if ($file->isDir()) continue;
$absolutePath = $file->getRealPath();
- $relativePath = preg_replace("/^" . preg_quote($absoluteBase . "/", "/") . "/", "", $absolutePath);
+ $relativePath = preg_replace("/^" . preg_quote($absoluteBase . "/", "/") . "/", "", (string) $absolutePath);
if (empty($relativePath) || $relativePath == $absolutePath) continue;
@@ -695,7 +695,7 @@ private function renderFileName($tree, $fileName, $relativePath,$rowId)
if($fileName === 'error_log')
{
- $hash = md5($relativePath);
+ $hash = md5((string) $relativePath);
e107::getSession()->set('fileinspector_error_log_'. $hash, $relativePath);
@@ -983,7 +983,7 @@ function scan_results()
if($this->opt('type') == 'tree')
{
$text .= " ".FR_LAN_3."
- root_dir))."')\">
+ root_dir))."')\">
";
}
else
@@ -1080,7 +1080,7 @@ function scan_results()
list($icon, $title) = $this->getGlyphForValidationCode($validation);
$text .= '';
$text .= "$icon ";
- $text .= htmlspecialchars($relativePath);
+ $text .= htmlspecialchars((string) $relativePath);
$text .= ' ';
$text .= isset($this->fileSizes[$relativePath]) ? $this->parsesize($this->fileSizes[$relativePath]) : '';
$oldVersion = $this->getOldVersionOfPath($relativePath, $validation);
@@ -1300,7 +1300,7 @@ public static function readScanProgress($scanId)
private static function exitOnEvilScanId($scanId)
{
- if (!preg_match('/^[0-9A-F]+$/i', $scanId)) exit(1);
+ if (!preg_match('/^[0-9A-F]+$/i', (string) $scanId)) exit(1);
}
private static function pruneOldProgressFiles()
diff --git a/e107_admin/footer.php b/e107_admin/footer.php
index 96c26e6db3..67bffa7170 100644
--- a/e107_admin/footer.php
+++ b/e107_admin/footer.php
@@ -91,7 +91,7 @@
}
}
}
-
+
//
// B.2 Send footer template, stop timing, send simple page stats
//
@@ -101,7 +101,7 @@
$ADMIN_FOOTER = e107::getCoreTemplate('admin', 'footer', false);
e107::renderLayout($ADMIN_FOOTER, ['sc'=>'admin']);
}
-
+
$eTimingStop = microtime();
global $eTimingStart;
$clockTime = e107::getSingleton('e107_traffic')->TimeDelta($eTimingStart, $eTimingStop);
@@ -112,7 +112,7 @@
$dbPercent = number_format($dbPercent); // DB as percent of clock
$memuse = eHelper::getMemoryUsage(); // Memory at end, in B/KB/MB/GB ;)
$rinfo = '';
-
+
if (function_exists('getrusage') && !empty($eTimingStartCPU))
{
$ru = getrusage();
@@ -124,7 +124,7 @@
$cpuTot = $cpuUTime + $cpuSTime;
$cpuTime = $cpuTot - $cpuStart;
$cpuPct = 100.0 * $cpuTime / $rendertime; /* CPU load during known clock time */
-
+
// Format for display or logging (Uncomment as needed for logging)
// User cpu
//$cpuUTime = number_format($cpuUTime, 3);
@@ -132,7 +132,7 @@
//$cpuSTime = number_format($cpuSTime, 3);
// Total (User+System)
//$cpuTot = number_format($cpuTot, 3);
-
+
$cpuStart = number_format($cpuStart, 3); // Startup time (i.e. CPU used before class2.php)
$cpuTime = number_format($cpuTime, 3); // CPU while we were measuring the clock (cpuTot-cpuStart)
$cpuPct = number_format($cpuPct); // CPU Load (CPU/Clock)
@@ -143,7 +143,7 @@
//
// $logname = "/home/mysite/public_html/queryspeed.log";
// $logfp = fopen($logname, 'a+'); fwrite($logfp, "$cpuTot,$cpuPct,$cpuStart,$rendertime,$db_time\n"); fclose($logfp);
-
+
if ($pref['displayrendertime'])
{
$rinfo .= CORE_LAN11;
@@ -166,7 +166,7 @@
{
$rinfo .= $cachestring.".";
}
-
+
if (function_exists('theme_renderinfo'))
{
theme_renderinfo($rinfo);
@@ -179,7 +179,7 @@
echo($rinfo ? "\n\n" : "");
}
}
-
+
} // End of regular-page footer (the above NOT done for popups)
//
@@ -299,11 +299,11 @@
if (is_array($pref['e_footer_list']))
{
// ob_start();
-
+
foreach($pref['e_footer_list'] as $val)
{
$fname = e_PLUGIN.$val."/e_footer.php"; // Do not place inside a function - BC $pref required. .
-
+
if(is_readable($fname))
{
$ret = (deftrue('e_DEBUG') || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
diff --git a/e107_admin/frontpage.php b/e107_admin/frontpage.php
index 8d51897c4d..a0fcb82f6d 100644
--- a/e107_admin/frontpage.php
+++ b/e107_admin/frontpage.php
@@ -151,7 +151,7 @@
{
// avoid endless loop.
- if(varset($_POST['frontpage']) == 'other' && (trim($_POST['frontpage_other']) == 'index.php' || trim($_POST['frontpage_other']) == '{e_BASE}index.php'))
+ if(varset($_POST['frontpage']) == 'other' && (trim((string) $_POST['frontpage_other']) == 'index.php' || trim((string) $_POST['frontpage_other']) == '{e_BASE}index.php'))
{
$_POST['frontpage'] = 'wmessage';
$_POST['frontpage_other'] = '';
@@ -160,8 +160,8 @@
foreach ($_POST as $k => $v)
{
- $incDec = substr($k, 0, 6);
- $idNum = substr($k, 6);
+ $incDec = substr((string) $k, 0, 6);
+ $idNum = substr((string) $k, 6);
if ($incDec == 'fp_inc')
{
$mv = intval($idNum);
@@ -217,7 +217,7 @@
if($_POST['frontpage'] == 'other')
{
- $_POST['frontpage_other'] = trim($tp->toForm($_POST['frontpage_other']));
+ $_POST['frontpage_other'] = trim((string) $tp->toForm($_POST['frontpage_other']));
$frontpage_value = $_POST['frontpage_other'] ? $_POST['frontpage_other'] : 'news.php';
}
else
@@ -234,7 +234,7 @@
if($_POST['fp_force_page'] == 'other')
{
- $_POST['fp_force_page_other'] = trim($tp->toForm($_POST['fp_force_page_other']));
+ $_POST['fp_force_page_other'] = trim((string) $tp->toForm($_POST['fp_force_page_other']));
$forcepage_value = $_POST['fp_force_page_other']; // A null value is allowable here
}
else
@@ -249,7 +249,7 @@
}
}
- $temp = array('order' => intval($_POST['fp_order']), 'class' => $_POST['class'], 'page' => $frontpage_value, 'force' => trim($forcepage_value));
+ $temp = array('order' => intval($_POST['fp_order']), 'class' => $_POST['class'], 'page' => $frontpage_value, 'force' => trim((string) $forcepage_value));
if($temp['order'] == 0) // New index to add
{
diff --git a/e107_admin/header.php b/e107_admin/header.php
index e1566aefdd..f6b4a6e2bb 100644
--- a/e107_admin/header.php
+++ b/e107_admin/header.php
@@ -208,9 +208,9 @@ function loadJSAddons()
// possibility to overwrite some CSS definition according to TEXTDIRECTION
// especially usefull for rtl.css
// see _blank theme for examples
-if(defined('TEXTDIRECTION') && file_exists(THEME . '/' . strtolower(TEXTDIRECTION) . '.css'))
+if(defined('TEXTDIRECTION') && file_exists(THEME . '/' . strtolower((string) TEXTDIRECTION) . '.css'))
{
- $e_js->themeCSS(strtolower(TEXTDIRECTION) . '.css');
+ $e_js->themeCSS(strtolower((string) TEXTDIRECTION) . '.css');
}
diff --git a/e107_admin/history.php b/e107_admin/history.php
index 1667e0af18..761696cad1 100644
--- a/e107_admin/history.php
+++ b/e107_admin/history.php
@@ -54,7 +54,7 @@ class history_adminArea extends e_admin_dispatcher
class admin_history_ui extends e_admin_ui
{
-
+
protected $pluginTitle = 'History';
protected $pluginName = 'myplugin';
// protected $eventName = 'myplugin-admin_history'; // remove comment to enable event triggers in admin.
@@ -66,11 +66,11 @@ class admin_history_ui extends e_admin_ui
protected $batchCopy = false;
// protected $tabs = array('tab1'=>'Tab 1', 'tab2'=>'Tab 2'); // Use 'tab'=>'tab1' OR 'tab'=>'tab2' in the $fields below to enable.
-
+
// protected $listQry = "SELECT * FROM `#tableName` WHERE field != '' "; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit.
-
+
protected $listOrder = 'history_id DESC';
-
+
protected $fields = array (
'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => 'value', 'class' => 'center', 'toggle' => 'e-multiselect', 'readParms' => [], 'writeParms' => [],),
// 'history_id' => array ( 'title' => LAN_ID, 'type' => 'number', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => [], 'writeParms' => [], 'class' => 'left', 'thclass' => 'left',),
@@ -84,15 +84,15 @@ class admin_history_ui extends e_admin_ui
'options' => array ( 'title' => LAN_OPTIONS, 'type' => 'method', 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => 'value', 'readParms' => [], 'writeParms' => [],),
);
-
+
protected $fieldpref = array( 'history_datestamp', 'history_table', 'history_record_id','history_action', 'history_data', 'history_user_id', 'history_restored');
-
+
// protected $preftabs = array('General', 'Other' );
protected $prefs = array(
);
-
+
public function init()
{
$this->fields['history_action']['writeParms']['optArray'] = [
@@ -134,7 +134,7 @@ private function processRestoreAction($id, $action)
if ($historyRow)
{
$originalTable = $historyRow['history_table']; // The table where this record belongs
- $originalData = json_decode($historyRow['history_data'], true);
+ $originalData = json_decode((string) $historyRow['history_data'], true);
$pid = $historyRow['history_pid'];
$recordId = $historyRow['history_record_id'];
@@ -190,34 +190,34 @@ private function processRestoreAction($id, $action)
// ------- Customize Create --------
-
+
public function beforeCreate($new_data,$old_data)
{
return $new_data;
}
-
-
+
+
// left-panel help menu area. (replaces e_help.php used in old plugins)
public function renderHelp()
{
$caption = LAN_HELP;
$text = "
This page allows you to view the history of changes made to records in the system and restore records to a previous state when needed.
-
+
Features of this page:
View Changes: See details of updates and deletions, including who made the changes and when.
Revert Changes: Restore a record to its earlier version, undoing accidental or undesired modifications.
Audit Trail: Track all actions performed on records for accountability and transparency.
-
+
Use the filters to narrow down the history logs or locate specific changes. If a record can be restored, an option will be available in the Options menu.
";
return ['caption' => $caption, 'text' => $text];
}
-
+
/*
// optional - a custom page.
public function customPage()
@@ -253,10 +253,10 @@ public function customPage()
$text .= $frm->close();
return $text;
-
+
}
-
-
+
+
// Handle batch options as defined in admin_history_form_ui::history_data; 'handle' + action + field + 'Batch'
// @important $fields['history_data']['batch'] must be true for this method to be detected.
// @param $selected
@@ -283,7 +283,7 @@ function handleListHistoryDataBatch($selected, $type)
}
-
+
// Handle filter options as defined in admin_history_form_ui::history_data; 'handle' + action + field + 'Filter'
// @important $fields['history_data']['filter'] must be true for this method to be detected.
// @param $selected
@@ -292,7 +292,7 @@ function handleListHistoryDataFilter($type)
{
$this->listOrder = 'history_data ASC';
-
+
switch($type)
{
case 'customfilter_1':
@@ -309,9 +309,9 @@ function handleListHistoryDataFilter($type)
}
-
-
-
+
+
+
*/
}
diff --git a/e107_admin/image.php b/e107_admin/image.php
index 6fa357cd39..6cff713e7e 100644
--- a/e107_admin/image.php
+++ b/e107_admin/image.php
@@ -341,16 +341,16 @@ function options($parms, $value, $id)
{
return;
}
-
+
$owner = $this->getController()->getListModel()->get('media_cat_owner');
if(!in_array($owner,$this->restrictedOwners))
{
return $this->renderValue('options',$value,null,$id);
}
-
-
-
+
+
+
// $save = ($_GET['bbcode']!='file') ? "e-dialog-save" : "";
// e-dialog-close
@@ -386,8 +386,8 @@ function init()
}
-
-
+
+
if(!empty($_POST['multiselect']) && varset($_POST['e__execute_batch']) && (varset($_POST['etrigger_batch']) == 'options__resize_2048' ))
{
$type = str_replace('options__','',$_POST['etrigger_batch']);
@@ -408,22 +408,22 @@ function init()
$ids = implode(",", e107::getParser()->filter($_POST['multiselect'],'int'));
$this->convertImagesToJpeg($ids,'all');
}*/
-
+
}
-
+
function resize_method($curval)
{
$frm = e107::getForm();
-
+
$options = array(
'gd1' => 'gd1',
'gd2' => 'gd2',
'ImageMagick' => 'ImageMagick'
);
-
+
return $frm->selectbox('resize_method',$options,$curval)."".IMALAN_4. '
';
}
-
+
public function rotateImages($ids,$type)
{
$sql = e107::getDb();
@@ -431,13 +431,13 @@ public function rotateImages($ids,$type)
$mes = e107::getMessage();
ini_set('memory_limit', '150M');
ini_set('gd.jpeg_ignore_warning', 1);
-
+
$degrees = ($type === 'rotate_cw') ? 270 : 90;
-
+
// $mes->addDebug("Rotate Mode Set: ".$type);
-
+
//TODO GIF and PNG rotation.
-
+
if($sql->select('core_media', 'media_url', 'media_id IN (' .$ids.") AND media_type = 'image/jpeg' "))
{
while($row = $sql->fetch())
@@ -445,9 +445,9 @@ public function rotateImages($ids,$type)
$original = $tp->replaceConstants($row['media_url']);
$mes->addDebug("Attempting to rotate by {$degrees} degrees: ".basename($original));
-
+
$source = imagecreatefromjpeg($original);
-
+
try
{
$rotate = imagerotate($source, $degrees, 0);
@@ -457,10 +457,10 @@ public function rotateImages($ids,$type)
$mes->addError(LAN_IMA_002. ': ' .basename($original));
return null;
}
-
+
$srch = array('.jpg', '.jpeg');
$cacheFile = str_replace($srch, '',strtolower(basename($original)))."_(.*)\.cache\.bin";
-
+
try
{
imagejpeg($rotate,$original,80);
@@ -498,17 +498,17 @@ public function resizeImage($oldpath,$w,$h)
public function resizeImages($ids,$type)
{
-
+
$sql = e107::getDb();
$sql2 = e107::getDb('sql2');
$mes = e107::getMessage();
$tp = e107::getParser();
$fl = e107::getFile();
-
+
// Max size is 6 megapixel.
$img_import_w = 2816;
$img_import_h = 2112;
-
+
if($sql->select('core_media', 'media_id,media_url', 'media_id IN (' .$ids.") AND media_type = 'image/jpeg' "))
{
while($row = $sql->fetch())
@@ -516,10 +516,10 @@ public function resizeImages($ids,$type)
$path = $tp->replaceConstants($row['media_url']);
$mes->addDebug('Attempting to resize: ' .basename($path));
-
+
if($this->resizeImage($path,$img_import_w,$img_import_h))
{
-
+
$info = $fl->getFileInfo($path);
$mes->addSuccess(LAN_IMA_004. ': ' .basename($path));
$mes->addSuccess(print_a($info,true));
@@ -532,9 +532,9 @@ public function resizeImages($ids,$type)
}
}
}
-
-
-
+
+
+
}
public function convertImagesToJpeg($ids,$mode=null)
@@ -585,15 +585,15 @@ public function convertImagesToJpeg($ids,$mode=null)
}
-
-
+
+
public function resize_dimensions($curval) // ie. never manually resize another image again!
{
$text = '';
$pref = e107::getPref();
-
+
// $options = array(
// "news-image" => LAN_IMA_O_001,
// "news-bbcode" => LAN_IMA_O_002,
@@ -609,7 +609,7 @@ public function resize_dimensions($curval) // ie. never manually resize another
{
foreach($pref['e_imageresize'] as $k=>$val)
{
- $options[$k] = ucfirst($k). ' ' .defset('LAN_IMA_O_006');
+ $options[$k] = ucfirst((string) $k). ' ' .defset('LAN_IMA_O_006');
}
}
@@ -628,7 +628,7 @@ public function resize_dimensions($curval) // ie. never manually resize another
$title = ucwords(str_replace('-', ' ',$key));
$valW = !empty($curval[$key]['w']) ? $curval[$key]['w'] : 400;
$valH = !empty($curval[$key]['h']) ? $curval[$key]['h'] : 400;
-
+
$text .= " ".$title." ";
$text .= " ";
$text .= " ";
@@ -636,14 +636,14 @@ public function resize_dimensions($curval) // ie. never manually resize another
}
$text .= '
';
-
+
// $text .= " Warning: This feature is experimental.
";
-
+
return $text;
-
-
+
+
}
-
+
function options($parms, $value, $id)
{
@@ -664,12 +664,12 @@ function options($parms, $value, $id)
return $arr;
}
-
+
if($_GET['action'] === 'edit')
{
return null;
}
-
+
$tagid = vartrue($_GET['tagid']);
$tagid = e107::getParser()->filter($tagid);
$model = $this->getController()->getListModel();
@@ -677,12 +677,12 @@ function options($parms, $value, $id)
$title = $model->get('media_name');
$id = $model->get('media_id');
- $preview = basename($path);
-
+ $preview = basename((string) $path);
+
$bbcode = (vartrue($_GET['bbcode']) === 'file') ? 'file' : '';
// $save = ($_GET['bbcode']!='file') ? "e-dialog-save" : "";
// e-dialog-close
-
+
$for = (string) $this->getController()->getQuery('for');
@@ -713,7 +713,7 @@ function options($parms, $value, $id)
$att = ['query' => e_QUERY."&after=".$action];
$url = $this->media_sef('', 'read', ['url'=>1]);
- $modal = (strpos($type, 'application') === false) ? 'e-modal' : '';
+ $modal = (strpos((string) $type, 'application') === false) ? 'e-modal' : '';
if($action === 'grid')
{
@@ -737,15 +737,15 @@ function options($parms, $value, $id)
}
return "".$text. '
';
-
+
}
private function getMediaType()
{
- list($type,$extra) = explode('/',$this->getController()->getFieldVar('media_type'));
+ list($type,$extra) = explode('/',(string) $this->getController()->getFieldVar('media_type'));
$category = $this->getController()->getFieldVar('media_category');
- if(strpos($category, '_icon') === 0)
+ if(strpos((string) $category, '_icon') === 0)
{
$type = 'icon';
}
@@ -821,9 +821,9 @@ function media_sef($curVal, $mode, $attributes, $id=null)
/*
function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
{
-
+
$curVal = explode(",",$curVal);
-
+
if($mode == 'read')
{
return $this->getController()->getMediaCategory($curVal);
@@ -843,7 +843,7 @@ function media_category($curVal,$mode) // not really necessary since we can use
$text = "";
$cats = $this->getController()->getMediaCategory();
-
+
foreach($cats as $key => $val)
{
$selected = (in_array($key,$curVal)) ? "selected='selected'" : "";
@@ -1215,7 +1215,7 @@ function init()
/** Wildcard support for media-type filter */
function handleGridMediaTypeFilter($var)
{
- if(strpos($var,'%') !== false)
+ if(strpos((string) $var,'%') !== false)
{
return "m.media_type LIKE '".$var."'";
}
@@ -1287,7 +1287,7 @@ function navPage() // no functioning correctly - see e_AJAX_REQUEST above.
public function ListAjaxObserver()
{
$cat = $this->getQuery('for');
- $file = (preg_match('/_file(_[\d]{1,2})?$/',$cat)) ? true : false;
+ $file = (preg_match('/_file(_[\d]{1,2})?$/',(string) $cat)) ? true : false;
if($file === true) // Make sure dialog mode is used when ajax searches occur.
{
@@ -1375,7 +1375,7 @@ function dialogPage() // Popup dialogPage for Image Selection.
$cat = $this->getQuery('for');
- $file = (preg_match('/_file(_[\d]{1,2})?$/',$cat)) ? true : false;
+ $file = (preg_match('/_file(_[\d]{1,2})?$/',(string) $cat)) ? true : false;
$mes = e107::getMessage();
$mes->addDebug('For:' .$cat);
$mes->addDebug('Bbcode: ' .$this->getQuery('bbcode'));
@@ -1512,7 +1512,7 @@ private function mediaManagerTabs()
$cat = $this->getQuery('for');
- $cat = urldecode($cat);
+ $cat = urldecode((string) $cat);
$tabOptions = array(
'core-media-icon' => array('caption'=> $tp->toGlyph('fa-file-photo-o').IMALAN_72, 'method' => 'iconTab' ),
@@ -1941,7 +1941,7 @@ private function iconTab($cat, $option=array())
'saveValue' => $val['media_url'],
'thumbUrl' => $val['media_url'],
'title' => $val['media_name'],
- 'tooltip' => basename($val['media_url']). ' (' .$val['media_dimensions']. ')',
+ 'tooltip' => basename((string) $val['media_url']). ' (' .$val['media_dimensions']. ')',
'slideCaption' => '',
'slideCategory' => 'bootstrap',
'mime' => $val['media_type']
@@ -1959,7 +1959,7 @@ private function iconTab($cat, $option=array())
{
foreach($items as $v)
{
- if(strpos($v['title'], $option['search'])!==false)
+ if(strpos((string) $v['title'], (string) $option['search'])!==false)
{
$filtered[] = $v;
}
@@ -2025,7 +2025,7 @@ private function imageTab2($category,$option=array())
'saveValue' => $val['media_url'],
'thumbUrl' => $tp->thumbUrl($val['media_url'], array('w'=>340, 'h'=>220)),
'title' => $val['media_name'],
- 'tooltip' => basename($val['media_url']). ' (' .$val['media_dimensions']. ')',
+ 'tooltip' => basename((string) $val['media_url']). ' (' .$val['media_dimensions']. ')',
'slideCaption' => '',
'slideCategory' => 'bootstrap',
'mime' => $val['media_type'],
@@ -2042,7 +2042,7 @@ private function imageTab2($category,$option=array())
{
foreach($items as $v)
{
- if(strpos($v['title'], $option['search'])!==false)
+ if(strpos((string) $v['title'], (string) $option['search'])!==false)
{
$filtered[] = $v;
}
@@ -2117,7 +2117,7 @@ private function audioTab($cat='', $parm=array())
{
foreach($items as $v)
{
- if(strpos($v['title'], $parm['search'])!==false)
+ if(strpos((string) $v['title'], (string) $parm['search'])!==false)
{
$filtered[] = $v;
}
@@ -2167,7 +2167,7 @@ private function videoTab($cat='', $parm=array())
'saveValue' => $val['media_url'],
'thumbUrl' => $val['media_url'],
'title' => $val['media_name'],
- 'tooltip' => basename($val['media_url']). ' (' .$size. ')',
+ 'tooltip' => basename((string) $val['media_url']). ' (' .$size. ')',
'slideCaption' => '',
'slideCategory' => 'bootstrap',
'mime' => $val['media_type'],
@@ -2184,7 +2184,7 @@ private function videoTab($cat='', $parm=array())
{
foreach($items as $v)
{
- if(strpos($v['title'], $parm['search'])!==false)
+ if(strpos((string) $v['title'], (string) $parm['search'])!==false)
{
$filtered[] = $v;
}
@@ -2337,7 +2337,7 @@ private function glyphTab($cat='', $parm=array())
'saveValue' => $val.'.glyph',
'thumbUrl' => $val,
'title' => $val,
- 'slideCaption' => ucfirst($glyphConfig['name']),
+ 'slideCaption' => ucfirst((string) $glyphConfig['name']),
'slideCategory' => $glyphConfig['name']
);
@@ -2365,7 +2365,7 @@ private function glyphTab($cat='', $parm=array())
{
foreach($items as $v)
{
- if(strpos($v['title'], $parm['search'])!==false)
+ if(strpos((string) $v['title'], (string) $parm['search'])!==false)
{
$v['slideCaption'] = '';
$filtered[] = $v;
@@ -2423,7 +2423,7 @@ private function youtubeTab($parm='')
$searchQry = $this->getQuery('search');
- if(strpos($searchQry, 'url:') === 0)
+ if(strpos((string) $searchQry, 'url:') === 0)
{
$searchQry = $this->getYouTubeCode($searchQry);
@@ -2431,9 +2431,9 @@ private function youtubeTab($parm='')
if(!empty($searchQry)) // -- Search Active.
{
- if(strpos($searchQry, 'video:') === 0 || strpos($searchQry, 'v=') === 0) // YouTube video code
+ if(strpos((string) $searchQry, 'video:') === 0 || strpos((string) $searchQry, 'v=') === 0) // YouTube video code
{
- $searchQry = (strpos($searchQry, 'v=') === 0) ? trim(substr($searchQry,2)) : trim(substr($searchQry,6));
+ $searchQry = (strpos((string) $searchQry, 'v=') === 0) ? trim(substr((string) $searchQry,2)) : trim(substr((string) $searchQry,6));
$extension = 'youtube';
// $feed = "https://www.googleapis.com/youtube/v3/videos?part=snippet&id=".urlencode($searchQry)."&key=".$apiKey;
@@ -2442,12 +2442,12 @@ private function youtubeTab($parm='')
$data['items'][0]['snippet']['thumbnails']['medium']['url'] = 'https://i.ytimg.com/vi/' .$searchQry. '/mqdefault.jpg';
$data['items'][0]['snippet']['title'] = 'Specified Video';
}
- elseif(strpos($searchQry, 'playlist:') === 0) // playlist
+ elseif(strpos((string) $searchQry, 'playlist:') === 0) // playlist
{
if(empty($apiKey))
{
- $playlistID = substr($searchQry,9);
+ $playlistID = substr((string) $searchQry,9);
$data = array();
$data['items'][0]['id']['videoId'] = $playlistID;
$data['items'][0]['snippet']['thumbnails']['medium']['url'] = e_IMAGE_ABS. 'generic/playlist_120.png'; // "http://i.ytimg.com/vi/".$playlistID."/mqdefault.jpg"; // not really possible, so it will show a generic grey image.
@@ -2455,21 +2455,21 @@ private function youtubeTab($parm='')
}
else
{
- $searchQry = trim(substr($searchQry,9));
+ $searchQry = trim(substr((string) $searchQry,9));
$feed = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q=' .urlencode($searchQry). '&type=playlist&maxResults=1&key=' .$apiKey;
}
$extension = 'youtubepl';
}
- elseif(strpos($searchQry, 'channel:') === 0)
+ elseif(strpos((string) $searchQry, 'channel:') === 0)
{
- $searchQry = trim(substr($searchQry,8));
+ $searchQry = trim(substr((string) $searchQry,8));
$extension = 'youtube';
$feed = 'https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=' .urlencode($searchQry). '&type=video&maxResults=20&key=' .$apiKey;
}
else
{
- $feed = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q=' .urlencode($searchQry). '&type=video&maxResults=20&key=' .$apiKey;
+ $feed = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q=' .urlencode((string) $searchQry). '&type=video&maxResults=20&key=' .$apiKey;
$extension = 'youtube';
}
@@ -2615,7 +2615,7 @@ function processUploadUrl($import = false, $cat='_common')
if(!empty($_POST['upload_remote_url']))
{
- $fileName = basename($_POST['upload_url']);
+ $fileName = basename((string) $_POST['upload_url']);
if(strpos($fileName,'?')!==false)
{
@@ -2662,7 +2662,7 @@ function settingsPage()
$sql = e107::getDb();
$ns = e107::getRender();
$mes = e107::getMessage();
-
+
if(function_exists('gd_info'))
{
$gd_info = gd_info();
@@ -2676,11 +2676,11 @@ function settingsPage()
$folder1 = e107::getFolder('imagemagick');
if($pref['resize_method'] === 'ImageMagick' && (!vartrue($folder1)))
{
-
+
$mes->addWarning('Please add: $IMAGEMAGICK_DIRECTORY="'.$pref['im_path'].'"; to your e107_config.php file');
}
-
-
+
+
//$IM_NOTE = "";
$folder = e107::getFolder('imagemagick');
$im_path = vartrue($folder);
@@ -2696,19 +2696,19 @@ function settingsPage()
{
$cmd = "{$im_file} -version";
$tmp = `$cmd`;
- if(strpos($tmp, 'ImageMagick') === FALSE)
+ if(strpos((string) $tmp, 'ImageMagick') === FALSE)
{
//$IM_NOTE = "".IMALAN_53." ";
$mes->addWarning(IMALAN_53);
}
}
}
-
-
-
-
-
+
+
+
+
+
$text = "
-
+
' .IMALAN_12. '
@@ -2752,9 +2752,9 @@ function settingsPage()
".IMALAN_13. '
';
-
- list($img_import_w,$img_import_h) = explode('x',$pref['img_import_resize']);
-
+
+ list($img_import_w,$img_import_h) = explode('x',(string) $pref['img_import_resize']);
+
$text .= '
' .IMALAN_105."".IMALAN_106. '
@@ -2762,7 +2762,7 @@ function settingsPage()
' .$frm->text('img_import_resize_w', $img_import_w,4). 'px X ' .$frm->text('img_import_resize_h', $img_import_h,4). 'px
-
+
' .IMALAN_3."".IMALAN_54." {$gd_version}
@@ -2784,11 +2784,11 @@ function settingsPage()
".IMALAN_6."
";
-
+
// Removed as IE6 should no longer be supported. A 3rd-party plugin can be made for this functionality if really needed.
-
-
-
+
+
+
$text .= "
".IMALAN_34."
@@ -2800,12 +2800,12 @@ function settingsPage()
";
-
+
*/
-
-
+
+
$text .= '
-
+
' .IMALAN_36. '
@@ -2819,7 +2819,7 @@ function settingsPage()
';
-
+
echo $mes->render().$text;
return;
// $ns->tablerender(LAN_MEDIAMANAGER." :: ".IMALAN_7, $mes->render().$text);
@@ -2841,7 +2841,7 @@ function avatarPageDeleteChecked()
foreach ($actions as $todel)
{
- list($usr,$path) = explode('#', $todel);
+ list($usr,$path) = explode('#', (string) $todel);
// $path = basename($path);
@@ -3240,9 +3240,9 @@ function observeUploaded($new_data)
return FALSE;
}
- $fname = basename($new_data['media_url']);
+ $fname = basename((string) $new_data['media_url']);
// move to the required place
- if(strpos($new_data['media_url'], '{e_IMPORT}') !== FALSE)
+ if(strpos((string) $new_data['media_url'], '{e_IMPORT}') !== FALSE)
// if(strpos($new_data['media_url'], '{e_MEDIA}temp/') !== FALSE)
{
$tp = e107::getParser();
@@ -3263,7 +3263,7 @@ function observeUploaded($new_data)
if(!varset($new_data['media_name']))
{
- $img_data['media_name'] = basename($new_data['media_url']);
+ $img_data['media_name'] = basename((string) $new_data['media_url']);
}
@@ -3466,7 +3466,7 @@ function batchImportForm()
$this->cats['_avatars_public'] = IMALAN_178;
$this->cats['_avatars_private'] = IMALAN_179;
- if(!isset($_POST['batch_category']) && strpos($lastMime, 'image') === 0)
+ if(!isset($_POST['batch_category']) && strpos((string) $lastMime, 'image') === 0)
{
$_POST['batch_category'] = '_common_image';
}
@@ -3501,10 +3501,10 @@ function batchImportForm()
// Check for matching XML file name and if found, return data from it during import.
function getFileXml($imgFile)
{
- list($file,$ext) = explode('.',$imgFile);
-
+ list($file,$ext) = explode('.',(string) $imgFile);
+
$xmlFile = e_IMPORT.$file. '.xml';
-
+
if(is_readable($xmlFile))
{
$data = file_get_contents($xmlFile);
@@ -3512,7 +3512,7 @@ function getFileXml($imgFile)
preg_match("/email=(?:'|\")([^'\"]*)/i",$data,$authorEmail);
preg_match("/(.*)<\/title>/i",$data,$title);
preg_match("/(.*)<\/description>/i",$data,$diz);
-
+
return array(
'title' => $title[1],
'description' => $diz[1],
@@ -3520,18 +3520,18 @@ function getFileXml($imgFile)
'authorEmail' => $authorEmail[1]
);
}
-
+
$srch = array('_', '-');
$description = str_replace($srch, ' ',$file);
-
+
$file = utf8_encode($file);
$description = utf8_encode($description);
-
+
return array('title'=>basename($file),'description'=>$description,'authorName'=>USERNAME,'authorEmail'=>'');
-
+
/*
Example: matchingfilename.xml (ie. same name as jpg|.gif|.png etc)
-
+
-
@@ -3550,7 +3550,7 @@ function getFileXml($imgFile)
function deleteFileXml($imgFile)
{
- list($file,$ext) = explode('.',$imgFile);
+ list($file,$ext) = explode('.',(string) $imgFile);
$xmlFile = e_IMPORT.$file. '.xml';
@@ -3567,7 +3567,7 @@ function batchDelete()
foreach($_POST['batch_selected'] as $key=>$file)
{
- if(trim($file) == '')
+ if(trim((string) $file) == '')
{
continue;
}
@@ -3704,7 +3704,7 @@ function batchImport()
function preview($f)
{
- list($type,$tmp) = explode('/',$f['mime']);
+ list($type,$tmp) = explode('/',(string) $f['mime']);
if($type === 'image')
{
@@ -3756,7 +3756,7 @@ function updateSettings()
$tmp = array();
$tmp['image_post'] = (int) $_POST['image_post'];
$tmp['resize_method'] = $tp->toDB($_POST['resize_method']);
- $tmp['im_path'] = trim($tp->toDB($_POST['im_path']));
+ $tmp['im_path'] = trim((string) $tp->toDB($_POST['im_path']));
$tmp['image_post_class'] = (int) $_POST['image_post_class'];
$tmp['image_post_disabled_method'] = (int) $_POST['image_post_disabled_method'];
$tmp['enable_png_image_fix'] = (int) $_POST['enable_png_image_fix'];
@@ -3881,7 +3881,7 @@ function updateSettings()
if (vartrue($search_users[$uid]))
{
$avname = avatar($search_users[$uid]['user_image']);
- if (strpos($avname, 'http://') === FALSE)
+ if (strpos((string) $avname, 'http://') === FALSE)
{ // Internal file, so unlink it
@unlink($avname);
}
@@ -3960,7 +3960,7 @@ function updateSettings()
{
//Check size
$avname=avatar($row['user_image']);
- if (strpos($avname, 'http://')!==FALSE)
+ if (strpos((string) $avname, 'http://')!==FALSE)
{
$iAVexternal++;
$bAVext=TRUE;
diff --git a/e107_admin/includes/flexpanel.php b/e107_admin/includes/flexpanel.php
index a7df9d7db6..aaf3883703 100644
--- a/e107_admin/includes/flexpanel.php
+++ b/e107_admin/includes/flexpanel.php
@@ -629,7 +629,7 @@ function renderLayoutPicker()
$files = $fl->get_files(e_ADMIN . 'includes/layouts/', "flexpanel_(.*).php", "standard", 1);
foreach($files as $num => $val)
{
- $filename = basename($val['fname']);
+ $filename = basename((string) $val['fname']);
$layout = str_replace('flexpanel_', '', $filename);
$layout = str_replace('.php', '', $layout);
diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php
index 60982eebba..b87dad044b 100755
--- a/e107_admin/includes/infopanel.php
+++ b/e107_admin/includes/infopanel.php
@@ -24,9 +24,9 @@
class adminstyle_infopanel
{
-
+
private $iconlist = array();
-
+
function __construct()
{
@@ -45,13 +45,13 @@ function __construct()
$coreUpdateCheck = "
$('#e-admin-core-update').html('
');
$.get('".e_ADMIN."admin.php?mode=core&type=update', function( data ) {
-
+
var res = $.parseJSON(data);
-
+
if(res === true)
{
$('#e-admin-core-update').html(' ');
-
+
$('[data-toggle=\"popover\"]').popover('show');
$('.popover').on('click', function()
{
@@ -63,9 +63,9 @@ function __construct()
// Hide li element.
$('#e-admin-core-update').parent().hide();
}
-
+
});
-
+
";
}
@@ -85,10 +85,10 @@ function __construct()
$('#e-adminfeed').load('".e_ADMIN."admin.php?mode=core&type=feed');
$('#e-adminfeed-plugin').load('".e_ADMIN."admin.php?mode=addons&type=plugin');
$('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme');
-
+
".$coreUpdateCheck."
".$addonUpdateCheck."
-
+
});
";
@@ -98,9 +98,9 @@ function __construct()
-
+
e107::js('inline',$code,'jquery');
-
+
if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
{
$this->savePref('core-infopanel-mye107', $_POST['e-mye107']);
@@ -171,7 +171,7 @@ function getIconList()
{
return $this->iconlist;
}
-
+
function render()
{
$tp = e107::getParser();
@@ -180,8 +180,8 @@ function render()
$mes = e107::getMessage();
$pref = e107::getPref();
$frm = e107::getForm();
-
-
+
+
// XXX Check Bootstrap bug is fixed.
/*
echo '
@@ -231,15 +231,15 @@ function render()
{
$user_pref['core-infopanel-mye107'] = e107::getNav()->getDefaultAdminPanelArray();
}
-
+
// "
";
-
+
// print_a($_SESSION['lancheck'][$lan]);
$plug_text = ($plug_text) ? $plug_header.$plug_text.$plug_footer : "".LAN_OK."
";
$theme_text = ($theme_text) ? $theme_header.$theme_text.$theme_footer : "".LAN_OK."
";
$mesStatus = ($_SESSION['lancheck'][$lan]['total']>0) ? E_MESSAGE_INFO : E_MESSAGE_SUCCESS;
-
+
$mes->add($message, $mesStatus);
-
+
// $ns -> tablerender(LAN_SUMMARY.": ".$lan,$message);
@@ -1151,11 +1151,11 @@ function write_lanfile($lan='')
{
$notdef_start = "";
$notdef_end = "\n";
- $deflang = (MAGIC_QUOTES_GPC === TRUE) ? stripslashes($_POST['newlang'][$i]) : $_POST['newlang'][$i];
+ $deflang = (MAGIC_QUOTES_GPC === TRUE) ? stripslashes((string) $_POST['newlang'][$i]) : $_POST['newlang'][$i];
$func = "define";
$quote = chr(34);
- if (strpos($_POST['newdef'][$i],"ndef++") !== FALSE )
+ if (strpos((string) $_POST['newdef'][$i],"ndef++") !== FALSE )
{
$defvar = str_replace("ndef++","",$_POST['newdef'][$i]);
$notdef_start = "if (!defined(".chr(34).$defvar.chr(34).")) {";
@@ -1173,12 +1173,12 @@ function write_lanfile($lan='')
if($_POST['newdef'][$i] == "LC_ALL" && vartrue($_SESSION['lancheck-edit-file']))
{
- $message .= $notdef_start.'setlocale('.htmlentities($defvar).','.$deflang.'); '.$notdef_end;
+ $message .= $notdef_start.'setlocale('.htmlentities((string) $defvar).','.$deflang.'); '.$notdef_end;
$input .= $notdef_start."setlocale(".$defvar.",".$deflang.");".$notdef_end;
}
else
{
- $message .= $notdef_start.$func.'('.$quote.htmlentities($defvar).$quote.',"'.$deflang.'"); '.$notdef_end;
+ $message .= $notdef_start.$func.'('.$quote.htmlentities((string) $defvar).$quote.',"'.$deflang.'"); '.$notdef_end;
$input .= $notdef_start.$func."(".$quote.$defvar.$quote.", ".chr(34).$deflang.chr(34).");".$notdef_end;
}
}
@@ -1355,7 +1355,7 @@ function check_lan_errors($english,$translation,$def, $opts=array())
$error = array();
$warning = array();
- if((is_array($translation) && !array_key_exists($def,$translation) && $eng_line != "") || (trim($trans_line) == "" && $eng_line != ""))
+ if((is_array($translation) && !array_key_exists($def,$translation) && $eng_line != "") || (trim((string) $trans_line) == "" && $eng_line != ""))
{
$this->checkLog('def',1);
return $def.": ".LAN_CHECK_5." ";
@@ -1366,33 +1366,33 @@ function check_lan_errors($english,$translation,$def, $opts=array())
$warning[] = "".$def. ": ".LAN_CHECK_29." ";
}
- if((strpos($eng_line,"[link=")!==FALSE && strpos($trans_line,"[link=")===FALSE) || (strpos($eng_line,"[b]")!==FALSE && strpos($trans_line,"[b]")===FALSE))
+ if((strpos((string) $eng_line,"[link=")!==FALSE && strpos((string) $trans_line,"[link=")===FALSE) || (strpos((string) $eng_line,"[b]")!==FALSE && strpos((string) $trans_line,"[b]")===FALSE))
{
$error[] = $def. ": ".LAN_CHECK_30;
}
- elseif((strpos($eng_line,"[")!==FALSE && strpos($trans_line,"[")===FALSE) || (strpos($eng_line,"]")!==FALSE && strpos($trans_line, "]")===FALSE))
+ elseif((strpos((string) $eng_line,"[")!==FALSE && strpos((string) $trans_line,"[")===FALSE) || (strpos((string) $eng_line,"]")!==FALSE && strpos((string) $trans_line, "]")===FALSE))
{
$error[] = $def. ": ".LAN_CHECK_31;
}
- if((strpos($eng_line,"--LINK--")!==false && strpos($trans_line,"--LINK--")===false))
+ if((strpos((string) $eng_line,"--LINK--")!==false && strpos((string) $trans_line,"--LINK--")===false))
{
$error[] = $def. ": Missing --LINK--";
}
- if((strpos($eng_line,"e107.org")!==false && strpos($trans_line,"e107.org")===false))
+ if((strpos((string) $eng_line,"e107.org")!==false && strpos((string) $trans_line,"e107.org")===false))
{
$error[] = $def. ": Missing e107.org URL";
}
- if((strpos($eng_line,"e107coders.org")!==FALSE && strpos($trans_line,"e107coders.org")===false))
+ if((strpos((string) $eng_line,"e107coders.org")!==FALSE && strpos((string) $trans_line,"e107coders.org")===false))
{
$error[] = $def. ": Missing e107coders.org URL";
}
- if(strip_tags($eng_line) != $eng_line)
+ if(strip_tags((string) $eng_line) != $eng_line)
{
- $stripped = strip_tags($trans_line);
+ $stripped = strip_tags((string) $trans_line);
if(($stripped == $trans_line))
{
@@ -1497,12 +1497,12 @@ function get_comp_lan_phrases($comp_dir,$lang,$depth=0)
- if(strpos($comp_dir,e_LANGUAGEDIR) !== false)
+ if(strpos((string) $comp_dir,e_LANGUAGEDIR) !== false)
{
$regexp = "#.php#";
$mode = 'core';
}
- elseif(strpos($comp_dir,e_THEME) !== false)
+ elseif(strpos((string) $comp_dir,e_THEME) !== false)
{
$regexp = "#".$lang."#";
$mode = 'themes';
@@ -1769,19 +1769,19 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null)
$dir1 = e_THEME.$dir1;
$dir2 = e_THEME.$dir2;
}
-
+
// $ns = e107::getRender();
$sql = e107::getDb();
-
+
/* echo " dir1 = $dir1";
echo " file1 = $f1";
-
+
echo " dir2 = $dir2";
echo " file2 = $f2";*/
-
-
-
+
+
+
if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English.php") // it's a language config file.
{
$f2 = $lan.".php";
@@ -1791,7 +1791,7 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null)
{
$root_file = $dir2.$f2;
}
-
+
if($dir2.$f2 == e_LANGUAGEDIR.$lan."/English_custom.php") // it's a language config file.
{
$f2 = $lan."_custom.php";
@@ -1810,7 +1810,7 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null)
$keys = array_keys($trans);
sort($keys);
-
+
$text = "";
-
+
$text .= "";
-
+
$capFile = str_replace("../","",$dir2.$f2);
$caption = LANG_LAN_21.SEP.$lan.SEP.LAN_CHECK_2.SEP.LAN_EDIT.SEP.$capFile;
@@ -1904,35 +1904,35 @@ function edit_lanfiles($dir1, $dir2, $f1, $f2, $lan, $type=null)
function fill_phrases_array($data,$type)
{
$retloc = array();
-
- if(preg_match_all('/(\/\*[\s\S]*?\*\/)/i',$data, $multiComment))
+
+ if(preg_match_all('/(\/\*[\s\S]*?\*\/)/i',(string) $data, $multiComment))
{
$data = str_replace($multiComment[1],'',$data); // strip multi-line comments.
}
-
- if(preg_match('/^\s*?setlocale\s*?\(\s*?([\w]+)\s*?,\s*?(.+)\s*?\)\s*?;/im',$data,$locale)) // check for setlocale();
+
+ if(preg_match('/^\s*?setlocale\s*?\(\s*?([\w]+)\s*?,\s*?(.+)\s*?\)\s*?;/im',(string) $data,$locale)) // check for setlocale();
{
$retloc[$type][$locale[1]]= $locale[2];
}
-
- if(preg_match_all('/^\s*?define\s*?\(\s*?(\'|\")([\w]+)(\'|\")\s*?,\s*?(\'|\")([\s\S]*?)\s*?(\'|\")\s*?\)\s*?;/imu',$data,$matches))
+
+ if(preg_match_all('/^\s*?define\s*?\(\s*?(\'|\")([\w]+)(\'|\")\s*?,\s*?(\'|\")([\s\S]*?)\s*?(\'|\")\s*?\)\s*?;/imu',(string) $data,$matches))
{
$def = $matches[2];
$values = $matches[5];
-
+
foreach($def as $k=>$d)
{
$retloc[$type][$d]= $values[$k];
}
}
-
+
return $retloc;
-
+
/*
echo "Raw Data ".$type." ";
echo htmlentities($data);
echo " ";
-
+
*/
}
@@ -1951,7 +1951,7 @@ function is_utf8($str) {
return TRUE;
}
- return (preg_match('/^./us',$str,$ar) == 1);
+ return (preg_match('/^./us',(string) $str,$ar) == 1);
}
diff --git a/e107_admin/language.php b/e107_admin/language.php
index 11122ecb20..64a6007cd4 100644
--- a/e107_admin/language.php
+++ b/e107_admin/language.php
@@ -271,7 +271,7 @@ private function renderLanguagePacks()
// if(is_readable(e_ADMIN."ver.php"))
{
// include(e_ADMIN."ver.php");
- list($ver, $tmp) = explode(" ", e_VERSION);
+ list($ver, $tmp) = explode(" ", (string) e_VERSION);
}
$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
@@ -438,7 +438,7 @@ private function renderOnlineLanguagePacks()
".$value['date']."
".$value['version'];
- if(strpos($value['tag'],'-') !==false)
+ if(strpos((string) $value['tag'],'-') !==false)
{
$text .= " ".LANG_LAN_153." ";
}
@@ -505,7 +505,7 @@ private function dbPageEditProcess()
// ----------------- delete tables ---------------------------------------------
if (isset($_POST['del_existing']) && $_POST['lang_choices'] && getperms('0'))
{
- $lang = strtolower($_POST['lang_choices']);
+ $lang = strtolower((string) $_POST['lang_choices']);
$_POST['lang_choices'] = e107::getParser()->filter($_POST['lang_choices'],'w');
@@ -543,7 +543,7 @@ private function dbPageEditProcess()
foreach ($tabs as $value)
{
- $lang = strtolower($_POST['language']);
+ $lang = strtolower((string) $_POST['language']);
if (isset($_POST[$value]))
{
$copdata = ($_POST['copydata_'.$value]) ? 1 : 0;
@@ -916,7 +916,7 @@ function __construct()
$mes->addError(LANG_LAN_136.$disUnusedLanFile);//Couldn't overwrite
}
- $ns->tablerender(LANG_LAN_137.SEP.$disUnusedLanFile,$mes->render()."".htmlentities($new)." ");//Processed
+ $ns->tablerender(LANG_LAN_137.SEP.$disUnusedLanFile,$mes->render()."".htmlentities((string) $new)." ");//Processed
}
@@ -940,17 +940,17 @@ function run()
foreach($script as $k=>$scr)
{
- if(strpos($scr,e_ADMIN)!==false) // CORE
+ if(strpos((string) $scr,e_ADMIN)!==false) // CORE
{
$mes->addDebug("Mode: Core Admin Calculated");
//$scriptname = str_replace("lan_","",basename($lanfile));
- $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".basename($scr);
+ $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".basename((string) $scr);
$this->adminFile = true;
}
else // Root
{
$mes->addDebug("Mode: Search Core Root lan calculated");
- $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/lan_".basename($scr);
+ $lanfile[$k] = e_LANGUAGEDIR.e_LANGUAGE."/lan_".basename((string) $scr);
$lanfile[$k] = str_replace("lan_install", "lan_installer", $lanfile[$k]); //quick fix.,
//$lanfile = $this->findIncludedFiles($script,vartrue($_POST['deprecatedLansReverse']));
@@ -1034,12 +1034,12 @@ function getDefined($line,$script=false)
return array('define'=>$line,'value'=>'-');
}
- if(preg_match("#\"(.*?)\".*?\"(.*)\"#",$line,$match) ||
- preg_match("#\'(.*?)\'.*?\"(.*)\"#",$line,$match) ||
- preg_match("#\"(.*?)\".*?\'(.*)\'#",$line,$match) ||
- preg_match("#\'(.*?)\'.*?\'(.*)\'#",$line,$match) ||
- preg_match("#\((.*?)\,.*?\"(.*)\"#",$line,$match) ||
- preg_match("#\((.*?)\,.*?\'(.*)\'#",$line,$match))
+ if(preg_match("#\"(.*?)\".*?\"(.*)\"#",(string) $line,$match) ||
+ preg_match("#\'(.*?)\'.*?\"(.*)\"#",(string) $line,$match) ||
+ preg_match("#\"(.*?)\".*?\'(.*)\'#",(string) $line,$match) ||
+ preg_match("#\'(.*?)\'.*?\'(.*)\'#",(string) $line,$match) ||
+ preg_match("#\((.*?)\,.*?\"(.*)\"#",(string) $line,$match) ||
+ preg_match("#\((.*?)\,.*?\'(.*)\'#",(string) $line,$match))
{
return array('define'=>$match[1],'value'=>$match[2]);
@@ -1106,7 +1106,7 @@ static function form()
foreach($lans as $script => $lan)
{
- if(in_array(basename($lan), $exclude))
+ if(in_array(basename((string) $lan), $exclude))
{
continue;
}
@@ -1121,7 +1121,7 @@ static function form()
foreach($root as $script => $lan)
{
- if(in_array(basename($lan), $exclude))
+ if(in_array(basename((string) $lan), $exclude))
{
continue;
}
@@ -1135,7 +1135,7 @@ static function form()
$text .= "";
foreach($templates as $script => $lan)
{
- if(in_array(basename($lan), $exclude))
+ if(in_array(basename((string) $lan), $exclude))
{
continue;
}
@@ -1148,7 +1148,7 @@ static function form()
$text .= "";
foreach($shortcodes as $script => $lan)
{
- if(in_array(basename($lan), $exclude))
+ if(in_array(basename((string) $lan), $exclude))
{
continue;
}
@@ -1182,7 +1182,7 @@ static function form()
asort($_SESSION['languageTools_lanFileList']);
foreach($_SESSION['languageTools_lanFileList'] as $val)
{
- if(strpos($val, e_SYSTEM) !== false)
+ if(strpos((string) $val, e_SYSTEM) !== false)
{
continue;
}
@@ -1250,7 +1250,7 @@ function isFound($needle, $haystack)
foreach($haystack as $file => $content)
{
$count = 1;
- $lines = explode("\n",$content);
+ $lines = explode("\n",(string) $content);
foreach($lines as $ln)
{
if(preg_match("/\b".$needle."\b/i",$ln, $mtch))
@@ -1290,9 +1290,9 @@ function compareit($needle,$haystack, $value='',$disabled=false, $reverse=false)
// Check if a common phrases was used.
foreach($ar as $def=>$common)
{
- similar_text($value, $common, $p);
+ similar_text((string) $value, (string) $common, $p);
- if(strtoupper(trim($value)) == strtoupper($common))
+ if(strtoupper(trim((string) $value)) == strtoupper((string) $common))
{
//$text .= "$common
";
@@ -1404,7 +1404,7 @@ function compareit($needle,$haystack, $value='',$disabled=false, $reverse=false)
// return "".$needle .$disabled. " ";
}
- elseif($foundSimilar && $found && substr($def,0,4) == "LAN_")
+ elseif($foundSimilar && $found && substr((string) $def,0,4) == "LAN_")
{
// $color = "background-color:#E9EAF2";
$label .= " ".round($p)."% like ".$def." ";
@@ -1644,12 +1644,12 @@ function findIncludedFiles($script,$reverse=false)
$reverse = false;
}
- $dir = dirname($script);
+ $dir = dirname((string) $script);
$dir = str_replace("/includes","",$dir);
$plugin = basename($dir);
- if(strpos($script,'admin')!==false || strpos($script,'includes')!==false) // Admin Language files.
+ if(strpos((string) $script,'admin')!==false || strpos((string) $script,'includes')!==false) // Admin Language files.
{
$newLangs = array(
diff --git a/e107_admin/links.php b/e107_admin/links.php
index 619f1f34b8..6ccfa1359a 100644
--- a/e107_admin/links.php
+++ b/e107_admin/links.php
@@ -585,9 +585,9 @@ function _tree_order($parent_id, $search, &$src, $level = 0, $modified = false)
function bcClean($link_name)
{
- if(substr($link_name, 0,8) == 'submenu.') // BC Fix.
+ if(substr((string) $link_name, 0,8) == 'submenu.') // BC Fix.
{
- list($tmp,$tmp2,$link) = explode('.', $link_name, 3);
+ list($tmp,$tmp2,$link) = explode('.', (string) $link_name, 3);
}
else
{
@@ -789,7 +789,7 @@ function link_sefurl($curVal,$mode)
foreach($config as $k=>$v)
{
- if($k == 'index' || (strpos($v['regex'],'(') === false)) // only provide urls without dynamic elements.
+ if($k == 'index' || (strpos((string) $v['regex'],'(') === false)) // only provide urls without dynamic elements.
{
$opts[] = $k;
}
@@ -809,7 +809,7 @@ function link_url($curVal,$mode)
$owner = $this->getController()->getListModel()->get('link_owner');
$sef = $this->getController()->getListModel()->get('link_sefurl');
- if($curVal[0] !== '{' && substr($curVal,0,4) != 'http' && $mode == 'link_id')
+ if($curVal[0] !== '{' && substr((string) $curVal,0,4) != 'http' && $mode == 'link_id')
{
$curVal = '{e_BASE}'.$curVal;
}
@@ -895,7 +895,7 @@ function _parent_select_array($parent_id, $search, &$src, $strpad = '  
foreach ($search[$parent_id] as $id => $title)
{
- $src[$id] = str_repeat($strpad, $level).($level != 0 ? '- ' : '').$title;
+ $src[$id] = str_repeat((string) $strpad, $level).($level != 0 ? '- ' : '').$title;
$this->_parent_select_array($id, $search, $src, $strpad, $level + 1);
}
}
diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php
index 5c2211f388..5607ea7f60 100644
--- a/e107_admin/mailout.php
+++ b/e107_admin/mailout.php
@@ -572,7 +572,7 @@ private function sendTestEmail()
$mes = e107::getMessage();
$pref = e107::getPref();
- if(trim($_POST['testaddress']) == '')
+ if(trim((string) $_POST['testaddress']) == '')
{
$mes->addError(LAN_MAILOUT_19);
return null;
@@ -583,7 +583,7 @@ private function sendTestEmail()
$pref['bulkmailer'] = $pref['mailer'];
}
- $add = ($pref['bulkmailer']) ? " (".strtoupper($pref['bulkmailer']).") " : ' (PHP)';
+ $add = ($pref['bulkmailer']) ? " (".strtoupper((string) $pref['bulkmailer']).") " : ' (PHP)';
if($pref['bulkmailer'] == 'smtp')
{
@@ -591,7 +591,7 @@ private function sendTestEmail()
$add .= " - ".str_replace("secure=", "", $pref['smtp_options']);
}
- $sendto = trim($_POST['testaddress']);
+ $sendto = trim((string) $_POST['testaddress']);
$subjectSitename = ($_POST['testtemplate'] == 'textonly') ? SITENAME : '';
@@ -798,7 +798,7 @@ function previewPage($id='', $user=null)
if(is_numeric($id))
{
$mailData = e107::getDb()->retrieve('mail_content','*','mail_source_id='.intval($id)." LIMIT 1");
-
+
$shortcodes = array(
'USERNAME' => 'John Example',
'DISPLAYNAME' => 'John Example',
@@ -813,7 +813,7 @@ function previewPage($id='', $user=null)
if(!empty($user))
{
$userData = e107::getDb()->retrieve('mail_recipients','*', 'mail_detail_id = '.intval($id).' AND mail_recipient_id = '.intval($user).' LIMIT 1');
- $shortcodes = e107::unserialize(stripslashes($userData['mail_target_info']));
+ $shortcodes = e107::unserialize(stripslashes((string) $userData['mail_target_info']));
}
if(!isset($shortcodes['MAILREF']))
@@ -821,9 +821,9 @@ function previewPage($id='', $user=null)
$shortcodes['MAILREF'] = intval($_GET['id']);
}
-
+
$data = $this->mailAdmin->dbToMail($mailData);
-
+
$eml = array(
'subject' => $data['mail_subject'],
'body' => $data['mail_body'],
@@ -831,7 +831,7 @@ function previewPage($id='', $user=null)
'shortcodes' => $shortcodes,
'media' => $data['mail_media'],
);
-
+
// return print_a($data,true);
}
else
@@ -926,7 +926,7 @@ private function processData($new_data)
$other['mail_selectors'] = $this->mailAdmin->getAllSelectors();
- $ret['mail_attach'] = trim($new_data['mail_attach']);
+ $ret['mail_attach'] = trim((string) $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.
@@ -1117,11 +1117,11 @@ function maintPage()
{
return;
}
-
+
$mes = e107::getMessage();
$ns = e107::getRender();
$frm = e107::getForm();
-
+
$text = "
";
return $text;
-
+
// return $ns->tablerender(ADLAN_136.SEP.ADLAN_40, $text, 'maint',true);
}
@@ -1156,7 +1156,7 @@ function prefsPage()
$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');
@@ -1166,7 +1166,7 @@ function prefsPage()
e107::getCache()->CachePageMD5 = '_';
$lastload = e107::getCache()->retrieve('emailLastBounce',FALSE,TRUE,TRUE);
$lastBounce = round((time() - $lastload) / 60);
-
+
$lastBounceText = ($lastBounce > 1256474) ? "Never " : "".$lastBounce . " minutes ago. ";
$text = "
@@ -1190,9 +1190,9 @@ function prefsPage()
".LAN_MAILOUT_77."
";
-
- $mail_enable = explode(',',vartrue($pref['mailout_enabled'],'core'));
-
+
+ $mail_enable = explode(',',(string) vartrue($pref['mailout_enabled'],'core'));
+
$coreCheck = (in_array('core',$mail_enable)) ? "checked='checked'" : "";
// $text .= $frm->checkbox('mail_mailer_enabled[]','core', $coreCheck, 'users');
@@ -1211,16 +1211,16 @@ function prefsPage()
$text .= "
-
-
+
+
".LAN_MAILOUT_115."
";
$text .= mailoutAdminClass::mailerPrefsTable($pref, 'bulkmailer');
-
-
+
+
/* FIXME - posting SENDMAIL path triggers Mod-Security rules.
// Sendmail. -------------->
$senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : '';
@@ -1232,7 +1232,7 @@ function prefsPage()
-
+
";
*/
@@ -1249,7 +1249,7 @@ function prefsPage()
\n
-
+
".LAN_MAILOUT_25."
".LAN_MAILOUT_26." ".$frm->number('mail_pause', $pref['mail_pause'])." ".LAN_MAILOUT_27." ".
@@ -1257,23 +1257,23 @@ function prefsPage()
".LAN_MAILOUT_30."
\n
-
+
".LAN_MAILOUT_156."
".$frm->number('mail_workpertick',varset($pref['mail_workpertick'],5))."".LAN_MAILOUT_157."
-
-
+
+
";
- list($mail_log_option,$mail_log_email) = explode(',',varset($pref['mail_log_options'],'0,0'));
-
+ list($mail_log_option,$mail_log_email) = explode(',',(string) 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 .= "
".LAN_MAILOUT_72."
@@ -1316,7 +1316,7 @@ function prefsPage()
".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;'" : '';
@@ -1340,20 +1340,20 @@ function prefsPage()
".LAN_EMAIL."
".$frm->text('mail_bounce_email2', $pref['mail_bounce_email'], 40, 'size=xlarge');
-
+
if(!empty($pref['mail_bounce_email']))
{
$text .= $frm->admin_button('send_bounce_test','Send Test','primary','Test');
}
-
+
$text .= "
-
+
".LAN_MAILOUT_233." ".(e_ROOT).e107::getFolder('handlers')."bounce_handler.php ";
-
+
$status = '';
-
+
if(!is_readable(e_HANDLER.'bounce_handler.php'))
{
$status = LAN_MAILOUT_161;
@@ -1363,17 +1363,17 @@ function prefsPage()
$status = LAN_MAILOUT_162;
}
-
+
if(!empty($status))
{
$text .= " ".$status." ";
}
-
-
-
+
+
+
$text .= "".LAN_MAILOUT_235."
-
-
+
+
".LAN_MAILOUT_236." ".$lastBounceText." ";
@@ -1392,14 +1392,14 @@ function prefsPage()
";
-
+
$bouncePrefs = array('mail_bounce_email'=>LAN_EMAIL, 'mail_bounce_pop3'=>LAN_MAILOUT_33, 'mail_bounce_user'=>LAN_MAILOUT_34, 'mail_bounce_pass'=>LAN_PASSWORD);
-
+
foreach($bouncePrefs as $key =>$label)
{
$text .= "".$label." ".$frm->text($key,$pref[$key],40,'size=xlarge')." ";
}
-
+
/*
$text .= "
".LAN_MAILOUT_32."
@@ -1408,7 +1408,7 @@ function prefsPage()
".LAN_PASSWORD."
";
*/
-
+
$text .= "
".LAN_MAILOUT_120." \n
\n
@@ -1470,7 +1470,7 @@ function saveMailPrefs(&$mes) // $emessage to $mes, working?
//$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))
+ if ((strpos((string) $_POST['sendmail'],'sendmail') !== FALSE) || (strpos((string) $_POST['sendmail'],'qmail') !== FALSE))
{
$temp['sendmail'] = $tp->toDB($_POST['sendmail']);
}
@@ -1480,13 +1480,13 @@ function saveMailPrefs(&$mes) // $emessage to $mes, working?
}
$temp['bulkmailer'] = $tp->filter($_POST['bulkmailer']);
- $temp['smtp_server'] = $tp->toDB(trim($_POST['smtp_server']));
- $temp['smtp_username'] = $tp->toDB(trim($_POST['smtp_username']));
- $temp['smtp_password'] = $tp->toDB(trim($_POST['smtp_password']));
+ $temp['smtp_server'] = $tp->toDB(trim((string) $_POST['smtp_server']));
+ $temp['smtp_username'] = $tp->toDB(trim((string) $_POST['smtp_username']));
+ $temp['smtp_password'] = $tp->toDB(trim((string) $_POST['smtp_password']));
$temp['smtp_port'] = intval($_POST['smtp_port']);
$smtp_opts = array();
- switch (trim($_POST['smtp_options']))
+ switch (trim((string) $_POST['smtp_options']))
{
case 'smtp_ssl' :
$smtp_opts[] = 'secure=SSL';
@@ -1571,7 +1571,7 @@ class mailout_admin_form_ui extends e_admin_form_ui
public function mail_selectors($curval, $mode)
{
- $val = stripslashes($this->getController()->getModel()->get('mail_other'));
+ $val = stripslashes((string) $this->getController()->getModel()->get('mail_other'));
$data = e107::unserialize($val);
switch($mode)
@@ -1599,7 +1599,7 @@ public function mail_selectors($curval, $mode)
public function mail_send_style($curVal, $mode)
{
- $val = stripslashes($this->getController()->getModel()->get('mail_other'));
+ $val = stripslashes((string) $this->getController()->getModel()->get('mail_other'));
$data = e107::unserialize($val);
switch($mode)
@@ -1629,13 +1629,13 @@ private function mailDetails($field, $mode)
switch($mode)
{
case 'read':
- $val = stripslashes($this->getController()->getListModel()->get('mail_other'));
+ $val = stripslashes((string) $this->getController()->getListModel()->get('mail_other'));
$data = e107::unserialize($val);
return $data[$field];
break;
case 'write':
- $val = stripslashes($this->getController()->getModel()->get('mail_other'));
+ $val = stripslashes((string) $this->getController()->getModel()->get('mail_other'));
$data = e107::unserialize($val);
if($field == 'mail_sender_name' && !vartrue($data['mail_sender_name']))
@@ -1685,14 +1685,14 @@ public function mail_attach($curVal,$mode)
{
if($mode == 'read')
{
- $val = stripslashes($this->getController()->getListModel()->get('mail_other'));
+ $val = stripslashes((string) $this->getController()->getListModel()->get('mail_other'));
$data = e107::unserialize($val);
- return basename($data['mail_attach']);
+ return basename((string) $data['mail_attach']);
}
if($mode == 'write')
{
- $val = stripslashes($this->getController()->getModel()->get('mail_other'));
+ $val = stripslashes((string) $this->getController()->getModel()->get('mail_other'));
$data = e107::unserialize($val);
return $this->filepicker('mail_attach',$data['mail_attach'], $mode);
}
diff --git a/e107_admin/menus.php b/e107_admin/menus.php
index b199e0ed0f..b1a6f9787d 100644
--- a/e107_admin/menus.php
+++ b/e107_admin/menus.php
@@ -11,7 +11,7 @@
if(isset($_GET['configure']))
{
//Switch to Front-end
- $_GET['configure'] = preg_replace('[^a-z0-9_-]','',$_GET['configure']);
+ $_GET['configure'] = preg_replace('[^a-z0-9_-]','',(string) $_GET['configure']);
define("USER_AREA", true);
define('ADMIN_AREA', false);
@@ -692,7 +692,7 @@ function e_help()
if(!empty($_GET['enc']))
{
- $string = base64_decode($_GET['enc']);
+ $string = base64_decode((string) $_GET['enc']);
parse_str($string,$_GET);
}
diff --git a/e107_admin/meta.php b/e107_admin/meta.php
index 7347298fe0..d0805e94cf 100644
--- a/e107_admin/meta.php
+++ b/e107_admin/meta.php
@@ -94,7 +94,7 @@ function save()
{
if(isset($_POST[$key]))
{
- $cfg->setPref($key . '/' . e_LANGUAGE, trim($_POST[$key]));
+ $cfg->setPref($key . '/' . e_LANGUAGE, trim((string) $_POST[$key]));
}
}
@@ -187,7 +187,7 @@ public function metaPage()
$text .= "
-
+
" .
@@ -214,7 +214,7 @@ public function metaPage()
function metaLabel($text, $small)
{
- $small = htmlentities($small);
+ $small = htmlentities((string) $small);
// $text = str_replace(['(', ')'], ['
', ' '], $text);
return e107::getParser()->lanVars($text, $small, true);
diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php
index e28e8180ca..02d6b44671 100644
--- a/e107_admin/newspost.php
+++ b/e107_admin/newspost.php
@@ -338,7 +338,7 @@ function submitnews_title($cur,$val)
if($submitnews_file)
{
- $tmp = explode(',',$submitnews_file);
+ $tmp = explode(',',(string) $submitnews_file);
$text .= "
";
@@ -550,7 +550,7 @@ public function beforeCreate($new_data, $old_data)
$this->checkSEFSimilarity($new_data);
- $tmp = explode(chr(35), $new_data['news_author']);
+ $tmp = explode(chr(35), (string) $new_data['news_author']);
$new_data['news_author'] = intval($tmp[0]);
if(E107_DBG_SQLQUERIES)
@@ -613,7 +613,7 @@ public function beforeUpdate($new_data, $old_data, $id)
if(!empty($new_data['news_author']))
{
- $tmp = explode(chr(35), $new_data['news_author']);
+ $tmp = explode(chr(35), (string) $new_data['news_author']);
$new_data['news_author'] = intval($tmp[0]);
}
@@ -640,7 +640,7 @@ private function checkSEFSimilarity($new_data)
$expectedSEF = eHelper::title2sef($new_data['news_title']);
- similar_text($expectedSEF,$new_data['news_sef'],$percSimilar);
+ similar_text($expectedSEF,(string) $new_data['news_sef'],$percSimilar);
if($percSimilar < 60)
{
@@ -718,7 +718,7 @@ public function afterUpdate($new_data, $old_data, $id)
// Trigger the news email notification trigger. (@see admin->notify )
private function triggerNotify($new_data)
{
- $visibility = explode(",", $new_data['news_class']);
+ $visibility = explode(",", (string) $new_data['news_class']);
if(in_array(e_UC_PUBLIC, $visibility))
{
@@ -941,8 +941,8 @@ function init()
// e107::getMessage()->addInfo($info);
-
-
+
+
$sql = e107::getDb();
$sql->gen("SELECT category_id,category_name FROM #news_category");
while($row = $sql->fetch())
@@ -1028,7 +1028,7 @@ function CreateObserver()
function beforePrefsSave($new_data, $old_data)
{
- $new_data['news_default_template'] = preg_replace('#[^\w\pL\-]#u', '', $new_data['news_default_template']);
+ $new_data['news_default_template'] = preg_replace('#[^\w\pL\-]#u', '', (string) $new_data['news_default_template']);
return $new_data;
}
@@ -1378,7 +1378,7 @@ private function processSubmittedMedia($data)
return false;
}
- $row = json_decode($data,true);
+ $row = json_decode((string) $data,true);
$text = '';
foreach($row as $k)
{
@@ -1643,13 +1643,13 @@ function news_body($curVal,$mode)
';
- $val = strpos($curVal, "[img]http") !== false ? $curVal : str_replace("[img]../", "[img]", $curVal);
+ $val = strpos((string) $curVal, "[img]http") !== false ? $curVal : str_replace("[img]../", "[img]", $curVal);
$text .= "
";
$text .= $frm->bbarea('news_body', $val, 'news', 'news');
$text .= "
";
$text .= "
";
- $val = (strpos($curValExt, "[img]http") !== false ? $curValExt : str_replace("[img]../", "[img]",$curValExt));
+ $val = (strpos((string) $curValExt, "[img]http") !== false ? $curValExt : str_replace("[img]../", "[img]",$curValExt));
$text .= $frm->bbarea('news_extended', $val, 'extended', 'news');
$text .= "
@@ -1668,9 +1668,9 @@ function news_thumbnail($curval,$mode)
if($mode == 'read')
{
- if(strpos($curval, ",")!==false)
+ if(strpos((string) $curval, ",")!==false)
{
- $tmp = explode(",",$curval);
+ $tmp = explode(",",(string) $curval);
$curval = $tmp[0];
}
@@ -1694,7 +1694,7 @@ function news_thumbnail($curval,$mode)
$url = e107::getParser()->thumbUrl($curval,'aw=80');
$link = e107::getParser()->replaceConstants($curval);
- return "
";
+ return "
";
}
@@ -1704,7 +1704,7 @@ function news_thumbnail($curval,$mode)
if(!empty($_GET['sub']))
{
- $thumbTmp = explode(",",$curval);
+ $thumbTmp = explode(",",(string) $curval);
foreach($thumbTmp as $key=>$path)
{
$url = ($path[0] == '{') ? $path : e_TEMP.$path;
@@ -1718,7 +1718,7 @@ function news_thumbnail($curval,$mode)
$frm = e107::getForm();
// $text .= $frm->imagepicker('news_thumbnail[0]', $curval ,'','media=news&video=1');
- $thumbTmp = explode(",",$curval);
+ $thumbTmp = explode(",",(string) $curval);
$text = "
';
$this->perPage = 180;
@@ -1403,13 +1403,13 @@ function options($data)
private function truncateSentence($string, $limit = 120 )
{
- if(strlen($string) <= $limit)
+ if(strlen((string) $string) <= $limit)
{
- $text = nl2br($string);
+ $text = nl2br((string) $string);
return $string;
}
- $tmp = explode(".", $string);
+ $tmp = explode(".", (string) $string);
$chars = 0;
@@ -1451,7 +1451,7 @@ private function setPlugData()
if($filter = $this->getQuery('filter_options'))
{
- list($bla, $cat) = explode("__",$filter);
+ list($bla, $cat) = explode("__",(string) $filter);
}
@@ -1486,13 +1486,13 @@ private function setPlugData()
'plugin_id' => $row['params']['id'],
'plugin_mode' => $row['params']['mode'],
'plugin_icon' => vartrue($row['icon'], e_IMAGE."logo_template.png"),
- 'plugin_name' => stripslashes($row['name']),
+ 'plugin_name' => stripslashes((string) $row['name']),
'plugin_description' => $this->truncateSentence(vartrue($row['description'])),
'plugin_featured' => $featured,
'plugin_sef' => '',
'plugin_folder' => $row['folder'],
'plugin_path' => $row['folder'],
- 'plugin_date' => $tp->toDate(strtotime($row['date']), 'relative'),
+ 'plugin_date' => $tp->toDate(strtotime((string) $row['date']), 'relative'),
'plugin_category' => vartrue($row['category'], 'n/a'),
'plugin_author' => vartrue($row['author']),
'plugin_version' => $row['version'],
@@ -1539,7 +1539,7 @@ public function listoldPage()
//TODO use admin_ui including filter capabilities by sending search queries back to the xml script.
$from = isset($_GET['frm']) ? intval($_GET['frm']) : 0;
- $srch = preg_replace('/[^\w]/', '', vartrue($_GET['srch']));
+ $srch = preg_replace('/[^\w]/', '', (string) vartrue($_GET['srch']));
$mp = $this->getMarketplace();
@@ -1589,7 +1589,7 @@ public function listoldPage()
'plugin_id' => $row['params']['id'],
'plugin_mode' => $row['params']['mode'],
'plugin_icon' => vartrue($row['icon'], 'e-plugins-32'),
- 'plugin_name' => stripslashes($row['name']),
+ 'plugin_name' => stripslashes((string) $row['name']),
'plugin_featured' => $featured,
'plugin_sef' => '',
'plugin_folder' => $row['folder'],
@@ -1598,7 +1598,7 @@ public function listoldPage()
'plugin_category' => vartrue($row['category'], 'n/a'),
'plugin_author' => vartrue($row['author']),
'plugin_version' => $row['version'],
- 'plugin_description' => nl2br(vartrue($row['description'])),
+ 'plugin_description' => nl2br((string) vartrue($row['description'])),
'plugin_compatible' => $badge,
'plugin_website' => vartrue($row['authorUrl']),
@@ -1946,7 +1946,7 @@ function step2($path)
foreach($files as $v)
{
- if(strpos($v['path'],'English')!==false OR strpos($v['fname'],'English')!==false)
+ if(strpos((string) $v['path'],'English')!==false OR strpos((string) $v['fname'],'English')!==false)
{
$path = $v['path'].$v['fname'];
$this->lanFiles[] = $path;
@@ -1981,7 +1981,7 @@ function findSimilar($data)
if($this->useSimilar == true)
{
- similar_text($v['value'], $data['value'], $percentSimilar);
+ similar_text((string) $v['value'], (string) $data['value'], $percentSimilar);
}
else
{
@@ -1990,7 +1990,7 @@ function findSimilar($data)
if((($v['value'] == $data['value'] || $percentSimilar > 89) && $data['file'] != $v['file']))
{
- if(strpos($v['lan'],'LAN')===false) // Defined constants that don't contain 'LAN'.
+ if(strpos((string) $v['lan'],'LAN')===false) // Defined constants that don't contain 'LAN'.
{
$v['status'] = 2;
}
@@ -2101,7 +2101,7 @@ function shortPath($path,$mode='lan')
$text = str_replace(e_PLUGIN.$this->plugin.'/languages/','',$path);
- if(strpos($path,'_front.php')===false && strpos($path,'_admin.php')===false && strpos($path,'_global.php')===false && strpos($path,'_menu.php')===false && strpos($path,'_notify.php')===false && strpos($path,'_search.php')===false)
+ if(strpos((string) $path,'_front.php')===false && strpos((string) $path,'_admin.php')===false && strpos((string) $path,'_global.php')===false && strpos((string) $path,'_menu.php')===false && strpos((string) $path,'_notify.php')===false && strpos((string) $path,'_search.php')===false)
{
return "
".$text." ";
}
@@ -2209,13 +2209,13 @@ function renderResults()
foreach($this->unused as $k=>$v)
{
- if(strpos($v,'LAN')===false)
+ if(strpos((string) $v,'LAN')===false)
{
unset($this->unused[$k]);
$this->unsure[$k] = $v;
}
- if(strpos($this->lanDefsData[$k]['file'],$this->plugin) === false || in_array($v,$this->excludeLans))
+ if(strpos((string) $this->lanDefsData[$k]['file'],$this->plugin) === false || in_array($v,$this->excludeLans))
{
unset($this->unused[$k]);
unset($this->unsure[$k]);
@@ -2311,7 +2311,7 @@ function scanLanFile($path)
}
- $type = basename($path);
+ $type = basename((string) $path);
if(preg_match_all('/^\s*?define\s*?\(\s*?(\'|\")([\w]+)(\'|\")\s*?,\s*?(\'|\")([\s\S]*?)\s*?(\'|\")\s*?\)\s*?;/im',$data,$matches))
{
diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php
index e2b115b0dd..bd4bdebeac 100644
--- a/e107_admin/prefs.php
+++ b/e107_admin/prefs.php
@@ -66,8 +66,8 @@
{
sendTest();
}
-
-
+
+
@@ -75,17 +75,17 @@
/* UPDATE PREFERENCES */
if(isset($_POST['updateprefs']))
{
-
-
-
+
+
+
unset($_POST['updateprefs'], $_POST['sitelanguage']);
-
+
$_POST['cookie_name'] = str_replace(array(" ", "."), "_", $_POST['cookie_name']);
$_POST['cookie_name'] = preg_replace("#[^a-zA-Z0-9_]#", "", $_POST['cookie_name']);
- $_POST['siteurl'] = trim($_POST['siteurl']) ? trim($_POST['siteurl']) : SITEURL;
+ $_POST['siteurl'] = trim((string) $_POST['siteurl']) ? trim((string) $_POST['siteurl']) : SITEURL;
$_POST['siteurl'] = substr($_POST['siteurl'], - 1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/";
// If email verification or Email/Password Login Method - email address is required!
@@ -120,7 +120,7 @@
if(!empty($_POST['smtp_options']))
{
- switch (trim($_POST['smtp_options']))
+ switch (trim((string) $_POST['smtp_options']))
{
case 'smtp_ssl' :
$smtp_opts[] = 'secure=SSL';
@@ -153,8 +153,8 @@
-
- $_POST['membersonly_exceptions'] = explode("\n",$_POST['membersonly_exceptions']);
+
+ $_POST['membersonly_exceptions'] = explode("\n",(string) $_POST['membersonly_exceptions']);
// FIXME - automate - pref model & validation handler
$prefChanges = array();
@@ -185,7 +185,7 @@
elseif('cookie_name' == $key && $core_pref->get($key) != $value)
{
// special case
- if(!preg_match('/^[\w\-]+$/', $value))
+ if(!preg_match('/^[\w\-]+$/', (string) $value))
{
$newValue = e_COOKIE;
$mes->addWarning(PRFLAN_219);
@@ -200,7 +200,7 @@
{
$newValue = $tp->toDB($value);
}
-
+
$core_pref->update($key, $newValue);
}
@@ -223,7 +223,7 @@
// reset cookie
cookie($core_pref->get('cookie_name'), $_COOKIE[e_COOKIE], (time() + 3600 * 24 * 30), e_HTTP, e107::getLanguage()->getCookieDomain());
cookie(e_COOKIE, null, null);
-
+
// regenerate session
$s = $_SESSION;
e107::getSession()->destroy();
@@ -267,8 +267,8 @@ function sendTest()
{
$log = e107::getLog();
$mes = e107::getMessage();
-
- if(trim($_POST['testaddress']) == '')
+
+ if(trim((string) $_POST['testaddress']) == '')
{
$mes->add(LAN_MAILOUT_19, E_MESSAGE_ERROR);
$subAction = 'error';
@@ -278,7 +278,7 @@ function sendTest()
$mailheader_e107id = USERID;
$pref = e107::pref();
- $add = ($pref['mailer']) ? " (".strtoupper($pref['mailer']).") " : ' (PHP)';
+ $add = ($pref['mailer']) ? " (".strtoupper((string) $pref['mailer']).") " : ' (PHP)';
if($pref['mailer'] == 'smtp')
{
@@ -287,11 +287,11 @@ function sendTest()
}
- $sendto = trim($_POST['testaddress']);
-
-
+ $sendto = trim((string) $_POST['testaddress']);
+
+
$eml = array();
-
+
$eml['email_subject'] = LAN_MAILOUT_113." ".$add;
$eml['email_sender_email'] = null;
$eml['email_sender_name'] = null;
@@ -402,7 +402,7 @@ function sendTest()
$sLogo = siteinfo_shortcodes::sc_logo();
*/
-if(!empty($pref['sitebutton']) && strpos($pref['sitebutton'],'{')===false && file_exists(e_IMAGE.$pref['sitebutton']))
+if(!empty($pref['sitebutton']) && strpos((string) $pref['sitebutton'],'{')===false && file_exists(e_IMAGE.$pref['sitebutton']))
{
$pref['sitebutton'] = '{e_IMAGE}'.$pref['sitebutton'];
}
@@ -430,7 +430,7 @@ function sendTest()
".$frm->textarea('sitedescription', $tp->toForm($pref['sitedescription']), 3, 80, array('size'=>'xxlarge'))."
-
+
".PRFLAN_9." ".$frm->help(PRFLAN_229)."
@@ -478,15 +478,15 @@ function sendTest()
".$frm->text('replyto_email', $pref['replyto_email'], 100, array('size'=>'xlarge'))."
-
-
+
+
".LAN_MAILOUT_110."
".$frm->admin_button('testemail', LAN_MAILOUT_112,'other')."
-
+
".PRFLAN_267."
";
@@ -497,12 +497,12 @@ function sendTest()
$text .="
-
-
+
+
".LAN_MAILOUT_222."
";
-
+
$emFormat = array(
'textonly' => LAN_MAILOUT_125,
'texthtml' => LAN_MAILOUT_126,
@@ -512,7 +512,7 @@ function sendTest()
$text .= "
-
+
".PRFLAN_162." ".$frm->help(PRFLAN_163)."
@@ -758,17 +758,17 @@ function sendTest()
".$frm->radio_switch('admin_helptip', varset($pref['admin_helptip']))."
-
+
".PRFLAN_287."
".$e_userclass->uc_dropdown('admin_navbar_debug', $pref['admin_navbar_debug'], 'nobody,main,admin,classes,no-excludes', "tabindex='".$frm->getNext()."'")."
-
+
-
-
-
+
+
+
".pref_submit('admindisp')."
@@ -814,9 +814,9 @@ function sendTest()
".$frm->text('forumdate', $pref['forumdate'], 50)."
";
-
-
-
+
+
+
$def = strtotime('December 21, 2012 3:45pm');
$inputdate = e107::getDate()->dateFormats($def);
@@ -827,9 +827,9 @@ function sendTest()
".PRFLAN_230."
".$frm->select('inputdate',$inputdate, e107::getPref('inputdate'));
-
+
$text .= $frm->select('inputtime',$inputtime, e107::getPref('inputtime'));
-
+
$text .= "
";
@@ -898,7 +898,7 @@ function sendTest()
$text .= "
-
+
".PRFLAN_184."
".$frm->select_open('allowEmailLogin', array('size'=>'xlarge'));
@@ -950,7 +950,7 @@ function sendTest()
-
+
".PRFLAN_197." ".$frm->help(PRFLAN_198)."
@@ -984,21 +984,21 @@ function sendTest()
-
+
-
+
".pref_submit('registration')."
";
-
+
// Key registration
-
-
+
+
// Signup options ===========================.
@@ -1040,7 +1040,7 @@ function sendTest()
";
-
+
$signup_option_names = array(
// "signup_option_loginname" => "Login Name",
@@ -1069,8 +1069,8 @@ function sendTest()
";
}
-
-
+
+
$text .= "
@@ -1223,16 +1223,16 @@ function sendTest()
".$frm->radio_switch('make_clickable', $pref['make_clickable'])."
";
-
-
+
+
$text .= "
".PRFLAN_102."?:
".$frm->help(PRFLAN_103)."
-
+
".$frm->radio_switch('link_replace', $pref['link_replace'])."
@@ -1243,21 +1243,21 @@ function sendTest()
Emails ".$frm->help(PRFLAN_108)." ".$frm->text('email_text', $tp->post_toForm($pref['email_text']), 200, 'size=block-level&placeholder='.PRFLAN_107)."
-
-
+
+
-
+
".PRFLAN_145."?: ".$frm->help(PRFLAN_146)."
".$frm->radio_switch('links_new_window', $pref['links_new_window'])."
-
+
-
-
+
+
".PRFLAN_40." ".$frm->help(PRFLAN_41)."
@@ -1277,8 +1277,8 @@ function sendTest()
".$frm->tags('profanity_words', $pref['profanity_words'], 250, array('maxItems'=>1000))."
-
-
+
+
".PRFLAN_109.": ".$frm->help(PRFLAN_110)."
@@ -1329,8 +1329,8 @@ function sendTest()
".$frm->radio_switch('wysiwyg', $pref['wysiwyg'])."
-
-
+
+
";
if(file_exists(e_PLUGIN."geshi/geshi.php"))
@@ -1407,12 +1407,12 @@ function multi_radio($name, $textsVals, $currentval = '')
// Secure Image/ Captcha
$secureImage = array('signcode'=>PRFLAN_76, 'logcode'=>PRFLAN_81, "fpwcode"=>PRFLAN_138,'admincode'=>PRFLAN_222);
-
+
foreach($secureImage as $key=>$label)
{
-
+
$label = str_replace($srch,$repl,$label);
-
+
$text .= "
".$label." ".$frm->help(PRFLAN_223)."";
if($hasGD)
{
@@ -1422,17 +1422,17 @@ function multi_radio($name, $textsVals, $currentval = '')
{
$text .= PRFLAN_133;
}
-
+
$text .= "
\n";
-
+
}
/*
-
+
$text .= "
".PRFLAN_81.":
@@ -1467,7 +1467,7 @@ function multi_radio($name, $textsVals, $currentval = '')
";
*
-
+
*/
$text .= "
@@ -1485,8 +1485,8 @@ function multi_radio($name, $textsVals, $currentval = '')
".$frm->radio('user_tracking', array('cookie' => PRFLAN_49, 'session' => PRFLAN_50), varset($pref['user_tracking']))."
-
-
+
+
".PRFLAN_55." ".$frm->help(PRFLAN_263)."
".$frm->text('cookie_name', varset($pref['cookie_name']), 20)."
@@ -1511,7 +1511,7 @@ function multi_radio($name, $textsVals, $currentval = '')
".PRFLAN_282."
".$frm->select('session_save_method', [ 'db'=>'Database', 'files'=>'Files'], varset($pref['session_save_method']))."
-
+
";
@@ -1544,9 +1544,9 @@ function multi_radio($name, $textsVals, $currentval = '')
";
-
+
$CHAP_list = array(PRFLAN_180, PRFLAN_181, PRFLAN_182);
-
+
$text .= "
".PRFLAN_178." ".
$frm->help(PRFLAN_183." ".PRFLAN_179)."
@@ -1555,12 +1555,12 @@ function multi_radio($name, $textsVals, $currentval = '')
$CHAPopt = !empty($pref['ssl_enabled']) || !empty($pref['passwordEncoding']) ? array('disabled'=>1) : null;
$text .= $frm->select('password_CHAP',$CHAP_list,$pref['password_CHAP'], $CHAPopt );
//." ".$frm->select_open('password_CHAP');
-
+
//TODO - user tracking session name - visible only if Cookie is enabled (JS)
$text .= "
-
+
".PRFLAN_35."
@@ -1595,14 +1595,14 @@ function multi_radio($name, $textsVals, $currentval = '')
$text .= "
-
+
".PRFLAN_231." ".$frm->help(PRFLAN_232)."
".$frm->number('failed_login_limit', varset($pref['failed_login_limit'],10), 3, array('max'=>10, 'min'=>0))."
-
+
@@ -1650,14 +1650,14 @@ function multi_radio($name, $textsVals, $currentval = '')
".$frm->radio_switch('nested_comments', $pref['nested_comments'], LAN_YES, LAN_NO)."
-
+
".PRFLAN_90.":
".$frm->radio_switch('allowCommentEdit', $pref['allowCommentEdit'], LAN_YES, LAN_NO)."
-
+
".PRFLAN_166.":
@@ -1669,7 +1669,7 @@ function multi_radio($name, $textsVals, $currentval = '')
".PRFLAN_233." ".$frm->help(PRFLAN_234)."
".
-
+
$frm->uc_select('comments_moderate', $pref['comments_moderate'],"nobody,guest,new,bots,public,member,admin,main,classes").
"
@@ -1677,16 +1677,16 @@ function multi_radio($name, $textsVals, $currentval = '')
".PRFLAN_235."
";
-
+
$comment_sort = array(
"desc" => PRFLAN_236, //default
'asc' => PRFLAN_237
);
-
+
$text .= $frm->select('comments_sort',$comment_sort, $pref['comments_sort'], array('size'=>'xlarge'))."
-
+
@@ -1710,37 +1710,37 @@ function multi_radio($name, $textsVals, $currentval = '')
".pref_submit('comments')."
";
-
+
// File Uploads
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_upload.php");
require_once(e_HANDLER."upload_handler.php");
-
-
-
-
-
-
+
+
+
+
+
+
$text .= "
".PRFLAN_53.defset('SEP').PRFLAN_238." ";
-
-
+
+
$upload_max_filesize = ini_get('upload_max_filesize');
$post_max_size = ini_get('post_max_size');
-
+
$maxINI = min($upload_max_filesize,$post_max_size);
-
+
if($maxINI < $pref['upload_maxfilesize'])
{
$text .= "";
$text .= PRFLAN_239." ".$maxINI."
";
$pref['upload_maxfilesize'] = $maxINI;
}
-
-
-
-
+
+
+
+
$text .= "
";
*/
$text .= "
".PRFLAN_241." ".str_replace("../",'',e_SYSTEM).e_READ_FILETYPES."
-
-
+
+
".pref_submit('uploads');
-
-
-
+
+
+
$text .= "
";
@@ -2185,7 +2185,7 @@ function prefs_adminmenu()
$var['core-prefs-signup']['text'] = PRFLAN_19;
$var['core-prefs-signup']['image_src'] = 'fas-clipboard-list.glyph';
-
+
$var['core-prefs-comments']['text'] = PRFLAN_210;
$var['core-prefs-comments']['image_src'] = 'fa-comments.glyph';
diff --git a/e107_admin/theme.php b/e107_admin/theme.php
index bbde48cf50..317af7388c 100644
--- a/e107_admin/theme.php
+++ b/e107_admin/theme.php
@@ -44,7 +44,7 @@
e107::js('footer-inline', "
$('textarea').suggest(':', {
data: function(q, lookup) {
-
+
$.getJSON('theme.php', {q : q }, function(data) {
console.log(data);
console.log(lookup);
@@ -54,7 +54,7 @@
// we aren't returning any
}
-
+
});
@@ -64,9 +64,9 @@
e107::js('footer-inline', "
$('textarea.input-custompages').suggest(':', {
-
+
data: function() {
-
+
var i = $.ajax({
type: 'GET',
url: 'theme.php',
@@ -78,7 +78,7 @@
// console.log(data);
return data;
}).responseText;
-
+
try
{
var d = $.parseJSON(i);
@@ -88,7 +88,7 @@
// Not JSON.
return;
}
-
+
return d;
},
filter: {
@@ -203,7 +203,7 @@ function handleAjax()
case 'info':
if(!empty($_GET['src']))
{
- $string = base64_decode($_GET['src']);
+ $string = base64_decode((string) $_GET['src']);
parse_str($string,$p);
$themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id']));
echo $themec->renderThemeInfo($themeInfo);
@@ -488,7 +488,7 @@ public function OnlineObserver()
$this->perPage = 500;
}
-
+
public function ChooseAjaxObserver()
{
$this->ChooseObserver();
@@ -648,7 +648,7 @@ public function InfoPage()
if(!empty($_GET['src'])) // online mode.
{
- $string = base64_decode($_GET['src']);
+ $string = base64_decode((string) $_GET['src']);
parse_str($string,$p);
$themeInfo = e107::getSession()->get('thememanager/online/'.intval($p['id']));
return $this->themeObj->renderThemeInfo($themeInfo);
@@ -677,7 +677,7 @@ public function DownloadPage()
$frm = e107::getForm();
$mes = e107::getMessage();
- $string = base64_decode($_GET['src']);
+ $string = base64_decode((string) $_GET['src']);
parse_str($string, $data);
if(!empty($data['price']))
@@ -786,7 +786,7 @@ private function containsErrors($code)
foreach($dep as $test)
{
- if(strpos($code, $test) !== false)
+ if(strpos((string) $code, $test) !== false)
{
e107::getMessage()->addDebug("Incompatible function
".rtrim($test,"(")." found in theme.php");
return true;
@@ -879,7 +879,7 @@ private function setThemeData($force=false)
if($filter = $this->getQuery('filter_options'))
{
- list($bla, $cat) = explode("__",$filter);
+ list($bla, $cat) = explode("__",(string) $filter);
}
$limit = 96;
@@ -909,7 +909,7 @@ private function setThemeData($force=false)
'id' => $r['params']['id'],
'type' => 'theme',
'mode' => $r['params']['mode'],
- 'name' => stripslashes($r['name']),
+ 'name' => stripslashes((string) $r['name']),
'category' => $r['category'],
'preview' => varset($r['screenshots']['image']),
'date' => $r['date'],
@@ -1004,7 +1004,7 @@ function loadBatch($force=false)
foreach($themeList as $k=>$v)
{
- if(!empty($parms['searchqry']) && stripos($v['info'],$parms['searchqry']) === false && stripos($v['folder'],$parms['searchqry']) === false && stripos($v['name'],$parms['searchqry']) === false)
+ if(!empty($parms['searchqry']) && stripos((string) $v['info'],(string) $parms['searchqry']) === false && stripos((string) $v['folder'],(string) $parms['searchqry']) === false && stripos((string) $v['name'],(string) $parms['searchqry']) === false)
{
continue;
}
@@ -1228,7 +1228,7 @@ private function onlineOptions($theme)
return $main_icon.$info_icon.$preview_icon;
}
-
+
}
@@ -1404,7 +1404,7 @@ function step2()
if($this->themeSrc) // New theme copied from another
{
$defaults = array(
- "main-name" => ucfirst($this->themeName),
+ "main-name" => ucfirst((string) $this->themeName),
'category-category' => vartrue($info['category']),
);
}
@@ -1489,7 +1489,7 @@ function step2()
$text .= "
"
.$frm->hidden('newtheme', $this->themeName);
- $text .= $frm->hidden('xml[custompages]', trim(vartrue($leg['CUSTOMPAGES'])))
+ $text .= $frm->hidden('xml[custompages]', trim((string) vartrue($leg['CUSTOMPAGES'])))
.$frm->admin_button('step', 3,'other',LAN_GENERATE)."
";
@@ -1601,7 +1601,7 @@ function createXml($data)
if(!empty($newArray['CUSTOMPAGES']))
{
- $newArray['CUSTOMPAGES'] = trim($newArray['CUSTOMPAGES']);
+ $newArray['CUSTOMPAGES'] = trim((string) $newArray['CUSTOMPAGES']);
$LAYOUTS = "\n
\n";
$LAYOUTS .= " {CUSTOMPAGES} \n";
$LAYOUTS .= " ";
@@ -1685,7 +1685,7 @@ function createXml($data)
function xmlInput($name, $info, $default='')
{
$frm = e107::getForm();
- list($cat,$type) = explode("-",$info);
+ list($cat,$type) = explode("-",(string) $info);
$size = 30;
$help = '';
@@ -1710,7 +1710,7 @@ function xmlInput($name, $info, $default='')
case 'main-date':
$help = TPVLAN_CONV_6;
$required = true;
- $default = (empty($default)) ? time() : strtotime($default);
+ $default = (empty($default)) ? time() : strtotime((string) $default);
break;
case 'main-version':
diff --git a/e107_admin/ugflag.php b/e107_admin/ugflag.php
index 094f9a0499..db47514f61 100644
--- a/e107_admin/ugflag.php
+++ b/e107_admin/ugflag.php
@@ -39,14 +39,14 @@
$pref['maintainance_text'] = $temp;
$changed = TRUE;
}
-
+
$temp = intval($_POST['main_admin_only']);
if(getperms('0') && $pref['main_admin_only'] != $temp)
{
$pref['main_admin_only'] = $temp;
$changed = TRUE;
}
-
+
if($changed)
{
e107::getLog()->add(($pref['maintainance_flag'] == 0) ? 'MAINT_02' : 'MAINT_01', $pref['maintainance_text'], E_LOG_INFORMATIVE, '');
@@ -59,7 +59,7 @@
}
$pref = e107::getConfig('core', true, true)->getPref();
-
+
}
@@ -75,14 +75,14 @@
";
-
+
$elements = array(
e_UC_PUBLIC => LAN_DISABLED,
e_UC_MEMBER => ADLAN_110,
e_UC_ADMIN => UGFLAN_8,
e_UC_MAINADMIN => UGFLAN_9
);
-
+
$text .= "
".UGFLAN_2.":
@@ -151,7 +151,7 @@ function headerjs()
";
-
+
return $ret;
}
diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php
index 085f128b74..29d941b22d 100644
--- a/e107_admin/update_routines.php
+++ b/e107_admin/update_routines.php
@@ -87,7 +87,7 @@
$fname = e_PLUGIN.$path.'/'.$path.'_update_check.php'; // DEPRECATED - left for BC only.
if (is_readable($fname)) include_once($fname);
}
-
+
$fname = e_PLUGIN.$path.'/'.$path.'_setup.php';
if (is_readable($fname))
{
@@ -103,7 +103,7 @@
{
$dbupdate['test_code'] = 'Test update routine';
}
-
+
// set 'master' to true to prevent other upgrades from running before it is complete.
$LAN_UPDATE_4 = deftrue('LAN_UPDATE_4',"Update from [x] to [y]"); // in case language-pack hasn't been upgraded.
@@ -115,7 +115,7 @@
$dbupdate['706_to_800'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('1.x','2.0')), 'message'=> LAN_UPDATE_29, 'hide_when_complete'=>true);
$dbupdate['20x_to_latest'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('2.x', $e107info['e107_version'])), 'message'=> null, 'hide_when_complete'=>false);
-
+
// always run these last.
@@ -398,7 +398,7 @@ function update_check()
$update_needed = true;
break;
}
- elseif(strpos($func, 'core_') !==0) // skip the pref and table check.
+ elseif(strpos((string) $func, 'core_') !==0) // skip the pref and table check.
{
$dbUpdatesPref[$func] = 1;
@@ -429,7 +429,7 @@ function update_check()
{
$update_needed = TRUE;
}
-
+
// $e107cache->set_sys('nq_admin_updatecheck', time().','.($update_needed ? '2,' : '1,').$e107info['e107_version'], TRUE);
}
@@ -1254,7 +1254,7 @@ function update_706_to_800($type='')
{ // Check for table - might add some core plugin tables in here
if ($field_info = ($sql->db_Field($t, $f, '', TRUE)))
{
- if (strtolower($field_info['Type']) != 'varchar(45)')
+ if (strtolower((string) $field_info['Type']) != 'varchar(45)')
{
if ($just_check) return update_needed('Update IP address field '.$f.' in table '.$t);
$status = $sql->gen("ALTER TABLE `".MPREFIX.$t."` MODIFY `$f` VARCHAR(45) NOT NULL DEFAULT '';") ? E_MESSAGE_DEBUG : E_MESSAGE_ERROR;
@@ -1548,7 +1548,7 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Avatar paths require updating.');
foreach($avatar_images as $av)
{
- $apath = (strpos($av['path'], 'public/') !== false) ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT;
+ $apath = (strpos((string) $av['path'], 'public/') !== false) ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT;
if(rename($av['path'].$av['fname'], $apath. $av['fname'])===false)
{
@@ -1596,7 +1596,7 @@ function update_706_to_800($type='')
{
$log->addDebug("core-media-cat `media_cat_nick` field removed.");
}
-
+
// $query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_owner`, `media_cat_category`, `media_cat_title`, `media_cat_diz`, `media_cat_class`, `media_cat_image`, `media_cat_order`) VALUES
// (0, 'gallery', 'gallery_1', 'Gallery 1', 'Visible to the public at /gallery.php', 0, '', 0);
/// ";
@@ -1723,7 +1723,7 @@ function update_706_to_800($type='')
while($row = $sql->fetch())
{
- $ext = strrchr($row['download_url'], ".");
+ $ext = strrchr((string) $row['download_url'], ".");
$suffix = ltrim($ext,".");
if(!isset($allowed_types[$suffix]))
@@ -1747,7 +1747,7 @@ function update_706_to_800($type='')
// add found Public file-types.
foreach($public_files as $v)
{
- $ext = strrchr($v['fname'], ".");
+ $ext = strrchr((string) $v['fname'], ".");
$suffix = ltrim($ext,".");
if(!isset($allowed_types[$suffix]))
{
@@ -1832,7 +1832,7 @@ function update_706_to_800($type='')
if (!$just_check) // Running the Upgrade Process.
{
-
+
if(!is_array($pref['sitetheme_layouts']) || !vartrue($pref['sitetheme_deflayout']))
{
$th = e107::getSingleton('themeHandler');
@@ -1846,10 +1846,10 @@ function update_706_to_800($type='')
$log->addDebug("Couldn't update SiteTheme prefs");
}
}
-
+
$log->toFile('upgrade_v1_to_v2');
-
-
+
+
if ($do_save)
{
// save_prefs();
diff --git a/e107_admin/updateadmin.php b/e107_admin/updateadmin.php
index 48612de21e..14e39f9f4b 100644
--- a/e107_admin/updateadmin.php
+++ b/e107_admin/updateadmin.php
@@ -110,7 +110,7 @@
- ".
+ ".
$frm->admin_button('update_settings','no-value','update',UDALAN_7)."
diff --git a/e107_admin/upload.php b/e107_admin/upload.php
index 20d44121a0..96a5cecf7e 100644
--- a/e107_admin/upload.php
+++ b/e107_admin/upload.php
@@ -208,7 +208,7 @@ public function beforeUpdate($new_data, $old_data, $id)
// Make sure the upload_category contains only integers
// Make sure the owner correspondents to the category id
- list($catOwner, $catID) = explode("__", $new_data['upload_category'], 2);
+ list($catOwner, $catID) = explode("__", (string) $new_data['upload_category'], 2);
$new_data['upload_category'] = intval($catID);
$new_data['upload_owner'] = $catOwner;
diff --git a/e107_admin/users.php b/e107_admin/users.php
index 01211ec551..7889a44160 100644
--- a/e107_admin/users.php
+++ b/e107_admin/users.php
@@ -262,34 +262,34 @@ public function runObservers($run_header = true)
class users_admin_ui extends e_admin_ui
{
-
+
protected $pluginTitle = ADLAN_36;
protected $pluginName = 'core';
protected $eventName = 'user';
protected $table = "user";
-
+
// protected $listQry = "SELECT SQL_CALC_FOUND_ROWS * FROM #users"; // without any Order or Limit.
protected $listQry = "SELECT SQL_CALC_FOUND_ROWS u.*,ue.* from #user AS u LEFT JOIN #user_extended AS ue ON u.user_id = ue.user_extended_id "; // without any Order or Limit.
-
+
protected $editQry = "SELECT u.*,ue.* FROM #user AS u left join #user_extended AS ue ON u.user_id = ue.user_extended_id WHERE user_id = {ID}";
-
+
protected $pid = "user_id";
protected $perPage = 10;
protected $batchDelete = true;
protected $batchExport = true;
protected $listOrder = 'user_id DESC';
-
+
/**
* Show confirm screen before (batch/single) delete
* @var boolean
*/
public $deleteConfirmScreen = true;
-
+
/**
* @var boolean
*/
protected $batchCopy = false;
-
+
/**
* List (numerical array) of only disallowed for this controller actions
*/
@@ -303,15 +303,15 @@ class users_admin_ui extends e_admin_ui
'description' => 'user_name',
'vars'=> array('user_id' => true, 'user_name' => true)
);
-
+
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'50px', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
-
+
'user_id' => array('title' => LAN_ID, 'tab'=>0, 'type' =>'text', 'data'=>'int', 'width' => '3%','forced' => true,'thclass'=>'center', 'class'=>'center', 'readParms'=>'link=sef&target=blank'),
// 'user_status' => array('title' => LAN_STATUS, 'type' => 'method', 'alias'=>'user_status', 'width' => 'auto','forced' => true, 'nosort'=>TRUE),
'user_ban' => array('title' => LAN_STATUS, 'tab'=>0, 'type' => 'method', 'width' => 'auto', 'filter'=>true, 'batch'=>true,'thclass'=>'center', 'class'=>'center'),
-
+
'user_name' => array('title' => LAN_USER_01, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'safestr', 'width' => 'auto','thclass' => 'left first'), // Display name
'user_loginname' => array('title' => LAN_USER_02, 'tab'=>0, 'type' => 'text', 'data'=>'safestr', 'width' => 'auto'), // User name
'user_login' => array('title' => LAN_USER_03, 'tab'=>0, 'type' => 'text', 'inline'=>true, 'data'=>'safestr', 'width' => 'auto'), // Real name (no real vetting)
@@ -336,9 +336,9 @@ class users_admin_ui extends e_admin_ui
'user_pwchange' => array('title' => LAN_USER_24, 'tab'=>0, 'noedit'=>true, 'type'=>'datestamp' , 'width' => 'auto'),
'user_signature' => array('title' => LAN_USER_09, 'type' => 'textarea', 'data'=>'str', 'width' => 'auto', 'writeParms'=>array('size'=>'xxlarge'))
);
-
+
protected $fieldpref = array('user_ban','user_name','user_loginname','user_login','user_email','user_class','user_admin');
-
+
protected $prefs = array(
// 'anon_post' => array('title'=>PRFLAN_32, 'type'=>'boolean'),
'avatar_upload' => array('title' => USRLAN_44, 'type' => 'boolean', 'writeParms' => 'label=yesno', 'data' => 'int',),
@@ -355,7 +355,7 @@ class users_admin_ui extends e_admin_ui
'signature_access' => array('title' => USRLAN_194, 'type' => 'userclass', 'writeParms' => 'classlist=member,admin,main,classes,nobody', 'data' => 'int',),
'user_new_period' => array('title' => USRLAN_190, 'type' => 'number', 'writeParms' => array('maxlength' => 3, 'post' => LANDT_04s), 'help' => USRLAN_191, 'data' => 'int',),
);
-
+
public $extended = array();
public $extendedData = array();
@@ -365,7 +365,7 @@ function getExtended()
{
return $this->extendedData;
}
-
+
function ListObserver()
{
parent::ListObserver();
@@ -386,7 +386,7 @@ function ListObserver()
function init()
{
-
+
$sql = e107::getDb();
$tp = e107::getParser();
@@ -399,7 +399,7 @@ function init()
$this->resend_to_all($resetPasswords, $age, $class);
}
-
+
if($this->getAction() == 'edit')
{
$this->fields['user_class']['noedit'] = true;
@@ -410,9 +410,9 @@ function init()
-
+
// Extended fields - FIXME - better field types
-
+
if($rows = $sql->retrieve('user_extended_struct', '*', "user_extended_struct_type > 0 AND user_extended_struct_text != '_system_' ORDER BY user_extended_struct_parent ASC",true))
{
// TODO FIXME use the handler to build fields and field attributes
@@ -431,13 +431,13 @@ function init()
continue;
}
}
-
-
+
+
$field = "user_".$row['user_extended_struct_name'];
// $title = ucfirst(str_replace("user_","",$field));
$label = $tp->toHTML($row['user_extended_struct_text'],false,'defs');
$this->fields[$field] = array('__tableField'=>'ue.'.$field, 'title' => $label,'width' => 'auto', 'type'=>'method', 'readParms'=>array('ueType'=>$row['user_extended_struct_type']), 'method'=>'user_extended', 'data'=>$dataMode, 'tab'=>1, 'noedit'=>false);
-
+
$this->extended[] = $field;
$this->extendedData[$field] = $row;
}
@@ -454,7 +454,7 @@ function init()
// $this->fields['user_signature']['writeParms']['data'] = e107::getUserClass()->uc_required_class_list("classes");
$this->fields['options'] = array('title'=> LAN_OPTIONS." ", 'type' => 'method', 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'right last', 'class' => 'left');
-
+
if(!getperms('4|U0')) // Quick Add User Access Only.
{
unset($this->fields['checkboxes']);
@@ -465,7 +465,7 @@ function init()
}
}
-
+
if(!empty($_GET['readonly']))
{
foreach($this->fields as $key=>$v)
@@ -508,10 +508,10 @@ public function getAvatarList()
$id = $f['fname'];
$sys[$id] = $f['fname'];
}
-
+
$avs['uploaded'] = $upload;
$avs['system'] = $sys;
-
+
return $avs;
}
@@ -565,21 +565,21 @@ public function beforeUpdate($new_data, $old_data, $id)
e107::getMessage()->addDebug("Password Hash: ".$new_data['user_password']);
}
-
+
if(!empty($new_data['perms']))
{
$new_data['user_perms'] = implode(".",$new_data['perms']);
}
-
+
// Handle the Extended Fields.
$this->saveExtended($new_data);
-
-
-
+
+
+
return $new_data;
}
-
+
function saveExtended($new_data)
{
@@ -649,7 +649,7 @@ public function ListUnbanTrigger($userid)
$sql = e107::getDb();
$tp = e107::getParser();
$sysuser = e107::getSystemUser($userid, false);
-
+
if(!$sysuser->getId())
{
e107::getMessage()->addError(USRLAN_223);
@@ -661,18 +661,18 @@ public function ListUnbanTrigger($userid)
$sysuser->set('user_ban', 2)
->set('user_sess', e_user_model::randomKey())
->save();
-
+
$sql->delete("banlist"," banlist_ip='{$row['user_ip']}' ");
$vars = array('x'=>$sysuser->getId(), 'y'=> $sysuser->getName(), 'z'=> $sysuser->getValue('email'));
e107::getLog()->add('USET_06', $tp->lanVars( USRLAN_162, $vars), E_LOG_INFORMATIVE);
e107::getMessage()->addSuccess("(".$sysuser->getId().".".$sysuser->getName()." - ".$sysuser->getValue('email').") ".USRLAN_9);
-
+
// List data reload
$this->getTreeModel()->loadBatch(true);
}
-
+
/**
* Ban user trigger
* @param int $userid
@@ -685,7 +685,7 @@ public function ListBanTrigger($userid)
$admin_log = e107::getLog();
$iph = e107::getIPHandler();
$tp = e107::getParser();
-
+
$sysuser = e107::getSystemUser($userid, false);
if(!$sysuser->getId())
{
@@ -693,7 +693,7 @@ public function ListBanTrigger($userid)
return;
}
$row = $sysuser->getData();
-
+
if (($row['user_perms'] == "0") || ($row['user_perms'] == "0."))
{
$mes->addWarning(USRLAN_7);
@@ -706,7 +706,7 @@ public function ListBanTrigger($userid)
e107::getLog()->add('USET_05',$tp->lanVars(USRLAN_161, $vars), E_LOG_INFORMATIVE);
$mes->addSuccess("(".$userid.".".$row['user_name']." - {$row['user_email']}) ".USRLAN_8);
}
- if (trim($row['user_ip']) == "")
+ if (trim((string) $row['user_ip']) == "")
{
$mes->addInfo(USRLAN_135);
}
@@ -732,7 +732,7 @@ public function ListBanTrigger($userid)
}
}
}
-
+
// List data reload
$this->getTreeModel()->loadBatch(true);
}
@@ -748,15 +748,15 @@ public function ListVerifyTrigger($userid)
$userMethods = e107::getUserSession();
$mes = e107::getMessage();
$tp = e107::getParser();
-
+
$uid = intval($userid);
if ($sysuser->getId())
{
$sysuser->set('user_ban', '0')
->set('user_sess', '');
-
+
$row = $sysuser->getData();
-
+
if ($initUserclasses = $userMethods->userClassUpdate($row, 'userall'))
{
$row['user_class'] = $initUserclasses;
@@ -779,16 +779,16 @@ public function ListVerifyTrigger($userid)
e107::getLog()->add('USET_10', $tp->lanVars( USRLAN_166, $vars), E_LOG_INFORMATIVE);
e107::getEvent()->trigger('userfull', $row); //BC
e107::getEvent()->trigger('admin_user_activated', $row);
-
+
$mes->addSuccess(USRLAN_86." (#".$sysuser->getId()." : ".$sysuser->getName().' - '.$sysuser->getValue('email').")");
-
+
$this->getTreeModel()->loadBatch(true);
if ((int) e107::pref('core', 'user_reg_veri') == 2)
{
$message = USRLAN_114." ".$row['user_name'].",\n\n".USRLAN_122." ".SITENAME.".\n\n".USRLAN_123."\n\n";
$message .= str_replace("{SITEURL}", SITEURL, USRLAN_139);
-
+
$options = array(
'mail_subject' => USRLAN_113.' '.SITENAME,
'mail_body' => nl2br($message),
@@ -828,23 +828,23 @@ public function ListLoginasTrigger($userid)
{
$sysuser = e107::getSystemUser($userid);
$user = e107::getUser();
-
+
// TODO - lan
$mes->addSuccess('Successfully logged in as '.$sysuser->getName().'
[logout] ')
->addSuccess('Please,
Leave Admin to browse the system as this user. Use "Logout" option in Administration to end front-end session');
-
+
$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'));
-
+
// TODO - lan
$lan = 'Administrator --ADMIN_EMAIL-- (#--ADMIN_UID--, --ADMIN_NAME--) has logged in as the user --EMAIL-- (#--UID--, --NAME--)';
-
+
e107::getLog()->add('USET_100', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE);
-
+
$eventData = array('user_id' => $sysuser->getId(), 'admin_id' => $user->getId());
e107::getEvent()->trigger('loginas', $eventData); // BC
e107::getEvent()->trigger('admin_user_loginas', $eventData);
-
+
}
}
@@ -860,21 +860,21 @@ public function LogoutasObserver()
{
// TODO - lan
e107::getMessage()->addSuccess('Successfully logged out from '.$sysuser->getName().' ('.$sysuser->getValue('email').') account', 'default', true);
-
+
$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'));
-
+
// TODO - lan
$lan = 'Administrator --ADMIN_EMAIL-- (#--ADMIN_UID--, --ADMIN_NAME--) has logged out as the user --EMAIL-- (#--UID--, --NAME--)';
-
+
e107::getLog()->add('USET_101', str_replace($search, $replace, $lan), E_LOG_INFORMATIVE);
-
+
$eventData = array('user_id' => $sysuser->getId(), 'admin_id' => $user->getId());
e107::getEvent()->trigger('logoutas', $eventData); //BC
e107::getEvent()->trigger('admin_user_logoutas', $eventData);
$this->redirect('list', 'main', true);
}
-
+
if(!$sysuser->getId()) e107::getMessage()->addError(LAN_USER_NOT_FOUND);
}
@@ -949,7 +949,7 @@ public function pastepermsPage()
}
-
+
/**
* Remove admin status trigger
*/
@@ -959,11 +959,11 @@ public function ListUnadminTrigger($userid)
$sysuser = e107::getSystemUser($userid, false);
$mes = e107::getMessage();
$tp = e107::getParser();
-
+
if(!$user->checkAdminPerms('3'))
{
$mes->addError(USRLAN_226, 'default', true);
-
+
//$search = array('--UID--', '--NAME--', '--EMAIL--', '--ADMIN_UID--', '--ADMIN_NAME--', '--ADMIN_EMAIL--');
$vars = array(
'u' => $sysuser->getId(),
@@ -973,7 +973,7 @@ public function ListUnadminTrigger($userid)
'y' => $user->getName(),
'z' => $user->getValue('email')
);
-
+
e107::getLog()->add('USET_08', $tp->lanVars(USRLAN_244,$vars), E_LOG_INFORMATIVE);
$this->redirect('list', 'main', true);
}
@@ -1009,7 +1009,7 @@ public function AdminObserver()
{
$this->redirect('list', 'main', true);
}
-
+
$userid = $this->getId();
$sql = e107::getDb();
$user = e107::getUser();
@@ -1017,7 +1017,7 @@ public function AdminObserver()
$admin_log = e107::getLog();
$mes = e107::getMessage();
$tp = e107::getParser();
-
+
if(!$user->checkAdminPerms('3'))
{
$mes->addError(USRLAN_226, 'default', true);
@@ -1033,25 +1033,25 @@ public function AdminObserver()
);
// $replace = array($sysuser->getId(), $sysuser->getName(), $sysuser->getValue('email'), $user->getId(), $user->getName(), $user->getValue('email'));
-
+
e107::getLog()->add('USET_08', $tp->lanVars( USRLAN_245,$vars), E_LOG_INFORMATIVE);
-
+
$this->redirect('list', 'main', true);
}
-
+
if(!$sysuser->getId())
{
$mes->addError(USRLAN_223, 'default', true);
$this->redirect('list', 'main', true);
}
-
-
+
+
if($this->getPosted('update_admin'))
{
e107::getUserPerms()->updatePerms($userid, $_POST['perms']);
$this->redirect('list', 'main', true);
}
-
+
if(!$sysuser->isAdmin()) // Security Check Only. Admin status check is added during 'updatePerms'.
{
// $sysuser->set('user_admin', 1)->save(); //"user","user_admin='1' WHERE user_id={$userid}"
@@ -1065,9 +1065,9 @@ public function AdminObserver()
$mes->addWarning($message);
$mes->addWarning(e107::getParser()->toHTML(USRLAN_229,true));
}
-
+
}
-
+
/**
* Admin manage page
*/
@@ -1079,16 +1079,16 @@ public function AdminPage()
//$sysuser->load($request->getId(), true);
$prm = e107::getUserPerms();
$frm = e107::getForm();
-
+
$response->appendBody($frm->open('adminperms'))
->appendBody($prm->renderPermTable('grouped', $sysuser->getValue('perms')))
->appendBody($prm->renderCheckAllButtons())
->appendBody($prm->renderSubmitButtons().$frm->token())
->appendBody($frm->close());
-
+
$this->addTitle(str_replace(array('[x]', '[y]'), array($sysuser->getName(), $sysuser->getValue('email')), USRLAN_230));
}
-
+
protected function checkAllowed($class_id) // check userclass change is permitted.
{
$e_userclass = e107::getUserClass();
@@ -1102,20 +1102,20 @@ protected function checkAllowed($class_id) // check userclass change is permitte
}
return true;
}
-
+
protected function manageUserclass($userid, $uclass, $mode = false)
{
$request = $this->getRequest();
$response = $this->getResponse();
$sysuser = e107::getSystemUser($userid, false);
-
+
$admin_log = e107::getLog();
$e_userclass = e107::getUserClass();
$sql = e107::getDb();
$remuser = true;
$mes = e107::getMessage();
-
+
if(!$sysuser->getId())
{
$mes->addError(USRLAN_223);
@@ -1125,7 +1125,7 @@ protected function manageUserclass($userid, $uclass, $mode = false)
$curClass = array();
if($mode !== 'update')
{
- $curClass = $sysuser->getValue('class') ? explode(',', $sysuser->getValue('class')) : array();
+ $curClass = $sysuser->getValue('class') ? explode(',', (string) $sysuser->getValue('class')) : array();
}
foreach ($uclass as $a)
@@ -1136,7 +1136,7 @@ protected function manageUserclass($userid, $uclass, $mode = false)
$mes->addError(USRLAN_231);
return false;
}
-
+
if($a != 0) // if 0 - then do not add.
{
$curClass[] = $a;
@@ -1156,7 +1156,7 @@ protected function manageUserclass($userid, $uclass, $mode = false)
$svar = is_array($curClass) ? implode(",", $curClass) : "";
$check = $sysuser->set('user_class', $svar)->save();
-
+
if($check)
{
$message = UCSLAN_9;
@@ -1174,13 +1174,13 @@ protected function manageUserclass($userid, $uclass, $mode = false)
}
}
if ($messaccess == '') $messaccess = UCSLAN_12."\n";
-
+
$message = USRLAN_256." ".$sysuser->getName().",\n\n".UCSLAN_4." ".SITENAME."\n( ".SITEURL." )\n\n".UCSLAN_5.": \n\n".$messaccess."\n".UCSLAN_10."\n".SITEADMIN;
// $admin_log->addEvent(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User class change",str_replace("\n","
",$message),FALSE,LOG_TO_ROLLING);
-
+
$options['mail_subject'] = UCSLAN_2;
$options['mail_body'] = nl2br($message);
-
+
$sysuser->email('email', $options);
//sendemail($send_to,$subject,$message);
}
@@ -1209,7 +1209,7 @@ public function UserclassUpdateclassTrigger()
{
$this->manageUserclass($this->getId(), $this->getPosted('userclass'), 'update');
}
-
+
/**
* Back to user list trigger (userclass page)
*/
@@ -1217,7 +1217,7 @@ public function UserclassBackTrigger()
{
$this->redirect('list', 'main', true);
}
-
+
/**
* Manage userclasses page
*/
@@ -1229,14 +1229,14 @@ public function UserclassPage()
$e_userclass = e107::getUserClass();
$userid = $this->getId();
$frm = e107::getForm();
-
+
$caption = UCSLAN_6."
".$sysuser->getName().' - '.$sysuser->getValue('email')." (".$sysuser->getClassList(true).")";
$this->addTitle($caption);
-
+
$text = "