\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\textbf{This information is valid for Horde 5 and later only. See <a href="https://wiki.horde.org/AltQuotaH4">AltQuotaH4</a> for Horde 4 or <a href="https://wiki.horde.org/AltQuotaH3">AltQuotaH3</a> for Horde 3.}

\subsection{Notes}
\textbf{IMP 6, Horde 5}<br />
\textbf{Modifies traditional and dynamic views to display quotas}.

This describes modifications to IMP 6 (Horde 5) quota \textbackslash\{\}<br />
to use two different partitions (file systems) with quota enabled. \textbackslash\{\}<br />
One is used for INBOX and the other is used for IMAP folders.

This allows different quota values for INBOX and IMAP folders.

It uses system quota command.

Tested on Debian 6.0 (squeeze), Horde 5.0.3-IMP 6.0.3, Horde 5.0.4-IMP 6.0.4


\noindent\rule{\textwidth}{1pt}
\subsection{Modifications}
<table class="horde-table">File & Variables, Function(s) \\
\hline
imp/config/backends.php & quota \\
\hline
imp/lib/Quota/Command.php & getQuota \\
\hline
imp/lib/Quota.php & construct \\
\hline
imp/lib/View/Subinfo.php & construct \\
\hline
imp/templates/basic/subinfo.html.php & quotaClassV, quotaClassH \\
\hline
imp/templates/dynamic/mailbox\_subinfo.html.php & quota-text \\
\hline
imp/lib/Ui/Quota.php & quota \\
\hline
imp/lib/Ajax/Queue.php & m, p, l, add \\
\hline
imp/js/dimpbase.js (IMP 6.0.3) & quotaV, quotaH, quotaCallback \\
\hline
imp/js/dimpbase.js (IMP 6.0.4) & quotaV, quotaH, quotaCallback \\
\hline
\textit{Last updated 2013-02-23} &  \\
\hline
</table>

\noindent\rule{\textwidth}{1pt}
\subsection{Descriptions}

\noindent\rule{\textwidth}{1pt}
\subsubsection{Configuration example (imp/config/backends.php)}
\begin{itemize}
\item Two partitions (file systems)


\end{itemize}
\begin{quote}
See Comand.php bellow for parameters.<br />
Quota command must support "w" (do not wrap).


\end{quote}
<pre><code class="language-php">
\$servers['imap'] = array(
    ...

    'quota' => array(
        'driver' => 'command',
        'params' => array(
            'quota\_path' => '/usr/bin/quota',
            'dev\_inbx' => '/dev/disk/by-uuid/734e96a4-af8f-4c83-a12c-4ab11b139a13',
            'dev\_fldrs' => '/dev/sdb2',
            'unit' => 'GB',
        )
    ),
    ...
);
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/lib/Quota/Command.php}
\begin{itemize}
\item Have INBOX and IMAP folders in different partitions and quota enabled on them.


\item Function IMP\_Quota\_command accepts 2 new parameters:


\end{itemize}
\begin{quote}
'\textbf{dev\_inbx}' (string) [\textbf{REQUIRED}] User´s INBOX file system device.<br />
Usually maps to /var/mail, /var/spool/mail.<br />
Examples: '/dev/hda6', '/dev/sdb2', '/dev/md2', '/dev/disk/by-uuid/097a934f-8fb1-4c9d-a330-817194b6e8a8'.<br />
'\textbf{dev\_fldrs}' (string) [\textbf{REQUIRED}] User´s home file system device. \textbackslash\{\}<br />
Used for IMAP folders. Usually maps to /home.<br />
Examples: '/dev/hda7', '/dev/sda3', '/dev/md1', '/dev/mapper/VOL2-Home'.<br />
\textbf{Obsolete} parameters: grep\_path, partition


\end{quote}
\begin{itemize}
\item function getQuota:


\end{itemize}
\begin{quote}
Function now takes care of exceeded quotas and quota not defined for that user.


\end{quote}
Backup your original imp/lib/Quota/Command.php and create a new Command.php with the following code:

<pre><code class="language-php">
<?php
/**
 * Implementation of IMP\_Quota API for IMAP servers with a *nix quota command.
 * This requires a modified "quota" command that allows the httpd server
 * account to get quotas for other users. It also requires that your
 * web server and imap server be the same server or at least have shared
 * authentication and file servers (e.g. via NIS/NFS).  And last, it (as
 * written) requires the POSIX PHP extensions.
 *
 * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author   Eric Rostetter <eric.rostetter@physics.utexas.edu>
 * @category Horde
 * @license  http://www.horde.org/licenses/gpl GPL
 * @package  IMP
 * 
 * Modified by Mauricio Jose T. Tecles <mtecles@biof.ufrj.br>
 * Updated 2013 February 19
 */
class IMP\_Quota\_Command extends IMP\_Quota
\{
    /**
     * Constructor.
     *
     * @param array \$params  Parameters:
     *   - grep\_path: obsolete.
     *   - partition: obsolete.
     * 'dev\_inbx'   - (string) [REQUIRED] User´s INBOX file system device
     *                   Usually: /,  /var/mail,  /var/spool/mail
     *                   Examples: '/dev/hda6', '/dev/sdb2', '/dev/md2', 
     *                             '/dev/mapper/VOL1-VarM'
     * 'dev\_fldrs'  - (string) [REQUIRED] User´s home file system device
     *                   Have INBOX and IMAP folders in different
     *                   devices and quota enabled on them.
     *                   For IMAP folders. Usually: /home
     *                   Examples: '/dev/hda7', '/dev/sda3', '/dev/md1', 
     *                             '/dev/mapper/VOL2-Home'
     *   - quota\_path: (string) [REQUIRED] Path to the quota binary.
     */
    public function \_\_construct(array \$params = array())
    \{
        \$params = array\_merge(array(
            'quota\_path' => 'quota',
            'dev\_inbx'  => null,
			'dev\_fldrs'  => null
        ), \$params);

        parent::\_\_construct(\$params);
    \}

    /**
     * Get the disk block size, if possible.
     *
     * We try to find out the disk block size from stat(). If not
     * available, stat() should return -1 for this value, in which
     * case we default to 1024 (for historical reasons). There are a
     * large number of reasons this may fail, such as OS support,
     * SELinux interference, the file being > 2 GB in size, the file
     * we're referring to not being readable, etc.
     *
     * @return integer  The disk block size.
     */
    protected function \_blockSize()
    \{
        \$results = stat(\_\_FILE\_\_);
        return (\$results['blksize'] > 1)
            ? \$results['blksize']
            : 1024;
    \}

    /**
     * Get quota information (used/allocated), in bytes.
     *
     * @return array  An array with the following keys:
     *                'limit' = Maximum quota allowed
     *                'usage' = Currently used portion of quota (in bytes)
     * @throws IMP\_Exception
     */
    public function getQuota()
    \{

        \$cmdline = \$this->\_params['quota\_path'] . ' -uw ' . escapeshellarg(\$this->\_params['username']);
        exec(\$cmdline, \$quota\_data, \$return\_code);
		
        \$junk = count( \$quota\_data);
        \$blocksize = 1024;

        /* 
        * Is quota exceeded? 
        */

        if (\$return\_code == 0) \{
            /* 
            * Quota not exceeded 
            * Is quota defined? 
            */

            if (ereg("none\$", \$quota\_data[0])) \{
                /*
                * Quota not defined.
                */

                return array('usagehome' => 0, 'limithome' => 0, 'usagevar' => 0, 'limitvar' => 0);

            \} else \{
                /*
                * Quota defined
                */
                if ( \$junk == 4 ) \{
                    /*
                    * Quotas defined for dev\_fldrs and dev\_inbx
                    */

                    if (ereg(\$this->\_params['dev\_fldrs'], \$quota\_data[2])) \{
                        \$quotahome = split("[[:blank:]]+", trim(\$quota\_data[2]));
                        \$quotavar = split("[[:blank:]]+", trim(\$quota\_data[3]));
                        return array('usagehome' => \$quotahome[1] * \$blocksize, 'limithome' => \$quotahome[2] * \$blocksize, 'usagevar' => \$quotavar[1] * \$blocksize, 'limitvar' => \$quotavar[2] * \$blocksize);
                    \} elseif (ereg(\$this->\_params['dev\_inbx'], \$quota\_data[2])) \{
                        \$quotahome = split("[[:blank:]]+", trim(\$quota\_data[3]));
                        \$quotavar = split("[[:blank:]]+", trim(\$quota\_data[2]));
                        return array('usagehome' => \$quotahome[1] * \$blocksize, 'limithome' => \$quotahome[2] * \$blocksize, 'usagevar' => \$quotavar[1] * \$blocksize, 'limitvar' => \$quotavar[2] * \$blocksize);
                    \} 
                \} else \{
                    /*
                    * Either quota is defined only for dev\_fldrs or dev\_inbx
                    * or user owns file in only one file system.
                    */
                    if (ereg(\$this->\_params['dev\_inbx'], \$quota\_data[2])) \{
                        \$quotavar = split("[[:blank:]]+", trim(\$quota\_data[2]));

                        return array('usagehome' => 0, 'limithome' => 0, 'usagevar' => \$quotavar[1] * \$blocksize, 'limitvar' => \$quotavar[2] * \$blocksize);

                    \} elseif (!empty(\$this->\_params['dev\_fldrs'])) \{
                        if (ereg(\$this->\_params['dev\_fldrs'], \$quota\_data[2])) \{
                            \$quotahome = split("[[:blank:]]+", trim(\$quota\_data[2]));
                            return array('usagehome' => \$quotahome[1] * \$blocksize, 'limithome' => \$quotahome[2] * \$blocksize, 'usagevar' => 0, 'limitvar' => 0);
                        \}    
                    \}
                \}
            \}
        \} else \{
            /*
            * Some quota exceeded
            */
            if ( \$junk == 4 ) \{
                /*
                * Quotas defined for dev\_fldrs and dev\_inbx
                */
                if (ereg(\$this->\_params['dev\_fldrs'], \$quota\_data[2])) \{
                    \$quotahome = split("[[:blank:]]+", trim(\$quota\_data[2]));
                    \$quotavar = split("[[:blank:]]+", trim(\$quota\_data[3]));
                \} elseif (ereg(\$this->\_params['dev\_inbx'], \$quota\_data[2])) \{
                    \$quotahome = split("[[:blank:]]+", trim(\$quota\_data[3]));
                    \$quotavar = split("[[:blank:]]+", trim(\$quota\_data[2]));
                \}
                /*
                * 
                * Quota exceeded in dev\_fldrs?
                */
                if (ereg("\textbackslash\{\}*\$", \$quotahome[1])) \{
                    \$quotahome[1] = ereg\_replace ("\textbackslash\{\}*", "", \$quotahome[1]);
                    \$quotahome[4] = ereg\_replace ("days", "", \$quotahome[4]);
                \} else \{
                    \$quotahome[4] == "";
                \}
                /* 
                * Quota exceeded in dev\_inbx?
                */
                if (ereg("\textbackslash\{\}*\$", \$quotavar[1])) \{
                    \$quotavar[1] = ereg\_replace ("\textbackslash\{\}*", "", \$quotavar[1]);
                    \$quotavar[4] = ereg\_replace ("days", "", \$quotavar[4]);
                \} else \{
                    \$quotavar[4] == "";
                \}
                return array('usagehome' => \$quotahome[1] * \$blocksize, 'limithome' => \$quotahome[2] * \$blocksize, 'gracehome' => \$quotahome[4], 'usagevar' => \$quotavar[1] * \$blocksize, 'limitvar' => \$quotavar[2] * \$blocksize, 'gracevar' => \$quotavar[4]);
            \} else \{
                /*
                * Either quota is defined only for dev\_fldrs or dev\_inbx
                * or user owns file in only one file system.
                */
                if (ereg(\$this->\_params[dev\_inbx], \$quota\_data[2])) \{
                    /** 
                    * Quota exceeded in dev\_inbx.
                    */
                    \$quotavar = split("[[:blank:]]+", trim(\$quota\_data[2]));
                    \$quotavar[1] = ereg\_replace ("\textbackslash\{\}*", "", \$quotavar[1]);
                    \$quotavar[4] = ereg\_replace ("days", "", \$quotavar[4]);

                    return array('usagehome' => 0, 'limithome' => 0, 'usagevar' => \$quotavar[1] * \$blocksize, 'limitvar' => \$quotavar[2] * \$blocksize, 'gracevar' => \$quotavar[4]);

                \} else \{
                    /* 
                    * Quota exceeded in dev\_fldrs
                    */
                    \$quotahome = split("[[:blank:]]+", trim(\$quota\_data[2]));
                    \$quotahome[1] = ereg\_replace ("\textbackslash\{\}*", "", \$quotahome[1]);
                    \$quotahome[4] = ereg\_replace ("days", "", \$quotahome[4]);
                    return array('usagehome' => \$quotahome[1] * \$blocksize, 'limithome' => \$quotahome[2] * \$blocksize, 'gracehome' => \$quotahome[4], 'usagevar' => 0, 'limitvar' => 0);
                \}
            \}
        \}

        throw new IMP\_Exception(\_("Unable to retrieve quota"));
    \}

\}
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/lib/Quota.php}
\begin{itemize}
\item New formats.


