summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-26 00:51:36 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-26 00:51:36 +0000
commit30405b6c9930c5dd23c5ed30bc2276780a46ecbb (patch)
treeceec5f17237c710e6da3c348abcc22d30b06deee
parent491eab55d8c581b42bcd0625cb137b6a53911259 (diff)
downloadampache-30405b6c9930c5dd23c5ed30bc2276780a46ecbb.tar.gz
ampache-30405b6c9930c5dd23c5ed30bc2276780a46ecbb.tar.bz2
ampache-30405b6c9930c5dd23c5ed30bc2276780a46ecbb.zip
start of browse by x mojo
-rw-r--r--browse.php71
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--lib/general.php163
-rw-r--r--lib/log.lib.php (renamed from lib/log.php)0
-rw-r--r--lib/ui.lib.php (renamed from lib/ui.php)128
-rw-r--r--modules/class/genre.class.php45
-rw-r--r--modules/class/update.php7
-rw-r--r--modules/class/user.php14
-rw-r--r--modules/init.php8
-rw-r--r--modules/lib.php158
-rw-r--r--modules/libglue/README (renamed from libglue/README)0
-rw-r--r--modules/libglue/auth.php (renamed from libglue/auth.php)0
-rw-r--r--modules/libglue/config.php (renamed from libglue/config.php)0
-rw-r--r--modules/libglue/dbh.php (renamed from libglue/dbh.php)0
-rw-r--r--modules/libglue/libdb.php (renamed from libglue/libdb.php)0
-rw-r--r--modules/libglue/session.php (renamed from libglue/session.php)0
-rw-r--r--modules/libglue/session2.php (renamed from libglue/session2.php)0
-rw-r--r--templates/menu.inc9
-rw-r--r--templates/show_all_popular.inc.php42
19 files changed, 431 insertions, 216 deletions
diff --git a/browse.php b/browse.php
new file mode 100644
index 00000000..d4485fa8
--- /dev/null
+++ b/browse.php
@@ -0,0 +1,71 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2005 Ampache.org
+ All Rights Reserved
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+/**
+ *
+ * Browse By Page
+ * This page shows the browse menu, which allows you to browse by many different
+ * fields including genre, artist, album, catalog, ???
+ * this page also handles the actuall browse action
+ * @package Web Interface
+ * @catagory Browse
+ * @author Karl Vollmer 06/24/05
+ *
+ */
+
+/* Base Require */
+require_once("modules/init.php");
+
+/* Clean up incomming variables */
+$action = scrub_in($_REQUEST['action']);
+
+/* Display the headers and menus */
+show_template('header');
+show_menu_items('Browse');
+show_clear();
+
+switch($action) {
+ case 'album':
+ case 'artist':
+ case 'genre':
+
+ break;
+ case 'catalog':
+ break;
+ /* Throw recently added, updated here */
+ default:
+
+ /* Show Most Popular artist/album/songs */
+ show_all_popular();
+
+ /* Show Recent Additions */
+ show_all_recent();
+
+ break;
+
+} // end Switch $action
+
+
+/* Show the Footer */
+show_page_footer('Browse', '',$user->prefs['display_menu']);
+
+?>
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index d9128518..75f807e5 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -7,6 +7,8 @@
- Added Spanish Translation (Thx ros)
- Fixed Menu Highlight when using a Translation
- More HTML cleanup (Thx Xgizzmo)
+ - Added inital Browse Pages and Supporting Functions
+ - Added Genre Stats Tracking
--------------------------------------------------------------------------
v.3.3.1 06/21/2005:
diff --git a/lib/general.php b/lib/general.php
index 1184db45..83bf2bfc 100644
--- a/lib/general.php
+++ b/lib/general.php
@@ -535,20 +535,169 @@ function get_random_songs( $options, $matchlist) {
} // get_random_songs
-/*!
- @function cleanup_and_exit
- @discussion used specificly for the play/index.php file
- this functions nukes now playing and then exits
-*/
+/**
+ * cleanup_and_exit
+ * used specificly for the play/index.php file
+ * this functions nukes now playing and then exits
+ * @package Streaming
+ * @catagory Clean
+ */
function cleanup_and_exit($playing_id) {
/* Clear now playing */
// 900 = 15 min
$expire = time() - 900;
- $sql = "DELETE FROM now_playing WHERE id='$lastid' OR start_time < $expire";
- $db_results = mysql_query($sql, dbh());
+ $sql = "DELETE FROM now_playing WHERE now_playing.id='$lastid' OR now_playing.start_time < $expire";
+
+ $db_results = @mysql_query($sql, dbh());
+
exit();
} // cleanup_and_exit
+/**
+ * get_global_popular
+ * this function gets the current globally popular items
+ * from the object_count table, depending on type passed
+ * @package Web Interface
+ * @catagory Get
+ */
+function get_global_popular($type) {
+
+ $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 Songs */
+ 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&amp;song=$song->id\" title=\"". htmlspecialchars($text) ."\">" .
+ htmlspecialchars(truncate_with_ellipse($text, conf('ellipse_threshold_title')+3)) . "&nbsp;($r->count)</a> </li>";
+ } // if it's a song
+
+ /* If Artist */
+ elseif ( $type == 'artist' ) {
+ $artist = get_artist_name($r->object_id);
+ $items[] = "<li> <a href=\"$web_path/artists.php?action=show&amp;artist=$r->object_id\" title=\"". htmlspecialchars($artist) ."\">" .
+ htmlspecialchars(truncate_with_ellipse($artist, conf('ellipse_threshold_artist')+3)) . "&nbsp;($r->count)</a> </li>";
+ } // if type isn't artist
+
+ /* If Album */
+ elseif ( $type == 'album' ) {
+ $album = new Album($r->object_id);
+ $items[] = "<li> <a href=\"$web_path/albums.php?action=show&amp;album=$r->object_id\" title=\"". htmlspecialchars($album->name) ."\">" .
+ htmlspecialchars(truncate_with_ellipse($album->name,conf('ellipse_threshold_album')+3)) . "&nbsp;($r->count)</a> </li>";
+ } // else not album
+
+ elseif ($type == 'genre') {
+ $genre = new Genre($r->object_id);
+ $items[] = "<li> <a href=\"$web_path/browse.php?action=genre&amp;genre=$r->object_id\" title=\"" . htmlspecialchars($genre->name) . "\">" .
+ htmlspecialchars(truncate_with_ellipse($genre->name,conf('ellipse_threshold_title')+3)) . "&nbsp;($r->count)</a> </li>";
+ } // end if genre
+ } // end while
+
+ if (count($items) == 0) {
+ $items[] = "<span class=\"error\">" . _("Not Enough Data") . "</span>\n";
+ }
+
+ return $items;
+
+} // get_global_popular
+
+/**
+ * gen_newest
+ * Get a list of newest $type (which can then be handed to show_info_box
+ * @package Web Interface
+ * @catagory Get
+ * @todo Add Genre
+ */
+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;
+} // get_newest
+
+/**
+ * show_info_box
+ * This shows the basic box that popular and newest stuff goes into
+ * @package Web Interface
+ * @catagory Display
+ * @todo make this use a template
+ */
+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&amp;your_popular_songs=$popular_threshold\">Play</a></td>\n";
+ }
+ elseif ($type == 'song') {
+ echo "<td>$title - <a href=\"$web_path/song.php?action=m3u&amp;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_info_box
+
+
+
?>
diff --git a/lib/log.php b/lib/log.lib.php
index 7a3d8faf..7a3d8faf 100644
--- a/lib/log.php
+++ b/lib/log.lib.php
diff --git a/lib/ui.php b/lib/ui.lib.php
index fbbdcf8b..6faa0897 100644
--- a/lib/ui.php
+++ b/lib/ui.lib.php
@@ -19,13 +19,16 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*!
- @header UI Function Library
- This contains functions that are generic, and display information
- things like a confirmation box, etc and so forth
-*/
-/*!
+/**
+ * UI Function Library
+ * This contains functions that are generic, and display information
+ * things like a confirmation box, etc and so forth
+ * @package Web Interface
+ * @catagory Library
+ */
+
+/**
@function show_confirmation
@discussion shows a confirmation of an action
@param $next_url Where to go next
@@ -45,7 +48,7 @@ function show_confirmation($title,$text,$next_url) {
} // show_confirmation
-/*!
+/**
@function set_preferences
@discussion legacy function...
//FIXME: Remove References
@@ -57,7 +60,7 @@ function set_preferences() {
} // set_preferences
-/*!
+/**
@function get_preferences
@discussion reads this users preferences
*/
@@ -94,7 +97,7 @@ function get_preferences($username=0) {
} // get_preferences
-/*!
+/**
@function flip_class
@discussion takes an array of 2 class names
and flips them back and forth and
@@ -114,7 +117,7 @@ function flip_class($array=0) {
} // flip_class
-/*!
+/**
@function clear_now_playing
@discussion Clears the now playing information incase something has
gotten stuck in there
@@ -128,7 +131,7 @@ function clear_now_playing() {
} // clear_now_playing
-/*!
+/**
@function show_tool_box
@discussion shows the toolbox
*/
@@ -138,7 +141,7 @@ function show_tool_box ($title, $items) {
}// show_tool_box
-/*!
+/**
@function show_box
@discussion shows a generic box
*/
@@ -148,7 +151,7 @@ function show_box($title,$items) {
} // show_box
-/*!
+/**
@function show_menu_items
@discussion shows menu items
*/
@@ -158,7 +161,7 @@ function show_menu_items ($high) {
} // show_menu_items
-/*!
+/**
@function _
@discussion checks to see if the alias _ is defined
if it isn't it defines it as a simple return
@@ -171,7 +174,7 @@ if (!function_exists('_')) {
} // _
} // if _ isn't defined
-/*!
+/**
@function show_playlist_menu
@discussion playlist functions
*/
@@ -184,7 +187,7 @@ function show_playlist_menu () {
} // show_playlist_menu
-/*!
+/**
@function show_admin_menu
@discussion shows the admin menu
*/
@@ -192,7 +195,7 @@ function show_admin_menu ($admin_highlight) {
include(conf('prefix') . "/templates/admin_menu.inc");
} // show_admin_menu
-/*!
+/**
@function access_denied
@discussion throws an error if they try to do something
that they aren't allowed to
@@ -208,7 +211,7 @@ function access_denied() {
} // access_denied
-/*!
+/**
@function show_users
@discussion shows all users (admin function)
*/
@@ -240,7 +243,7 @@ function show_users () {
} // show_users()
-/*!
+/**
@function return_referer
@discussion returns the script part of the
referer address passed by the web browser
@@ -261,7 +264,7 @@ function return_referer() {
} // return_referer
-/*!
+/**
@function show_alphabet_list
@discussion shows the A-Z,0-9 lists for
albums and artist pages
@@ -289,7 +292,7 @@ function show_alphabet_list ($type,$script="artist.php",$selected="false") {
echo "</div>\n";
} // show_alphabet_list
-/*!
+/**
@function show_local_control
@discussion shows the controls
for localplay
@@ -300,7 +303,7 @@ function show_local_control () {
} // show_local_control
-/*!
+/**
@function truncate_with_ellipse
@discussion truncates a text file to specified length by adding
thre dots (ellipse) to the end
@@ -328,7 +331,7 @@ function truncate_with_ellipse($text, $max=27) {
return $text;
} // truncate_with_ellipse
-/*!
+/**
@function show_footer
@discussion shows the footer of the page
*/
@@ -337,7 +340,7 @@ function show_footer() {
echo "<br /><br /><br /><div class=\"$class\" style=\"border: solid thin black;\">&nbsp;</div>";
} // show_footer
-/*!
+/**
@function show_now_playing
@discussion shows the now playing template
*/
@@ -350,7 +353,7 @@ function show_now_playing() {
} // show_now_playing
-/*!
+/**
@function show_user_registration
@discussion this function is called for a new user
registration
@@ -364,7 +367,7 @@ function show_user_registration ($values=array()) {
} // show_user_registration
-/*!
+/**
@function show_edit_profile
@discussion shows a single user profile for editing
*/
@@ -376,7 +379,7 @@ function show_edit_profile($username) {
} // show_edit_profile
-/*!
+/**
@function show_playlist
@discussion this shows the current playlist
*/
@@ -395,7 +398,7 @@ function show_playlist($playlist_id) {
} // show_playlist
-/*!
+/**
@function show_play_selected
@discussion this shows the playselected/add to playlist
box, which includes a little javascript
@@ -406,7 +409,7 @@ function show_play_selected() {
} // show_play_selected
-/*!
+/**
@function get_now_playing
@discussion gets the now playing information
*/
@@ -424,7 +427,7 @@ function get_now_playing() {
} // get_now_playing
-/*!
+/**
@function show_clear
@discussion this is a hack because of the float mojo
*/
@@ -434,23 +437,62 @@ function show_clear() {
} // show_clear
-/*!
- @function show_page_footer
- @discussion adds page footer including html and body end tags
- @param $menu menu item to highlight
- @param $admin_menu admin menu item to highlight
- @param $display_menu display menu or not (1 on 0 off)
-*/
-function show_page_footer ($menu="Home", $admin_menu='', $display_menu=0) {
+/**
+ * show_page_footer
+ * adds page footer including html and body end tags
+ * @param $menu menu item to highlight
+ * @param $admin_menu admin menu item to highlight
+ * @param $display_menu display menu or not (1 on 0 off)
+ * @package Web Interface
+ * @catagory Display
+ */
+function show_page_footer($menu="Home", $admin_menu='', $display_menu=0) {
+
if ($display_menu){
- if($menu =="Admin"){
+ if($menu == 'Admin'){
show_admin_menu($admin_menu);
- }
+ } // end if admin
show_menu_items($menu);
-
- }
+
+ } // end if
+
echo "<br /><br />\n</body>\n";
echo "</html>\n";
-}
+
+} // show_page_footer
+
+/**
+ * Show All Popular
+ * This functions shows all of the possible global popular tables, this is basicly a top X where X is
+ * set on a per user basis
+ * @package Web Interface
+ * @catagory Display
+ * @author Karl Vollmer
+ */
+function show_all_popular() {
+
+ $artists = get_global_popular('artist');
+ $albums = get_global_popular('album');
+ $songs = get_global_popular('song');
+ $genres = get_global_popular('genre');
+
+ require_once(conf('prefix') . '/templates/show_all_popular.inc.php');
+
+} // show_all_popular
+
+/**
+ * Show All Recent
+ * This function shows all of the possible "Newest" tables. The number of newest is pulled from the users
+ * popular threshold
+ * @package Web Interface
+ * @catagory Display
+ * @author Karl Vollmer
+ */
+function show_all_recent() {
+
+
+
+} // show_all_recent
+
?>
diff --git a/modules/class/genre.class.php b/modules/class/genre.class.php
new file mode 100644
index 00000000..9d5e4d4e
--- /dev/null
+++ b/modules/class/genre.class.php
@@ -0,0 +1,45 @@
+<?
+/*
+
+ Copyright 2001 - 2005 Ampache.org
+ All Rights Reserved
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+/**
+ * Genre Class
+ * This class takes care of the genre object
+ */
+class Genre {
+
+ /* Variables */
+ var $id;
+ var $name;
+
+ /**
+ * Constructor
+ * @package Genre
+ * @catagory Constructor
+ */
+ function Genre() {
+
+
+ } // genre
+
+} //end of genre class
+
+?>
diff --git a/modules/class/update.php b/modules/class/update.php
index bea76ded..b006b8e7 100644
--- a/modules/class/update.php
+++ b/modules/class/update.php
@@ -920,5 +920,12 @@ class Update {
} //update 331003
+ function update_332001() {
+
+ $sql = "ALTER TABLE `object_count` CHANGE `object_type` `object_type` ENUM( 'album', 'artist', 'song', 'playlist', 'genre', 'catalog' ) NOT NULL DEFAULT 'song'";
+ $sql = "ALTER TABLE `session` CHANGE `type` `type` ENUM( 'sso', 'mysql', 'ldap', 'http' ) NOT NULL DEFAULT 'mysql'";
+
+ } // update_332001
+
} // end update class
?>
diff --git a/modules/class/user.php b/modules/class/user.php
index 234e10ab..1ad50dc6 100644
--- a/modules/class/user.php
+++ b/modules/class/user.php
@@ -421,6 +421,20 @@ class User {
$db_result = mysql_query($sql, $dbh);
}
+ // Play count for this genre
+ $sql = "UPDATE object_count" .
+ " SET date = '$time', count=count+1" .
+ " WHERE object_type = 'genre'" .
+ " AND object_id = '" . $song_info->genre."' AND userid='$user'";
+ $db_results = mysql_query($sql, $dbh);
+
+ $rows = mysql_affected_rows();
+ if (!$rows) {
+ $sql = "INSERT INTO object_count (`object_type`,object_id`,`date`,`count`,`userid`)" .
+ "VALUES ('genre','" . $song_info->genre."','$time','1'1,'$user')";
+ $db_results = mysql_query($sql, $dbh);
+ }
+
} // update_stats
diff --git a/modules/init.php b/modules/init.php
index a84b9f31..8743b19b 100644
--- a/modules/init.php
+++ b/modules/init.php
@@ -112,10 +112,10 @@ if (!$results['conf']['prefix']) {
$results['conf']['prefix'] = $prefix;
}
if (!$results['libglue']['stop_auth']) {
- $results['libglue']['stop_auth'] = $results['conf']['prefix'] . "/libglue/gone.fishing";
+ $results['libglue']['stop_auth'] = $results['conf']['prefix'] . "/modules/libglue/gone.fishing";
}
if (!$results['libglue']['libglue_path']) {
- $results['libglue']['libglue_path']= $results['conf']['prefix'] . "/libglue";
+ $results['libglue']['libglue_path']= $results['conf']['prefix'] . "/modules/libglue";
}
if (!$results['conf']['http_port']) {
$results['conf']['http_port'] = '80';
@@ -157,8 +157,8 @@ require_once(conf('prefix') . "/lib/song.php");
require_once(conf('prefix') . "/lib/search.php");
require_once(conf('prefix') . "/lib/preferences.php");
require_once(conf('prefix') . "/lib/rss.php");
-require_once(conf('prefix') . "/lib/log.php");
-require_once(conf('prefix') . "/lib/ui.php");
+require_once(conf('prefix') . "/lib/log.lib.php");
+require_once(conf('prefix') . "/lib/ui.lib.php");
require_once(conf('prefix') . "/lib/gettext.php");
require_once(conf('prefix') . "/lib/batch.php");
require_once(conf('prefix') . "/lib/themes.php");
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&amp;song=$song->id\" title=\"". htmlspecialchars($text) ."\">" . htmlspecialchars(truncate_with_ellipse($text, conf('ellipse_threshold_title')+3)) . "&nbsp;($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&amp;artist=$r->object_id\" title=\"". htmlspecialchars($artist) ."\">" . htmlspecialchars(truncate_with_ellipse($artist, conf('ellipse_threshold_artist')+3)) . "&nbsp;($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&amp;album=$r->object_id\" title=\"". htmlspecialchars($album->name) ."\">" . htmlspecialchars(truncate_with_ellipse($album->name,conf('ellipse_threshold_album')+3)) . "&nbsp;($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&amp;your_popular_songs=$popular_threshold\">Play</a></td>\n";
- }
- elseif ($type == 'song') {
- echo "<td>$title - <a href=\"$web_path/song.php?action=m3u&amp;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);
diff --git a/libglue/README b/modules/libglue/README
index b847586b..b847586b 100644
--- a/libglue/README
+++ b/modules/libglue/README
diff --git a/libglue/auth.php b/modules/libglue/auth.php
index 0ef41e8c..0ef41e8c 100644
--- a/libglue/auth.php
+++ b/modules/libglue/auth.php
diff --git a/libglue/config.php b/modules/libglue/config.php
index c1ca07a8..c1ca07a8 100644
--- a/libglue/config.php
+++ b/modules/libglue/config.php
diff --git a/libglue/dbh.php b/modules/libglue/dbh.php
index 71d04b9c..71d04b9c 100644
--- a/libglue/dbh.php
+++ b/modules/libglue/dbh.php
diff --git a/libglue/libdb.php b/modules/libglue/libdb.php
index 00e8a9b2..00e8a9b2 100644
--- a/libglue/libdb.php
+++ b/modules/libglue/libdb.php
diff --git a/libglue/session.php b/modules/libglue/session.php
index aef10c60..aef10c60 100644
--- a/libglue/session.php
+++ b/modules/libglue/session.php
diff --git a/libglue/session2.php b/modules/libglue/session2.php
index 171dc1ca..171dc1ca 100644
--- a/libglue/session2.php
+++ b/modules/libglue/session2.php
diff --git a/templates/menu.inc b/templates/menu.inc
index a6047ba5..2ae05faf 100644
--- a/templates/menu.inc
+++ b/templates/menu.inc
@@ -32,10 +32,11 @@ if ($GLOBALS['user']->prefs['play_type'] == 'mpd' && conf('localplay_menu')) {
$items += array(_("Local Play") => htmlspecialchars(conf('web_path') . "/mpd.php"));
}
-$items += array(_("Albums") => htmlspecialchars(conf('web_path') . "/albums.php"),
- _("Artists") => htmlspecialchars(conf('web_path') . "/artists.php"),
- _("Playlists") => htmlspecialchars(conf('web_path') . "/playlist.php"),
- _("Search") => htmlspecialchars(conf('web_path') . "/search.php"),
+$items += array(_("Browse") => htmlspecialchars(conf('web_path') . "/browse.php"),
+ _("Albums") => htmlspecialchars(conf('web_path') . "/albums.php"),
+ _("Artists") => htmlspecialchars(conf('web_path') . "/artists.php"),
+ _("Playlists") => htmlspecialchars(conf('web_path') . "/playlist.php"),
+ _("Search") => htmlspecialchars(conf('web_path') . "/search.php"),
_("Preferences") => htmlspecialchars(conf('web_path') . "/preferences.php")
);
if ($GLOBALS['user']->prefs['upload']) {
diff --git a/templates/show_all_popular.inc.php b/templates/show_all_popular.inc.php
new file mode 100644
index 00000000..1c472949
--- /dev/null
+++ b/templates/show_all_popular.inc.php
@@ -0,0 +1,42 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2005 Ampache.org
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+?>
+<table class="tabledata">
+<tr>
+ <td valign="top" align="right">
+ <?php show_info_box(_("Most Popular Artists"), 'artist', $artists); ?>
+ </td>
+ <td valign="top" align="left">
+ <?php show_info_box(_("Most Popular Songs"), 'song', $songs); ?>
+ </td>
+ <td valign="top" align="right">
+ <?php show_info_box(_("Most Popular Albums"), '', $albums); ?>
+ </td>
+</tr>
+<tr><td colspan="3">&nbsp;</td></tr>
+<tr>
+ <td valign="top" align="left">
+ <?php show_info_box(_("Most Popular Genres"), '', $genres); ?>
+ </td>
+</tr>
+</table>