public function testCheckDefaultAdmin()
 {
     if (Security::has_default_admin()) {
         $this->markTestSkipped('Default admin present. There\'s no way to inspect default admin state, ' . 'so we don\'t override existing settings');
     }
     Security::setDefaultAdmin('admin', 'password');
     $this->assertTrue(Security::has_default_admin());
     $this->assertTrue(Security::check_default_admin('admin', 'password'), 'Succeeds with correct username and password');
     $this->assertFalse(Security::check_default_admin('wronguser', 'password'), 'Fails with incorrect username');
     $this->assertFalse(Security::check_default_admin('admin', 'wrongpassword'), 'Fails with incorrect password');
     Security::setDefaultAdmin(null, null);
 }
예제 #2
0
 function testCheckDefaultAdmin()
 {
     // TODO There's currently no way to inspect default admin state,
     //  hence we don't override existing settings
     if (Security::has_default_admin()) {
         return;
     }
     Security::setDefaultAdmin('admin', 'password');
     $this->assertTrue(Security::has_default_admin());
     $this->assertTrue(Security::check_default_admin('admin', 'password'), 'Succeeds with correct username and password');
     $this->assertFalse(Security::check_default_admin('wronguser', 'password'), 'Fails with incorrect username');
     $this->assertFalse(Security::check_default_admin('admin', 'wrongpassword'), 'Fails with incorrect password');
     Security::setDefaultAdmin(null, null);
 }
 public function tearDown()
 {
     Security::setDefaultAdmin($this->defaultUsername, $this->defaultPassword);
     parent::tearDown();
 }
예제 #4
0
<?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
	"type" => "MySQLDatabase",
	"server" => "localhost", 
	"username" => "root", 
	"password" => "", 
	"database" => "SS_mysite",
);

// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.com/doku.php?id=devmode
// for a description of what dev mode does.
Director::set_dev_servers(array(
	'localhost',
	'127.0.0.1',
));

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('mysite');

Security::setDefaultAdmin('admin', 'password');

?>
예제 #5
0
/*
global $databaseConfig;
$databaseConfig = array(
	"type" => 'MySQLDatabase',
	"server" => 'localhost',
	"username" => 'root',
	"password" => 'root',
	"database" => 'FuelDemo2016',
	"path" => '',
);
*/
// ******* LIVE Database Settings ******
global $databaseConfig;
$databaseConfig = array("type" => 'MySQLDatabase', "server" => 'localhost', "username" => 'fuel2', "password" => 'coyote5.!6', "database" => 'fuel2', "path" => '');
// Initial acmin account set-up - can be removed
Security::setDefaultAdmin('*****@*****.**', 'apples');
// Sets the CMS logo link to go to the site base URL
LeftAndMain::set_application_link(Director::baseURL());
// Set the site locale
i18n::set_locale('en_GB');
date_default_timezone_set('Europe/London');
//Enable Site Search **
//FulltextSearchable::enable();
Object::add_extension('SiteConfig', 'CustomSiteConfig');
//Force redirect to www.
Director::forceWWW();
//Show errors while in development only (to be removed)
error_reporting(E_ALL);
// Customise TinyMCE options
HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats', 'p,h1,h2,h3,h4');
HtmlEditorConfig::get('cms')->setOption('theme_advanced_disable', 'styleselect');
예제 #6
0
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
0
<?php

/*
 * Include any local instance specific configuration here - typically
 * this includes any database settings, email settings, etc that change
 * between installations. 
 */
global $databaseConfig;
$databaseConfig = array("type" => "{${db . type}}", "server" => "{${db . host}}", "username" => "{${db . user}}", "password" => "{${db . pass}}", "database" => "{${db . name}}");
Security::setDefaultAdmin('${admin.username}', '${admin.password}');
// Email::setAdminEmail('*****@*****.**');
define('SS_LOG_FILE', dirname(__FILE__) . '/' . basename(dirname(dirname(__FILE__))) . '.log');
// Get the DB connection details
require_once 'dbconn.php';
// Database config
global $databaseConfig;
// Set the database connection details
$databaseConfig = array("type" => 'MySQLDatabase', "server" => $server, "username" => $username, "password" => $password, "database" => $database, "path" => '');
// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.org/doku.php?id=configuration
// for a description of what dev mode does.
Director::set_dev_servers(array('lyc.local', '127.0.0.1'));
Email::setAdminEmail('*****@*****.**');
//Director::set_environment_type("dev");
//UploadifyField::show_debug();
//Security::setDefaultAdmin('*****@*****.**', 't627t');
Security::setDefaultAdmin('loveyourcoast', 'loveyour12345');
MySQLDatabase::set_connection_charset('utf8');
// Set the site locale
i18n::set_locale('en_NZ');
// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
//Add the CleanUpRole
//this extends the membership class and gives the
//relationships between member and cleanup
DataObject::add_extension('Member', 'CleanUpRole');
//FB
//FacebookConnect::set_api_key('3c7656ec45da9e30dbac9fca551b9753');
//FacebookConnect::set_api_secret('bbde13e55878f786355b1eea84173dde');
//FacebookConnect::set_app_id('104014689670653');
// Sortable
//SortableDataObject::add_sortable_class('TopCleanUp');
예제 #9
0
<?php

