phpBMS

Changeset 754

Show
Ignore:
Timestamp:
01/14/10 11:12:20 (2 years ago)
Author:
nate
Message:
  • Fixed misnamed variable name in _callServer function.
  • Added encoding function, and encoded relevant information sent to the target script.
  • Stripped out superfluous header information in a response from the target script.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/api/apiwrapper.php

    r753 r754  
    113113     *  
    114114     * @param string $tabledefuuid The uuid of the tabledefinition that you wish to get records. 
    115      * @param array $data An array of table uuids (or integer ids if useUuid option is set to false) 
     115     * @param array $data An array of associative arrays of table uuids (or integer ids if useUuid option is set to false).  The key=>value format is 'uuid'=>'{the actual uuid}' 
    116116     * @param array $options An associative array of options. Possible options are : 'useUuid', 'dateFormat', 'timeFormat' 
    117117     * 
     
    460460     
    461461    /* 
     462     * function _encode 
     463     *  
     464     * @param array $message Message to be encoded 
     465     *  
     466     * @return string Encoded message 
     467     */ 
     468     
     469    private function _encode($message) { 
     470         
     471        return json_encode($message); 
     472         
     473    }//end function 
     474     
     475     
     476    /* 
    462477     * function _decode 
    463478     *  
     
    487502        $params["phpbmspassword"] = $this->password; 
    488503         
     504        if(!isset($params["request"])) 
     505            $params["request"] = array(); 
     506         
     507        $params["request"] = $this->_encode($params["request"]); 
     508             
     509         
    489510        $this->errorMessage = ""; 
    490511        $this->errorCode = ""; 
    491512         
    492         $post_vars = $this->httpBuildQuery($params); 
     513        $post_vars = http_build_query($params); 
    493514         
    494515        $payload = "POST " .$this->apiUrl. " HTTP/1.0\r\n"; 
     
    507528                $port = 443; 
    508529             
    509             $sock = fsockopen("ssl://".$host, $port, $errno, $errstr, 30); 
     530            $sock = fsockopen("ssl://".$this->apiHostname, $port, $errno, $errstr, 30); 
    510531        } else { 
    511532             
     
    515536                $port = 80; 
    516537             
    517             $sock = fsockopen($host, $port, $errno, $errstr, 30); 
     538            $sock = fsockopen($this->apiHostname, $port, $errno, $errstr, 30); 
    518539        } 
    519540        if(!$sock) { 
     
    538559        fclose($sock); 
    539560        ob_end_clean(); 
     561         
     562        list($throw, $response) = explode("\r\n\r\n", $response, 2); 
     563         
    540564        if ($info["timed_out"]) return false; 
    541565         
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.