+// Checks if the module has a menu
+function MODULE_HAS_MENU ($mod, $forceDb = false) {
+ global $cacheArray, $_CONFIG;
+
+ // All is false by default
+ $ret = false;
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):mod={$mod},cache=".GET_EXT_VERSION("cache")."<br />\n";
+ if (GET_EXT_VERSION("cache") >= "0.1.2") {
+ // Cache version is okay, so let's check the cache!
+ if (isset($cacheArray['modules']['has_menu'][$mod])) {
+ // Check module cache and count hit
+ $ret = ($cacheArray['modules']['has_menu'][$mod] == "Y");
+ if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ } elseif (isset($cacheArray['extensions']['ext_menu'][$mod])) {
+ // Check cache and count hit
+ $ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
+ if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ } elseif ((IS_ADMIN()) && ($mod == "admin")) {
+ // Admin module has always a menu!
+ $ret = true;
+ }
+ } elseif ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ((!EXT_IS_ACTIVE("cache")) || ($forceDb === true))) {
+ // Check database for entry
+ $result = SQL_QUERY_ESC("SELECT has_menu FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1",
+ array($mod), __FILE__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load "has_menu" column
+ list($has_menu) = SQL_FETCHROW($result);
+
+ // Fake cache... ;-)
+ $cacheArray['extensions']['ext_menu'][$mod] = $has_menu;
+
+ // Does it have a menu?
+ $ret = ($has_menu == "Y");
+ } // END - if
+
+ // Free memory
+ SQL_FREERESULT($result);
+ } elseif (GET_EXT_VERSION("sql_patches") == "") {
+ // No sql_patches installed, so maybe in admin area?
+ $ret = ((IS_ADMIN()) && ($mod == "admin")); // Then there is a menu!
+ }
+
+ // Return status
+ //* DEBUG: */ var_dump($ret);
+ return $ret;
+}
+
+// Determines the task id for given extension
+function DETERMINE_EXTENSION_TASK_ID ($ext_name) {
+ // Default is not found
+ $task_id = 0;
+
+ // Search for extension task's id
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE task_type='EXTENSION' AND subject='[%s:]' LIMIT 1",
+ array($ext_name), __FILE__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Task found so load task's ID and register extension...
+ list($task_id) = SQL_FETCHROW($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return it
+ return $task_id;
+}
+
+// Determines the task id for given subject
+function DETERMINE_TASK_ID_BY_SUBJECT ($subject) {
+ // Default is not found
+ $task_id = 0;
+
+ // Search for task id
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '%s%%' LIMIT 1",
+ array($subject), __FILE__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Task found so load task's ID and register extension...
+ list($task_id) = SQL_FETCHROW($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return it
+ return $task_id;
+}
+