X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=64e185bdec56a990499f7ae4018c482ea523da91;hp=0b6877db346ddc888eb2fea24de29c0ed063a09d;hb=116f17077ae6fa32c7373ccd6aaf94044bb6c276;hpb=2f0357c7ac9da6c17d361b8e7cb0b1ad09eb85f6
diff --git a/inc/functions.php b/inc/functions.php
index 0b6877db34..64e185bdec 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
require($INC);
}
-// Output HTML code directly or "render" it. You addionally switch the new-line character off
+// Output HTML code directly or 'render' it. You addionally switch the new-line character off
function OUTPUT_HTML ($HTML, $newLine = true) {
// Some global variables
global $OUTPUT;
@@ -49,13 +49,13 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
// Do we have HTML-Code here?
if (!empty($HTML)) {
// Yes, so we handle it as you have configured
- switch (constant('OUTPUT_MODE'))
+ switch (getConfig('OUTPUT_MODE'))
{
- case "render":
+ case 'render':
// That's why you don't need any \n at the end of your HTML code... :-)
- if (constant('_OB_CACHING') == "on") {
+ if (constant('_OB_CACHING') == 'on') {
// Output into PHP's internal buffer
- OUTPUT_RAW($HTML);
+ outputRawCode($HTML);
// That's why you don't need any \n at the end of your HTML code... :-)
if ($newLine) echo "\n";
@@ -68,22 +68,22 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
}
break;
- case "direct":
+ case 'direct':
// If we are switching from render to direct output rendered code
- if ((!empty($OUTPUT)) && (constant('_OB_CACHING') != "on")) { OUTPUT_RAW($OUTPUT); $OUTPUT = ''; }
+ if ((!empty($OUTPUT)) && (constant('_OB_CACHING') != 'on')) { outputRawCode($OUTPUT); $OUTPUT = ''; }
// The same as above... ^
- OUTPUT_RAW($HTML);
+ outputRawCode($HTML);
if ($newLine) echo "\n";
break;
default:
// Huh, something goes wrong or maybe you have edited config.php ???
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", constant('OUTPUT_MODE')));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", getConfig('OUTPUT_MODE')));
app_die(__FUNCTION__, __LINE__, "{--FATAL_ERROR--}: {--LANG_NO_RENDER_DIRECT--}");
break;
}
- } elseif ((constant('_OB_CACHING') == "on") && (isset($GLOBALS['footer_sent'])) && ($GLOBALS['footer_sent'] == 1)) {
+ } elseif ((constant('_OB_CACHING') == 'on') && (isset($GLOBALS['footer_sent'])) && ($GLOBALS['footer_sent'] == 1)) {
// Headers already sent?
if (headers_sent()) {
// Log this error
@@ -102,21 +102,21 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
} // END - if
// Send HTTP header
- header("HTTP/1.1 200");
+ sendHeader('HTTP/1.1 200');
// Used later
$now = gmdate('D, d M Y H:i:s') . ' GMT';
// General headers for no caching
- header("Expired: " . $now); // RFC2616 - Section 14.21
- header("Last-Modified: " . $now);
- header("Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"); // HTTP/1.1
- header("Pragma: no-cache"); // HTTP/1.0
- header("Connection: Close");
+ sendHeader('Expired: ' . $now); // RFC2616 - Section 14.21
+ sendHeader('Last-Modified: ' . $now);
+ sendHeader('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
+ sendHeader('Pragma: no-cache'); // HTTP/1.0
+ sendHeader('Connection: Close');
// Extension 'rewrite' installed?
- if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
- $OUTPUT = REWRITE_LINKS($OUTPUT);
+ if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) {
+ $OUTPUT = rewriteLinksInCode($OUTPUT);
} // END - if
// Compile and run finished rendered HTML code
@@ -135,11 +135,11 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
} // END - while
// Output code here, DO NOT REMOVE! ;-)
- OUTPUT_RAW($OUTPUT);
- } elseif ((constant('OUTPUT_MODE') == "render") && (!empty($OUTPUT))) {
+ outputRawCode($OUTPUT);
+ } elseif ((getConfig('OUTPUT_MODE') == 'render') && (!empty($OUTPUT))) {
// Rewrite links when rewrite extension is active
- if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
- $OUTPUT = REWRITE_LINKS($OUTPUT);
+ if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) {
+ $OUTPUT = rewriteLinksInCode($OUTPUT);
} // END - if
// Compile and run finished rendered HTML code
@@ -149,17 +149,17 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
} // END - while
// Output code here, DO NOT REMOVE! ;-)
- OUTPUT_RAW($OUTPUT);
+ outputRawCode($OUTPUT);
}
}
// Output the raw HTML code
-function OUTPUT_RAW ($HTML) {
+function outputRawCode ($HTML) {
// Output stripped HTML code to avoid broken JavaScript code, etc.
echo stripslashes(stripslashes($HTML));
- // Flush the output if only constant('_OB_CACHING') is not "on"
- if (constant('_OB_CACHING') != "on") {
+ // Flush the output if only constant('_OB_CACHING') is not 'on'
+ if (constant('_OB_CACHING') != 'on') {
// Flush it
flush();
} // END - if
@@ -177,7 +177,6 @@ function getFatalArray () {
// Add a fatal error message to the queue array
function addFatalMessage ($F, $L, $message, $extra='') {
- debug_report_bug($message);
if (is_array($extra)) {
// Multiple extras for a message with masks
$message = call_user_func_array('sprintf', $extra);
@@ -223,9 +222,9 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
incrementConfigEntry('num_templates');
// Prepare IP number and User Agent
- $REMOTE_ADDR = GET_REMOTE_ADDR();
+ $REMOTE_ADDR = detectRemoteAddr();
if (!defined('REMOTE_ADDR')) define('REMOTE_ADDR', $REMOTE_ADDR);
- $HTTP_USER_AGENT = GET_USER_AGENT();
+ $HTTP_USER_AGENT = detectUserAgent();
// Init some data
$ret = '';
@@ -243,7 +242,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
$content = merge_array($content, SQL_FETCHARRAY($result));
// Translate gender
- $content['gender'] = TRANSLATE_GENDER($content['gender']);
+ $content['gender'] = translateGender($content['gender']);
} else {
// @DEPRECATED
// @TODO Fine all templates which are using these direct variables and rewrite them.
@@ -251,7 +250,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
list($gender, $surname, $family, $email) = SQL_FETCHROW($result);
// Translate gender
- $gender = TRANSLATE_GENDER($gender);
+ $gender = translateGender($gender);
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("DEPRECATION-WARNING: content is not array (%s).", gettype($content)));
}
@@ -260,10 +259,10 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
} // END - if
// Generate date/time string
- $date_time = MAKE_DATETIME(time(), "1");
+ $date_time = generateDateTime(time(), '1');
// Base directory
- $basePath = sprintf("%stemplates/%s/html/", constant('PATH'), GET_LANGUAGE());
+ $basePath = sprintf("%stemplates/%s/html/", constant('PATH'), getLanguage());
$mode = '';
// Check for admin/guest/member templates
@@ -290,7 +289,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
$test = substr($template, 0, strpos($template, "_"));
if (EXT_IS_ACTIVE($test)) {
// Set extra path to extension's name
- $mode = $test."/";
+ $mode = $test.'/';
}
}
@@ -309,22 +308,22 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
);
// Probe for it...
- if (FILE_READABLE($file2)) $FQFN = $file2;
+ if (isFileReadable($file2)) $FQFN = $file2;
// Remove variable from memory
unset($file2);
}
// Does the special template exists?
- if (!FILE_READABLE($FQFN)) {
+ if (!isFileReadable($FQFN)) {
// Reset to default template
$FQFN = $basePath.$template.".tpl";
} // END - if
// Now does the final template exists?
- if (FILE_READABLE($FQFN)) {
+ if (isFileReadable($FQFN)) {
// The local file does exists so we load it. :)
- $tmpl_file = READ_FILE($FQFN);
+ $tmpl_file = readFromFile($FQFN);
// Replace ' to our own chars to preventing them being quoted
while (strpos($tmpl_file, "'") !== false) { $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); }
@@ -344,12 +343,12 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
$ret = "\n".$ret."\n";
} elseif ((IS_ADMIN()) || ((isInstalling()) && (!isInstalled()))) {
// Only admins shall see this warning or when installation mode is active
- $ret = "
".TEMPLATE_404."
+ $ret = "
{--TEMPLATE_404--}
(".basename($FQFN).")
-".TEMPLATE_CONTENT."
+{--TEMPLATE_CONTENT--}