Code: Select all
$sql_ary = array(
'post_text' => utf8_recode($post_text, 'utf-8'),
'bbcode_uid' => $uid,
'bbcode_bitfield' => $bitfield,
'post_edit_time' => $edit_time,
'post_edit_count' => $edit_count,
'post_edit_user' => $edit_user,
);
Code: Select all
// <<== Nyquist's Always Show Edit Info
if (isset($config['nyq_editinfo']) && $config['nyq_editinfo'] == 'always')
$sql_ary = array_merge($sql_ary, array(
'post_edit_time' => time(),
'post_edit_user' => (int) $user->data['user_id'],
'post_edit_count' => (int) $row['post_edit_count'] + 1
));
// ==>> Nyquist's Always Show Edit Info
Code: Select all
<?php
/**
*
* @package phpBB3
* @version $Id: quickedit.php 386 2009-05-05 10:28:47Z marc1706 $
* @copyright (c) 2006 StarTrekGuide Group, (c) 2009 Marc Alexander(marc1706) www.m-a-styles.de
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('posting');
$post_id = request_var('post_id', 0);
$submit = isset($_POST['submit']) ? true : false;
$contents = utf8_normalize_nfc(request_var('contents', '', true));
if ($contents == 'cancel')
{
$sql = 'SELECT p.*, f.*
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
WHERE post_id = $post_id AND p.forum_id = f.forum_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
//now check to see if the user is allowed to read the post
if (!$auth->acl_get('f_read', $row['forum_id']))
{
die($user->lang['USER_CANNOT_READ']);
}
$row['bbcode_options'] = (($row['enable_bbcode']) ? OPTION_FLAG_BBCODE : 0) + (($row['enable_smilies']) ? OPTION_FLAG_SMILIES : 0) + (($row['enable_magic_url']) ? OPTION_FLAG_LINKS : 0);
$text = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
$template->assign_vars(array(
'SEND_TEXT' => true,
'TEXT' => $text,
'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'),
'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'),
));
}
else if ($submit)
{
$sql = 'SELECT p.*, f.*, t.*
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE p.post_id = $post_id AND p.topic_id = t.topic_id AND p.forum_id = f.forum_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
//first check to see if we are registered and have rights to edit something here
if ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $row['forum_id']))
{
$is_authed = true;
}
else
{
die($user->lang['USER_CANNOT_EDIT']);
}
//now check to see if this forum is locked and if we aren't a mod that can edit anything
if (($row['forum_status'] == ITEM_LOCKED || (isset($row['topic_status']) && $row['topic_status'] == ITEM_LOCKED)) && !$auth->acl_get('m_edit', $row['forum_id']))
{
die(($post_data['forum_status'] == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'TOPIC_LOCKED');
}
//now check to see if we can edit THIS post
if (!$auth->acl_get('m_edit', $row['forum_id']))
{
if ($user->data['user_id'] != $row['poster_id'])
{
die($user->lang['USER_CANNOT_EDIT']);
}
if (!($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']))
{
die($user->lang['CANNOT_EDIT_TIME']);
}
if ($row['post_edit_locked'])
{
die($user->lang['CANNOT_EDIT_POST_LOCKED']);
}
}
//now check if we need to set the edit time and edit count
if (!$auth->acl_get('m_edit', $row['forum_id']))
{
$edit_time = time();
$edit_count = $row['post_edit_count'] + 1;
$edit_user = $user->data['user_id'];
} else {
if(isset($row['post_edit_time']))
{
$edit_time = $row['post_edit_time'];
} else {
$edit_time = 0;
}
if(isset($row['post_edit_user']))
{
$edit_user = $row['post_edit_user'];
} else {
$edit_user = 0;
}
if(isset($row['post_edit_count']))
{
$edit_count = $row['post_edit_count'];
} else {
$edit_count = 0;
}
}
$post_text = utf8_normalize_nfc(request_var('contents', '', true));
$uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
$allow_bbcode = $allow_urls = $allow_smilies = true;
generate_text_for_storage($post_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
// let's try something else here in order to get the bbcode_uid and bbcode_bitfield
$message_parser = new parse_message();
$message_parser->message = $post_text;
if(!isset($uid))
{
$uid = $message_parser->bbcode_uid;
}
if(!isset($bitfield))
{
$bitfield = $message_parser->bbcode_bitfield;
}
$sql_ary = array(
'post_text' => $post_text,
'bbcode_uid' => $uid,
'bbcode_bitfield' => $bitfield,
'post_edit_time' => $edit_time,
'post_edit_count' => $edit_count,
'post_edit_user' => $edit_user,
);
$sql = 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE post_id = $post_id";
$db->sql_query($sql);
$text = generate_text_for_display($sql_ary['post_text'], $sql_ary['bbcode_uid'], $sql_ary['bbcode_bitfield'], 7);
$template->assign_vars(array(
'SEND_TEXT' => true,
'TEXT' => $text,
'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'),
'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'),
));
}
else if ($post_id)
{
$sql = 'SELECT p.*, f.*, t.*
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE p.post_id = $post_id AND p.topic_id = t.topic_id";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// HTML, BBCode, Smilies, Images and Flash status
$bbcode_status = ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $row['forum_id'])) ? true : false;
$smilies_status = ($bbcode_status && $config['allow_smilies'] && $auth->acl_get('f_smilies', $row['forum_id'])) ? true : false;
$img_status = ($bbcode_status && $auth->acl_get('f_img', $row['forum_id'])) ? true : false;
$url_status = ($config['allow_post_links']) ? true : false;
$flash_status = ($bbcode_status && $auth->acl_get('f_flash', $row['forum_id']) && $config['allow_post_flash']) ? true : false;
$quote_status = ($auth->acl_get('f_reply', $row['forum_id'])) ? true : false;
//first check to see if we are registered and have rights to edit something here
if ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $row['forum_id']))
{
$is_authed = true;
}
else
{
die($user->lang['USER_CANNOT_EDIT']);
}
//now check to see if this forum is locked and if we aren't a mod that can edit anything
if (($row['forum_status'] == ITEM_LOCKED || (isset($row['topic_status']) && $row['topic_status'] == ITEM_LOCKED)) && !$auth->acl_get('m_edit', $row['forum_id']))
{
die(($post_data['forum_status'] == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'TOPIC_LOCKED');
}
//now check to see if we can edit THIS post
if (!$auth->acl_get('m_edit', $row['forum_id']))
{
if ($user->data['user_id'] != $row['poster_id'])
{
die($user->lang['USER_CANNOT_EDIT']);
}
if (!($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']))
{
die($user->lang['CANNOT_EDIT_TIME']);
}
if ($row['post_edit_locked'])
{
die($user->lang['CANNOT_EDIT_POST_LOCKED']);
}
}
if(isset($row['bbcode_uid']))
{
decode_message($row['post_text'], $row['bbcode_uid']);
}
// Build custom bbcodes array
display_custom_bbcodes();
$template->assign_vars(array(
'EDIT_FORM' => true,
'POST_ID' => $post_id,
'POST_TEXT' => $row['post_text'],
'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'),
'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'),
'S_BBCODE_IMG' => $img_status,
'S_BBCODE_URL' => $url_status,
'S_BBCODE_FLASH' => $flash_status,
'S_BBCODE_QUOTE' => $quote_status,
'S_BBCODE_ALLOWED' => $bbcode_status,
));
}
else
{
die('USER_CANNOT_EDIT');
}
$template->set_filenames(array(
'body' => 'quickedit.html')
);
page_footer();
?>
$sql = 'SELECT p.*, f.*
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
WHERE post_id = $post_id AND p.forum_id = f.forum_id";
Code: Select all
var text_name = 'quickedit-textarea';
Code: Select all
var txt_name = 'quickedit-textarea';
Code: Select all
<!-- IF EDIT_FORM -->
<!-- IF S_BBCODE_ALLOWED -->
<div id="format-buttons" style="font-family:Verdana,Helvetica,Arial,sans-serif; font-size: 1.1 em;">
<input type="button" value=" B " onclick="bbstyle2(0)" class="button2" style="width: 30px; font-size:0.85em; font-weight:bold;" title="{L_BBCODE_B_HELP}" />
<input type="button" value=" i " onclick="bbstyle2(2)" class="button2" style="width: 30px; font-size:0.85em; font-style: italic;" title="{L_BBCODE_I_HELP}" />
<input type="button" value=" u " onclick="bbstyle2(4)" class="button2" style="width: 30px; font-size:0.85em; text-decoration: underline;" title="{L_BBCODE_U_HELP}" />
<!-- IF S_BBCODE_QUOTE -->
<input type="button" value="Quote" onclick="bbstyle2(6)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_Q_HELP}" />
<!-- ENDIF -->
<input type="button" value="Code" onclick="bbstyle2(8)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_C_HELP}" />
<input type="button" value="List" onclick="bbstyle2(10)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_L_HELP}" />
<input type="button" value="List=" onclick="bbstyle2(12)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_O_HELP}" />
<input type="button" value="[*]" onclick="bbstyle2(-1)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_LISTITEM_HELP}" />
<!-- IF S_BBCODE_IMG -->
<input type="button" value="Img" onclick="bbstyle2(14)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_P_HELP}" />
<!-- ENDIF -->
<!-- IF S_LINKS_ALLOWED -->
<input type="button" value="URL" onclick="bbstyle2(16)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_W_HELP}" />
<!-- ENDIF -->
<!-- IF S_BBCODE_FLASH -->
<input type="button" value="Flash" onclick="bbstyle2(18)" class="button2" style="width: 30px; font-size:0.85em;" title="{L_BBCODE_D_HELP}" />
<!-- ENDIF -->
<select id= "addbbcode20" name="addbbcode20" onchange="bbfontstyle2('[size=' + document.getElementById('addbbcode20').options[document.getElementById('addbbcode20').selectedIndex].value + ']', '[/size]');document.getElementById('addbbcode20').selectedIndex = 2;" title="{L_BBCODE_F_HELP}">
<option value="50">{L_FONT_TINY}</option>
<option value="85">{L_FONT_SMALL}</option>
<option value="100" selected="selected">{L_FONT_NORMAL}</option>
<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 150 -->
<option value="150">{L_FONT_LARGE}</option>
<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 200 -->
<option value="200">{L_FONT_HUGE}</option>
<!-- ENDIF -->
<!-- ENDIF -->
</select>
<!-- BEGIN custom_tags -->
<input type="button" class="button2" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle2({custom_tags.BBCODE_NAME})" title="{custom_tags.BBCODE_HELPLINE}" style="width: 30px; font-size:0.85em;" />
<!-- END custom_tags -->
</div>
<!-- ENDIF -->
<div id="message-box">
<textarea name="quickedit-textarea" id="quickedit-textarea" class="inputbox" rows="15" cols="76" onselect="storeCaret2(this);" onclick="storeCaret2(this);" onkeyup="storeCaret2(this);" onfocus="initInsertions2();" style="font-size: 1.0em;" >{POST_TEXT}</textarea><br />
</div><br />
<input class="button1" type="button" onclick="submit_changes({POST_ID});" value="{L_SUBMIT}" style="font-size:0.9em;" />
<input class="button2" type="button" onclick="cancel_changes({POST_ID});" value="{L_CANCEL}" style="font-size:0.9em;" />
<!-- ELSEIF SEND_TEXT -->
{TEXT}
<!-- ELSE -->
<script type="text/javascript">
// <![CDATA[
var http_request = getHTTPObject();
var divname = '';
var open_quick_edit = 0;
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
var baseHeight;
// Define the bbCode tags
var bbcode = new Array();
var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
Code: Select all
<!-- IF EDIT_FORM -->
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr valign="middle" align="{S_CONTENT_FLOW_BEGIN}">
<td colspan="2">
<!-- IF S_BBCODE_ALLOWED -->
<input type="button" value=" B " onclick="bbstyle2(0)" class="btnbbcode" style="width: 30px; font-size:0.85em; font-weight:bold;" title="{L_BBCODE_B_HELP}" />
<input type="button" value=" i " onclick="bbstyle2(2)" class="btnbbcode" style="width: 30px; font-size:0.85em; font-style: italic;" title="{L_BBCODE_I_HELP}" />
<input type="button" value=" u " onclick="bbstyle2(4)" class="btnbbcode" style="width: 30px; font-size:0.85em; text-decoration: underline;" title="{L_BBCODE_U_HELP}" />
<!-- IF S_BBCODE_QUOTE -->
<input type="button" value="Quote" onclick="bbstyle2(6)" class="btnbbcode" style="width: 40px; font-size:0.85em;" title="{L_BBCODE_Q_HELP}" />
<!-- ENDIF -->
<input type="button" value="Code" onclick="bbstyle2(8)" class="btnbbcode" style="width: 40px; font-size:0.85em;" title="{L_BBCODE_C_HELP}" />
<input type="button" value="List" onclick="bbstyle2(10)" class="btnbbcode" style="width: 40px; font-size:0.85em;" title="{L_BBCODE_L_HELP}" />
<input type="button" value="List=" onclick="bbstyle2(12)" class="btnbbcode" style="width: 40px; font-size:0.85em;" title="{L_BBCODE_O_HELP}" />
<input type="button" value="[*]" onclick="bbstyle2(-1)" class="btnbbcode" style="width: 40px; font-size:0.85em;" title="{L_BBCODE_LISTITEM_HELP}" />
<!-- IF S_BBCODE_IMG -->
<input type="button" value="Img" onclick="bbstyle2(14)" class="btnbbcode" style="width: 40px; font-size:0.85em;" title="{L_BBCODE_P_HELP}" />
<!-- ENDIF -->
<!-- IF S_LINKS_ALLOWED -->
<input type="button" value="URL" onclick="bbstyle2(16)" class="btnbbcode" style="width: 40px; font-size:0.85em;" title="{L_BBCODE_W_HELP}" />
<!-- ENDIF -->
<!-- IF S_BBCODE_FLASH -->
<input type="button" value="Flash" onclick="bbstyle2(18)" class="btnbbcode" style="font-size:0.85em;" title="{L_BBCODE_D_HELP}" />
<!-- ENDIF -->
<span class="genmed nowrap"><select class="gensmall" id= "addbbcode20" name="addbbcode20" onchange="bbfontstyle2('[size=' + document.getElementById('addbbcode20').options[document.getElementById('addbbcode20').selectedIndex].value + ']', '[/size]');document.getElementById('addbbcode20').selectedIndex = 2;" title="{L_BBCODE_F_HELP}">
<option value="50">{L_FONT_TINY}</option>
<option value="85">{L_FONT_SMALL}</option>
<option value="100" selected="selected">{L_FONT_NORMAL}</option>
<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 150 -->
<option value="150">{L_FONT_LARGE}</option>
<!-- IF not MAX_FONT_SIZE or MAX_FONT_SIZE >= 200 -->
<option value="200">{L_FONT_HUGE}</option>
<!-- ENDIF -->
<!-- ENDIF -->
</select></span>
<!-- ENDIF -->
</td>
</tr>
<!-- IF S_BBCODE_ALLOWED and .custom_tags -->
<tr valign="middle" align="{S_CONTENT_FLOW_BEGIN}">
<td colspan="2">
<!-- BEGIN custom_tags -->
<input type="button" class="btnbbcode" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle2({custom_tags.BBCODE_NAME})" title="{custom_tags.BBCODE_HELPLINE}" style="font-size:0.85em;" />
<!-- END custom_tags -->
</td>
</tr>
<!-- ENDIF -->
<tr>
<td valign="top" style="width: 100%;"><textarea name="quickedit-textarea" id="quickedit-textarea" rows="15" cols="76" tabindex="3" onselect="storeCaret2(this);" onclick="storeCaret2(this);" onkeyup="storeCaret2(this);" onfocus="initInsertions2();" style="width: 98%; font-size: 0.9em;" >{POST_TEXT}</textarea></td>
</tr><br />
<tr>
<td>
<input class="button1" type="button" onclick="submit_changes({POST_ID});" value="{L_SUBMIT}" style="font-size:0.9em;" />
<input class="button2" type="button" onclick="cancel_changes({POST_ID});" value="{L_CANCEL}" style="font-size:0.9em;" />
</td>
</tr>
</table>
<!-- ELSEIF SEND_TEXT -->
{TEXT}
<!-- ELSE -->
<script type="text/javascript">
// <![CDATA[
var http_request = getHTTPObject();
var divname = '';
var open_quick_edit = 0;
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
var baseHeight;
// Define the bbCode tags
var bbcode = new Array();
var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','