Ich habe für phpBB2 noch die MOD-Anleitung herumliegen, vielleicht kennt sich jemand gut genug aus, diesen MOD zu portieren...?
Code: Alles auswählen
##############################################################
## MOD Title: Smart Log In Redirect
## MOD Author: Smartor < smartor_xp@hotmail.com > (Hoang Ngoc Tu) http://smartor.is-root.com
## MOD Description: This MOD will redirect user to the page when he
## clicked "log in.out" after logging in successfully
## It can bring much more convenience to your surfing experience :)
## MOD Version: 1.0.2
##
## Installation Level: easy
## Installation Time: 1 Minutes
## Files To Edit: 2
## includes/page_header.php
## includes/functions.php
##
## Included Files: N/A
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes:
##
##############################################################
##
## Revision History:
##
## v1.0.2
## - fix an XSS
## v1.0.1
## - Did not redirect if user on profile.php, login.php
## v1.0.0
## - Initial Release and Final.
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]--------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]--------------------------------------------
#
if ( $userdata['session_logged_in'] )
{
$u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
}
else
{
$u_login_logout = 'login.'.$phpEx;
$l_login_logout = $lang['Login'];
}
#
#-----[ REPLACE WITH ]------------------------------------
#
if ( $userdata['session_logged_in'] )
{
$u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
}
else
{
$smart_redirect = strrchr($HTTP_SERVER_VARS['PHP_SELF'], '/');
$smart_redirect = substr($smart_redirect, 1, strlen($smart_redirect));
if( ($smart_redirect == ('profile.'.$phpEx)) or ($smart_redirect == ('login.'.$phpEx)) )
{
$smart_redirect = '';
}
if( isset($HTTP_GET_VARS) and !empty($smart_redirect) )
{
$smart_get_keys = array_keys($HTTP_GET_VARS);
for ($i = 0; $i < count($HTTP_GET_VARS); $i++)
{
if ($smart_get_keys[$i] != 'sid')
{
$smart_redirect .= '&' . $smart_get_keys[$i] . '=' . $HTTP_GET_VARS[$smart_get_keys[$i]];
}
}
}
$u_login_logout = 'login.' . $phpEx;
$u_login_logout .= (!empty($smart_redirect)) ? '?redirect=' . $smart_redirect : '';
$u_login_logout = htmlspecialchars($u_login_logout);
$l_login_logout = $lang['Login'];
}
# This step is only needed for phpBB 2.0.4
# It's just trying to fix a bug of phpBB 2.0.4, which may affect this mod
#-----[ OPEN ]----------------------------------------
#
includes/funtions.php
#
#-----[ FIND ]----------------------------------------
#
function redirect($url)
{
global $db, $board_config;
if (!empty($db))
{
$db->sql_close();
}
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
$script_name = ($script_name == '') ? $script_name : '/' . $script_name;
$url = preg_replace('#^\/?(.*?)\/?$#', '/\1', trim($url));
#
#-----[ AFTER, ADD ]----------------------------------
#
$url = str_replace('&', '&', $url);
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM