aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_module.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-01-22 17:05:23 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-01-22 17:05:23 +0000
commit60d817416bd2367e3a234837f559f6e0ffb150c0 (patch)
treea6a650b941f5411a0dad4f878298303771a1387f /phpBB/includes/functions_module.php
parent41d0347eb40594d3d90e30c4fcaf05ee5ad3228a (diff)
downloadforums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar.gz
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar.bz2
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar.xz
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.zip
fixing mcp bugs by introducing a new feature to check for loaded/accessible modules/modes. If the MCP module "logs" get disabled the quick mod tools on viewtopic still show a link to the logs, this will then lead to an error message. This is not fixable. The logs should be accessible to all moderators by default.
git-svn-id: file:///svn/phpbb/trunk@6920 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_module.php')
-rw-r--r--phpBB/includes/functions_module.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index ca47ef2f89..1ad543c298 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -21,6 +21,7 @@ class p_master
var $p_parent;
var $active_module = false;
+ var $active_module_row_id = false;
var $acl_forum_id = false;
var $module_ary = array();
@@ -217,6 +218,50 @@ class p_master
}
/**
+ * Check if a certain main module is accessible/loaded
+ * By giving the module mode you are able to additionally check for only one mode within the main module
+ *
+ * @param string $module_basename The module base name, for example logs, reports, main (for the mcp).
+ * @param mixed $module_mode The module mode to check. If provided the mode will be checked in addition for presence.
+ *
+ * @return bool Returns true if module is loaded and accessible, else returns false
+ */
+ function loaded($module_basename, $module_mode = false)
+ {
+ if (empty($this->loaded_cache))
+ {
+ $this->loaded_cache = array();
+
+ foreach ($this->module_ary as $row)
+ {
+ if (!$row['name'])
+ {
+ continue;
+ }
+
+ if (!isset($this->loaded_cache[$row['name']]))
+ {
+ $this->loaded_cache[$row['name']] = array();
+ }
+
+ if (!$row['mode'])
+ {
+ continue;
+ }
+
+ $this->loaded_cache[$row['name']][$row['mode']] = true;
+ }
+ }
+
+ if ($module_mode === false)
+ {
+ return (isset($this->loaded_cache[$module_basename])) ? true : false;
+ }
+
+ return (!empty($this->loaded_cache[$module_basename][$module_mode])) ? true : false;
+ }
+
+ /**
* Check module authorisation
*/
function module_auth($module_auth, $forum_id = false)
@@ -319,6 +364,7 @@ class p_master
$this->module_cache['parents'] = $this->module_cache['parents'][$this->p_id];
$this->active_module = $item_ary['id'];
+ $this->active_module_row_id = $row_id;
break;
}
@@ -374,6 +420,12 @@ class p_master
// We pre-define the action parameter we are using all over the place
if (defined('IN_ADMIN'))
{
+ // Is first module automatically enabled a duplicate and the category not passed yet?
+ if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate'])
+ {
+ $icat = $this->module_ary[$this->active_module_row_id]['parent'];
+ }
+
// Not being able to overwrite ;)
$this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
@@ -392,6 +444,12 @@ class p_master
$this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
+ // Add url_extra parameter to u_action url
+ if ($this->module_ary[$this->active_module_row_id]['url_extra'])
+ {
+ $this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra'];
+ }
+
// Assign the module path for re-usage
$this->module->module_path = $module_path . '/';