index.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. <?php //$id: $
  2. /* For licensing terms, see /chamilo_license.txt */
  3. /**
  4. ==============================================================================
  5. * GOAL : Chamilo installation
  6. * As seen from the user, the installation proceeds in 6 steps.
  7. * The user is presented with several webpages where he/she has to make choices
  8. * and/or fill in data.
  9. *
  10. * The aim is, as always, to have good default settings and suggestions.
  11. *
  12. * @todo reduce high level of duplication in this code
  13. * @todo (busy) organise code into functions
  14. * @package dokeos.install
  15. ==============================================================================
  16. */
  17. /*
  18. ==============================================================================
  19. PHP VERSION CHECK
  20. ==============================================================================
  21. */
  22. // PHP version requirement.
  23. define('REQUIRED_PHP_VERSION', '5');
  24. if ( !function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<' )) {
  25. $global_error_code = 1;
  26. // Incorrect PHP version.
  27. require '../inc/global_error_message.inc.php';
  28. die();
  29. }
  30. /*
  31. ==============================================================================
  32. INIT SECTION
  33. ==============================================================================
  34. */
  35. session_start();
  36. // Including necessary files
  37. @include '../inc/installedVersion.inc.php';
  38. require '../inc/lib/main_api.lib.php';
  39. require '../lang/english/trad4all.inc.php';
  40. require '../lang/english/install.inc.php';
  41. if (!empty($_POST['language_list'])) {
  42. $search = array('../','\\0');
  43. $install_language = str_replace($search,'',urldecode($_POST['language_list']));
  44. if(!is_dir('../lang/'.$install_language)){$install_language = 'english';}
  45. include_once "../lang/$install_language/trad4all.inc.php";
  46. include_once "../lang/$install_language/install.inc.php";
  47. api_session_register('install_language');
  48. } elseif ( isset($_SESSION['install_language']) && $_SESSION['install_language'] ) {
  49. $install_language = $_SESSION['install_language'];
  50. include_once "../lang/$install_language/trad4all.inc.php";
  51. include_once "../lang/$install_language/install.inc.php";
  52. }
  53. // These global variables must be set for proper working of the function get_lang(...) during the installation.
  54. $language_interface = $install_language;
  55. $language_interface_initial_value = $install_language;
  56. // Character set during the installation, it is always to be 'UTF-8'.
  57. $charset = 'UTF-8';
  58. // Page encoding initialization.
  59. header('Content-Type: text/html; charset='. $charset);
  60. // Initialization of the internationalization library.
  61. api_initialize_internationalization();
  62. // Initialization of the default encoding that will be used by the multibyte string routines in the internationalization library.
  63. api_set_internationalization_default_encoding($charset);
  64. require_once 'install_upgrade.lib.php'; //also defines constants
  65. require_once 'install_functions.inc.php';
  66. // Some constants
  67. define('DOKEOS_INSTALL',1);
  68. define('MAX_COURSE_TRANSFER',100);
  69. define('INSTALL_TYPE_UPDATE', 'update');
  70. define('FORM_FIELD_DISPLAY_LENGTH', 40);
  71. define('DATABASE_FORM_FIELD_DISPLAY_LENGTH', 25);
  72. define('MAX_FORM_FIELD_LENGTH', 80);
  73. define('DEFAULT_LANGUAGE', 'english');
  74. // setting the error reporting
  75. error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR);
  76. // overriding the timelimit (for large campusses that have to be migrated)
  77. @set_time_limit(0);
  78. //upgrading from any subversion of 1.6 is just like upgrading from 1.6.5
  79. $update_from_version_6=array('1.6','1.6.1','1.6.2','1.6.3','1.6.4','1.6.5');
  80. //upgrading from any subversion of 1.8 avoids the additional step of upgrading from 1.6
  81. $update_from_version_8=array('1.8','1.8.2','1.8.3','1.8.4','1.8.5','1.8.6','1.8.6.1','1.8.6.2');
  82. $my_old_version = '';
  83. $tmp_version = get_config_param('dokeos_version');
  84. if(!empty($_POST['old_version'])) {
  85. $my_old_version = $_POST['old_version'];
  86. } elseif(!empty($tmp_version)) {
  87. $my_old_version = $tmp_version;
  88. }
  89. elseif(!empty($dokeos_version)) //variable coming from installedVersion, normally
  90. {
  91. $my_old_version = $dokeos_version;
  92. }
  93. $new_version = '1.8.7';
  94. $new_version_stable = false;
  95. $new_version_major = true;
  96. /*
  97. ==============================================================================
  98. STEP 1 : INITIALIZES FORM VARIABLES IF IT IS THE FIRST VISIT
  99. ==============================================================================
  100. */
  101. //Is valid request
  102. $is_valid_request=$_REQUEST['is_executable'];
  103. foreach ($_POST as $request_index=>$request_value) {
  104. if (substr($request_index,0,4)=='step') {
  105. if ($request_index<>$is_valid_request) {
  106. unset($_POST[$request_index]);
  107. }
  108. }
  109. }
  110. $badUpdatePath=false;
  111. $emptyUpdatePath=true;
  112. $proposedUpdatePath = '';
  113. if(!empty($_POST['updatePath']))
  114. {
  115. $proposedUpdatePath = $_POST['updatePath'];
  116. }
  117. if ($_POST['step2_install'] || $_POST['step2_update_8'] || $_POST['step2_update_6']) {
  118. if ($_POST['step2_install']) {
  119. $installType='new';
  120. $_POST['step2']=1;
  121. } else {
  122. $installType='update';
  123. if($_POST['step2_update_8'])
  124. {
  125. $emptyUpdatePath = false;
  126. if(empty($_POST['updatePath']))
  127. {
  128. $proposedUpdatePath = $_SERVER['DOCUMENT_ROOT'];
  129. }
  130. else
  131. {
  132. $proposedUpdatePath = $_POST['updatePath'];
  133. }
  134. if(substr($proposedUpdatePath,-1) != '/')
  135. {
  136. $proposedUpdatePath.='/';
  137. }
  138. if(file_exists($proposedUpdatePath))
  139. {
  140. if(in_array($my_old_version,$update_from_version_8))
  141. {
  142. $_POST['step2']=1;
  143. }
  144. else
  145. {
  146. $badUpdatePath=true;
  147. }
  148. }
  149. else
  150. {
  151. $badUpdatePath=true;
  152. }
  153. }
  154. else //step2_update_6, presumably
  155. {
  156. if(empty($_POST['updatePath']))
  157. {
  158. $_POST['step1']=1;
  159. }
  160. else
  161. {
  162. $emptyUpdatePath = false;
  163. if(substr($_POST['updatePath'],-1) != '/')
  164. {
  165. $_POST['updatePath'].='/';
  166. }
  167. if(file_exists($_POST['updatePath']))
  168. {
  169. //1.6.x
  170. $my_old_version = get_config_param('clarolineVersion',$_POST['updatePath']);
  171. if(in_array($my_old_version,$update_from_version_6))
  172. {
  173. $_POST['step2']=1;
  174. $proposedUpdatePath = $_POST['updatePath'];
  175. }
  176. else
  177. {
  178. $badUpdatePath=true;
  179. }
  180. }
  181. else
  182. {
  183. $badUpdatePath=true;
  184. }
  185. }
  186. }
  187. }
  188. }
  189. elseif($_POST['step1'])
  190. {
  191. $_POST['updatePath']='';
  192. $installType='';
  193. $updateFromConfigFile='';
  194. unset($_GET['running']);
  195. }
  196. else
  197. {
  198. $installType=$_GET['installType'];
  199. $updateFromConfigFile=$_GET['updateFromConfigFile'];
  200. }
  201. if($installType=='update' && in_array($my_old_version,$update_from_version_8))
  202. {
  203. include_once '../inc/conf/configuration.php';
  204. }
  205. if(!isset($_GET['running'])) {
  206. $dbHostForm ='localhost';
  207. $dbUsernameForm ='root';
  208. $dbPassForm ='';
  209. $dbPrefixForm ='';
  210. $dbNameForm ='chamilo_main';
  211. $dbStatsForm ='chamilo_stats';
  212. $dbScormForm ='chamilo_scorm';
  213. $dbUserForm ='chamilo_user';
  214. // extract the path to append to the url if Chamilo is not installed on the web root directory
  215. $urlAppendPath=str_replace('/main/install/index.php','',api_get_self());
  216. $urlForm='http://'.$_SERVER['HTTP_HOST'].$urlAppendPath.'/';
  217. $pathForm=str_replace('\\','/',realpath('../..')).'/';
  218. $emailForm=$_SERVER['SERVER_ADMIN'];
  219. $email_parts = explode('@',$emailForm);
  220. if($email_parts[1] == 'localhost')
  221. {
  222. $emailForm .= '.localdomain';
  223. }
  224. $adminLastName = 'Doe';
  225. $adminFirstName = 'John';
  226. $loginForm = 'admin';
  227. $passForm = api_generate_password();
  228. $campusForm = 'My campus';
  229. $educationForm = 'Albert Einstein';
  230. $adminPhoneForm = '(000) 001 02 03';
  231. $institutionForm= 'My Organisation';
  232. $institutionUrlForm= 'http://www.chamilo.org';
  233. $languageForm = 'english';
  234. $checkEmailByHashSent=0;
  235. $ShowEmailnotcheckedToStudent=1;
  236. $userMailCanBeEmpty=1;
  237. $allowSelfReg=1;
  238. $allowSelfRegProf=1;
  239. $enableTrackingForm=1;
  240. $singleDbForm=0;
  241. $encryptPassForm='md5';
  242. $session_lifetime=360000;
  243. } else {
  244. foreach($_POST as $key=>$val)
  245. {
  246. $magic_quotes_gpc=ini_get('magic_quotes_gpc')?true:false;
  247. if(is_string($val))
  248. {
  249. if($magic_quotes_gpc)
  250. {
  251. $val=stripslashes($val);
  252. }
  253. $val=trim($val);
  254. $_POST[$key]=$val;
  255. }
  256. elseif(is_array($val))
  257. {
  258. foreach($val as $key2=>$val2)
  259. {
  260. if($magic_quotes_gpc)
  261. {
  262. $val2=stripslashes($val2);
  263. }
  264. $val2=trim($val2);
  265. $_POST[$key][$key2]=$val2;
  266. }
  267. }
  268. $GLOBALS[$key]=$_POST[$key];
  269. }
  270. }
  271. // The Steps
  272. $total_steps=7;
  273. if (!$_POST)
  274. {
  275. $current_step=1;
  276. }
  277. elseif (!empty($_POST['language_list']) or !empty($_POST['step1']) or ((!empty($_POST['step2_update_8']) or (!empty($_POST['step2_update_6']))) && ($emptyUpdatePath or $badUpdatePath)))
  278. {
  279. $current_step=2;
  280. }
  281. elseif (!empty($_POST['step2']) or (!empty($_POST['step2_update_8']) or (!empty($_POST['step2_update_6'])) ))
  282. {
  283. $current_step=3;
  284. }
  285. elseif (!empty($_POST['step3']))
  286. {
  287. $current_step=4;
  288. }
  289. elseif (!empty($_POST['step4']))
  290. {
  291. $current_step=5;
  292. }
  293. elseif (!empty($_POST['step5']))
  294. {
  295. $current_step=6;
  296. }
  297. // Managing the $encryptPassForm
  298. if ($encryptPassForm=='1' ) {
  299. $encryptPassForm = 'md5';
  300. } elseif ($encryptPassForm=='0') {
  301. $encryptPassForm = 'none';
  302. }
  303. ?>
  304. <!DOCTYPE html
  305. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  306. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  307. <html xmlns="http://www.w3.org/1999/xhtml">
  308. <head>
  309. <title>&mdash; <?php echo get_lang('ChamiloInstallation').' &mdash; '.get_lang('Version_').' '.$new_version; ?></title>
  310. <style type="text/css" media="screen, projection">
  311. /*<![CDATA[*/
  312. @import "../css/chamilo/default.css";
  313. /*]]>*/
  314. </style>
  315. <script type="text/javascript" src="../inc/lib/javascript/jquery.js"></script>
  316. <script type="text/javascript" >
  317. $(document).ready( function() {
  318. //checked
  319. if ($('#singleDb1').attr('checked')==false) {
  320. $('#dbStatsForm').removeAttr('disabled');
  321. $('#dbUserForm').removeAttr('disabled');
  322. $('#dbStatsForm').attr('value','chamilo_stats');
  323. $('#dbUserForm').attr('value','chamilo_user');
  324. } else if($('#singleDb1').attr('checked')==true){
  325. $('#dbStatsForm').attr('disabled','disabled');
  326. $('#dbUserForm').attr('disabled','disabled');
  327. $('#dbStatsForm').attr('value','chamilo_main');
  328. $('#dbUserForm').attr('value','chamilo_main');
  329. }
  330. //Allow Chamilo install in IE
  331. $("button").click(function() {
  332. $("#is_executable").attr("value",$(this).attr("name"));
  333. });
  334. } );
  335. </script>
  336. <script type="text/javascript">
  337. function show_hide_tracking_and_user_db (my_option) {
  338. if (my_option=='singleDb1') {
  339. $('#dbStatsForm').attr('disabled','true');
  340. $('#dbUserForm').attr('disabled','true');
  341. $('#dbStatsForm').attr('value','chamilo_main');
  342. $('#dbUserForm').attr('value','chamilo_main');
  343. } else if (my_option=='singleDb0') {
  344. $('#dbStatsForm').removeAttr('disabled');
  345. $('#dbUserForm').removeAttr('disabled');
  346. $('#dbStatsForm').attr('value','chamilo_stats');
  347. $('#dbUserForm').attr('value','chamilo_user');
  348. }
  349. }
  350. </script>
  351. <script language="javascript">
  352. init_visibility=0;
  353. function show_hide_option() {
  354. if(init_visibility == 0) {
  355. document.getElementById('optional_param1').style.display = '';
  356. document.getElementById('optional_param2').style.display = '';
  357. if(document.getElementById('optional_param3'))
  358. {
  359. document.getElementById('optional_param3').style.display = '';
  360. }
  361. document.getElementById('optional_param4').style.display = '';
  362. document.getElementById('optional_param5').style.display = '';
  363. document.getElementById('optional_param6').style.display = '';
  364. init_visibility = 1;
  365. document.getElementById('optionalparameters').innerHTML='<img style="vertical-align:middle;" src="../img/div_hide.gif" alt="" /> <?php echo get_lang('OptionalParameters'); ?>';
  366. } else {
  367. document.getElementById('optional_param1').style.display = 'none';
  368. document.getElementById('optional_param2').style.display = 'none';
  369. if(document.getElementById('optional_param3')) {
  370. document.getElementById('optional_param3').style.display = 'none';
  371. }
  372. document.getElementById('optional_param4').style.display = 'none';
  373. document.getElementById('optional_param5').style.display = 'none';
  374. document.getElementById('optional_param6').style.display = 'none';
  375. document.getElementById('optionalparameters').innerHTML='<img style="vertical-align:middle;" src="../img/div_show.gif" alt="" /> <?php echo get_lang('OptionalParameters'); ?>';
  376. init_visibility = 0;
  377. }
  378. }
  379. </script>
  380. <?php if(!empty($charset)){ ?>
  381. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
  382. <?php } ?>
  383. </head>
  384. <body dir="<?php echo $text_dir ?>">
  385. <div id="wrapper">
  386. <div id="header">
  387. <div id="header1">
  388. <div id="institution">
  389. <?php echo get_lang('ChamiloInstallation').' &mdash; '.get_lang('Version_').' '.$new_version; ?>
  390. <?php if($installType == 'new') echo ' &ndash; '.get_lang('NewInstallation'); else if($installType == 'update') echo ' &ndash; '.get_lang('UpdateFromDokeosVersion').(is_array($update_from_version)?implode('|',$update_from_version):''); ?>
  391. </div>
  392. </div>
  393. <div id="header2" style="height:50px">&nbsp;</div>
  394. <div id="header3">
  395. <ul>
  396. <li id="current"><a href="#"><span id="tab_active"><?php echo get_lang('Installation');?></span></a></li>
  397. </ul>
  398. </div>
  399. </div>
  400. <div id="main">
  401. <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); ?>">
  402. <div id="installation_steps" style="width:220px">
  403. <!-- <img src="../css/chamilo/images/header-logo.png" hspace="10" vspace="10" alt="Chamilo logo" /> -->
  404. <br />
  405. <ol>
  406. <li <?php step_active('1'); ?>><?php echo get_lang('InstallationLanguage'); ?></li>
  407. <li <?php step_active('2'); ?>><?php echo get_lang('Requirements'); ?></li>
  408. <li <?php step_active('3'); ?>><?php echo get_lang('Licence'); ?></li>
  409. <li <?php step_active('4'); ?>><?php echo get_lang('DBSetting'); ?></li>
  410. <li <?php step_active('5'); ?>><?php echo get_lang('CfgSetting'); ?></li>
  411. <li <?php step_active('6'); ?>><?php echo get_lang('PrintOverview'); ?></li>
  412. <li <?php step_active('7'); ?>><?php echo get_lang('Installing'); ?></li>
  413. </ol>
  414. </div>
  415. <table cellpadding="6" cellspacing="0" border="0" width="72%" align="center">
  416. <tr>
  417. <td>
  418. <div id="note" style="float:right;">
  419. <a href="../../documentation/installation_guide.html" target="_blank"><?php echo get_lang('ReadTheInstallationGuide'); ?></a>
  420. </div>
  421. </td>
  422. </tr>
  423. <tr>
  424. <td>
  425. <input type="hidden" name="updatePath" value="<?php if(!$badUpdatePath) echo api_htmlentities($proposedUpdatePath, ENT_QUOTES, $charset); ?>" />
  426. <input type="hidden" name="urlAppendPath" value="<?php echo api_htmlentities($urlAppendPath, ENT_QUOTES, $charset); ?>" />
  427. <input type="hidden" name="pathForm" value="<?php echo api_htmlentities($pathForm, ENT_QUOTES, $charset); ?>" />
  428. <input type="hidden" name="urlForm" value="<?php echo api_htmlentities($urlForm, ENT_QUOTES, $charset); ?>" />
  429. <input type="hidden" name="dbHostForm" value="<?php echo api_htmlentities($dbHostForm, ENT_QUOTES, $charset); ?>" />
  430. <input type="hidden" name="dbUsernameForm" value="<?php echo api_htmlentities($dbUsernameForm, ENT_QUOTES, $charset); ?>" />
  431. <input type="hidden" name="dbPassForm" value="<?php echo api_htmlentities($dbPassForm, ENT_QUOTES, $charset); ?>" />
  432. <input type="hidden" name="singleDbForm" value="<?php echo api_htmlentities($singleDbForm, ENT_QUOTES, $charset); ?>" />
  433. <input type="hidden" name="dbPrefixForm" value="<?php echo api_htmlentities($dbPrefixForm, ENT_QUOTES, $charset); ?>" />
  434. <input type="hidden" name="dbNameForm" value="<?php echo api_htmlentities($dbNameForm, ENT_QUOTES, $charset); ?>" />
  435. <?php
  436. if($installType == 'update' OR $singleDbForm == 0)
  437. {
  438. ?>
  439. <input type="hidden" name="dbStatsForm" value="<?php echo api_htmlentities($dbStatsForm, ENT_QUOTES, $charset); ?>" />
  440. <input type="hidden" name="dbScormForm" value="<?php echo api_htmlentities($dbScormForm, ENT_QUOTES, $charset); ?>" />
  441. <input type="hidden" name="dbUserForm" value="<?php echo api_htmlentities($dbUserForm, ENT_QUOTES, $charset); ?>" />
  442. <?php
  443. }
  444. else
  445. {
  446. ?>
  447. <input type="hidden" name="dbStatsForm" value="<?php echo api_htmlentities($dbNameForm, ENT_QUOTES, $charset); ?>" />
  448. <input type="hidden" name="dbUserForm" value="<?php echo api_htmlentities($dbNameForm, ENT_QUOTES, $charset); ?>" />
  449. <?php
  450. }
  451. ?>
  452. <input type="hidden" name="enableTrackingForm" value="<?php echo api_htmlentities($enableTrackingForm, ENT_QUOTES, $charset); ?>" />
  453. <input type="hidden" name="allowSelfReg" value="<?php echo api_htmlentities($allowSelfReg, ENT_QUOTES, $charset); ?>" />
  454. <input type="hidden" name="allowSelfRegProf" value="<?php echo api_htmlentities($allowSelfRegProf, ENT_QUOTES, $charset); ?>" />
  455. <input type="hidden" name="emailForm" value="<?php echo api_htmlentities($emailForm, ENT_QUOTES, $charset); ?>" />
  456. <input type="hidden" name="adminLastName" value="<?php echo api_htmlentities($adminLastName, ENT_QUOTES, $charset); ?>" />
  457. <input type="hidden" name="adminFirstName" value="<?php echo api_htmlentities($adminFirstName, ENT_QUOTES, $charset); ?>" />
  458. <input type="hidden" name="adminPhoneForm" value="<?php echo api_htmlentities($adminPhoneForm, ENT_QUOTES, $charset); ?>" />
  459. <input type="hidden" name="loginForm" value="<?php echo api_htmlentities($loginForm, ENT_QUOTES, $charset); ?>" />
  460. <input type="hidden" name="passForm" value="<?php echo api_htmlentities($passForm, ENT_QUOTES, $charset); ?>" />
  461. <input type="hidden" name="languageForm" value="<?php echo api_htmlentities($languageForm, ENT_QUOTES, $charset); ?>" />
  462. <input type="hidden" name="campusForm" value="<?php echo api_htmlentities($campusForm, ENT_QUOTES, $charset); ?>" />
  463. <input type="hidden" name="educationForm" value="<?php echo api_htmlentities($educationForm, ENT_QUOTES, $charset); ?>" />
  464. <input type="hidden" name="institutionForm" value="<?php echo api_htmlentities($institutionForm, ENT_QUOTES, $charset); ?>" />
  465. <input type="hidden" name="institutionUrlForm" value="<?php echo api_stristr($institutionUrlForm, 'http://', false, $charset) ? api_htmlentities($institutionUrlForm, ENT_QUOTES, $charset) : api_stristr($institutionUrlForm, 'https://', false, $charset) ? api_htmlentities($institutionUrlForm, ENT_QUOTES, $charset) : 'http://'.api_htmlentities($institutionUrlForm, ENT_QUOTES, $charset); ?>" />
  466. <input type="hidden" name="checkEmailByHashSent" value="<?php echo api_htmlentities($checkEmailByHashSent, ENT_QUOTES, $charset); ?>" />
  467. <input type="hidden" name="ShowEmailnotcheckedToStudent" value="<?php echo api_htmlentities($ShowEmailnotcheckedToStudent, ENT_QUOTES, $charset); ?>" />
  468. <input type="hidden" name="userMailCanBeEmpty" value="<?php echo api_htmlentities($userMailCanBeEmpty, ENT_QUOTES, $charset); ?>" />
  469. <input type="hidden" name="encryptPassForm" value="<?php echo api_htmlentities($encryptPassForm, ENT_QUOTES, $charset); ?>" />
  470. <input type="hidden" name="session_lifetime" value="<?php echo api_htmlentities($session_lifetime, ENT_QUOTES, $charset); ?>" />
  471. <input type="hidden" name="old_version" value="<?php echo api_htmlentities($my_old_version, ENT_QUOTES, $charset); ?>" />
  472. <input type="hidden" name="new_version" value="<?php echo api_htmlentities($new_version, ENT_QUOTES, $charset); ?>" />
  473. <?php
  474. if($_POST['step2'])
  475. {
  476. //STEP 3 : LICENSE
  477. display_license_agreement();
  478. } elseif($_POST['step3']) {
  479. //STEP 4 : MYSQL DATABASE SETTINGS
  480. display_database_settings_form($installType, $dbHostForm, $dbUsernameForm, $dbPassForm, $dbPrefixForm, $enableTrackingForm, $singleDbForm, $dbNameForm, $dbStatsForm, $dbScormForm, $dbUserForm);
  481. }
  482. elseif($_POST['step4'])
  483. {
  484. //STEP 5 : CONFIGURATION SETTINGS
  485. //if update, try getting settings from the database...
  486. if($installType == 'update')
  487. {
  488. $db_name = $dbNameForm;
  489. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'platformLanguage');
  490. if(!empty($tmp)) $languageForm = $tmp;
  491. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'emailAdministrator');
  492. if(!empty($tmp)) $emailForm = $tmp;
  493. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'administratorName');
  494. if(!empty($tmp)) $adminFirstName = $tmp;
  495. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'administratorSurname');
  496. if(!empty($tmp)) $adminLastName = $tmp;
  497. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'administratorTelephone');
  498. if(!empty($tmp)) $adminPhoneForm = $tmp;
  499. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'siteName');
  500. if(!empty($tmp)) $campusForm = $tmp;
  501. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'Institution');
  502. if(!empty($tmp)) $institutionForm = $tmp;
  503. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'InstitutionUrl');
  504. if(!empty($tmp)) $institutionUrlForm = $tmp;
  505. if(in_array($my_old_version,$update_from_version_6))
  506. { //for version 1.6
  507. $urlForm = get_config_param('rootWeb');
  508. $encryptPassForm = get_config_param('userPasswordCrypted');
  509. // Managing the $encryptPassForm
  510. if ($encryptPassForm=='1' ) {
  511. $encryptPassForm = 'md5';
  512. } elseif ($encryptPassForm=='0') {
  513. $encryptPassForm = 'none';
  514. }
  515. $allowSelfReg = get_config_param('allowSelfReg');
  516. $allowSelfRegProf = get_config_param('allowSelfRegProf');
  517. }
  518. else
  519. { //for version 1.8
  520. $urlForm = $_configuration['root_web'];
  521. $encryptPassForm = get_config_param('userPasswordCrypted');
  522. // Managing the $encryptPassForm
  523. if ($encryptPassForm=='1' ) {
  524. $encryptPassForm = 'md5';
  525. } elseif ($encryptPassForm=='0') {
  526. $encryptPassForm = 'none';
  527. }
  528. $allowSelfReg = false;
  529. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'allow_registration');
  530. if(!empty($tmp)) $allowSelfReg = $tmp;
  531. $allowSelfRegProf = false;
  532. $tmp = get_config_param_from_db($dbHostForm,$dbUsernameForm,$dbPassForm,$db_name,'allow_registration_as_teacher');
  533. if(!empty($tmp)) $allowSelfRegProf = $tmp;
  534. }
  535. }
  536. display_configuration_settings_form($installType, $urlForm, $languageForm, $emailForm, $adminFirstName, $adminLastName, $adminPhoneForm, $campusForm, $institutionForm, $institutionUrlForm, $encryptPassForm, $allowSelfReg, $allowSelfRegProf, $loginForm, $passForm);
  537. }
  538. elseif($_POST['step5'])
  539. {
  540. //STEP 6 : LAST CHECK BEFORE INSTALL
  541. ?>
  542. <h2><?php echo display_step_sequence().get_lang('LastCheck'); ?></h2>
  543. <?php echo get_lang('HereAreTheValuesYouEntered');?>
  544. <br />
  545. <b><?php echo get_lang('PrintThisPageToRememberPassAndOthers');?></b>
  546. <blockquote>
  547. <?php echo get_lang('MainLang').' : '.$languageForm; ?><br /><br />
  548. <?php echo get_lang('DBHost').' : '.$dbHostForm; ?><br />
  549. <?php echo get_lang('DBLogin').' : '.$dbUsernameForm; ?><br />
  550. <?php echo get_lang('DBPassword').' : '.str_repeat('*',strlen($dbPassForm)); ?><br />
  551. <?php if(!empty($dbPrefixForm)) echo get_lang('DbPrefixForm').' : '.$dbPrefixForm.'<br />'; ?>
  552. <?php echo get_lang('MainDB').' : <b>'.$dbNameForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br />
  553. <?php
  554. if(!$singleDbForm)
  555. {
  556. echo get_lang('StatDB').' : <b>'.$dbStatsForm.'</b>';
  557. if($installType == 'new')
  558. {
  559. echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)';
  560. }
  561. echo '<br />';
  562. echo get_lang('UserDB').' : <b>'.$dbUserForm.'</b>';
  563. if($installType == 'new')
  564. {
  565. echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)';
  566. }
  567. echo '<br />';
  568. }
  569. ?>
  570. <?php echo get_lang('EnableTracking').' : '.($enableTrackingForm?get_lang('Yes'):get_lang('No')); ?><br />
  571. <?php echo get_lang('SingleDb').' : '.($singleDbForm?get_lang('One'):get_lang('Several')); ?><br /><br />
  572. <?php echo get_lang('AllowSelfReg').' : '.($allowSelfReg?get_lang('Yes'):get_lang('No')); ?><br />
  573. <?php echo get_lang('EncryptMethodUserPass').' : ';
  574. echo $encryptPassForm;
  575. ?><br /><br/>
  576. <?php echo get_lang('AdminEmail').' : '.$emailForm; ?><br />
  577. <?php
  578. if (api_is_western_name_order()) {
  579. echo get_lang('AdminFirstName').' : '.$adminFirstName, '<br />', get_lang('AdminLastName').' : '.$adminLastName, '<br />';
  580. } else {
  581. echo get_lang('AdminLastName').' : '.$adminLastName, '<br />', get_lang('AdminFirstName').' : '.$adminFirstName, '<br />';
  582. }
  583. ?>
  584. <?php echo get_lang('AdminPhone').' : '.$adminPhoneForm; ?><br />
  585. <?php if($installType == 'new'): ?>
  586. <?php echo get_lang('AdminLogin').' : <b>'.$loginForm; ?></b><br />
  587. <?php echo get_lang('AdminPass').' : <b>'.$passForm; ?></b><br /><br />
  588. <?php else: ?>
  589. <br />
  590. <?php endif; ?>
  591. <?php echo get_lang('CampusName').' : '.$campusForm; ?><br />
  592. <?php echo get_lang('InstituteShortName').' : '.$institutionForm; ?><br />
  593. <?php echo get_lang('InstituteURL').' : '.$institutionUrlForm; ?><br />
  594. <?php echo get_lang('ChamiloURL').' : '.$urlForm; ?><br />
  595. </blockquote>
  596. <?php if($installType == 'new'): ?>
  597. <div style="background-color:#FFFFFF">
  598. <p align="center"><b><font color="red">
  599. <?php echo get_lang('Warning');?> !<br />
  600. <?php echo get_lang('TheInstallScriptWillEraseAllTables');?>
  601. </font></b></p>
  602. </div>
  603. <?php endif; ?>
  604. <table width="100%">
  605. <tr>
  606. <td><button type="submit" class="back" name="step4" value="&lt; <?php echo get_lang('Previous'); ?>" /><?php echo get_lang('Previous'); ?></button></td>
  607. <td align="right"><input type="hidden" name="is_executable" id="is_executable" value="-" /><button class="save" type="submit" name="step6" value="<?php echo get_lang('InstallDokeos'); ?> &gt;" onclick="javascript:if(this.value == '<?php $msg = get_lang('PleaseWait');?>...') return false; else this.value='<?php $msg = get_lang('InstallChamilo');?>...';" ><?php echo $msg; ?></button></td>
  608. </tr>
  609. </table>
  610. <?php
  611. }
  612. elseif($_POST['step6'])
  613. {
  614. //STEP 6 : INSTALLATION PROCESS
  615. if($installType == 'update')
  616. {
  617. if(empty($my_old_version)){$my_old_version='1.8.6';} //we guess
  618. $_configuration['main_database'] = $dbNameForm;
  619. //$urlAppendPath = get_config_param('urlAppend');
  620. error_log('Starting migration process from '.$my_old_version.' ('.time().')',0);
  621. if ($userPasswordCrypted=='1' ) {
  622. $userPasswordCrypted = 'md5';
  623. } elseif ($userPasswordCrypted=='0') {
  624. $userPasswordCrypted = 'none';
  625. }
  626. switch ($my_old_version) {
  627. case '1.6':
  628. case '1.6.0':
  629. case '1.6.1':
  630. case '1.6.2':
  631. case '1.6.3':
  632. case '1.6.4':
  633. case '1.6.5':
  634. include('update-db-1.6.x-1.8.0.inc.php');
  635. include('update-files-1.6.x-1.8.0.inc.php');
  636. //intentionally no break to continue processing
  637. case '1.8':
  638. case '1.8.0':
  639. include('update-db-1.8.0-1.8.2.inc.php');
  640. //intentionally no break to continue processing
  641. case '1.8.2':
  642. include('update-db-1.8.2-1.8.3.inc.php');
  643. //intentionally no break to continue processing
  644. case '1.8.3':
  645. include('update-db-1.8.3-1.8.4.inc.php');
  646. include('update-files-1.8.3-1.8.4.inc.php');
  647. case '1.8.4':
  648. include('update-db-1.8.4-1.8.5.inc.php');
  649. include('update-files-1.8.4-1.8.5.inc.php');
  650. case '1.8.5':
  651. include('update-db-1.8.5-1.8.6.inc.php');
  652. include('update-files-1.8.5-1.8.6.inc.php');
  653. case '1.8.6':
  654. include('update-db-1.8.6-1.8.6.1.inc.php');
  655. include('update-files-1.8.6-1.8.6.1.inc.php');
  656. case '1.8.6.1':
  657. include('update-db-1.8.6.1-1.8.6.2.inc.php');
  658. include('update-files-1.8.6.1-1.8.6.2.inc.php');
  659. case '1.8.6.2':
  660. include('update-db-1.8.6.2-1.8.7.inc.php');
  661. //include('update-files-1.8.6.2-1.8.7.inc.php');
  662. default:
  663. break;
  664. }
  665. } else {
  666. include('install_db.inc.php');
  667. include('install_files.inc.php');
  668. }
  669. display_after_install_message($installType, $nbr_courses);
  670. } elseif($_POST['step1'] || $badUpdatePath) {
  671. //STEP 1 : REQUIREMENTS
  672. //make sure that proposed path is set, shouldn't be necessary but...
  673. if(empty($proposedUpdatePath)){$proposedUpdatePath = $_POST['updatePath'];}
  674. display_requirements($installType, $badUpdatePath, $proposedUpdatePath, $update_from_version_8, $update_from_version_6);
  675. } else {
  676. //start screen
  677. display_language_selection();
  678. }
  679. ?>
  680. </td>
  681. </tr>
  682. </table>
  683. </form>
  684. </div>
  685. <br style="clear:both;" />
  686. <div class="push"></div>
  687. </div><!-- wrapper end-->
  688. <div id="footer">
  689. <div class="copyright"><?php echo get_lang('Platform');?> <a href="http://www.chamilo.org" target="_blank"> Chamilo <?php echo $new_version ?></a> &copy; <?php echo date('Y'); ?> </div>
  690. &nbsp;
  691. </div>
  692. </body>
  693. </html>