source: alternc/trunk/bureau/class/m_mail_squirrelmail.php @ 3147

Revision 3147, 1.5 KB checked in by squidly, 14 months ago (diff)

Ajout configuration squirrelmail + bugfixes pour postfix

Line 
1<?php 
2
3/*
4 * Proof of concept of what a new feature look like with the new mail interface
5 *
6**/
7
8Class m_mail_squirrelmail{
9  var $advanced;
10  var $enabled;
11
12  function m_mail_squirrelmail(){
13    // Get configuration var
14  }
15
16  function hooks_squirrelmail_init($mail,$dom){
17                global $err,$cuid,$db;
18    $err->log("mail_squirrelmail","squirrelmail_init",$mail."@".$dom);
19    $m=substr($mail,0,1);
20    $gecos=$mail;
21    if (!$mail) {
22      // Cas du CATCH-ALL
23      $gecos="Catch-All";
24      $m="_";
25    }
26
27               
28    $f=fopen("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","wb");
29    $g=0; $g=@fopen("/etc/squirrelmail/default_pref","rb");
30    fputs($f,"email_address=$mail@$dom\nchosen_theme=default_theme.php\n");
31    if ($g) {
32      while ($s=fgets($g,1024)) {
33              if (substr($s,0,14)!="email_address=" && substr($s,0,13)!="chosen_theme=") {
34                fputs($f,$s);
35        }
36      }
37      fclose($g);
38    }
39    fclose($f);
40    @copy("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","/var/lib/squirrelmail/data/".$mail."@".$dom.".pref");
41                return true; 
42        }
43
44        function hooks_squirrelmail_delete($mail,$dom){
45                global $err,$cuid,$db;
46    $err->log("mail_squirrelmail","squirrelmail_delete",$mail."@".$dom);
47
48    @unlink("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref");
49    @unlink("/var/lib/squirrelmail/data/".$mail."_".$dom.".abook");
50    @unlink("/var/lib/squirrelmail/data/".$mail."@".$dom.".pref");
51    @unlink("/var/lib/squirrelmail/data/".$mail."@".$dom.".abook");
52                return true;
53
54        }
55
56}
57
58?>
Note: See TracBrowser for help on using the repository browser.