diff options
author | Raphael Kubo da Costa <rakuco@FreeBSD.org> | 2014-06-22 19:03:47 +0000 |
---|---|---|
committer | Raphael Kubo da Costa <rakuco@FreeBSD.org> | 2014-06-22 19:03:47 +0000 |
commit | f3c5f1b571104d1f3028db44cb477ca72dca042f (patch) | |
tree | 2a35b1d94bf6aea6e98780fd2a6983ddc82d38d0 /net/rtg/files/patch-etc-view.php | |
parent | Update to 1.5.0. (diff) |
- Update to use PHP mysqli extensions (as mysql extension is deprecated
these days)
- Fix runtime dependencies to pull in perl's DBI and DBD::mysql modules for
target maker.
- Add some options to pull in dependencies for mysql server and php web
modules if needed.
PR: 191276
Submitted by: Daniel Austin <freebsd-ports@dan.me.uk> (maintainer)
Notes
Notes:
svn path=/head/; revision=358821
Diffstat (limited to 'net/rtg/files/patch-etc-view.php')
-rw-r--r-- | net/rtg/files/patch-etc-view.php | 85 |
1 files changed, 81 insertions, 4 deletions
diff --git a/net/rtg/files/patch-etc-view.php b/net/rtg/files/patch-etc-view.php index b7f99bff3e25..a3d4af95ee37 100644 --- a/net/rtg/files/patch-etc-view.php +++ b/net/rtg/files/patch-etc-view.php @@ -1,6 +1,57 @@ ---- etc/view.php.orig 2010-07-04 03:55:12.757175355 +0100 -+++ etc/view.php 2010-07-04 03:59:40.479683639 +0100 -@@ -95,19 +95,22 @@ +--- etc/view.php.orig 2003-09-26 16:58:34.000000000 +0100 ++++ etc/view.php 2014-06-22 15:24:14.720483023 +0100 +@@ -11,10 +11,8 @@ + print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n"; + + /* Connect to RTG MySQL Database */ +- $dbc=@mysql_connect ($host, $user, $pass) or +- $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or ++ $dbc=@mysqli_connect ($host, $user, $pass, $db) or + die ("MySQL Connection Failed, Check Configuration."); +- mysql_select_db($db,$dbc); + + # Global variables off by default in newer versions of PHP + if (!$PHP_SELF) { +@@ -26,17 +24,17 @@ + # Determine router, interface names as necessary + if ($rid && $iid) { + $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid"; +- $selectResult=mysql_query($selectQuery, $dbc); +- $selectRow=mysql_fetch_object($selectResult); +- $interfaces = mysql_num_rows($selectResult); ++ $selectResult=mysqli_query($dbc, $selectQuery); ++ $selectRow=mysqli_fetch_object($selectResult); ++ $interfaces = mysqli_num_rows($selectResult); + $name = $selectRow->name; + $description = $selectRow->description; + $speed = ($selectRow->speed)/1000000; + $router = $selectRow->router; + } else if ($rid && !$iid) { + $selectQuery="SELECT name AS router from router where rid=$rid"; +- $selectResult=mysql_query($selectQuery, $dbc); +- $selectRow=mysql_fetch_object($selectResult); ++ $selectResult=mysqli_query($dbc, $selectQuery); ++ $selectRow=mysqli_fetch_object($selectResult); + $router = $selectRow->router; + } + +@@ -68,12 +66,12 @@ + if (!$rid) { + print "Monitored Devices: <P>\n"; + $selectQuery="SELECT rid, name FROM router"; +- $selectResult=mysql_query($selectQuery, $dbc); +- if (mysql_num_rows($selectResult) <= 0) ++ $selectResult=mysqli_query($dbc, $selectQuery); ++ if (mysqli_num_rows($selectResult) <= 0) + print "<BR>No Routers Found.<BR>\n"; + else { + print "<UL>\n"; +- while ($selectRow=mysql_fetch_object($selectResult)){ ++ while ($selectRow=mysqli_fetch_object($selectResult)){ + print "<LI><A HREF=\"$PHP_SELF?rid=$selectRow->rid\">"; + print "$selectRow->name</A><BR>\n"; + } +@@ -95,19 +93,22 @@ $bt = $et - (60*60*24); print "<B>Day View:</B><BR>\n"; @@ -26,7 +77,24 @@ print "<BR><B>$router: $name ($description)</B>\n"; print "<BR><BR>\n"; } -@@ -134,7 +137,10 @@ +@@ -116,8 +117,8 @@ + + if ($rid && !$iid) { + $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid"; +- $selectResult=mysql_query($selectQuery, $dbc); +- $interfaces = mysql_num_rows($selectResult); ++ $selectResult=mysqli_query($dbc, $selectQuery); ++ $interfaces = mysqli_num_rows($selectResult); + if ($interfaces <= 0) + print "<BR>No Interfaces Found for Router $router (ID: $rid).<BR>\n"; + else { +@@ -129,12 +130,15 @@ + print gmdate('D, d M Y H:i:s \G\M\T', time())."\n"; + print "</TABLE><HR>\n"; + print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"10\">\n"; +- while ($selectRow=mysql_fetch_object($selectResult)){ ++ while ($selectRow=mysqli_fetch_object($selectResult)){ + $ids[$selectRow->id] = $selectRow->name; $desc[$selectRow->id] = $selectRow->description; $iid = $selectRow->id; print "<TD><A HREF=\"$PHP_SELF?rid=$rid&iid=$iid\">\n"; @@ -38,3 +106,12 @@ print "</A><BR>\n"; print "<B>$selectRow->name ($selectRow->description)</B>\n"; if ($even) { +@@ -148,7 +152,7 @@ + print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n"; + } + +- if ($dbc) mysql_close($dbc); ++ if ($dbc) mysqli_close($dbc); + echo "</FORM>\n"; + ?> + |