From: Stricted Date: Sat, 8 Aug 2015 13:41:34 +0000 (+0200) Subject: update some stuff X-Git-Url: https://git.stricted.de/?p=GitHub%2FStricted%2Fspeedport-hybrid-php-api.git;a=commitdiff_plain;h=cb3cff5caff8d4896ba9b2e02acc66ce49d09f5e update some stuff --- diff --git a/ISpeedport.class.php b/ISpeedport.class.php index a613483..ca9045b 100644 --- a/ISpeedport.class.php +++ b/ISpeedport.class.php @@ -15,8 +15,13 @@ interface ISpeedport { /** * get the csrf_token - * - * @return string */ - protected function getToken (); + public function getToken (); + + /** + * check if we are logged in + * + * @param boolean $exception + */ + public function checkLogin ($exception = true); } diff --git a/Speedportw724v.class.php b/Speedportw724v.class.php index 85557f7..8668fc2 100644 --- a/Speedportw724v.class.php +++ b/Speedportw724v.class.php @@ -9,6 +9,12 @@ require_once('SpeedportHybrid.class.php'); * @copyright 2015 Jan Altensen (Stricted) */ class Speedportw724v extends SpeedportHybrid implements ISpeedport { + /** + * login into the router with the given password + * + * @param string $password + * @return boolean + */ public function login ($password) { /* this is experimental, i dont have a speedport w724v so i cant test this * feel free to test it and report if it dosent work @@ -33,6 +39,15 @@ class Speedportw724v extends SpeedportHybrid implements ISpeedport { return false; } + /** + * get the csrf_token + * + * @return string + */ + protected function getToken () { + // TODO: check if this is needed + } + /** * sends the request to router * diff --git a/lib/trait/Login.class.php b/lib/trait/Login.class.php index b33947c..185a832 100644 --- a/lib/trait/Login.class.php +++ b/lib/trait/Login.class.php @@ -57,7 +57,7 @@ trait Login { $fields = array('csrf_token' => 'nulltoken', 'showpw' => 0, 'challengev' => 'null'); $data = $this->sentRequest($path, $fields); $data = $this->getValues($data['body']); - print_r($data); + if (isset($data['challengev']) && !empty($data['challengev'])) { return $data['challengev']; }