Code

f75e0e0061ec00873a7f18c634e26574b0f55d10
[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       "lrswipd"  => "delete",
84       "lrswipcd" => "write",
85       "lrswipcda"=> "admin",
86       " "         => "none");
88   protected $acl_mapping = array();
91   /*! \brief  Constructs the mail class 
92       @param  Object  Config  The GOsa configuration object
93       @param  Object  Plugin  The initator
94       @param  String          Open "user" or "group" account.
95    */
96   function __construct(&$config, &$parent, $type = "user")
97   {
98     $this->parent = $parent;
99     $this->config = $config;
101     /* Create a refernce to the mail selected server 
102      */
103     if(isset($this->parent->gosaMailServer)){
104       $this->MailServer = &$this->parent->gosaMailServer;
105     }else{
106       trigger_error("mailMethod with invalid parent object initialized.");
107     }
109     if(!in_array_strict($this->type,array("user","group"))){
110       trigger_error("Unknown mail class type used '".$type."'.");
111     }else{
112       $this->type = $type;
113     }
115   }
117   
118   /*! \brief  Intialize attributes and config settings.
119    */
120   protected function init()
121   {
122     /* Get config value for cyrusUseSlashes
123      */
124     if ($this->config->get_cfg_value("core","cyrusUseSlashes") == "true"){
125       $this->cyrusUseSlashes = TRUE;
126       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL:</b> cyrusUseSlashes: <b>Enabled</b>");
127     }else{
128       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL:</b> cyrusUseSlashes: <b>Disabled</b>");
129     }
131     /* Check if the mail account identification attribute
132        is overridden in the configuration file
133      */
134     if($this->config->get_cfg_value("core","mailAttribute") != ""){
135       $new_uattrib= strtolower($this->config->get_cfg_value("core","mailAttribute"));
136       if(in_array_strict($new_uattrib,array("mail","uid"))){
137         $this->uattrib = $new_uattrib;
138       }else{
139         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>".$new_uattrib."</b>",
140           "<b>MAIL:</b> Unsupported 'mailAttribute' in gosa configuration specified");
141         msg_dialog::display(_("Configuration error"), 
142             sprintf(_("The configured mail attribute '%s' is unsupported!"), $new_uattrib), ERROR_DIALOG);
143       }
144     }
146     /* Create ACL map */
147     foreach($this->acl_map as $acl => $name){
148       $this->acl_mapping[$acl] = _($name);
149     }
151     /* Check if we have an individual user/folder creation syntax 
152      */
153     $tmp = $this->config->get_cfg_value("core","mailUserCreation");
154     if(!empty($tmp)){
155       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
156           "<b>MAIL:</b> User creation set to");
157       $this->user_id  = $tmp;
158     }
159     $tmp = $this->config->get_cfg_value("core","mailFolderCreation");
160     if(!empty($tmp)){
161       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
162           "<b>MAIL:</b> Shared folder creation set to");
163       $this->share_id = $tmp;
164     }
165     $tmp = $this->config->get_cfg_value("core","gosaSharedPrefix");
166     if(!empty($tmp)){
167       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
168           "<b>MAIL:</b> Shared folder prefix set to");
169       $this->gosaSharedPrefix = $tmp;
170     }
172     $this->build_account_id();
173     $this->initial_account_id = $this->account_id;
174   }
176   
177   public function fixAttributesOnLoad()
178   {
179     foreach($this->attributes as $source => $dest){
180       if(isset($this->parent->attrs[$source])){
181         $this->parent->attrs[$dest] = $this->parent->attrs[$source];
182       }
183       if(isset($this->parent->$source)){
184         $this->parent->$dest = $this->parent->$source;
185       }
186       if(isset($this->parent->attrs[$source][0])){
187         $this->parent->saved_attributes[$source] = $this->parent->attrs[$source][0];
188       }
189     }
190   }
193   public function mailEqualsCN()
194   {
195     return($this->mailEqualsCN);
196   }
197   
199   public function fixAttributesOnRemove()
200   {
201     /* Remove objectClasses  
202      */ 
203     if($this->type == "user"){
204       $this->parent->attrs['objectClass'] = 
205         array_remove_entries_ics($this->userObjectClasses, $this->parent->attrs['objectClass']);
206     }else{
207       $this->parent->attrs['objectClass'] = 
208         array_remove_entries_ics($this->shareObjectClasses, $this->parent->attrs['objectClass']);
209       $this->parent->attrs['gosaSharedFolderTarget'] =array();
210     }
211     foreach($this->attributes as $source => $dest){
212       $this->attrs[$dest]   = array();
213       $this->attrs[$source] = array();
214     }
215   }
217   public function fixAttributesOnStore()
218   {
219     foreach($this->attributes as $source => $dest){
220       if(isset($this->parent->attrs[$dest])){
221         $this->parent->attrs[$source] = $this->parent->attrs[$dest ];
222       }
223       if(isset($this->parent->$dest)){
224         $this->parent->$source = $this->parent->$dest;
225       }
226     }
228     if($this->type == "user"){
229       $ocs = $this->userObjectClasses;
230     }else{
231       $ocs = $this->shareObjectClasses;
232     }
233     foreach($ocs as $oc){
234       if(!in_array_strict($oc, $this->parent->attrs['objectClass'])){
235         $this->parent->attrs['objectClass'][] = $oc;
236       }
237     }
238   
239     // Add gosaSharedFolderTarget for groups.
240     $this->build_account_id();
241     if($this->type == "group"){ 
242       $this->parent->attrs['gosaSharedFolderTarget'] = 
243         $this->gosaSharedPrefix.$this->account_id;
244     }
245   }
248   /*! \brief  Connect services like imap.
249               Not necessary for the base class.
250       @return Boolean True if this method is connected else false.
251    */
252   public function connect()
253   {
254     $this->reset_error();
255     @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","<b>MAIL: Connect method</b>: ".get_class($this));
256     @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","<b>MAIL: Current server</b>: ".$this->MailServer);
257  
258     $this->connected = TRUE;
259     return(TRUE);
260   }
263   /*! \brief  Returns the connection status of this method.
264       @return Boolean True if this method is connected else false.
265    */
266   public function is_connected()
267   {
268     return($this->connected);
269   }
272   /*! \brief  Disconnect this method. Close services like imap connection.
273               Not necessary for the base class.
274    */
275   public function disconnect()
276   {
277     $this->reset_error();
278     if($this->is_connected()){
279       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","<b>MAIL: Disconnect method</b>: ".get_class($this));
280       $this->connected =FALSE; 
281     }
282   }
284   
285   /*! \brief  Returns true the current object represents a valid account
286               (Some methods may check imap accounts here.)
287       @return Boolean TRUE if this is a valid account else FALSE
288   */
289   public function account_exists()
290   {
291     $this->reset_error();
292     return(TRUE);
293   }
294   
296   /*! \brief  Returns the last error occurred 
297       @return String  The last error message.
298    */
299   public function get_error(){
300     return($this->error);
301   }
304   public function isModifyableMail()
305   {
306     return($this->modifyableMail);
307   }
310   public function isModifyableServer()
311   {
312     return($this->modifyableServer);
313   }
316   /*! \brief  Returns TRUE if the action caused an error.
317       @return Boolean TRUE on error else FALSE
318    */
319   public function is_error(){
320     return($this->error != "");
321   }
324   /*! \brief  Resets the error message.
325    */
326   public function reset_error(){
327     $this->error = "";
328   }
331   public function get_account_id()
332   {
333     $this->build_account_id();
334     return($this->account_id);
335   }
337   /*! \brief  Create a new account id, like 'user/name@domain.com'.
338    */
339   protected function build_account_id()
340   {
341     /* Build account identicator */
342     if($this->type == "user"){
343       $prefix = $this->user_prefix;
344       $acc_string = $this->user_id;
345     }else{
346       $prefix = $this->share_prefix;
347       $acc_string = $this->share_id;
348     }
350     /* Create account prefix and respect "cyrusUseSlashes" 
351        Do not replace escaped dots for cyrusUseSlashes.
352      */
353     $uattrib = $this->uattrib;
354     if($this->cyrusUseSlashes){
355       $prefix     = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
356       $acc_string = preg_replace('/([^\\\\])\./',"\\1/",$acc_string); 
357     }
358     $prefix = preg_replace("/\\\\([\.\/])/","\\1",$prefix);
359     $acc_string = preg_replace("/\\\\([\.\/])/","\\1",$acc_string); 
360   
361     $domain = $mailpart = "";
362     $mail = $this->parent->mail;
363     if(preg_match("/\@/",$mail)){
364       list($mailpart,$domain) = explode("@",$mail);
365     }
367     /* Create account_id 
368      */ 
369     $from = array("/%cn%/i","/%uid%/i","/%prefix%/i","/%uattrib%/i","/%domain%/i","/%mailpart%/i","/%mail%/i");
370     $to   = array($this->parent->cn,$this->parent->uid,$prefix,$this->parent->$uattrib, $domain, $mailpart,$mail);
371     $acc_id = trim(strtolower(preg_replace($from,$to,$acc_string)));
373     /* Check for not replaced pattern.
374      */
375     if(preg_match("/%/",$acc_id)){
376       $notr = preg_replace("/^[^%]*/","",$acc_id);
377       if(!empty($notr)){
378         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"<b>Warning</b>", 
379             sprintf("<b>MAIL: WARNING unknown pattern in account creation string '%s' near '%s'</b>", $acc_id, $notr));
381         /* Remove incomprehensible patterns */
382         $acc_id = preg_replace("/%[^%]+%/","",$acc_id);
383       }
384     }
387     if($this->account_id != $acc_id){
388       $this->account_id = $acc_id;
389       @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"", "<b>MAIL:</b> AccountID generated: <b>".$acc_id."</b>");
390     }
391   }
394   /*! \brief  Creates a valid folder id for a given folder name.
395                e.g. $folder_id = "INBOX/test"  &&  $this->account_id = "share/mailbox@domain.de"
396                will result in "share/mailbox/test@domain.de"
397               This function is mainly used to read and write folder permissions.
398       @return String A valid folder id
399    */
400   public function create_folder_id($folder, $type = "")
401   {
403     if(!empty($folder)){
404       $folder = trim(preg_replace("/^INBOX[\.\/]*/i","",$folder));
405     }
406     if(!empty($folder)){
407       $folder = "/".$folder;
408     }
410     /* Build account identicator */
411     if($this->type == "user"){
412       $prefix = $this->user_prefix;
413       $acc_string = $this->user_id;
414     }else{
415       $prefix = $this->share_prefix;
416       $acc_string = $this->share_id;
417     }
419     /* Create account prefix and respect "cyrusUseSlashes" 
420        Do not replace escaped dots for cyrusUseSlashes.
421      */
422     $uattrib = $this->uattrib;
423     if($this->cyrusUseSlashes){
424       $prefix     = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
425       $acc_string = preg_replace('/([^\\\\])\./',"\\1/",$acc_string); 
426     }
427     $prefix = preg_replace("/\\\\([\.\/])/","\\1",$prefix);
428     $acc_string = preg_replace("/\\\\([\.\/])/","\\1",$acc_string); 
429   
430     $domain = $mailpart = "";
431     $mail = $this->parent->mail;
432     if(preg_match("/\@/",$mail)){
433       list($mailpart,$domain) = explode("@",$mail);
434     }
436     /* Create account_id
437      */
438     $from = array("/%cn%/i","/%uid%/i","/%prefix%/i","/%uattrib%/i","/%domain%/i","/%mailpart%/i","/%mail%/i");
439     $to   = array($this->parent->cn,$this->parent->uid,$prefix,$this->parent->$uattrib, $domain, $mailpart,$mail);
440     $acc_id = trim(strtolower(preg_replace($from,$to,$acc_string)));
442     /* Check for not replaced pattern.
443      */
444     if(preg_match("/%/",$acc_id)){
445       $notr = preg_replace("/^[^%]*/","",$acc_id);
446       if(!empty($notr)){
447         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"<b>Warning</b>", 
448             sprintf("<b>MAIL: WARNING unknown pattern in account creation string '%s' near '%s'</b>", $acc_id, $notr));
450         /* Remove incomprehensible patterns */
451         $acc_id = preg_replace("/%[^%]+%/","",$acc_id);
452       }
453     }
455     if(preg_match("/\@/",$acc_id)){
456       list($mail,$domain) = explode("@",$acc_id);
457       $str = trim($mail . $folder . "@" . $domain);
458     }else{
459       $str = trim($acc_id . $folder);
460     }
461     return($str) ;
462   }
465   /*! \brief  Returns the configured mail method for the given parent object, 
466                 initialized and read for use.
467       @return mailMethod  The configured mailMethod.
468    */
469   public function get_method()
470   {
471     $methods = mailMethod::get_methods();
472     if ($this->config->get_cfg_value("core","mailMethod") != ""){
473       $method= $this->config->get_cfg_value("core","mailMethod");
474       $cls = get_correct_class_name("mailMethod$method");
475       if(isset($methods[$cls])){
476         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"", "<b>MAIL:</b> Selected mailMethod: <b>".$cls."</b>");
477         $tmp = new $cls($this->config,$this->parent,$this->type);
478         $tmp->init();
479         return($tmp);
480       }else{
481         @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "","<b>MAIL: Invalid mailMethod defined: ".$cls.
482             " falling back to ".get_class($this)."</b>");
484         /* Print out configuration errors directly, we can't catch them everywhere. 
485          */
486         msg_dialog::display(_("Configuration error"), 
487             sprintf(_("Mail method '%s' is unknown!"), $method), ERROR_DIALOG);
488       }
489     }
491     /* If no valued mailMethod could be detected, return the base class.
492      */
493     $this->init();
494     return($this);
495   }
498   /*! \brief Saves sieve settings 
499    */
500   public function saveSieveSettings()
501   {
502     $this->reset_error();
503     return(TRUE);
504   }
506   
507   /*! \brief  Creates or Updates the mailAccount represented by this class. 
508    */
509   public function updateMailbox()
510   {
511     $this->reset_error();
512     return(TRUE);
513   }
516   /*! \brief  Update shared folder dependencies 
517    */
518   public function updateSharedFolder()
519   {
520     $this->reset_error();
521     return(TRUE);
522   }
525   /*! \brief  Removes the mailbox represented by this class,
526                and update shared folder ACLs .
527    */
528   public function deleteMailbox()
529   {
530     $this->reset_error();
532     @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<b>".$this->account_id."</b>" ,
533         "<b>MAIL: Remove account</b> from server :".$this->MailServer);
535     return(TRUE);
536   }
538   
539   /*! \brief  Returns the used mail attribute (mail,uid)
540       @param  String  One out of 'mail','uid'
541    */
542   public function getUAttrib()
543   {
544     return($this->uattrib);
545   }
548   /*! \brief  Returns the used mail attribute (mail,uid)
549       @param  String  One out of 'mail','uid'
550    */
551   public function getUAttribValue()
552   {
553     $uattrib = $this->getUAttrib();
554     return($this->parent->$uattrib);
555   }
557   
558   /*! \brief  Returns whether the quota settings are enabled or not 
559       @return Boolean TRUE if enabled else FALSE
560    */
561   public function quotaEnabled()
562   {
563     return($this->enableQuota);
564   }
566   
567   /*! \brief  Returns the used quota 
568       @return Integer Quota used.
569    */
570   public function getQuotaUsage()
571   {
572     return(-1);
573   }
576   /*! \brief  Returns the quota restrictions.
577       @return Integer Quota restrictions.
578    */
579   public function getQuota($quotaValue)
580   {
581     return($quotaValue);
582   }
584   
585   /*! \brief  Sets the mail quota
586    */
587   public function setQuota($number)
588   {
589     if(!is_numeric($number)){
590       $number = (int) $number;
591       if(!$number){
592         $number = 0;
593       }
594     }
595     $this->quotaValue = $number; 
596     return(TRUE);
597   }
600   /*! \brief  Returns true whether the domain is selectable or not 
601    */
602   public function domainSelectionEnabled()
603   {
604     return($this->enableDomainSelection);
605   } 
608   /*! \brief Returns a list of configured mail domains 
609       @return Array A list of mail domains
610    */
611   public function getMailDomains()
612   {
613     return(array("Unconfigured"));
614   } 
616   
617   /*! \brief  Returns the used Spamlevels for this mailmethod 
618    */
619   public function getSpamLevels()
620   {
621     $spamlevel= array();
622     for ($i= 0; $i<21; $i++){
623       $spamlevel[]= $i;
624     }
625     return($spamlevel);
626   }
628   
629   /*! \brief  Returns the list of configured mailbox folders
630       @return Array The mailbox folders.
631    */
632   public function getMailboxList()
633   {
634     return(array("INBOX"));
635   }
638   /*! \brief  Returns whether the vacation range is selectable or not
639       @return Boolean TRUE, FALSE
640    */
641   public function vacationRangeEnabled()
642   {
643     return($this->enableVacationRange);
644   }
646   
647   /*! \brief  Returns true if the sieveManagement is allowed
648       @return Boolean TRUE, FALSE
649    */
650   public function allowSieveManagement()
651   {
652     return($this->enableSieveManager);
653   } 
656   /*! \brief  Checks dependencies to other GOsa plugins.
657    */
658   public function accountCreateable(&$reason = ""){
659     return(TRUE);
660   }
663   /*! \brief  Checks whether this account is removeable or not.
664               There may be some dependencies left, eg. kolab.
665    */
666   public function accountRemoveable(&$reason = ""){
667     return(TRUE);
668   }
670   
671   /*! \brief  Returns all mail servers configured in GOsa 
672                that are useable with this mailMethod.
673       @return Array  All useable mail servers.
674   */
675   public function getMailServers()
676   {
677     $mailserver = array();
678     $ui = get_userinfo();
679     foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
680       if( $this->MailServer == $key ||
681           preg_match("/r/",$ui->get_permissions($val['server_dn'],"server/goImapServer",""))){
682         $mailserver[]= $key;
683       }
684     }
685     return($mailserver);
686   }
688   
689   /*! \brief  Returns the available mailMethods
690       @return Array   A list of all avaialable mailMethods_
691    */ 
692   static function get_methods()
693   {
694     global $class_mapping;
695     $available = array();
696     foreach($class_mapping as $class => $path){
697       if($class == "mailMethod") continue;
698       if(preg_match("/^mailMethod/",$class)){
699         $available[$class] = $class;
700       }
701     }
702     return($available);
703   }
705   
706   /* \brief   Some method require special folder types, "kolab" for example.
707       !! Those values are dummy values, the base class doesn't use folder types;
708      @return  Array Return folder types.
709    */
710   public function getAvailableFolderTypes()
711   {
712     $ret = array();
713     $ret['CAT'][''] = _("None"); 
714     $ret['SUB_CAT'][''][''] = _("None");
715     return($ret);
716   }
719   /* \brief  Returns the selected folder type. 
720       !! Those values are dummy values, the base class doesn't use folder types;
721      @return  Array  The folde type.
722    */
723   public function getFolderType($default)
724   {
725     return($default);
726   }
728  
729   /* \brief  Returns the selected folder type. 
730       !! Those values are dummy values, the base class doesn't use folder types;
731      @return  Array  The folde type.
732    */
733   public function setFolderType($type)
734   {
735     return(TRUE) ;   
736   }
739   /*! \brief  Returns configured acls 
740    */
741   public function  getFolderACLs($folder_acls)
742   {
743     /* Merge given ACL with acl mapping 
744        This ensures that no ACL will accidentally overwritten by gosa.
745      */
746     foreach($folder_acls as $user => $acl){
747       if(!isset($this->acl_mapping[$acl])){
748         $this->acl_mapping[$acl] = $acl;
749       }
750     }
752     return($folder_acls);
753   }
756   /*! \brief  Write ACLs back to imap or what ever 
757    */
758   public function  setFolderACLs($array)
759   {
760     return(TRUE);
761   }
764   /*! \brief  Returns a list of all possible acls.
765       @return Array   ACLs.
766   */
767   public function getAclTypes()
768   {
769     return( $this->acl_mapping);
770   }
772   public function folderTypesEnabled()
773   {
774     return($this->enableFolderTypes);
775   }
777   public function allow_remove(&$reason)
778   {
779     return(TRUE);
780   }
783   /*! \brief  Returns the configured mailMethod
784       @return String  the configured mail method or ""
785    */
786   static public function get_current_method($config)
787   {
788     global $class_mapping;
789     $method= $config->get_cfg_value("core","mailMethod");
790     $cls = get_correct_class_name("mailMethod$method");
791     foreach($class_mapping as $class => $path){
792       if($class == $cls){
793         return($class);
794       }
795     }
796     return("");
797   }
800   static function quota_to_image($use,$quota)
801   {
802     if($use == -1){
803       return("&nbsp;&nbsp;"._("Unknown"));
804     }elseif(empty($quota)){
805       return("&nbsp;&nbsp;"._("Unlimited"));
806     }else{
807       $usage =round(($use/$quota) * 100);
808       return("<img src='progress.php?x=100&amp;y=17&amp;p=$usage'>");
809     }
810   }
812  
813   /*! \brief  Returns the default sharedFolder ACLs for this method.
814       @return Array Returns an array containg acls for __member__ and __anyone__
815    */ 
816   public function getDefaultACLs()
817   {
818     $tmp = $this->default_acls;
819     if(!isset($tmp['__member__'])) $tmp['__member__'] = " ";
820     if(!isset($tmp['__anyone__'])) $tmp['__anyone__'] = " ";
821     return($tmp);
822   }
826 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
827 ?>