-// Checks wether 'what' is valid
-// @TODO This cache can be flushed to hard drive
-function WHAT_IS_VALID ($act, $wht, $type="guest") {
- global $cacheArray;
-
- // Is admin or cache entry is there?
- if (IS_ADMIN()) {
- // Everything is valid to the admin :-)
- $ret = true;
- } elseif (isset($cacheArray['what_valid'][$type][$act][$what])) {
- // Use the cache
- $ret = $cacheArray['what_valid'][$type][$act][$what];
-
- // Count the cache hit
- incrementConfigEntry('cache_hits');
- } else {
- // By default is nothing valid
- $ret = false;
-
- // Look in database
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE action='%s' AND what='%s' AND `locked`='N' LIMIT 1", array($type, $act, $wht), __FILE__, __LINE__);
-
- // Is "what" valid?
- $ret = (SQL_NUMROWS($result) == 1);
-
- // Free the result
- SQL_FREERESULT($result);
- }
-
- // Cache the entry
- $cacheArray['what_valid'][$type][$act][$what] = $ret;
-
- // Return the result
- return $ret;
-}
-