aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2003-11-01 16:10:21 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2003-11-01 16:10:21 +0000
commitf79d8a3694c014d179f04f1e8560ff2a077253c4 (patch)
tree5b8ea8f8a3bd35ae12b48a6cfdcb2d143d435d12 /phpBB/includes/functions.php
parentbd508e5a273d5594ebd65230da77b5d2877b75c6 (diff)
downloadforums-f79d8a3694c014d179f04f1e8560ff2a077253c4.tar
forums-f79d8a3694c014d179f04f1e8560ff2a077253c4.tar.gz
forums-f79d8a3694c014d179f04f1e8560ff2a077253c4.tar.bz2
forums-f79d8a3694c014d179f04f1e8560ff2a077253c4.tar.xz
forums-f79d8a3694c014d179f04f1e8560ff2a077253c4.zip
finish bump topic feature...
git-svn-id: file:///svn/phpbb/trunk@4634 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index dac19939ba..70d6f014f0 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1113,6 +1113,37 @@ function login_forum_box(&$forum_data)
page_footer();
}
+// Bump Topic Check - used by posting and viewtopic (do not want another included file)
+function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster)
+{
+ global $config, $auth, $user;
+
+ // Check permission and make sure the last post was not already bumped
+ if (!$auth->acl_get('f_bump', $forum_id) || $topic_bumped)
+ {
+ return false;
+ }
+
+ // Check bump time range, is the user really allowed to bump the topic at this time?
+ preg_match('#^([0-9]+)(m|h|d)$#', $config['bump_interval'], $match);
+ $bump_time = ($match[2] == 'm') ? $match[1] * 60 : (($match[2] == 'h') ? $match[1] * 3600 : $match[1] * 86400);
+
+ // Check bump time
+ if ($last_post_time + $bump_time > time())
+ {
+ return false;
+ }
+
+ // Check bumper, only topic poster and last poster are allowed to bump
+ if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id'])
+ {
+ return false;
+ }
+
+ // A bump time of 0 will completely disable the bump feature... not intended but might be useful.
+ return $bump_time;
+}
+
// Error and message handler, call with trigger_error if reqd
function msg_handler($errno, $msg_text, $errfile, $errline)
{