A lot code refactured to newly introduces wrapper function isNicknameUsed()
[mailer.git] / inc / wrapper-functions.php
index 7068fdc8bb5baee5a5d0b658101fd58d621ccfe5..bbe9c0c87932b3b860a92bd60da0199b6946970c 100644 (file)
@@ -423,5 +423,26 @@ function isConfigLocalLoaded () {
        return ((isset($GLOBALS['config_local_loaded'])) && ($GLOBALS['config_local_loaded'] === true));
 }
 
+// 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 = ((EXT_IS_ACTIVE('nickname')) && ((''.round($userid).'') != $userid));
+
+               // And write it to the cache
+               $GLOBALS['cache_probe_nicknames'][$userid] = $isUsed;
+       }
+
+       // Return the result
+       return $isUsed;
+}
+
 // [EOF]
 ?>