1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-01 12:05:37 +02:00

bump topic and orphan attachments

changes here and there...


git-svn-id: file:///svn/phpbb/trunk@4614 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2003-10-19 15:36:45 +00:00
parent de53ffabb4
commit e7c3370a04
13 changed files with 471 additions and 160 deletions

View File

@ -24,6 +24,7 @@ define('IN_PHPBB', 1);
$phpbb_root_path = '../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require('pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
if (!$auth->acl_get('a_attach'))
{
@ -85,7 +86,7 @@ while ($row = $db->sql_fetchrow($result))
if ($old_size != $new_size)
{
// See, if we have a similar value of old_size in Extension Groups. If so, update these values.
// check for similar value of old_size in Extension Groups. If so, update these values.
$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "
SET max_filesize = $new_size
WHERE max_filesize = $old_size";
@ -127,6 +128,14 @@ switch ($mode)
case 'ext_groups':
$l_title = 'EXTENSION_GROUPS_TITLE';
break;
case 'orphan':
$l_title = 'ORPHAN_ATTACHMENTS';
break;
default:
trigger_error('NO_MODE');
}
adm_page_header($user->lang[$l_title]);
@ -174,7 +183,7 @@ if ($submit && $mode == 'extensions')
{
// Change Extensions ?
$extension_change_list = (isset($_POST['extension_change_list'])) ? array_map('intval', $_POST['extension_change_list']) : array();
$extension_explain_list = request_var('extension_explain_list', ''); //(isset($_POST['extension_explain_list'])) ? array_map('trim', $_POST['extension_explain_list']) : array();
$extension_explain_list = request_var('extension_explain_list', '');
$group_select_list = (isset($_POST['group_select'])) ? array_map('intval', $_POST['group_select']) : array();
// Generate correct Change List
@ -209,11 +218,6 @@ if ($submit && $mode == 'extensions')
if (sizeof($extension_id_list))
{
$sql = 'DELETE
FROM ' . EXTENSIONS_TABLE . '
WHERE extension_id IN (' . implode(', ', $extension_id_list) . ')';
$db->sql_query($sql);
$sql = 'SELECT extension
FROM ' . EXTENSIONS_TABLE . '
WHERE extension_id IN (' . implode(', ', $extension_id_list) . ')';
@ -226,12 +230,17 @@ if ($submit && $mode == 'extensions')
}
$db->sql_freeresult($result);
$sql = 'DELETE
FROM ' . EXTENSIONS_TABLE . '
WHERE extension_id IN (' . implode(', ', $extension_id_list) . ')';
$db->sql_query($sql);
add_log('admin', 'LOG_ATTACH_EXT_DEL', $extension_list);
}
// Add Extension ?
$add_extension = strtolower(request_var('add_extension', '')); //(isset($_POST['add_extension'])) ? strtolower(trim(strip_tags($_POST['add_extension']))) : '';
$add_extension_explain = request_var('add_extension_explain', ''); //(isset($_POST['add_extension_explain'])) ? trim(strip_tags($_POST['add_extension_explain'])) : '';
$add_extension = strtolower(request_var('add_extension', ''));
$add_extension_explain = request_var('add_extension_explain', '');
$add_extension_group = request_var('add_group_select', 0);
$add = (isset($_POST['add_extension_check'])) ? TRUE : FALSE;
@ -241,7 +250,7 @@ if ($submit && $mode == 'extensions')
{
$sql = 'SELECT extension_id
FROM ' . EXTENSIONS_TABLE . "
WHERE extension = '$add_extension'";
WHERE extension = '" . $db->sql_escape($add_extension) . "'";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
@ -252,9 +261,13 @@ if ($submit && $mode == 'extensions')
if (!sizeof($error))
{
$sql = 'INSERT INTO ' . EXTENSIONS_TABLE . " (group_id, extension, comment)
VALUES ($add_extension_group, '" . $db->sql_escape($add_extension) . "', '" . $db->sql_escape($add_extension_explain) . "')";
$db->sql_query($sql);
$sql_ary = array(
'group_id' => $add_extension_group,
'extension' => $add_extension,
'comment' => $add_extension_explain
);
$db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
add_log('admin', 'LOG_ATTACH_EXT_ADD', $add_extension);
}
}
@ -270,13 +283,13 @@ if ($submit && $mode == 'ext_groups')
{
// Change Extension Groups ?
$group_change_list = (isset($_POST['group_change_list'])) ? array_map('intval', $_POST['group_change_list']) : array();
$extension_group_list = request_var('extension_group_list', ''); //(isset($_POST['extension_group_list'])) ? $_POST['extension_group_list'] : array();
$extension_group_list = request_var('extension_group_list', '');
$group_allowed_list = (isset($_POST['allowed_list'])) ? array_flip(array_map('intval', $_POST['allowed_list'])) : array();
$download_mode_list = (isset($_POST['download_mode_list'])) ? array_map('intval', $_POST['download_mode_list']) : array();
$category_list = (isset($_POST['category_list'])) ? array_map('intval', $_POST['category_list']) : array();
$upload_icon_list = request_var('upload_icon_list', ''); //(isset($_POST['upload_icon_list'])) ? $_POST['upload_icon_list'] : array();
$upload_icon_list = request_var('upload_icon_list', '');
$filesize_list = (isset($_POST['max_filesize_list'])) ? array_map('intval', $_POST['max_filesize_list']) : array();
$size_select_list = request_var('size_select_list', 'b'); //(isset($_POST['size_select_list'])) ? $_POST['size_select_list'] : array();
$size_select_list = request_var('size_select_list', 'b');
foreach ($group_change_list as $group_id => $var)
{
@ -302,16 +315,15 @@ if ($submit && $mode == 'ext_groups')
if (sizeof($group_delete_list))
{
$l_group_list = '';
$sql = 'SELECT group_name
FROM ' . EXTENSION_GROUPS_TABLE . '
WHERE group_id IN (' . implode(', ', $group_delete_list) . ')';
$result = $db->sql_query($sql);
$l_group_list = array();
while ($row = $db->sql_fetchrow($result))
{
$l_group_list .= (($l_group_list != '') ? ', ' : '') . $row['group_name'];
$l_group_list[] = $row['group_name'];
}
$db->sql_freeresult($result);
@ -321,12 +333,12 @@ if ($submit && $mode == 'ext_groups')
$db->sql_query($sql);
// Set corresponding Extensions to a pending Group
$sql = "UPDATE " . EXTENSIONS_TABLE . "
$sql ='"UPDATE ' . EXTENSIONS_TABLE . '
SET group_id = 0
WHERE group_id IN (" . implode(', ', $group_delete_list) . ")";
WHERE group_id IN (' . implode(', ', $group_delete_list) . ')';
$db->sql_query($sql);
add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $l_group_list);
add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', implode(', ', $l_group_list));
}
// Add Extensions Group ?
@ -343,7 +355,8 @@ if ($submit && $mode == 'ext_groups')
{
// check Extension Group
$sql = 'SELECT group_name
FROM ' . EXTENSION_GROUPS_TABLE;
FROM ' . EXTENSION_GROUPS_TABLE . "
WHERE group_name = '" . $db->sql_escape($extension_group) . "'";
$result = $db->sql_query_limit($sql, 1);
if ($row = $db->sql_fetchrow($result))
@ -410,7 +423,75 @@ if ($submit && $mode == 'ext_groups')
<p><?php echo $user->lang[$l_title . '_EXPLAIN']; ?></p>
<?php
<?php
if ($submit && $mode == 'orphan')
{
$delete_files = array_keys(request_var('delete', ''));
$add_files = array_keys(request_var('add', ''));
$post_ids = request_var('post_id', 0);
foreach ($delete_files as $delete)
{
phpbb_unlink($upload_dir . '/' . $delete);
}
if (sizeof($delete_files))
{
add_log('admin', sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files)));
$notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files));
}
$upload_list = array();
foreach ($add_files as $file)
{
if (!in_array($file, $delete_files) && $post_ids[$file])
{
$upload_list[$post_ids[$file]] = $file;
}
}
unset($add_files);
if (sizeof($upload_list))
{
?>
<h2><?php echo $user->lang['UPLOADING_FILES']; ?></h2>
<?php
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
$message_parser = new parse_message(0);
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE;
$result = $db->sql_query($sql);
$forum_names = array();
while ($row = $db->sql_fetchrow($result))
{
$forum_names[$row['forum_id']] = $row['forum_name'];
}
$db->sql_freeresult($result);
$sql = 'SELECT forum_id, topic_id, post_id
FROM ' . POSTS_TABLE . '
WHERE post_id IN (' . implode(', ', array_keys($upload_list)) . ')';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
echo sprintf($user->lang['UPLOADING_FILE_TO'], $upload_list[$row['post_id']], $row['post_id']) . '<br />';
if (!$auth->acl_get('f_attach', $row['forum_id']))
{
echo '<span style="color:red">' . sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) . '</span><br /><br />';
}
else
{
upload_file($row['post_id'], $row['topic_id'], $row['forum_id'], $upload_dir, $upload_list[$row['post_id']]);
}
}
}
}
if (sizeof($error))
{
?>
@ -433,14 +514,14 @@ if (sizeof($notify))
<?php
}
$modes = array('manage', 'cats', 'extensions', 'ext_groups');
$modes = array('manage', 'cats', 'extensions', 'ext_groups', 'orphan');
$select_size_mode = size_select('size', $size);
$select_quota_size_mode = size_select('quota_size', $quota_size);
$select_pm_size_mode = size_select('pm_size', $pm_size);
?>
<form action="admin_attachments.<?php echo "$phpEx$SID&amp;mode=$mode"; ?>" method="post">
<form name="attachments" method="post" action="admin_attachments.<?php echo "$phpEx$SID&amp;mode=$mode"; ?>">
<table cellspacing="1" cellpadding="0" border="0" align="center" width="99%">
<tr>
<td align="right"> &nbsp;&nbsp;
@ -469,6 +550,7 @@ $select_pm_size_mode = size_select('pm_size', $pm_size);
</table>
<?php
// Configuration
if ($mode == 'manage')
{
@ -541,6 +623,7 @@ if ($mode == 'manage')
<?php
}
// Special Categories
if ($mode == 'cats')
{
$sql = 'SELECT group_name, cat_id
@ -550,12 +633,12 @@ if ($mode == 'cats')
$result = $db->sql_query($sql);
$s_assigned_groups = array();
while ($row = $db->sql_fetchrow($result))
{
$s_assigned_groups[$row['cat_id']][] = $row['group_name'];
}
$db->sql_freeresult($result);
$display_inlined_yes = ($new['img_display_inlined']) ? 'checked="checked"' : '';
$display_inlined_no = (!$new['img_display_inlined']) ? 'checked="checked"' : '';
@ -618,6 +701,7 @@ if ($mode == 'cats')
<?php
}
// Extension Groups
if ($mode == 'ext_groups')
{
$img_path = $config['upload_icons_path'];
@ -629,10 +713,10 @@ if ($mode == 'ext_groups')
$filename_list = '';
foreach ($imglist as $key => $img)
{
$filename_list .= '<option value="' . htmlspecialchars($img) . '">' . $img . '</option>';
$filename_list .= '<option value="' . $img . '">' . htmlspecialchars($img) . '</option>';
}
$size = isset($_REQUEST['size']) ? intval($_REQUEST['size']) : 0;
$size = request_var('size', 0);
if (!$size && !$submit)
{
@ -817,6 +901,7 @@ if ($mode == 'ext_groups')
}
// Extensions
if ($mode == 'extensions')
{
?>
@ -874,6 +959,97 @@ if ($mode == 'extensions')
</table>
<?
}
// Orphan Attachments
if ($mode == 'orphan')
{
$attach_filelist = array();
$dir = @opendir($upload_dir);
while ($file = @readdir($dir))
{
if (is_file($upload_dir . '/' . $file) && filesize($upload_dir . '/' . $file) && $file != '.htaccess')
{
$attach_filelist[$file] = $file;
}
}
@closedir($dir);
?>
<script language="Javascript" type="text/javascript">
<!--
function marklist(match, name, status)
{
len = eval('document.' + match + '.length');
object = eval('document.' + match);
for (i = 0; i < len; i++)
{
result = eval('object.elements[' + i + '].name.search(/' + name + '.+/)');
if (result != -1)
object.elements[i].checked = status;
}
}
//-->
</script>
<?php
$sql = 'SELECT physical_filename
FROM ' . ATTACHMENTS_DESC_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
unset($attach_filelist[$row['physical_filename']]);
}
$db->sql_freeresult($result);
?>
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
<tr>
<th align="center" colspan="5">Orphan Attachments</th>
</tr>
<tr>
<td class="spacer" colspan="5" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<th>&nbsp;<?php echo $user->lang['FILENAME']; ?>&nbsp;</th>
<th>&nbsp;<?php echo $user->lang['FILESIZE']; ?>&nbsp;</th>
<th>&nbsp;<?php echo $user->lang['ATTACH_POST_ID']; ?>&nbsp;</th>
<th>&nbsp;<?php echo $user->lang['ATTACH_TO_POST']; ?>&nbsp;</th>
<th>&nbsp;<?php echo $user->lang['DELETE']; ?>&nbsp;</th>
</tr>
<?php
$i = 0;
foreach ($attach_filelist as $file)
{
$row_class = (++$i % 2 == 0) ? 'row2' : 'row1';
$filesize = @filesize($upload_dir . '/' . $file);
$size_lang = ($filesize >= 1048576) ? $user->lang['MB'] : ( ($filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] );
$filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize);
?>
<tr>
<td class="<?php echo $row_class; ?>"><a href="<?php echo $upload_dir . '/' . $file; ?>" class="gen" target="file"><?php echo $file; ?></a></td>
<td class="<?php echo $row_class; ?>"><?php echo $filesize . ' ' . $size_lang; ?></td>
<td class="<?php echo $row_class; ?>"><b class="gen">ID: </b><input type="text" name="post_id[<?php echo $file; ?>]" class="post" size="7" maxlength="10" value="<?php echo (!empty($post_ids[$file])) ? $post_ids[$file] : ''; ?>" /></td>
<td class="<?php echo $row_class; ?>"><input type="checkbox" name="add[<?php echo $file; ?>]" /></td>
<td class="<?php echo $row_class; ?>"><input type="checkbox" name="delete[<?php echo $file; ?>]" /></td>
</tr>
<?php
}
?>
<tr>
<td class="cat" colspan="3"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td>
<td class="cat" align="left"><b><span class="gensmall"><a href="javascript:marklist('attachments', 'add', true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('attachments', 'add', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b></td>
<td class="cat" align="left"><b><span class="gensmall"><a href="javascript:marklist('attachments', 'delete', true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('attachments', 'delete', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b></td>
</tr>
</table>
<?php
}
?>
</form>
@ -1066,28 +1242,72 @@ function download_select($select_name, $group_id = FALSE)
return($group_select);
}
// Get supported Image types
function get_supported_image_types()
// Upload already uploaded file... huh? are you kidding?
function upload_file($post_id, $topic_id, $forum_id, $upload_dir, $filename)
{
$types = array();
global $message_parser, $db, $user;
if (@extension_loaded('gd'))
$message_parser->attachment_data = array();
$message_parser->filename_data['filecomment'] = '';
$message_parser->filename_data['filename'] = $upload_dir . '/' . $filename;
$filedata = upload_attachment($filename, true, $upload_dir . '/' . $filename);
if ($filedata['post_attach'] && !sizeof($filedata['error']))
{
if (@function_exists('imagegif'))
{
$types[] = '1';
}
if (@function_exists('imagejpeg'))
{
$types[] = '2';
}
if (@function_exists('imagepng'))
{
$types[] = '3';
}
}
$message_parser->attachment_data = array(
'physical_filename' => $filedata['destination_filename'],
'real_filename' => $filedata['filename'],
'comment' => $message_parser->filename_data['filecomment'],
'extension' => $filedata['extension'],
'mimetype' => $filedata['mimetype'],
'filesize' => $filedata['filesize'],
'filetime' => $filedata['filetime'],
'thumbnail' => $filedata['thumbnail']
);
return ($types);
$message_parser->filename_data['filecomment'] = '';
$filedata['post_attach'] = FALSE;
// Submit Attachment
$attach_sql = $message_parser->attachment_data;
$db->sql_transaction();
$sql = 'INSERT INTO ' . ATTACHMENTS_DESC_TABLE . ' ' . $db->sql_build_array('INSERT', $attach_sql);
$db->sql_query($sql);
$attach_sql = array(
'attach_id' => $db->sql_nextid(),
'post_id' => $post_id,
'privmsgs_id' => 0,
'user_id_from' => $user->data['user_id'],
'user_id_to' => 0
);
$sql = 'INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $attach_sql);
$db->sql_query($sql);
$sql = 'UPDATE ' . POSTS_TABLE . "
SET post_attachment = 1
WHERE post_id = $post_id";
$db->sql_query($sql);
$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_attachment = 1
WHERE topic_id = $topic_id";
$db->sql_query($sql);
$db->sql_transaction('commit');
add_log('admin', sprintf($user->lang['LOG_ATTACH_FILEUPLOAD'], $post_id, $filename));
echo '<span style="color:green">' . $user->lang['SUCCESSFULLY_UPLOADED'] . '</span><br /><br />';
}
else if (sizeof($filedata['error']))
{
echo '<span style="color:red">' . sprintf($user->lang['ADMIN_UPLOAD_ERROR'], implode("<br />\t", $filedata['error'])) . '</span><br /><br />';
}
}
?>

