Topic Title: Standalone phpBB2 integration within PHPNuke - Part II

Forum Index » Other PHPNuke Issues » Standalone phpBB2 integration within PHPNuke - Part II
Topic URL: http://www.nukedgallery.net/postt1607.html

AuthorMessage
Post Title: Standalone phpBB2 integration within PHPNuke - Part II
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue May 03, 2005 8:36 pm
This is a DRAFT of the FORTH VERSION of the installation guide. Make backup copies of your phpNuke files and your database before starting this process. If it works for you, let us know [nukedgallery.net]. If it doesn't, let us know what went wrong [nukedgallery.net], then revert back to your saved backup for your site until we can work out the bugs.

Version History:
Beta1 (8 April 2004):
Initial Draft

Beta2 (27 April 2004):
Reduced number of phpNuke modifications by using $user_prefix.

Beta3 (3 May 2004):
Introduced ability to redirect to forums upon login/logout.
Added fixes for phpNuke admin control panel related to change in format of $user_regdate field in the database.

Beta4 (9 July 2004):
Updated to phpNuke 7.2.
Split the integration methods into two separate guides.

How to integrate standalone phpBB with phpNuke
Developed and Authored by: Dariush Molavi (dari AT nukedgallery DOT net) and spcdata
Special thanks to spcdata for testing


This is a how-to on integrating standalone phpBB within PHPNuke. Why do this? Simply stated, it makes upgrading and modifying both pieces of software much simpler.

Standard disclaimer: Before you start any of this:
Backup your existing phpnuke database.
Backup your existing phpnuke directory.


For existing PHPNuke / BB2Nuke installations
Portions of this are taken from phpBB.com [phpbb.com]

This is a bit trickier, as most of the required phpBB tables are already created by phpNuke, just with a different name. It is crucial that you back up your database before doing this.
<ol><li>When you install phpNuke for the first time, it creates lots of tables with names in the following format:
Code: › <prefix>_bbXXXXX


phpBB uses tables with the format of:
Code: › <prefix>bb_XXXXX


These are the tables that store all of your posts, private messages, etc. Below is a list of the tables:
Code: ›  <prefix>_bbauth_access       
 <prefix>_bbbanlist      
 <prefix>_bbcategories      
 <prefix>_bbconfig      
 <prefix>_bbdisallow      
 <prefix>_bbfavorites      
 <prefix>_bbforum_prune      
 <prefix>_bbforums      
 <prefix>_bbgroups      
 <prefix>_bbposts      
 <prefix>_bbposts_text      
 <prefix>_bbprivmsgs      
 <prefix>_bbprivmsgs_text   
 <prefix>_bbranks      
 <prefix>_bbsearch_results 
 <prefix>_bbsearch_wordlist
 <prefix>_bbsearch_wordmatch
 <prefix>_bbsessions      
 <prefix>_bbsmilies      
 <prefix>_bbthemes      
 <prefix>_bbthemes_name      
 <prefix>_bbtopics      
 <prefix>_bbtopics_watch      
 <prefix>_bbuser_group      
 <prefix>_bbvote_desc      
 <prefix>_bbvote_results      
 <prefix>_bbvote_voters      
 <prefix>_bbwords 


You may have more or less, depending on your version of PHPNuke (this list is from phpNuke 7.2).

You want to keep the contents of these tables intact during this conversion.
</li>
<li>Install a fresh copy of phpBB, making sure to specify the proper database name, database login, and password (the same as your phpNuke database). Leave the phpBB prefix at it's default value.</li>
<li>Drop the following tables created by the phpBB installation:
Code: ›  phpbb_auth_access       
 phpbb_banlist      
 phpbb_categories      
 phpbb_config      
 phpbb_disallow      
 phpbb_favorites      
 phpbb_forum_prune      
 phpbb_forums      
 phpbb_groups      
 phpbb_posts      
 phpbb_posts_text      
 phpbb_privmsgs      
 phpbb_privmsgs_text   
 phpbb_ranks      
 phpbb_search_results 
 phpbb_search_wordlist
 phpbb_search_wordmatch
 phpbb_sessions      
 phpbb_smilies      
 phpbb_themes      
 phpbb_themes_name      
 phpbb_topics      
 phpbb_topics_watch      
 phpbb_user_group      
 phpbb_vote_desc      
 phpbb_vote_results      
 phpbb_vote_voters      
 phpbb_words 
</li>
<li>Rename the phpNuke database tables that correspond to the above tables to their phpBB counterparts. For example, <prefix>_bbtopics would get renamed to <prefix>bb_topics.</li>
<li>Rename the <prefix>_users table to <prefix>bb_users.</li>
<li>Rename your <prefix>_users_temp table (from phpNuke) to <prefix>bb_users_temp.</li>
<li>Change the $user_prefix in <phpNuke_root>/config.php to look like this:
$user_prefix = "nukebb";
(You may have a different portion for the "nuke" part. The important thing here is that you have "bb" on the end of it.)
</li>
<li> This step is crucial. You must edit your phpBB config.php file and change the prefix from phpbb_ to <nuke_user_prefix>_.Don't forget to include the underscore character ( _ ) after your phpNuke user prefix.</li>
<li>Do the following in the <prefix>bb_users table
<ol type="i">
<li>Next, you will need to convert the user_regdate from the phpNuke "pretty-print" format to unixtime. The following php script will perform the conversion for you. (Note that this script will only function if your regdates are in the format "MMM dd, YYYY", for example "Nov 10, 2003") Once you've run this script, change the user_regdate from varchar(20) to int(11).
PHP: › <?php

require_once("mainfile.php");
global 
$user_prefix,$db;

