/**
  * Test StartupWithExistingConfigFile
  *
  * @return void
  */
 public function testStartupWithExistingConfigFile()
 {
     Configure::config('default', new PhpConfig(PATH_TO_CONFIG_FILES));
     Configure::load('recaptchaWithExistingKeys', 'default', false);
     // check that secret is well imported
     $this->assertEquals('goodsecret', Configure::read('Recaptcha.secret'));
 }
 /**
  * 初期化処理
  *
  * @access public
  */
 public function __construct()
 {
     // 「app.php」から画像アップロード先のパスを取得する
     Configure::config('default', new PhpConfig());
     Configure::load('app', 'default', false);
     $this->uploadFilePath = Configure::read('App.uploadFilePath');
     $this->uploadTempFilePath = Configure::read('App.uploadTempFilePath');
 }
 /**
  * 初期化処理
  * beforeFilter()メソッドの前に呼び出される。
  *
  * @access public
  */
 public function initialize()
 {
     parent::initialize();
     // コンポーネント読み込み
     $this->loadComponent('Csrf');
     $this->loadComponent('Cookie');
     // 登録確認メールのURLを取得する
     Configure::config('default', new PhpConfig());
     Configure::load('app', 'default', false);
     $this->sendMailUrl = Configure::read('Email.default.addUserSendMailUrl');
 }
Пример #4
0
use Cake\Log\Log;
use Cake\Mailer\Email;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::load('app', 'default', false);
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');
}
Пример #5
0
 /**
  * Test dumping only some of the data.
  *
  * @return void
  */
 public function testDumpPartial()
 {
     Configure::config('test_Engine', new PhpConfig(TMP));
     Configure::write('Error', ['test' => 'value']);
     $result = Configure::dump('config_test', 'test_Engine', ['Error']);
     $this->assertTrue($result > 0);
     $result = file_get_contents(TMP . 'config_test.php');
     $this->assertContains('<?php', $result);
     $this->assertContains('return ', $result);
     $this->assertContains('Error', $result);
     $this->assertNotContains('debug', $result);
     if (file_exists(TMP . 'config_test.php')) {
         unlink(TMP . 'config_test.php');
     }
 }
Пример #6
0
use Cake\Mailer\Email;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::config('json', new Configure\Engine\JsonConfig());
    Configure::load('app', 'default', false);
    Configure::load('config', 'json', true);
} catch (\Exception $e) {
    exit($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');
Пример #7
0
Security::salt(Configure::consume('Security.salt'));
/**
 * Setup detectors for mobile and tablet.
 */
Request::addDetector('mobile', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isMobile();
});
Request::addDetector('tablet', function ($request) {
    $detector = new \Detection\MobileDetect();
    return $detector->isTablet();
});
/**
 * Load some bootstrap-handy information.
 */
Configure::config('QuickApps', new PhpConfig(TMP));
if (!is_readable(TMP . 'snapshot.php')) {
    snapshot();
} else {
    try {
        Configure::load('snapshot', 'QuickApps', false);
    } catch (\Exception $ex) {
        die('No snapshot found. check write permissions on tmp/ directory');
    }
}
/**
 * Load all registered plugins.
 */
$pluginsPath = [];
plugin()->each(function ($plugin) use(&$pluginsPath, $classLoader) {
    if (strtoupper($plugin->name) === 'CMS') {
Пример #8
0
/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::load('app', 'default', false);
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
try {
    Configure::config('appConst', new PhpConfig());
    Configure::load('appConst');
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');
}
 /**
  * Test StartupWithEmptyOptions
  *
  * @return void
  */
 public function testStartupWithEmptyOptions()
 {
     Configure::config('default', new PhpConfig(PATH_TO_CONFIG_FILES));
     Configure::load('recaptchaWithEmptyOptions', 'default', false);
     $this->assertEquals('goodkey', Configure::read('Recaptcha.sitekey'));
     $this->assertEquals('goodsecret', Configure::read('Recaptcha.secret'));
     $this->assertEquals('', Configure::read('Recaptcha.lang'));
     $this->assertEquals('', Configure::read('Recaptcha.theme'));
     $this->assertEquals('', Configure::read('Recaptcha.type'));
 }
Пример #10
0
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 *
 * Also enable immutable time objects in the ORM.
 */
Type::build('time')->useImmutable()->useLocaleParser();
Type::build('date')->useImmutable()->useLocaleParser();
Type::build('datetime')->useImmutable()->useLocaleParser();
/**
 * Loading dbAdmin config file.
 */
Configure::config('ini', new IniConfig());
Configure::load('dbAdmin', 'ini');
Пример #11
0
<?php

use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Cache\Cache;
$configDir = dirname(__FILE__) . DS;
try {
    if (file_exists(CONFIG . '/banners_manager.php')) {
        Configure::load('banners_manager', 'default', false);
    } else {
        Configure::config('banners_manager_config', new PhpConfig($configDir));
        Configure::load('default_settings', 'banners_manager_config', false);
        Configure::drop('banners_manager_config');
    }
} catch (\Exception $e) {
    die($e->getMessage());
}
Cache::config('banners_manager_cache', ['className' => 'Cake\\Cache\\Engine\\FileEngine', 'duration' => '+1 week', 'probability' => 100, 'path' => CACHE . 'plugins' . DS . 'banners_manager' . DS]);
Пример #12
0
<?php

/**
 * Bootstrap
 *
 * @author   cake17
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://blog.cake-websites.com/
 */
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Recaptcha\Validation\ConfigValidator;
// Pass the config data from config/recaptcha.php to Configure Class
// If the file does not exist, an exception is thrown
Configure::config('default', new PhpConfig(dirname(APP) . DS . 'config' . DS));
Configure::load('recaptcha', 'default', false);
// Validate the Configure Data
$validator = new ConfigValidator();
$errors = $validator->errors(Configure::read('Recaptcha'));
if (!empty($errors)) {
    throw new \Exception(__d('recaptcha', 'One of your recaptcha config value is incorrect'));
    // throw an exception with config error that is raised
}
Пример #13
0
use Cake\Network\Email\Email;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
 * Read configuration file and inject configuration into various
 * CakePHP classes.
 *
 * By default there is only one configuration file. It is often a good
 * idea to create multiple configuration files, and separate the configuration
 * that changes from configuration that does not. This makes deployment simpler.
 */
try {
    Configure::config('default', new PhpConfig());
    Configure::config('project', new PhpConfig(PROJECT_CONFIG));
    Configure::load('app', 'project', false);
    Configure::write('App.namespace', 'BEdita\\Manage');
} catch (\Exception $e) {
    die($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+1 years');
    Configure::write('Cache._cake_core_.duration', '+1 years');