Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.13 KB | None | 0 0
  1. --- weathermap-for-observium-master/data-pick.php       2017-07-26 09:04:57.000000000 +0200
  2. +++ /opt/observium/html/weathermap/data-pick.php        2017-11-17 11:38:03.424615338 +0100
  3. @@ -38,7 +38,6 @@
  4.                  or die('Could not connect: ' . mysqli_error());
  5.                 mysqli_select_db($link,$config['db_name']) or die('Could not select database: '.mysqli_error());
  6.  
  7. -
  8.  // ******************************************
  9.  
  10.  function js_escape($str)
  11. @@ -268,10 +267,11 @@
  12.  
  13.          // Link query
  14.          //$result = mysql_query("SELECT device_id,hostname FROM devices ORDER BY hostname");
  15. -        $result = mysqli_query($link, "SELECT device_id,hostname FROM devices ORDER BY hostname");
  16. +        $result = mysqli_query($link, "SELECT device_id, device_id as id, hostname FROM devices ORDER BY hostname");
  17.  
  18.          //$hosts = mysql_fetch_assoc($result);
  19.          //$result = mysql_query($SQL_picklist);
  20. +
  21.          $hosts = 1;
  22.  ?>
  23.  
  24. @@ -304,7 +304,7 @@
  25.         $query = "SELECT devices.device_id,hostname,ports.port_id,ports.ifAlias,ports.ifIndex,ports.ifDescr FROM devices LEFT JOIN ports ON devices.device_id=ports.device_id WHERE ports.disabled=0";
  26.  
  27.         if($host_id > 0) {
  28. -               $query .= " AND devices.device_id='$host_id'";
  29. +               $query .= " AND devices.device_id=" . (int)$host_id;
  30.         }
  31.  
  32.         $query .= " ORDER BY hostname,ports.ifAlias";
  33. @@ -368,9 +368,7 @@
  34.  
  35.         //$query = mysql_query("SELECT id,hostname AS name FROM `devices` ORDER BY hostname");
  36.         //$hosts = mysql_fetch_assoc($query);
  37. -        $query = mysqli_query("SELECT id,hostname AS name FROM `devices` ORDER BY hostname");
  38. -        $hosts = mysqli_fetch_assoc($query);
  39. -
  40. +        $query = mysqli_query($link, "SELECT device_id, `device_id` as id,hostname AS name FROM `devices` ORDER BY hostname");
  41.  ?>
  42.  <html>
  43.  <head>
  44. @@ -469,30 +467,28 @@
  45.  
  46.  <form name="mini">
  47.  <?php
  48. -if(sizeof($hosts) > 0) {
  49.         print 'Host: <select name="host_id"  onChange="applyDSFilterChange(document.mini)">';
  50.  
  51.         print '<option '.($host_id==-1 ? 'SELECTED' : '' ).' value="-1">Any</option>';
  52.         print '<option '.($host_id==0 ? 'SELECTED' : '' ).' value="0">None</option>';
  53. -       foreach ($hosts as $host)
  54. -       {
  55. +        while ($host = mysqli_fetch_assoc($result))
  56. +        {
  57.                 print '<option ';
  58.                 if($host_id==$host['id']) print " SELECTED ";
  59.                 print 'value="'.$host['id'].'">'.$host['name'].'</option>';
  60.         }
  61.         print '</select><br />';
  62. -}
  63.  
  64.         print '<span class="filter" style="display: none;">Filter: <input id="filterstring" name="filterstring" size="20"> (case-sensitive)<br /></span>';
  65.         print '<input id="overlib" name="overlib" type="checkbox" value="yes" '.($overlib ? 'CHECKED' : '' ).'> <label for="overlib">Set both OVERLIBGRAPH and INFOURL.</label><br />';
  66.  
  67.         print '</form><div class="listcontainer"><ul id="dslist">';
  68.         //$result = mysql_query($SQL_picklist);
  69. -       $result = mysqli_query($SQL_picklist);
  70. -       if( mysql_num_rows($result) > 0)
  71. +       $result = mysqli_query($link, $SQL_picklist);
  72. +       if( mysqli_num_rows($result) > 0)
  73.         {
  74.                 $i=0;
  75. -               while($queryrows = mysql_fetch_assoc($result)) {
  76. +               while($queryrows = mysqli_fetch_assoc($result)) {
  77.                         echo "<li class=\"row".($i%2)."\">";
  78.                         $key = $queryrows['id'];
  79.                         $name = $queryrows['name'];
  80. diff -ur weathermap-for-observium-master/editor.php /opt/observium/html/weathermap/editor.php
  81. --- weathermap-for-observium-master/editor.php  2017-07-26 09:04:57.000000000 +0200
  82. +++ /opt/observium/html/weathermap/editor.php   2017-09-27 22:41:01.000000000 +0200
  83. @@ -1,10 +1,11 @@
  84.  <?php
  85.  
  86. +require_once 'observium-auth.php';
  87.  require_once 'lib/editor.inc.php';
  88.  require_once 'lib/Weathermap.class.php';
  89.  
  90.  // so that you can't have the editor active, and not know about it.
  91. -$ENABLED=false;
  92. +$ENABLED=true; // false;
  93.  
  94.  if(! $ENABLED)
  95.  {
  96. Only in /opt/observium/html/weathermap: maps
  97. Only in /opt/observium/html/weathermap: observium-auth.php
  98. diff -ur weathermap-for-observium-master/weathermap /opt/observium/html/weathermap/weathermap
  99. --- weathermap-for-observium-master/weathermap  2017-07-26 09:04:57.000000000 +0200
  100. +++ /opt/observium/html/weathermap/weathermap   2017-09-27 22:41:01.000000000 +0200
  101. @@ -283,8 +283,10 @@
  102.                 {
  103.                         fwrite($fd,
  104.                                 "<div id=\"overDiv\" style=\"position:absolute; visibility:hidden; z-index:1000;\"></div>\n");
  105. +                        fwrite($fd,
  106. +                                "<script type=\"text/javascript\">window.ol_fgcolor='#FFFFFF'; window.ol_hauto = true; window.ol_width = 512;</script>\n");
  107.                         fwrite($fd,
  108. -                               "<script type=\"text/javascript\" src=\"/overlib.js\"><!-- overLIB (c) Erik Bosrup --></script> \n");
  109. +                               "<script type=\"text/javascript\" src=\"overlib.js\"><!-- overLIB (c) Erik Bosrup --></script> \n");
  110.                 }
  111.  
  112.                 fwrite($fd, $map->MakeHTML());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement