* Sub-Ajax page, requires AJAX_INCLUDE */ if (!defined('AJAX_INCLUDE')) { exit; } $results = array(); switch ($_REQUEST['action']) { case 'set_instance': // Make sure they they are allowed to do this if (!Access::check('localplay', '5')) { debug_event('DENIED', 'Error attempted to set instance without required level', '1'); exit; } $type = $_REQUEST['instance'] ? 'localplay' : 'stream'; $localplay = new Localplay(AmpConfig::get('localplay_controller')); $localplay->set_active_instance($_REQUEST['instance']); Preference::update('play_type', $GLOBALS['user']->id, $type); // We should also refesh the sidebar ob_start(); require_once AmpConfig::get('prefix') . UI::find_template('sidebar.inc.php'); $results['sidebar-content'] = ob_get_contents(); ob_end_clean(); break; case 'command': // Make sure they are allowed to do this if (!Access::check('localplay', '50')) { debug_event('DENIED', 'Attempted to control Localplay without sufficient access', '1'); exit; } $localplay = new Localplay(AmpConfig::get('localplay_controller')); $localplay->connect();