diff options
author | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-03-14 20:14:52 +0000 |
---|---|---|
committer | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-03-14 20:14:52 +0000 |
commit | 1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc (patch) | |
tree | 54655ff3e692a71a17f1d37cd97374b263557ca1 /admin | |
parent | ef48bf3fbdca2a4d25f5d025f4c6ad23905e5369 (diff) | |
download | ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.gz ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.tar.bz2 ampache-1cb0983ed04c65e06d502ae2ac9ed6d5e31d70dc.zip |
Cosmetics: remove trailing whitespace
Diffstat (limited to 'admin')
-rw-r--r-- | admin/access.php | 164 | ||||
-rw-r--r-- | admin/catalog.php | 186 | ||||
-rw-r--r-- | admin/duplicates.php | 14 | ||||
-rw-r--r-- | admin/export.php | 34 | ||||
-rw-r--r-- | admin/flag.php | 204 | ||||
-rw-r--r-- | admin/index.php | 18 | ||||
-rw-r--r-- | admin/mail.php | 28 | ||||
-rw-r--r-- | admin/modules.php | 116 | ||||
-rw-r--r-- | admin/shout.php | 26 | ||||
-rw-r--r-- | admin/system.php | 28 | ||||
-rw-r--r-- | admin/users.php | 114 |
11 files changed, 466 insertions, 466 deletions
diff --git a/admin/access.php b/admin/access.php index a6ea8dd1..0c35b4fc 100644 --- a/admin/access.php +++ b/admin/access.php @@ -22,127 +22,127 @@ require '../lib/init.php'; -if (!Access::check('interface','100')) { +if (!Access::check('interface','100')) { access_denied(); exit(); } -show_header(); +show_header(); -switch ($_REQUEST['action']) { +switch ($_REQUEST['action']) { case 'delete_record': - if (!Core::form_verify('delete_access')) { - access_denied(); - exit; - } + if (!Core::form_verify('delete_access')) { + access_denied(); + exit; + } Access::delete($_REQUEST['access_id']); $url = Config::get('web_path') . '/admin/access.php'; show_confirmation(_('Deleted'),_('Your Access List Entry has been removed'),$url); break; - case 'show_delete_record': - if (Config::get('demo_mode')) { break; } - $access = new Access($_GET['access_id']); + case 'show_delete_record': + if (Config::get('demo_mode')) { break; } + $access = new Access($_GET['access_id']); show_confirmation(_('Deletion Request'),_('Are you sure you want to permanently delete') . ' ' . $access->name, - 'admin/access.php?action=delete_record&access_id=' . $access->id,1,'delete_access'); - break; + 'admin/access.php?action=delete_record&access_id=' . $access->id,1,'delete_access'); + break; case 'add_host': // Make sure we've got a valid form submission - if (!Core::form_verify('add_acl','post')) { - access_denied(); - exit; - } + if (!Core::form_verify('add_acl','post')) { + access_denied(); + exit; + } // We need to pre-process this a little bit as stuff is coming in from all over - switch ($_GET['method']) { - case 'advanced': - Access::create($_POST); - break; - case 'local': - $_POST['type'] = 'network'; - Access::create($_POST); - + switch ($_GET['method']) { + case 'advanced': + Access::create($_POST); + break; + case 'local': + $_POST['type'] = 'network'; + Access::create($_POST); + // Create Additional stuff based on the type - if ($_POST['addtype'] == 'streamnetwork' OR $_POST['addtype'] == 'allnetwork') { - $_POST['type'] = 'stream'; - Access::create($_POST); - } - if ($_POST['addtype'] == 'allnetwork') { - $_POST['type'] = 'interface'; - Access::create($_POST); - } - break; - case 'current': - $_POST['start'] = $_SERVER['REMOTE_ADDR']; - $_POST['end'] = $_SERVER['REMOTE_ADDR']; - $_POST['type'] = 'interface'; - Access::create($_POST); - $_POST['type'] = 'stream'; - Access::create($_POST); - break; - case 'rpc': + if ($_POST['addtype'] == 'streamnetwork' OR $_POST['addtype'] == 'allnetwork') { + $_POST['type'] = 'stream'; + Access::create($_POST); + } + if ($_POST['addtype'] == 'allnetwork') { + $_POST['type'] = 'interface'; + Access::create($_POST); + } + break; + case 'current': + $_POST['start'] = $_SERVER['REMOTE_ADDR']; + $_POST['end'] = $_SERVER['REMOTE_ADDR']; + $_POST['type'] = 'interface'; + Access::create($_POST); + $_POST['type'] = 'stream'; + Access::create($_POST); + break; + case 'rpc': $_POST['type'] = 'rpc'; - Access::create($_POST); + Access::create($_POST); // Create Additional stuff based on the type - if ($_POST['addtype'] == 'streamrpc' OR $_POST['addtype'] == 'allrpc') { - $_POST['type'] = 'stream'; - Access::create($_POST); + if ($_POST['addtype'] == 'streamrpc' OR $_POST['addtype'] == 'allrpc') { + $_POST['type'] = 'stream'; + Access::create($_POST); } - if ($_POST['addtype'] == 'allrpc') { - $_POST['type'] = 'interface'; - Access::create($_POST); - } - break; - default: + if ($_POST['addtype'] == 'allrpc') { + $_POST['type'] = 'interface'; + Access::create($_POST); + } + break; + default: // Do nothing they f'ed something up - break; + break; } // end switch on method - if (!Error::occurred()) { + if (!Error::occurred()) { $url = Config::get('web_path') . '/admin/access.php'; show_confirmation(_('Added'),_('Your new Access Control List(s) have been created'),$url); - } - else { - switch ($_GET['method']) { + } + else { + switch ($_GET['method']) { case 'rpc': require_once Config::get('prefix') . '/templates/show_add_access_rpc.inc.php'; break; - case 'local': require_once Config::get('prefix') . '/templates/show_add_access_local.inc.php'; break; + case 'local': require_once Config::get('prefix') . '/templates/show_add_access_local.inc.php'; break; case 'current': require_once Config::get('prefix') . '/templates/show_add_access_current.inc.php'; break; - case 'advanced': require_once Config::get('prefix') . '/templates/show_add_access.inc.php'; break; - default: require_once Config::get('prefix') . '/templates/show_access_list.inc.php'; break; - } - } + case 'advanced': require_once Config::get('prefix') . '/templates/show_add_access.inc.php'; break; + default: require_once Config::get('prefix') . '/templates/show_access_list.inc.php'; break; + } + } break; case 'update_record': - if (!Core::form_verify('edit_acl')) { - access_denied(); - exit; - } - $access = new Access($_REQUEST['access_id']); + if (!Core::form_verify('edit_acl')) { + access_denied(); + exit; + } + $access = new Access($_REQUEST['access_id']); $access->update($_POST); - if (!Error::occurred()) { + if (!Error::occurred()) { show_confirmation(_('Updated'),_('Access List Entry updated'), Config::get('web_path').'/admin/access.php'); - } - else { - $access->format(); - require_once Config::get('prefix') . '/templates/show_edit_access.inc.php'; } + else { + $access->format(); + require_once Config::get('prefix') . '/templates/show_edit_access.inc.php'; + } + break; + case 'show_add_current': + require_once Config::get('prefix') . '/templates/show_add_access_current.inc.php'; + break; + case 'show_add_rpc': + require_once Config::get('prefix') . '/templates/show_add_access_rpc.inc.php'; + break; + case 'show_add_local': + require_once Config::get('prefix') . '/templates/show_add_access_local.inc.php'; break; - case 'show_add_current': - require_once Config::get('prefix') . '/templates/show_add_access_current.inc.php'; - break; - case 'show_add_rpc': - require_once Config::get('prefix') . '/templates/show_add_access_rpc.inc.php'; - break; - case 'show_add_local': - require_once Config::get('prefix') . '/templates/show_add_access_local.inc.php'; - break; case 'show_add_advanced': require_once Config::get('prefix') . '/templates/show_add_access.inc.php'; break; case 'show_edit_record': $access = new Access($_REQUEST['access_id']); - $access->format(); + $access->format(); require_once Config::get('prefix') . '/templates/show_edit_access.inc.php'; break; default: diff --git a/admin/catalog.php b/admin/catalog.php index 7dcc0f10..9dee29eb 100644 --- a/admin/catalog.php +++ b/admin/catalog.php @@ -25,10 +25,10 @@ require_once '../lib/init.php'; if (!Access::check('interface','100')) { access_denied(); - exit; + exit; } -show_header(); +show_header(); /* Big switch statement to handle various actions */ switch ($_REQUEST['action']) { @@ -42,8 +42,8 @@ switch ($_REQUEST['action']) { $catalog = new Catalog(); $_REQUEST['catalogs'] = $catalog->get_catalog_ids(); case 'add_to_catalog': - toggle_visible('ajax-loading'); - ob_end_flush(); + toggle_visible('ajax-loading'); + ob_end_flush(); if (Config::get('demo_mode')) { break; } if ($_REQUEST['catalogs'] ) { foreach ($_REQUEST['catalogs'] as $catalog_id) { @@ -55,19 +55,19 @@ switch ($_REQUEST['action']) { $title = _('Catalog Updated'); $body = ''; show_confirmation($title,$body,$url); - toggle_visible('ajax-loading'); + toggle_visible('ajax-loading'); break; case 'update_all_catalogs': $_REQUEST['catalogs'] = Catalog::get_catalog_ids(); case 'update_catalog': - toggle_visible('ajax-loading'); - ob_end_flush(); + toggle_visible('ajax-loading'); + ob_end_flush(); /* If they are in demo mode stop here */ if (Config::get('demo_mode')) { break; } if (isset($_REQUEST['catalogs'])) { foreach ($_REQUEST['catalogs'] as $catalog_id) { - $catalog = new Catalog($catalog_id); + $catalog = new Catalog($catalog_id); $catalog->verify_catalog($catalog_id); } } @@ -75,59 +75,59 @@ switch ($_REQUEST['action']) { $title = _('Catalog Updated'); $body = ''; show_confirmation($title,$body,$url); - toggle_visible('ajax-loading'); + toggle_visible('ajax-loading'); break; case 'full_service': - toggle_visible('ajax-loading'); - ob_end_flush(); + toggle_visible('ajax-loading'); + ob_end_flush(); /* Make sure they aren't in demo mode */ - if (Config::get('demo_mode')) { access_denied(); break; } + if (Config::get('demo_mode')) { access_denied(); break; } - if (!$_REQUEST['catalogs']) { + if (!$_REQUEST['catalogs']) { $_REQUEST['catalogs'] = Catalog::get_catalog_ids(); } /* This runs the clean/verify/add in that order */ - foreach ($_REQUEST['catalogs'] as $catalog_id) { + foreach ($_REQUEST['catalogs'] as $catalog_id) { $catalog = new Catalog($catalog_id); $catalog->clean_catalog($catalog_id); $catalog->count = 0; $catalog->verify_catalog($catalog_id); $catalog->count = 0; $catalog->add_to_catalog($catalog_id); - } + } $url = Config::get('web_path') . '/admin/catalog.php'; $title = _('Catalog Updated'); $body = ''; show_confirmation($title,$body,$url); - toggle_visible('ajax-loading'); + toggle_visible('ajax-loading'); break; case 'delete_catalog': /* Make sure they aren't in demo mode */ if (Config::get('demo_mode')) { break; } - if (!Core::form_verify('delete_catalog')) { - access_denied(); - exit; - } - + if (!Core::form_verify('delete_catalog')) { + access_denied(); + exit; + } + /* Delete the sucker, we don't need to check perms as thats done above */ - Catalog::delete($_GET['catalog_id']); + Catalog::delete($_GET['catalog_id']); $next_url = Config::get('web_path') . '/admin/catalog.php'; show_confirmation(_('Catalog Deleted'),_('The Catalog and all associated records have been deleted'),$next_url); break; - case 'show_delete_catalog': - $catalog_id = scrub_in($_GET['catalog_id']); + case 'show_delete_catalog': + $catalog_id = scrub_in($_GET['catalog_id']); - $next_url = Config::get('web_path') . '/admin/catalog.php?action=delete_catalog&catalog_id=' . scrub_out($catalog_id); - show_confirmation(_('Catalog Delete'),_('Confirm Deletion Request'),$next_url,1,'delete_catalog'); - break; + $next_url = Config::get('web_path') . '/admin/catalog.php?action=delete_catalog&catalog_id=' . scrub_out($catalog_id); + show_confirmation(_('Catalog Delete'),_('Confirm Deletion Request'),$next_url,1,'delete_catalog'); + break; case 'remove_disabled': if (conf('demo_mode')) { break; } $song = $_REQUEST['song']; - if (count($song)) { + if (count($song)) { $catalog->remove_songs($song); $body = ngettext('Song Removed', 'Songs Removed', count($song)); } @@ -139,27 +139,27 @@ switch ($_REQUEST['action']) { show_confirmation($title,$body,$url); break; case 'clean_all_catalogs': - $catalog = new Catalog(); + $catalog = new Catalog(); $_REQUEST['catalogs'] = Catalog::get_catalog_ids(); case 'clean_catalog': - toggle_visible('ajax-loading'); - ob_end_flush(); + toggle_visible('ajax-loading'); + ob_end_flush(); /* If they are in demo mode stop them here */ if (Config::get('demo_mode')) { break; } - + // Make sure they checked something - if (isset($_REQUEST['catalogs'])) { - foreach($_REQUEST['catalogs'] as $catalog_id) { + if (isset($_REQUEST['catalogs'])) { + foreach($_REQUEST['catalogs'] as $catalog_id) { $catalog = new Catalog($catalog_id); $catalog->clean_catalog(0,1); } // end foreach catalogs } - + $url = Config::get('web_path') . '/admin/catalog.php'; $title = _('Catalog Cleaned'); $body = ''; show_confirmation($title,$body,$url); - toggle_visible('ajax-loading'); + toggle_visible('ajax-loading'); break; case 'update_catalog_settings': /* No Demo Here! */ @@ -167,82 +167,82 @@ switch ($_REQUEST['action']) { /* Update the catalog */ Catalog::update_settings($_REQUEST); - + $url = Config::get('web_path') . '/admin/catalog.php'; $title = _('Catalog Updated'); $body = ''; show_confirmation($title,$body,$url); break; - case 'update_from': - if (Config::get('demo_mode')) { 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'])); - } + 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); } - } + 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; + break; case 'add_catalog': /* Wah Demo! */ if (Config::get('demo_mode')) { break; } - ob_end_flush(); + ob_end_flush(); - if (!strlen($_POST['path']) || !strlen($_POST['name'])) { - Error::add('general',_('Error: Name and path not specified')); - } + if (!strlen($_POST['path']) || !strlen($_POST['name'])) { + Error::add('general',_('Error: Name and path not specified')); + } - if (substr($_POST['path'],0,7) != 'http://' && $_POST['type'] == 'remote') { + if (substr($_POST['path'],0,7) != 'http://' && $_POST['type'] == 'remote') { Error::add('general',_('Error: Remote selected, but path is not a URL')); - } - - if ($_POST['type'] == 'remote' && !strlen($_POST['key'])) { + } + + if ($_POST['type'] == 'remote' && !strlen($_POST['key'])) { Error::add('general',_('Error: Remote Catalog specified, but no key provided')); - } + } - if (!Core::form_verify('add_catalog','post')) { - access_denied(); - exit; - } + if (!Core::form_verify('add_catalog','post')) { + access_denied(); + exit; + } // Make sure that there isn't a catalog with a directory above this one - if (Catalog::get_from_path($_POST['path'])) { + if (Catalog::get_from_path($_POST['path'])) { Error::add('general',_('Error: Defined Path is inside an existing catalog')); - } + } // If an error hasn't occured - if (!Error::occurred()) { + if (!Error::occurred()) { - $catalog_id = Catalog::Create($_POST); + $catalog_id = Catalog::Create($_POST); - if (!$catalog_id) { - require Config::get('prefix') . '/templates/show_add_catalog.inc.php'; - break; + if (!$catalog_id) { + require Config::get('prefix') . '/templates/show_add_catalog.inc.php'; + break; } - $catalog = new Catalog($catalog_id); + $catalog = new Catalog($catalog_id); // Run our initial add - $catalog->run_add($_POST); + $catalog->run_add($_POST); - show_box_top(); + show_box_top(); echo "<h2>" . _('Catalog Created') . "</h2>"; - Error::display('general'); - Error::display('catalog_add'); - show_box_bottom(); + Error::display('general'); + Error::display('catalog_add'); + show_box_bottom(); - show_confirmation('','', Config::get('web_path').'/admin/catalog.php'); + show_confirmation('','', Config::get('web_path').'/admin/catalog.php'); } else { @@ -251,16 +251,16 @@ switch ($_REQUEST['action']) { break; case 'clear_stats': if (Config::get('demo_mode')) { access_denied(); break; } - - Catalog::clear_stats(); + + Catalog::clear_stats(); $url = Config::get('web_path') . '/admin/catalog.php'; $title = _('Catalog statistics cleared'); $body = ''; show_confirmation($title,$body,$url); break; - default: - case 'show_catalogs': - require_once Config::get('prefix') . '/templates/show_manage_catalogs.inc.php'; + default: + case 'show_catalogs': + require_once Config::get('prefix') . '/templates/show_manage_catalogs.inc.php'; break; case 'show_add_catalog': require Config::get('prefix') . '/templates/show_add_catalog.inc.php'; @@ -273,9 +273,9 @@ switch ($_REQUEST['action']) { case 'show_disabled': /* Stop the demo hippies */ if (conf('demo_mode')) { break; } - + $songs = $catalog->get_disabled(); - if (count($songs)) { + if (count($songs)) { require (conf('prefix') . '/templates/show_disabled_songs.inc.php'); } else { @@ -284,27 +284,27 @@ switch ($_REQUEST['action']) { break; case 'show_delete_catalog': /* Stop the demo hippies */ - if (Config::get('demo_mode')) { access_denied(); break; } + if (Config::get('demo_mode')) { access_denied(); break; } - $catalog = new Catalog($_REQUEST['catalog_id']); + $catalog = new Catalog($_REQUEST['catalog_id']); $nexturl = Config::get('web_path') . '/admin/catalog.php?action=delete_catalog&catalog_id=' . scrub_out($_REQUEST['catalog_id']); show_confirmation(_('Delete Catalog'),_('Do you really want to delete this catalog?') . " -- $catalog->name ($catalog->path)",$nexturl,1); break; case 'show_customize_catalog': - $catalog = new Catalog($_REQUEST['catalog_id']); + $catalog = new Catalog($_REQUEST['catalog_id']); require_once Config::get('prefix') . '/templates/show_edit_catalog.inc.php'; break; case 'gather_album_art': - toggle_visible('ajax-loading'); - ob_end_flush(); + toggle_visible('ajax-loading'); + ob_end_flush(); $catalogs = $_REQUEST['catalogs'] ? $_REQUEST['catalogs'] : Catalog::get_catalogs(); // Itterate throught the catalogs and gather as needed - foreach ($catalogs as $catalog_id) { + foreach ($catalogs as $catalog_id) { $catalog = new Catalog($catalog_id); - require Config::get('prefix') . '/templates/show_gather_art.inc.php'; - flush(); + require Config::get('prefix') . '/templates/show_gather_art.inc.php'; + flush(); $catalog->get_album_art('',1); } $url = Config::get('web_path') . '/admin/catalog.php'; diff --git a/admin/duplicates.php b/admin/duplicates.php index d61f5170..e2f82815 100644 --- a/admin/duplicates.php +++ b/admin/duplicates.php @@ -22,22 +22,22 @@ require_once '../lib/init.php'; -if (!Access::check('interface','100')) { - access_denied(); +if (!Access::check('interface','100')) { + access_denied(); exit; } -show_header(); +show_header(); /* Switch on Action */ switch ($_REQUEST['action']) { case 'find_duplicates': - $duplicates = Catalog::get_duplicate_songs($_REQUEST['search_type']); - require_once Config::get('prefix') . '/templates/show_duplicate.inc.php'; - require_once Config::get('prefix') . '/templates/show_duplicates.inc.php'; + $duplicates = Catalog::get_duplicate_songs($_REQUEST['search_type']); + require_once Config::get('prefix') . '/templates/show_duplicate.inc.php'; + require_once Config::get('prefix') . '/templates/show_duplicates.inc.php'; break; default: - require_once Config::get('prefix') . '/templates/show_duplicate.inc.php'; + require_once Config::get('prefix') . '/templates/show_duplicate.inc.php'; break; } // end switch on action diff --git a/admin/export.php b/admin/export.php index 4e423647..7b22cd8c 100644 --- a/admin/export.php +++ b/admin/export.php @@ -22,24 +22,24 @@ require_once '../lib/init.php'; -if (!Access::check('interface','100')) { - access_denied(); +if (!Access::check('interface','100')) { + access_denied(); exit; } -show_header(); +show_header(); /* Switch on Action */ switch ($_REQUEST['action']) { case 'export': - + // This may take a while - set_time_limit(0); - + set_time_limit(0); + $catalog = new Catalog($_REQUEST['export_catalog']); // Clear everything we've done so far - ob_end_clean(); + ob_end_clean(); // This will disable buffering so contents are sent immediately to browser. // This is very useful for large catalogs because it will immediately display the download dialog to user, @@ -49,7 +49,7 @@ switch ($_REQUEST['action']) { header("Content-Transfer-Encoding: binary"); header("Cache-control: public"); - $date = date("d/m/Y",time()); + $date = date("d/m/Y",time()); switch($_REQUEST['export_format']) { case 'itunes': @@ -57,19 +57,19 @@ switch ($_REQUEST['action']) { header("Content-Disposition: attachment; filename=\"ampache-itunes-$date.xml\""); $catalog->export('itunes'); break; - case 'csv': - header("Content-Type: application/vnd.ms-excel"); - header("Content-Disposition: filename=\"ampache-export-$date.csv\""); - $catalog->export('csv'); - break; - } // end switch on format + case 'csv': + header("Content-Type: application/vnd.ms-excel"); + header("Content-Disposition: filename=\"ampache-export-$date.csv\""); + $catalog->export('csv'); + break; + } // end switch on format // We don't want the footer so we're done here - exit; - + exit; + break; default: - require_once Config::get('prefix') . '/templates/show_export.inc.php'; + require_once Config::get('prefix') . '/templates/show_export.inc.php'; break; } // end switch on action diff --git a/admin/flag.php b/admin/flag.php index 79d9c81b..1d419421 100644 --- a/admin/flag.php +++ b/admin/flag.php @@ -21,52 +21,52 @@ */ require '../lib/init.php'; -if (!Access::check('interface','100')) { +if (!Access::check('interface','100')) { access_denied(); exit(); } -show_header(); +show_header(); switch ($_REQUEST['action']) { case 'edit_song': $catalog = new Catalog(); $song = new Song($_REQUEST['song_id']); $new_song = new Song(); - - /* Setup the vars so we can use the update_song function */ + + /* Setup the vars so we can use the update_song function */ $new_song->title = revert_string(scrub_in($_REQUEST['title'])); $new_song->track = revert_string(scrub_in($_REQUEST['track'])); $new_song->year = revert_string(scrub_in($_REQUEST['year'])); $new_song->comment = revert_string(scrub_in($_REQUEST['comment'])); /* If no change in string take Drop down */ - if (strcasecmp(stripslashes($_REQUEST['genre_string']),$song->get_genre_name()) == 0) { + if (strcasecmp(stripslashes($_REQUEST['genre_string']),$song->get_genre_name()) == 0) { $genre = $song->get_genre_name($_REQUEST['genre']); } - else { + else { $genre = scrub_in($_REQUEST['genre_string']); } - - if (strcasecmp(stripslashes($_REQUEST['album_string']),$song->get_album_name()) == 0) { + + if (strcasecmp(stripslashes($_REQUEST['album_string']),$song->get_album_name()) == 0) { $album = $song->get_album_name($_REQUEST['album']); } - else { + else { $album = scrub_in($_REQUEST['album_string']); } - - if (strcasecmp(stripslashes($_REQUEST['artist_string']),$song->get_artist_name()) == 0) { + + if (strcasecmp(stripslashes($_REQUEST['artist_string']),$song->get_artist_name()) == 0) { $artist = $song->get_artist_name($_REQUEST['artist']); } - else { + else { $artist = scrub_in($_REQUEST['artist_string']); } - + /* Use the check functions to get / create ids for this info */ $new_song->genre = $catalog->check_genre(revert_string($genre)); $new_song->album = $catalog->check_album(revert_string($album)); $new_song->artist = $catalog->check_artist(revert_string($artist)); - + /* Update this mofo, store an old copy for cleaning */ $old_song = new Song(); $old_song->artist = $song->artist; @@ -75,129 +75,129 @@ switch ($_REQUEST['action']) { $song->update_song($song->id,$new_song); /* Now that it's been updated clean old junk entries */ - $catalog = new Catalog(); + $catalog = new Catalog(); $cleaned = $catalog->clean_single_song($old_song); - + /* Add a tagging record of this so we can fix the file */ - if ($_REQUEST['flag']) { + if ($_REQUEST['flag']) { $flag = new Flag(); $flag->add($song->id,'song','retag','Edited Song, auto-tag'); } - if (isset($cleaned['artist']) || isset($cleaned['album'])) { $_SESSION['source'] = Config::get('web_path') . '/index.php'; } - + if (isset($cleaned['artist']) || isset($cleaned['album'])) { $_SESSION['source'] = Config::get('web_path') . '/index.php'; } + show_confirmation(_('Song Updated'),_('The requested song has been updated'),$_SESSION['source']); break; // Show the page for editing a full album case 'show_edit_album': - $album = new Album($_REQUEST['album_id']); - - require_once(conf('prefix') . '/templates/show_edit_album.inc.php'); + $album = new Album($_REQUEST['album_id']); + + require_once(conf('prefix') . '/templates/show_edit_album.inc.php'); break; // Update all songs from this album case 'edit_album': - - // Build the needed album - $album = new Album($_REQUEST['album_id']); - // Create the needed catalog object cause we can't do - // static class methods :( - $catalog = new Catalog(); - $flag = new Flag(); + // Build the needed album + $album = new Album($_REQUEST['album_id']); + + // Create the needed catalog object cause we can't do + // static class methods :( + $catalog = new Catalog(); + $flag = new Flag(); /* Check the new Name */ - $album_id = $catalog->check_album($_REQUEST['name'],$_REQUEST['year']); + $album_id = $catalog->check_album($_REQUEST['name'],$_REQUEST['year']); - $songs = $album->get_songs(); + $songs = $album->get_songs(); - foreach ($songs as $song) { - // Make that copy and change the album + foreach ($songs as $song) { + // Make that copy and change the album $new_song = $song; $new_song->album = $album_id; $song->update_song($song->id,$new_song); - if ($_REQUEST['flag'] == '1') { + if ($_REQUEST['flag'] == '1') { $flag->add($song->id,'song','retag','Edited Song, auto-tag'); - } + } } // end foreach songs - // Clean out the old album + // Clean out the old album $catalog->clean_albums(); - show_confirmation(_('Album Updated'),'',Config::get('web_path') . '/admin/index.php'); + show_confirmation(_('Album Updated'),'',Config::get('web_path') . '/admin/index.php'); break; // Show the page for editing a full artist case 'show_edit_artist': - $artist = new Artist($_REQUEST['artist_id']); + $artist = new Artist($_REQUEST['artist_id']); - require_once(conf('prefix') . '/templates/show_edit_artist.inc.php'); + require_once(conf('prefix') . '/templates/show_edit_artist.inc.php'); break; // Update all songs by this artist case 'edit_artist': // Build the needed artist - $artist = new Artist($_REQUEST['artist_id']); + $artist = new Artist($_REQUEST['artist_id']); // Create the needed objects, a pox on PHP4 - $catalog = new Catalog(); - $flag = new Flag(); + $catalog = new Catalog(); + $flag = new Flag(); /* Check the new Name */ - $artist_id = $catalog->check_artist($_REQUEST['name']); + $artist_id = $catalog->check_artist($_REQUEST['name']); - $songs = $artist->get_songs(); + $songs = $artist->get_songs(); - foreach ($songs as $song) { + foreach ($songs as $song) { // Make that copy and change the artist - $new_song = $song; - $new_song->artist = $artist_id; - - $song->update_song($song->id,$new_song); + $new_song = $song; + $new_song->artist = $artist_id; - if ($_REQUEST['flag'] == '1') { - $flag->add($song->id,'song','retag','Edited Song, auto-tag'); - } + $song->update_song($song->id,$new_song); + + if ($_REQUEST['flag'] == '1') { + $flag->add($song->id,'song','retag','Edited Song, auto-tag'); + } } // end foreach songs // Clean out the old artist(s) - $catalog->clean_artists(); + $catalog->clean_artists(); show_confirmation(_('Artist Updated'),'',Config::get('web_path') . '/admin/index.php'); - break; + break; /* Done by 'Select' code passes array of song ids */ - case 'mass_update': - $songs = $_REQUEST['song']; + case 'mass_update': + $songs = $_REQUEST['song']; $catalog = new Catalog(); - $object = $_REQUEST['update_field']; - $flag = new Flag(); + $object = $_REQUEST['update_field']; + $flag = new Flag(); /* If this is an album we need to pull the songs */ - if ($_REQUEST['type'] == 'album') { + if ($_REQUEST['type'] == 'album') { - // Define the results array - $results = array(); + // Define the results array + $results = array(); - foreach ($songs as $album_id) { - $album = new Album($album_id); - $results = array_merge($results,$album->get_song_ids()); + foreach ($songs as $album_id) { + $album = new Album($album_id); + $results = array_merge($results,$album->get_song_ids()); } // end foreach albums - // Re-assign the variable... HACK ALERT :( - $songs = $results; + // Re-assign the variable... HACK ALERT :( + $songs = $results; - } // is album + } // is album /* Foreach the songs we need to update */ - foreach ($songs as $song_id) { + foreach ($songs as $song_id) { $new_song = new Song($song_id); $old_song = new Song(); @@ -206,21 +206,21 @@ switch ($_REQUEST['action']) { $old_song->genre = $new_song->genre; /* Restrict which fields can be updated */ - switch ($object) { - case 'genre': - $new_song->genre = $catalog->check_genre(revert_string($_REQUEST['update_value'])); + switch ($object) { + case 'genre': + $new_song->genre = $catalog->check_genre(revert_string($_REQUEST['update_value'])); break; case 'album': - $new_song->album = $catalog->check_album(revert_string($_REQUEST['update_value'])); + $new_song->album = $catalog->check_album(revert_string($_REQUEST['update_value'])); break; case 'artist': - $new_song->artist = $catalog->check_artist(revert_string($_REQUEST['update_value'])); - break; + $new_song->artist = $catalog->check_artist(revert_string($_REQUEST['update_value'])); + break; case 'year': - $new_song->year = intval($_REQUEST['update_value']); + $new_song->year = intval($_REQUEST['update_value']); break; - default: - // Rien a faire + default: + // Rien a faire break; } // end switch @@ -235,14 +235,14 @@ switch ($_REQUEST['action']) { } // end foreach songs // Show a confirmation that this worked - show_confirmation(_('Songs Updated'),'',return_referer()); - break; + show_confirmation(_('Songs Updated'),'',return_referer()); + break; case 'reject_flag': $flag_id = scrub_in($_REQUEST['flag_id']); $flag = new Flag($flag_id); - $flag->delete_flag(); + $flag->delete_flag(); $flag->format_name(); - $url = return_referer(); + $url = return_referer(); $title = _('Flag Removed'); $body = _('Flag Removed from') . " " . $flag->name; show_confirmation($title,$body,$url); @@ -250,22 +250,22 @@ switch ($_REQUEST['action']) { case 'reject_flags': $flags = $_REQUEST['song']; - foreach ($flags as $flag_id) { - $flag = new Flag($flag_id); - if ($_REQUEST['update_action'] == 'reject') { - $flag->delete_flag(); - } - else { - $flag->approve(); - } + foreach ($flags as $flag_id) { + $flag = new Flag($flag_id); + if ($_REQUEST['update_action'] == 'reject') { + $flag->delete_flag(); + } + else { + $flag->approve(); + } } // end foreach flags - $title = _('Flags Updated'); - show_confirmation($title,'',return_referer()); + $title = _('Flags Updated'); + show_confirmation($title,'',return_referer()); break; case 'show_edit_song': $_SESSION['source'] = return_referer(); $song = new Song($_REQUEST['song']); - $song->fill_ext_info(); + $song->fill_ext_info(); $song->format_song(); require_once (conf('prefix') . '/templates/show_edit_song.inc.php'); break; @@ -291,20 +291,20 @@ switch ($_REQUEST['action']) { } // end else show_confirmation(_('Songs Enabled'),_('The requested song(s) have been enabled'),return_referer()); break; - case 'show_disabled': - $disabled = Flag::get_disabled(); - Browse::set_type('song'); - Browse::set_static_content(1); - Browse::save_objects($disabled); - Browse::show_objects($disabled); - break; + case 'show_disabled': + $disabled = Flag::get_disabled(); + Browse::set_type('song'); + Browse::set_static_content(1); + Browse::save_objects($disabled); + Browse::show_objects($disabled); + break; default: case 'show_flagged': $flagged = Flag::get_all(); - Flag::build_cache($flagged); - Browse::set_type('flagged'); + Flag::build_cache($flagged); + Browse::set_type('flagged'); Browse::set_static_content(1); - Browse::save_objects($flagged); + Browse::save_objects($flagged); Browse::show_objects($flagged); break; } // end switch diff --git a/admin/index.php b/admin/index.php index 24f358ad..ccb77661 100644 --- a/admin/index.php +++ b/admin/index.php @@ -22,21 +22,21 @@ require '../lib/init.php'; -if (!Access::check('interface',100)) { +if (!Access::check('interface',100)) { access_denied(); exit(); } -show_header(); +show_header(); -switch ($_REQUEST['action']) { - default: +switch ($_REQUEST['action']) { + default: // Show Catalogs - $catalog_ids = Catalog::get_catalogs(); - Browse::set_type('catalog'); - Browse::show_objects($catalog_ids); + $catalog_ids = Catalog::get_catalogs(); + Browse::set_type('catalog'); + Browse::show_objects($catalog_ids); break; -} +} -show_footer(); +show_footer(); ?> diff --git a/admin/mail.php b/admin/mail.php index e1eaf0c2..18bcb100 100644 --- a/admin/mail.php +++ b/admin/mail.php @@ -22,20 +22,20 @@ require_once '../lib/init.php'; -if (!Access::check('interface','75')) { +if (!Access::check('interface','75')) { access_denied(); exit(); } -show_header(); +show_header(); // Action switch -switch ($_REQUEST['action']) { +switch ($_REQUEST['action']) { case 'send_mail': - if (Config::get('demo_mode')) { - access_denied(); + if (Config::get('demo_mode')) { + access_denied(); exit; - } + } // Multi-byte Character Mail if(function_exists('mb_language')) { @@ -43,21 +43,21 @@ switch ($_REQUEST['action']) { mb_language("uni"); } - $clients = AmpacheMail::get_users($_REQUEST['to']); + $clients = AmpacheMail::get_users($_REQUEST['to']); - foreach ($clients as $client) { + foreach ($clients as $client) { if(function_exists('mb_encode_mimeheader')) { $recipient .= mb_encode_mimeheader($client['fullname']) ." <" . $client['email'] . ">, "; } else { $recipient .= $client['fullname'] ." <" . $client['email'] . ">, "; } } - + // Remove the last , from the recipient $recipient = rtrim($recipient,", "); - + // Set the vars on the object - AmpacheMail::$recipient = $recipient; + AmpacheMail::$recipient = $recipient; if(function_exists('mb_encode_mimeheader')) { AmpacheMail::$fullname = mb_encode_mimeheader($GLOBALS['user']->fullname); } else { @@ -77,16 +77,16 @@ switch ($_REQUEST['action']) { /* Confirmation Send */ $url = Config::get('web_path') . '/admin/mail.php'; - $title = _('E-mail Sent'); + $title = _('E-mail Sent'); $body = _('Your E-mail was successfully sent.'); show_confirmation($title,$body,$url); break; - default: + default: require_once Config::get('prefix') . '/templates/show_mail_users.inc.php'; break; } // end switch -show_footer(); +show_footer(); ?> diff --git a/admin/modules.php b/admin/modules.php index 5f3270d1..fd1e14b9 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -30,40 +30,40 @@ if (!$GLOBALS['user']->has_access(100)) { /* Always show the header */ -show_header(); - -switch ($_REQUEST['action']) { - case 'install_localplay': - $localplay = new Localplay($_REQUEST['type']); - if (!$localplay->player_loaded()) { - Error::add('general',_('Install Failed, Controller Error')); - Error::display('general'); +show_header(); + +switch ($_REQUEST['action']) { + case 'install_localplay': + $localplay = new Localplay($_REQUEST['type']); + if (!$localplay->player_loaded()) { + Error::add('general',_('Install Failed, Controller Error')); + Error::display('general'); break; - } + } // Install it! - $localplay->install(); + $localplay->install(); // Go ahead and enable Localplay (Admin->System) as we assume they want to do that // if they are enabling this - Preference::update('allow_localplay_playback','-1','1'); - Preference::update('localplay_level',$GLOBALS['user']->id,'100'); + Preference::update('allow_localplay_playback','-1','1'); + Preference::update('localplay_level',$GLOBALS['user']->id,'100'); Preference::update('localplay_controller',$GLOBALS['user']->id,$localplay->type); - header("Location:" . Config::get('web_path') . '/admin/modules.php?action=show_localplay'); + header("Location:" . Config::get('web_path') . '/admin/modules.php?action=show_localplay'); break; - case 'confirm_uninstall_localplay': - $type = scrub_in($_REQUEST['type']); - $url = Config::get('web_path') . '/admin/modules.php?action=uninstall_localplay&type=' . $type; - $title = _('Are you sure you want to remove this plugin?'); - $body = ''; - show_confirmation($title,$body,$url,1); + case 'confirm_uninstall_localplay': + $type = scrub_in($_REQUEST['type']); + $url = Config::get('web_path') . '/admin/modules.php?action=uninstall_localplay&type=' . $type; + $title = _('Are you sure you want to remove this plugin?'); + $body = ''; + show_confirmation($title,$body,$url,1); break; - case 'uninstall_localplay': - $type = scrub_in($_REQUEST['type']); + case 'uninstall_localplay': + $type = scrub_in($_REQUEST['type']); + + $localplay = new Localplay($type); + $localplay->uninstall(); - $localplay = new Localplay($type); - $localplay->uninstall(); - /* Show Confirmation */ $url = Config::get('web_path') . '/admin/modules.php?action=show_localplay'; $title = _('Plugin Deactivated'); @@ -72,49 +72,49 @@ switch ($_REQUEST['action']) { break; case 'install_plugin': /* Verify that this plugin exists */ - $plugins = Plugin::get_plugins(); - if (!array_key_exists($_REQUEST['plugin'],$plugins)) { - debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1'); + $plugins = Plugin::get_plugins(); + if (!array_key_exists($_REQUEST['plugin'],$plugins)) { + debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1'); break; } - $plugin = new Plugin($_REQUEST['plugin']); - if (!$plugin->install()) { - debug_event('plugins','Error: Plugin Install Failed, ' . $_REQUEST['plugin'],'1'); + $plugin = new Plugin($_REQUEST['plugin']); + if (!$plugin->install()) { + debug_event('plugins','Error: Plugin Install Failed, ' . $_REQUEST['plugin'],'1'); $url = Config::get('web_path') . '/admin/modules.php?action=show_plugins'; - $title = _('Unable to Install Plugin'); - $body = ''; - show_confirmation($title,$body,$url); - break; - } + $title = _('Unable to Install Plugin'); + $body = ''; + show_confirmation($title,$body,$url); + break; + } // Don't trust the plugin to this stuff - User::rebuild_all_preferences(); - + User::rebuild_all_preferences(); + /* Show Confirmation */ $url = Config::get('web_path') . '/admin/modules.php?action=show_plugins'; - $title = _('Plugin Activated'); + $title = _('Plugin Activated'); $body = ''; - show_confirmation($title,$body,$url); + show_confirmation($title,$body,$url); break; case 'confirm_uninstall_plugin': - $plugin = scrub_in($_REQUEST['plugin']); + $plugin = scrub_in($_REQUEST['plugin']); $url = Config::get('web_path') . '/admin/modules.php?action=uninstall_plugin&plugin=' . $plugin; - $title = _('Are you sure you want to remove this plugin?'); + $title = _('Are you sure you want to remove this plugin?'); $body = ''; - show_confirmation($title,$body,$url,1); - break; + show_confirmation($title,$body,$url,1); + break; case 'uninstall_plugin': /* Verify that this plugin exists */ - $plugins = Plugin::get_plugins(); + $plugins = Plugin::get_plugins(); if (!array_key_exists($_REQUEST['plugin'],$plugins)) { debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1'); break; } $plugin = new Plugin($_REQUEST['plugin']); - $plugin->uninstall(); + $plugin->uninstall(); // Don't trust the plugin to do it - User::rebuild_all_preferences(); + User::rebuild_all_preferences(); /* Show Confirmation */ $url = Config::get('web_path') . '/admin/modules.php?action=show_plugins'; @@ -125,23 +125,23 @@ switch ($_REQUEST['action']) { case 'upgrade_plugin': break; - case 'show_plugins': - $plugins = Plugin::get_plugins(); - show_box_top(_('Plugins')); - require_once Config::get('prefix') . '/templates/show_plugins.inc.php'; - show_box_bottom(); + case 'show_plugins': + $plugins = Plugin::get_plugins(); + show_box_top(_('Plugins')); + require_once Config::get('prefix') . '/templates/show_plugins.inc.php'; + show_box_bottom(); break; - case 'show_localplay': - $controllers = Localplay::get_controllers(); - show_box_top(_('Localplay Controllers')); - require_once Config::get('prefix') . '/templates/show_localplay_controllers.inc.php'; - show_box_bottom(); + case 'show_localplay': + $controllers = Localplay::get_controllers(); + show_box_top(_('Localplay Controllers')); + require_once Config::get('prefix') . '/templates/show_localplay_controllers.inc.php'; + show_box_bottom(); break; - default: + default: // Rien a faire break; } // end switch -show_footer(); +show_footer(); ?> diff --git a/admin/shout.php b/admin/shout.php index 31b7405a..b88ab1c1 100644 --- a/admin/shout.php +++ b/admin/shout.php @@ -26,18 +26,18 @@ if (!Access::check('interface','100')) { exit; } -show_header(); +show_header(); // Switch on the incomming action -switch ($_REQUEST['action']) { - case 'edit_shout': - $shout_id = $_POST['shout_id']; - $update = shoutBox::update($_POST); +switch ($_REQUEST['action']) { + case 'edit_shout': + $shout_id = $_POST['shout_id']; + $update = shoutBox::update($_POST); show_confirmation(_('Shoutbox Post Updated'),'',Config::get('web_path').'/admin/shout.php'); - break; + break; case 'show_edit': $shout = new shoutBox($_REQUEST['shout_id']); - $object = shoutBox::get_object($shout->object_type,$shout->object_id); + $object = shoutBox::get_object($shout->object_type,$shout->object_id); $object->format(); $client = new User($shout->user); $client->format(); @@ -48,12 +48,12 @@ switch ($_REQUEST['action']) { show_confirmation(_('Shoutbox Post Deleted'),'',Config::get('web_path').'/admin/shout.php'); break; default: - Browse::set_type('shoutbox'); - Browse::set_simple_browse(1); - $shoutbox_ids = Browse::get_objects(); - Browse::show_objects($shoutbox_ids); - break; + Browse::set_type('shoutbox'); + Browse::set_simple_browse(1); + $shoutbox_ids = Browse::get_objects(); + Browse::show_objects($shoutbox_ids); + break; } // end switch on action -show_footer(); +show_footer(); ?> diff --git a/admin/system.php b/admin/system.php index 85cf143e..c986cb51 100644 --- a/admin/system.php +++ b/admin/system.php @@ -29,35 +29,35 @@ if (!Access::check('interface',100) OR Config::get('demo_mode')) { exit(); } -show_header(); +show_header(); /* Switch on action boys */ -switch ($_REQUEST['action']) { +switch ($_REQUEST['action']) { /* This re-generates the config file comparing * /config/ampache.cfg to .cfg.dist */ case 'generate_config': - ob_end_clean(); + ob_end_clean(); $current = parse_ini_file(Config::get('prefix') . '/config/ampache.cfg.php'); $final = generate_config($current); - $browser = new Browser(); - $browser->downloadHeaders('ampache.cfg.php','text/plain',false,filesize(Config::get('prefix') . '/config/ampache.cfg.php.dist')); - echo $final; - exit; + $browser = new Browser(); + $browser->downloadHeaders('ampache.cfg.php','text/plain',false,filesize(Config::get('prefix') . '/config/ampache.cfg.php.dist')); + echo $final; + exit; break; case 'reset_db_charset': - Dba::reset_db_charset(); - show_confirmation(_('Database Charset Updated'),_('Your Database and associated tables have been updated to match your currently configured charset'), Config::get('web_path').'/admin/system.php?action=show_debug'); - break; - case 'show_debug': + Dba::reset_db_charset(); + show_confirmation(_('Database Charset Updated'),_('Your Database and associated tables have been updated to match your currently configured charset'), Config::get('web_path').'/admin/system.php?action=show_debug'); + break; + case 'show_debug': $configuration = Config::get_all(); require_once Config::get('prefix') . '/templates/show_debug.inc.php'; - break; - default: + break; + default: // Rien a faire break; } // end switch -show_footer(); +show_footer(); ?> diff --git a/admin/users.php b/admin/users.php index c871a5e7..5ed49043 100644 --- a/admin/users.php +++ b/admin/users.php @@ -22,22 +22,22 @@ require_once '../lib/init.php'; -if (!Access::check('interface','100')) { +if (!Access::check('interface','100')) { access_denied(); exit(); } -show_header(); +show_header(); -// Switch on the actions +// Switch on the actions switch ($_REQUEST['action']) { case 'update_user': if (Config::get('demo_mode')) { break; } - if (!Core::form_verify('edit_user','post')) { - access_denied(); - exit; - } + if (!Core::form_verify('edit_user','post')) { + access_denied(); + exit; + } /* Clean up the variables */ $user_id = scrub_in($_POST['user_id']); @@ -47,49 +47,49 @@ switch ($_REQUEST['action']) { $access = scrub_in($_POST['access']); $pass1 = scrub_in($_POST['password_1']); $pass2 = scrub_in($_POST['password_2']); - - /* Setup the temp user */ + + /* Setup the temp user */ $client = new User($user_id); - + /* Verify Input */ - if (empty($username)) { + if (empty($username)) { Error::add('username',_("Error Username Required")); } - if ($pass1 !== $pass2 && !empty($pass1)) { + if ($pass1 !== $pass2 && !empty($pass1)) { Error::add('password',_("Error Passwords don't match")); } /* If we've got an error then break! */ - if (Error::occurred()) { + if (Error::occurred()) { $_REQUEST['action'] = 'show_edit'; break; } // if we've had an oops! - if ($access != $client->access) { + if ($access != $client->access) { $client->update_access($access); } - if ($email != $client->email) { + if ($email != $client->email) { $client->update_email($email); } - if ($username != $client->username) { + if ($username != $client->username) { $client->update_username($username); - } + } if ($fullname != $client->fullname) { $client->update_fullname($fullname); } - if ($pass1 == $pass2 && strlen($pass1)) { + if ($pass1 == $pass2 && strlen($pass1)) { $client->update_password($pass1); - } - + } + show_confirmation(_('User Updated'), $client->fullname . "(" . $client->username . ")" . _('updated'), Config::get('web_path'). '/admin/users.php'); break; case 'add_user': if (Config::get('demo_mode')) { break; } - if (!Core::form_verify('add_user','post')) { + if (!Core::form_verify('add_user','post')) { access_denied(); exit; - } + } $username = scrub_in($_POST['username']); $fullname = scrub_in($_POST['fullname']); @@ -98,74 +98,74 @@ switch ($_REQUEST['action']) { $pass1 = scrub_in($_POST['password_1']); $pass2 = scrub_in($_POST['password_2']); - if ($pass1 !== $pass2 || !strlen($pass1)) { + if ($pass1 !== $pass2 || !strlen($pass1)) { Error::add('password',_("Error Passwords don't match")); } - if (empty($username)) { + if (empty($username)) { Error::add('username',_('Error Username Required')); } /* make sure the username doesn't already exist */ - if (!User::check_username($username)) { + if (!User::check_username($username)) { Error::add('username',_('Error Username already exists')); - } + } - if (!Error::occurred()) { + if (!Error::occurred()) { /* Attempt to create the user */ $user_id = User::create($username, $fullname, $email, $pass1, $access); - if (!$user_id) { + if (!$user_id) { Error::add('general',_("Error: Insert Failed")); } } // if no errors - else { + else { $_REQUEST['action'] = 'show_add_user'; break; } if ($access == 5){ $access = _('Guest');} elseif ($access == 25){ $access = _('User');} elseif ($access == 100){ $access = _('Admin');} - + /* HINT: %1 Username, %2 Access num */ show_confirmation(_('New User Added'),sprintf(_('%1$s has been created with an access level of %2$s'), $username, $access), Config::get('web_path').'/admin/users.php'); break; case 'enable': - $client = new User($_REQUEST['user_id']); - $client->enable(); - show_confirmation(_('User Enabled'),$client->fullname . ' (' . $client->username . ')', Config::get('web_path'). '/admin/users.php'); + $client = new User($_REQUEST['user_id']); + $client->enable(); + show_confirmation(_('User Enabled'),$client->fullname . ' (' . $client->username . ')', Config::get('web_path'). '/admin/users.php'); break; case 'disable': - $client = new User($_REQUEST['user_id']); - if ($client->disable()) { - show_confirmation(_('User Disabled'),$client->fullname . ' (' . $client->username . ')', Config::get('web_path'). '/admin/users.php'); - } - else { - show_confirmation(_('Error'),_('Unable to Disabled last Administrator'), Config::get('web_path').'/admin/users.php'); - } + $client = new User($_REQUEST['user_id']); + if ($client->disable()) { + show_confirmation(_('User Disabled'),$client->fullname . ' (' . $client->username . ')', Config::get('web_path'). '/admin/users.php'); + } + else { + show_confirmation(_('Error'),_('Unable to Disabled last Administrator'), Config::get('web_path').'/admin/users.php'); + } break; case 'show_edit': if (Config::get('demo_mode')) { break; } - $client = new User($_REQUEST['user_id']); + $client = new User($_REQUEST['user_id']); require_once Config::get('prefix') . '/templates/show_edit_user.inc.php'; break; case 'confirm_delete': if (Config::get('demo_mode')) { break; } - if (!Core::form_verify('delete_user')) { - access_denied(); - exit; - } - $client = new User($_REQUEST['user_id']); - if ($client->delete()) { + if (!Core::form_verify('delete_user')) { + access_denied(); + exit; + } + $client = new User($_REQUEST['user_id']); + if ($client->delete()) { show_confirmation(_('User Deleted'), sprintf(_('%s has been Deleted'), $client->username), Config::get('web_path'). "/admin/users.php"); } - else { + else { show_confirmation(_('Delete Error'), _("Unable to delete last Admin User"), Config::get('web_path')."/admin/users.php"); } break; case 'delete': if (Config::get('demo_mode')) { break; } - $client = new User($_REQUEST['user_id']); + $client = new User($_REQUEST['user_id']); show_confirmation(_('Deletion Request'), sprintf(_('Are you sure you want to permanently delete %s?'), $client->fullname), Config::get('web_path')."/admin/users.php?action=confirm_delete&user_id=" . $_REQUEST['user_id'],1,'delete_user'); @@ -173,11 +173,11 @@ switch ($_REQUEST['action']) { /* Show IP History for the Specified User */ case 'show_ip_history': /* get the user and their history */ - $working_user = new User($_REQUEST['user_id']); + $working_user = new User($_REQUEST['user_id']); if (!isset($_REQUEST['all'])){ $history = $working_user->get_ip_history(0,1); - } + } else { $history = $working_user->get_ip_history(); } @@ -187,18 +187,18 @@ switch ($_REQUEST['action']) { if (Config::get('demo_mode')) { break; } require_once Config::get('prefix') . '/templates/show_add_user.inc.php'; break; - case 'show_preferences': - $client = new User($_REQUEST['user_id']); - $preferences = Preference::get_all($client->id); + case 'show_preferences': + $client = new User($_REQUEST['user_id']); + $preferences = Preference::get_all($client->id); require_once Config::get('prefix') . '/templates/show_user_preferences.inc.php'; break; default: Browse::reset_filters(); - Browse::set_type('user'); + Browse::set_type('user'); Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); - $user_ids = Browse::get_objects(); - Browse::show_objects($user_ids); + $user_ids = Browse::get_objects(); + Browse::show_objects($user_ids); break; } // end switch on action |