diff --git a/bureau/admin/index.php b/bureau/admin/index.php
index f1aeaaf4..f5095b9d 100644
--- a/bureau/admin/index.php
+++ b/bureau/admin/index.php
@@ -88,8 +88,16 @@ if (!$_SERVER[HTTPS]) {
// Here we used to have a form to enter the squirrelmail's webmail.
// Following the "rule of less astonishment, we try to put it here again, even though the webmail is now a plugin.
$res=$hooks->invoke("hook_admin_webmail");
-foreach($res as $r) if ($r!==false) echo $r;
-
+if (($wr=get_variable("webmail_redirect")) && isset($res[$wr]) && $res[$wr]) {
+ $url=$res[$wr];
+} else {
+ foreach($res as $r) if ($r!==false) { $url=$r; break; }
+}
+if ($url) {
+?>
+
+
|
diff --git a/bureau/admin/webmail-redirect.php b/bureau/admin/webmail-redirect.php
index fe174f23..12f93dec 100644
--- a/bureau/admin/webmail-redirect.php
+++ b/bureau/admin/webmail-redirect.php
@@ -25,9 +25,16 @@
require_once("../class/config_nochk.php");
-if ($webmail=variable_get("webmail_redirect","")) {
- header("Location: /$webmail");
+
+ $res=$hooks->invoke("hook_admin_webmail");
+if (($wr=get_variable("webmail_redirect")) && isset($res[$wr]) && $res[$wr]) {
+ $url=$res[$wr];
} else {
- header("Location: /nowebmail.php");
+ foreach($res as $r) if ($r!==false) { $url=$r; break; }
+}
+if ($url) {
+ header("Location: $url");
+} else {
+ header("Location: /nowebmail");
}
diff --git a/squirrelmail/class/m_squirrelmail.php b/squirrelmail/class/m_squirrelmail.php
index 1feddf02..f1195d6b 100644
--- a/squirrelmail/class/m_squirrelmail.php
+++ b/squirrelmail/class/m_squirrelmail.php
@@ -29,6 +29,12 @@
*/
class m_squirrelmail {
+ /* ----------------------------------------------------------------- */
+ /** Hook called by the homepage or the /webmail link
+ * to redirect the user to a known webmail url.
+ * the variable 'webmail_redirect' tells which webmail has the priority.
+ * @return string the URL of the webmail
+ */
function hook_admin_webmail() {
global $db;
// not found ? use admin account (2000)
@@ -42,7 +48,7 @@ class m_squirrelmail {
$db->query("SELECT * FROM sub_domaines s WHERE s.domaine='".addslashes($dompart)."' AND s.type='squirrelmail';");
if ($db->next_record()) {
$domain=$db->Record;
- return ""._("To read your mail in a browser, click here to use the Squirrelmail Webmail")."
\n";
+ return "http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"];
}
$i++;
} while (strpos($dompart,'.')!==false);
@@ -51,7 +57,7 @@ class m_squirrelmail {
$db->query("SELECT * FROM sub_domaines s WHERE s.compte=2000 AND s.type='squirrelmail';");
if ($db->next_record()) {
$domain=$db->Record;
- return ""._("To read your mail in a browser, click here to go to the Squirrelmail Webmail")."
\n";
+ return "http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"];
}
}