$months = array("abc","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

$result $db->sql_query("SELECT user_id, username, user_regdate FROM ".$user_prefix."_users");

echo 
"Fetching information for ".$db->sql_numrows($result)." users...<br><br>";

while(
$row $db->sql_fetchrow($result)) {
        
$date $row['user_regdate'];
        
$tmp explode(" ",$date);
        
$day substr($tmp[1],0,2);
        
$month $tmp[0];
        while(
$month_name current($months)) {
                if(
$month_name == $month) {
                        
$month key($months);
                }
                
next($months);
        }
        
reset($months);
        
$year $tmp[2];
        
$unixdate mktime(0,0,0,$month,$day,$year);
        echo 
"Converting regdate for ".$row['username']."...";
        
$result2 $db->sql_query("UPDATE ".$user_prefix."_users SET user_regdate=".$unixdate." WHERE user_id=".$row['user_id']);
        if(!
$result2) {
                echo 
"<font color=\"#ff0000\"><b>Error!</b></font><br>";
        }
        else {
                echo 
"<font color=\"#00ff00\"><b>Success!</b></font><br>";
        }
}

?>

Simply put this script into a file called "changetime.php" in your phpNuke root directory and view it through your browser for the update to take place.</li>
<li>Change the user_id field from int(11) to mediumint(Cool and remove the autoincrement property.</li>
<li>Change the Anonymous user to have a user_id of -1.</li></ol></li>
<li>Make the following file modifications in your PHPNuke installation.
<ol type="a"><li>The following modifications are done inside Your_Account/index.php:
PHP: › <?php #
#-----[ OPEN ]-----------------------------------
#
modules/Your_Account/index.php

#
#-----[ FIND - THERE ARE 2 INSTANCES OF THIS]----
#
    
$sql "SELECT * FROM ".$prefix."_bbconfig";
    
$result $db->sql_query($sql);

#
#-----[ REPLACE BOTH INSTANCES WITH ]------------
#
    
$sql "SELECT * FROM ".$prefix."bb_config";
    
$result $db->sql_query($sql);

#
#-----[ FIND ]-----------------------------------
#
    
$user_regdate date("M d, Y");

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$user_regdate time();


#
#-----[ FIND ]-----------------------------------
#
    
$db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time) VALUES (NULL, '$username', '$user_email', '$new_password', '$user_regdate', '$check_num', '$time')");

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$db->sql_query("INSERT INTO ".$user_prefix."_users_temp (user_id, username, user_email, user_password, user_regdate, check_num, time) VALUES (NULL, '$username', '$user_email', '$new_password', $user_regdate, '$check_num', '$time')");

#
#-----[ FIND ]-----------------------------------
#
     
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE time < $past");
     
$sql "SELECT * FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'";
     
$result $db->sql_query($sql);

#
#-----[ AFTER, ADD ]-----------------------------------
#
    
$uid_result $db->sql_query("SELECT MAX(user_id) AS total FROM ".$user_prefix."_users");
    
$uid_row $db->sql_fetchrow($uid_result);
    
$user_id $uid_row['total'] + 1;

#
#-----[ FIND ]-----------------------------------
#
        
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', '$row[user_regdate]', '$language')");

#
#-----[ REPLACE WITH ]-----------------------------------
#
        
$sql2 "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES ('$user_id', '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', $row[user_regdate], '$language')";
        
$db->sql_query($sql2);
 
#
#-----[ FIND ]-----------------------------------
#
    
$db->sql_query("DELETE FROM ".$prefix."_bbsessions WHERE session_user_id='$r_uid'");

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$db->sql_query("DELETE FROM ".$prefix."bb_sessions WHERE session_user_id='$r_uid'");


#
#-----[ FIND ]-----------------------------------
#
        
if ($pm_login != "") {
            
Header("Location: modules.php?name=Private_Messages&file=index&folder=inbox");
            exit;
        }
        if (
$redirect == "" ) {
            
Header("Location: modules.php?name=Your_Account&amp;op=userinfo&amp;bypass=1&amp;username=$username");
        } else if (
$mode == "") {
            
Header("Location: modules.php?name=Forums&amp;file=$forward");
        } else if (
$t !="")  {
            
Header("Location: modules.php?name=Forums&amp;file=$forward&amp;mode=$mode&amp;t=$t");
        } else {
            
Header("Location: modules.php?name=Forums&amp;file=$forward&amp;mode=$mode&amp;f=$f");
        }

#
#-----[ REPLACE WITH ]-----------------------------------
#
        
if ($redirect == "" ) {
            
Header("Location: modules.php?name=Your_Account&op=userinfo&bypass=1&username=$username");
        } 
        else if (
$redirect == "phpBB") {
            
Header("Location: /phpBB2/");
        }
        else if (
$mode == "") {
            
Header("Location: /phpBB2/$forward");
        } else if (
$t !="")  {
            
Header("Location: /phpBB2/$forward&amp;mode=$mode&amp;t=$t");
        } else {
            
Header("Location: /phpBB2/$forward&amp;mode=$mode&amp;f=$f");
        }

#
#-----[ FIND ]-----------------------------------
#
    
if ($redirect != "") {
        echo 
"<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
    } else {
        echo 
"<META HTTP-EQUIV=\"refresh\" content=\"3;URL=/index.php\">";
    }

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
if($redirect == "phpBB") {
                echo 
"<META HTTP-EQUIV=\"refresh\" content=\"0;URL=/phpBB2/\">";
    }
    else {
            if (
$redirect != "") {
                echo 
"<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
            } else {
                echo 
"<META HTTP-EQUIV=\"refresh\" content=\"3;URL=/index.php\">";
            }
    }

#
#-----[ SAVE & CLOSE ]-----------------------------------
#
/modules/Your_Account/index.php ?>

</li>
<li>The following file modifications are done in admin.php:
PHP: › <?php #
#-----[ OPEN ]-----------------------------------
#
admin.php

#
#-----[ FIND ]-----------------------------------
#
$user_regdate date("M d, Y");

#
#-----[ REPLACE WITH ]-----------------------------------
#
$user_regdate time();

#
#-----[ FIND ]-----------------------------------
#
$sql "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_lang, user_dateformat) VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit','english','D M d, Y g:i a')";

#
#-----[ REPLACE WITH ]-----------------------------------
#
$sql "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_lang, user_dateformat) VALUES (2,'$name','$email','$url','$user_avatar',$user_regdate,'$pwd','$Default_Theme','$commentlimit','english','D M d, Y g:i a')";

#
#-----[ FIND ]-----------------------------------
#
            
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit', '2', 'english','D M d, Y g:i a')");

#
#-----[ REPLACE WITH ]-----------------------------------
#
           
$sql "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_lang, user_dateformat) VALUES (2,'$name','$email','$url','$user_avatar',$user_regdate,'$pwd','$Default_Theme','$commentlimit','english','D M d, Y g:i a')";
           
$db->sql_query($sql);

#
#-----[ FIND ]-----------------------------------
#
    
$curDate2 "%".$month[0].$month[1].$month[2]."%".$mday."%".$year."%";

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$curDate2 $month[0].$month[1].$month[2]." ".$mday." ".$year;

#
#-----[ FIND ]-----------------------------------
#
    
$curDateP "%".$premonth[0].$premonth[1].$premonth[2]."%".$preday."%".$preyear."%";

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$curDateP $premonth[0].$premonth[1].$premonth[2]." ".$preday." ".$preyear;


#
#-----[ FIND ]-----------------------------------
#
    
$row3 $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount from $user_prefix"._users." WHERE user_regdate LIKE '$curDate2'"));
    
$userCount $row3['userCount'];
    
$row4 $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE user_regdate LIKE '$curDateP'"));
    
$userCount2 $row4['userCount'];

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$sql "SELECT COUNT(user_id) AS userCount from $user_prefix"._users." WHERE FROM_UNIXTIME(user_regdate,'%b %e %Y') LIKE '$curDate2'";
    
$result $db->sql_query($sql);
    
$row3 $db->sql_fetchrow($result);
    
$userCount $row[userCount];
    
$sql "SELECT COUNT(user_id) AS userCount FROM $user_prefix"._users." WHERE FROM_UNIXTIME(user_regdate,'%b %e %Y') LIKE '$curDateP'";
    
$result $db->sql_query($sql);
    
$row4 $db->sql_fetchrow($result);
    
$userCount2 $row[userCount];

#
#-----[ SAVE & CLOSE ]-----------------------------------
#
/admin.php ?>
</li>
<li>The following modifications are made in admin/modules/users.php:
PHP: › <?php #
#-----[ FIND ]-----------------------------------
#
    
$user_regdate date("M d, Y");

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$user_regdate time();

#
#-----[ FIND ]-----------------------------------
#
    
$sql .= "values (NULL, '$add_name', '$add_uname', '$add_email', '$add_femail', '$add_url', '$user_regdate', '$add_user_icq', '$add_user_aim', '$add_user_yim', '$add_user_msnm', '$add_user_from', '$add_user_occ', '$add_user_intrest', '$add_user_viewemail', '$add_avatar', '$add_user_sig', '$add_pass', '$add_newsletter', '1', '0')";

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$sql .= "values (NULL, '$add_name', '$add_uname', '$add_email', '$add_femail', '$add_url', $user_regdate, '$add_user_icq', '$add_user_aim', '$add_user_yim', '$add_user_msnm', '$add_user_from', '$add_user_occ', '$add_user_intrest', '$add_user_viewemail', '$add_avatar', '$add_user_sig', '$add_pass', '$add_newsletter', '1', '0')";

#
#-----[ SAVE & CLOSE ]-----------------------------------
#
/admin/modules/users.php ?>
</li>
</ol></li>
That is all the file mods that need to be made for stock phpNuke files.

<li>Now comes the fun part, modifying the phpBB files to work with PHPNuke. Luckily, most of the modifications are minor. These are the only modifications you will have to repeat when/if you upgrade your phpBB installation. If you are using the stock subSilver template in your forum, it is important that you do NOT overwrite your templates directory during an upgrade of phpBB. This may look like a lot of modifications, but most are only one or two lines. With a heavily modified installation, such as the one here at NukedGallery.net, the additional time required to perform these alterations is trivial compared to the time required to re-implement all of the other modifications already in place.
PHP: › <?php #
#-----[ OPEN ]-----------------------------------
#
phpBB2/admin/pagestart.php

#
#-----[ FIND ]-----------------------------------
#
 
include($phpbb_root_path 'common.'.$phpEx);
 
#
#-----[ AFTER, ADD ]-----------------------------------
#
global $nukeuser;

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_INDEX);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_INDEX,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/admin/page_header_admin.php

