diff options
Diffstat (limited to 'modules/lib.php')
-rw-r--r-- | modules/lib.php | 158 |
1 files changed, 0 insertions, 158 deletions
diff --git a/modules/lib.php b/modules/lib.php index 13c76242..6ba1d956 100644 --- a/modules/lib.php +++ b/modules/lib.php @@ -1273,164 +1273,6 @@ function search_by_type ($type, $search) { return ($search_result); } - -function get_global_popular($type) { - - global $settings; - $dbh = dbh(); - - $sql = "SELECT object_id, SUM(count) as count FROM object_count" . - " WHERE object_type = '$type'" . - " GROUP BY object_id" . - " ORDER BY count DESC LIMIT " . conf('popular_threshold'); - $db_result = mysql_query($sql, $dbh); - - $items = array(); - $web_path = conf('web_path'); - - while ( $r = @mysql_fetch_object($db_result) ) { - if ( $type == 'song' ) { - $song = new Song($r->object_id); - $artist = $song->get_artist_name(); - $text = "$artist - $song->title"; - /* Add to array */ - $items[] = "<li> <a href=\"$web_path/song.php?action=m3u&song=$song->id\" title=\"". htmlspecialchars($text) ."\">" . htmlspecialchars(truncate_with_ellipse($text, conf('ellipse_threshold_title')+3)) . " ($r->count)</a> </li>"; - - } // if it's a song - - elseif ( $type == 'artist' ) { - $artist = get_artist_name($r->object_id); - if ($artist) { - $items[] = "<li> <a href=\"$web_path/artists.php?action=show&artist=$r->object_id\" title=\"". htmlspecialchars($artist) ."\">" . htmlspecialchars(truncate_with_ellipse($artist, conf('ellipse_threshold_artist')+3)) . " ($r->count)</a> </li>"; - } // if no artist found - } // if type isn't artist - elseif ( $type == 'album' ) { - $album = new Album($r->object_id); - if ($album) { - $items[] = "<li> <a href=\"$web_path/albums.php?action=show&album=$r->object_id\" title=\"". htmlspecialchars($album->name) ."\">" . htmlspecialchars(truncate_with_ellipse($album->name,conf('ellipse_threshold_album')+3)) . " ($r->count)</a> </li>"; - } - } - } // end while - - return $items; -} - - -// Get a list of newest $type (which can then be handed to show_info_box -function get_newest ($type = 'artist') { - - $dbh = dbh(); - - if (conf('popular_threshold') < 1) { conf(array('popular_threshold'=>'10'),1); } - - $sql = "SELECT DISTINCT $type FROM song ORDER BY addition_time " . - "DESC LIMIT " . conf('popular_threshold'); - $db_result = mysql_query($sql, $dbh); - - $items = array(); - $web_path = conf('web_path'); - - while ( $item = mysql_fetch_row($db_result) ) { - if ( $type == 'artist' ) { - $artist = new Artist($item[0]); - $artist->format_artist(); - $items[] = "<li>" . $artist->link . "</li>\n"; - } - elseif ( $type == 'album' ) { - $album = new Album($item[0]); - $album->format_album(); - $items[] = "<li>" . $album->f_name . "</li>"; - } - } - return $items; -} - - -function show_info_box ($title, $type, $items) { - - $web_path = conf('web_path'); - $popular_threshold = conf('popular_threshold'); - - echo "<table class=\"border\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" border=\"0\">"; - echo " <tr class=\"table-header\">"; - - - if ($type == 'your_song') { - echo "<td>$title - <a href=\"$web_path/song.php?action=m3u&your_popular_songs=$popular_threshold\">Play</a></td>\n"; - } - elseif ($type == 'song') { - echo "<td>$title - <a href=\"$web_path/song.php?action=m3u&popular_songs=$popular_threshold\">Play</a></td>\n"; - } - else { - echo "<td>$title</td>\n"; - } - - print <<<ECHO - </tr> - <tr class="even"> - <td align="left"> - <ol> - -ECHO; - - foreach ($items as $item) { - echo "$item\n"; - } - - print <<<ECHO - </ol> - </td> - </tr> -</table> - -ECHO; - -} - - -/* - * show_add_user() - * - */ - -function show_add_user () { - - global $error_color; - - $web_path = conf('web_path'); - - print <<<ECHO -<h3> 2. Add the Admin user for Ampache </h3> -<p><font color="$error_color">$error_text</font></p> -<p>This will be the administration user to get you started. You can delete/chage it later. </p> -<form name="user" method="post" action="$web_path/setup.php"> -<table border="0" cellpadding="2" cellspacing="0"> - <tr> - <td>Username:</td> - <td><input type="text" name="username" value="" size="30" /></td> - </tr> - <tr> - <td>Fullname:</td> - <td><input type="text" name="fullname" value="" size="30" /></td> - </tr> - <tr> - <td>Password:</td> - <td><input type="password" name="password_1" value="" size="30" /></td> - </tr> - <tr> - <td>Password: (again)</td> - <td><input type="password" name="password_2" value="" size="30" /></td> - </tr> -</table> -<input type="hidden" name="step" value="user" /><br /> -<input type="hidden" name="step_text" value="Add the Admin user for Ampache" /><br /> -<input type="submit" name="action" value="Add the Admin User" /><br /> -</form> -ECHO; - -} // show_add_user() - - function scrub_out($str) { return stripslashes($str); |