X-Git-Url: https://git.stricted.de/?p=GitHub%2FStricted%2Fspeedport-hybrid-php-api.git;a=blobdiff_plain;f=System.class.php;h=4bf7a279b404abebb1f6b7013c833a89adf3e7f5;hp=418403b2e64d75527d9a9bacb2ecd402b5cb8387;hb=e9631169a21a4bda05ca026fcbde2c6ce8646a38;hpb=9b926efe0bf5526ce1049e9a89e92b27a45c14ec diff --git a/System.class.php b/System.class.php index 418403b..4bf7a27 100644 --- a/System.class.php +++ b/System.class.php @@ -81,4 +81,32 @@ trait System { return $data['body']; } -} \ No newline at end of file + + /** + * reboot the router + * + * @return boolean + */ + public function reboot () { + $this->checkLogin(); + + $path = 'data/Reboot.json'; + $fields = array('csrf_token' => $this->token, 'reboot_device' => 'true'); + $data = $this->sentEncryptedRequest($path, $fields, true); + $data = $this->getValues($data['body']); + + if ($data['status'] == 'ok') { + // reset challenge and session + $this->challenge = ''; + $this->cookie = ''; + $this->token = ''; + $this->derivedk = ''; + + // throw an exception because router is unavailable for other tasks + // like $this->logout() or $this->checkLogin + throw new RebootException('Router Reboot'); + } + + return false; + } +}