<?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']);
$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..."; }
}
<?php
function banlist() {
- global $db,$error,$node,$logger;
+ global $db,$error,$node;
$node_id=$node['node_id'];
if ($node['node_permission']!=('owner' || 'master' || 'op')) {
$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..."; }
}
<?php
function configure_parent() {
- global $db,$error,$node,$logger;
+ global $db,$error,$node;
$user_id=$_SESSION['user_id'];
if (empty($_POST['node_creator'])) {
$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;
?>
<?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')) {
$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..."; }
}
}
<?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'];
$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);
}
}
<?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");
}
<?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'];
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);
}
}
<?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')) {
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..."; }
}
}
<?php
function silencelist() {
- global $db,$error,$node,$logger;
+ global $db,$error,$node;
$node_id=$node['node_id'];
$silence=explode(";",$_POST['silence']);
$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..."; }
}
<?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;
}
<?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']:"";
$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;
}
--$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;
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'];
//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;
else {
- $logger->log('enter',$node['node_id'],'failed');
+ logger::log('enter',$node['node_id'],'failed');
}