Example #1
0
            echo "<div class=\"error\" align=\"center\">" . T_('No Disabled songs found') . "</div>";
        }
        break;
    case 'show_delete_catalog':
        /* Stop the demo hippies */
        if (AmpConfig::get('demo_mode')) {
            UI::access_denied();
            break;
        }
        $catalog = Catalog::create_from_id($_REQUEST['catalog_id']);
        $nexturl = AmpConfig::get('web_path') . '/admin/catalog.php?action=delete_catalog&amp;catalog_id=' . scrub_out($_REQUEST['catalog_id']);
        show_confirmation(T_('Delete Catalog'), T_('Do you really want to delete this catalog?') . " -- {$catalog->name} ({$catalog->path})", $nexturl, 1);
        break;
    case 'show_customize_catalog':
        $catalog = Catalog::create_from_id($_REQUEST['catalog_id']);
        $catalog->format();
        require_once AmpConfig::get('prefix') . '/templates/show_edit_catalog.inc.php';
        break;
    case 'gather_media_art':
        $sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=gather_media_art&catalogs=" . $sse_catalogs;
        sse_worker($sse_url);
        show_confirmation(T_('Media Art Search started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
        break;
    case 'show_catalogs':
    default:
        require_once AmpConfig::get('prefix') . '/templates/show_manage_catalogs.inc.php';
        break;
}
// end switch
/* Show the Footer */
UI::show_footer();
Example #2
0
     $user_id = $_REQUEST['user_id'];
     $next_url = AmpConfig::get('web_path') . '/admin/users.php?action=generate_apikey&user_id=' . scrub_out($user_id);
     show_confirmation(T_('Generate new API Key'), T_('Confirm API Key Generation'), $next_url, 1, 'generate_apikey');
     break;
 case 'generate_apikey':
     if (AmpConfig::get('demo_mode')) {
         break;
     }
     if (!Core::form_verify('generate_apikey', 'post')) {
         UI::access_denied();
         exit;
     }
     $client = new User($_REQUEST['user_id']);
     $client->generate_apikey();
     $next_url = AmpConfig::get('web_path') . '/admin/users.php';
     show_confirmation(T_('API Key Generated'), T_('New user API Key has been generated.'), $next_url);
     break;
     /* Show IP History for the Specified User */
 /* Show IP History for the Specified User */
 case 'show_ip_history':
     /* get the user and their history */
     $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();
     }
     require AmpConfig::get('prefix') . '/templates/show_ip_history.inc.php';
     break;
 case 'show_add_user':
     if (AmpConfig::get('demo_mode')) {
Example #3
0
        $created = Channel::create($_REQUEST['name'], $_REQUEST['description'], $_REQUEST['url'], $_REQUEST['type'], $_REQUEST['id'], $_REQUEST['interface'], $_REQUEST['port'], $_REQUEST['admin_password'], $_REQUEST['private'] ?: 0, $_REQUEST['max_listeners'], $_REQUEST['random'] ?: 0, $_REQUEST['loop'] ?: 0, $_REQUEST['stream_type'], $_REQUEST['bitrate']);
        if (!$created) {
            require_once AmpConfig::get('prefix') . UI::find_template('show_add_channel.inc.php');
        } else {
            $title = T_('Channel Created');
            show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=channel');
        }
        UI::show_footer();
        exit;
    case 'show_delete':
        $id = $_REQUEST['id'];
        $next_url = AmpConfig::get('web_path') . '/channel.php?action=delete&id=' . scrub_out($id);
        show_confirmation(T_('Channel Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_channel');
        UI::show_footer();
        exit;
    case 'delete':
        if (AmpConfig::get('demo_mode')) {
            UI::access_denied();
            exit;
        }
        $id = $_REQUEST['id'];
        $channel = new Channel($id);
        if ($channel->delete()) {
            $next_url = AmpConfig::get('web_path') . '/browse.php?action=channel';
            show_confirmation(T_('Channel Deleted'), T_('The Channel has been deleted'), $next_url);
        }
        UI::show_footer();
        exit;
}
// switch on the action
UI::show_footer();
Example #4
0
     show_confirmation(T_('Song Deletion'), T_('Are you sure you want to permanently delete this song?'), AmpConfig::get('web_path') . "/song.php?action=confirm_delete&song_id=" . $song_id, 1, 'delete_song');
     break;
 case 'confirm_delete':
     if (AmpConfig::get('demo_mode')) {
         break;
     }
     $song = new Song($_REQUEST['song_id']);
     if (!Catalog::can_remove($song)) {
         debug_event('song', 'Unauthorized to remove the song `.' . $song->id . '`.', 1);
         UI::access_denied();
         exit;
     }
     if ($song->remove_from_disk()) {
         show_confirmation(T_('Song Deletion'), T_('Song has been deleted.'), AmpConfig::get('web_path'));
     } else {
         show_confirmation(T_('Song Deletion'), T_('Cannot delete this song.'), AmpConfig::get('web_path'));
     }
     break;
 case 'show_lyrics':
     $song = new Song($_REQUEST['song_id']);
     $song->format();
     $song->fill_ext_info();
     $lyrics = $song->get_lyrics();
     require_once AmpConfig::get('prefix') . UI::find_template('show_lyrics.inc.php');
     break;
 case 'show_song':
 default:
     $song = new Song($_REQUEST['song_id']);
     $song->format();
     $song->fill_ext_info();
     require_once AmpConfig::get('prefix') . UI::find_template('show_song.inc.php');
Example #5
0
            UI::access_denied();
            exit;
        }
        $podcast_id = scrub_in($_REQUEST['podcast_id']);
        show_confirmation(T_('Podcast Deletion'), T_('Are you sure you want to delete this podcast?'), AmpConfig::get('web_path') . "/podcast.php?action=confirm_delete&podcast_id=" . $podcast_id, 1, 'delete_podcast');
        break;
    case 'confirm_delete':
        if (!Access::check('interface', 75) || AmpConfig::get('demo_mode')) {
            UI::access_denied();
            exit;
        }
        $podcast = new Podcast($_REQUEST['podcast_id']);
        if ($podcast->remove()) {
            show_confirmation(T_('Podcast Deletion'), T_('Podcast has been deleted.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
        } else {
            show_confirmation(T_('Podcast Deletion'), T_('Cannot delete this podcast.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
        }
        break;
    case 'show':
        $podcast_id = intval($_REQUEST['podcast']);
        if ($podcast_id > 0) {
            $podcast = new Podcast($podcast_id);
            $podcast->format();
            $object_ids = $podcast->get_episodes();
            $object_type = 'podcast_episode';
            require_once AmpConfig::get('prefix') . UI::find_template('show_podcast.inc.php');
        }
        break;
}
// end data collection
UI::show_footer();
Example #6
0
 */
require_once 'lib/init.php';
if (!AmpConfig::get('broadcast')) {
    UI::access_denied();
    exit;
}
UI::show_header();
/* Switch on the action passed in */
switch ($_REQUEST['action']) {
    case 'show_delete':
        $id = $_REQUEST['id'];
        $next_url = AmpConfig::get('web_path') . '/broadcast.php?action=delete&id=' . scrub_out($id);
        show_confirmation(T_('Broadcast Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_broadcast');
        UI::show_footer();
        exit;
    case 'delete':
        if (AmpConfig::get('demo_mode')) {
            UI::access_denied();
            exit;
        }
        $id = $_REQUEST['id'];
        $broadcast = new Broadcast($id);
        if ($broadcast->delete()) {
            $next_url = AmpConfig::get('web_path') . '/browse.php?action=broadcast';
            show_confirmation(T_('Broadcast Deleted'), T_('The Broadcast has been deleted'), $next_url);
        }
        UI::show_footer();
        exit;
}
// switch on the action
UI::show_footer();
Example #7
0
        UI::show_header();
        $id = $_REQUEST['id'];
        $next_url = AmpConfig::get('web_path') . '/share.php?action=delete&id=' . scrub_out($id);
        show_confirmation(T_('Share Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_share');
        UI::show_footer();
        exit;
    case 'delete':
        if (AmpConfig::get('demo_mode')) {
            UI::access_denied();
            exit;
        }
        UI::show_header();
        $id = $_REQUEST['id'];
        if (Share::delete_share($id)) {
            $next_url = AmpConfig::get('web_path') . '/stats.php?action=share';
            show_confirmation(T_('Share Deleted'), T_('The Share has been deleted'), $next_url);
        }
        UI::show_footer();
        exit;
}
/**
 * If Access Control is turned on then we don't
 * even want them to be able to get to the login
 * page if they aren't in the ACL
 */
if (AmpConfig::get('access_control')) {
    if (!Access::check_network('interface', '', '5')) {
        debug_event('UI::access_denied', 'Access Denied:' . $_SERVER['REMOTE_ADDR'] . ' is not in the Interface Access list', '3');
        UI::access_denied();
        exit;
    }
Example #8
0
                }
            }
        }
        $fullname = $GLOBALS['user']->fullname;
        $preferences = $GLOBALS['user']->get_preferences($_REQUEST['tab']);
        break;
    default:
        $fullname = $GLOBALS['user']->fullname;
        $preferences = $GLOBALS['user']->get_preferences($_REQUEST['tab']);
        break;
}
// End Switch Action
UI::show_header();
/**
 * switch on the view
 */
switch ($_REQUEST['action']) {
    case 'confirm':
    case 'grant':
        show_confirmation($title, $text, $next_url, $cancel);
        break;
    default:
        if (!empty($notification_text)) {
            display_notification($notification_text);
        }
        // Show the default preferences page
        require AmpConfig::get('prefix') . UI::find_template('show_preferences.inc.php');
        break;
}
// end switch on action
UI::show_footer();
Example #9
0
    case 'delete':
        if (AmpConfig::get('demo_mode')) {
            break;
        }
        $episode_id = scrub_in($_REQUEST['podcast_episode_id']);
        show_confirmation(T_('Podcast Episode Deletion'), T_('Are you sure you want to permanently delete this episode?'), AmpConfig::get('web_path') . "/podcast_episode.php?action=confirm_delete&podcast_episode_id=" . $episode_id, 1, 'delete_podcast_episode');
        break;
    case 'confirm_delete':
        if (AmpConfig::get('demo_mode')) {
            break;
        }
        $episode = new Podcast_Episode($_REQUEST['podcast_episode_id']);
        if (!Catalog::can_remove($episode)) {
            debug_event('video', 'Unauthorized to remove the episode `.' . $episode->id . '`.', 1);
            UI::access_denied();
            exit;
        }
        if ($episode->remove()) {
            show_confirmation(T_('Podcast Episode Deletion'), T_('Episode has been deleted.'), AmpConfig::get('web_path'));
        } else {
            show_confirmation(T_('Podcast Episode Deletion'), T_('Cannot delete this episode.'), AmpConfig::get('web_path'));
        }
        break;
    case 'show':
    default:
        $episode = new Podcast_Episode($_REQUEST['podcast_episode']);
        $episode->format();
        require_once AmpConfig::get('prefix') . UI::find_template('show_podcast_episode.inc.php');
        break;
}
UI::show_footer();
Example #10
0
         UI::access_denied();
         break;
     }
     // Show the create page
     require_once AmpConfig::get('prefix') . UI::find_template('show_create_democratic.inc.php');
     break;
 case 'delete':
     if (!Access::check('interface', '75')) {
         UI::access_denied();
         break;
     }
     Democratic::delete($_REQUEST['democratic_id']);
     $title = '';
     $text = T_('The Requested Playlist has been deleted.');
     $url = AmpConfig::get('web_path') . '/democratic.php?action=manage_playlists';
     show_confirmation($title, $text, $url);
     break;
 case 'create':
     // Only power users here
     if (!Access::check('interface', '75')) {
         UI::access_denied();
         break;
     }
     if (!Core::form_verify('create_democratic')) {
         UI::access_denied();
         exit;
     }
     $democratic = Democratic::get_current_playlist();
     // If we don't have anything currently create something
     if (!$democratic->id) {
         // Create the playlist
Example #11
0
    case 'reset_db_charset':
        Dba::reset_db_charset();
        show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path') . '/admin/system.php?action=show_debug');
        break;
    case 'show_debug':
        $configuration = AmpConfig::get_all();
        if ($_REQUEST['autoupdate'] == 'force') {
            $version = AutoUpdate::get_latest_version(true);
        }
        require_once AmpConfig::get('prefix') . UI::find_template('show_debug.inc.php');
        break;
    case 'clear_cache':
        switch ($_REQUEST['type']) {
            case 'song':
                Song::clear_cache();
                break;
            case 'artist':
                Artist::clear_cache();
                break;
            case 'album':
                Album::clear_cache();
                break;
        }
        show_confirmation(T_('Cache cleared'), T_('Your cache has been cleared successfully.'), AmpConfig::get('web_path') . '/admin/system.php?action=show_debug');
        break;
    default:
        // Rien a faire
        break;
}
// end switch
UI::show_footer();
Example #12
0
 * action switch
 */
