stop(); die; } if ($argv[1] == "--start") { $GLOBALS["OUTPUT"] = true; start(); die; } if ($argv[1] == "--restart") { $GLOBALS["OUTPUT"] = true; restart(); die; } if ($argv[1] == "--tables") { $GLOBALS["OUTPUT"] = true; checktables(); die; } if ($argv[1] == "--dbsize") { $GLOBALS["OUTPUT"] = true; InfluxDbSize(); die; } if ($argv[1] == "--remove-influx") { $GLOBALS["OUTPUT"] = true; remove_influx(); die; } if ($argv[1] == "--install") { $GLOBALS["OUTPUT"] = true; install_postgres();
} elseif ($status["0"] == "0") { $notice = "toastr.error('Message not sent, please try again');"; } else { $notice = "toastr.error('Something went wrong, try again');"; } } if (isset($_POST["baction"]) && $_POST["baction"] == "Shutdown CSP Server") { $status = cspshutdown(); if ($status == "1") { $notice = "toastr.success('Shutdown initiated');"; } else { $notice = "toastr.error('Something went wrong, try again');"; } } if (isset($_POST["baction"]) && $_POST["baction"] == "Check tables") { $status = checktables(); if ($status == "1") { $notice = "toastr.success('Database tables checked successfully');"; } else { $notice = "toastr.error('Something went wrong, try again');"; } } if (isset($_POST["baction"]) && $_POST["baction"] == "Analyze tables") { $status = analyzetables(); if ($status == "1") { $notice = "toastr.success('Database tables analyzed successfully');"; } else { $notice = "toastr.error('Something went wrong, try again');"; } } if (isset($_POST["baction"]) && $_POST["baction"] == "Repair tables") {
$data = fread($fh, filesize("../includes/cmumdb.sql")); $charset = str_replace("-", "", $charset); $data = str_replace("%cmumdbname%", $sqlname, $data); $data = str_replace("%charset%", $charset, $data); $data = str_replace("%aname%", $admin_name, $data); $data = str_replace("%apass%", hash("sha256", $admin_pass . $seckey), $data); fclose($fh); $datalines = preg_split("/\r\n|[\r\n]/", $data); foreach ($datalines as $i => $value) { $mysqli->query($datalines[$i]); } $status = "1"; } mysqli_close($mysqli); return $status; } // // install ajax helpers // if (isset($_POST["function"]) && $_POST["function"] == "dbcheck" && $_POST["host"] != "" && $_POST["user"] != "" && $_POST["pass"] != "") { $status = checkmysql($_POST["host"], $_POST["user"], $_POST["pass"]); echo $status; } if (isset($_POST["function"]) && $_POST["function"] == "tblcheck" && $_POST["host"] != "" && $_POST["user"] != "" && $_POST["pass"] != "" && $_POST["name"] != "") { $status = checktables($_POST["host"], $_POST["user"], $_POST["pass"], $_POST["name"]); echo $status; } if (isset($_POST["function"]) && $_POST["function"] == "dbinstall" && $_POST["host"] != "" && $_POST["name"] != "" && $_POST["user"] != "" && $_POST["pass"] != "" && $_POST["charset"] != "" && $_POST["aname"] != "" && $_POST["apass"] != "" && $_POST["skey"] != "") { $status = installcmumdb($_POST["host"], $_POST["name"], $_POST["user"], $_POST["pass"], $_POST["charset"], $_POST["aname"], $_POST["apass"], $_POST["skey"]); echo $status; }