exit; } if (isset($_GET["statistics-today"])) { statistics_today(); exit; } if (isset($_GET["statistics-today-graph-0"])) { statistics_today_graph0(); exit; } if (isset($_POST["innodb_buffer_pool_size"])) { tune_save(); exit; } if (isset($_GET["tune"])) { tune(); exit; } main_page(); exit; function main_page() { $page = CurrentPageName(); $tplfile = "ressources/templates/endusers/index.html"; if (!is_file($tplfile)) { echo "{$tplfile} no such file"; die; } $content = @file_get_contents($tplfile); $content = str_replace("{SCRIPT}", "<script>LoadAjax('globalContainer','{$page}?content=yes')</script>", $content); echo $content;
function phar_buildFromZip($zipPath, $name = "", TuneArgs $args) { // extract $zip = new ZipArchive(); $result = ["phar" => null, "pharpath" => "index.php", "extractpath" => htdocs . "index.php", "error" => MAKEPHAR_ERROR_NO, "error_id" => "N/A", "error_name" => "N/A", "erorr_msg" => "N/A", "warnings" => [], "notices" => []]; if (($err = $zip->open($zipPath)) !== true) { $result["error"] = MAKEPHAR_ERROR_OPENZIP; $result["error_id"] = $err; switch ($err) { case ZipArchive::ER_EXISTS: echo "ER_EXISTS({$err}) File already exists"; $result["error_name"] = "ER_EXISTS"; $result["error_msg"] = "File already exists"; break; case ZipArchive::ER_INCONS: $result["error_name"] = "ER_INCONS"; $result["error_msg"] = "Zip archive inconsistent"; break; case ZipArchive::ER_INVAL: $result["error_name"] = "ER_INVAL"; $result["error_msg"] = "Invalid argument"; break; case ZipArchive::ER_MEMORY: $result["error_name"] = "ER_MEMORY"; $result["error_msg"] = "Malloc failure"; break; case ZipArchive::ER_NOENT: $result["error_name"] = "ER_NOENT"; $result["error_msg"] = "No such file"; break; case ZipArchive::ER_NOZIP: $result["error_name"] = "ER_NOZIP"; $result["error_msg"] = "This is not a ZIP file"; break; case ZipArchive::ER_OPEN: $result["error_name"] = "ER_OPEN"; $result["error_msg"] = "Cannot open file"; break; case ZipArchive::ER_READ: $result["error_name"] = "ER_READ"; $result["error_msg"] = "Read error"; break; case ZipArchive::ER_SEEK: $result["error_name"] = "ER_SEEK"; $result["error_msg"] = "Seek error"; break; default: $result["error_name"] = "Unknown"; $result["error_msg"] = "Unknown error"; break; } return $result; } $dir = getTmpDir(); if ($zip->extractTo($dir) !== true) { $result["error"] = MAKEPHAR_ERROR_EXTRACTZIP; $result["error_id"] = false; $result["error_name"] = ""; $result["error_msg"] = "Error extracting ZIP"; return $result; } if (!is_file($dir . "plugin.yml")) { $result["warnings"][] = "Cannot find plugin.yml in ZIP root!"; $results = []; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)) as $file) { if (strtolower(basename($file)) === "plugin.yml") { $real = realpath($file); $include = str_replace("\\", "/", substr($real, strlen(realpath($dir)))); $slashCount = 0; for ($pos = 0; ($pos = strpos($include, "/", $pos + 1)) !== false; $slashCount++) { } $htmlInclude = htmlspecialchars($include); $results[] = ["real" => $real, "include" => $include, "htmlInclude" => $htmlInclude, "slashCount" => $slashCount]; } } if (count($results) === 0) { $result["error"] = MAKEPHAR_ERROR_NO_PLUGIN_YML; $result["error_id"] = false; $result["error_name"] = ""; $result["error_msg"] = ""; return $result; } if (count($results) > 1) { echo "<p>"; $result["notices"][] = "The following occurrences of <code>plugin.yml</code> are found in the ZIP file:"; $notice = "<ul>"; $minReal = null; $min = null; $minCnt = PHP_INT_MAX; foreach ($results as $resultInfo) { /** @var string $htmlInclude */ /** @var string $include */ /** @var string $real */ /** @var int $slashCount */ extract($resultInfo); $notice .= "<li>{$htmlInclude}</li>"; if ($minCnt > $slashCount) { $minCnt = $slashCount; $min = $include; $minReal = $real; } } $notice .= "</ul>"; $result["notices"][] = $notice; $result["notices"][] = "Selecting {$min} as the <code>plugin.yml</code> to build around with."; $dir = dirname($minReal) . "\\"; } else { /** @var string $htmlInclude */ /** @var string $real */ extract($results[0]); $result["notices"] = "<p>Selecting {$htmlInclude} as the <code>plugin.yml</code> to build around with.</p>"; $dir = dirname($real) . "/"; } } $result["extractpath"] = $dir; // tune tune($dir, $args); // compile while (is_file($file = DATA_PATH . ($subpath = "phars/" . randomClass(16, "phar_" . $name . "_") . ".phar"))) { } $result["phar"] = $phar = new Phar($file); $result["pharpath"] = "/data/{$subpath}"; $phar->setStub($_POST["stub"]); $phar->setSignatureAlgorithm(Phar::SHA1); $phar->startBuffering(); $phar->buildFromDirectory($dir); // $phar->compressFiles(Phar::GZ); $phar->stopBuffering(); return $result; }
function settings() { $sock = new sockets(); $MySQLSyslogType = $sock->GET_INFO("MySQLSyslogType"); if (!is_numeric($MySQLSyslogType)) { $MySQLSyslogType = 1; } if ($MySQLSyslogType == 1) { tune(); return; } if ($MySQLSyslogType == 2) { mysqlparams(); return; } }
*/ $jsonOutput = isset($_REQUEST['json']) ? $_REQUEST['json'] : false; $soap = true; require 'dbAccess.php'; $db = new AutotuneDb(); if (!isset($_REQUEST['tracking']) && isset($_POST['userData'], $_POST['baseModel'], $_POST['schedule'], $_POST['parameters'], $_REQUEST['weather'])) { // tune an order $soap = false; $uData = $_POST['userData']; $bModel = $_POST['baseModel']; $schedule = $_POST['schedule']; $parameters = $_POST['parameters']; $weather = $_REQUEST['weather']; // set optional inputs $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : ""; tune($uData, $bModel, $schedule, $parameters, $weather, $email); } else { if (isset($_REQUEST['tracking'])) { // do something with given tracking $soap = false; $tracking = $_REQUEST['tracking']; // give full details if (isset($_REQUEST['full']) && $_REQUEST['full']) { getFullOutput($tracking); } else { if (isset($_REQUEST['terminate'])) { $terminate = $_REQUEST['terminate']; setTerminate($tracking, $terminate); } else { if (isset($_REQUEST['modelId'])) { $modelId = $_REQUEST['modelId'];