\end{itemize}
\begin{quote}
Only short formats.


\end{quote}
Backup your original imp/lib/Quota.php and replace function construct with the following code:

<pre><code class="language-php">
    public function \_\_construct(array \$params = array())
    \{
        \$this->\_params = array\_merge(\$this->\_params, \$params);

        \$this->\_params['format'] = array(
            'shortv' => isset(\$this->\_params['format']['short'])
                ? \$this->\_params['format']['short']
                : \_("Entrada: \%.0f\%\% of \%.1f \%s"),
            'shorth' => isset(\$this->\_params['format']['shorth'])
                ? \$this->\_params['format']['shorth']
                : \_(" - Pastas: \%.0f\%\% de \%.1f \%s"),
            'sshorth' => isset(\$this->\_params['format']['sshorth'])
                ? \$this->\_params['format']['sshorth']
                : \_("Pastas: \%.0f\%\% de \%.1f \%s"),
            'nolimit\_shortv' => isset(\$this->\_params['format']['nolimit\_short'])
                ? \$this->\_params['format']['nolimit\_short']
                : \_("Entrada: \%.1f \%s"),
            'nolimit\_shorth' => isset(\$this->\_params['format']['nolimit\_shorth'])
                ? \$this->\_params['format']['nolimit\_shorth']
                : \_(" - Pastas: \%.1f \%s"),
            'nolimit\_sshorth' => isset(\$this->\_params['format']['nolimit\_sshorth'])
                ? \$this->\_params['format']['nolimit\_sshorth']
                : \_("Pastas: \%.1f \%s"),
        );
    \}
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/lib/View/Subinfo.php}
Backup your original imp/lib/View/Subinfo.php and replace function construct with the following code:

