11
Dave_L
Re: Remove redirection within Xoops
  • 2004/12/18 2:47

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Many of the redirects provide informative messages. How would that be handled with a header redirect?

12
talunceford
Re: Remove redirection within Xoops

exactly

13
rajanurs
Re: Remove redirection within Xoops
  • 2004/12/19 20:17

  • rajanurs

  • Just popping in

  • Posts: 55

  • Since: 2004/12/8


I remember there was a similar issue in phpBB and I had easily removed with some minor changes. [Not sure if its there still in the current version of phpBB]


In several instances when the action results in being affirmative there is no need for the message because the user can see the result of the action. For example posting in forums / classifieds and albums.

14
Mithrandir
Re: Remove redirection within Xoops

What some have done is change the redirect_header.php to not show the redirect screen, but instead use a header('location:[...]); to redirect and then add the message to the URL in a GET parameter - e.g. ?xoops_msg=[message]

Then one can add something in header.php to check if $_GET['xoops_msg'] is set and if it is, assign it to a Smarty variable ($xoopsTpl->assign('xoops_msg', $_GET['xoops_msg']). Finally the theme can be changed to include a
<{if $xoops_msg}>
    <
div class="message"><{$xoops_msg}></div>
<{/if}>

and the "message" class can be added to the style.css to make it look pretty.

XOOPS 2.1/2.2 will not have the redirect screen, but instead a similar result as the above mentioned - however, the approach will be somewhat different.

15
senzaciona
Re: Remove redirection within Xoops
  • 2005/3/20 10:05

  • senzaciona

  • Just popping in

  • Posts: 64

  • Since: 2005/3/6 1


can you be more specifid mithrandir how i can make this.

And where i can founf redirect_header.php. I can't find it in xoops.

16
Mithrandir
Re: Remove redirection within Xoops

the function redirect_header() is in include/functions.php

A solution to the redirect screens could be this:

a. Include/functions.php change the function to save the message parameter in a session variable and then send the user along:
function redirect_header($url$time$message) {
  
$_SESSION['xoops_redirect_message'] = $message;
  if (
$addredirect && strstr($url'user.php')) {
        if (!
strstr($url'?')) {
            
$url .= '?xoops_redirect='.urlencode($xoopsRequestUri);
        } else {
            
$url .= '&amp;xoops_redirect='.urlencode($xoopsRequestUri);
        }
    }
    if (
defined('SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']])))) {
        if (!
strstr($url'?')) {
            
$url .= '?' SID;
        } else {
            
$url .= '&amp;'.SID;
        }
    }
    
$url preg_replace("/&amp;/i"'&'htmlspecialchars($urlENT_QUOTES));
  
header("location: ".$url);
}


Then in root/header.php around line 183, just before
if (xoops_getenv('REQUEST_METHOD') != 'POST' && !empty($xoopsModule) && !empty($xoopsConfig['module_cache'][$xoopsModule->getVar('mid')])) {

put this:
if (isset($_SESSION['xoops_redirect_message'])) {
  
$xoopsTpl->assign('xoops_redirect_message'$_SESSION['xoops_redirect_message']);
  unset(
$_SESSION['xoops_redirect_message']);
}


and place <{$xoops_redirect_message}> somewhere in your theme's theme.html to display the message.

ONE MAJOR FLAW, though: if your users have multiple browser windows open, they may get irregular messages, but this is a 5-minute change, that could perhaps take the edge of the annoyance.

17
senzaciona
Re: Remove redirection within Xoops
  • 2005/3/20 13:16

  • senzaciona

  • Just popping in

  • Posts: 64

  • Since: 2005/3/6 1


Thnx very much Mithrandir.

Now it works like i want to.

SO reall ytnx for that very good tutorila Mithrandir.

Thnx again.

18
Herko
Re: Remove redirection within Xoops
  • 2005/3/20 15:39

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


lets put this in the FAQ

Herko

19
Mithrandir
Re: Remove redirection within Xoops

Nah. As I said, it is not a perfect solution as it may not show correctly, if a user e.g. submits two forms from two browser windows/tabs.

20
stelian
Re: Remove redirection within Xoops
  • 2006/1/27 13:45

  • stelian

  • Just popping in

  • Posts: 87

  • Since: 2005/12/17


Hi all.

I want my redirection page to looks like in XOOPS 2.0.13 (a plain page and the message) without the header and footer like in XOOPS 2.2.3. I am using XOOPS 2.2.3 . Please help me.

How can i change this code?

XOOPS 2.2.3
/*
* Function to redirect a user to certain pages
*/
function redirect_header($url$time 3$message ''$addredirect true)
{
    global 
$xoopsConfig$xoopsLogger$xTheme$xoopsOption$xoopsModule$xoopsUser$xoopsTpl;
    if ( 
preg_match"/[\0-\31]|about :|script:/i"$url) ) {
        if (!
preg_match('/^b(java)?script:([s]*)history.go(-[0-9]*)([s]*[;]*[s]*)$/si'$url) ) {
            
$url XOOPS_URL;
        }
    }
    
//$xTheme->tplEngine->assign('xoops_showrblock', 1);

    
$xTheme->tplEngine->assign('time'intval($time));
    if (
$addredirect && strstr($url'user.php')) {
        if (!
strstr($url'?')) {
            
$url .= '?xoops_redirect='.urlencode($_SERVER['REQUEST_URI']);
        } else {
            
$url .= '&xoops_redirect='.urlencode($_SERVER['REQUEST_URI']);
        }
    }
    if (
defined('SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']])))) {
        if (!
strstr($url'?')) {
            
$url .= '?' SID;
        } else {
            
$url .= '&'.SID;
        }
    }
    
