Some slash fixes
[lhc/web/wiklou.git] / config / index.php
1 <?php
2 # MediaWiki web-based config/installation
3 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>
4 # http://www.mediawiki.org/
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # http://www.gnu.org/copyleft/gpl.html
20
21 header( "Content-type: text/html; charset=utf-8" );
22
23 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
24 "http://www.w3.org/TR/html4/loose.dtd">
25 <html>
26 <head>
27 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
28 <meta name="robots" content="noindex,nofollow">
29 <title>MediaWiki installation</title>
30 <style type="text/css">
31 #credit {
32 float: right;
33 width: 200px;
34 font-size: 0.7em;
35 background-color: #eee;
36 color: black;
37 border: solid 1px #444;
38 padding: 8px;
39 margin-left: 8px;
40 }
41
42 dl.setup dd {
43 margin-left: 0;
44 }
45 dl.setup dd label {
46 clear: left;
47 font-weight: bold;
48 width: 12em;
49 float: left;
50 text-align: right;
51 padding-right: 1em;
52 }
53 dl.setup dt {
54 clear: left;
55 font-size: 0.8em;
56 margin-left: 10em;
57 /* margin-right: 200px; */
58 margin-bottom: 2em;
59 }
60 .error {
61 color: red;
62 }
63 </style>
64 </head>
65
66 <body>
67
68 <div id="credit">
69 <center>
70 <a href="http://www.mediawiki.org/"><img
71 src="../images/wiki.png" width="135" height="135" alt="" border="0" /></a>
72 </center>
73
74 <b><a href="http://www.mediawiki.org/">MediaWiki</a></b> is
75 Copyright (C) 2001-2004 by Magnus Manske, Brion Vibber, Lee Daniel Crocker,
76 Tim Starling, Erik M&ouml;ller, and others.</p>
77
78 <ul>
79 <li><a href="../README">Readme</a></li>
80 <li><a href="../RELEASE-NOTES">Release notes</a></li>
81 <li><a href="../docs/">doc/</a></li>
82 <li><a href="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User's Guide</a></li>
83 </ul>
84
85 <p>This program is free software; you can redistribute it and/or modify
86 it under the terms of the GNU General Public License as published by
87 the Free Software Foundation; either version 2 of the License, or
88 (at your option) any later version.</p>
89
90 <p>This progarm is distributed in the hope that it will be useful,
91 but WITHOUT ANY WARRANTY; without even the implied warranty of
92 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93 GNU General Public License for more details.</p>
94
95 <p>You should have received <a href="../COPYING">a copy of the GNU General Public License</a>
96 along with this program; if not, write to the Free Software
97 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
98 or <a href="http://www.gnu.org/copyleft/gpl.html">read it online</a></p>
99 </div>
100
101 <?php
102 include( "../includes/DefaultSettings.php" );
103 ?>
104
105 <h1>MediaWiki <?php print $wgVersion ?> installation</h1>
106
107
108 <?php
109
110 /* Check for existing configurations and bug out! */
111
112 if( file_exists( "../LocalSettings.php" ) || file_exists( "../AdminSettings.php" ) ) {
113 dieout( "<h2>Wiki is configured.</h2>
114
115 <p>Already configured... <a href='../index.php'>return to the wiki</a>.</p>
116
117 <p>(You should probably remove this directory for added security.)</p>" );
118 }
119
120 if( file_exists( "./LocalSettings.php" ) || file_exists( "./AdminSettings.php" ) ) {
121 dieout( "<h2>You're configured!</h2>
122
123 <p>Please move <tt>LocalSettings.php</tt> to the parent directory, then
124 <a href='../index.php'>try out your wiki</a>.
125 (You should remove this config directory for added security once you're done.)</p>" );
126 }
127
128 if( !is_writable( "." ) ) {
129 dieout( "<h2>Can't write config file, aborting</h2>
130
131 <p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory
132 writable by the web server. Once configuration is done you'll move the created
133 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
134 then remove the <tt>config</tt> subdirectory entirely.</p>
135
136 <p>To make the directory writable on a Unix/Linux system:</p>
137
138 <pre>
139 cd <i>/path/to/wiki</i>
140 chmod a+w config
141 </pre>" );
142 }
143
144
145 include( "../install-utils.inc" );
146 include( "../maintenance/updaters.inc" );
147 class ConfigData {
148 function getEncoded( $data ) {
149 # Hackish
150 global $wgInputEncoding;
151 if( strcasecmp( $wgInputEncoding, "utf-8" ) == 0 ) {
152 return $data;
153 } else {
154 return utf8_decode( $data ); /* to latin1 wikis */
155 }
156 }
157 function getSitename() { return $this->getEncoded( $this->Sitename ); }
158 function getSysopName() { return $this->getEncoded( $this->SysopName ); }
159 function getSysopPass() { return $this->getEncoded( $this->SysopPass ); }
160 }
161
162 ?>
163
164
165 <h2>Checking environment...</h2>
166 <ul>
167 <?php
168
169 $conf = new ConfigData;
170
171 install_version_checks();
172 print "<li>PHP " . phpversion() . " ok</li>\n";
173
174 $sapi = php_sapi_name();
175 $conf->prettyURLs = true;
176 print "<li>PHP server API is $sapi; ";
177 switch( $sapi ) {
178 case "apache":
179 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
180 break;
181 case "cgi":
182 case "cgi-fcgi":
183 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
184 $conf->prettyURLs = false;
185 break;
186 default:
187 print "unknown; using pretty URLs (<tt>index.php/Page_Title</tt>), if you have trouble change this in <tt>LocalSettings.php</tt>";
188 }
189 print "</li>\n";
190
191 $conf->zlib = function_exists( "gzencode" );
192 if( $conf->zlib ) {
193 print "<li>Have zlib support; enabling output compression.</li>\n";
194 } else {
195 print "<li>No zlib support.</li>\n";
196 }
197
198 $conf->ImageMagick = false;
199
200 $conf->HaveGD = function_exists( "imagejpeg" );
201 if( $conf->HaveGD ) {
202 print "<li>Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.</li>\n";
203 } else {
204 $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin" );
205 foreach( $imcheck as $dir ) {
206 $im = "$dir/convert";
207 if( file_exists( $im ) ) {
208 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
209 $conf->ImageMagick = $im;
210 break;
211 }
212 }
213 if( !$conf->ImageMagick ) {
214 print "<li>Couldn't find GD library or ImageMagick; image thumbnailing disabled.</li>\n";
215 }
216 }
217
218 $conf->UseImageResize = $conf->HaveGD || $conf->ImageMagick;
219
220 # $conf->IP = "/Users/brion/Sites/inplace";
221 chdir( ".." );
222 $conf->IP = getcwd();
223 chdir( "config" );
224 print "<li>Installation directory: <tt>" . htmlspecialchars( $conf->IP ) . "</tt></li>\n";
225
226 # $conf->ScriptPath = "/~brion/inplace";
227 $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["REQUEST_URI"] );
228 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath ) . "</tt></li>\n";
229
230 $conf->posted = ($_SERVER["REQUEST_METHOD"] == "POST");
231
232 $conf->Sitename = ucfirst( importPost( "Sitename", "" ) );
233 $conf->EmergencyContact = importPost( "EmergencyContact", $_SERVER["SERVER_ADMIN"] );
234 $conf->DBserver = importPost( "DBserver", "localhost" );
235 $conf->DBname = importPost( "DBname", "wikidb" );
236 $conf->DBuser = importPost( "DBuser", "wikiuser" );
237 $conf->DBpassword = importPost( "DBpassword" );
238 $conf->DBpassword2 = importPost( "DBpassword2" );
239 $conf->RootPW = importPost( "RootPW" );
240 $conf->LanguageCode = importPost( "LanguageCode", "en-utf8" );
241 $conf->SysopName = importPost( "SysopName", "WikiSysop" );
242 $conf->SysopPass = importPost( "SysopPass" );
243 $conf->SysopPass2 = importPost( "SysopPass2" );
244
245 /* Check for validity */
246 $errs = array();
247
248 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki" || $conf->Sitename == "Mediawiki" ) {
249 $errs["Sitename"] = "Must not be blank or \"MediaWiki\".";
250 }
251 if( $conf->DBpassword == "" ) {
252 $errs["DBpassword"] = "Must not be blank";
253 }
254 if( $conf->DBpassword != $conf->DBpassword2 ) {
255 $errs["DBpassword2"] = "Passwords don't match!";
256 }
257
258 if( $conf->SysopPass == "" ) {
259 $errs["SysopPass"] = "Must not be blank";
260 }
261 if( $conf->SysopPass != $conf->SysopPass2 ) {
262 $errs["SysopPass2"] = "Passwords don't match!";
263 }
264
265 if( $conf->posted && ( 0 == count( $errs ) ) ) {
266 do { /* So we can 'continue' to end prematurely */
267 $conf->Root = ($conf->RootPW != "");
268
269 /* Load up the settings and get installin' */
270 $local = writeLocalSettings( $conf );
271 $wgCommandLineMode = false;
272 eval($local);
273
274 $wgDBadminuser = $wgDBuser;
275 $wgDBadminpassword = $wgDBpassword;
276 $wgCommandLineMode = true;
277 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
278 include_once( "Setup.php" );
279 include_once( "../maintenance/InitialiseMessages.inc" );
280
281 $wgTitle = Title::newFromText( "Installation script" );
282
283 if( $conf->Root ) {
284 $wgDatabase = Database::newFromParams( $wgDBserver, "root", $conf->RootPW, "", 1 );
285 } else {
286 $wgDatabase = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, "", 1 );
287 }
288 $wgDatabase->mIgnoreErrors = true;
289
290 if ( !$wgDatabase->isOpen() ) {
291 $errs["DBserver"] = "Couldn't connect to database";
292 continue;
293 }
294
295 @$myver = mysql_get_server_info( $wgDatabase->mConn );
296 if( !$myver ) {
297 print "<li>MySQL error " . ($err = mysql_errno() ) .
298 ": " . htmlspecialchars( mysql_error() );
299 $ok = false;
300 switch( $err ) {
301 case 1045:
302 if( $conf->Root ) {
303 $errs["RootPW"] = "Check password";
304 } else {
305 print "<li>Trying root...\n";
306 /* Try a blank root password... */
307 $wgDatabase = Database::newFromParams( $wgDBserver, "root", "", "", 1 );
308 $wgDatabase->isOpen();
309 $wgDatabase->mIgnoreErrors = true;
310 @$myver = mysql_get_server_info( $wgDatabase->mConn );
311 if( !$myver ) {
312 $errs["DBuser"] = "Check name/pass";
313 $errs["DBpassword"] = "or enter root";
314 $errs["DBpassword2"] = "password below";
315 $errs["RootPW"] = "Got root?";
316 print " need password.</li>\n";
317 } else {
318 $conf->Root = true;
319 $conf->RootPW = "";
320 print " ok.</li>\n";
321 # And keep going...
322 $ok = true;
323 }
324 break;
325 }
326 case 2002:
327 case 2003:
328 $errs["DBserver"] = "Connection failed";
329 break;
330 default:
331 $errs["DBserver"] = "Couldn't connect to database";
332 break;
333 }
334 if( !$ok ) continue;
335 }
336 print "<li>Connected to database... $myver";
337 if( version_compare( $myver, "4.0.0" ) >= 0 ) {
338 print "; enabling MySQL 4 enhancements";
339 $conf->DBmysql4 = true;
340 $local = writeLocalSettings( $conf );
341 }
342 print "</li>\n";
343
344 @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn );
345 if( $sel ) {
346 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
347 } else {
348 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
349 if( !$res ) {
350 print "<li>Couldn't create database <tt>" .
351 htmlspecialchars( $wgDBname ) .
352 "</tt>; try with root access or check your username/pass.</li>\n";
353 $errs["RootPW"] = "&lt;- Enter";
354 continue;
355 }
356 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
357 }
358
359 $wgDatabase->selectDB( $wgDBname );
360
361 if( $wgDatabase->tableExists( "cur" ) ) {
362 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n<pre>";
363
364 chdir( ".." );
365 flush();
366 do_ipblocks_update(); flush();
367 do_interwiki_update(); flush();
368 do_index_update(); flush();
369 do_linkscc_update(); flush();
370 do_hitcounter_update(); flush();
371 do_recentchanges_update(); flush();
372 initialiseMessages(); flush();
373 chdir( "config" );
374
375 print "</pre>\n";
376 print "<li>Finished update checks.</li>\n";
377 } else {
378 # FIXME: Check for errors
379 print "<li>Creating tables...";
380 dbsource( "../maintenance/tables.sql", $wgDatabase );
381 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
382 dbsource( "../maintenance/indexes.sql", $wgDatabase );
383 print " done.</li>\n";
384
385 print "<li>Initializing data...";
386 $wgDatabase->query( "INSERT INTO site_stats (ss_row_id,ss_total_views," .
387 "ss_total_edits,ss_good_articles) VALUES (1,0,0,0)" );
388
389 if( $conf->SysopName ) {
390 $u = User::newFromName( $conf->getSysopName() );
391 if ( 0 == $u->idForName() ) {
392 $u->addToDatabase();
393 $u->setPassword( $conf->getSysopPass() );
394 $u->addRight( "sysop" );
395 $u->addRight( "bureaucrat" );
396 $u->saveSettings();
397 print "<li>Created sysop account <tt>" .
398 htmlspecialchars( $conf->SysopName ) . "</tt>.</li>\n";
399 } else {
400 print "<li>Could not create user - already exists!</li>\n";
401 }
402 } else {
403 print "<li>Skipped sysop account creation, no name given.</li>\n";
404 }
405
406 print "<li>Initialising log pages...";
407 $logs = array(
408 "uploadlogpage" => "uploadlogpagetext",
409 "dellogpage" => "dellogpagetext",
410 "protectlogpage" => "protectlogtext",
411 "blocklogpage" => "bloglogtext"
412 );
413 $metaNamespace = Namespace::getWikipedia();
414 $now = wfTimestampNow();
415 $won = wfInvertTimestamp( $now );
416 foreach( $logs as $page => $text ) {
417 $logTitle = wfStrencode( $wgLang->ucfirst( str_replace( " ", "_", wfMsgNoDB( $page ) ) ) );
418 $logText = wfStrencode( wfMsgNoDB( $text ) );
419 $wgDatabase->query( "INSERT INTO cur (cur_namespace,cur_title,cur_text," .
420 "cur_restrictions,cur_timestamp,inverse_timestamp,cur_touched) " .
421 "VALUES ($metaNamespace,'$logTitle','$logText','sysop','$now','$won','$now')" );
422 }
423 print "</li>\n";
424
425 $titleobj = Title::newFromText( wfMsgNoDB( "mainpage" ) );
426 $title = $titleobj->getDBkey();
427 $sql = "INSERT INTO cur (cur_namespace,cur_title,cur_text,cur_timestamp,inverse_timestamp,cur_touched) " .
428 "VALUES (0,'$title','" .
429 wfStrencode( wfMsg( "mainpagetext" ) ) . "','$now','$won','$now')";
430 $wgDatabase->query( $sql, $fname );
431
432 print "<li><pre>";
433 initialiseMessages();
434 print "</pre></li>\n";
435
436 if( $conf->Root ) {
437 # Grant user permissions
438 dbsource( "../maintenance/users.sql", $wgDatabase );
439 }
440 }
441
442 /* Write out the config file now that all is well */
443 print "<p>Creating LocalSettings.php...</p>\n\n";
444 $localSettings = "<" . "?php\n$local\n?" . ">";
445
446 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
447 $xt = "xt"; # Refuse to overwrite an existing file
448 } else {
449 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
450 }
451 $f = fopen( "LocalSettings.php", $xt );
452
453 if( $f == false ) {
454 dieout( "Couldn't write out LocalSettings.php. Check that the directory permissions are correct and that there isn't already a file of that name here...</p>\n" .
455 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
456 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
457 }
458 fwrite( $f, $localSettings );
459 fclose( $f );
460
461 print "<p>Success! Move the LocalSettings.php file into the parent directory, then follow
462 <a href='{$conf->ScriptPath}/index.php'>this link</a> to your wiki.</p>\n";
463
464 } while( false );
465 }
466 ?>
467 </ul>
468
469
470 <?php
471
472 if( count( $errs ) ) {
473 /* Display options form */
474
475 if( $conf->posted ) {
476 echo "<p class='error'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
477 }
478 ?>
479
480 <form name="config" method="post">
481
482
483 <h2>Site config</h2>
484
485 <dl class="setup">
486 <dd>
487 <?php
488 aField( $conf, "Sitename", "Site name:" );
489 ?>
490 </dd>
491 <dt>
492 Your site name should be a relatively short word. It'll appear as the namespace
493 name for 'meta' pages as well as throughout the user interface. Good site names
494 are things like "<a href="http://www.wikipedia.org/">Wikipedia</a>" and
495 "<a href="http://openfacts.berlios.de/">OpenFacts</a>"; avoid punctuation,
496 which may cause problems.
497 </dt>
498
499 <dd>
500 <?php
501 aField( $conf, "EmergencyContact", "Contact e-mail" );
502 ?>
503 </dd>
504 <dt>
505 This will be used as the return address for password reminders and
506 may be displayed in some error conditions so visitors can get in
507 touch with you.
508 </dt>
509
510 <dd>
511 <label for="LanguageCode">Language</label>
512 <select id="LanguageCode" name="LanguageCode">
513 <?php
514 $list = getLanguageList();
515 foreach( $list as $code => $name ) {
516 $sel = ($code == $conf->LanguageCode) ? "selected" : "";
517 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
518 }
519 ?>
520 </select>
521 </dd>
522 <dt>
523 You may select the language for the user interface of the wiki...
524 Some localizations are less complete than others. This also controls
525 the character encoding; Unicode is more flexible, but Latin-1 may be
526 more compatible with older browsers for some languages. Unicode will
527 be used where not specified otherwise.
528 </dt>
529
530 <dd>
531 <?php aField( $conf, "SysopName", "Sysop account name:", "" ) ?>
532 </dd>
533 <dd>
534 <?php aField( $conf, "SysopPass", "password:", "password" ) ?>
535 </dd>
536 <dd>
537 <?php aField( $conf, "SysopPass2", "again:", "password" ) ?>
538 </dd>
539 <dt>
540 A sysop user account can lock or delete pages, block problematic IP
541 addresses from editing, and other maintenance tasks. If creating a new
542 wiki database, a sysop account will be created with the given name
543 and password.
544 </dt>
545 </dl>
546
547 <h2>Database config</h2>
548
549 <dl class="setup">
550 <dd><?php
551 aField( $conf, "DBserver", "MySQL server" );
552 ?></dd>
553 <dt>
554 If your database server isn't on your web server, enter the name
555 or IP address here.
556 </dt>
557
558 <dd><?php
559 aField( $conf, "DBname", "Database name" );
560 ?></dd>
561 <dd><?php
562 aField( $conf, "DBuser", "DB username" );
563 ?></dd>
564 <dd><?php
565 aField( $conf, "DBpassword", "DB password", "password" );
566 ?></dd>
567 <dd><?php
568 aField( $conf, "DBpassword2", "again", "password" );
569 ?></dd>
570 <dt>
571 If you only have a single user account and database available,
572 enter those here. If you have database root access (see below)
573 you can specify new accounts/databases to be created.
574 </dt>
575
576
577 <dd>
578 <?php
579 aField( $conf, "RootPW", "DB root password", "password" );
580 ?>
581 </dd>
582 <dt>
583 You will only need this if the database and/or user account
584 above don't already exist.
585 Do <em>not</em> type in your machine's root password! MySQL
586 has its own "root" user with a separate password. (It might
587 even be blank, depending on your configuration.)
588 </dt>
589
590 <dd>
591 <label>&nbsp;</label>
592 <input type="submit" value="Install!" />
593 </dd>
594 </dl>
595
596
597 </form>
598
599 <?php
600 }
601
602 /* -------------------------------------------------------------------------------------- */
603
604 function writeAdminSettings( $conf ) {
605 return "
606 \$wgDBadminuser = \"{$conf->DBadminuser}\";
607 \$wgDBadminpassword = \"{$conf->DBadminpassword}\";
608 ";
609 }
610
611 function writeLocalSettings( $conf ) {
612 $conf->DBmysql4 = $conf->DBmysql4 ? 'true' : 'false';
613 $conf->UseImageResize = $conf->UseImageResize ? 'true' : 'false';
614 $conf->PasswordSender = $conf->EmergencyContact;
615 if( $conf->LanguageCode == "en-utf8" ) {
616 $conf->LanguageCode = "en";
617 $conf->Encoding = "UTF-8";
618 }
619 $zlib = ($conf->zlib ? "" : "# ");
620 $magic = ($conf->ImageMagick ? "" : "# ");
621 $convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
622 $pretty = ($conf->prettyURLs ? "" : "# ");
623 $ugly = ($conf->prettyURLs ? "# " : "");
624
625 $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":";
626 return "
627 # This file was automatically generated by the MediaWiki installer.
628 # If you make manual changes, please keep track in case you need to
629 # recreate them later.
630
631 \$IP = \"{$conf->IP}\";
632 ini_set( \"include_path\", \"\$IP/includes$sep\$IP/languages$sep\" . ini_get(\"include_path\") );
633 include_once( \"DefaultSettings.php\" );
634
635 if( \$wgCommandLineMode ) {
636 die( \"Can't use command-line utils with in-place install yet, sorry.\" );
637 } else {
638 ## Compress output if the browser supports it
639 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
640 }
641
642 \$wgSitename = \"{$conf->Sitename}\";
643
644 \$wgScriptPath = \"{$conf->ScriptPath}\";
645 \$wgScript = \"\$wgScriptPath/index.php\";
646 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
647
648 ## If using PHP as a CGI module, use the ugly URLs
649 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
650 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
651
652 \$wgStyleSheetPath = \"\$wgScriptPath/stylesheets\";
653 \$wgStyleSheetDirectory = \"\$IP/stylesheets\";
654
655 \$wgUploadPath = \"\$wgScriptPath/images\";
656 \$wgUploadDirectory = \"\$IP/images\";
657 \$wgLogo = \"\$wgUploadPath/wiki.png\";
658
659 \$wgEmergencyContact = \"{$conf->EmergencyContact}\";
660 \$wgPasswordSender = \"{$conf->PasswordSender}\";
661
662 \$wgDBserver = \"{$conf->DBserver}\";
663 \$wgDBname = \"{$conf->DBname}\";
664 \$wgDBuser = \"{$conf->DBuser}\";
665 \$wgDBpassword = \"{$conf->DBpassword}\";
666
667 ## To allow SQL queries through the wiki's Special:Askaql page,
668 ## uncomment the next lines. THIS IS VERY INSECURE. If you want
669 ## to allow semipublic read-only SQL access for your sysops,
670 ## you should define a MySQL user with limited privileges.
671 ## See MySQL docs: http://www.mysql.com/doc/en/GRANT.html
672 #
673 # \$wgAllowSysopQueries = true;
674 # \$wgDBsqluser = \"sqluser\";
675 # \$wgDBsqlpassword = \"sqlpass\";
676
677 \$wgDBmysql4 = \$wgEnablePersistentLC = {$conf->DBmysql4};
678
679 ## To enable image uploads, make sure the 'images' directory
680 ## is writable, then uncomment this:
681 # \$wgDisableUploads = false;
682 \$wgUseImageResize = {$conf->UseImageResize};
683 {$magic}\$wgUseImageMagick = true;
684 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
685
686 ## If you have the appropriate support software installed
687 ## you can enable inline LaTeX equations:
688 # \$wgUseTeX = true;
689 \$wgMathPath = \"{\$wgUploadPath}/math\";
690 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
691 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
692
693 ## Experimental layout template subsystems
694 \$wgUsePHPTal = false;
695 \$wgUseSmarty = false;
696 if ( \$wgUsePHPTal ) {
697 ini_set( \"include_path\", \"\$IP/PHPTAL-NP-0.7.0/libs$sep\" . ini_get(\"include_path\") );
698 }
699 if ( \$wgUseSmarty ) {
700 ini_set( \"include_path\", \"\$IP/Smarty-2.6.2/libs$sep\" . ini_get(\"include_path\") );
701 }
702
703 \$wgLocalInterwiki = \$wgSitename;
704
705 \$wgLanguageCode = \"{$conf->LanguageCode}\";
706 " . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$conf->Encoding}\";" : "" ) . "
707
708 ";
709 }
710
711 function dieout( $text ) {
712 die( $text . "\n\n</body>\n</html>" );
713 }
714
715 function importPost( $name, $default = "" ) {
716 if( isset( $_POST[$name] ) ) {
717 return $_POST[$name];
718 } else {
719 return $default;
720 }
721 }
722
723 function aField( &$conf, $field, $text, $type = "" ) {
724 if( $type != "" ) $type = "type=\"$type\"";
725 echo "\t\t<label for=\"$field\">$text</label>\n";
726 echo "\t\t<input $type name=\"$field\" id=\"$field\" value=\"";
727 echo htmlspecialchars( $conf->$field );
728 echo "\" />\n";
729
730 global $errs;
731 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
732 }
733
734 function getLanguageList() {
735 global $wgLanguageNames;
736 if( !isset( $wgLanguageNames ) ) {
737 $wgLanguageCode = "xxx";
738 function wfLocalUrl( $x ) { return $x; }
739 function wfLocalUrlE( $x ) { return $x; }
740 include( "../languages/Language.php" );
741 }
742
743 $codes = array();
744 $latin1 = array( "da", "de", "en", "es", "nl", "sv" );
745
746 $d = opendir( "../languages" );
747 while( false !== ($f = readdir( $d ) ) ) {
748 if( preg_match( '/Language([A-Z][a-z]+)\.php$/', $f, $m ) ) {
749 $code = strtolower( $m[1] );
750 $codes[$code] = "$code - " . $wgLanguageNames[$code];
751 if( in_array( $code, $latin1 ) ) {
752 $codes[$code] .= " - Latin-1";
753 }
754 }
755 }
756 $codes["en-utf8"] = "en - English - Unicode";
757 closedir( $d );
758 ksort( $codes );
759 return $codes;
760 }
761
762 ?>
763
764 </body>
765 </html>