<pre><code class="language-php">
    public function \_\_construct(\$config = array())
    \{
        \$config['templatePath'] = IMP\_TEMPLATES . '/basic';
        parent::\_\_construct(\$config);

        \$quotadata = \$GLOBALS['injector']->getInstance('IMP\_Ui\_Quota')->quota();
        if (!empty(\$quotadata)) \{
            \$this->quotaClassV = \$quotadata['classvar'];
            \$this->quotaTextV = \$quotadata['messagevar'];
            \$this->quotaClassH = \$quotadata['classhome'];
            \$this->quotaTextH = \$quotadata['messagehome'];
        \}
    \}
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/templates/basic/subinfo.html.php}
Backup your original imp/templates/basic/subinfo.html.php and replace the following code:<br />
From:

<pre><code class="language-php">
<?php if (\$this->quotaText): ?>
<span class="<?php echo \$this->quotaClass ?>"><?php echo \$this->quotaText ?></span>
<?php endif ?>
</code></pre>
To:

<pre><code class="language-php">
<?php if (\$this->quotaTextV): ?>
<span class="<?php echo \$this->quotaClassV ?>"><?php echo \$this->quotaTextV ?></span>
<?php endif ?>
<?php if (\$this->quotaTextV): ?>
<span class="<?php echo \$this->quotaClassH ?>"><?php echo \$this->quotaTextH ?></span>
<?php endif ?>
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/templates/dynamic/mailbox\_subinfo.html.php}
Backup your original imp/templates/dynamic/mailbox\_subinfo.html.php and replace the following code:<br />
From:

<pre><code class="language-php">
<span id="quota-text"></span>
</code></pre>
To:

<pre><code class="language-php">
<span id="quota-textV"></span><span id="quota-textH"></span>
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/lib/Ui/Quota.php}
Backup your original imp/lib/Ui/Quota.php and create a new Quota.php with the following code:

<pre><code class="language-php">
<?php
/**
 * Common code dealing with quota handling.
 *
 * Copyright 2012 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author   Michael Slusarz <slusarz@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/gpl GPL
 * @package  IMP
 * 
 * Modified by Mauricio Jose T. Tecles <mtecles@biof.ufrj.br>
 * Updated 2013 February 23
 */
class IMP\_Ui\_Quota
\{
    /**
     * Returns data needed to output quota.
     *
     * @return array  Array with these keys: class, message, percent.
     */
    public function quota()
    \{
        global \$injector, \$session;

        if (!\$session->get('imp', 'imap\_quota')) \{
            return false;
        \}

        try \{
            \$quotaDriver = \$injector->getInstance('IMP\_Quota');
            \$quota = \$quotaDriver->getQuota();
        \} catch (IMP\_Exception \$e) \{
            Horde::log(\$e, 'ERR');
            return false;
        \}

        if (empty(\$quota)) \{
            return false;
        \}

        \$strings = \$quotaDriver->getMessages();
        list(\$calc, \$unit) = \$quotaDriver->getUnit();
        \$ret = array(
            'classvar' => '',
            'percentvar' => 0,
            'classhome' => '',
            'percenthome' => 0
        );

        /* Quota for dev\_fldrs */
        unset(\$ret['messagehome']);
        if (\$quota['limithome'] != 0) \{
            \$quota['usagehome'] = \$quota['usagehome'] / \$calc;
            \$quota['limithome'] = \$quota['limithome'] / \$calc;
            \$ret['percenthome'] = (\$quota['usagehome'] * 100) / \$quota['limithome'];

            if (\$ret['percenthome'] >= 100) \{
                \$ret['gracehome'] = \$quota['gracehome'];
                \$ret['classhome'] = 'quotaalert';
			\} elseif (\$ret['percenthome'] >= 90) \{
                \$ret['classhome'] = 'quotawarn';
            \}

			if (\$quota['usagevar'] != 0) \{
                \$ret['messagehome'] = sprintf(\$strings['shorth'], \$ret['percenthome'], \$quota['limithome'], \$unit);
                \$ret['percenthome'] = sprintf("\%.2f", \$ret['percenthome']);
			\} else \{
                \$ret['messagehome'] = sprintf(\$strings['sshorth'], \$ret['percenthome'], \$quota['limithome'], \$unit);
                \$ret['percenthome'] = sprintf("\%.2f", \$ret['percenthome']);
			\}

        \} else \{
            if (\$quota['usagehome'] != 0) \{
			    if (\$quota['usagevar'] != 0) \{
                    \$quota['usagehome'] = \$quota['usagehome'] / \$calc;
		            \$ret['messagehome'] = sprintf(\$strings['nolimit\_shorth'], \$quota['usagehome'], \$unit);
				\} else \{
                    \$quota['usagehome'] = \$quota['usagehome'] / \$calc;
		            \$ret['messagehome'] = sprintf(\$strings['nolimit\_sshorth'], \$quota['usagehome'], \$unit);
				\}
            \} else \{
                \$ret['messagehome'] = \_(" ");
            \}
        \}

        /* Quota for dev\_inbx */
        if (\$quota['limitvar'] != 0) \{
            \$quota['usagevar'] = \$quota['usagevar'] / \$calc;
            \$quota['limitvar'] = \$quota['limitvar'] / \$calc;
            \$ret['percentvar'] = (\$quota['usagevar'] * 100) / \$quota['limitvar'];

            if (\$ret['percentvar'] >= 100) \{
                \$ret['gracevar'] = \$quota['gracevar'];
                \$ret['classvar'] = 'quotaalert';
			\} elseif (\$ret['percentvar'] >= 90) \{
                \$ret['classvar'] = 'quotawarn';
            \}

            \$ret['messagevar'] = sprintf(\$strings['shortv'], \$ret['percentvar'], \$quota['limitvar'], \$unit);
            \$ret['percentvar'] = sprintf("\%.2f", \$ret['percentvar']);
        \} else \{
            if (\$quota['usagevar'] != 0) \{
                \$quota['usagevar'] = \$quota['usagevar'] / \$calc;

                \$ret['messagevar'] = sprintf(\$strings['nolimit\_shortv'], \$quota['usagevar'], \$unit);
            \} else \{
                \$ret['messagevar'] = \_(" ");
            \}
        \}
		
        return \$ret;
    \}

\}
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/lib/Ajax/Queue.php}
\begin{itemize}
\item mv, pv, lv: quota message, percentage and class for Inbox


\item mh, ph, lh: quota message, percentage and class for "home"


\end{itemize}
Backup your original imp/lib/Ajax/Queue.php and replace function add with the following code:

<pre><code class="language-php">
    public function add(IMP\_Ajax\_Application \$ajax)
    \{
        /* Add flag information. */
        if (!empty(\$this->\_flag)) \{
            \$ajax->addTask('flag', \$this->\_flag);
            \$this->\_flag = array();
        \}

        /* Add folder tree information. */
        \$imptree = \$GLOBALS['injector']->getInstance('IMP\_Imap\_Tree');
        \$imptree->setIteratorFilter(IMP\_Imap\_Tree::FLIST\_NOSPECIALMBOXES);
        \$out = \$imptree->getAjaxResponse();
        if (!empty(\$out)) \{
            \$ajax->addTask('mailbox', array\_merge(\$out, \$this->\_mailboxOpts));
        \}

        /* Add mail log information. */
        if (!empty(\$this->\_maillog)) \{
            \$imp\_maillog = \$GLOBALS['injector']->getInstance('IMP\_Maillog');
            \$maillog = array();

            foreach (\$this->\_maillog as \$val) \{
                if (\$tmp = \$imp\_maillog->getLogObs(\$val['msg\_id'])) \{
                    \$log\_ob = new stdClass;
                    \$log\_ob->log = \$tmp;
                    \$log\_ob->mbox = \$val['mailbox']->form\_to;
                    \$log\_ob->uid = \$val['uid'];
                    \$maillog[] = \$log\_ob;
                \}
            \}

            if (!empty(\$maillog)) \{
                \$ajax->addTask('maillog', \$maillog);
            \}
        \}

        /* Add message information. */
        if (!empty(\$this->\_messages)) \{
            \$ajax->addTask('message', \$this->\_messages);
            \$this->\_messages = array();
        \}

        /* Add poll information. */
        \$poll = \$poll\_list = array();
        foreach (\$this->\_poll as \$val) \{
            \$poll\_list[strval(\$val)] = 1;
        \}

        \$imap\_ob = \$GLOBALS['injector']->getInstance('IMP\_Factory\_Imap')->create();
        if (\$imap\_ob->ob) \{
            foreach (\$imap\_ob->statusMultiple(array\_keys(\$poll\_list), Horde\_Imap\_Client::STATUS\_UNSEEN) as \$key => \$val) \{
                \$poll[IMP\_Mailbox::formTo(\$key)] = intval(\$val['unseen']);
            \}
        \}

        if (!empty(\$poll)) \{
            \$ajax->addTask('poll', \$poll);
            \$this->\_poll = array();
        \}

        /* Add quota information. */
        if (\$this->\_quota \&\&
            (\$quotadata = \$GLOBALS['injector']->getInstance('IMP\_Ui\_Quota')->quota())) \{
            /* Quota for dev\_inbx */
			\$merrov = null;
            if (round(\$quotadata['percentvar']) >= 100) \{
                \$mvclasse = 'horde.error';

                if (ereg("none", \$quotadata['gracevar'])) \{
			        \$merrov = sprintf("Inbox above limit. Grace time expired.");
                \} else \{
				    \$merrov = sprintf("Inbox above limit. Solve in \%s day(s)", \$quotadata['gracevar']);
                \}
            \} else if (\$quotadata['percentvar'] >= 90) \{
                
                    \$merrov = sprintf("Inbox above 90\%\%.");
                    \$mvclasse = 'horde.warning';
            \}
            /* Quota for dev\_fldrs */
            \$merroh = null;
            if (round(\$quotadata['percenthome'] >= 100)) \{
                \$mhclasse = 'horde.error';
                if (ereg("none", \$quotadata['gracehome'])) \{
                    \$merroh = sprintf("Folders above limit. Grace time expired.");
                \} else \{
                    \$merroh = sprintf("Folders above limit. Solve in \%s day(s)", \$quotadata['gracehome']);
                \}
            \} elseif (\$quotadata['percenthome'] >= 90) \{
                \$merroh = sprintf("Folders above 90\%\%.");
                \$mhclasse = 'horde.warning';
            \}

            if (!empty(\$merrov)) \{
                \$GLOBALS['notification']->push(\$merrov, \$mvclasse);
            \}
            if (!empty(\$merroh)) \{
                \$GLOBALS['notification']->push(\$merroh, \$mhclasse);
            \}



            \$ajax->addTask('quota', array(
                'mv' => \$quotadata['messagevar'],
                'pv' => round(\$quotadata['percentvar']),
                'lv' => \$quotadata['percentvar'] >= 100
                    ? 'alert'
                    : (\$quotadata['percentvar'] >= 90 ? 'warn' : 'control'),
                'mh' => \$quotadata['messagehome'],
                'ph' => round(\$quotadata['percenthome']),
                'lh' => \$quotadata['percenthome'] >= 100
                    ? 'alert'
                    : (\$quotadata['percenthome'] >= 90 ? 'warn' : 'control')
			));
            \$this->\_quota = false;
        \}
    \}
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/js/dimpbase.js (IMP 6.0.3)}
\begin{itemize}
\item quotaCallback


