Fixed firstname lastname to call to fullname function
[moodle.git] / install.php
CommitLineData
8b5b1028 1<?php /// $Id$
2 /// install.php - helps admin user to create a config.php file
3
4/// If config.php exists already then we are not needed.
5
51e3e0b9 6if (file_exists('./config.php')) {
8b5b1028 7 header('Location: index.php');
51e3e0b9 8 die;
8b5b1028 9} else {
10 $configfile = './config.php';
11}
12
13///==========================================================================//
14/// We are doing this in stages
8d783716 15/// 0. Welcome and language settings
16/// 1. Compatibility
8b5b1028 17/// 2. Database settings
18/// 3. Host settings
19/// 4. Administration directory name
20/// 5. Save or display the settings
21/// 6. Redirect to index.php
22///==========================================================================//
23
24
8d783716 25
8b5b1028 26/// Begin the session as we are holding all information in a session
27/// variable until the end.
28
29session_name('MoodleSession');
30@session_start();
31
32if (! isset($_SESSION['INSTALL'])) {
33 $_SESSION['INSTALL'] = array();
34}
35
36$INSTALL = &$_SESSION['INSTALL']; // Makes it easier to reference
37
8d783716 38
39/// If it's our first time through this script then we need to set some default values
40
41if ( empty($INSTALL['language']) and empty($_POST['language']) ) {
8b5b1028 42
43 /// set defaults
44 $INSTALL['language'] = 'en';
45
46 $INSTALL['dbhost'] = 'localhost';
47 $INSTALL['dbuser'] = '';
48 $INSTALL['dbpass'] = '';
49 $INSTALL['dbtype'] = 'mysql';
50 $INSTALL['dbname'] = 'moodle';
51 $INSTALL['prefix'] = 'mdl_';
52
53 $INSTALL['wwwroot'] = '';
54 $INSTALL['dirroot'] = dirname(__FILE__);
55 $INSTALL['dataroot'] = dirname(dirname(__FILE__)) . '/moodledata';
56
57 $INSTALL['admindirname'] = 'admin';
58
8d783716 59 $INSTALL['stage'] = 0;
8b5b1028 60}
61
62
63
64//==========================================================================//
65
66/// Fake some settings so that we can use selected functions from moodlelib.php and weblib.php
8d783716 67
8b5b1028 68$SESSION->lang = (!empty($_POST['language'])) ? $_POST['language'] : $INSTALL['language'];
69$CFG->dirroot = $INSTALL['dirroot'];
70$CFG->dataroot = $INSTALL['dataroot'];
71$CFG->directorypermissions = 0777;
72
73
8d783716 74/// Include some moodle libraries
75
8b5b1028 76require_once('./lib/moodlelib.php');
77require_once('./lib/weblib.php');
78require_once('./lib/adodb/adodb.inc.php');
79
80
81/// guess the www root
82if ($INSTALL['wwwroot'] == '') {
83 list($INSTALL['wwwroot'], $xtra) = explode('/install.php', qualified_me());
84}
85
8d783716 86$stagetext = array(0 => get_string('chooselanguage', 'install'),
87 get_string('compatibilitysettings', 'install'),
88 get_string('directorysettings', 'install'),
89 get_string('databasesettings', 'install'),
90 get_string('admindirsetting', 'install'),
91 get_string('configurationcomplete', 'install')
8b5b1028 92 );
93
94
8d783716 95
96
97//==========================================================================//
98
99/// Are we in help mode?
100
101if (isset($_GET['help'])) {
102 $nextstage = -1;
103}
104
105
51e3e0b9 106
edd3a5db 107//==========================================================================//
108
51e3e0b9 109/// Are we in config download mode?
edd3a5db 110
51e3e0b9 111if (isset($_GET['download'])) {
112 header("Content-Type: application/download\n");
113 header("Content-Disposition: attachment; filename=\"config.php\"");
114 echo $INSTALL['config'];
115 exit;
edd3a5db 116}
8d783716 117
51e3e0b9 118
119
8b5b1028 120//==========================================================================//
121
122/// Was data submitted?
8d783716 123
124if (isset($_POST['stage'])) {
8b5b1028 125
126 /// Get the stage for which the form was set and the next stage we are going to
127
128
129 if ( $goforward = (! empty( $_POST['next'] )) ) {
130 $nextstage = $_POST['stage'] + 1;
131 } else {
132 $nextstage = $_POST['stage'] - 1;
133 }
51e3e0b9 134
8d783716 135 if ($nextstage < 0) $nextstage = 0;
51e3e0b9 136
8b5b1028 137
138 /// Store any posted data
139 foreach ($_POST as $setting=>$value) {
140 $INSTALL[$setting] = $value;
141 }
51e3e0b9 142
8b5b1028 143} else {
144
145 $goforward = true;
8d783716 146 $nextstage = 0;
51e3e0b9 147
8b5b1028 148}
149
150
151
152//==========================================================================//
153
154/// Check the directory settings
8d783716 155
8b5b1028 156if ($INSTALL['stage'] == 2) {
157
158 error_reporting(0);
51e3e0b9 159
160
161 /// check dirroot
162 if (($fh = @fopen($INSTALL['dirroot'].'/install.php', 'r')) === false ) {
163 $CFG->dirroot = dirname(__FILE__);
164 $INSTALL['dirroot'] = dirname(__FILE__);
165 $errormsg = get_string('dirrooterror', 'install');
8b5b1028 166 } else {
167 fclose($fh);
51e3e0b9 168
169 $CFG->dirroot = $INSTALL['dirroot'];
cd0e958e 170
51e3e0b9 171 /// check wwwroot
172 if (($fh = @fopen($INSTALL['wwwroot'].'/install.php', 'r')) === false) {
173 $errormsg = get_string('wwwrooterror', 'install');
8b5b1028 174 } else {
175 fclose($fh);
cd0e958e 176
8b5b1028 177 /// check dataroot
178 $CFG->dataroot = $INSTALL['dataroot'];
179 if (make_upload_directory('sessions', false) === false ) {
180 $errormsg = get_string('datarooterror', 'install');
51e3e0b9 181 }
8b5b1028 182 }
183 }
51e3e0b9 184
8b5b1028 185
186 if (!empty($errormsg)) $nextstage = 2;
187
188 error_reporting(7);
189}
190
191
192
193//==========================================================================//
194
195/// Check database settings if stage 3 data submitted
196/// Try to connect to the database. If that fails then try to create the database
8d783716 197
8b5b1028 198if ($INSTALL['stage'] == 3) {
199
200 if (empty($INSTALL['dbname'])) {
201 $INSTALL['dbname'] = 'moodle';
202 }
51e3e0b9 203
8d783716 204 /// different format for postgres7 by socket
205 if ($INSTALL['dbtype'] == 'postgres7' and ($INSTALL['dbhost'] == 'localhost' || $INSTALL['dbhost'] == '127.0.0.1')) {
8b5b1028 206 $INSTALL['dbhost'] = "user='{$INSTALL['dbuser']}' password='{$INSTALL['dbpass']}' dbname='{$INSTALL['dbname']}'";
8d783716 207 $INSTALL['dbuser'] = '';
208 $INSTALL['dbpass'] = '';
209 $INSTALL['dbname'] = '';
210
8b5b1028 211 if ($INSTALL['prefix'] == '') { /// must have a prefix
212 $INSTALL['prefix'] = 'mdl_';
213 }
214 }
215
fe515206 216 if ($INSTALL['dbtype'] == 'mysql') { /// Check MySQL extension is present
217 if (!extension_loaded('mysql')) {
218 $errormsg = get_string('mysqlextensionisnotpresentinphp', 'install');
219 $nextstage = 3;
220 }
221 }
8b5b1028 222
fe515206 223 if (empty($errormsg)) {
224
225 $db = &ADONewConnection($INSTALL['dbtype']);
226
227 error_reporting(0); // Hide errors
228
229 if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) {
230 /// The following doesn't seem to work but we're working on it
231 /// If you come up with a solution for creating a database in MySQL
232 /// feel free to put it in and let us know
233 if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) {
234 switch ($INSTALL['dbtype']) { /// Try to create a database
235 case 'mysql':
236 if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']};")) {
237 $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname']);
238 } else {
239 $errormsg = get_string('dbcreationerror', 'install');
240 $nextstage = 3;
241 }
242 break;
243 }
8b5b1028 244 }
245 }
246 }
247
248 error_reporting(7);
249
250 if (($dbconnected === false) and (empty($errormsg)) ) {
251 $errormsg = get_string('dbconnectionerror', 'install');
252 $nextstage = 3;
253 }
254}
255
256
257
258//==========================================================================//
259
260/// If the next stage is admin directory settings OR we have just come from there then
261/// check the admin directory.
262/// If we can open a file then we know that the admin name is correct.
263
264if ($nextstage == 4 or $INSTALL['stage'] == 4) {
265 if (($fh = @fopen($INSTALL['wwwroot'].'/'.$INSTALL['admindirname'].'/site.html', 'r')) !== false) {
266 $nextstage = ($goforward) ? 5 : 3;
267 fclose($fh);
268 } else {
269 if ($nextstage != 4) {
270 $errormsg = get_string('admindirerror', 'install');
271 $nextstage = 4;
272 }
273 }
274}
275
276
277
278//==========================================================================//
279
280/// Display or print the data
281/// Put the data into a string
282/// Try to open config file for writing.
8d783716 283
8b5b1028 284if ($nextstage == 5) {
51e3e0b9 285
286 $str = '<?php /// Moodle Configuration File '."\r\n";
287 $str .= "\r\n";
288
289 $str .= 'unset($CFG);'."\r\n";
290 $str .= "\r\n";
291
292 $str .= '$CFG->dbtype = \''.$INSTALL['dbtype']."';\r\n";
c423badc 293 $str .= '$CFG->dbhost = \''.addslashes($INSTALL['dbhost'])."';\r\n";
59812bc7 294 if (!empty($INSTALL['dbname'])) {
51e3e0b9 295 $str .= '$CFG->dbname = \''.$INSTALL['dbname']."';\r\n";
296 $str .= '$CFG->dbuser = \''.$INSTALL['dbuser']."';\r\n";
297 $str .= '$CFG->dbpass = \''.$INSTALL['dbpass']."';\r\n";
298 }
299 $str .= '$CFG->dbpersist = false;'."\r\n";
300 $str .= '$CFG->prefix = \''.$INSTALL['prefix']."';\r\n";
301 $str .= "\r\n";
302
303 $str .= '$CFG->wwwroot = \''.$INSTALL['wwwroot']."';\r\n";
304 $str .= '$CFG->dirroot = \''.$INSTALL['dirroot']."';\r\n";
305 $str .= '$CFG->dataroot = \''.$INSTALL['dataroot']."';\r\n";
306 $str .= "\r\n";
307
308 $str .= '$CFG->directorypermissions = 0777;'."\r\n";
309 $str .= "\r\n";
310
311 $str .= 'require_once("$CFG->dirroot/lib/setup.php");'."\r\n";
312 $str .= '// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,'."\r\n";
313 $str .= '// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.'."\r\n";
314 $str .= '?>';
315
7c561c7a 316 umask(0137);
317
8b5b1028 318 if (( $configsuccess = ($fh = @fopen($configfile, 'w')) ) !== false) {
319 fwrite($fh, $str);
320 fclose($fh);
321 }
7c561c7a 322
51e3e0b9 323
324 $INSTALL['config'] = $str;
8b5b1028 325}
326
327
328
329//==========================================================================//
330
331?>
332
333
334
335<html dir="<?php echo (get_string('this_direction') == 'rtl') ? 'rtl' : 'ltr' ?>">
336<head>
337<link rel="shortcut icon" href="http://moodle.dougiamas.net/theme/standard/favicon.ico" />
338<title>Moodle Install</title>
339<meta http-equiv="content-type" content="text/html; charset=<?php print_string('thischarset') ?>" />
340<?php css_styles() ?>
341
342</head>
343
344<body>
345
8d783716 346
347<?php
348if (isset($_GET['help'])) {
349 print_install_help($_GET['help']);
51e3e0b9 350 close_window_button();
8d783716 351} else {
352?>
353
8b5b1028 354
355<table class="main" align="center" cellpadding="3" cellspacing="0">
356 <tr>
8d783716 357 <td class="td_mainlogo">
839f2456 358 <p class="p_mainlogo"><img src="pix/moodlelogo-med.gif" width="240" height="60" alt=\"\"></p>
8d783716 359 </td>
360 <td class="td_mainlogo" valign="bottom">
361 <p class="p_mainheader"><?php print_string('installation', 'install') ?></p>
362 </td>
363 </tr>
364
365 <tr>
366 <td class="td_mainheading" colspan="2">
367 <p class="p_mainheading"><?php echo $stagetext[$nextstage] ?></p>
368 </td>
8b5b1028 369 </tr>
370
371 <tr>
8d783716 372 <td class="td_main" colspan="2">
51e3e0b9 373
8b5b1028 374<?php
375
376if (!empty($errormsg)) echo "<p class=\"errormsg\" align=\"center\">$errormsg</p>\n";
377
378
379if ($nextstage == 5) {
51e3e0b9 380 $INSTALL['stage'] = 0;
381 $options = array();
382 $options['lang'] = $INSTALL['language'];
8b5b1028 383 if ($configsuccess) {
384 echo "<p>".get_string('configfilewritten', 'install')."</p>\n";
51e3e0b9 385
386 echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n";
387 echo "<tr>\n";
388 echo "<td width=\"33.3%\">&nbsp;</td>\n";
389 echo "<td width=\"33.3%\">&nbsp;</td>\n";
390 echo "<td width=\"33.3%\" align=\"right\">\n";
391 print_single_button("index.php", $options, get_string('continue')." &raquo;");
392 echo "</td>\n";
393 echo "</tr>\n";
394 echo "</table>\n";
395
8b5b1028 396 } else {
51e3e0b9 397 echo "<p class=\"errormsg\">".get_string('configfilenotwritten', 'install')."</p>";
398
399 echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n";
400 echo "<tr>\n";
401 echo "<td width=\"33.3%\">&nbsp;</td>\n";
402 echo "<td width=\"33.3%\" align=\"center\">\n";
403 $installoptions = array();
404 $installoptions['download'] = 1;
405 print_single_button("install.php", $installoptions, get_string('download', 'install'));
406 echo "</td>\n";
407 echo "<td width=\"33.3%\" align=\"right\">\n";
408 print_single_button("index.php", $options, get_string('continue')." &raquo;");
409 echo "</td>\n";
410 echo "</tr>\n";
411 echo "</table>\n";
412
8b5b1028 413 echo "<hr />\n";
51e3e0b9 414 echo "<div style=\"text-align: left\">\n";
415 print_object(htmlentities($str));
416 echo "</div>\n";
8b5b1028 417 }
8b5b1028 418} else {
419 $formaction = (isset($_GET['configfile'])) ? "install.php?configfile=".$_GET['configfile'] : "install.php";
420 form_table($nextstage, $formaction);
421}
422
423?>
424
425 </td>
426 </tr>
427</table>
428
8d783716 429<?php
430}
431?>
432
8b5b1028 433</body>
434</html>
435
436
437
438
439
440
441
442
443
444
51e3e0b9 445<?php
8b5b1028 446
447//==========================================================================//
448
449
450function print_object($object) {
451 echo "<pre>\n";
452 print_r($object);
453 echo "</pre>\n";
454}
455
456
457
458//==========================================================================//
459
8d783716 460function form_table($nextstage = 0, $formaction = "install.php") {
8b5b1028 461 global $INSTALL;
462
463 /// standard lines for all forms
464?>
465
466 <form name="installform" method="post" action="<?php echo $formaction ?>">
467 <input type="hidden" name="stage" value="<?php echo $nextstage ?>" />
468 <table class="install_table" cellspacing="3" cellpadding="3" align="center">
469
470<?php
471 /// what we do depends on the stage we're at
472 switch ($nextstage) {
8d783716 473 case 0: /// Language settings
8b5b1028 474?>
475 <tr>
476 <td class="td_left"><p><?php print_string('language') ?></p></td>
477 <td class="td_right">
478 <?php choose_from_menu (get_list_of_languages(), 'language', $INSTALL['language'], '') ?>
479 </td>
480 </tr>
481
482<?php
8d783716 483 break;
484 case 1: /// Compatibilty check
485 $compatsuccess = true;
51e3e0b9 486
8d783716 487 /// Check that PHP is of a sufficient version
51e3e0b9 488 print_compatibility_row(check_php_version("4.1.0"), get_string('phpversion', 'install'), get_string('phpversionerror', 'install'), 'phpversionhelp');
8d783716 489 /// Check session auto start
490 print_compatibility_row(!ini_get_bool('session.auto_start'), get_string('sessionautostart', 'install'), get_string('sessionautostarterror', 'install'), 'sessionautostarthelp');
8d783716 491 /// Check magic quotes
492 print_compatibility_row(!ini_get_bool('magic_quotes_runtime'), get_string('magicquotesruntime', 'install'), get_string('magicquotesruntimeerror', 'install'), 'magicquotesruntimehelp');
51e3e0b9 493 /// Check safe mode
494 print_compatibility_row(!ini_get_bool('safe_mode'), get_string('safemode', 'install'), get_string('safemodeerror', 'install'), 'safemodehelp', true);
8d783716 495 /// Check file uploads
51e3e0b9 496 print_compatibility_row(ini_get_bool('file_uploads'), get_string('fileuploads', 'install'), get_string('fileuploadserror', 'install'), 'fileuploadshelp', true);
8d783716 497 /// Check GD version
51e3e0b9 498 print_compatibility_row(check_gd_version(), get_string('gdversion', 'install'), get_string('gdversionerror', 'install'), 'gdversionhelp', true);
8d783716 499 /// Check memory limit
51e3e0b9 500 print_compatibility_row(check_memory_limit(), get_string('memorylimit', 'install'), get_string('memorylimiterror', 'install'), 'memorylimithelp', true);
8d783716 501
502
8b5b1028 503 break;
504 case 2: /// Directory settings
505?>
506
507 <tr>
508 <td class="td_left"><p><?php print_string('wwwroot', 'install') ?></p></td>
509 <td class="td_right">
510 <input type="text" size="40"name="wwwroot" value="<?php echo $INSTALL['wwwroot'] ?>" />
511 </td>
512 </tr>
513 <tr>
514 <td class="td_left"><p><?php print_string('dirroot', 'install') ?></p></td>
515 <td class="td_right">
516 <input type="text" size="40" name="dirroot" value="<?php echo $INSTALL['dirroot'] ?>" />
517 </td>
518 </tr>
519 <tr>
520 <td class="td_left"><p><?php print_string('dataroot', 'install') ?></p></td>
521 <td class="td_right">
522 <input type="text" size="40" name="dataroot" value="<?php echo $INSTALL['dataroot'] ?>" />
523 </td>
524 </tr>
525
526<?php
527 break;
528 case 3: /// Database settings
529?>
530
531 <tr>
532 <td class="td_left"><p><?php print_string('dbtype', 'install') ?></p></td>
533 <td class="td_right">
534 <?php choose_from_menu (array("mysql" => "mysql", "postgres7" => "postgres7"), 'dbtype', $INSTALL['dbtype'], '') ?>
535 </td>
536 </tr>
537 <tr>
538 <td class="td_left"><p><?php print_string('dbhost', 'install') ?></p></td>
539 <td class="td_right">
540 <input type="text" size="40" name="dbhost" value="<?php echo $INSTALL['dbhost'] ?>" />
541 </td>
542 </tr>
543 <tr>
544 <td class="td_left"><p><?php print_string('database', 'install') ?></p></td>
545 <td class="td_right">
546 <input type="text" size="40" name="dbname" value="<?php echo $INSTALL['dbname'] ?>" />
547 </td>
548 </tr>
549 <tr>
550 <td class="td_left"><p><?php print_string('user') ?></p></td>
551 <td class="td_right">
552 <input type="text" size="40" name="dbuser" value="<?php echo $INSTALL['dbuser'] ?>" />
553 </td>
554 </tr>
555 <tr>
556 <td class="td_left"><p><?php print_string('password') ?></p></td>
557 <td class="td_right">
558 <input type="text" size="40" name="dbpass" value="<?php echo $INSTALL['dbpass'] ?>" />
559 </td>
560 </tr>
561 <tr>
562 <td class="td_left"><p><?php print_string('dbprefix', 'install') ?></p></td>
563 <td class="td_right">
564 <input type="text" size="40" name="prefix" value="<?php echo $INSTALL['prefix'] ?>" />
565 </td>
566 </tr>
567
568<?php
569 break;
570 case 4: /// Administration directory setting
571?>
572
573 <tr>
574 <td class="td_left"><p><?php print_string('admindirname', 'install') ?></p></td>
575 <td class="td_right">
576 <input type="text" size="40" name="admindirname" value="<?php echo $INSTALL['admindirname'] ?>" />
577 </td>
578 </tr>
579
580
581<?php
582 break;
583 default:
584 }
585?>
cd0e958e 586
51e3e0b9 587 <tr>
588 <td colspan="<?php echo ($nextstage == 1) ? '3' : '2'; ?>">
589
590 <?php echo ($nextstage < 5) ? "<input type=\"submit\" name=\"next\" value=\"".get_string('next')." &raquo;\" style=\"float: right\"/>\n" : "&nbsp;\n" ?>
591 <?php echo ($nextstage > 0) ? "<input type=\"submit\" name=\"prev\" value=\"&laquo; ".get_string('previous')."\" style=\"float: left\"/>\n" : "&nbsp;\n" ?>
cd0e958e 592
7c561c7a 593
51e3e0b9 594 </td>
cd0e958e 595
51e3e0b9 596 </tr>
597
598 </table>
8b5b1028 599 </form>
600
601<?php
602}
603
604
605
8d783716 606//==========================================================================//
607
51e3e0b9 608function print_compatibility_row($success, $testtext, $errormessage, $helpfield='', $caution=false) {
8d783716 609 echo "<tr>\n";
51e3e0b9 610 echo "<td class=\"td_left\" valign=\"top\" nowrap width=\"160\"><p>$testtext</p></td>\n";
8d783716 611 if ($success) {
51e3e0b9 612 echo "<td valign=\"top\"><p class=\"p_pass\">".get_string('pass', 'install')."</p></td>\n";
613 echo "<td valign=\"top\">&nbsp;</td>\n";
8d783716 614 } else {
51e3e0b9 615 echo "<td valign=\"top\"";
616 echo ($caution) ? "<p class=\"p_caution\">".get_string('caution', 'install') : "<p class=\"p_fail\">".get_string('fail', 'install');
617 echo "</p></td>\n";
618 echo "<td valign=\"top\">";
619 echo "<p>$errormessage ";
620 install_helpbutton("install.php?help=$helpfield");
621 echo "</p></td>\n";
8d783716 622 }
623 echo "</tr>\n";
624 return $success;
625}
626
627
628//==========================================================================//
629
630function install_helpbutton($url, $title='') {
631 if ($title == '') {
632 $title = get_string('help');
633 }
634 echo "<a href=\"javascript: void(0)\">";
635 echo "<img src=\"./pix/help.gif\" height=\"17\" width=\"22\" alt=\"$title\"";
839f2456 636 echo "border=\"0\" align=\"middle\" title=\"$title\" ";
8d783716 637 echo "onClick=\"return window.open('$url', 'Help', 'menubar=0,location=0,scrollbars,resizable,width=500,height=400')\">";
638 echo "</a>\n";
639}
51e3e0b9 640
8d783716 641
642
643//==========================================================================//
644
645function print_install_help($help) {
8d783716 646 switch ($help) {
647 case 'phpversionhelp':
648 print_string($help, 'install', phpversion());
649 break;
650 case 'memorylimithelp':
94ba66ce 651 print_string($help, 'install', get_memory_limit());
8d783716 652 break;
653 default:
654 print_string($help, 'install');
655 }
8d783716 656}
657
658
659//==========================================================================//
660
661function get_memory_limit() {
662 if ($limit = ini_get('memory_limit')) {
663 return $limit;
664 } else {
665 return get_cfg_var('memory_limit');
666 }
667}
668
669//==========================================================================//
670
671function check_memory_limit() {
672
673 /// if limit is already 16M or more then we don't care if we can change it or not
674 if ((int)str_replace('M', '', get_memory_limit()) >= 16) {
675 return true;
676 }
677
678 /// Otherwise, see if we can change it ourselves
679 @ini_set('memory_limit', '16M');
680 return ((int)str_replace('M', '', get_memory_limit()) >= 16);
681}
682
8b5b1028 683//==========================================================================//
684
685function css_styles() {
686?>
687
688<style type="text/css">
689
690 body { background-color: #ffeece; }
51e3e0b9 691 p, li {
8d783716 692 font-family: helvetica, arial, sans-serif;
693 font-size: 10pt;
694 }
8b5b1028 695 a { text-decoration: none; color: blue; }
696 .errormsg {
697 color: red;
698 font-weight: bold;
699 }
8d783716 700 blockquote {
51e3e0b9 701 font-family: courier, monospace;
8d783716 702 font-size: 10pt;
703 }
8b5b1028 704 .install_table {
705 width: 500px;
706 }
707 .td_left {
708 text-align: right;
709 font-weight: bold;
710 }
711 .td_right {
712 text-align: left;
713 }
714 .main {
715 width: 500px;
716 border-width: 1px;
717 border-style: solid;
718 border-color: #ffc85f;
719 -moz-border-radius-bottomleft: 15px;
720 -moz-border-radius-bottomright: 15px;
721 }
722 .td_mainheading {
723 background-color: #fee6b9;
8d783716 724 padding: 10px;
8b5b1028 725 }
726 .td_main {
727 text-align: center;
728 }
8d783716 729 .td_mainlogo {
730 }
731 .p_mainlogo {
732 }
8b5b1028 733 .p_mainheading {
8d783716 734 font-size: 11pt;
735 }
736 .p_mainheader{
737 text-align: right;
738 font-size: 20pt;
739 font-weight: bold;
740 }
741 .p_pass {
742 color: green;
743 font-weight: bold;
744 }
745 .p_fail {
746 color: red;
747 font-weight: bold;
748 }
51e3e0b9 749 .p_caution {
750 color: #ff6600;
751 font-weight: bold;
752 }
8d783716 753 .p_help {
754 text-align: center;
755 font-family: helvetica, arial, sans-serif;
756 font-size: 14pt;
757 font-weight: bold;
758 color: #333333;
8b5b1028 759 }
51e3e0b9 760
8b5b1028 761</style>
762
763<?php
764}
765?>