Skip to content

Instantly share code, notes, and snippets.

@leevigraham
Last active March 7, 2025 16:49
Show Gist options
  • Select an option

  • Save leevigraham/448166 to your computer and use it in GitHub Desktop.

Select an option

Save leevigraham/448166 to your computer and use it in GitHub Desktop.

Revisions

  1. leevigraham revised this gist Apr 15, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -151,7 +151,7 @@
    $env_config = array();
    $env_global_vars = array();
    }
    elseif('staging' === NSM_ENV) { {
    elseif('staging' === NSM_ENV) {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    @@ -174,7 +174,7 @@
    );
    $env_global_vars = array();
    }
    elseif('production' === NSM_ENV) { {
    elseif('production' === NSM_ENV) {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    @@ -366,7 +366,7 @@

    // File Upload config.
    // @see: http://expressionengine.com/user_guide/general/hidden_configuration_variables.html#upload-preferences
    //'upload_preferences' = array(
    //'upload_preferences' => array(
    // 1 => array( // ID of upload destination
    // 'name' => 'Staging Image Uploads', // Display name in control panel
    // 'server_path' => '/home/user/example.com/staging/images/uploads/', // Server path to upload directory
  2. leevigraham revised this gist Dec 10, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <?php

    /**
    * Custom configuration bootsrtap file for ExpressionEngine
    * Custom configuration bootstrap file for ExpressionEngine
    *
    * Place config.php in your site root
    * Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
  3. leevigraham revised this gist Apr 8, 2013. 1 changed file with 113 additions and 56 deletions.
    169 changes: 113 additions & 56 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@
    * @author Leevi Graham <http://leevigraham.com>
    * @link http://expressionengine.com/index.php?affiliate=leevigraham&page=wiki/EE_2_Config_Overrides/
    * @link http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/ - Hat tip to: Erskine from EECI2010 Preso
    * @version 1.5
    * @version 1.10
    *
    * == Changelog ==
    *
    @@ -58,97 +58,131 @@
    * - Added $config['third_party'] param to ease updating
    * - Added $config['base_url']
    * - Moved webmaster_email config into dev environment
    *
    * Version 1.10
    * - Added changed $config['third_party'] to $config['third_party_path']
    * - Added $config['path_third_themes']
    * - Added $config['url_third_themes']
    */

    // Setup the environment
    /**
    * config_bootstrap.php is included multiple times during the request
    * PHP Only allows constants to be defined once so we check first
    */
    if(!defined('NSM_ENV')) {
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_BASEPATH', dirname(__FILE__));

    // Set your system folder
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") {
    define('NSM_SITE_URL', "http://".NSM_SERVER_NAME);
    } else {
    define('NSM_SITE_URL', "https://".NSM_SERVER_NAME);
    }
    // Define the server name, basepath and site_url
    // These can all be defined using the server request and filepath
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_BASEPATH', dirname(__FILE__));
    define('NSM_SITE_URL', "//".NSM_SERVER_NAME);

    // Set the environment
    /**
    * Based on the requested server we can determine the environment
    * The following conditionals check the server name for specific strings
    * We use NSM_ENV to define variables latter on in the bootstrap process
    *
    * Examples:
    * http://local.my-site.com defines NSM_ENV as local
    * http://dev.my-site.com defines NSM_ENV as development
    *
    * strstr() — Find the first occurrence of a string
    * @see http://php.net/manual/en/function.strstr.php
    */
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'development');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'staging');
    elseif( strstr( NSM_SERVER_NAME, 'mobi.' ) ) define('NSM_ENV', 'mobile');
    // Fallback to production settings
    else define('NSM_ENV', 'production');
    }

    // Use for debugging the current environment
    if(isset($_GET['debug'])) {
    die('The current environment is: '.NSM_ENV);
    // Not sure what environment the request is?
    // Add ?debug_config_bootstrap to the end of the URL
    if(isset($_GET['debug_config_bootstrap'])) {
    die('The current environment is: '.NSM_ENV);
    }
    }

    // Define the environment settings

    /*
    * Create placeholder arrays for environment settings
    * Environment settings override the global settings (also defined in config_bootstrap.php) and
    * the standard config.php settings
    */
    $env_config = array();
    $env_db_config = array();
    $env_global_vars = array();

    // Set the environmental config and global vars
    if (NSM_ENV == 'local') {
    // Comparing NSM_ENV which environment specific configuration will we load?
    // Local configuration:
    if ('local' === NSM_ENV) {

    // Environment DB configuration
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );

    // Environment config variables
    // Overrides anything in $env_config
    $env_config = array();

    // Environment global vars
    // These will be available in youre templates
    // 'global:' is not required, it's just a naming convention we use @Newism
    // Example: 'global:cm_subscriber_list_slug' will be available in templates as {global:cm_subscriber_list_slug}
    // Overrides anything in $default_global_vars
    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => ''
    );

    }
    elseif(NSM_ENV == 'development') {
    elseif('development' === NSM_ENV) {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );
    $env_config = array();
    $env_global_vars = array();
    }
    elseif(NSM_ENV == 'staging') {
    elseif('staging' === NSM_ENV) { {
    $env_db_config = array(
    'hostname' => '',
    'database' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );

    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => ''
    );

    $env_config = array(
    'webmaster_email' => 'webmaster@' . NSM_SERVER_NAME,
    'webmaster_name' => 'Webmaster',
    );
    $env_config = array();
    $env_global_vars = array();
    }
    elseif(NSM_ENV == 'mobile') {
    $env_db_config = array(
    elseif('mobile' === NSM_ENV) {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );
    $env_config['tmpl_file_basepath'] = NSM_BASEPATH . '/templates_mobile/';
    $env_config = array(
    // Custom mobile templates?
    'tmpl_file_basepath' => NSM_BASEPATH . '/templates_mobile/'
    );
    $env_global_vars = array();
    }
    else {
    elseif('production' === NSM_ENV) { {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );
    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => '',
    'global:google_analytics_key' => 'XX-XXXX'
    );
    $env_config = array();
    $env_global_vars = array();
    }

    // Config bootsrap... GO!
    @@ -200,23 +234,27 @@
    */
    'global:google_analytics_key' => false,

    // NSM Gravatar
    'global:nsm_gravatar_default_avatar' => NSM_SITE_URL . '/uploads/member/avatars/default.png',

    // Store the entry_id for the 404 page
    'global:404_entry_id' => '2',
    );
    );

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();
    if(!isset($assign_to_config['global_vars'])) {
    $assign_to_config['global_vars'] = array();
    }

    $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);

    /**
    * Config. This shouldn't have to be changed if you're using the Newism EE2 template.
    *
    * All the values below override the default config.php configuration.
    * Setting a value below will also restrict users from changing it in the CP
    * If a user does save a configuration value in the CP:
    * - it will be written to config.php
    * - the user will see the value below in the CP
    */
    $default_config = array(

    @@ -233,11 +271,14 @@
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
    'uri_protocol' => 'PATH_INFO',
    // 'uri_protocol' => 'PATH_INFO',

    // Third party directory
    // @see http://expressionengine.com/user_guide/general/hidden_configuration_variables.html#third-party-path
    'third_party' => NSM_BASEPATH . '/third_party/',
    // http://ellislab.com/expressionengine/user-guide/general/hidden_configuration_variables.html#third-party-path
    'third_party_path' => NSM_BASEPATH . '/third_party/',
    // http://ellislab.com/expressionengine/user-guide/general/hidden_configuration_variables.html#path-third-themes
    'path_third_themes' => NSM_BASEPATH . '/content/themes/third_party/',
    // http://ellislab.com/expressionengine/user-guide/general/hidden_configuration_variables.html#url-third-themes
    'url_third_themes' => NSM_SITE_URL . '/themes/third_party/',

    // Datbase preferences
    'db_debug' => 'n',
    @@ -279,27 +320,32 @@
    'enable_entry_view_tracking' => 'n',
    'log_referrers' => 'n',

    // Messaging preferences
    'prv_msg_upload_path' => NSM_BASEPATH . '/content/uploads/member/pm_attachments',
    'enable_emoticons' => 'n',

    // Member preferences
    'allow_registration' => 'n',
    // Create a random string for the member profile trigger
    'profile_trigger' => '--sdjhkj2lffgrerfvmdkndkfisolmfmsd' . time(),

    'prv_msg_upload_path' => NSM_BASEPATH . '/content/uploads/member/pm_attachments',
    'enable_emoticons' => 'n',

    // Member avatar confiuration
    'enable_avatars' => 'n',
    'avatar_path' => NSM_BASEPATH . '/content/uploads/member/avatars/',
    'avatar_url' => NSM_SITE_URL . '/uploads/member/avatars/',
    'avatar_max_height' => 100,
    'avatar_max_width' => 100,
    'avatar_max_kb' => 100,

    // Member photo configuration
    'enable_photos' => 'n',
    'photo_path' => NSM_BASEPATH . '/content/uploads/member/photos/',
    'photo_url' => NSM_SITE_URL . '/uploads/member/photos/',
    'photo_max_height' => 200,
    'photo_max_width' => 200,
    'photo_max_kb' => 200,

    // Member signature confiuration
    'sig_allow_img_upload' => 'n',
    'sig_img_path' => NSM_BASEPATH . '/content/uploads/member/signature_attachments/',
    'sig_img_url' => NSM_SITE_URL . '/uploads/member/signature_attachments/',
    @@ -308,6 +354,7 @@
    'sig_img_max_kb' => 30,
    'sig_maxlength' => 500,

    // Captcha settings
    'captcha_font' => 'y',
    'captcha_rand' => 'y',
    'captcha_require_members' => 'n',
    @@ -317,7 +364,8 @@
    // Encryption / Session key
    'encryption_key' => '',

    // File Upload config. See: http://expressionengine.com/user_guide/general/hidden_configuration_variables.html#upload-preferences
    // File Upload config.
    // @see: http://expressionengine.com/user_guide/general/hidden_configuration_variables.html#upload-preferences
    //'upload_preferences' = array(
    // 1 => array( // ID of upload destination
    // 'name' => 'Staging Image Uploads', // Display name in control panel
    @@ -326,12 +374,21 @@
    // )
    // ),

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => array(NSM_BASEPATH . "/content/.htaccess")
    // NSM htaccess Generator Configuration
    // @see: http://ee-garage.com/nsm-htaccess-generator
    // 'nsm_htaccess_generator_path' => array(NSM_BASEPATH . "/content/.htaccess"),

    // NSM Gravatar Configuration
    // @see: https://github.com/newism/nsm.gravatar.ee_addon
    // 'nsm_htaccess_generator_path' => array(
    // 'size' => '200',
    // 'default' => NSM_SITE_URL . '/uploads/member/avatars/default.png',
    // 'force_default' => 'n',
    // 'rating' => 'pg',
    // 'secure' => 'n'
    // )
    );



    // Build the new config object
    $config = array_merge($config, $default_config, $env_config);
    }
  4. leevigraham revised this gist Jan 31, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -229,7 +229,7 @@
    'doc_url' => 'http://expressionengine.com/user_guide/',

    'site_url' => NSM_SITE_URL,
    'base_url' => NSM_SITE_URL
    'base_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
  5. leevigraham revised this gist Aug 10, 2012. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -53,6 +53,11 @@
    *
    * Version 1.8
    * - Added $_GET['debug'] param to help with support
    *
    * Version 1.9
    * - Added $config['third_party'] param to ease updating
    * - Added $config['base_url']
    * - Moved webmaster_email config into dev environment
    */

    // Setup the environment
    @@ -114,9 +119,15 @@
    'username' => '',
    'password' => '',
    );

    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => ''
    );

    $env_config = array(
    'webmaster_email' => 'webmaster@' . NSM_SERVER_NAME,
    'webmaster_name' => 'Webmaster',
    );
    }
    elseif(NSM_ENV == 'mobile') {
    $env_db_config = array(
    @@ -218,11 +229,16 @@
    'doc_url' => 'http://expressionengine.com/user_guide/',

    'site_url' => NSM_SITE_URL,
    'base_url' => NSM_SITE_URL
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
    'uri_protocol' => 'PATH_INFO',

    // Third party directory
    // @see http://expressionengine.com/user_guide/general/hidden_configuration_variables.html#third-party-path
    'third_party' => NSM_BASEPATH . '/third_party/',

    // Datbase preferences
    'db_debug' => 'n',
    'pconnect' => 'n',
    @@ -234,9 +250,6 @@
    'is_site_on' => 'y',
    'site_404' => 'site/four04',

    'webmaster_email' => 'webmaster@' . NSM_SERVER_NAME,
    'webmaster_name' => 'Webmaster',

    // Localization preferences
    'server_timezone' => 'UP10',
    'server_offset' => FALSE,
  6. leevigraham revised this gist May 12, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@
    }

    // Use for debugging the current environment
    if(isset($_GET['debug']) {
    if(isset($_GET['debug'])) {
    die('The current environment is: '.NSM_ENV);
    }

  7. leevigraham revised this gist May 9, 2012. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -50,6 +50,9 @@
    *
    * Version 1.7
    * - Added placeholder config for upload directories
    *
    * Version 1.8
    * - Added $_GET['debug'] param to help with support
    */

    // Setup the environment
    @@ -68,10 +71,15 @@
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'development');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'staging');
    elseif( strstr( NSM_SERVER_NAME, 'm.' ) ) define('NSM_ENV', 'mobile');
    elseif( strstr( NSM_SERVER_NAME, 'mobi.' ) ) define('NSM_ENV', 'mobile');
    else define('NSM_ENV', 'production');
    }

    // Use for debugging the current environment
    if(isset($_GET['debug']) {
    die('The current environment is: '.NSM_ENV);
    }

    // Define the environment settings

    $env_config = array();
  8. leevigraham revised this gist Mar 1, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -59,9 +59,9 @@
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") {
    define('NSM_SITE_URL', "http://".NSM_SERVER_NAME . '/');
    define('NSM_SITE_URL', "http://".NSM_SERVER_NAME);
    } else {
    define('NSM_SITE_URL', "https://".NSM_SERVER_NAME . '/');
    define('NSM_SITE_URL', "https://".NSM_SERVER_NAME);
    }

    // Set the environment
  9. leevigraham revised this gist Feb 7, 2012. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -120,6 +120,12 @@
    $env_config['tmpl_file_basepath'] = NSM_BASEPATH . '/templates_mobile/';
    }
    else {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );
    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => '',
    'global:google_analytics_key' => 'XX-XXXX'
  10. leevigraham revised this gist Feb 7, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -297,7 +297,7 @@
    // 'server_path' => '/home/user/example.com/staging/images/uploads/', // Server path to upload directory
    // 'url' => 'http://staging.example.com/images/uploads/' // URL of upload directory
    // )
    // );
    // ),

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => array(NSM_BASEPATH . "/content/.htaccess")
  11. leevigraham revised this gist Feb 7, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -291,7 +291,7 @@
    'encryption_key' => '',

    // File Upload config. See: http://expressionengine.com/user_guide/general/hidden_configuration_variables.html#upload-preferences
    // $config['upload_preferences'] = array(
    //'upload_preferences' = array(
    // 1 => array( // ID of upload destination
    // 'name' => 'Staging Image Uploads', // Display name in control panel
    // 'server_path' => '/home/user/example.com/staging/images/uploads/', // Server path to upload directory
  12. leevigraham revised this gist Jan 25, 2012. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -44,9 +44,12 @@
    *
    * Version 1.5
    * - Added global:404_entry_id
    *
    * Version 1.6
    * - Added SSL support for site url
    *
    * Version 1.7
    * - Added placeholder config for upload directories
    */

    // Setup the environment
    @@ -287,6 +290,15 @@
    // Encryption / Session key
    'encryption_key' => '',

    // File Upload config. See: http://expressionengine.com/user_guide/general/hidden_configuration_variables.html#upload-preferences
    // $config['upload_preferences'] = array(
    // 1 => array( // ID of upload destination
    // 'name' => 'Staging Image Uploads', // Display name in control panel
    // 'server_path' => '/home/user/example.com/staging/images/uploads/', // Server path to upload directory
    // 'url' => 'http://staging.example.com/images/uploads/' // URL of upload directory
    // )
    // );

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => array(NSM_BASEPATH . "/content/.htaccess")
    );
  13. leevigraham revised this gist Jan 23, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,8 @@
    * Custom configuration bootsrtap file for ExpressionEngine
    *
    * Place config.php in your site root
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
    * Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
    * If you have moved your site root you'll need to update the require_once path
    *
    * Also includes custom DB configuration file based on your environment
  14. leevigraham revised this gist Jan 23, 2012. 1 changed file with 11 additions and 3 deletions.
    14 changes: 11 additions & 3 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -44,15 +44,23 @@
    *
    * Version 1.5
    * - Added global:404_entry_id
    * Version 1.6
    * - Added SSL support for site url
    */

    // Setup the environment
    if(!defined('NSM_ENV')) {
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_SITE_URL', 'http://'.NSM_SERVER_NAME);
    define('NSM_BASEPATH', dirname(__FILE__));
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") {
    define('NSM_SITE_URL', "http://".NSM_SERVER_NAME . '/');
    } else {
    define('NSM_SITE_URL', "https://".NSM_SERVER_NAME . '/');
    }

    // Set the environment
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'development');
    @@ -166,9 +174,9 @@

    // NSM Gravatar
    'global:nsm_gravatar_default_avatar' => NSM_SITE_URL . '/uploads/member/avatars/default.png',

    // Store the entry_id for the 404 page
    'global:404_entry_id' => '2',
    'global:404_entry_id' => '2',
    );

    // Make this global so we can add some of the config variables here
  15. leevigraham revised this gist Apr 19, 2011. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@
    * @author Leevi Graham <http://leevigraham.com>
    * @link http://expressionengine.com/index.php?affiliate=leevigraham&page=wiki/EE_2_Config_Overrides/
    * @link http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/ - Hat tip to: Erskine from EECI2010 Preso
    * @version 1.4
    * @version 1.5
    *
    * == Changelog ==
    *
    @@ -41,7 +41,9 @@
    *
    * Version 1.4
    * - Updated NSM .htaccess path. v1.1.0 of the addon requires the config setting to be an array
    *
    * Version 1.5
    * - Added global:404_entry_id
    */

    // Setup the environment
    @@ -163,8 +165,11 @@
    'global:google_analytics_key' => false,

    // NSM Gravatar
    'global:nsm_gravatar_default_avatar' => NSM_SITE_URL . '/uploads/member/avatars/default.png'
    );
    'global:nsm_gravatar_default_avatar' => NSM_SITE_URL . '/uploads/member/avatars/default.png',

    // Store the entry_id for the 404 page
    'global:404_entry_id' => '2',
    );

    // Make this global so we can add some of the config variables here
    global $assign_to_config;
  16. leevigraham revised this gist Apr 1, 2011. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@
    * @author Leevi Graham <http://leevigraham.com>
    * @link http://expressionengine.com/index.php?affiliate=leevigraham&page=wiki/EE_2_Config_Overrides/
    * @link http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/ - Hat tip to: Erskine from EECI2010 Preso
    * @version 1.1
    * @version 1.4
    *
    * == Changelog ==
    *
    @@ -38,6 +38,10 @@
    *
    * Version 1.3
    * - Added encryption key
    *
    * Version 1.4
    * - Updated NSM .htaccess path. v1.1.0 of the addon requires the config setting to be an array
    */

    // Setup the environment
    @@ -271,7 +275,7 @@
    'encryption_key' => '',

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => NSM_BASEPATH . "/content/.htaccess"
    'nsm_htaccess_generator_path' => array(NSM_BASEPATH . "/content/.htaccess")
    );


  17. leevigraham revised this gist Mar 22, 2011. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,9 @@
    *
    * Version 1.2
    * - Removed $_GET and $_POST parsing. You should use Mo Variables instead. https://github.com/rsanchez/mo_variables
    *
    * Version 1.3
    * - Added encryption key
    */

    // Setup the environment
    @@ -264,8 +267,11 @@
    'captcha_path' => NSM_BASEPATH . '/content/'.NSM_SYSTEM_FOLDER.'/images/captchas/',
    'captcha_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/images/captchas/',

    // Encryption / Session key
    'encryption_key' => '',

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => NSM_BASEPATH . "/content/.htaccess",
    'nsm_htaccess_generator_path' => NSM_BASEPATH . "/content/.htaccess"
    );


  18. leevigraham revised this gist Feb 11, 2011. 1 changed file with 5 additions and 11 deletions.
    16 changes: 5 additions & 11 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,9 @@
    * - Make $_GET array available as global vars with 'get:' prefix
    * - Added more inline commenting
    * - Swapped order of system config and global vars
    *
    * Version 1.2
    * - Removed $_GET and $_POST parsing. You should use Mo Variables instead. https://github.com/rsanchez/mo_variables
    */

    // Setup the environment
    @@ -156,15 +159,6 @@
    'global:nsm_gravatar_default_avatar' => NSM_SITE_URL . '/uploads/member/avatars/default.png'
    );

    // Turn $_GET into global variables
    foreach ($_GET as $key => $value)
    $default_global_vars['get:' . $key] = $value;

    // Turn $_GET into global variables
    foreach ($_POST as $key => $value)
    if(!is_array($value))
    $default_global_vars['post:' . $key] = $value;

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    @@ -203,8 +197,8 @@
    'is_site_on' => 'y',
    'site_404' => 'site/four04',

    'webmaster_email' => 'admin@' . NSM_SERVER_NAME,
    'webmaster_name' => 'Admin',
    'webmaster_email' => 'webmaster@' . NSM_SERVER_NAME,
    'webmaster_name' => 'Webmaster',

    // Localization preferences
    'server_timezone' => 'UP10',
  19. leevigraham revised this gist Dec 16, 2010. 1 changed file with 266 additions and 208 deletions.
    474 changes: 266 additions & 208 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -1,40 +1,52 @@
    <?php

    /**
    * Custom configuration bootsrtap file for ExpressionEngine
    *
    * Place config.php in your site root
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
    * If you have moved your site root you'll need to update the require_once path
    *
    * Also includes custom DB configuration file based on your environment
    *
    * Posiible DB configuration options
    *
    * $env_db_config['hostname'] = "";
    * $env_db_config['username'] = "";
    * $env_db_config['password'] = "";
    * $env_db_config['database'] = "";
    *
    * @author Leevi Graham <http://leevigraham.com>
    * @link http://expressionengine.com/index.php?affiliate=leevigraham&page=wiki/EE_2_Config_Overrides/
    * @link http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/ - Hat tip to: Erskine from EECI2010 Preso
    */
    * Custom configuration bootsrtap file for ExpressionEngine
    *
    * Place config.php in your site root
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
    * If you have moved your site root you'll need to update the require_once path
    *
    * Also includes custom DB configuration file based on your environment
    *
    * Posiible DB configuration options
    *
    * $env_db_config['hostname'] = "";
    * $env_db_config['username'] = "";
    * $env_db_config['password'] = "";
    * $env_db_config['database'] = "";
    *
    * @author Leevi Graham <http://leevigraham.com>
    * @link http://expressionengine.com/index.php?affiliate=leevigraham&page=wiki/EE_2_Config_Overrides/
    * @link http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/ - Hat tip to: Erskine from EECI2010 Preso
    * @version 1.1
    *
    * == Changelog ==
    *
    * Version 1.1
    * - Changed 'gv_' to 'global:'
    * - Added {global:cm_subscriber_list_slug} for campaignmonitor.com integration
    * - Added {global:google_analytics_key} for Google Analytics integration
    * - Make $_POST array available as global vars with 'post:' prefix
    * - Make $_GET array available as global vars with 'get:' prefix
    * - Added more inline commenting
    * - Swapped order of system config and global vars
    */

    // Setup the environment
    if(!defined('NSM_ENV'))
    {
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_SITE_URL', 'http://'.NSM_SERVER_NAME);
    define('NSM_DOC_ROOT', dirname(__FILE__));
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    // Set the environment
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'dev');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'stage');
    elseif( strstr( NSM_SERVER_NAME, 'mobile.' ) ) define('NSM_ENV', 'mobile');
    else define('NSM_ENV', 'production');
    if(!defined('NSM_ENV')) {
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_SITE_URL', 'http://'.NSM_SERVER_NAME);
    define('NSM_BASEPATH', dirname(__FILE__));
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    // Set the environment
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'development');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'staging');
    elseif( strstr( NSM_SERVER_NAME, 'm.' ) ) define('NSM_ENV', 'mobile');
    else define('NSM_ENV', 'production');
    }

    // Define the environment settings
    @@ -43,188 +55,234 @@
    $env_db_config = array();
    $env_global_vars = array();

    /* Set the environmental config and global vars */

    // Local
    if (NSM_ENV == 'local'){
    $env_db_config = array(
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'your_db',
    );
    // $env_global_vars = array();
    // Set the environmental config and global vars
    if (NSM_ENV == 'local') {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );
    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => ''
    );
    }

    // Development
    elseif(NSM_ENV == 'dev'){}

    // Staging
    elseif(NSM_ENV == 'stage'){}

    // Mobile site example
    elseif(NSM_ENV == 'mobile'){
    // If the environment is mobile we'll load a different template path
    // * Files must be saved as templates
    // * Template Groups / Templates must be the same
    $env_config['tmpl_file_basepath'] = NSM_DOC_ROOT . '/templates_mobile/';
    elseif(NSM_ENV == 'development') {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );
    $env_global_vars = array();
    }
    elseif(NSM_ENV == 'staging') {
    $env_db_config = array(
    'hostname' => '',
    'database' => '',
    'username' => '',
    'password' => '',
    );
    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => ''
    );
    }
    elseif(NSM_ENV == 'mobile') {
    $env_db_config = array(
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    );
    $env_config['tmpl_file_basepath'] = NSM_BASEPATH . '/templates_mobile/';
    }
    else {
    $env_global_vars = array(
    'global:cm_subscriber_list_slug' => '',
    'global:google_analytics_key' => 'XX-XXXX'
    );
    }

    // Live site
    else{}

    // Config bootsrap... GO!
    if(isset($config))
    {
    // Our default config. This shouldn't have to be changed if you're using the Newism EE2 template.
    $default_config = array(

    // General preferences
    'is_system_on' => 'y',
    'license_number' => '',
    'site_index' => '',
    'admin_session_type' => 'cs',
    'new_version_check' => 'y',
    'doc_url' => 'http://expressionengine.com/user_guide/',

    'site_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
    'uri_protocol' => 'PATH_INFO',

    // Datbase preferences
    'db_debug' => 'n',
    'pconnect' => 'n',
    'enable_db_caching' => 'n',

    // Site preferences
    // Some of these preferences might actually need to be set in the index.php files.
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
    'is_site_on' => 'y',
    'site_name' => 'EE Template',
    'site_short_name' => 'default_site',
    'site_description' => '',
    'site_404' => 'site/four04',

    //'webmaster_email' => 'admin@' . NSM_SERVER_NAME,
    //'webmaster_name' => 'Admin',

    // Localization preferences
    'server_timezone' => 'UP10',
    'server_offset' => FALSE,
    'time_format' => 'eu',
    'daylight_savings' => 'n',
    'honor_entry_dst' => 'y',

    // Channel preferences
    'word_separator' => 'dash',
    'reserved_category_word' => 'cat',

    // Template preferences
    'strict_urls' => 'y',
    'save_tmpl_files' => 'y',
    'save_tmpl_revisions' => 'y',
    'tmpl_file_basepath' => NSM_DOC_ROOT . '/templates/',

    // Theme preferences
    'theme_folder_path' => NSM_DOC_ROOT . '/content/themes/',
    'theme_folder_url' => NSM_SITE_URL . '/themes/',

    // Tracking preferences
    'enable_online_user_tracking' => 'n',
    'dynamic_tracking_disabling' => '500',
    'enable_hit_tracking' => 'n',
    'enable_entry_view_tracking' => 'n',
    'log_referrers' => 'n',

    // Member preferences
    'allow_registration' => 'n',
    'profile_trigger' => '--sdjhkj2lffgrerfvmdkndkfisolmfmsd',

    'prv_msg_upload_path' => NSM_DOC_ROOT . '/content/uploads/member/prv_messages',
    'enable_emoticons' => 'n',

    'enable_avatars' => 'n',
    'avatar_path' => NSM_DOC_ROOT . '/content/uploads/member/avatars/',
    'avatar_url' => NSM_SITE_URL . '/uploads/member/avatars/',
    'avatar_max_height' => 100,
    'avatar_max_width' => 100,
    'avatar_max_kb' => 100,

    'enable_photos' => 'n',
    'photo_path' => NSM_DOC_ROOT . '/content/uploads/member/photos/',
    'photo_url' => NSM_SITE_URL . '/uploads/member/photos/',
    'photo_max_height' => 200,
    'photo_max_width' => 200,
    'photo_max_kb' => 200,

    'sig_allow_img_upload' => 'n',
    'sig_img_path' => NSM_DOC_ROOT . '/content/uploads/member/signature_attachments/',
    'sig_img_url' => NSM_SITE_URL . '/uploads/member/signature_attachments/',
    'sig_img_max_height' => 80,
    'sig_img_max_width' => 480,
    'sig_img_max_kb' => 30,
    'sig_maxlength' => 500,

    'captcha_font' => 'y',
    'captcha_rand' => 'y',
    'captcha_require_members' => 'n',
    'captcha_path' => NSM_DOC_ROOT . '/content/'.NSM_SYSTEM_FOLDER.'/images/captchas/',
    'captcha_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/images/captchas/',

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => NSM_DOC_ROOT . "/content/.htaccess",

    );

    // Build the new config object
    $config = array_merge($config, $default_config, $env_config);

    /**
    * Custom global variables
    *
    * This is a bit sucky as they are pulled straight from the $assign_to_config array.
    * See EE_Config.php around line 90 or search for: 'global $assign_to_config;'
    * Output the global vars in your template with:
    * <?php $EE = get_instance(); print('<pre><code>'.print_r($EE->config->_global_vars, TRUE) . '</code></pre>'); ?>
    */
    $default_global_vars = array(
    // General
    'global:env' => NSM_ENV,

    // Tag parameters
    'global:param_disable_default' => 'disable="categories|pagination|data"',
    'global:param_disable_all' => 'disable="categories|custom_fields|data|pagination"',
    'global:param_cache_param' => 'cache="yes" refresh="10"',
    '-global:param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time
    'global:date_time' => '%g:%i %a',
    'global:date_short' => '%F %d, %Y',
    'global:date_full' => '%F %d %Y, %g:%i %a',

    // Theme
    'global:theme_url' => '/themes/site_themes/default_site',
    );

    // Turn $_GET into global variables
    foreach ($_GET as $key => $value)
    if(!empty($value))
    $default_global_vars['get:' . $key] = $value;

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();

    $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);
    if(isset($config)) {

    /**
    * Custom global variables
    *
    * This is a bit sucky as they are pulled straight from the $assign_to_config array.
    * See EE_Config.php around line 90 or search for: 'global $assign_to_config;'
    * Output the global vars in your template with:
    * <?php $EE = get_instance(); print('<pre><code>'.print_r($EE->config->_global_vars, TRUE) . '</code></pre>'); ?>
    */
    $default_global_vars = array(
    // General - Set the production environment so we can test / show / hide components
    'global:env' => NSM_ENV,

    // Tag parameters - Short hand tag params
    'global:param_disable_default' => 'disable="categories|pagination|member_data"',
    'global:param_disable_all' => 'disable="categories|custom_fields|member_data|pagination"',
    'global:param_cache_param' => 'cache="yes" refresh="10"',
    '-global:param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time - Short hand date and time
    'global:date_time' => '%g:%i %a',
    'global:date_short' => '%F %d, %Y',
    'global:date_full' => '%F %d %Y, %g:%i %a',

    /**
    * Theme - URL to theme assets
    * Example: <script src="{global:theme_url}/js/libs/modernizr-1.6.min.js"></script>
    */
    'global:theme_url' => NSM_SITE_URL . '/themes/site_themes/default',

    /**
    * CampaignMonitor - Slug for CM signup forms
    * Example: <form action="http://newism.createsend.com/t/y/s/{global:cm_subscriber_list_slug}/" method="post">...</form>
    */
    'global:cm_subscriber_list_slug' => false,

    /**
    * Google Analytics Key
    * Example:
    * <script type="text/javascript">
    * var _gaq = _gaq || [];
    * _gaq.push(['_setAccount', 'UA-{global:google_analytics_key}']);
    * _gaq.push(['_trackPageview']);
    * </script>
    */
    'global:google_analytics_key' => false,

    // NSM Gravatar
    'global:nsm_gravatar_default_avatar' => NSM_SITE_URL . '/uploads/member/avatars/default.png'
    );

    // Turn $_GET into global variables
    foreach ($_GET as $key => $value)
    $default_global_vars['get:' . $key] = $value;

    // Turn $_GET into global variables
    foreach ($_POST as $key => $value)
    if(!is_array($value))
    $default_global_vars['post:' . $key] = $value;

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();

    $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);

    /**
    * Config. This shouldn't have to be changed if you're using the Newism EE2 template.
    */
    $default_config = array(

    // General preferences
    'is_system_on' => 'y',
    'license_number' => '',
    'site_index' => '',
    'admin_session_type' => 'cs',
    'new_version_check' => 'y',
    'doc_url' => 'http://expressionengine.com/user_guide/',

    'site_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
    'uri_protocol' => 'PATH_INFO',

    // Datbase preferences
    'db_debug' => 'n',
    'pconnect' => 'n',
    'enable_db_caching' => 'n',

    // Site preferences
    // Some of these preferences might actually need to be set in the index.php files.
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
    'is_site_on' => 'y',
    'site_404' => 'site/four04',

    'webmaster_email' => 'admin@' . NSM_SERVER_NAME,
    'webmaster_name' => 'Admin',

    // Localization preferences
    'server_timezone' => 'UP10',
    'server_offset' => FALSE,
    'time_format' => 'eu',
    'daylight_savings' => 'n',
    'honor_entry_dst' => 'y',

    // Channel preferences
    'use_category_name' => 'y',
    'word_separator' => 'dash',
    'reserved_category_word' => 'category',

    // Template preferences
    'strict_urls' => 'y',
    'save_tmpl_files' => 'y',
    'save_tmpl_revisions' => 'y',
    'tmpl_file_basepath' => NSM_BASEPATH . '/templates/',

    // Theme preferences
    'theme_folder_path' => NSM_BASEPATH . '/content/themes/',
    'theme_folder_url' => NSM_SITE_URL . '/themes/',

    // Tracking preferences
    'enable_online_user_tracking' => 'n',
    'dynamic_tracking_disabling' => '500',
    'enable_hit_tracking' => 'n',
    'enable_entry_view_tracking' => 'n',
    'log_referrers' => 'n',

    // Member preferences
    'allow_registration' => 'n',
    'profile_trigger' => '--sdjhkj2lffgrerfvmdkndkfisolmfmsd' . time(),

    'prv_msg_upload_path' => NSM_BASEPATH . '/content/uploads/member/pm_attachments',
    'enable_emoticons' => 'n',

    'enable_avatars' => 'n',
    'avatar_path' => NSM_BASEPATH . '/content/uploads/member/avatars/',
    'avatar_url' => NSM_SITE_URL . '/uploads/member/avatars/',
    'avatar_max_height' => 100,
    'avatar_max_width' => 100,
    'avatar_max_kb' => 100,

    'enable_photos' => 'n',
    'photo_path' => NSM_BASEPATH . '/content/uploads/member/photos/',
    'photo_url' => NSM_SITE_URL . '/uploads/member/photos/',
    'photo_max_height' => 200,
    'photo_max_width' => 200,
    'photo_max_kb' => 200,

    'sig_allow_img_upload' => 'n',
    'sig_img_path' => NSM_BASEPATH . '/content/uploads/member/signature_attachments/',
    'sig_img_url' => NSM_SITE_URL . '/uploads/member/signature_attachments/',
    'sig_img_max_height' => 80,
    'sig_img_max_width' => 480,
    'sig_img_max_kb' => 30,
    'sig_maxlength' => 500,

    'captcha_font' => 'y',
    'captcha_rand' => 'y',
    'captcha_require_members' => 'n',
    'captcha_path' => NSM_BASEPATH . '/content/'.NSM_SYSTEM_FOLDER.'/images/captchas/',
    'captcha_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/images/captchas/',

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => NSM_BASEPATH . "/content/.htaccess",
    );



    // Build the new config object
    $config = array_merge($config, $default_config, $env_config);
    }

    // DB bootsrap... GO!
    if(isset($db['expressionengine']))
    {
    $default_db_config = array("cachedir" => APPPATH . "cache/db_cache/");
    $db['expressionengine'] = array_merge($db['expressionengine'], $default_db_config, $env_db_config);
    $default_db_config = array("cachedir" => APPPATH . "cache/db_cache/");
    $db['expressionengine'] = array_merge($db['expressionengine'], $default_db_config, $env_db_config);
    }
  20. leevigraham revised this gist Oct 15, 2010. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,6 @@
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'dev');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'stage');
    // MOBILE SITE
    elseif( strstr( NSM_SERVER_NAME, 'mobile.' ) ) define('NSM_ENV', 'mobile');
    else define('NSM_ENV', 'production');
    }
  21. leevigraham revised this gist Oct 15, 2010. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,8 @@
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'dev');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'stage');
    // MOBILE SITE
    elseif( strstr( NSM_SERVER_NAME, 'mobile.' ) ) define('NSM_ENV', 'mobile');
    else define('NSM_ENV', 'production');
    }

    @@ -42,7 +44,9 @@
    $env_db_config = array();
    $env_global_vars = array();

    // Set the environmental config and global vars
    /* Set the environmental config and global vars */

    // Local
    if (NSM_ENV == 'local'){
    $env_db_config = array(
    'hostname' => 'localhost',
    @@ -52,8 +56,22 @@
    );
    // $env_global_vars = array();
    }

    // Development
    elseif(NSM_ENV == 'dev'){}

    // Staging
    elseif(NSM_ENV == 'stage'){}

    // Mobile site example
    elseif(NSM_ENV == 'mobile'){
    // If the environment is mobile we'll load a different template path
    // * Files must be saved as templates
    // * Template Groups / Templates must be the same
    $env_config['tmpl_file_basepath'] = NSM_DOC_ROOT . '/templates_mobile/';
    }

    // Live site
    else{}

    // Config bootsrap... GO!
  22. leevigraham revised this gist Oct 7, 2010. 1 changed file with 10 additions and 11 deletions.
    21 changes: 10 additions & 11 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -86,7 +86,6 @@
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
    'is_site_on' => 'y',
    'site_name' => 'EE Template',
    'site_label' => 'EE Template',
    'site_short_name' => 'default_site',
    'site_description' => '',
    'site_404' => 'site/four04',
    @@ -175,27 +174,27 @@
    */
    $default_global_vars = array(
    // General
    'gv_env' => NSM_ENV,
    'global:env' => NSM_ENV,

    // Tag parameters
    'gv_param_disable_default' => 'disable="categories|pagination|data"',
    'gv_param_disable_all' => 'disable="categories|custom_fields|data|pagination"',
    'gv_param_cache_param' => 'cache="yes" refresh="10"',
    '-gv_param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global
    'global:param_disable_default' => 'disable="categories|pagination|data"',
    'global:param_disable_all' => 'disable="categories|custom_fields|data|pagination"',
    'global:param_cache_param' => 'cache="yes" refresh="10"',
    '-global:param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time
    'gv_date_time' => '%g:%i %a',
    'gv_date_short' => '%F %d, %Y',
    'gv_date_full' => '%F %d %Y, %g:%i %a',
    'global:date_time' => '%g:%i %a',
    'global:date_short' => '%F %d, %Y',
    'global:date_full' => '%F %d %Y, %g:%i %a',

    // Theme
    'gv_theme_url' => '/themes/site_themes/default_site',
    'global:theme_url' => '/themes/site_themes/default_site',
    );

    // Turn $_GET into global variables
    foreach ($_GET as $key => $value)
    if(!empty($value))
    $default_global_vars['gv_get_' . $key] = $value;
    $default_global_vars['get:' . $key] = $value;

    // Make this global so we can add some of the config variables here
    global $assign_to_config;
  23. leevigraham revised this gist Aug 2, 2010. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -102,7 +102,7 @@
    'honor_entry_dst' => 'y',

    // Channel preferences
    'word_separator' => '-',
    'word_separator' => 'dash',
    'reserved_category_word' => 'cat',

    // Template preferences
    @@ -178,7 +178,7 @@
    'gv_env' => NSM_ENV,

    // Tag parameters
    'gv_param_disable_default' => 'disable="categories|pagination|data"',
    'gv_param_disable_default' => 'disable="categories|pagination|data"',
    'gv_param_disable_all' => 'disable="categories|custom_fields|data|pagination"',
    'gv_param_cache_param' => 'cache="yes" refresh="10"',
    '-gv_param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global
    @@ -192,6 +192,7 @@
    'gv_theme_url' => '/themes/site_themes/default_site',
    );

    // Turn $_GET into global variables
    foreach ($_GET as $key => $value)
    if(!empty($value))
    $default_global_vars['gv_get_' . $key] = $value;
  24. leevigraham revised this gist Jul 14, 2010. 1 changed file with 163 additions and 163 deletions.
    326 changes: 163 additions & 163 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -24,16 +24,16 @@
    // Setup the environment
    if(!defined('NSM_ENV'))
    {
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_SITE_URL', 'http://'.NSM_SERVER_NAME);
    define('NSM_DOC_ROOT', dirname(__FILE__));
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    // Set the environment
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'dev');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'stage');
    else define('NSM_ENV', 'production');
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_SITE_URL', 'http://'.NSM_SERVER_NAME);
    define('NSM_DOC_ROOT', dirname(__FILE__));
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    // Set the environment
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'dev');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'stage');
    else define('NSM_ENV', 'production');
    }

    // Define the environment settings
    @@ -44,13 +44,13 @@

    // Set the environmental config and global vars
    if (NSM_ENV == 'local'){
    $env_db_config = array(
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'your_db',
    );
    // $env_global_vars = array();
    $env_db_config = array(
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'your_db',
    );
    // $env_global_vars = array();
    }
    elseif(NSM_ENV == 'dev'){}
    elseif(NSM_ENV == 'stage'){}
    @@ -59,155 +59,155 @@
    // Config bootsrap... GO!
    if(isset($config))
    {
    // Our default config. This shouldn't have to be changed if you're using the Newism EE2 template.
    $default_config = array(

    // Gneral preferences
    'is_system_on' => 'y',
    'license_number' => '',
    'index_page' => '',
    'admin_session_type' => 'cs',
    'new_version_check' => 'y',
    'doc_url' => 'http://expressionengine.com/user_guide/',

    'site_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
    'uri_protocol' => 'PATH_INFO',

    // Datbase preferences
    'db_debug' => 'n',
    'pconnect' => 'n',
    'enable_db_caching' => 'n',

    // Site preferences
    // Some of these preferences might actually need to be set in the index.php files.
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
    'is_site_on' => 'y',
    'site_name' => 'EE Template',
    'site_label' => 'EE Template',
    'site_short_name' => 'default_site',
    'site_description' => '',
    'site_404' => 'site/four04',

    //'webmaster_email' => 'admin@' . NSM_SERVER_NAME,
    //'webmaster_name' => 'Admin',

    // Localization preferences
    'server_timezone' => 'UP10',
    'server_offset' => FALSE,
    'time_format' => 'eu',
    'daylight_savings' => 'n',
    'honor_entry_dst' => 'y',

    // Channel preferences
    'word_separator' => '-',
    'reserved_category_word' => 'cat',

    // Template preferences
    'strict_urls' => 'y',
    'save_tmpl_files' => 'y',
    'save_tmpl_revisions' => 'y',
    'tmpl_file_basepath' => NSM_DOC_ROOT . '/templates/',

    // Theme preferences
    'theme_folder_path' => NSM_DOC_ROOT . '/content/themes/',
    'theme_folder_url' => NSM_SITE_URL . '/themes/',

    // Tracking preferences
    'enable_online_user_tracking' => 'n',
    'dynamic_tracking_disabling' => '500',
    'enable_hit_tracking' => 'n',
    'enable_entry_view_tracking' => 'n',
    'log_referrers' => 'n',

    // Member preferences
    'allow_registration' => 'n',
    'profile_trigger' => '--sdjhkj2lffgrerfvmdkndkfisolmfmsd',

    'prv_msg_upload_path' => NSM_DOC_ROOT . '/content/uploads/member/prv_messages',
    'enable_emoticons' => 'n',

    'enable_avatars' => 'n',
    'avatar_path' => NSM_DOC_ROOT . '/content/uploads/member/avatars/',
    'avatar_url' => NSM_SITE_URL . '/uploads/member/avatars/',
    'avatar_max_height' => 100,
    'avatar_max_width' => 100,
    'avatar_max_kb' => 100,

    'enable_photos' => 'n',
    'photo_path' => NSM_DOC_ROOT . '/content/uploads/member/photos/',
    'photo_url' => NSM_SITE_URL . '/uploads/member/photos/',
    'photo_max_height' => 200,
    'photo_max_width' => 200,
    'photo_max_kb' => 200,

    'sig_allow_img_upload' => 'n',
    'sig_img_path' => NSM_DOC_ROOT . '/content/uploads/member/signature_attachments/',
    'sig_img_url' => NSM_SITE_URL . '/uploads/member/signature_attachments/',
    'sig_img_max_height' => 80,
    'sig_img_max_width' => 480,
    'sig_img_max_kb' => 30,
    'sig_maxlength' => 500,

    'captcha_font' => 'y',
    'captcha_rand' => 'y',
    'captcha_require_members' => 'n',
    'captcha_path' => NSM_DOC_ROOT . '/content/'.NSM_SYSTEM_FOLDER.'/images/captchas/',
    'captcha_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/images/captchas/',

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => NSM_DOC_ROOT . "/content/.htaccess",
    );

    // Build the new config object
    $config = array_merge($config, $default_config, $env_config);

    /**
    * Custom global variables
    *
    * This is a bit sucky as they are pulled straight from the $assign_to_config array.
    * See EE_Config.php around line 90 or search for: 'global $assign_to_config;'
    * Output the global vars in your template with:
    * <?php $EE = get_instance(); print('<pre><code>'.print_r($EE->config->_global_vars, TRUE) . '</code></pre>'); ?>
    */
    $default_global_vars = array(
    // General
    'gv_env' => NSM_ENV,

    // Tag parameters
    'gv_param_disable_default' => 'disable="categories|pagination|data"',
    'gv_param_disable_all' => 'disable="categories|custom_fields|data|pagination"',
    'gv_param_cache_param' => 'cache="yes" refresh="10"',
    '-gv_param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time
    'gv_date_time' => '%g:%i %a',
    'gv_date_short' => '%F %d, %Y',
    'gv_date_full' => '%F %d %Y, %g:%i %a',

    // Theme
    'gv_theme_url' => '/themes/site_themes/default_site',
    );

    foreach ($_GET as $key => $value)
    if(!empty($value))
    $default_global_vars['gv_get_' . $key] = $value;

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();

    $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);
    // Our default config. This shouldn't have to be changed if you're using the Newism EE2 template.
    $default_config = array(

    // General preferences
    'is_system_on' => 'y',
    'license_number' => '',
    'site_index' => '',
    'admin_session_type' => 'cs',
    'new_version_check' => 'y',
    'doc_url' => 'http://expressionengine.com/user_guide/',

    'site_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
    'uri_protocol' => 'PATH_INFO',

    // Datbase preferences
    'db_debug' => 'n',
    'pconnect' => 'n',
    'enable_db_caching' => 'n',

    // Site preferences
    // Some of these preferences might actually need to be set in the index.php files.
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
    'is_site_on' => 'y',
    'site_name' => 'EE Template',
    'site_label' => 'EE Template',
    'site_short_name' => 'default_site',
    'site_description' => '',
    'site_404' => 'site/four04',

    //'webmaster_email' => 'admin@' . NSM_SERVER_NAME,
    //'webmaster_name' => 'Admin',

    // Localization preferences
    'server_timezone' => 'UP10',
    'server_offset' => FALSE,
    'time_format' => 'eu',
    'daylight_savings' => 'n',
    'honor_entry_dst' => 'y',

    // Channel preferences
    'word_separator' => '-',
    'reserved_category_word' => 'cat',

    // Template preferences
    'strict_urls' => 'y',
    'save_tmpl_files' => 'y',
    'save_tmpl_revisions' => 'y',
    'tmpl_file_basepath' => NSM_DOC_ROOT . '/templates/',

    // Theme preferences
    'theme_folder_path' => NSM_DOC_ROOT . '/content/themes/',
    'theme_folder_url' => NSM_SITE_URL . '/themes/',

    // Tracking preferences
    'enable_online_user_tracking' => 'n',
    'dynamic_tracking_disabling' => '500',
    'enable_hit_tracking' => 'n',
    'enable_entry_view_tracking' => 'n',
    'log_referrers' => 'n',

    // Member preferences
    'allow_registration' => 'n',
    'profile_trigger' => '--sdjhkj2lffgrerfvmdkndkfisolmfmsd',

    'prv_msg_upload_path' => NSM_DOC_ROOT . '/content/uploads/member/prv_messages',
    'enable_emoticons' => 'n',

    'enable_avatars' => 'n',
    'avatar_path' => NSM_DOC_ROOT . '/content/uploads/member/avatars/',
    'avatar_url' => NSM_SITE_URL . '/uploads/member/avatars/',
    'avatar_max_height' => 100,
    'avatar_max_width' => 100,
    'avatar_max_kb' => 100,

    'enable_photos' => 'n',
    'photo_path' => NSM_DOC_ROOT . '/content/uploads/member/photos/',
    'photo_url' => NSM_SITE_URL . '/uploads/member/photos/',
    'photo_max_height' => 200,
    'photo_max_width' => 200,
    'photo_max_kb' => 200,

    'sig_allow_img_upload' => 'n',
    'sig_img_path' => NSM_DOC_ROOT . '/content/uploads/member/signature_attachments/',
    'sig_img_url' => NSM_SITE_URL . '/uploads/member/signature_attachments/',
    'sig_img_max_height' => 80,
    'sig_img_max_width' => 480,
    'sig_img_max_kb' => 30,
    'sig_maxlength' => 500,

    'captcha_font' => 'y',
    'captcha_rand' => 'y',
    'captcha_require_members' => 'n',
    'captcha_path' => NSM_DOC_ROOT . '/content/'.NSM_SYSTEM_FOLDER.'/images/captchas/',
    'captcha_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/images/captchas/',

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => NSM_DOC_ROOT . "/content/.htaccess",

    );

    // Build the new config object
    $config = array_merge($config, $default_config, $env_config);

    /**
    * Custom global variables
    *
    * This is a bit sucky as they are pulled straight from the $assign_to_config array.
    * See EE_Config.php around line 90 or search for: 'global $assign_to_config;'
    * Output the global vars in your template with:
    * <?php $EE = get_instance(); print('<pre><code>'.print_r($EE->config->_global_vars, TRUE) . '</code></pre>'); ?>
    */
    $default_global_vars = array(
    // General
    'gv_env' => NSM_ENV,

    // Tag parameters
    'gv_param_disable_default' => 'disable="categories|pagination|data"',
    'gv_param_disable_all' => 'disable="categories|custom_fields|data|pagination"',
    'gv_param_cache_param' => 'cache="yes" refresh="10"',
    '-gv_param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time
    'gv_date_time' => '%g:%i %a',
    'gv_date_short' => '%F %d, %Y',
    'gv_date_full' => '%F %d %Y, %g:%i %a',

    // Theme
    'gv_theme_url' => '/themes/site_themes/default_site',
    );

    foreach ($_GET as $key => $value)
    if(!empty($value))
    $default_global_vars['gv_get_' . $key] = $value;

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();

    $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);
    }

    // DB bootsrap... GO!
    if(isset($db['expressionengine']))
    {
    $default_db_config = array("cachedir" => APPPATH . "cache/db_cache/");
    $db['expressionengine'] = array_merge($db['expressionengine'], $default_db_config, $env_db_config);
    $default_db_config = array("cachedir" => APPPATH . "cache/db_cache/");
    $db['expressionengine'] = array_merge($db['expressionengine'], $default_db_config, $env_db_config);
    }
  25. leevigraham revised this gist Jul 14, 2010. 1 changed file with 176 additions and 174 deletions.
    350 changes: 176 additions & 174 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -1,38 +1,39 @@
    <?php
    /**
    * Custom configuration file for ExpressionEngine
    * Custom configuration bootsrtap file for ExpressionEngine
    *
    * Place config_bootstrap.php in your site root
    * Add: require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
    * Place config.php in your site root
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
    * If you have moved your site root you'll need to update the require_once path
    *
    * Note: If you have moved your site root you'll need to update the require_once path
    * Also includes custom DB configuration file based on your environment
    *
    * Asset paths such as member avatars reflect Newism's folder approach not the default EE install
    * Posiible DB configuration options
    *
    * Also includes custom DB configuration file based on your environment. Possible configuration options:
    *
    * $env_db_config['hostname'] = "localhost";
    * $env_db_config['username'] = "root";
    * $env_db_config['hostname'] = "";
    * $env_db_config['username'] = "";
    * $env_db_config['password'] = "";
    * $env_db_config['database'] = "your_database";
    * $env_db_config['database'] = "";
    *
    * @author Leevi Graham <http://leevigraham.com>, Technical Director - Newism <http://newism.com.au>
    * @link http://expressionengine.com/wiki/EE_2_Config_Overrides/
    * @author Leevi Graham <http://leevigraham.com>
    * @link http://expressionengine.com/index.php?affiliate=leevigraham&page=wiki/EE_2_Config_Overrides/
    * @link http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/ - Hat tip to: Erskine from EECI2010 Preso
    */

    // Setup the environment
    if(!defined('NSM_ENV'))
    {
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_SITE_URL', 'http://'.NSM_SERVER_NAME);
    define('NSM_DOC_ROOT', realpath(dirname(__FILE__)));

    // Set the environment
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'dev');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'stage');
    else define('NSM_ENV', 'production');
    define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
    define('NSM_SITE_URL', 'http://'.NSM_SERVER_NAME);
    define('NSM_DOC_ROOT', dirname(__FILE__));
    define('NSM_SYSTEM_FOLDER', 'ee-admin');

    // Set the environment
    if ( strstr( NSM_SERVER_NAME, 'local.' ) ) define('NSM_ENV', 'local');
    elseif( strstr( NSM_SERVER_NAME, 'dev.' ) ) define('NSM_ENV', 'dev');
    elseif( strstr( NSM_SERVER_NAME, 'stage.' ) ) define('NSM_ENV', 'stage');
    else define('NSM_ENV', 'production');
    }

    // Define the environment settings
    @@ -43,14 +44,13 @@

    // Set the environmental config and global vars
    if (NSM_ENV == 'local'){
    // $env_config = array();
    $env_db_config = array(
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'your_database'
    );
    // $env_global_vars = array();
    $env_db_config = array(
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'your_db',
    );
    // $env_global_vars = array();
    }
    elseif(NSM_ENV == 'dev'){}
    elseif(NSM_ENV == 'stage'){}
    @@ -59,153 +59,155 @@
    // Config bootsrap... GO!
    if(isset($config))
    {
    // Our default config. This shouldn't have to be changed if you're using the Newism EE2 template.
    $default_config = array(

    // Gneral preferences
    'is_system_on' => 'y',
    'license_number' => '',
    'index_page' => '',
    'admin_session_type' => 'cs',
    'new_version_check' => 'y',
    'doc_url' => 'http://expressionengine.com/public_beta/docs/',

    'base_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL . '/ee-admin/index.php',

    // Set this so we can use query strings
    // Our .htaccess rule must look like: RewriteRule (.*) /index.php/$1 [L]
    'uri_protocol' => 'PATH_INFO',

    // Site preferences
    // Some of these preferences might actually need to be set in the index.php files.
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
    'is_site_on' => 'y',
    'site_name' => 'EE Template',
    'site_label' => 'EE Template',
    'site_short_name' => 'default_site',
    'site_description' => '',
    'site_404' => 'site/four04',

    'webmaster_email' => 'admin@' . NSM_SERVER_NAME,
    'webmaster_name' => 'Admin',

    // Localization preferences
    'server_timezone' => 'UP10',
    'server_offset' => FALSE,
    'time_format' => 'eu',
    'daylight_savings' => 'n',
    'honor_entry_dst' => 'y',

    // Channel preferences
    'word_separator' => '-',
    'reserved_category_word' => 'cat',

    // Template preferences
    'strict_urls' => 'y',
    'save_tmpl_files' => 'y',
    'save_tmpl_revisions' => 'y',
    'tmpl_file_basepath' => NSM_DOC_ROOT . '/templates/',

    // Theme preferences
    'theme_folder_path' => NSM_DOC_ROOT . '/content/themes/',
    'theme_folder_url' => NSM_SITE_URL . '/themes/',

    // Tracking preferences
    'enable_online_user_tracking' => 'n',
    'dynamic_tracking_disabling' => '500',
    'enable_hit_tracking' => 'n',
    'enable_entry_view_tracking' => 'n',
    'log_referrers' => 'n',

    // Member preferences
    'allow_member_registration' => 'n',
    'profile_trigger' => '--sdsdjh22kj3hjksdkjhkj2lffgrerfvmdkndkfisolmfmsd',

    'enable_avatars' => 'n',
    'avatar_path' => NSM_DOC_ROOT . '/content/uploads/member_assets/member_avatars/',
    'avatar_url' => NSM_SITE_URL . '/member_assets/member_avatars/',
    'avatar_max_height' => 100,
    'avatar_max_width' => 100,
    'avatar_max_kb' => 100,

    'enable_photos' => 'n',
    'photo_path' => NSM_DOC_ROOT . '/content/uploads/member_assets/member_photos/',
    'photo__url' => NSM_SITE_URL . '/member_assets/member_photos/',
    'photo_max_height' => 200,
    'photo_max_width' => 200,
    'photo_max_kb' => 200,

    'enable_emoticons' => 'n',

    'sig_allow_img_upload' => 'n',
    'sig_img_path' => NSM_DOC_ROOT . '/content/uploads/member_assets/signature_attachments/',
    'sig_img_url' => NSM_SITE_URL . '/member_assets/signature_attachments/',
    'sig_img_max_height' => 80,
    'sig_img_max_width' => 480,
    'sig_img_max_kb' => 30,
    'sig_maxlength' => 500,

    // Capcha preferences
    'captcha_font' => 'y',
    'captcha_rand' => 'y',
    'captcha_require_members' => 'n',
    'captcha_path' => NSM_DOC_ROOT . '/content/images/captchas/',
    'captcha_url' => NSM_SITE_URL . '/images/captchas/',
    );

    // Build the new config object
    $config = array_merge($config, $default_config, $env_config);

    /**
    * Custom global variables
    *
    * This is a bit sucky as they are pulled straight from the $assign_to_config array.
    * See EE_Config.php around line 90 or search for: 'global $assign_to_config;'
    * Output the global vars in your template with:
    * <?php $EE = get_instance(); print('<pre><code>'.print_r($EE->config->_global_vars, TRUE) . '</code></pre>'); ?>
    * Hat tip to: Erskine from EECI2010 Preso: http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/
    */

    $default_global_vars = array(
    // General
    'gv_env' => NSM_ENV,

    // Tag parameters
    'gv_param_disable_default' => 'disable="categories|pagination|member_data"',
    'gv_param_disable_all' => 'disable="categories|custom_fields|member_data|pagination"',
    'gv_param_cache_param' => 'cache="yes" refresh="10"',
    '-gv_param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time
    'gv_date_time' => '%g:%i %a',
    'gv_date_short' => '%F %d, %Y',
    'gv_date_full' => '%F %d %Y, %g:%i %a',

    // theme urls
    'gv_theme_url' => '/themes/site_themes/default_site/'
    );

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();

    $assign_to_config['global_vars'] = array_merge(
    $assign_to_config['global_vars'],
    $default_global_vars,
    $env_global_vars
    );
    // Our default config. This shouldn't have to be changed if you're using the Newism EE2 template.
    $default_config = array(

    // Gneral preferences
    'is_system_on' => 'y',
    'license_number' => '',
    'index_page' => '',
    'admin_session_type' => 'cs',
    'new_version_check' => 'y',
    'doc_url' => 'http://expressionengine.com/user_guide/',

    'site_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/index.php',

    // Set this so we can use query strings
    'uri_protocol' => 'PATH_INFO',

    // Datbase preferences
    'db_debug' => 'n',
    'pconnect' => 'n',
    'enable_db_caching' => 'n',

    // Site preferences
    // Some of these preferences might actually need to be set in the index.php files.
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
    'is_site_on' => 'y',
    'site_name' => 'EE Template',
    'site_label' => 'EE Template',
    'site_short_name' => 'default_site',
    'site_description' => '',
    'site_404' => 'site/four04',

    //'webmaster_email' => 'admin@' . NSM_SERVER_NAME,
    //'webmaster_name' => 'Admin',

    // Localization preferences
    'server_timezone' => 'UP10',
    'server_offset' => FALSE,
    'time_format' => 'eu',
    'daylight_savings' => 'n',
    'honor_entry_dst' => 'y',

    // Channel preferences
    'word_separator' => '-',
    'reserved_category_word' => 'cat',

    // Template preferences
    'strict_urls' => 'y',
    'save_tmpl_files' => 'y',
    'save_tmpl_revisions' => 'y',
    'tmpl_file_basepath' => NSM_DOC_ROOT . '/templates/',

    // Theme preferences
    'theme_folder_path' => NSM_DOC_ROOT . '/content/themes/',
    'theme_folder_url' => NSM_SITE_URL . '/themes/',

    // Tracking preferences
    'enable_online_user_tracking' => 'n',
    'dynamic_tracking_disabling' => '500',
    'enable_hit_tracking' => 'n',
    'enable_entry_view_tracking' => 'n',
    'log_referrers' => 'n',

    // Member preferences
    'allow_registration' => 'n',
    'profile_trigger' => '--sdjhkj2lffgrerfvmdkndkfisolmfmsd',

    'prv_msg_upload_path' => NSM_DOC_ROOT . '/content/uploads/member/prv_messages',
    'enable_emoticons' => 'n',

    'enable_avatars' => 'n',
    'avatar_path' => NSM_DOC_ROOT . '/content/uploads/member/avatars/',
    'avatar_url' => NSM_SITE_URL . '/uploads/member/avatars/',
    'avatar_max_height' => 100,
    'avatar_max_width' => 100,
    'avatar_max_kb' => 100,

    'enable_photos' => 'n',
    'photo_path' => NSM_DOC_ROOT . '/content/uploads/member/photos/',
    'photo_url' => NSM_SITE_URL . '/uploads/member/photos/',
    'photo_max_height' => 200,
    'photo_max_width' => 200,
    'photo_max_kb' => 200,

    'sig_allow_img_upload' => 'n',
    'sig_img_path' => NSM_DOC_ROOT . '/content/uploads/member/signature_attachments/',
    'sig_img_url' => NSM_SITE_URL . '/uploads/member/signature_attachments/',
    'sig_img_max_height' => 80,
    'sig_img_max_width' => 480,
    'sig_img_max_kb' => 30,
    'sig_maxlength' => 500,

    'captcha_font' => 'y',
    'captcha_rand' => 'y',
    'captcha_require_members' => 'n',
    'captcha_path' => NSM_DOC_ROOT . '/content/'.NSM_SYSTEM_FOLDER.'/images/captchas/',
    'captcha_url' => NSM_SITE_URL.'/'.NSM_SYSTEM_FOLDER.'/images/captchas/',

    // NSM htaccess Generator
    'nsm_htaccess_generator_path' => NSM_DOC_ROOT . "/content/.htaccess",

    );

    // Build the new config object
    $config = array_merge($config, $default_config, $env_config);

    /**
    * Custom global variables
    *
    * This is a bit sucky as they are pulled straight from the $assign_to_config array.
    * See EE_Config.php around line 90 or search for: 'global $assign_to_config;'
    * Output the global vars in your template with:
    * <?php $EE = get_instance(); print('<pre><code>'.print_r($EE->config->_global_vars, TRUE) . '</code></pre>'); ?>
    */
    $default_global_vars = array(
    // General
    'gv_env' => NSM_ENV,

    // Tag parameters
    'gv_param_disable_default' => 'disable="categories|pagination|data"',
    'gv_param_disable_all' => 'disable="categories|custom_fields|data|pagination"',
    'gv_param_cache_param' => 'cache="yes" refresh="10"',
    '-gv_param_cache_param' => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time
    'gv_date_time' => '%g:%i %a',
    'gv_date_short' => '%F %d, %Y',
    'gv_date_full' => '%F %d %Y, %g:%i %a',

    // Theme
    'gv_theme_url' => '/themes/site_themes/default_site',
    );

    foreach ($_GET as $key => $value)
    if(!empty($value))
    $default_global_vars['gv_get_' . $key] = $value;

    // Make this global so we can add some of the config variables here
    global $assign_to_config;

    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();

    $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);
    }

    // DB bootsrap... GO!
    if(isset($db['expressionengine']))
    {
    $default_db_config = array("cachedir" => APPPATH . "cache/db_cache/");
    $db['expressionengine'] = array_merge(
    $db['expressionengine'],
    $default_db_config,
    $env_db_config
    );
    $default_db_config = array("cachedir" => APPPATH . "cache/db_cache/");
    $db['expressionengine'] = array_merge($db['expressionengine'], $default_db_config, $env_db_config);
    }
  26. leevigraham revised this gist Jul 6, 2010. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -73,6 +73,10 @@
    'base_url' => NSM_SITE_URL,
    'cp_url' => NSM_SITE_URL . '/ee-admin/index.php',

    // Set this so we can use query strings
    // Our .htaccess rule must look like: RewriteRule (.*) /index.php/$1 [L]
    'uri_protocol' => 'PATH_INFO',

    // Site preferences
    // Some of these preferences might actually need to be set in the index.php files.
    // Not sure which ones yet, I'll figure that out when I have my first MSM site.
  27. leevigraham revised this gist Jul 2, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@
    if (NSM_ENV == 'local'){
    // $env_config = array();
    $env_db_config = array(
    'host_name' => 'localhost',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'your_database'
  28. leevigraham renamed this gist Jun 29, 2010. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions config.php → config_bootstrap.php
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@
    /**
    * Custom configuration file for ExpressionEngine
    *
    * Place config.php in your site root
    * Add: require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
    * Place config_bootstrap.php in your site root
    * Add: require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
    *
    * Note: If you have moved your site root you'll need to update the require_once path
    *
  29. leevigraham revised this gist Jun 29, 2010. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions config.php
    Original file line number Diff line number Diff line change
    @@ -3,20 +3,19 @@
    * Custom configuration file for ExpressionEngine
    *
    * Place config.php in your site root
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add: require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
    *
    * Note: If you have moved your site root you'll need to update the require_once path
    * Asset paths such as member avatars reflect Newism's folder approach not the default EE install
    *
    * Also includes custom DB configuration file based on your environment
    * Asset paths such as member avatars reflect Newism's folder approach not the default EE install
    *
    * Posiible configuration options
    * Also includes custom DB configuration file based on your environment. Possible configuration options:
    *
    * $env_db_config['hostname'] = "localhost";
    * $env_db_config['username'] = "root";
    * $env_db_config['password'] = "";
    * $env_db_config['database'] = "your_database";
    * $env_db_config['cachedir'] = "/yoursite.com/www/system/expressionengine/cache/db_cache/";
    *
    * @author Leevi Graham <http://leevigraham.com>, Technical Director - Newism <http://newism.com.au>
    * @link http://expressionengine.com/wiki/EE_2_Config_Overrides/
  30. leevigraham revised this gist Jun 29, 2010. 1 changed file with 14 additions and 14 deletions.
    28 changes: 14 additions & 14 deletions config.php
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,8 @@
    * Place config.php in your site root
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/config.php
    * Add require(realpath(dirname(__FILE__) . '/../../config.php')); to the bottom of system/expressionengine/config/database.php
    * If you have moved your site root you'll need to update the require_once path
    * Note: If you have moved your site root you'll need to update the require_once path
    * Asset paths such as member avatars reflect Newism's folder approach not the default EE install
    *
    * Also includes custom DB configuration file based on your environment
    *
    @@ -15,18 +16,9 @@
    * $env_db_config['username'] = "root";
    * $env_db_config['password'] = "";
    * $env_db_config['database'] = "your_database";
    * $env_db_config['dbdriver'] = "mysql";
    * $env_db_config['dbprefix'] = "exp_";
    * $env_db_config['pconnect'] = FALSE;
    * $env_db_config['swap_pre'] = "exp_";
    * $env_db_config['db_debug'] = TRUE;
    * $env_db_config['cache_on'] = FALSE;
    * $env_db_config['autoinit'] = FALSE;
    * $env_db_config['char_set'] = "utf8";
    * $env_db_config['dbcollat'] = "utf8_general_ci";
    * $env_db_config['cachedir'] = "/yoursite.com//www/system/expressionengine/cache/db_cache/";
    * $env_db_config['cachedir'] = "/yoursite.com/www/system/expressionengine/cache/db_cache/";
    *
    * @author Leevi Graham <http://leevigraham.com>
    * @author Leevi Graham <http://leevigraham.com>, Technical Director - Newism <http://newism.com.au>
    * @link http://expressionengine.com/wiki/EE_2_Config_Overrides/
    */

    @@ -197,12 +189,20 @@
    if(!isset($assign_to_config['global_vars']))
    $assign_to_config['global_vars'] = array();

    $assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);
    $assign_to_config['global_vars'] = array_merge(
    $assign_to_config['global_vars'],
    $default_global_vars,
    $env_global_vars
    );
    }

    // DB bootsrap... GO!
    if(isset($db['expressionengine']))
    {
    $default_db_config = array("cachedir" => APPPATH . "cache/db_cache/");
    $db['expressionengine'] = array_merge($db['expressionengine'], $default_db_config, $env_db_config);
    $db['expressionengine'] = array_merge(
    $db['expressionengine'],
    $default_db_config,
    $env_db_config
    );
    }