$url preg_replace("/&/i"'&'htmlspecialchars($urlENT_QUOTES));
    
$xTheme->tplEngine->assign('url'$url);
    
$message trim($message) != '' $message _TAKINGBACK;
    
$xTheme->tplEngine->assign('message'$message);
    
$xTheme->tplEngine->assign('lang_ifnotreload'sprintf(_IFNOTRELOAD$url));
    
$xTheme->tplEngine->assign('xoops_module_header''<meta http-equiv="Refresh" content="2; url='.$url.'" />');
    
$xoopsOption['template_main'] = 'system_redirect.html';
    include 
XOOPS_ROOT_PATH."/footer.php";
    exit();
}

function 
xoops_getenv($key)
{
    return isset(
$_SERVER[$key]) ? $_SERVER[$key] : (isset($_ENV[$key]) ? $_ENV[$key] : null);
}


XOOPS 2.0.13.2
/*
* Function to redirect a user to certain pages
*/
function redirect_header($url$time 3$message ''$addredirect true)
{
    global 
$xoopsConfig$xoopsRequestUri$xoopsLogger$xoopsUserIsAdmin;
    if ( 
preg_match"/[\0-\31]|about :|script:/i"$url) ) {
        
$url XOOPS_URL;
    }
    if (
defined('XOOPS_CPFUNC_LOADED')) {
        
$theme 'default';
    } else {
        
$theme $xoopsConfig['theme_set'];
    }
    require_once 
XOOPS_ROOT_PATH.'/class/template.php';
    
$xoopsTpl = new XoopsTpl();
    
$xoopsTpl->assign(array('xoops_theme' => $theme'xoops_imageurl' => XOOPS_THEME_URL.'/'.$theme.'/''xoops_themecss'=> xoops_getcss($theme), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
    if (
$xoopsConfig['debug_mode'] == && $xoopsUserIsAdmin) {
        
$xoopsTpl->assign('time'300);
        
$xoopsTpl->assign('xoops_logdump'$xoopsLogger->dumpAll());
    } else {
        
$xoopsTpl->assign('time'intval($time));
    }
    if (
$addredirect && strstr($url'user.php')) {
        if (!
strstr($url'?')) {
            
$url .= '?xoops_redirect='.urlencode($xoopsRequestUri);
        } else {
            
$url .= '&xoops_redirect='.urlencode($xoopsRequestUri);
        }
    }
    if (
defined('SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '' && !isset($_COOKIE[$xoopsConfig['session_name']])))) {
        if (!
strstr($url'?')) {
            
$url .= '?' SID;
        } else {
            
$url .= '&'.SID;
        }
    }
    
$url preg_replace("/&/i"'&'htmlspecialchars($urlENT_QUOTES));
    
$xoopsTpl->assign('url'$url);
    
$message trim($message) != '' $message _TAKINGBACK;
    
$xoopsTpl->assign('message'$message);
    
$xoopsTpl->assign('lang_ifnotreload'sprintf(_IFNOTRELOAD$url));
    
$xoopsTpl->display('db:system_redirect.html');
    exit();
}



I don't think it's something verry complicated, but i can't figure it out what could it be.


Best regards,
Stelian.

Login

Who's Online

186 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 186


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits