Wiki source for IntegrationWithphpBB3


Show raw source

<<
Sajaki has posted an updated PHPBB3 to WikkaWiki bridge here: https://github.com/Sajaki/Wikkamod
<<
::c::

=====Integrating Wikka into PHPBB 3.x=====

====Introduction====

I'm running a phpBB Forum with a lot of users and would like to have an additional Wiki documentation and a few generic pages. They should look like normal pages and only very few users need access to the wiki behind it (edit, revisions etc.) Most of the Users only need read access but on different hierarchical levels which correlate with the forum hierarchy, so I want to use my Forumgroups for access control.

There are already two Solutions for this Problem
- WikkaWithphpBB / WikkaWithphpBB3
- UrduWeb
The first one reads the phpBB usertable and enables forumusers to login into wikka, but you have to log in into both systems, they look different and you have to manage permissions in both systems. In short: You have two systems running in parallel instead of one bigger system.
The second seems to go a step further but unfortunately the English page of the website is not reachable anymore and neither Google, nor any of the people around me can translate the Urdu version into a language I can understand. So there is no way for me to get these files.

So I have to pick up the first solution and modify it for my needs. Here is what I want:
- phpBB takes full responsibility for User management (Register, Log in, Log out, Change Profile, etc.)
- Output the Wiki through the phpBB Template System (So you can change your global layout at a central place and everything looks equal)
- Using phpBB Groups to controll Access to wikipages
- Separation between Wikka and phpBB files

As I am very familiar with phpBB but quite new to Wikka I will try to put Wikka into phpBB and not the other way round.
So lets start!

