Revision [8026]

This is an old revision of WikkaWithphpBB made by OfficeRabbit on 2005-05-11 13:45:27.

 

This is a very simple hack to get Wikka to read from the users table of a phpBB database rather than its own. It is assuming that you have installed your Wikka into the same database as phpBB and that your phpBB tables are prefixed with "phpbb_" and that their names have not been edited.

This will allow users from your phpBB forum to login to your wiki with their existing username and password.

/Wikka.php
Find:
    function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".$this->config['table_prefix']."users where name = '".mysql_real_escape_string($name)."' ".($password === 0 ? "" : "and password = '".mysql_real_escape_string($password)."'")." limit 1"); }


Replace with:
 function LoadUser($name, $password = 0) { return $this->LoadSingle("select * from ".phpbb_."users where username = '".mysql_real_escape_string($name)."' ".($password === 0 ? "" : "and user_password = '".mysql_real_escape_string($password)."'")." limit 1"); }


Find:
 function LoadUsers() { return $this->LoadAll("select * from ".$this->config['table_prefix']."users order by name"); }


Replace with:
 function LoadUsers() { return $this->LoadAll("select * from ".phpbb_."users order by username"); }


Find:
 function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; }


Replace with:
 function GetUserName() { if ($user = $this->GetUser()) $name = $user["username"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; }


Find:
 function SetUser($user) { $_SESSION["user"] = $user; $this->SetPersistentCookie("wikka_user_name", $user["name"]); $this->SetPersistentCookie("wikka_pass", $user["password"]); }


Replace with:
 function SetUser($user) { $_SESSION["user"] = $user; $this->SetPersistentCookie("wikka_user_name", $user["username"]); $this->SetPersistentCookie("wikka_pass", $user["user_password"]); }


/handlers/page/acls.php
Find:
 print("<option value=\"".$this->htmlspecialchars_ent($user["name"])."\">".$user["name"]."</option>\n");


Replace with:
 print("<option value=\"".$this->htmlspecialchars_ent($user["username"])."\">".$user["username"]."</option>\n");
There are 30 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki