On Thu, Jan 24, 2002 at 11:02:54AM +0100, Oliver Blasnik wrote:
> Dziugas Baltrunas wrote:
> > 2) how could i count user quota usage? IMP 3.0 in config/conf.php writes:
> > /* Gets the quota usage from the imap server. $imap_admin &
> >  * $imap_passwd must be set to fit your own settings. This works
> >  * with the Cyrus imap server and the Courier imap server > 1.3.12.
> >  * Note the necessary changes for the Courier server in the comments.
> >  */
> 
> Hm, good to see they have already mentioned courier in the config file.
> Bad to see that there is no example for courier :(

Actually they do include the sample, just below the quoted passage. Here
is the full PHP function:

/* Gets the quota usage from the imap server. $imap_admin &
 * $imap_passwd must be set to fit your own settings. This works
 * with the Cyrus imap server and the Courier imap server > 1.3.12.
 * Note the necessary changes for the Courier server in the comments.
 */
// if (!function_exists('imp_show_quota')) {
//    function imp_show_quota ($imp) {
//         $imap_admin = 'admin';
//         $imap_passwd = 'password';
//         // Use the following two lines instead for Courier.
//         // $imap_admin = $imp['user'];
//         // $imap_passwd = Secret::read(Secret::getKey('imp'), $imp['pass']);
//
//         $stream = @imap_open(IMP::serverString(), $imap_admin, $imap_passwd, 
OP_HALFOPEN);
//         $quota = @imap_get_quota($stream, 'user.' . $imp['user']);
//         // Use the following line instead for Courier.
//         // $quota = @imap_get_quota($stream, 'ROOT');
//         imap_close($stream);
//
//         if (!empty($quota)) {
//             $taken   = $quota['usage'] / 1024.0;
//             $total   = $quota['limit'] / 1024.0;
//             $percent = $taken * 100 / $total;
//
//             echo '<table width="100%" border="0" cellpadding="0" 
cellspacing="0"><tr><td class="item"><table border="0" cellspacing="2" cellpadding="2" 
width="100%"><tr><td align="center" class="control">';
//             echo sprintf("%.2fMB / %.2fMB  (%.2f%%)", $taken, $total, $percent);
//             echo '</td></tr></table></td></tr></table>';
//         }
//     }
// }


-- 
Joshua Warchol
UNIX Systems Administrator
DSL.net

_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to