X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=0.2.1%2Finc%2Flibs%2Foutput_functions.php;h=efa5bc730468b4d0a67e71cd855679ec00ebcc74;hp=df27137a6615333481967d30b780fc8462f6e8aa;hb=7bc25dd08431c94ce9edca131d56c1a36b13c28a;hpb=157ee010917df5ca07e6d31b42f67417b2516d74 diff --git a/0.2.1/inc/libs/output_functions.php b/0.2.1/inc/libs/output_functions.php index df27137a66..efa5bc7304 100644 --- a/0.2.1/inc/libs/output_functions.php +++ b/0.2.1/inc/libs/output_functions.php @@ -1,177 +1,177 @@ -$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 = "\n".$ret."\n"; - } - elseif (IS_ADMIN()) - { - // Only admins shall see this warning - $ret = "
".TEMPLATE_404."
-(".basename($file).") -

"; - } - if ($return) - { - // Return the HTML code - return $ret; - } - else - { - // Output directly - $this->add_html ($ret); - } -} - - // END OF CLASS -} -// -?> +$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 = "\n".$ret."\n"; + } + elseif (IS_ADMIN()) + { + // Only admins shall see this warning + $ret = "
".TEMPLATE_404."
+(".basename($file).") +

"; + } + if ($return) + { + // Return the HTML code + return $ret; + } + else + { + // Output directly + $this->add_html ($ret); + } +} + + // END OF CLASS +} +// +?>