[imp] attachment size limit regarding....

Anant Athavale asa at isac.gov.in
Thu Feb 9 01:37:54 PST 2006


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).

-Anant.



Quoting Anant Athavale <asa at isac.gov.in>:

> Thanks for the reply.
>
> I want to do it for the total attachement size.  We have two category
> of users.
> 1. staff and 2. trainee.  We want to reduce the total attachment size for
> trainee category of users. All accounts are on the same server.
>
> Is it possible to change horde/imp/conf.php contents dynamically?
>
> Regards,
> Anant.
>
> Quoting Eric Jon Rostetter <eric.rostetter at physics.utexas.edu>:
>
>> Quoting Anant S Athavale <asa at isac.gov.in>:
>>
>>> I would like to set a different attachment size limit based on some
>>> attribute of
>>> ldap (lower than the maximum allowed).  How to achieve it?
>>
>> The answer is slightly different depending on it you mean the max total size
>> of all attachments together, or the max total size of any individual
>> attachment.
>>
>> Assuming you mean that of an individual attachment, you could add some
>> code somewhere which got the value from the ldap server, calculated
>> the size limit based on it, and then set the php parameter for
>> "upload_max_filesize" dynamically.
>>
>> If you wanted to control the total size, you could put similar code into
>> horde/imp/conf.php to set the config variable "attach_size_limit" defined
>> there.
>>
>>> Regards,
>>>
>>> Anant
>>
>> --
>> Eric Rostetter
>> The Department of Physics
>> The University of Texas at Austin
>>
>> Go Longhorns!
>> --
>> IMP mailing list - Join the hunt: http://horde.org/bounties/#imp
>> Frequently Asked Questions: http://horde.org/faq/
>> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
>>
>
>
>
> Regards,
>
> Anant.
>
> ----------------------------------------------------------------
> PLEASE NOTE THE CHANGE IN DOMAIN PART OF THE "FROM :" ADDRESS.
> Our domain is changed to 'isac.gov.in'.
> Kindly update your Address Book accordingly.
>
> --
> IMP mailing list - Join the hunt: http://horde.org/bounties/#imp
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
>



Regards,

Anant.

----------------------------------------------------------------
PLEASE NOTE THE CHANGE IN DOMAIN PART OF THE "FROM :" ADDRESS.
Our domain is changed to 'isac.gov.in'.
Kindly update your Address Book accordingly.



More information about the imp mailing list