From 638e7fa034b3281e356a6e36b1380571e8860115 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 26 Sep 2011 14:04:45 +0000 Subject: [PATCH] All setters for 'what', 'action' and 'module' now set their values plain (avoid double-escaping) --- inc/wrapper-functions.php | 56 ++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index e3c2979da4..f9ebb56b11 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -547,7 +547,7 @@ function getWhat () { // Is the value set? if (isWhatSet(true)) { // Then use it - $what = $GLOBALS['what']; + $what = $GLOBALS['__what']; } // END - if // Return it @@ -556,7 +556,7 @@ function getWhat () { // Setter for 'what' value function setWhat ($newWhat) { - $GLOBALS['what'] = SQL_ESCAPE($newWhat); + $GLOBALS['__what'] = $newWhat; } // Setter for 'what' from configuration @@ -571,7 +571,7 @@ function setWhatFromConfig ($configEntry) { // Checks wether what is set and optionally aborts on miss function isWhatSet ($strict = false) { // Check for it - $isset = isset($GLOBALS['what']); + $isset = (isset($GLOBALS['__what']) && (!empty($GLOBALS['__what']))); // Should we abort here? if (($strict === true) && ($isset === false)) { @@ -591,7 +591,7 @@ function getAction ($strict = true) { // Is the value set? if (isActionSet(($strict) && (isHtmlOutputMode()))) { // Then use it - $action = $GLOBALS['action']; + $action = $GLOBALS['__action']; } // END - if // Return it @@ -600,13 +600,13 @@ function getAction ($strict = true) { // Setter for 'action' value function setAction ($newAction) { - $GLOBALS['action'] = SQL_ESCAPE($newAction); + $GLOBALS['__action'] = $newAction; } // Checks wether action is set and optionally aborts on miss function isActionSet ($strict = false) { // Check for it - $isset = ((isset($GLOBALS['action'])) && (!empty($GLOBALS['action']))); + $isset = ((isset($GLOBALS['__action'])) && (!empty($GLOBALS['__action']))); // Should we abort here? if (($strict === true) && ($isset === false)) { @@ -626,7 +626,7 @@ function getModule ($strict = true) { // Is the value set? if (isModuleSet($strict)) { // Then use it - $module = $GLOBALS['module']; + $module = $GLOBALS['__module']; } // END - if // Return it @@ -636,13 +636,13 @@ function getModule ($strict = true) { // Setter for 'module' value function setModule ($newModule) { // Secure it and make all modules lower-case - $GLOBALS['module'] = SQL_ESCAPE(strtolower($newModule)); + $GLOBALS['__module'] = strtolower($newModule); } // Checks wether module is set and optionally aborts on miss function isModuleSet ($strict = false) { // Check for it - $isset = (!empty($GLOBALS['module'])); + $isset = ((isset($GLOBALS['__module'])) && (!empty($GLOBALS['__module']))); // Should we abort here? if (($strict === true) && ($isset === false)) { @@ -651,7 +651,7 @@ function isModuleSet ($strict = false) { } // END - if // Return it - return (($isset === true) && ($GLOBALS['module'] != 'unknown')) ; + return (($isset === true) && ($GLOBALS['__module'] != 'unknown')) ; } // Getter for 'output_mode' value @@ -2566,6 +2566,12 @@ function isRawOutputMode () { return (getScriptOutputMode() == -1); } +// Wrapper to check if output mode is AJAX +function isAjaxOutputMode () { + // Determine it + return (getScriptOutputMode() == -2); +} + // Wrapper to generate a user email link function generateWrappedUserEmailLink ($email) { // Just call the inner function @@ -2694,5 +2700,35 @@ function getTotalUnconfirmedMails ($userid) { return $GLOBALS[__FUNCTION__][$userid]; } +// Checks wether 'mailer_theme' was found in session +function isMailerThemeSet () { + // Check session + return isSessionVariableSet('mailer_theme'); +} + +/** + * Setter for theme in session (This setter does return the success of + * setSession() which is required e.g. for destroySponsorSession(). + */ +function setMailerTheme ($newTheme) { + // Set it in session + return setSession('mailer_theme', $newTheme); +} + +/** + * Getter for theme from session (This getter does return 'mailer_theme' from + * session data or throws an error if not possible + */ +function getMailerTheme () { + // Is 'mailer_theme' set? + if (!isMailerThemeSet()) { + // No, then abort here + debug_report_bug(__FUNCTION__, __LINE__, 'mailer_theme not set in session. Please fix your code.'); + } // END - if + + // Return the theme from session + return getSession('mailer_theme'); +} + // [EOF] ?> -- 2.39.5