X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=0048109565812153f65ca8df08c1c64097237ab6;hb=dcab53bf379a6e7a0224b255dfab06512cb694dd;hp=c55b421dd3eb12a381c5c75e3caaea541276aa23;hpb=a975001c8e332a6af3513ea57e9acebeaadf1640;p=mailer.git diff --git a/inc/functions.php b/inc/functions.php index c55b421dd3..0048109565 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -44,7 +44,8 @@ if (!defined('__SECURITY')) { // Output HTML code directly or 'render' it. You addionally switch the new-line character off function outputHtml ($htmlCode, $newLine = true) { // Transfer username - $username = getUsername(); + $username = getMessage('USERNAME_UNKNOWN'); + if (isset($GLOBALS['username'])) $username = getUsername(); // Do we have HTML-Code here? if (!empty($htmlCode)) { @@ -135,7 +136,7 @@ function outputHtml ($htmlCode, $newLine = true) { // Was that eval okay? if (empty($newContent)) { // Something went wrong! - debug_report_bug('Evaluation error:
' . htmlentities($eval) . '
'); + debug_report_bug('Evaluation error:
' . linenumberCode($eval) . '
'); } // END - if $GLOBALS['output'] = $newContent; @@ -559,8 +560,12 @@ function loadEmailTemplate ($template, $content = array(), $UID = '0') { unset($content); unset($DATA); - // Return compiled content - return compileCode($newContent); + // Compile the code and eval it + $eval = '$newContent = "' . compileCode(smartAddSlashes($newContent)) . '";'; + eval($eval); + + // Return content + return $newContent; } // Send mail out to an email address @@ -930,18 +935,25 @@ function countSelection ($array) { // Generate XHTML code for the CAPTCHA function generateCaptchaCode ($code, $type, $DATA, $userid) { - return 'Code'; + return 'Code ' . $code . ''; } // Generates a timestamp (some wrapper for mktime()) -function makeTime ($H, $M, $S, $stamp) { +function makeTime ($hours, $minutes, $seconds, $stamp) { // Extract day, month and year from given timestamp - $day = date('d', $stamp); - $month = date('m', $stamp); - $year = date('Y', $stamp); + $days = date('d', $stamp); + $months = date('m', $stamp); + $years = date('Y', $stamp); // Create timestamp for wished time which depends on extracted date - return mktime($H, $M, $S, $month, $day, $year); + return mktime( + $hours, + $minutes, + $seconds, + $months, + $days, + $years + ); } // Redirects to an URL and if neccessarry extends it with own base URL @@ -3594,6 +3606,28 @@ function handleFatalErrors () { shutdown(); } +// Print code with line numbers +function linenumberCode ($code) { + if (!is_array($code)) $codeE = explode("\n", $code); else $codeE = $code; + $count_lines = count($codeE); + + $r = "Line | Code:
"; + foreach($codeE as $line => $c) { + $r .= "
"; + if ($count_lines == 1) { + $r .= '1'; + } else { + $r .= ($line == ($count_lines - 1)) ? '' : ($line+1); + } + $r .= "|"; + + // Add code + $r .= "" . htmlentities($c) . "
"; + } + + return "
" . $r . "
\n"; +} + ////////////////////////////////////////////////// // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // //////////////////////////////////////////////////