2 # MediaWiki web-based config/installation
3 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>
4 # http://www.mediawiki.org/
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.
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.
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
21 header( "Content-type: text/html; charset=utf-8" );
23 ?
><!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
24 "http://www.w3.org/TR/html4/loose.dtd">
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">
35 background
-color
: #eee;
37 border
: solid
1px
#444;
45 dl
.setup dd label
.column
{
57 /* margin-right: 200px; */
75 <a href
="http://www.mediawiki.org/"><img
76 src
="../images/wiki.png" width
="135" height
="135" alt
="" border
="0" /></a
>
79 <b
><a href
="http://www.mediawiki.org/">MediaWiki
</a
></b
> is
80 Copyright (C
) 2001-2004 by Magnus Manske
, Brion Vibber
, Lee Daniel Crocker
,
81 Tim Starling
, Erik M
ö
;ller
, and others
.</p
>
84 <li
><a href
="../README">Readme
</a
></li
>
85 <li
><a href
="../RELEASE-NOTES">Release notes
</a
></li
>
86 <li
><a href
="../docs/">doc
/</a
></li
>
87 <li
><a href
="http://meta.wikipedia.org/wiki/MediaWiki_User's_Guide">User
's Guide</a></li>
90 <p>This program is free software; you can redistribute it and/or modify
91 it under the terms of the GNU General Public License as published by
92 the Free Software Foundation; either version 2 of the License, or
93 (at your option) any later version.</p>
95 <p>This program is distributed in the hope that it will be useful,
96 but WITHOUT ANY WARRANTY; without even the implied warranty of
97 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98 GNU General Public License for more details.</p>
100 <p>You should have received <a href="../COPYING">a copy of the GNU General Public License</a>
101 along with this program; if not, write to the Free Software
102 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
103 or <a href="http://www.gnu.org/copyleft/gpl.html">read it online</a></p>
108 $IP = ".."; # Just to suppress notices, not for anything useful
109 include( "../includes/DefaultSettings.php" );
112 <h1>MediaWiki <?php print $wgVersion ?> installation</h1>
117 /* Check for existing configurations and bug out! */
119 if( file_exists( "../LocalSettings.php" ) || file_exists( "../AdminSettings.php" ) ) {
120 dieout( "<h2>Wiki is configured.</h2>
122 <p>Already configured... <a href='../index
.php
'>return to the wiki</a>.</p>
124 <p>(You should probably remove this directory for added security.)</p>" );
127 if( file_exists( "./LocalSettings.php" ) || file_exists( "./AdminSettings.php" ) ) {
128 dieout( "<h2>You're configured
!</h2
>
130 <p
>Please move
<tt
>LocalSettings
.php
</tt
> to the parent directory
, then
131 <a href
='../index.php'>try out your wiki
</a
>.
132 (You should remove this config directory
for added security once you
're done.)</p>" );
135 if( !is_writable( "." ) ) {
136 dieout( "<h2>Can't write config file
, aborting
</h2
>
138 <p
>In order to configure the wiki you have to make the
<tt
>config
</tt
> subdirectory
139 writable by the web server
. Once configuration is done you
'll move the created
140 <tt>LocalSettings.php</tt> to the parent directory, and for added safety you can
141 then remove the <tt>config</tt> subdirectory entirely.</p>
143 <p>To make the directory writable on a Unix/Linux system:</p>
146 cd <i>/path/to/wiki</i>
152 include( "../install-utils.inc" );
153 include( "../maintenance/updaters.inc" );
155 function getEncoded( $data ) {
157 global $wgInputEncoding;
158 if( strcasecmp( $wgInputEncoding, "utf-8" ) == 0 ) {
161 return utf8_decode( $data ); /* to latin1 wikis */
164 function getSitename() { return $this->getEncoded( $this->Sitename ); }
165 function getSysopName() { return $this->getEncoded( $this->SysopName ); }
166 function getSysopPass() { return $this->getEncoded( $this->SysopPass ); }
172 <h2>Checking environment...</h2>
177 $conf = new ConfigData;
179 install_version_checks();
180 print "<li>PHP " . phpversion() . " ok</li>\n";
182 $sapi = php_sapi_name();
183 $conf->prettyURLs = true;
184 print "<li>PHP server API is $sapi; ";
187 case "apache2handler":
188 print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
192 case "apache2filter":
193 print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
194 $conf->prettyURLs = false;
197 print "unknown; using pretty URLs (<tt>index.php/Page_Title</tt>), if you have trouble change this in <tt>LocalSettings.php</tt>";
201 $conf->zlib = function_exists( "gzencode" );
203 print "<li>Have zlib support; enabling output compression.</li>\n";
205 print "<li>No zlib support.</li>\n";
208 $conf->ImageMagick = false;
210 $conf->HaveGD = function_exists( "imagejpeg" );
211 if( $conf->HaveGD ) {
212 print "<li>Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads.</li>\n";
214 $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin" );
215 foreach( $imcheck as $dir ) {
216 $im = "$dir/convert";
217 if( file_exists( $im ) ) {
218 print "<li>Found ImageMagick: <tt>$im</tt>; image thumbnailing will be enabled if you enable uploads.</li>\n";
219 $conf->ImageMagick = $im;
223 if( !$conf->ImageMagick ) {
224 print "<li>Couldn't find GD library
or ImageMagick
; image thumbnailing disabled
.</li
>\n";
228 $conf->UseImageResize = $conf->HaveGD || $conf->ImageMagick;
230 # $conf->IP = "/Users
/brion
/Sites
/inplace
";
232 $conf->IP = getcwd();
233 $conf->IP = preg_replace( "/\\\\/","\\\\\\\\
",$conf->IP ); // For Windows, \ -> \\
235 print "<li
>Installation directory
: <tt
>" . htmlspecialchars( $conf->IP ) . "</tt
></li
>\n";
237 # $conf->ScriptPath = "/~brion
/inplace
";
238 $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $_SERVER["REQUEST_URI
"] );
239 print "<li
>Script URI path
: <tt
>" . htmlspecialchars( $conf->ScriptPath ) . "</tt
></li
>\n";
241 $conf->posted = ($_SERVER["REQUEST_METHOD
"] == "POST
");
243 $conf->Sitename = ucfirst( importPost( "Sitename
", "" ) );
244 $conf->EmergencyContact = importPost( "EmergencyContact
", $_SERVER["SERVER_ADMIN
"] );
245 $conf->DBserver = importPost( "DBserver
", "localhost
" );
246 $conf->DBname = importPost( "DBname
", "wikidb
" );
247 $conf->DBuser = importPost( "DBuser
", "wikiuser
" );
248 $conf->DBpassword = importPost( "DBpassword
" );
249 $conf->DBpassword2 = importPost( "DBpassword2
" );
250 $conf->RootPW = importPost( "RootPW
" );
251 $conf->LanguageCode = importPost( "LanguageCode
", "en
-utf8
" );
252 $conf->SysopName = importPost( "SysopName
", "WikiSysop
" );
253 $conf->SysopPass = importPost( "SysopPass
" );
254 $conf->SysopPass2 = importPost( "SysopPass2
" );
256 /* Check for validity */
259 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki
" || $conf->Sitename == "Mediawiki
" ) {
260 $errs["Sitename
"] = "Must not be blank
or \"MediaWiki\"
.";
262 if( $conf->DBpassword == "" ) {
263 $errs["DBpassword
"] = "Must not be blank
";
265 if( $conf->DBpassword != $conf->DBpassword2 ) {
266 $errs["DBpassword2
"] = "Passwords don
't match!";
269 if( $conf->SysopPass == "" ) {
270 $errs["SysopPass"] = "Must not be blank";
272 if( $conf->SysopPass != $conf->SysopPass2 ) {
273 $errs["SysopPass2"] = "Passwords don't match
!";
276 $conf->License = importPost( "License
", "none
" );
277 if( $conf->License == "gfdl
" ) {
278 $conf->RightsUrl = "http
://www.gnu.org/copyleft/fdl.html";
279 $conf->RightsText
= "GNU Free Documentation License 1.2";
280 $conf->RightsCode
= "gfdl";
281 $conf->RightsIcon
= "{$conf->ScriptPath}/images/gnu-fdl.png";
282 } elseif( $conf->License
== "none" ) {
283 $conf->RightsUrl
= $conf->RightsText
= $conf->RightsCode
= $conf->RightsIcon
= "";
285 $conf->RightsUrl
= importPost( "RightsUrl", "" );
286 $conf->RightsText
= importPost( "RightsText", "" );
287 $conf->RightsCode
= importPost( "RightsCode", "" );
288 $conf->RightsIcon
= importPost( "RightsIcon", "" );
291 if( $conf->posted
&& ( 0 == count( $errs ) ) ) {
292 do { /* So we can 'continue' to end prematurely */
293 $conf->Root
= ($conf->RootPW
!= "");
295 /* Load up the settings and get installin' */
296 $local = writeLocalSettings( $conf );
297 $wgCommandLineMode = false;
300 $wgDBadminuser = $wgDBuser;
301 $wgDBadminpassword = $wgDBpassword;
302 $wgCommandLineMode = true;
303 $wgUseDatabaseMessages = false; /* FIXME: For database failure */
304 include_once( "Setup.php" );
305 include_once( "../maintenance/InitialiseMessages.inc" );
307 $wgTitle = Title
::newFromText( "Installation script" );
308 $wgDatabase = Database
::newFromParams( $wgDBserver, "root", $conf->RootPW
, "", 1 );
309 $wgDatabase->mIgnoreErrors
= true;
311 @$myver = mysql_get_server_info( $wgDatabase->mConn
);
314 print "<li>Connected as root (automatic)</li>\n";
316 print "<li>MySQL error " . ($err = mysql_errno() ) .
317 ": " . htmlspecialchars( mysql_error() );
322 $errs["RootPW"] = "Check password";
324 print "<li>Trying regular user...\n";
325 /* Try the regular user... */
326 $wgDatabase = Database
::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, "", 1 );
327 $wgDatabase->isOpen();
328 $wgDatabase->mIgnoreErrors
= true;
329 @$myver = mysql_get_server_info( $wgDatabase->mConn
);
331 $errs["DBuser"] = "Check name/pass";
332 $errs["DBpassword"] = "or enter root";
333 $errs["DBpassword2"] = "password below";
334 $errs["RootPW"] = "Got root?";
335 print " need password.</li>\n";
347 $errs["DBserver"] = "Connection failed";
350 $errs["DBserver"] = "Couldn't connect to database";
356 if ( !$wgDatabase->isOpen() ) {
357 $errs["DBserver"] = "Couldn't connect to database";
361 print "<li>Connected to database... $myver";
362 if( version_compare( $myver, "4.0.0" ) >= 0 ) {
363 print "; enabling MySQL 4 enhancements";
364 $conf->DBmysql4
= true;
365 $local = writeLocalSettings( $conf );
369 @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn
);
371 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
373 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
375 print "<li>Couldn't create database <tt>" .
376 htmlspecialchars( $wgDBname ) .
377 "</tt>; try with root access or check your username/pass.</li>\n";
378 $errs["RootPW"] = "<- Enter";
381 print "<li>Created database <tt>" . htmlspecialchars( $wgDBname ) . "</tt></li>\n";
384 $wgDatabase->selectDB( $wgDBname );
386 if( $wgDatabase->tableExists( "cur" ) ) {
387 print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n<pre>";
391 do_ipblocks_update(); flush();
392 do_interwiki_update(); flush();
393 do_index_update(); flush();
394 do_linkscc_update(); flush();
395 do_hitcounter_update(); flush();
396 do_recentchanges_update(); flush();
397 initialiseMessages(); flush();
401 print "<li>Finished update checks.</li>\n";
403 # FIXME: Check for errors
404 print "<li>Creating tables...";
405 dbsource( "../maintenance/tables.sql", $wgDatabase );
406 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
407 dbsource( "../maintenance/indexes.sql", $wgDatabase );
408 print " done.</li>\n";
410 print "<li>Initializing data...";
411 $wgDatabase->query( "INSERT INTO site_stats (ss_row_id,ss_total_views," .
412 "ss_total_edits,ss_good_articles) VALUES (1,0,0,0)" );
414 if( $conf->SysopName
) {
415 $u = User
::newFromName( $conf->getSysopName() );
416 if ( 0 == $u->idForName() ) {
418 $u->setPassword( $conf->getSysopPass() );
419 $u->addRight( "sysop" );
420 $u->addRight( "bureaucrat" );
422 print "<li>Created sysop account <tt>" .
423 htmlspecialchars( $conf->SysopName
) . "</tt>.</li>\n";
425 print "<li>Could not create user - already exists!</li>\n";
428 print "<li>Skipped sysop account creation, no name given.</li>\n";
431 print "<li>Initialising log pages...";
433 "uploadlogpage" => "uploadlogpagetext",
434 "dellogpage" => "dellogpagetext",
435 "protectlogpage" => "protectlogtext",
436 "blocklogpage" => "blocklogtext"
438 $metaNamespace = Namespace::getWikipedia();
439 $now = wfTimestampNow();
440 $won = wfInvertTimestamp( $now );
441 foreach( $logs as $page => $text ) {
442 $logTitle = wfStrencode( $wgLang->ucfirst( str_replace( " ", "_", wfMsgNoDB( $page ) ) ) );
443 $logText = wfStrencode( wfMsgNoDB( $text ) );
444 $wgDatabase->query( "INSERT INTO cur (cur_namespace,cur_title,cur_text," .
445 "cur_restrictions,cur_timestamp,inverse_timestamp,cur_touched) " .
446 "VALUES ($metaNamespace,'$logTitle','$logText','sysop','$now','$won','$now')" );
450 $titleobj = Title
::newFromText( wfMsgNoDB( "mainpage" ) );
451 $title = $titleobj->getDBkey();
452 $sql = "INSERT INTO cur (cur_namespace,cur_title,cur_text,cur_timestamp,inverse_timestamp,cur_touched) " .
453 "VALUES (0,'$title','" .
454 wfStrencode( wfMsg( "mainpagetext" ) ) . "','$now','$won','$now')";
455 $wgDatabase->query( $sql, $fname );
458 initialiseMessages();
459 print "</pre></li>\n";
462 print "<li>Granting user permissions...</li>\n";
463 dbsource( "../maintenance/users.sql", $wgDatabase );
467 /* Write out the config file now that all is well */
468 print "<p>Creating LocalSettings.php...</p>\n\n";
469 $localSettings = "<" . "?php$endl$local$endl?" . ">";
471 if( version_compare( phpversion(), "4.3.2" ) >= 0 ) {
472 $xt = "xt"; # Refuse to overwrite an existing file
474 $xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above, but race conditions blah blah
476 $f = fopen( "LocalSettings.php", $xt );
479 dieout( "<p>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" .
480 "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" .
481 "<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
483 fwrite( $f, $localSettings );
486 print "<p>Success! Move the LocalSettings.php file into the parent directory, then follow
487 <a href='{$conf->ScriptPath}/index.php'>this link</a> to your wiki.</p>\n";
497 if( count( $errs ) ) {
498 /* Display options form */
500 if( $conf->posted
) {
501 echo "<p class='error'>Something's not quite right yet; make sure everything below is filled out correctly.</p>\n";
505 <form name
="config" method
="post">
513 aField( $conf, "Sitename", "Site name:" );
517 Your site name should be a relatively short word
. It
'll appear as the namespace
518 name for 'meta
' pages as well as throughout the user interface. Good site names
519 are things like "<a href="http://www.wikipedia.org/">Wikipedia</a>" and
520 "<a href="http://openfacts.berlios.de/">OpenFacts</a>"; avoid punctuation,
521 which may cause problems.
526 aField( $conf, "EmergencyContact", "Contact e-mail" );
530 This will be used as the return address for password reminders and
531 may be displayed in some error conditions so visitors can get in
536 <label class='column
' for="LanguageCode">Language</label>
537 <select id="LanguageCode" name="LanguageCode">
539 $list = getLanguageList();
540 foreach( $list as $code => $name ) {
541 $sel = ($code == $conf->LanguageCode) ? "selected" : "";
542 echo "\t\t<option value=\"$code\" $sel>$name</option>\n";
548 You may select the language for the user interface of the wiki...
549 Some localizations are less complete than others. This also controls
550 the character encoding; Unicode is more flexible, but Latin-1 may be
551 more compatible with older browsers for some languages. Unicode will
552 be used where not specified otherwise.
556 <label class='column
'>Copyright/license metadata</label>
557 <div>Select one:</div>
560 <li><?php aField( $conf, "License", "no license metadata", "radio", "none" ); ?></li>
561 <li><?php aField( $conf, "License", "GNU Free Documentation License 1.2 (Wikipedia-compatible)", "radio", "gfdl" ); ?></li>
563 aField( $conf, "License", "a Creative Commons license...", "radio", "cc" );
564 $partner = "MediaWiki";
565 $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
566 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
567 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
568 print "<a href=\"$ccApp\">choose</a>";
570 <li><?php aField( $conf, "RightsUrl", $conf->RightsUrl, "hidden" ); ?></li>
571 <li><?php aField( $conf, "RightsText", $conf->RightsText, "hidden" ); ?></li>
572 <li><?php aField( $conf, "RightsCode", $conf->RightsCode, "hidden" ); ?></li>
573 <li><?php aField( $conf, "RightsIcon", $conf->RightsIcon, "hidden" ); ?></li>
577 MediaWiki can include a basic license notice, icon, and machine-reable
578 copyright metadata if your wiki's content is to be licensed under
579 the GNU FDL
or a Creative Commons license
. If you
're not sure, leave
585 <?php aField( $conf, "SysopName", "Sysop account name:", "" ) ?>
588 <?php aField( $conf, "SysopPass", "password:", "password" ) ?>
591 <?php aField( $conf, "SysopPass2", "again:", "password" ) ?>
594 A sysop user account can lock or delete pages, block problematic IP
595 addresses from editing, and other maintenance tasks. If creating a new
596 wiki database, a sysop account will be created with the given name
601 <h2>Database config</h2>
605 aField( $conf, "DBserver", "MySQL server" );
608 If your database server isn't on your web server
, enter the name
613 aField( $conf, "DBname", "Database name" );
616 aField( $conf, "DBuser", "DB username" );
619 aField( $conf, "DBpassword", "DB password", "password" );
622 aField( $conf, "DBpassword2", "again", "password" );
625 If you only have a single user account
and database available
,
626 enter those here
. If you have database root
access (see below
)
627 you can specify
new accounts
/databases to be created
.
633 aField( $conf, "RootPW", "DB root password", "password" );
637 You will only need this
if the database
and/or user account
638 above don
't already exist.
639 Do <em>not</em> type in your machine's root password
! MySQL
640 has its own
"root" user with a separate password
. (It might
641 even be blank
, depending on your configuration
.)
645 <label
class='column'> 
;</label
>
646 <input type
="submit" value
="Install!" />
656 /* -------------------------------------------------------------------------------------- */
658 function writeAdminSettings( $conf ) {
660 \$wgDBadminuser = \"{$conf->DBadminuser}\";
661 \$wgDBadminpassword = \"{$conf->DBadminpassword}\";
665 function writeLocalSettings( $conf ) {
666 $conf->DBmysql4
= @$conf->DBmysql4 ?
'true' : 'false';
667 $conf->UseImageResize
= $conf->UseImageResize ?
'true' : 'false';
668 $conf->PasswordSender
= $conf->EmergencyContact
;
669 if( $conf->LanguageCode
== "en-utf8" ) {
670 $conf->LanguageCode
= "en";
671 $conf->Encoding
= "UTF-8";
673 $zlib = ($conf->zlib ?
"" : "# ");
674 $magic = ($conf->ImageMagick ?
"" : "# ");
675 $convert = ($conf->ImageMagick ?
$conf->ImageMagick
: "/usr/bin/convert" );
676 $pretty = ($conf->prettyURLs ?
"" : "# ");
677 $ugly = ($conf->prettyURLs ?
"# " : "");
678 $rights = ($conf->RightsUrl
) ?
"" : "# ";
680 # $proxyKey = Parser::getRandomString() . Parser::getRandomString();
682 $sep = (DIRECTORY_SEPARATOR
== "\\") ?
";" : ":";
684 # This file was automatically generated by the MediaWiki installer.
685 # If you make manual changes, please keep track in case you need to
686 # recreate them later.
688 \$IP = \"{$conf->IP}\";
689 ini_set( \"include_path\", \"\$IP/includes$sep\$IP/languages$sep\" . ini_get(\"include_path\") );
690 include_once( \"DefaultSettings.php\" );
692 if ( \$wgCommandLineMode ) {
693 if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
694 die( \"This script must be run from the command line\\n\" );
697 ## Compress output if the browser supports it
698 {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
701 \$wgSitename = \"{$conf->Sitename}\";
703 \$wgScriptPath = \"{$conf->ScriptPath}\";
704 \$wgScript = \"\$wgScriptPath/index.php\";
705 \$wgRedirectScript = \"\$wgScriptPath/redirect.php\";
707 ## If using PHP as a CGI module, use the ugly URLs
708 {$pretty}\$wgArticlePath = \"\$wgScript/\$1\";
709 {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\";
711 \$wgStylePath = \"\$wgScriptPath/stylesheets\";
712 \$wgStyleSheetDirectory = \"\$IP/stylesheets\";
714 \$wgUploadPath = \"\$wgScriptPath/images\";
715 \$wgUploadDirectory = \"\$IP/images\";
716 \$wgLogo = \"\$wgUploadPath/wiki.png\";
718 \$wgEmergencyContact = \"{$conf->EmergencyContact}\";
719 \$wgPasswordSender = \"{$conf->PasswordSender}\";
721 \$wgDBserver = \"{$conf->DBserver}\";
722 \$wgDBname = \"{$conf->DBname}\";
723 \$wgDBuser = \"{$conf->DBuser}\";
724 \$wgDBpassword = \"{$conf->DBpassword}\";
726 ## To allow SQL queries through the wiki's Special:Askaql page,
727 ## uncomment the next lines. THIS IS VERY INSECURE. If you want
728 ## to allow semipublic read-only SQL access for your sysops,
729 ## you should define a MySQL user with limited privileges.
730 ## See MySQL docs: http://www.mysql.com/doc/en/GRANT.html
732 # \$wgAllowSysopQueries = true;
733 # \$wgDBsqluser = \"sqluser\";
734 # \$wgDBsqlpassword = \"sqlpass\";
736 \$wgDBmysql4 = \$wgEnablePersistentLC = {$conf->DBmysql4};
738 ## To enable image uploads, make sure the 'images' directory
739 ## is writable, then uncomment this:
740 # \$wgDisableUploads = false;
741 \$wgUseImageResize = {$conf->UseImageResize};
742 {$magic}\$wgUseImageMagick = true;
743 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
745 ## If you have the appropriate support software installed
746 ## you can enable inline LaTeX equations:
748 \$wgMathPath = \"{\$wgUploadPath}/math\";
749 \$wgMathDirectory = \"{\$wgUploadDirectory}/math\";
750 \$wgTmpDirectory = \"{\$wgUploadDirectory}/tmp\";
752 \$wgUsePHPTal = true;
753 if ( \$wgUsePHPTal ) {
754 ini_set( \"include_path\", \"\$IP/PHPTAL-NP-0.7.0/libs$sep\" . ini_get(\"include_path\") );
757 \$wgLocalInterwiki = \$wgSitename;
759 \$wgLanguageCode = \"{$conf->LanguageCode}\";
760 " . ($conf->Encoding ?
"\$wgInputEncoding = \$wgOutputEncoding = \"{$conf->Encoding}\";" : "" ) . "
762 #\$wgProxyKey = $proxyKey;
764 ## For attaching licensing metadata to pages, and displaying an
765 ## appropriate copyright notice / icon. GNU Free Documentation
766 ## License and Creative Commons licenses are supported so far.
767 {$rights}\$wgEnableCreativeCommonsRdf = true;
768 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
769 \$wgRightsUrl = \"{$conf->RightsUrl}\";
770 \$wgRightsText = \"{$conf->RightsText}\";
771 \$wgRightsIcon = \"{$conf->RightsIcon}\";
772 # \$wgRightsCode = \"{$conf->RightsCode}\"; # Not yet used
776 function dieout( $text ) {
777 die( $text . "\n\n</body>\n</html>" );
780 function importPost( $name, $default = "" ) {
781 if( isset( $_REQUEST[$name] ) ) {
782 return $_REQUEST[$name];
788 function aField( &$conf, $field, $text, $type = "", $value = "" ) {
790 $xtype = "type=\"$type\"";
795 if(!(isset($id)) or ($id == "") ) $id = $field;
796 $nolabel = ($type == "radio") ||
($type == "hidden");
800 echo "\t\t<label class='column' for=\"$id\">$text</label>\n";
803 if( $type == "radio" && $value == $conf->$field ) {
804 $checked = "checked='checked'";
808 echo "\t\t<input $xtype name=\"$field\" id=\"$id\" $checked value=\"";
809 if( $type == "radio" ) {
810 echo htmlspecialchars( $value );
812 echo htmlspecialchars( $conf->$field );
816 echo " $text</label>\n";
820 if(isset($errs[$field])) echo "<span class='error'>" . $errs[$field] . "</span>\n";
823 function getLanguageList() {
824 global $wgLanguageNames;
825 if( !isset( $wgLanguageNames ) ) {
826 $wgLanguageCode = "xxx";
827 function wfLocalUrl( $x ) { return $x; }
828 function wfLocalUrlE( $x ) { return $x; }
829 include( "../languages/Language.php" );
833 $latin1 = array( "da", "de", "en", "es", "nl", "sv" );
835 $d = opendir( "../languages" );
836 while( false !== ($f = readdir( $d ) ) ) {
837 if( preg_match( '/Language([A-Z][a-z]+)\.php$/', $f, $m ) ) {
838 $code = strtolower( $m[1] );
839 $codes[$code] = "$code - " . $wgLanguageNames[$code];
840 if( in_array( $code, $latin1 ) ) {
841 $codes[$code] .= " - Latin-1";
845 $codes["en-utf8"] = "en - English - Unicode";