#
#-----[ FIND ]-----------------------------------
#
'S_LOGIN_ACTION' => append_sid('../login.'.$phpEx),

#
#-----[ REPLACE WITH ]-----------------------------------
#
'S_LOGIN_ACTION' => append_sid('/modules.'.$phpEx.'?name=Your_Account'),

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/common.php

#
#-----[ FIND ]-----------------------------------
#
 
{
     die(
"Hacking attempt");
 }

#
#-----[ AFTER, ADD ]-----------------------------------
#
$user $_COOKIE['user'];
$nukeuser base64_decode($user);
 
#
#-----[ OPEN ]-----------------------------------
#
phpBB2/faq.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_FAQ);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_FAQ,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/groupcp.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_GROUPCP);

#
#-----[    REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_GROUPCP,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/constants.php

#
#-----[ FIND ]-----------------------------------
#
define('DELETED', -1);
define('ANONYMOUS', -1);
                                                                                
define('USER'0);
define('ADMIN'1);
define('MOD'2);

#
#-----[ REPLACE WITH ]-----------------------------------
#
define('DELETED', -1);
define('ANONYMOUS', -1);
  
define('USER'1);
define('ADMIN'2);
define('MOD'3);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/functions.php

#
#-----[ FIND ]-----------------------------------
#
    
global $db$template$board_config$theme$lang$phpEx$phpbb_root_path$nav_links$gen_simple_header$images;

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
global $db$template$board_config$theme$lang$phpEx$phpbb_root_path$nav_links$gen_simple_header$images,$user;

#
#-----[ FIND ]-----------------------------------
#
        
$userdata session_pagestart($user_ipPAGE_INDEX);

#
#-----[ REPLACE WITH ]-----------------------------------
#
        
$userdata session_pagestart($user_ipPAGE_INDEX$nukeuser);

#
#-----[ FIND ]-----------------------------------
#
        // Behave as per HTTP/1.1 spec for others
        
header('Location: ' $server_protocol $server_name $server_port $script_name $url);
    exit;
 }
 
#
#-----[ AFTER, ADD ]-----------------------------------
#
function bblogin($nukeuser$session_id) {
        global 
$nukeuser$userdata$user_ip$session_length$session_id$db$nuke_file_path;
        
define("IN_LOGIN"true);
        
$cookie explode(":"$nukeuser);
        
$nuid $cookie[0];
        
$sql "SELECT s.*
                FROM " 
SESSIONS_TABLE " s
                WHERE s.session_id = '$session_id'
                AND s.session_ip = '$user_ip'"
;
        if ( !(
$result $db->sql_query($sql)) )
        {
                
message_die(CRITICAL_ERROR'Error doing DB query userdata row fetch : session_pagestar');
        }
        
$logindata $db->sql_fetchrow($result);

        if( 
$nuid != $logindata['session_user_id'] ) {
            
$nusername $cookie[1];
            
$sql "SELECT user_id, username, user_password, user_active, user_level
                    FROM "
.USERS_TABLE."
                    WHERE username = '" 
str_replace("\'""''"$nusername) . "'";
            
$result $db->sql_query($sql);
            if(!
$result) {
                
message_die(GENERAL_ERROR"Error in obtaining userdata : login"""__LINE____FILE__$sql);
            }
            
$rowresult $db->sql_fetchrow($result);
            
$password $cookie[2];
            if(
count($rowresult) ) {
                if( 
$rowresult['user_level'] != ADMIN && $board_config['board_disable'] ) {
                    
header("Location: " append_sid("/phpBB2/index.php"true));
                } else {
                    if( 
$password == $rowresult['user_password'] && $rowresult['user_active'] ) {
                        
$autologin 0;
                        
$userdata session_begin($rowresult['user_id'], $user_ipPAGE_INDEX$session_lengthFALSE$autologin);
                        
$session_id $userdata['session_id'];
                        if(!
$session_id ) {
                            
message_die(CRITICAL_ERROR"Couldn't start session : login"""__LINE____FILE__);

                        } else {
                        }
                    } else {
                        
$message $lang['Error_login'] . "<br /><br />" sprintf($lang['Click_return_login'], "<a href=\"" append_sid("/phpBB2/login.php&amp;$redirect") . "\">""</a> ") . "<br /><br />" .  sprintf($lang['Click_return_index'], "<a href=\"" append_sid("/phpBB2/index.php") . "\">""</a> ");
                        
message_die(GENERAL_MESSAGE$message);
                    }
                }
            } else {
                
$message $lang['Error_login'] . "<br /><br />" sprintf($lang['Click_return_login'], "<a href=\"" append_sid("/phpBB2/login.php&amp;$redirect") . "\">""</a> ") . "<br /><br />" .  sprintf($lang['Click_return_index'], "<a href=\"" append_sid("/phpBB2/index.php") . "\">""</a> ");
                
message_die(GENERAL_MESSAGE$message);
            }
        }

}

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/functions_post.php

#
#-----[ FIND ]-----------------------------------
#
        
$userdata session_pagestart($user_ip$page_id);
#
#-----[ REPLACE WITH ]-----------------------------------
#
        
$userdata session_pagestart($user_ip$page_id,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/page_header.php

#
#-----[ FIND ]-----------------------------------
#
'S_LOGIN_ACTION' => append_sid('login.'.$phpEx),

#
#-----[ REPLACE WITH ]-----------------------------------
#
'S_LOGIN_ACTION' => append_sid('/modules.'.$phpEx.'?name=Your_Account'),

#
#-----[ FIND ]-----------------------------------
#
//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
    
$u_login_logout 'login.'.$phpEx.'?logout=true&amp;sid=' $userdata['session_id'];
    
$l_login_logout $lang['Logout'] . ' [ ' $userdata['username'] . ' ]';
}
else
{
    
$u_login_logout 'login.'.$phpEx;
    
$l_login_logout $lang['Login'];
}

