[imp] Re: how to display quota ?

Daniel Eckl daniel.eckl at gmx.de
Wed Mar 16 10:14:26 PST 2005


Showing the quota of an imap server which doesn't provide quotas is really a 
very dirty little hack....

But maybe someone wants to use that, too... Who knows.....
Good for the archives, but I don't think anyone want's to see that by default 
in stable horde code....

Best,
Daniel

Am Mittwoch, 16. März 2005 19:07 schrieb Jigish Gohil:
> _
> This is how i have managed it, making my own little hack and copying
> some stuff from elsewhere. I had to use 'du' bit as i am given an idea
> that imap server (dovecot) i have used doesnt support quota.
>
> I have just inserted the code below in horde/config/hooks.php
>
> This script just shows the disk used by the user and starts nagging
> (pop up) once the quota is over 80%.
>
> I would however like to suspend the mailing capabilities of the user
> till they reduce the mailbox sizes, any suggestions?
>
> I found it convinient as i dont have to configure anything else for it to
> work.
>
> Cheers
>
> Jigish
> _______________
>
> <?php
>        $user=Auth::getAuth();
>        $homedir="/home/$user";
>        $usage = `du -s /home/$user | cut -d "/" -f 1`;
>        $usedmb = $usage / 1000;
>        $quota = 20000;
>        $quotamb = $quota / 1000;
>        $percent = $usage * 100 / $quota;
>        $quota_html = '<table width="100%" border="0" cellpadding="0"
> cellspacing="0"><tr><td class="item"><table border="0" cellspacing="0"
> cellpadding="0" width="100%"><tr>';
>           if ($percent >= 100) {
>               echo '<script language="JavaScript"
> type="text/javascript"><!-- alert("QUOTA EXCEEDED, DELETE EMAILS TO
> CONTINUE THE USE OF EMAIL FACILITY") // -->
> </script>';
>
>           } else ($percent >= 80) {
>               echo '<script language="JavaScript"
> type="text/javascript"><!-- alert("You are nearing your mailbox quota
> limit, please delete & purge emails to avoid any inconvinience.")
> // -->
> </script>';
>
> $quota_html .= '<td align="center" class="header">';
> $quota_html .= '<table width="100%"><tr><td bgcolor="#ccccff"><div
> style="height:6px; width:'. sprintf("%.1f%%", $percent). ';
> font-size:3px; background-color:'.$color.'">';
>             echo '<table width="100%" border="0" cellpadding="0"
> cellspacing="0"><tr><td class="item"><table border="0" cellspacing="0"
> cellpadding="0" width="100%"><tr>';
>             echo '<td align="right" class="header">';
>   echo "Used $usedmb MB of $quotamb MB, $percent %";
>             echo '</td></tr></table></td></tr></table>';
>
> return $quota_html
> ?>
>
> ______________
>
> On Tue, 15 Mar 2005 09:48:14 +0100, Jan Schneider <jan at horde.org> wrote:
> > Zitat von Noel Tanmoy Das <noel.das at gmail.com>:
> > > hi ........... i want to display the quota (like other webmail system,
> > > yahoo, hotmail etc) in imp ........ how can i do it ?
> >
> > Enable it in config/servers.php
> >
> > Jan.
> >
> > --
> > Do you need professional PHP or Horde consulting?
> > http://horde.org/consulting/
> > --
> > 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


More information about the imp mailing list