diff options
54 files changed, 179 insertions, 517 deletions
diff --git a/activate.php b/activate.php index ff0200b6..5942994b 100644 --- a/activate.php +++ b/activate.php @@ -21,13 +21,12 @@ */ $no_session = true; -require_once( "modules/init.php" ); +require_once('lib/init.php'); /* Keep them out if they shouldn't be here */ if(!conf('allow_public_registration') || conf('demo_mode')) { access_denied(); } - ?> <html><head> <?php show_template('style'); ?> diff --git a/admin/access.php b/admin/access.php index f0fa7d9b..f9e3d2be 100644 --- a/admin/access.php +++ b/admin/access.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -20,7 +20,7 @@ */ -require('../modules/init.php'); +require('../lib/init.php'); /* Scrub in the Needed vars */ @@ -28,8 +28,8 @@ $action = scrub_in($_REQUEST['action']); $access_id = scrub_in($_REQUEST['access_id']); $access = new Access($access_id); -if (!$user->has_access(100)) { - header("Location: http://" . conf('web_path') . "/index.php?access=denied"); +if (!$GLOBALS['user']->has_access(100)) { + access_denied(); exit(); } @@ -39,7 +39,7 @@ show_template('header'); switch ($action ) { case 'show_confirm_delete': - show_confirm_action(_('Do you really want to delete this Access Reocrd?'),'admin/access.php','access_id=' . scrub_out($_REQUEST['access_id']) . '&action=delete_host'); + show_confirmation(_('Confirm Delete'),_('Do you really want to delete this Access Record?'),'admin/access.php?access_id=' . scrub_out($_REQUEST['access_id']) . '&action=delete_host','1'); break; case 'delete_host': $access->delete($_REQUEST['access_id']); @@ -62,7 +62,7 @@ switch ($action ) { default: $list = array(); $list = $access->get_access_list(); - include(conf('prefix') ."/templates/show_access_list.inc"); + include(conf('prefix') .'/templates/show_access_list.inc'); break; } // end switch on action show_footer(); diff --git a/admin/album.php b/admin/album.php deleted file mode 100644 index 006f99f8..00000000 --- a/admin/album.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -/* - - Copyright (c) 2004 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 Admin Album Mojo - Update the album information for the site. - -*/ - -require('../modules/init.php'); - - -if (!$user->has_access(100)) { - header("Location:" . conf('web_path') . "/index.php?access=denied"); - exit(); -} - - -if ( $action == 'Change Name' ) { - - update_album_name($album, $new_name); - - if ( $update_tag ) { - // get songs associated with this - $songs = get_songs_from_album($album); - - // run update_local_mp3 - $total_updated = update_local_mp3($new_name, 'album', $songs); - $update_text = "Updated the database and $total_updated local files."; - } - - // set the action to view so everybody can see the changes - $action = 'View'; -} - -show_template('header'); - -show_menu_items('Admin'); -show_admin_menu('Catalog'); - -?> - -<p>Use this form to change the name(s) of albums in the database. In order to update your -local MP3's your Apache user must have write-permission to your MP3's.</p> - -<form name="album" method="post" action="album.php"> -<table> - <tr> - <td>Select Album:</td> - <td> <?php show_album_pulldown($album) ?> </td> - <td> <input type=submit name=action value=View> </td> - </tr> -</table> -</form> - -<hr> - -<?php - -// if album exists then show some info -if ( $album and $action == 'View' ) { - $album_name = get_album_name($album); - -?> - -<p style="color: red;"><?php echo $update_text; ?></p> - -<form name="album_change" method=post action="album.php"> - <table> - <tr> - <td>Album Name:</td> - <td><input type=text name="new_name" value="<?php echo $album_name; ?>" size="50"></td> - <td> </td> - <td><input type=submit name=action value="Change Name"></td> - <tr> - <td> </td> <td><input type="checkbox" name="update_tag"> - Update MP3 tag <b>Note: this will only modify your local MP3's</b> - </td> - </tr> - </table> - <input type=hidden name=album value="<?php echo $album; ?>"> -</form> - -<?php - - $song_ids = get_song_ids_from_album($album); - show_songs($song_ids, 0); -} - -show_footer(); -?> - -</body> -</html> diff --git a/admin/artist.php b/admin/artist.php deleted file mode 100644 index be473d8d..00000000 --- a/admin/artist.php +++ /dev/null @@ -1,121 +0,0 @@ -<?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. - -*/ - -/*! - @header Admin Artist page - Update the artist information for the site. - -*/ - -require('../modules/init.php'); - - -if (!$user->has_access(100)) { - header("Location:". conf('web_path') . "/index.php?access=denied"); - exit(); -} - -$dbh = dbh(); - -if ( $action == 'Change Name' ) { - if ( $settings[demo_mode] == 'false' && $username != $settings[demo_user] ) { - $old_artist_name = get_artist_name($artist); - update_artist_name($artist, $new_name); - - if ( $update_tag ) { - // get songs associated with this - $song_ids = get_song_ids_from_artist($artist); - - // run update_local_mp3 - $total_updated = update_local_mp3($new_name, 'artist', $song_ids); - $update_text = "Updated $old_artist_name to $new_name and $total_updated local files."; - } - else { - $update_text = "Updated $old_artist_name to $new_name."; - } - - // set the action to view so everybody can see the changes - $action = 'View'; - } -} - -show_template('header'); - -show_menu_items(".."); -show_admin_menu('Catalog'); - -?> - -<p>Use this form to change the name(s) of artists in the database. In order to update your -local MP3's your Apache user must have write-permission to your MP3's.</p> - -<form name="artist" method="post" action="artist.php"> -<table> - <tr> - <td>Select Artist:</td> - <td> <?php show_artist_pulldown($artist) ?> </td> - <td> <input type=submit name=action value=View> </td> - </tr> -</table> -</form> - -<hr> - -<?php - -// if artist exists then show some info -if ( $artist and $action == 'View' ) { - $sql = "SELECT name FROM artist WHERE id='$artist'"; - $db_result = mysql_query($sql, $dbh); - - $r = mysql_fetch_row($db_result); - $artist_name = $r[0]; - -?> - -<p style="color: red;"><?php echo $update_text; ?></p> - -<form name="artist_change" method=post action="artist.php"> - <table> - <tr> - <td>Artist Name:</td> <td><input type=text name="new_name" value="<?php echo $artist_name; ?>" size="50"></td> - <td> </td> <td><input type=submit name=action value="Change Name"></td> - </tr> - <tr> - <td> </td> <td><input type="checkbox" name="update_tag"> - Update MP3 tag <b>Note: this will only modify your local MP3's</b> - </td> - </tr> - </table> - <input type="hidden" name="artist" value="<?php echo $artist; ?>"> -</form> - -<?php - - show_albums_for_artist($artist); -} - -?> - -</body> -</html> diff --git a/admin/catalog.php b/admin/catalog.php index 54fac154..1327e188 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -26,7 +26,7 @@ This document handles actions for catalog creation and passes them off to the catalog class */ -require('../modules/init.php'); +require('../lib/init.php'); if (!$GLOBALS['user']->has_access(100)) { access_denied(); diff --git a/admin/duplicates.php b/admin/duplicates.php index 2680e05e..d0167bbb 100644 --- a/admin/duplicates.php +++ b/admin/duplicates.php @@ -1,8 +1,7 @@ <?php - /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -24,7 +23,7 @@ // Allows users to search for duplicate songs in their catalogs -require_once ("../modules/init.php"); +require_once ('../lib/init.php'); require_once( conf('prefix').'/lib/duplicates.php'); diff --git a/admin/flag.php b/admin/flag.php index 695d90d0..e8416b6f 100644 --- a/admin/flag.php +++ b/admin/flag.php @@ -26,7 +26,7 @@ * flagging. */ -require('../modules/init.php'); +require('../lib/init.php'); if (!$GLOBALS['user']->has_access('100')) { access_denied(); diff --git a/admin/flags.php b/admin/flags.php index 3f47cc44..fffc0e5c 100644 --- a/admin/flags.php +++ b/admin/flags.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ @header Flags Mojo */ -require_once ("../modules/init.php"); +require_once ("../lib/init.php"); require_once( conf('prefix').'/lib/flag.php'); if (!$user->has_access(100)) { diff --git a/admin/index.php b/admin/index.php index 0fcbec54..6217ef0f 100644 --- a/admin/index.php +++ b/admin/index.php @@ -20,7 +20,7 @@ */ -require ('../modules/init.php'); +require ('../lib/init.php'); $action = scrub_in($_REQUEST['action']); diff --git a/admin/mail.php b/admin/mail.php index df717780..a71669e7 100644 --- a/admin/mail.php +++ b/admin/mail.php @@ -20,7 +20,7 @@ */ -require('../modules/init.php'); +require('../lib/init.php'); if (!$GLOBALS['user']->has_access(100)) { access_denied(); diff --git a/admin/modules.php b/admin/modules.php index 0678ff7c..5dde981c 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -20,7 +20,7 @@ */ -require('../modules/init.php'); +require('../lib/init.php'); if (!$GLOBALS['user']->has_access(100)) { access_denied(); diff --git a/admin/preferences.php b/admin/preferences.php index ea3175fc..94f940f3 100644 --- a/admin/preferences.php +++ b/admin/preferences.php @@ -29,7 +29,7 @@ * @author Karl Vollmer */ -require('../modules/init.php'); +require('../lib/init.php'); if (!$user->has_access(100)) { diff --git a/admin/users.php b/admin/users.php index e2fdcbee..3a8c132c 100644 --- a/admin/users.php +++ b/admin/users.php @@ -27,7 +27,7 @@ */ -require_once ("../modules/init.php"); +require_once ('../lib/init.php'); if (!$user->has_access(100)) { access_denied(); diff --git a/albumart.php b/albumart.php index db56c707..af603a71 100644 --- a/albumart.php +++ b/albumart.php @@ -20,14 +20,13 @@ */ /* - @header Album Art This pulls album art out of the file using the getid3 library and dumps it to the browser as an image mime type. */ -require('modules/init.php'); +require('lib/init.php'); /* Decide what size this image is */ switch ($_REQUEST['thumb']) { @@ -20,7 +20,7 @@ */ -require_once('modules/init.php'); +require_once('lib/init.php'); show_template('header'); diff --git a/artists.php b/artists.php index b1f4452a..4e38c1bc 100644 --- a/artists.php +++ b/artists.php @@ -26,7 +26,7 @@ */ -require_once("modules/init.php"); +require_once('lib/init.php'); if (!isset($_REQUEST['match'])) { $_REQUEST['match'] = "Browse"; } if (!isset($_REQUEST['action'])) { $_REQUEST['action'] = "match"; } @@ -32,7 +32,7 @@ * in your PHP build. */ - require_once('modules/init.php'); + require_once('lib/init.php'); //test that batch download is permitted (user or system?) /* Drop the normal Time limit constraints, this can take a while */ diff --git a/bin/catalog_update.php.inc b/bin/catalog_update.php.inc index 4ad80076..16dff65e 100644 --- a/bin/catalog_update.php.inc +++ b/bin/catalog_update.php.inc @@ -21,7 +21,7 @@ */ $no_session='1'; -require ("../modules/init.php"); +require ('../lib/init.php'); echo "[catalog_update.php.inc]\nStarting Catalog Clean/Update And Add\n\n"; diff --git a/bin/compare_config.php.inc b/bin/compare_config.php.inc index af29b381..c5393ede 100644 --- a/bin/compare_config.php.inc +++ b/bin/compare_config.php.inc @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved This program is free software; you can redistribute it and/or @@ -21,8 +21,8 @@ */ $no_session = '1'; -require ("../modules/init.php"); -require ("../lib/debug.php"); +require ('../lib/init.php'); +require ('../lib/debug.php'); $results = debug_read_config(conf('prefix') . "/config/ampache.cfg.php"); diff --git a/bin/dump_album_art.php.inc b/bin/dump_album_art.php.inc index 093e7b71..8748cd41 100644 --- a/bin/dump_album_art.php.inc +++ b/bin/dump_album_art.php.inc @@ -22,7 +22,7 @@ $no_session = '1'; -require ("../modules/init.php"); +require ("../lib/init.php"); $catalogs = Catalog::get_catalogs(); diff --git a/bin/parse_m3u.php.inc b/bin/parse_m3u.php.inc index 9b720bb3..71c5c2f4 100644 --- a/bin/parse_m3u.php.inc +++ b/bin/parse_m3u.php.inc @@ -23,7 +23,7 @@ $filename = "/data/music/Live/L/Life'll Kill Ya/Warren Zevon.m3u"; $no_session = '1'; -require ("../modules/init.php"); +require ("../lib/init.php"); $handle = fopen($filename,'r'); diff --git a/bin/print_amazon.php.inc b/bin/print_amazon.php.inc index 09118ae7..32f864b2 100755 --- a/bin/print_amazon.php.inc +++ b/bin/print_amazon.php.inc @@ -25,7 +25,7 @@ $search['artist_name'] = "Bent"; $no_session = '1'; -require ("../modules/init.php"); +require ("../lib/init.php"); echo "<pre>\n"; $amazon = new AmazonSearch(conf('amazon_developer_key')); // Prevent the script from timing out diff --git a/bin/print_tags.php.inc b/bin/print_tags.php.inc index 68d84b27..aef52594 100644 --- a/bin/print_tags.php.inc +++ b/bin/print_tags.php.inc @@ -20,13 +20,14 @@ */ $no_session = '1'; -require ("../modules/init.php"); +require ("../lib/init.php"); $filename = usage(); echo "Reading: $filename\n"; -$info = new Audioinfo(); +$info = new vainfo(); +$info->get_info(); $results = $info->info($filename); $results['file'] = $filename; $key = get_tag_type($results); diff --git a/bin/quarantine_migration.php.inc b/bin/quarantine_migration.php.inc index 803317ef..cb428a56 100644 --- a/bin/quarantine_migration.php.inc +++ b/bin/quarantine_migration.php.inc @@ -24,7 +24,7 @@ */ $no_session='1'; -require_once('../modules/init.php'); +require_once('../lib/init.php'); usage(); diff --git a/bin/sort_files.php.inc b/bin/sort_files.php.inc index 7f446873..f270e86e 100644 --- a/bin/sort_files.php.inc +++ b/bin/sort_files.php.inc @@ -39,7 +39,7 @@ $alphabet_prefix = true; $no_session = '1'; -require ("../modules/init.php"); +require ("../lib/init.php"); /* First Clean the catalog to we don't try to write anything we shouldn't */ @@ -33,7 +33,7 @@ */ /* Base Require */ -require_once("modules/init.php"); +require_once('lib/init.php'); /* Clean up incomming variables */ $action = scrub_in($_REQUEST['action']); diff --git a/docs/CHANGELOG b/docs/CHANGELOG index c284afa1..f0384cc1 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,9 @@ -------------------------------------------------------------------------- v.3.3.2-Beta3 + - Moved /modules/init.php to /lib/init.php + - Removed Checkboxes from Search page and added ability to + search on Comment and Rating - Fixed a missing close tag on the catalog build if ampache was unable to get the filesize of a file - Fixed link to Statistics page, user link has been missing diff --git a/download/index.php b/download/index.php index 58b33e56..5375cce1 100644 --- a/download/index.php +++ b/download/index.php @@ -26,7 +26,7 @@ Special thanks to the Horde project for their Browser class that makes this so easy. */ -require('../modules/init.php'); +require('../lib/init.php'); require(conf('prefix') . '/modules/horde/Browser.php'); $browser = new Browser(); @@ -26,7 +26,7 @@ */ -require_once('modules/init.php'); +require_once('lib/init.php'); show_template('header'); @@ -23,7 +23,7 @@ * Genres Pages * Nuff Said for now */ -require_once("modules/init.php"); +require_once('lib/init.php'); show_template('header'); @@ -26,16 +26,10 @@ */ -require_once("modules/init.php"); - -/* We need to attempt to init the mpd object -if ($user->prefs['play_type']=='mpd') { $myMpd = init_mpd(); } -* Happening in header.inc now -*/ +require_once('lib/init.php'); show_template('header'); -if (conf('refresh_limit') > 0) { require_once ("templates/javascript_refresh.inc"); } $action = scrub_in($_REQUEST['action']); ?> @@ -55,40 +49,26 @@ $action = scrub_in($_REQUEST['action']); </td> <td valign="top" align="left"> <!-- sigger: why is it a problem to set width=50% --> <?php - if (false) // $user->prefs['play_type'] == 'mpd' && !conf('localplay_menu')) -{ - show_mpd_control(); - } - else { - if ($items = get_global_popular('album')) { - show_info_box(_("Most Popular Albums"), 'album',$items); - } + if ($items = get_global_popular('album')) { + show_info_box(_('Most Popular Albums'), 'album',$items); } ?> </td> </tr> <tr><td colspan="2"> </td></tr> - <?php - if ($user->prefs['play_type'] == 'mpd' && !conf('localplay_menu')) { - echo '<tr><td colspan="2" valign="top">'; - show_mpd_pl(); - echo '</td></tr>'; - } - ?> - <tr><td colspan="2"> </td></tr> <tr> <td valign="top" align="right"> <?php if ($items = get_global_popular('artist')) { - show_info_box(_("Most Popular Artists"), 'artist', $items); + show_info_box(_('Most Popular Artists'), 'artist', $items); } ?> </td> <td valign="top" align="left"> <?php if ($items = get_global_popular('song')) { - show_info_box(_("Most Popular Songs"), 'song', $items); + show_info_box(_('Most Popular Songs'), 'song', $items); } ?> </td> @@ -98,36 +78,20 @@ $action = scrub_in($_REQUEST['action']); <td valign="top" align="right"> <?php if ($items = get_newest('artist')) { - show_info_box(_("Newest Artist Additions"), '', $items); + show_info_box(_('Newest Artist Additions'), '', $items); } ?> </td> <td valign="top" align="left"> <?php if ($items = get_newest('album')) { - show_info_box(_("Newest Album Additions"), '', $items); + show_info_box(_('Newest Album Additions'), '', $items); } ?> </td> </tr> </table><!-- End Left table --> </td> -<?php -if ($user->prefs['play_type'] == 'local_play') { -?> - <td valign="top"> - <table border="0"> <!-- Right table --> - <tr> - <td valign="top" rowspan="7"> - <?php show_local_control(); ?> - <br /> - </td> - </tr> - </table> <!-- End Right Table --> - </td> -<?php -} -?> </tr> </table> <!-- End Big Daddy Table --> diff --git a/modules/init.php b/lib/init.php index 96b99a21..8a97f5c9 100644 --- a/modules/init.php +++ b/lib/init.php @@ -80,7 +80,7 @@ if (!$results['allow_stream_playback']) { /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.3.2-Beta3 (Build 008)'; +$results['version'] = '3.3.2-Beta3 (Build 009)'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; diff --git a/lib/search.php b/lib/search.php index 5ab121ba..203168a9 100644 --- a/lib/search.php +++ b/lib/search.php @@ -33,12 +33,20 @@ function run_search($data) { /* Create an array of the object we need to search on */ - foreach ($data['search_object'] as $type) { - /* generate the full name of the textbox */ - $fullname = $type . "_string"; - $search[$type] = sql_escape($data[$fullname]); + foreach ($data as $key=>$value) { + /* Get the first two chars to check + * and see if it's s_ + */ + $prefix = substr($key,0,2); + $value = trim($value); + + if ($prefix == 's_' AND strlen($value)) { + $true_name = substr($key,2,strlen($key)); + $search[$true_name] = sql_escape($value); + } + } // end foreach - + /* Figure out if they want a AND based search or a OR based search */ switch($_REQUEST['operator']) { case 'or': @@ -156,6 +164,9 @@ function search_song($data,$operator,$method,$limit) { case 'filename': $where_sql .= " song.file $value_string $operator"; break; + case 'comment': + $where_sql .= " song.comment $value_string $operator"; + break; case 'played': /* This is a 0/1 value so bool it */ $value = make_bool($value); diff --git a/localplay.php b/localplay.php index be5e2fe0..adf2c2c9 100644 --- a/localplay.php +++ b/localplay.php @@ -21,7 +21,7 @@ */ -require('modules/init.php'); +require('lib/init.php'); /* If we are running a demo, quick while you still can! */ if (conf('demo_mode')) { @@ -27,7 +27,11 @@ */ $no_session = true; -require_once('modules/init.php'); +require_once('lib/init.php'); + +/* We have to create a cookie here because IIS + * can't handle Cookie + Redirect + */ vauth_session_cookie(); init_preferences(); @@ -24,8 +24,7 @@ * This is the logout page, it kills any cookies you have in your browser kills * your session in the database and then redirects you to the login page */ - -require_once("modules/init.php"); +require_once('lib/init.php'); // To end a legitimate session, just call logout. setcookie("amp_longsess","",null); logout(); diff --git a/modules/id3/vainfo.class.php b/modules/id3/vainfo.class.php index d9efe341..23f2703f 100755 --- a/modules/id3/vainfo.class.php +++ b/modules/id3/vainfo.class.php @@ -28,19 +28,18 @@ class vainfo { /* Default Encoding */ - var $encoding = 'UTF-8'; + var $encoding = ''; /* Loaded Variables */ var $filename = ''; var $type = ''; var $tags = array(); - var $info = array(); - /* Internal Information */ var $_raw = array(); var $_getID3 = ''; var $_iconv = false; + var $_file_encoding = ''; var $_file_pattern = ''; var $_dir_pattern = ''; @@ -93,9 +92,15 @@ class vainfo { /* Figure out what type of file we are dealing with */ $this->type = $this->_get_type(); + /* This is very important, figure out th encoding of the + * file + */ + $this->_set_encoding(); + /* Get the general information about this file */ $info = $this->_get_info(); + /* Gets the Tags */ $this->tags = $this->_get_tags(); $this->tags['info'] = $info; @@ -105,6 +110,26 @@ class vainfo { } // get_info /** + * _set_encoding + * This function trys to figure out what the encoding + * is based on the file type and sets the _file_encoding + * var to whatever it finds, the default is UTF-8 if we + * can't find anything + */ + function _set_encoding() { + /* Switch on the file type */ + switch ($this->type) { + case 'mp3': + $this->_file_encoding = $this->_raw['encoding']; + break; + default: + $this->_file_encoding = 'UTF-8'; + break; + } // end switch + + } // _get_encoding + + /** * _get_type * This function takes the raw information and figures out * what type of file we are dealing with for use by the tag @@ -285,14 +310,14 @@ class vainfo { function _parse_id3v1($tags) { $array = array(); - + /* Go through all the tags */ foreach ($tags as $tag=>$data) { /* This is our baseline for naming * so no translation needed */ - $array[$tag] = $this->_clean_tag($data['0']); + $array[$tag] = $this->_clean_tag($data['0'],$this->_file_encoding); } // end foreach @@ -316,7 +341,7 @@ class vainfo { /* This is our baseline for naming so * no translation is needed */ - $array[$tag] = $this->_clean_tag($data['0']); + $array[$tag] = $this->_clean_tag($data['0'],$this->_file_encoding); } // end foreach @@ -379,10 +404,13 @@ class vainfo { * in the file */ function _clean_tag($tag,$encoding='') { + + /* Guess that it's UTF-8 */ + if (!$encoding) { $encoding = 'UTF-8'; } - - if ($this->_iconv) { - $tag = iconv('UTF-8',conf('site_charset'),$tag); + if ($this->_iconv AND strcasecmp($encoding,$this->encoding) != 0) { + $charset = $this->encoding . '//TRANSLIT'; + $tag = iconv($encoding,$charset,$tag); } return $tag; diff --git a/play/index.php b/play/index.php index 23581638..91f1323f 100644 --- a/play/index.php +++ b/play/index.php @@ -28,7 +28,7 @@ */ $no_session = true; -require_once('../modules/init.php'); +require_once('../lib/init.php'); require_once(conf('prefix') . '/modules/horde/Browser.php'); diff --git a/playlist.php b/playlist.php index 44c40777..f70bcd18 100644 --- a/playlist.php +++ b/playlist.php @@ -24,7 +24,7 @@ * This is the playlist document, it handles all things playlist. */ -require_once("modules/init.php"); +require_once('lib/init.php'); show_template('header'); diff --git a/preferences.php b/preferences.php index 985f225f..906df6ff 100644 --- a/preferences.php +++ b/preferences.php @@ -27,7 +27,7 @@ */ -require('modules/init.php'); +require('lib/init.php'); /* Scrub in the needed mojo */ if (!$_REQUEST['tab']) { $_REQUEST['tab'] = 'theme'; } diff --git a/qtembed.php b/qtembed.php deleted file mode 100644 index 47c87806..00000000 --- a/qtembed.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php
-/*
-
- Copyright (c) 2004 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.
-
-*/
-
-/*
-
- This script generates the HTML needed for
- embeded QuickTime player.
-
-*/
-
-require('modules/init.php');
-
-
-/* Just pass on all the parameters */
-$web_path = conf('web_path');
-$play_url = "$web_path/play/?".$_SERVER["QUERY_STRING"];
-
-?>
-
-
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-<head>
- <title>QT Embedded Player</title>
-
-<style type="text/css">
-<!--
- BODY {
- margin: 0pt;
- padding: 0pt;
- }
--->
-</style>
-
-</head>
-
-
-
-<body>
-
-<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
- WIDTH="100%"
- HEIGHT="16"
- NAME="movie"
- CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
- <PARAM name="SRC" VALUE="<?=$play_url?>">
- <PARAM name="AUTOPLAY" VALUE="true">
- <PARAM name="CONTROLLER" VALUE="true">
- <PARAM name="QTNEXT1" VALUE="<javascript:top.next_song();>">
- <EMBED
- NAME="movie"
- SRC="<?=$play_url?>"
- WIDTH="100%"
- HEIGHT="16"
- AUTOPLAY="true"
- CONTROLLER="true"
- QTNEXT1="<javascript:top.next_song();>"
- PLUGINSPAGE="http://www.apple.com/quicktime/download/"
- >
- </EMBED>
-</OBJECT>
-
-</body>
-</html>
diff --git a/randomplay.php b/randomplay.php index 155b81b6..a3cfb6d6 100644 --- a/randomplay.php +++ b/randomplay.php @@ -25,13 +25,13 @@ @discussion Do most of the dirty work of displaying the mp3 catalog */ -require_once("modules/init.php"); +require_once('lib/init.php'); show_template('header'); $action = scrub_in($_REQUEST['action']); show_template('show_random_play'); -show_footer(); +show_footer(); ?> diff --git a/ratings.php b/ratings.php index 5253b1dd..f5bcab3e 100644 --- a/ratings.php +++ b/ratings.php @@ -20,7 +20,7 @@ */ -require_once("modules/init.php"); +require_once('lib/init.php'); show_template('header'); diff --git a/register.php b/register.php index 16cc2d5a..8461f458 100644 --- a/register.php +++ b/register.php @@ -28,7 +28,7 @@ */ $no_session = true; -require_once ("modules/init.php"); +require_once ('lib/init.php'); /* Check Perms */ @@ -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 @@ -21,7 +21,7 @@ */ $no_session = 1; -require('modules/init.php'); +require('lib/init.php'); /* Check Perms */ if (!conf('use_rss') || conf('demo_mode')) { @@ -1,6 +1,9 @@ <?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 @@ -25,7 +28,7 @@ */ -require_once("modules/init.php"); +require_once('lib/init.php'); show_template('header'); @@ -48,6 +51,7 @@ switch ($action) { } case 'search': show_template('show_search'); + print_r($_REQUEST); $results = run_search($_REQUEST); show_search($_REQUEST['object_type'],$results); break; diff --git a/server/ajax.server.php b/server/ajax.server.php index bb38d7cc..42189c6e 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -25,7 +25,7 @@ */ $no_session = true; -require_once('../modules/init.php'); +require_once('../lib/init.php'); /* Verify the existance of the Session they passed in */ if (!session_exists($_REQUEST['sessid'])) { exit(); } diff --git a/server/xmlrpc.server.php b/server/xmlrpc.server.php index 9208205f..a0d71cc0 100644 --- a/server/xmlrpc.server.php +++ b/server/xmlrpc.server.php @@ -21,7 +21,7 @@ */ $no_session = true; -require_once('../modules/init.php'); +require_once('../lib/init.php'); if (conf('xml_rpc')) { @@ -29,7 +29,7 @@ FIXME: don't get me started... :( */ -require('modules/init.php'); +require('lib/init.php'); /* If we are running a demo, quick while you still can! */ if (conf('demo_mode') || !$user->has_access('25')) { @@ -25,7 +25,7 @@ Show us the stats for the server and this user */ -require_once('modules/init.php'); +require_once('lib/init.php'); /* If we are a full admin then we can see other peoples stats! */ if ($GLOBALS['user']->has_access(100) AND isset($_REQUEST['user_id'])) { diff --git a/templates/show_search.inc b/templates/show_search.inc index 3a182e14..7bbc5f39 100644 --- a/templates/show_search.inc +++ b/templates/show_search.inc @@ -19,134 +19,108 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Setup the needed variables that check the correct boxes */ -$final_javascript = "<script type=\"text/javascript\" language=\"javascript\">\n<!-- Begin \n"; - -$i = 0; -foreach ($_REQUEST['search_object'] as $key) { - $name = "check_" . $key; - $field_name = $key . "_string"; - ${$name} = "checked=\"checked\""; - $final_javascript .= "flipField('$field_name'); \n"; - if ($i++ == 0) { /* Focus the first checked field */ - $final_javascript .= "selectField('$field_name'); \n"; - } -} /* end foreach ($_REQUEST['search_object'] as $key) */ -if ($i == 0) { /* Select the artist/title/album one by default */ - $final_javascript .= "flipField('all_string'); \n"; - $final_javascript .= "selectField('all_string'); \n"; - $check_all = "checked=\"checked\""; -} - -$final_javascript .= " // END-->\n </script>"; - /** * search template * This is the template for the searches... amazing! - * @package Search - * @catagory Display */ ?> <form name="search" method="post" action="<?php echo conf('web_path'); ?>/search.php" enctype="multipart/form-data" style="Display:inline"> <table class="tabledata" cellspacing="0" cellpadding="3" border="0"> <tr class="table-header"> - <th colspan="4"><?php echo _("Search Ampache"); ?>...</th> + <th colspan="4"><?php echo _('Search Ampache'); ?>...</th> </tr> <tr class="<?php echo flip_class(); ?>"> - <td><?php echo _("Keywords") ?></td> + <td><?php echo _('Keywords') ?></td> <td> - <input type="checkbox" name="search_object[]" value="all" onclick="flipField('all_string');" <?php echo $check_all; ?> /> - <input type="text" id="all_string" name="all_string" value="<?php echo scrub_out($_REQUEST['all_string']); ?>" disabled="disabled" /> - <?php $GLOBALS['error']->print_error('keyword'); ?> + <input type="text" id="s_keywords" name="s_keywords" value="<?php echo scrub_out($_REQUEST['s_keywords']); ?>"/> </td> - <td colspan="2"> </td> + <td><?php echo _('Comment'); ?></td> + <td> + <input type="text" id="s_comment" name="s_comment" value="<?php echo scrub_out($_REQUEST['s_comment']); ?>" /> + </td> </tr> <tr class="<?php echo flip_class(); ?>"> - <td><?php echo _("Title"); ?></td> + <td><?php echo _('Title'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="title" onclick="flipField('title_string');" <?php echo $check_title; ?> /> - <input type="text" id="title_string" name="title_string" value="<?php echo scrub_out($_REQUEST['title_string']); ?>" disabled="disabled" /> + <input type="text" id="s_title" name="s_title" value="<?php echo scrub_out($_REQUEST['s_title']); ?>" /> </td> - <td><?php echo _("Artist"); ?></td> + <td><?php echo _('Artist'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="artist" onclick="flipField('artist_string');" <?php echo $check_artist; ?> /> - <input type="text" id="artist_string" name="artist_string" value="<?Php echo scrub_out($_REQUEST['artist_string']); ?>" disabled="disabled" /> + <input type="text" id="s_artist" name="s_artist" value="<?php echo scrub_out($_REQUEST['s_artist']); ?>" /> </td> </tr> <tr class="<?php echo flip_class(); ?>"> - <td><?php echo _("Album"); ?></td> + <td><?php echo _('Album'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="album" onclick="flipField('album_string');" <?php echo $check_album; ?> /> - <input type="text" id="album_string" name="album_string" value="<?php echo scrub_out($_REQUEST['album_string']); ?>" disabled="disabled" /> + <input type="text" id="s_album" name="s_album" value="<?php echo scrub_out($_REQUEST['s_album']); ?>" /> </td> - <td><?php echo _("Genre"); ?></td> + <td><?php echo _('Genre'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="genre" onclick="flipField('genre_string');" <?php echo $check_genre; ?> /> - <input type="text" id="genre_string" name="genre_string" value="<?php echo scrub_out($_REQUEST['genre_string']); ?>" disabled="disabled" /> + <input type="text" id="s_genre" name="s_genre" value="<?php echo scrub_out($_REQUEST['s_genre']); ?>" /> </td> </tr> <tr class="<?php echo flip_class(); ?>"> - <td><?php echo _("Year"); ?></td> + <td><?php echo _('Year'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="year" onclick="flipField('year_string');" <?php echo $check_year; ?> /> - <input type="text" id="year_string" name="year_string" value="<?php echo scrub_out($_REQUEST['year_string']); ?>" disabled="disabled" /> + <input type="text" id="s_year" name="s_year" value="<?php echo scrub_out($_REQUEST['s_year']); ?>" /> </td> - <td><?php echo _("Filename"); ?></td> + <td><?php echo _('Filename'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="filename" onclick="flipField('filename_string');" <?php echo $check_filename; ?> /> - <input type="text" id="filename_string" name="filename_string" value="<?php echo scrub_out($_REQUEST['filename_string']); ?>" disabled="disabled" /> + <input type="text" id="s_filename" name="s_filename" value="<?php echo scrub_out($_REQUEST['s_filename']); ?>" /> </td> </tr> <tr class="<?php echo flip_class(); ?>"> - <td><?php echo _("Played"); ?></td> + <td><?php echo _('Played'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="played" onclick="flipField('played_string');" <?php echo $check_played; ?> /> - <select id="played_string" name="played_string" disabled="disabled"> - <option value="1" <?php if($_REQUEST['played_string']=="1") echo "selected=\"selected\""?>><?php echo _("Yes"); ?></option> - <option value="0" <?php if($_REQUEST['played_string']=="0") echo "selected=\"selected\""?>><?php echo _("No"); ?></option> + <select id="s_played" name="s_played" > + <option value=""> </option> + <option value="1" <?php if($_REQUEST['s_played']=="1") echo "selected=\"selected\""?>><?php echo _('Yes'); ?></option> + <option value="0" <?php if($_REQUEST['s_played']=="0") echo "selected=\"selected\""?>><?php echo _('No'); ?></option> </select> </td> - <td><?php echo _("Min Bitrate"); ?></td> + <td><?php echo _('Min Bitrate'); ?></td> <td> - <input type="checkbox" name="search_object[]" value="minbitrate" onclick="flipField('minbitrate_string');" <?php echo $check_minbitrate; ?> /> - <select id="minbitrate_string" name="minbitrate_string" disabled="disabled"> + <select id="s_minbitrate" name="s_minbitrate" > + <option vlaue=""> </option> <?php foreach(array(32,40,48,56,64,80,96,112,128,160,192,224,256,320) as $val) { ?> - <option value="<?php echo $val?>" <?php if($_REQUEST['minbitrate_string']==$val) echo "selected=\"selected\""?>><?php echo $val?></option> + <option value="<?php echo $val?>" <?php if($_REQUEST['s_minbitrate']==$val) echo "selected=\"selected\""?>><?php echo $val?></option> <?php } ?> </select> </td> </tr> <tr class="<?php echo flip_class(); ?>"> - <td><?php echo _("Object Type"); ?>:</td> + <td><?php echo _('Rating'); ?>:</td> <td> - <select name="object_type"> - <option value="song" <?php if($_REQUEST['object_type']=="song") echo "selected=\"selected\""?>><?php echo _("Songs"); ?></option> - <option value="album" <?php if($_REQUEST['object_type']=="album") echo "selected=\"selected\""?>><?php echo _("Albums"); ?></option> - <option value="artist" <?php if($_REQUEST['object_type']=="artist") echo "selected=\"selected\""?>><?php echo _("Artists"); ?></option> - <option value="genre" <?php if($_REQUEST['object_type']=="genre") echo "selected=\"selected\""?>><?php echo _("Genres"); ?></option> + <select id="s_rating" name="s_rating"> + <option value=""> </option> + <option value="1"><?php echo _('One Star'); ?></option> + <option value="2"><?php echo _('Two Stars'); ?></option> + <option value="3"><?php echo _('Three Stars'); ?></option> + <option value="4"><?php echo _('Four Stars'); ?></option> + <option value="5"><?php echo _('Five Stars'); ?></option> </select> </td> - <td><?php echo _("Operator"); ?>:</td> + <td><?php echo _('Operator'); ?>:</td> <td> <select name="operator"> - <option value="and" <?php if($_REQUEST['operator']=="and") echo "selected=\"selected\""?>><?php echo _("AND"); ?></option> - <option value="or" <?php if($_REQUEST['operator']=="or") echo "selected=\"selected\""?>><?php echo _("OR"); ?></option> + <option value="and" <?php if($_REQUEST['operator']=="and") echo "selected=\"selected\""?>><?php echo _('AND'); ?></option> + <option value="or" <?php if($_REQUEST['operator']=="or") echo "selected=\"selected\""?>><?php echo _('OR'); ?></option> </select> </td> </tr> <tr class="<?php echo flip_class(); ?>"> - <td><?php echo _("Method"); ?>:</td> + <td><?php echo _('Method'); ?>:</td> <td> <select name="method"> - <option value="fuzzy" <?php if($_REQUEST['method']=="fuzzy") echo "selected=\"selected\""?>><?php echo _("Fuzzy"); ?></option> - <option value="exact" <?php if($_REQUEST['method']=="exact") echo "selected=\"selected\""?>><?php echo _("Exact"); ?></option> + <option value="fuzzy" <?php if($_REQUEST['method']=="fuzzy") echo "selected=\"selected\""?>><?php echo _('Fuzzy'); ?></option> + <option value="exact" <?php if($_REQUEST['method']=="exact") echo "selected=\"selected\""?>><?php echo _('Exact'); ?></option> </select> </td> - <td><?php echo _("Maxium Results"); ?>:</td> + <td><?php echo _('Maxium Results'); ?>:</td> <td> <select name="limit"> - <option value="0"><?php echo _("Unlimited"); ?></option> + <option value="0"><?php echo _('Unlimited'); ?></option> <option value="25" <?php if($_REQUEST['limit']=="25") echo "selected=\"selected\""?>>25</option> <option value="50" <?php if($_REQUEST['limit']=="50") echo "selected=\"selected\""?>>50</option> <option value="100" <?php if($_REQUEST['limit']=="100") echo "selected=\"selected\""?>>100</option> @@ -157,22 +131,21 @@ $final_javascript .= " // END-->\n </script>"; <tr class="<?php echo flip_class(); ?>"> <td> </td> <td> - <input type="submit" value="<?php echo _("Search");?>" /> - <input type="reset" value="<?php echo _("Reset Form");?>" /> + <input class="button" type="submit" value="<?php echo _('Search'); ?>" /> + <input class="button" type="reset" value="<?php echo _('Reset Form');?>" /> <input type="hidden" name="action" value="search" /> </td> <td colspan="2"> </td> </tr> </table> </form> -<?php echo $final_javascript; ?> <?php if (isset($_REQUEST['search_object'])) { ?> <br /> <form method="post" action="<?php echo conf('web_path'); ?>/playlist.php?action=add_dyn_song"> <?php echo _('Save Search As Track on'); ?>: <?php show_playlist_dropdown('', true); ?> -<input type="submit" value="<?php echo _('Save'); ?>" /></form> +<input class="button" type="submit" value="<?php echo _('Save'); ?>" /></form> <?php } ?> <br /> @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -24,8 +24,7 @@ @header TV Display for Ampache @discussion BIG now playing and (soon) on deck */ -require("modules/init.php"); -init_mpd(); +require_once('lib/init.php'); show_template('style'); if (conf('refresh_interval')) { @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -31,7 +31,7 @@ // We need this stuff $no_session = 1; - require("modules/init.php"); + require('lib/init.php'); // Make a blank update object $update = new Update(0); @@ -35,7 +35,7 @@ --TEST! */ -require_once( "modules/init.php" ); +require_once('lib/init.php'); // Set page header show_template('header'); |