IsOwner())) { if ($user->IsAdmin()) { WebContextManager::Redirect("/"); } die('bababooey'); } adminPanelStats(); //global variables $devmode = false; ////db queries $maintenancequery = $pdo->prepare("SELECT * FROM websettings WHERE maintenance = 1"); $maintenancequery->execute(); $status = $pdo->prepare("SELECT * FROM websettings WHERE maintenance = 1"); $status->execute(); $websettings = $pdo->prepare("SELECT * FROM websettings"); $websettings->execute(); $websettings = $websettings->fetch(PDO::FETCH_OBJ); ////end db queries ////Third party web queries $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, 'https://api.cloudflare.com/client/v4/zones/6dea541960676cbb10231ce5c8035b4c/settings/development_mode'); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $cloudflareheader); $curl_response = curl_exec($soap_do); $result = json_decode($curl_response,true); if ($result['result']['value'] == "on") { $devmode = true; } else { $devmode = false; } ////end Third party web queries //end queries if(isset($_POST['maintenanceon'])) { enableMaintenance($_POST['optionalmaintenancetext']); WebContextManager::Redirect("configuration"); } if(isset($_POST['maintenanceoff'])) { disableMaintenance(); WebContextManager::Redirect("configuration"); } if(isset($_POST['devmodeon'])) { $content = '{"value":"on"}'; $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, 'https://api.cloudflare.com/client/v4/zones/6dea541960676cbb10231ce5c8035b4c/settings/development_mode'); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $content); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $cloudflareheader); $curl_response = curl_exec($soap_do); WebContextManager::Redirect("configuration"); } if(isset($_POST['devmodeoff'])) { $content = '{"value":"off"}'; $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, 'https://api.cloudflare.com/client/v4/zones/6dea541960676cbb10231ce5c8035b4c/settings/development_mode'); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_CUSTOMREQUEST, 'PATCH'); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $content); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $cloudflareheader); $curl_response = curl_exec($soap_do); WebContextManager::Redirect("configuration"); } if (isset($_POST['clearcachesubmit'])) { $content = '{"purge_everything":true}'; $soap_do = curl_init(); curl_setopt($soap_do, CURLOPT_URL, 'https://api.cloudflare.com/client/v4/zones/6dea541960676cbb10231ce5c8035b4c/purge_cache'); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($soap_do, CURLOPT_TIMEOUT, 30); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($soap_do, CURLOPT_POST, true); curl_setopt($soap_do, CURLOPT_POSTFIELDS, $content); curl_setopt($soap_do, CURLOPT_HTTPHEADER, $cloudflareheader); $curl_response = curl_exec($soap_do); WebContextManager::Redirect("configuration"); } if (isset($_POST['submitwskey'])) { $key = genHash(16); $setwskey = $pdo->prepare("UPDATE websettings SET webservice_key = :k"); $setwskey->bindParam(":k", $key, PDO::PARAM_STR); $setwskey->execute(); WebContextManager::Redirect("configuration"); } if (isset($_POST['setwsipwhitelist'])) { $setwsip = $pdo->prepare("UPDATE websettings SET webservice_whitelist = :w"); $setwsip->bindParam(":w", $_POST['setwsipwhitelist'], PDO::PARAM_STR); $setwsip->execute(); WebContextManager::Redirect("configuration"); } if (isset($_POST['cachingon'])) { $setapprovals = $pdo->prepare("UPDATE websettings SET avatarCaching = 1"); $setapprovals->execute(); WebContextManager::Redirect("configuration"); } if (isset($_POST['cachingoff'])) { $setapprovals = $pdo->prepare("UPDATE websettings SET avatarCaching = 0"); $setapprovals->execute(); WebContextManager::Redirect("configuration"); } $maintenancestatus = ""; if ($maintenancequery->rowCount() > 0) { $maintenancestatus = 'ON'; } else { $maintenancestatus = 'OFF'; } $developmentmodestatus = ""; if ($devmode) { $developmentmodestatus = 'ON'; } else { $developmentmodestatus = 'OFF'; } $body = <<
General Configuration
Maintenance ON/OFF
Maintenance is currently: {$maintenancestatus}

Development Mode (no cache) ON/OFF
Development Mode is currently: {$developmentmodestatus}

Clear Cache

Generate RCC Backend Key

Set Backend IP Whitelist
Current Backend Whitelisted IP's:
{$websettings->webservice_whitelist}

EOT; pageHandler(); $ph->pagetitle = ""; $ph->navbar = ""; $ph->body = $body; $ph->footer = ""; $ph->output();