1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-10 17:45:18 +02:00

#575496 - only one way to do it, user input would be nice. ;)

git-svn-id: file:///svn/phpbb/trunk@3898 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2003-04-20 16:49:26 +00:00
parent 42d7f86141
commit c2da346e65
4 changed files with 162 additions and 41 deletions

View File

@ -178,7 +178,7 @@ function format_display($message, $html, $bbcode, $uid, $url, $smilies, $sig)
$message .= $user_sig;
return($message);
return $message;
}
// Update Last Post Informations
@ -569,7 +569,7 @@ function upload_attachment($filename)
if (!$filedata['post_attach'])
{
return ($filedata);
return $filedata;
}
$r_file = $filename;
@ -594,7 +594,7 @@ function upload_attachment($filename)
$filedata['error'] = true;
$filedata['err_msg'] = sprintf($user->lang['DISALLOWED_EXTENSION'], $filedata['extension']);
$filedata['post_attach'] = false;
return ($filedata);
return $filedata;
}
$allowed_filesize = ($extensions[$filedata['extension']]['max_filesize'] != 0) ? $extensions[$filedata['extension']]['max_filesize'] : $config['max_filesize'];
@ -606,7 +606,7 @@ function upload_attachment($filename)
$filedata['error'] = true;
$filedata['err_msg'] = sprintf($user->lang['INVALID_FILENAME'], $filename);
$filedata['post_attach'] = false;
return ($filedata);
return $filedata;
}
// check php upload-size
@ -615,7 +615,7 @@ function upload_attachment($filename)
$filedata['error'] = true;
$filedata['err_msg'] = (@ini_get('upload_max_filesize') == '') ? $user->lang['ATTACHMENT_PHP_SIZE_NA'] : sprintf($user->lang['ATTACHMENT_PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
$filedata['post_attach'] = false;
return ($filedata);
return $filedata;
}
/*
@ -655,7 +655,7 @@ function upload_attachment($filename)
$filedata['error'] = true;
$filedata['err_msg'] = sprintf($user->lang['ATTACHMENT_TOO_BIG'], $allowed_filesize, $size_lang);
$filedata['post_attach'] = false;
return ($filedata);
return $filedata;
}
// Check our complete quota
@ -666,7 +666,7 @@ function upload_attachment($filename)
$filedata['error'] = true;
$filedata['err_msg'] = $user->lang['ATTACH_QUOTA_REACHED'];
$filedata['post_attach'] = false;
return ($filedata);
return $filedata;
}
}
@ -773,7 +773,7 @@ function upload_attachment($filename)
$filedata['err_msg'] = $result;
$filedata['post_attach'] = false;
}
return ($filedata);
return $filedata;
}
// Move/Upload File - could be used for Avatars too ?
@ -792,7 +792,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
{
if ( !@move_uploaded_file($source_filename, $config['upload_dir'] . '/' . $destination_filename) )
{
return (sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename));
return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename);
}
}
@chmod($config['upload_dir'] . '/' . $destination_filename, 0666);
@ -803,7 +803,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
{
if ( !@copy($source_file, $config['upload_dir'] . '/' . $destination_filename) )
{
return (sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename));
return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename);
}
}
@chmod($config['upload_dir'] . '/' . $destination_filename, 0666);
@ -825,7 +825,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
if (!$res)
{
@ftp_quit($conn_id);
return (sprintf($user->lang['Ftp_error_upload'], $config['ftp_path']));
return sprintf($user->lang['Ftp_error_upload'], $config['ftp_path']);
}
@ftp_site($conn_id, 'CHMOD 0644 ' . $destination_filename);
@ -857,7 +857,7 @@ function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
}
}
}*/
return ('');
return '';
}
// Delete File
@ -904,7 +904,7 @@ function phpbb_unlink($filename, $mode = 'file', $use_ftp = false)
message_die(GENERAL_ERROR, sprintf($lang['Ftp_error_delete'], $attach_config['ftp_path'] . $add));
}
return ($deleted);
return $deleted;
}
@ftp_quit($conn_id);
@ -912,7 +912,7 @@ function phpbb_unlink($filename, $mode = 'file', $use_ftp = false)
$deleted = TRUE;*/
}
return ($deleted);
return $deleted;
}

View File

@ -364,6 +364,8 @@ $lang = array(
'OPTIONS' => 'Options',
'MOD_OPTIONS' => 'Moderator Options',
'POST_NORMAL' => 'Normal',
'POST_REVIEW' => 'Post Review',
'POST_REVIEW_EXPLAIN' => 'Since the beginning of your reply, new posts were added to this topic. You are able to review these posts now, to change yours accordingly.<br />This reminder will be displayed only once, if you press submit the next time your post will be stored.',
'LOCK_POST' => 'Lock Post',
'LOCK_POST_EXPLAIN' => 'Prevent editing',

View File

@ -24,36 +24,12 @@
// * topic review additions -> quoting from previous posts ?
// * check for reply since started posting upon submission and display of 'between-posts' to allow re-defining of post
// * hidden form element containing sid to prevent remote posting - Edwin van Vliet
// * Attachments
// * bbcode parsing -> see functions_posting.php
// * lock topic option within posting
// * multichoice polls
// * permission defined ability for user to add poll options
// * Spellcheck? aspell? or some such?
// * Posting approval
// Temp Function - strtolower (will have a look at iconv later) - borrowed from php.net
function phpbb_strtolower($string)
{
$new_string = '';
for ($i = 0; $i < strlen($string); $i++)
{
// Not sure about the offset, where is my ASCII Table ???
if (ord(substr($string, $i, 1)) > 0xa0)
{
$new_string .= strtolower(substr($string, $i, 2));
$i++;
}
else
{
$new_string .= strtolower(substr($string, $i, 1));
}
}
return $new_string;
}
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
@ -609,7 +585,76 @@ if (($submit) || ($preview) || ($refresh))
// notify and show user the post made between his request and the final submit
if ( ($mode == 'reply' || $mode == 'quote') && ($topic_cur_post_id != $topic_last_post_id) )
{
$template->assign_vars(array(
'S_POST_REVIEW' => true)
);
// Define censored word matches
if (empty($censors))
{
$censors = array();
obtain_word_list($censors);
}
// Go ahead and pull all data for the remaining posts
$sql = "SELECT u.username, u.user_id, p.*
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
AND p.post_id > " . $topic_cur_post_id . "
ORDER BY p.post_time DESC";
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
if ($row = $db->sql_fetchrow($result))
{
$i = 0;
do
{
$poster_id = $row['user_id'];
$poster = $row['username'];
// Handle anon users posting with usernames
if ($poster_id == ANONYMOUS && $row['post_username'] != '')
{
$poster = $row['post_username'];
$poster_rank = $user->lang['GUEST'];
}
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : '';
$message = $row['post_text'];
$message = (empty($row['enable_smilies']) || empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $message) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $message);
if (count($censors['match']))
{
$post_subject = preg_replace($censors['match'], $censors['replace'], $post_subject);
$message = preg_replace($censors['match'], $censors['replace'], $message);
}
$template->assign_block_vars('post_postrow', array(
'MINI_POST_IMG' => $user->img('icon_post', $user->lang['POST']),
'POSTER_NAME' => $poster,
'POST_DATE' => $user->format_date($row['post_time']),
'POST_SUBJECT' => $post_subject,
'MESSAGE' => nl2br($message),
'S_ROW_COUNT' => $i++)
);
}
while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'L_MESSAGE' => $user->lang['MESSAGE'],
'L_POSTED' => $user->lang['POSTED'],
'L_POST_SUBJECT'=> $user->lang['POST_SUBJECT'],
'L_POST_REVIEW' => $user->lang['POST_REVIEW'])
);
$submit = FALSE;
$refresh = TRUE;
}
// Grab md5 'checksum' of new message
@ -711,7 +756,7 @@ if (($submit) || ($preview) || ($refresh))
}
// Store message, sync counters
if (($err_msg == '') && ($submit))
if ($err_msg == '' && $submit)
{
// Lock/Unlock Topic
$change_topic_status = $topic_status;
@ -828,7 +873,7 @@ if ($subject)
}
// Save us some processing time. ;)
if (count($poll_options_tmp))
if (count($poll_options))
{
$poll_options_tmp = implode("\n", $poll_options);
decode_text($poll_options_tmp);
@ -1158,6 +1203,7 @@ function topic_review($topic_id, $is_inline_review = false)
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
WHERE p.topic_id = $topic_id
AND p.poster_id = u.user_id
" . (($greater_post_id != 0) ? " AND p.post_id > " . $greater_post_id : "") . "
ORDER BY p.post_time DESC";
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
@ -1228,5 +1274,25 @@ function topic_review($topic_id, $is_inline_review = false)
}
}
// Temp Function - strtolower (will have a look at iconv later) - borrowed from php.net
function phpbb_strtolower($string)
{
$new_string = '';
for ($i = 0; $i < strlen($string); $i++)
{
if (ord(substr($string, $i, 1)) > 0xa0)
{
$new_string .= strtolower(substr($string, $i, 2));
$i++;
}
else
{
$new_string .= strtolower(substr($string, $i, 1));
}
}
return $new_string;
}
?>

View File

@ -47,6 +47,59 @@ function checkForm()
</tr>
</table>
<!-- IF S_POST_REVIEW -->
<table class="tablebg" border="0" cellpadding="3" cellspacing="1" width="100%">
<tr>
<th height="28" align="center">{L_POST_REVIEW}</th>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td class="gen" align="center">{L_POST_REVIEW_EXPLAIN}</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td class="row1">
<table class="tablebg" width="100%" cellpadding="2" cellspacing="1" border="0">
<tr>
<th width="22%" height="26">{L_AUTHOR}</th>
<th>{L_MESSAGE}</th>
</tr>
<!-- BEGIN post_postrow -->
<!-- IF post_postrow.S_ROW_COUNT is even -->
<tr class="row1">
<!-- ELSE -->
<tr class="row2">
<!-- ENDIF -->
<td width="22%" align="left" valign="top"><span class="name"><a name="{post_postrow.U_POST_ID}"></a><b>{post_postrow.POSTER_NAME}</b></span></td>
<td height="28" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">{post_postrow.MINI_POST_IMG}<span class="postdetails">{L_POSTED}: {post_postrow.POST_DATE}<span class="gen">&nbsp;</span>&nbsp;&nbsp;&nbsp;{L_POST_SUBJECT}: {post_postrow.POST_SUBJECT}</span></td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td colspan="2"><span class="postbody">{post_postrow.MESSAGE}</span></td>
</tr>
</table></td>
</tr>
<tr>
<td class="spacer" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<!-- END post_postrow -->
</table>
</td>
</tr>
</table>
<br />
<!-- ENDIF -->
<!-- IF S_DISPLAY_PREVIEW --><!-- INCLUDE posting_preview.html --><!-- ENDIF -->
<table class="tablebg" width="100%" cellspacing="1" cellpadding="3" border="0">