summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 06:03:47 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 06:03:47 +0000
commit46ffeca144b7ef44572a5805061da246c8be5f3c (patch)
tree2b338376bb6e4a77839607131c22f20e6a59cb8d
parent0d2c89e90d7c64eba058ae375760a350d336578b (diff)
downloadampache-46ffeca144b7ef44572a5805061da246c8be5f3c.tar.gz
ampache-46ffeca144b7ef44572a5805061da246c8be5f3c.tar.bz2
ampache-46ffeca144b7ef44572a5805061da246c8be5f3c.zip
database update, cleaned up some stuff
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/update.class.php13
-rw-r--r--lib/general.lib.php13
-rw-r--r--lib/preferences.php127
-rw-r--r--server/ajax.server.php6
-rw-r--r--stats.php22
-rw-r--r--templates/show_index.inc.php19
-rw-r--r--templates/show_objects.inc.php3
-rw-r--r--templates/show_stats_newest.inc.php41
-rw-r--r--templates/show_stats_popular.inc.php42
-rw-r--r--themes/classic/templates/default.css3
-rw-r--r--themes/greysme/templates/default.css3
12 files changed, 122 insertions, 171 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 70379d82..db6f5c59 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Alpha4
+ - Database Update, removed useless config options and tweaked a few others
- Fixed last of the missing MPD functionality (Volume & Playlist Clear)
- Fixed HTTPQ and improved parsing for urls from MPD & HTTPQ
they now reconize Democratic Playlists
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 0d5bacfe..c34cd012 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -247,10 +247,12 @@ class Update {
$version[] = array('version' => '340012','description'=>$update_string);
- $update_string = '- Removed Unused Preferneces<br />' .
- '- Changed all XML-RPC acls to RPC to reflect inclusion of new API<br />';
+ $update_string = '- Removed Unused Preferneces.<br />' .
+ '- Changed Localplay Config to Localplay Access.<br />' .
+ '- Changed all XML-RPC acls to RPC to reflect inclusion of new API.<br />';
-// $version[] = array('version' => '340013','description'=>$update_string)
+ $version[] = array('version' => '340013','description'=>$update_string);
+
return $version;
@@ -1055,7 +1057,10 @@ class Update {
public static function update_340013() {
$sql = "DELETE FROM `preference` WHERE `name`='localplay_mpd_hostname' OR `name`='localplay_mpd_port' " .
- "OR `name`='direct_link' OR `name`='localplay_level' OR `name`='localplay_mpd_password'";
+ "OR `name`='direct_link' OR `name`='localplay_mpd_password' OR `name`='catalog_echo_count'";
+ $db_results = Dba::query($sql);
+
+ $sql = "UPDATE `preference` SET `description`='Localplay Access' WHERE `name`='localplay_level'";
$db_results = Dba::query($sql);
$sql = "UPDATE `access_list` SET `type`='rpc' WHERE `type`='xml-rpc'";
diff --git a/lib/general.lib.php b/lib/general.lib.php
index eab84a73..60a461d0 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -521,11 +521,22 @@ function get_languages() {
*/
function logout() {
+ // Do a quick check to see if this is an AJAX'd logout request
+ // if so use the iframe to redirect
+ if (AJAX_INCLUDE == '1') {
+ $_SESSION['iframe']['target'] = Config::get('web_path') . '/login.php';
+ $results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
+ echo xml_from_array($results);
+ }
+
/* First destory their session */
vauth_logout(session_id());
+
/* Redirect them to the login page */
- header ('Location: ' . Config::get('web_path') . '/login.php');
+ if (AJAX_INCLUDE != '1') {
+ header ('Location: ' . Config::get('web_path') . '/login.php');
+ }
return true;
diff --git a/lib/preferences.php b/lib/preferences.php
index c81a3360..793b1db4 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -19,49 +19,6 @@
*/
-/*!
- @function get_site_preferences
- @discussion gets all of the preferences for this Ampache site
-*/
-function get_site_preferences() {
-
- $results = array();
-
- $sql = "SELECT preferences.name, preferences.type, user_preference.value, preferences.description FROM preferences,user_preference " .
- " WHERE preferences.id=user_preference.preference AND user_preference.user = '-1' ORDER BY `type`,`name`";
- $db_results = mysql_query($sql, dbh());
-
- while ($r = mysql_fetch_object($db_results)) {
- $results[] = $r;
- }
-
- return $results;
-
-} // get_site_preferences
-
-/*!
- @function set_site_preferences
- @discussion sets the conf() function with the current site preferences from the db
-*/
-function set_site_preferences() {
-
- $results = array();
-
- $sql = "SELECT preferences.name,user_preference.value FROM preferences,user_preference WHERE user='-1' AND user_preference.preference=preferences.id";
- $db_results = mysql_query($sql, dbh());
-
- while ($r = mysql_fetch_object($db_results)) {
- $results[$r->name] = $r->value;
- } // db results
-
- if (strlen($results['theme_name']) > 0) {
- $results['theme_path'] = "/themes/" . $results['theme_name'];
- }
-
- conf($results,1);
-
-} // set_site_preferences
-
/**
* clean_preference_name
* s/_/ /g & upper case first
@@ -304,12 +261,12 @@ function create_preference_input($name,$value) {
echo "</select>\n";
break;
case 'localplay_level':
- if ($value == '2') { $is_full = 'selected="selected"'; }
- elseif ($value == '1') { $is_global = 'selected="selected"'; }
+ if ($value == '25') { $is_user = 'selected="selected"'; }
+ elseif ($value == '100') { $is_admin = 'selected="selected"'; }
echo "<select name=\"$name\">\n";
echo "<option value=\"0\">" . _('Disabled') . "</option>\n";
- echo "<option value=\"1\" $is_global>" . _('Server') . "</option>\n";
- echo "<option value=\"2\" $is_full>" . _('User') . "</option>\n";
+ echo "<option value=\"25\" $is_user>" . _('User') . "</option>\n";
+ echo "<option value=\"100\" $is_admin>" . _('Admin') . "</option>\n";
echo "</select>\n";
break;
case 'theme_name':
@@ -370,51 +327,6 @@ function get_preference_id($name) {
} // get_preference_id
/**
- * get_preference_name
- * This does the inverse of the above function and returns the preference name from the ID
- * This is usefull for doing... the opposite of above. Amazing isn't it.
- */
-function get_preference_name($id) {
-
- $id = sql_escape($id);
-
- $sql = "SELECT name FROM preferences WHERE id='$id'";
- $db_results = mysql_query($sql,dbh());
-
- $results = mysql_fetch_assoc($db_results);
-
- return $results['name'];
-
-} // get_preference_name
-
-/**
- * insert_preference
- * This creates a new preference record in the
- * preferences table this is used by the modules
- */
-function insert_preference($name,$description,$default,$level,$type,$catagory) {
-
- /* Clean the incomming variables */
- $name = sql_escape($name);
- $description = sql_escape($description);
- $default = sql_escape($default);
- $level = sql_escape($level);
- $type = sql_escape($type);
- $catagory = sql_escape($catagory);
-
-
- /* Form the sql statement */
- $sql = "INSERT INTO preferences (`name`,`description`,`value`,`type`,`level`,`catagory`) VALUES " .
- " ('$name','$description','$default','$type','$level','$catagory')";
- $db_results = mysql_query($sql, dbh());
-
- if ($db_results) { return true; }
-
- return false;
-
-} // insert_preference
-
-/**
* 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
@@ -463,37 +375,6 @@ function init_preferences() {
} // init_preferences
/**
- * show_import_playlist
- * This just shows the template for importing playlists
- * from something outside Ampache such as a m3u
- */
-function show_import_playlist() {
-
- require_once(conf('prefix') . '/templates/show_import_playlist.inc.php');
-
-} // show_import_playlist
-
-/**
- * get_preferences
- * This returns an array of all current preferences in the
- * preferences table, this isn't a users preferences
- */
-function get_preferences() {
-
- $sql = "SELECT * FROM preferences";
- $db_results = mysql_query($sql, dbh());
-
- $results = array();
-
- while ($r = mysql_fetch_assoc($db_results)) {
- $results[] = $r;
- }
-
- return $results;
-
-} // get_preferences
-
-/**
* update_preference_level
* This function updates the level field in the preferences table
* this has nothing to do with a users actuall preferences
diff --git a/server/ajax.server.php b/server/ajax.server.php
index 4f9a954b..98aa473f 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -23,6 +23,9 @@
* as part of the get request
*/
+// Set that this is an ajax include
+define('AJAX_INCLUDE','1');
+
require_once '../lib/init.php';
/* Set the correct headers */
@@ -33,9 +36,6 @@ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
-// Set that this is an ajax include
-define('AJAX_INCLUDE','1');
-
switch ($_REQUEST['page']) {
case 'stats':
require_once Config::get('prefix') . '/server/stats.ajax.php';
diff --git a/stats.php b/stats.php
index b5a9632e..69e9c6a7 100644
--- a/stats.php
+++ b/stats.php
@@ -50,26 +50,8 @@ switch ($_REQUEST['action']) {
// Global stuff first
$stats = Catalog::get_stats();
require_once Config::get('prefix') . '/templates/show_local_catalog_info.inc.php';
-
- $objects = Stats::get_top('album');
- $headers = array('f_link'=>_('Most Popular Albums'));
- show_box_top('','info-box box_popular_albums');
- require Config::get('prefix') . '/templates/show_objects.inc.php';
- show_box_bottom();
-
- $objects = Stats::get_top('artist');
- $headers = array('f_name_link'=>_('Most Popular Artists'));
- show_box_top('','info-box box_popular_artists');
- require Config::get('prefix') . '/templates/show_objects.inc.php';
- show_box_bottom();
-
- $objects = Stats::get_top('genre');
- $headers = array('f_link'=>_('Most Popular Genres'));
- show_box_top('','info-box box_popular_genres');
- require Config::get('prefix') . '/templates/show_objects.inc.php';
- show_box_bottom();
-
-
+ require_once Config::get('prefix') . '/templates/show_stats_popular.inc.php';
+ require_once Config::get('prefix') . '/templates/show_stats_newest.inc.php';
break;
} // end switch on action
diff --git a/templates/show_index.inc.php b/templates/show_index.inc.php
index 4ff0055f..3e656024 100644
--- a/templates/show_index.inc.php
+++ b/templates/show_index.inc.php
@@ -43,22 +43,3 @@ if (isset($_REQUEST['xspf']) && isset ($_REQUEST['play_info'])){
show_box_bottom();
?>
</div>
-<div id="recent_added">
- <?php
- $objects = Stats::get_newest('album');
- $headers = array('f_link'=>_('Newest Albums'));
- show_box_top('','info-box box_newest_albums');
- require Config::get('prefix') . '/templates/show_objects.inc.php';
- show_box_bottom();
- $objects = Stats::get_newest('artist');
- $headers = array('f_name_link'=>_('Newest Artists'));
- show_box_top('','info-box box_newest_artists');
- require Config::get('prefix') . '/templates/show_objects.inc.php';
- show_box_bottom();
- $objects = Stats::get_newest('genre');
- $headers = array('f_link'=>_('Newest Genres'));
- show_box_top('','info-box box_newest_genres');
- require Config::get('prefix') . '/templates/show_objects.inc.php';
- show_box_bottom();
- ?>
-</div>
diff --git a/templates/show_objects.inc.php b/templates/show_objects.inc.php
index 4ebaa1f2..728c376f 100644
--- a/templates/show_objects.inc.php
+++ b/templates/show_objects.inc.php
@@ -22,11 +22,12 @@
/*
* Variable/Non-DB object display takes headers & objects
*/
+
?>
<table class="tabledata" cellspacing="0">
<tr>
<?php foreach ($headers as $header) { ?>
- <th class="th-top"><?php echo scrub_out($header); ?></th>
+ <th class="th-top"><?php echo $header; ?></th>
<?php } ?>
</tr>
<?php
diff --git a/templates/show_stats_newest.inc.php b/templates/show_stats_newest.inc.php
new file mode 100644
index 00000000..c547198d
--- /dev/null
+++ b/templates/show_stats_newest.inc.php
@@ -0,0 +1,41 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2007 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 v2
+ as published by the Free Software Foundation.
+
+ 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.
+
+*/
+?>
+<div id="recent_added">
+ <?php
+ $objects = Stats::get_newest('album');
+ $headers = array('f_link'=>_('Newest Albums'));
+ show_box_top('','info-box box_newest_albums');
+ require Config::get('prefix') . '/templates/show_objects.inc.php';
+ show_box_bottom();
+ $objects = Stats::get_newest('artist');
+ $headers = array('f_name_link'=>_('Newest Artists'));
+ show_box_top('','info-box box_newest_artists');
+ require Config::get('prefix') . '/templates/show_objects.inc.php';
+ show_box_bottom();
+ $objects = Stats::get_newest('genre');
+ $headers = array('f_link'=>_('Newest Genres'));
+ show_box_top('','info-box box_newest_genres');
+ require Config::get('prefix') . '/templates/show_objects.inc.php';
+ show_box_bottom();
+ ?>
+</div>
+
diff --git a/templates/show_stats_popular.inc.php b/templates/show_stats_popular.inc.php
new file mode 100644
index 00000000..648945a9
--- /dev/null
+++ b/templates/show_stats_popular.inc.php
@@ -0,0 +1,42 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2007 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 v2
+ as published by the Free Software Foundation.
+
+ 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.
+
+*/
+?>
+<div>
+<?php
+ $objects = Stats::get_top('album');
+ $headers = array('f_link'=>_('Most Popular Albums'));
+ show_box_top('','info-box box_popular_albums');
+ require Config::get('prefix') . '/templates/show_objects.inc.php';
+ show_box_bottom();
+
+ $objects = Stats::get_top('artist');
+ $headers = array('f_name_link'=>_('Most Popular Artists'));
+ show_box_top('','info-box box_popular_artists');
+ require Config::get('prefix') . '/templates/show_objects.inc.php';
+ show_box_bottom();
+
+ $objects = Stats::get_top('genre');
+ $headers = array('f_link'=>_('Most Popular Genres'));
+ show_box_top('','info-box box_popular_genres');
+ require Config::get('prefix') . '/templates/show_objects.inc.php';
+ show_box_bottom();
+?>
+</div>
diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css
index 74457687..06fabf73 100644
--- a/themes/classic/templates/default.css
+++ b/themes/classic/templates/default.css
@@ -490,6 +490,9 @@ a.button{padding:1px 3px;}
.box_newest_albums {}
.box_newest_artists {clear:none;}
.box_newest_genres {clear:none;}
+.box_popular_album {}
+.box_popular_artists {clear:none;}
+.box_popular_genres {clear:none;}
.box_preferences h4 {color:#000;font:bold 14px Verdana, Helvetica, sans-serif;padding:0.8em 0;}
diff --git a/themes/greysme/templates/default.css b/themes/greysme/templates/default.css
index ee3a02d0..4b753ac2 100644
--- a/themes/greysme/templates/default.css
+++ b/themes/greysme/templates/default.css
@@ -524,6 +524,9 @@ input[type=checkbox] { border:0;background:none; }
.box_newest_albums {}
.box_newest_artists {clear:none;}
.box_newest_genres {clear:none;}
+.box_popular_album {}
+.box_popular_artists {clear:none;}
+.box_popular_genres {clear:none;}
.box_preferences h4 {color: #8b3e38;font-size: 1.1em;text-align:center;font-weight: bold;border-bottom:1px solid #8b3e38;padding:1em;}
/************************************************/