mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
commit
0cdf52c09a
@ -368,6 +368,10 @@ class Controller extends RequestHandler {
|
||||
*/
|
||||
function can($perm, $member = null) {
|
||||
if(!$member) $member = Member::currentUser();
|
||||
if(is_array($perm)) {
|
||||
$perm = array_map(array($this, 'can'), $perm, array_fill(0, count($perm), $member));
|
||||
return min($perm);
|
||||
}
|
||||
if($this->hasMethod($methodName = 'can' . $perm)) {
|
||||
return $this->$methodName($member);
|
||||
} else {
|
||||
|
@ -40,7 +40,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ENVIRONMENT CONFIG
|
||||
|
||||
if(defined('E_DEPRECATED')) error_reporting(E_ALL ^ E_DEPRECATED);
|
||||
if(defined('E_DEPRECATED')) error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT));
|
||||
else error_reporting(E_ALL);
|
||||
/*
|
||||
* This is for versions of PHP prior to version 5.2
|
||||
|
@ -136,7 +136,8 @@ class SS_Backtrace {
|
||||
$args = array();
|
||||
foreach($item['args'] as $arg) {
|
||||
if(!is_object($arg) || method_exists($arg, '__toString')) {
|
||||
$args[] = (strlen((string)$arg) > $argCharLimit) ? substr((string)$arg, 0, $argCharLimit) . '...' : (string)$arg;
|
||||
$sarg = is_array($arg) ? 'Array' : strval($arg);
|
||||
$args[] = (strlen($sarg) > $argCharLimit) ? substr($sarg, 0, $argCharLimit) . '...' : $sarg;
|
||||
} else {
|
||||
$args[] = get_class($arg);
|
||||
}
|
||||
|
3
main.php
3
main.php
@ -107,6 +107,9 @@ require_once("model/DB.php");
|
||||
|
||||
// Redirect to the installer if no database is selected
|
||||
if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) {
|
||||
if(!file_exists(BASE_PATH . '/install.php')) {
|
||||
die('SilverStripe Framework requires a $databaseConfig defined.');
|
||||
}
|
||||
$s = (isset($_SERVER['SSL']) || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')) ? 's' : '';
|
||||
$installURL = "http$s://" . $_SERVER['HTTP_HOST'] . BASE_URL . '/install.php';
|
||||
|
||||
|
@ -218,7 +218,7 @@ class RestfulServiceTest_MockRestfulService extends RestfulService {
|
||||
|
||||
public $session = null;
|
||||
|
||||
public function request($subURL = '', $method = "GET", $data = null, $headers = null) {
|
||||
public function request($subURL = '', $method = "GET", $data = null, $headers = null, $curlOptions = array()) {
|
||||
|
||||
if(!$this->session) {
|
||||
$this->session = new Session(array());
|
||||
@ -277,7 +277,7 @@ class RestfulServiceTest_MockRestfulService extends RestfulService {
|
||||
*/
|
||||
class RestfulServiceTest_MockErrorService extends RestfulService {
|
||||
|
||||
public function curlRequest() {
|
||||
public function curlRequest($url, $method, $data = null, $headers = null, $curlOptions = array()) {
|
||||
return new RestfulService_Response('<error>HTTP Error</error>', 400);
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ class SSViewer {
|
||||
}
|
||||
}
|
||||
|
||||
if(substr((string) $templateList,-3) == '.ss') {
|
||||
if(!is_array($templateList) && substr((string) $templateList,-3) == '.ss') {
|
||||
$this->chosenTemplates['main'] = $templateList;
|
||||
} else {
|
||||
$this->chosenTemplates = SS_TemplateLoader::instance()->findTemplates(
|
||||
|
Loading…
Reference in New Issue
Block a user