i thought somebody would be interested in this simple hack.
Version: Squirrel Mail 1.4.1 for Xoops, XOOPS 2.0.7
Summary: This hack adds a checkbox at XOOPS user login page. When checked, checklogin redirect successful logon to sqmail for a login attempt. No kernel hack involved.
Files involved (5):
language/english/user.php
modules/system/templates/system_userform.html
user.php
include/checklogin.php
modules/sqmail/src/redirect.php
Step One: Add a dictionary entry in language/english/user.php
[color=00CC00]define('_US_LOGINMAIL','Login My Mail too');[/color]
Step Two: Modify user.php to add the dictionary word
$xoopsTpl->assign('lang_youremail', _US_YOUREMAIL);
$xoopsTpl->assign('lang_sendpassword', _US_SENDPASSWORD);
[color=00CC00]$xoopsTpl->assign('lang_loginmail', _US_LOGINMAIL);[/color]
include 'footer.php';
} elseif ( $xoopsUser ) {
Step Three: Add a checkbox in system_userform.html (note: you can recompile system module now to see the change)
[color=00CC00]<small><input type="checkbox" name="sync_sqmail" value="1" /><{$lang_loginmail}>small><br>[/color]
<input type="hidden" name="op" value="login" />
<input type="hidden" name="xoops_redirect" value="<{$redirect_page}>" />
<input type="submit" value="<{$lang_login}>" />
Step Four: Tweak checklogin.php a bit
$notification_handler->doLoginMaintenance($user->getVar('uid'));
[color=00CC00]if (isset($sync_sqmail))
{
$HTTP_SESSION_VARS['login_username'] = $uname;
$HTTP_SESSION_VARS['secretkey'] = $pass;
$HTTP_SESSION_VARS['login_quietly'] = 1;
$HTTP_SESSION_VARS['login_redirect'] = $url;
$HTTP_SESSION_VARS['login_redirect_text'] =
sprintf(_US_LOGGINGU, $user->getVar('uname'));
redirect_header(
XOOPS_URL."/modules/sqmail/src/redirect.php",
0,
sprintf(_US_LOGGINGU, $user->getVar('uname')));
}[/color]
redirect_header($url, 1, sprintf(_US_LOGGINGU, $user->getVar('uname')));
} else {
redirect_header(XOOPS_URL.'/user.php',1,_US_INCORRECTLOGIN);
}
exit();
Step Five(optional): In case you wished a silent login for Squirrel mail, add the following in redirect.php.
Part a:
sqGetGlobalVar('secretkey', $secretkey);
[color=00CC00]sqGetGlobalVar('login_quietly', $login_quietly);
sqGetGlobalVar('login_redirect', $login_redirect);
sqGetGlobalVar('login_redirect_text', $login_redirect_text);[/color]
sqGetGlobalVar('js_autodetect_results', $js_autodetect_results);
Part b:
/* Write session data and send them off to the appropriate page. */
session_write_close();
[color=00CC00]if ($login_quietly)
{
sqsession_unregister('login_username');
sqsession_unregister('secretkey');
sqsession_unregister('login_quietly');
sqsession_unregister('login_redirect');
sqsession_unregister('login_redirect_text');
redirect_header($login_redirect, 1, $login_redirect_text);
}
else[/color] header("Location: $redirect_url");
Well done.
i hope this is helpful. Please give me your comments.