History of phpBB Edits

Version 13

phpBB Edits

phpBB edits

Created by: Southpaw, Last modification: 19 Nov 2004 (04:30 UTC) by Southpaw
phpBB 2.0.6/2.0.10 Edits

This is the current phpBB 2.0.6 edits required for user integration to TikiPro. Remeber to make a backup of everything before you start editing!

These edits work for phpBB 2.0.10 too.



Files: That need to be created and/or edited.
  • ./common.php
  • ./admin/index.php
  • ./tiki_setup_inc.php #Needs to be created!
  • ./admin/schema_inc.php #Needs to be created!
  • ./includes/sessions.php
  • ./templates/menu_phpbb.tpl #Needs to be created!
  • ./templates/menu_phpbb_admin.tpl #Needs to be created!
  • ./templates/phpbb_mini_search.tpl #Needs to be created!
  • ./templates/tiki_phpbb.tpl #Needs to be created!




In ./common.php:

Find:
{CODE(colors=>'php')}$board_config = array();
$userdata = array();
$theme = array();
$images = array();
$lang = array();
$gen_simple_header = FALSE;{CODE}

Add After:
{CODE(colors=>'php')}// {{{ TIKI_MOD
if( file_exists( $phpbb_root_path . 'config.'.$phpEx ) ) {
include($phpbb_root_path . 'config.'.$phpEx);
}
if( !defined("PHPBB_INSTALLED") )
{
header("Location: install/install.$phpEx");
exit;
}

require_once( $phpbb_root_path.'/../tiki_setup_inc.php' );
//phpBB is not as clean as tiki. errors only
error_reporting ( E_ALL & ~E_NOTICE );
// }}} TIKI_MOD{CODE}

Save and upload the file.



In ./admin/index.php:

Find:
{CODE(colors=>'php')} $db->sql_close();
exit;

}

?>{CODE}

Add ABOVE:
{CODE(colors=>'php')}// {{{ TIKI_MOD
$template->flush_buffer();
// }}} TIKI_MOD{CODE}

Save and upload the file.



Create a new file called tiki_setup_inc.php in your phpBB root folder.

Add this into the file:
{CODE(colors=>'php')}<?php
global $gTikiSystem;

$gTikiSystem->registerPackage( 'phpBB', dirname( FILE ).'/' );
if( $gTikiSystem->isPackageActive( 'phpbb' ) ) {
$gTikiSystem->registerAppMenu( 'phpbb', 'Forums', PHPBB_PKG_URL.'index.php', 'tikipackage:phpbb/menu_phpbb.tpl' );
}
?>{CODE}

Save and upload the file.



Create a new file called schema_inc.php in your ./admin/ folder.

Add this into the file:
{CODE(colors=>'php')}<?php
global $gTikiInstaller;
$gTikiInstaller->registerPackageInfo( PHPBB_PKG_DIR, array(
'description' => "phpBB is a high powered, fully scalable, and highly customizable Open Source bulletin board package. phpBB has a user-friendly interface, simple and straightforward administration panel, and helpful FAQ.",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
'version' => '2.0.6',
'state' => 'external package',
'dependencies' => '',
'install' => array(
'package' => 'phpbb',
'file' => 'install/install.php'
)
) );
?>{CODE}

Save and upload the file.



In ./includes/sessions.php:

Find:
{CODE(colors=>'php')} if ( isset($HTTP_COOKIE_VARS>$cookiename . '_sid')
isset($HTTP_COOKIE_VARS>$cookiename . '_data') )
{
$session_id = isset($HTTP_COOKIE_VARS>$cookiename . '_sid') ? $HTTP_COOKIE_VARS>$cookiename . '_sid' : ;
$sessiondata = isset($HTTP_COOKIE_VARS>$cookiename . '_data') ? unserialize(stripslashes($HTTP_COOKIE_VARS>$cookiename . '_data')) : array();
$sessionmethod = SESSION_METHOD_COOKIE;
}
else
{
$sessiondata = array();
$session_id = ( isset($HTTP_GET_VARSsid>'sid') ) ? $HTTP_GET_VARSsid>'sid' : ;
$sessionmethod = SESSION_METHOD_GET;
}{CODE}
Add After:
{CODE(colors=>'php')}// {{{ TIKI_MOD
// we always force auto login
$sessiondataautologinid>'autologinid' = TRUE;
// }}} TIKI_MOD{CODE}
Find:
{CODE(colors=>'php')} //
// Did the session exist in the DB?
//
if ( isset($userdatauser_id>'user_id') )
{{CODE}
Add After:
{CODE(colors=>'php')} // {{{ BEGIN TIKI_MOD
check_tiki_user( $userdata );
// }}} END TIKI_MOD{CODE}
Find:
{CODE(colors=>'php')} setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
}
return $userdata;
}
}
}{CODE}
Add After:
{CODE(colors=>'php')} // {{{ BEGIN TIKI_MOD
check_tiki_user( $sessiondata );
// {{{ END TIKI_MOD{CODE}
Find:
{CODE(colors=>'php')} //
// If we reach here then no (valid) session exists. So we'll create a new one,
// using the cookie user_id if available to pull basic user prefs.
//
$user_id = ( isset($sessiondatauserid>'userid') ) ? intval($sessiondatauserid>'userid') : ANONYMOUS;
if ( !($userdata = session_begin($user_id, $user_ip, $thispage_id, TRUE)) )
{
message_die(CRITICAL_ERROR, 'Error creating user session', , LINE, FILE, $sql);
}
return $userdata;
}{CODE}
Add After:
{CODE(colors=>'php')}// {{{ BEGIN TIKI MOD
function check_tiki_user( &$p_user_data ) {
// We have a valid tiki user, however we do not have a phpBB user
global $db, $gTikiSystem, $gTikiUser, $userlib, $HTTP_GET_VARS;
if( empty($p_user_datauser_id>'user_id')
($p_user_datauser_id''>'user_id' == ANONYMOUS)
( $gTikiUser->isValid() && $gTikiUser->mUserId != $p_user_datauser_id>'user_id' )
) {
if( $gTikiUser->isValid() ) {
//
// Try and pull the last time stored in a cookie, if it exists
//
$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE user_id = '".$gTikiUser->mUserId."'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not obtain tiki user from phpBB user table', , LINE, FILE, $sql);
}
$user_row = $db->sql_fetchrow($result);
$md5 = ( $gTikiSystem->mPrefsfeature_clear_passwords>'feature_clear_passwords' == 'y' );
$phpbb_password = ( $md5 ? $gTikiUser->mInfopassword>'password' : md5( $gTikiUser->mInfopassword>'password' ) );
if( empty( $user_rowuser_id>'user_id' ) ) {
$sql = "INSERT INTO ". USERS_TABLE ." (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
VALUES ( ".$gTikiUser->mInfouser_id>'user_id'.", ".$gTikiSystem->mDb->qstr( $gTikiUser->mInfologin>'login', get_magic_quotes_gpc() ).", ".strtotime('now').", ".$gTikiSystem->mDb->qstr( $phpbb_password, get_magic_quotes_gpc() ).", '".$gTikiUser->mInfoemail>'email'."',
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 1, 0, 1, 0, 0, 1, 1, 0, 'd M Y h:i a', 'english', 1, ".(int)$gTikiUser->isAdmin().", 0, 1, NULL)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not create tiki user for phpBB', , LINE, FILE, $sql);
}
// nuke their existing session cause it stores anonymous_id (-1) initially
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_id = '".$p_user_datasession_id>'session_id'."'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error clearing sessions table', , LINE, FILE, $sql);
}
} else {
// Has user data changed?
if( ($user_rowuser_email>'user_email' != $gTikiUser->mInfoemail>'email')
($user_rowuser_password''>'user_password' != $phpbb_password)
|| ($user_rowusername>'username' != $gTikiUser->mInfologin>'login')
)
{
$sql = "UPDATE ". USERS_TABLE ." SET username=".$gTikiSystem->mDb->qstr( $gTikiUser->mInfologin>'login', get_magic_quotes_gpc() ).", user_email = ".$gTikiSystem->mDb->qstr( $gTikiUser->mInfoemail>'email', get_magic_quotes_gpc() ).", user_password=".$gTikiSystem->mDb->qstr( $phpbb_password, get_magic_quotes_gpc() )."
WHERE user_id = ".$user_rowuser_id>'user_id';
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not create tiki user for phpBB', '', LINE, FILE, $sql);
die;
}
}
}
$p_user_datauser_id>'user_id' = $gTikiUser->mUserId;
$p_user_datauserid>'userid' = $gTikiUser->mUserId;
}
}
}
// }}} END TIKI MOD{CODE}

