Skip to content

Commit

Permalink
Merge pull request #3417 from murrant/php7
Browse files Browse the repository at this point in the history
Improve PHP7 compatibility
  • Loading branch information
laf committed Apr 24, 2016
2 parents 413d0b7 + b98ba8c commit 7f50eca
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
6 changes: 3 additions & 3 deletions html/includes/graphs/application/shoutcast_multi_bits.inc.php
Expand Up @@ -27,16 +27,16 @@
if ($handle = opendir($rrddir)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (eregi('app-shoutcast-'.$app['app_id'], $file)) {
if (stripos($file, 'app-shoutcast-'.$app['app_id'])) {
array_push($files, $file);
}
}
}
}

foreach ($files as $id => $file) {
$hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = eregi_replace('.rrd', '', $hostname);
$hostname = str_ireplace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = str_ireplace('.rrd', '', $hostname);
list($host, $port) = explode('_', $hostname, 2);
$rrd_filenames[] = $rrddir.'/'.$file;
$rrd_list[$i]['filename'] = $rrddir.'/'.$file;
Expand Down
Expand Up @@ -15,16 +15,16 @@
if ($handle = opendir($rrddir)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (eregi('app-shoutcast-'.$app['app_id'], $file)) {
if (stripos($file, 'app-shoutcast-'.$app['app_id'])) {
array_push($files, $file);
}
}
}
}

foreach ($files as $id => $file) {
$hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = eregi_replace('.rrd', '', $hostname);
$hostname = str_ireplace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = str_ireplace('.rrd', '', $hostname);
list($host, $port) = explode('_', $hostname, 2);
$rrd_filenames[] = $rrddir.'/'.$file;
$rrd_list[$i]['filename'] = $rrddir.'/'.$file;
Expand Down
6 changes: 3 additions & 3 deletions html/pages/device/apps/shoutcast.inc.php
Expand Up @@ -10,7 +10,7 @@
if ($handle = opendir($rrddir)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (eregi('app-shoutcast-'.$app['app_id'], $file)) {
if (stripos($file, 'app-shoutcast-'.$app['app_id']) !== false) {
array_push($files, $file);
}
}
Expand Down Expand Up @@ -45,8 +45,8 @@
}

foreach ($files as $id => $file) {
$hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = eregi_replace('.rrd', '', $hostname);
$hostname = str_ireplace('app-shoutcast-'.$app['app_id'].'-', '', $file);
$hostname = str_ireplace('.rrd', '', $hostname);
list($host, $port) = explode('_', $hostname, 2);
$graphs = array(
'shoutcast_bits' => 'Traffic Statistics - '.$host.' (Port: '.$port.')',
Expand Down
4 changes: 1 addition & 3 deletions html/pages/front/map.php
Expand Up @@ -157,7 +157,7 @@
//From default.php - This code is not part of above license.
if ($config['enable_syslog']) {
$sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog ORDER BY seq DESC LIMIT 20";
$query = mysql_query($sql);

echo('<div class="container-fluid">
<div class="row">
<div class="col-md-12">
Expand Down Expand Up @@ -196,8 +196,6 @@
P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
}

$data = mysql_query($query);

echo('<div class="container-fluid">
<div class="row">
<div class="col-md-12">
Expand Down
4 changes: 2 additions & 2 deletions includes/common.php
Expand Up @@ -699,8 +699,8 @@ function get_smokeping_files($device) {
if ($handle = opendir($smokeping_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
if (eregi('.rrd', $file)) {
if (eregi('~', $file)) {
if (stripos($file, '.rrd') !== false) {
if (strpos($file, '~') !== false) {
list($target,$slave) = explode('~', str_replace('.rrd', '', $file));
$target = str_replace('_', '.', $target);
$smokeping_files['in'][$target][$slave] = $file;
Expand Down
2 changes: 1 addition & 1 deletion irc.php
Expand Up @@ -416,7 +416,7 @@ private function log($msg) {

private function chkdb() {
if (!is_resource($this->sql)) {
if (($this->sql = mysql_connect($this->config['db_host'], $this->config['db_user'], $this->config['db_pass'])) != false && mysql_select_db($this->config['db_name'])) {
if (($this->sql = mysqli_connect($this->config['db_host'], $this->config['db_user'], $this->config['db_pass'])) != false && mysqli_select_db($this->sql, $this->config['db_name'])) {
return true;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion scripts/ntpd-server.php
Expand Up @@ -25,7 +25,7 @@
$vars = array();
$vars2 = array();
$vars = explode(',', $cmd);
$vars2 = eregi_replace(' ', '', $cmd2);
$vars2 = str_replace(' ', '', $cmd2);
$vars2 = explode("\n", $vars2);


Expand Down

0 comments on commit 7f50eca

Please sign in to comment.