switch ($_REQUEST['action']) {
    case 'search':
        $browse = new Browse();
        require_once AmpConfig::get('prefix') . '/templates/show_search.inc.php';
        require_once AmpConfig::get('prefix') . '/templates/show_search_options.inc.php';
        $results = Search::run($_REQUEST);
        $browse->set_type($_REQUEST['type']);
        $browse->show_objects($results);
        $browse->store();
        break;
    case 'save_as_track':
        $playlist_id = save_search($_REQUEST);
        $playlist = new Playlist($playlist_id);
        show_confirmation(T_('Search Saved'), sprintf(T_('Your Search has been saved as a track in %s'), $playlist->name), AmpConfig::get('web_path') . "/search.php");
        break;
    case 'save_as_smartplaylist':
        $playlist = new Search();
        $playlist->parse_rules(Search::clean_request($_REQUEST));
        $playlist->save();
        break;
    case 'descriptor':
        // This is a little special we don't want header/footers so trash what we've got in the OB
        ob_clean();
        require_once AmpConfig::get('prefix') . '/templates/show_search_descriptor.inc.php';
        exit;
    default:
        require_once AmpConfig::get('prefix') . '/templates/show_search.inc.php';
        break;
}
Example #13
0
    case 'delete':
        if (AmpConfig::get('demo_mode')) {
            break;
        }
        $video_id = scrub_in($_REQUEST['video_id']);
        show_confirmation(T_('Video Deletion'), T_('Are you sure you want to permanently delete this video?'), AmpConfig::get('web_path') . "/video.php?action=confirm_delete&video_id=" . $video_id, 1, 'delete_video');
        break;
    case 'confirm_delete':
        if (AmpConfig::get('demo_mode')) {
            break;
        }
        $video = Video::create_from_id($_REQUEST['video_id']);
        if (!Catalog::can_remove($video)) {
            debug_event('video', 'Unauthorized to remove the video `.' . $video->id . '`.', 1);
            UI::access_denied();
            exit;
        }
        if ($video->remove_from_disk()) {
            show_confirmation(T_('Video Deletion'), T_('Video has been deleted.'), AmpConfig::get('web_path'));
        } else {
            show_confirmation(T_('Video Deletion'), T_('Cannot delete this video.'), AmpConfig::get('web_path'));
        }
        break;
    case 'show_video':
    default:
        $video = Video::create_from_id($_REQUEST['video_id']);
        $video->format();
        require_once AmpConfig::get('prefix') . '/templates/show_video.inc.php';
        break;
}
UI::show_footer();
Example #14
0
     show_confirmation(T_('Artist Deletion'), T_('Are you sure you want to permanently delete this artist?'), AmpConfig::get('web_path') . "/artists.php?action=confirm_delete&artist_id=" . $artist_id, 1, 'delete_artist');
     break;
 case 'confirm_delete':
     if (AmpConfig::get('demo_mode')) {
         break;
     }
     $artist = new Artist($_REQUEST['artist_id']);
     if (!Catalog::can_remove($artist)) {
         debug_event('artist', 'Unauthorized to remove the artist `.' . $artist->id . '`.', 1);
         UI::access_denied();
         exit;
     }
     if ($artist->remove_from_disk()) {
         show_confirmation(T_('Artist Deletion'), T_('Artist has been deleted.'), AmpConfig::get('web_path'));
     } else {
         show_confirmation(T_('Artist Deletion'), T_('Cannot delete this artist.'), AmpConfig::get('web_path'));
     }
     break;
 case 'show':
     $artist = new Artist($_REQUEST['artist']);
     $artist->format();
     if (AmpConfig::get('album_release_type')) {
         $multi_object_ids = $artist->get_albums($_REQUEST['catalog'], false, true);
     } else {
         $object_ids = $artist->get_albums($_REQUEST['catalog']);
     }
     $object_type = 'album';
     require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
     break;
 case 'show_all_songs':
     $artist = new Artist($_REQUEST['artist']);