====Versions:====
**Wikka:** 1.2 (other versions //might// work as well)
**phpBB:** 3.0.7-PL1 (all versions with major release 3.0 //should// work, newer major releases (e.g. 3.1.*) //might// work. phpBB2 or phpBB4 //won't// work without modification)

At the time of writing (2010-04-23) these are the newest stable Versions.

====Files====
Download a phpBB Release and unzip it to your document root (I will use / to reffer to this folder from now on). Get a Wikka Release and unzip it in a subfolder called /wikka. Run both Setups.

===/wikka/wikka.php===
Find:
%%(php)
/**
* Start session.
*/
$base_url_path = preg_replace('/wikka\.php/', '', $_SERVER['SCRIPT_NAME']);%%
Replace With:
%%(php)
/**
* Start session.
*/
/* BEGIN phpBB3 Integration
* original: $base_url_path = preg_replace('/wikka\.php/', '', $_SERVER['SCRIPT_NAME']);
*/
$base_url_path = preg_replace('/wiki\.php/', '', $_SERVER['SCRIPT_NAME']);
// END phpBB3 Integration%%

Find:
%%(php)
/**
* Save session ID
*/
$user = $wakka->GetUser();%%
Afterwards add:
%%(php)
// BEGIN phpBB3 Integration
// TODO I am pretty sure that one of the three following ifs is to much, but without them login does not work or the user keeps loggin in and our on every refresh
// If we have a user logged in, do the usernames of the both systems match?
if($phpbb_username != $wakka->getOwnBBName($user['name']))
{
// No, so prepare wikka to load the phpBB3 user
$user = NULL;
}

// Does wikka still needs a Usersession and the user is already logged in into phpBB3?
if(NULL == $user && $phpbb_username != 'anonymous')
{
// Yes, a phpBB3 user is logged in, but wikka dowsn't know yet. So change it!
$user = $wakka->LoadUser($wakka->getOwnWikkaName($phpbb_username));
// Did we load a user?
if(NULL != $user)
{
// Yes, let wikka log him in
$wakka->SetUser($user);
}
}

// Do we have a wikka user but there is no phpBB3 Session?
if(!$user_phpbb->data['is_registered'] && $user != NULL)
{
// Yes, let wikka perform a logout
$wakka->LogoutUser();
$user = NULL;
}
// END phpBB3 Integration%%

Find:
%%(php)
$etag = md5($content);
header('ETag: '.$etag);

header('Content-Length: '.$page_length);
ob_end_clean();

/**
* Output the page
*/
echo $page_output;
?>%%
Replace with:
%%(php)
/* BEGIN phpBB3 Integration
* original:
* $etag = md5($content);
* header('ETag: '.$etag);
* header('Content-Length: '.$page_length);
* END phpBB3 Integration */

ob_end_clean();

/**
* Output the page.
*/
/* BEGIN phpBB3 Integration
* original:
* echo $page_output;
* END phpBB3 Integration */
?>%%

====/wikka/actions/highscores.php====
(From: WikkaWithphpBB3 )

Find:
%%(php)
switch($rank)
{
case 'edits':
$label= 'edits';
$query = 'SELECT COUNT(*) AS cnt, `name` FROM '.$this->GetConfigValue('table_prefix').'users, '.$this->GetConfigValue('table_prefix').'pages WHERE `name` = `user` GROUP BY name ORDER BY cnt DESC LIMIT '.$limit;
$total = $this->getCount('pages');
break;

case 'comments':
$label= 'comments';
$query = 'SELECT COUNT(*) AS cnt, `name` FROM '.$this->GetConfigValue('table_prefix').'users, '.$this->GetConfigValue('table_prefix').'comments WHERE `name` = `user` GROUP BY name ORDER BY cnt DESC LIMIT '.$limit;
$total = $this->getCount('comments');
break;

default:
case 'pages':
$label= 'pages owned';
$query = 'SELECT COUNT(*) AS cnt, `name` FROM '.$this->GetConfigValue('table_prefix').'users, '.$this->GetConfigValue('table_prefix').'pages WHERE `name` = `owner` AND `latest` = "Y" GROUP BY name ORDER BY cnt DESC LIMIT '.$limit;
$total = $this->getCount('pages', "`latest` = 'Y'");
break;
}%%
Replace with:
%%(php)
/* BEGIN phpBB3 Integration
* original:
* switch($rank)
* {
* case 'edits':
* $label= 'edits';
* $query = 'SELECT COUNT(*) AS cnt, `name` FROM '.$this->GetConfigValue('table_prefix').'users, '.$this->GetConfigValue('table_prefix').'pages WHERE `name` = `user` GROUP BY name ORDER BY cnt DESC LIMIT '.$limit;
* $total = $this->getCount('pages');
* break;
*
* case 'comments':
* $label= 'comments';
* $query = 'SELECT COUNT(*) AS cnt, `name` FROM '.$this->GetConfigValue('table_prefix').'users, '.$this->GetConfigValue('table_prefix').'comments WHERE `name` = `user` GROUP BY name ORDER BY cnt DESC LIMIT '.$limit;
* $total = $this->getCount('comments');
* break;
*
* default:
* case 'pages':
* $label= 'pages owned';
* $query = 'SELECT COUNT(*) AS cnt, `name` FROM '.$this->GetConfigValue('table_prefix').'users, '.$this->GetConfigValue('table_prefix').'pages WHERE `name` = `owner` AND `latest` = "Y" GROUP BY name ORDER BY cnt DESC LIMIT '.$limit;
* $total = $this->getCount('pages', "`latest` = 'Y'");
* break;
* }
*/
/**
* Contributed by Paul Young, using the example code by JeremyCoates
* see http://wikkawiki.org/WikkaWithphpBB3
*/
switch($rank)
{
case 'edits':
$label= 'edits';
$query = 'SELECT COUNT(*) AS cnt, `username` AS name FROM phpbb3_users '.$this->GetConfigValue('table_prefix').'pages WHERE `username` = `user` GROUP BY username ORDER BY cnt DESC LIMIT '.$limit;
$total = $this->getCount('pages');
break;

case 'comments':
$label= 'comments';
$query = 'SELECT COUNT(*) AS cnt, `username` AS name FROM phpbb3_users '.$this->GetConfigValue('table_prefix').'comments WHERE `username` = `user` GROUP BY username ORDER BY cnt DESC LIMIT '.$limit;
$total = $this->getCount('comments');
break;

default:
case 'pages':
$label= 'pages owned';
$query = 'SELECT COUNT(*) AS cnt, `username` AS name FROM phpbb3_users '.$this->GetConfigValue('table_prefix').'pages WHERE `username` = `owner` AND `latest` = "Y" GROUP BY username ORDER BY cnt DESC LIMIT '.$limit;
$total = $this->getCount('pages', "`latest` = 'Y'");
break;
}
// END phpBB3 Integration%%

===/wikka/actions/usersetting.php===
(From: WikkaWithphpBB3 )

Find:
%%(php)
default: // input is valid
$this->Query('UPDATE '.$this->config['table_prefix'].'users SET '.
"email = '".mysql_real_escape_string($email)."', ".
"doubleclickedit = '".mysql_real_escape_string($doubleclickedit)."', ".
"show_comments = '".mysql_real_escape_string($show_comments)."', ".
"revisioncount = '".mysql_real_escape_string($revisioncount)."', ".
"changescount = '".mysql_real_escape_string($changescount)."', ".
"theme = '".mysql_real_escape_string($usertheme)."' ".
"WHERE name = '".$user['name']."' LIMIT 1");
$this->SetUser($this->LoadUser($user["name"]));

// forward
$params .= 'stored=true';
$this->Redirect($url.$params);%%
Replace with:
%%(php)
default: // input is valid
/* BEGIN phpBB3 Integration
* original:
* $this->Query('UPDATE '.$this->config['table_prefix'].'users SET '.
* "email = '".mysql_real_escape_string($email)."', ".
* "doubleclickedit = '".mysql_real_escape_string($doubleclickedit)."', ".
* "show_comments = '".mysql_real_escape_string($show_comments)."', ".
* "revisioncount = '".mysql_real_escape_string($revisioncount)."', ".
* "changescount = '".mysql_real_escape_string($changescount)."', ".
* "theme = '".mysql_real_escape_string($usertheme)."' ".
* "WHERE name = '".$user['name']."' LIMIT 1");
*/
$tmpUser = $this->LoadUser($user['name']);
if (is_null($tmpUser['show_comments'])) {
$this->Query("INSERT INTO ".$this->config['table_prefix']."users SET ".
"signuptime = '".mysql_real_escape_string($user['signuptime'])."',".
"name = '".mysql_real_escape_string($user['name'])."', ".
"email = '".mysql_real_escape_string($user['email'])."'");
}
// END phpBB3 Integration

$this->SetUser($this->LoadUser($user["name"]));

// forward
$params .= 'stored=true';
$this->Redirect($url.$params);%%

===/wikka/libs/Wakka.class.php===
(With parts from: WikkaWithphpBB3 )

Find:
%%(php) // USERS
/* BEGIN phpBB3 Integration
* original:
* 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"); }
* function LoadUsers() { return $this->LoadAll("select * from ".$this->config['table_prefix']."users order by name"); }
*/
/**
* Contributed by Paul Young, using the example code by JeremyCoates
* see http://wikkawiki.org/WikkaWithphpBB3
*/
function LoadUser($name, $password = 0) {
$user = $this->LoadSingle("SELECT " .
"CONCAT('".$this->config['user_prefix']."', p.username_clean) as name, " .
"p.user_password as password, " .
"p.user_email as email, " .
"p.user_regdate as signuptime, " .
"w.revisioncount, " .
"w.changescount, " .
"w.doubleclickedit, " .
"w.show_comments " .
"FROM ".phpbb3_."users p " .
"left join " . $this->config['table_prefix'] . "users w ON p.username = w.name " .
"WHERE p.username_clean = '".mysql_real_escape_string($this->getOwnBBName($name))."' and p.user_type != 1 limit 1");
// If we have a signuptime, format it!
if (isset($user['signuptime'])) {
$user['signuptime'] = date('Y-m-d H:i:s', $user['signuptime']);
}
return $user;
}

/**
* Contributed by Paul Young, using the example code by JeremyCoates
* see http://wikkawiki.org/WikkaWithphpBB3
*/
function LoadUsers() {
$users = $this->LoadAll("SELECT " .
"CONCAT('".$this->config['user_prefix']."', p.username_clean) as name, " .
"p.user_password as password, " .
"p.user_email as email, " .
"p.user_regdate as signuptime, " .
"w.revisioncount, " .
"w.changescount, " .
"w.doubleclickedit, " .
"w.show_comments " .
"FROM ".phpbb3_."users p " .
"left join " . $this->config['table_prefix'] . "users w ON CONCAT('".$this->config['user_prefix']."', p.username_clean) = w.name " .
"WHERE p.user_type != 1 AND p.user_type != 2 " .
"ORDER BY username");

foreach ($users as $key => $user) {
// If we have a signuptime, format it!
if (isset($user['signuptime'])) {
$user['signuptime'] = date('Y-m-d H:i:s', $user['signuptime']);
}
// Save the changes into the array
$users[$key] = $user;
}
return $users;
}

/**
* Transform a Wikka Username into a phpBB Username (remove the user_prefix)
*/
function getOwnBBName($name)
{
$ret = substr($name, strlen($this->config['user_prefix']));
//die('getOwnBBName('.$name.') =- '.$ret);
return $ret;
}

/**
* Transform a phpBB Username into a Wikka Username (add the user_prefix)
*/
function getOwnWikkaName($name)
{
return ($this->config['user_prefix'].$name);
}

/**
* Returns wether user $who is a confirmed Member of the phpBB3 Group $group ir not
* @return true => Member, false => Not Member
*/
function isGroupMember($who, $group)
{
$who = $this->getOwnBBName($who);

$sql = 'SELECT ' .
'u.user_id ' .
'FROM ' .
$this->config["group_table"] . ' as g, ' .
$this->config["user_group_table"] . ' as ug, ' .
$this->config["user_table"] . ' as u ' .
'WHERE ' .
'g.group_id = ug.group_id AND ' .
'ug.user_id = u.user_id AND ' .
'u.username_clean = \''.strtolower($who).'\' AND ' .
'ug.user_pending = 0 AND ' .
'LOWER(g.group_name) = \''.strtolower($group).'\'';

return (NULL !== $this->LoadSingle($sql));
}
// END phpBB3 Integration%%

Find:
%%(php)
function GetUser() { return (isset($_SESSION["user"])) ? $_SESSION["user"] : NULL; }%%
Replace with:
%%(php)
/* BEGIN phpBB3 Integration
* original:
* function GetUser() { return (isset($_SESSION["user"])) ? $_SESSION["user"] : NULL; }
*/
function GetUser() { global $phpbb_username; return ($phpbb_username != 'anonymous') ? $this->LoadUser($this->getOwnWikkaName($phpbb_username)) : NULL ;}
// END phpBB3 Integration%%

Find:
%%(php)
case "+":
// return ($registered) ? !$negate : false;
return ($registered) ? !$negate : $negate;
// aha! a user entry.
default:
if ($line == $user)
{
return !$negate;
}%%
Replace with:
%%(php)
case "+":
// return ($registered) ? !$negate : false;
return ($registered) ? !$negate : $negate;
// BEGIN phpBB3 Integration
// group name
case "~":
return ($this->isGroupMember($user, substr($line, 1))) ? !$negate : $negate;
// END phpBB3 Integration
// aha! a user entry.
default:
if ($line == $user)
{
return !$negate;
}%%

===/wikka/plugins/template/default/footer.php===
Create /wikka/plugins/templates/default/ . Copy all folders inside /wikka/templates/default/ to /wikka/plugins/templates/default/ . Create the file footer.php with the following content:
%%(php)
<!-- BEGIN PAGE FOOTER -->
<div id="footer">
<?php
//page generation start
global $tstart;
echo $this->MakeMenu('options_menu');
$wikka_patch_level = ($this->GetWikkaPatchLevel() == '0') ? '' : '-p'.$this->GetWikkaPatchLevel();
?>
</div>
<!-- END PAGE FOOTER -->
<!-- BEGIN SYSTEM INFO -->
<!-- END SYSTEM INFO -->
<?php
if ($this->GetConfigValue('sql_debugging'))
{
echo '<div class="smallprint"><strong>Query log:</strong><br />'."\n";
foreach ($this->queryLog as $query)
{
echo $query['query'].' ('.$query['time'].')<br />'."\n";
}
echo '</div>'."\n";
}
echo '<!--'.sprintf(PAGE_GENERATION_TIME, $this->microTimeDiff($tstart)).'-->'."\n";
?>
</div>
<!-- END PAGE WRAPPER -->%%

===/wikka/plugins/templates/default/header.php===
Create the file with the following content:
%%(php)
<?php
$message = $this->GetRedirectMessage();
$user = $this->GetUser();
$site_base = $this->GetConfigValue("base_url");
if ( substr_count($site_base, 'wikka.php?wakka=') > 0 ) $site_base = substr($site_base,0,-16);
?>
<?php
if ($this->GetMethod() != 'edit')
{
$rsslink = ' <link rel="alternate" type="application/rss+xml" title="'.$this->GetWakkaName().': revisions for '.$this->tag.' (RSS)" href="'.$this->Href('revisions.xml', $this->tag).'" />'."\n";
$rsslink .= ' <link rel="alternate" type="application/rss+xml" title="'.$this->GetWakkaName().': recently edited pages (RSS)" href="'.$this->Href('recentchanges.xml', $this->tag).'" />'."\n";
//echo $rsslink;
}
?>
<!-- BEGIN PAGE WRAPPER -->
<div id="page">
<?php
//display system messages
if (isset($message) && strlen($message)>0)
{
echo '<div class="success">'.$message.'</div>';
}
?>
<!-- BEGIN PAGE HEADER -->
<div id="header">
<h2><a id="homepage_link" href="<?php echo $this->href('', $this->config['root_page'], ''); ?>"><?php echo $this->config['wakka_name'];?></a> : <a href="<?php echo $this->href('backlinks', '', ''); ?>" title="Display a list of pages linking to <?php echo $this->tag ?>"><?php echo $this->GetPageTag(); ?></a></h2>
<?php echo $this->MakeMenu('main_menu'); ?>
</div>
<br style="clear:both;" />
<!-- END PAGE HEADER -->%%

===/wikka/plugins/templates/default/css/*.css===
As we are pushing the wikka output through the phpBB Output we will have overlapping CSS IDs like #header. To prevent this we have to put the wiki output into a wrapper and mask all CSS Definitions by Wikka to only be active as a subitem of our wrapper.

Inside the css folder delete all global Elements and append a #wikiwrapper before any id-referrence in every css file.
Original wikka.css (just the first lines):
%%(css)
body {
font-family: "Lucida Grande", "Lucida Sans Unicode", "DejaVu Sans", Verdana, sans-serif;
font-size: 13px;
line-height: 20px;
color: #000000;
background-color: #F8F8F8;
margin: 0;
/* text-align: justify; */ /* comment out this line if you really need justified text */
}

#page {
}

