fetch(); assert_error($note_owner, "That user id does not exist.", "no such user"); } $users = array(); $n = sql("SELECT account.id AS id, login AS name, COUNT(notes.id) AS nbNotes FROM account ". "LEFT JOIN notes ON notes.owner = account.id ". "WHERE notes.public != 0 AND notes.id != 0 ". "GROUP BY account.id ORDER BY nbNotes DESC"); while ($nn =$n->fetch()) $users[] = $nn; $notes_tree = array(); $n = sql("SELECT id, parent, title FROM notes ". "WHERE owner = ? ". ($userid == $user['id'] ? "" : "AND public != 0 "). "ORDER BY title ASC", $userid); while ($nn = $n->fetch()) { if (isset($notes_tree[$nn['parent']])) { $notes_tree[$nn['parent']][] = $nn; } else { $notes_tree[$nn['parent']] = array($nn); } } require("tpl/notes/user.php");