mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
7912aa3b4a
commit
0e1289bdf2
@ -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);
|
|
||||||
|
|
||||||
return $response;
|
if($getResponse){
|
||||||
|
$response = stream_get_contents($socket);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
@ -660,7 +651,7 @@ class Director {
|
|||||||
// Use ?isDev=1 to get development access on the live server
|
// Use ?isDev=1 to get development access on the live server
|
||||||
if(isset($_GET['isDev'])) {
|
if(isset($_GET['isDev'])) {
|
||||||
if(ClassInfo::ready()) {
|
if(ClassInfo::ready()) {
|
||||||
BasicAuth::requireLogin("SilverStripe developer access. Use your CMS login", "ADMIN");
|
BasicAuth::requireLogin("SilverStripe developer access. Use your CMS login", "ADMIN");
|
||||||
$_SESSION['isDev'] = $_GET['isDev'];
|
$_SESSION['isDev'] = $_GET['isDev'];
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>";
|
||||||
|
Loading…
Reference in New Issue
Block a user