gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r15345 - in gauger: . web


From: gnunet
Subject: [GNUnet-SVN] r15345 - in gauger: . web
Date: Sun, 29 May 2011 04:52:32 +0200

Author: bartpolot
Date: 2011-05-29 04:52:32 +0200 (Sun, 29 May 2011)
New Revision: 15345

Modified:
   gauger/README
   gauger/web/io.php
   gauger/web/params.php
   gauger/web/template.php
Log:
Improved range handling, added config file locking, updated documentation


Modified: gauger/README
===================================================================
--- gauger/README       2011-05-27 17:30:14 UTC (rev 15344)
+++ gauger/README       2011-05-29 02:52:32 UTC (rev 15345)
@@ -46,8 +46,13 @@
   * Section config
    Should contain:
     * A path where to put the data logged from clients
-    * A salt to protect the password hashes
-    * A flag for the auto add feature
+    * A salt to protect the password hashes, which should be a unique string
+      for each gauger installation. By default it includes a random 15 bit
+      number
+    * A flag for the auto add feature. With this feature on, when a previously
+      unknown host tries to log data, instead of rejecting it, gauger registers
+      the new host wit hthe provided password into the known hosts and
+      accepts the data.
   * Section hosts
    Should contain a username for each machine authorized to log data to
    the server, followed by a salted hash of the password, one per line.
@@ -99,7 +104,7 @@
         int main(int argc, char *argv[]) {
             GAUGER("", "counter1", 100, "")
             GAUGER("performance", "network bandwidth", 100, "kb/s")
-            GAUGER_ID("meteo", "temperature", 50, "C", "365")
+            GAUGER_ID("meteo", "temperature", 5, "C", "20101231")
             return 0;
         }
 

Modified: gauger/web/io.php
===================================================================
--- gauger/web/io.php   2011-05-27 17:30:14 UTC (rev 15344)
+++ gauger/web/io.php   2011-05-29 02:52:32 UTC (rev 15345)
@@ -62,7 +62,7 @@
  * @param $conf Associative array as returned by parse_ini_file(), with 
sections
  * @return true on success
  */
-function write_ini_file($conf) { 
+function write_ini_file($conf) {
     $content = "";
     foreach ($conf as $sect => $e) {
         $content .= "[" . $sect . "]\n";
@@ -77,10 +77,12 @@
     if (!$handle = fopen('gauger.conf', 'w')) {
         return false;
     }
+    flock($handle, LOCK_EX);
     if (!fwrite($handle, $content)) {
         fclose($handle);
         return false;
     }
+    flock($handle, LOCK_UN);
     fclose($handle);
     return true;
 }
@@ -125,7 +127,7 @@
 function get_range_global() {
     global $DATADIR;
     $f = @fopen($DATADIR.'global_range.dat', 'r');
-    if($f === false) return;
+    if($f === false) return false;
     flock($f, LOCK_SH);
     $buffer = fgets($f, 512);
     flock($f, LOCK_UN);

Modified: gauger/web/params.php
===================================================================
--- gauger/web/params.php       2011-05-27 17:30:14 UTC (rev 15344)
+++ gauger/web/params.php       2011-05-29 02:52:32 UTC (rev 15345)
@@ -57,17 +57,11 @@
     session_name('gauger_session');
     session_start();
 
-    if (get_param('logout')) {
-        session_unset();
-        session_destroy();
-        header("Location: " . preg_replace("/\?.*/", "", 
$_SERVER["REQUEST_URI"]));
-        die();
-    }
+    $r = get_range_global();
+    $_SESSION['xrange_min'] = $r[0];
+    $_SESSION['xrange_max'] = $r[1];
 
-    if (get_session('xrange_min') === '') {
-        $r = get_range('','');
-        $_SESSION['xrange_min'] = $r[0];
-        $_SESSION['xrange_max'] = $r[1];
+    if (get_session('png_x_size') === '') {
         $_SESSION['y_min'] = 0;
         foreach ($range_parameters as $param_name) {
             $_SESSION[$param_name.'_a'] = 1;

Modified: gauger/web/template.php
===================================================================
--- gauger/web/template.php     2011-05-27 17:30:14 UTC (rev 15344)
+++ gauger/web/template.php     2011-05-29 02:52:32 UTC (rev 15345)
@@ -44,9 +44,9 @@
         $(document).ready(function() {
                 $( ".slider-range" ).slider({
                         range: true,
-                        min: <?php echo get_session('xrange_min', '0') ?>,
-                        max: <?php echo get_session('xrange_max', '100') ?>,
-                        values: [ <?php echo get_session('x_min', 
get_session('xrange_min', '0')) ?> , <?php echo get_session('x_max', 
get_session('xrange_max', '100')) ?> ],
+                        min: <?php echo get_session('xrange_min') ?>,
+                        max: <?php echo get_session('xrange_max') ?>,
+                        values: [ <?php echo get_session('x_min', 
get_session('xrange_min')) ?> , <?php echo get_session('x_max', 
get_session('xrange_max')) ?> ],
                         slide: function( event, ui ) {
                             if(this.id == "default_range_slider") {
                                 $(".input_min").val(ui.values[0]);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]