diff options
Diffstat (limited to 'lib/notes/move.php')
-rw-r--r-- | lib/notes/move.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/notes/move.php b/lib/notes/move.php index d51b4ad..2f6375a 100644 --- a/lib/notes/move.php +++ b/lib/notes/move.php @@ -3,12 +3,12 @@ assert_redir(count($args) >= 3, 'notes'); $noteid = intval($args[2]); -$note = mysql_fetch_assoc(sql( +$note = sql( "SELECT na.id AS id, na.title AS title, na.text AS text, na.public AS public, na.owner AS owner, ". "nb.title AS parent_title, nb.id AS parent_id, account.login AS ownername FROM notes na ". "LEFT JOIN notes nb ON na.parent = nb.id LEFT JOIN account ON account.id = na.owner ". "WHERE na.id = $noteid" -)); +)->fetch(); assert_error($note && ($note['owner'] == $user['id'] || $user['priv'] >= $priv_admin), "This note does not exist, or you are not allowed to move it."); @@ -16,7 +16,7 @@ if (count($args) == 4) { $newparent = intval($args[3]); // SHOULD CHECK FOR TREE CONSISTENCY, SKIP FOR NOW. if ($newparent != 0) { - $p = mysql_fetch_assoc(sql("SELECT id, owner FROM notes WHERE id = $newparent")); + $p = sql("SELECT id, owner FROM notes WHERE id = $newparent")->fetch(); } if ($newparent != 0 && !$p) { $error = "Selected parent does not exist."; @@ -32,7 +32,7 @@ if (count($args) == 4) { $notes_tree = array(); $n = sql("SELECT id, parent, title FROM notes ". "WHERE owner = " . $user['id'] . " AND id != $noteid AND parent != $noteid ORDER BY title ASC"); -while ($nn = mysql_fetch_assoc($n)) { +while ($nn = $n->fetch()) { if (isset($notes_tree[$nn['parent']])) { $notes_tree[$nn['parent']][] = $nn; } else { |