Hello,

About the System of my company :
Server A : imap server ( come from redhat 6.2 )
Server B : Web server ( redhat system 7.2 ) + IMP ( http://horde.org/imp
)

How can I enable the quota function with imap server by this php config
?
if (!function_exists('imp_show_quota')) {
   function imp_show_quota ($imp) {
        $imap_admin = $imp['user'];
        $passwd_array = posix_getpwnam($imap_admin);
        $homedir = split("/", $passwd_array['dir']);
        $realname = split(",", $passwd_array['gecos']);

        $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>';
        $quota_html .= '<td align="left" class="header">Login: ' .
$realname[0] . " (" . $imap_admin . ")" . '</td>';

        $junk = exec("sudo /usr/bin/quota -u $imap_admin | grep
/dev/md1",
                     $quota_data,$return_code);
        if ($return_code == 0 && count($quota_data) == 1) {
           $splitted = split("[[:blank:]]+", trim($quota_data[0]));
           $taken = $splitted[1] / 1000 ; $total = $splitted[2] / 1000 ;

           $percent = $taken * 100 / $total ;
           if ($percent >= 90) {
               $color = '#FF0000';
           } elseif ($percent >= 80) {
               $color = '#FCE30D';
           } else {
               $color = '#339933';
           }
           $quota_html .= '<td align="center" class="header">';
           $quota_html .= sprintf("<font size=-2>Quota on /%s:
%.1fMB/%.1fMB (%.1f%%)</font>", $homedir[1], $taken, $total, $percent);
        } else {
            $quota_html .= '<td align="center" class="header">';
            $quota_html .= "Quota not available";
        }
        $quota_html .= '</td><td width="30" class="header"
align="right"><font size="-3">0%</font></td><td width="200"
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.'">';
        $quota_html .= '</div></td></tr></table></td><td width="30"
class="header" align="left"><font
size="-3">100%</font></td></tr></table></td></tr></table>';
        return $quota_html;
    }
}

And I want the result similar with
http://www.ita.org.mo/~edward/imp/screenshot.gif

Thank for your help !

Edward.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to