public function setUpOnce() { parent::setUpOnce(); Restrictable::set_enabled(false); BasicAuth::protect_entire_site(false); // needs to be done this way to work around SS bug // include_once dirname(dirname(__FILE__)).'/extensions/Restrictable.php'; // Object::add_extension('PrivateObject', 'Restrictable'); }
function setUp() { parent::setUp(); $this->mainSession = new TestSession(); // Disable theme, if necessary if ($this->stat('disable_themes')) { SSViewer::set_theme(null); } // Switch to draft site, if necessary if ($this->stat('use_draft_site')) { $this->useDraftSite(); } // Unprotect the site, tests are running with the assumption it's off. They will enable it on a case-by-case basis. BasicAuth::protect_entire_site(false); SecurityToken::disable(); }
public function setUp() { // Skip calling FunctionalTest directly. if (get_class($this) == "FunctionalTest") { $this->skipTest = true; } parent::setUp(); $this->mainSession = new TestSession(); // Disable theme, if necessary if (static::get_disable_themes()) { Config::inst()->update('SSViewer', 'theme', null); } // Switch to draft site, if necessary if (static::get_use_draft_site()) { $this->useDraftSite(); } // Unprotect the site, tests are running with the assumption it's off. They will enable it on a case-by-case // basis. BasicAuth::protect_entire_site(false); SecurityToken::disable(); }
public function init() { BasicAuth::protect_entire_site(false); parent::init(); }
<?php global $project; $project = 'mysite'; global $database; $database = 'SS_ssnewdocstest'; require_once 'conf/ConfigureFromEnv.php'; MySQLDatabase::set_connection_charset('utf8'); // This line set's the current theme. More themes can be // downloaded from http://www.silverstripe.org/themes/ SSViewer::set_theme('docs'); // enable nested URLs for this site (e.g. page/sub-page/) SiteTree::enable_nested_urls(); // render the user documentation first Director::addRules(20, array('Security//$Action/$ID/$OtherID' => 'Security')); DocumentationViewer::set_link_base(''); DocumentationViewer::$check_permission = false; Director::addRules(10, array('$Action' => 'DocumentationViewer', '' => '->current/en/cms')); DocumentationService::set_automatic_registration(false); DocumentationService::register("cms", realpath("../../master/cms/docs/"), '2.4'); // We want this to be reviewed by the whole community BasicAuth::protect_entire_site(false);
if (!isset($database) || !$database) { // if SS_DATABASE_CHOOSE_NAME if (defined('SS_DATABASE_CHOOSE_NAME') && SS_DATABASE_CHOOSE_NAME) { $loopCount = (int) SS_DATABASE_CHOOSE_NAME; $databaseDir = dirname($_SERVER['SCRIPT_FILENAME']); for ($i = 0; $i < $loopCount; $i++) { $databaseDir = dirname($databaseDir); } $database = "SS_" . basename($databaseDir); $database = str_replace('.', '', $database); } } if (defined('SS_DATABASE_USERNAME') && defined('SS_DATABASE_PASSWORD')) { global $databaseConfig; $databaseConfig = array("type" => "MySQLDatabase", "server" => defined('SS_DATABASE_SERVER') ? SS_DATABASE_SERVER : 'localhost', "username" => SS_DATABASE_USERNAME, "password" => SS_DATABASE_PASSWORD, "database" => (defined('SS_DATABASE_PREFIX') ? SS_DATABASE_PREFIX : '') . $database . (defined('SS_DATABASE_SUFFIX') ? SS_DATABASE_SUFFIX : '')); } if (defined('SS_SEND_ALL_EMAILS_TO')) { Email::send_all_emails_to(SS_SEND_ALL_EMAILS_TO); } if (defined('SS_DEFAULT_ADMIN_USERNAME')) { if (!defined('SS_DEFAULT_ADMIN_PASSWORD')) { user_error("SS_DEFAULT_ADMIN_PASSWORD must be defined in your _ss_environment.php, if SS_DEFAULT_ADMIN_USERNAME is defined. See http://doc.silverstripe.com/doku.php?id=environment-management for more infomration", E_USER_ERROR); } Security::setDefaultAdmin(SS_DEFAULT_ADMIN_USERNAME, SS_DEFAULT_ADMIN_PASSWORD); } if (defined('SS_USE_BASIC_AUTH') && SS_USE_BASIC_AUTH) { BasicAuth::protect_entire_site(); } if (defined('SS_ERROR_LOG')) { Debug::log_errors_to(SS_ERROR_LOG); }
public function init() { BasicAuth::protect_entire_site(true, null); parent::init(); }
public function invalid() { BasicAuth::protect_entire_site(false); $out = <<<XML <?xml version="1.0"?> <test> \t<fail><invalid> </test> XML; header('Content-type: text/xml'); echo $out; }
<?php global $project; $project = 'mysite'; // use the _ss_environment.php file for configuration require_once 'conf/ConfigureFromEnv.php'; // set default language i18n::set_locale('en_US'); define('PROJECT_THIRDPARTY_DIR', project() . '/thirdparty'); define('PROJECT_THIRDPARTY_PATH', BASE_PATH . '/' . PROJECT_THIRDPARTY_DIR); if (SS_IS_TEST_ENV) { BasicAuth::protect_entire_site(true); } if (Director::isLive()) { if (strpos(Director::absoluteBaseURL(), 'silverstripe-europe.org') !== false || strpos(Director::absoluteBaseURL(), 'www') !== false) { $response = new SS_HTTPResponse(); $response->redirect('https://stripecon.eu', 301); HTTP::add_cache_headers($response); $response->output(); die; } // we are in live mode, send errors per email, set cache and force WWW HTTP::set_cache_age(3600); // HTTP Header for CloudFlare Caching SS_Cache::set_cache_lifetime('any', 10800); // Serverside cache to 3 hours. SS_Log::add_writer(new SS_LogEmailWriter('*****@*****.**'), SS_Log::ERR); } Config::inst()->update('HtmlEditorField', 'use_gzip', false);
function index() { BasicAuth::protect_entire_site(false); return "ok"; }