From 515085a2a2d4b06989566a60b8add3fa4864f1e3 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 21 Dec 2006 10:37:50 +0000 Subject: - some fixes - important bugfix for the mcp and determining allowed ids in general (if global announcements are included) git-svn-id: file:///svn/phpbb/trunk@6787 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_module.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_module.php') diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 753e043c16..22312b8d76 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -166,7 +166,7 @@ class p_master $depth = sizeof($this->module_cache['parents'][$row['module_id']]); // We need to prefix the functions to not create a naming conflict - + // Function for building 'url_extra' $url_func = '_module_' . $row['module_basename'] . '_url'; @@ -191,7 +191,7 @@ class p_master 'mode' => (string) $row['module_mode'], 'display' => (int) $row['module_display'], - 'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode']) : '', + 'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode'], $row) : '', 'lang' => ($row['module_basename'] && function_exists($lang_func)) ? $lang_func($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : $row['module_langname']), 'langname' => $row['module_langname'], @@ -578,7 +578,9 @@ class p_master } $u_title = $module_url . $delim . 'i=' . (($item_ary['cat']) ? $item_ary['id'] : $item_ary['name'] . (($item_ary['is_duplicate']) ? '&icat=' . $current_id : '') . '&mode=' . $item_ary['mode']); - $u_title .= (!$item_ary['cat'] && isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : ''; + + // Was not allowed in categories before - /*!$item_ary['cat'] && */ + $u_title .= (isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : ''; // Only output a categories items if it's currently selected if (!$depth || ($depth && (in_array($item_ary['parent'], array_values($this->module_cache['parents'])) || $item_ary['parent'] == $this->p_parent))) -- cgit v1.2.1 From ae1cb0316e6c19d62f0579e9cef52f11df081bcf Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 24 Dec 2006 13:11:54 +0000 Subject: some fixes today - most important change is the consolidation of the display attachment functions; merging them together to have one function we need to call. git-svn-id: file:///svn/phpbb/trunk@6803 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_module.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_module.php') diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 22312b8d76..ca47ef2f89 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -69,6 +69,11 @@ class p_master $cache->put('_modules_' . $this->p_class, $this->module_cache); } + if (empty($this->module_cache)) + { + $this->module_cache = array('modules' => array(), 'parents' => array()); + } + // We "could" build a true tree with this function - maybe mod authors want to use this... // Functions for traversing and manipulating the tree are not available though // We might re-structure the module system to use true trees in 3.2.x... @@ -370,7 +375,7 @@ class p_master if (defined('IN_ADMIN')) { // Not being able to overwrite ;) - $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_id}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } else { @@ -384,7 +389,7 @@ class p_master $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; } - $this->module->u_action = append_sid($this->module->u_action, "i={$this->p_id}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } // Assign the module path for re-usage @@ -394,7 +399,7 @@ class p_master // Users are able to call the main method after this function to be able to assign additional parameters manually if ($execute_module) { - $this->module->main(($this->p_name) ? $this->p_name : $this->p_id, $this->p_mode); + $this->module->main($this->p_name, $this->p_mode); } return; -- cgit v1.2.1 From 60d817416bd2367e3a234837f559f6e0ffb150c0 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 22 Jan 2007 17:05:23 +0000 Subject: 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 --- phpBB/includes/functions_module.php | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'phpBB/includes/functions_module.php') 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(); @@ -216,6 +217,50 @@ class p_master unset($this->module_cache['modules'], $names); } + /** + * 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 */ @@ -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) ? '&icat=' . $icat : '') . "&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) ? '&icat=' . $icat : '') . "&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 . '/'; -- cgit v1.2.1 From 9e5c25504e275d8de071f2efafa349ebee21063c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 24 Jan 2007 11:29:56 +0000 Subject: - added confirm box to ucp zebra (adding fried/foe) - permission fixes for conversions - use more appropiate error message within convertor if source tables could not be found - other tiny fixes git-svn-id: file:///svn/phpbb/trunk@6925 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_module.php') diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 1ad543c298..d45358327f 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -445,7 +445,7 @@ class p_master } // Add url_extra parameter to u_action url - if ($this->module_ary[$this->active_module_row_id]['url_extra']) + if (!empty($this->module_ary) && $this->active_module !== false && $this->module_ary[$this->active_module_row_id]['url_extra']) { $this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra']; } -- cgit v1.2.1