update some stuff
authorStricted <info@stricted.de>
Sat, 8 Aug 2015 13:41:34 +0000 (15:41 +0200)
committerStricted <info@stricted.de>
Sat, 8 Aug 2015 13:41:34 +0000 (15:41 +0200)
ISpeedport.class.php
Speedportw724v.class.php
lib/trait/Login.class.php

index a613483dc14c685ade45dc0d047a44e79e6519ef..ca9045b748f6a69aeccc57ea38ea72cbb9364876 100644 (file)
@@ -15,8 +15,13 @@ interface ISpeedport {
        
        /**
         * get the csrf_token
        
        /**
         * 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);
 }
 }
index 85557f78ea5d9bc57b3fe38b4f2b9350d55a71c2..8668fc21edccc7897aed9f87556b10c4327ac927 100644 (file)
@@ -9,6 +9,12 @@ require_once('SpeedportHybrid.class.php');
  * @copyright   2015 Jan Altensen (Stricted)
  */
 class Speedportw724v extends SpeedportHybrid implements ISpeedport {
  * @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
        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;
        }
        
                return false;
        }
        
+       /**
+        * get the csrf_token
+        * 
+        * @return      string
+        */
+       protected function getToken () {
+               // TODO: check if this is needed
+       }
+       
        /**
         * sends the request to router
         * 
        /**
         * sends the request to router
         * 
index b33947ce821b494bf4c5d67bb320ed5dc18ccbc3..185a832792f9f4f5065d3c4e4e9f3b444b216696 100644 (file)
@@ -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']);
                $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'];
                }
                if (isset($data['challengev']) && !empty($data['challengev'])) {
                        return $data['challengev'];
                }