Example #15
0
            $results = Search::run($_REQUEST);
            $browse->set_type($_REQUEST['type']);
            $browse->show_objects($results);
            $browse->store();
        } else {
            $wartists = Wanted::search_missing_artists($_REQUEST['rule_1_input']);
            require_once AmpConfig::get('prefix') . '/templates/show_missing_artists.inc.php';
            echo '<a href="http://musicbrainz.org/search?query=' . rawurlencode($_REQUEST['rule_1_input']) . '&type=artist&method=indexed" target="_blank">' . T_('View on MusicBrainz') . '</a><br />';
        }
        break;
    case 'save_as_smartplaylist':
        if (!Access::check('interface', 25)) {
            UI::access_denied();
            exit;
        }
        $playlist = new Search();
        $playlist->parse_rules(Search::clean_request($_REQUEST));
        $playlist->save();
        show_confirmation(T_('Search Saved'), sprintf(T_('Your Search has been saved as a Smart Playlist with name %s'), $playlist->name), AmpConfig::get('web_path') . "/browse.php?action=smartplaylist");
        break;
    case 'descriptor':
        // This is a little special we don't want header/footers so trash what we've got in the OB
        ob_clean();
        require_once AmpConfig::get('prefix') . '/templates/show_search_descriptor.inc.php';
        exit;
    default:
        require_once AmpConfig::get('prefix') . '/templates/show_search_form.inc.php';
        break;
}
/* Show the Footer */
UI::show_footer();
Example #16
0
     if (AmpConfig::get('demo_mode')) {
         break;
     }
     $msgs = split(",", $_REQUEST['msgs']);
     foreach ($msgs as $msg_id) {
         $msg_id = intval($msg_id);
         $pvmsg = new PrivateMsg($msg_id);
         if ($pvmsg->id && $pvmsg->to_user === $GLOBALS['user']->id) {
             $pvmsg->delete();
         } else {
             debug_event('UI::access_denied', 'Unknown or unauthorized private message #' . $msg_id . '.', '3');
             UI::access_denied();
             exit;
         }
     }
     show_confirmation(T_('Messages Deletion'), T_('Messages have been deleted.'), AmpConfig::get('web_path') . "/browse.php?action=pvmsg");
     break;
 case 'show':
 default:
     $msg_id = intval($_REQUEST['pvmsg_id']);
     $pvmsg = new PrivateMsg($msg_id);
     if ($pvmsg->id && $pvmsg->to_user === $GLOBALS['user']->id) {
         $pvmsg->format();
         if (!$pvmsg->is_read) {
             $pvmsg->set_is_read(true);
         }
         require_once AmpConfig::get('prefix') . UI::find_template('show_pvmsg.inc.php');
     } else {
         debug_event('UI::access_denied', 'Unknown or unauthorized private message #' . $msg_id . '.', '3');
         UI::access_denied();
         exit;
Example #17
0
switch ($_REQUEST['action']) {
    case 'edit_shout':
        $shout = new Shoutbox($_REQUEST['shout_id']);
        if ($shout->id) {
            $shout->update($_POST);
        }
        show_confirmation(T_('Shoutbox Post Updated'), '', AmpConfig::get('web_path') . '/admin/shout.php');
        break;
    case 'show_edit':
        $shout = new Shoutbox($_REQUEST['shout_id']);
        $object = Shoutbox::get_object($shout->object_type, $shout->object_id);
        $object->format();
        $client = new User($shout->user);
        $client->format();
        require_once AmpConfig::get('prefix') . '/templates/show_edit_shout.inc.php';
        break;
    case 'delete':
        Shoutbox::delete($_REQUEST['shout_id']);
        show_confirmation(T_('Shoutbox Post Deleted'), '', AmpConfig::get('web_path') . '/admin/shout.php');
        break;
    default:
        $browse = new Browse();
        $browse->set_type('shoutbox');
        $browse->set_simple_browse(true);
        $shoutbox_ids = $browse->get_objects();
        $browse->show_objects($shoutbox_ids);
        $browse->store();
        break;
}
// end switch on action
UI::show_footer();
Example #18
0
            break;
        }
        $tvshow_season_id = scrub_in($_REQUEST['tvshow_season_id']);
        show_confirmation(T_('TVShow Season Deletion'), T_('Are you sure you want to permanently delete this tvshow season?'), AmpConfig::get('web_path') . "/tvshow_seasons.php?action=confirm_delete&tvshow_season_id=" . $tvshow_season_id, 1, 'delete_tvshow_season');
        break;
    case 'confirm_delete':
        if (AmpConfig::get('demo_mode')) {
            break;
        }
        $tvshow_season = new TVShow_Season($_REQUEST['tvshow_season_id']);
        if (!Catalog::can_remove($tvshow_season)) {
            debug_event('tvshow_season', 'Unauthorized to remove the tvshow `.' . $tvshow_season->id . '`.', 1);
            UI::access_denied();
            exit;
        }
        if ($tvshow_season->remove_from_disk()) {
            show_confirmation(T_('TVShow Season Deletion'), T_('TVShow Season has been deleted.'), AmpConfig::get('web_path'));
        } else {
            show_confirmation(T_('TVShow Season Deletion'), T_('Cannot delete this tvshow season.'), AmpConfig::get('web_path'));
        }
        break;
    case 'show':
        $season = new TVShow_Season($_REQUEST['season']);
        $season->format();
        $object_ids = $season->get_episodes();
        $object_type = 'tvshow_episode';
        require_once AmpConfig::get('prefix') . UI::find_template('show_tvshow_season.inc.php');
        break;
}
// end switch
UI::show_footer();
Example #19
0
     show_confirmation(T_('Album Deletion'), T_('Are you sure you want to permanently delete this album?'), AmpConfig::get('web_path') . "/albums.php?action=confirm_delete&album_id=" . $album_id, 1, 'delete_album');
     break;
 case 'confirm_delete':
     if (AmpConfig::get('demo_mode')) {
         break;
     }
     $album = new Album($_REQUEST['album_id']);
     if (!Catalog::can_remove($album)) {
         debug_event('album', 'Unauthorized to remove the album `.' . $album->id . '`.', 1);
         UI::access_denied();
         exit;
     }
     if ($album->remove_from_disk()) {
         show_confirmation(T_('Album Deletion'), T_('Album has been deleted.'), AmpConfig::get('web_path'));
     } else {
         show_confirmation(T_('Album Deletion'), T_('Cannot delete this album.'), AmpConfig::get('web_path'));
     }
     break;
 case 'update_from_tags':
     // Make sure they are a 'power' user at least
     if (!Access::check('interface', '75')) {
         UI::access_denied();
         exit;
     }
     $type = 'album';
     $object_id = intval($_REQUEST['album_id']);
     $target_url = AmpConfig::get('web_path') . '/albums.php?action=show&amp;album=' . $object_id;
     require_once AmpConfig::get('prefix') . UI::find_template('show_update_items.inc.php');
     break;
 case 'set_track_numbers':
     debug_event('albums', 'Set track numbers called.', '5');
