require_once() is inperformant, replace with require()
[core.git] / inc / classes / third_party / api / primusportal / class_PrimeraApi.php
index fba7463490046fd02a5426135a3e9a26a97da59c..1f7036e935da2eff22abf71c1bb44e64ef931463 100644 (file)
@@ -17,7 +17,7 @@
  * Die Einbindung des Interfaces geschieht folgendermaßen:
  *  1. Einbindung der Klasse in Ihr PHP-Auszahlungsskript:
  *     CODE:
- *       require_once( "PFAD/ZU/DER/KLASSE/PrimusInterface.class.php" );
+ *       require( "PFAD/ZU/DER/KLASSE/PrimusInterface.class.php" );
  *       $PPUsername = "username"; // Ihr Username bei Primusportal
  *       $PPPassword = "passwort"; // Ihr Passwort bei Primusportal
  *
@@ -45,7 +45,7 @@
  *
  *     Die komplette Rückgabe des Interfaces wird als assoziatives Array in der Klassen-
  *     variable __data gespeichert:
- *     __data => array("status" => Rückgabecode (PI_DONE, PI_SENDER_ERROR, ...),
+ *     __data => array('status' => Rückgabecode (PI_DONE, PI_SENDER_ERROR, ...),
  *                     "statustext" => Status in Worten (z.B.: "Transaktion erfolgreich durchgeführt"),
  *                     ")
  *
@@ -56,7 +56,7 @@
  * @copyright  (c) 2007 by Primusportal.de
  * @copyright  (c) 2008 by Roland Haeder
  */
-class PrimeraApi {
+class PrimeraApi extends BaseFrameworkSystem {
        /**
         * Fehler - Interfacebenutzer
         */
@@ -109,12 +109,12 @@ class PrimeraApi {
        private $path = "/transfer.interface.2.0.php";
 
        private $errno = 0;
-       private $err = "";
+       private $err = '';
 
-       private $seperator = ":";
+       private $seperator = ':';
 
-       private $username = "";
-       private $password = "";
+       private $username = '';
+       private $password = '';
 
        private $data = array();
 
@@ -154,7 +154,7 @@ class PrimeraApi {
                fputs($fp, "Connection: close\r\n\r\n");
                fputs($fp, $data);
 
-               $return = "";
+               $return = '';
                while (!feof($fp)) {
                        $return.=fgets($fp,128);
                }
@@ -170,7 +170,7 @@ class PrimeraApi {
                $x = explode("\n", $content);
                $return = array();
                foreach($x as $currentLine) {
-                       $line_exploded = explode(":", $currentLine,2);
+                       $line_exploded = explode($this->seperator, $currentLine,2);
                        if (count($line_exploded) > 1) {
                                $return[$line_exploded[0]] = $line_exploded[1];
                        }
@@ -183,17 +183,18 @@ class PrimeraApi {
         * @param int$Amount Betrag in ganzzahligen Primera
         * @param string $Description Beschreibung (Sichtbar in Einzelauflistung)
         */
-       public function payPrimera ($Receiver, $Amount, $Description = "") {
+       public function payPrimera ($Receiver, $Amount, $Description = '') {
                $valid = false;
-               $PostData = array("PrimusInterface_Action" => "Pay",
-                       "PrimusInterface_Receiver" => base64_encode($Receiver),
-                       "PrimusInterface_Amount" => base64_encode($Amount),
-                       "PrimusInterface_Description" => base64_encode($Description) );
+               $PostData = array(
+                       'PrimusInterface_Action'      => 'Pay',
+                       'PrimusInterface_Receiver'    => base64_encode($Receiver),
+                       'PrimusInterface_Amount'      => base64_encode($Amount),
+                       'PrimusInterface_Description' => base64_encode($Description) );
 
                $PostReturn = $this->parseContent( $this->queryApi($PostData) );
 
                $this->data = $PostReturn;
-               if ($PostReturn["status"] == "200") {
+               if ($PostReturn['status'] == '200') {
                        $valid = true;
                }
                return $valid;
@@ -205,16 +206,17 @@ class PrimeraApi {
         * - ist er aktiv
         * @param string/int $User Userid / Username
         */
-       function CheckPrimusUser($User) {
+       function CheckPrimusUser ($User) {
                $valid = false;
-               $PostData = array("PrimusInterface_Action"=> "CheckPrimusUser",
-                       "PrimusInterface_CheckPrimusUser" => $User);
+               $PostData = array(
+                       'PrimusInterface_Action'          => 'CheckPrimusUser',
+                       'PrimusInterface_CheckPrimusUser' => $User);
 
                $PostReturn = $this->parseContent( $this->queryApi($PostData) );
 
                $this->data = $PostReturn;
 
-               if ($PostReturn["status"] == self::PI_USER_CHECK_OK) {
+               if ($PostReturn['status'] == self::PI_USER_CHECK_OK) {
                        $valid = true;
                }
                return $valid;
@@ -229,7 +231,7 @@ class PrimeraApi {
                $PostReturn = $this->parseContent( $this->queryApi($PostData) );
 
                $this->data = $PostReturn;
-               if ($PostReturn["status"] == self::PI_GET_PRIMERA_DONE) {
+               if ($PostReturn['status'] == self::PI_GET_PRIMERA_DONE) {
                        $primera = $PostReturn["primera"];
                }
                return $primera;