if (empty($isHtml)) $isHtml = 'N';
if (isDebugModeEnabled()) {
// In debug mode we want to display the mail instead of sending it away so we can debug this part
- outputHtml("<pre>
-".htmlentities(trim($mailHeader))."
-To : " . $toEmail."
-Subject : " . $subject."
-Message : " . $message."
-</pre>\n");
+ outputHtml('<pre>
+Headers : ' . htmlentities(trim($mailHeader)) . '
+To : ' . $toEmail . '
+Subject : ' . $subject . '
+Message : ' . $message . '
+</pre>');
} elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) {
// Send mail as HTML away
sendHtmlEmail($toEmail, $subject, $message, $mailHeader);
}
// Send a GET request
-function sendGetRequest ($script) {
+function sendGetRequest ($script, $data = array()) {
// Extract host name from script
$host = extractHostnameFromUrl($script);
+ // Add data
+ $scriptData = http_build_query($data, '', '&');
+
+ // Do we have a question-mark in the script?
+ if (strpos($script, '?') === false) {
+ // No, so first char must be question mark
+ $scriptData = '?' . $scriptData;
+ } else {
+ // Ok, add &
+ $scriptData = '&' . $scriptData;
+ }
+
+ // Add script data
+ $script .= $scriptData;
+
// Generate GET request header
$request = 'GET /' . trim($script) . ' HTTP/1.1' . getConfig('HTTP_EOL');
$request .= 'Host: ' . $host . getConfig('HTTP_EOL');
$host = extractHostnameFromUrl($script);
// Construct request
- $data = http_build_query($postData, '','&');
+ $data = http_build_query($postData, '', '&');
// Generate POST request header
$request = 'POST /' . trim($script) . ' HTTP/1.1' . getConfig('HTTP_EOL');
return $ret;
}
-// Handles fatal errors
-function handleFatalErrors () {
- // Do we have errors to handle and right output mode?
- if ((getTotalFatalErrors() == 0) || (getOutputMode() != 0)) {
- // Abort executing here
- return false;
- } // END - if
-
- // Set content type
- setContentType('text/html');
-
- // Load config here
- loadIncludeOnce('inc/load_config.php');
-
- // Set unset variable
- if (empty($check)) $check = '';
-
- // Default is none
- $content = '';
-
- // Installation phase or regular mode?
- if ((isInstallationPhase())) {
- // While we are installing ouput other header than while it is installed... :-)
- $OUT = '';
- foreach (getFatalArray() as $key => $value) {
- // Prepare content for the template
- $content = array(
- 'key' => ($key + 1),
- 'value' => $value
- );
-
- // Load row template
- $OUT .= loadTemplate('install_fatal_row', true, $content);
- }
-
- // Load main template
- $content = loadTemplate('install_fatal_table', true, $OUT);
- } elseif (isInstalled()) {
- // Display all runtime fatal errors
- $OUT = '';
- foreach (getFatalArray() as $key => $value) {
- // Prepare content for the template
- $content = array(
- 'key' => ($key + 1),
- 'value' => $value
- );
-
- // Load row template
- $OUT .= loadTemplate('runtime_fatal_row', true, $content);
- }
-
- // Load main template
- $content = loadTemplate('runtime_fatal_table', true, $OUT);
- }
-
- // Message to regular users (non-admin)
- $CORR = getMessage('FATAL_REPORT_ERRORS');
-
- // PHP warnings fixed
- if ($check == 'done') {
- if (isAdmin()) $CORR = getMessage('FATAL_CORRECT_ERRORS');
- } // END - if
-
- // Remember all in array
- $content = array(
- 'rows' => $content,
- 'corr' => $CORR
- );
-
- // Load footer
- loadIncludeOnce('inc/header.php');
-
- // Load main template
- loadTemplate('fatal_errors', false, $content);
-
- // Delete all to prevent double-display
- initFatalMessages();
-
- // Load footer
- loadIncludeOnce('inc/footer.php');
-
- // Abort here
- shutdown();
-}
-
// Print code with line numbers
function linenumberCode ($code) {
if (!is_array($code)) $codeE = explode("\n", $code); else $codeE = $code;
}
} // END - if
+if (!function_exists('http_build_query')) {
+ // Taken from documentation on www.php.net, credits to Marco K. (Germany)
+ function http_build_query($data, $prefix='', $sep='', $key='') {
+ $ret = array();
+ foreach ((array)$data as $k => $v) {
+ if (is_int($k) && $prefix != null) {
+ $k = urlencode($prefix . $k);
+ } // END - if
+
+ if ((!empty($key)) || ($key === 0)) $k = $key.'['.urlencode($k).']';
+
+ if (is_array($v) || is_object($v)) {
+ array_push($ret, http_build_query($v, '', $sep, $k));
+ } else {
+ array_push($ret, $k.'='.urlencode($v));
+ }
+ } // END - foreach
+
+ if (empty($sep)) $sep = ini_get('arg_separator.output');
+
+ return implode($sep, $ret);
+ }
+}// // END - if
+
// [EOF]
?>