+// Checks wether a nickname or userid was entered and caches the result
+function isNicknameUsed ($userid) {
+ // Default is false
+ $isUsed = false;
+
+ // Is the cache there
+ if (isset($GLOBALS['cache_probe_nicknames'][$userid])) {
+ // Then use it
+ $isUsed = $GLOBALS['cache_probe_nicknames'][$userid];
+ } else {
+ // Determine it
+ $isUsed = ((isExtensionActive('nickname')) && (('' . round($userid) . '') != $userid));
+
+ // And write it to the cache
+ $GLOBALS['cache_probe_nicknames'][$userid] = $isUsed;
+ }
+
+ // Return the result
+ return $isUsed;
+}
+
+// Getter for 'what' value
+function getWhat () {
+ // Default is null
+ $what = null;
+
+ // Is the value set?
+ if (isWhatSet(true)) {
+ // Then use it
+ $what = $GLOBALS['what'];
+ } // END - if
+
+ // Return it
+ return $what;
+}
+
+// Setter for 'what' value
+function setWhat ($newWhat) {
+ $GLOBALS['what'] = SQL_ESCAPE($newWhat);
+}
+
+// Setter for 'what' from configuration
+function setWhatFromConfig ($configEntry) {
+ // Get 'what' from config
+ $what = getConfig($configEntry);
+
+ // Set it
+ setWhat($what);
+}
+
+// Checks wether what is set and optionally aborts on miss
+function isWhatSet ($abortOnMiss = false) {
+ // Check for it
+ $isset = (isset($GLOBALS['what']));
+
+ // Should we abort here?
+ if (($abortOnMiss === true) && ($isset === false)) {
+ // Output backtrace
+ debug_report_bug('what is empty.');
+ } // END - if
+
+ // Return it
+ return $isset;
+}
+
+// Getter for 'action' value
+function getAction () {
+ // Default is null
+ $action = null;
+
+ // Is the value set?
+ if (isActionSet(true)) {
+ // Then use it
+ $action = $GLOBALS['action'];
+ } // END - if
+
+ // Return it
+ return $action;
+}
+
+// Setter for 'action' value
+function setAction ($newAction) {
+ $GLOBALS['action'] = SQL_ESCAPE($newAction);
+}
+
+// Checks wether action is set and optionally aborts on miss
+function isActionSet ($abortOnMiss = false) {
+ // Check for it
+ $isset = (isset($GLOBALS['action']));
+
+ // Should we abort here?
+ if (($abortOnMiss === true) && ($isset === false)) {
+ // Output backtrace
+ debug_report_bug('action is empty.');
+ } // END - if
+
+ // Return it
+ return $isset;
+}
+
+// Getter for 'module' value
+function getModule () {
+ // Default is null
+ $module = null;
+
+ // Is the value set?
+ if (isModuleSet(true)) {
+ // Then use it
+ $module = $GLOBALS['module'];
+ } // END - if
+
+ // Return it
+ return $module;
+}
+
+// Setter for 'module' value
+function setModule ($newModule) {
+ // Secure it and make all modules lower-case
+ $GLOBALS['module'] = SQL_ESCAPE(strtolower($newModule));
+}
+
+// Checks wether module is set and optionally aborts on miss
+function isModuleSet ($abortOnMiss = false) {
+ // Check for it
+ $isset = (!empty($GLOBALS['module']));
+
+ // Should we abort here?
+ if (($abortOnMiss === true) && ($isset === false)) {
+ // Output backtrace
+ print '<pre>';
+ debug_print_backtrace();
+ die('</pre');
+ debug_report_bug('module is empty.');
+ } // END - if
+
+ // Return it
+ return $isset;
+}
+
+// Getter for 'output_mode' value
+function getOutputMode () {
+ // Default is null
+ $output_mode = null;
+
+ // Is the value set?
+ if (isOutputModeSet(true)) {
+ // Then use it
+ $output_mode = $GLOBALS['output_mode'];
+ } // END - if
+
+ // Return it
+ return $output_mode;
+}
+
+// Setter for 'output_mode' value
+function setOutputMode ($newOutputMode) {
+ $GLOBALS['output_mode'] = SQL_ESCAPE($newOutputMode);
+}
+
+// Checks wether output_mode is set and optionally aborts on miss
+function isOutputModeSet ($abortOnMiss = false) {
+ // Check for it
+ $isset = (isset($GLOBALS['output_mode']));
+
+ // Should we abort here?
+ if (($abortOnMiss === true) && ($isset === false)) {
+ // Output backtrace
+ debug_report_bug('output_mode is empty.');
+ } // END - if
+
+ // Return it
+ return $isset;
+}
+
+// Enables block-mode
+function enableBlockMode ($enabled = true) {
+ $GLOBALS['block_mode'] = $enabled;
+}
+
+// Checks wether block-mode is enabled
+function isBlockModeEnabled () {
+ // Abort if not set
+ if (!isset($GLOBALS['block_mode'])) {
+ // Needs to be fixed
+ debug_report_bug(__FUNCTION__ . ': block_mode is not set.');
+ } // END - if
+
+ // Return it
+ return $GLOBALS['block_mode'];
+}
+
+// Wrapper function for addPointsThroughReferalSystem()
+function addPointsDirectly ($subject, $userid, $points) {
+ // Reset level here
+ unset($GLOBALS['ref_level']);
+
+ // Call more complicated method (due to more parameters)
+ return addPointsThroughReferalSystem($subject, $userid, $points, false, 0, false, 'direct');
+}
+
+// Wrapper function to redirect from member-only modules to index
+function redirectToIndexMemberOnlyModule () {
+ // Do the redirect here
+ redirectToUrl('modules.php?module=index&code=' . getCode('MODULE_MEM_ONLY') . '&mod=' . getModule());
+}
+
+// Wrapper function for checking if extension is installed and newer or same version
+function isExtensionInstalledAndNewer ($ext_name, $version) {
+ // Return it
+ return ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version));
+}
+
+// Wrapper function for checking if extension is installed and older than given version
+function isExtensionInstalledAndOlder ($ext_name, $version) {
+ // Return it
+ return ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version)));
+}
+
+// Set username
+function setUsername ($userName) {
+ $GLOBALS['username'] = (string) $userName;
+}
+
+// Get username
+function getUsername () {
+ return $GLOBALS['username'];
+}
+
+// Wrapper function for installation phase
+function isInstallationPhase () {
+ // Do we have cache?
+ if (!isset($GLOBALS['installation_phase'])) {
+ // Determine it
+ $GLOBALS['installation_phase'] = ((!isInstalled()) || (isInstalling()));
+ } // END - if
+
+ // Return result
+ return $GLOBALS['installation_phase'];
+}
+
+// Checks wether the extension demo is actuve and the admin login is demo (password needs to be demo, too!)
+function isDemoModeActive () {
+ return ((isExtensionActive('demo')) && (getSession('admin_login') == 'demo'));
+}
+
+// Wrapper function to redirect to de-refered URL
+function redirectToDereferedUrl ($URL) {
+ // De-refer the URL
+ $URL = generateDerefererUrl($URL);
+
+ // Redirect to to
+ redirectToUrl($URL);
+}
+
+// Getter for PHP caching value
+function getPhpCaching () {
+ return $GLOBALS['php_caching'];
+}
+
+// Checks wether the admin hash is set
+function isAdminHashSet ($admin) {
+ return isset($GLOBALS['cache_array']['admin']['password'][$admin]);
+}
+
+// Setter for admin hash
+function setAdminHash ($admin, $hash) {
+ $GLOBALS['cache_array']['admin']['password'][$admin] = $hash;
+}
+