mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
catalog clean up and admin index changes
This commit is contained in:
parent
b99e8307ac
commit
eda7fd335c
12 changed files with 379 additions and 367 deletions
|
@ -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
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
require('../modules/init.php');
|
require('../modules/init.php');
|
||||||
|
|
||||||
if (!$user->has_access(100)) {
|
if (!$GLOBALS['user']->has_access(100)) {
|
||||||
access_denied();
|
access_denied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ switch ($_REQUEST['action']) {
|
||||||
$type = 'show_flagged_songs';
|
$type = 'show_flagged_songs';
|
||||||
include(conf('prefix') . '/templates/flag.inc');
|
include(conf('prefix') . '/templates/flag.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _("Add to Catalog(s)"):
|
case _("Add to Catalog(s)"):
|
||||||
|
case 'add_to_catalog':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
if ($_REQUEST['catalogs'] ) {
|
if ($_REQUEST['catalogs'] ) {
|
||||||
foreach ($_REQUEST['catalogs'] as $catalog_id) {
|
foreach ($_REQUEST['catalogs'] as $catalog_id) {
|
||||||
|
@ -56,7 +56,6 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _("Add to all Catalogs"):
|
case _("Add to all Catalogs"):
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
|
|
||||||
|
@ -79,9 +78,11 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _("Update Catalog(s)"):
|
case _("Update Catalog(s)"):
|
||||||
|
case 'update_catalog':
|
||||||
|
/* If they are in demo mode stop here */
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
|
|
||||||
if (isset($_REQUEST['catalogs'])) {
|
if (isset($_REQUEST['catalogs'])) {
|
||||||
foreach ($_REQUEST['catalogs'] as $catalog_id) {
|
foreach ($_REQUEST['catalogs'] as $catalog_id) {
|
||||||
$catalog = new Catalog($catalog_id);
|
$catalog = new Catalog($catalog_id);
|
||||||
|
@ -90,7 +91,6 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _("Update All Catalogs"):
|
case _("Update All Catalogs"):
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
$catalogs = $catalog->get_catalogs();
|
$catalogs = $catalog->get_catalogs();
|
||||||
|
@ -100,7 +100,20 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
case 'full_service':
|
||||||
|
/* Make sure they aren't in demo mode */
|
||||||
|
if (conf('demo_mode')) { break; }
|
||||||
|
|
||||||
|
/* This runs the clean/verify/add in that order */
|
||||||
|
foreach ($_REQUEST['catalogs'] as $catalog_id) {
|
||||||
|
$catalog = new Catalog($catalog_id);
|
||||||
|
$catalog->clean_catalog();
|
||||||
|
$catalog->count = 0;
|
||||||
|
$catalog->update_catalog();
|
||||||
|
$catalog->count = 0;
|
||||||
|
$catalog->add_to_catalog();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'delete_catalog':
|
case 'delete_catalog':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
if ($_REQUEST['confirm'] === 'Yes') {
|
if ($_REQUEST['confirm'] === 'Yes') {
|
||||||
|
@ -109,7 +122,6 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'remove_disabled':
|
case 'remove_disabled':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
$song = $_REQUEST['song'];
|
$song = $_REQUEST['song'];
|
||||||
|
@ -122,15 +134,16 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
case _('Clean Catalog(s)'):
|
||||||
case _("Clean Catalog(s)"):
|
case 'clean_catalog':
|
||||||
|
/* If they are in demo mode stop them here */
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
|
|
||||||
// Make sure they checked something
|
// Make sure they checked something
|
||||||
if (isset($_REQUEST['catalogs'])) {
|
if (isset($_REQUEST['catalogs'])) {
|
||||||
foreach($_REQUEST['catalogs'] as $catalog_id) {
|
foreach($_REQUEST['catalogs'] as $catalog_id) {
|
||||||
$catalog = new Catalog($catalog_id);
|
$catalog = new Catalog($catalog_id);
|
||||||
$catalog->clean_catalog(0,$_REQUEST['update_type']);
|
$catalog->clean_catalog(0,1);
|
||||||
} // end foreach catalogs
|
} // end foreach catalogs
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
|
@ -152,7 +165,6 @@ switch ($_REQUEST['action']) {
|
||||||
$result = mysql_query($sql, dbh());
|
$result = mysql_query($sql, dbh());
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _("Clean All Catalogs"):
|
case _("Clean All Catalogs"):
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
$catalogs = $catalog->get_catalogs();
|
$catalogs = $catalog->get_catalogs();
|
||||||
|
@ -186,25 +198,20 @@ switch ($_REQUEST['action']) {
|
||||||
include(conf('prefix') . '/templates/add_catalog.inc');
|
include(conf('prefix') . '/templates/add_catalog.inc');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'really_clear_stats':
|
case 'really_clear_stats':
|
||||||
|
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
if ($_REQUEST['confirm'] == 'Yes') {
|
if ($_REQUEST['confirm'] == 'Yes') {
|
||||||
clear_catalog_stats();
|
clear_catalog_stats();
|
||||||
}
|
}
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'show_add_catalog':
|
case 'show_add_catalog':
|
||||||
include(conf('prefix') . '/templates/add_catalog.inc');
|
include(conf('prefix') . '/templates/add_catalog.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'clear_now_playing':
|
case 'clear_now_playing':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
clear_now_playing();
|
clear_now_playing();
|
||||||
show_confirmation(_("Now Playing Cleared"),_("All now playing data has been cleared"),"/admin/catalog.php");
|
show_confirmation(_("Now Playing Cleared"),_("All now playing data has been cleared"),"/admin/catalog.php");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'Clear Catalog':
|
case 'Clear Catalog':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
|
@ -212,13 +219,11 @@ switch ($_REQUEST['action']) {
|
||||||
"admin/catalog.php", "action=really_clear_catalog");
|
"admin/catalog.php", "action=really_clear_catalog");
|
||||||
print("<hr />\n");
|
print("<hr />\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'clear_stats':
|
case 'clear_stats':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
show_confirm_action(_("Do you really want to clear the statistics for this catalog?"),
|
show_confirm_action(_("Do you really want to clear the statistics for this catalog?"),
|
||||||
"admin/catalog.php", "action=really_clear_stats");
|
"admin/catalog.php", "action=really_clear_stats");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'show_disabled':
|
case 'show_disabled':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
$songs = $catalog->get_disabled();
|
$songs = $catalog->get_disabled();
|
||||||
|
@ -229,32 +234,21 @@ switch ($_REQUEST['action']) {
|
||||||
echo "<p class=\"error\" align=\"center\">No Disabled songs found</p>";
|
echo "<p class=\"error\" align=\"center\">No Disabled songs found</p>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'show_delete_catalog':
|
case 'show_delete_catalog':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
show_confirm_action(_("Do you really want to delete this catalog?"),
|
show_confirm_action(_("Do you really want to delete this catalog?"),
|
||||||
"admin/catalog.php",
|
"admin/catalog.php",
|
||||||
"catalog_id=" . $_REQUEST['catalog_id'] . "&action=delete_catalog");
|
"catalog_id=" . $_REQUEST['catalog_id'] . "&action=delete_catalog");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'show_flagged_songs':
|
case 'show_flagged_songs':
|
||||||
if (conf('demo_mode')) { break; }
|
if (conf('demo_mode')) { break; }
|
||||||
$type = $_REQUEST['action'];
|
$type = $_REQUEST['action'];
|
||||||
include (conf('prefix') . '/templates/flag.inc');
|
include (conf('prefix') . '/templates/flag.inc');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Update Flags':
|
|
||||||
if (conf('demo_mode')) { break; }
|
|
||||||
echo "<pre>";
|
|
||||||
print_r($_REQUEST);
|
|
||||||
echo "</pre>";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'show_customize_catalog':
|
case 'show_customize_catalog':
|
||||||
include(conf('prefix') . '/templates/customize_catalog.inc');
|
include(conf('prefix') . '/templates/customize_catalog.inc');
|
||||||
break;
|
break;
|
||||||
case 'gather_album_art':
|
case 'gather_album_art':
|
||||||
|
|
||||||
echo "<b>" . _("Starting Album Art Search") . ". . .</b><br /><br />\n";
|
echo "<b>" . _("Starting Album Art Search") . ". . .</b><br /><br />\n";
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
|
@ -266,18 +260,9 @@ switch ($_REQUEST['action']) {
|
||||||
echo "<b>" . _("Album Art Search Finished") . ". . .</b><br />\n";
|
echo "<b>" . _("Album Art Search Finished") . ". . .</b><br />\n";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
// (Added by Cucumber 20050216)
|
|
||||||
case 'dump_album_art':
|
|
||||||
$catalogs = $catalog->get_catalogs();
|
|
||||||
|
|
||||||
foreach ($catalogs as $data) {
|
|
||||||
$data->dump_album_art();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
include(conf('prefix') . '/templates/catalog.inc');
|
include(conf('prefix') . '/templates/catalog.inc');
|
||||||
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
/* Show the Footer */
|
/* Show the Footer */
|
||||||
|
|
|
@ -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,59 +20,31 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
require ('../modules/init.php');
|
||||||
@header Admin Index
|
|
||||||
Do most of the dirty work of displaying the mp3 catalog
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
require ("../modules/init.php");
|
|
||||||
|
|
||||||
$action = scrub_in($_REQUEST['action']);
|
$action = scrub_in($_REQUEST['action']);
|
||||||
|
|
||||||
if (!$user->has_access(100)) {
|
if (!$GLOBALS['user']->has_access(100)) {
|
||||||
header ("Location: " . conf('web_path') . "/index.php?access=denied");
|
access_denied();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// let's set the preferences here so that they take affect on the fly
|
|
||||||
if ( $action == 'Update Preferences' ) {
|
|
||||||
update_site_preferences($preferences_id, 'true', $new_m_host, $new_w_host,
|
|
||||||
$new_site_title, $new_login_message, $new_session_lifetime, $new_font,
|
|
||||||
$new_background_color, $new_primary_color, $new_secondary_color,
|
|
||||||
$new_primary_font_color, $new_secondary_font_color,
|
|
||||||
$new_error_color, $new_popular_threshold);
|
|
||||||
// reload the preferences now
|
|
||||||
set_preferences();
|
|
||||||
}
|
|
||||||
|
|
||||||
show_template('header');
|
show_template('header');
|
||||||
|
|
||||||
if ( $action == 'Update Preferences' ) {
|
|
||||||
$action = 'show_preferences';
|
|
||||||
}
|
|
||||||
elseif ( $action == 'show_update_catalog' ) {
|
|
||||||
show_update_catalog();
|
|
||||||
}
|
|
||||||
elseif ( $action == 'show_file_manager' ) {
|
|
||||||
show_file_manager();
|
|
||||||
}
|
|
||||||
elseif ( $action == 'show_site_preferences' ) {
|
|
||||||
$user = new User(0);
|
|
||||||
require (conf('prefix') . "/templates/show_preferences.inc");
|
|
||||||
}
|
|
||||||
elseif ( $action == 'show_preferences' ) {
|
|
||||||
$user = new User($_REQUEST['user_id']);
|
|
||||||
require (conf('prefix') . "/templates/show_preferences.inc");
|
|
||||||
}
|
|
||||||
elseif ( $action == 'show_orphaned_files' ) {
|
|
||||||
show_orphaned_files();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
show_clear();
|
|
||||||
require (conf('prefix') . "/templates/show_admin_index.inc");
|
|
||||||
} // if they didn't pick anything
|
|
||||||
|
|
||||||
show_footer();
|
|
||||||
?>
|
?>
|
||||||
|
<!-- Big Daddy Table -->
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<!-- Needs Attention Cell -->
|
||||||
|
<td rowspan="2" valign="top" width="50%">
|
||||||
|
<?php require (conf('prefix') . '/templates/show_admin_info.inc.php'); ?>
|
||||||
|
</td>
|
||||||
|
<!-- Catalog Cell -->
|
||||||
|
<td width="50%"><?php require (conf('prefix') . '/templates/show_admin_catalog.inc.php'); ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<!-- Users Cell -->
|
||||||
|
<td><?php require (conf('prefix') . '/templates/show_admin_user.inc.php'); ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<?php show_footer(); ?>
|
||||||
|
|
|
@ -34,12 +34,12 @@ while ($r = mysql_fetch_row($db_results)) {
|
||||||
$catalog = new Catalog($r[0]);
|
$catalog = new Catalog($r[0]);
|
||||||
|
|
||||||
// Clean out dead files
|
// Clean out dead files
|
||||||
$catalog->clean_catalog();
|
$catalog->clean_catalog(0,0);
|
||||||
|
|
||||||
$catalog->count = 0;
|
$catalog->count = 0;
|
||||||
|
|
||||||
// Verify Existing
|
// Verify Existing
|
||||||
$catalog->verify_catalog();
|
$catalog->verify_catalog(0,0,0);
|
||||||
|
|
||||||
$catalog->count = 0;
|
$catalog->count = 0;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
v.3.3.2-Beta2
|
v.3.3.2-Beta2
|
||||||
|
- Added dump album art command line script and tweaked catalog
|
||||||
|
build display.
|
||||||
- Tweaked preferences adding tab'd views rather then all on one
|
- Tweaked preferences adding tab'd views rather then all on one
|
||||||
page, also added account page back in.
|
page, also added account page back in.
|
||||||
- Fixed popen in downsample, forcing binary mode, so that windows
|
- Fixed popen in downsample, forcing binary mode, so that windows
|
||||||
|
|
|
@ -266,8 +266,9 @@ class Catalog {
|
||||||
information against the db.
|
information against the db.
|
||||||
@param $path The root path you want to start grabing files from
|
@param $path The root path you want to start grabing files from
|
||||||
@param $gather_type=0 Determins if we need to check the id3 tags of the file or not
|
@param $gather_type=0 Determins if we need to check the id3 tags of the file or not
|
||||||
|
@param $parse_m3u Tells Ampache to look at m3us
|
||||||
*/
|
*/
|
||||||
function add_files($path,$gather_type='',$parse_m3u='') {
|
function add_files($path,$gather_type='',$parse_m3u='',$verbose=1) {
|
||||||
/* Strip existing escape slashes and then add them again
|
/* Strip existing escape slashes and then add them again
|
||||||
This is done because we keep adding to the dir (slashed) + (non slashed)
|
This is done because we keep adding to the dir (slashed) + (non slashed)
|
||||||
and a double addslashes would pooch things
|
and a double addslashes would pooch things
|
||||||
|
@ -380,7 +381,9 @@ class Catalog {
|
||||||
/* Stupid little cutesie thing */
|
/* Stupid little cutesie thing */
|
||||||
$this->count++;
|
$this->count++;
|
||||||
if ( !($this->count%conf('catalog_echo_count')) ) {
|
if ( !($this->count%conf('catalog_echo_count')) ) {
|
||||||
echo _("Added") . " $this->count. . . . <br />\n";
|
echo "<script language=\"JavaScript\">";
|
||||||
|
echo "update_txt('" . $this->count . "','count');";
|
||||||
|
echo "</script>\n";
|
||||||
flush();
|
flush();
|
||||||
} //echos song count
|
} //echos song count
|
||||||
|
|
||||||
|
@ -736,16 +739,17 @@ class Catalog {
|
||||||
|
|
||||||
/* Fluf */
|
/* Fluf */
|
||||||
echo _("Starting Catalog Build") . " [$name]<br />\n";
|
echo _("Starting Catalog Build") . " [$name]<br />\n";
|
||||||
flush();
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->catalog_type == 'remote') {
|
if ($this->catalog_type == 'remote') {
|
||||||
echo _("Running Remote Sync") . ". . .<br /><br />";
|
echo _("Running Remote Sync") . ". . .<br /><br />";
|
||||||
flush();
|
|
||||||
$this->get_remote_catalog($type=0);
|
$this->get_remote_catalog($type=0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo _('Found') . ": <span id=\"count\">" . _('None') . "</span><br />\n";
|
||||||
|
flush();
|
||||||
|
|
||||||
/* Get the songs and then insert them into the db */
|
/* Get the songs and then insert them into the db */
|
||||||
$this->add_files($this->path,$type,$parse_m3u);
|
$this->add_files($this->path,$type,$parse_m3u);
|
||||||
|
|
||||||
|
@ -890,29 +894,34 @@ class Catalog {
|
||||||
@discussion this function adds new files to an
|
@discussion this function adds new files to an
|
||||||
existing catalog
|
existing catalog
|
||||||
*/
|
*/
|
||||||
function add_to_catalog($type='') {
|
function add_to_catalog($type='',$verbose=1) {
|
||||||
|
|
||||||
echo "\n" . _('Starting New Song Search on') . " <b>[$this->name]</b> " . _('catalog') . "<br /><br />\n";
|
if ($verbose) {
|
||||||
flush();
|
echo "\n" . _('Starting New Song Search on') . " <b>[$this->name]</b> " . _('catalog') . "<br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->catalog_type == 'remote') {
|
if ($this->catalog_type == 'remote') {
|
||||||
echo _('Running Remote Update') . ". . .<br /><br />";
|
echo _('Running Remote Update') . ". . .<br />";
|
||||||
flush();
|
|
||||||
$this->get_remote_catalog($type=0);
|
$this->get_remote_catalog($type=0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo _('Found') . ": <span id=\"count\">" . _('None') . "</span><br />\n";
|
||||||
|
flush();
|
||||||
|
|
||||||
/* Set the Start time */
|
/* Set the Start time */
|
||||||
$start_time = time();
|
$start_time = time();
|
||||||
|
|
||||||
/* Get the songs and then insert them into the db */
|
/* Get the songs and then insert them into the db */
|
||||||
$this->add_files($this->path,$type);
|
$this->add_files($this->path,$type,1,$verbose);
|
||||||
|
|
||||||
foreach ($this->_playlists as $full_file) {
|
foreach ($this->_playlists as $full_file) {
|
||||||
if ($this->import_m3u($full_file)) {
|
if ($this->import_m3u($full_file)) {
|
||||||
$file = basename($full_file);
|
$file = basename($full_file);
|
||||||
|
if ($verbose) {
|
||||||
echo " " . _('Added Playlist From') . " $file . . . .<br />\n";
|
echo " " . _('Added Playlist From') . " $file . . . .<br />\n";
|
||||||
flush();
|
flush();
|
||||||
|
}
|
||||||
} // end if import worked
|
} // end if import worked
|
||||||
} // end foreach playlist files
|
} // end foreach playlist files
|
||||||
|
|
||||||
|
@ -920,8 +929,10 @@ class Catalog {
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
|
|
||||||
if ($type != 'fast_add') {
|
if ($type != 'fast_add') {
|
||||||
|
if ($verbose) {
|
||||||
echo "\n<b>" . _('Starting Album Art Search') . ". . .</b><br />\n";
|
echo "\n<b>" . _('Starting Album Art Search') . ". . .</b><br />\n";
|
||||||
flush();
|
flush();
|
||||||
|
}
|
||||||
$this->get_album_art();
|
$this->get_album_art();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1118,17 +1129,19 @@ class Catalog {
|
||||||
@discussion Cleans the Catalog of files that no longer exist grabs from $this->id or $id passed
|
@discussion Cleans the Catalog of files that no longer exist grabs from $this->id or $id passed
|
||||||
Doesn't actually delete anything, disables errored files, and returns them in an array
|
Doesn't actually delete anything, disables errored files, and returns them in an array
|
||||||
@param $catalog_id=0 Take the ID of the catalog you want to clean
|
@param $catalog_id=0 Take the ID of the catalog you want to clean
|
||||||
@param $action=0 Delete/Disable, default is disable
|
|
||||||
*/
|
*/
|
||||||
function clean_catalog($catalog_id=0,$action=0) {
|
function clean_catalog($catalog_id=0,$verbose=1) {
|
||||||
|
|
||||||
/* Define the Arrays we will need */
|
/* Define the Arrays we will need */
|
||||||
$dead_files = array();
|
$dead_files = array();
|
||||||
|
|
||||||
if (!$catalog_id) { $catalog_id = $this->id; }
|
if (!$catalog_id) { $catalog_id = $this->id; }
|
||||||
|
|
||||||
echo "\nCleaning the <b>[" . $this->name . "]</b> Catalog...<br /><br />\n";
|
if ($verbose) {
|
||||||
|
echo "\n" . _('Cleaning the') . " <b>[" . $this->name . "]</b> " . _('Catalog') . "...<br />\n";
|
||||||
|
echo _('Checking') . ": <span id=\"count\"></span>\n<br />";
|
||||||
flush();
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
/* Get all songs in this catalog */
|
/* Get all songs in this catalog */
|
||||||
$sql = "SELECT id,file FROM song WHERE catalog='$catalog_id' AND enabled='1'";
|
$sql = "SELECT id,file FROM song WHERE catalog='$catalog_id' AND enabled='1'";
|
||||||
|
@ -1142,8 +1155,10 @@ class Catalog {
|
||||||
|
|
||||||
/* Stupid little cutesie thing */
|
/* Stupid little cutesie thing */
|
||||||
$this->count++;
|
$this->count++;
|
||||||
if ( !($this->count%conf('catalog_echo_count')) ) {
|
if ( !($this->count%conf('catalog_echo_count')) && $verbose) {
|
||||||
echo _('Checking') . " $this->count. . . . <br />\n";
|
echo "<script language=\"JavaScript\">";
|
||||||
|
echo "update_txt('" . $this->count ."','count');";
|
||||||
|
echo "</script>\n";
|
||||||
flush();
|
flush();
|
||||||
} //echos song count
|
} //echos song count
|
||||||
|
|
||||||
|
@ -1154,8 +1169,10 @@ class Catalog {
|
||||||
if (!file_exists($results->file) OR $file_info < 1) {
|
if (!file_exists($results->file) OR $file_info < 1) {
|
||||||
|
|
||||||
/* Add Error */
|
/* Add Error */
|
||||||
|
if ($verbose) {
|
||||||
echo "<font class=\"error\">Error File Not Found or 0 Bytes: " . $results->file . "</font><br />";
|
echo "<font class=\"error\">Error File Not Found or 0 Bytes: " . $results->file . "</font><br />";
|
||||||
flush();
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
/* Add this file to the list for removal from the db */
|
/* Add this file to the list for removal from the db */
|
||||||
$dead_files[] = $results;
|
$dead_files[] = $results;
|
||||||
|
@ -1169,22 +1186,9 @@ class Catalog {
|
||||||
if (count($dead_files)) {
|
if (count($dead_files)) {
|
||||||
foreach ($dead_files as $data) {
|
foreach ($dead_files as $data) {
|
||||||
|
|
||||||
//FIXME: Until I fix the form, assume delete
|
|
||||||
//if ($action === 'delete_dead') {
|
|
||||||
$sql = "DELETE FROM song WHERE id='$data->id'";
|
$sql = "DELETE FROM song WHERE id='$data->id'";
|
||||||
//}
|
|
||||||
//
|
|
||||||
//else {
|
|
||||||
// $sql = "UPDATE song SET status='disabled' WHERE id='$data->id'";
|
|
||||||
//}
|
|
||||||
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
$db_results = mysql_query($sql, dbh());
|
||||||
|
|
||||||
/* DB Error occured */
|
|
||||||
if (!$db_results) {
|
|
||||||
/* Add Error */
|
|
||||||
} //if error
|
|
||||||
|
|
||||||
} //end foreach
|
} //end foreach
|
||||||
|
|
||||||
} // end if dead files
|
} // end if dead files
|
||||||
|
@ -1198,11 +1202,13 @@ class Catalog {
|
||||||
$this->clean_stats();
|
$this->clean_stats();
|
||||||
$this->clean_playlists();
|
$this->clean_playlists();
|
||||||
$this->clean_flagged();
|
$this->clean_flagged();
|
||||||
;$this->clean_genres();
|
$this->clean_genres();
|
||||||
|
|
||||||
/* Return dead files, so they can be listed */
|
/* Return dead files, so they can be listed */
|
||||||
|
if ($verbose) {
|
||||||
echo "<b>" . _("Catalog Clean Done") . " [" . count($dead_files) . "] " . _("files removed") . "</b><br />\n";
|
echo "<b>" . _("Catalog Clean Done") . " [" . count($dead_files) . "] " . _("files removed") . "</b><br />\n";
|
||||||
flush();
|
flush();
|
||||||
|
}
|
||||||
return $dead_files;
|
return $dead_files;
|
||||||
|
|
||||||
$this->count = 0;
|
$this->count = 0;
|
||||||
|
@ -1461,7 +1467,7 @@ class Catalog {
|
||||||
@discussion This function compares the DB's information with the ID3 tags
|
@discussion This function compares the DB's information with the ID3 tags
|
||||||
@param $catalog_id The ID of the catalog to compare
|
@param $catalog_id The ID of the catalog to compare
|
||||||
*/
|
*/
|
||||||
function verify_catalog($catalog_id=0,$gather_type='') {
|
function verify_catalog($catalog_id=0,$gather_type='',$verbose=1) {
|
||||||
|
|
||||||
/* Create and empty song for us to use */
|
/* Create and empty song for us to use */
|
||||||
$total_updated = 0;
|
$total_updated = 0;
|
||||||
|
@ -1476,9 +1482,12 @@ class Catalog {
|
||||||
$db_results = mysql_query($sql, dbh());
|
$db_results = mysql_query($sql, dbh());
|
||||||
$number = mysql_num_rows($db_results);
|
$number = mysql_num_rows($db_results);
|
||||||
|
|
||||||
|
if ($verbose) {
|
||||||
echo _("Updating the") . " <b>[ $this->name ]</b> " . _("Catalog") . "<br />\n";
|
echo _("Updating the") . " <b>[ $this->name ]</b> " . _("Catalog") . "<br />\n";
|
||||||
echo $number . " " . _("songs found checking tag information.") . "<br /><br />\n\n";
|
echo $number . " " . _("songs found checking tag information.") . "<br />\n\n";
|
||||||
|
echo _('Verifed') . ": <span=\"count\">None</span><br />\n";
|
||||||
flush();
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
/* Magical Fix so we don't run out of time */
|
/* Magical Fix so we don't run out of time */
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
@ -1550,7 +1559,9 @@ class Catalog {
|
||||||
/* Stupid little cutesie thing */
|
/* Stupid little cutesie thing */
|
||||||
$this->count++;
|
$this->count++;
|
||||||
if ( !($this->count%conf('catalog_echo_count')) ) {
|
if ( !($this->count%conf('catalog_echo_count')) ) {
|
||||||
echo "Checked $this->count. . . . <br />\n";
|
echo "<script language=\"JavaScript\">";
|
||||||
|
echo "update_txt('" . $this->count . "','count');";
|
||||||
|
echo "</script>\n";
|
||||||
flush();
|
flush();
|
||||||
} //echos song count
|
} //echos song count
|
||||||
|
|
||||||
|
|
|
@ -265,6 +265,10 @@ function selectField(element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function for the catalog mojo fluf
|
||||||
|
function update_txt(value,field) {
|
||||||
|
document.getElementById(field).innerHTML=value;
|
||||||
|
}
|
||||||
|
|
||||||
function popup_art(url) {
|
function popup_art(url) {
|
||||||
var newwindow;
|
var newwindow;
|
||||||
|
|
|
@ -30,6 +30,9 @@ function log_event($username='Unknown',$event_name,$event_description,$log_name=
|
||||||
/* Set it up here to make sure it's _always_ the same */
|
/* Set it up here to make sure it's _always_ the same */
|
||||||
$log_time = time();
|
$log_time = time();
|
||||||
|
|
||||||
|
/* must have some name */
|
||||||
|
if (!strlen($log_name)) { $log_name = 'ampache'; }
|
||||||
|
|
||||||
$log_filename = conf('log_path') . "/$log_name." . date("Ymd",$log_time) . ".log";
|
$log_filename = conf('log_path') . "/$log_name." . date("Ymd",$log_time) . ".log";
|
||||||
$log_line = date("Y-m-d H:i:s",$log_time) . " { $username } ( $event_name ) - $event_description \n";
|
$log_line = date("Y-m-d H:i:s",$log_time) . " { $username } ( $event_name ) - $event_description \n";
|
||||||
|
|
||||||
|
|
|
@ -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-Beta2 (Build 008)';
|
$results['version'] = '3.3.2-Beta2 (Build 009)';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
54
templates/show_admin_catalog.inc.php
Normal file
54
templates/show_admin_catalog.inc.php
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2001 - 2006 Ampache.org
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
$web_path = conf('web_path');
|
||||||
|
$catalogs = Catalog::get_catalogs();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="text-box">
|
||||||
|
<span class="header2"><?php echo _('Catalogs'); ?></span>
|
||||||
|
<!-- Current Catalogs -->
|
||||||
|
<table border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr class="table-header">
|
||||||
|
<td><?php echo _('Name'); ?></td>
|
||||||
|
<td align="center"><?php echo _('Action'); ?></td>
|
||||||
|
<?php foreach ($catalogs as $catalog) { ?>
|
||||||
|
<tr class="<?php echo flip_class(); ?>">
|
||||||
|
<td>
|
||||||
|
<a href="<?php echo $web_path; ?>/admin/catalog.php?action=show_customize_catalog&catalog_id=<?php echo $catalog->id; ?>">
|
||||||
|
<?php echo $catalog->name; ?></a>
|
||||||
|
(<?php echo $catalog->path; ?>)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="<?php echo $web_path; ?>/admin/catalog.php?action=add_to_catalog&catalogs[]=<?php echo $catalog->id; ?>">
|
||||||
|
<?php echo _('Add'); ?></a> |
|
||||||
|
<a href="<?php echo $web_path; ?>/admin/catalog.php?action=update_catalog&catalogs[]=<?php echo $catalog->id; ?>">
|
||||||
|
<?php echo _('Update'); ?></a> |
|
||||||
|
<a href="<?php echo $web_path; ?>/admin/catalog.php?action=clean_catalog&catalogs[]=<?php echo $catalog->id; ?>">
|
||||||
|
<?php echo _('Clean'); ?></a> |
|
||||||
|
<a href="<?php echo $web_path; ?>/admin/catalog.php?action=full_service&catalogs[]=<?php echo $catalog->id; ?>">
|
||||||
|
<?php echo _('All'); ?></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } // end foreach ?>
|
||||||
|
</table>
|
||||||
|
<span class="header2"><?php echo _('Other Tools'); ?></span><br />
|
||||||
|
</div>
|
|
@ -1,46 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 2001 - 2006 Ampache.org
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
*/
|
|
||||||
/*!
|
|
||||||
@header Show Admin Index
|
|
||||||
@discussion shows the admin index
|
|
||||||
*/
|
|
||||||
$web_path = conf('web_path');
|
|
||||||
$sections = array(_("User Management") => $web_path . "/admin/users.php",
|
|
||||||
_("E-mail Management") => $web_path . "/admin/mail.php",
|
|
||||||
_("Catalog Managment") => $web_path . "/admin/catalog.php",
|
|
||||||
_("Admin Preferences") => $web_path . "/admin/preferences.php",
|
|
||||||
_("Access Lists") => $web_path . "/admin/access.php");
|
|
||||||
|
|
||||||
$common = array(_("Add a catalog") => $web_path . "/admin/catalog.php?action=show_add_catalog",
|
|
||||||
_("Add a new user") => $web_path . "/admin/users.php?action=show_add_user",
|
|
||||||
_("Clear Now Playing") => $web_path . "/admin/catalog.php?action=clear_now_playing",
|
|
||||||
_("Add Access List Entry") => $web_path . "/admin/access.php?action=show_add_host");
|
|
||||||
?>
|
|
||||||
<table cellpadding="5" border="0" cellspacing="0">
|
|
||||||
<tr>
|
|
||||||
<td valign="top"><?php show_tool_box(_("Common Functions"), $common); ?><?php show_clear(); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td valign="top"><?php show_tool_box(_("Admin Sections"), $sections); ?></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
27
templates/show_admin_user.inc.php
Normal file
27
templates/show_admin_user.inc.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2001 - 2006 Ampache.org
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
$web_path = conf('web_path');
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="text-box">
|
||||||
|
<span class="header2"><?php echo _('Users'); ?></span><br />
|
||||||
|
</div>
|
Loading…
Add table
Add a link
Reference in a new issue