$myplex_published = true; echo T_('Server registration completed.') . "<br />\r\n"; } else { $myplex_published = false; echo "<p class='error'>" . T_('Cannot register the server on myPlex.') . "</p>"; } Preference::update('myplex_published', -1, $myplex_published, true, true); } else { $myplex_authtoken = ''; $myplex_published = false; echo "<p class='error'>" . T_('Cannot authenticate on myPlex.') . "</p>"; } } break; case 'unauth_myplex': Plex_Api::unregisterMyPlex($myplex_authtoken); $myplex_username = ''; $myplex_authtoken = ''; $myplex_published = false; Preference::update('myplex_username', -1, $myplex_username, true, true); Preference::update('myplex_authtoken', -1, $myplex_authtoken, true, true); Preference::update('myplex_published', -1, $myplex_published, true, true); break; case 'save': $plex_servername = $_POST['plex_servername']; $plex_local_auth = $_POST['plex_local_auth'] ?: '0'; $plex_match_email = $_POST['plex_match_email'] ?: '0'; Preference::update('plex_servername', -1, $plex_servername, true, true); Preference::update('plex_local_auth', -1, $plex_local_auth, true, true); Preference::update('plex_match_email', -1, $plex_match_email, true, true); break;
// Recurse through them and see if we're calling one of them for ($i = count($params); $i > 0; $i--) { $act = strtolower(implode('_', array_slice($params, 0, $i))); foreach ($methods as $method) { if (in_array($method, $internal_functions)) { continue; } // If the method is the same as the action being called // Then let's call this function! if ($act == $method) { if ($act != 'users' && $act != 'users_account' && $act != 'manage_frameworks_ekspinner_resources') { Plex_Api::auth_user(); } Plex_Api::setHeader('xml'); Plex_Api::setPlexHeader($headers); call_user_func(array('plex_api', $method), array_slice($params, $i, count($params) - $i)); // We only allow a single function to be called, and we assume it's cleaned up! exit; } } // end foreach methods in API } } else { Plex_Api::auth_user(); Plex_Api::setHeader('xml'); Plex_Api::setPlexHeader($headers); Plex_Api::root(); exit; } Plex_Api::createError(404);