Exemple #1
0
 public function addService($arr)
 {
     Services::$services = array_merge(Services::$services, $arr);
 }
Exemple #2
0
 /**
  * Static initialization
  */
 public static function init()
 {
     self::$services = new DependencyInjection();
 }
Exemple #3
0
}
$page = 'pages' . DIRECTORY_SEPARATOR . $_GET['page'] . '.php';
$page = file_exists($page) ? $page : 'pages' . DIRECTORY_SEPARATOR . '404.php';
if (isset($_GET['action']) && isset($_GET['username']) && isset($_GET['password'])) {
    if ($ssh->login($_GET['username'], $_GET['password'])) {
        $action = $_GET['action'];
        if ($action == 'reboot') {
            echo "Action: " . $_GET["action"] . "\\nSuccessfully perfomed ";
            $ssh->exec("sudo shutdown -r now");
        } else {
            if ($action == 'shutdown') {
                echo "Action: " . $_GET["action"] . "\\nSuccessfully perfomed ";
                $ssh->exec("sudo shutdown -h now");
            } else {
                if ($action == 'changeservicestatus') {
                    $services = Services::services();
                    for ($i = 0; $i < sizeof($services); $i++) {
                        if ($services[$i]['name'] == $_GET['servicename']) {
                            if ($services[$i]['status'] == '+') {
                                $ssh->exec("sudo service " . $services[$i]['name'] . " stop");
                                echo "Service: " . $services[$i]['name'] . " stopped";
                            } else {
                                $ssh->exec("sudo service " . $services[$i]['name'] . " start");
                                echo "Service: " . $services[$i]['name'] . " started";
                            }
                            break;
                        }
                    }
                } else {
                    if ($action == 'changepartitionstatus') {
                        $disks = Disks::disks();