#
#-----[ REPLACE WITH ]-----------------------------------
#
//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
        
$u_login_logout '/modules.php?name=Your_Account&op=logout&redirect=phpBB';
        
$l_login_logout $lang['Logout'];
        
$l_user "Hello, ".$userdata['username']."! "
}
else
{
        
$u_login_logout 'login.'.$phpEx.'?redirect=phpBB';
        
$l_login_logout $lang['Login'];
        
$l_user "<a class=\"phpnuke\" href=\"/modules.php?name=Your_Account&amp;op=new_user\">Create</a> an account";
}

#
#-----[ FIND ]-----------------------------------
#
    
'L_USERNAME' => $lang['Username'],
     
'L_PASSWORD' => $lang['Password'],
     
'L_LOGIN_LOGOUT' => $l_login_logout,

#
#-----[ AFTER, ADD ]-----------------------------------
#
    
'L_USER' => $l_user,

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/page_tail.php

#
#-----[ FIND ]-----------------------------------
#
 //
 // Show the overall footer.
 //

#
#-----[ AFTER, ADD ]-----------------------------------
#
global $nukeuser;

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/sessions.php

#
#-----[ FIND ]-----------------------------------
#
    
$SID 'sid=' $session_id;

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
$SID = ( $sessionmethod == SESSION_METHOD_GET ) ? 'sid=' $session_id '';
 
#
#-----[ FIND ]-----------------------------------
#
function session_pagestart($user_ip$thispage_id)

#
#-----[ REPLACE WITH ]-----------------------------------
#
function session_pagestart($user_ip$thispage_id,$nukeuser)

#
#-----[ FIND ]-----------------------------------
#
    
global $db$lang$board_config;

#
#-----[ REPLACE WITH ]-----------------------------------
#
    
global $db$lang$board_config,$session_id;

#
#-----[ FIND ]-----------------------------------
#
        
$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';
         
$sessionmethod SESSION_METHOD_GET;
     }

#
#-----[ AFTER, ADD ]-----------------------------------
#
        
if ( ($nukeuser != "") && ($userdata['session_logged_in'] == "" )) {
                
bblogin($nukeuser$session_id);
        } else {
                
$sessiondata = array();                
        }

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/topic_review.php

#
#-----[ FIND ]-----------------------------------
#
        
$userdata session_pagestart($user_ip$forum_id);

#
#-----[ REPLACE WITH ]-----------------------------------
#
        
$userdata session_pagestart($user_ip$forum_id,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/index.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_INDEX);

#
#-----[ REPLACE WITH ]-----------------------------------
#
global $nukeuser;
$userdata session_pagestart($user_ipPAGE_INDEX,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/login.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_LOGIN);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_LOGIN,$nukeuser);

#
#-----[ FIND ]-----------------------------------
#
$s_hidden_fields '<input type="hidden" name="redirect" value="' $forward_page '" />';

#
#-----[ REPLACE WITH ]-----------------------------------
#
if($forward_page == "phpBB?") {
    
$forward_page "phpBB";
}

$s_hidden_fields '<input type="hidden" name="op" value="login"><input type="hidden" name="redirect" value="' $forward_page '" />';

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/memberlist.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_VIEWMEMBERS);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_VIEWMEMBERS,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/modcp.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ip$forum_id);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ip$forum_id,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/posting.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_POSTING);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_POSTING,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/privmsg.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_PRIVMSGS);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_PRIVMSGS,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/profile.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_PROFILE);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_PROFILE,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/search.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_SEARCH);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_SEARCH,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/viewforum.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ip$forum_id);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ip$forum_id,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/viewonline.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_VIEWONLINE);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ipPAGE_VIEWONLINE,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/viewtopic.php

#
#-----[ FIND ]-----------------------------------
#
$userdata session_pagestart($user_ip$forum_id);

#
#-----[ REPLACE WITH ]-----------------------------------
#
$userdata session_pagestart($user_ip$forum_id,$nukeuser);

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/templates/subSilver/index_body.tpl

#
#-----[ FIND ]-----------------------------------
#
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" /></td>

#
#-----[ AFTER, ADD ]-----------------------------------
#
<td><input type="hidden" name="redirect" value="phpBB" /><input type="hidden" name="op" value="login" /></td>

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/templates/subSilver/login_body.tpl

#
#-----[ FIND SIMILAR ]---------------------------
#
<form action="{S_LOGIN_ACTION}" method="post">

#
#-----[ CONFIRM ]-----------------------------------
#
You MUST confirm that there is no "target="_top"" statement in this form tag. If there isyou MUST remove it.

#
#-----[ FIND SIMILAR ]---------------------------
#
<input type="password" name="user_password" size="25" maxlength="32" />

#
#-----[ CONFIRM ]-----------------------------------
#
You MUST confirm that the name of the "password" variable is "user_password".  If it is no "user_password"you MUST change it to "user_password".


#
#-----[ SAVE & CLOSE]-----------------------------------
#
All Files ?>

All of these modifications get phpBB and phpNuke to share the same user database and recognise when users are logged in. You can now view your forum and log in/out via the forum or phpNuke. But, you may notice that it doesn't have the phpNuke header and footer, and some colors or fonts might be wrong.</li>
<li>For the header (the part of the page at the top with your site logo) and the footer (the bottom of the page, with all of the boring copyright information) to match your phpNuke site, you must make a few minor modifcations to the following files:
Code: › /phpBB2/templates/<your_template>/overall_header.tpl
/phpBB2/templates/<your_template>/overall_footer.tpl

We'll start on overall_footer.tpl.
<ol type="a"><li>The easiest way for your phpBB footer to match your phpNuke footer is to view the html source of your phpNuke page. Scroll down to the part that contains your footer code and just copy and paste the html source into your overall_footer.tpl file. Please do the wonderful developers at phpBB the courtesy of leaving their copyright information intact.</li>
<li>Making your header match your phpNuke header is a little more complicated. You cannot have any database driven information in your overall_header.tpl file (no $db->sql_query statements). So, you'll have to keep a basic navigation menu at the top, similar to the one you see here. To add your header, put your desired html code in overall_header.tpl after the <body> tag.</li></ol>
<li>Lastly, the fonts and background colors. Those are controlled via CSS, and are either located in a separate CSS file in your template directory (ie /phpBB2/templates/fisubsilver/fisubsilver.css), or both in the overall_header.tpl file and a separate CSS file (as is the case with the default subSilver template). You will want to add/modify code to these CSS files to create fonts, etc to your liking.</li></ol>

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Wed May 04, 2005 10:59 pm
Hiya Dari,

Just a quick note, as I'm editing some of the files right now before the movie my honey and I are going to watch begins....

BTW, I'm using PHP-Nuke 7.6 (with the chatserv security patch 2.9; don't know if THAT part matters).

Now instead of admin/modules/users.php (that file no longer exists in 7.6), you'd now use the file modules/Your_Account/admin/index.php .... the find/replace is identical in that file to your tutorial you have posted for Nuke 7.2 using the former file.

I'm sure that sooner or later you'll want to update your tutorial for newer versions of Nuke, so figured I'd just post that here so you'd know already.

If/when I come across any other differences that I find and solve myself, I'll let ya know. Wink

