Exemplo n.º 1
0
if (!$GLOBALS['user']->has_access(100)) {
    UI::access_denied();
    exit;
}
/* Always show the header */
UI::show_header();
switch ($_REQUEST['action']) {
    case 'install_localplay':
        $localplay = new Localplay($_REQUEST['type']);
        if (!$localplay->player_loaded()) {
            Error::add('general', T_('Install Failed, Controller Error'));
            Error::display('general');
            break;
        }
        // Install it!
        $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('localplay_controller', $GLOBALS['user']->id, $localplay->type);
        header("Location:" . AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay');
        break;
    case 'install_catalog_type':
        $type = scrub_in($_REQUEST['type']);
        $catalog = Catalog::create_catalog_type($type);
        if ($catalog == null) {
            Error::add('general', T_('Install Failed, Catalog Error'));
            Error::display('general');
            break;
        }