removing warning messages and not working rss
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / display.inc
index 76ad8bd12afaceb078de2786deed7b1dce790e4f..8518cdf7f242db6c7e260a9f894849a7710c10c7 100644 (file)
@@ -1,10 +1,12 @@
 <?php
 function display() {
-       global $node,$db,$error,$referer_id,$smarty,$permissions;
+       global $node,$db,$error,$referer_id,$smarty,$permissions,$template_id;
+       global $timer_start;
        if (!$referer_id) $referer_id=1;
+       $content='';
 
        $node_id=$node['node_id'];
-       $user_id=$_SESSION['user_id'];
+       $user_id=(empty($_SESSION['user_id'])) ? "" : $_SESSION['user_id'];
 
 if ($permissions['r']) {
 
@@ -49,35 +51,20 @@ if ($node['template_id']!='2019721'){
 //     }
 // }
 
-// DO NOT MESS WITH THIS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-//creating neural network
-$db->update("update nodes set node_views=node_views+1 where node_id='".$node['node_id']."'");
-if (isset($referer_id) && is_numeric($referer_id)) {
-       $q="update neurons set synapse=synapse+1 where dst='".$node['node_id']."' and src='$referer_id'";
-       $result=$db->update($q);
-       if (!$result) {
-               $q="insert into neurons set synapse_creator='".$_SESSION['user_id']."',dst='".$node['node_id']."',src='$referer_id',synapse=1";
-               $db->query($q);
-               }
-} else {
-       logger::log('enter',$node['node_id'],'failed');
-}
-
-
 
 //assigning user data to smarty if user logged in
 if (isset($_SESSION['user_id'])&&($user_id=$_SESSION['user_id'])) {
        $smarty->assign('_POST',$_POST);
        $smarty->assign('bookmarks',$_SESSION['bookmarks']);
-       $smarty->assign('ignore',$_SESSION['ignore']);
+       if (isset($_SESSION['ignore'])) { $smarty->assign('ignore',$_SESSION['ignore']); };
        $smarty->assign('bookstyl',$_SESSION['bookstyl']);
-       $smarty->assign('fook',$_SESSION['fook']);
+       if (isset($_SESSION['fook'])) {$smarty->assign('fook',$_SESSION['fook']); };
        $smarty->assign('user_id',$_SESSION['user_id']);
        $smarty->assign('user_name',$_SESSION['user_name']);
        if (!empty($_SESSION['cube_vector'])) 
                $smarty->assign('cube_vector',$_SESSION['cube_vector']);
         $smarty->assign('friends',$_SESSION['friends']); //req by freezy, done by darkaural
-       $smarty->assign('user_quota',$_SESSION['user_quota']);
+       if (isset($_SESSION['user_quota'])) {$smarty->assign('user_quota',$_SESSION['user_quota']);};
 
        // XXX into function
        $newmail_q = sprintf('select u.user_mail_id
@@ -147,7 +134,6 @@ if ($permissions['r']) {
        $smarty->assign('node_json',json_encode($node));
 }
 else {
-
        $smarty->assign('node',$node);
        //new templates by Dark matter
        $smarty->template_dir=OWN_TEMPLATE_DIR;
@@ -167,7 +153,7 @@ else {
 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->executequery($q);
+$db->query($q);
 }
 
 $whole_time=SubStr((Time()+SubStr(MicroTime(),0,8)-$timer_start),0,7);
@@ -241,13 +227,13 @@ if (!empty($_POST['template_event'])) {
        $descendant_count=$node['node_descendant_count'];
 
         if (isset($_POST['listing_amount']) && is_numeric($_POST['listing_amount'])) { 
-               $listing_amount=mysql_real_escape_string($_POST['listing_amount']);
+               $listing_amount=db_escape_string($_POST['listing_amount']);
        }elseif (!empty($_SESSION['listing_amount'])) $listing_amount=$_SESSION['listing_amount'];
         else $listing_amount=DEFAULT_LISTING_AMOUNT;
        $smarty->assign('listing_amount',$listing_amount);
 
        if (isset($_POST['listing_order']) && $_POST['listing_order']) {
-               $listing_order=mysql_real_escape_string($_POST['listing_order']);
+               $listing_order=db_escape_string($_POST['listing_order']);
        } elseif (!empty($_SESSION['listing_order'])) $listing_order=$_SESSION['listing_order'];
        else $listing_order=DEFAULT_LISTING_ORDER;
        $smarty->assign('listing_order',$listing_order);
@@ -260,24 +246,25 @@ if (!empty($_POST['template_event'])) {
         //movement forward and backward
 //     if ($listing_order=='asc' && !$offset) $offset=$descendant_count-$listing_amount;
 
-        if ($_POST['get_children_move']=='<') {
-               $offset=$offset-$listing_amount;
-                     if ($offset<0) $offset=0;
-        }
-        elseif ($_POST['get_children_move']=='>') {
-               $offset=$offset+$listing_amount;
-        }
-       elseif ($_POST['get_children_move']=='>>') {
-               $offset=$descendant_count-$listing_amount;
-               }
-
-        elseif ($_POST['get_children_move']=='<<') {
-               $offset=0;
-        }
-        if ($offset<0) $offset=0;
-        $_POST['offset']=$offset;
-        $smarty->assign('offset',$offset);
+       if (isset($_POST['get_children_move'])) { 
+               if ($_POST['get_children_move']=='<') {
+                       $offset=$offset-$listing_amount;
+                       if ($offset<0) $offset=0;
+               }
+               elseif ($_POST['get_children_move']=='>') {
+                       $offset=$offset+$listing_amount;
+               }
+               elseif ($_POST['get_children_move']=='>>') {
+                       $offset=$descendant_count-$listing_amount;
+               }
 
+               elseif ($_POST['get_children_move']=='<<') {
+                       $offset=0;
+               }
+       }
+       if ($offset<0) $offset=0;
+       $_POST['offset']=$offset; // XXX sqli?
+       $smarty->assign('offset',$offset);
 
 if ($node['external_link']=='header://svg' && !is_numeric($template_id)) {
        header("Content-Type: image/svg+xml");
@@ -308,6 +295,7 @@ else {
        $content.=$smarty->fetch($node['template_id'].".tpl");
 }
 
+// XXX remove constant
 if ($template_id=='2019721'){
        $content=$smarty->fetch($template_id.".tpl");
        echo $content;
@@ -318,5 +306,5 @@ if ($template_id=='2019721'){
 }
 //end of displaying
 
-       return false;
+       return true;
 }
This page took 0.119731 seconds and 4 git commands to generate.