X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fprimera_functions.php;h=3f7f445f79f577809e72029c9387691a4f9690eb;hb=30986f637cd3c03951bdbfc880b9a420f7724ce0;hp=1d19c960a73467df51e8830c879fd9120f4c96ec;hpb=7f104f6fe558bb56b4205241435a2357c2feece1;p=mailer.git diff --git a/inc/libs/primera_functions.php b/inc/libs/primera_functions.php index 1d19c960a7..3f7f445f79 100644 --- a/inc/libs/primera_functions.php +++ b/inc/libs/primera_functions.php @@ -28,7 +28,7 @@ * * Wobei $PayReicer der Username des Empfängers bei * Primusportal.de ist. $PayAmount ist der gerundete( !! ) Betrag an Primera, - * die der Empfänger erhalten soll. $PayDescription ist eine von Ihnen + * die der Empfänger erhalten soll. $PayDescription ist eine von Ihnen * festgelegte kurze Beschreibung. Die Länge dieses Textes darf 100 Zeichen * nicht überschreiten. Beispiel: * $status = $Interface->payPrimera("garbage", 10000, "Auszahlung IhreSeite.de - ID: 12345"); @@ -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"), * ") * @@ -109,16 +109,16 @@ class PrimeraApi { var $path = "/transfer.interface.2.0.php"; var $errno = 0; - var $err = ""; + var $err = ''; - var $seperator = ":"; + var $seperator = ':'; - var $username = ""; - var $password = ""; + var $username = ''; + var $password = ''; var $data = array(); - var $headers = ""; + var $headers = ''; /** * Konstruktor @@ -134,17 +134,17 @@ class PrimeraApi { */ function queryApi ( $data = array() ) { // Base64-encode username and password hash - $data["PrimusInterface_Username"] = base64_encode($this->username); - $data["PrimusInterface_Password"] = base64_encode($this->password); + $data['PrimusInterface_Username'] = base64_encode($this->username); + $data['PrimusInterface_Password'] = base64_encode($this->password); // Send POST request - $return = POST_URL($this->host.$this->path, $data); + $return = sendPostRequest($this->host.$this->path, $data); // Convert the array into a full string $returnStr = implode("\n", $return); // Extract the real content, strip header away - $content = explode("", $returnStr); + $content = explode('', $returnStr); // Store headers away for debugging $this->headers = $content[0]; @@ -160,7 +160,7 @@ class PrimeraApi { $x = explode("\n", $content); $return = array(); foreach($x as $currentLine) { - $line_exploded = explode(":", $currentLine,2); + $line_exploded = explode(':', $currentLine,2); if (count($line_exploded) > 1) { $return[$line_exploded[0]] = $line_exploded[1]; } @@ -173,17 +173,17 @@ class PrimeraApi { * @param int $Amount Betrag in ganzzahligen Primera * @param string $Description Beschreibung (Sichtbar in Einzelauflistung) */ - function payPrimera ($Receiver, $Amount, $Description = "") { + 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; @@ -197,14 +197,14 @@ class PrimeraApi { */ 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; @@ -215,12 +215,12 @@ class PrimeraApi { */ function getPrimera() { $primera = false; - $postData = array( "PrimusInterface_Action" => "GetPrimera" ); + $postData = array( 'PrimusInterface_Action' => 'GetPrimera' ); $postReturn = $this->parseContent( $this->queryApi($postData) ); $this->data = $postReturn; - if ($postReturn["status"] == self::PI_GET_PRIMERA_DONE) { - $primera = $postReturn["primera"]; + if ($postReturn['status'] == self::PI_GET_PRIMERA_DONE) { + $primera = $postReturn['primera']; } return $primera; } @@ -236,17 +236,15 @@ class PrimeraApi { // is not false the API data is valid, else invalid function PRIMERA_TEST_API () { // Get new instance - $api = new PrimeraApi($_POST['primera_api_name'], $_POST['primera_api_md5']); + $api = new PrimeraApi(REQUEST_POST('primera_api_name'), REQUEST_POST('primera_api_md5')); // Was that fine? return ($api->getPrimera() !== false); } // Execute the withdraw of a sponsor only! function PRIMERA_EXECUTE_WITHDRAW ($primusNick, $userMd5, $amount) { - global $_CONFIG; - // Is the sponsor extension installed? - if (!EXT_IS_ACTIVE("sponsor")) { + if (!EXT_IS_ACTIVE('sponsor')) { // No, abort here return false; } elseif (!IS_SPONSOR()) { @@ -258,7 +256,7 @@ function PRIMERA_EXECUTE_WITHDRAW ($primusNick, $userMd5, $amount) { $api = new PrimeraApi($primusNick, $userMd5); // Prepare purpose - $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_WITHDRAW, $_COOKIE['sponsorid']))."\";"; + $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_WITHDRAW'), getSession('sponsorid')))."\";"; eval($eval); // Pay the Primera @@ -266,13 +264,11 @@ function PRIMERA_EXECUTE_WITHDRAW ($primusNick, $userMd5, $amount) { } // Execute the payout function PRIMERA_EXECUTE_PAYOUT ($primusNick, $userMd5, $amount) { - global $_CONFIG; - // Get new instance - $api = new PrimeraApi($_CONFIG['primera_api_name'], $_CONFIG['primera_api_md5']); + $api = new PrimeraApi(getConfig('primera_api_name'), getConfig('primera_api_md5')); // Prepare purpose - $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_PAYOUT, $GLOBALS['userid']))."\";"; + $eval = "\$purpose = \"".COMPILE_CODE(sprintf(getMessage('PRIMERA_API_PURPOSE_PAYOUT'), getUserId()))."\";"; eval($eval); // Pay the Primera