summaryrefslogtreecommitdiffstats
path: root/lib/class/flag.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-03-27 04:29:23 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-03-27 04:29:23 +0000
commit7673d000dd8ec85908a99a1174840c8ca3c53e16 (patch)
tree8cbce751084279e680055f156824c52ea3b3b88b /lib/class/flag.class.php
parent75434cbeb6e6c2e4107b9932a79b3d146dbdcc0f (diff)
downloadampache-7673d000dd8ec85908a99a1174840c8ca3c53e16.tar.gz
ampache-7673d000dd8ec85908a99a1174840c8ca3c53e16.tar.bz2
ampache-7673d000dd8ec85908a99a1174840c8ca3c53e16.zip
added some more to flagging and updated mail page to fit new standards
Diffstat (limited to 'lib/class/flag.class.php')
-rw-r--r--lib/class/flag.class.php52
1 files changed, 52 insertions, 0 deletions
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
@@ -113,6 +113,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
* and a comment and then inserts the mofo
@@ -138,6 +162,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
* object