Diff for QuotaHack between 2 and 3

To assign quota toHere is a userhack that displays quota on a server not supporting quota, like dovecot or any mail server without using the built in quota feature(If you find this simpler).

create a folder quota'quota' on your server '/' partition

<code type="bash">

mkdir /quota


to assign quota to any user


<code type="bash">

echo "10000" > /quota/username


This would give 10MB quota to a user. Give whatever you wish to assign.

Create the following file



<code type="php">




    $usage = `sudo du -s /home/$user/mail | cut -d "/" -f 1` + `sudo du -s /var/spool/mail/$user | cut -d "/" -f 1` - $archive;

    $archiveused = round($archive/1000);

    $usedmb = round($usage / 1000);

    $quota$usedmb = `cat /quota/$user`+ 1;round($usage / 1000);

    $quotamb$quota = round($quota / 1000);`cat /quota/$user`+ 1;

    $percent$quotamb = round($usage * 100round($quota / $quota);1000);

        if$percent = round($usage * 100 / $quota);

        if ($quota > 1) {

             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="left" class="header">Login: ' .  $user . '</td>';

             echo '<td align="right" class="header">';

             echo "Quota Used $usedmb MB of $quotamb MB ($percent %)";

             echo '</td></tr></table></td></tr></table>';


// -->




Change the above reflecting your mailserver's folder locations. Above is for dovecot on RHEL 3, with mails in /home/username/mail and /var/spool/mail/username.

Add this in horde/imp/templates/common-headers.inc (line 27, 28,29)


<code type="php">

$page_title = $GLOBALS['registry']->get('name');

if (!empty($title)) $page_title .= ' :: ' . $title;

if (!empty($refresh_time) && !empty($refresh_url)) {

    echo "<meta http-equiv="refresh" content="$refresh_time;url=$refresh_url" />n";




<title><?php echo htmlspecialchars($page_title) ?></title>


//--->Add the following here <----


include_once HORDE_BASE . '/quota.php';




<link href="<?php echo $GLOBALS['registry']->getImageDir()?>/favicon.ico" rel="SHORTCUT ICON" />

<?php if (isset($mailbox_url)): ?>


This should give you quota information on any mail server regardless of the support of quota by the server or OS quota assignments. DoDo let me know if this was useful or send in any improvement suggestions.improvements/suggestions.

jigish dot gohil at gmail dot com