#header {
position: relative; /* needed for the correct positioning of system messages */
padding: 10px 10px 0 10px;
}

#content {
clear: both;
color: #000;
background-color: white;
padding: 15px;
border: 1px solid #CCC;
}

#footer {
background-color: #EAEAEA;
border-bottom: 1px solid #CCC;
padding: 0 10px;
height: 25px;
}
...%%

wikka.css with Modification (full file):
%%(css)
/*
-----------------------------------------------
Wikka Default Stylesheet (screen)
----------------------------------------------- */

/* page layout */

/*

#page {
}

#wikiwrapper #header {
position: relative; /* needed for the correct positioning of system messages */
padding: 10px 10px 0 10px;
}
*/


#wikiwrapper #content {
clear: both;
color: #000;
background-color: white;
padding: 15px;
border: 1px solid #CCC;
}



#wikiwrapper #footer {
background-color: #EAEAEA;
border-bottom: 1px solid #CCC;
padding: 0 10px;
height: 25px;
}

#wikiwrapper #smallprint {
clear: both;
float: right;
font-size: 0.8em;
color: #777;
padding-right: 0.5%;
text-align: right;
}

/* comments */

#wikiwrapper #comments {
border-bottom: 1px solid #CCC;
}

#wikiwrapper #commentheader {
clear: both;
background-color: #DDD;
padding: 2px 10px;
border-left: 1px solid #CCC;
border-right: 1px solid #CCC;
border-top: none;
}

