本文整理汇总了PHP中BasicAuth::protect_entire_site方法的典型用法代码示例。如果您正苦于以下问题:PHP BasicAuth::protect_entire_site方法的具体用法?PHP BasicAuth::protect_entire_site怎么用?PHP BasicAuth::protect_entire_site使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasicAuth
的用法示例。
在下文中一共展示了BasicAuth::protect_entire_site方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpOnce
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');
}
示例2: setUp
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();
}
示例3: setUp
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();
}
示例4: init
public function init()
{
BasicAuth::protect_entire_site(false);
parent::init();
}
示例5: array
<?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);
示例6: dirname
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);
}
示例7: init
public function init()
{
BasicAuth::protect_entire_site(true, null);
parent::init();
}
示例8: invalid
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;
}
示例9: define
<?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('info@silverstripe-europe.org'), SS_Log::ERR);
}
Config::inst()->update('HtmlEditorField', 'use_gzip', false);
示例10: index
function index()
{
BasicAuth::protect_entire_site(false);
return "ok";
}