From 7f4a51d27f933b893253b30d583f82822f659a6e Mon Sep 17 00:00:00 2001 From: Stricted Date: Thu, 2 Jul 2015 09:47:34 +0200 Subject: [PATCH] add travis script --- .travis.yml | 17 +++++++++++++++++ README.md | 32 ++++++++++++++++++++++++++++++-- speedport.class.php | 40 ++++++++++------------------------------ 3 files changed, 57 insertions(+), 32 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..bcef372 --- /dev/null +++ b/.travis.yml @@ -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 diff --git a/README.md b/README.md index 9ff049c..26ec482 100644 --- 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 +**THIS CLASS IS ONLY FOR SPEEDPORT HYBRID** + ### 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 diff --git a/speedport.class.php b/speedport.class.php index 4aa517d..bbfe6fa 100644 --- a/speedport.class.php +++ b/speedport.class.php @@ -167,31 +167,6 @@ class speedport { /** * 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 */ @@ -298,8 +273,12 @@ class speedport { 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'); @@ -309,7 +288,7 @@ class speedport { return $json; } - */ + /** * check if firmware is actual @@ -482,7 +461,8 @@ class speedport { $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; } @@ -494,4 +474,4 @@ class speedport { return $headers; } -} \ No newline at end of file +} -- 2.20.1