install.php

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

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