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