diff --git a/e107_admin/upload.php b/e107_admin/upload.php
index b382788d9..5bbf3504b 100644
--- a/e107_admin/upload.php
+++ b/e107_admin/upload.php
@@ -180,7 +180,7 @@ class upload_ui extends e_admin_ui
protected function handleListUploadActiveBatch($selected, $value = null)
{
- $ids = array_map('intval', array_values($selected));
+ $ids = array_map('\intval', array_values($selected));
foreach ($ids as $id)
{
$model = $this->getTreeModel()->getNode($id);
diff --git a/e107_core/bbcodes/link.bb b/e107_core/bbcodes/link.bb
index d95292203..f1730e845 100644
--- a/e107_core/bbcodes/link.bb
+++ b/e107_core/bbcodes/link.bb
@@ -55,7 +55,7 @@ global $pref;
if(!$parm) $link = $code_text;
- if($link == "external" && $extras == "")
+ if($link == "external" && empty($extras))
{
$link = $code_text;
$extras = "rel=external";
diff --git a/e107_core/shortcodes/single/picture.sc b/e107_core/shortcodes/single/picture.sc
index 46da12980..afb78dcf4 100644
--- a/e107_core/shortcodes/single/picture.sc
+++ b/e107_core/shortcodes/single/picture.sc
@@ -1,12 +1,12 @@
//renderJs('footer_inline', true);
// see e107.js and class2.php
// This must be done as late as possible in page processing.
$_serverTime = time();
-$lastSet = isset($_COOKIE['e107_tdSetTime']) ? intval($_COOKIE['e107_tdSetTime']) : 0;
+$lastSet = isset($_COOKIE['e107_tdSetTime']) ? (int) $_COOKIE['e107_tdSetTime'] : 0;
$_serverPath = e_HTTP;
$_serverDomain = deftrue('MULTILANG_SUBDOMAIN') ? '.'.e_DOMAIN : '';
if (abs($_serverTime - $lastSet) > 120)
diff --git a/e107_core/url/news/sef_noid_url.php b/e107_core/url/news/sef_noid_url.php
index 687e69f24..3fed5abe9 100644
--- a/e107_core/url/news/sef_noid_url.php
+++ b/e107_core/url/news/sef_noid_url.php
@@ -210,7 +210,7 @@ class core_news_sef_noid_url extends eUrlConfig
else
{
if(!is_numeric($parts[1])) $id = $this->categoryIdByTitle($parts[1]);
- else $id = intval($parts[1]);
+ else $id = (int) $parts[1];
}
if(!$id)
{
diff --git a/e107_handlers/arraystorage_class.php b/e107_handlers/arraystorage_class.php
index b4b1f4e96..c027d14f3 100644
--- a/e107_handlers/arraystorage_class.php
+++ b/e107_handlers/arraystorage_class.php
@@ -63,7 +63,8 @@ class ArrayData {
*/
function ReadArray($ArrayData)
{
- if ($ArrayData == ""){
+ if (empty($ArrayData))
+ {
return false;
}
diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php
index 7d901bae3..c9c667333 100644
--- a/e107_handlers/core_functions.php
+++ b/e107_handlers/core_functions.php
@@ -435,7 +435,7 @@ class e_array {
$ArrayData = $sourceArrayData;
- if ($ArrayData == "")
+ if (empty($ArrayData))
{
return false;
}
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index d2f3ffc6a..8c44a7062 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -4316,7 +4316,7 @@ class e107
}
}
- if ($_SERVER['PHP_SELF'] == "" && !empty($_SERVER['SCRIPT_NAME']))
+ if (empty($_SERVER['PHP_SELF']) && !empty($_SERVER['SCRIPT_NAME']))
{
$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'];
}
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 9d03bf2b0..db139df59 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -762,7 +762,7 @@ class e_parse extends e_parser
if (isset($match[1]))
{
- $chop = intval(strlen($match[1]) / 2);
+ $chop = (int) (strlen($match[1]) / 2);
$ans = substr($match[1], 0, $chop).'##xss##'.substr($match[1], $chop);
}
else
@@ -2523,17 +2523,17 @@ class e_parse extends e_parser
{
if($w !== null)
{
- $this->thumbWidth = intval($w);
+ $this->thumbWidth = (int) $w;
}
if($h !== null)
{
- $this->thumbHeight = intval($h);
+ $this->thumbHeight = (int) $h;
}
if($crop !== null)
{
- $this->thumbCrop = intval($crop);
+ $this->thumbCrop = (int) $crop;
}
}
@@ -2543,7 +2543,7 @@ class e_parse extends e_parser
if($val !== null)
{
- $this->thumbEncode = intval($val);
+ $this->thumbEncode = (int) $val;
return null;
}
@@ -2574,7 +2574,7 @@ class e_parse extends e_parser
{
if($width !== null)
{
- $this->thumbWidth = intval($width);
+ $this->thumbWidth = (int) $width;
}
return $this->thumbWidth;
@@ -2588,7 +2588,7 @@ class e_parse extends e_parser
{
if($status !== false)
{
- $this->thumbCrop = intval($status);
+ $this->thumbCrop = (int) $status;
}
return $this->thumbCrop;
@@ -2604,7 +2604,7 @@ class e_parse extends e_parser
{
if($height !== null)
{
- $this->thumbHeight = intval($height);
+ $this->thumbHeight = (int) $height;
}
return $this->thumbHeight;
@@ -2902,7 +2902,7 @@ class e_parse extends e_parser
$options['h'] = $options['ah'] ;
}
- $thurl .= 'aw='.intval($options['w']).'&ah='.intval($options['h']);
+ $thurl .= 'aw='.(int) $options['w'].'&ah='.(int) $options['h'];
if(!is_numeric($options['crop']))
{
@@ -2914,7 +2914,7 @@ class e_parse extends e_parser
else
{
- $thurl .= 'w='.intval($options['w']).'&h='.intval($options['h']);
+ $thurl .= 'w='.(int) $options['w'].'&h='.(int) $options['h'];
}
diff --git a/e107_handlers/js_manager.php b/e107_handlers/js_manager.php
index 152ab108d..05461d794 100644
--- a/e107_handlers/js_manager.php
+++ b/e107_handlers/js_manager.php
@@ -1742,7 +1742,7 @@ class e_jsmanager
$i -= 1;
}
- if ($i > 0 && $parts[$i] === "") // remove empty parts
+ if ($i > 0 && empty($parts[$i])) // remove empty parts
{
unset($parts[$i]);
$parts = array_values($parts);
diff --git a/e107_handlers/library_manager.php b/e107_handlers/library_manager.php
index e246cab1d..8d77a3ce2 100755
--- a/e107_handlers/library_manager.php
+++ b/e107_handlers/library_manager.php
@@ -939,6 +939,7 @@ class e_library_manager
*/
public function detect($name)
{
+
// Re-use the statically cached value of info() to save memory.
$library = &$this->info($name);
@@ -1202,6 +1203,7 @@ class e_library_manager
public function load($name, $variant = null)
{
// Re-use the statically cached value to save memory.
+
static $loaded;
if(!isset($loaded[$name]))
@@ -1216,7 +1218,7 @@ class e_library_manager
$library = e107::unserialize($cached);
}
- if(!varset($library, false))
+ if(empty($library))
{
$library = $this->detect($name);
$cacheData = e107::serialize($library, 'json');
diff --git a/e107_handlers/login.php b/e107_handlers/login.php
index 18eb56798..d5208c362 100644
--- a/e107_handlers/login.php
+++ b/e107_handlers/login.php
@@ -85,7 +85,7 @@ class userlogin
$forceLogin = ($autologin === 'signup');
if(!$forceLogin && $autologin === 'provider') $forceLogin = 'provider';
- if($username == "" || (($userpass == "") && ($response == '') && $forceLogin !== 'provider'))
+ if(empty($username) || (empty($userpass) && empty($response) && $forceLogin !== 'provider'))
{ // Required fields blank
return $this->invalidLogin($username,LOGIN_BLANK_FIELD);
}
diff --git a/e107_handlers/rate_class.php b/e107_handlers/rate_class.php
index de00d42c4..44249b827 100644
--- a/e107_handlers/rate_class.php
+++ b/e107_handlers/rate_class.php
@@ -651,7 +651,7 @@ class rater
}
}
$rate .= "
";
- if($ratearray[2] == ""){ $ratearray[2] = 0; }
+ if(empty($ratearray[2])){ $ratearray[2] = 0; }
$rate .= " ".$ratearray[1].".".$ratearray[2];
if(!$userid){
$rate .= " - ".$ratearray[0]." ";
diff --git a/e107_handlers/user_select_class.php b/e107_handlers/user_select_class.php
index 0f2da2803..2a206979b 100644
--- a/e107_handlers/user_select_class.php
+++ b/e107_handlers/user_select_class.php
@@ -93,8 +93,8 @@ class user_select
}
if ($class == e_UC_MEMBER)
{
- $sql -> db_Select("userclass_classes", "userclass_id, userclass_name", "ORDER BY userclass_name", "nowhere");
- while ($row = $sql -> db_Fetch())
+ $sql -> select("userclass_classes", "userclass_id, userclass_name", "ORDER BY userclass_name", "nowhere");
+ while ($row = $sql -> fetch())
{
if (check_class($row['userclass_id']) || ADMINPERMS == '0')
{
@@ -104,8 +104,8 @@ class user_select
}
else
{
- $sql -> db_Select("userclass_classes", "userclass_id, userclass_name", "userclass_id='".intval($class)."' ORDER BY userclass_name");
- while ($row = $sql -> db_Fetch())
+ $sql -> select("userclass_classes", "userclass_id, userclass_name", "userclass_id='".intval($class)."' ORDER BY userclass_name");
+ while ($row = $sql -> fetch())
{
$text .= "";
}
@@ -143,7 +143,7 @@ class user_select
";
list($form_type, $form_id) = explode(".", $user_form);
- if($form_id == "") { $form_id = $form_type; }
+ if(empty($form_id)) { $form_id = $form_type; }
if ($type == 'list')
{
@@ -183,8 +183,8 @@ class user_select
function real_name($_id)
{
global $sql;
- $sql -> db_Select("user", "user_name", "user_id='".intval($_id)."' ");
- if ($row = $sql -> db_Fetch())
+ $sql ->select("user", "user_name", "user_id='".intval($_id)."' ");
+ if ($row = $sql ->fetch())
{
return $row['user_name'];
}
@@ -210,7 +210,7 @@ class user_select
}
else
{
- if($elementID == "")
+ if(empty($elementID))
{
$elementID = $elementType;
}
@@ -297,9 +297,9 @@ class user_select
function findusers($s,$banned=FALSE) {
global $sql, $tp;
$inc = ($banned == FALSE) ? " AND user_ban != 1" : "";
- if ($sql->db_Select("user", "*", "user_name LIKE '%".$tp -> toDB($s)."%'".$inc))
+ if ($sql->select("user", "*", "user_name LIKE '%".$tp -> toDB($s)."%'".$inc))
{
- while ($row = $sql -> db_Fetch()) {
+ while ($row = $sql ->fetch()) {
$ret[strtolower($row['user_name'])] = $row['user_name'];
}
ksort($ret);
diff --git a/install.php b/install.php
index 9e8f09ef1..e3738a7f4 100644
--- a/install.php
+++ b/install.php
@@ -445,11 +445,11 @@ class e_install
{
$_POST['stage'] = 1;
}
- $_POST['stage'] = intval($_POST['stage']);
+ $_POST['stage'] = (int) $_POST['stage'];
if(!empty($_POST['back']))
{
- $_POST['stage'] = intval($_POST['back']);
+ $_POST['stage'] = (int) $_POST['back'];
}
switch ($_POST['stage'])
@@ -2332,8 +2332,8 @@ function create_tables_unattended()
$einstall->previous_steps['admin']['password'] = (isset($_GET['admin_password']) ? $_GET['admin_password'] : 'admin_password');
$einstall->previous_steps['admin']['email'] = (isset($_GET['admin_email']) ? $_GET['admin_email'] : 'admin_email@xxx.com');
- $einstall->previous_steps['generate_content'] = isset($_GET['gen']) ? intval($_GET['gen']) : 1;
- $einstall->previous_steps['install_plugins'] = isset($_GET['plugins']) ? intval($_GET['plugins']) : 1;
+ $einstall->previous_steps['generate_content'] = isset($_GET['gen']) ? (int) $_GET['gen'] : 1;
+ $einstall->previous_steps['install_plugins'] = isset($_GET['plugins']) ? (int) $_GET['plugins'] : 1;
$einstall->previous_steps['prefs']['sitename'] = isset($_GET['sitename']) ? urldecode($_GET['sitename']) : LANINS_113;
$einstall->previous_steps['prefs']['sitetheme'] = isset($_GET['theme']) ? urldecode($_GET['theme']) : 'bootstrap3';
diff --git a/online.php b/online.php
index 508aea310..65962b3f9 100644
--- a/online.php
+++ b/online.php
@@ -185,7 +185,7 @@
$tmp = explode(".", substr(strrchr($online_location, "php."), 2));
if($tmp[0] == "article")
{
- $sql->select("content", "content_heading, content_class", "content_id='" . intval($tmp[1]) . "'");
+ $sql->select("content", "content_heading, content_class", "content_id='" . (int) $tmp[1] . "'");
$content = $sql->fetch();
$online_location_page = ARTICLE . ": " . $content['content_heading'];
$online_location = str_replace("php.", "php?", $online_location);
@@ -197,7 +197,7 @@
}
elseif($tmp[0] == "review")
{
- $sql->select("content", "content_heading, content_class", "content_id='" . intval($tmp[1]) . "'");
+ $sql->select("content", "content_heading, content_class", "content_id='" . (int) $tmp[1] . "'");
$content = $sql->fetch();
$online_location_page = REVIEW . ": " . $content['content_heading'];
$online_location = str_replace("php.", "php?", $online_location);
diff --git a/page.php b/page.php
index 90e173bb5..c525d6569 100644
--- a/page.php
+++ b/page.php
@@ -115,16 +115,16 @@ class pageClass
if(!vartrue($_GET['id'])) // legacy URLs /page.php?x
{
$tmp = explode(".", e_QUERY);
- $this->pageID = intval($tmp[0]);
- $this->pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0);
+ $this->pageID = (int) $tmp[0];
+ $this->pageSelected = (isset($tmp[1]) ? (int) $tmp[1] : 0);
$this->pageTitles = array();
$this->bullet = '';
}
else // NEW URLS /page.php?id=x
{
$tmp = explode(".", e_QUERY);
- $this->pageID = intval($_GET['id']);
- $this->pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0); // Not sure what this is?
+ $this->pageID = (int) $_GET['id'];
+ $this->pageSelected = (isset($tmp[1]) ? (int) $tmp[1] : 0); // Not sure what this is?
$this->pageTitles = array();
$this->bullet = ''; // deprecated - use CSS instead.
}
@@ -170,11 +170,11 @@ class pageClass
switch ($request)
{
case 'listChapters':
- $id = intval($_GET['bk']);
+ $id = (int) $_GET['bk'];
break;
case 'listPages':
- $id = intval($_GET['ch']);
+ $id = (int) $_GET['ch'];
break;
case 'showPage':