OH, being that it's a different Nuke version, there were a couple of "finds" that were slightly different.... stupidly I didn't take note of them like I normally do as I'm in a bit of a hurry tonight. However, it'd be VERY simple for me to find them and let you know what the "find" would be for 7.6 vs. 7.2 Nuke.

TTFN!

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Thu May 05, 2005 6:30 am
if you could do that, i'd greatly appreciate it Smile

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Thu May 05, 2005 10:29 am
WHEW! I feel better now.... After I posted last night I logged off the PC and watched a movie, then as I was dozing off I suddenly felt a bit of an urge to come back and either delete or edit my post as I didn't want to step on toes or anything. Which I know is ridiculous in most forums like this, because users help when they can: not only the admins and/or original authors. It's how community help works really.... but I've seen some help type forums where the admins or authors didn't like being told "such and such" is different, etc. (Over-inflated egos IMHO; I personally would want help and even corrections if my code IS different and/or has errors, that's how modding improves anyway. Here, however, it's not like that. It's just people helping people, the way community help forums should be!)

The way I see it is that someone here has gone out of their way to be of help to others with what can be such a difficult project, and so since I have a newer version of both Nuke and phpBB than when the tutorial was written and of course there are always upgraded versions when improvements and stronger security are implemented, I thought I'd try and be helpful by taking note of what changes there are. (I normally do take note of differences in file edit instruction files anyway, so that if I'd have to reinstall for any emergency reason and need to reinstall mods then I want to just quickly find what I need to find rather than searching for the differing lines all over again.)

ANYHOOO.... rather than putting up 100 posts RE: what turns out different with the newer versions each time I come across one, I'll instead take note of each difference (there've only been a few so far; I've done the edits for Nuke but not phpBB yet, that's my next step) and put all of the differences I've found in one post. AND also I'll make note of the fact in the post that my phpBB is modded quite a lot so some "find" changes would be different from straight phpBB whereas others will still be the same. (I go through that a lot when I mod my phpBB already, so I know that some "finds" will be different and some will be the same.) It's just more of a "help" to you when you decide to implement for newer versions; after all, I need to take the notes for myself anyway, so it's not any more difficult for me to list them in a post when I've already documented them for my own use. Cool

OH, BTW! Something I noticed in your tutorial immediately.... I think it's the first mod/hack instruct that had correct spelling and grammar throughout, which has always been a "peeve" of mine per se. I mean, when coding one HAS to make sure that every word and symbol, etc., is spelled 100% correctly, then the exact same authors will use some vocabluary and spelling that is a cross between English and I don't know what! Razz Granted, I know that many authors don't speak English so of course the translation would be different, but many of the mod/hack authors DO speak English as their first language and I find myself correcting the spelling and grammar in the instruction files. (My own copies, I don't go telling the authors that they're awful at spelling and grammar. I'm not that rude! LMAO)

Well, sorry to have rambled so much, and hope I made some sense here.... haven't made my coffee yet so I'm still extremely disoriented. Chronic insomnia sucks!!! Evil or Very Mad Laughing

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Thu May 05, 2005 3:46 pm
NOTE: I've used BBcode to make the differences show up as bold & red in this post so they'd be easy to see.... so be careful not to simply click on "quote" in my post and paste the changes without first finding and deleting the BBcode!

That's also why I'm posting this in "regular" format, rather than using either [code] or [php] BBcode, so that the portions I've made bold will show up as such. Wink

OH, and any differences I've posted that are NOT marked in bold/red means that the "find" WAS different but I didn't have the time to examine exactly what was different.... sorry, but I really need to get off of the PC and start today's studying. Rolling Eyes

~~ Kat ~~



These are all of the differences I've found....

The PHP-Nuke differences definitely apply to version change, as it's a FRESH install and I haven't modified a thing before this integration attempt.

I also want to make it completely clear:
The phpBB differences could be due to version change OR due to my present modifications; or both. Wink

ANYHOOO.... Hope this might help for those who have Nuke 7.6 and phpBB 2.0.14

And once again, I'm NO programmer! I simply compensate when instructed to find a line of code and it's different in my file/version, etc. So this should definitely be looked over by someone who knows a lot more about PHP than I do! Idea

Therefore, feel free to edit this post to your liking so that everything is correct AND so that the format/size of the post fits better in another way than what I've formatted here. Cool



(NUKE FILE EDITS):

#
#-----[ OPEN ]-----------------------------------
#
modules/Your_Account/index.php

#-----[ FIND (Nuke 7.2) ]-----------------------------------
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE time < $past");
$sql = "SELECT * FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'";
$result = $db->sql_query($sql);

#-----[ FIND (Nuke 7.6) ]-----------------------------------
$db->sql_query("DELETE FROM ".$user_prefix."_users_temp WHERE time < '$past'");
$sql = "SELECT * FROM ".$user_prefix."_users_temp WHERE username='$username' AND check_num='$check_num'";
$result = $db->sql_query($sql);

#-----[ AFTER, ADD ]-----------------------------------
$uid_result = $db->sql_query("SELECT MAX(user_id) AS total FROM ".$user_prefix."_users");
$uid_row = $db->sql_fetchrow($uid_result);
$user_id = $uid_row['total'] + 1;


#-----[ FIND (Nuke 7.2) ]-----------------------------------
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', '$row[user_regdate]', '$language')");

#-----[ FIND (Nuke 7.6) ]-----------------------------------
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type, user_regdate, user_lang) VALUES (NULL, '$row[username]', '$row[user_email]', '$user_password', 'gallery/blank.gif', '3', '$row[user_regdate]', '$language')");

#-----[ REPLACE WITH ]-----------------------------------
$sql2 = "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_password, user_avatar, user_avatar_type, user_regdate, user_lang) VALUES ('$user_id', '$row[username]', '$row[user_email]', '$row[user_password]', 'gallery/blank.gif', '3', $row[user_regdate], '$language')";
$db->sql_query($sql2);


#-----[ FIND (Nuke 7.2) ]-----------------------------------
if ($pm_login != "") {
Header("Location: modules.php?name=Private_Messages&file=index&folder=inbox");
exit;
}
if ($redirect == "" ) {
Header("Location: modules.php?name=Your_Account&amp;op=userinfo&amp;bypass=1&amp;username=$username");
} else if ($mode == "") {
Header("Location: forums.html&amp;file=$forward");
} else if ($t !="") {
Header("Location: forums.html&amp;file=$forward&amp;mode=$mode&amp;t=$t");
} else {
Header("Location: forums.html&amp;file=$forward&amp;mode=$mode&amp;f=$f");
}

#-----[ FIND (Nuke 7.6) ]-----------------------------------
if ($pm_login != "") {
Header("Location: modules.php?name=Private_Messages&file=index&folder=inbox");
exit;
}
if ($redirect == "" ) {
Header("Location: modules.php?name=Your_Account&op=userinfo&bypass=1&username=$username");
} else if ($mode == "") {
Header("Location: forums.html&file=$forward");
} else if ($t !="") {
Header("Location: forums.html&file=$forward&mode=$mode&t=$t");
} else {
Header("Location: forums.html&file=$forward&mode=$mode&f=$f");
}
} else {
Header("Location: modules.php?name=$module_name&stop=1");
}


