-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 01/26/2005 *\r
- * =============== Last change: 01/26/2005 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : output_functions.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Class containing the HTML sub-system *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Klasse fuer das HTML-Subsystem *\r
- * -------------------------------------------------------------------- *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder *\r
- * For more information visit: http://www.mxchange.org *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU General Public License as published by *\r
- * the Free Software Foundation; either version 2 of the License, or *\r
- * (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU General Public License *\r
- * along with this program; if not, write to the Free Software *\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *\r
- * MA 02110-1301 USA *\r
- ************************************************************************/\r
-\r
-// Some security stuff...\r
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))\r
-{\r
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
- require($INC);\r
-}\r
-// Add HTML to the output stream\r
-class HTMLParser\r
-{\r
-\r
-// Initializer\r
-function HTMLParser()\r
-{\r
-}\r
-\r
-// Add HTML-Code to buffer\r
-function add_html ($HTML, $NEW_LINE = true)\r
-{\r
- global $OUTPUT;\r
-}\r
-// Compiles HTML code\r
-function compile_html($code, $simple=false)\r
-{\r
- global $SEC_CHARS;\r
-\r
- // Compile constants\r
- $code = str_replace("{--", '".', str_replace("--}", '."', $code));\r
-\r
- // Compile QUOT and other non-HTML codes\r
- foreach ($SEC_CHARS['to'] as $k=>$from)\r
- {\r
- // Do the reversed thing as in inc/libs/security_functions.php\r
- $code = str_replace($from, $SEC_CHARS['from'][$k], $code);\r
- }\r
-\r
- // But keep simple quotes for later use\r
- if ($simple) $code = str_replace("'", "{QUOT}", $code);\r
-\r
- // Return compiled code\r
- return $code;\r
-}\r
-// Load a template file and return it's content (only it's name; do not use ' or ")\r
-function get_template ($template, $return=false, $content="")\r
-{\r
- // Add more variables which you want to use in your template files\r
- global $DATA, $ACTION, $WHAT;\r
- $REFID = bigintval($_COOKIE['refid']);\r
-\r
- if ($template == "member_support_form")\r
- {\r
- // Support request of a member\r
- $ID = bigintval($_COOKIE['userid']);\r
- $result = SQL_QUERY_ESC("SELECT sex, surname, family FROM "._MYSQL_PREFIX."_user_data WHERE userid='%s' LIMIT 1", array($ID), __FILE__, __LINE__);\r
- list($sex, $surname, $family) = SQL_FETCHROW($result);\r
- SQL_FREERESULT($result);\r
- $salut = TRANSLATE_SEX($sex);\r
- }\r
-\r
- // Base directory\r
- $BASE = PATH."templates/".GET_LANGUAGE()."/html/";\r
- $MODE = "";\r
-\r
- // Check for admin/guest/member templates\r
- if (strpos($template, "admin_") > -1)\r
- {\r
- // Admin template found\r
- $MODE = "admin/";\r
- }\r
- elseif (strpos($template, "guest_") > -1)\r
- {\r
- // Guest template found\r
- $MODE = "guest/";\r
- }\r
- elseif (strpos($template, "member_") > -1)\r
- {\r
- // Member template found\r
- $MODE = "member/";\r
- }\r
- elseif (strpos($template, "install_") > -1)\r
- {\r
- // Installation template found\r
- $MODE = "install/";\r
- }\r
- elseif (strpos($template, "mailid_") > -1)\r
- {\r
- // Mail confirmation template found\r
- $MODE = "mailid/";\r
- }\r
-\r
- // Generate file name\r
- $file = $BASE.$MODE.$template.".tpl";\r
- if ((!empty($HTTP_GET_VARS['what'])) && ((strpos($template, "_header") > 0) || (strpos($template, "_footer") > 0)) && (($MODE == "guest/") || ($MODE == "member/") || ($MODE == "admin/")))\r
- {\r
- // Select what depended header/footer template file for admin/guest/member area\r
- $file2 = $BASE.$MODE.$template."_".$HTTP_GET_VARS['what'].".tpl";\r
-\r
- // Probe for it...\r
- if (file_exists($file2)) $file = $file2;\r
-\r
- // Remove variable from memory\r
- unset($file2);\r
- }\r
-\r
- // Does the special template exists?\r
- if (!file_exists($file))\r
- {\r
- // Reset to default template\r
- $file = PATH."templates/".GET_LANGUAGE()."/html/".$template.".tpl";\r
- }\r
-\r
- // Now does the final template exists?\r
- if (file_exists($file))\r
- {\r
- // The local file does exists so we load it. :)\r
- $tmpl_file = implode("", file($file));\r
- $tmpl_file = str_replace("'", "{QUOT}", $tmpl_file);\r
-\r
- // Compile and run code\r
- $ret = COMPILE_CODE(addslashes($tmpl_file), false, true);\r
- $ret = "<!-- Template ".$template." - Start -->\n".$ret."<!-- Template ".$template." - End -->\n";\r
- }\r
- elseif (IS_ADMIN())\r
- {\r
- // Only admins shall see this warning\r
- $ret = "<BR><SPAN class=\"guest_failed\">".TEMPLATE_404."</SPAN><BR>\r
-(".basename($file).")\r
-<BR><BR>";\r
- }\r
- if ($return)\r
- {\r
- // Return the HTML code\r
- return $ret;\r
- }\r
- else\r
- {\r
- // Output directly\r
- $this->add_html ($ret);\r
- }\r
-}\r
-\r
- // END OF CLASS\r
-}\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 01/26/2005 *
+ * =============== Last change: 01/26/2005 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : output_functions.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Class containing the HTML sub-system *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Klasse fuer das HTML-Subsystem *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
+{
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ require($INC);
+}
+// Add HTML to the output stream
+class HTMLParser
+{
+
+// Initializer
+function HTMLParser()
+{
+}
+
+// Add HTML-Code to buffer
+function add_html ($HTML, $NEW_LINE = true)
+{
+ global $OUTPUT;
+}
+// Compiles HTML code
+function compile_html($code, $simple=false)
+{
+ global $SEC_CHARS;
+
+ // Compile constants
+ $code = str_replace("{--", '".', str_replace("--}", '."', $code));
+
+ // Compile QUOT and other non-HTML codes
+ foreach ($SEC_CHARS['to'] as $k=>$from)
+ {
+ // Do the reversed thing as in inc/libs/security_functions.php
+ $code = str_replace($from, $SEC_CHARS['from'][$k], $code);
+ }
+
+ // But keep simple quotes for later use
+ if ($simple) $code = str_replace("'", "{QUOT}", $code);
+
+ // Return compiled code
+ return $code;
+}
+// Load a template file and return it's content (only it's name; do not use ' or ")
+function get_template ($template, $return=false, $content="")
+{
+ // Add more variables which you want to use in your template files
+ global $DATA, $ACTION, $WHAT;
+ $REFID = bigintval($_COOKIE['refid']);
+
+ if ($template == "member_support_form")
+ {
+ // Support request of a member
+ $ID = bigintval($_COOKIE['userid']);
+ $result = SQL_QUERY_ESC("SELECT sex, surname, family FROM "._MYSQL_PREFIX."_user_data WHERE userid='%s' LIMIT 1", array($ID), __FILE__, __LINE__);
+ list($sex, $surname, $family) = SQL_FETCHROW($result);
+ SQL_FREERESULT($result);
+ $salut = TRANSLATE_SEX($sex);
+ }
+
+ // Base directory
+ $BASE = PATH."templates/".GET_LANGUAGE()."/html/";
+ $MODE = "";
+
+ // Check for admin/guest/member templates
+ if (strpos($template, "admin_") > -1)
+ {
+ // Admin template found
+ $MODE = "admin/";
+ }
+ elseif (strpos($template, "guest_") > -1)
+ {
+ // Guest template found
+ $MODE = "guest/";
+ }
+ elseif (strpos($template, "member_") > -1)
+ {
+ // Member template found
+ $MODE = "member/";
+ }
+ elseif (strpos($template, "install_") > -1)
+ {
+ // Installation template found
+ $MODE = "install/";
+ }
+ elseif (strpos($template, "mailid_") > -1)
+ {
+ // Mail confirmation template found
+ $MODE = "mailid/";
+ }
+
+ // Generate file name
+ $file = $BASE.$MODE.$template.".tpl";
+ if ((!empty($HTTP_GET_VARS['what'])) && ((strpos($template, "_header") > 0) || (strpos($template, "_footer") > 0)) && (($MODE == "guest/") || ($MODE == "member/") || ($MODE == "admin/")))
+ {
+ // Select what depended header/footer template file for admin/guest/member area
+ $file2 = $BASE.$MODE.$template."_".$HTTP_GET_VARS['what'].".tpl";
+
+ // Probe for it...
+ if (file_exists($file2)) $file = $file2;
+
+ // Remove variable from memory
+ unset($file2);
+ }
+
+ // Does the special template exists?
+ if (!file_exists($file))
+ {
+ // Reset to default template
+ $file = PATH."templates/".GET_LANGUAGE()."/html/".$template.".tpl";
+ }
+
+ // Now does the final template exists?
+ if (file_exists($file))
+ {
+ // The local file does exists so we load it. :)
+ $tmpl_file = implode("", file($file));
+ $tmpl_file = str_replace("'", "{QUOT}", $tmpl_file);
+
+ // Compile and run code
+ $ret = COMPILE_CODE(addslashes($tmpl_file), false, true);
+ $ret = "<!-- Template ".$template." - Start -->\n".$ret."<!-- Template ".$template." - End -->\n";
+ }
+ elseif (IS_ADMIN())
+ {
+ // Only admins shall see this warning
+ $ret = "<BR><SPAN class=\"guest_failed\">".TEMPLATE_404."</SPAN><BR>
+(".basename($file).")
+<BR><BR>";
+ }
+ if ($return)
+ {
+ // Return the HTML code
+ return $ret;
+ }
+ else
+ {
+ // Output directly
+ $this->add_html ($ret);
+ }
+}
+
+ // END OF CLASS
+}
+//
+?>