|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 if (isset($_REQUEST['lang'])) { 00028 $lang = preg_replace('/[^A-Za-z0-9_-]/i', '', $_REQUEST['lang']); 00029 } else { 00030 $lang = 'en'; 00031 } 00032 00033 if (isset($_REQUEST['admin'])) { 00034 $admin = preg_replace('/[^A-Za-z0-9_-]/i', '', $_REQUEST['admin']); 00035 } else { 00036 $admin = 'admin'; 00037 } 00038 00039 // If config.php exists we just created config.php and need to redirect to continue installation 00040 $configfile = './config.php'; 00041 if (file_exists($configfile)) { 00042 header("Location: $admin/index.php?lang=$lang"); 00043 die; 00044 } 00045 00046 define('CLI_SCRIPT', false); // prevents some warnings later 00047 define('AJAX_SCRIPT', false); // prevents some warnings later 00048 00049 // Servers should define a default timezone in php.ini, but if they don't then make sure something is defined. 00050 // This is a quick hack. Ideally we should ask the admin for a value. See MDL-22625 for more on this. 00051 if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) { 00052 @date_default_timezone_set(@date_default_timezone_get()); 00053 } 00054 00055 // make sure PHP errors are displayed - helps with diagnosing of problems 00056 @error_reporting(E_ALL); 00057 @ini_set('display_errors', '1'); 00058 00059 // Check that PHP is of a sufficient version 00060 // PHP 5.2.0 is intentionally checked here even though a higher version is required by the environment 00061 // check. This is not a typo - see MDL-18112 00062 if (version_compare(phpversion(), "5.2.0") < 0) { 00063 $phpversion = phpversion(); 00064 // do NOT localise - lang strings would not work here and we CAN not move it after installib 00065 echo "Moodle 2.1 or later requires at least PHP 5.3.2 (currently using version $phpversion).<br />"; 00066 echo "Please upgrade your server software or install older Moodle version."; 00067 die; 00068 } 00069 00070 // make sure iconv is available and actually works 00071 if (!function_exists('iconv')) { 00072 // this should not happen, this must be very borked install 00073 echo 'Moodle requires the iconv PHP extension. Please install or enable the iconv extension.'; 00074 die(); 00075 } 00076 if (iconv('UTF-8', 'UTF-8//IGNORE', 'abc') !== 'abc') { 00077 // known to be broken in mid-2011 MAMP installations 00078 echo 'Broken iconv PHP extension detected, installation can not continue.'; 00079 die; 00080 } 00081 00082 if (PHP_INT_SIZE > 4) { 00083 // most probably 64bit PHP - we need a lot more memory 00084 $minrequiredmemory = '70M'; 00085 } else { 00086 // 32bit PHP 00087 $minrequiredmemory = '40M'; 00088 } 00089 // increase or decrease available memory - we need to make sure moodle 00090 // installs even with low memory, otherwise developers would overlook 00091 // sudden increases of memory needs ;-) 00092 @ini_set('memory_limit', $minrequiredmemory); 00093 00095 define('MOODLE_INTERNAL', true); 00096 00097 require dirname(__FILE__).'/lib/installlib.php'; 00098 00099 // TODO: add lang detection here if empty $_REQUEST['lang'] 00100 00101 // distro specific customisation 00102 $distro = null; 00103 if (file_exists('install/distrolib.php')) { 00104 require_once('install/distrolib.php'); 00105 if (function_exists('distro_get_config')) { 00106 $distro = distro_get_config(); 00107 } 00108 } 00109 00110 $config = new stdClass(); 00111 $config->lang = $lang; 00112 00113 if (!empty($_POST)) { 00114 if (install_ini_get_bool('magic_quotes_gpc')) { 00115 $_POST = array_map('stripslashes', $_POST); 00116 } 00117 00118 $config->stage = (int)$_POST['stage']; 00119 00120 if (isset($_POST['previous'])) { 00121 $config->stage--; 00122 if (INSTALL_DATABASETYPE and !empty($distro->dbtype)) { 00123 $config->stage--; 00124 } 00125 if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_DOWNLOADLANG) { 00126 $config->stage--; 00127 } 00128 } else if (isset($_POST['next'])) { 00129 $config->stage++; 00130 } 00131 00132 $config->dbtype = trim($_POST['dbtype']); 00133 $config->dbhost = trim($_POST['dbhost']); 00134 $config->dbuser = trim($_POST['dbuser']); 00135 $config->dbpass = trim($_POST['dbpass']); 00136 $config->dbname = trim($_POST['dbname']); 00137 $config->prefix = trim($_POST['prefix']); 00138 $config->dbsocket = (int)(!empty($_POST['dbsocket'])); 00139 00140 $config->admin = empty($_POST['admin']) ? 'admin' : trim($_POST['admin']); 00141 00142 $config->dataroot = trim($_POST['dataroot']); 00143 00144 } else { 00145 $config->stage = INSTALL_WELCOME; 00146 00147 $config->dbtype = empty($distro->dbtype) ? '' : $distro->dbtype; // let distro skip dbtype selection 00148 $config->dbhost = empty($distro->dbhost) ? 'localhost' : $distro->dbhost; // let distros set dbhost 00149 $config->dbuser = empty($distro->dbuser) ? '' : $distro->dbuser; // let distros set dbuser 00150 $config->dbpass = ''; 00151 $config->dbname = 'moodle'; 00152 $config->prefix = 'mdl_'; 00153 $config->dbsocket = 0; 00154 00155 $config->admin = 'admin'; 00156 00157 $config->dataroot = empty($distro->dataroot) ? null : $distro->dataroot; // initialised later after including libs or by distro 00158 } 00159 00160 // Fake some settings so that we can use selected functions from moodlelib.php and weblib.php 00161 $CFG = new stdClass(); 00162 $CFG->lang = $config->lang; 00163 $CFG->dirroot = dirname(__FILE__); 00164 $CFG->libdir = "$CFG->dirroot/lib"; 00165 $CFG->wwwroot = install_guess_wwwroot(); // can not be changed - ppl must use the real address when installing 00166 $CFG->httpswwwroot = $CFG->wwwroot; 00167 $CFG->dataroot = $config->dataroot; 00168 $CFG->tempdir = $CFG->dataroot.'/temp'; 00169 $CFG->cachedir = $CFG->dataroot.'/cache'; 00170 $CFG->admin = $config->admin; 00171 $CFG->docroot = 'http://docs.moodle.org'; 00172 $CFG->langotherroot = $CFG->dataroot.'/lang'; 00173 $CFG->langlocalroot = $CFG->dataroot.'/lang'; 00174 $CFG->directorypermissions = isset($distro->directorypermissions) ? $distro->directorypermissions : 00777; // let distros set dir permissions 00175 $CFG->running_installer = true; 00176 $CFG->early_install_lang = true; 00177 00178 // Require all needed libs 00179 require_once($CFG->libdir.'/setuplib.php'); 00180 00181 // we need to make sure we have enough memory to load all libraries 00182 $memlimit = @ini_get('memory_limit'); 00183 if (!empty($memlimit) and $memlimit != -1) { 00184 if (get_real_size($memlimit) < get_real_size($minrequiredmemory)) { 00185 // do NOT localise - lang strings would not work here and we CAN not move it to later place 00186 echo "Moodle requires at least {$minrequiredmemory}B of PHP memory.<br />"; 00187 echo "Please contact server administrator to fix PHP.ini memory settings."; 00188 die; 00189 } 00190 } 00191 00192 // Continue with lib loading 00193 require_once($CFG->libdir.'/textlib.class.php'); 00194 require_once($CFG->libdir.'/weblib.php'); 00195 require_once($CFG->libdir.'/outputlib.php'); 00196 require_once($CFG->libdir.'/dmllib.php'); 00197 require_once($CFG->libdir.'/moodlelib.php'); 00198 require_once($CFG->libdir .'/pagelib.php'); 00199 require_once($CFG->libdir.'/deprecatedlib.php'); 00200 require_once($CFG->libdir.'/adminlib.php'); 00201 require_once($CFG->libdir.'/environmentlib.php'); 00202 require_once($CFG->libdir.'/componentlib.class.php'); 00203 00204 //point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else 00205 //the problem is that we need specific version of quickforms and hacked excel files :-( 00206 ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path')); 00207 //point zend include path to moodles lib/zend so that includes and requires will search there for files before anywhere else 00208 ini_set('include_path', $CFG->libdir.'/zend' . PATH_SEPARATOR . ini_get('include_path')); 00209 00210 require('version.php'); 00211 $CFG->target_release = $release; 00212 00213 $SESSION = new stdClass(); 00214 $SESSION->lang = $CFG->lang; 00215 00216 $USER = new stdClass(); 00217 $USER->id = 0; 00218 00219 $COURSE = new stdClass(); 00220 $COURSE->id = 0; 00221 00222 $SITE = $COURSE; 00223 define('SITEID', 0); 00224 00225 $hint_dataroot = ''; 00226 $hint_admindir = ''; 00227 $hint_database = ''; 00228 00229 // Are we in help mode? 00230 if (isset($_GET['help'])) { 00231 install_print_help_page($_GET['help']); 00232 } 00233 00234 //first time here? find out suitable dataroot 00235 if (is_null($CFG->dataroot)) { 00236 $CFG->dataroot = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'moodledata'; 00237 00238 $i = 0; //safety check - dirname might return some unexpected results 00239 while(is_dataroot_insecure()) { 00240 $parrent = dirname($CFG->dataroot); 00241 $i++; 00242 if ($parrent == '/' or $parrent == '.' or preg_match('/^[a-z]:\\\?$/i', $parrent) or ($i > 100)) { 00243 $CFG->dataroot = ''; //can not find secure location for dataroot 00244 break; 00245 } 00246 $CFG->dataroot = dirname($parrent).DIRECTORY_SEPARATOR.'moodledata'; 00247 } 00248 $config->dataroot = $CFG->dataroot; 00249 $config->stage = INSTALL_WELCOME; 00250 } 00251 00252 // now let's do the stage work 00253 if ($config->stage < INSTALL_WELCOME) { 00254 $config->stage = INSTALL_WELCOME; 00255 } 00256 if ($config->stage > INSTALL_SAVE) { 00257 $config->stage = INSTALL_SAVE; 00258 } 00259 00260 00261 00262 if ($config->stage == INSTALL_SAVE) { 00263 $CFG->early_install_lang = false; 00264 00265 $database = moodle_database::get_driver_instance($config->dbtype, 'native'); 00266 if (!$database->driver_installed()) { 00267 $config->stage = INSTALL_DATABASETYPE; 00268 } else { 00269 if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation 00270 $distro = distro_pre_create_db($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersist'=>0, 'dbsocket'=>$config->dbsocket), $distro); 00271 } 00272 $hint_database = install_db_validate($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersist'=>0, 'dbsocket'=>$config->dbsocket)); 00273 00274 if ($hint_database === '') { 00275 $configphp = install_generate_configphp($database, $CFG); 00276 00277 umask(0137); 00278 if (($fh = @fopen($configfile, 'w')) !== false) { 00279 fwrite($fh, $configphp); 00280 fclose($fh); 00281 } 00282 00283 if (file_exists($configfile)) { 00284 // config created, let's continue! 00285 redirect("$CFG->wwwroot/$config->admin/index.php?lang=$config->lang"); 00286 } 00287 00288 install_print_header($config, 'config.php', 00289 get_string('configurationcompletehead', 'install'), 00290 get_string('configurationcompletesub', 'install').get_string('configfilenotwritten', 'install')); 00291 echo '<div class="configphp"><pre>'; 00292 echo p($configphp); 00293 echo '</pre></div>'; 00294 00295 install_print_footer($config); 00296 die; 00297 00298 } else { 00299 $config->stage = INSTALL_DATABASE; 00300 } 00301 } 00302 } 00303 00304 00305 00306 if ($config->stage == INSTALL_DOWNLOADLANG) { 00307 if (empty($CFG->dataroot)) { 00308 $config->stage = INSTALL_PATHS; 00309 00310 } else if (is_dataroot_insecure()) { 00311 $hint_dataroot = get_string('pathsunsecuredataroot', 'install'); 00312 $config->stage = INSTALL_PATHS; 00313 00314 } else if (!file_exists($CFG->dataroot)) { 00315 $a = new stdClass(); 00316 $a->parent = dirname($CFG->dataroot); 00317 $a->dataroot = $CFG->dataroot; 00318 if (!is_writable($a->parent)) { 00319 $hint_dataroot = get_string('pathsroparentdataroot', 'install', $a); 00320 $config->stage = INSTALL_PATHS; 00321 } else { 00322 if (!install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) { 00323 $hint_dataroot = get_string('pathserrcreatedataroot', 'install', $a); 00324 $config->stage = INSTALL_PATHS; 00325 } 00326 } 00327 00328 } else if (!install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) { 00329 $hint_dataroot = get_string('pathserrcreatedataroot', 'install', array('dataroot' => $CFG->dataroot)); 00330 $config->stage = INSTALL_PATHS; 00331 } 00332 00333 if (empty($hint_dataroot) and !is_writable($CFG->dataroot)) { 00334 $hint_dataroot = get_string('pathsrodataroot', 'install'); 00335 $config->stage = INSTALL_PATHS; 00336 } 00337 00338 if ($config->admin === '' or !file_exists($CFG->dirroot.'/'.$config->admin.'/environment.xml')) { 00339 $hint_admindir = get_string('pathswrongadmindir', 'install'); 00340 $config->stage = INSTALL_PATHS; 00341 } 00342 } 00343 00344 00345 00346 if ($config->stage == INSTALL_DOWNLOADLANG) { 00347 // no need to download anything if en lang selected 00348 if ($CFG->lang == 'en') { 00349 $config->stage = INSTALL_DATABASETYPE; 00350 } 00351 } 00352 00353 00354 00355 if ($config->stage == INSTALL_DATABASETYPE) { 00356 // skip db selection if distro package supports only one db 00357 if (!empty($distro->dbtype)) { 00358 $config->stage = INSTALL_DATABASE; 00359 } 00360 } 00361 00362 00363 if ($config->stage == INSTALL_DOWNLOADLANG) { 00364 $downloaderror = ''; 00365 00366 // download and install required lang packs, the lang dir has already been created in install_init_dataroot 00367 $installer = new lang_installer($CFG->lang); 00368 $results = $installer->run(); 00369 foreach ($results as $langcode => $langstatus) { 00370 if ($langstatus === lang_installer::RESULT_DOWNLOADERROR) { 00371 $a = new stdClass(); 00372 $a->url = $installer->lang_pack_url($langcode); 00373 $a->dest = $CFG->dataroot.'/lang'; 00374 $downloaderror = get_string('remotedownloaderror', 'error', $a); 00375 } 00376 } 00377 00378 if ($downloaderror !== '') { 00379 install_print_header($config, get_string('language'), get_string('langdownloaderror', 'install', $CFG->lang), $downloaderror); 00380 install_print_footer($config); 00381 die; 00382 } else { 00383 if (empty($distro->dbtype)) { 00384 $config->stage = INSTALL_DATABASETYPE; 00385 } else { 00386 $config->stage = INSTALL_DATABASE; 00387 } 00388 } 00389 00390 // switch the string_manager instance to stop using install/lang/ 00391 $CFG->early_install_lang = false; 00392 $CFG->langotherroot = $CFG->dataroot.'/lang'; 00393 $CFG->langlocalroot = $CFG->dataroot.'/lang'; 00394 get_string_manager(true); 00395 } 00396 00397 00398 if ($config->stage == INSTALL_DATABASE) { 00399 $CFG->early_install_lang = false; 00400 00401 $database = moodle_database::get_driver_instance($config->dbtype, 'native'); 00402 00403 $sub = '<h3>'.$database->get_name().'</h3>'.$database->get_configuration_help(); 00404 00405 install_print_header($config, get_string('database', 'install'), get_string('databasehead', 'install'), $sub); 00406 00407 $strdbhost = get_string('databasehost', 'install'); 00408 $strdbname = get_string('databasename', 'install'); 00409 $strdbuser = get_string('databaseuser', 'install'); 00410 $strdbpass = get_string('databasepass', 'install'); 00411 $strprefix = get_string('dbprefix', 'install'); 00412 $strdbsocket = get_string('databasesocket', 'install'); 00413 00414 echo '<div class="userinput">'; 00415 00416 $disabled = empty($distro->dbhost) ? '' : 'disabled="disabled'; 00417 echo '<div class="formrow"><label for="id_dbhost" class="formlabel">'.$strdbhost.'</label>'; 00418 echo '<input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="50" class="forminput" />'; 00419 echo '</div>'; 00420 00421 echo '<div class="formrow"><label for="id_dbname" class="formlabel">'.$strdbname.'</label>'; 00422 echo '<input id="id_dbname" name="dbname" type="text" value="'.s($config->dbname).'" size="30" class="forminput" />'; 00423 echo '</div>'; 00424 00425 $disabled = empty($distro->dbuser) ? '' : 'disabled="disabled'; 00426 echo '<div class="formrow"><label for="id_dbuser" class="formlabel">'.$strdbuser.'</label>'; 00427 echo '<input id="id_dbuser" name="dbuser" '.$disabled.' type="text" value="'.s($config->dbuser).'" size="30" class="forminput" />'; 00428 echo '</div>'; 00429 00430 echo '<div class="formrow"><label for="id_dbpass" class="formlabel">'.$strdbpass.'</label>'; 00431 // no password field here, the password may be visible in config.php if we can not write it to disk 00432 echo '<input id="id_dbpass" name="dbpass" type="text" value="'.s($config->dbpass).'" size="30" class="forminput" />'; 00433 echo '</div>'; 00434 00435 echo '<div class="formrow"><label for="id_prefix" class="formlabel">'.$strprefix.'</label>'; 00436 echo '<input id="id_prefix" name="prefix" type="text" value="'.s($config->prefix).'" size="10" class="forminput" />'; 00437 echo '</div>'; 00438 00439 if (!(stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin'))) { 00440 $checked = $config->dbsocket ? 'checked="checked' : ''; 00441 echo '<div class="formrow"><label for="id_dbsocket" class="formlabel">'.$strdbsocket.'</label>'; 00442 echo '<input type="hidden" value="0" name="dbsocket" />'; 00443 echo '<input type="checkbox" id="id_dbsocket" value="1" name="dbsocket" '.$checked.' class="forminput" />'; 00444 echo '</div>'; 00445 } 00446 00447 echo '<div class="hint">'.$hint_database.'</div>'; 00448 echo '</div>'; 00449 install_print_footer($config); 00450 die; 00451 } 00452 00453 00454 if ($config->stage == INSTALL_DATABASETYPE) { 00455 $CFG->early_install_lang = false; 00456 00457 // Finally ask for DB type 00458 install_print_header($config, get_string('database', 'install'), 00459 get_string('databasetypehead', 'install'), 00460 get_string('databasetypesub', 'install')); 00461 00462 $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), 00463 'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'), 00464 'oci' => moodle_database::get_driver_instance('oci', 'native'), 00465 'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver 00466 'mssql' => moodle_database::get_driver_instance('mssql', 'native'), // FreeTDS driver 00467 ); 00468 00469 echo '<div class="userinput">'; 00470 echo '<div class="formrow"><label class="formlabel" for="dbtype">'.get_string('dbtype', 'install').'</label>'; 00471 echo '<select id="dbtype" name="dbtype" class="forminput">'; 00472 $disabled = array(); 00473 $options = array(); 00474 foreach ($databases as $type=>$database) { 00475 if ($database->driver_installed() !== true) { 00476 $disabled[$type] = $database; 00477 continue; 00478 } 00479 echo '<option value="'.s($type).'">'.$database->get_name().'</option>'; 00480 } 00481 if ($disabled) { 00482 echo '<optgroup label="'.s(get_string('notavailable')).'">'; 00483 foreach ($disabled as $type=>$database) { 00484 echo '<option value="'.s($type).'" class="notavailable">'.$database->get_name().'</option>'; 00485 } 00486 echo '</optgroup>'; 00487 } 00488 echo '</select></div>'; 00489 echo '</div>'; 00490 00491 install_print_footer($config); 00492 die; 00493 } 00494 00495 00496 00497 if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_PATHS) { 00498 $version_fail = (version_compare(phpversion(), "5.3.2") < 0); 00499 $curl_fail = ($lang !== 'en' and !extension_loaded('curl')); // needed for lang pack download 00500 $zip_fail = ($lang !== 'en' and !extension_loaded('zip')); // needed for lang pack download 00501 00502 if ($version_fail or $curl_fail or $zip_fail) { 00503 $config->stage = INSTALL_ENVIRONMENT; 00504 00505 install_print_header($config, get_string('environmenthead', 'install'), 00506 get_string('errorsinenvironment', 'install'), 00507 get_string('environmentsub2', 'install')); 00508 00509 echo '<div id="envresult"><dl>'; 00510 if ($version_fail) { 00511 $a = (object)array('needed'=>'5.3.2', 'current'=>phpversion()); 00512 echo '<dt>'.get_string('phpversion', 'install').'</dt><dd>'.get_string('environmentrequireversion', 'admin', $a).'</dd>'; 00513 } 00514 if ($curl_fail) { 00515 echo '<dt>'.get_string('phpextension', 'install', 'cURL').'</dt><dd>'.get_string('environmentrequireinstall', 'admin').'</dd>'; 00516 } 00517 if ($zip_fail) { 00518 echo '<dt>'.get_string('phpextension', 'install', 'Zip').'</dt><dd>'.get_string('environmentrequireinstall', 'admin').'</dd>'; 00519 } 00520 echo '</dl></div>'; 00521 00522 install_print_footer($config, true); 00523 die; 00524 00525 } else { 00526 $config->stage = INSTALL_PATHS; 00527 } 00528 } 00529 00530 00531 00532 if ($config->stage == INSTALL_PATHS) { 00533 $paths = array('wwwroot' => get_string('wwwroot', 'install'), 00534 'dirroot' => get_string('dirroot', 'install'), 00535 'dataroot' => get_string('dataroot', 'install')); 00536 00537 $sub = '<dl>'; 00538 foreach ($paths as $path=>$name) { 00539 $sub .= '<dt>'.$name.'</dt><dd>'.get_string('pathssub'.$path, 'install').'</dd>'; 00540 } 00541 if (!file_exists("$CFG->dirroot/admin/environment.xml")) { 00542 $sub .= '<dt>'.get_string('admindirname', 'install').'</dt><dd>'.get_string('pathssubadmindir', 'install').'</dd>'; 00543 } 00544 $sub .= '</dl>'; 00545 00546 install_print_header($config, get_string('paths', 'install'), get_string('pathshead', 'install'), $sub); 00547 00548 $strwwwroot = get_string('wwwroot', 'install'); 00549 $strdirroot = get_string('dirroot', 'install'); 00550 $strdataroot = get_string('dataroot', 'install'); 00551 $stradmindirname = get_string('admindirname', 'install'); 00552 00553 echo '<div class="userinput">'; 00554 echo '<div class="formrow"><label for="id_wwwroot" class="formlabel">'.$paths['wwwroot'].'</label>'; 00555 echo '<input id="id_wwwroot" name="wwwroot" type="text" value="'.s($CFG->wwwroot).'" disabled="disabled" size="70" class="forminput" />'; 00556 echo '</div>'; 00557 00558 echo '<div class="formrow"><label for="id_dirroot" class="formlabel">'.$paths['dirroot'].'</label>'; 00559 echo '<input id="id_dirroot" name="dirroot" type="text" value="'.s($CFG->dirroot).'" disabled="disabled" size="70"class="forminput" />'; 00560 echo '</div>'; 00561 00562 echo '<div class="formrow"><label for="id_dataroot" class="formlabel">'.$paths['dataroot'].'</label>'; 00563 echo '<input id="id_dataroot" name="dataroot" type="text" value="'.s($config->dataroot).'" size="70" class="forminput" />'; 00564 if ($hint_dataroot !== '') { 00565 echo '<div class="hint">'.$hint_dataroot.'</div>'; 00566 } 00567 echo '</div>'; 00568 00569 00570 if (!file_exists("$CFG->dirroot/admin/environment.xml")) { 00571 echo '<div class="formrow"><label for="id_admin" class="formlabel">'.$paths['admindir'].'</label>'; 00572 echo '<input id="id_admin" name="admin" type="text" value="'.s($config->admin).'" size="10" class="forminput" />'; 00573 if ($hint_admindir !== '') { 00574 echo '<div class="hint">'.$hint_admindir.'</div>'; 00575 } 00576 echo '</div>'; 00577 } 00578 00579 echo '</div>'; 00580 00581 install_print_footer($config); 00582 die; 00583 } 00584 00585 00586 00587 $config->stage = INSTALL_WELCOME; 00588 00589 if ($distro) { 00590 ob_start(); 00591 include('install/distribution.html'); 00592 $sub = ob_get_clean(); 00593 00594 install_print_header($config, get_string('language'), 00595 get_string('chooselanguagehead', 'install'), 00596 $sub); 00597 00598 } else { 00599 install_print_header($config, get_string('language'), 00600 get_string('chooselanguagehead', 'install'), 00601 get_string('chooselanguagesub', 'install')); 00602 } 00603 00604 $languages = get_string_manager()->get_list_of_translations(); 00605 echo '<div class="userinput">'; 00606 echo '<div class="formrow"><label class="formlabel" for="langselect">'.get_string('language').'</label>'; 00607 echo '<select id="langselect" name="lang" class="forminput" onchange="this.form.submit()">'; 00608 foreach ($languages as $name=>$value) { 00609 $selected = ($name == $CFG->lang) ? 'selected="selected"' : ''; 00610 echo '<option value="'.s($name).'" '.$selected.'>'.$value.'</option>'; 00611 } 00612 echo '</select></div>'; 00613 echo '</div>'; 00614 00615 install_print_footer($config); 00616 die; 00617