mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
more flagging fixes, you can flag files now you just cant do anything about it
This commit is contained in:
parent
e3e529394d
commit
2d5ed879bd
10 changed files with 385 additions and 371 deletions
141
modules/lib.php
141
modules/lib.php
|
@ -38,42 +38,6 @@ function show_album_pulldown ($album) {
|
|||
} // show_album_pulldown()
|
||||
|
||||
|
||||
/*
|
||||
* show_flagged_popup($reason);
|
||||
*
|
||||
* Shows a listing of the flagged_types for when people want to mark
|
||||
* a song as being broken in some way.
|
||||
*/
|
||||
|
||||
function show_flagged_popup($reason,$label='value', $name='flagged_type', $other='') {
|
||||
|
||||
global $settings;
|
||||
$dbh = dbh();
|
||||
|
||||
$access = $_SESSION['userdata']['access'];
|
||||
|
||||
$query = "SELECT type,value FROM flagged_types";
|
||||
if ($access !== 'admin') {
|
||||
$query .= " WHERE access = '$access'";
|
||||
}
|
||||
$db_result = mysql_query($query, $dbh);
|
||||
|
||||
echo "\n<select name=\"$name\" $other>\n";
|
||||
|
||||
while ( $r = mysql_fetch_array($db_result) ) {
|
||||
// $r[0] = id, $r[1] = type
|
||||
if ( $reason === $r['type'] ) {
|
||||
echo "\t<option value=\"".$r['type']."\" selected=\"selected\">".htmlspecialchars($r[$label])."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "\t<option value=\"".$r['type']."\">".htmlspecialchars($r[$label])."</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n</select>\n";
|
||||
} // show_flagged_popup()
|
||||
|
||||
|
||||
/*
|
||||
* delete_user_stats()
|
||||
*
|
||||
|
@ -95,87 +59,6 @@ function delete_user_stats ($user) {
|
|||
} // delete_user_stats()
|
||||
|
||||
|
||||
/*
|
||||
* insert_flagged_song()
|
||||
*
|
||||
*/
|
||||
|
||||
function insert_flagged_song($song, $reason, $comment) {
|
||||
|
||||
$user = $_SESSION['userdata']['username'];
|
||||
$time = time();
|
||||
$sql = "INSERT INTO flagged (user,song,type,comment,date)" .
|
||||
" VALUES ('$user','$song', '$reason', '$comment', '$time')";
|
||||
$db_result = mysql_query($sql, dbh());
|
||||
|
||||
} // insert_flagged_song()
|
||||
|
||||
|
||||
/*
|
||||
* get_flagged();
|
||||
*
|
||||
* Get all of the songs from the flagged table. These are songs that
|
||||
* may or may not be broken.
|
||||
* Deprecated by hopson on 7/27
|
||||
*/
|
||||
|
||||
function get_flagged() {
|
||||
|
||||
$dbh = dbh();
|
||||
|
||||
$sql = "SELECT flagged.id, user.username, type, song, date, comment" .
|
||||
" FROM flagged, user" .
|
||||
" WHERE flagged.user = user.username" .
|
||||
" ORDER BY date";
|
||||
$db_result = mysql_query($sql, $dbh);
|
||||
|
||||
$arr = array();
|
||||
|
||||
while ( $flag = mysql_fetch_object($db_result) ) {
|
||||
$arr[] = $flag;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
} // get_flagged()
|
||||
|
||||
|
||||
/*
|
||||
* get_flagged_type($type);
|
||||
*
|
||||
* Return the text associated with this type.
|
||||
*/
|
||||
|
||||
function get_flagged_type($type) {
|
||||
|
||||
$dbh = dbh();
|
||||
|
||||
$sql = "SELECT value FROM flagged_types WHERE type = '$type'";
|
||||
echo $sql;
|
||||
$db_result = mysql_query($sql, $dbh);
|
||||
|
||||
if ($flagged_type = mysql_fetch_object($db_result)) {
|
||||
return $flagged_type->value;
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
} // get_flagged_type()
|
||||
|
||||
|
||||
/*
|
||||
* delete_flagged( $flag );
|
||||
*
|
||||
*/
|
||||
|
||||
function delete_flagged($flag) {
|
||||
|
||||
$dbh = dbh();
|
||||
|
||||
$sql = "DELETE FROM flagged WHERE id = '$flag'";
|
||||
$db_result = mysql_query($sql, $dbh);
|
||||
} // delete_flagged()
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/* Functions for getting songs given artist, album or id */
|
||||
/*********************************************************/
|
||||
|
@ -285,30 +168,6 @@ function get_songs_from_type ($type, $results, $artist_id = 0) {
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/* This is the main song display function. I found tieing it to the playlist functions
|
||||
was really handy in getting added functionality at no cost.
|
||||
/* Lets tie it to album too, so we can show art ;) */
|
||||
/*********************************************************/
|
||||
/* One symbol, m(__)m */
|
||||
function show_songs ($song_ids, $playlist, $album=0) {
|
||||
|
||||
$dbh = dbh();
|
||||
|
||||
// Get info about current user
|
||||
$user = $GLOBALS['user'];
|
||||
|
||||
$totaltime = 0;
|
||||
$totalsize = 0;
|
||||
|
||||
require (conf('prefix') . "/templates/show_songs.inc");
|
||||
|
||||
return true;
|
||||
|
||||
} // function show_songs
|
||||
|
||||
|
||||
|
||||
function show_playlist_form () {
|
||||
|
||||
print <<<ECHO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue