List active/inactive extensions
[mailer.git] / 0.2.1 / inc / modules / admin / what-usage.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 11/15/2003 *\r
4  * ===============                              Last change: 04/02/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : what-usage.php                                   *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Auto-detection of usage statistics               *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Automatische Erkennung der Aufrufstatistiken     *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\r
18  * This program is free software; you can redistribute it and/or modify *\r
19  * it under the terms of the GNU General Public License as published by *\r
20  * the Free Software Foundation; either version 2 of the License, or    *\r
21  * (at your option) any later version.                                  *\r
22  *                                                                      *\r
23  * This program is distributed in the hope that it will be useful,      *\r
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
26  * GNU General Public License for more details.                         *\r
27  *                                                                      *\r
28  * You should have received a copy of the GNU General Public License    *\r
29  * along with this program; if not, write to the Free Software          *\r
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
31  * MA  02110-1301  USA                                                  *\r
32  ************************************************************************/\r
33 \r
34 // Some security stuff...\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))\r
36 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";\r
38         require($INC);\r
39 }\r
40 // Add description as navigation point\r
41 ADD_DESCR("admin", basename(__FILE__));\r
42 \r
43 OPEN_TABLE("100%", "admin_content admin_content_align", "");\r
44 $usage = "usage/";\r
45 if (!empty($_GET['image']))\r
46 {\r
47         if ($_GET['type'] == "usage")\r
48         {\r
49                 $file = PATH.$usage."usage.png";\r
50         }\r
51          else\r
52         {\r
53                 if (strpos($_GET['image'], "\\") > 0) $_GET['image'] = substr($_GET['image'], 0, strpos($_GET['image'], "\\"));\r
54                 $file = PATH.$usage.$_GET['type']."_usage_".$_GET['image'].".png";\r
55         }\r
56         if (file_exists($file))\r
57         {\r
58                 $image = imagecreatefrompng($file);\r
59                 header("Content-type: image/png");\r
60                 imagepng($image);\r
61                 imagedestroy($image);\r
62         }\r
63         exit();\r
64 }\r
65  elseif (empty($_GET['usage']))\r
66 {\r
67         $file = PATH.$usage."index.html";\r
68 }\r
69  else\r
70 {\r
71         $file = sprintf("%s%susage_%s.html",\r
72                 PATH,\r
73                 $usage,\r
74                 SQL_ESCAPE($_GET['usage'])\r
75         );\r
76 }\r
77 if ($file !="")\r
78 {\r
79         if (file_exists($file) && is_readable($file))\r
80         {\r
81                         $tmpl_file = implode("", file($file));\r
82                         $tmpl_file = addslashes($tmpl_file);\r
83                         $tmpl_file = "\$content=\"".$tmpl_file."\";";\r
84                         eval($tmpl_file);\r
85                         $content = str_replace("usage.png", URL."/modules.php?module=admin&amp;what=".$GLOBALS['what']."&type=usage&image=usage", $content);\r
86                         $content = str_replace("daily_usage_", URL."/modules.php?module=admin&amp;what=".$GLOBALS['what']."&type=daily&image=", $content);\r
87                         $content = str_replace("hourly_usage_", URL."/modules.php?module=admin&amp;what=".$GLOBALS['what']."&type=hourly&image=", $content);\r
88                         $content = str_replace("ctry_usage_", URL."/modules.php?module=admin&amp;what=".$GLOBALS['what']."&type=ctry&image=", $content);\r
89                         $content = str_replace("usage_", URL."/modules.php?module=admin&amp;what=".$GLOBALS['what']."&usage=", str_replace(".html", "", $content));\r
90                         // Disabled due to too much trouble\r
91                         //$content = str_replace("HREF=\"http://", "href=\"".URL."/modules.php?module=loader&amp;url=http://", $content);\r
92                         $test = strtolower($content);\r
93                         $body_start = strpos($test, "<body");\r
94                         $body_end   = strpos($test, "</body>");\r
95                         if (($body_start > 0) && ($body_end > 0))\r
96                         {\r
97                                 $content = substr(substr($content, 0, $body_end), $body_start);\r
98                                 $content = substr($content, strpos($content, ">") + 1);\r
99                                 OUTPUT_HTML ("<DIV align=\"left\">\r
100   ".$content."\r
101 </DIV>");\r
102                         }\r
103         }\r
104 }\r
105 CLOSE_TABLE();\r
106 //\r
107 ?>\r