Merged branches/kiwiselect into trunk

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@61184 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-08-20 06:31:12 +00:00
parent 7912aa3b4a
commit 0e1289bdf2
4 changed files with 11 additions and 16 deletions

View File

@ -236,7 +236,7 @@ class HTTP {
* @param string $port * @param string $port
* @return string Raw HTTP-result including headers * @return string Raw HTTP-result including headers
*/ */
static function sendPostRequest($host, $path, $data, $name = null, $query = '', $port = 80) { static function sendPostRequest($host, $path, $data, $name = null, $query = '', $port = 80, $getResponse = true) {
$socket = fsockopen($host, $port, $errno, $error); $socket = fsockopen($host, $port, $errno, $error);
if(!$socket) if(!$socket)
@ -244,6 +244,8 @@ class HTTP {
if(self::$userName && self::$password) if(self::$userName && self::$password)
$auth = "Authorization: Basic " . base64_encode(self::$userName . ':' . self::$password) . "\r\n"; $auth = "Authorization: Basic " . base64_encode(self::$userName . ':' . self::$password) . "\r\n";
else
$auth = '';
if($query) if($query)
$query = '?' . $query; $query = '?' . $query;
@ -253,9 +255,11 @@ class HTTP {
$request .= $dataStr . "\r\n\r\n"; $request .= $dataStr . "\r\n\r\n";
fwrite($socket, $request); fwrite($socket, $request);
$response = stream_get_contents($socket);
if($getResponse){
$response = stream_get_contents($socket);
return $response; return $response;
}
} }

View File

@ -437,16 +437,7 @@ class Director {
} }
/** /**
* Given a filesystem reference relative to the site root, return the full filesystem path * Given a filesystem reference relative to the site root, return the full file-system path.
*/
/**
* Cleans up a given file-path
*
* @param string $file
* @return string
*/
/**
* Cleans up a given file-path
* *
* @param string $file * @param string $file
* @return string * @return string

View File

@ -332,7 +332,7 @@ class Email extends ViewableData {
if(!empty($headers['Bcc']) && trim($headers['Bcc'])) { if(!empty($headers['Bcc']) && trim($headers['Bcc'])) {
$headers['Bcc'] .= ', ' . self::$bcc_all_emails_to; $headers['Bcc'] .= ', ' . self::$bcc_all_emails_to;
} else { } else {
$headers['Cc'] = self::$bcc_all_emails_to; $headers['Bcc'] = self::$bcc_all_emails_to;
} }
} }

View File

@ -441,7 +441,7 @@ HTML;
function createTag($tag, $attributes, $content = null) { function createTag($tag, $attributes, $content = null) {
$preparedAttributes = ''; $preparedAttributes = '';
foreach($attributes as $k => $v) { foreach($attributes as $k => $v) {
if(!empty($v)) $preparedAttributes .= " $k=\"" . Convert::raw2att($v) . "\""; if(!empty($v) || $v === '0') $preparedAttributes .= " $k=\"" . Convert::raw2att($v) . "\"";
} }
if($content) return "<$tag$preparedAttributes>$content</$tag>"; if($content) return "<$tag$preparedAttributes>$content</$tag>";