View File

@ -97,6 +97,10 @@ while ($row = $db->sql_fetchrow($result))
$default_config[$config_name] = $config_value;
$new[$config_name] = request_var($config_name, $default_config[$config_name]);
if ($config_name == 'bump_interval' && $submit)
{
$new['bump_interval'] = request_var('bump_interval', 0) . request_var('bump_type', '');
}
if ($submit)
{
@ -375,6 +379,17 @@ switch ($mode)
$display_last_edited_yes = ($new['display_last_edited']) ? 'checked="checked"' : '';
$display_last_edited_no = (!$new['display_last_edited']) ? 'checked="checked"' : '';
$bump_type = (string) preg_replace('#^[0-9]+([m|h|d])$#', '\1', $new['bump_interval']);
$bump_time = (int) preg_replace('#^([0-9]+)[m|h|d]$#', '\1', $new['bump_interval']);
$s_bump_type = '';
$types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS');
foreach ($types as $type => $lang)
{
$selected = ($type == $bump_type) ? 'selected="selected" ' : '';
$s_bump_type .= '<option value="' . $type . '" ' . $selected . '>' . $user->lang[$lang] . '</option>';
}
?>
<tr>
<td class="row1" width="50%"><b><?php echo $user->lang['SITE_NAME']; ?>: </b></td>
@ -433,6 +448,10 @@ switch ($mode)
<td class="row1"><b><?php echo $user->lang['FLOOD_INTERVAL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FLOOD_INTERVAL_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="flood_interval" value="<?php echo $new['flood_interval']; ?>" /></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['BUMP_INTERVAL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BUMP_INTERVAL_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" size="3" maxlength="4" name="bump_interval" value="<?php echo $bump_time ?>" />&nbsp;<select name="bump_type"><?php echo $s_bump_type; ?></select></td>
</tr>
<tr>
<td class="row1"><b><?php echo $user->lang['TOPICS_PER_PAGE']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="topics_per_page" size="3" maxlength="4" value="<?php echo $new['topics_per_page']; ?>" /></td>

View File

@ -191,7 +191,6 @@ define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset');
define('TOPICS_TABLE', $table_prefix.'topics');
define('TOPICS_TRACK_TABLE', $table_prefix.'topics_marking');
define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch');
define('UCP_MODULES_TABLE', $table_prefix.'ucp_modules');
define('USER_GROUP_TABLE', $table_prefix.'user_group');
define('USERS_TABLE', $table_prefix.'users');
define('WORDS_TABLE', $table_prefix.'words');

View File

@ -652,7 +652,8 @@ function delete_attachments($post_id_array = -1, $attach_id_array = -1, $page =
$db->sql_freeresult($result);
}
// TODO - Return number of deleted attachments
// TODO
// Return number of deleted attachments
}
function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = TRUE)
@ -702,9 +703,11 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = TRUE)
// Delete File
function phpbb_unlink($filename, $mode = 'file')
{
global $config, $user;
global $config, $user, $phpbb_root_path;
$filename = ($mode == 'thumbnail') ? $config['upload_dir'] . '/thumbs/t_' . $filename : $config['upload_dir'] . '/' . $filename;
$upload_dir = ($config['upload_dir'][0] == '/' || ($config['upload_dir'][0] != '/' && $config['upload_dir'][1] == ':')) ? $config['upload_dir'] : $phpbb_root_path . $config['upload_dir'];
$filename = ($mode == 'thumbnail') ? $upload_dir . '/thumbs/t_' . $filename : $upload_dir . '/' . $filename;
$deleted = @unlink($filename);
if (file_exists($filename))

View File

@ -445,6 +445,8 @@ function display_attachments($attachment_data, &$update_count, $force_physical =
break;
}
$l_download_count = ($attachment['download_count'] == 0) ? $user->lang['DOWNLOAD_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang['DOWNLOAD_COUNT'], $attachment['download_count']) : sprintf($user->lang['DOWNLOAD_COUNTS'], $attachment['download_count']));
$template_array = array_merge($additional_array, array(
// 'IS_FLASH' => ($display_cat == SWF_CAT) ? true : false,
'IS_WM_STREAM' => ($display_cat == WM_CAT) ? true : false,
@ -461,7 +463,7 @@ function display_attachments($attachment_data, &$update_count, $force_physical =
'UPLOAD_IMG' => $upload_image,
'L_DOWNLOADED_VIEWED' => $l_downloaded_viewed,
'L_DOWNLOAD_COUNT' => sprintf($user->lang['DOWNLOAD_NUMBER'], $attachment['download_count']))
'L_DOWNLOAD_COUNT' => $l_download_count)
);
$template->assign_block_vars('postrow.attachment', $template_array);

View File

@ -47,7 +47,6 @@ function generate_smilies($mode, $forum_id)
FROM ' . SMILIES_TABLE . '
WHERE display_on_posting = 0';
$result = $db->sql_query_limit($sql, 1, 0, 3600);
$row = $db->sql_fetchrow($result);
if ($row = $db->sql_fetchrow($result))
{
@ -194,7 +193,7 @@ function update_last_post_information($type, $id)
}
// Upload Attachment - filedata is generated here
function upload_attachment($filename)
function upload_attachment($filename, $local = false, $local_storage = '')
{
global $auth, $user, $config, $db;
@ -208,8 +207,8 @@ function upload_attachment($filename)
}
$r_file = $filename;
$file = $_FILES['fileupload']['tmp_name'];
$filedata['mimetype'] = $_FILES['fileupload']['type'];
$file = (!$local) ? $_FILES['fileupload']['tmp_name'] : $local_storage;
$filedata['mimetype'] = (!$local) ? $_FILES['fileupload']['type'] : 'application/octet-stream';
// Opera add the name to the mime type
$filedata['mimetype'] = ( strstr($filedata['mimetype'], '; name') ) ? str_replace(strstr($filedata['mimetype'], '; name'), '', $filedata['mimetype']) : $filedata['mimetype'];
@ -239,7 +238,7 @@ function upload_attachment($filename)
}
// check php upload-size
if ( ($file == 'none') )
if ($file == 'none')
{
$filedata['error'][] = (@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;
@ -304,6 +303,7 @@ function upload_attachment($filename)
// Descide the Upload method
$upload_mode = (@ini_get('open_basedir') || @ini_get('safe_mode')) ? 'move' : 'copy';
$upload_mode = ($local) ? 'local' : $upload_mode;
// Ok, upload the File
$result = move_uploaded_attachment($upload_mode, $file, $filedata);
@ -319,40 +319,50 @@ function upload_attachment($filename)
// Move/Upload File - could be used for Avatars too ?
function move_uploaded_attachment($upload_mode, $source_filename, &$filedata)
{
global $user, $config;
global $user, $config, $phpbb_root_path;
$upload_dir = ($config['upload_dir'][0] == '/' || ($config['upload_dir'][0] != '/' && $config['upload_dir'][1] == ':')) ? $config['upload_dir'] : $phpbb_root_path . $config['upload_dir'];
$destination_filename = $filedata['destination_filename'];
$thumbnail = (isset($filedata['thumbnail'])) ? $filedata['thumbnail'] : FALSE;
switch ($upload_mode)
{
case 'copy':
if ( !@copy($source_filename, $config['upload_dir'] . '/' . $destination_filename) )
if ( !@copy($source_filename, $upload_dir . '/' . $destination_filename) )
{
if ( !@move_uploaded_file($source_filename, $config['upload_dir'] . '/' . $destination_filename) )
if ( !@move_uploaded_file($source_filename, $upload_dir . '/' . $destination_filename) )
{
return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename);
return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], $upload_dir . '/' . $destination_filename);
}
}
@chmod($config['upload_dir'] . '/' . $destination_filename, 0666);
@chmod($upload_dir . '/' . $destination_filename, 0666);
break;
case 'move':
if ( !@move_uploaded_file($source_filename, $config['upload_dir'] . '/' . $destination_filename) )
if ( !@move_uploaded_file($source_filename, $upload_dir . '/' . $destination_filename) )
{
if ( !@copy($source_file, $config['upload_dir'] . '/' . $destination_filename) )
if ( !@copy($source_file, $upload_dir . '/' . $destination_filename) )
{
return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], './' . $config['upload_dir'] . '/' . $destination_filename);
return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], $upload_dir . '/' . $destination_filename);
}
}
@chmod($config['upload_dir'] . '/' . $destination_filename, 0666);
@chmod($upload_dir . '/' . $destination_filename, 0666);
break;
case 'local':
if (!@copy($source_filename, $upload_dir . '/' . $destination_filename))
{
return sprintf($user->lang['GENERAL_UPLOAD_ERROR'], $upload_dir . '/' . $destination_filename);
}
@chmod($upload_dir . '/' . $destination_filename, 0666);
@unlink($source_filename);
break;
}
if ($filedata['thumbnail'])
{
$source = $config['upload_dir'] . '/' . $destination_filename;
$destination = $config['upload_dir'] . '/thumbs/t_' . $destination_filename;
$source = $upload_dir . '/' . $destination_filename;
$destination = $upload_dir . '/thumbs/t_' . $destination_filename;
if (!create_thumbnail($source, $destination, $filedata['mimetype']))
{

View File

@ -62,9 +62,8 @@ class parse_message
// Do some general 'cleanup' first before processing message,
// e.g. remove excessive newlines(?), smilies(?)
// Transform \r\n and \r into \n
$match = array('#\r\n?#', '#sid=[a-z0-9]*?&?#', "#([\n][\s]+){3,}#");
$match = array('#\r\n?#', '#sid=[a-z0-9]*?&amp;?#', "#([\n][\s]+){3,}#");
$replace = array("\n", '', "\n\n");
$this->message = trim(preg_replace($match, $replace, $this->message));
// Message length check
@ -78,17 +77,13 @@ class parse_message
if ($bbcode)
{
$this->bbcode_init();
if (!$allow_img)
$disallow = array('allow_img', 'allow_flash', 'allow_quote');
foreach ($disallow as $bool)
{
$this->bbcodes['img']['disabled'] = TRUE;
}
if (!$allow_flash)
{
$this->bbcodes['flash']['disabled'] = TRUE;
}
if (!$allow_quote)
{
$this->bbcodes['quote']['disabled'] = TRUE;
if (!$$bool)
{
$this->bbcodes[str_replace('allow_', '', $bool)]['disabled'] = TRUE;
}
}
$this->bbcode();
}

View File

@ -117,6 +117,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_yim_user','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_yim_pass','');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_interval','10h');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize','6144');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_min_width','20');
@ -169,6 +170,7 @@ INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_quote', 1);
INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_edit', 1);
INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_lock', 1);
INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_delete', 1);
INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_bump', 1);
INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_poll', 1);
INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_vote', 1);
INSERT INTO phpbb_auth_options (auth_option, is_local) VALUES ('f_votechg', 1);

View File

@ -134,6 +134,13 @@ $lang += array(
'LOG_LOAD_CONFIG' => '<b>Altered load settings</b>',
'LOG_ATTACH_CONFIG' => '<b>Altered attachment settings</b>',
'LOG_ATTACH_EXT_ADD' => '<b>Added or edited attachment extension</b><br />&#187; %s',
'LOG_ATTACH_EXT_DEL' => '<b>Removed attachment extension</b><br />&#187; %s',
'LOG_ATTACH_EXT_UPDATE' => '<b>Updated attachment extension</b><br />&#187; %s',
'LOG_ATTACH_EXTGROUP_ADD' => '<b>Added or edited extension group</b><br />&#187; %s',
'LOG_ATTACH_EXTGROUP_DEL' => '<b>Removed extension group</b><br />&#187; %s',
'LOG_ATTACH_FILEUPLOAD' => '<b>Orphan File uploaded to Post Number %1$d - %2$s</b>',
'LOG_ATTACH_ORPHAN_DEL' => '<b>Orphan Files deleted</b><br />&#187; %s',
'log_prune_user_deac' => '<b>Users Deactivated</b><br />%s',
'log_prune_user_del_del'=> '<b>Users Pruned and Posts Deleted</b><br />%s',
@ -155,11 +162,6 @@ $lang += array(
'LOG_ACL_GROUP_ADD' => '<b>Edited Group permissions</b><br />&#187; %s',
'LOG_ACL_PRESET_ADD' => '<b>Added or edited permission preset</b><br />&#187; %s',
'LOG_ACL_PRESET_DEL' => '<b>Deleted permission preset</b><br />&#187; %s',
'LOG_ATTACH_EXT_ADD' => '<b>Added or edited attachment extension</b><br />&#187; %s',
'LOG_ATTACH_EXT_DEL' => '<b>Removed attachment extension</b><br />&#187; %s',
'LOG_ATTACH_EXT_UPDATE' => '<b>Updated attachment extension</b><br />&#187; %s',
'LOG_ATTACH_EXTGROUP_ADD' => '<b>Added or edited extension group</b><br />&#187; %s',
'LOG_ATTACH_EXTGROUP_DEL' => '<b>Removed extension group</b><br />&#187; %s',
'LOG_FORUM_ADD' => '<b>Created new forum</b><br />&#187; %s',
'LOG_FORUM_MOVE_UP' => '<b>Moved forum</b> %s <b>above</b> %s',
@ -711,6 +713,8 @@ $lang += array(
'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts',
'FLOOD_INTERVAL' => 'Flood Interval',
'FLOOD_INTERVAL_EXPLAIN' => 'Number of seconds a user must wait between posting new messages. To enable users to ignore this alter their permissions.',
'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.',
'SEARCH_INTERVAL' => 'Search Flood Interval',
'SEARCH_INTERVAL_EXPLAIN' => 'Number of seconds users must wait between searches.',
'MIN_SEARCH_CHARS' => 'Min characters indexed by search',
@ -892,8 +896,10 @@ $lang += array(
'EXPORT_SMILE' => 'Create smilies pak',
'IMPORT_ICONS' => 'Install icons pak',
'EXPORT_ICONS' => 'Create icons pak',
'ADD_SMILE' => 'Add smilie',
'ADD_ICONS' => 'Add icon',
'ADD_SMILE' => 'Add smilies',
'ADD_ICONS' => 'Add icons',
'EDIT_SMILE' => 'Edit smilies',
'EDIT_ICONS' => 'Edit Icons',
'SMILE_NOT_DISPLAYED' => 'The following smilies are not displayed on the posting page',
'ICONS_NOT_DISPLAYED' => 'The following icons are not displayed on the posting page',
'EMOTION' => 'Emotion',
@ -911,11 +917,13 @@ $lang += array(
'SMILE_EMOTION' => 'Emotion',
'SMILE_ADD' => 'Add a new Smilie',
'SMILE_EDIT' => 'Edit Smilie',
'SMILE_LOCATION'=> 'Smilie location',
'ICONS_CONFIG' => 'Icon configuration',
'ICONS_URL' => 'Icon image file',
'ICONS_HEIGHT' => 'Icon height',
'ICONS_WIDTH' => 'Icon width',
'ICONS_ORDER' => 'Icon order',
'ICONS_LOCATION'=> 'Icon location',
'ICONS_ADD' => 'Add a new Icon',
'ICONS_EDIT' => 'Edit Icon',
'EXPORT_SMILE_EXPLAIN' => 'To create a package of your currently installed smilies, click %sHERE%s to download the emoticons.pak file. Once downloaded create a zip or tgz file containing all of your smilies plus this .pak configuration file.',
@ -1556,15 +1564,16 @@ $lang += array(
// Admin logs
$lang += array(
'ADMIN_LOGS_EXPLAIN' => 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'MOD_LOGS_EXPLAIN' => 'This lists the actions carried out by board moderators, select a forum from the drop down list. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. These log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'DISPLAY_LOG' => 'Display entries from previous',
'ALL_ENTRIES' => 'All entries',
'SORT_IP' => 'IP address',
'SORT_DATE' => 'Date',
'SORT_ACTION' => 'Log action',
'NO_ENTRIES' => 'No log entries for this period',
'ADMIN_LOGS_EXPLAIN' => 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'MOD_LOGS_EXPLAIN' => 'This lists the actions carried out by board moderators, select a forum from the drop down list. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. These log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.',
'DISPLAY_LOG' => 'Display entries from previous',
'ALL_ENTRIES' => 'All entries',
'SORT_IP' => 'IP address',
'SORT_DATE' => 'Date',
'SORT_ACTION' => 'Log action',
'NO_ENTRIES' => 'No log entries for this period',
);
// Attachments
@ -1577,6 +1586,9 @@ $lang += array(
'ATTACH_CATS_URL' => 'Special Categories',
'ATTACH_EXTENSIONS_URL' => 'Extensions',
'ATTACH_EXT_GROUPS_URL' => 'Extension Groups',
'ATTACH_ORPHAN_URL' => 'Orphan Attachments',
'ORPHAN_ATTACHMENTS' => 'Orphan Attachments', // Title
'ORPHAN_ATTACHMENTS_EXPLAIN'=> 'Here you are able to see files within the Attachments upload directory but not assigned to posts. This happens mostly if users are attaching files but not submitting the post. You are able to delete the files or attach them to existing posts. Attaching to posts requires a valid post id, you have to determine this id by yourself, this feature is mainly for those people wanting to upload files with another program and assigning those (mostly large) files to an existing post.',
'ATTACHMENT_SETTINGS' => 'Attachment Settings',
'ATTACHMENT_CONFIG_EXPLAIN' => 'Here you can configure the Main Settings for Attachments and the associated Special Categories.',
@ -1662,13 +1674,21 @@ $lang += array(
'EXTENSION_GROUP_EXIST' => 'The Extension Group %s already exist',
'MANAGE_EXTENSIONS' => 'Manage Extensions',
'MANAGE_EXTENSIONS_EXPLAIN' => 'Here you can manage your allowed extensions. To activate your Extensions, please refer to the extension groups management panel. It is not recommended to add scripting extensions (such as php, php3, php4, phtml, pl, cgi, asp, aspx...)',
'MANAGE_EXTENSIONS_EXPLAIN' => 'Here you can manage your allowed extensions. To activate your Extensions, please refer to the extension groups management panel. We strongly recommend not to allow scripting extensions (such as php, php3, php4, phtml, pl, cgi, asp, aspx...)',
'COMMENT' => 'Comment',
'EXTENSION' => 'Extension',
'ADD_EXTENSION' => 'Add extension',
'EXTENSIONS_UPDATED' => 'Extensions successfully updated',
'EXTENSION_EXIST' => 'The Extension %s already exist',
'NOT_ASSIGNED' => 'Not assigned',
'UPLOADING_FILES' => 'Uploading Files',
'UPLOADING_FILE_TO' => 'Uploading File "%1$s" to Post Number %2$d...',
'UPLOAD_DENIED_FORUM' => 'You do not have the permission to upload files to forum "%s"',
'ATTACH_POST_ID' => 'Post ID',
'ATTACH_TO_POST' => 'Attach file to post',
'SUCCESSFULLY_UPLOADED' => 'Succeessfully uploaded',
'ADMIN_UPLOAD_ERROR' => 'Errors while trying to attach file: %s'
);
// Installation

View File

@ -47,6 +47,7 @@ $lang = array(
'AUTHOR' => 'Author',
'TIME' => 'Time',
'HOURS' => 'Hours',
'MINUTES' => 'Minutes',
'MESSAGE' => 'Message',
'POST_TIME' => 'Post time',
'TOPIC_TIME' => 'Topic time',
@ -439,6 +440,7 @@ $lang += array(
'LOGIN_VIEWTOPIC' => 'The board administrator requires you to be registered and logged in to view this topic.',
'PRINT_TOPIC' => 'Print View',
'EMAIL_TOPIC' => 'Email Friend',
'BUMP_TOPIC' => 'Bump Topic',
'VIEW_NEXT_TOPIC' => 'Next topic',
'VIEW_PREVIOUS_TOPIC' => 'Previous topic',
'VIEW_UNREAD_POST' => 'First unread post',
@ -548,7 +550,7 @@ $lang += array(
'TOPIC_REVIEW' => 'Topic review',
'TOPIC_ICON' => 'Topic icon',
'POST_ICON' => 'Post icon',
'No_post_mode' => 'No post mode specified',
'NO_POST_MODE' => 'No post mode specified',
'POST_TOPIC' => 'Post a new topic',
'POST_REPLY' => 'Post a reply',
'POST_TOPIC_AS' => 'Post topic as',
@ -567,10 +569,10 @@ $lang += array(
'LOCK_POST_EXPLAIN' => 'Prevent editing',
'CONFIRM_DELETE' => 'Are you sure you want to delete this post?',
'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_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.',
'BUMP_ERROR' => 'You cannot bump this topic so soon after the last post.',
'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.',
'EMPTY_MESSAGE' => 'You must enter a message when posting.',
@ -588,6 +590,7 @@ $lang += array(
'USER_CANNOT_EDIT' => 'You cannot edit posts in this forum',
'USER_CANNOT_DELETE' => 'You cannot delete posts in this forum',
'USER_CANNOT_REPORT' => 'You cannot report posts in this forum',
'USER_CANNOT_BUMP' => 'You cannot bump topics in this forum',
'CANNOT_POST_STICKY' => 'Sorry but you cannot post sticky topics.',
'CANNOT_POST_ANNOUNCE' => 'Sorry but you cannot post announcements.',
'CANNOT_POST_NEWS' => 'Sorry but you cannot post news topics.',
@ -597,8 +600,6 @@ $lang += array(
'DELETE_OWN_POSTS' => 'Sorry but you can only delete your own posts.',
'ALREADY_DELETED' => 'Sorry but this message is already deleted.',
'No_such_post' => 'There is no such post, please return and try again',
'ADD_POLL' => 'Add a Poll',
'ADD_POLL_EXPLAIN' => 'If you do not want to add a poll to your topic leave the fields blank',
'POLL_QUESTION' => 'Poll question',
@ -647,7 +648,8 @@ $lang += array(
'POST_STORED' => 'Your message has been posted successfully',
'POST_STORED_MOD' => 'Your message has been saved but requires approval',
'DELETED' => 'Your message has been deleted successfully',
'POST_DELETED' => 'Your message has been deleted successfully',
'TOPIC_BUMPED' => 'Topic has been bumped successfully',
'Poll_delete' => 'Your poll has been deleted successfully',
'Topic_reply_notification' => 'Topic Reply Notification',
@ -678,7 +680,6 @@ $lang += array(
'FILE_NOT_FOUND_404' => 'The file <b>%s</b> does not exist.',
'DOWNLOADED' => 'Downloaded',
'VIEWED' => 'Viewed',
'DOWNLOAD_NUMBER' => '%d Time(s)', // replace %d with count <-- NEEDS CHANGING TO FOLLOWING
'DOWNLOAD_NONE' => '0 Times', // replace %d with count
'DOWNLOAD_COUNT' => '%d Time', // replace %d with count
'DOWNLOAD_COUNTS' => '%d Times', // replace %d with count

View File

@ -71,6 +71,7 @@ switch ($mode)
WHERE forum_id = $forum_id";
break;
case 'bump':
case 'reply':
if (!$topic_id)
{
@ -107,7 +108,7 @@ switch ($mode)
default:
$sql = '';
trigger_error('NO_MODE');
trigger_error('NO_POST_MODE');
}
$censors = array();
@ -264,7 +265,6 @@ if (($forum_status == ITEM_LOCKED || $topic_status == ITEM_LOCKED) && !$auth->ac
trigger_error($message);
}
// Can we edit this post?
if (($mode == 'edit' || $mode == 'delete') && !$auth->acl_get('m_edit', $forum_id) && $config['edit_time'] && $post_time < time() - $config['edit_time'])
{
@ -313,12 +313,12 @@ if ($mode == 'delete' && (($poster_id == $user->data['user_id'] && $user->data['
if ($topic_first_post_id == $topic_last_post_id)
{
$meta_info = "viewforum.$phpEx$SID&amp;f=$forum_id";
$message = $user->lang['DELETED'];
$message = $user->lang['POST_DELETED'];
}
else
{
$meta_info = "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;p=$next_post_id#$next_post_id";
$message = $user->lang['DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;p=$next_post_id#$next_post_id\">", '</a>');
$message = $user->lang['POST_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;p=$next_post_id#$next_post_id\">", '</a>');
}
meta_refresh(3, $meta_info);
@ -377,6 +377,55 @@ $flash_status = ($auth->acl_get('f_flash', $forum_id)) ? TRUE : FALSE;
$quote_status = ($config['allow_quote'] && $auth->acl_get('f_quote', $forum_id)) ? TRUE : FALSE;
// Bump Topic
if ($mode == 'bump' && !$auth->acl_get('f_bump', $forum_id))
{
trigger_error('USER_CANNOT_BUMP');
}
else if ($mode == 'bump')
{
// Check bump time range, is the user really allowed to bump the topic at this time?
$bump_type = (string) preg_replace('#^[0-9]+([m|h|d])$#', '\1', $config['bump_time_range']);
$bump_time = (int) preg_replace('#^([0-9]+)[m|h|d]$#', '\1', $config['bump_time_range']);
$bump_time = ($bump_type == 'm') ? $bump_time*60 : (($bump_type == 'h') ? $bump_time*3600 : $bump_time*86400);
if ($topic_last_post_time + $bump_time > time())
{
trigger_error('BUMP_ERROR');
}
$current_time = time();
$db->sql_transaction();
$db->sql_query('UPDATE ' . POSTS_TABLE . "
SET post_time = $current_time
WHERE post_id = $topic_last_post_id
AND topic_id = $topic_id");
$db->sql_query('UPDATE ' . TOPICS_TABLE . "
SET topic_last_post_time = $current_time
WHERE topic_id = $topic_id");
$db->sql_query('UPDATE ' . FORUMS_TABLE . '
SET ' . implode(', ', update_last_post_information('forum', $forum_id)) . "
WHERE forum_id = $forum_id");
$db->sql_query('UPDATE ' . USERS_TABLE . "
SET user_lastpost_time = $current_time
WHERE user_id = " . $user->data['user_id']);
$db->sql_transaction('commit');
markread('post', $forum_id, $topic_id, $current_time);
meta_refresh(3, "viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id&amp;p=$topic_last_post_id#$topic_last_post_id");
$message = $user->lang['TOPIC_BUMPED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="viewtopic.' . $phpEx . $SID . "&amp;f=$forum_id&amp;t=$topic_id&amp;p=$topic_last_post_id#$topic_last_post_id\">", '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="viewforum.' . $phpEx . $SID .'&amp;f=' . $forum_id . '">', '</a>');
trigger_error($message);
}
// Save Draft
if (($save || isset($_POST['draft_save'])) && $user->data['user_id'] != ANONYMOUS && $auth->acl_get('u_savedrafts'))
{
@ -467,11 +516,7 @@ if ($submit || $preview || $refresh)
if ($poll_delete && (($mode == 'edit' && !empty($poll_options) && empty($poll_last_vote) && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
{
// Delete Poll
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . "
WHERE topic_id = $topic_id";
$db->sql_query($sql);
$sql = 'DELETE FROM ' . POLL_VOTES_TABLE . "
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ', ' . POLL_VOTES_TABLE . "
WHERE topic_id = $topic_id";
$db->sql_query($sql);
@ -522,7 +567,7 @@ if ($submit || $preview || $refresh)
if ($mode != 'edit' || $message_md5 != $post_checksum || $status_switch || $preview)
{
// Parse message
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status);
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, $auth->acl_get('f_quote', $forum_id));
}
$message_parser->parse_attachments($mode, $post_id, $submit, $preview, $refresh);
@ -1289,37 +1334,33 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
if (sizeof($update_notification['topic']))
{
$sql = 'UPDATE ' . TOPICS_WATCH_TABLE . "
$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . "
SET notify_status = 1
WHERE topic_id = $topic_id
AND user_id IN (" . implode(', ', $update_notification['topic']) . ")";
$db->sql_query($sql);
AND user_id IN (" . implode(', ', $update_notification['topic']) . ")");
}
if (sizeof($update_notification['forum']))
{
$sql = 'UPDATE ' . FORUMS_WATCH_TABLE . "
$db->sql_query('UPDATE ' . FORUMS_WATCH_TABLE . "
SET notify_status = 1
WHERE forum_id = $forum_id
AND user_id IN (" . implode(', ', $update_notification['forum']) . ")";
$db->sql_query($sql);
AND user_id IN (" . implode(', ', $update_notification['forum']) . ")");
}
// Now delete the user_ids not authorized to receive notifications on this topic/forum
if (sizeof($delete_ids['topic']))
{
$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . "
$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . "
WHERE topic_id = $topic_id
AND user_id IN (" . implode(', ', $delete_ids['topic']) . ")";
$db->sql_query($sql);
AND user_id IN (" . implode(', ', $delete_ids['topic']) . ")");
}
if (sizeof($delete_ids['forum']))
{
$sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . "
$db->sql_query('DELETE FROM ' . FORUMS_WATCH_TABLE . "
WHERE forum_id = $forum_id
AND user_id IN (" . implode(', ', $delete_ids['forum']) . ")";
$db->sql_query($sql);
AND user_id IN (" . implode(', ', $delete_ids['forum']) . ")");
}
$db->sql_transaction('commit');
@ -1571,26 +1612,23 @@ function delete_post($mode, $post_id, $topic_id, $forum_id, $data)
if (isset($sql_data['forum']) && $sql_data['forum'] != '')
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
$db->sql_query('UPDATE ' . FORUMS_TABLE . '
SET ' . $sql_data['forum'] . "
WHERE forum_id = $forum_id";
$db->sql_query($sql);
WHERE forum_id = $forum_id");
}
if (isset($sql_data['topic']) && $sql_data['topic'] != '')
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
SET ' . $sql_data['topic'] . "
WHERE topic_id = $topic_id";
$db->sql_query($sql);
WHERE topic_id = $topic_id");
}
if (isset($sql_data['user']) && $sql_data['user'] != '')
{
$sql = 'UPDATE ' . USERS_TABLE . '
$db->sql_query('UPDATE ' . USERS_TABLE . '
SET ' . $sql_data['user'] . '
WHERE user_id = ' . $data['poster_id'];
$db->sql_query($sql);
WHERE user_id = ' . $data['poster_id']);
}
$db->sql_transaction('commit');
@ -1755,7 +1793,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
break;
}
$db->sql_transaction();
// $db->sql_transaction();
// Submit new topic
if ($post_mode == 'post')
@ -1838,19 +1876,17 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
// Update the topics table
if (isset($sql_data['topic']['sql']))
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_data['topic']['sql']) . '
WHERE topic_id = ' . $data['topic_id'];
$db->sql_query($sql);
WHERE topic_id = ' . $data['topic_id']);
}
// Update the posts table
if (isset($sql_data['post']['sql']))
{
$sql = 'UPDATE ' . POSTS_TABLE . '
$db->sql_query('UPDATE ' . POSTS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_data['post']['sql']) . '
WHERE post_id = ' . $data['post_id'];
$db->sql_query($sql);
WHERE post_id = ' . $data['post_id']);
}
// Update Poll Tables and Attachment Entries
@ -1959,7 +1995,7 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
}
$db->sql_transaction('commit');
// $db->sql_transaction('commit');
if ($post_mode == 'post' || $post_mode == 'reply' || $post_mode == 'edit_last_post')
{
@ -2013,34 +2049,30 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
if (implode('', $sql_data['post']['stat']) != '')
{
$sql = 'UPDATE ' . POSTS_TABLE . '
$db->sql_query('UPDATE ' . POSTS_TABLE . '
SET ' . implode(', ', $sql_data['post']['stat']) . '
WHERE post_id = ' . $data['post_id'];
$db->sql_query($sql);
WHERE post_id = ' . $data['post_id']);
}
if (implode('', $sql_data['topic']['stat']) != '')
{
$sql = 'UPDATE ' . TOPICS_TABLE . '
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
SET ' . implode(', ', $sql_data['topic']['stat']) . '
WHERE topic_id = ' . $data['topic_id'];
$db->sql_query($sql);
WHERE topic_id = ' . $data['topic_id']);
}
if (implode('', $sql_data['forum']['stat']) != '')
{
$sql = 'UPDATE ' . FORUMS_TABLE . '
$db->sql_query('UPDATE ' . FORUMS_TABLE . '
SET ' . implode(', ', $sql_data['forum']['stat']) . '
WHERE forum_id = ' . $data['forum_id'];
$db->sql_query($sql);
WHERE forum_id = ' . $data['forum_id']);
}
if (implode('', $sql_data['user']['stat']) != '')
{
$sql = 'UPDATE ' . USERS_TABLE . '
$db->sql_query('UPDATE ' . USERS_TABLE . '
SET ' . implode(', ', $sql_data['user']['stat']) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
WHERE user_id = ' . $user->data['user_id']);
}
// Fulltext parse

View File

@ -28,9 +28,10 @@
<td class="cat" colspan="2" height="28"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="nav" nowrap="nowrap">&nbsp;
<!-- IF S_WATCH_TOPIC -->{S_WATCH_TOPIC} | <!-- ENDIF -->
<!-- IF U_PRINT_TOPIC --><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}">{L_PRINT_TOPIC}</a> | <!-- ENDIF -->
<!-- IF U_EMAIL_TOPIC --><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}">{L_EMAIL_TOPIC}</a><!-- ENDIF -->
<!-- IF S_WATCH_TOPIC -->{S_WATCH_TOPIC}<!-- IF U_PRINT_TOPIC or U_EMAIL_TOPIC or U_BUMP_TOPIC --> | <!-- ENDIF --><!-- ENDIF -->
<!-- IF U_PRINT_TOPIC --><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}">{L_PRINT_TOPIC}</a><!-- IF U_EMAIL_TOPIC or U_BUMP_TOPIC --> | <!-- ENDIF --><!-- ENDIF -->
<!-- IF U_EMAIL_TOPIC --><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}">{L_EMAIL_TOPIC}</a><!-- IF U_BUMP_TOPIC --> | <!-- ENDIF --><!-- ENDIF -->
<!-- IF U_BUMP_TOPIC --><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}">{L_BUMP_TOPIC}</a><!-- ENDIF -->
</td>
<td class="nav" align="right" nowrap="nowrap"><a href="{U_VIEW_OLDER_TOPIC}">{L_VIEW_PREVIOUS_TOPIC}</a> | <a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> | <a href="{U_VIEW_NEWER_TOPIC}">{L_VIEW_NEXT_TOPIC}</a>&nbsp;</td>
</tr>

View File

@ -162,7 +162,7 @@ if ($user->data['user_id'] != ANONYMOUS)
// whereupon we join on the forum_id passed as a parameter ... this
// is done so navigation, forum name, etc. remain consistent with where
// user clicked to view a global topic
$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . '
$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, ' . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . ', t.topic_last_post_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style, f.forum_password' . $extra_fields . '
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . "
WHERE $join_sql
AND (f.forum_id = t.forum_id
@ -446,6 +446,12 @@ if (sizeof($censors))
$topic_title = preg_replace($censors['match'], $censors['replace'], $topic_title);
}
// Bump topic allowed?
$bump_type = (string) preg_replace('#^[0-9]+([m|h|d])$#', '\1', $config['bump_time_range']);
$bump_time = (int) preg_replace('#^([0-9]+)[m|h|d]$#', '\1', $config['bump_time_range']);
$bump_time = ($bump_type == 'm') ? $bump_time*60 : (($bump_type == 'h') ? $bump_time*3600 : $bump_time*86400);
unset($bump_type);
// Send vars to template
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
@ -501,7 +507,8 @@ $template->assign_vars(array(
'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? "memberlist.$phpEx$SID&amp;mode=email&amp;t=$topic_id" : '',
'U_POST_NEW_TOPIC' => "posting.$phpEx$SID&amp;mode=post&amp;f=$forum_id",
'U_POST_REPLY_TOPIC' => "posting.$phpEx$SID&amp;mode=reply&amp;f=$forum_id&amp;t=$topic_id")
'U_POST_REPLY_TOPIC' => "posting.$phpEx$SID&amp;mode=reply&amp;f=$forum_id&amp;t=$topic_id",
'U_BUMP_TOPIC' => ($topic_last_post_time + $bump_time < time() && $auth->acl_get('f_bump', $forum_id)) ? "posting.$phpEx$SID&amp;mode=bump&amp;f=$forum_id&amp;t=$topic_id" : '')
);
// Does this topic contain a poll?