still cleaning warnings
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / smarty / node_methodz / function.get_k_neurons.php
index b43bf952c7983079215d892f1e697be1ee7ccc8c..c188c6ea7f8d70fe81109d8ae670e8f8b9480452 100644 (file)
@@ -1,34 +1,27 @@
 <?php
-       function smarty_function_get_k_neurons($params,&$smarty) {
 
-               global $db,$node;
-               if (is_numeric($params['offset'])) $offset=$params['offset'];
-               else $offset=0;
-               if (is_numeric($params['listing_amount'])) $listing_amount=$params['listing_amount'];
-               else $listing_amount=DEFAULT_LISTING_AMOUNT;
-               if (!is_numeric($_POST['interval'])) $interval=1;
-               else $interval = $_POST['interval'];
-               if ($params['vector']) {
-                       $vector=$params['vector'];
-                       $interval=365;
-               }
-               else $vector="00";
-
-// XXX backend
-
-$q="select nodes.*,parent.node_name as parent_name,users.login as creator
- from nodes left join nodes as parent on nodes.node_parent=parent.node_id
- left join users on users.user_id=nodes.node_creator where nodes.node_created>now()-interval $interval day
-  and nodes.node_vector like '$vector%' and nodes.k>0 and nodes.node_system_access!='private' order by nodes.k desc limit $offset,$listing_amount";
-
-               $set=$db->query($q);
-               while ($set->next()) {
-                       $k_array[]=$set->getRecord();
-               }
-
-               $smarty->assign('get_k',$k_array);
-
-
-
-       }
+function smarty_function_get_k_neurons($params,&$smarty) {
+
+       global $db;
+       if (isset($params['offset']) && (is_numeric($params['offset']))) {
+               $offset=$params['offset'];
+       } else {$offset=20;} 
+       if (isset($params['listing_amount']) && (is_numeric($params['listing_amount']))) {
+               $listing_amount=$params['listing_amount'];
+       } else {$listing_amount=DEFAULT_LISTING_AMOUNT;}
+       if (isset($_POST['interval']) && (is_numeric($_POST['interval']))) {
+               $interval= $_POST['interval'];
+       } else {$interval = 1;}
+       if (isset($params['vector']) && ($params['vector'])) {
+               $vector=$params['vector'];
+               $interval=365;
+       } else {$vector="00";}
+
+               
+       // XXX other parameters
+       $k_array=nodes::getKNeurons($_SESSION['user_id'],$offset);
+
+
+       $smarty->assign('get_k_neurons',$k_array);
+}
 ?>
This page took 0.139274 seconds and 4 git commands to generate.