X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=inc%2Fsmarty%2Fnode_methodz%2Ffunction.get_bookmarks.php;fp=inc%2Fsmarty%2Fnode_methodz%2Ffunction.get_bookmarks.php;h=b413a36b633783d5e3f0753085ec1d318f8979b5;hb=b42b2bf946332ad8544d53f610be9cb05e80bf56;hp=901b4d1c467772c9a7622026d53d2f99eab35831;hpb=e586807dafc64c3fe152ab518599e6cf3f0f84e1;p=mirrors%2FKyberia-bloodline.git diff --git a/inc/smarty/node_methodz/function.get_bookmarks.php b/inc/smarty/node_methodz/function.get_bookmarks.php index 901b4d1..b413a36 100644 --- a/inc/smarty/node_methodz/function.get_bookmarks.php +++ b/inc/smarty/node_methodz/function.get_bookmarks.php @@ -1,54 +1,55 @@ query($q); - while ($set->next()) { - $array[]=$set->getRecord(); - } - $smarty->assign('get_bookmarks',$array); - return false; - } - - //returning my own bookmarks divided in categories - $q="select distinct bookmark_category,nodes.* from node_access left join nodes on node_access.bookmark_category=nodes.node_id where user_id='".$_SESSION['user_id']."' and node_bookmark='yes' order by node_name"; - $result=$db->query($q); - while ($result->next()) { - $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'"; - 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; - - 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'); - } - } - - $smarty->assign('get_bookmarks',$categories); - } - - else { - while ($result->next()) { - $bookmarks[]=$result->getRecord(); - } - $smarty->assign('get_bookmarks',$bookmarks); - } +if (is_numeric($brawco['node_id'])) $bookcat=$brawco['node_id']; +if (is_numeric($brawco['user_id'])) $user_id=$brawco['user_id']; +global $db; + +//returning user specific bookmarks +if ($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()) { +$array[]=$set->getRecord(); +} +$smarty->assign('get_bookmarks',$array); +return false; +} + +//returning my own bookmarks divided in categories +$q="select distinct bookmark_category,nodes.* from node_access left join nodes on node_access.bookmark_category=nodes.node_id where user_id='".$_SESSION['user_id']."' and node_bookmark='yes' order by node_name"; +$result=$db->query($q); +while ($result->next()) { +$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; + +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'); +} +} + +$smarty->assign('get_bookmarks',$categories); +} + +else { +while ($result->next()) { +$bookmarks[]=$result->getRecord(); +} +$smarty->assign('get_bookmarks',$bookmarks); +} } ?>