Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
m_squirrelmail Class Reference

This class handle squirrelmail's webmail hook the main panel page to add a link to the webmail. More...

Public Member Functions

 hook_admin_webmail ()
 Hook called by the homepage or the /webmail link to redirect the user to a known webmail url.
 hook_mail_delete_for_real ($mail_id, $fullmail)
 Hook called when an email is REALLY deleted (by the cron, not just in the panel)

Detailed Description

This class handle squirrelmail's webmail hook the main panel page to add a link to the webmail.

Definition at line 30 of file m_squirrelmail.php.

Member Function Documentation

hook_admin_webmail ( )

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.

Returns
string the URL of the webmail

Definition at line 38 of file m_squirrelmail.php.

References $db, $domain, $host, and $i.

{
global $db;
// Search for the domain where the panel is hosted, then search for a webmail in it.
$i=2;
$domain="";
if (!empty($_SERVER["HTTP_HOST"])) {
do { // for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
$expl=explode(".",$_SERVER["HTTP_HOST"],$i);
if (count($expl)>=2) {
list($host,$dompart)=$expl;
// We search for a 'squirrelmail' subdomain in that domain
$db->query("SELECT * FROM sub_domaines s WHERE s.domaine='".addslashes($dompart)."' AND s.type='squirrelmail';");
if ($db->next_record()) {
$domain=$db->Record;
return "http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"];
}
}
$i++;
} while (strpos($dompart,'.')!==false);
}
// not found: search for a webmail in the admin user account
$db->query("SELECT * FROM sub_domaines s WHERE s.compte=2000 AND s.type='squirrelmail';");
if ($db->next_record()) {
$domain=$db->Record;
return "http://".$domain["sub"].(($domain["sub"])?".":"").$domain["domaine"];
}
}
hook_mail_delete_for_real (   $mail_id,
  $fullmail 
)

Hook called when an email is REALLY deleted (by the cron, not just in the panel)

Parameters
mail_idinteger the ID of the mail in the AlternC database
fullmailstring the deleted mail himself in the form of john@.nosp@m.doma.nosp@m.in.tl.nosp@m.d
Returns
boolean

Definition at line 75 of file m_squirrelmail.php.

References $t.

{
$fullmail2 = str_replace('@','_',$fullmail); // fullname with _ instead of @ (compatibility)
$todel = array (
"$fullmail.abook",
"$fullmail.pref",
"$fullmail2.abook",
"$fullmail2.pref");
foreach ( $todel as $t ) {
if (file_exists("/var/lib/squirrelmail/data/$t") ) {
@unlink("/var/lib/squirrelmail/data/$t");
}
}
} // hook_mail_delete_for_real

The documentation for this class was generated from the following file: