From: Brion Vibber Date: Wed, 3 Mar 2004 06:54:03 +0000 (+0000) Subject: Create sysop account on new wiki creation. X-Git-Tag: 1.3.0beta1~879 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=686d3f41ef891aa3096cb8c243cd413128e23c7b;p=lhc%2Fweb%2Fwiklou.git Create sysop account on new wiki creation. --- diff --git a/config/index.php b/config/index.php index d9d1959a9a..98c3616316 100644 --- a/config/index.php +++ b/config/index.php @@ -1,4 +1,26 @@ - +# http://www.mediawiki.org/ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# http://www.gnu.org/copyleft/gpl.html + +header( "Content-type: text/html; charset=utf-8" ); + +?> @@ -18,11 +40,12 @@ } dl.setup dd { + margin-left: 0; } dl.setup dd label { clear: left; font-weight: bold; - width: 10em; + width: 12em; float: left; text-align: right; padding-right: 1em; @@ -104,7 +127,20 @@ if( file_exists( "./LocalSettings.php" ) || file_exists( "./AdminSettings.php" ) include( "../install-utils.inc" ); -class ConfigData {} +class ConfigData { + function getEncoded( $data ) { + # Hackish + global $wgInputEncoding; + if( strcasecmp( $wgInputEncoding, "utf-8" ) == 0 ) { + return $data; + } else { + return utf8_decode( $data ); /* to latin1 wikis */ + } + } + function getSitename() { return $this->getEncoded( $this->Sitename ); } + function getSysopName() { return $this->getEncoded( $this->SysopName ); } + function getSysopPass() { return $this->getEncoded( $this->SysopPass ); } +} ?> @@ -163,6 +199,9 @@ print "
  • Script URI path: " . htmlspecialchars( $conf->ScriptPath ) . "DBpassword2 = importPost( "DBpassword2" ); $conf->RootPW = importPost( "RootPW" ); $conf->LanguageCode = importPost( "LanguageCode", "en-utf8" ); + $conf->SysopName = importPost( "SysopName", "WikiSysop" ); + $conf->SysopPass = importPost( "SysopPass" ); + $conf->SysopPass2 = importPost( "SysopPass2" ); /* Check for validity */ $errs = array(); @@ -177,6 +216,13 @@ if( $conf->DBpassword != $conf->DBpassword2 ) { $errs["DBpassword2"] = "Passwords don't match!"; } +if( $conf->SysopPass == "" ) { + $errs["SysopPass"] = "Must not be blank"; +} +if( $conf->SysopPass != $conf->SysopPass2 ) { + $errs["SysopPass2"] = "Passwords don't match!"; +} + if( $conf->posted && ( 0 == count( $errs ) ) ) { do { /* So we can 'continue' to end prematurely */ $conf->Root = ($conf->RootPW != ""); @@ -267,7 +313,23 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { $wgDatabase->query( "INSERT INTO site_stats (ss_row_id,ss_total_views," . "ss_total_edits,ss_good_articles) VALUES (1,0,0,0)" ); - # FIXME: Initial sysop account + if( $conf->SysopName ) { + $u = User::newFromName( $conf->getSysopName() ); + if ( 0 == $u->idForName() ) { + $u->addToDatabase(); + $u->setPassword( $conf->getSysopPass() ); + $u->addRight( "sysop" ); + $u->addRight( "developer" ); /* ?? */ + $u->saveSettings(); + print "
  • Created sysop account " . + htmlspecialchars( $conf->SysopName ) . ".
  • \n"; + } else { + print "
  • Could not create user - already exists!
  • \n"; + } + } else { + print "
  • Skipped sysop account creation, no name given.
  • \n"; + } + # FIXME: Main page, logs # FIXME: Initialize messages print "
  • (NYI: accounts, pages, messages)
  • \n"; @@ -305,51 +367,9 @@ if( count( $errs ) ) { echo "

    Something's not quite right yet; make sure everything below is filled out correctly.

    \n"; } ?> -

    Database config

    -
    -
    -
    - If your database server isn't on your web server, enter the name - or IP address here. -
    - -
    -
    -
    -
    -
    - If you only have a single user account and database available, - enter those here. If you have database root access (see below) - you can specify new accounts/databases to be created. -
    - - -
    - -
    -
    - You will only need this if the database and/or user account - above don't already exist. - Do not type in your machine's root password! MySQL - has its own "root" user with a separate password. (It might - even be blank, depending on your configuration.) -
    -

    Site config

    @@ -373,7 +393,9 @@ if( count( $errs ) ) { ?>
    - If the wiki breaks terribly, it may display this contact address. + This will be used as the return address for password reminders and + may be displayed in some error conditions so visitors can get in + touch with you.
    @@ -392,16 +414,77 @@ if( count( $errs ) ) { You may select the language for the user interface of the wiki... Some localizations are less complete than others. This also controls the character encoding; Unicode is more flexible, but Latin-1 may be - more compatible with older browsers for some languages. The default - for most languages is Unicode. + more compatible with older browsers for some languages. Unicode will + be used where not specified otherwise. +
    + +
    +
    + +
    +
    + +
    +
    + A sysop user account can lock or delete pages, block problematic IP + addresses from editing, and other maintenance tasks. If creating a new + wiki database, a sysop account will be created with the given name + and password. +
    + + +

    Database config

    + +
    +
    +
    + If your database server isn't on your web server, enter the name + or IP address here. +
    + +
    +
    +
    +
    +
    + If you only have a single user account and database available, + enter those here. If you have database root access (see below) + you can specify new accounts/databases to be created. +
    + + +
    + +
    +
    + You will only need this if the database and/or user account + above don't already exist. + Do not type in your machine's root password! MySQL + has its own "root" user with a separate password. (It might + even be blank, depending on your configuration.) +
    +
    +