|
return $userdata;
|
|
-}{CODE}
|
|
-''Add After:''
|
-{CODE(colors=>'php')}// {{{ BEGIN TIKI MOD
|
-function check_tiki_user( &$p_user_data ) {
|
+} |
+{/code} |
+ |
+''Add After:'' (i'm afraid we can't use php syntax highlighting as it causes the code plugin to crash) |
+{code source='Html4Strict'} |
+// {{{ BEGIN TIKI MOD |
+function check_bit_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;
|
+ global $db, $gBitSystem, $gBitUser, $userlib, $HTTP_GET_VARS; |
|
- if( empty($p_user_data['user_id']) || ($p_user_data['user_id'] == ANONYMOUS)
|
- || ( $gTikiUser->isValid() && $gTikiUser->mUserId != $p_user_data['user_id'] )
|
+ $anon = $p_user_data['user_id'] == ANONYMOUS; |
+ if( empty($p_user_data['user_id']) || $anon |
+ || ( $gBitUser->isRegistered() && $gBitUser->mUserId != $p_user_data['user_id'] ) |
) {
|
-
|
- if( $gTikiUser->isValid() ) {
|
+ if( $gBitUser->isRegistered() ) { |
//
|
// 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)) )
|
+ $sql = "SELECT * |
+ FROM " . USERS_TABLE . " |
+ WHERE user_id = '".$gBitUser->mUserId."'"; |
+ if ( !($result = $db->sql_query($sql)) ) |
{
|
- message_die(CRITICAL_ERROR, 'Could not obtain tiki user from phpBB user table', '', __LINE__, __FILE__, $sql);
|
+ message_die(CRITICAL_ERROR, 'Could not obtain bitweaver user from phpBB user table', '', __LINE__, __FILE__, $sql); |
+ } |
+ $user_row = $db->sql_fetchrow($result); |
+//vd( $user_row ); |
+ $md5 = ( $gBitSystem->mPrefs['feature_clear_passwords'] == 'y' ); |
+ $phpbb_password = ( $md5 ? $gBitUser->mInfo['password'] : md5( $gBitUser->mInfo['password'] ) ); |
+ // nuke their existing session cause it stores anonymous_id (-1) initially |
+ $sql = "DELETE FROM " . SESSIONS_TABLE . " |
+ WHERE session_id = '".$p_user_data['session_id']."'"; |
+ if ( !$db->sql_query($sql) ) |
+ { |
+ message_die(CRITICAL_ERROR, 'Error clearing sessions table', '', __LINE__, __FILE__, $sql); |
}
|
- $user_row = $db->sql_fetchrow($result);
|
- $md5 = ( $gTikiSystem->mPrefs['feature_clear_passwords'] == 'y' );
|
- $phpbb_password = ( $md5 ? $gTikiUser->mInfo['password'] : md5( $gTikiUser->mInfo['password'] ) );
|
if( empty( $user_row['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->mInfo['user_id'].", ".$gTikiSystem->mDb->qstr( $gTikiUser->mInfo['login'], get_magic_quotes_gpc() ).", ".strtotime('now').", ".$gTikiSystem->mDb->qstr( $phpbb_password, get_magic_quotes_gpc() ).", '".$gTikiUser->mInfo['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);
|
- }
|
+ $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 ( ".$gBitUser->mInfo['user_id'].", ".$gBitSystem->mDb->qstr( $gBitUser->mInfo['login'], get_magic_quotes_gpc() ).", ".strtotime('now').", ".$gBitSystem->mDb->qstr( $phpbb_password, get_magic_quotes_gpc() ).", '".$gBitUser->mInfo['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)$gBitUser->isAdmin().", 0, 1, NULL)"; |
|
- // nuke their existing session cause it stores anonymous_id (-1) initially
|
- $sql = "DELETE FROM " . SESSIONS_TABLE . "
|
- WHERE session_id = '".$p_user_data['session_id']."'";
|
- if ( !$db->sql_query($sql) )
|
+ if ( !($result = $db->sql_query($sql)) ) |
{
|
- message_die(CRITICAL_ERROR, 'Error clearing sessions table', '', __LINE__, __FILE__, $sql);
|
+ message_die(CRITICAL_ERROR, 'Could not create bitweaver user for phpBB', '', __LINE__, __FILE__, $sql); |
}
|
} else {
|
// Has user data changed?
|
- if( ($user_row['user_email'] != $gTikiUser->mInfo['email'])
|
+ if( ($user_row['user_email'] != $gBitUser->mInfo['email']) |
|| ($user_row['user_password'] != $phpbb_password)
|
- || ($user_row['username'] != $gTikiUser->mInfo['login'])
|
+ || ($user_row['username'] != $gBitUser->mInfo['login']) |
)
|
{
|
- $sql = "UPDATE ". USERS_TABLE ." SET username=".$gTikiSystem->mDb->qstr( $gTikiUser->mInfo['login'], get_magic_quotes_gpc() ).", user_email = ".$gTikiSystem->mDb->qstr( $gTikiUser->mInfo['email'], get_magic_quotes_gpc() ).", user_password=".$gTikiSystem->mDb->qstr( $phpbb_password, get_magic_quotes_gpc() )."
|
- WHERE user_id = ".$user_row['user_id'];
|
- if ( !($result = $db->sql_query($sql)) )
|
+ $sql = "UPDATE ". USERS_TABLE ." SET username=".$gBitSystem->mDb->qstr( $gBitUser->mInfo['login'], get_magic_quotes_gpc() ).", user_email = ".$gBitSystem->mDb->qstr( $gBitUser->mInfo['email'], get_magic_quotes_gpc() ).", user_password=".$gBitSystem->mDb->qstr( $phpbb_password, get_magic_quotes_gpc() )." |
+ WHERE user_id = ".$user_row['user_id']; |
+ if ( !($result = $db->sql_query($sql)) ) |
{
|
- message_die(CRITICAL_ERROR, 'Could not create tiki user for phpBB', '', __LINE__, __FILE__, $sql);
|
+ message_die(CRITICAL_ERROR, 'Could not create bitweaver user for phpBB', '', __LINE__, __FILE__, $sql); |
die;
|
}
|
}
|
}
|
- $p_user_data['user_id'] = $gTikiUser->mUserId;
|
- $p_user_data['userid'] = $gTikiUser->mUserId;
|
+ // Restart the session because somehow we lost it. |
+ $p_user_data = session_begin( $gBitUser->mUserId, $p_user_data['session_ip'], $p_user_data['session_page'], TRUE, TRUE ); |
+ } else { |
+ // We have an anonymous session |
+ $user_id = ( isset($p_user_data['user_id']) ) ? intval($p_user_data['user_id']) : ANONYMOUS; |
+ |
+ if ( !($p_user_data = session_begin( $user_id, $p_user_data['user_ip'], $p_user_data['session_page'], TRUE, TRUE, , (int)$gBitUser->isAdmin() )) ) |
+ { |
+ message_die(CRITICAL_ERROR, 'Error creating user session', '', __LINE__, __FILE__, $sql); |
+ } |
+ } |
+ } elseif( $gBitUser->isRegistered() ) { |
+ if( empty( $p_user_data['session_id'] ) ) { |
+ // we need a session |
+ $p_user_data = session_begin( $gBitUser->mUserId, $p_user_data['session_ip'], $p_user_data['session_page'], TRUE, TRUE, (int)$gBitUser->isAdmin() ); |
+ } |
+ } else { |
+ if( $p_user_data['session_logged_in'] ) { |
+ //our bitweaver session has ended before our phpBB session |
+ session_end( $p_user_data['session_id'], $p_user_data['user_id'] ); |
+ $p_user_data = session_begin( ANONYMOUS, $p_user_data['session_ip'], $p_user_data['session_page'] ); |
}
|
}
|
}
|
-// }}} END TIKI MOD{CODE}
|
+{/code} |
|
''Save and upload the file.''
|
+ |
+--- |
+ |
+__In ./db/postgres7.php:__ |
+ |
+Bug fix for phpBB in postgres schemas. |
+ |
+''Find:'' |
+{code source="php"} |
+ |
+ if( preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->last_query_text[$query_id], $tablename) ) |
+{/code} |
+ |
+replace with |
+{code source="php"} |
+ |
+if( preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([-a-z0-9\_\.]+)/is", $this->last_query_text[$query_id], $tablename) ) |
+{/code} |
+ |
+--- |
+ |
+__In ./viewtopic.php__ |
+ |
+Bug fix for mystery function "phpbb_rtrim" which doesn't appear to be defined anywhere. |
+ |
+''Find:'' |
+{code source="php"} |
+ |
+ $highlight_match = phpbb_rtrim($highlight_match, "\\"); |
+{/code} |
+ |
+replace with |
+{code source="php"} |
+ |
+ $highlight_match = rtrim($highlight_match, "\\"); |
+{/code} |
+ |
|
---
|
|
__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>
|
+{code source='php'} |
+<a class="menuoption" href="{$smarty.const.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>
|
+<a class="menuoption" href="{$smarty.const.PHPBB_PKG_URL}search.php?search_id=newposts">{tr}Posts since last visit{/tr}</a> |
+<a class="menuoption" href="{$smarty.const.PHPBB_PKG_URL}search.php?search_id=egosearch">{tr}Your posts{/tr}</a> |
+<a class="menuoption" href="{$smarty.const.PHPBB_PKG_URL}search.php?search_id=unanswered">{tr}Unanswered posts{/tr}</a> |
{/if}
|
-{CODE}
|
+{/code} |
|
''Save and upload the file.''
|
|