add travis script
authorStricted <info@stricted.de>
Thu, 2 Jul 2015 07:47:34 +0000 (09:47 +0200)
committerStricted <info@stricted.de>
Thu, 2 Jul 2015 07:48:42 +0000 (09:48 +0200)
.travis.yml [new file with mode: 0644]
README.md
speedport.class.php

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..bcef372
--- /dev/null
@@ -0,0 +1,17 @@
+language: php
+php:
+  - 5.3
+  - 5.4
+  - 5.5
+  - 5.6
+  - nightly
+allow_failures:
+    - php: nightly
+before_install:
+  - pear install pear/PHP_CodeSniffer
+  - phpenv rehash
+before_script:
+  - git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF
+script:
+  - find . -type f -name '*.php' -not -path "./WCF/*" |xargs -I file php -l file  > /dev/null
+  - phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" --ignore="CryptLib/" --ignore="WCF/" .
\ No newline at end of file
index 9ff049c5d92ba74bfc68d2adffebcb77149ba2e0..26ec482b41b3672ed5a050301da259724fb0ef5d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,7 +1,35 @@
-## speedport hybrid php api
+### speedport hybrid php api
+
+[![Build Status](https://travis-ci.org/Stricted/speedport-hybrid-php-api.svg)](https://travis-ci.org/Stricted/speedport-hybrid-php-api)
 
 Access Speedport Hybrid Router through PHP
 
 
 Access Speedport Hybrid Router through PHP
 
+**THIS CLASS IS ONLY FOR SPEEDPORT HYBRID**
+
 ### License
 ---
 ### License
 ---
-This project is licensed under [GNU LESSER GENERAL PUBLIC LICENSE Version 3](https://github.com/Stricted/speedport-hybrid-php-api/blob/master/LICENSE).
\ No newline at end of file
+This project is licensed under [GNU LESSER GENERAL PUBLIC LICENSE Version 3](https://github.com/Stricted/speedport-hybrid-php-api/blob/master/LICENSE).
+
+known valid paths for getData() :
+ * /data/dsl.json
+ * /data/interfaces.json
+ * /data/arp.json
+ * /data/session.json
+ * /data/dhcp_client.json
+ * /data/dhcp_server.json
+ * /data/ipv6.json
+ * /data/dns.json
+ * /data/routing.json
+ * /data/igmp_proxy.json
+ * /data/igmp_snooping.json
+ * /data/wlan.json
+ * /data/module.json
+ * /data/memory.json
+ * /data/speed.json
+ * /data/webdav.json
+ * /data/bonding_client.json
+ * /data/bonding_tunnel.json
+ * /data/filterlist.json
+ * /data/bonding_tr181.json
+ * /data/letinfo.json
+ * /data/Status.json
\ No newline at end of file
index 4aa517d0d500bc55e985ec3509f0bc1dc441486a..bbfe6fa1f84e12d82b7c40dfaaa522b4e488a7b2 100644 (file)
@@ -167,31 +167,6 @@ class speedport {
        /**
         * return the given json as array
         * 
        /**
         * return the given json as array
         * 
-        * the following paths are known to be valid:
-        * /data/dsl.json
-        * /data/interfaces.json
-        * /data/arp.json
-        * /data/session.json
-        * /data/dhcp_client.json
-        * /data/dhcp_server.json
-        * /data/ipv6.json
-        * /data/dns.json
-        * /data/routing.json
-        * /data/igmp_proxy.json
-        * /data/igmp_snooping.json
-        * /data/wlan.json
-        * /data/module.json
-        * /data/memory.json
-        * /data/speed.json
-        * /data/webdav.json
-        * /data/bonding_client.json
-        * /data/bonding_tunnel.json
-        * /data/filterlist.json
-        * /data/bonding_tr181.json
-        * /data/letinfo.json
-        * 
-        * /data/Status.json (No login needed)
-        * 
         * @param       string  $file
         * @return      array
         */
         * @param       string  $file
         * @return      array
         */
@@ -298,8 +273,12 @@ class speedport {
                return $json;
        }
        
                return $json;
        }
        
-       /*
-       // i dont want test this :D, feel free to test it and report if it works or not
+       /**
+        * reset the router to Factory Default
+        * not tested
+        *
+        * @return      array
+        */
        public function resetToFactoryDefault () {
                $path = 'data/resetAllSetting.json';
                $fields = array('csrf_token' => 'nulltoken', 'showpw' => 0, 'password' => $this->hash, 'reset_all' => 'true');
        public function resetToFactoryDefault () {
                $path = 'data/resetAllSetting.json';
                $fields = array('csrf_token' => 'nulltoken', 'showpw' => 0, 'password' => $this->hash, 'reset_all' => 'true');
@@ -309,7 +288,7 @@ class speedport {
                
                return $json;
        }
                
                return $json;
        }
-       */
+       
        
        /**
         * check if firmware is actual
        
        /**
         * check if firmware is actual
@@ -482,7 +461,8 @@ class speedport {
                $headers = array();
                $header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
                
                $headers = array();
                $header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
                
-               foreach (explode("\r\n", $header_text) as $i => $line) {
+               $header_text = explode("\r\n", $header_text);
+               foreach ($header_text as $i => $line) {
                        if ($i === 0) {
                                $headers['http_code'] = $line;
                        }
                        if ($i === 0) {
                                $headers['http_code'] = $line;
                        }
@@ -494,4 +474,4 @@ class speedport {
                
                return $headers;
        }
                
                return $headers;
        }
-}
\ No newline at end of file
+}