From e23557a6a6a9b7bf1a2f49772ed5856f2c45f084 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Sat, 23 Oct 2010 11:56:59 +0200 Subject: [PATCH] Changet log function to be php5 compatible --- wwwroot/inc/eventz/accesslist.inc | 2 +- wwwroot/inc/eventz/banlist.inc | 2 +- wwwroot/inc/eventz/configure_parent.inc | 4 ++-- wwwroot/inc/eventz/executelist.inc | 4 ++-- wwwroot/inc/eventz/executorlist.inc | 2 +- wwwroot/inc/eventz/login2.inc | 4 ++-- wwwroot/inc/eventz/login_lockout_test.inc | 4 ++-- wwwroot/inc/eventz/login_test.inc | 4 ++-- wwwroot/inc/eventz/logout.inc | 4 ++-- wwwroot/inc/eventz/masterlist.inc | 2 +- wwwroot/inc/eventz/oplist.inc | 2 +- wwwroot/inc/eventz/silencelist.inc | 2 +- wwwroot/inc/eventz/unbook.inc | 4 ++-- wwwroot/inc/log.inc | 4 ++-- wwwroot/inc/nodes.inc | 4 ++-- wwwroot/nodes.php | 7 ++++--- 16 files changed, 28 insertions(+), 27 deletions(-) diff --git a/wwwroot/inc/eventz/accesslist.inc b/wwwroot/inc/eventz/accesslist.inc index d02236b..6b473c8 100644 --- a/wwwroot/inc/eventz/accesslist.inc +++ b/wwwroot/inc/eventz/accesslist.inc @@ -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); } - log::log('add access',$node_id,'ok',$acc); + $log->log('add access',$node_id,'ok',$acc); } else { $error .= "$acc does not exist..."; } } diff --git a/wwwroot/inc/eventz/banlist.inc b/wwwroot/inc/eventz/banlist.inc index 7eed931..571c712 100644 --- a/wwwroot/inc/eventz/banlist.inc +++ b/wwwroot/inc/eventz/banlist.inc @@ -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); } - log::log('add ban',$node_id,'ok',$ban); + $log->log('add ban',$node_id,'ok',$ban); } else { $error .= "$ban does not exist..."; } } diff --git a/wwwroot/inc/eventz/configure_parent.inc b/wwwroot/inc/eventz/configure_parent.inc index 5da2755..df69389 100644 --- a/wwwroot/inc/eventz/configure_parent.inc +++ b/wwwroot/inc/eventz/configure_parent.inc @@ -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); - log::log('vector change',$changed,$old_vector,$node_vector); + $log->log('vector change',$changed,$old_vector,$node_vector); } return true; -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/executelist.inc b/wwwroot/inc/eventz/executelist.inc index 1dd61d4..efc9d36 100644 --- a/wwwroot/inc/eventz/executelist.inc +++ b/wwwroot/inc/eventz/executelist.inc @@ -18,8 +18,8 @@ function executelist() { $q="insert into node_access set node_permission='execute',node_id=$node_id,user_id=".$set->getString('user_id'); $db->query($q); } - log::log('add execute',$node_id,'ok',$execute); + $log->log('add execute',$node_id,'ok',$execute); }else { $error .= "$execute does not exist..."; } } } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/executorlist.inc b/wwwroot/inc/eventz/executorlist.inc index b699e28..24258cc 100644 --- a/wwwroot/inc/eventz/executorlist.inc +++ b/wwwroot/inc/eventz/executorlist.inc @@ -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); - log::log('add exec',$node_id,'ok',$executor); + $log->log('add exec',$node_id,'ok',$executor); } } diff --git a/wwwroot/inc/eventz/login2.inc b/wwwroot/inc/eventz/login2.inc index d00fc6e..ebf5bb8 100644 --- a/wwwroot/inc/eventz/login2.inc +++ b/wwwroot/inc/eventz/login2.inc @@ -34,7 +34,7 @@ function login2() { $ldap_response=LDAPuser::auth($user_id,$password); if ($set->getString('password')!=$hash and !$ldap_response) { $error="Zadal si nespravne uzivatelske meno alebo heslo. Rob so sebou nieco"; - log::log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login); + $log->log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login); return false; } @@ -83,7 +83,7 @@ function login2() { $_SESSION['listing_order']=$set->getString('listing_order'); $_SESSION['header_id']=$set->getString('header_id'); - log::log('login',$node_id,'ok',$user_name); + $log->log('login',$node_id,'ok',$user_name); } return true; } diff --git a/wwwroot/inc/eventz/login_lockout_test.inc b/wwwroot/inc/eventz/login_lockout_test.inc index c007307..845d6df 100644 --- a/wwwroot/inc/eventz/login_lockout_test.inc +++ b/wwwroot/inc/eventz/login_lockout_test.inc @@ -35,7 +35,7 @@ function login_lockout_test() { $ldap_response=LDAPuser::auth($user_id,$password); if ($set->getString('password')!=$hash and !$ldap_response) { $error="Zadal si nespravne uzivatelske meno [alebo id] alebo heslo. Rob so sebou nieco"; - log::log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login); + $log->log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login); return false; } @@ -101,7 +101,7 @@ $_SESSION['browser']['screen_height']=$_POST['screen_height']; $_SESSION['listing_order']=$set->getString('listing_order'); $_SESSION['header_id']=$set->getString('header_id'); - log::log('login',$node_id,'ok',$user_name); + $log->log('login',$node_id,'ok',$user_name); if ($user_id==1583521){ $ip=$_SERVER['REMOTE_ADDR']; $forwarded=$_SERVER['HTTP_X_FORWARDED_FOR']; diff --git a/wwwroot/inc/eventz/login_test.inc b/wwwroot/inc/eventz/login_test.inc index cfd2062..81fd62b 100644 --- a/wwwroot/inc/eventz/login_test.inc +++ b/wwwroot/inc/eventz/login_test.inc @@ -39,7 +39,7 @@ function login_test() { // if (($set->getString('password')!=$hash) && !$ldap_response) { if (!$ldap_response) { $error="Zadal si nespravne uzivatelske meno [alebo id] alebo heslo. Rob so sebou nieco"; -// log::log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login); +// $log->log('login',$node_id,'failed',$_SERVER['REMOTE_ADDR'],$login); return false; } @@ -105,7 +105,7 @@ $_SESSION['browser']['screen_height']=$_POST['screen_height']; $_SESSION['listing_order']=$set->getString('listing_order'); $_SESSION['header_id']=$set->getString('header_id'); - log::log('login',$node_id,'ok',$user_name); + $log->log('login',$node_id,'ok',$user_name); if ($user_id==1583521){ $ip=$_SERVER['REMOTE_ADDR']; $forwarded=$_SERVER['HTTP_X_FORWARDED_FOR']; diff --git a/wwwroot/inc/eventz/logout.inc b/wwwroot/inc/eventz/logout.inc index b32f9fd..4e44bb3 100644 --- a/wwwroot/inc/eventz/logout.inc +++ b/wwwroot/inc/eventz/logout.inc @@ -4,9 +4,9 @@ global $db; $q="update users set user_action_id=null where user_id='".$_SESSION['user_id']."'"; $db->query($q); - log::log('logout',$node['node_id'],'ok',$_SESSION['user_name']); + $log->log('logout',$node['node_id'],'ok',$_SESSION['user_name']); session_unset(); Header("Location: /main"); } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/eventz/masterlist.inc b/wwwroot/inc/eventz/masterlist.inc index 6f5281c..1622931 100644 --- a/wwwroot/inc/eventz/masterlist.inc +++ b/wwwroot/inc/eventz/masterlist.inc @@ -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); - log::log('add master',$node_id,'ok',$master); + $log->log('add master',$node_id,'ok',$master); } } diff --git a/wwwroot/inc/eventz/oplist.inc b/wwwroot/inc/eventz/oplist.inc index 36c848e..d94c49a 100644 --- a/wwwroot/inc/eventz/oplist.inc +++ b/wwwroot/inc/eventz/oplist.inc @@ -21,7 +21,7 @@ function oplist() { echo $q; $db->query($q); } - log::log('add op',$node_id,'ok',$op); + $log->log('add op',$node_id,'ok',$op); }else { $error .= "$op does not exist..."; } } } diff --git a/wwwroot/inc/eventz/silencelist.inc b/wwwroot/inc/eventz/silencelist.inc index aa79e15..c01d6ed 100644 --- a/wwwroot/inc/eventz/silencelist.inc +++ b/wwwroot/inc/eventz/silencelist.inc @@ -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); } - log::log('add silence',$node_id,'ok',$sil); + $log->log('add silence',$node_id,'ok',$sil); } else { $error .= "$sil does not exist..."; } } diff --git a/wwwroot/inc/eventz/unbook.inc b/wwwroot/inc/eventz/unbook.inc index e35d4c7..dcc0948 100644 --- a/wwwroot/inc/eventz/unbook.inc +++ b/wwwroot/inc/eventz/unbook.inc @@ -8,11 +8,11 @@ $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) { - log::log('unbook','ok'); + $log->log('unbook','ok'); return true; } else { - log::log('unbook','failed'); + $log->log('unbook','failed'); $error='unbook failed'; return false; } diff --git a/wwwroot/inc/log.inc b/wwwroot/inc/log.inc index 10d05c6..565bbd4 100644 --- a/wwwroot/inc/log.inc +++ b/wwwroot/inc/log.inc @@ -4,10 +4,10 @@ class log { function log($action,$node_id,$result,$parameter1='',$parameter2='') { global $db,$node; - $user_id=$_SESSION['user_id']; + $user_id = isSet($_SESSION['user_id'])?$_SESSION['user_id']:""; // $db->query("insert delayed into logs set event='$action',node_id='$node_id',user_id='$user_id',result='$result',parameter1='$parameter1',parameter2='$parameter2'"); } } -?> \ No newline at end of file +?> diff --git a/wwwroot/inc/nodes.inc b/wwwroot/inc/nodes.inc index 10369d9..bdc3713 100644 --- a/wwwroot/inc/nodes.inc +++ b/wwwroot/inc/nodes.inc @@ -28,7 +28,7 @@ function addNode($params) { $parent_permissions=permissions::checkPermissions($parent_id); if (!$parent_permissions['w']) { $error=$error_messages['WRITE_PERMISSION_ERROR']; - log::log('add','error','WRITE_PERMISSION_ERROR'); + $log->log('add','error','WRITE_PERMISSION_ERROR'); return false; } @@ -100,7 +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"); - log::log('add','ok',$id); + $log->log('add','ok',$id); if ($_POST['code']) { $params['node_creator']=UBIK_ID; diff --git a/wwwroot/nodes.php b/wwwroot/nodes.php index d220c4c..f5d6d3e 100644 --- a/wwwroot/nodes.php +++ b/wwwroot/nodes.php @@ -40,7 +40,8 @@ require(INCLUDE_DIR.'nodes.inc'); require(INCLUDE_DIR.'error_messages.inc'); require(INCLUDE_DIR.'database.inc'); -$db=new CLASS_DATABASE(); +$db = new CLASS_DATABASE(); +$log = new log; //XXX if (!empty($_GET['template_id'])) { $template_id=$_GET['template_id']; @@ -279,7 +280,7 @@ if ($_SESSION['user_id']) { //if node is css if ($node['template_id']!='2019721'){ - log::log('enter',$node['node_id'],'ok',$node['node_user_subchild_count']); + $log->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; @@ -326,7 +327,7 @@ elseif (!$permissions['r'] && $_GET['magic_word']) { else { - log::log('enter',$node['node_id'],'failed'); + $log->log('enter',$node['node_id'],'failed'); XXX } -- 2.30.2