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 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/upload.php | 21 +++++++++++++++++++ 2 files changed, 73 insertions(+) (limited to 'lib') 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 diff --git a/lib/upload.php b/lib/upload.php index 43cfc7bd..deac8ffd 100644 --- a/lib/upload.php +++ b/lib/upload.php @@ -240,4 +240,25 @@ function report_file_error( $error_code ) { } // report_file_error + +/** + * show_upload_status_style + * Pure fluf, it shows Grey for 'unknown' Green for Add and Red for delete + */ +function show_upload_status_style($action) { + + switch ($action) { + case 'add': + return 'width:10px;background:green;'; + break; + case 'delete': + return 'width:10px;background:red;'; + break; + default: + return 'width:10px;'; + break; + } // end switch + +} // show_upload_status_style + ?> -- cgit