#-----[ REPLACE WITH ]-----------------------------------
#(If your phpBB directory name is different, replace /phpBB2/ with /"forums"/ <---(your forums directory name; NO QUOTES of course!)
if ($redirect == "" ) {
Header("Location: modules.php?name=Your_Account&op=userinfo&bypass=1&username=$username");
}
else if ($redirect == "phpBB") {
Header("Location: /phpBB2/");
}
else if ($mode == "") {
Header("Location: /phpBB2/$forward");
} else if ($t !="") {
Header("Location: /phpBB2/$forward&amp;mode=$mode&amp;t=$t");
} else {
Header("Location: /phpBB2/$forward&amp;mode=$mode&amp;f=$f");
}


#-----[ FIND (Nuke 7.2) ]-----------------------------------
if ($redirect != "") {
echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
} else {
echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=/index.html\">";
}

#-----[ FIND (Nuke 7.6) ]-----------------------------------
if ($redirect != "") {
echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
} else {
echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=index.html\">";
}

#-----[ REPLACE WITH ]-----------------------------------
if($redirect == "phpBB") {
echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=/phpBB2/\">";
}
else {
if ($redirect != "") {
echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=modules.php?name=$redirect\">";
} else {
echo "<META HTTP-EQUIV=\"refresh\" content=\"3;URL=index.html\">";
}
}



#
#-----[ OPEN ]-----------------------------------
#
admin.php

#-----[ FIND (Nuke 7.2) ]-----------------------------------
$sql = "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_lang, user_dateformat) VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit','english','D M d, Y g:i a')";

#-----[ FIND (Nuke 7.6) ]-----------------------------------
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit','2','english','D M d, Y g:i a')");

#-----[ REPLACE WITH ]-----------------------------------
$sql = "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) VALUES (2,'$name','$email','$url','$user_avatar',$user_regdate,'$pwd','$Default_Theme','$commentlimit','2','english','D M d, Y g:i a')";


#-----[ FIND (Nuke 7.2) ]-----------------------------------
$db->sql_query("INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) VALUES (NULL,'$name','$email','$url','$user_avatar','$user_regdate','$pwd','$Default_Theme','$commentlimit', '2', 'english','D M d, Y g:i a')");

#-----[ FIND (Nuke 7.6) ]-----------------------------------
$sql = "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) VALUES (2,'$name','$email','$url','$user_avatar',$user_regdate,'$pwd','$Default_Theme','$commentlimit','2','english','D M d, Y g:i a')";

#-----[ REPLACE WITH ]-----------------------------------
$sql = "INSERT INTO ".$user_prefix."_users (user_id, username, user_email, user_website, user_avatar, user_regdate, user_password, theme, commentmax, user_level, user_lang, user_dateformat) VALUES (2,'$name','$email','$url','$user_avatar',$user_regdate,'$pwd','$Default_Theme','$commentlimit','2','english','D M d, Y g:i a')";
$db->sql_query($sql);

#
#-----[ OPEN ]-----------------------------------
#
(Nuke 7.2): admin/modules/users.php
(This file no longer exists in 7.6; I don't know which version changed this, however!)
(Nuke 7.6): modules/Your_Account/admin/index.php
(This is the file you'd edit instead.)

(File finds/edits are the same, it's only the file itself that has changed.)


(PHPBB2 FILE EDITS):

#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/constants.php

#-----[ FIND Original tutorial instruct ]-----------------------------------
define('DELETED', -1);
define('ANONYMOUS', -1);

define('USER', 0);
define('ADMIN', 1);
define('MOD', 2);

#-----[ FIND ]-----------------------------------
# My phpBB IS modded, but users should note differences
# as many people do add mods; i.e., MINE is:
define('DELETED', -1);
define('ANONYMOUS', -1);

define('USER', 0);
define('ADMIN', 1);
define('LESS_ADMIN', 2);
define('MOD', 3);


#-----[ REPLACE WITH ]-----------------------------------
# Simply take note of your values before replacing; it could be the same as the original tutorial. i.e., MINE would be:
define('DELETED', -1);
define('ANONYMOUS', -1);

define('USER', 1);
define('ADMIN', 2);
define('LESS_ADMIN', 3);
define('MOD', 4);



#
#-----[ OPEN ]-----------------------------------
#
includes/page_header.php

#-----[ FIND ]-----------------------------------
//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
$u_login_logout = 'login.'.$phpEx.'?logout=true&amp;sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
}
else
{
$u_login_logout = 'login.'.$phpEx;
$l_login_logout = $lang['Login'];
}


#-----[ FIND ]-----------------------------------
# My phpBB IS modded, but users should note differences as many people do add mods;
# i.e., MINE is:
# (In other words, the "find" appeared to be the same except for the modded add-on in the middle;
# just something to watch for if your board is modded.)
//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
$u_login_logout = 'login.'.$phpEx.'?logout=true&amp;sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';

if ($board_config['points_browse'] && !$post_info['points_disabled'] )
{
$points = $board_config['points_browse'];

if (($userdata['user_id'] !=ANONYMOUS) && ($userdata['admin_allow_points']))
{
add_points($userdata['user_id'], $points);
}
}
}
else
{
$u_login_logout = 'login.'.$phpEx;
$l_login_logout = $lang['Login'];
}


#-----[ REPLACE WITH ]-----------------------------------
# MY replacement would keep the add-in for the modded portion.
#
//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
$u_login_logout = '/modules.php?name=Your_Account&op=logout&redirect=phpBB';
$l_login_logout = $lang['Logout'];
$l_user = "Hello, ".$userdata['username']."! ";

if ($board_config['points_browse'] && !$post_info['points_disabled'] )
{
$points = $board_config['points_browse'];

if (($userdata['user_id'] !=ANONYMOUS) && ($userdata['admin_allow_points']))
{
add_points($userdata['user_id'], $points);
}
}

}
else
{
$u_login_logout = 'login.'.$phpEx.'?redirect=phpBB';
$l_login_logout = $lang['Login'];
$l_user = "<a class=\"phpnuke\" href=\"/modules.php?name=Your_Account&amp;op=new_user\">Create</a> an account";
}



#
#-----[ OPEN ]-----------------------------------
#
phpBB2/includes/sessions.php

#-----[ FIND ]-----------------------------------
function session_pagestart($user_ip, $thispage_id)

#-----[ FIND ]-----------------------------------
# (This could be due to my mods, or it could be due to phpBB now being version 2.0.14)
function session_pagestart($user_ip, $thispage_id, $thistopic_id=PAGE_INDEX)

#-----[ REPLACE WITH ]-----------------------------------
# (The bolded code could be due the newer phpBB format,
# or it could be from a mod in mine.)
function session_pagestart($user_ip, $thispage_id, $nukeuser)


#
#-----[ OPEN ]-----------------------------------
#
viewtopic.php

#-----[ FIND ]-----------------------------------
$userdata = session_pagestart($user_ip, $forum_id);

#-----[ FIND ]-----------------------------------
# (This could be due to my mods, or it could be due to phpBB now being version 2.0.14)
$userdata = session_pagestart($user_ip, $forum_id, $topic_id);

#-----[ REPLACE WITH ]-----------------------------------
# (Due to either version upgrade or because my phpBB is modded):
$userdata = session_pagestart($user_ip, $forum_id, $topic_id, $nukeuser);


THAT'S ALL, FOLKS!!!

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
andrewbelcher
Joined: Jun 09, 2005
Posts: 8