#wikiwrapper #commentlist {}

.comment {
background-color: #EEE;
padding: 10px;
border-left: 1px solid #CCC;
border-right: 1px solid #CCC;
border-top: 1px solid #CCC;
border-bottom: 1px solid #EEE;
}

#wikiwrapper .commentinfo {
color: #AAA;
}

#wikiwrapper #commentform {
background-color: #EEE;
padding: 10px;
border-left: 1px solid #CCC;
border-right: 1px solid #CCC;
border-top: 1px solid #CCC;
}

/* links */

#wikiwrapper a {
color: #339;
text-decoration: none;
}

#wikiwrapper a:visited {
text-decoration: none;
}

#wikiwrapper a:hover {
color: #933;
}

#wikiwrapper a:active {
text-decoration: none;
}

#wikiwrapper a.ext {
color: #339;
}

#wikiwrapper a.ext:hover {
color: #933;
}

/* link icons */

#wikiwrapper #content a.ext {
background: url('../images/ext_simple.gif') left bottom no-repeat;
padding-left: .8em;
}

#wikiwrapper #content a.mailto {
background: url('../images/mail.gif') left bottom no-repeat;
padding-left: .9em;
}

#wikiwrapper #content a.interwiki {
background: url('../images/ext.gif') left bottom no-repeat;
padding-left: 1em;
}

#wikiwrapper a.user, a.user:hover {
background: url('../images/user.gif') left bottom no-repeat;
padding-left: 1em;
}
#wikiwrapper #header a:hover {
color: #933;
background: transparent;
border-bottom: 0px;
}

#wikiwrapper a#homepage_link {
color: #000;
}

#wikiwrapper #content a {
text-decoration: none;
}

#wikiwrapper #content a:hover {
color: #933;
text-decoration: underline;
}

#wikiwrapper #content a.keys:hover {
text-decoration: none;
color: #333;
}

/* lists */

#wikiwrapper ul, ol {
margin-top: 0px;
margin-bottom: 0px;
padding-top: 0px;
padding-bottom: 0px;
}

#wikiwrapper ul.thread {
list-style-type: none;
border-left: 2px #666 solid;
padding-left: 10px;
margin: 5px 0px;
}

#wikiwrapper ul.thread li {
color: #333;
font-size: 11px;
}

/* images */

#wikiwrapper img {
border: 0px;
}

#wikiwrapper img.centre {
display: block;
text-align: center;
margin: 5px auto;
}

#wikiwrapper img.center {
display: block;
text-align: center;
margin: 5px auto;
}

