warnings cleanup
authorniekt0 <niekt0@kyberia.cz>
Tue, 27 Sep 2011 23:08:00 +0000 (01:08 +0200)
committerniekt0 <niekt0@kyberia.cz>
Tue, 27 Sep 2011 23:08:00 +0000 (01:08 +0200)
wwwroot/backend/mysql/permissions.inc
wwwroot/inc/smarty/node_methodz/function.get_bookmarks.php

index ce17117e55bf5c3b584ca5a3658ab18218f518da..234221cd546a64af9d18426dac5e1797d92aef69 100644 (file)
@@ -17,7 +17,7 @@ public static function checkPerms($node) {
                $node_id=$node;
        }
 
-       if (!$node_vector) {
+       if (empty($node_vector)) {
                $set=$db->query("select node_vector from  nodes where node_id='$node_id'");
                $set->next();
                $node_vector=$set->getString('node_vector');
index b413a36b633783d5e3f0753085ec1d318f8979b5..8744980f8dd40e5bd121ba10596f13a83004369c 100644 (file)
@@ -2,12 +2,12 @@
 
 function smarty_function_get_bookmarks($brawco,&$smarty) {
 
-if (is_numeric($brawco['node_id'])) $bookcat=$brawco['node_id'];
-if (is_numeric($brawco['user_id'])) $user_id=$brawco['user_id'];
+if ((!empty($brawco['node_id'])) && is_numeric($brawco['node_id'])) $bookcat=$brawco['node_id'];
+if ((!empty($brawco['user_id'])) && is_numeric($brawco['user_id'])) $user_id=$brawco['user_id'];
 global $db;
 
 //returning user specific bookmarks
-if ($user_id) {
+if ((!empty($user_id)) && $user_id) {
 $q="select * from node_access left join nodes on node_access.node_id=nodes.node_id where user_id='$user_id' and node_bookmark='yes' and nodes.node_system_access='public'";
 $set=$db->query($q);
 while ($set->next()) {
@@ -25,31 +25,31 @@ $categories[$result->getString('node_id')]=$result->getRecord();
 }
 
 $q="select * from node_access left join nodes on node_access.node_id=nodes.node_id where user_id='".$_SESSION['user_id']."' and node_bookmark='yes' and node_name is not NULL ";
-if ($bookcat) $q.=" and (bookmark_category='$bookcat' or bookmark_category=0 or bookmark_category IS NULL) order by node_name desc";
-if ($bookcat && $_SESSION['user_id']==548) echo $q;
+if ((!empty($bookcat)) && $bookcat) $q.=" and (bookmark_category='$bookcat' or bookmark_category=0 or bookmark_category IS NULL) order by node_name desc";
+#if ($bookcat && $_SESSION['user_id']==548) echo $q; ble
 
 else $q.="order by node_name";
 $result=$db->query($q);
 if (!$bookcat) {
-while ($result->next()) {
-if (!$result->getString('bookmark_category')) {
-$categories['unsorted']['children'][]=$result->getRecord();
-$categories['unsorted']['sum']+=$result->getString('node_user_subchild_count');
-}
-else {
-$categories[$result->getString('bookmark_category')]['children'][]=$result->getRecord();
-$categories[$result->getString('bookmark_category')]['sum']+=$result->getString('node_user_subchild_count');
-}
-}
+       while ($result->next()) {
+               if (!$result->getString('bookmark_category')) {
+                       $categories['unsorted']['children'][]=$result->getRecord();
+                       $categories['unsorted']['sum']+=$result->getString('node_user_subchild_count');
+               }
+               else {
+                       $categories[$result->getString('bookmark_category')]['children'][]=$result->getRecord();
+                       $categories[$result->getString('bookmark_category')]['sum']+=$result->getString('node_user_subchild_count');
+               }
+       }
 
-$smarty->assign('get_bookmarks',$categories);
+       $smarty->assign('get_bookmarks',$categories);
 }
 
 else {
-while ($result->next()) {
-$bookmarks[]=$result->getRecord();
-}
-$smarty->assign('get_bookmarks',$bookmarks);
+       while ($result->next()) {
+               $bookmarks[]=$result->getRecord();
+       }
+       $smarty->assign('get_bookmarks',$bookmarks);
 }
 }
 ?>
This page took 0.172582 seconds and 4 git commands to generate.