aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-08-21 16:49:08 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-08-21 16:49:08 +0200
commitd289bc13acc0ab0329cac25742ae22560a80c607 (patch)
treebfd6d91205e19132d49e254618ad67ce501c8a30 /phpBB/includes/functions_admin.php
parentd828ef93f29eda5fe31a6f8291dd1e5b3cdfd97c (diff)
downloadforums-d289bc13acc0ab0329cac25742ae22560a80c607.tar
forums-d289bc13acc0ab0329cac25742ae22560a80c607.tar.gz
forums-d289bc13acc0ab0329cac25742ae22560a80c607.tar.bz2
forums-d289bc13acc0ab0329cac25742ae22560a80c607.tar.xz
forums-d289bc13acc0ab0329cac25742ae22560a80c607.zip
[ticket/10714] Remove dependency injection and use global instead
This avoids loading functions_admin.php globally and was suggested by naderman PHPBB3-10714
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php26
1 files changed, 6 insertions, 20 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index e7aed85e15..2a87feed51 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2488,34 +2488,20 @@ function cache_moderators()
*/
function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $keywords = '')
{
- // This is all just an ugly hack to add "Dependency Injection" to a function
- // the only real code is the function call which maps this function to a method.
- static $static_log = null;
-
- if ($mode instanceof phpbb_log_interface)
- {
- $static_log = $mode;
- return true;
- }
- else if ($mode === false)
- {
- return false;
- }
-
- $tmp_log = $static_log;
+ global $phpbb_log;
// no log class set, create a temporary one ourselves to keep backwards compatability
- if ($tmp_log === null)
+ if ($phpbb_log === null)
{
- $tmp_log = new phpbb_log(LOG_TABLE);
+ $phpbb_log = new phpbb_log(LOG_TABLE);
}
$count_logs = ($log_count !== false);
- $log = $tmp_log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $limit_days, $sort_by, $keywords);
- $log_count = $tmp_log->get_log_count();
+ $log = $phpbb_log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $limit_days, $sort_by, $keywords);
+ $log_count = $phpbb_log->get_log_count();
- return $tmp_log->get_valid_offset();
+ return $phpbb_log->get_valid_offset();
}
/**