aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2007-02-25 22:09:53 +0000
committerNils Adermann <naderman@naderman.de>2007-02-25 22:09:53 +0000
commitb66e0fcd34d3209ca86059d1737125699a726a7d (patch)
tree96f2a08d958122e7f0c4780c718694646ac4e846 /phpBB/includes/acp
parent424a520d0e3d8f668b70c632a8d787f004d8098b (diff)
downloadforums-b66e0fcd34d3209ca86059d1737125699a726a7d.tar
forums-b66e0fcd34d3209ca86059d1737125699a726a7d.tar.gz
forums-b66e0fcd34d3209ca86059d1737125699a726a7d.tar.bz2
forums-b66e0fcd34d3209ca86059d1737125699a726a7d.tar.xz
forums-b66e0fcd34d3209ca86059d1737125699a726a7d.zip
- fix htmlspecialchars handling in search (search backends get specialchared input, and should return specialchared output), current backends strip entities anyway [includes Bug #8156]
- allow cancelling search index creation/removal - custom CSS class name input too short [Bug #8328] - give an error message if a password wasn't convertable (special characters in non-standard encoding) - moved still_on_time to functions.php, used by acp_search and converter, might be useful for MODs (or complex cron scripts) - do not allow empty passwords on login - add sids to local URLs in posts (this was a really terrible bug to fix ;-)) [Bug #7892] - ignore invalid HTTP_X_FORWARDED_FOR headers (just use REMOTE_ADDR if invalid) [Bug #8314] - changed forum listing code on search page and acp_attachments [Bug #6658] - search indexing uses still_on_time(), smaller batch size (1000) and meta_refresh() instead of redirect(), this should solve a few problems [Bugs #8034, #8270] - made password requirement language strings clearer - ALPHA is not meant to be alphanumric [Bug #7764] - display bug in firefox on linux making the pagination wrap on search results page (caused by &nbsp;) git-svn-id: file:///svn/phpbb/trunk@7076 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r--phpBB/includes/acp/acp_attachments.php8
-rw-r--r--phpBB/includes/acp/acp_search.php234
2 files changed, 136 insertions, 106 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 23b67aadc7..81ecc4c963 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -766,6 +766,8 @@ class acp_attachments
if ($row['left_id'] > $cat_right)
{
+ // make sure we don't forget anything
+ $s_forum_id_options .= $holding;
$holding = '';
}
@@ -781,6 +783,12 @@ class acp_attachments
$holding = '';
}
}
+
+ if ($holding)
+ {
+ $s_forum_id_options .= $holding;
+ }
+
$db->sql_freeresult($result);
unset($padding_store);
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php
index 1dfda1b684..ab81721311 100644
--- a/phpBB/includes/acp/acp_search.php
+++ b/phpBB/includes/acp/acp_search.php
@@ -9,6 +9,16 @@
*/
/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+// make sure, a start time is saved
+still_on_time();
+
+/**
* @package acp
*/
class acp_search
@@ -17,7 +27,7 @@ class acp_search
var $state;
var $search;
var $max_post_id;
- var $batch_size = 5000;
+ var $batch_size = 1000;
function main($id, $mode)
{
@@ -143,7 +153,7 @@ class acp_search
if (!method_exists($search, 'init') || !($error = $search->init()))
{
set_config('search_type', $cfg_array['search_type']);
-
+
if (!$updated)
{
add_log('admin', 'LOG_CONFIG_SEARCH');
@@ -210,6 +220,13 @@ class acp_search
}
$this->state = explode(',', $config['search_indexing_state']);
+ if (isset($_POST['cancel']))
+ {
+ $action = '';
+ $this->state = array();
+ $this->save_state();
+ }
+
if ($action)
{
switch ($action)
@@ -218,15 +235,15 @@ class acp_search
$type = request_var('type', '');
$this->display_progress_bar($type);
break;
-
+
case 'delete':
$this->state[1] = 'delete';
break;
-
+
case 'create':
$this->state[1] = 'create';
break;
-
+
default:
trigger_error('NO_ACTION', E_USER_ERROR);
break;
@@ -243,10 +260,8 @@ class acp_search
{
trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);
}
-
- $action = &$this->state[1];
- @set_time_limit(0);
+ $action = &$this->state[1];
$this->max_post_id = $this->get_max_post_id();
@@ -254,116 +269,126 @@ class acp_search
$this->state[2] = &$post_counter;
$this->save_state();
- if ($action == 'delete')
+ switch ($action)
{
- if (method_exists($this->search, 'delete_index'))
- {
- // pass a reference to myself so the $search object can make use of save_state() and attributes
- if ($error = $this->search->delete_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=delete", false)))
+ case 'delete':
+ if (method_exists($this->search, 'delete_index'))
{
- $this->state = array('');
- $this->save_state();
- trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING);
+ // pass a reference to myself so the $search object can make use of save_state() and attributes
+ if ($error = $this->search->delete_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=delete", false)))
+ {
+ $this->state = array('');
+ $this->save_state();
+ trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING);
+ }
}
- }
- else
- {
- $sql = 'SELECT post_id, poster_id, forum_id
- FROM ' . POSTS_TABLE . '
- WHERE post_id >= ' . (int) ($post_counter + 1) . '
- AND post_id < ' . (int) ($post_counter + $this->batch_size);
- $result = $db->sql_query($sql);
-
- $ids = $posters = array();
- while ($row = $db->sql_fetchrow($result))
+ else
{
- $ids[] = $row['post_id'];
- $posters[] = $row['poster_id'];
- $forum_ids[] = $row['forum_id'];
- }
- $db->sql_freeresult($result);
+ while (still_on_time() && $post_counter <= $this->max_post_id)
+ {
+ $sql = 'SELECT post_id, poster_id, forum_id
+ FROM ' . POSTS_TABLE . '
+ WHERE post_id >= ' . (int) ($post_counter + 1) . '
+ AND post_id < ' . (int) ($post_counter + $this->batch_size);
+ $result = $db->sql_query($sql);
+
+ $ids = $posters = $forum_ids = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $ids[] = $row['post_id'];
+ $posters[] = $row['poster_id'];
+ $forum_ids[] = $row['forum_id'];
+ }
+ $db->sql_freeresult($result);
- if (sizeof($ids))
- {
- $this->search->index_remove($ids, $posters, $forum_ids);
+ if (sizeof($ids))
+ {
+ $this->search->index_remove($ids, $posters, $forum_ids);
+ }
+
+ $post_counter += $this->batch_size;
+
+ // save the current state
+ $this->save_state();
+ }
+
+ if ($post_counter <= $this->max_post_id)
+ {
+ meta_refresh(1, $this->u_action . '&amp;action=delete&amp;skip_rows=' . $post_counter);
+ trigger_error(sprintf($user->lang['SEARCH_INDEX_DELETE_REDIRECT'], $post_counter));
+ }
}
-
- $post_counter += $this->batch_size;
-
- // save the current state
+
+ $this->search->tidy();
+
+ $this->state = array('');
$this->save_state();
-
- if ($post_counter <= $this->max_post_id)
- {
- redirect($this->u_action . '&amp;action=delete');
- }
- }
-
- $this->search->tidy();
- $this->state = array('');
- $this->save_state();
+ trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js());
+ break;
- trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js());
- }
- else
- {
- if (method_exists($this->search, 'create_index'))
- {
- // pass a reference to myself so the $search object can make use of save_state() and attributes
- if ($error = $this->search->create_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=create", false)))
+ case 'create':
+ if (method_exists($this->search, 'create_index'))
{
- $this->state = array('');
- $this->save_state();
- trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING);
+ // pass a reference to acp_search so the $search object can make use of save_state() and attributes
+ if ($error = $this->search->create_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=create", false)))
+ {
+ $this->state = array('');
+ $this->save_state();
+ trigger_error($error . adm_back_link($this->u_action) . $this->close_popup_js(), E_USER_WARNING);
+ }
}
- }
- else
- {
- $sql = 'SELECT forum_id, enable_indexing
- FROM ' . FORUMS_TABLE;
- $result = $db->sql_query($sql, 3600);
-
- while ($row = $db->sql_fetchrow($result))
+ else
{
- $forums[$row['forum_id']] = (bool) $row['enable_indexing'];
- }
- $db->sql_freeresult($result);
+ $sql = 'SELECT forum_id, enable_indexing
+ FROM ' . FORUMS_TABLE;
+ $result = $db->sql_query($sql, 3600);
- $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
- FROM ' . POSTS_TABLE . '
- WHERE post_id >= ' . (int) ($post_counter + 1) . '
- AND post_id < ' . (int) ($post_counter + $this->batch_size);
- $result = $db->sql_query($sql);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $forums[$row['forum_id']] = (bool) $row['enable_indexing'];
+ }
+ $db->sql_freeresult($result);
- while ($row = $db->sql_fetchrow($result))
- {
- // Indexing enabled for this forum or global announcement?
- // Global announcements get indexed by default.
- if (!$row['forum_id'] || (isset($forums[$row['forum_id']]) && $forums[$row['forum_id']]))
+ while (still_on_time() && $post_counter <= $this->max_post_id)
{
- $this->search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
+ $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
+ FROM ' . POSTS_TABLE . '
+ WHERE post_id >= ' . (int) ($post_counter + 1) . '
+ AND post_id < ' . (int) ($post_counter + $this->batch_size);
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ // Indexing enabled for this forum or global announcement?
+ // Global announcements get indexed by default.
+ if (!$row['forum_id'] || (isset($forums[$row['forum_id']]) && $forums[$row['forum_id']]))
+ {
+ $this->search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
+ }
+ }
+ $db->sql_freeresult($result);
+
+ $post_counter += $this->batch_size;
+
+ // save the current state
+ $this->save_state();
+ }
+
+ if ($post_counter <= $this->max_post_id)
+ {
+ meta_refresh(1, $this->u_action . '&amp;action=create&amp;skip_rows=' . $post_counter);
+ trigger_error(sprintf($user->lang['SEARCH_INDEX_CREATE_REDIRECT'], $post_counter));
}
}
- $db->sql_freeresult($result);
- $post_counter += $this->batch_size;
-
- // save the current state
+ $this->search->tidy();
+
+ $this->state = array('');
$this->save_state();
-
- if ($post_counter <= $this->max_post_id)
- {
- redirect($this->u_action . '&amp;action=create');
- }
- }
-
- $this->search->tidy();
-
- $this->state = array('');
- $this->save_state();
- trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js());
+ trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js());
+ break;
}
}
@@ -469,14 +494,11 @@ class acp_search
function close_popup_js()
{
- /**
- * @todo remove Javascript
- */
- return '<script type="text/javascript">
- <!--
- close_waitscreen = 1;
- //-->
- </script>';
+ return "<script type=\"text/javascript\">\n" .
+ "<!--\n" .
+ " close_waitscreen = 1;\n" .
+ "//-->\n" .
+ "</script>\n";
}
function get_search_types()