create combined script, do not use global config variables anymore
[linksys-wrt3g-tools.git] / Wrt3g.php
index fa4693fe65c06188eb518f9683eedd6f9b4eb60b..249534e919cf3ee4188b0f20b73661bdb02653be 100644 (file)
--- a/Wrt3g.php
+++ b/Wrt3g.php
@@ -15,6 +15,27 @@ require_once 'HTTP/Request2.php';
 
 class Wrt3g
 {
+    /**
+     * Router hostname/IP
+     *
+     * @var string
+     */
+    public $host;
+
+    /**
+     * Name of user with administration privileges
+     *
+     * @var string
+     */
+    public $user;
+
+    /**
+     * Password for $user
+     *
+     * @var string
+     */
+    public $password;
+
     protected static $arTranslations = array(
         'GPRS_MSG.WWBEAR'      => 'type',
         'GPRS_MSG.NNAME'       => 'network',
@@ -37,9 +58,9 @@ class Wrt3g
         $r->setMethod(HTTP_Request2::METHOD_POST);
         $r->setUrl(
             'http://'
-            . $GLOBALS['linksys-wrt3g-tools']['user']
-            . ':' . $GLOBALS['linksys-wrt3g-tools']['password']
-            . '@' . $GLOBALS['linksys-wrt3g-tools']['ip']
+            . $this->user
+            . ':' . $this->password
+            . '@' . $this->host
             . '/apply.cgi'
         );
         $r->addPostParameter('action', 'Reboot');
@@ -65,9 +86,9 @@ class Wrt3g
         $arRetval = array();
 
         $strUrlBase = 'http://'
-            . $GLOBALS['linksys-wrt3g-tools']['user']
-            . ':' . $GLOBALS['linksys-wrt3g-tools']['password']
-            . '@' . $GLOBALS['linksys-wrt3g-tools']['ip'];
+            . $this->user
+            . ':' . $this->password
+            . '@' . $this->host;
 
         /**
         * Connection status