1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

- automatically sync topic_reported when deleting a post [Bug #2152]

- retrieve forum information in report.php
- don't update deleted topics
- proper permission check for "admin or moderator"
- allow changing poster while ip dropdown contains a different user [Bug #2190]
- fixed a typo in acp_styles [Bug #2188]
- allow inserting BBCode at the first position of the textarea [Bug #2078]
- allow the style name to be different than the style path


git-svn-id: file:///svn/phpbb/trunk@6063 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann
2006-06-14 18:59:12 +00:00
parent 771d9f21cb
commit c9e971759d
10 changed files with 53 additions and 52 deletions

View File

@@ -1383,7 +1383,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
$imgsize_bool = (!empty($imgname) && ($imgsize || preg_match('#\*\d+#', $$imgname))) ? true : false;
$img_info = explode('*', $$imgname);
$img_info = explode('*', $imgname);
$template->assign_vars(array(
'S_EDIT_IMAGESET' => true,
@@ -1791,7 +1791,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
{
include($phpbb_root_path . 'includes/functions_compress.' . $phpEx);
$path = str_replace(' ', '_', $style_row[$mode . '_name']);
$path = $style_row[$mode . '_path'];
if ($format == 'zip')
{
@@ -1947,12 +1947,6 @@ pagination_sep = \'{PAGINATION_SEP}\'
if (!sizeof($error))
{
// Check if the character set is allowed
if (!preg_match('/^[a-z0-9_\-\+ ]+$/i', $name))
{
$error[] = $user->lang[$l_type . '_ERR_NAME_CHARS'];
}
// Check length settings
if (strlen($name) > 30)
{
@@ -2216,21 +2210,21 @@ pagination_sep = \'{PAGINATION_SEP}\'
/**
* Store template files into db
*/
function store_templates($mode, $style_id, $name, $filelist)
function store_templates($mode, $style_id, $template_path, $filelist)
{
global $phpbb_root_path, $phpEx, $db;
$path = str_replace(' ', '_', $name) . '/template/';
$template_path = $template_path . '/template/';
$includes = array();
foreach ($filelist as $pathfile => $file_ary)
{
foreach ($file_ary as $file)
{
if (!($fp = fopen("{$phpbb_root_path}styles/$path$pathfile$file", 'r')))
if (!($fp = fopen("{$phpbb_root_path}styles/$template_path$pathfile$file", 'r')))
{
trigger_error("Could not open {$phpbb_root_path}styles/$path$pathfile$file");
trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file");
}
$template_data = fread($fp, filesize("{$phpbb_root_path}styles/$path$pathfile$file"));
$template_data = fread($fp, filesize("{$phpbb_root_path}styles/$template_path$pathfile$file"));
fclose($fp);
if (preg_match_all('#<!-- INCLUDE (.*?\.html) -->#is', $template_data, $matches))
@@ -2257,10 +2251,10 @@ pagination_sep = \'{PAGINATION_SEP}\'
// heck of a lot of data ...
$sql_ary = array(
'template_id' => $style_id,
'template_filename' => "$pathfile$file",
'template_filename' => "$template_pathfile$file",
'template_included' => (isset($includes[$file])) ? implode(':', $includes[$file]) . ':' : '',
'template_mtime' => filemtime("{$phpbb_root_path}styles/$path$pathfile$file"),
'template_data' => file_get_contents("{$phpbb_root_path}styles/$path$pathfile$file"),
'template_mtime' => filemtime("{$phpbb_root_path}styles/$template_path$pathfile$file"),
'template_data' => file_get_contents("{$phpbb_root_path}styles/$template_path$pathfile$file"),
);
if ($mode == 'insert')
@@ -2447,11 +2441,11 @@ pagination_sep = \'{PAGINATION_SEP}\'
{
if ($mode == 'style')
{
$this->install_style($error, 'install', $root_path, $style_row['style_id'], $style_row['style_name'], $style_row['style_copyright'], $style_row['style_active'], $style_row['style_default'], $style_row);
$this->install_style($error, 'install', $root_path, $style_row['style_id'], $style_row['style_name'], $install_path, $style_row['style_copyright'], $style_row['style_active'], $style_row['style_default'], $style_row);
}
else
{
$style_row['store_db'] = $this->install_element($mode, $error, 'install', $root_path, $style_row[$mode . '_id'], $style_row[$mode . '_name'], $style_row[$mode . '_copyright'], $style_row['store_db']);
$style_row['store_db'] = $this->install_element($mode, $error, 'install', $root_path, $style_row[$mode . '_id'], $style_row[$mode . '_name'], $install_path, $style_row[$mode . '_copyright'], $style_row['store_db']);
}
if (!sizeof($error))
@@ -2707,7 +2701,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
/**
* Install/Add style
*/
function install_style(&$error, $action, $root_path, &$id, $name, $copyright, $active, $default, &$style_row)
function install_style(&$error, $action, $root_path, &$id, $name, $path, $copyright, $active, $default, &$style_row)
{
global $config, $db, $user;
@@ -2718,12 +2712,6 @@ pagination_sep = \'{PAGINATION_SEP}\'
$error[] = $user->lang['STYLE_ERR_STYLE_NAME'];
}
// Check if the character set is allowed
if (!preg_match('/^[a-z0-9_\-\+ ]+$/i', $name))
{
$error[] = $user->lang['STYLE_ERR_NAME_CHARS'];
}
// Check length settings
if (strlen($name) > 30)
{
@@ -2759,7 +2747,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
// and do the install if necessary
if (!$style_row[$element . '_id'])
{
$this->install_element($element, $error, $action, $root_path, $style_row[$element . '_id'], $style_row[$element . '_name'], $style_row[$element . '_copyright']);
$this->install_element($element, $error, $action, $root_path, $style_row[$element . '_id'], $style_row[$element . '_name'], $path, $style_row[$element . '_copyright']);
}
}
@@ -2808,7 +2796,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
/**
* Install/add an element, doing various checks as we go
*/
function install_element($mode, &$error, $action, $root_path, &$id, $name, $copyright, $store_db = 0)
function install_element($mode, &$error, $action, $root_path, &$id, $name, $path, $copyright, $store_db = 0)
{
global $phpbb_root_path, $db, $user;
@@ -2828,19 +2816,12 @@ pagination_sep = \'{PAGINATION_SEP}\'
}
$l_type = strtoupper($mode);
$path = str_replace(' ', '_', $name);
if (!$name)
{
$error[] = $user->lang[$l_type . '_ERR_STYLE_NAME'];
}
// Check if the character set is allowed
if (!preg_match('/^[a-z0-9_\-\+ ]+$/i', $name))
{
$error[] = $user->lang[$l_type . '_ERR_NAME_CHARS'];
}
// Check length settings
if (strlen($name) > 30)
{
@@ -2930,7 +2911,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
if ($mode == 'template' && $store_db)
{
$filelist = filelist("{$root_path}template", '', 'html');
$this->store_templates('insert', $id, $name, $filelist);
$this->store_templates('insert', $id, $path, $filelist);
}
$db->sql_transaction('commit');

View File

@@ -1157,7 +1157,8 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$sql = 'SELECT DISTINCT(post_id)
FROM ' . REPORTS_TABLE . '
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
WHERE post_id IN (' . implode(', ', $post_ids) . ')
AND report_closed = 0';
$result = $db->sql_query($sql);
$post_ids = array();

View File

@@ -18,10 +18,8 @@
* http://phpjabber.g-blog.net (not many doc comments in here, sorry)
*
* last modified: 27.04.2003 13:01:53 CET
*
*
* Modified by psoTFX, phpBB Group, 2003.
* Removed functions/support not critical to integration with phpBB
* Modified by members of the phpBB Group
*
* @package phpBB3
*/

View File

@@ -1139,7 +1139,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
if (!delete_posts('post_id', array($post_id), false, false))
{
// Try to delete topic, we may had an previous error causing inconsistency
if ($post_mode = 'delete_topic')
if ($post_mode == 'delete_topic')
{
delete_topics('topic_id', array($topic_id), false);
}
@@ -1148,7 +1148,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$db->sql_transaction('commit');
// Collect the necessary informations for updating the tables
// Collect the necessary information for updating the tables
$sql_data[FORUMS_TABLE] = '';
switch ($post_mode)
{
@@ -1168,8 +1168,6 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
$sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
}
$sql_data[TOPICS_TABLE] = 'topic_replies_real = topic_replies_real - 1' . (($data['post_approved']) ? ', topic_replies = topic_replies - 1' : '');
break;
case 'delete_first_post':
@@ -1291,6 +1289,11 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
}
}
if ($data['post_reported'] && ($post_mode != 'delete_topic'))
{
sync('topic_reported', 'topic_id', array($topic_id));
}
return $next_post_id;
}

View File

@@ -57,10 +57,16 @@ function mcp_post_details($id, $mode, $action)
case 'chgposter':
case 'chgposter_ip':
$username = request_var('username', '', true);
$new_user_id = request_var('u', 0);
$sql_where = ($new_user_id) ? 'user_id = ' . $new_user_id : "username = '" . $db->sql_escape($username) . "'";
if ($action == 'chgposter')
{
$username = request_var('username', '', true);
$sql_where = "username = '" . $db->sql_escape($username) . "'";
}
else
{
$new_user_id = request_var('u', 0);
$sql_where = 'user_id = ' . $new_user_id;
}
$sql = 'SELECT *
FROM ' . USERS_TABLE . '

View File

@@ -1113,7 +1113,7 @@ class parse_message extends bbcode_firstpass
if ($submit && in_array($mode, array('post', 'reply', 'quote', 'edit')) && $upload_file)
{
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_'))
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id))
{
$filedata = upload_attachment($form_name, $forum_id, false, '', $is_message);
$error = $filedata['error'];