aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-09-22 19:18:13 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-09-22 19:18:13 +0000
commit7f65bc98adcde87ebd12dfcc3c8963c3a5ce315b (patch)
tree562486b0531a95c67081cb61fd67221f8f9daa2a /phpBB/includes/functions.php
parente3882844ec985a62ae573bbcf618c08343afc717 (diff)
downloadforums-7f65bc98adcde87ebd12dfcc3c8963c3a5ce315b.tar
forums-7f65bc98adcde87ebd12dfcc3c8963c3a5ce315b.tar.gz
forums-7f65bc98adcde87ebd12dfcc3c8963c3a5ce315b.tar.bz2
forums-7f65bc98adcde87ebd12dfcc3c8963c3a5ce315b.tar.xz
forums-7f65bc98adcde87ebd12dfcc3c8963c3a5ce315b.zip
new hook system (do not get it confused with events or plugins please)
- introducing two new hookable functions too git-svn-id: file:///svn/phpbb/trunk@8100 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php46
1 files changed, 37 insertions, 9 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 004c4d8828..60d4297ff4 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1564,7 +1564,8 @@ function on_page($num_items, $per_page, $start)
// Server functions (building urls, redirecting...)
/**
-* Append session id to url
+* Append session id to url.
+* This function supports hooks.
*
* @param string $url The url the session id needs to be appended to (can have params)
* @param mixed $params String or array of additional url parameters
@@ -1579,17 +1580,19 @@ function on_page($num_items, $per_page, $start)
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", array('t' => 1, 'f' => 2));
* </code>
*
-* Ability to use own function <code>append_sid_phpbb_hook</code> as a hook. It is called in favor of this function.
*/
function append_sid($url, $params = false, $is_amp = true, $session_id = false)
{
- global $_SID, $_EXTRA_URL;
+ global $_SID, $_EXTRA_URL, $phpbb_hook;
// Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly.
// They could mimick most of what is within this function
- if (function_exists('append_sid_phpbb_hook'))
+ if ($phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id))
{
- return append_sid_phpbb_hook($url, $params, $is_amp, $session_id);
+ if ($phpbb_hook->hook_return(__FUNCTION__))
+ {
+ return $phpbb_hook->hook_return_result(__FUNCTION__);
+ }
}
// Assign sid if session id is not specified
@@ -4333,21 +4336,46 @@ function garbage_collection()
}
/**
-* Handler for exit calls in phpBB
+* Handler for exit calls in phpBB.
+* This function supports hooks.
*
-* Ability to use own function <code>exit_handler_phpbb_hook</code> as a hook. It is called in favor of this function.
+* Note: This function is called after the template has been outputted.
*/
function exit_handler()
{
- if (function_exists('exit_handler_phpbb_hook'))
+ global $phpbb_hook;
+
+ if ($phpbb_hook->call_hook(__FUNCTION__))
{
- return exit_handler_phpbb_hook();
+ if ($phpbb_hook->hook_return(__FUNCTION__))
+ {
+ return $phpbb_hook->hook_return_result(__FUNCTION__);
+ }
}
exit;
}
/**
+* Handler for init calls in phpBB. This function is called in user::setup();
+* This function supports hooks.
+*/
+function phpbb_user_session_handler()
+{
+ global $phpbb_hook;
+
+ if ($phpbb_hook->call_hook(__FUNCTION__))
+ {
+ if ($phpbb_hook->hook_return(__FUNCTION__))
+ {
+ return $phpbb_hook->hook_return_result(__FUNCTION__);
+ }
+ }
+
+ return;
+}
+
+/**
* @package phpBB3
*/
class bitfield