#wikiwrapper img.left {
margin: 5px 5px 5px -5px;
float: left;
}

#wikiwrapper img.right {
margin: 5px -5px 5px 5px;
float: right;
}

#wikiwrapper img.icon {
border: 0px;
vertical-align: middle;
}

/* floats */

#wikiwrapper .floatl {
float: left;
text-align: left;
width: 46%;
margin-right: 15px;
padding: 4px;
background: #EEE;
border: 1px solid #CCC;
}

#wikiwrapper .floatr {
float: right;
text-align: left;
width: 46%;
margin-left: 15px;
padding: 4px;
background: #EEE;
border: 1px solid #CCC;
}

/* simply left-float element */
#wikiwrapper .left {
float:left;
}

/* simply right-float element */
#wikiwrapper .right {
float:right;
}

#wikiwrapper .clear {clear:both;}

/* text formatting */

#wikiwrapper h1, h2, h3, h4, h5 {
font-family: Georgia, "DejaVu Serif", Times, serif;
font-weight: normal;
margin: 0px;
padding: 0px;
}

#wikiwrapper #content h5 {
margin-bottom: 4pt;
font-size: 12pt;
}

#wikiwrapper #content h4 {
margin-bottom: 5pt;
font-size: 14pt;
}

#wikiwrapper #content h3 {
font-size: 16pt;
margin-bottom: 6pt;
}

#wikiwrapper #content h2 {
font-size: 18pt;
margin-bottom: 8pt;
}

#wikiwrapper #content h1 {
font-size: 20pt;
margin-bottom: 10pt;
}

#wikiwrapper #header h2 {
font-size: 18pt;
padding: .3em 0;
}

#wikiwrapper tt {
color: #666;
}

#wikiwrapper .hidden {
display: none;
}

#wikiwrapper .wikisource {
font-family: monospace;
font-size: 1.1em;
color: #666;
background-color: #F9F9F9;
border: 1px solid #CCC;
padding: 1em;
margin-bottom: .5em;
}

#wikiwrapper .highlight {color: red; background: #FFFFD0;}

#wikiwrapper .strikethrough {color: #888; text-decoration: line-through;}

#wikiwrapper .underline {text-decoration: underline;}

#wikiwrapper .indent {
margin-left: 40px;
}

#wikiwrapper .notes {
color: #880;
}

#wikiwrapper .help {
cursor: help;
}

#wikiwrapper .centre {text-align: center;}

#wikiwrapper .center, .center p {text-align: center;}

#wikiwrapper .keys {
color: #666;
background-color: #DDD;
font: normal 95% Verdana, sans-serif;
text-align: center;
border-top: 1px solid #FFF;
border-left: 1px solid #FFF;
border-right: 1px solid #AAA;
border-bottom: 1px solid #AAA;
padding: .1em .2em;
}

#wikiwrapper .keys:hover {
color: #555;
background-color: #CCC;
border-top: 1px solid #FFF;
border-left: 1px solid #FFF;
border-right: 1px solid #999;
border-bottom: 1px solid #999;
}

#wikiwrapper acronym {
border-bottom: 1px dotted #333;
cursor: help;
}

#wikiwrapper abbr {
border-bottom: 1px dotted #333;
cursor: help;
}

#wikiwrapper blockquote {
font-size: 90%;
}

#wikiwrapper hr {
border: 0;
border-top: 1px solid #EEE;
}

#wikiwrapper .disabled {
color: #AAA;
}

/* code blocks */

#wikiwrapper .code_header {
color: #336;
background-color: #D0E0F0;
border-top: 1px solid #AAC;
border-right: 1px solid #AAC;
border-left: 1px solid #AAC;
border-bottom: none;
font-family: Verdana, Arial, sans-serif;
font-size: 100%;
padding: 0 3px;
margin: 5px auto 0 auto;
text-align: left;
line-height: 1.5em;
}

#wikiwrapper .code {
color: black;
background: #F3F3FF;
border: 1px solid #AAC;
font-size: 11px;
font-family: "Lucida Console", Monaco, monospace;
margin: auto;
padding: 6px 5px 13px 5px; /* padding-bottom solves hor. scrollbar hiding single line of code in IE6 but causes vert. scrollbar... */
text-align: left; /* override justify on body */
overflow: auto; /* allow scroll bar in case of long lines - goes together with white-space: nowrap! */
white-space: nowrap; /* prevent line wrapping */
}

#wikiwrapper .code pre {
margin-top: 6px;
margin-bottom: 6px; /* prevent vertical scroll bar in case of overflow */
font-size: 11px;
font-family: "Lucida Console", Monaco, monospace;
}

/* form elements */

#wikiwrapper form {
margin: 0px;
padding: 0px;
}

#wikiwrapper fieldset {
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid #CCC;
}

#wikiwrapper fieldset legend {
font-size: 115%;
color: #666;
padding:2px;
}

#wikiwrapper textarea {
border: 1px solid #CCC;
}

#wikiwrapper textarea:hover {
background-color: #F3F3F3;
}

#wikiwrapper textarea:focus {
background-color: #E6E6FF;
}

#wikiwrapper input {
border: 1px solid #CCC;
}

#wikiwrapper input:hover {
background-color: #F3F3F3;
}

#wikiwrapper input:focus {
background-color: #E6E6FF;
}

#wikiwrapper input[type=hidden] {
display: none;
}

#wikiwrapper input[type=submit], input[type=button] {
color: #666;
background-color: #EEE;
font: normal 95% Verdana, sans-serif;
text-align: center;
border-top: 1px solid #FFF;
border-left: 1px solid #FFF;
border-right: 1px solid #AAA;
border-bottom: 1px solid #AAA;
padding: .1em .2em;
}

