#!/usr/bin/php
<?php
-//require('/storage/system/www-docroot/kyberia.sk/config/config.inc');
-require('/home/freezy/kyb/config/config.inc');
-//connecting to database and creating universal $db object
+
+//XXX fix full path
+require('/storage/system/www-docroot/kyberia/config/config.inc');
+
//require(SYSTEM_ROOT.'/inc/log.inc');
-//require(SYSTEM_ROOT.'/inc/database.inc');
+require(SYSTEM_ROOT.'/inc/database.inc');
//require(SYSTEM_ROOT.'/inc/nodes.inc');
-//require('/storage/system/www-docroot/kyberia.sk/inc/log.inc');
-//require('/storage/system/www-docroot/kyberia.sk/inc/database.inc');
-require('/home/freezy/kyb/inc/database.inc');
-//require('/storage/system/www-docroot/kyberia.sk/inc/nodes.inc');
$db=new CLASS_DATABASE();
$db->query("update users set user_action=NULL,user_action_id=NULL,user_location_vector=NULL where unix_timestamp()-3600>unix_timestamp(last_action)");
?>
$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);
+ $logger->log('add access',$node_id,'ok',$acc);
}
else { $error .= "$acc does not exist..."; }
}
$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);
+ $logger->log('add ban',$node_id,'ok',$ban);
}
else { $error .= "$ban does not exist..."; }
}
$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);
+ $logger->log('vector change',$changed,$old_vector,$node_vector);
}
return true;
?>
$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);
+ $logger->log('add execute',$node_id,'ok',$execute);
}else { $error .= "$execute does not exist..."; }
}
}
$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);
+ $logger->log('add exec',$node_id,'ok',$executor);
}
}
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']); //obnovit kdyz to bude mozne. ~harvie
+ $logger->log('logout',$node['node_id'],'ok',$_SESSION['user_name']);
session_unset();
Header("Location: /main");
}
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);
+ $logger->log('add master',$node_id,'ok',$master);
}
}
echo $q;
$db->query($q);
}
- $log->log('add op',$node_id,'ok',$op);
+ $logger->log('add op',$node_id,'ok',$op);
}else { $error .= "$op does not exist..."; }
}
}
$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);
+ $logger->log('add silence',$node_id,'ok',$sil);
}
else { $error .= "$sil does not exist..."; }
}
$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');
+ $logger->log('unbook','ok');
return true;
}
else {
- $log->log('unbook','failed');
+ $logger->log('unbook','failed');
$error='unbook failed';
return false;
}
<?php
-class log {
+class logger {
function log($action,$node_id,$result,$parameter1='',$parameter2='') {
$parent_permissions=permissions::checkPermissions($parent_id);
if (!$parent_permissions['w']) {
$error=$error_messages['WRITE_PERMISSION_ERROR'];
- $log->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");
- $log->log('add','ok',$id);
+ $logger->log('add','ok',$id);
if ($_POST['code']) {
$params['node_creator']=UBIK_ID;
<?php
function smarty_function_get_search($params,&$smarty) {
-/*
-$string=escapeshellarg($params['query']);
-$output=`/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f
-/storage/data/index.swish-e -w node_name=($string) or node_content=($string)`;
-//$output2=`/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f
-/storage/data/index.swish-e -w '$string'`;
-//echo "/usr/local/bin/swish-e -d ::: -p node_name node_id node_type node_content k node_views -s node_views -f
-/storage/data/index.swish-e -w $string";
-//$output=$output1.$output2;
-$output=str_replace($params['query'],"<span
-class='most_important'>".$params['query']."</span>",$output);
-preg_match_all("/:::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?):::(.*?)n/i",$output,$matches);
-foreach($matches[0] as $key => $value) {
-preg_match("/(.*?).xml/i",$matches[2][$key],$ids);
-$id=$ids[1];
-echo "<a href='/id/".$id."'>".$matches[4][$key]."</a>
-(".$matches[6][$key].")<br>";
-echo $matches[7][$key]."<br><br>";
-//echo $matches[5][$key]."<br><br>";
-}
-
-global $db, $node;
-
-$q = "SELECT * FROM nodes WHERE node_system_access!='private' AND template_id=3 AND node_name LIKE
-'%".
-str_replace(array("%", "_"), array('%', '_'),
-addslashes($params['query']))."%'";
-$set=$db->query($q);
-while($set->next()) {
-$rec = $set->getRecord();
-echo "<a href='/id/{$rec[node_id]}'>{$rec[node_name]}</a><br>";
-}
-*/
global $db, $node;
if (is_numeric($params['offset'])) $offset = $params['offset'];
else $offset = 0;
$smarty->assign('get_search',$search);
}
-?>
\ No newline at end of file
+?>
require(INCLUDE_DIR.'database.inc');
$db = new CLASS_DATABASE();
-$log = new log; //XXX
+$logger = new logger; //XXX
if (!empty($_GET['template_id'])) {
$template_id=$_GET['template_id'];
//if node is css
if ($node['template_id']!='2019721'){
- $log->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 {
- $log->log('enter',$node['node_id'],'failed');
+ $logger->log('enter',$node['node_id'],'failed');
}