Logger converted to public static
authorHarvie <tomas@mudrunka.cz>
Tue, 26 Oct 2010 23:36:17 +0000 (01:36 +0200)
committerHarvie <tomas@mudrunka.cz>
Tue, 26 Oct 2010 23:36:17 +0000 (01:36 +0200)
13 files changed:
wwwroot/inc/eventz/accesslist.inc
wwwroot/inc/eventz/banlist.inc
wwwroot/inc/eventz/configure_parent.inc
wwwroot/inc/eventz/executelist.inc
wwwroot/inc/eventz/executorlist.inc
wwwroot/inc/eventz/logout.inc
wwwroot/inc/eventz/masterlist.inc
wwwroot/inc/eventz/oplist.inc
wwwroot/inc/eventz/silencelist.inc
wwwroot/inc/eventz/unbook.inc
wwwroot/inc/log.inc
wwwroot/inc/nodes.inc
wwwroot/nodes.php

index 337ccf145633ee8cf20631a40227b9a38d9f15af..87c342c2a41058c13cb9f8e412cba2306eb49232 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
        function accesslist() {
-               global $db,$error,$node,$error_messages,$logger;
+               global $db,$error,$node,$error_messages;
                $node_id=$node['node_id'];
                $access=explode(";",$_POST['access']);
 
@@ -22,7 +22,7 @@ return false;
                                        $q="insert into node_access set node_permission='access',node_id=$node_id,user_id=".$set->getString('user_id');
                                        $db->query($q);
                                }
-                               $logger->log('add access',$node_id,'ok',$acc);
+                               logger::log('add access',$node_id,'ok',$acc);
                        }
                        else { $error .= "$acc does not exist..."; }
                }
index 9d4633266150e43ba9a6ddc5faec31e777994473..d817840602ddba28b6674bfb6a0c1646643e40f2 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
        function banlist() {
-               global $db,$error,$node,$logger;
+               global $db,$error,$node;
                $node_id=$node['node_id'];
 
 if ($node['node_permission']!=('owner' || 'master' || 'op')) {
@@ -22,7 +22,7 @@ return false;
                                        $q="insert into node_access set node_permission='ban',node_id=$node_id,user_id=".$set->getString('user_id');
                                        $db->query($q);
                                }
-                               $logger->log('add ban',$node_id,'ok',$ban);
+                               logger::log('add ban',$node_id,'ok',$ban);
                        }
                        else { $error .= "$ban does not exist..."; }
                }
index 31846ff74cb272ba5d2e6ade4e1d5ed10deefd07..9fab234852e1c11027eb030dbba91dd24f3d7266 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 function configure_parent() {
-       global $db,$error,$node,$logger;
+       global $db,$error,$node;
        $user_id=$_SESSION['user_id'];
 
                        if (empty($_POST['node_creator'])) {
@@ -50,7 +50,7 @@ function configure_parent() {
                                $db->update($q);
                                $q="update nodes set node_children_count=node_children_count-1 where node_id='$old_parent'";
                                $db->update($q);
-                               $logger->log('vector change',$changed,$old_vector,$node_vector);
+                               logger::log('vector change',$changed,$old_vector,$node_vector);
                        }
                        return true;
 ?>
index 18ff63c8fb9b4f7b54e5f3e3d39f6ea59b38b785..a5e426acaca17ea2c73b642f880b3a976be06bfe 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 function executelist() {
-    global $db,$error,$node,$logger;
+    global $db,$error,$node;
     $node_id=$node['node_id'];
     $silence=explode(";",$_POST['execute']);
     if (($node['node_permission']!='owner') && ($node['node_permission']!='master')) {
@@ -18,7 +18,7 @@ function executelist() {
                 $q="insert into node_access set node_permission='execute',node_id=$node_id,user_id=".$set->getString('user_id');
                 $db->query($q);
             }
-            $logger->log('add execute',$node_id,'ok',$execute);
+            logger::log('add execute',$node_id,'ok',$execute);
         }else { $error .= "$execute does not exist..."; }
     }
 }
index a00468cbd7b73e41b7f3361bdc01d129735775f8..8a0714fde3b19a9abd51a98efe9278e75573dc62 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
         function executorlist() {
-                global $db,$error,$node,$logger;
+                global $db,$error,$node;
                 $node_id=$node['node_id'];
                 if ($node['node_permission']!='owner') {
                         $error=$error_messages['EVENT_PERMISSION_ERROR'];
@@ -22,7 +22,7 @@ user_id='".$set->getString('user_id')."'";
                                         $q="insert into node_access set
 node_permission='exec',node_id=$node_id,user_id=".$set->getString('user_id');
                                         $db->query($q);
-                                        $logger->log('add exec',$node_id,'ok',$executor);
+                                        $logger::log('add exec',$node_id,'ok',$executor);
 
                                 }
                         }
index 2d5ddb57b7477043d59d08bd3a56c48f130148ba..f2434e3735c2db79f15250743b6371cc3715ff31 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
        function logout() {
-               global $db,$logger;
+               global $db;
                $q="update users set user_action_id=null where user_id='".$_SESSION['user_id']."'";
                $db->query($q);
-               $logger->log('logout',$node['node_id'],'ok',$_SESSION['user_name']); 
+               $logger::log('logout',$node['node_id'],'ok',$_SESSION['user_name']); 
                session_unset();
                Header("Location: /main");
        }
index 62832f0d606804d3deb4dd970ab4dca56707fd23..9d4fb4257ffa1c49a13faf1a8c4012010c213620 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
        function masterlist() {
-               global $db,$error,$node,$logger;
+               global $db,$error,$node;
                $node_id=$node['node_id'];
 if (($node['node_permission']!='owner') && ($node['node_permission']!='master')) {
 $error=$error_messages['EVENT_PERMISSION_ERROR'];
@@ -18,7 +18,7 @@ return false;
                                if (!$changed) {
                                        $q="insert into node_access set node_permission='master',node_id=$node_id,user_id=".$set->getString('user_id');
                                        $db->query($q);
-                                       $logger->log('add master',$node_id,'ok',$master);
+                                       logger::log('add master',$node_id,'ok',$master);
 
                                }
                        }
index f78bc560664361ea6d93f02dddbb698ace8a5bf6..8fc130ee05293d8e131d65a9da51d948cd03f9de 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 function oplist() {
-    global $db,$error,$node,$logger;
+    global $db,$error,$node;
     $node_id=$node['node_id'];
 
     if (($node['node_permission']!='owner') && ($node['node_permission']!='master')) {
@@ -21,7 +21,7 @@ function oplist() {
                 echo $q;
                 $db->query($q);
             }
-            $logger->log('add op',$node_id,'ok',$op);
+            logger::log('add op',$node_id,'ok',$op);
         }else { $error .= "$op does not exist..."; }
     }
 }
index eb59651f5e6981ffa1e70d72b55192b9adc2386e..5cd1a799b7134792ad7a857df0640491e8bee943 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
        function silencelist() {
-               global $db,$error,$node,$logger;
+               global $db,$error,$node;
                $node_id=$node['node_id'];
                $silence=explode(";",$_POST['silence']);
 
@@ -20,7 +20,7 @@ return false;
                                        $q="insert into node_access set node_permission='silence',node_id=$node_id,user_id=".$set->getString('user_id');
                                        $db->query($q);
                                }
-                               $logger->log('add silence',$node_id,'ok',$sil);
+                               logger::log('add silence',$node_id,'ok',$sil);
                        }
                        else { $error .= "$sil does not exist..."; }
                }
