Code

Updated table summary
[gosa.git] / gosa-plugins / mail / personal / mail / class_mail-methods.inc
1 <?php
4 class mailMethod{
6   /* Allow modification of account_ids for existing mail accounts */
7   protected $modifyableMail   = TRUE;
9   /* Allow modification of the mail server attribute existing mail accounts */
10   protected $modifyableServer = TRUE;
12   /* Enforces same value for 'mail' as used for 'cn' */
13   protected $mailEqualsCN   = FALSE; 
15   /* the attribute used to create accounts */ 
16   protected $uattrib        = "mail";  // Naming attribute for accounts, e.g. imap.
18   /* The account prefixes, keep the '.' here! See FAQ cyrusUseSlashes */
19   protected $user_prefix    = "user.";  
20   protected $share_prefix   = "share.";
22   /* Account ID creation 
24       !!Depends on the attributes 'user_prefix'/'share_prefix' and the option 'cyrusUseSlashes'
26       Examples - based on defaults : 
27         %PREFIX%    => "user." or "user/" (Depending on cyrusUseSlashes=FALSE/TRUE) 
28         %CN%        => "technik"          (The groups cn)
29         %UID%       => "herbert"          (The users uid)
30         %MAIL%      => "herbert@domain.de"(The mail address)
31         %DOMAIN%    => "domain.de"        (The domain part of the specified mail)
32         %MAILPART%  => "herbert"          (The mail address without domain)
33         %UATTRIB%   => "herbert"/"herbert@domains.de"
34                                             (Configured in gosa.conf mailAttribute="mail"/"uid")
35    */
36   protected $user_id    = "%PREFIX%%UATTRIB%";  
37   protected $share_id   = "%PREFIX%%UATTRIB%";
39   /* Create accounts in cyrus style with '/' instead of '.' */
40   protected $cyrusUseSlashes= FALSE;
42   /* gosaSharedFolderTarget settings, 
43    *  E.g. 
44    *    For an accountID like: 'share/herberts.folder@gonicus.de' the value 'dummy+' 
45    *    will result in gosaSharedFolderTarget: dummy+share/herberts.folder@gonicus.de
46    */
47   protected $gosaSharedPrefix = '';  
49   /* The atribute mapping for this class  Source --> Destination */
50   protected $attributes     = array();
51   protected $userObjectClasses = array();
52   protected $shareObjectClasses = array();
54   /* Enabled mail domain selection. If enabled getMailDomains() have to return an array 
55    *  with the domain parts.
56    */ 
57   protected $enableDomainSelection= FALSE;
58   protected $enableQuota          = TRUE;
59   protected $enableSieveManager   = FALSE;
60   protected $enableVacationRange  = TRUE;
61   protected $enableFolderTypes    = FALSE;
63   /* Default values */
64   protected $quotaValue   = 0;  
65   protected $quotaUsage   = 0;  
67   /* Method internal */
68   protected $type               = "user"; 
69   protected $account_id         = "";
70   protected $initial_account_id = "";
71   protected $connected          = FALSE;
72   protected $error              = "";
73   protected $parent             = NULL;   
74   protected $MailServer         = "";
76   protected $default_acls = array("__anyone__" => "p", "__member__" => "lrswp");
78   protected $acl_map = array(
79       "lrsw"     => "read",
80       "lrswp"    => "post",
81       "p"        => "external post",
82       "lrswip"   => "append",
83       "lrswipcd" => "write",
84       "lrswipcda"=> "admin",
85       " "         => "none");
87   protected $acl_mapping = array();
90   /*! \brief  Constructs the mail class 
91       @param  Object  Config  The GOsa configuration object
92       @param  Object  Plugin  The initator
93       @param  String          Open "user" or "group" account.
94    */
95   function __construct(&$config, &$parent, $type = "user")
96   {
97     $this->parent = $parent;
98     $this->config = $config;
100     /* Create a refernce to the mail selected server 
101      */
102     if(isset($this->parent->gosaMailServer)){
103       $this->MailServer = &$this->parent->gosaMailServer;
104     }else{
105       trigger_error("mailMethod with invalid parent object initialized.");
106     }
108     if(!in_array($this->type,array("user","group"))){
109       trigger_error("Unknown mail class type used '".$type."'.");
110     }else{
111       $this->type = $type;
112     }
114   }
116   
117   /*! \brief  Intialize attributes and config settings.
118    */
119   protected function init()
120   {
121     /* Get config value for cyrusUseSlashes
122      */
123     if ($this->config->get_cfg_value("cyrusUseSlashes") == "true"){
124       $this->cyrusUseSlashes = TRUE;
125       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL:</b> cyrusUseSlashes: <b>Enabled</b>");
126     }else{
127       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL:</b> cyrusUseSlashes: <b>Disabled</b>");
128     }
130     /* Check if the mail account identification attribute
131        is overridden in the configuration file
132      */
133     if($this->config->get_cfg_value("mailAttribute","mail") != ""){
134       $new_uattrib= strtolower($this->config->get_cfg_value("mailAttribute"));
135       if(in_array($new_uattrib,array("mail","uid"))){
136         $this->uattrib = $new_uattrib;
137       }else{
138         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>".$new_uattrib."</b>",
139           "<b>MAIL:</b> Unsupported 'mailAttribute' in gosa configuration specified");
140         msg_dialog::display(_("Configuration error"), 
141             sprintf(_("The configured mail attribute '%s' is unsupported!"), $new_uattrib), ERROR_DIALOG);
142       }
143     }
145     /* Create ACL map */
146     foreach($this->acl_map as $acl => $name){
147       $this->acl_mapping[$acl] = _($name);
148     }
150     /* Check if we have an individual user/folder creation syntax 
151      */
152     $tmp = $this->config->get_cfg_value("mailUserCreation");
153     if(!empty($tmp)){
154       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
155           "<b>MAIL:</b> User creation set to");
156       $this->user_id  = $tmp;
157     }
158     $tmp = $this->config->get_cfg_value("mailFolderCreation");
159     if(!empty($tmp)){
160       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
161           "<b>MAIL:</b> Shared folder creation set to");
162       $this->share_id = $tmp;
163     }
164     $tmp = $this->config->get_cfg_value("gosaSharedPrefix");
165     if(!empty($tmp)){
166       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
167           "<b>MAIL:</b> Shared folder prefix set to");
168       $this->gosaSharedPrefix = $tmp;
169     }
171     $this->build_account_id();
172     $this->initial_account_id = $this->account_id;
173   }
175   
176   public function fixAttributesOnLoad()
177   {
178     foreach($this->attributes as $source => $dest){
179       if(isset($this->parent->attrs[$source])){
180         $this->parent->attrs[$dest] = $this->parent->attrs[$source];
181       }
182       if(isset($this->parent->$source)){
183         $this->parent->$dest = $this->parent->$source;
184       }
185       if(isset($this->parent->attrs[$source][0])){
186         $this->parent->saved_attributes[$source] = $this->parent->attrs[$source][0];
187       }
188     }
189   }
192   public function mailEqualsCN()
193   {
194     return($this->mailEqualsCN);
195   }
196   
198   public function fixAttributesOnRemove()
199   {
200     /* Remove objectClasses  
201      */ 
202     if($this->type == "user"){
203       $this->parent->attrs['objectClass'] = 
204         array_remove_entries_ics($this->userObjectClasses, $this->parent->attrs['objectClass']);
205     }else{
206       $this->parent->attrs['objectClass'] = 
207         array_remove_entries_ics($this->shareObjectClasses, $this->parent->attrs['objectClass']);
208       $this->parent->attrs['gosaSharedFolderTarget'] =array();
209     }
210     foreach($this->attributes as $source => $dest){
211       $this->attrs[$dest]   = array();
212       $this->attrs[$source] = array();
213     }
214   }
216   public function fixAttributesOnStore()
217   {
218     foreach($this->attributes as $source => $dest){
219       if(isset($this->parent->attrs[$dest])){
220         $this->parent->attrs[$source] = $this->parent->attrs[$dest ];
221       }
222       if(isset($this->parent->$dest)){
223         $this->parent->$source = $this->parent->$dest;
224       }
225     }
227     if($this->type == "user"){
228       $ocs = $this->userObjectClasses;
229     }else{
230       $ocs = $this->shareObjectClasses;
231     }
232     foreach($ocs as $oc){
233       if(!in_array($oc, $this->parent->attrs['objectClass'])){
234         $this->parent->attrs['objectClass'][] = $oc;
235       }
236     }
237   
238     // Add gosaSharedFolderTarget for groups.
239     $this->build_account_id();
240     if($this->type == "group"){ 
241       $this->parent->attrs['gosaSharedFolderTarget'] = 
242         $this->gosaSharedPrefix.$this->account_id;
243     }
244   }
247   /*! \brief  Connect services like imap.
248               Not necessary for the base class.
249       @return Boolean True if this method is connected else false.
250    */
251   public function connect()
252   {
253     $this->reset_error();
254     @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","<b>MAIL: Connect method</b>: ".get_class($this));
255     @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","<b>MAIL: Current server</b>: ".$this->MailServer);
256  
257     $this->connected = TRUE;
258     return(TRUE);
259   }
262   /*! \brief  Returns the connection status of this method.
263       @return Boolean True if this method is connected else false.
264    */
265   public function is_connected()
266   {
267     return($this->connected);
268   }
271   /*! \brief  Disconnect this method. Close services like imap connection.
272               Not necessary for the base class.
273    */
274   public function disconnect()
275   {
276     $this->reset_error();
277     if($this->is_connected()){
278       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","<b>MAIL: Disconnect method</b>: ".get_class($this));
279       $this->connected =FALSE; 
280     }
281   }
283   
284   /*! \brief  Returns true the current object represents a valid account
285               (Some methods may check imap accounts here.)
286       @return Boolean TRUE if this is a valid account else FALSE
287   */
288   public function account_exists()
289   {
290     $this->reset_error();
291     return(TRUE);
292   }
293   
295   /*! \brief  Returns the last error occurred 
296       @return String  The last error message.
297    */
298   public function get_error(){
299     return($this->error);
300   }
303   public function isModifyableMail()
304   {
305     return($this->modifyableMail);
306   }
309   public function isModifyableServer()
310   {
311     return($this->modifyableServer);
312   }
315   /*! \brief  Returns TRUE if the action caused an error.
316       @return Boolean TRUE on error else FALSE
317    */
318   public function is_error(){
319     return($this->error != "");
320   }
323   /*! \brief  Resets the error message.
324    */
325   public function reset_error(){
326     $this->error = "";
327   }
330   public function get_account_id()
331   {
332     $this->build_account_id();
333     return($this->account_id);
334   }
336   /*! \brief  Create a new account id, like 'user/name@domain.com'.
337    */
338   protected function build_account_id()
339   {
340     /* Build account identicator */
341     if($this->type == "user"){
342       $prefix = $this->user_prefix;
343       $acc_string = $this->user_id;
344     }else{
345       $prefix = $this->share_prefix;
346       $acc_string = $this->share_id;
347     }
349     /* Create account prefix and respect "cyrusUseSlashes" 
350        Do not replace escaped dots for cyrusUseSlashes.
351      */
352     $uattrib = $this->uattrib;
353     if($this->cyrusUseSlashes){
354       $prefix     = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
355       $acc_string = preg_replace('/([^\\\\])\./',"\\1/",$acc_string); 
356     }
357     $prefix = preg_replace("/\\\\([\.\/])/","\\1",$prefix);
358     $acc_string = preg_replace("/\\\\([\.\/])/","\\1",$acc_string); 
359   
360     $domain = $mailpart = "";
361     $mail = $this->parent->mail;
362     if(preg_match("/\@/",$mail)){
363       list($mailpart,$domain) = explode("@",$mail);
364     }
366     /* Create account_id 
367      */ 
368     $from = array("/%cn%/i","/%uid%/i","/%prefix%/i","/%uattrib%/i","/%domain%/i","/%mailpart%/i","/%mail%/i");
369     $to   = array($this->parent->cn,$this->parent->uid,$prefix,$this->parent->$uattrib, $domain, $mailpart,$mail);
370     $acc_id = trim(strtolower(preg_replace($from,$to,$acc_string)));
372     /* Check for not replaced pattern.
373      */
374     if(preg_match("/%/",$acc_id)){
375       $notr = preg_replace("/^[^%]*/","",$acc_id);
376       if(!empty($notr)){
377         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"<b>Warning</b>", 
378             sprintf("<b>MAIL: WARNING unknown pattern in account creation string '%s' near '%s'</b>", $acc_id, $notr));
380         /* Remove incomprehensible patterns */
381         $acc_id = preg_replace("/%[^%]+%/","",$acc_id);
382       }
383     }
386     if($this->account_id != $acc_id){
387       $this->account_id = $acc_id;
388       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"", "<b>MAIL:</b> AccountID generated: <b>".$acc_id."</b>");
389     }
390   }
393   /*! \brief  Creates a valid folder id for a given folder name.
394                e.g. $folder_id = "INBOX/test"  &&  $this->account_id = "share/mailbox@domain.de"
395                will result in "share/mailbox/test@domain.de"
396               This function is mainly used to read and write folder permissions.
397       @return String A valid folder id
398    */
399   public function create_folder_id($folder, $type = "")
400   {
402     if(!empty($folder)){
403       $folder = trim(preg_replace("/^INBOX[\.\/]*/i","",$folder));
404     }
405     if(!empty($folder)){
406       $folder = "/".$folder;
407     }
409     /* Build account identicator */
410     if($this->type == "user"){
411       $prefix = $this->user_prefix;
412       $acc_string = $this->user_id;
413     }else{
414       $prefix = $this->share_prefix;
415       $acc_string = $this->share_id;
416     }
418     /* Create account prefix and respect "cyrusUseSlashes" 
419        Do not replace escaped dots for cyrusUseSlashes.
420      */
421     $uattrib = $this->uattrib;
422     if($this->cyrusUseSlashes){
423       $prefix     = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
424       $acc_string = preg_replace('/([^\\\\])\./',"\\1/",$acc_string); 
425     }
426     $prefix = preg_replace("/\\\\([\.\/])/","\\1",$prefix);
427     $acc_string = preg_replace("/\\\\([\.\/])/","\\1",$acc_string); 
428   
429     $domain = $mailpart = "";
430     $mail = $this->parent->mail;
431     if(preg_match("/\@/",$mail)){
432       list($mailpart,$domain) = explode("@",$mail);
433     }
435     /* Create account_id
436      */
437     $from = array("/%cn%/i","/%uid%/i","/%prefix%/i","/%uattrib%/i","/%domain%/i","/%mailpart%/i","/%mail%/i");
438     $to   = array($this->parent->cn,$this->parent->uid,$prefix,$this->parent->$uattrib, $domain, $mailpart,$mail);
439     $acc_id = trim(strtolower(preg_replace($from,$to,$acc_string)));
441     /* Check for not replaced pattern.
442      */
443     if(preg_match("/%/",$acc_id)){
444       $notr = preg_replace("/^[^%]*/","",$acc_id);
445       if(!empty($notr)){
446         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"<b>Warning</b>", 
447             sprintf("<b>MAIL: WARNING unknown pattern in account creation string '%s' near '%s'</b>", $acc_id, $notr));
449         /* Remove incomprehensible patterns */
450         $acc_id = preg_replace("/%[^%]+%/","",$acc_id);
451       }
452     }
454     if(preg_match("/\@/",$acc_id)){
455       list($mail,$domain) = explode("@",$acc_id);
456       $str = trim($mail . $folder . "@" . $domain);
457     }else{
458       $str = trim($acc_id . $folder);
459     }
460     return($str) ;
461   }
464   /*! \brief  Returns the configured mail method for the given parent object, 
465                 initialized and read for use.
466       @return mailMethod  The configured mailMethod.
467    */
468   public function get_method()
469   {
470     $methods = mailMethod::get_methods();
471     if ($this->config->get_cfg_value("mailmethod") != ""){
472       $method= $this->config->get_cfg_value("mailmethod");
473       $cls = get_correct_class_name("mailMethod$method");
474       if(isset($methods[$cls])){
475         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"", "<b>MAIL:</b> Selected mailMethod: <b>".$cls."</b>");
476         $tmp = new $cls($this->config,$this->parent,$this->type);
477         $tmp->init();
478         return($tmp);
479       }else{
480         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL: Invalid mailMethod defined: ".$cls.
481             " falling back to ".get_class($this)."</b>");
483         /* Print out configuration errors directly, we can't catch them everywhere. 
484          */
485         msg_dialog::display(_("Configuration error"), 
486             sprintf(_("Mail method '%s' is unknown!"), $method), ERROR_DIALOG);
487       }
488     }
490     /* If no valued mailMethod could be detected, return the base class.
491      */
492     $this->init();
493     return($this);
494   }
497   /*! \brief Saves sieve settings 
498    */
499   public function saveSieveSettings()
500   {
501     $this->reset_error();
502     return(TRUE);
503   }
505   
506   /*! \brief  Creates or Updates the mailAccount represented by this class. 
507    */
508   public function updateMailbox()
509   {
510     $this->reset_error();
511     return(TRUE);
512   }
515   /*! \brief  Update shared folder dependencies 
516    */
517   public function updateSharedFolder()
518   {
519     $this->reset_error();
520     return(TRUE);
521   }
524   /*! \brief  Removes the mailbox represented by this class,
525                and update shared folder ACLs .
526    */
527   public function deleteMailbox()
528   {
529     $this->reset_error();
531     @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>".$this->account_id."</b>" ,
532         "<b>MAIL: Remove account</b> from server :".$this->MailServer);
534     return(TRUE);
535   }
537   
538   /*! \brief  Returns the used mail attribute (mail,uid)
539       @param  String  One out of 'mail','uid'
540    */
541   public function getUAttrib()
542   {
543     return($this->uattrib);
544   }
547   /*! \brief  Returns the used mail attribute (mail,uid)
548       @param  String  One out of 'mail','uid'
549    */
550   public function getUAttribValue()
551   {
552     $uattrib = $this->getUAttrib();
553     return($this->parent->$uattrib);
554   }
556   
557   /*! \brief  Returns whether the quota settings are enabled or not 
558       @return Boolean TRUE if enabled else FALSE
559    */
560   public function quotaEnabled()
561   {
562     return($this->enableQuota);
563   }
565   
566   /*! \brief  Returns the used quota 
567       @return Integer Quota used.
568    */
569   public function getQuotaUsage()
570   {
571     return(-1);
572   }
575   /*! \brief  Returns the quota restrictions.
576       @return Integer Quota restrictions.
577    */
578   public function getQuota($quotaValue)
579   {
580     return($quotaValue);
581   }
583   
584   /*! \brief  Sets the mail quota
585    */
586   public function setQuota($number)
587   {
588     if(!is_numeric($number)){
589       $number = (int) $number;
590       if(!$number){
591         $number = 0;
592       }
593     }
594     $this->quotaValue = $number; 
595     return(TRUE);
596   }
599   /*! \brief  Returns true whether the domain is selectable or not 
600    */
601   public function domainSelectionEnabled()
602   {
603     return($this->enableDomainSelection);
604   } 
607   /*! \brief Returns a list of configured mail domains 
608       @return Array A list of mail domains
609    */
610   public function getMailDomains()
611   {
612     return(array("Unconfigured"));
613   } 
615   
616   /*! \brief  Returns the used Spamlevels for this mailmethod 
617    */
618   public function getSpamLevels()
619   {
620     $spamlevel= array();
621     for ($i= 0; $i<21; $i++){
622       $spamlevel[]= $i;
623     }
624     return($spamlevel);
625   }
627   
628   /*! \brief  Returns the list of configured mailbox folders
629       @return Array The mailbox folders.
630    */
631   public function getMailboxList()
632   {
633     return(array("INBOX"));
634   }
637   /*! \brief  Returns whether the vacation range is selectable or not
638       @return Boolean TRUE, FALSE
639    */
640   public function vacationRangeEnabled()
641   {
642     return($this->enableVacationRange);
643   }
645   
646   /*! \brief  Returns true if the sieveManagement is allowed
647       @return Boolean TRUE, FALSE
648    */
649   public function allowSieveManagement()
650   {
651     return($this->enableSieveManager);
652   } 
655   /*! \brief  Checks dependencies to other GOsa plugins.
656    */
657   public function accountCreateable(&$reason = ""){
658     return(TRUE);
659   }
662   /*! \brief  Checks whether this account is removeable or not.
663               There may be some dependencies left, eg. kolab.
664    */
665   public function accountRemoveable(&$reason = ""){
666     return(TRUE);
667   }
669   
670   /*! \brief  Returns all mail servers configured in GOsa 
671                that are useable with this mailMethod.
672       @return Array  All useable mail servers.
673   */
674   public function getMailServers()
675   {
676     $mailserver = array();
677     $ui = get_userinfo();
678     foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
679       if( $this->MailServer == $key ||
680           preg_match("/r/",$ui->get_permissions($val['server_dn'],"server/goImapServer",""))){
681         $mailserver[]= $key;
682       }
683     }
684     return($mailserver);
685   }
687   
688   /*! \brief  Returns the available mailMethods
689       @return Array   A list of all avaialable mailMethods_
690    */ 
691   static protected function get_methods()
692   {
693     global $class_mapping;
694     $available = array();
695     foreach($class_mapping as $class => $path){
696       if($class == "mailMethod") continue;
697       if(preg_match("/^mailMethod/",$class)){
698         $available[$class] = $class;
699       }
700     }
701     return($available);
702   }
704   
705   /* \brief   Some method require special folder types, "kolab" for example.
706       !! Those values are dummy values, the base class doesn't use folder types;
707      @return  Array Return folder types.
708    */
709   public function getAvailableFolderTypes()
710   {
711     $ret = array();
712     $ret['CAT'][''] = _("None"); 
713     $ret['SUB_CAT'][''][''] = _("None");
714     return($ret);
715   }
718   /* \brief  Returns the selected folder type. 
719       !! Those values are dummy values, the base class doesn't use folder types;
720      @return  Array  The folde type.
721    */
722   public function getFolderType($default)
723   {
724     return($default);
725   }
727  
728   /* \brief  Returns the selected folder type. 
729       !! Those values are dummy values, the base class doesn't use folder types;
730      @return  Array  The folde type.
731    */
732   public function setFolderType($type)
733   {
734     return(TRUE) ;   
735   }
738   /*! \brief  Returns configured acls 
739    */
740   public function  getFolderACLs($folder_acls)
741   {
742     /* Merge given ACL with acl mapping 
743        This ensures that no ACL will accidentally overwritten by gosa.
744      */
745     foreach($folder_acls as $user => $acl){
746       if(!isset($this->acl_mapping[$acl])){
747         $this->acl_mapping[$acl] = $acl;
748       }
749     }
751     return($folder_acls);
752   }
755   /*! \brief  Write ACLs back to imap or what ever 
756    */
757   public function  setFolderACLs($array)
758   {
759     return(TRUE);
760   }
763   /*! \brief  Returns a list of all possible acls.
764       @return Array   ACLs.
765   */
766   public function getAclTypes()
767   {
768     return( $this->acl_mapping);
769   }
771   public function folderTypesEnabled()
772   {
773     return($this->enableFolderTypes);
774   }
776   public function allow_remove(&$reason)
777   {
778     return(TRUE);
779   }
782   /*! \brief  Returns the configured mailMethod
783       @return String  the configured mail method or ""
784    */
785   static public function get_current_method($config)
786   {
787     global $class_mapping;
788     $method= $config->get_cfg_value("mailmethod");
789     $cls = get_correct_class_name("mailMethod$method");
790     foreach($class_mapping as $class => $path){
791       if($class == $cls){
792         return($class);
793       }
794     }
795     return("");
796   }
799   static function quota_to_image($use,$quota)
800   {
801     if($use == -1){
802       return("&nbsp;&nbsp;"._("Unknown"));
803     }elseif(empty($quota)){
804       return("&nbsp;&nbsp;"._("Unlimited"));
805     }else{
806       $usage =round(($use/$quota) * 100);
807       return("<img src='progress.php?x=100&amp;y=17&amp;p=$usage'>");
808     }
809   }
811  
812   /*! \brief  Returns the default sharedFolder ACLs for this method.
813       @return Array Returns an array containg acls for __member__ and __anyone__
814    */ 
815   public function getDefaultACLs()
816   {
817     $tmp = $this->default_acls;
818     if(!isset($tmp['__member__'])) $tmp['__member__'] = " ";
819     if(!isset($tmp['__anyone__'])) $tmp['__anyone__'] = " ";
820     return($tmp);
821   }
825 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
826 ?>