Variable fixed
[mailer.git] / img.php
diff --git a/img.php b/img.php
index 94878c19a323a5083df6d0425ad5b3308d65c34f..09cafe5146de8bc60609fdd19009d34073a20158 100644 (file)
--- a/img.php
+++ b/img.php
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
  * MXChange v0.2.1                                    Start: 10/12/2003 *
- * ===============                              Last change: 10/12/2004 *
+ * ===============                              Last change: 10/16/2008 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : img.php                                          *
@@ -37,31 +37,42 @@ require_once("inc/libs/security_functions.php");
 // Init "action" and "what"
 global $what, $action;
 $GLOBALS['what'] = ""; $GLOBALS['action'] = "";
-if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
-if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
 
 // Set module
 $GLOBALS['module'] = "img"; $CSS = -1;
 
 // Load the required file(s)
-require ("inc/config.php");
+require("inc/config.php");
 
-if (defined('mxchange_installed') && (mxchange_installed))
-{
-       if (!empty($_GET['code']))
-       {
+// Script installed?
+if (isBooleanConstantAndTrue('mxchange_installed')) {
+       // Load header
+       require_once(PATH."inc/header.php");
+
+       // Code set?
+       if (!empty($_GET['code'])) {
                // Generate image
                GENERATE_IMAGE(bigintval($_GET['code']));
+       } elseif (!empty($_GET['tag'])) {
+               // Tag set so create FQFN
+               $fqfn = sprintf("%sinc/img/tag-%s.php",
+                       PATH,
+                       SQL_ESCAPE($_GET['tag'])
+               );
+
+               // Include is readable?
+               if (FILE_READABLE($fqfn)) {
+                       // Include it
+                       require($fqfn);
+               } // END - if
        }
-}
- else
-{
+
+       // Finish generation here
+       require_once(PATH."inc/footer.php");
+} else {
        // You have to configure first!
        LOAD_URL("install.php");
 }
 
 // Really all done here... ;-)
-die();
-
-//
 ?>