diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php index 915a63a56f..25e6ced71c 100644 --- a/phpBB/admin/admin_forums.php +++ b/phpBB/admin/admin_forums.php @@ -168,6 +168,7 @@ switch ($mode) $forum_style = (!empty($_POST['forum_style'])) ? intval($_POST['forum_style']) : 'NULL'; $post_count_inc = (!empty($_POST['disable_post_count'])) ? 0 : 1; + $moderated = (!empty($_POST['moderated'])) ? 1 : 0; $prune_enable = (!empty($_POST['prune_enable'])) ? 1 : 0; $prune_days = intval($_POST['prune_days']); @@ -198,8 +199,8 @@ switch ($mode) $right_id = $left_id + 1; } - $sql = 'INSERT INTO ' . FORUMS_TABLE . " (forum_id, forum_name, forum_desc, parent_id, left_id, right_id, forum_status, forum_style, post_count_inc, prune_enable, prune_days, prune_freq) - VALUES ($forum_id, '$forum_name', '$forum_desc', $parent_id, $left_id, $right_id, $forum_status, $forum_style, $post_count_inc, $prune_enable, $prune_days, $prune_freq)"; + $sql = 'INSERT INTO ' . FORUMS_TABLE . " (forum_id, forum_name, forum_desc, parent_id, left_id, right_id, forum_status, forum_style, post_count_inc, moderate, prune_enable, prune_days, prune_freq) + VALUES ($forum_id, '$forum_name', '$forum_desc', $parent_id, $left_id, $right_id, $forum_status, $forum_style, $post_count_inc, $moderated, $prune_enable, $prune_days, $prune_freq)"; $db->sql_query($sql); $message = $user->lang['Forums_updated'] . "

" . sprintf($user->lang['Click_return_forumadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); @@ -231,8 +232,9 @@ switch ($mode) 'prune_enable' => (!empty($_POST['prune_enable'])) ? 1 : 0, 'prune_days' => intval($_POST['prune_days']), 'prune_freq' => intval($_POST['prune_freq']), - 'display_on_index' => (!isset($_POST['display_on_index']) || !empty($_POST['display_on_index'])) ? 1 : 0, - 'post_count_inc' => (!empty($_POST['disable_post_count'])) ? 0 : 1 + 'display_on_index' => (!empty($_POST['display_on_index'])) ? 1 : 0, + 'post_count_inc' => (!empty($_POST['disable_post_count'])) ? 0 : 1, + 'moderated' => (!empty($_POST['moderated'])) ? 1 : 0, ); if (!empty($_POST['set_category']) && $action) @@ -249,8 +251,8 @@ switch ($mode) $sql['forum_posts'] = 0; $sql['forum_topics'] = 0; } - - $db->sql_query_array('UPDATE ' . FORUMS_TABLE . " SET WHERE forum_id = $forum_id", $sql); +echo 'UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . " WHERE forum_id = $forum_id"; + $db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . " WHERE forum_id = $forum_id"); $message = $user->lang['Forums_updated'] . "

" . sprintf($user->lang['Click_return_forumadmin'], '', '') . '

' . sprintf($user->lang['Click_return_admin_index'], '', ''); message_die(MESSAGE, $message); @@ -400,6 +402,7 @@ switch ($mode) $forum_name = (!empty($_POST['forum_name'][$parent_id])) ? htmlspecialchars($_POST['forum_name'][$parent_id]) : ''; $post_count_inc = TRUE; + $moderated = FALSE; $prune_enabled = ''; $prune_days = 7; @@ -424,117 +427,136 @@ switch ($mode)

lang['Forum_edit_delete_explain'] ?>

-
" method="post"> - - - - - - - - - - - +" method="post">
lang['General_settings'] ?>
lang['Forum_name'] : $user->lang['Category_name'] ?>
lang['Forum_desc'] ?>
+ + + + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + - - - - + + + + - - - - + + + + - - - -
lang['General_settings'] ?>
lang['Forum_name'] : $user->lang['Category_name'] ?>
lang['Forum_desc'] ?>
lang['Forum_type'] ?>/>lang['Forum'] ?>   />lang['Category'] ?>
lang['Forum_type'] ?>/>lang['Forum'] ?>   />lang['Category'] ?>
lang['Parent'] ?>
lang['Style'] ?>
lang['Parent'] ?>
lang['Style'] ?>
lang['Forum_settings'] ?>
lang['Forum_status'] ?>
lang['Options'] ?> - />lang['Disable_post_count'] ?> +
lang['Forum_settings'] ?>
lang['Forum_status'] ?>
lang['Options'] ?> + + + + + + 0) { - // // if this forum is a subforum put the "display on index" checkbox - // if ($parent_info = get_forum_info($parent_id)) { if ($parent_info['parent_id'] > 0 || $parent_info['forum_status'] != ITEM_CATEGORY) { + ?> -
- />lang['Display_on_index'] ?> + + + - +
/> lang['Disable_post_count'] ?>
/> lang['Forum_is_moderated']; ?>
/> lang['Display_on_index'] ?>
+
lang['Forum_type'] ?>lang['Set_as_category'] ?>
-      lang['Delete_all_posts'] ?>
-      lang['Move_posts_to'] ?> -
lang['Forum_type'] ?> + + + + + + + + + +
lang['Set_as_category'] ?>
      lang['Delete_all_posts'] ?>
      lang['Move_posts_to'] ?>
lang['Forum_pruning'] ?> - - - - - - - - - - - - -
lang['Enabled'] ?>/>
lang['prune_days'] ?>  lang['Days'] ?>
lang['prune_freq'] ?>  lang['Days'] ?>
lang['Forum_pruning'] ?> + + + + + + + + + + + + +
lang['Enabled'] ?>/>
lang['prune_days'] ?>  lang['Days'] ?>
lang['prune_freq'] ?>  lang['Days'] ?>
-
+ + + +
acl_get('a_general')) // // Check to see what mode we should operate in. // +if (isset($_POST['type']) || isset($_GET['type'])) +{ + $type = (!empty($_POST['type'])) ? $_POST['type'] : $_GET['type']; +} +else +{ + $type = ''; +} + if (isset($_POST['mode']) || isset($_GET['mode'])) { $mode = (!empty($_POST['mode'])) ? $_POST['mode'] : $_GET['mode']; @@ -60,25 +70,40 @@ else $mode = ''; } +switch ($type) +{ + case 'emoticons': + $table = SMILIES_TABLE; + $lang = 'smilies'; + $path = $config['smilies_path']; + break; + + case 'icons': + $table = ICONS_TABLE; + $lang = 'icons'; + $path = $config['icons_path']; + break; +} + $delimiter = '=+:'; -$smilies_images = $smilies_paks = array(); +$_images = $_paks = array(); if ($mode == 'edit' || !empty($_POST['add']) || !empty($_POST['import_pak'])) { - $dir = @opendir($phpbb_root_path . $board_config['smilies_path']); + $dir = @opendir($phpbb_root_path . $path); while ($file = @readdir($dir)) { - if (is_file($phpbb_root_path . $board_config['smilies_path'] . '/' . $file)) + if (is_file($phpbb_root_path . $path . '/' . $file)) { - $img_size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $file); + $img_size = @getimagesize($phpbb_root_path . $path . '/' . $file); if (preg_match('/\.(gif|png|jpg)$/i', $file) || (!empty($img_size[0]) && !empty($img_size[1]))) { - $smilies_images[] = $file; + $_images[] = $file; } elseif (preg_match('/\.pak$/i', $file)) { - $smilies_paks[] = $file; + $_paks[] = $file; } } } @@ -90,7 +115,7 @@ if ($mode == 'edit' || !empty($_POST['add']) || !empty($_POST['import_pak'])) // if (isset($_POST['import_pak'])) { - if (!empty($_POST['smilies_pak'])) + if (!empty($_POST['_pak'])) { $smile_order = 0; // @@ -98,11 +123,11 @@ if (isset($_POST['import_pak'])) // if (!empty($_POST['clear_current'])) { - $db->sql_query('DELETE FROM ' . SMILIES_TABLE); + $db->sql_query('DELETE FROM ' . $table); } else { - $result = $db->sql_query('SELECT code FROM ' . SMILIES_TABLE); + $result = $db->sql_query('SELECT code FROM ' . $table); $smilies = array(); while ($row = $db->sql_fetchrow($result)) @@ -112,35 +137,35 @@ if (isset($_POST['import_pak'])) } } - $fcontents = @file($phpbb_root_path . $board_config['smilies_path'] . '/'. $smilies_pak); + $fcontents = @file($phpbb_root_path . $path . '/'. $_pak); if (empty($fcontents)) { - message_die(ERROR, 'Could not read smiley pak file'); + trigger_error('Could not read smiley pak file', E_USER_ERROR); } foreach ($fcontents as $line) { - $smile_data = explode($delimiter, trim($line)); + $_data = explode($delimiter, trim($line)); - $smile_url = $smile_data[0]; - $emotion = $smile_data[1]; - $code = htmlentities($smile_data[2]); + $_url = $_data[0]; + $emotion = $_data[1]; + $code = htmlentities($_data[2]); - if (!isset($smile_data[4])) + if (!isset($_data[4])) { // // The size isn't specified, try to get it from the file and if it fails // arbitrary set it to 15 and let the user correct it later. // - $size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_url); - $smile_width = (!empty($size[0])) ? $size[0] : 15; - $smile_height = (!empty($size[1])) ? $size[1] : 15; + $size = @getimagesize($phpbb_root_path . $path . '/' . $smile_url); + $_width = (!empty($size[0])) ? $size[0] : 15; + $_height = (!empty($size[1])) ? $size[1] : 15; } else { - $smile_width = $smile_data[3]; - $smile_height = $smile_data[4]; + $_width = $_data[3]; + $_height = $_data[4]; } if (!empty($smilies[$code])) @@ -149,12 +174,12 @@ if (isset($_POST['import_pak'])) { $code_sql = str_replace("'", "''", str_replace('\\', '\\\\', $code)); $sql = array( - 'smile_url' => $smile_url, - 'smile_height' => $smile_height, - 'smile_width' => $smile_width, + 'smile_url' => $_url, + 'smile_height' => $_height, + 'smile_width' => $_width, 'emoticon' => $emotion ); - $db->sql_query_array('UPDATE ' . SMILIES_TABLE . " SET WHERE code = '$code_sql'", $sql); + $db->sql_query("UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . "WHERE code = '$code_sql'"); } } else @@ -163,33 +188,33 @@ if (isset($_POST['import_pak'])) $sql = array( 'code' => $code, - 'smile_url' => $smile_url, - 'smile_height' => $smile_height, - 'smile_width' => $smile_width, - 'smile_order' => $smile_order, + 'smile_url' => $_url, + 'smile_height' => $_height, + 'smile_width' => $_width, + 'smile_order' => $_order, 'emoticon' => $emotion ); - $db->sql_query_array('INSERT INTO ' . SMILIES_TABLE, $sql); + $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql)); } } - message_die(MESSAGE, $user->lang['Smilies_import_success']); + message_die(MESSAGE, $user->lang[$lang . '_import_success']); } else { - if (!count($smilies_paks)) + if (!count($_paks)) { - $smilies_paks_select = $user->lang['No_smilies_pak']; + $_paks_select = $user->lang['No_smilies_pak']; } else { - $smilies_paks_select = ''; - foreach ($smilies_paks as $pak) + foreach ($_paks as $pak) { - $smilies_paks_select .= ''; + $_paks_select .= ''; } - $smilies_paks_select .= ''; + $_paks_select .= ''; } page_header($user->lang['Import_smilies']); @@ -198,13 +223,13 @@ if (isset($_POST['import_pak']))

lang['Import_smilies_explain'] ?>

