}
}
-// Open a table (you may want to add some header stuff here)
-// @DEPRECATED
-function OPEN_TABLE ($PERCENT = "", $CLASS = "", $ALIGN="left", $VALIGN="", $td_only=false) {
- global $table_cnt;
-
- // Count tables so we can generate CSS classes for every table... :-)
- if (empty($CLASS)) {
- // Class is empty so count one up and create a class
- $table_cnt++; $CLASS = "class".$table_cnt;
- }
- $OUT = "<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\"";
-
- // Shall I add the classes to TABLE and TD or only to TD?
- if (!$td_only) $OUT .= " class=\"".$CLASS."\"";
-
- // Width is given
- if (!empty($PERCENT)) $OUT .= " width=\"".$PERCENT."\"";
-
- // Horizonal align
- if (!empty($ALIGN)) $OUT .=" align=\"".$ALIGN."\"";
-
- // Vertical align is given
- if (!empty($VALIGN)) $OUT .= " valign=\"".$VALIGN."\"";
- $OUT .= ">\n<TR>\n<TD";
- if (!empty($ALIGN)) $OUT .=" align=\"".$ALIGN."\"";
- $OUT .= " class=\"".$CLASS."\">";
- OUTPUT_HTML($OUT);
-}
-
-// Close a table (you may want to add some footer stuff here)
-// @DEPRECATED
-function CLOSE_TABLE( $ADD="") {
- OUTPUT_HTML(" </TD>\n</TR>");
- if (!empty($ADD)) OUTPUT_HTML($ADD);
- OUTPUT_HTML("</TABLE>");
-}
-
// Output HTML code directly or "render" it. You addionally switch the new-line character off
function OUTPUT_HTML ($HTML, $NEW_LINE = true) {
// Some global variables
default:
// Huh, something goes wrong or maybe you have edited config.php ???
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", OUTPUT_MODE));
- MXCHANGE_DIE("<strong>".FATAL_ERROR.":</strong> ".LANG_NO_RENDER_DIRECT);
+ mxchange_die("<strong>{!FATAL_ERROR!}:</strong> {!LANG_NO_RENDER_DIRECT!}");
break;
}
} elseif ((_OB_CACHING == "on") && ($footer == 1)) {
// Log this error
DEBUG_LOG(__FUNCTION__, __LINE__, "Headers already sent! We need debug backtrace here.");
- // Output debug trace
- print("<stron>Headers are already sent!</strong><br />\n");
- print("Please report this error at <a href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">bugs.mxchange.org</a>:<pre>");
- debug_print_backtrace();
- die("</pre>Thank you for your help finding bugs.");
+ // Trigger an user error
+ trigger_error("Headers are already sent!");
} // END - if
// Output cached HTML code
$OUTPUT = ob_get_contents();
// Clear output buffer for later output
- ob_end_clean();
+ clearOutputBuffer();
// Send HTTP header
header("HTTP/1.1 200");
header("Connection: Close");
// Extension "rewrite" installed?
- if ((EXT_IS_ACTIVE("rewrite")) && (function_exists('REWRITE_LINKS')) && ($CSS != "1") && ($CSS != "-1")) {
+ if ((EXT_IS_ACTIVE("rewrite")) && ($CSS != "1") && ($CSS != "-1")) {
$OUTPUT = REWRITE_LINKS($OUTPUT);
} // END - if
OUTPUT_RAW($OUTPUT);
} elseif ((OUTPUT_MODE == "render") && (!empty($OUTPUT))) {
// Rewrite links when rewrite extension is active
- if ((EXT_IS_ACTIVE("rewrite")) && (function_exists('REWRITE_LINKS')) && ($CSS != "1") && ($CSS != "-1")) {
+ if ((EXT_IS_ACTIVE("rewrite")) && ($CSS != "1") && ($CSS != "-1")) {
$OUTPUT = REWRITE_LINKS($OUTPUT);
} // END - if
}
// Getter for total fatal message count
-function getTotalFatalMessages () {
+function getTotalFatalErrors () {
global $FATAL;
// Init coun
if (getConfig('auto_purge') == 0) {
// Will never expire!
$EXPIRATION = MAIL_WILL_NEVER_EXPIRE;
- } elseif (function_exists('CREATE_FANCY_TIME')) {
+ } else {
// Create nice date string
$EXPIRATION = CREATE_FANCY_TIME(getConfig('auto_purge'));
- } else {
- // Display days only
- $EXPIRATION = round(getConfig('auto_purge')/60/60/24)." "._DAYS;
}
// Is content an array?
if (empty($newContent)) {
// Compiling failed
$newContent = "Compiler error for template {$template}!\nUncompiled content:\n".$tmpl_file;
+ // Add last error if the required function exists
if (function_exists('error_get_last')) $newContent .= "\n--------------------------------------\nDebug:\n".print_r(error_get_last(), true)."--------------------------------------\nPlease don't alter these informations!\nThanx.";
} // END - if
// Clear it only if there is content
if (!empty($OUTPUT)) {
- ob_end_clean();
+ clearOutputBuffer();
} // END - if
// Add some data to URL if cookies are not accepted
debug_print_backtrace();
die("</pre>URL={$URL}");
*/
- @header ("Location: ".str_replace("&", "&", $URL));
+ header ("Location: ".str_replace("&", "&", $URL));
} else {
// Output error message
- include(PATH."inc/header.php");
+ require(PATH."inc/header.php");
LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL));
- include(PATH."inc/footer.php");
+ require(PATH."inc/footer.php");
}
exit();
}
+
+// Wrapper for LOAD_URL but URL comes from a configuration entry
+function LOAD_CONFIGURED_URL ($configEntry) {
+ // Get the URL
+ $URL = getConfig($configEntry);
+
+ // Is this URL set?
+ if (is_null($URL)) {
+ // Then abort here
+ trigger_error(sprintf("Configuration entry %s is not set!", $configEntry));
+ } // END - if
+
+ // Load the URL
+ LOAD_URL($URL);
+}
+
//
function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) {
global $SEC_CHARS, $URL_CHARS;
// Output error messages in a fasioned way and die...
function mxchange_die ($msg) {
- global $footer;
+ // Load header
+ require_once(PATH."inc/header.php");
// Load the message template
LOAD_TEMPLATE("admin_settings_saved", false, $msg);
// Load footer
- include(PATH."inc/footer.php");
+ require(PATH."inc/footer.php");
// Exit explicitly
exit;
return $value;
}
-// @TODO Rewrite all language constants to the function getLanguage().
+// @TODO Rewrite all language constants to this function.
// "Getter" for language strings
function getMessage ($messageId) {
// Default is not found!
return $ERROR;
}
+// Clears the output buffer. This function does *NOT* backup sent content.
+function clearOutputBuffer () {
+ // Trigger an error on failure
+ if (!ob_end_clean()) {
+ // Failed!
+ trigger_error(__FUNCTION__.": Failed to clean output buffer.");
+ } // END - if
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////