From a93bd4a0fca84e80f651e6fac65bcabb97d14407 Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Thu, 4 May 2017 18:32:34 +0200 Subject: [PATCH] Fixed some warning in PHP 7.1 Warning: Cannot assign an empty string to a string offset * fixed Notice with tempnam() --- system/functions.php | 2 +- system/libs/pot/OTS_Account.php | 6 +++--- templates/kathrine/news.php | 2 +- templates/tibiacom/news.php | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/system/functions.php b/system/functions.php index 111c6a13..8aa4b4bd 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1199,7 +1199,7 @@ function load_config_lua($filename) if(!@file_exists($config_file)) die('ERROR: Cannot find ' . $filename . ' file.'); - $tempFile = tempnam('/tmp', 'lua'); + $tempFile = @tempnam('/tmp', 'lua'); $file = fopen($tempFile, 'w'); if(!$file) die('Cannot load server config!'); diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index fcc4461c..1212e302 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -886,11 +886,11 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable public function logAction($action) { $ip = '127.0.0.1'; - if(isset($_SERVER['REMOTE_ADDR']) && !empty(($_SERVER['REMOTE_ADDR']))) + if(isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR']; - else if(isset($_SERVER['HTTP_CLIENT_IP']) && !empty(($_SERVER['HTTP_CLIENT_IP']))) + else if(isset($_SERVER['HTTP_CLIENT_IP']) && !empty($_SERVER['HTTP_CLIENT_IP'])) $ip = $_SERVER['HTTP_CLIENT_IP']; - else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty(($_SERVER['HTTP_X_FORWARDED_FOR']))) + else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; return $this->db->query('INSERT INTO ' . $this->db->tableName(TABLE_PREFIX . 'account_actions') . ' (' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('ip') . ', ' . $this->db->fieldName('date') . ', ' . $this->db->fieldName('action') . ') VALUES (' . $this->db->quote($this->getId()).', INET_ATON(' . $this->db->quote($ip) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')'); diff --git a/templates/kathrine/news.php b/templates/kathrine/news.php index 83f32718..b8a30a97 100644 --- a/templates/kathrine/news.php +++ b/templates/kathrine/news.php @@ -9,7 +9,7 @@ function news_parse($title, $content, $date, $icon = 0, $author = '', $comments $tmp = $template_path.'/images/letters/'.$content[0].'.gif'; if(file_exists($tmp)) { $firstLetter = ''.$content[0].''; - $content[0] = ''; + $content = substr($content, 1); } } diff --git a/templates/tibiacom/news.php b/templates/tibiacom/news.php index 57a3141a..2ec340ff 100644 --- a/templates/tibiacom/news.php +++ b/templates/tibiacom/news.php @@ -8,7 +8,6 @@ function news_parse($title, $content, $date, $icon = 0, $author = '', $comments $tmp = $template_path.'/images/letters/'.$content[0].'.gif'; if(file_exists($tmp)) { $firstLetter = ''.$content[0].''; - $content[0] = ''; } }