Posted: Thu Jun 09, 2005 4:49 pm
Could I have a little help? I did all of the above and got this in return (every time I attempt to log in... Not tried anything else yet, but this has cropped up):

"Parse error: parse error, unexpected $ in /home/jamiea64/public_html/testnukebb/modules/Your_Account/index.php on line 1717"

The thing that really throws me is that line 1717 is the last line in index.php, and consists only of "?>"...

Any help would be greatly appreciated! It's using phpBB2 2.0.13 and phpNuke 7.6 (I followed all the 7.6 specific commands)

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Jun 10, 2005 6:11 am
it means:
1. there is whitespace after the ?> . if so, delete it (and any blank lines after it).
2. there is a lingering $ somewhere in the code that doesn't belong....

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
andrewbelcher
Joined: Jun 09, 2005
Posts: 8

Posted: Fri Jun 10, 2005 6:27 am
It doesn't have a whitespace...

Any way to find out where in the file it has the extra $?

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Jun 10, 2005 7:42 am
the easiest way is to look at the lines you've modified, look for un-escaped strings, etc...

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
andrewbelcher
Joined: Jun 09, 2005
Posts: 8

Posted: Fri Jun 10, 2005 10:41 am
I did that, but unfortunately to no avail... I can't see any stray $ signs... Everything is exactly as the above modifications say (I even re-did them to no avail). Any other ideas?

Here is the full code incase that will help... Unfortunately it's quite big... So I don't know if it will help really...

Hmmm... OK - I can't work out how to do that php thingy... How can I do that? As I don't want to post 1700 lines unless it's default is collapsed Razz

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sat Jun 11, 2005 7:35 am
you can use:
[ php ] and [ /php ] but remove the spaces..

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
andrewbelcher
Joined: Jun 09, 2005
Posts: 8

Posted: Mon Jun 13, 2005 11:50 am
Ahh, cool. We'll... Here is the problematic file!

Hmmm... Doesn't like it. Told me the HTML tags I used we're allowed.


Also, when I tried going to the forums it came up with this:

Quote: › phpBB : Critical Error

Could not query config information

DEBUG MODE

SQL Error : 1146 Table 'jamiea64_testnukebb.nuke_bbconfig' doesn't exist

SELECT * FROM nuke_bbconfig

Line : 218
File : /home/jamiea64/public_html/testnukebb/modules/Forums/common.php

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Fri Jun 17, 2005 12:48 am
I kept getting that same error/debug message myself, whether I used my current phpBB & Nuke 7.6 or instead used the premodded distribution that was on this site once upon a time and disappeared when the URL changed. I got tired of banging my head on my desk, I don't like headaches very much. Laughing So I put the phpbb2/Nuke Integration on the back burner for the time being.... school has to come first whether I like it or not. (LOL) But I'm still going to work this out if it kills me, as soon as I have the time and the focus.

BTW Dari, I believe I still have that .zip saved on a CD that you'd distributed when I'd first found your site and the integration instructions/files (phpBB 2.10 & Nuke 7.4), if it's missing due to URL/database (whatever) changes per chance. Mr. Green

~~ Kat ~~

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Stijevo
Joined: Jul 10, 2005
Posts: 5

Posted: Mon Jul 11, 2005 9:03 pm
Ok I have tried this like 100 times, both new install and existing install. I have had no success with either. I need to post some help now, I am getting fed up.

Here is the error I am getting.

phpBB : Critical Error

Error creating new session

DEBUG MODE

SQL Error : 1054 Unknown column 'session_admin' in 'field list'

INSERT INTO nukebb_sessions (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin) VALUES ('2ae12b740c5901cd54f9db0a21a416fa', -1, 1121133654, 1121133654, '182b226b', 0, 0, 0)