index 227f713b019857084c30d96974ce06a7e2b12177..6ab4b4677715a21e5bbc7c287f6816084894cab8 100644 (file)
@@ -1,18 +1,18 @@
 <?php
        function unbook() {
 
-               global $db,$error,$node,$logger;
+               global $db,$error,$node;
                $q="update neurons set link='soft' where synapse_creator='".$_SESSION['user_id']."' and src='".$node['node_id']."' and link='bookmark'";
                $result=$db->update($q);
 
                $q="update node_access set last_visit='',node_bookmark='no' where user_id='".$_SESSION['user_id']."' and node_id='".$node['node_id']."'";
                $result=$db->query($q);
                if ($result) {
-                       $logger->log('unbook','ok');
+                       logger::log('unbook','ok');
                        return true;
                }
                else {
-                       $logger->log('unbook','failed');
+                       logger::log('unbook','failed');
                        $error='unbook failed';
                        return false;
                }
index f575f63491ca8e309d09edfe06cd1bcb39c6a835..5a35b16ef945de197209bbd7552f73658b42ec99 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 class logger {
 
-       function log($action,$node_id,$result,$parameter1='',$parameter2='') {
+       public static function log($action,$node_id,$result,$parameter1='',$parameter2='') {
 
                global $db,$node;
                $user_id = isSet($_SESSION['user_id'])?$_SESSION['user_id']:"";
index efd21bc4f11548ddf1d15b54218e68675f49d8da..2f63e55265648747b7ef17714ac58858916eabac 100644 (file)
@@ -28,7 +28,7 @@ function addNode($params) {
         $parent_permissions=permissions::checkPermissions($parent_id);
         if (!$parent_permissions['w']) {
                 $error=$error_messages['WRITE_PERMISSION_ERROR'];
-                $logger->log('add','error','WRITE_PERMISSION_ERROR');
+                logger::log('add','error','WRITE_PERMISSION_ERROR');
                 return false;
         }
 
@@ -100,8 +100,7 @@ node_vector='".$params['node_vector']."'";
         --$user_k;
         $db->query("update users set user_k='$user_k' where user_id='$params[node_creator]'");
         $db->query("commit");
-                               global $logger;
-        $logger->log('add','ok',$id);
+        logger::log('add','ok',$id);
 
         if ($_POST['code']) {
                 $params['node_creator']=UBIK_ID;
index ff90b6f14a009cca962a241d07fbff8a6653ab77..ef084411e09ba510e153f8fb35e52f64f31739a3 100644 (file)
@@ -42,7 +42,7 @@ require(INCLUDE_DIR.'error_messages.inc');
 require(INCLUDE_DIR.'database.inc');
 
 $db = new CLASS_DATABASE();
-$logger = new logger; //XXX
+//$logger = new logger; //XXX
 
 if (!empty($_GET['template_id'])) {
        $template_id=$_GET['template_id'];
@@ -283,7 +283,7 @@ if ($_SESSION['user_id']) {
 //if node is css
 if ($node['template_id']!='2019721'){
 
-       $logger->log('enter',$node['node_id'],'ok',$node['node_user_subchild_count']);
+       logger::log('enter',$node['node_id'],'ok',$node['node_user_subchild_count']);
        if (!empty($_SESSION['user_id']) && is_numeric($node['node_id'])) {
                $q="update node_access set visits=visits+1,node_user_subchild_count='0',last_visit=NOW() where node_id='".$node['node_id']."' and user_id='".$_SESSION['user_id']."'";
 //             echo $q;
@@ -330,7 +330,7 @@ elseif (!$permissions['r'] && $_GET['magic_word']) {
 
 
 else {
-       $logger->log('enter',$node['node_id'],'failed');
+       logger::log('enter',$node['node_id'],'failed');
 }
 
 
This page took 0.300051 seconds and 4 git commands to generate.