function handle_show_all($user) { $userid = get_int("userid"); $appid = get_int("appid"); $state = get_int("state"); if ($userid) { // user looking at their own batches // if ($userid != $user->id) { error_page("wrong user"); } $batches = BoincBatch::enum("user_id = {$user->id} and state={$state} order by id desc"); fill_in_app_and_user_names($batches); show_batches_in_state($batches, $state); } else { // admin looking at batches // check_admin_access($user, $appid); if ($appid) { $app = BoincApp::lookup_id($appid); if (!$app) { error_page("no such app"); } $batches = BoincBatch::enum("app_id = {$appid} and state={$state} order by id desc"); } else { $batches = BoincBatch::enum("state={$state} order by id desc"); } fill_in_app_and_user_names($batches); show_batches_in_state($batches, $state); } }
// data invalid } if ($notification == 1) { NotificationListener::enableNotification(NotificationListener::LISTENER_TYPE_GLOBAL, null, false, $userid); } else { NotificationListener::disableNotification(NotificationListener::LISTENER_TYPE_GLOBAL, null, $userid); } if ($updateresult) { jsonExit(array('error' => 0)); // everything is fine } else { jsonExit(array('error' => 4)); // error updating user } } elseif (isset($_GET['deleteuser'])) { check_admin_access(); stop_gpc($_POST); $userid = (int) _post('yttuserid'); // check input if (empty($userid)) { jsonExit(array('error' => 1)); // data invalid } $result = $db->dq("DELETE FROM {$db->prefix}users WHERE id = ?", array($userid)); if ($result->affected()) { jsonExit(array('error' => 0)); // done } else { jsonExit(array('error' => 2)); // error }