global $project;
$project = 'mysite';
global $databaseConfig;
$databaseConfig = array("type" => 'MySQLDatabase', "server" => '127.0.0.1', "username" => 'root', "password" => 'password', "database" => 'ss_official', "path" => '');
// Set the site locale
i18n::set_locale('en_US');
//Security::SetDefaultAdmin('admin', 'admin');
if (Director::isLive()) {
    SS_Log::add_writer(new SS_LogEmailWriter('*****@*****.**'), SS_Log::ERR);
} else {
    //isTest or isDev
    SS_Log::add_writer(new SS_LogFileWriter('../silverstripe-errors-warnings.log'), SS_Log::WARN, '<=');
    SS_Log::add_writer(new SS_LogFileWriter('../silverstripe-errors.log'), SS_Log::ERR);
}
session_save_path('/tmp');
Security::setDefaultAdmin('admin', 'admin');
예제 #10
0
<?php

/**
 * User: Julian Scheuchenzuber <*****@*****.**>
 * Date: 22.10.15
 * Time: 12:12
 */
if (isset($GLOBALS['_DEFAULT_ADMINS'])) {
    // Reset pointer and fetch data of first record
    reset($GLOBALS['_DEFAULT_ADMINS']);
    $email = key($GLOBALS['_DEFAULT_ADMINS']);
    $pw = $GLOBALS['_DEFAULT_ADMINS'][$email];
    // Set default admin if not exists
    if (!Security::has_default_admin()) {
        Security::setDefaultAdmin($email, $pw);
    }
}
 public function tearDown()
 {
     Security::setDefaultAdmin($this->defaultUsername, $this->defaultPassword);
     Permission::flush_permission_cache();
     parent::tearDown();
 }
 /**
  * Ensures we have permissions to manipulate pages (gets around access issues with global state). Unfortunately, the
  * creation of a default admin account below is necessary because SilverStripe will reference global state via
  * Member::currentUser() and the only surefire way around this is to login as a default admin with full access.
  *
  * CAUTION: Since migrations can only be run from the command line, it's assumed that if you're accessing this, then
  * you're already an admin or you've got an incorrectly configured site!
  *
  * TODO: This should be removed soon.
  *
  * @deprecated  Use ::whileAdmin() instead.
  */
 protected static function loginAsAdmin()
 {
     Deprecation::notice('0', 'Use ::whileAdmin() instead. This method will be removed soon.');
     if (!Member::currentUserID()) {
         // See if a default admin is setup yet.
         if (!Security::has_default_admin()) {
             // Generate a randomized user/pass and use that as the default administrator just for this session.
             $user = substr(str_shuffle(sha1("u" . microtime())), 0, 20);
             $pass = substr(str_shuffle(sha1("p" . microtime())), 0, 20);
             Security::setDefaultAdmin($user, $pass);
         }
         $admin = Member::default_admin();
         if (!$admin) {
             throw new MigrationException("Cannot login: No default administrator found.");
         }
         Session::start();
         Session::set("loggedInAs", $admin->ID);
     }
 }
예제 #13
0
파일: _config.php 프로젝트: saiyan/selim
<?php

global $project;
$project = 'mysite';
global $database;
$database = '';
// Set the site locale
i18n::set_locale('en_US');
Security::setDefaultAdmin('page1', 'page1');
예제 #14
0
<?php

global $project;
$project = 'mysite';
require_once str_replace('//', '/', dirname(__FILE__) . '/') . '../.shi/shi.php';
if (_shi('admin_set') > 0) {
    Security::setDefaultAdmin(_shi('admin_username'), _shi('admin_password'));
}
global $databaseConfig;
$database = _shi('db_name_prefix') . _shi('db_name') . _shi('db_name_suffix');
$databaseConfig = array('type' => 'MySQLDatabase', 'server' => _shi('db_server'), 'username' => _shi('db_username'), 'password' => _shi('db_password'), 'database' => $database);
if (_shi('mode') == 'dev') {
    Director::set_environment_type('dev');
}
// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('blackcandy');
예제 #15
0
파일: _config.php 프로젝트: 8secs/cocina
<?php

global $project;
$project = 'cocina';
ini_set('memory_limit', '80M');
ini_set('mysql.connect_timeout', 14400);
date_default_timezone_set('Europe/Madrid');
global $database;
//LOCAL
//$database = 'SS_cocina';
//cocina.COM
//$database = 'db562588325';
//HOMECOOKING
$database = 'db563848102';
require_once 'conf/ConfigureFromEnv.php';
//Item::add_extension('ItemExtension');
Security::setDefaultAdmin("*****@*****.**", "gelves08");
Object::useCustomClass("MemberLoginForm", "CocinaLoginForm");
/*Object::add_extension("Group", 'GroupExtension');
Object::add_extension("ChefObject", 'Addressable');
Object::add_extension('ChefObject', 'Geocodable');*/
// Set the site locale
i18n::set_locale('en_GB');
Translatable::set_default_locale('en_GB');