Example #20
0
UI::show_header();
/* Switch on action boys */
switch ($_REQUEST['action']) {
    /* This re-generates the config file comparing
     * /config/ampache.cfg to .cfg.dist
     */
    case 'generate_config':
        ob_end_clean();
        $current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
        $final = generate_config($current);
        $browser = new Horde_Browser();
        $browser->downloadHeaders('ampache.cfg.php', 'text/plain', false, filesize(AmpConfig::get('prefix') . '/config/ampache.cfg.php.dist'));
        echo $final;
        exit;
    case 'reset_db_charset':
        Dba::reset_db_charset();
        show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path') . '/admin/system.php?action=show_debug');
        break;
    case 'show_debug':
        $configuration = AmpConfig::get_all();
        if ($_REQUEST['autoupdate'] == 'force') {
            $version = AutoUpdate::get_latest_version(true);
        }
        require_once AmpConfig::get('prefix') . '/templates/show_debug.inc.php';
        break;
    default:
        // Rien a faire
        break;
}
// end switch
UI::show_footer();
Example #21
0
         exit;
     }
     // Remove unauthorized defined values from here
     if (isset($_POST['user'])) {
         unset($_POST['user']);
     }
     if (isset($_POST['creation_date'])) {
         unset($_POST['creation_date']);
     }
     $label_id = Label::create($_POST);
     if (!$label_id) {
         require_once AmpConfig::get('prefix') . UI::find_template('show_add_label.inc.php');
     } else {
         $body = T_('Label Added');
         $title = '';
         show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=label');
     }
     break;
 case 'show':
     $label_id = intval($_REQUEST['label']);
     if (!$label_id) {
         if (!empty($_REQUEST['name'])) {
             $label_id = Label::lookup($_REQUEST);
         }
     }
     if ($label_id > 0) {
         $label = new Label($label_id);
         $label->format();
         $object_ids = $label->get_artists();
         $object_type = 'artist';
         require_once AmpConfig::get('prefix') . UI::find_template('show_label.inc.php');
Example #22
0
     }
     $images = array_merge($cover_url, $images);
     // If we've found anything then go for it!
     if (count($images)) {
         // We don't want to store raw's in here so we need to strip them out into a separate array
         foreach ($images as $index => $image) {
             if ($image['raw']) {
                 unset($images[$index]['raw']);
             }
         }
         // end foreach
         // Store the results for further use
         $_SESSION['form']['images'] = $images;
         require_once AmpConfig::get('prefix') . '/templates/show_arts.inc.php';
     } else {
         show_confirmation(T_('Art Not Located'), T_('Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'), $burl);
     }
     require_once AmpConfig::get('prefix') . '/templates/show_get_art.inc.php';
     break;
 case 'select_art':
     /* Check to see if we have the image url still */
     $image_id = $_REQUEST['image'];
     // Prevent the script from timing out
     set_time_limit(0);
     $image = Art::get_from_source($_SESSION['form']['images'][$image_id], 'album');
     $mime = $_SESSION['form']['images'][$image_id]['mime'];
     // Special case for albums, I'm not sure if we should keep it, remove it or find a generic way
     if ($object_type == 'album') {
         $album = new $object_type($object_id);
         $album_groups = $album->get_group_disks_ids();
         foreach ($album_groups as $a_id) {
Example #23
0
         $url = AmpConfig::get('web_path') . '/admin/access.php';
         show_confirmation(T_('Added'), T_('Your new Access Control List(s) have been created'), $url);
     } else {
         $action = 'show_add_' . $_POST['type'];
         require_once AmpConfig::get('prefix') . '/templates/show_add_access.inc.php';
     }
     break;
 case 'update_record':
     if (!Core::form_verify('edit_acl')) {
         UI::access_denied();
         exit;
     }
     $access = new Access($_REQUEST['access_id']);
     $access->update($_POST);
     if (!Error::occurred()) {
         show_confirmation(T_('Updated'), T_('Access List Entry updated'), AmpConfig::get('web_path') . '/admin/access.php');
     } else {
         $access->format();
         require_once AmpConfig::get('prefix') . '/templates/show_edit_access.inc.php';
     }
     break;
 case 'show_add_current':
 case 'show_add_rpc':
 case 'show_add_local':
 case 'show_add_advanced':
     $action = $_REQUEST['action'];
     require_once AmpConfig::get('prefix') . '/templates/show_add_access.inc.php';
     break;
 case 'show_edit_record':
     $access = new Access($_REQUEST['access_id']);
     $access->format();
Example #24
0
        if (isset($_POST['license_id'])) {
            $license = new License($_POST['license_id']);
            if ($license->id) {
                $license->update($_POST);
            }
            $text = T_('License Updated');
        } else {
            License::create($_POST);
            $text = T_('License Created');
        }
        show_confirmation($text, '', AmpConfig::get('web_path') . '/admin/license.php');
        break;
    case 'show_edit':
        $license = new License($_REQUEST['license_id']);
    case 'show_create':
        require_once AmpConfig::get('prefix') . '/templates/show_edit_license.inc.php';
        break;
    case 'delete':
        License::delete($_REQUEST['license_id']);
        show_confirmation(T_('License Deleted'), '', AmpConfig::get('web_path') . '/admin/license.php');
        break;
    default:
        $browse = new Browse();
        $browse->set_type('license');
        $browse->set_simple_browse(true);
        $license_ids = $browse->get_objects();
        $browse->show_objects($license_ids);
        $browse->store();
        break;
}
UI::show_footer();
Example #25
0
     $id = $_REQUEST['id'];
     if (Share::delete_share($id)) {
         $next_url = AmpConfig::get('web_path') . '/stats.php?action=share';
         show_confirmation(T_('Share Deleted'), T_('The Share has been deleted'), $next_url);
     }
     UI::show_footer();
     exit;
 case 'clean':
     if (AmpConfig::get('demo_mode')) {
         UI::access_denied();
         exit;
     }
     UI::show_header();
     Share::gc();
     $next_url = AmpConfig::get('web_path') . '/stats.php?action=share';
     show_confirmation(T_('Shared Objects cleaned'), T_('Expired shared objects have been cleaned.'), $next_url);
     UI::show_footer();
     exit;
 case 'external_share':
     if (AmpConfig::get('demo_mode')) {
         UI::access_denied();
         exit;
     }
     $plugin = new Plugin($_GET['plugin']);
     if (!$plugin) {
         UI::access_denied('Access Denied - Unkown external share plugin.');
         exit;
     }
     $plugin->load($GLOBALS['user']);
     $type = $_REQUEST['type'];
     $id = $_REQUEST['id'];
