mailer project continued:
[mailer.git] / inc / modules / admin / what-usage.php
index 70df56b23fe2132883c9a322e24db3954072b1db..b18804cc849a91ab3a4a3493719bfa07dfae004e 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -59,8 +59,8 @@ if (isGetRequestElementSet('image')) {
                        getConfig('usage_base')
                );
        } else {
-               if (strpos(getRequestElement('image'), "\\") > 0) {
-                       setGetRequestElement('image', substr(getRequestElement('image'), 0, strpos(getRequestElement('image'), "\\")));
+               if (strpos(getRequestElement('image'), chr(92)) > 0) {
+                       setGetRequestElement('image', substr(getRequestElement('image'), 0, strpos(getRequestElement('image'), chr(92))));
                } // END - if
                $FQFN = sprintf("%s%s/%s_usage_%s.png",
                        getPath(),
@@ -76,7 +76,7 @@ if (isGetRequestElementSet('image')) {
                imagepng($image);
                imagedestroy($image);
        } // END - if
-       shutdown();
+       doShutdown();
 } elseif (isGetRequestElementSet('usage')) {
        $FQFN = sprintf("%s%s/usage_%s.html",
                getPath(),
@@ -91,11 +91,28 @@ if ((!empty($FQFN)) && (isFileReadable($FQFN))) {
        // Until here...
 
        // Replace URLs
-       $content = str_replace('usage.png'    , '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=usage&image=usage', $content);
-       $content = str_replace('daily_usage_' , '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=daily&image='     , $content);
-       $content = str_replace('hourly_usage_', '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=hourly&image='    , $content);
-       $content = str_replace('ctry_usage_'  , '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=ctry&image='      , $content);
-       $content = str_replace('usage_'       , '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&usage='                    , str_replace('.html', '', $content));
+       $content = str_replace(
+               // From:
+               array(
+                       'usage.png',
+                       'daily_usage_',
+                       'hourly_usage_',
+                       'ctry_usage_',
+                       'usage_',
+                       '.html',
+               ),
+               // To:
+               array(
+                       '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=usage&image=usage',
+                       '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=daily&image=',
+                       '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=hourly&image=',
+                       '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&type=ctry&image=',
+                       '{?URL?}/modules.php?module=admin&what=' . getWhat() . '&usage=',
+                       '',
+               ),
+               // Target to replace on:
+               $content
+       );
        $test = strtolower($content);
 
        // Do we need to strip out above and including <body> plus trailing </html> tag?