summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-25 10:04:27 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-12-25 10:04:27 +0000
commit27158141ee1a14b7d23ae8997d2c41b49fc904d9 (patch)
tree2180fff67d21ffdbab32f2105cff3c7275b6b511
parent5415c2e847032896907946c98d68a254399e4416 (diff)
downloadampache-27158141ee1a14b7d23ae8997d2c41b49fc904d9.tar.gz
ampache-27158141ee1a14b7d23ae8997d2c41b49fc904d9.tar.bz2
ampache-27158141ee1a14b7d23ae8997d2c41b49fc904d9.zip
initial ratings mojo, some stylesheet fixes, changed user preferences again and a db update
-rw-r--r--admin/preferences.php17
-rw-r--r--config/ampache.cfg.php.dist15
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--images/ratings/star.gifbin0 -> 924 bytes
-rw-r--r--images/ratings/star_off.gifbin0 -> 879 bytes
-rw-r--r--images/ratings/x.gifbin0 -> 873 bytes
-rw-r--r--images/ratings/x_off.gifbin0 -> 873 bytes
-rw-r--r--lib/class/rating.class.php34
-rw-r--r--lib/class/update.class.php65
-rw-r--r--lib/class/user.class.php34
-rw-r--r--lib/general.lib.php53
-rw-r--r--lib/preferences.php27
-rw-r--r--lib/rating.lib.php82
-rw-r--r--lib/themes.php9
-rw-r--r--lib/ui.lib.php151
-rw-r--r--modules/init.php11
-rw-r--r--preferences.php14
-rw-r--r--ratings.php41
-rw-r--r--song.php5
-rw-r--r--stats.php13
-rw-r--r--templates/footer.inc1
-rw-r--r--templates/header.inc1
-rw-r--r--templates/show_album.inc16
-rw-r--r--templates/show_login_form.inc8
-rw-r--r--templates/show_object_rating.inc.php53
-rw-r--r--templates/show_preference_box.inc.php78
-rw-r--r--templates/show_preferences.inc88
-rw-r--r--templates/show_songs.inc15
-rw-r--r--templates/style.inc28
-rwxr-xr-xthemes/classic/images/ampache.gifbin9492 -> 6343 bytes
-rw-r--r--themes/greyblock/templates/style.inc108
31 files changed, 740 insertions, 229 deletions
diff --git a/admin/preferences.php b/admin/preferences.php
index 46f4e6fb..ea3175fc 100644
--- a/admin/preferences.php
+++ b/admin/preferences.php
@@ -37,34 +37,37 @@ if (!$user->has_access(100)) {
}
$user_id = scrub_in($_REQUEST['user_id']);
+if (!$user_id) { $user_id ='-1'; }
+
+$temp_user = new User($user_id);
+$temp_user->username = $user_id;
switch(scrub_in($_REQUEST['action'])) {
case 'user':
- $temp_user = new User($user_id);
$fullname = "ADMIN - " . $temp_user->fullname;
- $preferences = $temp_user->get_preferences($user_id);
+ $preferences = $temp_user->get_preferences();
break;
case 'update_preferences':
if (conf('demo_mode')) { break; }
update_preferences($user_id);
if ($user_id != '-1') {
- $temp_user = new User($user_id);
$fullname = "ADMIN - " . $temp_user->fullname;
$preferences = $temp_user->get_preferences();
}
else {
- $preferences = get_site_preferences();
+ init_preferences();
+ $GLOBALS['user']->set_preferences();
+ set_theme();
+ $preferences = $temp_user->get_preferences();
}
break;
case 'fix_preferences':
- $temp_user = new User();
$temp_user->fix_preferences($user_id);
$preferences = $temp_user->get_preferences($user_id);
break;
default:
- $user_id = -1;
- $preferences = get_site_preferences();
+ $preferences = $temp_user->get_preferences();
$fullname = "Site";
break;
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index ce39f31d..950ef7ff 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -147,6 +147,21 @@ id3tag_order = "id3v1"
# DEFAULT true
use_auth = "yes"
+# 5 Star Ratings
+# CURRENTLY BROKEN!!!!!
+# These are disabled by default, to turn them on remove the
+# comment before the value flash requires flash player and
+# will cause longer load times.
+# POSSIBLE VALUES: false normal
+# DEFAULT: normal
+#ratings = "normal"
+
+# This enables the ability to use custom colors for the ratings.
+# This option MUST be set in order to use custom colors.
+# DEFAULT: false, use the default colorset
+# true: use custom colors, loaded from /templates/ratings_colors.php
+#custom_ratings_colors = "false"
+
# This options will turn on/off Demo Mode
# If Demo mode is on you can not play songs or update your catalog
# in other words.. leave this commented out
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 3358e21d..589e0756 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,8 @@
--------------------------------------------------------------------------
v.3.3.2-Alpha4
+ - Updated Preferences (yet again) maybe it's better, maybe it's not
+ we'll never know...
- Fixed Classic Theme view in IE (had spaces)
- Fixed permission bug with guest users when batch download was
enabled
diff --git a/images/ratings/star.gif b/images/ratings/star.gif
new file mode 100644
index 00000000..4834f1da
--- /dev/null
+++ b/images/ratings/star.gif
Binary files differ
diff --git a/images/ratings/star_off.gif b/images/ratings/star_off.gif
new file mode 100644
index 00000000..218545cb
--- /dev/null
+++ b/images/ratings/star_off.gif
Binary files differ
diff --git a/images/ratings/x.gif b/images/ratings/x.gif
new file mode 100644
index 00000000..de7140ff
--- /dev/null
+++ b/images/ratings/x.gif
Binary files differ
diff --git a/images/ratings/x_off.gif b/images/ratings/x_off.gif
new file mode 100644
index 00000000..f815d7e8
--- /dev/null
+++ b/images/ratings/x_off.gif
Binary files differ
diff --git a/lib/class/rating.class.php b/lib/class/rating.class.php
index 6d5199a4..f69e2585 100644
--- a/lib/class/rating.class.php
+++ b/lib/class/rating.class.php
@@ -32,8 +32,7 @@ class Rating {
var $type; // The type of object we want
/* Generated vars */
- var $rating; // The rating as set by this user
- var $average_rating; // The average rating as set by all users
+ var $rating; // The average rating as set by all users
/**
* Constructor
@@ -42,19 +41,31 @@ class Rating {
*/
function Rating($id,$type) {
+ $this->id = $id;
+ $this->type = $type;
+ if (intval($id) > 1) {
+ $this->get_average();
+ }
} // Rating
/**
* get_user
* Get the user's rating this is based off the currently logged
- * in user. It sets the $this->rating and returns the value
+ * in user. It returns the value
*/
- function get_user() {
+ function get_user($username) {
+ $username = sql_escape($username);
+ $sql = "SELECT rating FROM ratings WHERE user='$username' AND object_id='$this->id' AND object_type='$this->type'";
+ $db_results = mysql_query($sql, dbh());
+
+ $results = mysql_fetch_assoc($db_results);
+
+ return $results['rating'];
} // get_user
@@ -67,6 +78,21 @@ class Rating {
*/
function get_average() {
+ $sql = "SELECT rating FROM ratings WHERE object_id='$this->id' AND object_type='$this->type'";
+ $db_results = mysql_fetch_assoc($db_results);
+
+ $i = 0;
+
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $i++;
+ $total = $r['rating'];
+ } // while we're pulling results
+
+ $average = floor($total/$i);
+
+ $this->rating = $average;
+
+ return $average;
} // get_average
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 8ef40403..10532321 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -242,6 +242,12 @@ class Update {
$version[] = array('version' => '332003', 'description' => $update_string);
+ $update_string = "- Added ID to playlist_data so that duplicate songs on the same playlist can actually work.<br />" .
+ "- Re-worked Preferences, again :'(, hopefully making them better.<br />" .
+ "- Added rating table for SoundOfEmotions Rating system.<br />";
+
+ $version[] = array('version' => '332004', 'description' => $update_string);
+
return $version;
} // populate_version
@@ -1221,13 +1227,70 @@ class Update {
@function update_332004
@discussion adds a id to the playlist_data field because of a problem
with updating the same song on the same playlist being basicly
- impossible...Also re-works the indexing on the tables
+ impossible...Adds rating table and general clean up
*/
function update_332004() {
$sql = "ALTER TABLE `playlist_data` ADD `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT FIRST";
$db_results = mysql_query($sql, dbh());
+ /* Create the ratings table */
+ $sql = " CREATE TABLE `ratings` (`id` int(11) unsigned NOT NULL auto_increment," .
+ " `user` varchar(128) NOT NULL default ''," .
+ " `object_type` enum('artist','album','song') NOT NULL default 'artist'," .
+ " `object_id` int(11) unsigned NOT NULL default '0'," .
+ " `rating` enum('00','0','1','2','3','4','5') NOT NULL default '0'," .
+ " PRIMARY KEY (`id`))";
+ $db_results = mysql_query($sql, dbh());
+
+ /* Add an index for the object ID */
+ $sql = "ALTER TABLE `ratings` ADD INDEX ( `object_id` ) ";
+ $db_results = mysql_query($sql, dbh());
+
+ /**
+ * Update the Type designation on the preference table
+ * possible types are
+ * system, theme, interface, options, streaming
+ * users get everything but site, admins get the whole kit and kabodle
+ */
+
+ /* Set the Theme preferences */
+ $sql = "UPDATE preferences SET type='theme' WHERE name='font' OR name='bg_color1' OR name='bg_color2' " .
+ " OR name='base_color1' OR name='base_color2' OR name='font_color1' OR name='font_color2' " .
+ " OR name='font_color3' OR name='row_color1' OR name='row_color2' OR name='row_color3' " .
+ " OR name='error_color' OR name='theme_name' OR name='font' OR name='font_size'";
+ $db_results = mysql_query($sql, dbh());
+
+ /* Set the Interface preferences */
+ $sql = "UPDATE preferences SET type='interface' WHERE name='refresh_limit' OR name='lang' OR name='condPL' " .
+ " OR name='popular_threshold' OR name='ellipse_threshold_album' OR name='ellipse_threshold_artist' " .
+ " OR name='ellipse_threshold_title'";
+ $db_results = mysql_query($sql, dbh());
+
+ /* Set the Options Preferences */
+ $sql = "UPDATE preferences SET type='options' WHERE name='download' OR name='upload' OR name='quarantine' " .
+ " OR name='direct_link' OR name='upload_dir'";
+ $db_results = mysql_query($sql, dbh());
+
+ /* Set the Streaming Preferences */
+ $sql = "UPDATE preferences SET type='streaming' WHERE name='sample_rate' OR name='play_type' " .
+ " OR name='playlist_type'";
+ $db_results = mysql_query($sql, dbh());
+
+ /* Get the ID */
+ $sql = "SELECT id FROM preferences WHERE name='display_menu'";
+ $db_results = mysql_query($sql, dbh());
+
+ $result = mysql_fetch_assoc($db_results);
+
+ /* Kill the bottom menu preference as its no longer needed */
+ $sql = "DELETE FROM preferences WHERE name='display_menu'";
+ $db_results = mysql_query($sql, dbh());
+
+ /* Kill the user pref references */
+ $sql = "DELETE FROM user_preference WHERE preference='" . $result['id'] . "'";
+ $db_results = mysql_query($sql, dbh());
+
$this->set_version('db_version','332004');
} // update_332004
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 83a778ce..0b0459a7 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -74,11 +74,14 @@ class User {
} // get_info
- /*!
- @function get_preferences
- @discussion gets the prefs for this specific
- user and returns them as an array
- */
+ /**
+ * get_preferences
+ * This is a little more complicate now that we've got many types of preferences
+ * This funtions pulls all of them an arranges them into a spiffy little array
+ * []['title'] = ucased type name
+ * []['prefs'] = array(array('name','display','value'));
+ * []['admin'] = t/f value if this is an admin only section
+ */
function get_preferences($user_id=0) {
if (!$user_id) {
@@ -86,14 +89,25 @@ class User {
}
if (!conf('use_auth')) { $user_id = '-1'; }
-
+
+ if ($user_id != '-1') {
+ $user_limit = "AND preferences.type != 'system'";
+ }
+
+
$sql = "SELECT preferences.name, preferences.description, preferences.type, user_preference.value FROM preferences,user_preference " .
- "WHERE user_preference.user='$user_id' AND user_preference.preference=preferences.id AND preferences.type='user'";
+ "WHERE user_preference.user='$user_id' AND user_preference.preference=preferences.id $user_limit";
$db_results = mysql_query($sql, dbh());
- while ($r = mysql_fetch_object($db_results)) {
- $results[] = $r;
- }
+ /* Ok this is crapy, need to clean this up or improve the code FIXME */
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $type = $r['type'];
+ $admin = false;
+ if ($type == 'system') { $admin = true; }
+ $type_array[$type][] = array('name'=>$r['name'],'description'=>$r['description'],'value'=>$r['value']);
+ $results[$type] = array ('title'=>ucwords($type),'admin'=>$admin,'prefs'=>$type_array[$type]);
+ } // end while
+
return $results;
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 2896fb74..09c3ad5c 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -854,5 +854,58 @@ function make_bool($string) {
} // make_bool
+/**
+ * get_languages
+ * This function does a dir of ./locale and pulls the names of the
+ * different languages installed, this means that all you have to do
+ * is drop one in and it will show up on the context menu. It returns
+ * in the form of an array of names
+ */
+function get_languages() {
+
+ /* Open the locale directory */
+ $handle = @opendir(conf('prefix') . '/locale');
+
+ if (!is_resource($handle)) {
+ if (conf('debug')) {
+ log_event($GLOBALS['user']->username,'language',"Error unable to open locale directory");
+ }
+ }
+
+ $results = array();
+
+ /* Prepend English */
+ $results['en_US'] = _('English');
+
+ while ($file = readdir($handle)) {
+
+ $full_file = conf('prefix') . '/locale/' . $file;
+
+ /* Check to see if it's a directory */
+ if (is_dir($full_file) AND substr($file,0,1) != '.' AND $file != 'base') {
+
+ switch($file) {
+ case 'de_DE'; $name = _('German'); break;
+ case 'en_US'; $name = _('English'); break;
+ case 'en_GB'; $name = _('British English'); break;
+ case 'es_ES'; $name = _('Spanish'); break;
+ case 'fr_FR'; $name = _('French'); break;
+ case 'it_IT'; $name = _('Italian'); break;
+ case 'nl_NL'; $name = _('Dutch'); break;
+ case 'tr_TR'; $name = _('Turkish'); break;
+ case 'zh_CN'; $name = _('Simplified Chinese'); break;
+ default: $name = _('Unknown'); break;
+ } // end switch
+
+
+ $results[$file] = $name;
+ }
+
+ } // end while
+
+ return $results;
+
+} // get_languages
+
?>
diff --git a/lib/preferences.php b/lib/preferences.php
index 8e7135d7..dea96529 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -94,7 +94,7 @@ function update_preferences($pref_id=0) {
$sql = "SELECT id,name,type FROM preferences";
/* If it isn't the System Account's preferences */
- if ($pref_id != '-1') { $sql .= " WHERE type='user'"; }
+ if ($pref_id != '-1') { $sql .= " WHERE type!='system'"; }
$db_results = mysql_query($sql, dbh());
@@ -149,8 +149,12 @@ function update_preference($username,$name,$pref_id,$value) {
/* First see if they are an administrator and we are applying this to everything */
if ($GLOBALS['user']->has_access(100) AND make_bool($_REQUEST[$apply_check])) {
- $sql = "UPDATE user_preference SET `value`,'$value' WHERE preference='$pref_id'";
+ $sql = "UPDATE user_preference SET `value`='$value' WHERE preference='$pref_id'";
$db_results = mysql_query($sql, dbh());
+ /* Reset everyones colors! */
+ if ($name =='theme_name') {
+ set_theme_colors($value,0);
+ }
return true;
}
@@ -190,7 +194,7 @@ function has_preference_access($name) {
$level = 100;
break;
default:
- $level = 1;
+ $level = 25;
break;
} // end switch key
@@ -290,18 +294,17 @@ function create_preference_input($name,$value) {
echo "</select>\n";
break;
case 'lang':
+ $languages = get_languages();
$var_name = $value . "_lang";
${$var_name} = "selected=\"selected\"";
+
echo "<select name=\"$name\">\n";
- echo "\t<option value=\"de_DE\" $de_DE_lang>" . _("German") . "</option>\n";
- echo "\t<option value=\"en_US\" $en_US_lang>" . _("English") . "</option>\n";
- echo "\t<option value=\"en_GB\" $en_GB_lang>" . _("British English") . "</option>\n";
- echo "\t<option value=\"es_ES\" $es_ES_lang>" . _("Spanish") . "</option>\n";
- echo "\t<option value=\"fr_FR\" $fr_FR_lang>" . _("French") . "</option>\n";
- echo "\t<option value=\"it_IT\" $it_IT_lang>" . _("Italian") . "</option>\n";
- echo "\t<option value=\"nl_NL\" $nl_NL_lang>" . _("Dutch") . "</option>\n";
- echo "\t<option value=\"tr_TR\" $tr_TR_lang>" . _("Turkish") . "</option>\n";
- echo "\t<option value=\"zh_CN\" $zh_CN_lang>" . _("Simplified Chinese") . "</option>\n";
+
+ foreach ($languages as $lang=>$name) {
+ $var_name = $lang . "_lang";
+
+ echo "\t<option value=\"$lang\" " . ${$var_name} . ">$name</option>\n";
+ } // end foreach
echo "</select>\n";
break;
case 'theme_name':
diff --git a/lib/rating.lib.php b/lib/rating.lib.php
new file mode 100644
index 00000000..4f854c93
--- /dev/null
+++ b/lib/rating.lib.php
@@ -0,0 +1,82 @@
+<?php
+/*
+
+ Copyright 2001 - 2006 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.
+
+*/
+
+/**
+ * show_rating
+ * This takes an artist id and includes the right file
+ */
+function show_rating($object_id,$type) {
+
+ $rating = new Rating($object_id,$type);
+
+ switch (conf('ratings')) {
+ case 'normal':
+ include(conf('prefix') . '/templates/show_object_rating.inc.php');
+ break;
+ case 'flash':
+ include(conf('prefix') . '/templates/show_object_rating_flash.inc.php');
+ break;
+ default:
+ return false;
+ break;
+ } // end flash switch
+
+ return true;
+
+} // show_rating
+
+/**
+ * get_rating_name
+ * This takes a score and returns the name that we should use
+ */
+function get_rating_name($score) {
+
+ switch ($score) {
+ case '0':
+ return _("Don't Play");
+ break;
+ case '1':
+ return _("It's Pretty Bad");
+ break;
+ case '2':
+ return _("It's Ok");
+ break;
+ case '3':
+ return _("It's Pretty Good");
+ break;
+ case '4':
+ return _("I Love It!");
+ break;
+ case '5':
+ return _("It's Insane");
+ break;
+ // I'm fired
+ default:
+ return _("Off the Charts!");
+ break;
+ } // end switch
+
+ return true;
+
+} // get_rating_name
+
+?>
diff --git a/lib/themes.php b/lib/themes.php
index bb6c180a..1c67c5a7 100644
--- a/lib/themes.php
+++ b/lib/themes.php
@@ -75,6 +75,13 @@ function get_theme($name) {
*/
function set_theme_colors($theme_name,$user_id) {
+
+
+ if (make_bool($user_id)) {
+ $user_sql = "`user`='$user_id' AND";
+ }
+
+
/* We assume if we've made it this far we've got the right to do it
This could be dangerous but eah!
*/
@@ -89,7 +96,7 @@ function set_theme_colors($theme_name,$user_id) {
$results = mysql_fetch_array($db_results);
- $sql = "UPDATE user_preference SET `value`='" . sql_escape($color) . "' WHERE `user`='" . $user_id . "' AND " .
+ $sql = "UPDATE user_preference SET `value`='" . sql_escape($color) . "' WHERE $user_sql " .
" preference='" . $results[0] . "'";
$db_results = mysql_query($sql, dbh());
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 6c1be64a..6c6396ca 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -56,47 +56,60 @@ function show_confirmation($title,$text,$next_url) {
*/
function set_preferences() {
- get_preferences();
+ init_preferences();
return true;
} // set_preferences
/**
* get_preferences
- * reads this users preferences
+ * WTF was I thinking, this should be set or ini not get.. it doesn't get anything.. sigh anyway I'll
+ * leave this be for now.
+ * @deprecated
*/
function get_preferences($username=0) {
- /* Get System Preferences first */
- $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='0' " .
- " AND user_preference.preference = preferences.id AND preferences.type='system'";
- $db_results = mysql_query($sql, dbh());
+ init_preferences();
+ return true;
- while ($r = mysql_fetch_object($db_results)) {
- $results[$r->name] = $r->value;
- } // end while sys prefs
+} // get_preferences
+
+/**
+ * init_preferences
+ * Third times the charm, why rename a function once when you can do it three times :(
+ * This grabs the preferences and then loads them into conf it should be run on page load
+ * to initialize the needed variables
+ */
+function init_preferences() {
- conf($results, 1);
- unset($results);
+ /* Get Global Preferences */
+ $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='-1' " .
+ " AND user_preference.preference = preferences.id AND preferences.type='system'";
+ $db_results = mysql_query($sql, dbh());
- if (!$username) { $username = $_SESSION['userdata']['username']; }
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $name = $r['name'];
+ $results[$name] = $r['value'];
+ } // end while sys prefs
- $user = new User($username);
+ /* Now we need to allow the user to override some stuff that's been set by the above */
+ $username = $_SESSION['userdata']['username'];
- $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='$user->username'" .
- " AND user_preference.preference=preferences.id";
+ $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user_preference.user='$username' " .
+ " AND user_preference.preference = preferences.id AND preferences.type != 'system'";
$db_results = mysql_query($sql, dbh());
- while ($r = mysql_fetch_object($db_results)) {
- $results[$r->name] = $r->value;
- }
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $name = $r['name'];
+ $results[$name] = $r['value'];
+ } // end while
- unset($results['user'], $results['id']);
+ conf($results,1);
- conf($results, 1);
+ return true;
-} // get_preferences
+} // init_preferences
/**
* flip_class
@@ -520,7 +533,7 @@ function get_all_ratings($rate_user,$sort_by) {;
$id=$row['object_id'];
$rating=$row['user_rating'];
$art_image="<img border=\"0\" src=\"" . conf('web_path') . "/albumart.php?id=" . $id . "\" alt=\"Album Art\" height=\"100\" />";
- $art_link="<a href='http://24.4.10.233/ampache/albums.php?action=show&album=$id'>$art_image</a>";
+ $art_link="<a href='http://" . conf('web_path') . "/ampache/albums.php?action=show&album=$id'>$art_image</a>";
$artist_name=$album->f_artist;
$album_name=$album->name;
if($type=="album"){
@@ -533,7 +546,7 @@ function get_all_ratings($rate_user,$sort_by) {;
"</table>");
}
else{
- $artistLink="<a href='http://24.4.10.233/ampache/artists.php?action=show&artist=$id'>Artist $id</a>";
+ $artistLink="<a href='" . conf('web_path') . "/ampache/artists.php?action=show&artist=$id'>Artist $id</a>";
echo ("<table width=150>" .
"<tr>" .
"<td align=left>$artist_link<br>" .
@@ -547,85 +560,6 @@ function get_all_ratings($rate_user,$sort_by) {;
} // get_artist_rating()
-/**
- * get_artist_rating() - Implemented by SoundOfEmotion
- *
- * given an artist id (string) it will return:
- * false: if there is no current rating
- * true: if there is a rating and will then display the rating
- *
- */
-
-function get_artist_rating($artist_id, $rate_user) {
-
- $artist_id = sql_escape($artist_id);
-
- $sql = "SELECT `user_rating` FROM ratings WHERE user='$rate_user' AND object_type='artist' AND object_id='$artist_id'";
- $db_result = mysql_query( $sql, dbh() );
- $r = mysql_fetch_row( $db_result );
-
- if ( $r[0] ) {
- return ($r[0]);
- }
-
- else{
- return "NA";
- }
-} // get_artist_rating()
-
-/**
- * get_album_rating() - Implemented by SoundOfEmotion
- *
- * given an album id (string) it will return:
- * false: if there is no current rating
- * true: if there is a rating and will then display
- * the rating
- *
- */
-
-function get_album_rating($album_id, $rate_user) {
-
- $album_id = sql_escape($album_id);
-
- $sql = "SELECT `user_rating` FROM ratings WHERE user='$rate_user' AND object_type='album' AND object_id='$album_id'";
- $db_result = mysql_query( $sql, dbh() );
- $r = mysql_fetch_row( $db_result );
-
- if ( $r[0] ) {
- return ($r[0]);
- }
-
- else {
- return "NA";
- }
-} // get_album_rating()
-
-/**
- * get_song_rating() - Implemented by SoundOfEmotion
- *
- * given a song id (string) it will return:
- * false: if there is no current rating
- * true: if there is a rating and will then display the rating
- *
- */
-
-function get_song_rating($song_id, $rate_user) {
-
- $song_id = sql_escape($song_id);
-
- $sql = "SELECT `user_rating` FROM ratings WHERE user='$rate_user' AND object_type='song' AND object_id='$song_id'";
- $db_result = mysql_query( $sql, dbh() );
- $r = mysql_fetch_row( $db_result );
-
- if ( $r[0] ) {
- return ($r[0]);
- }
-
- else{
- return "NA";
- }
-} // get_song_rating()
-
/*
* Artist Ratings - Implemented by SoundOfEmotion
*
@@ -1113,4 +1047,17 @@ function get_location() {
} // get_location
+/**
+ * show_preference_box
+ * This shows the preference box for the preferences pages
+ * it takes a chunck of the crazy preference array and then displays it out
+ * it does not contain the <form> </form> tags
+ */
+function show_preference_box($preferences) {
+
+ include (conf('prefix') . '/templates/show_preference_box.inc.php');
+
+} // show_preference_box
+
+
?>
diff --git a/modules/init.php b/modules/init.php
index 564fbc36..5b2f983a 100644
--- a/modules/init.php
+++ b/modules/init.php
@@ -83,7 +83,7 @@ if (!$results['conf']['allow_stream_playback']) {
}
$results['conf']['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['conf']['web_path'];
-$results['conf']['version'] = '3.3.2-Alpha4 (Build 003)';
+$results['conf']['version'] = '3.3.2-Alpha4 (Build 004)';
$results['conf']['catalog_file_pattern']= 'mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx';
$results['libglue']['local_table'] = 'session';
$results['libglue']['local_sid'] = 'id';
@@ -189,6 +189,11 @@ if (conf('allow_xmms2_playback')) {
require_once(conf('prefix') . "/modules/xmms2/xmms2.class.php");
}
+if (conf('ratings')) {
+ require_once(conf('prefix') . '/lib/class/rating.class.php');
+ require_once(conf('prefix') . '/lib/rating.lib.php');
+}
+
// Classes
require_once(conf('prefix') . "/lib/class/catalog.class.php");
require_once(conf('prefix') . "/lib/class/stream.class.php");
@@ -248,7 +253,7 @@ srand((double) microtime() * 1000003);
// If we don't want a session
if (!isset($no_session) AND conf('use_auth')) {
if (!check_session()) { logout(); exit(); }
- get_preferences();
+ init_preferences();
set_theme();
$user = new User($_SESSION['userdata']['username']);
$user->update_last_seen();
@@ -270,7 +275,7 @@ if (!conf('use_auth')) {
$_SESSION['userdata']['username'] = $auth['info']['username'];
$_SESSION['userdata']['offset_limit'] = $auth['info']['offset_limit'];
$user->set_preferences();
- get_preferences();
+ init_preferences();
set_theme();
}
diff --git a/preferences.php b/preferences.php
index b43a52d4..804405fd 100644
--- a/preferences.php
+++ b/preferences.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2004 Ampache.org
+ Copyright (c) 2001 - 2006 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -32,12 +32,18 @@ require('modules/init.php');
switch(scrub_in($_REQUEST['action'])) {
case 'update_preferences':
$user_id = scrub_in($_REQUEST['user_id']);
+
+ /* Do the work */
update_preferences($user_id);
- $preferences = $GLOBALS['user']->get_preferences();
+
+ /* Reload the Preferences */
$GLOBALS['user']->set_preferences();
- get_preferences();
+
+ /* Reset the conf values */
+ init_preferences();
+
+ /* Reset the Theme */
set_theme();
- break;
default:
$user_id = $user->username;
$preferences = $user->get_preferences();
diff --git a/ratings.php b/ratings.php
new file mode 100644
index 00000000..3ae150b5
--- /dev/null
+++ b/ratings.php
@@ -0,0 +1,41 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2006 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.
+
+*/
+
+require_once("modules/init.php");
+
+
+show_template('header');
+$action = scrub_in($_REQUEST['action']);
+
+switch ($action) {
+ case 'set_rating':
+
+ break;
+ default:
+
+ break;
+} // switch on the action
+
+show_footer();
+
+
+?>
diff --git a/song.php b/song.php
index 93d9d9d5..9c2dbe79 100644
--- a/song.php
+++ b/song.php
@@ -98,7 +98,10 @@ elseif ( $_REQUEST['random'] ) {
if($_REQUEST['catalog'] != '-1') {
$matchlist['catalog'] = $_REQUEST['catalog'];
}
-
+ $_REQUEST['random'] = '100';
+ $_REQUEST['random_type'] = 'normal';
+ unset($matchlist['genre']);
+ unset($matchlist['catalog']);
/* Setup the options array */
$options = array('limit' => $_REQUEST['random'], 'random_type' => $_REQUEST['random_type']);
diff --git a/stats.php b/stats.php
index 637c5cc6..7bb232e8 100644
--- a/stats.php
+++ b/stats.php
@@ -33,14 +33,9 @@ else {
}
show_template('header');
-show_menu_items('Stats');
-show_clear();
?>
-<div class="header1"><?php echo $working_user->fullname; ; ?>'s Favorites:</div>
-
-<p> Below is a list of what you have been listening to the most. You can clear these statistics
-by <a href="<?php echo conf('web_path'); ?>/user.php?action=show_edit_profile">editing your profile.</a></p>
+<span class="header1"><?php echo $working_user->fullname; ; ?>'s Favorites:</span>
<table cellpadding="5" cellspacing="5" border="0" width="100%">
<tr>
@@ -48,7 +43,7 @@ by <a href="<?php echo conf('web_path'); ?>/user.php?action=show_edit_profile">e
<?php
if ( $items = $working_user->get_favorites('artist') ) {
$items = $working_user->format_favorites($items);
- show_info_box('Your Favorite Artists', 'artist', $items);
+ show_info_box('Favorite Artists', 'artist', $items);
}
else {
print("<p> Not enough data for favorite artists.</p>");
@@ -60,7 +55,7 @@ by <a href="<?php echo conf('web_path'); ?>/user.php?action=show_edit_profile">e
<?php
if ( $items = $working_user->get_favorites('song') ) {
$items = $working_user->format_favorites($items);
- show_info_box('Your Favorite Songs', 'your_song', $items);
+ show_info_box('Favorite Songs', 'your_song', $items);
}
else {
print("<p> Not enough data for favorite songs.</p>");
@@ -72,7 +67,7 @@ by <a href="<?php echo conf('web_path'); ?>/user.php?action=show_edit_profile">e
<?php
if ( $items = $working_user->get_favorites('album') ) {
$items = $working_user->format_favorites($items);
- show_info_box('Your Favorite Albums', 'album', $items);
+ show_info_box('Favorite Albums', 'album', $items);
}
else {
print("<p> Not enough data for favorite albums.</p>");
diff --git a/templates/footer.inc b/templates/footer.inc
index 894bb74a..b35db223 100644
--- a/templates/footer.inc
+++ b/templates/footer.inc
@@ -1,3 +1,4 @@
+</td></tr></table>
</div> <!-- end id="content"-->
</div> <!-- end id="maincontainer"-->
</body>
diff --git a/templates/header.inc b/templates/header.inc
index 7eceff3d..635330d8 100644
--- a/templates/header.inc
+++ b/templates/header.inc
@@ -64,4 +64,5 @@ $location = get_location();
<?php require_once(conf('prefix') . '/templates/sidebar.inc.php'); ?>
</div>
<div id="content">
+ <table><tr><td>
<!-- Start Main Page -->
diff --git a/templates/show_album.inc b/templates/show_album.inc
index ad445246..d16a9cf3 100644
--- a/templates/show_album.inc
+++ b/templates/show_album.inc
@@ -28,7 +28,14 @@
$row_classes = array('even','odd');
//FIXME: I hate having to create this here again... LAME
-$user = new User($_SESSION['userdata']['username']);
+$user = $GLOBALS['user'];
+
+// Generate variables for the flash ratings
+//FIXME:
+$album_id=$album->id;
+$artist_id=$album->artist_id;
+$username=$user->username;
+
?>
<br />
<table class="border" cellspacing="1" cellpadding="3" border="0">
@@ -49,6 +56,12 @@ $user = new User($_SESSION['userdata']['username']);
?>
</td>
<td valign="top">
+ <?php
+ if (conf('ratings')) {
+ show_rating($album->id,'artist');
+ } // end if flash
+ echo "<br />\n";
+ ?>
<b>Actions:</b><br />
&nbsp;&nbsp;<a href="<?php echo conf('web_path'); ; ?>/song.php?action=m3u&amp;album=<?php echo $album->id; ; ?>"><?php echo _("Play Album"); ; ?></a><br />
&nbsp;&nbsp;<a href="<?php echo conf('web_path'); ; ?>/song.php?action=m3u&amp;album_random=<?php echo $album->id; ; ?>"><?php echo _("Play Random from Album"); ; ?></a><br />
@@ -60,7 +73,6 @@ $user = new User($_SESSION['userdata']['username']);
<?php if( batch_ok() ) { ?>
&nbsp;&nbsp;<a href="<?php echo conf('web_path'); ; ?>/batch.php?action=alb&amp;id=<?php echo $album->id; ; ?>"><?php echo _("Download"); ?></a><br />
<?php } ?>
-
</td>
</tr>
</table>
diff --git a/templates/show_login_form.inc b/templates/show_login_form.inc
index c7351854..09612512 100644
--- a/templates/show_login_form.inc
+++ b/templates/show_login_form.inc
@@ -69,14 +69,10 @@ if (preg_match($subject,$_SERVER['HTTP_HOST'])) {
</form>
<p align="center">
<a href="http://validator.w3.org/check/referer">
- <img style="padding:0;border:0;width:68px;height:19px"
- src="http://www.w3.org/Icons/valid-xhtml10"
- alt="Valid XHTML 1.0!" />
+ <img style="padding:0;border:0;" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" />
</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
- <img style="padding:0;border:0;width:68px;height:19px"
- src="http://jigsaw.w3.org/css-validator/images/vcss"
- alt="Valid CSS!" />
+ <img style="padding:0;border:0;" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" />
</a>
</p>
<?php if ($show_copyright == 1) { ?>
diff --git a/templates/show_object_rating.inc.php b/templates/show_object_rating.inc.php
new file mode 100644
index 00000000..5b95868b
--- /dev/null
+++ b/templates/show_object_rating.inc.php
@@ -0,0 +1,53 @@
+<?php
+/*
+
+ Copyright 2001 - 2006 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.
+
+*/
+
+
+if ($type != 'song') {
+ echo "<strong>" . _("Rating") . ":</strong>";
+}
+
+/* Create some variables we are going to need */
+$base_url = conf('web_path') . '/ratings.php?action=set_rating&mode=' . conf('flash') . '&rating_type=' . $rating->type . '&object_id=' . $rating->id . '&username=' . $GLOBALS['user']->username;
+$score = '0';
+
+/* count up to 6 */
+while ($score < 6) {
+ /* Handle the "Not rated" possibility */
+ if ($score == '0' AND $score === $rating->rating) {
+ echo "<img src=\"" . conf('web_path') . "/images/ratings/x.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n";
+ }
+ elseif ($score == '0') {
+ echo "<a href=\"" . $base_url . "&rating=$score\">\n";
+ echo "\t<img src=\"" . conf('web_path') . "/images/ratings/x_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n";
+ echo "</a>";
+ }
+ elseif ($score === $rating->rating) {
+ echo "<img src=\"" . conf('web_path') . "/images/ratings/star.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n";
+ }
+ else {
+ echo "<a href=\"" . $base_url . "&rating=$score\">\n\t<img src=\"" . conf('web_path') . "/images/ratings/star_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n</a>\n";
+ }
+ /* Next! */
+ $score++;
+} // end while
+
+?>
diff --git a/templates/show_preference_box.inc.php b/templates/show_preference_box.inc.php
new file mode 100644
index 00000000..3435f2ac
--- /dev/null
+++ b/templates/show_preference_box.inc.php
@@ -0,0 +1,78 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2006 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.
+
+*/
+
+/*!
+ @header Show Preferences
+ @discussion shows a single preference box
+
+*/
+
+/* I'm cheating a little here, check to see if we want to show the
+ * Apply to All button on this page
+ */
+if ($GLOBALS['user']->has_access(100) AND conf('use_auth')) {
+ $show_apply_to_all = true;
+}
+
+?>
+
+
+<table class="border" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr class="odd">
+ <th colspan="3" class="header2" align="left"><?php echo $preferences['title']; ?></th>
+</tr>
+<tr class="table-header">
+ <th><?php echo _("Preference"); ?></th>
+ <th><?php echo _("Value"); ?></th>
+ <?php if ($show_apply_to_all) { ?>
+ <th><?php echo _("Apply to All"); ?></th>
+ <?php } ?>
+</tr>
+<?php
+ foreach ($preferences['prefs'] as $pref) {
+?>
+<tr class="<?php echo flip_class(); ?>">
+ <td><?php echo _($pref['description']); ?></td>
+ <td><table>
+ <tr>
+ <td><?php create_preference_input($pref['name'],$pref['value']); ?></td>
+ <?php if(preg_match('/Color/',$pref['description'])) { ?>
+ <td>
+ <table width="40" border="3" style="border-collapse: collapse;" bgcolor="<?php echo $pref['value'];?>">
+ <tr style="height:20px;">
+ <td></td>
+ </tr>
+ </table>
+ </td>
+ <?php } else { ?>
+ <td></td>
+ <?php } ?>
+ </tr>
+ </table>
+ </td>
+
+ <?php if ($show_apply_to_all) { ?>
+ <td align="center"><input type="checkbox" name="check_<?php echo $pref['name']; ?>" value="1" /></td>
+ <?php } ?>
+</tr>
+<?php } ?>
+</table>
diff --git a/templates/show_preferences.inc b/templates/show_preferences.inc
index 4b3944a2..d3277db2 100644
--- a/templates/show_preferences.inc
+++ b/templates/show_preferences.inc
@@ -35,65 +35,47 @@ if ($GLOBALS['user']->has_access(100) AND $user_id == '-1' AND conf('use_auth'))
?>
-<div class="header1">
+
+<table class="text-box">
+<tr><td>
+<span class="header1">
<?php echo _("Editing"); ?> <?php echo $fullname; ?> <?php echo _("preferences"); ?>
- <?php if ($user->has_access(100)) { ?>
+ <?php if ($GLOBALS['user']->has_access(100)) { ?>
[<a href="<?php echo conf('web_path'); ?>/admin/preferences.php?action=fix_preferences&amp;user_id=<?php echo $user_id; ?>"><?php echo _("Rebuild Preferences"); ?></a>]
<?php } ?>
-</div>
+</span>
+
+
<form method="post" name="preferences" action="<?php echo conf('web_path'); ?><?php echo $target; ?>" enctype="multipart/form-data">
-<table class="border" border="0" cellpadding="0" cellspacing="0">
-<tr class="table-header">
- <th><?php echo _("Preference"); ?></th>
- <th><?php echo _("Value"); ?></th>
- <?php if ($show_apply_to_all) { ?>
- <th><?php echo _("Type"); ?></th>
- <th><?php echo _("Apply to All"); ?></th>
+<table cellspacing="10">
+<tr>
+ <td valign="top"><?php show_preference_box($preferences['theme']); ?></td>
+ <?php if (isset($preferences['system'])) { ?>
+ <td valign="top"><?php show_preference_box($preferences['system']); ?></td>
+ <?php } else { ?>
+ <td valign="top">&nbsp;</td>
<?php } ?>
</tr>
-<?php
- foreach ($preferences as $pref) {
- if ($pref->type == "system") {
- $table_break = 1;
- }
- if ($pref->type == "user" AND $table_break == '1') {
- $table_break = 0;
- ?>
- <tr class="table-header">
- <td colspan="4" style="background:<?php echo conf('bg_color1'); ?>;">&nbsp;</td>
- </tr>
- <?php
- }
-?>
-<tr class="<?php echo flip_class(); ?>">
- <td><?php echo _($pref->description); ?></td>
- <td><table>
- <tr>
- <td><?php create_preference_input($pref->name,$pref->value); ?></td>
- <?php if(preg_match('/Color/',$pref->description)) { ?>
- <td><table width="40" border="3" style="border-collapse: collapse;" bgcolor="<?php echo $pref->value;?>"><tr style="height:20px;"><td></td></tr></table></td>
- <?php } else { ?>
- <td></td>
- <?php } ?>
- </tr>
- </table>
- </td>
-
- <?php if ($show_apply_to_all) { ?>
- <td><?php echo $pref->type; ?></td>
- <td align="center"><input type="checkbox" name="check_<?php echo $pref->name; ?>" value="1" /></td>
- <?php } ?>
+<tr>
+ <td valign="top"><?php show_preference_box($preferences['streaming']); ?></td>
+ <td>&nbsp;</td>
</tr>
-<?php } ?>
-<tr class="<?php echo flip_class(); ?>">
- <td colspan="4">
- <input class="button" type="submit" value="<?php echo _("Update Preferences"); ?>" />
- <input type="hidden" name="action" value="update_preferences" />
- <input type="hidden" name="user_id" value="<?php echo $user_id; ?>" />
- &nbsp;&nbsp;
- <input class="button" type="submit" name="action" value="<?php echo _("Cancel"); ?>" />
- </td>
+<tr>
+ <td valign="top"><?php show_preference_box($preferences['interface']); ?></td>
+ <td>&nbsp;</td>
</tr>
+<tr>
+ <td valign="top"><?php show_preference_box($preferences['options']); ?></td>
+ <td>&nbsp;</td>
+</tr>
+</table>
+
+ <input class="button" type="submit" value="<?php echo _("Update Preferences"); ?>" />
+ <input type="hidden" name="action" value="update_preferences" />
+ <input type="hidden" name="user_id" value="<?php echo $user_id; ?>" />
+ &nbsp;&nbsp;
+ <input class="button" type="submit" name="action" value="<?php echo _("Cancel"); ?>" />
+
+ </form>
+</td></tr>
</table>
-</form>
-<br /><br />
diff --git a/templates/show_songs.inc b/templates/show_songs.inc
index 2f006009..5dd22f10 100644
--- a/templates/show_songs.inc
+++ b/templates/show_songs.inc
@@ -22,6 +22,10 @@
$web_path = conf('web_path');
show_clear();
+
+// Need to set the username for the song ratings.
+$username=$GLOBALS['user']->username;
+
?>
<form name="songs" method="post" enctype="multipart/form-data" action="#">
<table border="0">
@@ -40,6 +44,9 @@ show_clear();
<th><?php echo _("Genre"); ?></th>
<th><?php echo _("Flag"); ?></th>
<th><?php echo _("Action"); ?></th>
+ <?php if (conf('ratings') || conf('ratings')=="false") { ?>
+ <th><?php echo _("Rating"); ?></th>
+ <? } ?>
</tr>
<?php
/* FIXME: don't even get me started with how many things are wrong with this code */
@@ -57,7 +64,8 @@ show_clear();
// Still needed crap
$totalsize += $song->size;
$totaltime += $song->time;
- if ($song->status == "disabled") { $text_class = "class=\"disabled\""; }
+ if ($song->status == "disabled") { $text_class = "class=\"disabled\""; }
+ include("get_song_ratings.inc");
?>
<tr class="<?php echo flip_class(); ?>">
<td align="center">
@@ -119,6 +127,11 @@ show_clear();
| <a href="<?php echo $web_path; ?>/play/index.php?song=<?php echo $song->id; ?>&amp;uid=<?php echo $user->username . "&amp;sid=" . session_id(); ?>&amp;fn=<?php echo rawurlencode($song->f_artist_full . " - " . $song->title . "." . $song->type); ?>"><?php echo _("Direct Link"); ?></a>
<?php } ?>
</td>
+ <?php if(conf('ratings')) { ?>
+ <td>
+ <?php show_rating($song->id,'song'); ?>
+ </td>
+ <? } ?>
</tr>
<?php
}// foreach loop
diff --git a/templates/style.inc b/templates/style.inc
index 44fe274b..cf8cdec1 100644
--- a/templates/style.inc
+++ b/templates/style.inc
@@ -280,12 +280,14 @@
*/
#maincontrainer
{
- margin: 0px;
+ margin:0px;
}
#topbar
{
+ margin-left: 5px;
+ margin-top: 5px;
height: 80px;
- background-color: #888888;
+ background-color: <?php echo conf('bg_color1'); ?>;
}
#topbarright
{
@@ -299,7 +301,7 @@
{
clear: both;
height: 100%;
- margin-left: 0px;
+ margin-left: 5px;
margin-top:0px;
float: left;
width: 170px;
@@ -326,15 +328,15 @@
{
display: block;
padding: 5px 10px;
- color: #000;
- background-color: #666;
+ color: <?php echo conf('font_color1'); ?>;
+ background-color: <?php echo conf('row_color2'); ?>;
text-decoration: none;
}
#sidebar a:hover
{
- color: #000;
- background-color: #ccc;
+ color: <?php echo conf('font_color1'); ?>;
+ background-color: <?php echo conf('row_color3'); ?>;
text-decoration: none;
}
@@ -345,8 +347,8 @@
display: block;
padding: 5px 5px 5px 30px;
width: 125px;
- color: #000;
- background-color: #ccc;
+ color: <?php echo conf('font_color1'); ?>;
+ background-color: <?php echo conf('row_color1'); ?>;
text-decoration: none;
}
@@ -358,16 +360,16 @@
.subnavbutton
{
- background-color: #ddd;
+ background-color: <?php echo conf('row_color1'); ?>;
text-align:center;
text-decoration: none;
- color: #000;
+ color: <?php echo conf('font_color2'); ?>;
}
#sidebar ul ul a:hover
{
- color: #000;
- background-color: #ddd;
+ color: <?php echo conf('font_color2'); ?>;
+ background-color: <?php echo conf('row_color3'); ?>;
text-decoration: none;
}
#content
diff --git a/themes/classic/images/ampache.gif b/themes/classic/images/ampache.gif
index 3e54f9ce..fb110191 100755
--- a/themes/classic/images/ampache.gif
+++ b/themes/classic/images/ampache.gif
Binary files differ
diff --git a/themes/greyblock/templates/style.inc b/themes/greyblock/templates/style.inc
index 3f4bbd64..64fe72f7 100644
--- a/themes/greyblock/templates/style.inc
+++ b/themes/greyblock/templates/style.inc
@@ -264,5 +264,113 @@
font-size: <?php echo conf('font_size'); ?>px;
font-weight: normal;
}
+ #sidebar a:hover
+ {
+ color: #000;
+ background-color: #ccc;
+ text-decoration: none;
+ }
+
+ #sidebar ul ul li { margin: 0 0 1px 0; }
+
+ #sidebar ul ul a
+ {
+ display: block;
+ padding: 5px 5px 5px 30px;
+ width: 125px;
+ color: #000;
+ background-color: #ccc;
+ text-decoration: none;
+ }
+
+ #sidebar ul
+ {
+ margin-left:0px;
+ margin-top:0px;
+ margin-bottom:0px;
+ margin-right: 10px;
+ padding: 0px;
+ list-style-type: none;
+ font-family: verdana, arial, Helvetica, sans-serif;
+ }
+
+ #sidebar li {
+ margin: 0 0 1px 0;
+ padding-top:0px;
+ padding-bottom:0px;
+ }
+
+ #sidebar a, .navbutton
+ {
+ display: block;
+ padding: 5px 10px;
+ color: #000;
+ background-color: #666;
+ text-decoration: none;
+ }
+
+/**
+ * Div Definitions
+ * These define how the page is layed out, be careful with these as changes to them
+ * can cause drastic layout changes
+ */
+ #maincontrainer
+ {
+ margin: 0px;
+ }
+ #topbar
+ {
+ height: 80px;
+ background-color: <?php echo conf('bg_color1'); ?>;
+ }
+ #topbarright
+ {
+ float: right;
+ }
+ #topbarleft
+ {
+ float: left;
+ }
+ #sidebar
+ {
+ clear: both;
+ height: 100%;
+ margin-left: 0px;
+ margin-top:0px;
+ float: left;
+ width: 170px;
+ }
+ #navcontainer ul li
+ {
+ float:left;
+ width:100%;
+ }
+
+ .subnavbutton
+ {
+ background-color: <?php echo conf('row_color1'); ?>;
+ text-align:center;
+ text-decoration: none;
+ color: #000;
+ }
+
+ #sidebar ul ul a:hover
+ {
+ color: <?php echo conf('font_color3'); ?>;
+ background-color: <?php echo conf('row_color2'); ?>;
+ text-decoration: none;
+ }
+ #content
+ {
+ margin-left:0px;
+ padding-top:10px;
+ padding-left:10px;
+ vertical-align:top;
+ }
+/**
+ * End Div Definitions
+ * This is the end of the main structure def's
+ */
+
-->
</style>