#wikiwrapper input[type=submit]:hover, input[type=button]:hover {
color: #333;
background-color: #DDD;
border-top: 1px solid #FFF;
border-left: 1px solid #FFF;
border-right: 1px solid #999;
border-bottom: 1px solid #999;
}

/* editor textarea decorations */
/* (decorations can't be in "textarea#body" declaration, else the "width:100%" won't work) */
#wikiwrapper #textarea_container {
border: 1px solid #CCC;
padding: 2px;
margin-bottom: 2px;
}

#wikiwrapper textarea#body{
width: 100%;
height: 500px;
/* padding and border must be 0 for the "width:100%" to work */
padding: 0;
border: 0;
}

#wikiwrapper .searchbox {
/* border: none; */
border: 1px solid #CCA;
padding: 0px;
margin: 0px;
}

#wikiwrapper input.grabcode {
float: right;
margin-top: 0px;
font-size: 90%;
}

#wikiwrapper input.highlight {
font-weight: normal;
background-color: #FCC;
color: #000;
}

/* system information */

#wikiwrapper .datetime {
color: #666;
font-size: 80%;
font-family: "Lucida Console", Monaco, monospace;
}

#wikiwrapper .missingpage {
/* background: #ccffff; */
text-decoration: none;
border-bottom-width: 1px;
border-bottom-color: #933;
border-bottom-style: dashed;
}

/* inline system messages */
#wikiwrapper em.error {
color: #A33;
font-style: normal;
font-weight: bold;
font-size: 95%;
}

#wikiwrapper em.success {
color: #3A3;
font-style: normal;
font-weight: bold;
font-size: 95%;
}

/* redirection messages */

#wikiwrapper div.success {
position: fixed;
top: 6em;
right: 1.5em;
max-width: 40%;
border: 2px solid #3A3;
padding: .2em .4em;
color: #3A3;
background-color: #EFE;
font-style: normal;
font-weight: bold;
font-size: 90%;
}

#wikiwrapper .comments {display: none;}

#wikiwrapper .revisioninfo {
color: #000000;
background-color: #E9F9E9;
border: 1px solid #ACA;
padding: 5px 10px;
font-size: 90%;
margin-bottom: 1em;
}

#wikiwrapper .copyright {
font-size: 11px;
color: #AAA;
text-align: right;
}

#wikiwrapper .copyright a {
color: #AAA;
}

#wikiwrapper .previewhead {
margin: auto;
z-index:20;
position:fixed;
top: 80px;
left: 10px;
color: red;
font-size: xx-large;
font-weight: bold;
padding: 5px;
}

#wikiwrapper ins {
background-color: #CFC;
text-decoration: none;
}

#wikiwrapper del {
color: #876;
background-color: #FC9;
text-decoration: none;
}

#wikiwrapper .recentchanges {font-size: 0.9em;}

#wikiwrapper .pagenote {color: #888;}

#wikiwrapper .smaller {font-size: smaller;}

#wikiwrapper #smallprint a {
color: #987;
}

/* sort order information in sortable lists and tables*/
#wikiwrapper .sortorder {
font-size: 70%;
text-transform: uppercase;
letter-spacing: 1px;
}

/* debug messages */
#wikiwrapper .debug {
color: #AAA;
font-size: 70%;
text-transform: uppercase;
letter-spacing: 1px;
}


/* Tables */
#wikiwrapper table.data {
border: 2px solid #CCC;
border-collapse: collapse;
border-spacing: 0;
}

#wikiwrapper table.data caption {
border: 1px solid #CCC;
font-size: 95%;
color: #666;
margin:5px 0;
padding:2px;
}

#wikiwrapper table.data thead {
background-color: #DDD;
}

#wikiwrapper table.data tfoot {
background-color: #DDD;
}

#wikiwrapper table.data th {
border: 1px solid #CCC;
padding: .1em .25em;
}

#wikiwrapper table.data thead th {
background-color: #DDD;
}

#wikiwrapper table.data tfoot th {
background-color: #DDD;
}

#wikiwrapper table.data tbody th {
background-color: #EEE;
}

#wikiwrapper table.data tbody tr:hover {
background-color: #E9E9F9;
}

#wikiwrapper table.data tbody tr.alt:hover {
background-color: #E9E9F9;
}

#wikiwrapper table.data td {
border: 1px solid #CCC;
padding: .1em .25em;
}

#wikiwrapper table.data td.number {
text-align: right;
}

#wikiwrapper table.data td.datetime {
text-align: right;
white-space: nowrap;
}

/* --- alternate row & column color --- */

#wikiwrapper table.data tr.alt {
background-color: #EEE;
}

#wikiwrapper table.data th.c1 {
background-color: #CDD;
}

#wikiwrapper table.data th.c2 {
background-color: #DCC;
}

#wikiwrapper table.data th.c3 {
background-color: #DDC;
}

#wikiwrapper table.data th.c4 {
background-color: #CDC;
}

#wikiwrapper table.data th.c5 {
background-color: #CCD;
}

#wikiwrapper table.data th.c6 {
background-color: #DCD;
}

#wikiwrapper table.data td.c1 {
background-color: #EFF;
}

#wikiwrapper table.data td.c2 {
background-color: #FEE;
}

#wikiwrapper table.data td.c3 {
background-color: #FFE;
}

#wikiwrapper table.data td.c4 {
background-color: #EFE;
}

#wikiwrapper table.data td.c5 {
background-color: #EEF;
}

#wikiwrapper table.data td.c6 {
background-color: #FEF;
}

#wikiwrapper table.data tr.alt td.c1 {
background-color: #DEE;
}

#wikiwrapper table.data tr.alt td.c2 {
background-color: #EDD;
}

#wikiwrapper table.data tr.alt td.c3 {
background-color: #EED;
}