-
+
- + @@ -230,7 +255,7 @@ elseif (isset($_GET['export_pak'])) { $smilies_pak = ''; - $result = $db->sql_query('SELECT * FROM ' . SMILIES_TABLE); + $result = $db->sql_query('SELECT * FROM ' . $table); while ($row = $db->sql_fetchrow($result)) { $smilies_pak .= $row['smile_url'] . $delimiter; @@ -256,7 +281,7 @@ elseif (isset($_POST['export_pak'])) elseif (isset($_POST['add'])) { $filename_list = ''; - foreach ($smilies_images as $smile_url) + foreach ($_images as $smile_url) { if (!isset($default_image)) { @@ -273,7 +298,7 @@ elseif (isset($_POST['add'])) -
lang['Smilies_import'] ?>
lang['Select_package'] ?>
lang['Delete_existing_smilies'] ?>
+>
@@ -296,7 +321,7 @@ function update_smile_dimensions() - + @@ -352,7 +377,7 @@ switch ($mode) $order_list = '' . $order_list; $filename_list = ''; - foreach ($smilies_images as $smile_url) + foreach ($_images as $smile_url) { if ($smile_url == $smile_data['smile_url']) { @@ -375,7 +400,7 @@ switch ($mode) ' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '\\3'"; // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing - $match[] = '#(^|[\n ])(www\.[\w\-]+\.[\w\-.\~]+(?:/[^\t <\n\r\"]*)?)#ie'; + $match[] = '#(^|[\n ])(www\.[\w\-]+\.[\w\-.\~]+(?:/[^\t\n\r <"\']*)?)#ie'; $replace[] = "'\\1' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . ''"; // matches an email@domain type address at the start of a line, or after a space. @@ -174,17 +174,21 @@ class fulltext_search { global $user, $config; - static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!', '*'); - static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' ', ' '); - $stopwords_list = @file($user->lang_path . '/search_stopwords.txt'); - $synonym_list = @file($user->lang_path . '/search_synonyms.txt'); + static $drop_char_match, $drop_char_replace, $stopwords, $synonyms; + + if (empty($drop_char_match)) + { + $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!', '*'); + $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '' , ' ', ' ', ' ', ' ', ' ', ' ', ' '); + $stopwords = @file($user->lang_path . '/search_stopwords.txt'); + $synonyms = @file($user->lang_path . '/search_synonyms.txt'); + } $match = array(); // New lines, carriage returns $match[] = "#[\n\r]+#"; - // HTML and NCRs like   etc. - $match[] = '#<(.*?)>.*?<\/\1>#'; // BAD! - $match[] = '#\b&\#?[a-z0-9]+;\b#'; + // NCRs like   etc. + $match[] = '#&[\#a-z0-9]+?;#i'; // URL's $match[] = '#\b[\w]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?#'; // BBcode @@ -192,26 +196,23 @@ class fulltext_search $match[] = '#\[\/?url(=.*?)?\]#'; $match[] = '#\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]#'; // Sequences < min_search_chars & < max_search_chars - $match[] = '#\b([a-z0-9]{1,' . $config['min_search_chars'] . '}|[a-z0-9]{' . $config['max_search_chars'] . ',})\b#'; + $match[] = '#\b([a-z0-9]{1,' . $config['min_search_chars'] . '}|[a-z0-9]{' . $config['max_search_chars'] . ',})\b#is'; $text = preg_replace($match, ' ', ' ' . strtolower($text) . ' '); // Filter out non-alphabetical chars - for($i = 0; $i < count($drop_char_match); $i++) - { - $text = str_replace($drop_char_match[$i], $drop_char_replace[$i], $text); - } + $text = str_replace($drop_char_match, $drop_char_replace, $text); if ( !empty($stopwords_list) ) { - $text = str_replace($stopwords_list, '', $text); + $text = str_replace($stopwords, '', $text); } - if ( !empty($synonym_list) ) + if ( !empty($synonyms) ) { - for ($j = 0; $j < count($synonym_list); $j++) + for ($j = 0; $j < count($synonyms); $j++) { - list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_list[$j]))); + list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonyms[$j]))); if ( $mode == 'post' || ( $match_synonym != 'not' && $match_synonym != 'and' && $match_synonym != 'or' ) ) { $text = preg_replace('#\b' . trim($match_synonym) . '\b#', ' ' . trim($replace_synonym) . ' ', $text); @@ -219,11 +220,7 @@ class fulltext_search } } - echo "

\n\n"; - echo "cleaned_text => " . htmlentities($text); - echo "

\n\n"; preg_match_all('/\b([\w]+)\b/', $text, $split_entries); - return array_unique($split_entries[1]); } @@ -231,8 +228,8 @@ class fulltext_search { global $config, $db; - $mtime = explode(' ', microtime()); - $starttime = $mtime[1] + $mtime[0]; +// $mtime = explode(' ', microtime()); +// $starttime = $mtime[1] + $mtime[0]; // Split old and new post/subject to obtain array of 'words' $split_text = $this->split_words($message); @@ -245,160 +242,124 @@ class fulltext_search FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m WHERE m.post_id = " . intval($post_id) . " AND w.word_id = m.word_id"; - $result = $db->sql_query($result); + $result = $db->sql_query($sql); $cur_words = array(); while ($row = $db->sql_fetchrow($result)) { $which = ($row['title_match']) ? 'title' : 'post'; - $cur_words[$which][$row['word_id']] = $row['word_text']; + $cur_words[$which][$row['word_text']] = $row['word_id']; } $db->sql_freeresult($result); - $words['add']['post'] = array_diff($split_text, $cur_words['post']); - $words['add']['title'] = array_diff($split_title, $cur_words['title']); - $words['del']['post'] = array_diff($cur_words['post'], $split_text); - $words['del']['title'] = array_diff($cur_words['title'], $split_title); + $words['add']['post'] = array_diff($split_text, array_keys($cur_words['post'])); + $words['add']['title'] = array_diff($split_title, array_keys($cur_words['title'])); + $words['del']['post'] = array_diff(array_keys($cur_words['post']), $split_text); + $words['del']['title'] = array_diff(array_keys($cur_words['title']), $split_title); } else { $words['add']['post'] = $split_text; $words['add']['title'] = $split_title; + $words['del']['post'] = array(); + $words['del']['title'] = array(); } unset($split_text); unset($split_title); // Get unique words from the above arrays - $unique_add_words = array_unique(array_merge($words['add']['text'], $words['add']['title'])); + $unique_add_words = array_unique(array_merge($words['add']['post'], $words['add']['title'])); - // // We now have unique arrays of all words to be added and removed and // individual arrays of added and removed words for text and title. What // we need to do now is add the new words (if they don't already exist) // and then add (or remove) matches between the words and this post - // - if ( sizeof($unique_add_words) ) - { - $word_id = array(); - $new_word = array(); - - $sql = "SELECT word_id, word_text - FROM " . SEARCH_WORD_TABLE . " - WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $unique_words)) . ")"; - $result = $db->sql_query($sql); - - while ( $row = $db->sql_fetchrow($result) ) - { - $word_id[$row['word_text']] = $row['word_id']; - } - $db->sql_freeresult($result); - - foreach ( $unique_words as $word ) - { - if ( empty($word_id[$word]) ) - { - $new_words[] = $row['word_text']; - } - } - unset($unique_words); - - switch( SQL_LAYER ) - { - case 'postgresql': - case 'msaccess': - case 'mssql-odbc': - case 'oracle': - case 'db2': - foreach ( $new_words as $word ) - { - $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) - VALUES ('" . $word . "')"; - $db->sql_query($sql); - } - - break; - - default: - switch( SQL_LAYER ) - { - case 'mysql': - case 'mysql4': - $value_sql = implode(', ', preg_replace('#^(.*)$#', '(\'\1\')', $new_words)); - break; - - case mssql: - $value_sql = implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \'\1\'', $new_words)); - break; - - } - - if ( $value_sql ) - { - $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) - VALUES $value_sql"; - $db->sql_query($sql); - } - } - } - - $unique_words = array_unique(array_merge($words['del']['text'], $words['del']['title'])); - - $word_id = array(); - if ( count($unique_words) ) + if (sizeof($unique_add_words)) { $sql = "SELECT word_id, word_text FROM " . SEARCH_WORD_TABLE . " - WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $unique_words)) . ")"; + WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $unique_add_words)) . ")"; $result = $db->sql_query($sql); + $word_ids = array(); while ( $row = $db->sql_fetchrow($result) ) { - if ( !empty($words['del']['title']) ) - { - $words['del']['title'][] = $row['word_id']; - } - - if ( !empty($words['del']['text']) ) - { - $words['del']['text'][] = $row['word_id']; - } + $word_ids[$row['word_text']] = $row['word_id']; } $db->sql_freeresult($result); - unset($unique_words); + $new_words = array_diff($unique_add_words, array_keys($word_ids)); + unset($unique_add_words); + + if (sizeof($new_words)) + { + switch (SQL_LAYER) + { + case 'postgresql': + case 'msaccess': + case 'mssql-odbc': + case 'oracle': + case 'db2': + foreach ($new_words as $word) + { + $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) + VALUES ('" . $word . "')"; + $db->sql_query($sql); + } + + break; + case 'mysql': + case 'mysql4': + $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) + VALUES " . implode(', ', preg_replace('#^(.*)$#', '(\'\1\')', $new_words)); + $db->sql_query($sql); + break; + case 'mssql': + $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) + VALUES " . implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \'\1\'', $new_words)); + $db->sql_query($sql); + break; + } + } + unset($new_words); } - foreach ( $words as $sql_type => $word_in_ary ) + foreach ($words['del'] as $word_in => $word_ary) { - foreach ( $word_in_ary as $word_in => $word_ary ) - { - $word_sql = ( $sql_type == 'add' ) ? implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $word_ary)) : implode(', ', $word_id); - $title_match = ( $word_in == 'title' ) ? 1 : 0; + $title_match = ( $word_in == 'title' ) ? 1 : 0; - if ( $word_sql != '' ) + $sql = ''; + if (sizeof($word_ary)) + { + foreach ($word_ary as $word) { - echo "
" . $sql = ( $sql_type == 'add' ) ? "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) SELECT $post_id, word_id, $title_match FROM " . SEARCH_WORD_TABLE . " WHERE word_text IN ($word_sql)" : "DELETE FROM " . SEARCH_MATCH_TABLE . " WHERE post_id = $post_id AND title_match = $title_match AND word_id IN ($word_sql)"; - $db->sql_query($sql); + $sql .= (($sql != '') ? ', ' : '') . $cur_words[$word_in][$word]; } + $sql = "DELETE FROM " . SEARCH_MATCH_TABLE . " WHERE word_id IN ($sql) AND post_id = " . intval($post_id) . " AND title_match = $title_match"; + $db->sql_query($sql); + } + } + + foreach ($words['add'] as $word_in => $word_ary) + { + $title_match = ( $word_in == 'title' ) ? 1 : 0; + + if (sizeof($word_ary)) + { + $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match) SELECT $post_id, word_id, $title_match FROM " . SEARCH_WORD_TABLE . " WHERE word_text IN (" . implode(', ', preg_replace('#^(.*)$#', '\'\1\'', $word_ary)) . ")"; + $db->sql_query($sql); } } unset($words); - unset($word_in_ary); - $mtime = explode(' ', microtime()); - echo "

"; - echo $mtime[1] + $mtime[0] - $starttime; - echo "

"; - print_r($new_words); - echo "

"; - print_r($del_words); - echo "

"; +// $mtime = explode(' ', microtime()); +// echo "Search parser time taken >> " . ($mtime[1] + $mtime[0] - $starttime); // Run the cleanup infrequently, once per session cleanup - if ( $config['session_last_gc'] < time - ( $config['session_gc'] / 2 ) ) + if ($config['search_last_gc'] < time - $config['search_gc']) { - $this->search_tidy(); +// $this->search_tidy(); } } @@ -476,18 +437,16 @@ class fulltext_search // function generate_smilies($mode) { - global $SID, $auth, $db, $session, $config, $template, $theme, $lang; - global $user_ip, $starttime; - global $phpEx, $phpbb_root_path; - global $user, $userdata; + global $SID, $auth, $db, $user, $config, $template; + global $starttime, $phpEx, $phpbb_root_path; - if ( $mode == 'window' ) + if ($mode == 'window' ) { - $page_title = $lang['Review_topic'] . " - $topic_title"; + $page_title = $user->lang['Review_topic'] . " - $topic_title"; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( - 'smiliesbody' => 'posting_smilies.html') + 'body' => 'posting_smilies.html') ); } @@ -495,25 +454,25 @@ function generate_smilies($mode) $sql = "SELECT emoticon, code, smile_url, smile_width, smile_height FROM " . SMILIES_TABLE . " $where_sql - ORDER BY smile_order, smile_width, smile_height, smilies_id"; + ORDER BY smile_order"; $result = $db->sql_query($sql); $num_smilies = 0; $smile_array = array(); - if ( $row = $db->sql_fetchrow($result) ) + if ($row = $db->sql_fetchrow($result)) { do { - if ( !in_array($row['smile_url'], $smile_array) ) + if (!in_array($row['smile_url'], $smile_array)) { - if ( $mode == 'window' || ( $mode == 'inline' && $num_smilies < 20 ) ) + if ($mode == 'window' || ( $mode == 'inline' && $num_smilies < 20 )) { $template->assign_block_vars('emoticon', array( - 'SMILEY_CODE' => $row['code'], - 'SMILEY_IMG' => $config['smilies_path'] . '/' . $row['smile_url'], - 'SMILEY_WIDTH' => $row['smile_width'], + 'SMILEY_CODE' => $row['code'], + 'SMILEY_IMG' => $config['smilies_path'] . '/' . $row['smile_url'], + 'SMILEY_WIDTH' => $row['smile_width'], 'SMILEY_HEIGHT' => $row['smile_height'], - 'SMILEY_DESC' => $row['emoticon']) + 'SMILEY_DESC' => $row['emoticon']) ); } @@ -521,30 +480,27 @@ function generate_smilies($mode) $num_smilies++; } } - while ( ( $row = $db->sql_fetchrow($result) ) ); + while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); - if ( $mode == 'inline' && $num_smilies >= 20 ) + if ($mode == 'inline' && $num_smilies >= 20) { $template->assign_vars(array( - 'S_SHOW_EMOTICON_LINK' => true, - 'L_MORE_SMILIES' => $lang['More_emoticons'], - 'U_MORE_SMILIES' => "posting.$phpEx$SID&mode=smilies") + 'S_SHOW_EMOTICON_LINK' => true, + 'L_MORE_SMILIES' => $user->lang['More_emoticons'], + 'U_MORE_SMILIES' => "posting.$phpEx$SID&mode=smilies") ); } $template->assign_vars(array( - 'L_EMOTICONS' => $lang['Emoticons'], - 'L_CLOSE_WINDOW' => $lang['Close_window'], - 'S_SMILIES_COLSPAN' => $s_colspan) + 'L_EMOTICONS' => $user->lang['Emoticons'], + 'L_CLOSE_WINDOW' => $user->lang['Close_window']) ); } - if ( $mode == 'window' ) + if ($mode == 'window') { - $template->display('smiliesbody'); - include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } } diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php index 5263f7db16..c16abe3047 100644 --- a/phpBB/language/en/lang_admin.php +++ b/phpBB/language/en/lang_admin.php @@ -422,6 +422,7 @@ $lang = array_merge($lang, array( 'General_settings' => 'General settings', 'Forum_settings' => 'Forum settings', 'Disable_post_count' => 'Disable post count', + 'Forum_is_moderated' => 'Moderated forum', 'Display_on_index' => 'Display a link to this forum on index', 'Forum_edit_delete_explain' => 'The form below will allow you to customize all the general board options. For User and Forum configurations use the related links on the left hand side', 'Forum_general' => 'General Forum Settings', @@ -433,6 +434,7 @@ $lang = array_merge($lang, array( 'prune_days' => 'Remove topics that have not been posted to in', 'Set_as_category' => 'Set this forum as a category and', 'Forum_delete' => 'Delete Forum', + 'Update' => 'Update', 'Forum_delete_explain' => 'The form below will allow you to delete a forum (or category) and decide where you want to put all topics (or forums) it contained.', 'Move_and_Delete' => 'Move and Delete', 'Move_posts_to' => 'Move posts to', diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index 890ce5be1d..6c8dc6c155 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -256,6 +256,7 @@ $lang = array_merge($lang, array( 'Very_good' => 'Very Good', 'Total_votes' => 'Total Votes', 'Message_body' => 'Message body', + 'Message_body_explain' => 'Enter your message here, it may contain no more than %d characters.', 'Topic_review' => 'Topic review', 'Topic_icon' => 'Topic icon', 'No_post_mode' => 'No post mode specified', @@ -292,8 +293,9 @@ $lang = array_merge($lang, array( 'Cannot_delete_replied' => 'Sorry but you may not delete posts that have been replied to', 'Cannot_delete_poll' => 'Sorry but you cannot delete an active poll', 'Empty_poll_title' => 'You must enter a title for your poll', - 'To_few_poll_options' => 'You must enter at least two poll options', - 'To_many_poll_options' => 'You have tried to enter too many poll options', + 'Too_few_poll_options' => 'You must enter at least two poll options', + 'Too_many_poll_options' => 'You have tried to enter too many poll options', + 'No_delete_poll_options' => 'You cannot delete existing poll options', 'Post_has_no_poll' => 'This post has no poll', 'Already_voted' => 'You have already voted in this poll', 'No_vote_option' => 'You must specify an option when voting', diff --git a/phpBB/language/en/search_stopwords.txt b/phpBB/language/en/search_stopwords.txt index 5629d9a00b..5f4200e302 100644 --- a/phpBB/language/en/search_stopwords.txt +++ b/phpBB/language/en/search_stopwords.txt @@ -1,246 +1,246 @@ -a -about -after -ago -all -almost -along +a +about +after +ago +all +almost +along alot -also -am -an -and -answer -any -anybody +also +am +an +and +answer +any +anybody anybodys -anywhere -are -arent -around -as +anywhere +are +arent +around +as ask askd -at -bad -be -because -been -before -being -best -better -between -big -btw -but -by -can -cant -come -could -couldnt -day +at +bad +be +because +been +before +being +best +better +between +big +btw +but +by +can +cant +come +could +couldnt +day days days -did -didnt -do -does -doesnt -dont -down -each -etc -either -else -even -ever -every -everybody +did +didnt +do +does +doesnt +dont +down +each +etc +either +else +even +ever +every +everybody everybodys -everyone -far -find -for -found -from -get -go -going -gone -good -got -gotten -had -has -have -havent -having -her -here -hers -him -his -home -how +everyone +far +find +for +found +from +get +go +going +gone +good +got +gotten +had +has +have +havent +having +her +here +hers +him +his +home +how hows -href -I +href +I Ive -if -in -ini -into -is -isnt -it -its +if +in +ini +into +is +isnt +it +its its just -know -large -less -like +know +large +less +like liked -little -looking -look +little +looking +look looked looking -lot -maybe -many -me -more -most -much -must +lot +maybe +many +me +more +most +much +must mustnt -my -near -need -never -new -news -no -none -not -nothing -now -of -off -often -old -on -once -only +my +near +need +never +new +news +no +none +not +nothing +now +of +off +often +old +on +once +only oops -or -other -our -ours -out -over -page -please -put -question +or +other +our +ours +out +over +page +please +put +question questions questioned quote -rather -really -recent +rather +really +recent said saw say says -she +she see sees -should -sites -small -so -some -something -sometime -somewhere -soon -take -than -true -thank -that -thatd -thats -the -their -theirs +should +sites +small +so +some +something +sometime +somewhere +soon +take +than +true +thank +that +thatd +thats +the +their +theirs theres theirs -them -then -there -these -they +them +then +there +these +they theyll theyd theyre -this -those -though -through -thus -time -times -to -too -under -until -untrue -up -upon -use -users -version -very -via -want -was -way +this +those +though +through +thus +time +times +to +too +under +until +untrue +up +upon +use +users +version +very +via +want +was +way we well went -were +were werent -what -when -where -which -who -whom -whose -why -wide -will -with -within -without +what +when +where +which +who +whom +whose +why +wide +will +with +within +without wont -world -worse -worst +world +worse +worst would wrote -www -yes -yet -you +www +yes +yet +you youd youll -your +your youre yours AFAIK diff --git a/phpBB/posting.php b/phpBB/posting.php index 827c35eccd..00ea5387e7 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -35,38 +35,13 @@ $auth->acl($user->data); extract($_GET); extract($_POST); -// Some vars need their names changing and type imposing -$int_vars = array( - 'f' => 'forum_id', - 'p' => 'post_id', - 't' => 'topic_id', -); - -foreach ( $int_vars as $in_var => $out_var) -{ - $$out_var = ( isset($$in_var) ) ? intval($$in_var) : false; -} - // Was cancel pressed? If so then redirect to the appropriate page if ( !empty($cancel) ) { - $redirect = ( $p ) ? "viewtopic.$phpEx$SID&p=$p#$p" : ( ( $t ) ? "viewtopic.$phpEx$SID&t=$t" : ( ( $f ) ? "viewforum.$phpEx$SID&f=$f" : "index.$phpEx$SID" ) ); + $redirect = (intval($p)) ? "viewtopic.$phpEx$SID&p=" . intval($p) . "#" . intval($p) : ( (intval($t)) ? "viewtopic.$phpEx$SID&t=" . intval($t) : ( (intval($f)) ? "viewforum.$phpEx$SID&f=" . intval($f) : "index.$phpEx$SID" ) ); redirect($redirect); } -// If the mode is set to topic review then output that review ... -switch ($mode) -{ - case 'topicreview': -// require($phpbb_root_path . 'includes/topic_review.'.$phpEx); -// topic_review($topic_id, false); - break; - - case 'smilies': - generate_smilies('window'); - break; -} - // --------- @@ -78,32 +53,51 @@ switch ($mode) switch ($mode) { case 'post': + if (empty($f)) + { + trigger_error($user->lang['No_forum_id']); + } + + $sql = 'SELECT forum_id, post_count_inc + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . intval($f); break; case 'reply': - if (empty($topic_id)) + if (empty($t)) { trigger_error($user->lang['No_topic_id']); } - $sql = "SELECT * - FROM " . TOPICS_TABLE . " - WHERE topic_id = $topic_id"; + $sql = 'SELECT t.*, f.post_count_inc + FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f + WHERE t.topic_id = ' . intval($t) . ' + AND f.forum_id = t.forum_id'; break; case 'quote': case 'edit': case 'delete': - if (empty($post_id)) + if (empty($p)) { trigger_error($user->lang['No_post_id']); } - $sql = "SELECT t.*, p.*, pt.* - FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt, " . TOPICS_TABLE . " t - WHERE p.post_id = $post_id + $sql = 'SELECT t.*, p.*, pt.*, f.post_count_inc + FROM ' . POSTS_TABLE . ' p, ' . POSTS_TEXT_TABLE . ' pt, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f + WHERE p.post_id = ' . intval($p) . ' AND t.topic_id = p.topic_id - AND pt.post_id = p.post_id"; + AND pt.post_id = p.post_id + AND f.forum_id = t.forum_id'; + break; + + case 'topicreview': + require($phpbb_root_path . 'includes/topic_review.'.$phpEx); + topic_review(intval($topic_id), false); + break; + + case 'smilies': + generate_smilies('window'); break; default: @@ -236,16 +230,22 @@ if (isset($post)) // Process poll options if (!empty($poll_option_text) && (($auth->acl_get('f_poll', $forum_id) && empty($poll_last_vote)) || $auth->acl_get('a_'))) { + $poll_options_size = sizeof($poll_options); + $result = $parse_msg->parse($poll_option_text, $enable_html, $enable_bbcode, $bbcode_uid, $enable_urls, $enable_smilies); $poll_options = explode("\n", $poll_option_text); if (sizeof($poll_options) == 1) { - $err_msg .= ((!empty($err_msg)) ? '
' : '') . $user->lang['To_few_poll_options']; + $err_msg .= ((!empty($err_msg)) ? '
' : '') . $user->lang['Too_few_poll_options']; } else if (sizeof($poll_options) > intval($config['max_poll_options'])) { - $err_msg .= ((!empty($err_msg)) ? '
' : '') . $user->lang['To_many_poll_options']; + $err_msg .= ((!empty($err_msg)) ? '
' : '') . $user->lang['Too_many_poll_options']; + } + else if (sizeof($poll_options) < $poll_options_size) + { + $err_msg .= ((!empty($err_msg)) ? '
' : '') . $user->lang['No_delete_poll_options']; } $poll_subject = (!empty($poll_subject)) ? trim(htmlspecialchars(strip_tags($poll_subject))) : ''; @@ -280,12 +280,12 @@ if (isset($post)) { $db->sql_transaction(); + // topic info if ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)) { - $sql = ($mode == 'post') ? 'INSERT INTO ' . TOPICS_TABLE : 'UPDATE ' . TOPICS_TABLE . ' SET WHERE topic_id = ' . intval($topic_id); $topic_sql = array( 'forum_id' => intval($forum_id), - 'topic_title' => sql_quote($subject), + 'topic_title' => $subject, 'topic_poster' => intval($user->data['user_id']), 'topic_time' => $current_time, 'topic_type' => intval($type), @@ -300,56 +300,50 @@ if (isset($post)) 'poll_length' => $poll_length * 3600 )); } - $db->sql_query_array($sql, $topic_sql); + $sql = ($mode == 'post') ? 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $topic_sql): 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $topic_sql) . ' WHERE topic_id = ' . intval($topic_id); + $db->sql_query($sql); $topic_id = ($mode == 'post') ? $db->sql_nextid() : $topic_id; } - $sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TABLE . ' SET , post_edit_count = post_edit_count + 1 WHERE post_id = ' . $post_id : 'INSERT INTO ' . POSTS_TABLE; + // post $post_sql = array( 'topic_id' => intval($topic_id), 'forum_id' => intval($forum_id), 'poster_id' => ($mode == 'edit') ? intval($poster_id) : intval($user->data['user_id']), - 'post_username' => ($username != '') ? sql_quote($username) : '', + 'post_username' => ($username != '') ? $username : '', 'poster_ip' => $user->ip, 'post_time' => $current_time, 'post_approved' => ($forum_moderated) ? 0 : 1, - 'post_edit_time' => ($mode == 'edit') ? $current_time : 0, + 'post_edit_time' => ($mode == 'edit' && $poster_id == $user->data['user_id']) ? $current_time : 0, 'enable_sig' => $enable_html, 'enable_bbcode' => $enable_bbcode, 'enable_html' => $enable_html, 'enable_smilies' => $enable_smilies, 'enable_magic_url' => $enable_urls, ); - $db->sql_query_array($sql, $post_sql); + $sql = ($mode == 'edit' && $poster_id == $user->data['user_id']) ? 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $post_sql) . ' , post_edit_count = post_edit_count + 1 WHERE post_id = ' . intval($post_id) : 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $post_sql); + $db->sql_query($sql); - // post_id $post_id = ($mode == 'edit') ? $post_id : $db->sql_nextid(); // post_text ... may merge into posts table - $sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TEXT_TABLE . ' SET WHERE post_id = ' . intval($post_id) : 'INSERT INTO ' . POSTS_TEXT_TABLE; $post_text_sql = array( - 'post_subject' => sql_quote(htmlspecialchars($subject)), + 'post_subject' => htmlspecialchars($subject), 'bbcode_uid' => $bbcode_uid, 'post_id' => intval($post_id), ); - if ($mode != 'edit' || $message_md5 != $post_checksum) { $post_text_sql = array_merge($post_text_sql, array( 'post_checksum' => $message_md5, - 'post_text' => sql_quote($message), + 'post_text' => $message, )); } - $db->sql_query_array($sql, $post_text_sql); + $sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TEXT_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $post_text_sql) . ' WHERE post_id = ' . intval($post_id) : 'INSERT INTO ' . POSTS_TEXT_TABLE . ' ' . $db->sql_build_array('INSERT', $post_text_sql); + $db->sql_query($sql); - // Fulltext parse - if ($mode != 'edit' || $message_md5 != $post_checksum) - { -// $result = $search->add($mode, $post_id, $message, $subject); - } - - // Add/Update poll options ... incomplete(!) + // poll options if (!empty($poll_options)) { $cur_poll_options = array(); @@ -385,9 +379,16 @@ if (isset($post)) } } + // Fulltext parse + if ($mode != 'edit' || $message_md5 != $post_checksum) + { + $result = $search->add($mode, $post_id, $message, $subject); + } + // Sync forums, topics and users ... if ($mode != 'edit') { + // Update forums: last post info, topics, posts $forum_topics_sql = ($mode == 'post') ? ', forum_topics = forum_topics + 1' : ''; $forum_sql = array( 'forum_last_post_id' => intval($post_id), @@ -395,16 +396,16 @@ if (isset($post)) 'forum_last_poster_id' => intval($user->data['user_id']), 'forum_last_poster_name'=> ($username != '') ? $username : '', ); - $db->sql_query_array('UPDATE ' . FORUMS_TABLE . ' SET , forum_posts = forum_posts + 1' . $forum_topics_sql . ' WHERE forum_id = ' . intval($forum_id), $forum_sql); + $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $forum_sql) . ', forum_posts = forum_posts + 1' . $forum_topics_sql . ' WHERE forum_id = ' . intval($forum_id); + $db->sql_query($sql); - $topic_replies_sql = ($mode == 'reply') ? ', topic_replies = topic_replies + 1' : ''; + // Update topic: first/last post info, replies $topic_sql = array( 'topic_last_post_id' => intval($post_id), 'topic_last_post_time' => $current_time, 'topic_last_poster_id' => intval($user->data['user_id']), 'topic_last_poster_name'=> ($username != '') ? $username : '', ); - if ($mode == 'post') { $topic_sql = array_merge($topic_sql, array( @@ -414,9 +415,12 @@ if (isset($post)) 'topic_first_poster_name' => ($username != '') ? $username : '', )); } - $db->sql_query_array('UPDATE ' . TOPICS_TABLE . ' SET ' . $topic_replies_sql . ' WHERE topic_id = ' . intval($topic_id), $topic_sql); + $topic_replies_sql = ($mode == 'reply') ? ', topic_replies = topic_replies + 1' : ''; + $sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $forum_sql) . $topic_replies_sql . ' . WHERE topic_id = ' . intval($topic_id); + $db->sql_query($sql); - if ($post_count_inc && $user->data['user_id'] != ANONYMOUS) + // Update user post count ... if appropriate + if (!empty($post_count_inc) && $user->data['user_id'] != ANONYMOUS) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + 1 @@ -449,8 +453,8 @@ if (isset($post)) } // Houston, we have an error ... - $post_text = &$message; - $post_subject = $topic_title = &$subject; + $post_text = &stripslashes($message); + $post_subject = $topic_title = &stripslashes($subject); $topic_icon = &$icon; $topic_type = &$type; @@ -570,24 +574,22 @@ $urls_checked = (isset($enable_urls)) ? !$enable_urls : 0; $sig_checked = (isset($attach_sig)) ? $attach_sig : (($config['allow_sigs']) ? $user->data['user_atachsig'] : 0); $notify_checked = (isset($notify_set)) ? $notify_set : (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_notify'] : 0); -// Page title/hidden fields -$s_hidden_fields = ''; - -switch( $mode ) +// Page title & action URL +$s_action = "posting.$phpEx$SID&mode=$mode&f=" . intval($forum_id); +switch ($mode) { case 'post': $page_title = $user->lang['Post_a_new_topic']; - $s_hidden_fields .= ''; break; case 'reply': $page_title = $user->lang['Post_a_reply']; - $s_hidden_fields .= ''; + $s_action .= '&t=' . intval($topic_id); break; case 'edit': $page_title = $user->lang['Edit_Post']; - $s_hidden_fields .= ''; + $s_action .= '&p=' . intval($post_id); break; } @@ -613,7 +615,9 @@ $template->assign_vars(array( 'L_TOPIC_ICON' => $user->lang['Topic_icon'], 'L_SUBJECT' => $user->lang['Subject'], 'L_MESSAGE_BODY' => $user->lang['Message_body'], + 'L_MESSAGE_BODY_EXPLAIN'=> (intval($config['max_post_chars'])) ? sprintf($user->lang['Message_body_explain'], intval($config['max_post_chars'])) : '', 'L_OPTIONS' => $user->lang['Options'], + 'L_EMOTICONS' => $user->lang['Emoticons'], 'L_PREVIEW' => $user->lang['Preview'], 'L_SPELLCHECK' => $user->lang['Spellcheck'], 'L_SUBMIT' => $user->lang['Submit'], @@ -654,7 +658,7 @@ $template->assign_vars(array( 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$forum_id", 'U_VIEWTOPIC' => ($mode != 'post') ? "viewtopic.$phpEx$SID&t=$topic_id" : '', 'U_REVIEW_TOPIC' => ($mode != 'post') ? "posting.$phpEx$SID&mmode=topicreview&t=$topic_id" : '', - 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . $forum_id, + 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . intval($forum_id), 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_HTML_CHECKED' => ($html_checked) ? 'checked="checked"' : '', @@ -671,20 +675,19 @@ $template->assign_vars(array( 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id)) ? true : false, 'S_NOTIFY_ALLOWED' => ($user->data['user_id'] != ANONYMOUS) ? true : false, - 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($auth->acl_get('f_delete', $forum_id) && $post_data['last_post']) || $auth->acl_get('m_', $forum_id))) ? true : false, + 'S_DELETE_ALLOWED' => ($mode = 'edit' && (($post_id == $topic_last_post_id && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', intval($forum_id))) || $auth->acl_get('m_delete', intval($forum_id)) || $auth->acl_get('a_'))) ? true : false, 'S_TYPE_TOGGLE' => $topic_type_toggle, - 'S_TOPIC_ID' => $topic_id, - 'S_POST_ACTION' => "posting.$phpEx$SID", - 'S_HIDDEN_FIELDS' => $s_hidden_fields) + 'S_TOPIC_ID' => intval($topic_id), + 'S_POST_ACTION' => $s_action) ); // Poll entry -if ((($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && empty($poll_last_vote))) && $auth->acl_get('f_poll', $forum_id)) || $auth->acl_get('a_')) +if ((($mode == 'post' || ($mode == 'edit' && intval($post_id) == intval($topic_first_post_id) && empty($poll_last_vote))) && $auth->acl_get('f_poll', intval($forum_id))) || $auth->acl_get('a_')) { $template->assign_vars(array( 'S_SHOW_POLL_BOX' => true, - 'S_POLL_DELETE' => ($mode == 'edit') ? true : false, + 'S_POLL_DELETE' => ($mode = 'edit' && !empty($poll_options) && ((empty($poll_last_vote) && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', intval($forum_id))) || $auth->acl_get('m_delete', intval($forum_id)) || $auth->acl_get('a_'))) ? true : false, 'L_ADD_A_POLL' => $user->lang['Add_poll'], 'L_ADD_POLL_EXPLAIN' => $user->lang['Add_poll_explain'], diff --git a/phpBB/search.php b/phpBB/search.php index 0cc1ea8fc5..e767f7d43c 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1147,7 +1147,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id ) // // Search forum // -$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id +/*$sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f WHERE f.cat_id = c.cat_id ORDER BY c.cat_id, f.forum_order"; @@ -1165,8 +1165,9 @@ while( $row = $db->sql_fetchrow($result) ) } } } - -if ( $s_forums != '' ) +*/ +$s_forums = '' . $s_forums; +/*if ( $s_forums != '' ) { $s_forums = '' . $s_forums; @@ -1183,7 +1184,7 @@ else { message_die(MESSAGE, $user->lang['No_searchable_forums']); } - +*/ // // Number of chars returned // diff --git a/phpBB/templates/subSilver/posting_body.html b/phpBB/templates/subSilver/posting_body.html index de485dd3eb..e69466e7bd 100644 --- a/phpBB/templates/subSilver/posting_body.html +++ b/phpBB/templates/subSilver/posting_body.html @@ -263,31 +263,24 @@ function storeCaret(textEl) { - - + + -
lang['smile_config'] ?>
lang['Smile_url'] ?>        
lang['Smile_width'] ?>
{L_SUBJECT}{L_SUBJECT}
+ -
{L_MESSAGE_BODY}
{L_MESSAGE_BODY_EXPLAIN}

- + - + + + + + +
{L_MESSAGE_BODY} {L_EMOTICONS}

- - - - - - - - - - - -
{L_EMOTICONS}
{emoticon.SMILEY_DESC}
{L_MORE_SMILIES}
{emoticon.SMILEY_DESC}
{L_MORE_SMILIES}
+ diff --git a/phpBB/templates/subSilver/posting_smilies.html b/phpBB/templates/subSilver/posting_smilies.html index 583bfca64b..13b01939f3 100644 --- a/phpBB/templates/subSilver/posting_smilies.html +++ b/phpBB/templates/subSilver/posting_smilies.html @@ -17,17 +17,14 @@ function emoticon(text) { //--> -
@@ -318,6 +311,7 @@ function storeCaret(textEl) { +
@@ -330,7 +324,7 @@ function storeCaret(textEl) { rgb(pas,width1,height1,text1,text2); //--> - +
+
diff --git a/phpBB/templates/subSilver/simple_header.html b/phpBB/templates/subSilver/simple_header.html index cef378af7e..ddda3e1a14 100644 --- a/phpBB/templates/subSilver/simple_header.html +++ b/phpBB/templates/subSilver/simple_header.html @@ -4,20 +4,18 @@ - - - + + {META} -{SITENAME} :: {PAGE_TITLE} +{SITENAME} :: {PAGE_TITLE} diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 14e856aa68..8019d01352 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -699,7 +699,7 @@ if ( $row = $db->sql_fetchrow($result) ) if ( ( $user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) ) || $auth->acl_get('m_edit', $forum_id) || $auth->acl_get('a_') ) { - $temp_url = "posting.$phpEx$SID&mode=edit&p=" . $row['post_id']; + $temp_url = "posting.$phpEx$SID&mode=edit&f=" . $row['forum_id'] . "&p=" . $row['post_id']; $edit_img = '' . $user->img('icon_edit', $user->lang['Edit_delete_post']) . ''; $edit = '' . $user->lang['Edit_delete_post'] . ''; }
- - - - +
{L_EMOTICONS}
{emoticon.SMILEY_DESC}

{L_CLOSE_WINDOW}
{emoticon.SMILEY_DESC}
{L_CLOSE_WINDOW}