Used exit() (also app_die()->app_exit()) because die() is an alias of exit nowadays
[core.git] / inc / classes / third_party / api / wernisportal / class_WernisApi.php
index 42936f106b99d01d7753e698f59ceb3554c05d59..d2e105488c8b40ca83ce8e40e09223de992a9106 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007 - 2009 Roland Haeder, this is free software
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -70,10 +70,6 @@ class WernisApi extends BaseFrameworkSystem {
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
@@ -82,7 +78,7 @@ class WernisApi extends BaseFrameworkSystem {
         * @param       $cfg                    Configuration array
         * @return      $apiInstance    An instance of this API class
         */
-       public final static function createWernisApi (array $cfg) {
+       public static final function createWernisApi (array $cfg) {
                // Create a new instance
                $apiInstance = new WernisApi();
 
@@ -146,7 +142,7 @@ class WernisApi extends BaseFrameworkSystem {
                global $_CONFIG;
                include "templates/zurueck.html";
                include "templates/fuss.html";
-               die();
+               exit();
        }
 
        // Fehlermeldung ausgeben und beenden
@@ -222,7 +218,13 @@ class WernisApi extends BaseFrameworkSystem {
                }
 
                // All (maybe) fine so remove the response header from server
-               $response = $response[(count($response) - 1)];
+               for ($idx = (count($response) - 1); $idx > 1; $idx--) {
+                       $line = trim($response[$idx]);
+                       if (!empty($line)) {
+                               $response = $line;
+                               break;
+                       }
+               }
 
                // Prepare the returning result for higher functions
                if (substr($response, 0, 1) == '&') {