1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 15:45:34 +02:00

Dumped sql_query_array, replaced with build_array, posting updates, fixed quoting in mysql layers, fulltext enabled ... speed/problem feedback welcome

git-svn-id: file:///svn/phpbb/trunk@2986 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-10-30 18:59:09 +00:00
parent 9273252cfc
commit 0a4f369681
14 changed files with 677 additions and 652 deletions

View File

@ -168,6 +168,7 @@ switch ($mode)
$forum_style = (!empty($_POST['forum_style'])) ? intval($_POST['forum_style']) : 'NULL'; $forum_style = (!empty($_POST['forum_style'])) ? intval($_POST['forum_style']) : 'NULL';
$post_count_inc = (!empty($_POST['disable_post_count'])) ? 0 : 1; $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_enable = (!empty($_POST['prune_enable'])) ? 1 : 0;
$prune_days = intval($_POST['prune_days']); $prune_days = intval($_POST['prune_days']);
@ -198,8 +199,8 @@ switch ($mode)
$right_id = $left_id + 1; $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) $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, $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); $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>'); $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_enable' => (!empty($_POST['prune_enable'])) ? 1 : 0,
'prune_days' => intval($_POST['prune_days']), 'prune_days' => intval($_POST['prune_days']),
'prune_freq' => intval($_POST['prune_freq']), 'prune_freq' => intval($_POST['prune_freq']),
'display_on_index' => (!isset($_POST['display_on_index']) || !empty($_POST['display_on_index'])) ? 1 : 0, 'display_on_index' => (!empty($_POST['display_on_index'])) ? 1 : 0,
'post_count_inc' => (!empty($_POST['disable_post_count'])) ? 0 : 1 'post_count_inc' => (!empty($_POST['disable_post_count'])) ? 0 : 1,
'moderated' => (!empty($_POST['moderated'])) ? 1 : 0,
); );
if (!empty($_POST['set_category']) && $action) if (!empty($_POST['set_category']) && $action)
@ -249,8 +251,8 @@ switch ($mode)
$sql['forum_posts'] = 0; $sql['forum_posts'] = 0;
$sql['forum_topics'] = 0; $sql['forum_topics'] = 0;
} }
echo 'UPDATE ' . FORUMS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . " WHERE forum_id = $forum_id";
$db->sql_query_array('UPDATE ' . FORUMS_TABLE . " SET WHERE forum_id = $forum_id", $sql); $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 = $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); message_die(MESSAGE, $message);
@ -400,6 +402,7 @@ switch ($mode)
$forum_name = (!empty($_POST['forum_name'][$parent_id])) ? htmlspecialchars($_POST['forum_name'][$parent_id]) : ''; $forum_name = (!empty($_POST['forum_name'][$parent_id])) ? htmlspecialchars($_POST['forum_name'][$parent_id]) : '';
$post_count_inc = TRUE; $post_count_inc = TRUE;
$moderated = FALSE;
$prune_enabled = ''; $prune_enabled = '';
$prune_days = 7; $prune_days = 7;
@ -424,16 +427,15 @@ switch ($mode)
<p><?php echo $user->lang['Forum_edit_delete_explain'] ?></p> <p><?php echo $user->lang['Forum_edit_delete_explain'] ?></p>
<form action="<?php echo "admin_forums.$phpEx$SID" ?>" method="post"> <form action="<?php echo "admin_forums.$phpEx$SID" ?>" method="post"><table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0" align="center">
<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline" align="center"> <tr>
<tr> <th colspan="2"><?php echo $user->lang['General_settings'] ?></th>
<th class="thHead" colspan="2"><?php echo $user->lang['General_settings'] ?></th> </tr>
</tr> <tr>
<tr>
<td class="row1"><?php echo ($forum_status != ITEM_CATEGORY) ? $user->lang['Forum_name'] : $user->lang['Category_name'] ?></td> <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> <td class="row2"><input type="text" size="25" name="forum_name" value="<?php echo $forum_name ?>" class="post" /></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Forum_desc'] ?></td> <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> <td class="row2"><textarea rows="5" cols="45" wrap="virtual" name="forum_desc" class="post"><?php echo $forum_desc ?></textarea></td>
</tr> </tr>
@ -441,75 +443,95 @@ switch ($mode)
if ($mode == 'add' || $forum_status == ITEM_CATEGORY) if ($mode == 'add' || $forum_status == ITEM_CATEGORY)
{ {
?> ?>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Forum_type'] ?></td> <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'] ?> &nbsp; <input type="radio" name="is_category" value="1" <?php echo $category_checked ?>/><?php echo $user->lang['Category'] ?></td> <td class="row2"><input type="radio" name="is_category" value="0" <?php echo $forum_checked ?>/><?php echo $user->lang['Forum'] ?> &nbsp; <input type="radio" name="is_category" value="1" <?php echo $category_checked ?>/><?php echo $user->lang['Category'] ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Parent'] ?></td> <td class="row1"><?php echo $user->lang['Parent'] ?></td>
<td class="row2"><select name="parent_id"> <td class="row2"><select name="parent_id"><option value="0"><?php echo $user->lang['No_parent'] ?></option><?php echo $parents_list ?></select></td>
<option value="0"><?php echo $user->lang['No_parent'] ?></option> </tr>
<?php echo $parents_list ?></select></td> <tr>
</tr>
<tr>
<td class="row1"><?php echo $user->lang['Style'] ?></td> <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> <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>
<?php <?php
if ($forum_status != ITEM_CATEGORY) if ($forum_status != ITEM_CATEGORY)
{ {
?> ?>
<tr> <tr>
<th class="thHead" colspan="2"><?php echo $user->lang['Forum_settings'] ?></th> <th colspan="2"><?php echo $user->lang['Forum_settings'] ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Forum_status'] ?></td> <td class="row1"><?php echo $user->lang['Forum_status'] ?></td>
<td class="row2"><select name="forum_status"><?php echo $statuslist ?></select></td> <td class="row2"><select name="forum_status"><?php echo $statuslist ?></select></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Options'] ?></td> <td class="row1"><?php echo $user->lang['Options'] ?></td>
<td class="row2"> <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<input type="checkbox" name="disable_post_count" <?php echo ((!empty($post_count_inc)) ? '' : 'checked="checked" ') ?>/><?php echo $user->lang['Disable_post_count'] ?> <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 <?php
if ($mode == 'edit' && $parent_id > 0) if ($mode == 'edit' && $parent_id > 0)
{ {
//
// if this forum is a subforum put the "display on index" checkbox // if this forum is a subforum put the "display on index" checkbox
//
if ($parent_info = get_forum_info($parent_id)) if ($parent_info = get_forum_info($parent_id))
{ {
if ($parent_info['parent_id'] > 0 || $parent_info['forum_status'] != ITEM_CATEGORY) if ($parent_info['parent_id'] > 0 || $parent_info['forum_status'] != ITEM_CATEGORY)
{ {
?> ?>
<br /> <tr>
<input type="checkbox" name="display_on_index" <?php echo ((!empty($display_on_index)) ? '' : 'checked="checked" ') ?>/><?php echo $user->lang['Display_on_index'] ?> <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 <?php
} }
} }
} }
?> ?>
</td></tr> </td></table>
</tr>
<?php <?php
if ($mode == 'edit') if ($mode == 'edit')
{ {
?> ?>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Forum_type'] ?></td> <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 /> <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
&nbsp; &nbsp; &nbsp;<input type="radio" name="action" value="delete" checked="checked" /><?php echo $user->lang['Delete_all_posts'] ?><br /> <tr>
&nbsp; &nbsp; &nbsp;<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><input type="checkbox" name="set_category" /> <?php echo $user->lang['Set_as_category'] ?></td>
</td> </tr>
</tr> <tr>
<td>&nbsp; &nbsp; &nbsp;<input type="radio" name="action" value="delete" checked="checked" /> <?php echo $user->lang['Delete_all_posts'] ?></td>
</tr>
<tr>
<td>&nbsp; &nbsp; &nbsp;<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 <?php
} }
?> ?>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Forum_pruning'] ?></td> <td class="row1"><?php echo $user->lang['Forum_pruning'] ?></td>
<td class="row2"><table cellspacing="0" cellpadding="1" border="0"> <td class="row2"><table cellspacing="0" cellpadding="1" border="0">
<tr> <tr>
@ -518,23 +540,23 @@ switch ($mode)
</tr> </tr>
<tr> <tr>
<td align="right" valign="middle"><?php echo $user->lang['prune_days'] ?></td> <td align="right" valign="middle"><?php echo $user->lang['prune_days'] ?></td>
<td align="left" valign="middle">&nbsp;<input type="text" name="prune_days" value="<?php echo $prune_days ?>" size="5" class="post" />&nbsp;<?php echo $user->lang['Days'] ?></td> <td align="left" valign="middle">&nbsp;<input class="post" type="text" name="prune_days" value="<?php echo $prune_days ?>" size="5" />&nbsp;<?php echo $user->lang['Days'] ?></td>
</tr> </tr>
<tr> <tr>
<td align="right" valign="middle"><?php echo $user->lang['prune_freq'] ?></td> <td align="right" valign="middle"><?php echo $user->lang['prune_freq'] ?></td>
<td align="left" valign="middle">&nbsp;<input type="text" name="prune_freq" value="<?php echo $prune_freq ?>" size="5" class="post" />&nbsp;<?php echo $user->lang['Days'] ?></td> <td align="left" valign="middle">&nbsp;<input class="post" type="text" name="prune_freq" value="<?php echo $prune_freq ?>" size="5" />&nbsp;<?php echo $user->lang['Days'] ?></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
<?php <?php
} }
?> ?>
<tr> <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> <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> </tr>
</table> </table></form>
</form>
<br clear="all" /> <br clear="all" />
<?php <?php

View File

@ -27,7 +27,8 @@ if ( !empty($setmodules) )
} }
$filename = basename(__FILE__); $filename = basename(__FILE__);
$module['General']['Emoticons'] = $filename . $SID . '&amp;mode=emoticons'; $module['Posts']['Emoticons'] = $filename . $SID . '&amp;type=emoticons';
$module['Posts']['Topic_icons'] = $filename . $SID . '&amp;type=icons';
return; return;
} }
@ -51,6 +52,15 @@ if (!$auth->acl_get('a_general'))
// //
// Check to see what mode we should operate in. // 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'])) if (isset($_POST['mode']) || isset($_GET['mode']))
{ {
$mode = (!empty($_POST['mode'])) ? $_POST['mode'] : $_GET['mode']; $mode = (!empty($_POST['mode'])) ? $_POST['mode'] : $_GET['mode'];
@ -60,25 +70,40 @@ else
$mode = ''; $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 = '=+:'; $delimiter = '=+:';
$smilies_images = $smilies_paks = array(); $_images = $_paks = array();
if ($mode == 'edit' || !empty($_POST['add']) || !empty($_POST['import_pak'])) 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)) 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]))) 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)) 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 (isset($_POST['import_pak']))
{ {
if (!empty($_POST['smilies_pak'])) if (!empty($_POST['_pak']))
{ {
$smile_order = 0; $smile_order = 0;
// //
@ -98,11 +123,11 @@ if (isset($_POST['import_pak']))
// //
if (!empty($_POST['clear_current'])) if (!empty($_POST['clear_current']))
{ {
$db->sql_query('DELETE FROM ' . SMILIES_TABLE); $db->sql_query('DELETE FROM ' . $table);
} }
else else
{ {
$result = $db->sql_query('SELECT code FROM ' . SMILIES_TABLE); $result = $db->sql_query('SELECT code FROM ' . $table);
$smilies = array(); $smilies = array();
while ($row = $db->sql_fetchrow($result)) 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)) 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) foreach ($fcontents as $line)
{ {
$smile_data = explode($delimiter, trim($line)); $_data = explode($delimiter, trim($line));
$smile_url = $smile_data[0]; $_url = $_data[0];
$emotion = $smile_data[1]; $emotion = $_data[1];
$code = htmlentities($smile_data[2]); $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 // 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. // arbitrary set it to 15 and let the user correct it later.
// //
$size = @getimagesize($phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_url); $size = @getimagesize($phpbb_root_path . $path . '/' . $smile_url);
$smile_width = (!empty($size[0])) ? $size[0] : 15; $_width = (!empty($size[0])) ? $size[0] : 15;
$smile_height = (!empty($size[1])) ? $size[1] : 15; $_height = (!empty($size[1])) ? $size[1] : 15;
} }
else else
{ {
$smile_width = $smile_data[3]; $_width = $_data[3];
$smile_height = $smile_data[4]; $_height = $_data[4];
} }
if (!empty($smilies[$code])) if (!empty($smilies[$code]))
@ -149,12 +174,12 @@ if (isset($_POST['import_pak']))
{ {
$code_sql = str_replace("'", "''", str_replace('\\', '\\\\', $code)); $code_sql = str_replace("'", "''", str_replace('\\', '\\\\', $code));
$sql = array( $sql = array(
'smile_url' => $smile_url, 'smile_url' => $_url,
'smile_height' => $smile_height, 'smile_height' => $_height,
'smile_width' => $smile_width, 'smile_width' => $_width,
'emoticon' => $emotion '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 else
@ -163,33 +188,33 @@ if (isset($_POST['import_pak']))
$sql = array( $sql = array(
'code' => $code, 'code' => $code,
'smile_url' => $smile_url, 'smile_url' => $_url,
'smile_height' => $smile_height, 'smile_height' => $_height,
'smile_width' => $smile_width, 'smile_width' => $_width,
'smile_order' => $smile_order, 'smile_order' => $_order,
'emoticon' => $emotion '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 else
{ {
if (!count($smilies_paks)) if (!count($_paks))
{ {
$smilies_paks_select = $user->lang['No_smilies_pak']; $_paks_select = $user->lang['No_smilies_pak'];
} }
else 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']); page_header($user->lang['Import_smilies']);
@ -198,13 +223,13 @@ if (isset($_POST['import_pak']))
<p><?php echo $user->lang['Import_smilies_explain'] ?></p> <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 . '&amp;type=' . $type; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th colspan="2"><?php echo $user->lang['Smilies_import'] ?></th> <th colspan="2"><?php echo $user->lang['Smilies_import'] ?></th>
</tr> </tr>
<tr> <tr>
<td class="row2"><?php echo $user->lang['Select_package'] ?></td> <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>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Delete_existing_smilies'] ?></td> <td class="row1"><?php echo $user->lang['Delete_existing_smilies'] ?></td>
@ -230,7 +255,7 @@ elseif (isset($_GET['export_pak']))
{ {
$smilies_pak = ''; $smilies_pak = '';
$result = $db->sql_query('SELECT * FROM ' . SMILIES_TABLE); $result = $db->sql_query('SELECT * FROM ' . $table);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$smilies_pak .= $row['smile_url'] . $delimiter; $smilies_pak .= $row['smile_url'] . $delimiter;
@ -256,7 +281,7 @@ elseif (isset($_POST['export_pak']))
elseif (isset($_POST['add'])) elseif (isset($_POST['add']))
{ {
$filename_list = ''; $filename_list = '';
foreach ($smilies_images as $smile_url) foreach ($_images as $smile_url)
{ {
if (!isset($default_image)) if (!isset($default_image))
{ {
@ -273,7 +298,7 @@ elseif (isset($_POST['add']))
<!-- <!--
function update_smile(newimage) 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() function update_smile_dimensions()
{ {
@ -286,7 +311,7 @@ function update_smile_dimensions()
//--> //-->
</script> </script>
<form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&amp;mode=create"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> <form method="post" action="admin_smilies.<?php echo $phpEx . $SID ?>&amp;mode=create">><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr> <tr>
<th colspan="2"><?php echo $user->lang['smile_config'] ?></th> <th colspan="2"><?php echo $user->lang['smile_config'] ?></th>
</tr> </tr>
@ -296,7 +321,7 @@ function update_smile_dimensions()
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Smile_url'] ?></td> <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> &nbsp; <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()" /> &nbsp;</td> <td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> &nbsp; <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()" /> &nbsp;</td>
</tr> </tr>
<tr> <tr>
<td class="row2"><?php echo $user->lang['Smile_width'] ?></td> <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; $order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . $user->lang['First'] . '</option>' . $order_list;
$filename_list = ''; $filename_list = '';
foreach ($smilies_images as $smile_url) foreach ($_images as $smile_url)
{ {
if ($smile_url == $smile_data['smile_url']) if ($smile_url == $smile_data['smile_url'])
{ {
@ -375,7 +400,7 @@ switch ($mode)
<!-- <!--
function update_smile(newimage) 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() function update_smile_dimensions()
{ {
@ -398,7 +423,7 @@ function update_smile_dimensions()
</tr> </tr>
<tr> <tr>
<td class="row1"><?php echo $user->lang['Smile_url'] ?></td> <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> &nbsp; <img name="smile_image" src="<?php echo $phpbb_root_path . $board_config['smilies_path'] . '/' . $smile_edit_img ?>" border="0" alt="" onLoad="update_smile_dimensions()" /> &nbsp;</td> <td class="row1"><select name="smile_url" onChange="update_smile(this.options[selectedIndex].value);"><?php echo $filename_list ?></select> &nbsp; <img name="smile_image" src="<?php echo $phpbb_root_path . $config['smilies_path'] . '/' . $smile_edit_img ?>" border="0" alt="" onLoad="update_smile_dimensions()" /> &nbsp;</td>
</tr> </tr>
<tr> <tr>
<td class="row2"><?php echo $user->lang['Smile_emotion'] ?></td> <td class="row2"><?php echo $user->lang['Smile_emotion'] ?></td>
@ -436,7 +461,7 @@ function update_smile_dimensions()
$smile_height = intval($_POST['smile_height']); $smile_height = intval($_POST['smile_height']);
if ($smile_width == 0 || $smile_height == 0) 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_width = $img_size[0];
$smile_height = $img_size[1]; $smile_height = $img_size[1];
} }
@ -490,12 +515,12 @@ function update_smile_dimensions()
if ($mode == 'modify') 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']); message_die(MESSAGE, $user->lang['Smile_edited']);
} }
else 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']); message_die(MESSAGE, $user->lang['Smile_added']);
} }
break; break;
@ -540,11 +565,27 @@ function update_smile_dimensions()
<p><?php echo $user->lang['Emoticons_explain']; ?></p> <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> <tr>
<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['Code']; ?></th>
<th><?php echo $user->lang['Smile']; ?></th>
<th><?php echo $user->lang['Emotion']; ?></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['Action']; ?></th>
<th colspan="2"><?php echo $user->lang['Reorder']; ?></th> <th colspan="2"><?php echo $user->lang['Reorder']; ?></th>
</tr> </tr>
@ -558,16 +599,27 @@ function update_smile_dimensions()
$spacer = TRUE; $spacer = TRUE;
?> ?>
<tr> <tr>
<td class="row3" colspan="7" align="center"><?php echo $user->lang['Smilies_not_displayed'] ?></td> <td class="row3" colspan="<?php echo ($type == 'emoticons') ? 7 : 5; ?>" align="center"><?php echo $user->lang['Smilies_not_displayed'] ?></td>
</tr> </tr>
<?php <?php
} }
$row_class = ( $row_class != 'row1' ) ? 'row1' : 'row2'; $row_class = ( $row_class != 'row1' ) ? 'row1' : 'row2';
?> ?>
<tr> <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 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"><?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&amp;mode=edit&amp;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&amp;mode=edit&amp;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&amp;mode=delete&amp;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&amp;mode=delete&amp;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&amp;mode=move_up&amp;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&amp;mode=move_up&amp;smile_order=" . $row['smile_order']; ?>"><?php echo $user->lang['Up']; ?></a></td>
@ -579,7 +631,9 @@ function update_smile_dimensions()
?> ?>
<tr> <tr>
<td class="cat" colspan="7" align="center"><input type="submit" name="add" value="<?php echo $user->lang['Add_smile']; ?>" class="mainoption" />&nbsp;&nbsp;<input class="liteoption" type="submit" name="import_pak" value="<?php echo $user->lang['Import_smilies']; ?>">&nbsp;&nbsp;<input class="liteoption" type="submit" name="export_pak" value="<?php echo $user->lang['Export_smilies']; ?>"></td> <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" />&nbsp;&nbsp;<input class="liteoption" type="submit" name="import_pak" value="<?php echo $user->lang['Import_smilies']; ?>">&nbsp;&nbsp;<input class="liteoption" type="submit" name="export_pak" value="<?php echo $user->lang['Export_smilies']; ?>"></td>
</tr>
</table></td>
</tr> </tr>
</table></form> </table></form>

View File

@ -205,17 +205,17 @@ class sql_db
} }
// Idea for this from Ikonboard // 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)) if (!is_array($assoc_ary))
{ {
return false; return false;
} }
if (preg_match('/^INSERT/', $query))
{
$fields = array(); $fields = array();
$values = array(); $values = array();
if ($query == 'INSERT')
{
foreach ($assoc_ary as $key => $var) foreach ($assoc_ary as $key => $var)
{ {
$fields[] = $key; $fields[] = $key;
@ -226,7 +226,7 @@ class sql_db
} }
elseif (is_string($var)) elseif (is_string($var))
{ {
$values[] = "'" . str_replace("'", "''", $var) . "'"; $values[] = "'" . str_replace('\\\'', '\'\'', $var) . "'";
} }
else else
{ {
@ -236,7 +236,7 @@ class sql_db
$query = $query . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; $query = $query . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')';
} }
else else if ($query == 'UPDATE')
{ {
$values = array(); $values = array();
foreach ($assoc_ary as $key => $var) foreach ($assoc_ary as $key => $var)
@ -247,18 +247,16 @@ class sql_db
} }
elseif (is_string($var)) elseif (is_string($var))
{ {
$values[] = "$key = '" . str_replace("'", "''", $var) . "'"; $values[] = "$key = '" . str_replace('\\\'', '\'\'', $var) . "'";
} }
else else
{ {
$values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; $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);
} }
// //

View File

@ -205,17 +205,17 @@ class sql_db
} }
// Idea for this from Ikonboard // 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)) if (!is_array($assoc_ary))
{ {
return false; return false;
} }
if (preg_match('/^INSERT/', $query))
{
$fields = array(); $fields = array();
$values = array(); $values = array();
if ($query == 'INSERT')
{
foreach ($assoc_ary as $key => $var) foreach ($assoc_ary as $key => $var)
{ {
$fields[] = $key; $fields[] = $key;
@ -226,7 +226,7 @@ class sql_db
} }
elseif (is_string($var)) elseif (is_string($var))
{ {
$values[] = "'" . str_replace("'", "''", $var) . "'"; $values[] = "'" . str_replace('\\\'', '\'\'', $var) . "'";
} }
else else
{ {
@ -236,7 +236,7 @@ class sql_db
$query = $query . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')'; $query = $query . ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')';
} }
else else if ($query == 'UPDATE')
{ {
$values = array(); $values = array();
foreach ($assoc_ary as $key => $var) foreach ($assoc_ary as $key => $var)
@ -247,18 +247,16 @@ class sql_db
} }
elseif (is_string($var)) elseif (is_string($var))
{ {
$values[] = "$key = '" . str_replace("'", "''", $var) . "'"; $values[] = "$key = '" . str_replace('\\\'', '\'\'', $var) . "'";
} }
else else
{ {
$values[] = (is_bool($var)) ? "$key = " . intval($var) : "$key = $var"; $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);
} }
// //

View File

@ -27,7 +27,7 @@ class parse_message
function parse(&$message, $html, $bbcode, $uid, $url, $smilies) function parse(&$message, $html, $bbcode, $uid, $url, $smilies)
{ {
global $config, $db, $lang; global $config, $db, $user;
$warn_msg = ''; $warn_msg = '';
@ -44,9 +44,9 @@ class parse_message
$message = preg_replace($match, $replace, $message); $message = preg_replace($match, $replace, $message);
// Message length check // 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 // Smiley check
@ -64,9 +64,9 @@ class parse_message
$match++; $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; break;
} }
} }
@ -75,7 +75,7 @@ class parse_message
} }
// Specialchars message here ... ? // Specialchars message here ... ?
$message = htmlspecialchars($message, ENT_COMPAT, $lang['ENCODING']); // $message = htmlspecialchars($message, ENT_COMPAT, $user->lang['ENCODING']);
if ( $warn_msg ) if ( $warn_msg )
{ {
@ -92,7 +92,7 @@ class parse_message
function html(&$message, $html) function html(&$message, $html)
{ {
global $config, $lang; global $config, $user;
if ( $html ) if ( $html )
{ {
@ -137,15 +137,15 @@ class parse_message
$replace = array(); $replace = array();
// relative urls for this board // 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>'; $replace[] = '<a href="\1" target="_blank">\1</a>';
// matches a xxxx://aaaaa.bbb.cccc. ... // 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'"; $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 // 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 -->'"; $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. // 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; global $user, $config;
static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!', '*'); static $drop_char_match, $drop_char_replace, $stopwords, $synonyms;
static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' ', ' ');
$stopwords_list = @file($user->lang_path . '/search_stopwords.txt'); if (empty($drop_char_match))
$synonym_list = @file($user->lang_path . '/search_synonyms.txt'); {
$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(); $match = array();
// New lines, carriage returns // New lines, carriage returns
$match[] = "#[\n\r]+#"; $match[] = "#[\n\r]+#";
// HTML and NCRs like &nbsp; etc. // NCRs like &nbsp; etc.
$match[] = '#<(.*?)>.*?<\/\1>#'; // BAD! $match[] = '#&[\#a-z0-9]+?;#i';
$match[] = '#\b&\#?[a-z0-9]+;\b#';
// URL's // URL's
$match[] = '#\b[\w]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?#'; $match[] = '#\b[\w]+:\/\/[a-z0-9\.\-]+(\/[a-z0-9\?\.%_\-\+=&\/]+)?#';
// BBcode // BBcode
@ -192,26 +196,23 @@ class fulltext_search
$match[] = '#\[\/?url(=.*?)?\]#'; $match[] = '#\[\/?url(=.*?)?\]#';
$match[] = '#\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]#'; $match[] = '#\[\/?[a-z\*=\+\-]+(\:?[0-9a-z]+)?:[a-z0-9]{10,}(\:[a-z0-9]+)?=?.*?\]#';
// Sequences < min_search_chars & < max_search_chars // 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) . ' '); $text = preg_replace($match, ' ', ' ' . strtolower($text) . ' ');
// Filter out non-alphabetical chars // Filter out non-alphabetical chars
for($i = 0; $i < count($drop_char_match); $i++) $text = str_replace($drop_char_match, $drop_char_replace, $text);
{
$text = str_replace($drop_char_match[$i], $drop_char_replace[$i], $text);
}
if ( !empty($stopwords_list) ) 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' ) ) if ( $mode == 'post' || ( $match_synonym != 'not' && $match_synonym != 'and' && $match_synonym != 'or' ) )
{ {
$text = preg_replace('#\b' . trim($match_synonym) . '\b#', ' ' . trim($replace_synonym) . ' ', $text); $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); preg_match_all('/\b([\w]+)\b/', $text, $split_entries);
return array_unique($split_entries[1]); return array_unique($split_entries[1]);
} }
@ -231,8 +228,8 @@ class fulltext_search
{ {
global $config, $db; global $config, $db;
$mtime = explode(' ', microtime()); // $mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0]; // $starttime = $mtime[1] + $mtime[0];
// Split old and new post/subject to obtain array of 'words' // Split old and new post/subject to obtain array of 'words'
$split_text = $this->split_words($message); $split_text = $this->split_words($message);
@ -245,71 +242,65 @@ class fulltext_search
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
WHERE m.post_id = " . intval($post_id) . " WHERE m.post_id = " . intval($post_id) . "
AND w.word_id = m.word_id"; AND w.word_id = m.word_id";
$result = $db->sql_query($result); $result = $db->sql_query($sql);
$cur_words = array(); $cur_words = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$which = ($row['title_match']) ? 'title' : 'post'; $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); $db->sql_freeresult($result);
$words['add']['post'] = array_diff($split_text, $cur_words['post']); $words['add']['post'] = array_diff($split_text, array_keys($cur_words['post']));
$words['add']['title'] = array_diff($split_title, $cur_words['title']); $words['add']['title'] = array_diff($split_title, array_keys($cur_words['title']));
$words['del']['post'] = array_diff($cur_words['post'], $split_text); $words['del']['post'] = array_diff(array_keys($cur_words['post']), $split_text);
$words['del']['title'] = array_diff($cur_words['title'], $split_title); $words['del']['title'] = array_diff(array_keys($cur_words['title']), $split_title);
} }
else else
{ {
$words['add']['post'] = $split_text; $words['add']['post'] = $split_text;
$words['add']['title'] = $split_title; $words['add']['title'] = $split_title;
$words['del']['post'] = array();
$words['del']['title'] = array();
} }
unset($split_text); unset($split_text);
unset($split_title); unset($split_title);
// Get unique words from the above arrays // 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 // 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 // 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) // 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 // 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 $sql = "SELECT word_id, word_text
FROM " . SEARCH_WORD_TABLE . " 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); $result = $db->sql_query($sql);
$word_ids = array();
while ( $row = $db->sql_fetchrow($result) ) 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); $db->sql_freeresult($result);
foreach ( $unique_words as $word ) $new_words = array_diff($unique_add_words, array_keys($word_ids));
{ unset($unique_add_words);
if ( empty($word_id[$word]) )
{
$new_words[] = $row['word_text'];
}
}
unset($unique_words);
switch( SQL_LAYER ) if (sizeof($new_words))
{
switch (SQL_LAYER)
{ {
case 'postgresql': case 'postgresql':
case 'msaccess': case 'msaccess':
case 'mssql-odbc': case 'mssql-odbc':
case 'oracle': case 'oracle':
case 'db2': case 'db2':
foreach ( $new_words as $word ) foreach ($new_words as $word)
{ {
$sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text) $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
VALUES ('" . $word . "')"; VALUES ('" . $word . "')";
@ -317,88 +308,58 @@ class fulltext_search
} }
break; break;
default:
switch( SQL_LAYER )
{
case 'mysql': case 'mysql':
case 'mysql4': 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) $sql = "INSERT INTO " . SEARCH_WORD_TABLE . " (word_text)
VALUES $value_sql"; VALUES " . implode(', ', preg_replace('#^(.*)$#', '(\'\1\')', $new_words));
$db->sql_query($sql); $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);
} }
$unique_words = array_unique(array_merge($words['del']['text'], $words['del']['title'])); foreach ($words['del'] as $word_in => $word_ary)
$word_id = array();
if ( count($unique_words) )
{ {
$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) )
{
if ( !empty($words['del']['title']) )
{
$words['del']['title'][] = $row['word_id'];
}
if ( !empty($words['del']['text']) )
{
$words['del']['text'][] = $row['word_id'];
}
}
$db->sql_freeresult($result);
unset($unique_words);
}
foreach ( $words as $sql_type => $word_in_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))
{ {
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)"; foreach ($word_ary as $word)
{
$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_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($words);
unset($word_in_ary);
$mtime = explode(' ', microtime()); // $mtime = explode(' ', microtime());
echo "<br /><br />"; // echo "Search parser time taken >> " . ($mtime[1] + $mtime[0] - $starttime);
echo $mtime[1] + $mtime[0] - $starttime;
echo "<br /><br />";
print_r($new_words);
echo "<br /><br />";
print_r($del_words);
echo "<br /><br />";
// Run the cleanup infrequently, once per session cleanup // 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) function generate_smilies($mode)
{ {
global $SID, $auth, $db, $session, $config, $template, $theme, $lang; global $SID, $auth, $db, $user, $config, $template;
global $user_ip, $starttime; global $starttime, $phpEx, $phpbb_root_path;
global $phpEx, $phpbb_root_path;
global $user, $userdata;
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); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
'smiliesbody' => 'posting_smilies.html') 'body' => 'posting_smilies.html')
); );
} }
@ -495,18 +454,18 @@ function generate_smilies($mode)
$sql = "SELECT emoticon, code, smile_url, smile_width, smile_height $sql = "SELECT emoticon, code, smile_url, smile_width, smile_height
FROM " . SMILIES_TABLE . " FROM " . SMILIES_TABLE . "
$where_sql $where_sql
ORDER BY smile_order, smile_width, smile_height, smilies_id"; ORDER BY smile_order";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$num_smilies = 0; $num_smilies = 0;
$smile_array = array(); $smile_array = array();
if ( $row = $db->sql_fetchrow($result) ) if ($row = $db->sql_fetchrow($result))
{ {
do 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( $template->assign_block_vars('emoticon', array(
'SMILEY_CODE' => $row['code'], 'SMILEY_CODE' => $row['code'],
@ -521,30 +480,27 @@ function generate_smilies($mode)
$num_smilies++; $num_smilies++;
} }
} }
while ( ( $row = $db->sql_fetchrow($result) ) ); while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result); $db->sql_freeresult($result);
if ( $mode == 'inline' && $num_smilies >= 20 ) if ($mode == 'inline' && $num_smilies >= 20)
{ {
$template->assign_vars(array( $template->assign_vars(array(
'S_SHOW_EMOTICON_LINK' => true, 'S_SHOW_EMOTICON_LINK' => true,
'L_MORE_SMILIES' => $lang['More_emoticons'], 'L_MORE_SMILIES' => $user->lang['More_emoticons'],
'U_MORE_SMILIES' => "posting.$phpEx$SID&amp;mode=smilies") 'U_MORE_SMILIES' => "posting.$phpEx$SID&amp;mode=smilies")
); );
} }
$template->assign_vars(array( $template->assign_vars(array(
'L_EMOTICONS' => $lang['Emoticons'], 'L_EMOTICONS' => $user->lang['Emoticons'],
'L_CLOSE_WINDOW' => $lang['Close_window'], 'L_CLOSE_WINDOW' => $user->lang['Close_window'])
'S_SMILIES_COLSPAN' => $s_colspan)
); );
} }
if ( $mode == 'window' ) if ($mode == 'window')
{ {
$template->display('smiliesbody');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
} }

View File

@ -422,6 +422,7 @@ $lang = array_merge($lang, array(
'General_settings' => 'General settings', 'General_settings' => 'General settings',
'Forum_settings' => 'Forum settings', 'Forum_settings' => 'Forum settings',
'Disable_post_count' => 'Disable post count', 'Disable_post_count' => 'Disable post count',
'Forum_is_moderated' => 'Moderated forum',
'Display_on_index' => 'Display a link to this forum on index', '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_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', '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', 'prune_days' => 'Remove topics that have not been posted to in',
'Set_as_category' => 'Set this forum as a category and', 'Set_as_category' => 'Set this forum as a category and',
'Forum_delete' => 'Delete Forum', '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.', '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_and_Delete' => 'Move and Delete',
'Move_posts_to' => 'Move posts to', 'Move_posts_to' => 'Move posts to',

View File

@ -256,6 +256,7 @@ $lang = array_merge($lang, array(
'Very_good' => 'Very Good', 'Very_good' => 'Very Good',
'Total_votes' => 'Total Votes', 'Total_votes' => 'Total Votes',
'Message_body' => 'Message body', 'Message_body' => 'Message body',
'Message_body_explain' => 'Enter your message here, it may contain no more than %d characters.',
'Topic_review' => 'Topic review', 'Topic_review' => 'Topic review',
'Topic_icon' => 'Topic icon', 'Topic_icon' => 'Topic icon',
'No_post_mode' => 'No post mode specified', '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_replied' => 'Sorry but you may not delete posts that have been replied to',
'Cannot_delete_poll' => 'Sorry but you cannot delete an active poll', 'Cannot_delete_poll' => 'Sorry but you cannot delete an active poll',
'Empty_poll_title' => 'You must enter a title for your poll', 'Empty_poll_title' => 'You must enter a title for your poll',
'To_few_poll_options' => 'You must enter at least two poll options', 'Too_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_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', 'Post_has_no_poll' => 'This post has no poll',
'Already_voted' => 'You have already voted in this poll', 'Already_voted' => 'You have already voted in this poll',
'No_vote_option' => 'You must specify an option when voting', 'No_vote_option' => 'You must specify an option when voting',

View File

@ -35,38 +35,13 @@ $auth->acl($user->data);
extract($_GET); extract($_GET);
extract($_POST); 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 // Was cancel pressed? If so then redirect to the appropriate page
if ( !empty($cancel) ) 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); 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) switch ($mode)
{ {
case 'post': 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; break;
case 'reply': case 'reply':
if (empty($topic_id)) if (empty($t))
{ {
trigger_error($user->lang['No_topic_id']); trigger_error($user->lang['No_topic_id']);
} }
$sql = "SELECT * $sql = 'SELECT t.*, f.post_count_inc
FROM " . TOPICS_TABLE . " FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
WHERE topic_id = $topic_id"; WHERE t.topic_id = ' . intval($t) . '
AND f.forum_id = t.forum_id';
break; break;
case 'quote': case 'quote':
case 'edit': case 'edit':
case 'delete': case 'delete':
if (empty($post_id)) if (empty($p))
{ {
trigger_error($user->lang['No_post_id']); trigger_error($user->lang['No_post_id']);
} }
$sql = "SELECT t.*, p.*, pt.* $sql = 'SELECT t.*, p.*, pt.*, f.post_count_inc
FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt, " . TOPICS_TABLE . " t FROM ' . POSTS_TABLE . ' p, ' . POSTS_TEXT_TABLE . ' pt, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
WHERE p.post_id = $post_id WHERE p.post_id = ' . intval($p) . '
AND t.topic_id = p.topic_id 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; break;
default: default:
@ -236,16 +230,22 @@ if (isset($post))
// Process poll options // Process poll options
if (!empty($poll_option_text) && (($auth->acl_get('f_poll', $forum_id) && empty($poll_last_vote)) || $auth->acl_get('a_'))) 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); $result = $parse_msg->parse($poll_option_text, $enable_html, $enable_bbcode, $bbcode_uid, $enable_urls, $enable_smilies);
$poll_options = explode("\n", $poll_option_text); $poll_options = explode("\n", $poll_option_text);
if (sizeof($poll_options) == 1) 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'])) 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))) : ''; $poll_subject = (!empty($poll_subject)) ? trim(htmlspecialchars(strip_tags($poll_subject))) : '';
@ -280,12 +280,12 @@ if (isset($post))
{ {
$db->sql_transaction(); $db->sql_transaction();
// topic info
if ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)) 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( $topic_sql = array(
'forum_id' => intval($forum_id), 'forum_id' => intval($forum_id),
'topic_title' => sql_quote($subject), 'topic_title' => $subject,
'topic_poster' => intval($user->data['user_id']), 'topic_poster' => intval($user->data['user_id']),
'topic_time' => $current_time, 'topic_time' => $current_time,
'topic_type' => intval($type), 'topic_type' => intval($type),
@ -300,56 +300,50 @@ if (isset($post))
'poll_length' => $poll_length * 3600 '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; $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( $post_sql = array(
'topic_id' => intval($topic_id), 'topic_id' => intval($topic_id),
'forum_id' => intval($forum_id), 'forum_id' => intval($forum_id),
'poster_id' => ($mode == 'edit') ? intval($poster_id) : intval($user->data['user_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, 'poster_ip' => $user->ip,
'post_time' => $current_time, 'post_time' => $current_time,
'post_approved' => ($forum_moderated) ? 0 : 1, '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_sig' => $enable_html,
'enable_bbcode' => $enable_bbcode, 'enable_bbcode' => $enable_bbcode,
'enable_html' => $enable_html, 'enable_html' => $enable_html,
'enable_smilies' => $enable_smilies, 'enable_smilies' => $enable_smilies,
'enable_magic_url' => $enable_urls, '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_id = ($mode == 'edit') ? $post_id : $db->sql_nextid();
// post_text ... may merge into posts table // 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_text_sql = array(
'post_subject' => sql_quote(htmlspecialchars($subject)), 'post_subject' => htmlspecialchars($subject),
'bbcode_uid' => $bbcode_uid, 'bbcode_uid' => $bbcode_uid,
'post_id' => intval($post_id), 'post_id' => intval($post_id),
); );
if ($mode != 'edit' || $message_md5 != $post_checksum) if ($mode != 'edit' || $message_md5 != $post_checksum)
{ {
$post_text_sql = array_merge($post_text_sql, array( $post_text_sql = array_merge($post_text_sql, array(
'post_checksum' => $message_md5, '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 // poll options
if ($mode != 'edit' || $message_md5 != $post_checksum)
{
// $result = $search->add($mode, $post_id, $message, $subject);
}
// Add/Update poll options ... incomplete(!)
if (!empty($poll_options)) if (!empty($poll_options))
{ {
$cur_poll_options = array(); $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 ... // Sync forums, topics and users ...
if ($mode != 'edit') if ($mode != 'edit')
{ {
// Update forums: last post info, topics, posts
$forum_topics_sql = ($mode == 'post') ? ', forum_topics = forum_topics + 1' : ''; $forum_topics_sql = ($mode == 'post') ? ', forum_topics = forum_topics + 1' : '';
$forum_sql = array( $forum_sql = array(
'forum_last_post_id' => intval($post_id), '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_id' => intval($user->data['user_id']),
'forum_last_poster_name'=> ($username != '') ? $username : '', '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_sql = array(
'topic_last_post_id' => intval($post_id), 'topic_last_post_id' => intval($post_id),
'topic_last_post_time' => $current_time, 'topic_last_post_time' => $current_time,
'topic_last_poster_id' => intval($user->data['user_id']), 'topic_last_poster_id' => intval($user->data['user_id']),
'topic_last_poster_name'=> ($username != '') ? $username : '', 'topic_last_poster_name'=> ($username != '') ? $username : '',
); );
if ($mode == 'post') if ($mode == 'post')
{ {
$topic_sql = array_merge($topic_sql, array( $topic_sql = array_merge($topic_sql, array(
@ -414,9 +415,12 @@ if (isset($post))
'topic_first_poster_name' => ($username != '') ? $username : '', '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 . ' $sql = 'UPDATE ' . USERS_TABLE . '
SET user_posts = user_posts + 1 SET user_posts = user_posts + 1
@ -449,8 +453,8 @@ if (isset($post))
} }
// Houston, we have an error ... // Houston, we have an error ...
$post_text = &$message; $post_text = &stripslashes($message);
$post_subject = $topic_title = &$subject; $post_subject = $topic_title = &stripslashes($subject);
$topic_icon = &$icon; $topic_icon = &$icon;
$topic_type = &$type; $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); $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); $notify_checked = (isset($notify_set)) ? $notify_set : (($user->data['user_id'] != ANONYMOUS) ? $user->data['user_notify'] : 0);
// Page title/hidden fields // Page title & action URL
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />'; $s_action = "posting.$phpEx$SID&amp;mode=$mode&amp;f=" . intval($forum_id);
switch ($mode)
switch( $mode )
{ {
case 'post': case 'post':
$page_title = $user->lang['Post_a_new_topic']; $page_title = $user->lang['Post_a_new_topic'];
$s_hidden_fields .= '<input type="hidden" name="f" value="' . $forum_id . '" />';
break; break;
case 'reply': case 'reply':
$page_title = $user->lang['Post_a_reply']; $page_title = $user->lang['Post_a_reply'];
$s_hidden_fields .= '<input type="hidden" name="t" value="' . $topic_id . '" />'; $s_action .= '&amp;t=' . intval($topic_id);
break; break;
case 'edit': case 'edit':
$page_title = $user->lang['Edit_Post']; $page_title = $user->lang['Edit_Post'];
$s_hidden_fields .= '<input type="hidden" name="p" value="' . $post_id . '" />'; $s_action .= '&amp;p=' . intval($post_id);
break; break;
} }
@ -613,7 +615,9 @@ $template->assign_vars(array(
'L_TOPIC_ICON' => $user->lang['Topic_icon'], 'L_TOPIC_ICON' => $user->lang['Topic_icon'],
'L_SUBJECT' => $user->lang['Subject'], 'L_SUBJECT' => $user->lang['Subject'],
'L_MESSAGE_BODY' => $user->lang['Message_body'], '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_OPTIONS' => $user->lang['Options'],
'L_EMOTICONS' => $user->lang['Emoticons'],
'L_PREVIEW' => $user->lang['Preview'], 'L_PREVIEW' => $user->lang['Preview'],
'L_SPELLCHECK' => $user->lang['Spellcheck'], 'L_SPELLCHECK' => $user->lang['Spellcheck'],
'L_SUBMIT' => $user->lang['Submit'], 'L_SUBMIT' => $user->lang['Submit'],
@ -654,7 +658,7 @@ $template->assign_vars(array(
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id", 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&amp;f=$forum_id",
'U_VIEWTOPIC' => ($mode != 'post') ? "viewtopic.$phpEx$SID&amp;t=$topic_id" : '', 'U_VIEWTOPIC' => ($mode != 'post') ? "viewtopic.$phpEx$SID&amp;t=$topic_id" : '',
'U_REVIEW_TOPIC' => ($mode != 'post') ? "posting.$phpEx$SID&amp;mmode=topicreview&amp;t=$topic_id" : '', 'U_REVIEW_TOPIC' => ($mode != 'post') ? "posting.$phpEx$SID&amp;mmode=topicreview&amp;t=$topic_id" : '',
'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&amp;mode=moderators&amp;f=' . $forum_id, 'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&amp;mode=moderators&amp;f=' . intval($forum_id),
'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
'S_HTML_CHECKED' => ($html_checked) ? 'checked="checked"' : '', 'S_HTML_CHECKED' => ($html_checked) ? 'checked="checked"' : '',
@ -671,20 +675,19 @@ $template->assign_vars(array(
'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_ALLOWED' => $smilies_status,
'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id)) ? true : false, 'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id)) ? true : false,
'S_NOTIFY_ALLOWED' => ($user->data['user_id'] != ANONYMOUS) ? 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_TYPE_TOGGLE' => $topic_type_toggle,
'S_TOPIC_ID' => $topic_id, 'S_TOPIC_ID' => intval($topic_id),
'S_POST_ACTION' => "posting.$phpEx$SID", 'S_POST_ACTION' => $s_action)
'S_HIDDEN_FIELDS' => $s_hidden_fields)
); );
// Poll entry // 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( $template->assign_vars(array(
'S_SHOW_POLL_BOX' => true, '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_A_POLL' => $user->lang['Add_poll'],
'L_ADD_POLL_EXPLAIN' => $user->lang['Add_poll_explain'], 'L_ADD_POLL_EXPLAIN' => $user->lang['Add_poll_explain'],

View File

@ -1147,7 +1147,7 @@ if ( $search_keywords != '' || $search_author != '' || $search_id )
// //
// Search forum // 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 FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
WHERE f.cat_id = c.cat_id WHERE f.cat_id = c.cat_id
ORDER BY c.cat_id, f.forum_order"; 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; $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']); message_die(MESSAGE, $user->lang['No_searchable_forums']);
} }
*/
// //
// Number of chars returned // Number of chars returned
// //

View File

@ -263,31 +263,24 @@ function storeCaret(textEl) {
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<tr> <tr>
<td class="row1" width="22%"><span class="gen"><b>{L_SUBJECT}</b></span></td> <td class="row1" width="24%"><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="row2" width="76%"><input type="text" name="subject" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{SUBJECT}" /></td>
</tr> </tr>
<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> <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>
<tr> <tr>
<td valign="middle" align="center"><br /><table width="120" cellspacing="0" cellpadding="5" border="0"> <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>
<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> </tr>
<!-- IF S_SHOW_EMOTICON_LINK --> <!-- IF S_SHOW_EMOTICON_LINK -->
<tr> <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> <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> </tr>
<!-- ENDIF --> <!-- ENDIF -->
</table></td> </table></td>
</tr> <td class="row2" valign="top"><table width="450" cellspacing="0" cellpadding="2" border="0">
</table></td>
<td class="row2" valign="top"><span class="gen"><table width="450" border="0" cellspacing="0" cellpadding="2">
<tr align="center" valign="middle"> <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="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> <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>
<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 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>
<tr> <tr>
<td colspan="9"><table id="ColorPanel" cellspacing="0" cellpadding="0" border="0" align="center"> <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); rgb(pas,width1,height1,text1,text2);
//--></script></td> //--></script></td>
</tr>
</table></td> </table></td>
</tr> </tr>
</table></td> </table></td>

View File

@ -17,17 +17,14 @@ function emoticon(text) {
//--> //-->
</script> </script>
<table width="100%" cellspacing="0" cellpadding="10" border="0"> <table width="100%" cellspacing="2" cellpadding="0" border="0">
<tr> <tr>
<td><table class="forumline" width="100%" cellspacing="1" cellpadding="4" border="0"> <td><table class="forumline" width="100%" cellspacing="1" cellpadding="4" border="0">
<tr> <tr>
<th class="thHead" height="25">{L_EMOTICONS}</th> <th class="thHead" height="25">{L_EMOTICONS}</th>
</tr> </tr>
<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> <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>
<tr>
<td align="center"><br /><span class="genmed"><a href="javascript:window.close();" class="genmed">{L_CLOSE_WINDOW}</a></span></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>

View File

@ -4,20 +4,18 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}"> <html dir="{S_CONTENT_DIRECTION}">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" /> <meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
<meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
-->
</style>
{META} {META}
<title>{SITENAME} :: {PAGE_TITLE}</title>
<link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css"> <link rel="stylesheet" href="{T_STYLESHEET_LINK}" type="text/css">
<style type="text/css"> <style type="text/css">
<!-- <!--
{T_STYLESHEET_DATA} {T_STYLESHEET_DATA}
body {margin:0px;padding:0px;border:0px}
//--> //-->
</style> </style>
<title>{SITENAME} :: {PAGE_TITLE}</title>
</head> </head>
<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}"> <body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">

View File

@ -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_') ) 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&amp;mode=edit&amp;p=" . $row['post_id']; $temp_url = "posting.$phpEx$SID&amp;mode=edit&amp;f=" . $row['forum_id'] . "&amp;p=" . $row['post_id'];
$edit_img = '<a href="' . $temp_url . '">' . $user->img('icon_edit', $user->lang['Edit_delete_post']) . '</a>'; $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>'; $edit = '<a href="' . $temp_url . '">' . $user->lang['Edit_delete_post'] . '</a>';
} }