ok wunderbar. funktioniert.
http://wiki.maxrev.de
hier nochmal die komplette Auth_phpBB.php:
Code: Alles auswählen
<?php
/**
* Auth_phpBB authorization plugin for MediaWiki.
*
* This plugin allows login into MediaWiki only if the user already exists in phpBB 2.0 database.
* An account in MediaWiki is created automatically on first login (needed by MediaWiki software)
* and the email for the MediaWiki account is set to the email of the phpBB account.
* All other account creation in MediaWiki is disabled.
*
* Attention: This extension works only if phpBB uses mysql as database system!
*
* Copyright: Michael Keppler, http://www.bananeweizen.de
* License: GPL
*
* Installation:
* 1) copy this file into the MediaWiki subdirectory "extensions" (should exist already)
* 2) add the following line at the end of LocalSettings.php:
require_once( 'extensions/Auth_phpBB.php' );
* 3) edit the configuration section 6 lines below this line
* 4) go to Special:Allmessages and edit the message "nosuchuser" (remove the part about account creation)
*/
/*
* Configuration section start
*/
$wpPathTophpBB='../'; //path from MediaWiki directory to phpBB directory
$extraAuthCondition=''; //you may use extra conditions like "u.user_posts >= 100"
/*
* Configuration section end
*
* The following is no user configuration anymore.
* Don't change these values.
*/
//include base class
require_once( 'AuthPlugin.php' );
//disable all account creation in MediaWiki (this is needed to remove the form fields for account creation)
$wgWhitelistAccount['user'] = 0;
$wgWhitelistAccount['sysop'] = 0;
//include phpBB configuration to get the database connection parameters
require($wpPathTophpBB.DIRECTORY_SEPARATOR.'config.php');
class Auth_phpBB extends AuthPlugin {
/* check for existence of username */
function userExists( $username ) {
global $table_prefix;
return $this->phpBBExists(
"SELECT username
FROM ${table_prefix}users
WHERE username='$username'");
}
/* check for username and password */
/*conditions for successful login:
- user exists
- password is correct
- user account is activated
*/
function authenticate( $username, $password ) {
global $table_prefix;
if ($this->userExists( $username )) {
$query = "SELECT username
FROM ${table_prefix}users u
WHERE u.username='$username'
AND u.user_password='".md5($password)."'
AND u.user_active=1";
if ($extraAuthCondition!='') {
$query = $query . ' AND ' . $extraAuthCondition;
}
return $this->phpBBExists($query);
}
return false;
}
/* always create local account (seems to be needed for MediaWiki) */
function autoCreate() {
return true;
}
/* only allow logins authenticated by phpBB database */
function strict() {
return true;
}
/* user account initialization: copy email from phpBB to MediaWiki */
function initUser( &$user ) {
global $table_prefix;
$mail = $this->phpBBQuery(
"SELECT user_email
FROM ${table_prefix}users
WHERE username='".$user->getName()."'");
if (is_array($mail)) {
$user->setEmail( $mail[0] );
}
}
/* private function for getting some value from the phpBB database */
function phpBBQuery($query) {
global $dbhost, $dbname, $dbuser, $dbpasswd;
$value = false;
$database_id = mysql_connect( $dbhost, $dbuser, $dbpasswd );
mysql_select_db( $dbname, $database_id );
$query_result = mysql_query($query);
if ( ( $query_result != false ) && ( mysql_num_rows ( $query_result ) > 0 ) ) {
$value = mysql_fetch_row ( $query_result );
}
// mysql_close( $database_id );
return $value;
}
/* private function to check for existence of dataset in phpBB database */
function phpBBExists($query) {
return $this->phpBBQuery($query) != false;
}
}
// create authorization plugin instance
$wgAuth = new Auth_phpBB();
?>
dann ein paar Fragen noch:
ist das richtig, dass ich sogar als gast deine seiten bearbeiten kann?
rkern hat geschrieben:Bei mir läuft der phpBBAuth-Mod mit der Version 1.4.7. Auf die 1.5 Beta bin ich nicht umgestiegen, da ich vorsichtig bin.
mfg Ralph
Ich habe mich mal in Deinem Forum registriert. Was ich unkomfortabel finde, ist dass das Wiki bzw. das phpBB anscheinend unterschiedliche Cookies verwendet. Also man sich jeweils einloggen muss. Wie könnte man das noch vereinfachen. Hast du da eine Idee?
Wie sieht das denn bei wiki aus. kann da jeder, jede Seite editieren? Oder habe ich als Admin noch "Rechte"
http://wiki.maxrev.de
Ich kann ja schlecht jede Seite einzeln "schützen" bzw. wenn ein User unfähr wäre könnte er ja "ungeschützte" Beiträge einfach löschen oder nicht?
Auch gefällt mir derzeit das mit der Einstellungsseite nicht. Dort werden Daten angegeben wie E-Mail-Adresse, Passwort, etc. Die Felder sind aber leer. Welche Daten werden dort abgerufen?
Die Registrierung zu entfernen finde ich nicht passend. Besser fände ich eine Weiterleitung auf das "normale" Forum zu verwirklichen.
Auch bin ich etwas verwirrt. Wer ist denn alles Admin auf dem Wiki? Geht das nach phpBB Rechten oder wie bestimmt man dort Admin's bzw. Moderatoren? Denn ich kann ja auf den Spezialseiten einen neuen Admin festlegen. Nur welche Userdatenbank wird dann da verwendet
Wuppi hat geschrieben:
Ich kanns aktuell nicht testen - denke in 2-3 Wochen - hab von Forum und Wiki ne Testversion auf 2 Subdomains. Da kann ja nichts schief gehen ...
Gruß
Wuppi
Bei Dir scheint ja soweit alles zu gehen auch die Short Urls Funktion. Die bekomme ich nicht zum Laufen.
Wenn ich diesen Part in die .htaccess einfüge kommt ein internal server error:
Hast du auch diesen Mod dafür genommen?
http://meta.wikimedia.org/wiki/Using_a_very_short_URL