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;
}
+
+
}
?>
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);
<?php
- function smarty_function_get_node_userlist($params,&$smarty) {
+// Get list of users currently viewing specified node.
- global $db,$node;
- if (is_numeric($params['node_id'])) $node_id=$params['node_id'];
- else $node_id=$node['node_id'];
+function smarty_function_get_node_userlist($params,&$smarty) {
- $set=$db->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);
+}
+?>
$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);