|
From: Michael A. P. I. <sha...@gm...> - 2007-11-16 15:02:54
|
On 11/15/07, Jon Angliss <jo...@sq...> wrote:
> Doing some research on this, it might not be too difficult, you
> *should* be able to catch this in the logout_error hook. It's a bit of
> a "cheap shot" so to speak, but you can probably do something like
> this:
>
> function login_auto_logout_err() {
> if (defined('PAGE_NAME') && (PAGE_NAME == 'webmail')) {
> if (!empty($_COOKIE['user'])) {
> header('Location: ' . SM_PATH . 'src/login.php');
> }
> }
> }
>
> This forces a redirect to the login page, only if the page is webmail,
> and the login_auto cookie 'user' is set. This will allow the normal
> login_auto code to kick in. You'll also need to update the
> squirrelmail_plugin_hooks, which is in the _init function in
> login_auto/setup.php.
>
> $squirrelmail_plugin_hooks['logout_error']['login_auto'] = 'login_auto_logout_err';
Thanks.
O.K. in login_auto/setup.php, I have (showing relevant parts only):
function squirrelmail_plugin_init_login_auto() {
$squirrelmail_plugin_hooks['logout_error']['login_auto'] =
'login_auto_logout_err';
}
function login_auto_logout_err() {
if (defined('SM_PATH'))
include_once(SM_PATH . 'plugins/login_auto/functions.php');
else
include_once('../plugins/login_auto/functions.php');
login_auto_logout_err_do();
}
In login_auto/functions.php, I have (showing relevant parts only):
function login_auto_logout_err_do() {
if (defined('PAGE_NAME') && (PAGE_NAME == 'webmail')) {
if (!empty($_COOKIE['user'])) {
header('Location: ' . SM_PATH . 'src/login.php');
}
}
}
login_auto_logout_err_do() never seems to be called and no redirection happens.
login_auto_logout_err never seems to be called either.
Do I have something incorrect?
I just skipped all that and edited functions/display_messages.php.
I added:
header('Location: ' . SM_PATH . 'src/login.php');
right before:
list($junk, $errString, $errTitle, $logout_link)
= do_hook('logout_error', $errString, $errTitle, $logout_link);
and it works great.
How can I accomplish that from login_auto?
Thanks.
--
Michael
|