mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
added 711252 and lock topic within post, fixed post editing a bit.
git-svn-id: file:///svn/phpbb/trunk@3817 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
75eef6bfd7
commit
793182218a
6 changed files with 79 additions and 12 deletions
|
@ -775,7 +775,8 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
|
||||||
'enable_smilies' => $post_data['enable_smilies'],
|
'enable_smilies' => $post_data['enable_smilies'],
|
||||||
'enable_magic_url' => $post_data['enable_urls'],
|
'enable_magic_url' => $post_data['enable_urls'],
|
||||||
'bbcode_uid' => $bbcode_uid,
|
'bbcode_uid' => $bbcode_uid,
|
||||||
'bbcode_bitfield' => $post_data['bbcode_bitfield']
|
'bbcode_bitfield' => $post_data['bbcode_bitfield'],
|
||||||
|
'post_edit_locked' => $post_data['post_edit_locked']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($mode != 'edit' || $post_data['message_md5'] != $post_data['post_checksum'])
|
if ($mode != 'edit' || $post_data['message_md5'] != $post_data['post_checksum'])
|
||||||
|
@ -786,7 +787,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
|
||||||
'post_encoding' => $user->lang['ENCODING']
|
'post_encoding' => $user->lang['ENCODING']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$sql = ($mode == 'edit' && $post_data['poster_id'] == intval($user->data['user_id'])) ? 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $post_sql) . ' , post_edit_count = post_edit_count + 1 WHERE post_id = ' . $post_data['post_id'] : 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $post_sql);
|
$sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $post_sql) . ' , post_edit_count = post_edit_count + 1 WHERE post_id = ' . $post_data['post_id'] : 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $post_sql);
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$post_data['post_id'] = ($mode == 'edit') ? $post_data['post_id'] : $db->sql_nextid();
|
$post_data['post_id'] = ($mode == 'edit') ? $post_data['post_id'] : $db->sql_nextid();
|
||||||
|
|
|
@ -342,7 +342,7 @@ class Template {
|
||||||
|
|
||||||
$compile_blocks = array();
|
$compile_blocks = array();
|
||||||
|
|
||||||
for ($curr_tb = 0; $curr_tb < count($text_blocks); $curr_tb++)
|
for ($curr_tb = 0; $curr_tb < count($text_blocks); $curr_tb++)
|
||||||
{
|
{
|
||||||
switch ($blocks[1][$curr_tb])
|
switch ($blocks[1][$curr_tb])
|
||||||
{
|
{
|
||||||
|
|
|
@ -442,6 +442,7 @@ CREATE TABLE phpbb_posts (
|
||||||
bbcode_uid varchar(10) NOT NULL,
|
bbcode_uid varchar(10) NOT NULL,
|
||||||
post_edit_time int(11),
|
post_edit_time int(11),
|
||||||
post_edit_count smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
|
post_edit_count smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
|
post_edit_locked tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
PRIMARY KEY (post_id),
|
PRIMARY KEY (post_id),
|
||||||
KEY forum_id (forum_id),
|
KEY forum_id (forum_id),
|
||||||
KEY topic_id (topic_id),
|
KEY topic_id (topic_id),
|
||||||
|
|
|
@ -361,11 +361,16 @@ $lang = array(
|
||||||
'CHANGE_TOPIC_TO' => 'Change topic type to',
|
'CHANGE_TOPIC_TO' => 'Change topic type to',
|
||||||
'EDIT_POST' => 'Edit post',
|
'EDIT_POST' => 'Edit post',
|
||||||
'OPTIONS' => 'Options',
|
'OPTIONS' => 'Options',
|
||||||
|
'MOD_OPTIONS' => 'Moderator Options',
|
||||||
'POST_NORMAL' => 'Normal',
|
'POST_NORMAL' => 'Normal',
|
||||||
|
|
||||||
|
'LOCK_POST' => 'Lock Post',
|
||||||
|
'LOCK_POST_EXPLAIN' => 'Prevent editing',
|
||||||
|
|
||||||
'CONFIRM_DELETE' => 'Are you sure you want to delete this post?',
|
'CONFIRM_DELETE' => 'Are you sure you want to delete this post?',
|
||||||
'Confirm_delete_poll' => 'Are you sure you want to delete this poll?',
|
'Confirm_delete_poll' => 'Are you sure you want to delete this poll?',
|
||||||
'Cannot_edit_time' => 'You can no longer edit or delete that post',
|
'CANNOT_EDIT_TIME' => 'You can no longer edit or delete that post',
|
||||||
|
'CANNOT_EDIT_POST_LOCKED' => 'This post has been locked. You can no longer edit that post.',
|
||||||
'FLOOD_ERROR' => 'You cannot make another post so soon after your last, please try again in a short while',
|
'FLOOD_ERROR' => 'You cannot make another post so soon after your last, please try again in a short while',
|
||||||
'EMPTY_SUBJECT' => 'You must specify a subject when posting a new topic',
|
'EMPTY_SUBJECT' => 'You must specify a subject when posting a new topic',
|
||||||
'To_long_subject' => 'The subject is too long it must be 60 characters or less',
|
'To_long_subject' => 'The subject is too long it must be 60 characters or less',
|
||||||
|
|
|
@ -105,7 +105,7 @@ $forum_fields = array('forum_name' => 's', 'parent_id' => 'i', 'forum_parents' =
|
||||||
|
|
||||||
$topic_fields = array('topic_status' => 'i', 'topic_first_post_id' => 'i', 'topic_last_post_id' => 'i', 'topic_type' => 'i', 'topic_title' => 's', 'poll_last_vote' => 'i', 'poll_start' => 'i', 'poll_title' => 's', 'poll_length' => 'i');
|
$topic_fields = array('topic_status' => 'i', 'topic_first_post_id' => 'i', 'topic_last_post_id' => 'i', 'topic_type' => 'i', 'topic_title' => 's', 'poll_last_vote' => 'i', 'poll_start' => 'i', 'poll_title' => 's', 'poll_length' => 'i');
|
||||||
|
|
||||||
$post_fields = array('post_time' => 'i', 'poster_id' => 'i', 'post_username' => 's', 'post_text' => 's', 'post_subject' => 's', 'post_checksum' => 's', 'post_attachment' => 'i', 'bbcode_uid' => 's', 'enable_magic_url' => 'i', 'enable_sig' => 'i', 'enable_smilies' => 'i', 'enable_bbcode' => 'i');
|
$post_fields = array('post_time' => 'i', 'poster_id' => 'i', 'post_username' => 's', 'post_text' => 's', 'post_subject' => 's', 'post_checksum' => 's', 'post_attachment' => 'i', 'bbcode_uid' => 's', 'enable_magic_url' => 'i', 'enable_sig' => 'i', 'enable_smilies' => 'i', 'enable_bbcode' => 'i', 'post_edit_locked' => 'i');
|
||||||
|
|
||||||
$sql = '';
|
$sql = '';
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
|
@ -368,6 +368,12 @@ if ( ($mode == 'edit') && (!$perm['m_edit']) && ($user->data['user_id'] != $post
|
||||||
trigger_error($user->lang['USER_CANNOT_EDIT']);
|
trigger_error($user->lang['USER_CANNOT_EDIT']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is edit posting locked ?
|
||||||
|
if ( ($mode == 'edit') && ($post_edit_locked) && (!$auth->acl_gets('m_', 'a_', $forum_id)) )
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['CANNOT_EDIT_POST_LOCKED']);
|
||||||
|
}
|
||||||
|
|
||||||
$message_parser = new parse_message(0); // <- TODO: add constant (MSG_POST/MSG_PM)
|
$message_parser = new parse_message(0); // <- TODO: add constant (MSG_POST/MSG_PM)
|
||||||
|
|
||||||
// Delete triggered ?
|
// Delete triggered ?
|
||||||
|
@ -450,6 +456,8 @@ if (($submit) || ($preview) || ($refresh))
|
||||||
$enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1;
|
$enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1;
|
||||||
$enable_sig = (!intval($config['allow_sig'])) ? false : ((!empty($_POST['attach_sig'])) ? true : false);
|
$enable_sig = (!intval($config['allow_sig'])) ? false : ((!empty($_POST['attach_sig'])) ? true : false);
|
||||||
$notify = (!empty($_POST['notify'])) ? true : false;
|
$notify = (!empty($_POST['notify'])) ? true : false;
|
||||||
|
$topic_lock = (isset($_POST['lock_topic'])) ? true : false;
|
||||||
|
$post_lock = (isset($_POST['lock_post'])) ? true : false;
|
||||||
|
|
||||||
$poll_delete = (isset($_POST['poll_delete'])) ? true : false;
|
$poll_delete = (isset($_POST['poll_delete'])) ? true : false;
|
||||||
|
|
||||||
|
@ -580,6 +588,41 @@ if (($submit) || ($preview) || ($refresh))
|
||||||
// Store message, sync counters
|
// Store message, sync counters
|
||||||
if (($err_msg == '') && ($submit))
|
if (($err_msg == '') && ($submit))
|
||||||
{
|
{
|
||||||
|
// Lock/Unlock Topic
|
||||||
|
$change_topic_status = $topic_status;
|
||||||
|
|
||||||
|
if ($topic_status == ITEM_LOCKED && !$topic_lock && $perm['m_lock'])
|
||||||
|
{
|
||||||
|
$change_topic_status = ITEM_UNLOCKED;
|
||||||
|
}
|
||||||
|
else if ($topic_status == ITEM_UNLOCKED && $topic_lock && $perm['m_lock'])
|
||||||
|
{
|
||||||
|
$change_topic_status = ITEM_LOCKED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($change_topic_status != $topic_status)
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||||
|
SET topic_status = ' . $change_topic_status . '
|
||||||
|
WHERE topic_id = ' . $topic_id . '
|
||||||
|
AND topic_moved_id = 0';
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
add_log('mod', $forum_id, $topic_id, 'logm_' . (($change_topic_status == ITEM_LOCKED) ? 'lock' : 'unlock'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lock/Unlock Post Edit
|
||||||
|
if ($mode == 'edit' && $post_edit_locked == ITEM_LOCKED && !$post_lock && $perm['m_edit'])
|
||||||
|
{
|
||||||
|
$post_edit_locked = ITEM_UNLOCKED;
|
||||||
|
}
|
||||||
|
else if ($mode == 'edit' && $post_edit_locked == ITEM_UNLOCKED && $post_lock && $perm['m_edit'])
|
||||||
|
{
|
||||||
|
$post_edit_locked = ITEM_LOCKED;
|
||||||
|
}
|
||||||
|
|
||||||
$post_data = array(
|
$post_data = array(
|
||||||
'topic_first_post_id' => $topic_first_post_id,
|
'topic_first_post_id' => $topic_first_post_id,
|
||||||
'post_id' => $post_id,
|
'post_id' => $post_id,
|
||||||
|
@ -599,6 +642,7 @@ if (($submit) || ($preview) || ($refresh))
|
||||||
'forum_parents' => $forum_parents,
|
'forum_parents' => $forum_parents,
|
||||||
'notify' => $notify,
|
'notify' => $notify,
|
||||||
'notify_set' => $notify_set,
|
'notify_set' => $notify_set,
|
||||||
|
'post_edit_locked' => $post_edit_locked,
|
||||||
'bbcode_bitfield' => $message_parser->bbcode_bitfield
|
'bbcode_bitfield' => $message_parser->bbcode_bitfield
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -727,6 +771,7 @@ $urls_checked = (isset($enable_urls)) ? !$enable_urls : 0;
|
||||||
$sig_checked = $enable_sig;
|
$sig_checked = $enable_sig;
|
||||||
$notify_checked = (isset($notify_set)) ? $notify_set : (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_notify'] : 0);
|
$notify_checked = (isset($notify_set)) ? $notify_set : (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_notify'] : 0);
|
||||||
$lock_topic_checked = (isset($topic_lock)) ? $topic_lock : (($topic_status == ITEM_LOCKED) ? 1 : 0);
|
$lock_topic_checked = (isset($topic_lock)) ? $topic_lock : (($topic_status == ITEM_LOCKED) ? 1 : 0);
|
||||||
|
$lock_post_checked = (isset($post_lock)) ? $post_lock : $post_edit_locked;
|
||||||
|
|
||||||
// Page title & action URL, include session_id for security purpose
|
// Page title & action URL, include session_id for security purpose
|
||||||
$s_action = "posting.$phpEx?sid=" . $user->session_id . "&mode=$mode&f=" . $forum_id;
|
$s_action = "posting.$phpEx?sid=" . $user->session_id . "&mode=$mode&f=" . $forum_id;
|
||||||
|
@ -809,6 +854,8 @@ $template->assign_vars(array(
|
||||||
'S_NOTIFY_CHECKED' => ($notify_checked) ? 'checked="checked"' : '',
|
'S_NOTIFY_CHECKED' => ($notify_checked) ? 'checked="checked"' : '',
|
||||||
'S_LOCK_TOPIC_ALLOWED' => ( ($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($perm['m_lock']) ) ? true : false,
|
'S_LOCK_TOPIC_ALLOWED' => ( ($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($perm['m_lock']) ) ? true : false,
|
||||||
'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? 'checked="checked"' : '',
|
'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? 'checked="checked"' : '',
|
||||||
|
'S_LOCK_POST_ALLOWED' => (($mode == 'edit') && ($perm['m_edit'])) ? true : false,
|
||||||
|
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? 'checked="checked"' : '',
|
||||||
'S_MAGIC_URL_CHECKED' => ($urls_checked) ? 'checked="checked"' : '',
|
'S_MAGIC_URL_CHECKED' => ($urls_checked) ? 'checked="checked"' : '',
|
||||||
'S_TYPE_TOGGLE' => $topic_type_toggle,
|
'S_TYPE_TOGGLE' => $topic_type_toggle,
|
||||||
'S_SAVE_ALLOWED' => ($perm['f_save']) ? true : false,
|
'S_SAVE_ALLOWED' => ($perm['f_save']) ? true : false,
|
||||||
|
|
|
@ -144,7 +144,7 @@ function checkForm()
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span><br /><table cellspacing="2" cellpadding="0" border="0">
|
<td class="row1" valign="top"><b class="gen">{L_OPTIONS}</b><br /><table cellspacing="2" cellpadding="0" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="gensmall">{HTML_STATUS}</td>
|
<td class="gensmall">{HTML_STATUS}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -196,12 +196,6 @@ function checkForm()
|
||||||
<td class="gen">{L_NOTIFY_REPLY}</td>
|
<td class="gen">{L_NOTIFY_REPLY}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- IF S_LOCK_TOPIC_ALLOWED -->
|
|
||||||
<tr>
|
|
||||||
<td><input type="checkbox" name="lock_topic" {S_LOCK_TOPIC_CHECKED} /></td>
|
|
||||||
<td class="gen">{L_LOCK_TOPIC}</td>
|
|
||||||
</tr>
|
|
||||||
<!-- ENDIF -->
|
|
||||||
<!-- IF S_TYPE_TOGGLE -->
|
<!-- IF S_TYPE_TOGGLE -->
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
@ -210,6 +204,25 @@ function checkForm()
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!-- IF S_LOCK_TOPIC_ALLOWED or S_LOCK_POST_ALLOWED -->
|
||||||
|
<tr>
|
||||||
|
<td class="row1" valign="top"><b class="gen">{L_MOD_OPTIONS}</b></td>
|
||||||
|
<td class="row2"><table cellspacing="0" cellpadding="1" border="0">
|
||||||
|
<!-- IF S_LOCK_TOPIC_ALLOWED -->
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox" name="lock_topic" {S_LOCK_TOPIC_CHECKED} /></td>
|
||||||
|
<td class="gen">{L_LOCK_TOPIC}</td>
|
||||||
|
</tr>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- IF S_LOCK_POST_ALLOWED -->
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox" name="lock_post" {S_LOCK_POST_CHECKED} /></td>
|
||||||
|
<td class="gen">{L_LOCK_POST} [{L_LOCK_POST_EXPLAIN}]</td>
|
||||||
|
</tr>
|
||||||
|
<!-- ENDIF -->
|
||||||
|
</table></td>
|
||||||
|
</tr>
|
||||||
|
<!-- ENDIF -->
|
||||||
<!-- IF S_SHOW_ATTACH_BOX -->
|
<!-- IF S_SHOW_ATTACH_BOX -->
|
||||||
<!-- INCLUDE posting_attach_body.html -->
|
<!-- INCLUDE posting_attach_body.html -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue