alecpl
2009-10-19 efe93ad11610fcfd42c76a1cdddb07be00f8cf1b
bin/quotaimg.php
@@ -4,7 +4,7 @@
 | bin/quotaimg.php                                                      |
 |                                                                       |
 | This file is part of the RoundCube Webmail client                     |
 | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland                 |
 | Licensed under the GNU GPL                                            |
 |                                                                       |
 | PURPOSE:                                                              |
@@ -17,6 +17,11 @@
 $Id$
*/
define('INSTALL_PATH', realpath(dirname(__FILE__).'/..') . '/');
require INSTALL_PATH . 'program/include/iniset.php';
$RCMAIL = rcmail::get_instance();
$used   = isset($_GET['u']) ? intval($_GET['u']) : '??';
$quota  = isset($_GET['q']) ? intval($_GET['q']) : '??';
@@ -97,7 +102,7 @@
    ***********************************/
   // @todo: Set to "??" instead?
   if (ereg("^[^0-9?]*$", $used) || ereg("^[^0-9?]*$", $total)) {
   if (preg_match('/^[^0-9?]*$/', $used) || preg_match('/^[^0-9?]*$/', $total)) {
      return false; 
   }
@@ -167,7 +172,8 @@
      }
      $quota_width = $quota / 100 * $width;
      imagefilledrectangle($im, $border, 0, $quota_width, $height-2*$border, $fill);
      if ($quota_width)
         imagefilledrectangle($im, $border, 0, $quota_width, $height-2*$border, $fill);
      $string = $quota . '%';
      $mid    = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1;
@@ -186,11 +192,12 @@
   imagedestroy($im);
}
if ($width > 1 && $height > 1) {
   genQuota($used, $quota, $width, $height);
if (!empty($RCMAIL->user->ID) && $width > 1 && $height > 1) {
   genQuota($used, $quota, $width, $height);
}
else {
   header("HTTP/1.0 404 Not Found");
   header("HTTP/1.0 403 Forbidden");
   echo "Requires a valid user session and positive values";
}
exit;