function install_get_settings_file_template

7.x install.php install_get_settings_file_template()
6.x install.php install_get_settings_file_template()
4.x install.php install_get_settings_file_template()
5.x install.php install_get_settings_file_template()

Returns a template for a new settings file.

The only role of this function is to provide a settings template, with replacement patterns which we will use to create a new settings.php file.

1 call to install_get_settings_file_template()
install_perform_install in ./install.php
Actually performs the installation of FlightPath

File

./install.php, line 280
This is the initial installation file for FlightPath.

Code

function install_get_settings_file_template() {
  return '

<?php
/**
 * @file
 * The settings file for FlightPath, containing database and other settings.
 *
 * Once you have made changes to this file, it would be best to change
 * the permissions to "read-only" to prevent unauthorized users
 * from altering it.
 */
 
// Set the PHP error reporting level for FlightPath.  In this case,
// only show us errors and warnings. (Hide "notice" and "strict" messages)
error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
 
// Set the PHP max time limit which any one page is allowed to take up while
// running.  The default is 30 seconds.  Change this value (or remove it)
// as needed.
set_time_limit(300);  // 300 seconds = 5 minutes.

 
////////////////////////////////////
// All system settings will be placed (at the end of this script)
// into a $GLOBALS variable, but for now will be placed into the
// array "$system_settings", defined below:

$system_settings = array();


////////////////////////////////////
// !!!  *** IMPORTANT !!!  ***    //
////////////////////////////////////
// If this variable is set to TRUE, then anyone who attempts to log in
// will have full, admin access.
// Only set this to TRUE if you have run into trouble, and cannot log into
// FlightPath normally!
// Otherwise, leave it set to FALSE!
$system_settings["GRANT_FULL_ACCESS"] = FALSE;
////////////////////////////////////

// This should be the actual filesystem path to the directory
// where FlightPath is installed.  Do NOT include a trailing slash!
// Ex: /var/www/public_html/flightpath  or, for Windows: C:/htdocs/flightpath
// ** Depending on your webserver, you may be required to use forward-slashes! **
// use the following line to help you figure out the fileSystemPath, by seeing
// what the path is to this file:
// print "<br>System path to settings.php: " . __FILE__ . "<br><br>";
$system_settings["file_system_path"] = "%FILE_SYSTEM_PATH%";

// The base URL is the actual URL a user would type to visit your site.
// Do NOT enter a trailing slash!
// Ex:  http://localhost/flightpath
$system_settings["base_url"] = "%BASE_URL%";

// The basePath is related to the baseURL.  It is the part of the URL which comes after
// your domain name.
// It MUST begin with a preceeding slash.
// Ex: If your site is example.com/dev/flightpath, then you should
// enter  "/dev/flightpath".  If you are hosting on a bare domain name (https://abc.example.com/)
// then simply enter "/"
$system_settings["base_path"] = "%BASE_PATH%";


////////////////////////////////////
// *** Database-related settings ***
////////////////////////////////////
$system_settings["db_host"] = "%DB_HOST%"; // domain/ip address of the mysql host. ex: localhost, or 10.10.1.1, or db.example.com
$system_settings["db_port"] = "%DB_PORT%"; // default for mysql/mariadb is 3306 
$system_settings["db_name"] = "%DB_NAME%"; // Name of the actual database where flightpath\'s tables are located.
$system_settings["db_user"] = "%DB_USER%"; 
$system_settings["db_pass"] = "%DB_PASS%";


////////////////////////////////////
// *** Cron-related ***           //
////////////////////////////////////
// If you wish to use cron.php (which will call every module\'s
// hook_cron() function), you may set up a cron job like this:
//      php cron.php security_token_string
 
// Cron Security Token:  This is something which
// must be the first argument passed to cron.php.  It can be any continuous
// string of *alpha-numeric* characters.
// This is a security measure to prevent unauthorized users (or web-users) from
// running cron.php, and is REQUIRED!
// For example, if the token is CRON_TOKEN then to run the script you would need
// to use:   https://example.com/cron.php?t=CRON_TOKEN
// 
// In Linux/Unix, you can use the following in your system crontab to run the FlightPath
// cron every 10 minutes:
//    */10 * * * * wget -O - -q -t 1 https://example.com/cron.php?t=CRON_TOKEN
// See the System status page (/admin/config/status) for more instructions.
// 
// The following cron_security_token has been randomly generated:

$system_settings["cron_security_token"] = "%CRON_SECURITY_TOKEN%";


////////////////////////////////////
// *** Encryption-related ***     //
////////////////////////////////////
// The encryption module is enabled by default, and requires an encryption key string to function
// correctly. It should be random characters and at least 32 characthers.
// You may also specify a key file.  See admin/config/encryption for more information.
//
// You should PRINT this encryption string, as well as the hash protocol and cipher algorithm
// in use (see admin/config/encryption) and store in a safe place.  If the encryption key string
// is lost, you will not be able to decrypt previously encrypted values/files.
//
// The encryption key string below has been randomly generated:

$GLOBALS["encryption_key_string"] = "%ENCRYPTION_KEY_STRING%";


////////////////////////////////////////////
/// *** Custom Settings? ***             ///
////////////////////////////////////////////
// If you have any custom settings you wish to add to this file, do so here.
// 
// As long as you place your settings in a uniquely named $GLOBALS variable, it will be accessible on every page load
// throughout FlightPath.
//
// For example: 
//     $GLOBALS["fp_my_custom_module_settings"]["secret_string"] = "Shhh... This is a secret.";
//
// If you are unsure what this might be used for, leave this section blank.





/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////
// END OF SETTINGS FILE /////////////
/////////////////////////////////////
// *** Do not alter or remove below this line!
/////////////////////////////////////
/////////////////////////////////////
/////////////////////////////////////
// This will load the contents of the variables
// table into the $system_settings variable.  These are extra settings
// which were set via the web, usually in the Admin Console.
$db_host = $system_settings["db_host"];
$db_port = $system_settings["db_port"];
$db_user = $system_settings["db_user"];
$db_pass = $system_settings["db_pass"];
$db_name = $system_settings["db_name"];

// Connection by IP address is fastest, so let\'s always try to do that.
// It can be time-consuming to convert our hostname to IP address.  Cache it in our SESSION
if (isset($_SESSION["fp_db_host_ip"])) {
  $db_host_ip = $_SESSION["fp_db_host_ip"];
  if (!$db_host_ip) $db_host_ip = $db_host;
}
else {
  // Convert our db_host into an IP address, then save to simple SESSION cache.
  $db_host_ip = trim(gethostbyname($db_host));
  if (!$db_host_ip) $db_host_ip = $db_host;
  $_SESSION["fp_db_host_ip"] = $db_host_ip;
}

// Connect using PDO
$GLOBALS["pdo"] = new PDO("mysql:host=$db_host_ip;port=$db_port;dbname=$db_name;charset=utf8mb4", $db_user, $db_pass,
  array(
    PDO::MYSQL_ATTR_LOCAL_INFILE => TRUE,
  ));
// Set our error handling...  (using "silent" so I can catch errors in try/catch and display them, email, etc, if wanted.)
$GLOBALS["pdo"]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
     
$res = $GLOBALS["pdo"]->prepare("SELECT * FROM modules WHERE enabled = 1
              ORDER BY weight, name");
$res->execute();
while ($cur = $res->fetch(PDO::FETCH_ASSOC)) {
  $system_settings["modules"][$cur["name"]] = $cur;
}


// We want to make sure the "system" module is enabled, so we will hard-code
// its values.
if ($system_settings["modules"]["system"]["enabled"] != 1) {
  $system_settings["modules"]["system"]["path"] = "modules/system";
  $system_settings["modules"]["system"]["enabled"] = 1;
}



////////////////////////////////////////////
////////////////////////////////////////////
// This must appear at the VERY end!  Nothing involving "system_settings" should come after this....
//
// Assign our system_settings to the GLOBALS array so we can access it anywhere in FlightPath.
$GLOBALS["fp_system_settings"] = $system_settings;

//////////////////////////////////////////////
//////////////////////////////////////////////
// PUT NOTHING BELOW THIS LINE ///////////////        
  
';

}