diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 31 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 21 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 1 |
3 files changed, 52 insertions, 1 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) { diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 78c46bafd0..9eac5d44ce 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -70,6 +70,27 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = return $forum_list; } +// Generate size select form +function size_select($select_name, $size_compare) +{ + global $user; + + $size_types_text = array($user->lang['BYTES'], $user->lang['KB'], $user->lang['MB']); + $size_types = array('b', 'kb', 'mb'); + + $select_field = '<select name="' . $select_name . '">'; + + for ($i = 0; $i < count($size_types_text); $i++) + { + $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : ''; + $select_field .= '<option value="' . $size_types[$i] . '"' . $selected . '>' . $size_types_text[$i] . '</option>'; + } + + $select_field .= '</select>'; + + return ($select_field); +} + // Obtain authed forums list function get_forum_list($acl_list = 'f_list', $id_only = TRUE, $postable_only = FALSE, $no_cache = FALSE) { diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 677bdc08bd..6468a15508 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -523,7 +523,6 @@ function create_thumbnail($source, $new_file, $mimetype) return TRUE; } - // // TODO // |