#wikiwrapper table.data tr.alt td.c4 {
background-color: #DED;
}

#wikiwrapper table.data tr.alt td.c5 {
background-color: #DDE;
}

#wikiwrapper table.data tr.alt td.c6 {
background-color: #EDE;
}

/* Action-related styling */

/* Adminpages action */

#wikiwrapper table#adminpages {
border: 1px solid #CCC;
width: 100%;
}

#wikiwrapper table#adminpages td.actions {
text-align: center;
font-size: 70%;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

#wikiwrapper form#form_page_admin_panel fieldset {
line-height: 2em;
}

/* Adminuser action */

#wikiwrapper table#adminusers {
border: 1px solid #CCC;
width: 100%;
}

#wikiwrapper table#adminusers td.actions {
text-align: center;
font-size: 70%;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

#wikiwrapper form#form_user_admin_panel fieldset {
line-height: 2em;
}

/* Lastedit action */
#wikiwrapper .lastedit {
border:dotted 1px;
padding:3pt;
margin:8pt; color:#888;
font-size:8pt;
width:30%;
}

#wikiwrapper .lastedit_notes {
color: #880;
}

/* TextSearch & TextSearchExpanded Actions*/
#wikiwrapper .tse_keywords {
font-weight: bold;
color: green;
background-color: #FAEBD7;
}

/* Calendar Action */
#wikiwrapper table.calendar {
color: #000;
background-color: #EEE;
border-collapse: collapse;
}

#wikiwrapper table.calendar caption {
border: 1px solid #CCC;
margin:5px 0;
font-size: 95%;
color: #666;
padding:2px;
}

#wikiwrapper table.calendar thead {
border: 2px solid #CCC;
background-color: #DDD;
}

#wikiwrapper table.calendar tbody.face {
background-color: #EEE;
border: 2px solid #CCC;
}

#wikiwrapper table.calendar tbody.calnav {
background-color: #FFF;
}

#wikiwrapper table.calendar thead th {
border: 1px solid #CCC;
padding: 1px;
text-align: center;
font-size: 85%;
width: 26px;
}

#wikiwrapper table.calendar tbody.face td {
border: 1px solid #CCC;
text-align: right;
}

#wikiwrapper table.calendar td.currentday {
color: #FFF;
background-color: #33A;
}

#wikiwrapper table.calendar tbody.face td:hover {
background-color: #DDD;
}

#wikiwrapper table.calendar tbody.face td.currentday:hover {
color: #FFF;
background-color: #66C;
}

#wikiwrapper table.calendar tbody.calnav {
font-weight: bold;
}

#wikiwrapper table.calendar td.prevmonth {
text-align: left;
font-size: 85%;
}

#wikiwrapper table.calendar td.curmonth {
text-align: center;
}

#wikiwrapper table.calendar td.nextmonth {
text-align: right;
font-size: 85%;
}

#wikiwrapper table.calendar a:link {
color: #339;
text-decoration: none;
}

#wikiwrapper table.calendar a:visited {
color: #339;
text-decoration: none;
}

#wikiwrapper table.calendar a:hover {
color: #933;
}

#wikiwrapper table.calendar a:active {
color: #339;
text-decoration: none;
}

/* Usersettings action */
#wikiwrapper table.usersettings {
}

/* Wikkaconfig action */
#wikiwrapper table.wikkaconfig {
width: 70%;
font-size: 90%;
}

#wikiwrapper table.wikkaconfig caption {
font-size: 120%;
background-color: #E9E9F9;
padding: 5px;
}

#wikiwrapper table.wikkaconfig tbody th[scope=row] {
text-align: right;
padding-right: 5px;
}

#wikiwrapper table.wikkaconfig tbody td {
padding-left: 5px;
}


/* Handler-related styling */

/* Acls handler */
#wikiwrapper table.acls {
}

/* 3rdparty-code related styling */

/* syntax highlighting code - GeSHi */
#wikiwrapper .code ol {
margin-top: 6px;
margin-bottom: 6px; /* prevent vertical scroll bar in case of overflow */
}
#wikiwrapper .code li {
font-size: 11px;
font-family: "Lucida Console", Monaco, monospace;
}
#wikiwrapper .code .br0 { color: #6C6; }
#wikiwrapper .code .co1 { color: #808080; font-style: italic; }
#wikiwrapper .code .co2 { color: #808080; font-style: italic; }
#wikiwrapper .code .coMULTI { color: #808080; font-style: italic; }
#wikiwrapper .code .es0 { color: #009; font-weight: bold; }
#wikiwrapper .code .kw1 { color: #b1b100; }
#wikiwrapper .code .kw2 { color: #000; font-weight: bold; }
#wikiwrapper .code .kw3 { color: #006; }
#wikiwrapper .code .kw4 { color: #933; }
#wikiwrapper .code .kw5 { color: #00F; }
#wikiwrapper .code .me0 { color: #060; }
#wikiwrapper .code .nu0 { color: #C6C; }
#wikiwrapper .code .re0 { color: #00F; }
#wikiwrapper .code .re1 { color: #00F; }
#wikiwrapper .code .re2 { color: #00F; }
#wikiwrapper .code .re4 { color: #099; }
#wikiwrapper .code .sc0 { color: #0BD; }
#wikiwrapper .code .sc1 { color: #DB0; }
#wikiwrapper .code .sc2 { color: #090; }
#wikiwrapper .code .st0 { color: #F00; }

/* wikiedit */

#wikiwrapper .toolbar tr { background: ButtonFace; }
#wikiwrapper .toolbar .btn-, .toolbar .btn-hover, .toolbar .btn-active,
.toolbar .btn-pressed {
background: ButtonFace;
color: ButtonText;
border: 1px solid ButtonFace;
padding: 1px;
margin: 0px;
cursor: pointer;
}
#wikiwrapper .toolbar .btn- img { width: 20px; height: 20px; }
#wikiwrapper .toolbar .btn-hover { border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; }
#wikiwrapper .toolbar .btn-active,
.toolbar .btn-pressed { border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; }
#wikiwrapper .toolbar .btn-pressed { background: ButtonHighlight; }
#wikiwrapper .editornamecss { background-color:#CCCCFF; font-size: 18px; padding: 0 10px; }

/* menus */


#wikiwrapper ul#main_menu {
margin-top: 10px;
text-align: left;
list-style-type: none;
padding: 0px;
}

#wikiwrapper ul#main_menu li {
float: left;
width: auto;
text-align: left;
padding: 2pt;
}

#wikiwrapper ul#main_menu li+li:before {
content: " :: ";
}

#wikiwrapper ul#options_menu {
padding: 5px 10px;
text-align: left;
list-style-type: none;
padding: 0px;
}

#wikiwrapper ul#options_menu li {
float: left;
width: auto;
text-align: left;
padding: 2pt;
margin-right: 15px;
}

#wikiwrapper ul#main_menu li form {
display: inline;
}

#wikiwrapper ul#main_menu li input {
font-weight: bold;
border: none;
border-bottom: 2px solid #CCC;
background-color: transparent;
}

*/%%

If you want to use more than one wikilayout, repeat these steps with every template.

===/wikka/wikka.config.php===
I will only post the relevant options, please change the other options according to your needs.

|=|Option|=|Value|=|Comment|=|
||base_url||[[http://example.com/wiki.php?wakka=]]||Change wakka.php to wiki.php and insert your domain/path||
||theme||default||If you prepared more templates with the steps from above you can choos a different one, but unchanged templates won't work out of the box.||
||wikka_template_path||plugins/templates||remove //templates// as they contain the original templates, which are not compatible wit the output through phpBB||
||allow_user_registration||0||We don't want wiki-only users thats whats this page is about||
||user_prefix||ForumUser_||**New option:** Most of my (already existing) usernames are no WikiWords but Wikka requires Usernames to be WikiWords so we put a (WikiWords)prefix before every username to be safe.||
||user_table||phpbb3_users||**New option:** phpBBs usertable||
||user_group_table||phpbb3_user_group||**New option:** phpBBs usergrouptable||
||group_table||phpbb3_groups||**New option:** phpBBs grouptable||
||admin_users||ForumUser_master||Change this to your (forum) Admin account name. Don't forget to add the user_prefix, so in this case my Forum admin is called //master// inside Wikka this useraccount will be called //ForumUser_master//||


===/wiki.php===
Create the file with the following content
%%(php)
<?php

define('WIKKASESSION', 'WIKKASESSION');

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';

$phpEx = substr(strrchr(__FILE__, '.'), 1);

include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$phpbb_username = $user->data['username_clean'];
$user_phpbb = $user;
$auth_phpbb = $auth;
unset($auth);



chdir('wikka');
include('wikka.php');
//echo $page_output;
chdir('../');

unset($user);
unset($auth);
//die(nl2br(print_r($_SESSION, true)));
$user = $user_phpbb;
$auth = $auth_phpbb;




page_header('Wiki');

//echo $page_output;
$template->assign_var('TEXT', $page_output);

$template->set_filenames(array(
'body' => 'wiki_body.html',
));

//make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();


?>%%

===/styles/prosilver/templates/overall_header.html===
And for all other phpBB Templates you want to use

Find:
%%(html4strict)
<link href="{T_THEME_PATH}/normal.css" rel="stylesheet" type="text/css" title="A" />
<link href="{T_THEME_PATH}/medium.css" rel="alternate stylesheet" type="text/css" title="A+" />
<link href="{T_THEME_PATH}/large.css" rel="alternate stylesheet" type="text/css" title="A++" />%%
Append:
%%(html4strict)
<link href="wikka/plugins/templates/default/css/wikka.css" rel="stylesheet" type="text/css" />%%

===/styles/prosilver/templates/wiki_body.html===
Create this file for every phpBB template and adapt it to your needs.

%%(html4strict)
<!-- INCLUDE overall_header.html -->

<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>

<div id="wikiwrapper" class="content">{TEXT}</div>
</div>


<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->%%

===/wikka/images/*===
Move all images to /images

====How to use====
===Visit your Page / Wiki===
Now you should be able to browse to your Documentroot and see the forum at example.com/index.php the wiki should be avaliable at example.com/wiki.php=Pagename

===Group Permissions===
You can give access to single Users just by putting their Names into the ACL just as usual (Remember to use the user_prefix, too). You can also put ~Groupname into the ACL which gives the selected rights to every confirmed Member of the phpBB Group //Groupname//. You can also prevent access to a certain group by negating it. E.g. put !kiddies into the ACL and all Members of //kiddies// can't acces the page.

===URLRewrite===
Up to now I did not have a detailed look at URLRewrite so if youre not sure what to do leave it disabled (leave /wikka/.htaccess untouched and set //rewrite_mode// to //0// in your /wikka/wikka.conf.php . If you are fammiliar with rewriting and want to enable it, please do so and document your steps in this wikipage.

===Language===
As you might have noticed, english is not my native language so if someone who is more familiar with it can have a closer look at this document to wipe out typos or strange grammar, thanks in advance!

====Todo====
- Make the large codeblocks smaller (use a scrollbar), especially the wikka.css file (any idea, how to do this?)
- Set up a demo page
- Try to reproduce the modification, to validate its completness
- Other phpBB Integrations have trouble with the recent pages, check if this applies to this mod, too
- Hav a look at the User Registration framework, like mentioned in comment #1 on WikkaWithphpBB3
- Introduce this modification at http://wikkawiki.org/WikkaIntegration
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki