diff --git a/phpBB/admin/admin_icons.php b/phpBB/admin/admin_icons.php index ca146a2d5f..90e63d7cf4 100644 --- a/phpBB/admin/admin_icons.php +++ b/phpBB/admin/admin_icons.php @@ -319,7 +319,6 @@ function update_image_dimensions() SET ' . $db->sql_build_array('UPDATE', $img_sql) . " WHERE " . $fields . "_id = $image_id"); $cache->destroy('icons'); - $cache->put('icons'); trigger_error($user->lang[$lang . '_EDITED']); } @@ -327,7 +326,6 @@ function update_image_dimensions() { $db->sql_query('INSERT INTO ' . $table . ' ' . $db->sql_build_array('INSERT', $img_sql)); $cache->destroy('icons'); - $cache->put('icons'); trigger_error($user->lang[$lang . '_ADDED']); } diff --git a/phpBB/admin/admin_prune.php b/phpBB/admin/admin_prune.php index 3031343e72..396e7c61f4 100644 --- a/phpBB/admin/admin_prune.php +++ b/phpBB/admin/admin_prune.php @@ -44,9 +44,7 @@ if (!$auth->acl_get('a_prune')) trigger_error($user->lang['NO_ADMIN']); } -// // Get the forum ID for pruning -// if (isset($_REQUEST['f'])) { $forum_id = intval($_REQUEST['f']); @@ -57,24 +55,9 @@ else $forum_id = ''; $forum_sql = ''; } -// -// Get a list of forum's or the data for the forum that we are pruning. -// -$sql = "SELECT forum_id, forum_name, left_id, right_id - FROM " . FORUMS_TABLE . " - ORDER BY left_id ASC"; -$result = $db->sql_query($sql); -$forum_rows = array(); -while($row = $db->sql_fetchrow($result)) -{ - $forum_rows[] = $row; -} -$db->sql_freeresult($result); -// // Check for submit to be equal to Prune. If so then proceed with the pruning. -// if (isset($_POST['doprune'])) { $prunedays = (isset($_POST['prunedays'])) ? intval($_POST['prunedays']) : 0; @@ -82,122 +65,138 @@ if (isset($_POST['doprune'])) // Convert days to seconds for timestamp functions... $prunedate = time() - ($prunedays * 86400); - $template->set_filenames(array( - 'body' => 'admin/forum_prune_result_body.tpl') - ); - - $log_data = ''; - for($i = 0; $i < count($forum_rows); $i++) - { - $p_result = prune($forum_rows[$i]['forum_id'], $prunedate); - sync('forum', $forum_rows[$i]['forum_id']); - - $template->assign_block_vars('prune_results', array( - 'ROW_COLOR' => '#' . $row_color, - 'ROW_CLASS' => $row_class, - 'FORUM_NAME' => $forum_rows[$i]['forum_name'], - 'FORUM_TOPICS' => $p_result['topics'], - 'FORUM_POSTS' => $p_result['posts']) - ); - - $log_data .= (($log_data != '') ? ', ' : '') . $forum_rows[$i]['forum_name']; - } - - $template->assign_vars(array( - 'L_FORUM_PRUNE' => $user->lang['Forum_Prune'], - 'L_FORUM' => $user->lang['Forum'], - 'L_TOPICS_PRUNED' => $user->lang['Topics_pruned'], - 'L_POSTS_PRUNED' => $user->lang['Posts_pruned'], - 'L_PRUNE_RESULT' => $user->lang['Prune_success']) - ); - - add_admin_log('log_prune', $log_data); - -} -else -{ - page_header($user->lang['Prune']); - - // - // If they haven't selected a forum for pruning yet then - // display a select box to use for pruning. - // - if (empty($forum_id)) - { - // - // Output a selection table if no forum id has been specified. - // - $select_list = ''; - - $right = 0; - $subforum = ''; - $forum_list = ''; - foreach ($forum_rows as $row) - { - if ($row['left_id'] < $right ) - { - $subforum .= '   '; - } - else if ($row['left_id'] > $right + 1) - { - $subforum = substr($subforum, 0, -18 * ($row['left_id'] - $right + 1)); - } - - $select_list .= ''; - - $right = $row['right_id']; - } + page_header($user->lang['PRUNE']); ?> -

lang['Prune']; ?>

+

lang['PRUNE']; ?>

-

lang['Forum_Prune_explain']; ?>

+

lang['PRUNE_SUCCESS']; ?>

-
"> +
- + + + - - - -
lang['Select_a_Forum']; ?>lang['FORUM']; ?>lang['TOPICS_PRUNED']; ?>lang['POSTS_PRUNED']; ?>
    
- sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $log_data = ''; + do + { + $p_result = prune($forum_rows[$i]['forum_id'], $prunedate); + sync('forum', $forum_rows[$i]['forum_id']); + + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; + +?> + + + + + +sql_fetchrow($result)); + + add_admin_log('log_prune', $log_data); + } else { - $forum_name = ($forum_id == -1) ? $user->lang['All_Forums'] : $forum_rows[0]['forum_name']; - $prune_data = $user->lang['Prune_topics_not_posted'] . " "; - $prune_data .= ' ' . $user->lang['Days']; +?> + + lang['NO_PRUNE']; ?> + +'; + } + $db->sql_freeresult($result); + +?> + + +
+ +lang['PRUNE']); ?> -

lang['Prune']; ?>

+

lang['PRUNE']; ?>

-

lang['Forum_Prune_explain']; ?>

+

lang['FORUM_PRUNE_EXPLAIN']; ?>

-

lang['Forum'] . ': ' . $forum_name; ?>

+"> +// If they haven't selected a forum for pruning yet then +// display a select box to use for pruning. +if (empty($forum_id)) +{ + + // Output a selection table if no forum id has been specified. + $select_list = '' . make_forum_select(false, false, false); + +?> + +
- + - - - - + + +
lang['Forum_Prune']; ?>lang['SELECT_FORUM']; ?>
    
+ +sql_query($sql); + + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_name = ($forum_id == -1) ? $user->lang['ALL_FORUMS'] : $row['forum_name']; + +?> + +

lang['FORUM'] . ': ' . $forum_name; ?>

+ +
+ + + + + + + +
lang['FORUM_PRUNE']; ?>
lang['PRUNE_NOT_POSTED'], ''); ?>
lang['No_word_selected']); + trigger_error($user->lang['NO_WORD']); } $sql = "SELECT * @@ -87,27 +87,29 @@ if ($mode != '') $result = $db->sql_query($sql); $word_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $s_hidden_fields .= ''; } - page_header($user->lang['Words_title']); + page_header($user->lang['WORDS_TITLE']); ?> -

lang['Words_title']; ?>

+

lang['WORDS_TITLE']; ?>

-

lang['Words_explain']; ?>

+

lang['WORDS_EXPLAIN']; ?>

"> - + - + - + @@ -127,17 +129,18 @@ if ($mode != '') if ($word == '' || $replacement == '') { - trigger_error($user->lang['Must_enter_word']); + trigger_error($user->lang['ENTER_WORD']); } - $sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . sql_quote($word) . "', replacement = '" . sql_quote($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . sql_quote($word) . "', '" . sql_quote($replacement) . "')"; + $sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . $db->sql_escape($word) . "', replacement = '" . $db->sql_escape($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . $db->sql_escape($word) . "', '" . $db->sql_escape($replacement) . "')"; $db->sql_query($sql); + $cache->destroy('word_censors'); $log_action = ($word_id) ? 'log_edit_word' : 'log_add_word'; add_admin_log($log_action, stripslashes($word)); - $message = ($word_id) ? $user->lang['Word_updated'] : $user->lang['Word_added']; + $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; break; case 'delete': @@ -148,17 +151,18 @@ if ($mode != '') } else { - trigger_error($user->lang['Must_specify_word']); + trigger_error($user->lang['NO_WORD']); } $sql = "DELETE FROM " . WORDS_TABLE . " WHERE word_id = $word_id"; $db->sql_query($sql); + $cache->destroy('word_censors'); add_admin_log('log_delete_word'); - $message = $user->lang['Word_remove']; + $message = $user->lang['WORD_REMOVE']; break; } @@ -168,41 +172,39 @@ if ($mode != '') ORDER BY word"; $result = $db->sql_query($sql); - $cache_str = "\$word_censors = array(\n"; - $cache_str_match = $cache_str_replace = ''; if ($row = $db->sql_fetchrow($result)) { + $censors = array(); do { - $cache_str_match .= "\t\t'" . addslashes('#\b' . str_replace('\*', '.*?', preg_quote($row['word'], '#')) . '\b#i') . "',\n"; - $cache_str_replace .= "\t\t'" . addslashes($row['replacement']) . "',\n"; + $censors['match'][] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i'; + $censors['replace'][] = $row['replacement']; } while ($row = $db->sql_fetchrow($result)); - $cache_str .= "\t'match' => array(\n$cache_str_match\t),\n\t'replace' => array(\n$cache_str_replace\t)\n);"; + $cache->put('word_censors', $censors); } $db->sql_freeresult($result); - config_cache_write('\$word_censors = array\(.*?\);', $cache_str); trigger_error($message); } else { - page_header($user->lang['Words_title']); + page_header($user->lang['WORDS_TITLE']); ?> -

lang['Words_title']; ?>

+

lang['WORDS_TITLE']; ?>

-

lang['Words_explain']; ?>

+

lang['WORDS_EXPLAIN']; ?>

-">
lang['Edit_word_censor']; ?>lang['EDIT_WORD']; ?>
lang['Word']; ?>lang['WORD']; ?>
lang['Replacement']; ?>lang['REPLACEMENT']; ?>
+
- - - + + + - + - +
lang['Word']; ?>lang['Replacement']; ?>lang['Action']; ?>lang['WORD']; ?>lang['REPLACEMENT']; ?>lang['ACTION']; ?>
 ">lang['Edit']; ?>  ">lang['EDIT']; ?>   ">lang['DELETE']; ?>