1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +02:00

moved init.php improved vainfo a bit, removed checkboxes from search page

This commit is contained in:
Karl 'vollmerk' Vollmer 2006-06-17 16:32:04 +00:00
parent c6c2320170
commit e3734f063e
54 changed files with 184 additions and 522 deletions

View file

@ -21,13 +21,12 @@
*/ */
$no_session = true; $no_session = true;
require_once( "modules/init.php" ); require_once('lib/init.php');
/* Keep them out if they shouldn't be here */ /* Keep them out if they shouldn't be here */
if(!conf('allow_public_registration') || conf('demo_mode')) { if(!conf('allow_public_registration') || conf('demo_mode')) {
access_denied(); access_denied();
} }
?> ?>
<html><head> <html><head>
<?php show_template('style'); ?> <?php show_template('style'); ?>

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2005 Ampache.org Copyright (c) 2001 - 2006 Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or 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 */ /* Scrub in the Needed vars */
@ -28,8 +28,8 @@ $action = scrub_in($_REQUEST['action']);
$access_id = scrub_in($_REQUEST['access_id']); $access_id = scrub_in($_REQUEST['access_id']);
$access = new Access($access_id); $access = new Access($access_id);
if (!$user->has_access(100)) { if (!$GLOBALS['user']->has_access(100)) {
header("Location: http://" . conf('web_path') . "/index.php?access=denied"); access_denied();
exit(); exit();
} }
@ -39,7 +39,7 @@ show_template('header');
switch ($action ) { switch ($action ) {
case 'show_confirm_delete': 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']) . '&amp;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']) . '&amp;action=delete_host','1');
break; break;
case 'delete_host': case 'delete_host':
$access->delete($_REQUEST['access_id']); $access->delete($_REQUEST['access_id']);
@ -62,7 +62,7 @@ switch ($action ) {
default: default:
$list = array(); $list = array();
$list = $access->get_access_list(); $list = $access->get_access_list();
include(conf('prefix') ."/templates/show_access_list.inc"); include(conf('prefix') .'/templates/show_access_list.inc');
break; break;
} // end switch on action } // end switch on action
show_footer(); show_footer();

View file

@ -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> &nbsp; </td>
<td><input type=submit name=action value="Change Name"></td>
<tr>
<td> &nbsp; </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>

View file

@ -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> &nbsp; </td> <td><input type=submit name=action value="Change Name"></td>
</tr>
<tr>
<td> &nbsp; </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>

View file

@ -26,7 +26,7 @@
This document handles actions for catalog creation and passes them off to the catalog class 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)) { if (!$GLOBALS['user']->has_access(100)) {
access_denied(); access_denied();

View file

@ -1,8 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2005 Ampache.org Copyright (c) 2001 - 2006 Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or 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 // 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'); require_once( conf('prefix').'/lib/duplicates.php');

View file

@ -26,7 +26,7 @@
* flagging. * flagging.
*/ */
require('../modules/init.php'); require('../lib/init.php');
if (!$GLOBALS['user']->has_access('100')) { if (!$GLOBALS['user']->has_access('100')) {
access_denied(); access_denied();

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2005 Ampache.org Copyright (c) 2001 - 2006 Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -25,7 +25,7 @@
@header Flags Mojo @header Flags Mojo
*/ */
require_once ("../modules/init.php"); require_once ("../lib/init.php");
require_once( conf('prefix').'/lib/flag.php'); require_once( conf('prefix').'/lib/flag.php');
if (!$user->has_access(100)) { if (!$user->has_access(100)) {

View file

@ -20,7 +20,7 @@
*/ */
require ('../modules/init.php'); require ('../lib/init.php');
$action = scrub_in($_REQUEST['action']); $action = scrub_in($_REQUEST['action']);

View file

@ -20,7 +20,7 @@
*/ */
require('../modules/init.php'); require('../lib/init.php');
if (!$GLOBALS['user']->has_access(100)) { if (!$GLOBALS['user']->has_access(100)) {
access_denied(); access_denied();

View file

@ -20,7 +20,7 @@
*/ */
require('../modules/init.php'); require('../lib/init.php');
if (!$GLOBALS['user']->has_access(100)) { if (!$GLOBALS['user']->has_access(100)) {
access_denied(); access_denied();

View file

@ -29,7 +29,7 @@
* @author Karl Vollmer * @author Karl Vollmer
*/ */
require('../modules/init.php'); require('../lib/init.php');
if (!$user->has_access(100)) { if (!$user->has_access(100)) {

View file

@ -27,7 +27,7 @@
*/ */
require_once ("../modules/init.php"); require_once ('../lib/init.php');
if (!$user->has_access(100)) { if (!$user->has_access(100)) {
access_denied(); access_denied();

View file

@ -20,14 +20,13 @@
*/ */
/* /*
@header Album Art @header Album Art
This pulls album art out of the file using the getid3 library This pulls album art out of the file using the getid3 library
and dumps it to the browser as an image mime type. 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 */ /* Decide what size this image is */
switch ($_REQUEST['thumb']) { switch ($_REQUEST['thumb']) {

View file

@ -20,7 +20,7 @@
*/ */
require_once('modules/init.php'); require_once('lib/init.php');
show_template('header'); show_template('header');

View file

@ -26,7 +26,7 @@
*/ */
require_once("modules/init.php"); require_once('lib/init.php');
if (!isset($_REQUEST['match'])) { $_REQUEST['match'] = "Browse"; } if (!isset($_REQUEST['match'])) { $_REQUEST['match'] = "Browse"; }
if (!isset($_REQUEST['action'])) { $_REQUEST['action'] = "match"; } if (!isset($_REQUEST['action'])) { $_REQUEST['action'] = "match"; }

View file

@ -32,7 +32,7 @@
* in your PHP build. * in your PHP build.
*/ */
require_once('modules/init.php'); require_once('lib/init.php');
//test that batch download is permitted (user or system?) //test that batch download is permitted (user or system?)
/* Drop the normal Time limit constraints, this can take a while */ /* Drop the normal Time limit constraints, this can take a while */

View file

@ -21,7 +21,7 @@
*/ */
$no_session='1'; $no_session='1';
require ("../modules/init.php"); require ('../lib/init.php');
echo "[catalog_update.php.inc]\nStarting Catalog Clean/Update And Add\n\n"; echo "[catalog_update.php.inc]\nStarting Catalog Clean/Update And Add\n\n";

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2005 Ampache.org Copyright (c) 2001 - 2006 Ampache.org
All rights reserved All rights reserved
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -21,8 +21,8 @@
*/ */
$no_session = '1'; $no_session = '1';
require ("../modules/init.php"); require ('../lib/init.php');
require ("../lib/debug.php"); require ('../lib/debug.php');
$results = debug_read_config(conf('prefix') . "/config/ampache.cfg.php"); $results = debug_read_config(conf('prefix') . "/config/ampache.cfg.php");

View file

@ -22,7 +22,7 @@
$no_session = '1'; $no_session = '1';
require ("../modules/init.php"); require ("../lib/init.php");
$catalogs = Catalog::get_catalogs(); $catalogs = Catalog::get_catalogs();

View file

@ -23,7 +23,7 @@ $filename = "/data/music/Live/L/Life'll Kill Ya/Warren Zevon.m3u";
$no_session = '1'; $no_session = '1';
require ("../modules/init.php"); require ("../lib/init.php");
$handle = fopen($filename,'r'); $handle = fopen($filename,'r');

View file

@ -25,7 +25,7 @@ $search['artist_name'] = "Bent";
$no_session = '1'; $no_session = '1';
require ("../modules/init.php"); require ("../lib/init.php");
echo "<pre>\n"; echo "<pre>\n";
$amazon = new AmazonSearch(conf('amazon_developer_key')); $amazon = new AmazonSearch(conf('amazon_developer_key'));
// Prevent the script from timing out // Prevent the script from timing out

View file

@ -20,13 +20,14 @@
*/ */
$no_session = '1'; $no_session = '1';
require ("../modules/init.php"); require ("../lib/init.php");
$filename = usage(); $filename = usage();
echo "Reading: $filename\n"; echo "Reading: $filename\n";
$info = new Audioinfo(); $info = new vainfo();
$info->get_info();
$results = $info->info($filename); $results = $info->info($filename);
$results['file'] = $filename; $results['file'] = $filename;
$key = get_tag_type($results); $key = get_tag_type($results);

View file

@ -24,7 +24,7 @@
*/ */
$no_session='1'; $no_session='1';
require_once('../modules/init.php'); require_once('../lib/init.php');
usage(); usage();

View file

@ -39,7 +39,7 @@
$alphabet_prefix = true; $alphabet_prefix = true;
$no_session = '1'; $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 */ /* First Clean the catalog to we don't try to write anything we shouldn't */

View file

@ -33,7 +33,7 @@
*/ */
/* Base Require */ /* Base Require */
require_once("modules/init.php"); require_once('lib/init.php');
/* Clean up incomming variables */ /* Clean up incomming variables */
$action = scrub_in($_REQUEST['action']); $action = scrub_in($_REQUEST['action']);

View file

@ -4,6 +4,9 @@
-------------------------------------------------------------------------- --------------------------------------------------------------------------
v.3.3.2-Beta3 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 - Fixed a missing close tag on the catalog build if ampache was
unable to get the filesize of a file unable to get the filesize of a file
- Fixed link to Statistics page, user link has been missing - Fixed link to Statistics page, user link has been missing

View file

@ -26,7 +26,7 @@
Special thanks to the Horde project for their Browser class that makes this so easy. 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'); require(conf('prefix') . '/modules/horde/Browser.php');
$browser = new Browser(); $browser = new Browser();

View file

@ -26,7 +26,7 @@
*/ */
require_once('modules/init.php'); require_once('lib/init.php');
show_template('header'); show_template('header');

View file

@ -23,7 +23,7 @@
* Genres Pages * Genres Pages
* Nuff Said for now * Nuff Said for now
*/ */
require_once("modules/init.php"); require_once('lib/init.php');
show_template('header'); show_template('header');

View file

@ -26,16 +26,10 @@
*/ */
require_once("modules/init.php"); require_once('lib/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
*/
show_template('header'); show_template('header');
if (conf('refresh_limit') > 0) { require_once ("templates/javascript_refresh.inc"); }
$action = scrub_in($_REQUEST['action']); $action = scrub_in($_REQUEST['action']);
?> ?>
@ -55,40 +49,26 @@ $action = scrub_in($_REQUEST['action']);
</td> </td>
<td valign="top" align="left"> <!-- sigger: why is it a problem to set width=50% --> <td valign="top" align="left"> <!-- sigger: why is it a problem to set width=50% -->
<?php <?php
if (false) // $user->prefs['play_type'] == 'mpd' && !conf('localplay_menu')) if ($items = get_global_popular('album')) {
{ show_info_box(_('Most Popular Albums'), 'album',$items);
show_mpd_control();
}
else {
if ($items = get_global_popular('album')) {
show_info_box(_("Most Popular Albums"), 'album',$items);
}
} }
?> ?>
</td> </td>
</tr> </tr>
<tr><td colspan="2">&nbsp;</td></tr> <tr><td colspan="2">&nbsp;</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">&nbsp;</td></tr> <tr><td colspan="2">&nbsp;</td></tr>
<tr> <tr>
<td valign="top" align="right"> <td valign="top" align="right">
<?php <?php
if ($items = get_global_popular('artist')) { if ($items = get_global_popular('artist')) {
show_info_box(_("Most Popular Artists"), 'artist', $items); show_info_box(_('Most Popular Artists'), 'artist', $items);
} }
?> ?>
</td> </td>
<td valign="top" align="left"> <td valign="top" align="left">
<?php <?php
if ($items = get_global_popular('song')) { if ($items = get_global_popular('song')) {
show_info_box(_("Most Popular Songs"), 'song', $items); show_info_box(_('Most Popular Songs'), 'song', $items);
} }
?> ?>
</td> </td>
@ -98,36 +78,20 @@ $action = scrub_in($_REQUEST['action']);
<td valign="top" align="right"> <td valign="top" align="right">
<?php <?php
if ($items = get_newest('artist')) { if ($items = get_newest('artist')) {
show_info_box(_("Newest Artist Additions"), '', $items); show_info_box(_('Newest Artist Additions'), '', $items);
} }
?> ?>
</td> </td>
<td valign="top" align="left"> <td valign="top" align="left">
<?php <?php
if ($items = get_newest('album')) { if ($items = get_newest('album')) {
show_info_box(_("Newest Album Additions"), '', $items); show_info_box(_('Newest Album Additions'), '', $items);
} }
?> ?>
</td> </td>
</tr> </tr>
</table><!-- End Left table --> </table><!-- End Left table -->
</td> </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> </tr>
</table> </table>
<!-- End Big Daddy Table --> <!-- End Big Daddy Table -->

View file

@ -80,7 +80,7 @@ if (!$results['allow_stream_playback']) {
/** This is the version.... fluf nothing more... **/ /** 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['raw_web_path'] = $results['web_path'];
$results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path'];

View file

@ -33,12 +33,20 @@
function run_search($data) { function run_search($data) {
/* Create an array of the object we need to search on */ /* Create an array of the object we need to search on */
foreach ($data['search_object'] as $type) { foreach ($data as $key=>$value) {
/* generate the full name of the textbox */ /* Get the first two chars to check
$fullname = $type . "_string"; * and see if it's s_
$search[$type] = sql_escape($data[$fullname]); */
$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 } // end foreach
/* Figure out if they want a AND based search or a OR based search */ /* Figure out if they want a AND based search or a OR based search */
switch($_REQUEST['operator']) { switch($_REQUEST['operator']) {
case 'or': case 'or':
@ -156,6 +164,9 @@ function search_song($data,$operator,$method,$limit) {
case 'filename': case 'filename':
$where_sql .= " song.file $value_string $operator"; $where_sql .= " song.file $value_string $operator";
break; break;
case 'comment':
$where_sql .= " song.comment $value_string $operator";
break;
case 'played': case 'played':
/* This is a 0/1 value so bool it */ /* This is a 0/1 value so bool it */
$value = make_bool($value); $value = make_bool($value);

View file

@ -21,7 +21,7 @@
*/ */
require('modules/init.php'); require('lib/init.php');
/* If we are running a demo, quick while you still can! */ /* If we are running a demo, quick while you still can! */
if (conf('demo_mode')) { if (conf('demo_mode')) {

View file

@ -27,7 +27,11 @@
*/ */
$no_session = true; $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(); vauth_session_cookie();
init_preferences(); init_preferences();

View file

@ -24,8 +24,7 @@
* This is the logout page, it kills any cookies you have in your browser kills * 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 * your session in the database and then redirects you to the login page
*/ */
require_once('lib/init.php');
require_once("modules/init.php");
// To end a legitimate session, just call logout. // To end a legitimate session, just call logout.
setcookie("amp_longsess","",null); setcookie("amp_longsess","",null);
logout(); logout();

View file

@ -28,19 +28,18 @@
class vainfo { class vainfo {
/* Default Encoding */ /* Default Encoding */
var $encoding = 'UTF-8'; var $encoding = '';
/* Loaded Variables */ /* Loaded Variables */
var $filename = ''; var $filename = '';
var $type = ''; var $type = '';
var $tags = array(); var $tags = array();
var $info = array();
/* Internal Information */ /* Internal Information */
var $_raw = array(); var $_raw = array();
var $_getID3 = ''; var $_getID3 = '';
var $_iconv = false; var $_iconv = false;
var $_file_encoding = '';
var $_file_pattern = ''; var $_file_pattern = '';
var $_dir_pattern = ''; var $_dir_pattern = '';
@ -93,9 +92,15 @@ class vainfo {
/* Figure out what type of file we are dealing with */ /* Figure out what type of file we are dealing with */
$this->type = $this->_get_type(); $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 */ /* Get the general information about this file */
$info = $this->_get_info(); $info = $this->_get_info();
/* Gets the Tags */ /* Gets the Tags */
$this->tags = $this->_get_tags(); $this->tags = $this->_get_tags();
$this->tags['info'] = $info; $this->tags['info'] = $info;
@ -104,6 +109,26 @@ class vainfo {
} // get_info } // 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 * _get_type
* This function takes the raw information and figures out * This function takes the raw information and figures out
@ -285,14 +310,14 @@ class vainfo {
function _parse_id3v1($tags) { function _parse_id3v1($tags) {
$array = array(); $array = array();
/* Go through all the tags */ /* Go through all the tags */
foreach ($tags as $tag=>$data) { foreach ($tags as $tag=>$data) {
/* This is our baseline for naming /* This is our baseline for naming
* so no translation needed * so no translation needed
*/ */
$array[$tag] = $this->_clean_tag($data['0']); $array[$tag] = $this->_clean_tag($data['0'],$this->_file_encoding);
} // end foreach } // end foreach
@ -316,7 +341,7 @@ class vainfo {
/* This is our baseline for naming so /* This is our baseline for naming so
* no translation is needed * no translation is needed
*/ */
$array[$tag] = $this->_clean_tag($data['0']); $array[$tag] = $this->_clean_tag($data['0'],$this->_file_encoding);
} // end foreach } // end foreach
@ -379,10 +404,13 @@ class vainfo {
* in the file * in the file
*/ */
function _clean_tag($tag,$encoding='') { function _clean_tag($tag,$encoding='') {
/* Guess that it's UTF-8 */
if (!$encoding) { $encoding = 'UTF-8'; }
if ($this->_iconv AND strcasecmp($encoding,$this->encoding) != 0) {
if ($this->_iconv) { $charset = $this->encoding . '//TRANSLIT';
$tag = iconv('UTF-8',conf('site_charset'),$tag); $tag = iconv($encoding,$charset,$tag);
} }
return $tag; return $tag;

View file

@ -28,7 +28,7 @@
*/ */
$no_session = true; $no_session = true;
require_once('../modules/init.php'); require_once('../lib/init.php');
require_once(conf('prefix') . '/modules/horde/Browser.php'); require_once(conf('prefix') . '/modules/horde/Browser.php');

View file

@ -24,7 +24,7 @@
* This is the playlist document, it handles all things playlist. * This is the playlist document, it handles all things playlist.
*/ */
require_once("modules/init.php"); require_once('lib/init.php');
show_template('header'); show_template('header');

View file

@ -27,7 +27,7 @@
*/ */
require('modules/init.php'); require('lib/init.php');
/* Scrub in the needed mojo */ /* Scrub in the needed mojo */
if (!$_REQUEST['tab']) { $_REQUEST['tab'] = 'theme'; } if (!$_REQUEST['tab']) { $_REQUEST['tab'] = 'theme'; }

View file

@ -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>

View file

@ -25,13 +25,13 @@
@discussion Do most of the dirty work of displaying the mp3 catalog @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'); show_template('header');
$action = scrub_in($_REQUEST['action']); $action = scrub_in($_REQUEST['action']);
show_template('show_random_play'); show_template('show_random_play');
show_footer();
show_footer();
?> ?>

View file

@ -20,7 +20,7 @@
*/ */
require_once("modules/init.php"); require_once('lib/init.php');
show_template('header'); show_template('header');

View file

@ -28,7 +28,7 @@
*/ */
$no_session = true; $no_session = true;
require_once ("modules/init.php"); require_once ('lib/init.php');
/* Check Perms */ /* Check Perms */

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2004 Ampache.org Copyright (c) 2001 - 2006 Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -21,7 +21,7 @@
*/ */
$no_session = 1; $no_session = 1;
require('modules/init.php'); require('lib/init.php');
/* Check Perms */ /* Check Perms */
if (!conf('use_rss') || conf('demo_mode')) { if (!conf('use_rss') || conf('demo_mode')) {

View file

@ -1,6 +1,9 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2006 Ampache.org
All Rights Reserved
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 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'); show_template('header');
@ -48,6 +51,7 @@ switch ($action) {
} }
case 'search': case 'search':
show_template('show_search'); show_template('show_search');
print_r($_REQUEST);
$results = run_search($_REQUEST); $results = run_search($_REQUEST);
show_search($_REQUEST['object_type'],$results); show_search($_REQUEST['object_type'],$results);
break; break;

View file

@ -25,7 +25,7 @@
*/ */
$no_session = true; $no_session = true;
require_once('../modules/init.php'); require_once('../lib/init.php');
/* Verify the existance of the Session they passed in */ /* Verify the existance of the Session they passed in */
if (!session_exists($_REQUEST['sessid'])) { exit(); } if (!session_exists($_REQUEST['sessid'])) { exit(); }

View file

@ -21,7 +21,7 @@
*/ */
$no_session = true; $no_session = true;
require_once('../modules/init.php'); require_once('../lib/init.php');
if (conf('xml_rpc')) { if (conf('xml_rpc')) {

View file

@ -29,7 +29,7 @@
FIXME: don't get me started... :( 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 we are running a demo, quick while you still can! */
if (conf('demo_mode') || !$user->has_access('25')) { if (conf('demo_mode') || !$user->has_access('25')) {

View file

@ -25,7 +25,7 @@
Show us the stats for the server and this user 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 we are a full admin then we can see other peoples stats! */
if ($GLOBALS['user']->has_access(100) AND isset($_REQUEST['user_id'])) { if ($GLOBALS['user']->has_access(100) AND isset($_REQUEST['user_id'])) {

View file

@ -19,134 +19,108 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 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 * search template
* This is the template for the searches... amazing! * 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"> <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"> <table class="tabledata" cellspacing="0" cellpadding="3" border="0">
<tr class="table-header"> <tr class="table-header">
<th colspan="4"><?php echo _("Search Ampache"); ?>...</th> <th colspan="4"><?php echo _('Search Ampache'); ?>...</th>
</tr> </tr>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td><?php echo _("Keywords") ?></td> <td><?php echo _('Keywords') ?></td>
<td> <td>
<input type="checkbox" name="search_object[]" value="all" onclick="flipField('all_string');" <?php echo $check_all; ?> /> <input type="text" id="s_keywords" name="s_keywords" value="<?php echo scrub_out($_REQUEST['s_keywords']); ?>"/>
<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'); ?>
</td> </td>
<td colspan="2">&nbsp;</td> <td><?php echo _('Comment'); ?></td>
</tr> <td>
<tr class="<?php echo flip_class(); ?>"> <input type="text" id="s_comment" name="s_comment" value="<?php echo scrub_out($_REQUEST['s_comment']); ?>" />
<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" />
</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" />
</td> </td>
</tr> </tr>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td><?php echo _("Album"); ?></td> <td><?php echo _('Title'); ?></td>
<td> <td>
<input type="checkbox" name="search_object[]" value="album" onclick="flipField('album_string');" <?php echo $check_album; ?> /> <input type="text" id="s_title" name="s_title" value="<?php echo scrub_out($_REQUEST['s_title']); ?>" />
<input type="text" id="album_string" name="album_string" value="<?php echo scrub_out($_REQUEST['album_string']); ?>" disabled="disabled" />
</td> </td>
<td><?php echo _("Genre"); ?></td> <td><?php echo _('Artist'); ?></td>
<td> <td>
<input type="checkbox" name="search_object[]" value="genre" onclick="flipField('genre_string');" <?php echo $check_genre; ?> /> <input type="text" id="s_artist" name="s_artist" value="<?php echo scrub_out($_REQUEST['s_artist']); ?>" />
<input type="text" id="genre_string" name="genre_string" value="<?php echo scrub_out($_REQUEST['genre_string']); ?>" disabled="disabled" />
</td> </td>
</tr> </tr>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td><?php echo _("Year"); ?></td> <td><?php echo _('Album'); ?></td>
<td> <td>
<input type="checkbox" name="search_object[]" value="year" onclick="flipField('year_string');" <?php echo $check_year; ?> /> <input type="text" id="s_album" name="s_album" value="<?php echo scrub_out($_REQUEST['s_album']); ?>" />
<input type="text" id="year_string" name="year_string" value="<?php echo scrub_out($_REQUEST['year_string']); ?>" disabled="disabled" />
</td> </td>
<td><?php echo _("Filename"); ?></td> <td><?php echo _('Genre'); ?></td>
<td> <td>
<input type="checkbox" name="search_object[]" value="filename" onclick="flipField('filename_string');" <?php echo $check_filename; ?> /> <input type="text" id="s_genre" name="s_genre" value="<?php echo scrub_out($_REQUEST['s_genre']); ?>" />
<input type="text" id="filename_string" name="filename_string" value="<?php echo scrub_out($_REQUEST['filename_string']); ?>" disabled="disabled" />
</td> </td>
</tr> </tr>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td><?php echo _("Played"); ?></td> <td><?php echo _('Year'); ?></td>
<td> <td>
<input type="checkbox" name="search_object[]" value="played" onclick="flipField('played_string');" <?php echo $check_played; ?> /> <input type="text" id="s_year" name="s_year" value="<?php echo scrub_out($_REQUEST['s_year']); ?>" />
<select id="played_string" name="played_string" disabled="disabled"> </td>
<option value="1" <?php if($_REQUEST['played_string']=="1") echo "selected=\"selected\""?>><?php echo _("Yes"); ?></option> <td><?php echo _('Filename'); ?></td>
<option value="0" <?php if($_REQUEST['played_string']=="0") echo "selected=\"selected\""?>><?php echo _("No"); ?></option> <td>
<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>
<select id="s_played" name="s_played" >
<option value="">&nbsp;</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> </select>
</td> </td>
<td><?php echo _("Min Bitrate"); ?></td> <td><?php echo _('Min Bitrate'); ?></td>
<td> <td>
<input type="checkbox" name="search_object[]" value="minbitrate" onclick="flipField('minbitrate_string');" <?php echo $check_minbitrate; ?> /> <select id="s_minbitrate" name="s_minbitrate" >
<select id="minbitrate_string" name="minbitrate_string" disabled="disabled"> <option vlaue="">&nbsp;</option>
<?php foreach(array(32,40,48,56,64,80,96,112,128,160,192,224,256,320) as $val) { ?> <?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 } ?> <?php } ?>
</select> </select>
</td> </td>
</tr> </tr>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td><?php echo _("Object Type"); ?>:</td> <td><?php echo _('Rating'); ?>:</td>
<td> <td>
<select name="object_type"> <select id="s_rating" name="s_rating">
<option value="song" <?php if($_REQUEST['object_type']=="song") echo "selected=\"selected\""?>><?php echo _("Songs"); ?></option> <option value="">&nbsp;</option>
<option value="album" <?php if($_REQUEST['object_type']=="album") echo "selected=\"selected\""?>><?php echo _("Albums"); ?></option> <option value="1"><?php echo _('One Star'); ?></option>
<option value="artist" <?php if($_REQUEST['object_type']=="artist") echo "selected=\"selected\""?>><?php echo _("Artists"); ?></option> <option value="2"><?php echo _('Two Stars'); ?></option>
<option value="genre" <?php if($_REQUEST['object_type']=="genre") echo "selected=\"selected\""?>><?php echo _("Genres"); ?></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> </select>
</td> </td>
<td><?php echo _("Operator"); ?>:</td> <td><?php echo _('Operator'); ?>:</td>
<td> <td>
<select name="operator"> <select name="operator">
<option value="and" <?php if($_REQUEST['operator']=="and") echo "selected=\"selected\""?>><?php echo _("AND"); ?></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> <option value="or" <?php if($_REQUEST['operator']=="or") echo "selected=\"selected\""?>><?php echo _('OR'); ?></option>
</select> </select>
</td> </td>
</tr> </tr>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td><?php echo _("Method"); ?>:</td> <td><?php echo _('Method'); ?>:</td>
<td> <td>
<select name="method"> <select name="method">
<option value="fuzzy" <?php if($_REQUEST['method']=="fuzzy") echo "selected=\"selected\""?>><?php echo _("Fuzzy"); ?></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> <option value="exact" <?php if($_REQUEST['method']=="exact") echo "selected=\"selected\""?>><?php echo _('Exact'); ?></option>
</select> </select>
</td> </td>
<td><?php echo _("Maxium Results"); ?>:</td> <td><?php echo _('Maxium Results'); ?>:</td>
<td> <td>
<select name="limit"> <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="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="50" <?php if($_REQUEST['limit']=="50") echo "selected=\"selected\""?>>50</option>
<option value="100" <?php if($_REQUEST['limit']=="100") echo "selected=\"selected\""?>>100</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(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="<?php echo _("Search");?>" />&nbsp;&nbsp; <input class="button" type="submit" value="<?php echo _('Search'); ?>" />&nbsp;&nbsp;
<input type="reset" value="<?php echo _("Reset Form");?>" /> <input class="button" type="reset" value="<?php echo _('Reset Form');?>" />
<input type="hidden" name="action" value="search" /> <input type="hidden" name="action" value="search" />
</td> </td>
<td colspan="2">&nbsp;</td> <td colspan="2">&nbsp;</td>
</tr> </tr>
</table> </table>
</form> </form>
<?php echo $final_javascript; ?>
<?php if (isset($_REQUEST['search_object'])) { ?> <?php if (isset($_REQUEST['search_object'])) { ?>
<br /> <br />
<form method="post" action="<?php echo conf('web_path'); ?>/playlist.php?action=add_dyn_song"> <form method="post" action="<?php echo conf('web_path'); ?>/playlist.php?action=add_dyn_song">
<?php echo _('Save Search As Track on'); ?>: <?php echo _('Save Search As Track on'); ?>:
<?php show_playlist_dropdown('', true); ?> <?php show_playlist_dropdown('', true); ?>
<input type="submit" value="<?php echo _('Save'); ?>" /></form> <input class="button" type="submit" value="<?php echo _('Save'); ?>" /></form>
<?php } ?> <?php } ?>
<br /> <br />

5
tv.php
View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2005 Ampache.org Copyright (c) 2001 - 2006 Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -24,8 +24,7 @@
@header TV Display for Ampache @header TV Display for Ampache
@discussion BIG now playing and (soon) on deck @discussion BIG now playing and (soon) on deck
*/ */
require("modules/init.php"); require_once('lib/init.php');
init_mpd();
show_template('style'); show_template('style');
if (conf('refresh_interval')) { if (conf('refresh_interval')) {

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2005 Ampache.org Copyright (c) 2001 - 2006 Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -31,7 +31,7 @@
// We need this stuff // We need this stuff
$no_session = 1; $no_session = 1;
require("modules/init.php"); require('lib/init.php');
// Make a blank update object // Make a blank update object
$update = new Update(0); $update = new Update(0);

View file

@ -35,7 +35,7 @@
--TEST! --TEST!
*/ */
require_once( "modules/init.php" ); require_once('lib/init.php');
// Set page header // Set page header
show_template('header'); show_template('header');