Save and upload the file.



Create a new file called menu_phpbb.tpl in your ./templates/ folder.

Add this into the file:
{CODE(colors=>'php')}<a class="menuoption" href="{$gTikiLoc.PHPBB_PKG_URL}">{tr}Browse Forums{/tr}</a>
{if $user}
<a class="menuoption" href="{$gTikiLoc.PHPBB_PKG_URL}search.php?search_id=newposts">{tr}Posts since last visit{/tr}</a>
<a class="menuoption" href="{$gTikiLoc.PHPBB_PKG_URL}search.php?search_id=egosearch">{tr}Your posts{/tr}</a>
<a class="menuoption" href="{$gTikiLoc.PHPBB_PKG_URL}search.php?search_id=unanswered">{tr}Unanswered posts{/tr}</a>
{/if}
{CODE}

Save and upload the file.



Create a new file called menu_phpbb_admin.tpl in your ./templates/ folder.

Add this into the file:
{CODE(colors=>'php')}<a class="menuoption" href="{$gTikiLoc.PHPBB_PKG_URL}admin/index.php">{tr}Administer phpBB{/tr}</a>{CODE}

Save and upload the file.



Create a new file called phpbb_mini_search.tpl in your ./templates/ folder.

Add this into the file:
{CODE(colors=>'php')}<form action="{$gTikiLoc.PHPBB_PKG_URL}search.php" method="POST">
<input type="hidden" name="search_fields" value="all" />

<input type="text" style="width: 75px" class="post" name="search_keywords" size="30" /> <input class="liteoption" type="submit" value="{tr}Search{/tr}" />

<br />
Match: <input type="radio" name="search_terms" value="any" checked="checked" /> {tr}Any{/tr}
<input type="radio" name="search_terms" value="all" />{tr}All{/tr}</span>
<br/>

</form>
<a href="{$gTikiLoc.PHPBB_PKG_URL}search.php" style="font-size:smaller">{tr}More options{/tr}</a>
{CODE}

Save and upload the file.



Create a new file called tiki_phpbb.tpl in your ./templates/ folder.

Add this into the file:
{CODE(colors=>'php')}{* TIKI_MOD - this is a new file*}
<div class="phpbb">
{php}
global $template;
$template->flush_buffer();
{/php}
</div>
{* TIKI_MOD *}{CODE}

Save and upload the file.




Fin.



Page History
Date/CommentUserIPVersion
21 Apr 2006 (12:10 UTC)
use different highlighting for one code block to avoid crashes
SV1206.105.169.16032
Current • Source
xing194.152.164.4530
View • Compare • Difference • Source
spiderr66.93.240.20429
View • Compare • Difference • Source
spiderr66.93.240.20428
View • Compare • Difference • Source
spiderr66.93.240.20426
View • Compare • Difference • Source
spiderr66.93.240.20425
View • Compare • Difference • Source
spiderr66.93.240.20423
View • Compare • Difference • Source
spiderr66.93.240.20422
View • Compare • Difference • Source
spiderr66.93.240.20421
View • Compare • Difference • Source
spiderr66.93.240.20420
View • Compare • Difference • Source
spiderr66.93.240.20419
View • Compare • Difference • Source
spiderr66.93.240.20418
View • Compare • Difference • Source
spiderr66.93.240.20416
View • Compare • Difference • Source
Southpaw213.202.174.1115
View • Compare • Difference • Source
Southpaw213.202.168.5414
View • Compare • Difference • Source
Southpaw213.202.159.6113
View • Compare • Difference • Source
Southpaw213.202.159.6112
View • Compare • Difference • Source
Southpaw213.202.159.6111
View • Compare • Difference • Source
Southpaw213.202.159.6110
View • Compare • Difference • Source
Southpaw213.202.161.779
View • Compare • Difference • Source
Southpaw213.202.161.778
View • Compare • Difference • Source
Southpaw213.202.161.777
View • Compare • Difference • Source
Southpaw213.202.161.776
View • Compare • Difference • Source
Southpaw213.202.161.775
View • Compare • Difference • Source
Southpaw213.202.161.774
View • Compare • Difference • Source
Southpaw213.202.161.773
View • Compare • Difference • Source