From: niekt0 Date: Wed, 28 Sep 2011 00:05:28 +0000 (+0200) Subject: moved get_node_userlist into backend, removed some warnings X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=4dbe228fe37a6606365f0f96cd26736972c56a28;p=mirrors%2FKyberia-bloodline.git moved get_node_userlist into backend, removed some warnings --- diff --git a/wwwroot/backend/mysql/backend.inc b/wwwroot/backend/mysql/backend.inc index 7b19577..0171736 100644 --- a/wwwroot/backend/mysql/backend.inc +++ b/wwwroot/backend/mysql/backend.inc @@ -482,8 +482,30 @@ public static function getSynapseWeight($user_id,$node_id){ if (! ($synapse_weight) ) { $synapse_weight = 1;} return $synapse_weight; +} + +// getNodeUserlist + +// Get list of users currently viewing specified node. +// Secure. +// Returns list of (login, user_id) + +public static function getNodeUserlist($node_id) { + + global $db; + if (!is_numeric($node_id)) + { return -1; } + + + $set=$db->query("select login,user_id from users where user_action_id='$node_id'"); + while ($set->next()) { + $userlist[]=$set->getRecord(); + } + return $userlist; } + + } ?> diff --git a/wwwroot/inc/smarty/node_methodz/function.get_mail.php b/wwwroot/inc/smarty/node_methodz/function.get_mail.php index dcf6db7..587d44d 100644 --- a/wwwroot/inc/smarty/node_methodz/function.get_mail.php +++ b/wwwroot/inc/smarty/node_methodz/function.get_mail.php @@ -43,7 +43,7 @@ userto.login as mail_to_name, userfrom.login as mail_from_name, mail.* from mail left join users as userfrom on mail_from=userfrom.user_id left join users as userto on mail_to=userto.user_id where mail_user='$user_id' "; - if ($sql_type) $query.=$sql_type; + if (isset($sql_type)) $query.=$sql_type; $query.=" order by mail_id desc limit $offset,$listing_amount"; $set = $db->query($query); diff --git a/wwwroot/inc/smarty/node_methodz/function.get_node_userlist.php b/wwwroot/inc/smarty/node_methodz/function.get_node_userlist.php index b5bd265..43499a5 100644 --- a/wwwroot/inc/smarty/node_methodz/function.get_node_userlist.php +++ b/wwwroot/inc/smarty/node_methodz/function.get_node_userlist.php @@ -1,17 +1,18 @@ query("select login,user_id from users where user_action_id='$node_id'"); - while ($set->next()) { - $userlist[]=$set->getRecord(); - } - - $smarty->assign('userlist',$userlist); + global $node; + if (isset($params['node_id']) && is_numeric($params['node_id'])) { + $node_id=$params['node_id']; + } else { + $node_id=$node['node_id']; } -?> \ No newline at end of file + + $userlist=nodes::getNodeUserlist($node_id); + $smarty->assign('userlist',$userlist); +} +?> diff --git a/wwwroot/inc/smarty/node_methodz/function.get_nodes_by_parent.php b/wwwroot/inc/smarty/node_methodz/function.get_nodes_by_parent.php index 3bb895e..9fb3659 100644 --- a/wwwroot/inc/smarty/node_methodz/function.get_nodes_by_parent.php +++ b/wwwroot/inc/smarty/node_methodz/function.get_nodes_by_parent.php @@ -46,7 +46,7 @@ function smarty_function_get_nodes_by_parent($params,&$smarty) { $q.=$sql_type; } - if ($orderby) $q.=" order by $orderby "; + if (isset($orderby)) $q.=" order by $orderby "; else $q.=" order by nodes.node_id desc "; $q.= " LIMIT $offset,$listing_amount "; $set=$db->query($q);