index.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  9. Copyright (c) Roan Embrechts, Vrije Universiteit Brussel
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  18. Mail: info@dokeos.com
  19. ==============================================================================
  20. */
  21. /**
  22. ==============================================================================
  23. * GOAL : Dokeos installation
  24. * As seen from the user, the installation proceeds in 6 steps.
  25. * The user is presented with several webpages where he/she has to make choices
  26. * and/or fill in data.
  27. *
  28. * The aim is, as always, to have good default settings and suggestions.
  29. *
  30. * @todo reduce high level of duplication in this code
  31. * @todo (busy) organise code into functions
  32. * @package dokeos.install
  33. ==============================================================================
  34. */
  35. /*
  36. ==============================================================================
  37. INIT SECTION
  38. ==============================================================================
  39. */
  40. session_start();
  41. // Including necessary files
  42. @include('../inc/installedVersion.inc.php');
  43. require('../inc/lib/main_api.lib.php');
  44. require('../lang/english/trad4all.inc.php');
  45. require('../lang/english/install.inc.php');
  46. if (!empty($_POST['language_list']))
  47. {
  48. $search = array('../','\\0');
  49. $install_language = str_replace($search,'',urldecode($_POST['language_list']));
  50. if(!is_dir('../lang/'.$install_language)){$install_language = 'english';}
  51. include_once("../lang/$install_language/trad4all.inc.php");
  52. include_once("../lang/$install_language/install.inc.php");
  53. api_session_register('install_language');
  54. }
  55. elseif ( isset($_SESSION['install_language']) && $_SESSION['install_language'] )
  56. {
  57. $install_language = $_SESSION['install_language'];
  58. include_once("../lang/$install_language/trad4all.inc.php");
  59. include_once("../lang/$install_language/install.inc.php");
  60. }
  61. $charset = '';
  62. //force ISO-8859-15 for European languages. Leave Apache determine the encoding for others (HTML declaring UTF-8)
  63. $euro_langs = array('english','french','french_KM','french_corporate','french_org','dutch','spanish','german','italian','greek','danish','swedish','norwegian','polish','galician','catalan','czech','finnish');
  64. if(in_array($install_language,$euro_langs))
  65. {
  66. $charset = 'ISO-8859-15';
  67. header('Content-Type: text/html; charset='. $charset);
  68. }
  69. require_once('install_upgrade.lib.php'); //also defines constants
  70. require_once('install_functions.inc.php');
  71. // Some constants
  72. define('DOKEOS_INSTALL',1);
  73. define('MAX_COURSE_TRANSFER',100);
  74. define('INSTALL_TYPE_UPDATE', 'update');
  75. define('FORM_FIELD_DISPLAY_LENGTH', 40);
  76. define('DATABASE_FORM_FIELD_DISPLAY_LENGTH', 25);
  77. define('MAX_FORM_FIELD_LENGTH', 50);
  78. define('DEFAULT_LANGUAGE', 'english');
  79. // setting the error reporting
  80. error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
  81. // overriding the timelimit (for large campusses that have to be migrated)
  82. @set_time_limit(0);
  83. //upgrading from any subversion of 1.6 is just like upgrading from 1.6.5
  84. $update_from_version_6=array('1.6','1.6.1','1.6.2','1.6.3','1.6.4','1.6.5');
  85. //upgrading from any subversion of 1.8 avoids the additional step of upgrading from 1.6
  86. $update_from_version_8=array('1.8','1.8.2','1.8.3','1.8.4');
  87. $my_old_version = '';
  88. $tmp_version = get_config_param('dokeos_version');
  89. if(!empty($_POST['old_version']))
  90. {
  91. $my_old_version = $_POST['old_version'];
  92. }
  93. elseif(!empty($dokeos_version)) //variable coming from installedVersion, normally
  94. {
  95. $my_old_version = $dokeos_version;
  96. }
  97. elseif(!empty($tmp_version))
  98. {
  99. $my_old_version = $tmp_version;
  100. }
  101. $new_version = '1.8.5';
  102. $new_version_stable = false;
  103. /*
  104. ==============================================================================
  105. STEP 1 : INITIALIZES FORM VARIABLES IF IT IS THE FIRST VISIT
  106. ==============================================================================
  107. */
  108. $badUpdatePath=false;
  109. $emptyUpdatePath=true;
  110. $proposedUpdatePath = '';
  111. if(!empty($_POST['updatePath']))
  112. {
  113. $proposedUpdatePath = $_POST['updatePath'];
  114. }
  115. if($_POST['step2_install'] || $_POST['step2_update_8'] || $_POST['step2_update_6'])
  116. {
  117. if($_POST['step2_install'])
  118. {
  119. $installType='new';
  120. $_POST['step2']=1;
  121. }
  122. else
  123. {
  124. $installType='update';
  125. if($_POST['step2_update_8'])
  126. {
  127. $emptyUpdatePath = false;
  128. if(empty($_POST['updatePath']))
  129. {
  130. $proposedUpdatePath = $_SERVER['DOCUMENT_ROOT'];
  131. }
  132. else
  133. {
  134. $proposedUpdatePath = $_POST['updatePath'];
  135. }
  136. if(substr($proposedUpdatePath,-1) != '/')
  137. {
  138. $proposedUpdatePath.='/';
  139. }
  140. if(file_exists($proposedUpdatePath))
  141. {
  142. if(in_array($my_old_version,$update_from_version_8))
  143. {
  144. $_POST['step2']=1;
  145. }
  146. else
  147. {
  148. $badUpdatePath=true;
  149. }
  150. }
  151. else
  152. {
  153. $badUpdatePath=true;
  154. }
  155. }
  156. else //step2_update_6, presumably
  157. {
  158. if(empty($_POST['updatePath']))
  159. {
  160. $_POST['step1']=1;
  161. }
  162. else
  163. {
  164. $emptyUpdatePath = false;
  165. if(substr($_POST['updatePath'],-1) != '/')
  166. {
  167. $_POST['updatePath'].='/';
  168. }
  169. if(file_exists($_POST['updatePath']))
  170. {
  171. //1.6.x
  172. $my_old_version = get_config_param('clarolineVersion',$_POST['updatePath']);
  173. if(in_array($my_old_version,$update_from_version_6))
  174. {
  175. $_POST['step2']=1;
  176. $proposedUpdatePath = $_POST['updatePath'];
  177. }
  178. else
  179. {
  180. $badUpdatePath=true;
  181. }
  182. }
  183. else
  184. {
  185. $badUpdatePath=true;
  186. }
  187. }
  188. }
  189. }
  190. }
  191. elseif($_POST['step1'])
  192. {
  193. $_POST['updatePath']='';
  194. $installType='';
  195. $updateFromConfigFile='';
  196. unset($_GET['running']);
  197. }
  198. else
  199. {
  200. $installType=$_GET['installType'];
  201. $updateFromConfigFile=$_GET['updateFromConfigFile'];
  202. }
  203. if($installType=='update' && in_array($my_old_version,$update_from_version_8))
  204. {
  205. include_once('../inc/conf/configuration.php');
  206. }
  207. if(!isset($_GET['running']))
  208. {
  209. $dbHostForm='localhost';
  210. $dbUsernameForm='root';
  211. $dbPassForm='';
  212. $dbPrefixForm='';
  213. $dbNameForm='dokeos_main';
  214. $dbStatsForm='dokeos_stats';
  215. $dbScormForm='dokeos_scorm';
  216. $dbUserForm='dokeos_user';
  217. // extract the path to append to the url if Dokeos is not installed on the web root directory
  218. $urlAppendPath=str_replace('/main/install/index.php','',api_get_self());
  219. $urlForm='http://'.$_SERVER['HTTP_HOST'].$urlAppendPath.'/';
  220. $pathForm=str_replace('\\','/',realpath('../..')).'/';
  221. $emailForm=$_SERVER['SERVER_ADMIN'];
  222. $email_parts = explode('@',$emailForm);
  223. if($email_parts[1] == 'localhost')
  224. {
  225. $emailForm .= '.localdomain';
  226. }
  227. $adminLastName='Doe';
  228. $adminFirstName='John';
  229. $loginForm='admin';
  230. $passForm=api_generate_password();
  231. $campusForm='My campus';
  232. $educationForm='Albert Einstein';
  233. $adminPhoneForm='(000) 001 02 03';
  234. $institutionForm='My Organisation';
  235. $institutionUrlForm='http://www.dokeos.com';
  236. $languageForm='english';
  237. $checkEmailByHashSent=0;
  238. $ShowEmailnotcheckedToStudent=1;
  239. $userMailCanBeEmpty=1;
  240. $allowSelfReg=1;
  241. $allowSelfRegProf=1;
  242. $enableTrackingForm=1;
  243. $singleDbForm=0;
  244. $encryptPassForm=1;
  245. $session_lifetime=360000;
  246. }
  247. else
  248. {
  249. foreach($_POST as $key=>$val)
  250. {
  251. $magic_quotes_gpc=ini_get('magic_quotes_gpc')?true:false;
  252. if(is_string($val))
  253. {
  254. if($magic_quotes_gpc)
  255. {
  256. $val=stripslashes($val);
  257. }
  258. $val=trim($val);
  259. $_POST[$key]=$val;
  260. }
  261. elseif(is_array($val))
  262. {
  263. foreach($val as $key2=>$val2)
  264. {
  265. if($magic_quotes_gpc)
  266. {
  267. $val2=stripslashes($val2);
  268. }
  269. $val2=trim($val2);
  270. $_POST[$key][$key2]=$val2;
  271. }
  272. }
  273. $GLOBALS[$key]=$_POST[$key];
  274. }
  275. }
  276. // The Steps
  277. $total_steps=7;
  278. if (!$_POST)
  279. {
  280. $current_step=1;
  281. }
  282. elseif (!empty($_POST['language_list']) or !empty($_POST['step1']) or ((!empty($_POST['step2_update_8']) or (!empty($_POST['step2_update_6']))) && ($emptyUpdatePath or $badUpdatePath)))
  283. {
  284. $current_step=2;
  285. }
  286. elseif (!empty($_POST['step2']) or (!empty($_POST['step2_update_8']) or (!empty($_POST['step2_update_6'])) ))
  287. {
  288. $current_step=3;
  289. }
  290. elseif (!empty($_POST['step3']))
  291. {
  292. $current_step=4;
  293. }
  294. elseif (!empty($_POST['step4']))
  295. {
  296. $current_step=5;
  297. }
  298. elseif (!empty($_POST['step5']))
  299. {
  300. $current_step=6;
  301. }
  302. ?>
  303. <!DOCTYPE html
  304. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  305. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  306. <html xmlns="http://www.w3.org/1999/xhtml">
  307. <head>
  308. <title>&mdash; <?php echo get_lang('DokeosInstallation').' &mdash; '.get_lang('Version_').' '.$new_version; ?></title>
  309. <style type="text/css" media="screen, projection">
  310. /*<![CDATA[*/
  311. @import "../css/default/default.css";
  312. /*]]>*/
  313. </style>
  314. <script language="javascript">
  315. init_visibility=0;
  316. function show_hide_option()
  317. {
  318. if(init_visibility == 0)
  319. {
  320. document.getElementById('optional_param1').style.display = '';
  321. document.getElementById('optional_param2').style.display = '';
  322. if(document.getElementById('optional_param3'))
  323. {
  324. document.getElementById('optional_param3').style.display = '';
  325. }
  326. document.getElementById('optional_param4').style.display = '';
  327. document.getElementById('optional_param5').style.display = '';
  328. document.getElementById('optional_param6').style.display = '';
  329. init_visibility = 1;
  330. }
  331. else
  332. {
  333. document.getElementById('optional_param1').style.display = 'none';
  334. document.getElementById('optional_param2').style.display = 'none';
  335. if(document.getElementById('optional_param3'))
  336. {
  337. document.getElementById('optional_param3').style.display = 'none';
  338. }
  339. document.getElementById('optional_param4').style.display = 'none';
  340. document.getElementById('optional_param5').style.display = 'none';
  341. document.getElementById('optional_param6').style.display = 'none';
  342. init_visibility = 0;
  343. }
  344. }
  345. </script>
  346. <?php if(!empty($charset)){ ?>
  347. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
  348. <?php } ?>
  349. </head>
  350. <body dir="<?php echo $text_dir ?>">
  351. <div id="header">
  352. <div id="header1"><?php echo get_lang('DokeosInstallation').' &mdash; '.get_lang('Version_').' '.$new_version; ?><?php if($installType == 'new') echo ' &ndash; '.get_lang('NewInstallation'); else if($installType == 'update') echo ' &ndash; '.get_lang('UpdateFromDokeosVersion').implode('|',$update_from_version); ?></div>
  353. <div id="header2">&nbsp;</div>
  354. <div id="header3">&nbsp;</div>
  355. </div>
  356. <form style="padding: 0px; margin: 0px;" method="post" action="<?php echo api_get_self(); ?>?running=1&amp;installType=<?php echo $installType; ?>&amp;updateFromConfigFile=<?php echo urlencode($updateFromConfigFile); ?>">
  357. <div id="installation_steps">
  358. <img src="../img/bluelogo.gif" hspace="10" vspace="10" alt="Dokeos logo" />
  359. <ol>
  360. <li <?php step_active('1'); ?>><?php echo get_lang('InstallationLanguage'); ?></li>
  361. <li <?php step_active('2'); ?>><?php echo get_lang('Requirements'); ?></li>
  362. <li <?php step_active('3'); ?>><?php echo get_lang('Licence'); ?></li>
  363. <li <?php step_active('4'); ?>><?php echo get_lang('DBSetting'); ?></li>
  364. <li <?php step_active('5'); ?>><?php echo get_lang('CfgSetting'); ?></li>
  365. <li <?php step_active('6'); ?>><?php echo get_lang('PrintOverview'); ?></li>
  366. <li <?php step_active('7'); ?>><?php echo get_lang('Installing'); ?></li>
  367. </ol>
  368. </div>
  369. <table cellpadding="6" cellspacing="0" border="0" width="75%" align="center">
  370. <tr>
  371. <td>
  372. <input type="hidden" name="updatePath" value="<?php if(!$badUpdatePath) echo htmlentities($proposedUpdatePath); ?>" />
  373. <input type="hidden" name="urlAppendPath" value="<?php echo htmlentities($urlAppendPath); ?>" />
  374. <input type="hidden" name="pathForm" value="<?php echo htmlentities($pathForm); ?>" />
  375. <input type="hidden" name="urlForm" value="<?php echo htmlentities($urlForm); ?>" />
  376. <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" />
  377. <input type="hidden" name="dbUsernameForm" value="<?php echo htmlentities($dbUsernameForm); ?>" />
  378. <input type="hidden" name="dbPassForm" value="<?php echo htmlentities($dbPassForm); ?>" />
  379. <input type="hidden" name="singleDbForm" value="<?php echo htmlentities($singleDbForm); ?>" />
  380. <input type="hidden" name="dbPrefixForm" value="<?php echo htmlentities($dbPrefixForm); ?>" />
  381. <input type="hidden" name="dbNameForm" value="<?php echo htmlentities($dbNameForm); ?>" />
  382. <?php
  383. if($installType == 'update' OR $singleDbForm == 0)
  384. {
  385. ?>
  386. <input type="hidden" name="dbStatsForm" value="<?php echo htmlentities($dbStatsForm); ?>" />
  387. <input type="hidden" name="dbScormForm" value="<?php echo htmlentities($dbScormForm); ?>" />
  388. <input type="hidden" name="dbUserForm" value="<?php echo htmlentities($dbUserForm); ?>" />
  389. <?php
  390. }
  391. else
  392. {
  393. ?>
  394. <input type="hidden" name="dbStatsForm" value="<?php echo htmlentities($dbNameForm); ?>" />
  395. <input type="hidden" name="dbUserForm" value="<?php echo htmlentities($dbNameForm); ?>" />
  396. <?php
  397. }
  398. ?>
  399. <input type="hidden" name="enableTrackingForm" value="<?php echo htmlentities($enableTrackingForm); ?>" />
  400. <input type="hidden" name="allowSelfReg" value="<?php echo htmlentities($allowSelfReg); ?>" />
  401. <input type="hidden" name="allowSelfRegProf" value="<?php echo htmlentities($allowSelfRegProf); ?>" />
  402. <input type="hidden" name="emailForm" value="<?php echo htmlentities($emailForm); ?>" />
  403. <input type="hidden" name="adminLastName" value="<?php echo htmlentities($adminLastName); ?>" />
  404. <input type="hidden" name="adminFirstName" value="<?php echo htmlentities($adminFirstName); ?>" />
  405. <input type="hidden" name="adminPhoneForm" value="<?php echo htmlentities($adminPhoneForm); ?>" />
  406. <input type="hidden" name="loginForm" value="<?php echo htmlentities($loginForm); ?>" />
  407. <input type="hidden" name="passForm" value="<?php echo htmlentities($passForm); ?>" />
  408. <input type="hidden" name="languageForm" value="<?php echo htmlentities($languageForm); ?>" />
  409. <input type="hidden" name="campusForm" value="<?php echo htmlentities($campusForm); ?>" />
  410. <input type="hidden" name="educationForm" value="<?php echo htmlentities($educationForm); ?>" />
  411. <input type="hidden" name="institutionForm" value="<?php echo htmlentities($institutionForm); ?>" />
  412. <input type="hidden" name="institutionUrlForm" value="<?php echo stristr($institutionUrlForm,'http://')?htmlentities($institutionUrlForm):'http://'.htmlentities($institutionUrlForm); ?>" />
  413. <input type="hidden" name="checkEmailByHashSent" value="<?php echo htmlentities($checkEmailByHashSent); ?>" />
  414. <input type="hidden" name="ShowEmailnotcheckedToStudent" value="<?php echo htmlentities($ShowEmailnotcheckedToStudent); ?>" />
  415. <input type="hidden" name="userMailCanBeEmpty" value="<?php echo htmlentities($userMailCanBeEmpty); ?>" />
  416. <input type="hidden" name="encryptPassForm" value="<?php echo htmlentities($encryptPassForm); ?>" />
  417. <input type="hidden" name="session_lifetime" value="<?php echo htmlentities($session_lifetime); ?>" />
  418. <input type="hidden" name="old_version" value="<?php echo htmlentities($my_old_version); ?>" />
  419. <input type="hidden" name="new_version" value="<?php echo htmlentities($new_version); ?>" />
  420. <?php
  421. if($_POST['step2'])
  422. {
  423. //STEP 3 : LICENSE
  424. display_license_agreement();
  425. }
  426. elseif($_POST['step3'])
  427. {
  428. //STEP 4 : MYSQL DATABASE SETTINGS
  429. display_database_settings_form($installType, $dbHostForm, $dbUsernameForm, $dbPassForm, $dbPrefixForm, $enableTrackingForm, $singleDbForm, $dbNameForm, $dbStatsForm, $dbScormForm, $dbUserForm);
  430. }
  431. elseif($_POST['step4'])
  432. {
  433. //STEP 5 : CONFIGURATION SETTINGS
  434. //if update, try getting settings from the database...
  435. if($installType == 'update')
  436. {
  437. $db_name = $dbNameForm;
  438. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'platformLanguage');
  439. if(!empty($tmp)) $languageForm = $tmp;
  440. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'emailAdministrator');
  441. if(!empty($tmp)) $emailForm = $tmp;
  442. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'administratorName');
  443. if(!empty($tmp)) $adminFirstName = $tmp;
  444. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'administratorSurname');
  445. if(!empty($tmp)) $adminLastName = $tmp;
  446. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'administratorTelephone');
  447. if(!empty($tmp)) $adminPhoneForm = $tmp;
  448. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'siteName');
  449. if(!empty($tmp)) $campusForm = $tmp;
  450. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'Institution');
  451. if(!empty($tmp)) $institutionForm = $tmp;
  452. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'InstitutionUrl');
  453. if(!empty($tmp)) $institutionUrlForm = $tmp;
  454. if(in_array($my_old_version,$update_from_version_6))
  455. { //for version 1.6
  456. $urlForm = get_config_param('rootWeb');
  457. $encryptPassForm = get_config_param('userPasswordCrypted');
  458. $allowSelfReg = get_config_param('allowSelfReg');
  459. $allowSelfRegProf = get_config_param('allowSelfRegProf');
  460. }
  461. else
  462. { //for version 1.8
  463. $urlForm = $_configuration['root_web'];
  464. $encryptPassForm = get_config_param('userPasswordCrypted');
  465. $allowSelfReg = false;
  466. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'allow_registration');
  467. if(!empty($tmp)) $allowSelfReg = $tmp;
  468. $allowSelfRegProf = false;
  469. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'allow_registration_as_teacher');
  470. if(!empty($tmp)) $allowSelfRegProf = $tmp;
  471. }
  472. }
  473. display_configuration_settings_form($installType, $urlForm, $languageForm, $emailForm, $adminFirstName, $adminLastName, $adminPhoneForm, $campusForm, $institutionForm, $institutionUrlForm, $encryptPassForm, $allowSelfReg, $allowSelfRegProf, $loginForm, $passForm);
  474. }
  475. elseif($_POST['step5'])
  476. {
  477. //STEP 6 : LAST CHECK BEFORE INSTALL
  478. ?>
  479. <h2><?php echo display_step_sequence().get_lang('LastCheck'); ?></h2>
  480. <?php echo get_lang('HereAreTheValuesYouEntered');?>
  481. <br />
  482. <b><?php echo get_lang('PrintThisPageToRememberPassAndOthers');?></b>
  483. <blockquote>
  484. <?php echo get_lang('MainLang').' : '.$languageForm; ?><br /><br />
  485. <?php echo get_lang('DBHost').' : '.$dbHostForm; ?><br />
  486. <?php echo get_lang('DBLogin').' : '.$dbUsernameForm; ?><br />
  487. <?php echo get_lang('DBPassword').' : '.$dbPassForm; ?><br />
  488. <?php if(!empty($dbPrefixForm)) echo get_lang('DbPrefixForm').' : '.$dbPrefixForm.'<br />'; ?>
  489. <?php echo get_lang('MainDB').' : <b>'.$dbNameForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br />
  490. <?php
  491. if(!$singleDbForm)
  492. {
  493. echo get_lang('StatDB').' : <b>'.$dbStatsForm.'</b>';
  494. if($installType == 'new')
  495. {
  496. echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)';
  497. }
  498. echo '<br />';
  499. echo get_lang('ScormDB').' : <b>'.$dbScormForm.'</b>';
  500. if($installType == 'new')
  501. {
  502. echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)';
  503. }
  504. echo '<br />';
  505. echo get_lang('UserDB').' : <b>'.$dbUserForm.'</b>';
  506. if($installType == 'new')
  507. {
  508. echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)';
  509. }
  510. echo '<br />';
  511. }
  512. ?>
  513. <?php echo get_lang('EnableTracking').' : '.($enableTrackingForm?$langYes:$langNo); ?><br />
  514. <?php echo get_lang('SingleDb').' : '.($singleDbForm?$langOne:$langSeveral); ?><br /><br />
  515. <?php echo get_lang('AllowSelfReg').' : '.($allowSelfReg?$langYes:$langNo); ?><br />
  516. <?php echo get_lang('EncryptUserPass').' : '.($encryptPassForm?$langYes:$langNo); ?><br /><br/>
  517. <?php echo get_lang('AdminEmail').' : '.$emailForm; ?><br />
  518. <?php echo get_lang('AdminLastName').' : '.$adminLastName; ?><br />
  519. <?php echo get_lang('AdminFirstName').' : '.$adminFirstName; ?><br />
  520. <?php echo get_lang('AdminPhone').' : '.$adminPhoneForm; ?><br />
  521. <?php if($installType == 'new'): ?>
  522. <?php echo get_lang('AdminLogin').' : <b>'.$loginForm; ?></b><br />
  523. <?php echo get_lang('AdminPass').' : <b>'.$passForm; ?></b><br /><br />
  524. <?php else: ?>
  525. <br />
  526. <?php endif; ?>
  527. <?php echo get_lang('CampusName').' : '.$campusForm; ?><br />
  528. <?php echo get_lang('InstituteShortName').' : '.$institutionForm; ?><br />
  529. <?php echo get_lang('InstituteURL').' : '.$institutionUrlForm; ?><br />
  530. <?php echo get_lang('DokeosURL').' : '.$urlForm; ?><br />
  531. </blockquote>
  532. <?php if($installType == 'new'): ?>
  533. <div style="background-color:#FFFFFF">
  534. <p align="center"><b><font color="red">
  535. <?php echo get_lang('Warning');?> !<br />
  536. <?php echo get_lang('TheInstallScriptWillEraseAllTables');?>
  537. </font></b></p>
  538. </div>
  539. <?php endif; ?>
  540. <table width="100%">
  541. <tr>
  542. <td><input type="submit" name="step4" value="&lt; <?php echo get_lang('Previous'); ?>" /></td>
  543. <td align="right"><input type="submit" name="step6" value="<?php echo get_lang('InstallDokeos'); ?> &gt;" onclick="javascript:if(this.value == '<?php echo get_lang('PleaseWait');?>...') return false; else this.value='<?php echo get_lang('PleaseWait');?>...';" /></td>
  544. </tr>
  545. </table>
  546. <?php
  547. }
  548. elseif($_POST['step6'])
  549. {
  550. //STEP 6 : INSTALLATION PROCESS
  551. if($installType == 'update')
  552. {
  553. if(empty($my_old_version)){$my_old_version='1.8.3';} //we guess
  554. $_configuration['main_database'] = $dbNameForm;
  555. //$urlAppendPath = get_config_param('urlAppend');
  556. switch($my_old_version)
  557. {
  558. case '1.6':
  559. case '1.6.0':
  560. case '1.6.1':
  561. case '1.6.2':
  562. case '1.6.3':
  563. case '1.6.4':
  564. case '1.6.5':
  565. include('update-db-1.6.x-1.8.0.inc.php');
  566. include('update-files-1.6.x-1.8.0.inc.php');
  567. //intentionally no break to continue processing
  568. case '1.8':
  569. case '1.8.0':
  570. include('update-db-1.8.0-1.8.2.inc.php');
  571. //intentionally no break to continue processing
  572. case '1.8.2':
  573. include('update-db-1.8.2-1.8.3.inc.php');
  574. //intentionally no break to continue processing
  575. case '1.8.3':
  576. include('update-db-1.8.3-1.8.4.inc.php');
  577. include('update-files-1.8.3-1.8.4.inc.php');
  578. case '1.8.4':
  579. default:
  580. include('update-db-1.8.4-1.8.5.inc.php');
  581. include('update-files-1.8.4-1.8.5.inc.php');
  582. break;
  583. }
  584. }
  585. else
  586. {
  587. include('install_db.inc.php');
  588. include('install_files.inc.php');
  589. }
  590. display_after_install_message($installType, $nbr_courses);
  591. }
  592. elseif($_POST['step1'] || $badUpdatePath)
  593. {
  594. //STEP 1 : REQUIREMENTS
  595. //make sure that proposed path is set, shouldn't be necessary but...
  596. if(empty($proposedUpdatePath)){$proposedUpdatePath = $_POST['updatePath'];}
  597. display_requirements($installType, $badUpdatePath, $proposedUpdatePath, $update_from_version_8, $update_from_version_6);
  598. }
  599. else
  600. {
  601. //start screen
  602. display_language_selection();
  603. }
  604. ?>
  605. </td>
  606. </tr>
  607. </table>
  608. </form>
  609. <br style="clear:both;" />
  610. <div id="footer">
  611. <div class="copyright"><?php echo get_lang('Platform');?> <a href="http://www.dokeos.com"> Dokeos <?php echo $new_version ?></a> &copy; <?php echo date('Y'); ?> </div>
  612. &nbsp;
  613. </div>
  614. </body>
  615. </html>