Line : 172
File : sessions.php

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Mon Jul 11, 2005 9:12 pm
(I ran across this problem myself when phpBB's version 2.0.15 came out.)

That's because in phpBB's version 2.0.15 and now 2.0.16 the phpbb_sessions table has changed, added "sesson_admin" into the tables which "includes/sessions.php" calls for.....

The table info is now as follows (copied from MY database, so of course take note of the prefix if you use a different one!.... also, MY board is premodded for now until I get my "vanilla" board modded enough to replace the crappy coding that the premodded board has LOL, so what you REALLY need to do is look at phpBB's installation .sql files, search for "phpbb_sessions" and look at the database formation from there):


Code: › DROP TABLE IF EXISTS `phpbb_sessions`;
CREATE TABLE IF NOT EXISTS `phpbb_sessions` (
  `session_id` char(32) NOT NULL default '',
  `session_user_id` mediumint(8) NOT NULL default '0',
  `session_start` int(11) NOT NULL default '0',
  `session_time` int(11) NOT NULL default '0',
  `session_ip` char(8) NOT NULL default '0',
  `session_page` int(11) NOT NULL default '0',
  `session_topic` int(11) NOT NULL default '0',
  `session_logged_in` tinyint(1) NOT NULL default '0',
  `session_admin` tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (`session_id`),
  KEY `session_user_id` (`session_user_id`),
  KEY `session_id_ip_user_id` (`session_id`,`session_ip`,`session_user_id`)
) TYPE=MyISAM;


Which version of phpBB are you using???
(It would appear to me that your sessions.php file isn't matching up with your phpbb_sessions database table.)

If you're using 2.0.15 or higher, then that's what's wrong: you're missing the `session_admin` field in the phpbb_sessions table.

If you're using a phpBB version LOWER than 2.0.15, then that field will NOT be in the phpbb_sessions table.

Hope that helps. Smile
~~ Kat ~~

P.S.:
Refer to http://www.nukedgallery.net/posts1606-start15.html and you'll see a BIG reason why this isn't working.... easier to just give you the link than to retype all the B.S. involved with Nuke. Wink However, whether you continue with the attempt at Nuke/phpBB integration or not, the phpBB install definitely isn't matching up with the includes/sessions.php file.... easy error, I made the same one myself as I didn't pay enough attention when I upgraded to 2.0.15 Laughing

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Stijevo
Joined: Jul 10, 2005
Posts: 5

Posted: Mon Jul 11, 2005 9:37 pm
Ok I am using PHPBB 2.0.16 and PHPNuke 7.7

I did what you said, I deleted my old _session and made my new _session with the code you posted.

I can access the page but now this happens.
http://www.stijevo.tat-webhost.com/CroZ ... /index.php

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Mon Jul 11, 2005 9:47 pm
You REALLY need to read the OTHER phpBB2 integration within PHPNuke thread here, the last page in particular: http://www.nukedgallery.net/posts1606-start15.html

Dari himself has said that it's probably never going to work because of all of the changes Nuke makes with every new release. This is an integration that DID work with an earlier Nuke release, but they've changed it so drastically since that it's just too difficult to keep up with all of the changes that FB makes in Nuke's structure.

Dari is in the process of "dumping" Nuke and making this site powered strictly by phpBB (he explains it on the page to which I linked in the first paragraph of this post).... he's the one who wrote the tutorial so that just goes to show how cruddy Nuke has become RE: attempts at modifying it at ALL, much less making it compatible with standalone phpBB.

However, RE: the standalone phpBB and the "cannot modify headers" errors.... Just out of curiousity, do you have GZip Compression on or off? (Many times if that is turned on, you get all sorts of error/debug messages like the ones on your page unless it's modded in a way that allows for GZip Compression without interfering with the rest of the phpBB codes.) Wink

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Stijevo
Joined: Jul 10, 2005
Posts: 5

Posted: Mon Jul 11, 2005 9:57 pm
SO what the other post is saying is that its a waist of time and that I should just drop it and use somthing other then phpnuke?

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Mon Jul 11, 2005 10:12 pm
That's what I'm doing, using standalone phpBB with Smartor's portal INSTEAD of PHPNuke.... and Dari said he is also going to be switching this site over to standalone phpBB and "dumping" Nuke altogether (but he did stress that he'll continue with Nuke support), although when I'm not sure as it will be a LOT of work for Dari to make the switch with a site that's already up and running and has SO many users and posts, etc.

However, I'm not a pro by any means, I can only help with things that I've personally experienced and therefore "know the ropes" in those particular areas. Cool Dari's not online I'm guessing, or he'd have responded by now. And since it's Dari's tutorial and I don't know enough about Nuke's sloppy (IMNSHO) coding, then Dari would be the one to give that "final answer" as to whether or not it's a waste of time. Wink

But yes, it does appear to be as such, to me at this point anyhow.... unless you are using the versions of phpBB and Nuke that were in the tutorial to begin with and don't upgrade, especially don't upgrade Nuke as THAT is where the coding/structure has changed so drastically. However, not upgrading means HUGE security loopholes.... talk about a rock and a hard place, eh? Rolling Eyes

That's why I chose phpBB over Nuke to begin with.... although I am NOT a PHP pro, I've learned enough to apply mods/hacks; and phpBB is much more reliable than Nuke when it comes to modifying the program and still having a working site that won't leave you wanting to rip your hair out and take a sledge hammer to your computer. Laughing

Wish I could be of more help. Nuke itself can be a good CMS, especially if the owner/admin doesn't do much modding.... but phpBB can be modded to work LIKE a CMS by using Smartor's portal and phpBB is extremely versatile when it comes to modding/hacking the program and still having a site that functions.

~~ Kat ~~

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Stijevo
Joined: Jul 10, 2005
Posts: 5

Posted: Mon Jul 11, 2005 10:33 pm
Hmm Well I really like phpBB and also know enough of it to mod it hack it and what not, thats the only type of board i have used and I would like to stay with it. Thats why I wanted to use a standalone phpbb with phpnuke so i can mod phpbb.

So I guess I can try this other Smartors protal thingy and see how I like it. What exactly is and and what does it do?

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Mon Jul 11, 2005 10:59 pm
Well, Smartor's portal is actually a pretty simple mod to install if I remember correctly. (It's been about a year and a half since I installed it, so I don't remember 100% the difficulty level as I've done SO MANY mods/hacks since then. LOL)

But Smartor's portal works a lot like Nuke does, insofar as being able to take phpBB and make it function like a CMS. (Actually any GOOD portal will make phpBB function much like a CMS, which is what Nuke is anyhow.) Here's one place you can download it: http://www.phpbbhacks.com/download/694

There are other portals as well, not by Smartor (I've used IMPortal by IntergaMOD listed on the page of the following link, and it worked great as well), phpbbhacks.com's initial portal page is: http://www.phpbbhacks.com/category/34/ (ezPortal is the one by Smartor, BTW).

And then there are tons of portal addon's, each portal has different addon's so it's probably a good idea to explore the initial portals and find what works best FOR YOU.... also at phpbbhacks.com: http://www.phpbbhacks.com/category/28/

Also, if you go to phpbb.com I'm sure that in their downloads section there will be portals and portal addons that phpbb.com has "approved" and therefore supports if/when you need help. I simply gave the phpbbhacks.com links because I already had them saved so it was easy to copy/paste the URL's here. Cool

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Mon Jul 11, 2005 11:08 pm
P.S.

Although my board is heavily modded, you can see how the portals work on phpBB by looking at my site's home page: http://katatawnic.com/forums/ (And no, I'm not asking for you to register or anything like that. Wink I simply was rereading what I just posted and realized that I could SHOW you the versatility that portals for phpBB can give you.)


(Edited for URL change at my domain.)

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Jul 12, 2005 7:56 am
Also, Gallery (both 1 and 2) can be easily embedded into phpBB.

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Stijevo
Joined: Jul 10, 2005
Posts: 5

Posted: Wed Jul 13, 2005 3:41 pm
And with this can I use any template I want that I use for the forums?
SO if I have one template for the forums it can use that some template for the site?

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Reven
Joined: Aug 08, 2005
Posts: 1

Posted: Mon Aug 08, 2005 10:15 pm
Step 4, renaming all the tables, seems to be to be completely unnecesary.
The underscore separating the prefix from the rest of the table name is actually part of the prefix.

Therefore, you just should be able to just change the phpBB2 config file:
Code: › $table_prefix = 'prefix_bb';
where 'prefix' is whatever your current prefix is. You still have to rename prefix_users to be prefix_bbusers, etc, but it cuts down on a lot of work.

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Mon Aug 08, 2005 11:05 pm
I tried that one a long time ago, and it was a flop.

It's a phpBB thing.... No matter how you instruct phpBB in naming your SQL prefix, it will always add an underscore after the prefix when rendering the database tables/fields.

Therefore, "<prefix>_bbconfig" would render as "<prefix>_bbconfig_" in your database.... I'm sure the problem there can be seen without much pondering. Cool

That is why phpBB's config.php has to have the underscore at the end of the prefix, or absolutely no phpBB files will connect to the database as of course the prefix in config.php won't match up with what prefix phpBB renders in the database . Rolling Eyes

Personally, I think it's a B.S. thing, as one should be able to configure one's database prefix as personally desired, but then again phpBB doesn't have many "bugs" at all compared to other programs.... so I don't complain too much about that one. Wink

~~ Kat ~~

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Ridicule
Joined: Jul 06, 2005
Posts: 4

Posted: Mon Aug 15, 2005 11:59 am
ive got this working on phpBB 2.0.15 @ www.flipside-radio.com

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Fri Aug 19, 2005 11:09 am
What version of Nuke are you using?
What (if any) changes did you implement from the original tutorial?


Remember, from all of the posts RE: this integration, that with all of the Nuke structure changes there've been major problems in getting this to work.... there are many of us who would really love to see how it got done. Cool

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Ridicule
Joined: Jul 06, 2005
Posts: 4

Posted: Wed Oct 19, 2005 11:56 am
ill be re-installing phpbb soon so when i re-do this ill tell you what i had to change, theres a few bits but my memory is lacking in detail as it was a couple months ago... By the way if you get a blank page you need to turn on debugging messages in phpnuke

AuthorMessage
Post Title: Re: Standalone phpBB2 integration within PHPNuke - Part II
Katatawnic
Joined: Jan 31, 2005
Posts: 37
Location: Forest Falls, CA; USA
Posted: Thu Oct 20, 2005 7:17 pm
Cool, I'd like to see that.... I'm in the middle of moving and I mean as in ASAP (long story, let's just say "Mr. Right" wasn't just "Mr. Right Now".... he was "Mr. Psychotic and ALL Wrong and Need to Get Out Before Danger Increases for My Son as well as ME!"), but once settled if this is completely workable I'll give it a shot. Cool Wink

~~ Kat ~~

All times are GMT - 5 Hours
Powered by PHPNuke and phpBB2 © 2006 phpBB Group