fixing squirrelmail package for autodetection

This commit is contained in:
Benjamin Sonntag 2012-08-30 12:01:46 +00:00
parent 594b264843
commit 5e23aa74ee
1 changed files with 5 additions and 6 deletions

View File

@ -37,22 +37,21 @@ class m_squirrelmail {
$i=2; $i=2;
$domain=""; $domain="";
do { // for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org) do { // for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
list($host,$domain)=explode(".",$_SERVER["HTTP_HOST"],$i); list($host,$dompart)=explode(".",$_SERVER["HTTP_HOST"],$i);
$dompart=$mat[1];
// We search for a 'squirrelmail' subdomain in that domain // We search for a 'squirrelmail' subdomain in that domain
$db->query("SELECT * FROM subdomaines s WHERE s.domaine='".addslashes($dompart)."' AND s.type='squirrelmail';"); $db->query("SELECT * FROM sub_domaines s WHERE s.domaine='".addslashes($dompart)."' AND s.type='squirrelmail';");
if ($db->next_record()) { if ($db->next_record()) {
$domain=$db->Record; $domain=$db->Record;
return "<p><a href=\"http://".$dompart["sub"].(($dompart["sub"])?".":"").$dompart["domaine"]."\">"._("To read your mail in a browser, click here to use the Squirrelmail Webmail")."</a></p>\n"; return "<p><a href=\"http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"]."\">"._("To read your mail in a browser, click here to use the Squirrelmail Webmail")."</a></p>\n";
} }
$i++; $i++;
} while (strpos($dompart,'.')!==false); } while (strpos($dompart,'.')!==false);
// not found: search for a webmail in the admin user account // not found: search for a webmail in the admin user account
$db->query("SELECT * FROM subdomaines s WHERE s.compte=2000 AND s.type='squirrelmail';"); $db->query("SELECT * FROM sub_domaines s WHERE s.compte=2000 AND s.type='squirrelmail';");
if ($db->next_record()) { if ($db->next_record()) {
$domain=$db->Record; $domain=$db->Record;
return "<p><a href=\"http://".$dompart["sub"].(($dompart["sub"])?".":"").$dompart["domaine"]."\">"._("To read your mail in a browser, click here to use the Squirrelmail Webmail")."</a></p>\n"; return "<p><a href=\"http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"]."\">"._("To read your mail in a browser, click here to go to the Squirrelmail Webmail")."</a></p>\n";
} }
} }