\end{itemize}
\begin{quote}
quotaV, mv, lv<br />
quotaH, mh, lh


\end{quote}
Backup your original imp/js/dimpbase.js. Edit dimpbase.js and replace function quotaCallback with the following code:

<pre><code class="language-php">
    quotaCallback: function(r)
    \{
        var quotaV = \$('quota-textV');
        var quotaH = \$('quota-textH');
        quotaV.setText(r.mv);
        switch (r.lv) \{
        case 'alert':
            quotaV.removeClassName('quotawarn');
            quotaV.addClassName('quotaalert');
            break;
        case 'warn':
            quotaV.removeClassName('quotaalert');
            quotaV.addClassName('quotawarn');
            break;
        case 'control':
            quotaV.removeClassName('quotawarn');
            quotaV.removeClassName('quotaalert');
            break;
        \}
        quotaH.setText(r.mh);
        switch (r.lh) \{
        case 'alert':
            quotaH.removeClassName('quotawarn');
            quotaH.addClassName('quotaalert');
            break;
        case 'warn':
            quotaH.removeClassName('quotaalert');
            quotaH.addClassName('quotawarn');
            break;
        case 'control':
            quotaH.removeClassName('quotawarn');
            quotaH.removeClassName('quotaalert');
            break;
        \}
    \},
</code></pre>

\noindent\rule{\textwidth}{1pt}
\subsubsection{imp/js/dimpbase.js (IMP 6.0.4)}
\begin{itemize}
\item quotaCallback


\end{itemize}
\begin{quote}
quotaV, mv, lv<br />
quotaH, mh, lh


\end{quote}
Backup your original imp/js/dimpbase.js. Edit dimpbase.js and replace function quotaCallback with the following code:

<pre><code class="language-php">
    quotaCallback: function(r)
    \{
        var quotaV = \$('quota-textV');
        var quotaH = \$('quota-textH');
        quotaV.removeClassName('quotaalert').
            removeClassName('quotawarn').
            setText(r.mv);
        quotaH.removeClassName('quotaalert').
            removeClassName('quotawarn').
            setText(r.mh);

        switch (r.lv) \{
        case 'alert':
        case 'warn':
            quotaV.addClassName('quota' + r.lv);
            break;
        \}

        switch (r.lh) \{
        case 'alert':
        case 'warn':
            quotaH.addClassName('quota' + r.lh);
            break;
        \}
    \},
</code></pre>
\end{document}
