mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
- queue trigger feature
- queued posts do not affect user_posts - show links to MCP + queued posts in ucp and acp git-svn-id: file:///svn/phpbb/trunk@8816 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
0dbe7e3b6c
commit
44416f4744
16 changed files with 140 additions and 43 deletions
|
@ -30,7 +30,7 @@
|
|||
</dl>
|
||||
<dl>
|
||||
<dt><label>{L_POSTS}:</label></dt>
|
||||
<dd><strong>{USER_POSTS}</strong></dd>
|
||||
<dd><strong>{USER_POSTS}</strong><!-- IF POSTS_IN_QUEUE and U_MCP_QUEUE --> (<a href="{U_MCP_QUEUE}">{L_POSTS_IN_QUEUE}</a>)<!-- ELSEIF POSTS_IN_QUEUE --> ({L_POSTS_IN_QUEUE})<!-- ENDIF --></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>{L_WARNINGS}:</label></dt>
|
||||
|
@ -138,7 +138,7 @@
|
|||
</p>
|
||||
|
||||
</fieldset>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<!-- ENDIF -->
|
||||
|
|
|
@ -158,6 +158,8 @@ class acp_board
|
|||
'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
|
||||
'legend2' => 'POSTING',
|
||||
'enable_queue_trigger' => array('lang' => 'ENABLE_QUEUE_TRIGGER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
'queue_trigger_posts' => array('lang' => 'QUEUE_TRIGGER_POSTS', 'validate' => 'int:0:250', 'type' => 'text:4:4', 'explain' => true),
|
||||
'bump_type' => false,
|
||||
'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
|
||||
'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||
|
@ -552,14 +554,14 @@ class acp_board
|
|||
{
|
||||
$l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
|
||||
}
|
||||
|
||||
|
||||
$content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
|
||||
|
||||
|
||||
if (empty($content))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$template->assign_block_vars('options', array(
|
||||
'KEY' => $config_key,
|
||||
'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
|
||||
|
@ -670,7 +672,7 @@ class acp_board
|
|||
|
||||
return h_radio('config[ip_check]', $radio_ary, $value, $key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Select referer validation
|
||||
*/
|
||||
|
@ -680,7 +682,7 @@ class acp_board
|
|||
|
||||
return h_radio('config[referer_validation]', $radio_ary, $value, $key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Select account activation method
|
||||
*/
|
||||
|
|
|
@ -1646,7 +1646,8 @@ class acp_forums
|
|||
$sql = 'SELECT poster_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE forum_id = ' . $forum_id . '
|
||||
AND post_postcount = 1';
|
||||
AND post_postcount = 1
|
||||
AND post_approved = 1';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$post_counts = array();
|
||||
|
@ -1766,6 +1767,7 @@ class acp_forums
|
|||
WHERE user_id = ' . $poster_id . '
|
||||
AND user_posts < ' . $substract;
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_posts = user_posts - ' . $substract . '
|
||||
WHERE user_id = ' . $poster_id . '
|
||||
|
|
|
@ -185,7 +185,7 @@ class acp_main
|
|||
|
||||
$sql = 'SELECT COUNT(p.post_id) AS num_posts, u.user_id
|
||||
FROM ' . USERS_TABLE . ' u
|
||||
LEFT JOIN ' . POSTS_TABLE . ' p ON (u.user_id = p.poster_id AND p.post_postcount = 1)
|
||||
LEFT JOIN ' . POSTS_TABLE . ' p ON (u.user_id = p.poster_id AND p.post_postcount = 1 AND p.post_approved = 1)
|
||||
GROUP BY u.user_id';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
|
|
@ -890,9 +890,19 @@ class acp_users
|
|||
}
|
||||
}
|
||||
|
||||
// Posts in Queue
|
||||
$sql = 'SELECT COUNT(post_id) as posts_in_queue
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $user_id . '
|
||||
AND post_approved = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
$user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']),
|
||||
'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']),
|
||||
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']),
|
||||
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
||||
|
||||
'S_OVERVIEW' => true,
|
||||
|
@ -904,9 +914,11 @@ class acp_users
|
|||
|
||||
'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
|
||||
'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}",
|
||||
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, $user->session_id) : '',
|
||||
|
||||
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid('ucp', "mode=switch_perm&u={$user_row['user_id']}") : '',
|
||||
|
||||
'POSTS_IN_QUEUE' => $user_row['posts_in_queue'],
|
||||
'USER' => $user_row['username'],
|
||||
'USER_REGISTERED' => $user->format_date($user_row['user_regdate']),
|
||||
'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'],
|
||||
|
|
|
@ -670,7 +670,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
|
|||
$topic_ids[] = $row['topic_id'];
|
||||
$forum_ids[] = $row['forum_id'];
|
||||
|
||||
if ($row['post_postcount'] && $post_count_sync)
|
||||
if ($row['post_postcount'] && $post_count_sync && $row['post_approved'])
|
||||
{
|
||||
$post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1;
|
||||
}
|
||||
|
@ -709,6 +709,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
|
|||
WHERE user_id = ' . $poster_id . '
|
||||
AND user_posts < ' . $substract;
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_posts = user_posts - ' . $substract . '
|
||||
WHERE user_id = ' . $poster_id . '
|
||||
|
|
|
@ -1744,6 +1744,7 @@ function sync_post_count($offset, $limit)
|
|||
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE post_postcount = 1
|
||||
AND post_approved = 1
|
||||
GROUP BY poster_id
|
||||
ORDER BY poster_id';
|
||||
$result = $db->sql_query_limit($sql, $limit, $offset);
|
||||
|
|
|
@ -1247,6 +1247,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
|
|||
$msg_list_ary[$row['template']][$pos]['jabber'] = $row['user_jabber'];
|
||||
$msg_list_ary[$row['template']][$pos]['name'] = $row['username'];
|
||||
$msg_list_ary[$row['template']][$pos]['lang'] = $row['user_lang'];
|
||||
$msg_list_ary[$row['template']][$pos]['user_id']= $row['user_id'];
|
||||
}
|
||||
unset($msg_users);
|
||||
|
||||
|
@ -1599,10 +1600,18 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
$data['post_approved'] = $topic_row['post_approved'];
|
||||
}
|
||||
|
||||
// This variable indicates if the user is able to post or put into the queue - it is used later for all code decisions regarding approval
|
||||
$post_approval = 1;
|
||||
|
||||
// Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected.
|
||||
if (($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts'] && !$auth->acl_get('m_approve', $data['forum_id'])) || !$auth->acl_get('f_noapprove', $data['forum_id']))
|
||||
{
|
||||
$post_approval = 0;
|
||||
}
|
||||
|
||||
// Start the transaction here
|
||||
$db->sql_transaction('begin');
|
||||
|
||||
|
||||
// Collect Information
|
||||
switch ($post_mode)
|
||||
{
|
||||
|
@ -1614,7 +1623,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
'icon_id' => $data['icon_id'],
|
||||
'poster_ip' => $user->ip,
|
||||
'post_time' => $current_time,
|
||||
'post_approved' => (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) ? 0 : 1,
|
||||
'post_approved' => $post_approval,
|
||||
'enable_bbcode' => $data['enable_bbcode'],
|
||||
'enable_smilies' => $data['enable_smilies'],
|
||||
'enable_magic_url' => $data['enable_urls'],
|
||||
|
@ -1680,7 +1689,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
|
||||
'poster_id' => $data['poster_id'],
|
||||
'icon_id' => $data['icon_id'],
|
||||
'post_approved' => (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) ? 0 : $data['post_approved'],
|
||||
'post_approved' => (!$post_approval) ? 0 : $data['post_approved'],
|
||||
'enable_bbcode' => $data['enable_bbcode'],
|
||||
'enable_smilies' => $data['enable_smilies'],
|
||||
'enable_magic_url' => $data['enable_urls'],
|
||||
|
@ -1714,7 +1723,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
'topic_time' => $current_time,
|
||||
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
|
||||
'icon_id' => $data['icon_id'],
|
||||
'topic_approved' => (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) ? 0 : 1,
|
||||
'topic_approved' => $post_approval,
|
||||
'topic_title' => $subject,
|
||||
'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''),
|
||||
'topic_first_poster_colour' => $user->data['user_colour'],
|
||||
|
@ -1734,24 +1743,23 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
);
|
||||
}
|
||||
|
||||
$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id'])) ? ', user_posts = user_posts + 1' : '');
|
||||
$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
|
||||
|
||||
if ($topic_type != POST_GLOBAL)
|
||||
{
|
||||
if ($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id']))
|
||||
if ($post_approval)
|
||||
{
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts + 1';
|
||||
}
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_real = forum_topics_real + 1' . (($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id'])) ? ', forum_topics = forum_topics + 1' : '');
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_real = forum_topics_real + 1' . (($post_approval) ? ', forum_topics = forum_topics + 1' : '');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'reply':
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies_real = topic_replies_real + 1, topic_bumped = 0, topic_bumper = 0' . (($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id'])) ? ', topic_replies = topic_replies + 1' : '') . ((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies_real = topic_replies_real + 1, topic_bumped = 0, topic_bumper = 0' . (($post_approval) ? ', topic_replies = topic_replies + 1' : '') . ((!empty($data['attachment_data']) || (isset($data['topic_attachment']) && $data['topic_attachment'])) ? ', topic_attachment = 1' : '');
|
||||
$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id']) && $post_approval) ? ', user_posts = user_posts + 1' : '');
|
||||
|
||||
$sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data['forum_id'])) ? ', user_posts = user_posts + 1' : '');
|
||||
|
||||
if (($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id'])) && $topic_type != POST_GLOBAL)
|
||||
if ($post_approval && $topic_type != POST_GLOBAL)
|
||||
{
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts + 1';
|
||||
}
|
||||
|
@ -1763,7 +1771,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
$sql_data[TOPICS_TABLE]['sql'] = array(
|
||||
'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $data['forum_id'],
|
||||
'icon_id' => $data['icon_id'],
|
||||
'topic_approved' => (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) ? 0 : $data['topic_approved'],
|
||||
'topic_approved' => (!$post_approval) ? 0 : $data['topic_approved'],
|
||||
'topic_title' => $subject,
|
||||
'topic_first_poster_name' => $username,
|
||||
'topic_type' => $topic_type,
|
||||
|
@ -1778,7 +1786,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
);
|
||||
|
||||
// Correctly set back the topic replies and forum posts... only if the topic was approved before and now gets disapproved
|
||||
if (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id']) && $data['topic_approved'])
|
||||
if (!$post_approval && $data['topic_approved'])
|
||||
{
|
||||
// Do we need to grab some topic informations?
|
||||
if (!sizeof($topic_row))
|
||||
|
@ -1800,6 +1808,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
|
||||
set_config('num_topics', $config['num_topics'] - 1, true);
|
||||
set_config('num_posts', $config['num_posts'] - ($topic_row['topic_replies'] + 1), true);
|
||||
|
||||
// Only decrement this post, since this is the one non-approved now
|
||||
if ($auth->acl_get('f_postcount', $data['forum_id']))
|
||||
{
|
||||
$sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1';
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1808,12 +1822,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
case 'edit_last_post':
|
||||
|
||||
// Correctly set back the topic replies and forum posts... but only if the post was approved before.
|
||||
if (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id']) && $data['post_approved'])
|
||||
if (!$post_approval && $data['post_approved'])
|
||||
{
|
||||
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1';
|
||||
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1';
|
||||
|
||||
set_config('num_posts', $config['num_posts'] - 1, true);
|
||||
|
||||
if ($auth->acl_get('f_postcount', $data['forum_id']))
|
||||
{
|
||||
$sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1';
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -2289,7 +2308,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
}
|
||||
|
||||
// Update total post count, do not consider moderated posts/topics
|
||||
if ($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id']))
|
||||
if ($post_approval)
|
||||
{
|
||||
if ($post_mode == 'post')
|
||||
{
|
||||
|
@ -2304,7 +2323,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
}
|
||||
|
||||
// Update forum stats
|
||||
$where_sql = array(POSTS_TABLE => 'post_id = ' . $data['post_id'], TOPICS_TABLE => 'topic_id = ' . $data['topic_id'], FORUMS_TABLE => 'forum_id = ' . $data['forum_id'], USERS_TABLE => 'user_id = ' . $user->data['user_id']);
|
||||
$where_sql = array(POSTS_TABLE => 'post_id = ' . $data['post_id'], TOPICS_TABLE => 'topic_id = ' . $data['topic_id'], FORUMS_TABLE => 'forum_id = ' . $data['forum_id'], USERS_TABLE => 'user_id = ' . $poster_id);
|
||||
|
||||
foreach ($sql_data as $table => $update_ary)
|
||||
{
|
||||
|
@ -2421,14 +2440,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
|||
}
|
||||
|
||||
// Send Notifications
|
||||
if ($mode != 'edit' && $mode != 'delete' && ($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id'])))
|
||||
if ($mode != 'edit' && $mode != 'delete' && $post_approval)
|
||||
{
|
||||
user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id']);
|
||||
}
|
||||
|
||||
$params = $add_anchor = '';
|
||||
|
||||
if ($auth->acl_get('f_noapprove', $data['forum_id']) || $auth->acl_get('m_approve', $data['forum_id']))
|
||||
if ($post_approval)
|
||||
{
|
||||
$params .= '&t=' . $data['topic_id'];
|
||||
|
||||
|
|
|
@ -415,8 +415,8 @@ function change_poster(&$post_info, $userdata)
|
|||
sync('forum', 'forum_id', $post_info['forum_id'], false, false);
|
||||
}
|
||||
|
||||
// Adjust post counts
|
||||
if ($post_info['post_postcount'])
|
||||
// Adjust post counts... only if the post is approved (else, it was not added the users post count anyway)
|
||||
if ($post_info['post_postcount'] && $post_info['post_approved'])
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_posts = user_posts - 1
|
||||
|
@ -470,11 +470,11 @@ function change_poster(&$post_info, $userdata)
|
|||
if (file_exists(PHPBB_ROOT_PATH . 'includes/search/' . $search_type . '.' . PHP_EXT))
|
||||
{
|
||||
require(PHPBB_ROOT_PATH . "includes/search/$search_type." . PHP_EXT);
|
||||
|
||||
|
||||
// We do some additional checks in the module to ensure it can actually be utilised
|
||||
$error = false;
|
||||
$search = new $search_type($error);
|
||||
|
||||
|
||||
if (!$error && method_exists($search, 'destroy_cache'))
|
||||
{
|
||||
$search->destroy_cache(array(), array($post_info['user_id'], $userdata['user_id']));
|
||||
|
|
|
@ -480,6 +480,7 @@ function approve_post($post_id_list, $id, $mode)
|
|||
|
||||
$total_topics = $total_posts = 0;
|
||||
$forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
|
||||
$user_posts_sql = array();
|
||||
|
||||
$update_forum_information = false;
|
||||
|
||||
|
@ -492,6 +493,9 @@ function approve_post($post_id_list, $id, $mode)
|
|||
$forum_id_list[$post_data['forum_id']] = 1;
|
||||
}
|
||||
|
||||
// User post update (we do not care about topic or post, since user posts are strictly connected to posts
|
||||
$user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1;
|
||||
|
||||
// Topic or Post. ;)
|
||||
if ($post_data['topic_first_post_id'] == $post_id)
|
||||
{
|
||||
|
@ -611,6 +615,25 @@ function approve_post($post_id_list, $id, $mode)
|
|||
}
|
||||
}
|
||||
|
||||
if (sizeof($user_posts_sql))
|
||||
{
|
||||
// Try to minimize the query count by merging users with the same post count additions
|
||||
$user_posts_update = array();
|
||||
|
||||
foreach ($user_posts_sql as $user_id => $user_posts)
|
||||
{
|
||||
$user_posts_update[$user_posts][] = $user_id;
|
||||
}
|
||||
|
||||
foreach ($user_posts_update as $user_posts => $user_id_ary)
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_posts = user_posts + ' . $user_posts . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if ($total_topics)
|
||||
{
|
||||
set_config('num_topics', $config['num_topics'] + $total_topics, true);
|
||||
|
|
|
@ -137,6 +137,11 @@ $lang = array_merge($lang, array(
|
|||
'ALLOW_POST_FLASH' => 'Allow use of <code>[FLASH]</code> BBCode tag in posts',
|
||||
'ALLOW_POST_FLASH_EXPLAIN' => 'If disallowed the <code>[FLASH]</code> BBCode tag is disabled in posts. Otherwise the permission system controls which users can use the <code>[FLASH]</code> BBCode tag.',
|
||||
|
||||
'ENABLE_QUEUE_TRIGGER' => 'Enable queued posts',
|
||||
'ENABLE_QUEUE_TRIGGER_EXPLAIN' => 'Ability to put registered users posts to post approval if their post count is lower than the specified value below. This setting has no effect on the permission setting for post/topic approval.',
|
||||
'QUEUE_TRIGGER_POSTS' => 'Maximum post count for queued posts',
|
||||
'QUEUE_TRIGGER_POSTS_EXPLAIN' => 'If queued posts is enabled, this is the post count the user need to reach in order to post without post approval. If the users post count is below this number, the post is stored in the queue automatically.',
|
||||
|
||||
'BUMP_INTERVAL' => 'Bump interval',
|
||||
'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.',
|
||||
'CHAR_LIMIT' => 'Maximum characters per post',
|
||||
|
|
|
@ -390,6 +390,13 @@ $lang = array_merge($lang, array(
|
|||
'NO_USERS' => 'The requested users do not exist.',
|
||||
'NO_USER_SPECIFIED' => 'No username was specified.',
|
||||
|
||||
// Nullar/Singular/Plural language entry. The key numbers define the number range in which a certain grammatical expression is valid.
|
||||
'NUM_POSTS_IN_QUEUE' => array(
|
||||
0 => 'No posts in queue', // 0
|
||||
1 => '1 post in queue', // 1
|
||||
2 => '%d posts in queue', // 2+
|
||||
),
|
||||
|
||||
'OCCUPATION' => 'Occupation',
|
||||
'OFFLINE' => 'Offline',
|
||||
'ONLINE' => 'Online',
|
||||
|
|
|
@ -129,7 +129,7 @@ switch ($mode)
|
|||
$admin_memberships = group_memberships($admin_group_id, $admin_id_ary);
|
||||
|
||||
$admin_user_ids = array();
|
||||
|
||||
|
||||
if (!empty($admin_memberships))
|
||||
{
|
||||
// ok, we only need the user ids...
|
||||
|
@ -527,13 +527,32 @@ switch ($mode)
|
|||
unset($module);
|
||||
}
|
||||
|
||||
// If the user has m_approve permission or a_user permission, then list then display unapproved posts
|
||||
if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user'))
|
||||
{
|
||||
$sql = 'SELECT COUNT(post_id) as posts_in_queue
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE poster_id = ' . $user_id . '
|
||||
AND post_approved = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
$member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$member['posts_in_queue'] = 0;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']),
|
||||
|
||||
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
|
||||
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
|
||||
|
||||
'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '',
|
||||
'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '',
|
||||
'SIGNATURE' => $member['user_sig'],
|
||||
'POSTS_IN_QUEUE'=> $member['posts_in_queue'],
|
||||
|
||||
'AVATAR_IMG' => $poster_avatar,
|
||||
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
|
||||
|
@ -553,6 +572,7 @@ switch ($mode)
|
|||
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid(CONFIG_ADM_FOLDER . '/index', 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '',
|
||||
'U_USER_BAN' => ($auth->acl_get('m_ban')) ? append_sid('mcp', 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '',
|
||||
'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid('ucp', "mode=switch_perm&u={$user_id}") : '',
|
||||
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid('mcp', 'i=queue', true, $user->session_id) : '',
|
||||
|
||||
'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false,
|
||||
'U_ADD_FRIEND' => (!$friend) ? append_sid('ucp', 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '',
|
||||
|
@ -1146,7 +1166,7 @@ switch ($mode)
|
|||
$sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
||||
$sql_where_data = " AND u.user_id = ug.user_id AND ug.group_id = $group_id";
|
||||
}
|
||||
|
||||
|
||||
// Sorting and order
|
||||
if (!isset($sort_key_sql[$sort_key]))
|
||||
{
|
||||
|
@ -1597,9 +1617,9 @@ function show_profile($data)
|
|||
function _sort_last_active($first, $second)
|
||||
{
|
||||
global $id_cache, $sort_dir;
|
||||
|
||||
|
||||
$lesser_than = ($sort_dir === 'a') ? -1 : 1;
|
||||
|
||||
|
||||
if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader']))
|
||||
{
|
||||
return 1;
|
||||
|
|
|
@ -999,10 +999,9 @@ if ($submit || $preview || $refresh)
|
|||
}
|
||||
|
||||
$redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message);
|
||||
$post_need_approval = (!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) ? true : false;
|
||||
|
||||
// If the post need approval we will wait a lot longer.
|
||||
if ($post_need_approval)
|
||||
// Check the permissions for post approval, as well as the queue trigger where users are put on approval with a post count lower than specified. Moderators are not affected.
|
||||
if (($config['enable_queue_trigger'] && $user->data['user_posts'] < $config['queue_trigger_posts'] && !$auth->acl_get('m_approve', $data['forum_id'])) || !$auth->acl_get('f_noapprove', $data['forum_id']))
|
||||
{
|
||||
meta_refresh(10, $redirect_url);
|
||||
$message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD'];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<form method="post" action="{S_PROFILE_ACTION}" id="viewprofile">
|
||||
<div class="panel bg1<!-- IF S_ONLINE --> online<!-- ENDIF -->">
|
||||
<div class="inner"><span class="corners-top"><span></span></span>
|
||||
|
||||
|
||||
<!-- IF AVATAR_IMG -->
|
||||
<dl class="left-box">
|
||||
<dt>{AVATAR_IMG}</dt>
|
||||
|
@ -55,7 +55,7 @@
|
|||
<div class="column1">
|
||||
|
||||
<h3>{L_CONTACT_USER} {USERNAME}</h3>
|
||||
|
||||
|
||||
<dl class="details">
|
||||
<!-- IF U_EMAIL --><dt>{L_EMAIL_ADDRESS}:</dt> <dd><a href="{U_EMAIL}">{L_SEND_EMAIL_USER} {USERNAME}</a></dd><!-- ENDIF -->
|
||||
<!-- IF U_WWW --><dt>{L_WEBSITE}:</dt> <dd><a href="{U_WWW}" title="{L_VISIT_WEBSITE}: {U_WWW}">{U_WWW}</a></dd><!-- ENDIF -->
|
||||
|
@ -82,7 +82,11 @@
|
|||
<dt>{L_WARNINGS}: </dt>
|
||||
<dd><strong>{WARNINGS}</strong> [ <a href="{U_NOTES}">{L_VIEW_NOTES}</a> <!-- IF U_WARN --> | <a href="{U_WARN}">{L_WARN_USER}</a> <!-- ENDIF -->]</dd>
|
||||
<!-- ENDIF -->
|
||||
<dt>{L_TOTAL_POSTS}:</dt> <dd>{POSTS} | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a></strong><!-- IF POSTS_PCT --><br />({POSTS_PCT} / {POSTS_DAY})<!-- ENDIF --></dd>
|
||||
<dt>{L_TOTAL_POSTS}:</dt>
|
||||
<dd>{POSTS} | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a></strong>
|
||||
<!-- IF POSTS_PCT --><br />({POSTS_PCT} / {POSTS_DAY})<!-- ENDIF -->
|
||||
<!-- IF POSTS_IN_QUEUE and U_MCP_QUEUE --><br />(<a href="{U_MCP_QUEUE}">{L_POSTS_IN_QUEUE}</a>)<!-- ELSEIF POSTS_IN_QUEUE --><br />({L_POSTS_IN_QUEUE})<!-- ENDIF -->
|
||||
</dd>
|
||||
<!-- IF S_SHOW_ACTIVITY and POSTS -->
|
||||
<dt>{L_ACTIVE_IN_FORUM}:</dt> <dd><!-- IF ACTIVE_FORUM --><strong><a href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></strong><br />({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})<!-- ELSE --> - <!-- ENDIF --></dd>
|
||||
<dt>{L_ACTIVE_IN_TOPIC}:</dt> <dd><!-- IF ACTIVE_TOPIC --><strong><a href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></strong><br />({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})<!-- ELSE --> - <!-- ENDIF --></dd>
|
||||
|
|
|
@ -74,7 +74,9 @@
|
|||
<!-- ENDIF -->
|
||||
<tr>
|
||||
<td class="gen" align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap">{L_TOTAL_POSTS}: </td>
|
||||
<td><b class="gen">{POSTS}</b><span class="genmed"><!-- IF POSTS_PCT --><br />[{POSTS_PCT} / {POSTS_DAY}]<!-- ENDIF --><br /><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a></span></td>
|
||||
<td><b class="gen">{POSTS}</b><span class="genmed"><!-- IF POSTS_PCT --><br />[{POSTS_PCT} / {POSTS_DAY}]<!-- ENDIF -->
|
||||
<!-- IF POSTS_IN_QUEUE and U_MCP_QUEUE --><br />[<a href="{U_MCP_QUEUE}">{L_POSTS_IN_QUEUE}</a>]<!-- ELSEIF POSTS_IN_QUEUE --><br />[{L_POSTS_IN_QUEUE}]<!-- ENDIF -->
|
||||
<br /><a href="{U_SEARCH_USER}">{L_SEARCH_USER_POSTS}</a></span></td>
|
||||
</tr>
|
||||
<!-- IF S_SHOW_ACTIVITY -->
|
||||
<tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue