diff options
-rw-r--r-- | phpBB/admin/admin_forums.php | 176 | ||||
-rw-r--r-- | phpBB/admin/admin_smilies.php | 194 | ||||
-rw-r--r-- | phpBB/db/mysql.php | 18 | ||||
-rw-r--r-- | phpBB/db/mysql4.php | 18 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 260 | ||||
-rw-r--r-- | phpBB/language/en/lang_admin.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/lang_main.php | 6 | ||||
-rw-r--r-- | phpBB/language/en/search_stopwords.txt | 408 | ||||
-rw-r--r-- | phpBB/posting.php | 159 | ||||
-rw-r--r-- | phpBB/search.php | 9 | ||||
-rw-r--r-- | phpBB/templates/subSilver/posting_body.html | 32 | ||||
-rw-r--r-- | phpBB/templates/subSilver/posting_smilies.html | 7 | ||||
-rw-r--r-- | phpBB/templates/subSilver/simple_header.html | 12 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 2 |
14 files changed, 664 insertions, 639 deletions
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'] . "<br /><br />" . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&parent_id=' . $parent_id . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_admin_index'], '<a href="index.' . $phpEx . $SID . '?pane=right' . '">', '</a>'); @@ -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'] . "<br /><br />" . sprintf($user->lang['Click_return_forumadmin'], '<a href="admin_forums.' . $phpEx . $SID . '&parent_id=' . $parent_id . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_admin_index'], '<a href="index.' . $phpEx . $SID . '?pane=right' . '">', '</a>'); 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) <p><?php echo $user->lang['Forum_edit_delete_explain'] ?></p> -<form action="<?php echo "admin_forums.$phpEx$SID" ?>" method="post"> -<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> -<tr> - <th class="thHead" colspan="2"><?php echo $user->lang['General_settings'] ?></th> -</tr> -<tr> - <td class="row1"><?php echo ($forum_status != ITEM_CATEGORY) ? $user->lang['Forum_name'] : $user->lang['Category_name'] ?></td> - <td class="row2"><input type="text" size="25" name="forum_name" value="<?php echo $forum_name ?>" class="post" /></td> -</tr> -<tr> - <td class="row1"><?php echo $user->lang['Forum_desc'] ?></td> - <td class="row2"><textarea rows="5" cols="45" wrap="virtual" name="forum_desc" class="post"><?php echo $forum_desc ?></textarea></td> +<form action="<?php echo "admin_forums.$phpEx$SID" ?>" method="post"><table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0" align="center"> + <tr> + <th colspan="2"><?php echo $user->lang['General_settings'] ?></th> + </tr> + <tr> + <td class="row1"><?php echo ($forum_status != ITEM_CATEGORY) ? $user->lang['Forum_name'] : $user->lang['Category_name'] ?></td> + <td class="row2"><input type="text" size="25" name="forum_name" value="<?php echo $forum_name ?>" class="post" /></td> + </tr> + <tr> + <td class="row1"><?php echo $user->lang['Forum_desc'] ?></td> + <td class="row2"><textarea rows="5" cols="45" wrap="virtual" name="forum_desc" class="post"><?php echo $forum_desc ?></textarea></td> </tr> <?php if ($mode == 'add' || $forum_status == ITEM_CATEGORY) { + ?> -<tr> - <td class="row1"><?php echo $user->lang['Forum_type'] ?></td> - <td class="row2"><input type="radio" name="is_category" value="0" <?php echo $forum_checked ?>/><?php echo $user->lang['Forum'] ?> <input type="radio" name="is_category" value="1" <?php echo $category_checked ?>/><?php echo $user->lang['Category'] ?></td> -</tr> + <tr> + <td class="row1"><?php echo $user->lang['Forum_type'] ?></td> + <td class="row2"><input type="radio" name="is_category" value="0" <?php echo $forum_checked ?>/><?php echo $user->lang['Forum'] ?> <input type="radio" name="is_category" value="1" <?php echo $category_checked ?>/><?php echo $user->lang['Category'] ?></td> + </tr> <?php } + ?> -<tr> - <td class="row1"><?php echo $user->lang['Parent'] ?></td> - <td class="row2"><select name="parent_id"> - <option value="0"><?php echo $user->lang['No_parent'] ?></option> - <?php echo $parents_list ?></select></td> -</tr> -<tr> - <td class="row1"><?php echo $user->lang['Style'] ?></td> - <td class="row2"><select name="forum_style"><option value="0"><?php echo $user->lang['Default_style'] ?></option><?php echo $styles_list ?></select></td> -</tr> + <tr> + <td class="row1"><?php echo $user->lang['Parent'] ?></td> + <td class="row2"><select name="parent_id"><option value="0"><?php echo $user->lang['No_parent'] ?></option><?php echo $parents_list ?></select></td> + </tr> + <tr> + <td class="row1"><?php echo $user->lang['Style'] ?></td> + <td class="row2"><select name="forum_style"><option value="0"><?php echo $user->lang['Default_style'] ?></option><?php echo $styles_list ?></select></td> + </tr> <?php if ($forum_status != ITEM_CATEGORY) { + ?> -<tr> - <th class="thHead" colspan="2"><?php echo $user->lang['Forum_settings'] ?></th> -</tr> -<tr> - <td class="row1"><?php echo $user->lang['Forum_status'] ?></td> - <td class="row2"><select name="forum_status"><?php echo $statuslist ?></select></td> -</tr> -<tr> - <td class="row1"><?php echo $user->lang['Options'] ?></td> - <td class="row2"> - <input type="checkbox" name="disable_post_count" <?php echo ((!empty($post_count_inc)) ? '' : 'checked="checked" ') ?>/><?php echo $user->lang['Disable_post_count'] ?> + <tr> + <th colspan="2"><?php echo $user->lang['Forum_settings'] ?></th> + </tr> + <tr> + <td class="row1"><?php echo $user->lang['Forum_status'] ?></td> + <td class="row2"><select name="forum_status"><?php echo $statuslist ?></select></td> + </tr> + <tr> + <td class="row1"><?php echo $user->lang['Options'] ?></td> + <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> + <tr> + <td><input type="checkbox" name="disable_post_count"<?php echo ((!empty($post_count_inc)) ? ' ' : 'checked="checked" ') ?>/> <?php echo $user->lang['Disable_post_count'] ?></td> + </tr> + <tr> + <td><input type="checkbox" name="moderated"<?php echo ((!empty($moderated)) ? 'checked="checked" ' : ' ') ?>/> <?php echo $user->lang['Forum_is_moderated']; ?></td> + </tr> <?php + if ($mode == 'edit' && $parent_id > 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) { + ?> - <br /> - <input type="checkbox" name="display_on_index" <?php echo ((!empty($display_on_index)) ? '' : 'checked="checked" ') ?>/><?php echo $user->lang['Display_on_index'] ?> + <tr> + <td><input type="checkbox" name="display_on_index"<?php echo ((!empty($display_on_index)) ? 'checked="checked" ' : ' ') ?>/> <?php echo $user->lang['Display_on_index'] ?></td> + </tr> <?php + } } } ?> -</td></tr> + </td></table> + </tr> <?php + if ($mode == 'edit') { + ?> -<tr> - <td class="row1"><?php echo $user->lang['Forum_type'] ?></td> - <td class="row2"><input type="checkbox" name="set_category" /><?php echo $user->lang['Set_as_category'] ?><br /> - <input type="radio" name="action" value="delete" checked="checked" /><?php echo $user->lang['Delete_all_posts'] ?><br /> - <input type="radio" name="action" value="move" /><?php echo $user->lang['Move_posts_to'] ?> <select name="to_forum_id"><?php echo $forums_list ?></select> - </td> -</tr> + <tr> + <td class="row1"><?php echo $user->lang['Forum_type'] ?></td> + <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> + <tr> + <td><input type="checkbox" name="set_category" /> <?php echo $user->lang['Set_as_category'] ?></td> + </tr> + <tr> + <td> <input type="radio" name="action" value="delete" checked="checked" /> <?php echo $user->lang['Delete_all_posts'] ?></td> + </tr> + <tr> + <td> <input type="radio" name="action" value="move" /> <?php echo $user->lang['Move_posts_to'] ?> <select name="to_forum_id"><?php echo $forums_list ?></select></td> + </tr> + </table></td> + </tr> <?php + } + ?> -<tr> - <td class="row1"><?php echo $user->lang['Forum_pruning'] ?></td> - <td class="row2"><table cellspacing="0" cellpadding="1" border="0"> - <tr> - <td align="right" valign="middle"><?php echo $user->lang['Enabled'] ?></td> - <td align="left" valign="middle"><input type="checkbox" name="prune_enable" value="1" <?php echo $prune_enabled ?>/></td> - </tr> - <tr> - <td align="right" valign="middle"><?php echo $user->lang['prune_days'] ?></td> - <td align="left" valign="middle"> <input type="text" name="prune_days" value="<?php echo $prune_days ?>" size="5" class="post" /> <?php echo $user->lang['Days'] ?></td> - </tr> - <tr> - <td align="right" valign="middle"><?php echo $user->lang['prune_freq'] ?></td> - <td align="left" valign="middle"> <input type="text" name="prune_freq" value="<?php echo $prune_freq ?>" size="5" class="post" /> <?php echo $user->lang['Days'] ?></td> - </tr> - </table></td> -</tr> + <tr> + <td class="row1"><?php echo $user->lang['Forum_pruning'] ?></td> + <td class="row2"><table cellspacing="0" cellpadding="1" border="0"> + <tr> + <td align="right" valign="middle"><?php echo $user->lang['Enabled'] ?></td> + <td align="left" valign="middle"><input type="checkbox" name="prune_enable" value="1" <?php echo $prune_enabled ?>/></td> + </tr> + <tr> + <td align="right" valign="middle"><?php echo $user->lang['prune_days'] ?></td> + <td align="left" valign="middle"> <input class="post" type="text" name="prune_days" value="<?php echo $prune_days ?>" size="5" /> <?php echo $user->lang['Days'] ?></td> + </tr> + <tr> + <td align="right" valign="middle"><?php echo $user->lang['prune_freq'] ?></td> + <td align="left" valign="middle"> <input class="post" type="text" name="prune_freq" value="<?php echo $prune_freq ?>" size="5" /> <?php echo $user->lang['Days'] ?></td> + </tr> + </table></td> + </tr> <?php } + ?> -<tr> - <td class="cat" colspan="2" align="center"><input type="hidden" name="mode" value="<?php echo $newmode ?>" /><input type="hidden" name="forum_id" value="<?php echo $forum_id ?>" /><input type="submit" name="submit" value="<?php echo $buttonvalue ?>" class="mainoption" /></td> -</tr> -</table> -</form> + <tr> + <td class="cat" colspan="2" align="center"><input type="hidden" name="mode" value="<?php echo $newmode ?>" /><input type="hidden" name="forum_id" value="<?php echo $forum_id ?>" /><input class="mainoption" type="submit" name="submit" value="<?php echo $buttonvalue ?>" /></td> + </tr> +</table></form> <br clear="all" /> <?php diff --git a/phpBB/admin/admin_smilies.php b/phpBB/admin/admin_smilies.php index 09f0f3fdde..01024175e7 100644 --- a/phpBB/admin/admin_smilies.php +++ b/phpBB/admin/admin_smilies.php @@ -27,7 +27,8 @@ if ( !empty($setmodules) ) } $filename = basename(__FILE__); - $module['General']['Emoticons'] = $filename . $SID . '&mode=emoticons'; + $module['Posts']['Emoticons'] = $filename . $SID . '&type=emoticons'; + $module['Posts']['Topic_icons'] = $filename . $SID . '&type=icons'; return; } @@ -51,6 +52,15 @@ if (!$auth->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 = '<select name="smilies_pak">'; + $_paks_select = '<select name="smilies_pak">'; - foreach ($smilies_paks as $pak) + foreach ($_paks as $pak) { - $smilies_paks_select .= '<option>' . htmlspecialchars($pak) . '</option>'; + $_paks_select .= '<option>' . htmlspecialchars($pak) . '</option>'; } - $smilies_paks_select .= '</select>'; + $_paks_select .= '</select>'; } page_header($user->lang['Import_smilies']); @@ -198,13 +223,13 @@ if (isset($_POST['import_pak'])) <p><?php echo $user->lang['Import_smilies_explain'] ?></p> -<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> +<form method="post" action="admin_smilies.<?php echo $phpEx . $SID . '&type=' . $type; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> <tr> <th colspan="2"><?php echo $user->lang['Smilies_import'] ?></th> </tr> <tr> <td class="row2"><?php echo $user->lang['Select_package'] ?></td> - <td class="row2"><?php echo $smilies_paks_select ?></td> + <td class="row2"><?php echo $_paks_select ?></td> </tr> <tr> <td class="row1"><?php echo $user->lang['Delete_existing_smilies'] ?></td> @@ -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'])) <!-- function update_smile(newimage) { - document.smile_image.src = "<?php echo $phpbb_root_path . $board_config['smilies_path'] ?>/" + newimage; + document.smile_image.src = "<?php echo $phpbb_root_path . $config['smilies_path'] ?>/" + newimage; } function update_smile_dimensions() { @@ -286,7 +311,7 @@ function update_smile_dimensions() //--> </script> -<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&mode=create"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> +<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&mode=create">><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> <tr> <th colspan="2"><?php echo $user->lang['smile_config'] ?></th> </tr> @@ -296,7 +321,7 @@ function update_smile_dimensions() </tr> <tr> <td class="row1"><?php echo $user->lang['Smile_url'] ?></td> - <td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> <img name="smile_image" src="<?php echo (!empty($default_image)) ? $phpbb_root_path . $board_config['smilies_path'] . '/' . $default_image : '../images/spacer.gif' ?>" border="0" alt="" onLoad="update_smile_dimensions()" /> </td> + <td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> <img name="smile_image" src="<?php echo (!empty($default_image)) ? $phpbb_root_path . $config['smilies_path'] . '/' . $default_image : '../images/spacer.gif' ?>" border="0" alt="" onLoad="update_smile_dimensions()" /> </td> </tr> <tr> <td class="row2"><?php echo $user->lang['Smile_width'] ?></td> @@ -352,7 +377,7 @@ switch ($mode) $order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . $user->lang['First'] . '</option>' . $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) <!-- function update_smile(newimage) { - document.smile_image.src = "<?php echo $phpbb_root_path . $board_config['smilies_path'] ?>/" + newimage; + document.smile_image.src = "<?php echo $phpbb_root_path . $config['smilies_path'] ?>/" + newimage; } function update_smile_dimensions() { @@ -398,7 +423,7 @@ function update_smile_dimensions() </tr> <tr> <td class="row1"><?php echo $user->lang['Smile_url'] ?></td> - <td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> <img name="smile_image" src="<?php echo $phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_edit_img ?>" border="0" alt="" onLoad="update_smile_dimensions()" /> </td> + <td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> <img name="smile_image" src="<?php echo $phpbb_root_path . $config['smilies_path'] . '/' . $smile_edit_img ?>" border="0" alt="" onLoad="update_smile_dimensions()" /> </td> </tr> <tr> <td class="row2"><?php echo $user->lang['Smile_emotion'] ?></td> @@ -436,7 +461,7 @@ function update_smile_dimensions() $smile_height = intval($_POST['smile_height']); if ($smile_width == 0 || $smile_height == 0) { - $img_size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . stripslashes($_POST['smile_url'])); + $img_size = @getimagesize($phpbb_root_path . $config['smilies_path'] . '/' . stripslashes($_POST['smile_url'])); $smile_width = $img_size[0]; $smile_height = $img_size[1]; } @@ -490,12 +515,12 @@ function update_smile_dimensions() if ($mode == 'modify') { - $db->sql_query_array('UPDATE ' . SMILIES_TABLE . " SET WHERE smilies_id = $smile_id", $sql); + $db->sql_query('UPDATE ' . SMILIES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . "WHERE smilies_id = $smile_id"); message_die(MESSAGE, $user->lang['Smile_edited']); } else { - $db->sql_query_array('INSERT INTO ' . SMILIES_TABLE, $sql); + $db->sql_query('INSERT INTO ' . SMILIES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql)); message_die(MESSAGE, $user->lang['Smile_added']); } break; @@ -540,14 +565,30 @@ function update_smile_dimensions() <p><?php echo $user->lang['Emoticons_explain']; ?></p> -<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> +<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>"><table cellspacing="1" cellpadding="0" border="0" align="center"> <tr> - <th><?php echo $user->lang['Code']; ?></th> - <th><?php echo $user->lang['Smile']; ?></th> - <th><?php echo $user->lang['Emotion']; ?></th> - <th colspan="2"><?php echo $user->lang['Action']; ?></th> - <th colspan="2"><?php echo $user->lang['Reorder']; ?></th> + <td align="right"><?php echo $user->lang['Add_smile']; ?> | <?php echo $user->lang['Import_smilies']; ?> | <?php echo $user->lang['Export_smilies']; ?></td> </tr> + <tr> + <td><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> + <tr> +<?php + + if ($type == 'emoticons') + { + +?> + <th><?php echo $user->lang['Code']; ?></th> + <th><?php echo $user->lang['Emotion']; ?></th> +<?php + + } + +?> + <th><?php echo $user->lang['Smile']; ?></th> + <th colspan="2"><?php echo $user->lang['Action']; ?></th> + <th colspan="2"><?php echo $user->lang['Reorder']; ?></th> + </tr> <?php $spacer = FALSE; @@ -557,29 +598,42 @@ function update_smile_dimensions() { $spacer = TRUE; ?> - <tr> - <td class="row3" colspan="7" align="center"><?php echo $user->lang['Smilies_not_displayed'] ?></td> - </tr> + <tr> + <td class="row3" colspan="<?php echo ($type == 'emoticons') ? 7 : 5; ?>" align="center"><?php echo $user->lang['Smilies_not_displayed'] ?></td> + </tr> <?php } $row_class = ( $row_class != 'row1' ) ? 'row1' : 'row2'; ?> <tr> - <td class="<?php echo $row_class; ?>" align="center"><?php echo htmlspecialchars($row['code']); ?></td> - <td class="<?php echo $row_class; ?>" align="center"><img src="<?php echo './../' . $board_config['smilies_path'] . '/' . $row['smile_url']; ?>" width="<?php echo $row['smile_width']; ?>" height="<?php echo $row['smile_height']; ?>" alt="<?php echo htmlspecialchars($row['code']); ?>" /></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['emoticon']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=edit&smile_id=" . $row['smilies_id']; ?>"><?php echo $user->lang['Edit']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=delete&smile_id=" . $row['smilies_id']; ?>"><?php echo $user->lang['Delete']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=move_up&smile_order=" . $row['smile_order']; ?>"><?php echo $user->lang['Up']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=move_down&smile_order=" . $row['smile_order']; ?>"><?php echo $user->lang['Down']; ?></a></td> - </tr> +<?php + + if ($type == 'emoticons') + { + +?> + <td class="<?php echo $row_class; ?>" align="center"><?php echo htmlspecialchars($row['code']); ?></td> + <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['emoticon']; ?></td> +<?php + + } + +?> + <td class="<?php echo $row_class; ?>" align="center"><img src="<?php echo './../' . $config['smilies_path'] . '/' . $row['smile_url']; ?>" width="<?php echo $row['smile_width']; ?>" height="<?php echo $row['smile_height']; ?>" alt="<?php echo htmlspecialchars($row['code']); ?>" /></td> + <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=edit&smile_id=" . $row['smilies_id']; ?>"><?php echo $user->lang['Edit']; ?></a></td> + <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=delete&smile_id=" . $row['smilies_id']; ?>"><?php echo $user->lang['Delete']; ?></a></td> + <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=move_up&smile_order=" . $row['smile_order']; ?>"><?php echo $user->lang['Up']; ?></a></td> + <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_smilies.$phpEx$SID&mode=move_down&smile_order=" . $row['smile_order']; ?>"><?php echo $user->lang['Down']; ?></a></td> + </tr> <?php } ?> - <tr> - <td class="cat" colspan="7" align="center"><input type="submit" name="add" value="<?php echo $user->lang['Add_smile']; ?>" class="mainoption" /> <input class="liteoption" type="submit" name="import_pak" value="<?php echo $user->lang['Import_smilies']; ?>"> <input class="liteoption" type="submit" name="export_pak" value="<?php echo $user->lang['Export_smilies']; ?>"></td> + <tr> + <td class="cat" colspan="<?php echo ($type == 'emoticons') ? 7 : 5; ?>" align="center"><input type="submit" name="add" value="<?php echo $user->lang['Add_smile']; ?>" class="mainoption" /> <input class="liteoption" type="submit" name="import_pak" value="<?php echo $user->lang['Import_smilies']; ?>"> <input class="liteoption" type="submit" name="export_pak" value="<?php echo $user->lang['Export_smilies']; ?>"></td> + </tr> + </table></td> </tr> </table></form> diff --git a/phpBB/db/mysql.php b/phpBB/db/mysql.php index 1864fedfc2..fe2e93fee5 100644 --- a/phpBB/db/mysql.php +++ b/phpBB/db/mysql.php @@ -205,17 +205,17 @@ class sql_db } // Idea for this from Ikonboard - function sql_query_array($query = '', $assoc_ary = false) + function sql_build_array($query, $assoc_ary = false) { if (!is_array($assoc_ary)) { return false; } - if (preg_match('/^INSERT/', $query)) + $fields = array(); + $values = array(); + if ($query == 'INSERT') { - $fields = array(); - $values = array(); foreach ($assoc_ary as $key => $var) { $fields[] = $key; @@ -226,7 +226,7 @@ class sql_db } elseif (is_string($var)) { - $values[] = "'" . str_replace("'", "''", $var) . "'"; + $values[] = "'" . str_replace('\\\'', '\'\'', $var) . "'"; } else { @@ -236,7 +236,7 @@ class sql_db $query = $query . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; } - else + else if ($query == 'UPDATE') { $values = array(); foreach ($assoc_ary as $key => $var) @@ -247,18 +247,16 @@ class sql_db } elseif (is_string($var)) { - $values[] = "$key = '" . str_replace("'", "''", $var) . "'"; + $values[] = "$key = '" . str_replace('\\\'', '\'\'', $var) . "'"; } else { $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; } } - - $query = preg_replace('/^(.*? SET )(.*?)$/is', '\1' . implode(', ', $values) . ' \2', $query); } - return $this->sql_query($query); + return implode(', ', $values); } // diff --git a/phpBB/db/mysql4.php b/phpBB/db/mysql4.php index 0407515f38..a03216503c 100644 --- a/phpBB/db/mysql4.php +++ b/phpBB/db/mysql4.php @@ -205,17 +205,17 @@ class sql_db } // Idea for this from Ikonboard - function sql_query_array($query = '', $assoc_ary = false) + function sql_build_array($query, $assoc_ary = false) { if (!is_array($assoc_ary)) { return false; } - if (preg_match('/^INSERT/', $query)) + $fields = array(); + $values = array(); + if ($query == 'INSERT') { - $fields = array(); - $values = array(); foreach ($assoc_ary as $key => $var) { $fields[] = $key; @@ -226,7 +226,7 @@ class sql_db } elseif (is_string($var)) { - $values[] = "'" . str_replace("'", "''", $var) . "'"; + $values[] = "'" . str_replace('\\\'', '\'\'', $var) . "'"; } else { @@ -236,7 +236,7 @@ class sql_db $query = $query . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; } - else + else if ($query == 'UPDATE') { $values = array(); foreach ($assoc_ary as $key => $var) @@ -247,18 +247,16 @@ class sql_db } elseif (is_string($var)) { - $values[] = "$key = '" . str_replace("'", "''", $var) . "'"; + $values[] = "$key = '" . str_replace('\\\'', '\'\'', $var) . "'"; } else { $values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; } } - - $query = preg_replace('/^(.*? SET )(.*?)$/is', '\1' . implode(', ', $values) . ' \2', $query); } - return $this->sql_query($query); + return implode(', ', $values); } // diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f78a1a431f..b52f0fa54c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -27,7 +27,7 @@ class parse_message function parse(&$message, $html, $bbcode, $uid, $url, $smilies) { - global $config, $db, $lang; + global $config, $db, $user; $warn_msg = ''; @@ -44,9 +44,9 @@ class parse_message $message = preg_replace($match, $replace, $message); // Message length check - if ( !strlen($message) || ( $config['max_post_chars'] && strlen($message) > $config['max_post_chars'] ) ) + if ( !strlen($message) || ( $config['max_post_chars'] && strlen($message) > intval($config['max_post_chars']) ) ) { - $warn_msg .= ( !strlen($message) ) ? $lang['Too_few_chars'] . '<br />' : $lang['Too_many_chars'] . '<br />'; + $warn_msg .= ( !strlen($message) ) ? $user->lang['Too_few_chars'] . '<br />' : $user->lang['Too_many_chars'] . '<br />'; } // Smiley check @@ -64,9 +64,9 @@ class parse_message $match++; } - if ( $match > $config['max_post_smilies'] ) + if ( $match > intval($config['max_post_smilies']) ) { - $warn_msg .= $lang['Too_many_smilies'] . '<br />'; + $warn_msg .= $user->lang['Too_many_smilies'] . '<br />'; break; } } @@ -75,7 +75,7 @@ class parse_message } // Specialchars message here ... ? - $message = htmlspecialchars($message, ENT_COMPAT, $lang['ENCODING']); +// $message = htmlspecialchars($message, ENT_COMPAT, $user->lang['ENCODING']); if ( $warn_msg ) { @@ -92,7 +92,7 @@ class parse_message function html(&$message, $html) { - global $config, $lang; + global $config, $user; if ( $html ) { @@ -137,15 +137,15 @@ class parse_message $replace = array(); // relative urls for this board - $match[] = '#' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/([^\t <\n\r\"]+)#i'; + $match[] = '#' . $server_protocol . trim($config['server_name']) . $server_port . preg_replace('/^\/?(.*?)(\/)?$/', '\1', trim($config['script_path'])) . '/([^\t\n\r <"\']+)#i'; $replace[] = '<a href="\1" target="_blank">\1</a>'; // matches a xxxx://aaaaa.bbb.cccc. ... - $match[] = '#([\n ])([\w]+?://.*?)([\t\n\r <"\'])#ie'; + $match[] = '#([\n ])([\w]+?://.*?)([^\t\n\r <"\'])#ie'; $replace[] = "'\\1<!-- m --><a href=\"\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->\\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<!-- m --><a href=\"http://\\2\" target=\"_blank\">' . ( ( strlen('\\2') > 55 ) ?substr('\\2', 0, 39) . ' ... ' . substr('\\2', -10) : '\\2' ) . '</a><!-- m -->'"; // 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 "<br /><br />\n\n"; - echo "cleaned_text => " . htmlentities($text); - echo "<br /><br />\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) ) + 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)) . ")"; + 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) ) { - $word_id[$row['word_text']] = $row['word_id']; + $word_ids[$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); + $new_words = array_diff($unique_add_words, array_keys($word_ids)); + unset($unique_add_words); - switch( SQL_LAYER ) + if (sizeof($new_words)) { - case 'postgresql': - case 'msaccess': - case 'mssql-odbc': - case 'oracle': - case 'db2': - foreach ( $new_words as $word ) - { + 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 ('" . $word . "')"; + VALUES " . implode(', ', preg_replace('#^(.*)$#', '(\'\1\')', $new_words)); $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 ) - { + break; + case 'mssql': $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) - VALUES $value_sql"; + VALUES " . implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \'\1\'', $new_words)); $db->sql_query($sql); - } + break; + } } + unset($new_words); } - $unique_words = array_unique(array_merge($words['del']['text'], $words['del']['title'])); - - $word_id = array(); - if ( count($unique_words) ) + foreach ($words['del'] as $word_in => $word_ary) { - $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); + $title_match = ( $word_in == 'title' ) ? 1 : 0; - while ( $row = $db->sql_fetchrow($result) ) + $sql = ''; + if (sizeof($word_ary)) { - if ( !empty($words['del']['title']) ) - { - $words['del']['title'][] = $row['word_id']; - } - - if ( !empty($words['del']['text']) ) + foreach ($word_ary as $word) { - $words['del']['text'][] = $row['word_id']; + $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); } - $db->sql_freeresult($result); - - unset($unique_words); } - foreach ( $words as $sql_type => $word_in_ary ) + foreach ($words['add'] 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 != '' ) - { - echo "<br />" . $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); - } + 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 "<br /><br />"; - echo $mtime[1] + $mtime[0] - $starttime; - echo "<br /><br />"; - print_r($new_words); - echo "<br /><br />"; - print_r($del_words); - echo "<br /><br />"; +// $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)) ? '<br />' : '') . $user->lang['To_few_poll_options']; + $err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $user->lang['Too_few_poll_options']; } else if (sizeof($poll_options) > intval($config['max_poll_options'])) { - $err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $user->lang['To_many_poll_options']; + $err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $user->lang['Too_many_poll_options']; + } + else if (sizeof($poll_options) < $poll_options_size) + { + $err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $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 = '<input type="hidden" name="mode" value="' . $mode . '" />'; - -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 .= '<input type="hidden" name="f" value="' . $forum_id . '" />'; break; case 'reply': $page_title = $user->lang['Post_a_reply']; - $s_hidden_fields .= '<input type="hidden" name="t" value="' . $topic_id . '" />'; + $s_action .= '&t=' . intval($topic_id); break; case 'edit': $page_title = $user->lang['Edit_Post']; - $s_hidden_fields .= '<input type="hidden" name="p" value="' . $post_id . '" />'; + $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 = '<option value="-1">' . $user->lang['All_available'] . '</option>' . $s_forums; +/*if ( $s_forums != '' ) { $s_forums = '<option value="-1">' . $user->lang['All_available'] . '</option>' . $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) { </tr> <!-- ENDIF --> <tr> - <td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td> - <td class="row2" width="78%"><input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" /></td> + <td class="row1" width="24%"><span class="gen"><b>{L_SUBJECT}</b></span></td> + <td class="row2" width="76%"><input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" /></td> </tr> <tr> - <td class="row1" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="1"> + <td class="row1" valign="top"><span class="gen"><b>{L_MESSAGE_BODY}</b></span><br /><span class="gensmall">{L_MESSAGE_BODY_EXPLAIN}</span><br /><br /><table width="80%" cellspacing="5" cellpadding="0" border="0" align="center"> <tr> - <td><span class="gen"><b>{L_MESSAGE_BODY}</b></span> </td> + <td align="center"><span class="gensmall"><b>{L_EMOTICONS}</b></span></td> </tr> <tr> - <td valign="middle" align="center"><br /><table width="120" cellspacing="0" cellpadding="5" border="0"> - <tr> - <td class="gensmall" align="center"><b>{L_EMOTICONS}</b></td> - </tr> - <tr> - <td align="center"><!-- BEGIN emoticon --> <a href="javascript:emoticon('{emoticon.SMILEY_CODE}')"><img src="{emoticon.SMILEY_IMG}" width="{emoticon.SMILEY_WIDTH}" height="{emoticon.SMILEY_HEIGHT}" border="0" alt="{emoticon.SMILEY_DESC}" title="{emoticon.SMILEY_DESC}" onclick="emoticon('{emoticon.SMILEY_CODE}');return false" hspace="2" vspace="2" /></a> <!-- END emoticon --></td> - </tr> - <!-- IF S_SHOW_EMOTICON_LINK --> - <tr> - <td colspan="{S_SMILIES_COLSPAN}" align="center"><span class="nav"><a href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=250');return false;" target="_phpbbsmilies" class="nav">{L_MORE_SMILIES}</a></span></td> - </tr> - <!-- ENDIF --> - </table></td> + <td align="center"><!-- BEGIN emoticon --><a href="javascript:emoticon('{emoticon.SMILEY_CODE}')"><img src="{emoticon.SMILEY_IMG}" width="{emoticon.SMILEY_WIDTH}" height="{emoticon.SMILEY_HEIGHT}" border="0" alt="{emoticon.SMILEY_DESC}" title="{emoticon.SMILEY_DESC}" onclick="emoticon('{emoticon.SMILEY_CODE}');return false" hspace="2" vspace="2" /></a> <!-- END emoticon --></td> + </tr> + <!-- IF S_SHOW_EMOTICON_LINK --> + <tr> + <td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=350,resizable=yes,scrollbars=yes,WIDTH=300');return false;" target="_phpbbsmilies">{L_MORE_SMILIES}</a></td> </tr> + <!-- ENDIF --> </table></td> - <td class="row2" valign="top"><span class="gen"><table width="450" border="0" cellspacing="0" cellpadding="2"> + <td class="row2" valign="top"><table width="450" cellspacing="0" cellpadding="2" border="0"> <tr align="center" valign="middle"> <td><input type="button" class="button" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onClick="bbstyle(0)" onMouseOver="helpline('b')" /></td> <td><input type="button" class="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onClick="bbstyle(2)" onMouseOver="helpline('i')" /></td> @@ -318,6 +311,7 @@ function storeCaret(textEl) { </tr> <tr> <td colspan="9"><textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea></td> + <td align="center" valign="top"></td> </tr> <tr> <td colspan="9"><table id="ColorPanel" cellspacing="0" cellpadding="0" border="0" align="center"> @@ -330,7 +324,7 @@ function storeCaret(textEl) { rgb(pas,width1,height1,text1,text2); //--></script></td> - + </tr> </table></td> </tr> </table></td> 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) { //--> </script> -<table width="100%" cellspacing="0" cellpadding="10" border="0"> +<table width="100%" cellspacing="2" cellpadding="0" border="0"> <tr> <td><table class="forumline" width="100%" cellspacing="1" cellpadding="4" border="0"> <tr> <th class="thHead" height="25">{L_EMOTICONS}</th> </tr> <tr> - <td align="center" valign="middle"><!-- BEGIN emoticon --> <a href="javascript:emoticon('{emoticon.SMILEY_CODE}')"><img src="{emoticon.SMILEY_IMG}" width="{emoticon.SMILEY_WIDTH}" height="{emoticon.SMILEY_HEIGHT}" border="0" alt="{emoticon.SMILEY_DESC}" title="{emoticon.SMILEY_DESC}" hspace="2" vspace="2" onclick="emoticon('{emoticon.SMILEY_CODE}');return false" /></a> <!-- END emoticon --></td> - </tr> - <tr> - <td align="center"><br /><span class="genmed"><a href="javascript:window.close();" class="genmed">{L_CLOSE_WINDOW}</a></span></td> + <td class="row1" align="center" valign="middle"><!-- BEGIN emoticon --> <a href="javascript:emoticon('{emoticon.SMILEY_CODE}')"><img src="{emoticon.SMILEY_IMG}" width="{emoticon.SMILEY_WIDTH}" height="{emoticon.SMILEY_HEIGHT}" border="0" alt="{emoticon.SMILEY_DESC}" title="{emoticon.SMILEY_DESC}" hspace="2" vspace="2" onclick="emoticon('{emoticon.SMILEY_CODE}');return false" /></a> <!-- END emoticon --><br /><a class="nav" href="javascript:window.close();">{L_CLOSE_WINDOW}</a></td> </tr> </table></td> </tr> 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 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html dir="{S_CONTENT_DIRECTION}"> <head> -<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" /> -<meta http-equiv="Content-Style-Type" content="text/css" /> -<style type="text/css"> -<!-- ---> -</style> +<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}"> +<meta http-equiv="Content-Style-Type" content="text/css"> {META} -<title>{SITENAME} :: {PAGE_TITLE}</title> <link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css"> <style type="text/css"> <!-- {T_STYLESHEET_DATA} + +body {margin:0px;padding:0px;border:0px} //--> </style> +<title>{SITENAME} :: {PAGE_TITLE}</title> </head> <body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}"> 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 = '<a href="' . $temp_url . '">' . $user->img('icon_edit', $user->lang['Edit_delete_post']) . '</a>'; $edit = '<a href="' . $temp_url . '">' . $user->lang['Edit_delete_post'] . '</a>'; } |