From 7673d000dd8ec85908a99a1174840c8ca3c53e16 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 27 Mar 2006 04:29:23 +0000 Subject: added some more to flagging and updated mail page to fit new standards --- lib/class/flag.class.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'lib/class/flag.class.php') diff --git a/lib/class/flag.class.php b/lib/class/flag.class.php index 8bbdc2c9..dc6f44a3 100644 --- a/lib/class/flag.class.php +++ b/lib/class/flag.class.php @@ -112,6 +112,30 @@ class Flag { } // get_total + /** + * get_flagged + * This returns an array of ids of flagged songs if no limit is passed + * it gets everything + */ + function get_flagged($count=0) { + + if ($count) { $limit_clause = "LIMIT " . intval($count); } + + $sql = "SELECT id FROM flagged ORDER BY id $limit_clause"; + $db_results = mysql_query($sql, dbh()); + + /* Default it to an array */ + $results = array(); + + /* While the query */ + while ($r = mysql_fetch_assoc($db_results)) { + $results[] = $r['id']; + } + + return $results; + + } // get_flagged + /** * add * This adds a flag entry for an item, it takes an id, a type, the flag type @@ -137,6 +161,34 @@ class Flag { } // add + /** + * delete_flag + * This deletes the flagged entry and rescans the file to revert to the origional + * state, in a perfect world, I could just roll the changes back... not until 3.4 + */ + function delete_flag() { + + $sql = "DELETE FROM flagged WHERE id='$this->id'"; + $db_results = mysql_query($sql, dbh()); + + return true; + + } // reject + + /** + * approve + * This approves the current flag object ($this->id) by setting approved to + * 1 + */ + function approve() { + + $sql = "UPDATE flagged SET approved='1' WHERE id='$this->id'"; + $db_results = mysql_query($sql, dbh()); + + return true; + + } // approve + /** * print_name * This function formats and prints out a userfriendly name of the flagged -- cgit