index.php 23 KB

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