Example #26
0
            if (ini_get($ini_default_charset)) {
                ini_set($ini_default_charset, "UTF-8");
            }
            mb_language("uni");
        }
        $mailer = new Mailer();
        // Set the vars on the object
        $mailer->subject = $_REQUEST['subject'];
        $mailer->message = $_REQUEST['message'];
        if ($_REQUEST['from'] == 'system') {
            $mailer->set_default_sender();
        } else {
            $mailer->sender = $GLOBALS['user']->email;
            $mailer->sender_name = $GLOBALS['user']->fullname;
        }
        if ($mailer->send_to_group($_REQUEST['to'])) {
            $title = T_('E-mail Sent');
            $body = T_('Your E-mail was successfully sent.');
        } else {
            $title = T_('E-mail Not Sent');
            $body = T_('Your E-mail was not sent.');
        }
        $url = AmpConfig::get('web_path') . '/admin/mail.php';
        show_confirmation($title, $body, $url);
        break;
    default:
        require_once AmpConfig::get('prefix') . UI::find_template('show_mail_users.inc.php');
        break;
}
// end switch
UI::show_footer();
Example #27
0
     }
     $images = array_merge($cover_url, $images);
     // If we've found anything then go for it!
     if (count($images)) {
         // We don't want to store raw's in here so we need to strip them out into a separate array
         foreach ($images as $index => $image) {
             if ($image['raw']) {
                 unset($images[$index]['raw']);
             }
         }
         // end foreach
         // Store the results for further use
         $_SESSION['form']['images'] = $images;
         require_once AmpConfig::get('prefix') . '/templates/show_album_art.inc.php';
     } else {
         show_confirmation(T_('Album Art Not Located'), T_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'), "/albums.php?action=show&amp;album=" . $album->id);
     }
     $albumname = $album->name;
     $artistname = $artist;
     // Remember the last typed entry, if there was one
     if (!empty($_REQUEST['album_name'])) {
         $albumname = scrub_in($_REQUEST['album_name']);
     }
     if (!empty($_REQUEST['artist_name'])) {
         $artistname = scrub_in($_REQUEST['artist_name']);
     }
     require_once AmpConfig::get('prefix') . '/templates/show_get_albumart.inc.php';
     break;
 case 'select_art':
     /* Check to see if we have the image url still */
     $image_id = $_REQUEST['image'];