From 7fb9bf8320c56b536a5cb7658f45823f013848f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 3 Nov 2010 22:24:41 +0000 Subject: [PATCH] Missing HTTP status set, some minor rewrites --- inc/extensions/ext-imprint.php | 5 ++++- inc/functions.php | 4 +++- inc/module-functions.php | 2 +- inc/modules/admin/what-extensions.php | 2 +- inc/wrapper-functions.php | 7 +++++++ mailid.php | 6 +++++- mailid_top.php | 6 +++++- modules.php | 6 +++--- 8 files changed, 29 insertions(+), 9 deletions(-) diff --git a/inc/extensions/ext-imprint.php b/inc/extensions/ext-imprint.php index 5c842bd3c8..4155fdf492 100644 --- a/inc/extensions/ext-imprint.php +++ b/inc/extensions/ext-imprint.php @@ -46,6 +46,9 @@ setThisExtensionVersion('0.0'); // Version history array (add more with , '0.1.0' and so on) setExtensionVersionHistory(array('0.0')); +// This extension is in development (non-productive) +enableExtensionProductive(false); + switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) // SQL commands to run @@ -73,7 +76,7 @@ PRIMARY KEY (`imprint_id`) // Init imprint data addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_imprint_data` (`imprint_key`) VALUES ('company'),('surname'),('family'),('street_nr1'),('street_nr2'),('zip'),('city'),('state'),('country'),('phone'),('fax'),('email'),('footer')"); - addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_imprint_data` SET `imprint_value`='{?WEBMASTER?}' WHERE `imprint_key`='email' LIMIT 1"); + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_imprint_data` SET `imprint_value`='{OPEN_CONFIG}WEBMASTER{CLOSE_CONFIG}' WHERE `imprint_key`='email' LIMIT 1"); break; case 'remove': // Do stuff when removing extension diff --git a/inc/functions.php b/inc/functions.php index 99ff9804f5..8394f5f98c 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -149,7 +149,9 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' } // END - if // Fix HTML parameter (default is no!) - if (empty($isHtml)) $isHtml = 'N'; + if (empty($isHtml)) { + $isHtml = 'N'; + } // END - if // Debug mode enabled? if (isDebugModeEnabled()) { diff --git a/inc/module-functions.php b/inc/module-functions.php index d0f00c8fa6..bf629eb462 100644 --- a/inc/module-functions.php +++ b/inc/module-functions.php @@ -322,7 +322,7 @@ VALUES rebuildCache('modules', 'modules'); } elseif ($found === false) { // Problem with module detected - logDebugMessage(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s,locked=%d,hidden=%d,mem=%d,admin=%d,output_mode=%s", + logDebugMessage(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. getModuleStatus()=%s,locked=%d,hidden=%d,mem=%d,admin=%d,output_mode=%s", $module_chk, getModuleStatus($module_chk), intval(isModuleLocked($module_chk)), diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 04d84cc623..88aefc57e2 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -188,7 +188,7 @@ if (isGetRequestParameterSet('reg_ext')) { // Listing of SQLs enabled? if (isVerboseSqlEnabled()) { // Load SQL commands in remove mode - if (loadExtension($ext_name, 'remove', '', true)) { + if (loadExtension($ext_name, 'remove', '0.0', true)) { // Generate extra table with loaded SQL commands $VERBOSE_OUT = addExtensionVerboseSqlTable(); } // END - if diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 74f30d01b0..d910f8da2d 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -945,6 +945,13 @@ function setHttpStatus ($status) { // Getter for HTTP status function getHttpStatus () { + // Is the status set? + if (!isset($GLOBALS['http_status'])) { + // Abort here + debug_report_bug(__FUNCTION__, __LINE__, 'No HTTP status set!'); + } // END - if + + // Return it return $GLOBALS['http_status']; } diff --git a/mailid.php b/mailid.php index 7f684cef9b..417ad84f3a 100644 --- a/mailid.php +++ b/mailid.php @@ -49,8 +49,9 @@ $errorCode = ''; // Load the required file(s) require('inc/config-global.php'); -// Set content type +// Set content type and HTTP status setContentType('text/html'); +setHttpStatus('404 NOT FOUND'); // Is the extension active? redirectOnUninstalledExtension('mailid'); @@ -181,6 +182,9 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr } // END - if if (($time > 0) && (($payment > 0) || ($points > 0))) { + // Set HTTP status to okay + setHttpStatus('200 OK'); + // Export data into constants for the template $content = array( 'userid' => $userId, diff --git a/mailid_top.php b/mailid_top.php index 8b812839c4..c546edf28c 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -48,8 +48,9 @@ $GLOBALS['output_mode'] = -1; // Load the required file(s) require('inc/config-global.php'); -// Set content type +// Set content type and HTTP status setContentType('text/html'); +setHttpStatus('404 NOT FOUND'); // Is the extension mailid active? redirectOnUninstalledExtension('mailid'); @@ -240,6 +241,9 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr // Right code entered? if (bigintval(postRequestParameter('gfx_check')) == $img_code) { + // Set HTTP status to okay + setHttpStatus('200 OK'); + // Add points over referal system is the default $template = 'mailid_points_done'; diff --git a/modules.php b/modules.php index 3b6905a4ec..6a0ab78b37 100644 --- a/modules.php +++ b/modules.php @@ -107,11 +107,11 @@ if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && ( case 'locked': // Set HTTP status - setHttpStatus('403'); + setHttpStatus('403 FORBIDDEN'); if (!isIncludeReadable($GLOBALS['module_inc'])) { - // Set HTTP status - setHttpStatus('404'); + // Set HTTP status again + setHttpStatus('404 NOT FOUND'); // Module does addionally not exists addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule())); -- 2.39.5