X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=wwwroot%2Finc%2Feventz%2Fdisplay.inc;h=aff889de0186de9956419f3bef24fdc564bdeba8;hb=8fc54d8f71a9ba9526cd396fe8f5c6f4764fb6c3;hp=8518cdf7f242db6c7e260a9f894849a7710c10c7;hpb=13826e4f1ca35cbce3d20be1131a1b7dbf68ac7b;p=mirrors%2FKyberia-bloodline.git diff --git a/wwwroot/inc/eventz/display.inc b/wwwroot/inc/eventz/display.inc index 8518cdf..aff889d 100644 --- a/wwwroot/inc/eventz/display.inc +++ b/wwwroot/inc/eventz/display.inc @@ -10,19 +10,13 @@ function display() { if ($permissions['r']) { -// these 4 lines are not the source of kyberia lagging problems. -// leave them. started on the 10.4. // data gained will be used for scientific purposes -// if (isset($_SESSION['user_id']) { -// log_levenshtein($_SESSION['user_id'],$node['node_id']); -// } - if ((isset($_SESSION['user_id'])) && ($_SESSION['user_id'])) { - $q="insert delayed into levenshtein set user_id='".$_SESSION['user_id']."',node_id='".$node['node_id']."'"; - $db->update($q); + levenshteinLog($_SESSION['user_id'],$node['node_id']); } +// WTF //if node is css //XXX into function if ($node['template_id']!='2019721'){ @@ -30,7 +24,6 @@ if ($node['template_id']!='2019721'){ 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; $result=$db->update($q); if (!$result) { @@ -42,16 +35,6 @@ if ($node['template_id']!='2019721'){ } -//XXX into function -// if (isset($_SESSION['user_id']) { -// if (isset($referer_id)) { -// update_nodes($_SESSION['user_id'],$node['node_id'],$referer_id); -// } else { -// update_nodes($_SESSION['user_id'],$node['node_id'],0); -// } -// } - - //assigning user data to smarty if user logged in if (isset($_SESSION['user_id'])&&($user_id=$_SESSION['user_id'])) { $smarty->assign('_POST',$_POST); @@ -95,28 +78,16 @@ if (isset($_SESSION['user_id'])&&($user_id=$_SESSION['user_id'])) { $smarty->assign('k_wallet',$k_wallet); $user_id=$_SESSION['user_id']; - //mail node - if ($node['node_name']=='mail') { + //mail node //OMG remove constant + if ($node['node_id']==MAIL_NODE) { //clear new mail message - - if ($new_mail) $db->query("update users set user_mail=0 where user_id='$user_id'"); - - //set messages as delivered to recipient - $set=$db->query("select mail_id,mail_duplicate_id from mail where mail_user='$user_id' and mail_to='$user_id' and mail_read='no'"); - while($set->next()) { - $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_duplicate_id')."'"); - $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_id')."'"); - - $new_messages[$set->getString('mail_id')]=true; + if ($new_mail) { + //set messages as delivered + $db->query("update users set user_mail=0 where user_id='$user_id'"); + $db->query("update mail set mail_read='yes' where mail_to='$user_id' and mail_read='no'"); } -/* - if (count($new_messages)) { - $db->query("update mail set mail_read='yes' where mail_user='$user_id' and mail_user=mail_to and mail_read='no'"); - $smarty->assign('new_messages',$new_messages); - } -*/ } } @@ -150,28 +121,30 @@ else { // XXX into function -if (($node['template_id']!='2019721') && (isset($_SESSION['user_id']))){ -//setting user location -$q="update users set last_action=NOW(),user_location_vector='".$node['node_vector']."',user_action='".addslashes($node['node_name'])."',user_action_id='".$node['node_id']."' where user_id='".$_SESSION['user_id']."'"; -$db->query($q); +if (isset($_SESSION['user_id']) && ($_SESSION['user_id']!='')){ + //setting user location + $q="update users set last_action=NOW(),user_location_vector='". + $node['node_vector']."',user_action='".addslashes($node['node_name']). + "',user_action_id='".$node['node_id']."' where user_id='".$_SESSION['user_id']."'"; + $db->query($q); } $whole_time=SubStr((Time()+SubStr(MicroTime(),0,8)-$timer_start),0,7); $smarty->assign('whole_time',$whole_time); -if ($template_id=='download' OR $template_id=='download.jpg') { +if ($template_id=='data') { if ($permissions['r']) { - $linkname = SYSTEM_ROOT."/files/".$node['node_id']; - $filename= readlink($linkname); - $suffix=preg_replace("/(.*?)\.(.*?)/i","$2",$filename); - - $ext = substr( $filename,-3 ); - if( $filename == "" ) { - echo "ERROR: Empty file to download. "; - exit; - } elseif ( ! file_exists( $filename ) ) { - exit; + $linkname = FILE_DIR."/".$node['node_id']; + $filename= readlink($linkname); + $suffix=preg_replace("/(.*?)\.(.*?)/i","$2",$filename); + + $ext = substr( $filename,-3 ); + if( $filename == "" ) { + echo "ERROR: Empty file to download. "; + exit; + } elseif ( ! file_exists( $filename ) ) { + exit; }; switch( strtolower($ext) ){ case "pdf": $ctype="application/pdf"; break; @@ -203,16 +176,12 @@ if ($template_id=='download' OR $template_id=='download.jpg') { readfile("$filename"); exit(); } - else { echo "you don't have permissions for downloading this data"; die(); } + else { + echo "you don't have permissions for downloading this data"; + die(); + } } -if ($node['template_id']=='2019721'){ -Header("Cache-control: max-age=3600"); -}else{ -Header("Cache-control: no-cache"); -Header("Expires:".gmdate("D, d M Y H:i:s")." GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); -} //for cases like search & preview