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

fixed clean, added lang to installer (thx ros) and cleaned up catalog display a bit and mojoed lang list

This commit is contained in:
Karl 'vollmerk' Vollmer 2006-05-01 07:22:07 +00:00
parent af554e6296
commit a02b8ce207
16 changed files with 278 additions and 39 deletions

View file

@ -122,6 +122,10 @@ switch ($_REQUEST['action']) {
$catalog->add_to_catalog();
echo "</div>";
}
$url = conf('web_path') . '/admin/index.php';
$title = _('Catalog Updated');
$body = '';
show_confirmation($title,$body,$url);
break;
case 'delete_catalog':
/* Make sure they aren't in demo mode */

View file

@ -4,6 +4,8 @@
--------------------------------------------------------------------------
v.3.3.2-Beta3
- Added Clear Playlist Functionality to Localplay
- Added Language selection to Installer (Thx Ros)
- Added xbmc controller (Thx Infamy)
- Fixed a problem where if require_session was disabled it would
still pass the sid with the urls
@ -11,9 +13,9 @@
- New Install and Update screen styles (Thx Ros)
- Fixed a glitch that was causing m3u's to be built on every
catalog add, rather then just on creation
- Full re-write of Localplay, MPD controller added
- Tweaked Preferences once more
- Added Modules Page
- Added Modules Page, used for enabling/disabling localplay
types
- Fixed a missing web_path reference on playlist edit page
- Added Localplay API, check the wiki for more information
https://ampache.bountysource.com/wiki/Localplay

View file

@ -31,6 +31,7 @@ require_once('modules/lib.php');
require_once('lib/debug.php');
require_once('lib/class/user.class.php');
require_once('lib/class/error.class.php');
require_once('lib/gettext.php');
require_once('modules/vauth/dbh.lib.php');
require_once('modules/vauth/init.php');
@ -75,8 +76,12 @@ switch ($action) {
require_once('templates/show_install.inc.php');
break;
}
/* Get the variables for the language */
$htmllang = $_REQUEST['htmllang'];
$charset = $_REQUEST['charset'];
header ("Location: " . $php_self . "?action=show_create_config&local_db=$database&local_host=$hostname");
header ("Location: " . $php_self . "?action=show_create_config&local_db=$database&local_host=$hostname&htmllang=$htmllang&charset=$charset");
break;
case 'create_config':
@ -89,7 +94,33 @@ switch ($action) {
/* Attempt to Guess the Web_path */
$web_path = dirname($_SERVER['PHP_SELF']);
$web_path = rtrim($web_path,"\/");
/* Get the variables for the language */
$htmllang = $_REQUEST['htmllang'];
$charset = $_REQUEST['charset'];
// Set the lang in the conf array
conf(array('lang'=>$htmllang));
// We need the charset for the different languages
$charsets = array('de_DE' => 'ISO-8859-15',
'en_US' => 'iso-8859-1',
'en_GB' => 'UTF-8',
'es_ES' => 'iso-8859-1',
'fr_FR' => 'iso-8859-1',
'it_IT' => 'UTF-8',
'nl_NL' => 'ISO-8859-15',
'tr_TR' => 'iso-8859-9',
'zh_CN' => 'GBK');
$charset = $charsets[$_REQUEST['htmllang']];
// Set the site_charset in the conf array
conf(array('site_charset'=>$charsets[$_REQUEST['htmllang']]));
/* load_gettext mojo */
load_gettext();
header ("Content-Type: text/html; charset=" . conf('site_charset'));
require_once('templates/show_install_config.inc');
break;
case 'create_account':
@ -130,11 +161,73 @@ switch ($action) {
break;
}
/* Get the variables for the language */
$htmllang = $_REQUEST['htmllang'];
$charset = $_REQUEST['charset'];
// Set the lang in the conf array
conf(array('lang'=>$htmllang));
// We need the charset for the different languages
$charsets = array('de_DE' => 'ISO-8859-15',
'en_US' => 'iso-8859-1',
'en_GB' => 'UTF-8',
'es_ES' => 'iso-8859-1',
'fr_FR' => 'iso-8859-1',
'it_IT' => 'UTF-8',
'nl_NL' => 'ISO-8859-15',
'tr_TR' => 'iso-8859-9',
'zh_CN' => 'GBK');
$charset = $charsets[$_REQUEST['htmllang']];
// Set the site_charset in the conf array
conf(array('site_charset'=>$charsets[$_REQUEST['htmllang']]));
/* load_gettext mojo */
load_gettext();
header ("Content-Type: text/html; charset=" . conf('site_charset'));
require_once('templates/show_install_account.inc.php');
break;
default:
case 'init':
/* First step of installation */
// Get the language
$htmllang = $_REQUEST['htmllang'];
// Set the lang in the conf array
conf(array('lang'=>$htmllang));
// We need the charset for the different languages
$charsets = array('de_DE' => 'ISO-8859-15',
'en_US' => 'iso-8859-1',
'en_GB' => 'UTF-8',
'es_ES' => 'iso-8859-1',
'fr_FR' => 'iso-8859-1',
'it_IT' => 'UTF-8',
'nl_NL' => 'ISO-8859-15',
'tr_TR' => 'iso-8859-9',
'zh_CN' => 'GBK');
$charset = $charsets[$_REQUEST['htmllang']];
// Set the site_charset in the conf array
conf(array('site_charset'=>$charsets[$_REQUEST['htmllang']]));
// Now we make voodoo with the Load gettext mojo
load_gettext();
// Page ready :)
header ("Content-Type: text/html; charset=" . conf('site_charset'));
require_once('templates/show_install.inc');
break;
default:
/* Show the language options first */
require_once('templates/show_install_lang.inc.php');
break;
} // end action switch

