function isUserDataValid () {
// User id should not be zero so abort here
if (!isCurrentUserIdSet()) {
+ // Debug message
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isCurrentUserIdSet()=false - ABORTING!');
+
+ // Abort here
return false;
} // END - if
// Setter for current userid
function setCurrentUserId ($userid) {
- // Set userid
- $GLOBALS['current_userid'] = bigintval($userid);
-
- // Unset it to re-determine the actual state
- unset($GLOBALS['is_userdata_valid'][$userid]);
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid . ' - ENTERED!');
// Is the cache from below functions different?
- if ((isset($GLOBALS['getCurrentUserId'])) && ($GLOBALS['getCurrentUserId'] != $userid)) {
+ if (((isset($GLOBALS['getCurrentUserId'])) && ($GLOBALS['getCurrentUserId'] != $userid)) || ((!isset($GLOBALS['current_userid'])) && (isset($GLOBALS['isCurrentUserIdSet'])))) {
// Then unset both
unset($GLOBALS['getCurrentUserId']);
unset($GLOBALS['isCurrentUserIdSet']);
+ unset($GLOBALS['isValidUserId'][$userid]);
} // END - if
+
+ // Set userid
+ $GLOBALS['current_userid'] = bigintval($userid);
+
+ // Unset it to re-determine the actual state
+ unset($GLOBALS['is_userdata_valid'][$userid]);
+
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid . ' - EXIT!');
}
// Getter for current userid
// Debug message
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid[' . gettype($userid) . ']=' . $userid);
- // Handle NULL
- if (is_null($userid)) {
- // Do not handle this as of below isset() will always return false
- return false;
- } // END - if
-
// Do we have cache?
if (!isset($GLOBALS[__FUNCTION__][$userid])) {
// Check it out
} // END - if
// Return cache
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',result=' . intval($GLOBALS[__FUNCTION__][$userid]));
return $GLOBALS[__FUNCTION__][$userid];
}
return $GLOBALS[__FUNCTION__];
}
+// "Getter" for mt_word2
+function getMtWord3 () {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Determine it
+ $GLOBALS[__FUNCTION__] = getConfig('mt_word3');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// "Getter" for main_title
function getMainTitle () {
// Do we have cache?
return floatval($floatString);
}
+/**
+ * Searches a multi-dimensional array (as used in many places) for given
+ * key/value pair as taken from user comments from PHP documentation website.
+ *
+ * @param $array An array with one or more dimensions
+ * @param $key Key to look for
+ * @param $valur Value to look for
+ * @return $results Resulted array or empty array if $array is no array
+ * @author sunelbe<at>gmail<dot>com
+ * @link http://de.php.net/manual/en/function.array-search.php#110120
+ */
+function search_array ($array, $key, $value) {
+ // Init array result
+ $results = array();
+
+ // Is $array really an array?
+ if (is_array($array)) {
+ // Does key and value match?
+ if (isset($array[$key]) && $array[$key] == $value) {
+ // Then add it as result
+ $results[] = $array;
+ } // END - if
+
+ // Search for whole array
+ foreach ($array as $subArray) {
+ // Search recursive and merge again
+ $results = merge_array($results, search_array($subArray, $key, $value));
+ } // END - foreach
+ } // END - if
+
+ // Return resulting array
+ return $results;
+}
+
// Generates a YES/NO option list from given default
function generateYesNoOptions ($defaultValue = '') {
// Generate it