[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * This script creates config.php file during installation. 20 * 21 * @package core 22 * @subpackage install 23 * @copyright 2009 Petr Skoda (http://skodak.org) 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 if (isset($_REQUEST['lang'])) { 28 $lang = preg_replace('/[^A-Za-z0-9_-]/i', '', $_REQUEST['lang']); 29 } else { 30 $lang = 'en'; 31 } 32 33 if (isset($_REQUEST['admin'])) { 34 $admin = preg_replace('/[^A-Za-z0-9_-]/i', '', $_REQUEST['admin']); 35 } else { 36 $admin = 'admin'; 37 } 38 39 // If config.php exists we just created config.php and need to redirect to continue installation 40 $configfile = './config.php'; 41 if (file_exists($configfile)) { 42 header("Location: $admin/index.php?lang=$lang"); 43 die; 44 } 45 46 define('CLI_SCRIPT', false); // prevents some warnings later 47 define('AJAX_SCRIPT', false); // prevents some warnings later 48 define('CACHE_DISABLE_ALL', true); // Disables caching.. just in case. 49 define('PHPUNIT_TEST', false); 50 define('IGNORE_COMPONENT_CACHE', true); 51 52 // Servers should define a default timezone in php.ini, but if they don't then make sure something is defined. 53 // This is a quick hack. Ideally we should ask the admin for a value. See MDL-22625 for more on this. 54 if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) { 55 @date_default_timezone_set(@date_default_timezone_get()); 56 } 57 58 // make sure PHP errors are displayed - helps with diagnosing of problems 59 @error_reporting(E_ALL); 60 @ini_set('display_errors', '1'); 61 62 // Check that PHP is of a sufficient version. 63 if (version_compare(phpversion(), '5.4.4') < 0) { 64 $phpversion = phpversion(); 65 // do NOT localise - lang strings would not work here and we CAN not move it after installib 66 echo "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).<br />"; 67 echo "Please upgrade your server software or install older Moodle version."; 68 die; 69 } 70 71 // make sure iconv is available and actually works 72 if (!function_exists('iconv')) { 73 // this should not happen, this must be very borked install 74 echo 'Moodle requires the iconv PHP extension. Please install or enable the iconv extension.'; 75 die(); 76 } 77 78 if (PHP_INT_SIZE > 4) { 79 // most probably 64bit PHP - we need a lot more memory 80 $minrequiredmemory = '70M'; 81 } else { 82 // 32bit PHP 83 $minrequiredmemory = '40M'; 84 } 85 // increase or decrease available memory - we need to make sure moodle 86 // installs even with low memory, otherwise developers would overlook 87 // sudden increases of memory needs ;-) 88 @ini_set('memory_limit', $minrequiredmemory); 89 90 /** Used by library scripts to check they are being called by Moodle */ 91 define('MOODLE_INTERNAL', true); 92 93 require_once (__DIR__.'/lib/classes/component.php'); 94 require_once (__DIR__.'/lib/installlib.php'); 95 96 // TODO: add lang detection here if empty $_REQUEST['lang'] 97 98 // distro specific customisation 99 $distro = null; 100 if (file_exists('install/distrolib.php')) { 101 require_once('install/distrolib.php'); 102 if (function_exists('distro_get_config')) { 103 $distro = distro_get_config(); 104 } 105 } 106 107 $config = new stdClass(); 108 $config->lang = $lang; 109 110 if (!empty($_POST)) { 111 $config->stage = (int)$_POST['stage']; 112 113 if (isset($_POST['previous'])) { 114 $config->stage--; 115 if (INSTALL_DATABASETYPE and !empty($distro->dbtype)) { 116 $config->stage--; 117 } 118 if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_DOWNLOADLANG) { 119 $config->stage--; 120 } 121 } else if (isset($_POST['next'])) { 122 $config->stage++; 123 } 124 125 $config->dbtype = trim($_POST['dbtype']); 126 $config->dbhost = trim($_POST['dbhost']); 127 $config->dbuser = trim($_POST['dbuser']); 128 $config->dbpass = trim($_POST['dbpass']); 129 $config->dbname = trim($_POST['dbname']); 130 $config->prefix = trim($_POST['prefix']); 131 $config->dbport = (int)trim($_POST['dbport']); 132 $config->dbsocket = trim($_POST['dbsocket']); 133 134 if ($config->dbport <= 0) { 135 $config->dbport = ''; 136 } 137 138 $config->admin = empty($_POST['admin']) ? 'admin' : trim($_POST['admin']); 139 140 $config->dataroot = trim($_POST['dataroot']); 141 142 } else { 143 $config->stage = INSTALL_WELCOME; 144 145 $config->dbtype = empty($distro->dbtype) ? '' : $distro->dbtype; // let distro skip dbtype selection 146 $config->dbhost = empty($distro->dbhost) ? 'localhost' : $distro->dbhost; // let distros set dbhost 147 $config->dbuser = empty($distro->dbuser) ? '' : $distro->dbuser; // let distros set dbuser 148 $config->dbpass = ''; 149 $config->dbname = 'moodle'; 150 $config->prefix = 'mdl_'; 151 $config->dbport = empty($distro->dbport) ? '' : $distro->dbport; 152 $config->dbsocket = empty($distro->dbsocket) ? '' : $distro->dbsocket; 153 154 $config->admin = 'admin'; 155 156 $config->dataroot = empty($distro->dataroot) ? null : $distro->dataroot; // initialised later after including libs or by distro 157 } 158 159 // Fake some settings so that we can use selected functions from moodlelib.php, weblib.php and filelib.php. 160 global $CFG; 161 $CFG = new stdClass(); 162 $CFG->lang = $config->lang; 163 $CFG->dirroot = dirname(__FILE__); 164 $CFG->libdir = "$CFG->dirroot/lib"; 165 $CFG->wwwroot = install_guess_wwwroot(); // can not be changed - ppl must use the real address when installing 166 $CFG->httpswwwroot = $CFG->wwwroot; 167 $CFG->dataroot = $config->dataroot; 168 $CFG->tempdir = $CFG->dataroot.'/temp'; 169 $CFG->cachedir = $CFG->dataroot.'/cache'; 170 $CFG->localcachedir = $CFG->dataroot.'/localcache'; 171 $CFG->admin = $config->admin; 172 $CFG->docroot = 'http://docs.moodle.org'; 173 $CFG->langotherroot = $CFG->dataroot.'/lang'; 174 $CFG->langlocalroot = $CFG->dataroot.'/lang'; 175 $CFG->directorypermissions = isset($distro->directorypermissions) ? $distro->directorypermissions : 00777; // let distros set dir permissions 176 $CFG->filepermissions = ($CFG->directorypermissions & 0666); 177 $CFG->umaskpermissions = (($CFG->directorypermissions & 0777) ^ 0777); 178 $CFG->running_installer = true; 179 $CFG->early_install_lang = true; 180 $CFG->ostype = (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) ? 'WINDOWS' : 'UNIX'; 181 $CFG->debug = (E_ALL | E_STRICT); 182 $CFG->debugdisplay = true; 183 $CFG->debugdeveloper = true; 184 185 // Require all needed libs 186 require_once($CFG->libdir.'/setuplib.php'); 187 188 // we need to make sure we have enough memory to load all libraries 189 $memlimit = @ini_get('memory_limit'); 190 if (!empty($memlimit) and $memlimit != -1) { 191 if (get_real_size($memlimit) < get_real_size($minrequiredmemory)) { 192 // do NOT localise - lang strings would not work here and we CAN not move it to later place 193 echo "Moodle requires at least {$minrequiredmemory}B of PHP memory.<br />"; 194 echo "Please contact server administrator to fix PHP.ini memory settings."; 195 die; 196 } 197 } 198 199 // Continue with lib loading 200 require_once($CFG->libdir.'/classes/text.php'); 201 require_once($CFG->libdir.'/classes/string_manager.php'); 202 require_once($CFG->libdir.'/classes/string_manager_install.php'); 203 require_once($CFG->libdir.'/classes/string_manager_standard.php'); 204 require_once($CFG->libdir.'/weblib.php'); 205 require_once($CFG->libdir.'/outputlib.php'); 206 require_once($CFG->libdir.'/dmllib.php'); 207 require_once($CFG->libdir.'/moodlelib.php'); 208 require_once($CFG->libdir .'/pagelib.php'); 209 require_once($CFG->libdir.'/deprecatedlib.php'); 210 require_once($CFG->libdir.'/adminlib.php'); 211 require_once($CFG->libdir.'/environmentlib.php'); 212 require_once($CFG->libdir.'/componentlib.class.php'); 213 require_once($CFG->dirroot.'/cache/lib.php'); 214 215 //point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else 216 //the problem is that we need specific version of quickforms and hacked excel files :-( 217 ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path')); 218 //point zend include path to moodles lib/zend so that includes and requires will search there for files before anywhere else 219 ini_set('include_path', $CFG->libdir.'/zend' . PATH_SEPARATOR . ini_get('include_path')); 220 221 // Register our classloader, in theory somebody might want to replace it to load other hacked core classes. 222 // Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes. 223 if (defined('COMPONENT_CLASSLOADER')) { 224 spl_autoload_register(COMPONENT_CLASSLOADER); 225 } else { 226 spl_autoload_register('core_component::classloader'); 227 } 228 229 require ('version.php'); 230 $CFG->target_release = $release; 231 232 \core\session\manager::init_empty_session(); 233 global $SESSION; 234 global $USER; 235 236 global $COURSE; 237 $COURSE = new stdClass(); 238 $COURSE->id = 1; 239 240 global $SITE; 241 $SITE = $COURSE; 242 define('SITEID', 1); 243 244 $hint_dataroot = ''; 245 $hint_admindir = ''; 246 $hint_database = ''; 247 248 // Are we in help mode? 249 if (isset($_GET['help'])) { 250 install_print_help_page($_GET['help']); 251 } 252 253 //first time here? find out suitable dataroot 254 if (is_null($CFG->dataroot)) { 255 $CFG->dataroot = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'moodledata'; 256 257 $i = 0; //safety check - dirname might return some unexpected results 258 while(is_dataroot_insecure()) { 259 $parrent = dirname($CFG->dataroot); 260 $i++; 261 if ($parrent == '/' or $parrent == '.' or preg_match('/^[a-z]:\\\?$/i', $parrent) or ($i > 100)) { 262 $CFG->dataroot = ''; //can not find secure location for dataroot 263 break; 264 } 265 $CFG->dataroot = dirname($parrent).DIRECTORY_SEPARATOR.'moodledata'; 266 } 267 $config->dataroot = $CFG->dataroot; 268 $config->stage = INSTALL_WELCOME; 269 } 270 271 // now let's do the stage work 272 if ($config->stage < INSTALL_WELCOME) { 273 $config->stage = INSTALL_WELCOME; 274 } 275 if ($config->stage > INSTALL_SAVE) { 276 $config->stage = INSTALL_SAVE; 277 } 278 279 280 281 if ($config->stage == INSTALL_SAVE) { 282 $CFG->early_install_lang = false; 283 284 $database = moodle_database::get_driver_instance($config->dbtype, 'native'); 285 if (!$database->driver_installed()) { 286 $config->stage = INSTALL_DATABASETYPE; 287 } else { 288 if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation 289 $distro = distro_pre_create_db($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersist'=>0, 'dbport'=>$config->dbport, 'dbsocket'=>$config->dbsocket), $distro); 290 } 291 $hint_database = install_db_validate($database, $config->dbhost, $config->dbuser, $config->dbpass, $config->dbname, $config->prefix, array('dbpersist'=>0, 'dbport'=>$config->dbport, 'dbsocket'=>$config->dbsocket)); 292 293 if ($hint_database === '') { 294 $configphp = install_generate_configphp($database, $CFG); 295 296 umask(0137); 297 if (($fh = @fopen($configfile, 'w')) !== false) { 298 fwrite($fh, $configphp); 299 fclose($fh); 300 } 301 302 if (file_exists($configfile)) { 303 // config created, let's continue! 304 redirect("$CFG->wwwroot/$config->admin/index.php?lang=$config->lang"); 305 } 306 307 install_print_header($config, 'config.php', 308 get_string('configurationcompletehead', 'install'), 309 get_string('configurationcompletesub', 'install').get_string('configfilenotwritten', 'install'), 'alert-error'); 310 echo '<div class="configphp"><pre>'; 311 echo p($configphp); 312 echo '</pre></div>'; 313 314 install_print_footer($config); 315 die; 316 317 } else { 318 $config->stage = INSTALL_DATABASE; 319 } 320 } 321 } 322 323 324 325 if ($config->stage == INSTALL_DOWNLOADLANG) { 326 if (empty($CFG->dataroot)) { 327 $config->stage = INSTALL_PATHS; 328 329 } else if (is_dataroot_insecure()) { 330 $hint_dataroot = get_string('pathsunsecuredataroot', 'install'); 331 $config->stage = INSTALL_PATHS; 332 333 } else if (!file_exists($CFG->dataroot)) { 334 $a = new stdClass(); 335 $a->parent = dirname($CFG->dataroot); 336 $a->dataroot = $CFG->dataroot; 337 if (!is_writable($a->parent)) { 338 $hint_dataroot = get_string('pathsroparentdataroot', 'install', $a); 339 $config->stage = INSTALL_PATHS; 340 } else { 341 if (!install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) { 342 $hint_dataroot = get_string('pathserrcreatedataroot', 'install', $a); 343 $config->stage = INSTALL_PATHS; 344 } 345 } 346 347 } else if (!install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) { 348 $hint_dataroot = get_string('pathserrcreatedataroot', 'install', array('dataroot' => $CFG->dataroot)); 349 $config->stage = INSTALL_PATHS; 350 } 351 352 if (empty($hint_dataroot) and !is_writable($CFG->dataroot)) { 353 $hint_dataroot = get_string('pathsrodataroot', 'install'); 354 $config->stage = INSTALL_PATHS; 355 } 356 357 if ($config->admin === '' or !file_exists($CFG->dirroot.'/'.$config->admin.'/environment.xml')) { 358 $hint_admindir = get_string('pathswrongadmindir', 'install'); 359 $config->stage = INSTALL_PATHS; 360 } 361 } 362 363 364 365 if ($config->stage == INSTALL_DOWNLOADLANG) { 366 // no need to download anything if en lang selected 367 if ($CFG->lang == 'en') { 368 $config->stage = INSTALL_DATABASETYPE; 369 } 370 } 371 372 373 374 if ($config->stage == INSTALL_DATABASETYPE) { 375 // skip db selection if distro package supports only one db 376 if (!empty($distro->dbtype)) { 377 $config->stage = INSTALL_DATABASE; 378 } 379 } 380 381 382 if ($config->stage == INSTALL_DOWNLOADLANG) { 383 $downloaderror = ''; 384 385 // download and install required lang packs, the lang dir has already been created in install_init_dataroot 386 $installer = new lang_installer($CFG->lang); 387 $results = $installer->run(); 388 foreach ($results as $langcode => $langstatus) { 389 if ($langstatus === lang_installer::RESULT_DOWNLOADERROR) { 390 $a = new stdClass(); 391 $a->url = $installer->lang_pack_url($langcode); 392 $a->dest = $CFG->dataroot.'/lang'; 393 $downloaderror = get_string('remotedownloaderror', 'error', $a); 394 } 395 } 396 397 if ($downloaderror !== '') { 398 install_print_header($config, get_string('language'), get_string('langdownloaderror', 'install', $CFG->lang), $downloaderror); 399 install_print_footer($config); 400 die; 401 } else { 402 if (empty($distro->dbtype)) { 403 $config->stage = INSTALL_DATABASETYPE; 404 } else { 405 $config->stage = INSTALL_DATABASE; 406 } 407 } 408 409 // switch the string_manager instance to stop using install/lang/ 410 $CFG->early_install_lang = false; 411 $CFG->langotherroot = $CFG->dataroot.'/lang'; 412 $CFG->langlocalroot = $CFG->dataroot.'/lang'; 413 get_string_manager(true); 414 } 415 416 417 if ($config->stage == INSTALL_DATABASE) { 418 $CFG->early_install_lang = false; 419 420 $database = moodle_database::get_driver_instance($config->dbtype, 'native'); 421 422 $sub = '<h3>'.$database->get_name().'</h3>'.$database->get_configuration_help(); 423 424 install_print_header($config, get_string('database', 'install'), get_string('databasehead', 'install'), $sub); 425 426 $strdbhost = get_string('databasehost', 'install'); 427 $strdbname = get_string('databasename', 'install'); 428 $strdbuser = get_string('databaseuser', 'install'); 429 $strdbpass = get_string('databasepass', 'install'); 430 $strprefix = get_string('dbprefix', 'install'); 431 $strdbport = get_string('databaseport', 'install'); 432 $strdbsocket = get_string('databasesocket', 'install'); 433 434 echo '<div class="userinput">'; 435 436 $disabled = empty($distro->dbhost) ? '' : 'disabled="disabled'; 437 echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbhost">'.$strdbhost.'</label></div>'; 438 echo '<div class="fitemelement"><input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="50" /></div>'; 439 echo '</div>'; 440 441 echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbname">'.$strdbname.'</label></div>'; 442 echo '<div class="fitemelement"><input id="id_dbname" name="dbname" type="text" value="'.s($config->dbname).'" size="50" /></div>'; 443 echo '</div>'; 444 445 $disabled = empty($distro->dbuser) ? '' : 'disabled="disabled'; 446 echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbuser">'.$strdbuser.'</label></div>'; 447 echo '<div class="fitemelement"><input id="id_dbuser" name="dbuser" '.$disabled.' type="text" value="'.s($config->dbuser).'" size="50" /></div>'; 448 echo '</div>'; 449 450 echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbpass">'.$strdbpass.'</label></div>'; 451 // no password field here, the password may be visible in config.php if we can not write it to disk 452 echo '<div class="fitemelement"><input id="id_dbpass" name="dbpass" type="text" value="'.s($config->dbpass).'" size="50" /></div>'; 453 echo '</div>'; 454 455 echo '<div class="fitem"><div class="fitemtitle"><label for="id_prefix">'.$strprefix.'</label></div>'; 456 echo '<div class="fitemelement"><input id="id_prefix" name="prefix" type="text" value="'.s($config->prefix).'" size="10" /></div>'; 457 echo '</div>'; 458 459 echo '<div class="fitem"><div class="fitemtitle"><label for="id_prefix">'.$strdbport.'</label></div>'; 460 echo '<div class="fitemelement"><input id="id_dbport" name="dbport" type="text" value="'.s($config->dbport).'" size="10" /></div>'; 461 echo '</div>'; 462 463 if (!(stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin'))) { 464 echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbsocket">'.$strdbsocket.'</label></div>'; 465 echo '<div class="fitemelement"><input id="id_dbsocket" name="dbsocket" type="text" value="'.s($config->dbsocket).'" size="50" /></div>'; 466 echo '</div>'; 467 } 468 469 if ($hint_database !== '') { 470 echo '<div class="alert alert-error">'.$hint_database.'</div>'; 471 } 472 echo '</div>'; 473 install_print_footer($config); 474 die; 475 } 476 477 478 if ($config->stage == INSTALL_DATABASETYPE) { 479 $CFG->early_install_lang = false; 480 481 // Finally ask for DB type 482 install_print_header($config, get_string('database', 'install'), 483 get_string('databasetypehead', 'install'), 484 get_string('databasetypesub', 'install')); 485 486 $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), 487 'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'), 488 'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'), 489 'oci' => moodle_database::get_driver_instance('oci', 'native'), 490 'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver 491 'mssql' => moodle_database::get_driver_instance('mssql', 'native'), // FreeTDS driver 492 ); 493 494 echo '<div class="userinput">'; 495 echo '<div class="fitem"><div class="fitemtitle"><label for="dbtype">'.get_string('dbtype', 'install').'</label></div>'; 496 echo '<div class="fitemelement"><select id="dbtype" name="dbtype">'; 497 $disabled = array(); 498 $options = array(); 499 foreach ($databases as $type=>$database) { 500 if ($database->driver_installed() !== true) { 501 $disabled[$type] = $database; 502 continue; 503 } 504 echo '<option value="'.s($type).'">'.$database->get_name().'</option>'; 505 } 506 if ($disabled) { 507 echo '<optgroup label="'.s(get_string('notavailable')).'">'; 508 foreach ($disabled as $type=>$database) { 509 echo '<option value="'.s($type).'" class="notavailable">'.$database->get_name().'</option>'; 510 } 511 echo '</optgroup>'; 512 } 513 echo '</select></div></div>'; 514 echo '</div>'; 515 516 install_print_footer($config); 517 die; 518 } 519 520 521 522 if ($config->stage == INSTALL_ENVIRONMENT or $config->stage == INSTALL_PATHS) { 523 $curl_fail = ($lang !== 'en' and !extension_loaded('curl')); // needed for lang pack download 524 $zip_fail = ($lang !== 'en' and !extension_loaded('zip')); // needed for lang pack download 525 526 if ($curl_fail or $zip_fail) { 527 $config->stage = INSTALL_ENVIRONMENT; 528 529 install_print_header($config, get_string('environmenthead', 'install'), 530 get_string('errorsinenvironment', 'install'), 531 get_string('environmentsub2', 'install')); 532 533 echo '<div id="envresult"><dl>'; 534 if ($curl_fail) { 535 echo '<dt>'.get_string('phpextension', 'install', 'cURL').'</dt><dd>'.get_string('environmentrequireinstall', 'admin').'</dd>'; 536 } 537 if ($zip_fail) { 538 echo '<dt>'.get_string('phpextension', 'install', 'Zip').'</dt><dd>'.get_string('environmentrequireinstall', 'admin').'</dd>'; 539 } 540 echo '</dl></div>'; 541 542 install_print_footer($config, true); 543 die; 544 545 } else { 546 $config->stage = INSTALL_PATHS; 547 } 548 } 549 550 551 552 if ($config->stage == INSTALL_PATHS) { 553 $paths = array('wwwroot' => get_string('wwwroot', 'install'), 554 'dirroot' => get_string('dirroot', 'install'), 555 'dataroot' => get_string('dataroot', 'install')); 556 557 $sub = '<dl>'; 558 foreach ($paths as $path=>$name) { 559 $sub .= '<dt>'.$name.'</dt><dd>'.get_string('pathssub'.$path, 'install').'</dd>'; 560 } 561 if (!file_exists("$CFG->dirroot/admin/environment.xml")) { 562 $sub .= '<dt>'.get_string('admindirname', 'install').'</dt><dd>'.get_string('pathssubadmindir', 'install').'</dd>'; 563 } 564 $sub .= '</dl>'; 565 566 install_print_header($config, get_string('paths', 'install'), get_string('pathshead', 'install'), $sub); 567 568 $strwwwroot = get_string('wwwroot', 'install'); 569 $strdirroot = get_string('dirroot', 'install'); 570 $strdataroot = get_string('dataroot', 'install'); 571 $stradmindirname = get_string('admindirname', 'install'); 572 573 echo '<div class="userinput">'; 574 echo '<div class="fitem"><div class="fitemtitle"><label for="id_wwwroot">'.$paths['wwwroot'].'</label></div>'; 575 echo '<div class="fitemelement"><input id="id_wwwroot" name="wwwroot" type="text" value="'.s($CFG->wwwroot).'" disabled="disabled" size="70" /></div>'; 576 echo '</div>'; 577 578 echo '<div class="fitem"><div class="fitemtitle"><label for="id_dirroot">'.$paths['dirroot'].'</label></div>'; 579 echo '<div class="fitemelement"><input id="id_dirroot" name="dirroot" type="text" value="'.s($CFG->dirroot).'" disabled="disabled" size="70" /></div>'; 580 echo '</div>'; 581 582 echo '<div class="fitem"><div class="fitemtitle"><label for="id_dataroot">'.$paths['dataroot'].'</label></div>'; 583 echo '<div class="fitemelement"><input id="id_dataroot" name="dataroot" type="text" value="'.s($config->dataroot).'" size="70" /></div>'; 584 if ($hint_dataroot !== '') { 585 echo '<div class="alert alert-error">'.$hint_dataroot.'</div>'; 586 } 587 echo '</div>'; 588 589 590 if (!file_exists("$CFG->dirroot/admin/environment.xml")) { 591 echo '<div class="fitem"><div class="fitemtitle"><label for="id_admin">'.$paths['admindir'].'</label></div>'; 592 echo '<div class="fitemelement"><input id="id_admin" name="admin" type="text" value="'.s($config->admin).'" size="10" /></div>'; 593 if ($hint_admindir !== '') { 594 echo '<div class="alert alert-error">'.$hint_admindir.'</div>'; 595 } 596 echo '</div>'; 597 } 598 599 echo '</div>'; 600 601 install_print_footer($config); 602 die; 603 } 604 605 606 607 $config->stage = INSTALL_WELCOME; 608 609 if ($distro) { 610 ob_start(); 611 include ('install/distribution.html'); 612 $sub = ob_get_clean(); 613 614 install_print_header($config, get_string('language'), 615 get_string('chooselanguagehead', 'install'), 616 $sub, 'alert-success'); 617 618 } else { 619 install_print_header($config, get_string('language'), 620 get_string('chooselanguagehead', 'install'), 621 get_string('chooselanguagesub', 'install')); 622 } 623 624 $languages = get_string_manager()->get_list_of_translations(); 625 echo '<div class="userinput">'; 626 echo '<div class="fitem"><div class="fitemtitle"><label for="langselect">'.get_string('language').'</label></div>'; 627 echo '<div class="fitemelement"><select id="langselect" name="lang" onchange="this.form.submit()">'; 628 foreach ($languages as $name=>$value) { 629 $selected = ($name == $CFG->lang) ? 'selected="selected"' : ''; 630 echo '<option value="'.s($name).'" '.$selected.'>'.$value.'</option>'; 631 } 632 echo '</select></div></div>'; 633 echo '</div>'; 634 635 install_print_footer($config); 636 die; 637
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |