[imp] attachment size limit regarding....

Jan Schneider jan at horde.org
Thu Feb 9 02:55:58 PST 2006


Zitat von Anant Athavale <asa at isac.gov.in>:

> Dear Members:
>
> I have modified the imp/lib/Compose.php as below:
>
> ----------------------------------------------------------------------------
>         $uname = Auth::getAuth();
>         $uds=ldap_connect("localhost");
>         $ur=ldap_bind($uds);
>         $usr=ldap_search($uds, "o=dos", "mail=$uname");
>         $ulist=ldap_get_entries($uds, $usr);
>         $usertype=$ulist[0]["objectclass"][0];
>         ldap_close($uds);
>         /* Check for filesize limitations. */
>         if ($usertype == "trainee")
>         {
>             if (!empty($conf['compose']['trainee_attach_size_limit']) &&
>                (($conf['compose']['trainee_attach_size_limit'] -
> $this->sizeOfAttachments() - $_FILES[$name]['size']) < 0)) {
>                return PEAR::raiseError(sprintf(_("Attached file   
> \"%s\" exceeds
> the attachment size limits. File NOT attached."), $filename), 'horde.error');
>             }
>         }
>         else
>         {
>             if (!empty($conf['compose']['attach_size_limit']) &&
>                (($conf['compose']['attach_size_limit'] -
> $this->sizeOfAttachments() - $_FILES[$name]['size']) < 0)) {
>                return PEAR::raiseError(sprintf(_("Attached file   
> \"%s\" exceeds
> the attachment size limits. File NOT attached."), $filename), 'horde.error');
>             }
>         }
>
>
> ----------------------------------------------------------------------------
> and looks like I have achieved what I wanted.  Can anybody please comment on
> this please (please suggest any improvements).

Eric already made a suggestion: Put it into the configuration file,  
where it belongs.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the imp mailing list