summaryrefslogtreecommitdiffstats
path: root/admin/catalog.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-11-19 23:06:21 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-11-19 23:06:21 +0000
commite35405ce69dcb132de2c46876c855b7b02b49a2a (patch)
treedf518b61b5eef60b0627f20567c0c904e7f79770 /admin/catalog.php
parentef684b03c2713959fc3eaa04e38b5ba08cafd35c (diff)
downloadampache-e35405ce69dcb132de2c46876c855b7b02b49a2a.tar.gz
ampache-e35405ce69dcb132de2c46876c855b7b02b49a2a.tar.bz2
ampache-e35405ce69dcb132de2c46876c855b7b02b49a2a.zip
allow add or verify on a specified sub directory of an existing catalog
Diffstat (limited to 'admin/catalog.php')
-rw-r--r--admin/catalog.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/admin/catalog.php b/admin/catalog.php
index f60f6789..8445d2ed 100644
--- a/admin/catalog.php
+++ b/admin/catalog.php
@@ -173,10 +173,23 @@ switch ($_REQUEST['action']) {
break;
case 'update_from':
if (Config::get('demo_mode')) { break; }
+
// First see if we need to do an add
if ($_POST['add_path'] != '/' AND strlen($_POST['add_path'])) {
+ if ($catalog_id = Catalog::get_from_path($_POST['add_path'])) {
+ $catalog = new Catalog($catalog_id);
+ $catalog->run_add(array('subdirectory'=>$_POST['add_path']));
+ }
+ } // end if add
+
+ // Now check for an update
+ if ($_POST['update_path'] != '/' AND strlen($_POST['update_path'])) {
+ if ($catalog_id = Catalog::get_from_path($_POST['update_path'])) {
+ $songs = Song::get_from_path($_POST['update_path']);
+ foreach ($songs as $song_id) { Catalog::update_single_item('song',$song_id); }
+ }
+ } // end if update
- }
break;
case 'add_catalog':
/* Wah Demo! */
@@ -196,6 +209,11 @@ switch ($_REQUEST['action']) {
Error::add('general','Error Remote Catalog specified, but no key provided');
}
+ // Make sure that there isn't a catalog with a directory above this one
+ if (Catalog::get_from_path($_REQUEST['path'])) {
+ Error::add('general',_('Error: Defined Path is inside an existing catalog'));
+ }
+
// If an error hasn't occured
if (!Error::occurred()) {