get_nodes_by_type and logout moved to backend, warnings cleanup
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / smarty / node_methodz / function.get_nodes_by_type.php
index e72b975fbc58518aa03d169aadaaa32674fb24ee..136500ca3b385e7c60bb365b95f17dad3833034f 100644 (file)
@@ -1,32 +1,25 @@
 <?php
 
-       function smarty_function_get_nodes_by_type($params,&$smarty) {
-               global $node;
-               $type=$params['type'];
-               if ($params['listing_amount']=='all') $listing_amount='2323232323232323';
-               else $listing_amount=$params['listing_amount'];
-               if (empty($params['offset'])) $offset=0;
-               else $offset=$params['offset'];
-               if ($params['vector']) {
-                       $vector=addslashes($params['vector']);
-               }
-               if ($params['orderby']) {
-                       $orderby=addslashes($params['orderby']);
-               }
+function smarty_function_get_nodes_by_type($params,&$smarty) {
+       global $node;
 
-               global $db,$node;
-               $node_id=$node['node_id'];
-               $user_id=$_SESSION['user_id'];
-               $q="select parent.node_name as parent_name,users.*,nodes.*,node_access.node_user_subchild_count from nodes left join nodes as parent on parent.node_id=nodes.node_parent left join node_access on node_access.node_id=nodes.node_id and node_access.user_id='$user_id'  left  join users on users.user_id=nodes.node_creator where ";
-               if ($vector) $q.="nodes.node_vector like '$vector%' and";
-               $q.=" nodes.template_id='$type' and nodes.node_system_access!='private'";
-               if ($orderby) $q.=" order by $orderby ";
-               else $q.=" order by nodes.node_id desc ";
-               $q.= " LIMIT $offset,$listing_amount ";
-               $set=$db->query($q);
+       $type=$params['type'];
+       if ($params['listing_amount']=='all') $listing_amount=DEF_MAX_LISTING_AMMOUNT;
+       else $listing_amount=$params['listing_amount'];
+       if (empty($params['offset'])) $offset=0;
+       else $offset=$params['offset'];
+       if ($params['vector']) {
+               $vector=$params['vector'];
+       }
+       if ($params['orderby']) {
+               $orderby=$params['orderby'];
+       }
+       $node_id=$node['node_id'];
+       $user_id=$_SESSION['user_id'];
 
-               while ($set->next()) $pole[]=$set->getRecord();
-               $smarty->assign('get_nodes_by_type',$pole);
+       $result=nodes::getNodesByType(isset($vector)?$vector:"",$user_id,$type,isset($orderby)?$orderby:"",$offset,$listing_amount);
 
-       }
-?>
\ No newline at end of file
+       $smarty->assign('get_nodes_by_type',$result);
+
+}
+?>
This page took 0.135656 seconds and 4 git commands to generate.