function process_post() { /* We switch according to the $_POST[action] variable, which is a hidden * submit formfield in each <form>. see html/add*.txt for more information. */ switch ("{$_POST['action']}") { /* * Add new user. We wont touch that here. Let auth() handle that. */ case "newuser": addNewUser(); break; /* * Update to the about box in profiles. */ /* * Update to the about box in profiles. */ case "modprofile": modProfile(); break; /* * Change password. We wont touch that here. Let auth() handle that. */ /* * Change password. We wont touch that here. Let auth() handle that. */ case "changepw": changePassword(); break; /* * Change email. */ /* * Change email. */ case "changeemail": changeEmail(); break; /* * Change can view preferences. */ /* * Change can view preferences. */ case "changecanpage": changeCanPrefs(); break; /* * Update API Key */ /* * Update API Key */ case "update_api": global $MySelf; $api = new api($MySelf->getID()); if ($_POST[deleteKey]) { // Delete api Key $api->deleteApiKey(); makeNotice("Your API key has been delete from the database.", "notice", "API Key wipe success", "index.php?action=preferences"); } else { // Update api key $api->setApiKey($_POST[apiID], $_POST[apiKey]); makeNotice("Your new API key has been stored.", "notice", "API Key update success", "index.php?action=preferences"); } break; /* * Add a Rank */ /* * Add a Rank */ case "addnewrank": addRank(); break; /* * Edit the ranks */ /* * Edit the ranks */ case "editranks": editRanks(); break; /* * Change opt-in status. */ /* * Change opt-in status. */ case "optIn": toggleOptIn(); break; /* * Change See Inoffical Runs Setting (sir) */ /* * Change See Inoffical Runs Setting (sir) */ case "sirchange": sirchange(); break; /* * Submiting a template change form */ /* * Submiting a template change form */ case "editTemplate": editTemplate(); break; /* * Change ore value. */ /* * Change ore value. */ case "changeore": changeOreValue(); break; /* * Change ship value. */ /* * Change ship value. */ case "changeship": changeShipValue(); break; /* * Delete pending payout request */ /* * Delete pending payout request */ case "deleteRequest": deletePayoutRequest(); break; /* * Modify online time. */ /* * Modify online time. */ case "modonlinetime": modOnlineTime(); break; /* * Modify site settings. */ /* * Modify site settings. */ case "configuration": modConfiguration(); break; /* * Add an event to the DB */ /* * Add an event to the DB */ case "addevent": addEventToDB(); break; /* * Request payout. */ /* * Request payout. */ case "requestPayout": requestPayout(); break; /* * Transfer Money */ /* * Transfer Money */ case "transferMoney": transferMoney(); break; /* * Do the payouts */ /* * Do the payouts */ case "payout": doPayout(); break; /* * Create a new can in the Database. */ /* * Create a new can in the Database. */ case "addcan": addCanToDatabase(); break; /* * Admin request to change a user. */ /* * Admin request to change a user. */ case "edituser": editUser(); break; /* * AddRun * This adds a new run to the database. */ /* * AddRun * This adds a new run to the database. */ case "addrun": addRun(); break; /* * Analog to AddRun, just for Hauls. */ /* * Analog to AddRun, just for Hauls. */ case "addhaul": addHaul(); break; /* * Create a new transaction. */ /* * Create a new transaction. */ case "transaction": createTransaction(); break; /* * Lotto stuff */ /* * Lotto stuff */ case "editLottoTickets": lotto_editCreditsInDB(); break; case "createDrawing": lotto_createDrawing(); break; case "lottoBuyCredits": lotto_buyTickets(); break; } }
$fields = []; $db->query('SHOW COLUMNS FROM `staff_ranks` WHERE `Type` = "enum(\'Yes\',\'No\')"'); $db->execute(); $rows = $db->fetch_row(); foreach ($rows as $row) { $fields[] = $row['Field']; } $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : null; $_GET['action'] = array_key_exists('action', $_GET) && ctype_alpha($_GET['action']) ? strtolower(trim($_GET['action'])) : null; switch ($_GET['action']) { case 'add': if (!$users->hasAccess('staff_panel_staff_ranks_add')) { $mtg->error('You don\'t have access'); } $users->updateStatus("Adding a new staff rank"); addRank($db, $mtg, $logs, $fields); break; case 'edit': if (!$users->hasAccess('staff_panel_staff_ranks_edit')) { $mtg->error('You don\'t have access'); } $users->updateStatus("Editing a staff rank"); editRank($db, $mtg, $logs, $fields); break; case 'del': if (!$users->hasAccess('staff_panel_staff_ranks_delete')) { $mtg->error('You don\'t have access'); } $users->updateStatus("Deleting a staff rank"); deleteRank($db, $mtg, $logs); break;