install.php

  1. 6.x install.php
  2. 4.x install.php
  3. 5.x install.php

This is the initial installation file for FlightPath.

This script will handle the initial installation of FlightPath, which entails creating its database tables and settings.php file.

File

install.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * This is the initial installation file for FlightPath.
  5. *
  6. * This script will handle the initial installation of FlightPath, which
  7. * entails creating its database tables and settings.php file.
  8. */
  9. // Set the PHP error reporting level for FlightPath. In this case,
  10. // only show us errors and warnings. (Hide "notice" and "strict" messages)
  11. error_reporting(E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_WARNING);
  12. session_start();
  13. header("Cache-control: private");
  14. // Load our bootstrap (skipping over loads we don't need)
  15. $skip_flightpath_settings = TRUE;
  16. $skip_flightpath_modules = TRUE;
  17. require("bootstrap.inc");
  18. // Load needed modules
  19. require_once("modules/system/system.module");
  20. // Check here to see if FlightPath has already been installed.
  21. // We will do this by simply looking for the settings.php file.
  22. if (file_exists("custom/settings.php")) {
  23. die("FlightPath has already been installed. If you wish to re-install FlightPath,
  24. DELETE the custom/settings.php file, and drop all of the tables in FlightPath's
  25. database.");
  26. }
  27. /*
  28. * To begin setting up FlightPath, the user must have completed
  29. * two other steps-- select language, and pass the requirements
  30. * check.
  31. */
  32. $lang = $_REQUEST["lang"];
  33. if ($lang == "") {
  34. install_display_lang_selection();
  35. die;
  36. }
  37. // If we made it here, the language must have been set. So,
  38. // now check the requirements, and display the results if there
  39. // are any.
  40. if ($req_array = install_check_requirements()) {
  41. install_display_requirements($req_array);
  42. die;
  43. }
  44. if ($_REQUEST["perform_action"] != "install") {
  45. // If we made it this far, it means we have no unfulfilled requirements.
  46. // Let's go ahead and ask the user for their database information.
  47. install_display_db_form();
  48. die;
  49. }
  50. else {
  51. // We ARE trying to install. Let's give it a go!
  52. install_perform_install();
  53. die;
  54. }
  55. die;
  56. // See: https://stackoverflow.com/questions/4356289/php-random-string-generator
  57. function install_get_random_string($length = 99) {
  58. $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@^&#%*';
  59. $charlen = strlen($characters);
  60. $random_string = '';
  61. for ($i = 0; $i < $length; $i++) {
  62. $random_string .= $characters[mt_rand(0, $charlen - 1)];
  63. }
  64. return $random_string;
  65. }
  66. /**
  67. * Actually performs the installation of FlightPath
  68. */
  69. function install_perform_install() {
  70. global $user;
  71. if (!isset($user)) {
  72. $user = new stdClass();
  73. }
  74. $user->id = 1; // set to admin during install
  75. $db_name = trim($_POST["db_name"]);
  76. $db_host = trim($_POST["db_host"]);
  77. $db_port = trim($_POST["db_port"]);
  78. $db_user = trim($_POST["db_user"]);
  79. $db_pass = trim($_POST["db_pass"]);
  80. $admin_pass = trim($_POST["admin_pass"]);
  81. $admin_pass2 = trim($_POST["admin_pass2"]);
  82. $admin_name = trim($_POST["admin_name"]);
  83. $admin_email = trim($_POST["admin_email"]);
  84. if (strlen($admin_name) < 3) {
  85. return install_display_db_form("<font color='red'>" . st("Please select another
  86. username for Admin (ex: admin)
  87. which is at least 3 characters long.") . "</font>");
  88. }
  89. if (strlen($admin_pass) < 5) {
  90. return install_display_db_form("<font color='red'>" . st("Admin password must be at least 5 characters long.") . "</font>");
  91. }
  92. if ($admin_pass != $admin_pass2) {
  93. return install_display_db_form("<font color='red'>" . st("You must enter the same Admin password for both the
  94. 'Admin Password' field and the 'Re-enter Password'
  95. field.") . "</font>");
  96. }
  97. if (!filter_var($admin_email, FILTER_VALIDATE_EMAIL)) {
  98. // invalid emailaddress
  99. return install_display_db_form("<font color='red'>" . st("You must enter a valid email address for the admin user.") . "</font>");
  100. }
  101. // Place into settings so our installation procedures will work.
  102. $GLOBALS["fp_system_settings"]["db_host"] = $db_host;
  103. $GLOBALS["fp_system_settings"]["db_port"] = $db_port;
  104. $GLOBALS["fp_system_settings"]["db_user"] = $db_user;
  105. $GLOBALS["fp_system_settings"]["db_pass"] = $db_pass;
  106. $GLOBALS["fp_system_settings"]["db_name"] = $db_name;
  107. // Make sure admin information is OK.
  108. // We will attempt to connect to this database. If we have any problems, we will go back to
  109. // the form and inform the user.
  110. try {
  111. $pdo = new PDO("mysql:host=$db_host;port=$db_port;dbname=$db_name;charset=utf8mb4", $db_user, $db_pass);
  112. $GLOBALS['pdo'] = $pdo;
  113. }
  114. catch (Exception $e) {
  115. // Connection failed!
  116. return install_display_db_form("<div style='color:red;'>" . st("Could not connect. Please check that you have
  117. created the database already, and given the user all of the permissions
  118. (except Grant). Then, make sure you typed the username and
  119. password correctly, as well as the database name itself.
  120. <br><br>Full exception message: " . $e->getMessage()) . "</div>");
  121. }
  122. ///////////////////////////////
  123. // If we have made it here, then we have been provided valid database credentials.
  124. // Let's write out our settings.php file.
  125. $settings_template = trim(install_get_settings_file_template());
  126. // Add in our replacements
  127. $settings_template = str_replace("%DB_HOST%", $db_host, $settings_template);
  128. $settings_template = str_replace("%DB_PORT%", $db_port, $settings_template);
  129. $settings_template = str_replace("%DB_NAME%", $db_name, $settings_template);
  130. $settings_template = str_replace("%DB_USER%", $db_user, $settings_template);
  131. $settings_template = str_replace("%DB_PASS%", $db_pass, $settings_template);
  132. $settings_template = str_replace("%CRON_SECURITY_TOKEN%", md5(time()), $settings_template);
  133. $settings_template = str_replace("%ENCRYPTION_KEY_STRING%", install_get_random_string(99) , $settings_template);
  134. // Attempt to figure out the file_system_path based on __FILE__
  135. $file_system_path = str_replace("install.php", "", __FILE__);
  136. // Convert \ to / in the file system path.
  137. $file_system_path = str_replace("\\", "/", $file_system_path);
  138. // Get rid of the last character, which should be a / at this point.
  139. $file_system_path = substr($file_system_path, 0, -1);
  140. $settings_template = str_replace("%FILE_SYSTEM_PATH%", $file_system_path, $settings_template);
  141. // Attempt to figure out the base URL.
  142. $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
  143. $host = $_SERVER['HTTP_HOST'];
  144. $script = $_SERVER['SCRIPT_NAME'];
  145. $base_url = $protocol . "://" . $host . $script;
  146. $base_url = str_replace("/install.php", "", $base_url);
  147. $settings_template = str_replace("%BASE_URL%", $base_url, $settings_template);
  148. // Figure out the base_path and add it in.
  149. $base_path = str_replace($protocol . "://" . $host, "", $base_url);
  150. $settings_template = str_replace("%BASE_PATH%", $base_path, $settings_template);
  151. // Okay, we have completed all the changes to the settings template string, we can
  152. // write it out to a file now.
  153. if (!file_put_contents("custom/settings.php", $settings_template)) {
  154. die("There was an error trying to write out the /custom/settings.php file. Please
  155. make sure the /custom directory is writable to the webserver.");
  156. }
  157. ///////////////////////////////////
  158. // Okay, we have just written out our settings.php file.
  159. // We now need to install our database. We will do this by
  160. // running the system module's hook_install, as it contains all
  161. // of our various tables needed to run FlightPath.
  162. include_once("modules/system/system.install");
  163. $GLOBALS["fp_die_mysql_errors"] = TRUE;
  164. // call system_install() to perform our numerous DB table creations.
  165. system_install();
  166. // With db tables created, let's include our settings file so we can get some
  167. // important GLOBAL variables set up.
  168. include("custom/settings.php");
  169. // Re-establish DatabaseHandler object connection since we just re-loaded the settings file.
  170. $temp_db = new DatabaseHandler();
  171. // Get our hash of the admin password
  172. $new_pass = user_hash_password($admin_pass);
  173. // Add the admin user to the newly-created users table and the "faculty" table.
  174. db_query("INSERT INTO users (user_id, user_name, cwid, password, email, is_faculty, f_name, l_name)
  175. VALUES ('1', ?, '1', ?, ?, '1', 'Admin', 'User') ", $admin_name, $new_pass, $admin_email);
  176. db_query("INSERT INTO faculty (cwid) VALUES ('1') ");
  177. // Having made it here, we now need to call system_enable,
  178. // which will in turn enable all of the other modules which
  179. // we will need to have, as well as other database changes.
  180. system_enable();
  181. // Now that we have enabled all of the modules (and made other database changes)
  182. // let's re-include the bootstrap file, which will re-init our GLOBAL settings,
  183. // as well as load all of our new modules.
  184. $skip_flightpath_settings = FALSE;
  185. $skip_flightpath_modules = FALSE;
  186. include("bootstrap.inc");
  187. // Re-establish DatabaseHandler object connection since we just re-loaded the settings file.
  188. $temp_db = new DatabaseHandler();
  189. /////////////////////////
  190. // Now, we need to clear our caches and re-build the menu router.
  191. fp_clear_cache();
  192. // wipe out the SESSION to remove any extraneous messages.
  193. session_destroy();
  194. // Okay, now we are done!
  195. // let's re-direct to a new page.
  196. fp_goto("install-finished");
  197. }
  198. /**
  199. * Returns a template for a new settings file.
  200. *
  201. * The only role of this function is to provide a settings
  202. * template, with replacement patterns which we will use to create
  203. * a new settings.php file.
  204. */
  205. function install_get_settings_file_template() {
  206. return '
  207. <?php
  208. /**
  209. * @file
  210. * The settings file for FlightPath, containing database and other settings.
  211. *
  212. * Once you have made changes to this file, it would be best to change
  213. * the permissions to "read-only" to prevent unauthorized users
  214. * from altering it.
  215. */
  216. // Set the PHP error reporting level for FlightPath. In this case,
  217. // only show us errors and warnings. (Hide "notice" and "strict" messages)
  218. error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
  219. // Set the PHP max time limit which any one page is allowed to take up while
  220. // running. The default is 30 seconds. Change this value (or remove it)
  221. // as needed.
  222. set_time_limit(300); // 300 seconds = 5 minutes.
  223. ////////////////////////////////////
  224. // All system settings will be placed (at the end of this script)
  225. // into a $GLOBALS variable, but for now will be placed into the
  226. // array "$system_settings", defined below:
  227. $system_settings = array();
  228. ////////////////////////////////////
  229. // !!! *** IMPORTANT !!! *** //
  230. ////////////////////////////////////
  231. // If this variable is set to TRUE, then anyone who attempts to log in
  232. // will have full, admin access.
  233. // Only set this to TRUE if you have run into trouble, and cannot log into
  234. // FlightPath normally!
  235. // Otherwise, leave it set to FALSE!
  236. $system_settings["GRANT_FULL_ACCESS"] = FALSE;
  237. ////////////////////////////////////
  238. // This should be the actual filesystem path to the directory
  239. // where FlightPath is installed. Do NOT include a trailing slash!
  240. // Ex: /var/www/public_html/flightpath or, for Windows: C:/htdocs/flightpath
  241. // ** Depending on your webserver, you may be required to use forward-slashes! **
  242. // use the following line to help you figure out the fileSystemPath, by seeing
  243. // what the path is to this file:
  244. // print "<br>System path to settings.php: " . __FILE__ . "<br><br>";
  245. $system_settings["file_system_path"] = "%FILE_SYSTEM_PATH%";
  246. // The base URL is the actual URL a user would type to visit your site.
  247. // Do NOT enter a trailing slash!
  248. // Ex: http://localhost/flightpath
  249. $system_settings["base_url"] = "%BASE_URL%";
  250. // The basePath is related to the baseURL. It is the part of the URL which comes after
  251. // your domain name.
  252. // It MUST begin with a preceeding slash.
  253. // Ex: If your site is example.com/dev/flightpath, then you should
  254. // enter "/dev/flightpath". If you are hosting on a bare domain name (https://abc.example.com/)
  255. // then simply enter "/"
  256. $system_settings["base_path"] = "%BASE_PATH%";
  257. ////////////////////////////////////
  258. // *** Database-related settings ***
  259. ////////////////////////////////////
  260. $system_settings["db_host"] = "%DB_HOST%"; // domain/ip address of the mysql host. ex: localhost, or 10.10.1.1, or db.example.com
  261. $system_settings["db_port"] = "%DB_PORT%"; // default for mysql/mariadb is 3306
  262. $system_settings["db_name"] = "%DB_NAME%"; // Name of the actual database where flightpath\'s tables are located.
  263. $system_settings["db_user"] = "%DB_USER%";
  264. $system_settings["db_pass"] = "%DB_PASS%";
  265. ////////////////////////////////////
  266. // *** Cron-related *** //
  267. ////////////////////////////////////
  268. // If you wish to use cron.php (which will call every module\'s
  269. // hook_cron() function), you may set up a cron job like this:
  270. // php cron.php security_token_string
  271. // SecurityToken: This is something which
  272. // must be the first argument passed to cron.php. It can be any continuous
  273. // string of *alpha-numeric* characters.
  274. // This is a security measure to prevent unauthorized users (or web-users) from
  275. // running cron.php, and is REQUIRED!
  276. // For example, if the token is CRON_TOKEN then to run the script you would need
  277. // to use: https://example.com/cron.php?t=CRON_TOKEN
  278. //
  279. // In Linux/Unix, you can use the following in your system crontab to run the FlightPath
  280. // cron every 10 minutes:
  281. // */10 * * * * wget -O - -q -t 1 https://example.com/cron.php?t=CRON_TOKEN
  282. // See the System status page (/admin/config/status) for more instructions.
  283. //
  284. // The following cron_security_token has been randomly generated:
  285. $system_settings["cron_security_token"] = "%CRON_SECURITY_TOKEN%";
  286. ////////////////////////////////////
  287. // *** Encryption-related *** //
  288. ////////////////////////////////////
  289. // The encryption module is enabled by default, and requires an encryption key string to function
  290. // correctly. It should be random characters and at least 32 characthers.
  291. // You may also specify a key file. See admin/config/encryption for more information.
  292. //
  293. // You should PRINT this encryption string, as well as the hash protocol and cipher algorithm
  294. // in use (see admin/config/encryption) and store in a safe place. If the encryption key string
  295. // is lost, you will not be able to decrypt previously encrypted values/files.
  296. //
  297. // The encryption key string below has been randomly generated:
  298. $GLOBALS["encryption_key_string"] = "%ENCRYPTION_KEY_STRING%";
  299. ////////////////////////////////////////////
  300. /// *** Custom Settings? *** ///
  301. ////////////////////////////////////////////
  302. // If you have any custom settings you wish to add to this file, do so here.
  303. //
  304. // As long as you place your settings in a uniquely named $GLOBALS variable, it will be accessible on every page load
  305. // throughout FlightPath.
  306. //
  307. // For example:
  308. // $GLOBALS["fp_my_custom_module_settings"]["secret_string"] = "Shhh... This is a secret.";
  309. //
  310. // If you are unsure what this might be used for, leave this section blank.
  311. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  312. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  313. /////////////////////////////////////
  314. // END OF SETTINGS FILE /////////////
  315. /////////////////////////////////////
  316. // *** Do not alter or remove below this line!
  317. /////////////////////////////////////
  318. /////////////////////////////////////
  319. /////////////////////////////////////
  320. // This will load the contents of the variables
  321. // table into the $system_settings variable. These are extra settings
  322. // which were set via the web, usually in the Admin Console.
  323. $db_host = $system_settings["db_host"];
  324. $db_port = $system_settings["db_port"];
  325. $db_user = $system_settings["db_user"];
  326. $db_pass = $system_settings["db_pass"];
  327. $db_name = $system_settings["db_name"];
  328. // Connection by IP address is fastest, so let\'s always try to do that.
  329. // It can be time-consuming to convert our hostname to IP address. Cache it in our SESSION
  330. if (isset($_SESSION["fp_db_host_ip"])) {
  331. $db_host_ip = $_SESSION["fp_db_host_ip"];
  332. if (!$db_host_ip) $db_host_ip = $db_host;
  333. }
  334. else {
  335. // Convert our db_host into an IP address, then save to simple SESSION cache.
  336. $db_host_ip = trim(gethostbyname($db_host));
  337. if (!$db_host_ip) $db_host_ip = $db_host;
  338. $_SESSION["fp_db_host_ip"] = $db_host_ip;
  339. }
  340. // Connect using PDO
  341. $GLOBALS["pdo"] = new PDO("mysql:host=$db_host_ip;port=$db_port;dbname=$db_name;charset=utf8mb4", $db_user, $db_pass,
  342. array(
  343. PDO::MYSQL_ATTR_LOCAL_INFILE => TRUE,
  344. ));
  345. // Set our error handling... (using "silent" so I can catch errors in try/catch and display them, email, etc, if wanted.)
  346. $GLOBALS["pdo"]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  347. $res = $GLOBALS["pdo"]->prepare("SELECT * FROM modules WHERE enabled = 1
  348. ORDER BY weight, name");
  349. $res->execute();
  350. while ($cur = $res->fetch(PDO::FETCH_ASSOC)) {
  351. $system_settings["modules"][$cur["name"]] = $cur;
  352. }
  353. // We want to make sure the "system" module is enabled, so we will hard-code
  354. // its values.
  355. if ($system_settings["modules"]["system"]["enabled"] != 1) {
  356. $system_settings["modules"]["system"]["path"] = "modules/system";
  357. $system_settings["modules"]["system"]["enabled"] = 1;
  358. }
  359. ////////////////////////////////////////////
  360. ////////////////////////////////////////////
  361. // This must appear at the VERY end! Nothing involving "system_settings" should come after this....
  362. //
  363. // Assign our system_settings to the GLOBALS array so we can access it anywhere in FlightPath.
  364. $GLOBALS["fp_system_settings"] = $system_settings;
  365. //////////////////////////////////////////////
  366. //////////////////////////////////////////////
  367. // PUT NOTHING BELOW THIS LINE ///////////////
  368. ';
  369. }
  370. /**
  371. * Displays the form to let a user set up a new database
  372. */
  373. function install_display_db_form($msg = "") {
  374. global $lang;
  375. $db_name = $_POST["db_name"];
  376. $db_host = $_POST["db_host"];
  377. $db_port = $_POST["db_port"];
  378. $db_user = $_POST["db_user"];
  379. $db_pass = $_POST["db_pass"];
  380. $admin_pass = $_POST["admin_pass"];
  381. $admin_pass2 = $_POST["admin_pass2"];
  382. $admin_name = $_POST["admin_name"];
  383. $admin_email = $_POST["admin_email"];
  384. if ($db_port == "") $db_port = "3306";
  385. $pC = "";
  386. $pC .= "<h2 class='title'>" . st("Setup Database and Admin") . "</h2>$msg
  387. <p>" . st("You should have already set up a database and database user
  388. (with all privileges except Grant) for FlightPath.
  389. <br><br>
  390. <strong>Required: The database default Character set must be 'utf8mb4'.</strong>
  391. <br><br>
  392. Please enter database credentials and information below.") . "</p>
  393. <hr>
  394. <form action='install.php?lang=$lang' method='POST'>
  395. <input type='hidden' name='perform_action' value='install'>
  396. <table border='0' cellpadding='3' style='margin-left: 20px;'>
  397. <tr>
  398. <td colspan='2'><b>" . st("FlightPath administrator information") . "</b></td>
  399. </tr>
  400. <tr>
  401. <td valign='top'>" . st("Admin Username:") . "</td>
  402. <td valign='top'><input type='text' name='admin_name' value='$admin_name' size='15' maxlength='50'> Ex: admin</td>
  403. </tr>
  404. <tr>
  405. <td valign='top'>" . st("Admin Email Address:") . "</td>
  406. <td valign='top'><input type='text' name='admin_email' value='$admin_email' size='20'></td>
  407. </tr>
  408. <tr>
  409. <td valign='top'>" . st("Admin Password:") . "</td>
  410. <td valign='top'><input type='password' name='admin_pass' value='$admin_pass' size='20'></td>
  411. </tr>
  412. <tr>
  413. <td valign='top'>" . st("Re-enter Password:") . "</td>
  414. <td valign='top'><input type='password' name='admin_pass2' value='$admin_pass2' size='20'></td>
  415. </tr>
  416. <tr>
  417. <td colspan='2'><hr>
  418. <b>" . st("Database information") . "</b></td>
  419. </tr>
  420. <tr>
  421. <td valign='top'>" . st("Database Name:") . "</td>
  422. <td valign='top'><input type='text' name='db_name' value='$db_name' size='50'></td>
  423. </tr>
  424. <tr>
  425. <td valign='top'>" . st("Database Host/IP:") . "</td>
  426. <td valign='top'><input type='text' name='db_host' value='$db_host' size='50'></td>
  427. </tr>
  428. <tr>
  429. <td valign='top'>" . st("Database Port:") . "</td>
  430. <td valign='top'><input type='text' name='db_port' value='$db_port' size='10'> Ex: 3306</td>
  431. </tr>
  432. <tr>
  433. <td valign='top'>" . st("Database Username:") . "</td>
  434. <td valign='top'><input type='text' name='db_user' value='$db_user' size='50'></td>
  435. </tr>
  436. <tr>
  437. <td valign='top'>" . st("Database Password:") . "</td>
  438. <td valign='top'><input type='password' name='db_pass' value='$db_pass' size='50'></td>
  439. </tr>
  440. </table>
  441. <br><br>
  442. <input type='submit' value='" . st("Install") . "'>
  443. <br>
  444. <b>" . st("Please click only once. May take several seconds to install.") . "
  445. </form>";
  446. // Display the screen
  447. $page_content = $pC;
  448. install_output_to_browser($page_content);
  449. }
  450. /**
  451. * Check for missing requirements of the system.
  452. *
  453. * Returns an array of missing requirements which the user must fix before
  454. * installation can continue.
  455. *
  456. */
  457. function install_check_requirements() {
  458. $rtn = array();
  459. // Is the /custom directory writable?
  460. if (!is_writable("custom")) {
  461. $rtn[] = st("Please make sure the <em>/custom</em> directory is writable to the web server.
  462. <br>Ex: chmod 777 custom");
  463. }
  464. if (count($rtn) == 0) return FALSE;
  465. return $rtn;
  466. }
  467. /**
  468. * Displays the requirements on screen for the user.
  469. */
  470. function install_display_requirements($req_array) {
  471. global $lang;
  472. $pC = "";
  473. $pC .= "<h2 class='title'>" . st("Check Requirements") . "</h2>
  474. <p>" . st("The following requirements must be fixed before installation of FlightPath
  475. can continue.") . "</p>";
  476. foreach ($req_array as $req) {
  477. $pC .= "<div style='padding: 5px; margin: 10px; border: 1px solid red;
  478. font-family: Courier New, serif; font-size:0.9em'>$req</div>";
  479. }
  480. $pC .= "<p>" . st("Please fix the problems listed, then reload to try again:") . "
  481. <br><a href='install.php?lang=$lang'>" . st("Click here to try again") . "</a>";
  482. // Display the screen
  483. $page_content = $pC;
  484. install_output_to_browser($page_content);
  485. }
  486. function install_display_lang_selection() {
  487. $html = "";
  488. $html .= "<h2 class='title'>Install FlightPath</h2>
  489. Please follow the instructions on the following pages to complete
  490. your installation of FlightPath.
  491. <h3 class='title'>Select language</h3>
  492. Please begin by selecting an installation language.
  493. <ul>
  494. <li><a href='install.php?lang=en'>English</a></li>
  495. </ul>
  496. <br><br><br>
  497. <b>Please note:</b> By proceeding with this installation, you affirm that you
  498. have read, understand, and agree with the LICENSE.txt file and the COPYRIGHT.txt file
  499. included with this software package.
  500. Specifically, that you accept and agree with the GNU GPL license, and with the statement
  501. that this software is provided to you without warranty. If you have any questions,
  502. please visit http://getflightpath.com/contact before proceeding with installation.";
  503. // Display the screen
  504. install_output_to_browser($html);
  505. }
  506. function install_output_to_browser($page_content, $page_title = "Install FlightPath 6") {
  507. print "
  508. <html>
  509. <head>
  510. <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
  511. <title>$page_title</title>
  512. <style>
  513. body
  514. {
  515. font-family: Arial, Helvetica, sans serif;
  516. background-color: white;
  517. }
  518. .top-banner {
  519. width: 820px; /* the size of page-content + padding */
  520. margin-left: auto;
  521. margin-right: auto;
  522. margin-bottom: 1.2em;
  523. background-color: white;
  524. border: 3px solid #ccc;
  525. border-radius: 5px;
  526. }
  527. /* Page content */
  528. .page-content {
  529. width: 800px;
  530. min-height: 400px;
  531. margin-top: 50px;
  532. margin-left: auto;
  533. margin-right: auto;
  534. padding-left: 10px;
  535. padding-right: 10px;
  536. padding-top: 5px;
  537. padding-bottom: 50px;
  538. border: 1px solid #ccc;
  539. box-shadow: 1px 1px 50px #ccc;
  540. border-radius: 5px;
  541. background-color: white;
  542. }
  543. .page-is-popup .page-content {
  544. min-height: 250px;
  545. width: 90%;
  546. }
  547. </style>
  548. </head>
  549. <body>
  550. <div class='page-content'>
  551. $page_content
  552. </div>
  553. </body>
  554. </html>
  555. ";
  556. }

Functions

Namesort descending Description
install_check_requirements Check for missing requirements of the system.
install_display_db_form Displays the form to let a user set up a new database
install_display_lang_selection
install_display_requirements Displays the requirements on screen for the user.
install_get_random_string
install_get_settings_file_template Returns a template for a new settings file.
install_output_to_browser
install_perform_install Actually performs the installation of FlightPath