View file

@ -493,7 +493,7 @@ class Catalog {
echo "</script>\n";
flush();
} //echos song count
// Prevent the script from timing out
set_time_limit(0);
@ -501,8 +501,7 @@ class Catalog {
unset($found);
} // foreach albums
echo "$art_found album's with art. . .<br />\n";
echo "<br />$art_found " . _('album\'s with art') . ". . .<br />\n";
flush();
} // get_album_art
@ -649,7 +648,7 @@ class Catalog {
// Get all of the albums in this catalog
$albums = $this->get_catalog_albums($catalog_id);
echo "<br /><b>" . _("Starting Dump Album Art") . ". . .</b><br /><br />\n";
echo "<br /><b>" . _('Starting Dump Album Art') . ". . .</b><br /><br />\n";
// Run through them an get the art!
foreach ($albums as $album) {
@ -789,6 +788,12 @@ class Catalog {
/* Get the songs and then insert them into the db */
$this->add_files($this->path,$type,$parse_m3u);
echo "<script language=\"JavaScript\">";
echo "update_txt('" . $this->count . "','count_add_" . $this->id ."');";
echo "</script>\n";
flush();
foreach ($this->_playlists as $full_file) {
if ($this->import_m3u($full_file)) {
$file = basename($full_file);
@ -799,7 +804,7 @@ class Catalog {
/* Now Adding Album Art? */
if ($gather_art) {
echo "<br />\n<b>" . _("Starting Album Art Search") . ". . .</b><br />\n";
echo "<br />\n<b>" . _('Starting Album Art Search') . ". . .</b><br />\n";
echo _('Searched') . ": <span id=\"count_art_" . $this->id . "\">" . _('None') . "</span>";
flush();
$this->get_album_art(0,$art);
@ -952,6 +957,11 @@ class Catalog {
/* Get the songs and then insert them into the db */
$this->add_files($this->path,$type,1,$verbose);
echo "<script language=\"JavaScript\">";
echo "update_txt('" . $this->count . "','count_add_" . $this->id ."');";
echo "</script>\n";
flush();
foreach ($this->_playlists as $full_file) {
if ($this->import_m3u($full_file)) {
$file = basename($full_file);
@ -1212,12 +1222,25 @@ class Catalog {
flush();
}
$sql = "DELETE FROM song WHERE id='" . $results->id . "'";
$db_results = mysql_query($sql, dbh());
/* Add this file to the list for removal from the db */
$dead_files[] = $results;
} //if error
} //while gettings songs
/* Unfortuantly it has to be done this way
* you can't delete a row at the same time you're
* doing a select on said table
*/
if (count($dead_files)) {
foreach ($dead_files as $data) {
$sql = "DELETE FROM song WHERE id='$data->id'";
$db_results = mysql_query($sql, dbh());
} //end foreach
} // end if dead files
/* Step two find orphaned Arists/Albums
* This finds artists and albums that no
@ -1232,6 +1255,9 @@ class Catalog {
/* Return dead files, so they can be listed */
if ($verbose) {
echo "<script language=\"JavaScript\">";
echo "update_txt('" . $this->count ."','count_clean_" . $this->id . "');";
echo "</script>\n";
echo "<b>" . _("Catalog Clean Done") . " [" . count($dead_files) . "] " . _("files removed") . "</b><br />\n";
flush();
}
@ -1659,6 +1685,13 @@ class Catalog {
// Update the last_update
$this->update_last_update();
if ($verbose) {
echo "<script language=\"JavaScript\">";
echo "update_txt('" . $this->count . "','count_verify_" . $this->id . "');";
echo "</script>\n";
flush();
}
echo _('Update Finished.') . _('Checked') . " $this->count. $total_updated " . _('songs updated.') . "<br /><br />";
$this->count = 0;

View file

@ -23,7 +23,7 @@
class Localplay {
/* Base Variables */
var $type;
@ -327,6 +327,25 @@ class Localplay {
} // delete
/**
* delete_all
* This removes every song from the players playlist as defined by the delete_all function
* map
*/
function delete_all() {
$function = $this->_function_map['delete_all'];
if (!$this->_player->$function($songs)) {
debug_event('localplay','Error: Unable to delete entire playlist, check ' . $this->type . ' controller','1');
return false;
}
return true;
} // delete_all
} //end localplay class
?>

View file

@ -877,9 +877,7 @@ function get_languages() {
$handle = @opendir(conf('prefix') . '/locale');
if (!is_resource($handle)) {
if (conf('debug')) {
log_event($GLOBALS['user']->username,'language',"Error unable to open locale directory");
}
debug_event('language','Error unable to open locale directory','1');
}
$results = array();
@ -895,15 +893,16 @@ function get_languages() {
if (is_dir($full_file) AND substr($file,0,1) != '.' AND $file != 'base') {
switch($file) {
case 'de_DE'; $name = _('German'); break;
case 'de_DE'; $name = 'Deutsch'; break;
case 'en_US'; $name = _('English'); break;
case 'en_GB'; $name = _('British English'); break;
case 'es_ES'; $name = _('Spanish'); break;
case 'fr_FR'; $name = _('French'); break;
case 'it_IT'; $name = _('Italian'); break;
case 'nl_NL'; $name = _('Dutch'); break;
case 'es_ES'; $name = 'Espa&ntilde;ol'; break;
case 'fr_FR'; $name = 'Fran&ccedil;ais'; break;
case 'it_IT'; $name = 'Italiano'; break;
case 'nl_NL'; $name = 'Nederlands'; break;
case 'tr_TR'; $name = _('Turkish'); break;
case 'zh_CN'; $name = _('Simplified Chinese'); break;
case 'zh_CN'; $name = _('Simplified Chinese') . " (&#x7b80;&#x4f53;&#x4e2d;&#x6587;)"; break;
case 'ru_RU'; $name = 'Russian (&#x0420;&#x0443;&#x0441;&#x0441;&#x043a;&#x0438;&#x0439;)'; break;
default: $name = _('Unknown'); break;
} // end switch

View file

@ -48,7 +48,15 @@ switch ($action) {
$localplay = init_localplay();
$localplay->delete($songs);
$url = $web_path . '/localplay.php';
$title = _('Song Removed from Playlist');
$title = _('Song(s) Removed from Playlist');
$body = '';
show_confirmation($title,$body,$url);
break;
case 'delete_all':
$localplay = init_localplay();
$localplay->delete_all();
$url = $web_path . '/localplay.php';
$title = _('Song(s) Remove from Playlist');
$body = '';
show_confirmation($title,$body,$url);
break;

View file

@ -75,7 +75,7 @@ class AmpacheMpd {
/* Optional Functions */
$map['move'] = 'move';
//$map['delete_all'] = 'clear_playlist';
$map['delete_all'] = 'clear_playlist';
return $map;
@ -150,6 +150,18 @@ class AmpacheMpd {
} // delete_songs
/**
* clear_playlist
* This deletes the entire MPD playlist... nuff said
*/
function clear_playlist() {
if (is_null($this->_mpd->PLClear())) { return false; }
return true;
} // clear_playlist
/**
* play
* This just tells MPD to start playing, it does not

View file

@ -118,6 +118,9 @@ $catalog = new Catalog($song->catalog);
/* Update the users last seen information */
$GLOBALS['user']->update_last_seen();
/* Run Garbage Collection on Now Playing */
gc_now_playing();
/* Check to see if this is a 'remote' catalog */
if ($catalog->catalog_type == 'remote') {
// redirect to the remote host's play path
@ -133,9 +136,6 @@ if ($catalog->catalog_type == 'remote') {
} // end if remote catalog
/* Run Garbage Collection on Now Playing */
gc_now_playing();
// If we are running in Legalize mode, don't play songs already playing
if (conf('lock_songs')) {
if (!check_lock_songs($song->id)) { exit(); }

View file

@ -1,4 +1,4 @@
<html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $htmllang; ?>" lang="<?php echo $htmllang; ?>">
<head>
<title>Ampache :: For The Love Of Music - Install</title>
</head>
@ -34,7 +34,7 @@
<br /><br />
<span class="header2">Insert Ampache Database</span>
<?php echo $GLOBALS['error']->print_error('general'); ?>
<form method="post" action="<?php echo $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?action=create_db"; ?>" enctype="multipart/form-data" >
<form method="post" action="<?php echo $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?action=create_db&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data" >
<table>
<tr>
<td class="align"><?php echo _("Desired Database Name"); ?></td>

View file

@ -25,7 +25,7 @@
*/
?>
<html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $htmllang; ?>" lang="<?php echo $htmllang; ?>">
<head>
<title>Ampache :: For The Love Of Music - Install</title>
</head>

View file

@ -6,7 +6,7 @@
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
1 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,
@ -25,7 +25,7 @@
*/
?>
<html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $htmllang; ?>" lang="<?php echo $htmllang; ?>">
<head>
<title>Ampache :: For The Love Of Music - Install</title>
</head>
@ -125,12 +125,13 @@
<tr>
<td>&nbsp;</td>
<td>
<a href="<?php echo $GLOBALS['php_self']; ?>?action=show_create_config&local_db=<?php echo $_REQUEST['local_db']; ?>&local_host=<?php echo $_REQUEST['local_host']; ?>">[<?php echo _("Check for Config"); ?>]</a>
<?php $check_url = $GLOBALS['php_self'] . "?action=show_create_config&amp;htmllang=$htmllang&amp;charset=$charset&amp;local_db=" . $_REQUEST['local_db'] . "&amp;local_host=" . $_REQUEST['local_host']; ?>
<a href="<?php echo $check_url; ?>">[<?php echo _('Check for Config'); ?>]</a>
</td>
</tr>
</table>
<br />
<form method="post" action="<?php echo $GLOBALS['php_self'] . "?action=show_create_account"; ?>" enctype="multipart/form-data">
<form method="post" action="<?php echo $GLOBALS['php_self'] . "?action=show_create_account&htmllang=$htmllang&charset=$charset"; ?>" enctype="multipart/form-data">
<input type="Submit" value="Continue to Step 3" />
</form>
</div>

View file

@ -0,0 +1,60 @@
<html>
<head>
<title>Ampache :: For The Love Of Music - Install</title>
</head>
<body>
<script src="lib/general.js" language="javascript" type="text/javascript"></script>
<?php require_once(conf('prefix') . "/templates/install.css"); ?>
<div id="header">
<h1><?php echo _('Ampache Installation'); ?></h1>
<p>For the love of Music</p>
</div>
<div id="text-box">
<div class="notify">
<b><?php echo _("Requirements"); ?></b>
<p>
<?php echo _('This Page handles the installation of the Ampache database and the creation of the ampache.cfg.php file. Before you continue please make sure that you have the following pre-requisites'); ?>
<br />
<ul>
<li><?php echo _('A MySQL Server with a username and password that can create/modify databases'); ?></li>
<li><?php echo _('Your webserver has read access to the /sql/ampache.sql file and the /config/ampache.cfg.php.dist file'); ?></li>
</ul>
<?php echo _("Once you have ensured that you have the above requirements please fill out the information below. You will only be asked for the required config values. If you would like to make changes to your ampache install at a later date simply edit /config/ampache.cfg.php"); ?>
</p>
</div>
<div class="content">
<b>Choose installation language.</b>
<p>
<?php echo $GLOBALS['error']->print_error('general'); ?>
<form method="post" action="<?php echo $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?action=init"; ?>" enctype="multipart/form-data" >
<?
$languages = get_languages();
$var_name = $value . "_lang";
${$var_name} = "selected=\"selected\"";
echo "<select name=\"htmllang\">\n";
foreach ($languages as $lang=>$name) {
$var_name = $lang . "_lang";
echo "\t<option value=\"$lang\" " . ${$var_name} . ">$name</option>\n";
} // end foreach
echo "</select>\n";
?>
<input type="submit" value="<?php echo _('Start configuration'); ?>">
</form>
</p>
</div>
<div id="bottom">
<p><b>Ampache Installation.</b><br />
For the love of Music.</p>
</div>
</div>
</body>
</html>

View file

@ -26,8 +26,12 @@ $songs = $localplay->get();
?>
<div class="text-box">
<span class="header2"><?php echo _('Localplay'); ?></span>
<!-- Yea I don't know what to put here... yet.. -->
<span class="header2"><?php echo ucfirst($localplay->type); ?> <?php echo _('Localplay'); ?></span>
<ul class="text-action">
<?php if ($localplay->has_function('delete_all')) { ?>
<li><a href="<?php echo $web_path; ?>/localplay.php?action=delete_all"><?php echo _('Clear Playlist'); ?></a></li>
<?php } ?>
</ul>
</div>
<br />
<div class="text-box">
@ -51,7 +55,7 @@ $songs = $localplay->get();
</tr>
<?php } if (!count($songs)) { ?>
<tr class="<?php echo flip_class(); ?>">
<td colspan="2"><span class="error"><?php echo _('No Records Found'); ?></span></td>
<td colspan="3"><span class="error"><?php echo _('No Records Found'); ?></span></td>
</tr>
<?php } ?>
</table>

View file

@ -30,7 +30,7 @@
$localplay_modules = get_localplay_controllers();
$web_path = conf('web_path');
?>
<span class="header2"><?php echo _('Modules'); ?></span>
<span class="header1"><?php echo _('Modules'); ?></span>
<table class="border" border="0" cellspacing="0">
<tr class="table-header">
<th><?php echo _('Module Name'); ?></th>

View file

@ -186,6 +186,10 @@ $web_path = conf('web_path');
<?php require_once(conf('prefix') . '/templates/show_localplay_control.inc.php'); ?>
<br />
<?php $type = conf('play_type'); ${$type} = 'id="pt_active"'; ?>
<?php
$required_info = "&amp;user_id=" . $GLOBALS['user']->id . "&amp;sessid=" . session_id();
$ajax_url = $web_path . '/server/ajax.server.php';
?>
<span class="text-action" style="cursor:pointer;" id="play_type">
<span <?php echo $stream; ?> onclick="ajaxPut('<?php echo $ajax_url; ?>','action=change_play_type&amp;type=stream<?php echo $required_info; ?>','play_type');return true;">
<?php echo _('Stream') ?>