mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Posting and acl option updates
git-svn-id: file:///svn/phpbb/trunk@2972 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
7cc1dbf6b0
commit
595a39122f
10 changed files with 637 additions and 1115 deletions
|
@ -371,8 +371,8 @@ switch ( $mode )
|
||||||
<td class="row2"><input type="text" maxlength="4" size="4" name="pm_max_boxes" value="<?php echo $new['pm_max_boxes']; ?>" /></td>
|
<td class="row2"><input type="text" maxlength="4" size="4" name="pm_max_boxes" value="<?php echo $new['pm_max_boxes']; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><?php echo $user->lang['Boxes_limit']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Boxes_limit_explain']; ?></span></td>
|
<td class="row1"><?php echo $user->lang['Edit_time']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Edit_time_explain']; ?></span></td>
|
||||||
<td class="row2"><input type="text" maxlength="4" size="4" name="pm_max_msgs" value="<?php echo $new['pm_max_msgs']; ?>" /></td>
|
<td class="row2"><input type="text" maxlength="3" size="3" name="edit_time" value="<?php echo $new['edit_time']; ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><?php echo $user->lang['Flood_Interval']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Flood_Interval_explain']; ?></span></td>
|
<td class="row1"><?php echo $user->lang['Flood_Interval']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Flood_Interval_explain']; ?></span></td>
|
||||||
|
|
|
@ -146,8 +146,6 @@ function prune($forum_id, $prune_date)
|
||||||
{
|
{
|
||||||
global $db, $lang, $phpEx, $phpbb_root_path;
|
global $db, $lang, $phpEx, $phpbb_root_path;
|
||||||
|
|
||||||
require_once($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
|
|
||||||
|
|
||||||
// Those without polls ...
|
// Those without polls ...
|
||||||
$sql = "SELECT t.topic_id
|
$sql = "SELECT t.topic_id
|
||||||
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
|
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
|
||||||
|
@ -577,7 +575,12 @@ class auth_admin extends auth
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function acl_add_option($new_options)
|
// Add a new option to the list ... $options is a hash of form ->
|
||||||
|
// $options = array(
|
||||||
|
// 'local' => array('option1', 'option2', ...),
|
||||||
|
// 'global' => array('optionA', 'optionB', ...)
|
||||||
|
// );
|
||||||
|
function acl_add_option($options)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
@ -586,7 +589,7 @@ class auth_admin extends auth
|
||||||
trigger_error('Incorrect parameter for acl_add_option', E_USER_ERROR);
|
trigger_error('Incorrect parameter for acl_add_option', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array();
|
$cur_options = array();
|
||||||
|
|
||||||
$sql = "SELECT auth_value, is_global, is_local
|
$sql = "SELECT auth_value, is_global, is_local
|
||||||
FROM " . ACL_OPTIONS_TABLE . "
|
FROM " . ACL_OPTIONS_TABLE . "
|
||||||
|
@ -595,13 +598,13 @@ class auth_admin extends auth
|
||||||
|
|
||||||
while ( $row = $db->sql_fetchrow($result) )
|
while ( $row = $db->sql_fetchrow($result) )
|
||||||
{
|
{
|
||||||
if ( isset($row['is_global']) )
|
if ( !empty($row['is_global']) )
|
||||||
{
|
{
|
||||||
$options['global'][] = $row['auth_value'];
|
$cur_options['global'][] = $row['auth_value'];
|
||||||
}
|
}
|
||||||
if ( isset($row['is_local']) )
|
if ( !empty($row['is_local']) )
|
||||||
{
|
{
|
||||||
$options['local'][] = $row['auth_value'];
|
$cur_options['local'][] = $row['auth_value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -614,15 +617,65 @@ class auth_admin extends auth
|
||||||
// Here we need to insert new options ... this requires
|
// Here we need to insert new options ... this requires
|
||||||
// discovering whether an options is global, local or both
|
// discovering whether an options is global, local or both
|
||||||
// and whether we need to add an option type flag (x_)
|
// and whether we need to add an option type flag (x_)
|
||||||
foreach ($new_options as $type => $option_ary)
|
$new_options = array();
|
||||||
|
foreach ($options as $type => $option_ary)
|
||||||
{
|
{
|
||||||
|
$option_ary = array_unique($option_ary);
|
||||||
foreach ($option_ary as $option_value)
|
foreach ($option_ary as $option_value)
|
||||||
{
|
{
|
||||||
$options[$type][] = $option_value;
|
if (!in_array($option_value, $cur_options[$type]))
|
||||||
|
{
|
||||||
|
$new_options[$type][] = $option_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$flag = substr($option_value, 0, strpos($option_value, '_') + 1);
|
||||||
|
if (!in_array($flag, $cur_options[$type]) && !in_array($flag, $new_options[$type]))
|
||||||
|
{
|
||||||
|
$new_options[$type][] = $flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($options);
|
||||||
|
|
||||||
|
$options = array();
|
||||||
|
$options['local'] = array_diff($new_options['local'], $new_options['global']);
|
||||||
|
$options['global'] = array_diff($new_options['global'], $new_options['local']);
|
||||||
|
$options['local_global'] = array_intersect($new_options['local'], $new_options['global']);
|
||||||
|
|
||||||
|
$type_sql = array('local' => '0, 1', 'global' => '1, 0', 'local_global' => '1, 1');
|
||||||
|
|
||||||
|
$sql = '';
|
||||||
|
foreach ($options as $type => $option_ary)
|
||||||
|
{
|
||||||
|
foreach ($option_ary as $option)
|
||||||
|
{
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'mysql':
|
||||||
|
case 'mysql4':
|
||||||
|
$sql .= ( ($sql != '') ? ', ' : '' ) . "('$option', " . $type_sql[$type] . ")";
|
||||||
|
break;
|
||||||
|
case 'mssql':
|
||||||
|
$sql .= ( ($sql != '') ? ' UNION ALL ' : '' ) . " SELECT '$option', " . $type_sql[$type];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sql = "INSERT INTO " . ACL_OPTIONS_TABLE . " (auth_value, is_global, is_local)
|
||||||
|
VALUES ($option, " . $type_sql[$type] . ")";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
$sql = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acl_cache_options($options);
|
if ( $sql != '' )
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO " . ACL_OPTIONS_TABLE . " (auth_value, is_global, is_local)
|
||||||
|
VALUES $sql";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->acl_cache_options($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function acl_cache_options($options = false)
|
function acl_cache_options($options = false)
|
||||||
|
|
|
@ -79,7 +79,7 @@ class parse_message
|
||||||
|
|
||||||
if ( $warn_msg )
|
if ( $warn_msg )
|
||||||
{
|
{
|
||||||
// return $warn_msg;
|
return $warn_msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
$warn_msg .= $this->html($message, $html);
|
$warn_msg .= $this->html($message, $html);
|
||||||
|
@ -182,12 +182,12 @@ class fulltext_search
|
||||||
{
|
{
|
||||||
function split_words(&$text)
|
function split_words(&$text)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $board_config;
|
global $user, $board_config;
|
||||||
|
|
||||||
static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!', '*');
|
static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!', '*');
|
||||||
static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' ', ' ');
|
||||||
$stopwords_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt');
|
$stopwords_list = @file($user->lang_path . '/search_stopwords.txt');
|
||||||
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
|
$synonym_list = @file($user->lang_path . '/search_synonyms.txt');
|
||||||
|
|
||||||
$match = array();
|
$match = array();
|
||||||
// New lines, carriage returns
|
// New lines, carriage returns
|
||||||
|
@ -212,9 +212,9 @@ class fulltext_search
|
||||||
$text = str_replace($drop_char_match[$i], $drop_char_replace[$i], $text);
|
$text = str_replace($drop_char_match[$i], $drop_char_replace[$i], $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($stopword_list) )
|
if ( !empty($stopwords_list) )
|
||||||
{
|
{
|
||||||
$text = str_replace($stopword_list, '', $text);
|
$text = str_replace($stopwords_list, '', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($synonym_list) )
|
if ( !empty($synonym_list) )
|
||||||
|
@ -547,777 +547,4 @@ function generate_smilies($mode)
|
||||||
// END NEW CODE
|
// END NEW CODE
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
|
|
||||||
// ---------------------------------------------
|
|
||||||
// OLD CODE FROM 2.0.x
|
|
||||||
//
|
|
||||||
define('BBCODE_UID_LEN', 10);
|
|
||||||
|
|
||||||
$html_entities_match = array('#&#', '#<#', '#>#');
|
|
||||||
$html_entities_replace = array('&', '<', '>');
|
|
||||||
|
|
||||||
$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
|
|
||||||
$unhtml_specialchars_replace = array('>', '<', '"', '&');
|
|
||||||
|
|
||||||
//
|
|
||||||
// This function will prepare a posted message for
|
|
||||||
// entry into the database.
|
|
||||||
//
|
|
||||||
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
|
|
||||||
{
|
|
||||||
global $board_config;
|
|
||||||
global $html_entities_match, $html_entities_replace;
|
|
||||||
global $code_entities_match, $code_entities_replace;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Clean up the message
|
|
||||||
//
|
|
||||||
$message = trim($message);
|
|
||||||
|
|
||||||
if ( $html_on )
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
$end_html = 0;
|
|
||||||
$start_html = 1;
|
|
||||||
$tmp_message = '';
|
|
||||||
$message = ' ' . $message . ' ';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while ( $start_html = strpos($message, '<', $start_html) )
|
|
||||||
{
|
|
||||||
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1, ( $start_html - $end_html - 1 )));
|
|
||||||
|
|
||||||
if ( $end_html = strpos($message, '>', $start_html) )
|
|
||||||
{
|
|
||||||
$length = $end_html - $start_html + 1;
|
|
||||||
$hold_string = substr($message, $start_html, $length);
|
|
||||||
|
|
||||||
if ( ( $unclosed_open = strrpos(' ' . $hold_string, '<') ) != 1 )
|
|
||||||
{
|
|
||||||
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($hold_string, 0, $unclosed_open - 1));
|
|
||||||
$hold_string = substr($hold_string, $unclosed_open - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
$tagallowed = false;
|
|
||||||
for($i = 0; $i < sizeof($allowed_html_tags); $i++)
|
|
||||||
{
|
|
||||||
$match_tag = trim($allowed_html_tags[$i]);
|
|
||||||
|
|
||||||
if ( preg_match('/^<\/?' . $match_tag . '\b/i', $hold_string) )
|
|
||||||
{
|
|
||||||
$tagallowed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmp_message .= ( $length && !$tagallowed ) ? preg_replace($html_entities_match, $html_entities_replace, $hold_string) : $hold_string;
|
|
||||||
|
|
||||||
$start_html += $length;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $start_html, strlen($message)));
|
|
||||||
|
|
||||||
$start_html = strlen($message);
|
|
||||||
$end_html = $start_html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $end_html != strlen($message) && $tmp_message != '' )
|
|
||||||
{
|
|
||||||
$tmp_message .= preg_replace($html_entities_match, $html_entities_replace, substr($message, $end_html + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = ( $tmp_message != '' ) ? trim($tmp_message) : trim($message);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$message = preg_replace($html_entities_match, $html_entities_replace, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $bbcode_on && $bbcode_uid != '' )
|
|
||||||
{
|
|
||||||
$tmp_message = $message;
|
|
||||||
if ( ($match_count = preg_match_all('#^(.*?)\[code\](.*?)\[\/code\](.*?)$#is', $tmp_message, $match)) )
|
|
||||||
{
|
|
||||||
$code_entities_match = array('#<#', '#>#', '#"#', '#:#', '#\[#', '#\]#', '#\(#', '#\)#', '#\{#', '#\}#');
|
|
||||||
$code_entities_replace = array('<', '>', '"', ':', '[', ']', '(', ')', '{', '}');
|
|
||||||
|
|
||||||
$message = '';
|
|
||||||
|
|
||||||
for($i = 0; $i < $match_count; $i++)
|
|
||||||
{
|
|
||||||
$message .= $match[1][$i] . '[code]' . preg_replace($code_entities_match, $code_entities_replace, $match[2][$i]) . '[/code]';
|
|
||||||
$tmp_message = $match[3][$i];
|
|
||||||
}
|
|
||||||
|
|
||||||
$message .= $tmp_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = bbencode_first_pass($message, $bbcode_uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $message;
|
|
||||||
}
|
|
||||||
|
|
||||||
function unprepare_message($message)
|
|
||||||
{
|
|
||||||
global $unhtml_specialchars_match, $unhtml_specialchars_replace;
|
|
||||||
|
|
||||||
return preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Prepare a message for posting
|
|
||||||
//
|
|
||||||
function prepare_post(&$mode, &$post_data, &$bbcode_on, &$html_on, &$smilies_on, &$error_msg, &$username, &$bbcode_uid, &$subject, &$message, &$poll_title, &$poll_options, &$poll_length)
|
|
||||||
{
|
|
||||||
global $board_config, $userdata, $lang, $phpEx, $phpbb_root_path;
|
|
||||||
|
|
||||||
// Check username
|
|
||||||
if ( !empty($username) )
|
|
||||||
{
|
|
||||||
$username = htmlspecialchars(trim(strip_tags($username)));
|
|
||||||
|
|
||||||
if ( !$userdata['session_logged_in'] || ( $userdata['session_logged_in'] && $username != $userdata['username'] ) )
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
|
|
||||||
|
|
||||||
$result = validate_username($username);
|
|
||||||
if ( $result['error'] )
|
|
||||||
{
|
|
||||||
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $result['error_msg'] : $result['error_msg'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check subject
|
|
||||||
if ( !empty($subject) )
|
|
||||||
{
|
|
||||||
$subject = htmlspecialchars(trim($subject));
|
|
||||||
}
|
|
||||||
else if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
|
|
||||||
{
|
|
||||||
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check message
|
|
||||||
if ( !empty($message) )
|
|
||||||
{
|
|
||||||
$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
|
|
||||||
$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
|
|
||||||
}
|
|
||||||
else if ( $mode != 'delete' && $mode != 'polldelete' )
|
|
||||||
{
|
|
||||||
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Handle poll stuff
|
|
||||||
//
|
|
||||||
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
|
|
||||||
{
|
|
||||||
$poll_length = ( isset($poll_length) ) ? max(0, intval($poll_length)) : 0;
|
|
||||||
|
|
||||||
if ( !empty($poll_title) )
|
|
||||||
{
|
|
||||||
$poll_title = htmlspecialchars(trim($poll_title));
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !empty($poll_options) )
|
|
||||||
{
|
|
||||||
$temp_option_text = array();
|
|
||||||
while( list($option_id, $option_text) = @each($poll_options) )
|
|
||||||
{
|
|
||||||
$option_text = trim($option_text);
|
|
||||||
if ( !empty($option_text) )
|
|
||||||
{
|
|
||||||
$temp_option_text[$option_id] = htmlspecialchars($option_text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$option_text = $temp_option_text;
|
|
||||||
|
|
||||||
if ( count($poll_options) < 2 )
|
|
||||||
{
|
|
||||||
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['To_few_poll_options'] : $lang['To_few_poll_options'];
|
|
||||||
}
|
|
||||||
else if ( count($poll_options) > $board_config['max_poll_options'] )
|
|
||||||
{
|
|
||||||
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['To_many_poll_options'] : $lang['To_many_poll_options'];
|
|
||||||
}
|
|
||||||
else if ( $poll_title == '' )
|
|
||||||
{
|
|
||||||
$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_poll_title'] : $lang['Empty_poll_title'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Post a new topic/reply/poll or edit existing post/poll
|
|
||||||
//
|
|
||||||
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, &$bbcode_on, &$html_on, &$smilies_on, &$attach_sig, &$bbcode_uid, &$post_username, &$post_subject, &$post_message, &$poll_title, &$poll_options, &$poll_length)
|
|
||||||
{
|
|
||||||
global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
|
|
||||||
global $userdata, $user_ip;
|
|
||||||
|
|
||||||
$current_time = time();
|
|
||||||
|
|
||||||
if ( $mode == 'newtopic' || $mode == 'reply' )
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Flood control
|
|
||||||
//
|
|
||||||
$where_sql = ( $userdata['user_id'] == ANONYMOUS ) ? "poster_ip = '$user_ip'" : 'poster_id = ' . $userdata['user_id'];
|
|
||||||
$sql = "SELECT MAX(post_time) AS last_post_time
|
|
||||||
FROM " . POSTS_TABLE . "
|
|
||||||
WHERE $where_sql";
|
|
||||||
if ( $result = $db->sql_query($sql) )
|
|
||||||
{
|
|
||||||
if( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
if ( $row['last_post_time'] > 0 && ( $current_time - $row['last_post_time'] ) < $board_config['flood_interval'] )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( $mode == 'editpost' )
|
|
||||||
{
|
|
||||||
remove_search_post($post_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
|
|
||||||
{
|
|
||||||
$topic_vote = ( !empty($poll_title) && count($poll_options) >= 2 ) ? 1 : 0;
|
|
||||||
$sql = ( $mode != "editpost" ) ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_vote = $topic_vote WHERE topic_id = $topic_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $mode == 'newtopic' )
|
|
||||||
{
|
|
||||||
$topic_id = $db->sql_nextid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$edited_sql = ( $mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post'] ) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
|
|
||||||
$sql = ( $mode != "editpost" ) ? "INSERT INTO " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '$user_ip', $bbcode_on, $html_on, $smilies_on, $attach_sig)" : "UPDATE " . POSTS_TABLE . " SET enable_bbcode = $bbcode_on, enable_html = $html_on, enable_smilies = $smilies_on, enable_sig = $attach_sig" . $edited_sql . " WHERE post_id = $post_id";
|
|
||||||
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $mode != 'editpost' )
|
|
||||||
{
|
|
||||||
$post_id = $db->sql_nextid();
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = ( $mode != 'editpost' ) ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message', bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
add_search_words($post_id, stripslashes($post_message), stripslashes($post_subject));
|
|
||||||
|
|
||||||
//
|
|
||||||
// Add poll
|
|
||||||
//
|
|
||||||
if ( ( $mode == 'newtopic' || $mode == 'editpost' ) && !empty($poll_title) && count($poll_options) >= 2 )
|
|
||||||
{
|
|
||||||
$sql = ( !$post_data['has_poll'] ) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, '$poll_title', $current_time, " . ( $poll_length * 86400 ) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ( $poll_length * 86400 ) . " WHERE topic_id = $topic_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$delete_option_sql = '';
|
|
||||||
$old_poll_result = array();
|
|
||||||
if ( $mode == 'editpost' && $post_data['has_poll'] )
|
|
||||||
{
|
|
||||||
$sql = "SELECT vote_option_id, vote_result
|
|
||||||
FROM " . VOTE_RESULTS_TABLE . "
|
|
||||||
WHERE vote_id = $poll_id
|
|
||||||
ORDER BY vote_option_id ASC";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain vote data results for this topic', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$old_poll_result[$row['vote_option_id']] = $row['vote_result'];
|
|
||||||
|
|
||||||
if( !isset($poll_options[$row['vote_option_id']]) )
|
|
||||||
{
|
|
||||||
$delete_option_sql .= ( $delete_option_sql != '' ) ? ', ' . $row['vote_option_id'] : $row['vote_option_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$poll_id = $db->sql_nextid();
|
|
||||||
}
|
|
||||||
|
|
||||||
@reset($poll_options);
|
|
||||||
|
|
||||||
$poll_option_id = 1;
|
|
||||||
while ( list($option_id, $option_text) = each($poll_options) )
|
|
||||||
{
|
|
||||||
if( !empty($option_text) )
|
|
||||||
{
|
|
||||||
$option_text = str_replace("\'", "''", $option_text);
|
|
||||||
$poll_result = ( $mode == "editpost" && isset($old_poll_result[$option_id]) ) ? $old_poll_result[$option_id] : 0;
|
|
||||||
|
|
||||||
$sql = ( $mode != "editpost" || !isset($old_poll_result[$option_id]) ) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
$poll_option_id++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $delete_option_sql != '' )
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
|
|
||||||
WHERE vote_option_id IN ($delete_option_sql)";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error deleting pruned poll options', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$meta = '<meta http-equiv="refresh" content="3;url=' . "viewtopic.$phpEx$SID&" . POST_POST_URL . "=" . $post_id . '#' . $post_id . '">';
|
|
||||||
$message = $lang['Stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . "viewtopic.$phpEx$SID&" . POST_POST_URL . "=" . $post_id . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . "viewforum.$phpEx$SID&" . POST_FORUM_URL . "=$forum_id" . '">', '</a>');
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Update post stats and details
|
|
||||||
//
|
|
||||||
function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
$sign = ( $mode == 'delete' ) ? '- 1' : '+ 1';
|
|
||||||
$forum_update_sql = "forum_posts = forum_posts $sign";
|
|
||||||
$topic_update_sql = '';
|
|
||||||
|
|
||||||
if ( $mode == 'delete' )
|
|
||||||
{
|
|
||||||
if ( $post_data['last_post'] )
|
|
||||||
{
|
|
||||||
if ( $post_data['first_post'] )
|
|
||||||
{
|
|
||||||
$forum_update_sql .= ', forum_topics = forum_topics - 1';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
$topic_update_sql .= "topic_replies = topic_replies - 1";
|
|
||||||
|
|
||||||
$sql = "SELECT MAX(post_id) AS post_id
|
|
||||||
FROM " . POSTS_TABLE . "
|
|
||||||
WHERE topic_id = $topic_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$topic_update_sql .= ', topic_last_post_id = ' . $row['post_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $post_data['last_topic'] )
|
|
||||||
{
|
|
||||||
$sql = "SELECT MAX(post_id) AS post_id
|
|
||||||
FROM " . POSTS_TABLE . "
|
|
||||||
WHERE forum_id = $forum_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$forum_update_sql .= ( $row['post_id'] ) ? ', forum_last_post_id = ' . $row['post_id'] : ', forum_last_post_id = 0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( $post_data['first_post'] )
|
|
||||||
{
|
|
||||||
$sql = "SELECT MIN(post_id) AS post_id
|
|
||||||
FROM " . POSTS_TABLE . "
|
|
||||||
WHERE topic_id = $topic_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$topic_update_sql .= 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['post_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$topic_update_sql .= 'topic_replies = topic_replies - 1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( $mode != 'poll_delete' )
|
|
||||||
{
|
|
||||||
$forum_update_sql .= ", forum_last_post_id = $post_id" . ( ( $mode == 'newtopic' ) ? ", forum_topics = forum_topics $sign" : "" );
|
|
||||||
$topic_update_sql = "topic_last_post_id = $post_id" . ( ( $mode == 'reply' ) ? ", topic_replies = topic_replies $sign" : ", topic_first_post_id = $post_id" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$topic_update_sql .= 'topic_vote = 0';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "UPDATE " . FORUMS_TABLE . " SET
|
|
||||||
$forum_update_sql
|
|
||||||
WHERE forum_id = $forum_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $topic_update_sql != '' )
|
|
||||||
{
|
|
||||||
$sql = "UPDATE " . TOPICS_TABLE . " SET
|
|
||||||
$topic_update_sql
|
|
||||||
WHERE topic_id = $topic_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $mode != 'poll_delete' )
|
|
||||||
{
|
|
||||||
$sql = "UPDATE " . USERS_TABLE . "
|
|
||||||
SET user_posts = user_posts $sign
|
|
||||||
WHERE user_id = $user_id";
|
|
||||||
if ( !($result = $db->sql_query($sql, END_TRANSACTION)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Delete a post/poll
|
|
||||||
//
|
|
||||||
function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id)
|
|
||||||
{
|
|
||||||
global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
|
|
||||||
global $userdata, $user_ip;
|
|
||||||
|
|
||||||
$topic_update_sql = '';
|
|
||||||
if ( $mode != 'poll_delete' )
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM " . POSTS_TABLE . "
|
|
||||||
WHERE post_id = $post_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "DELETE FROM " . POSTS_TEXT_TABLE . "
|
|
||||||
WHERE post_id = $post_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
|
|
||||||
WHERE post_id = $post_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$forum_update_sql = 'forum_posts = forum_posts - 1';
|
|
||||||
$topic_update_sql .= 'topic_replies = topic_replies - 1';
|
|
||||||
if ( $post_data['last_post'] )
|
|
||||||
{
|
|
||||||
if ( $post_data['first_post'] )
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM " . TOPICS_TABLE . "
|
|
||||||
WHERE topic_id = $topic_id
|
|
||||||
OR topic_moved_id = $topic_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
|
|
||||||
WHERE topic_id = $topic_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $mode == 'poll_delete' || ( $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] ) && $post_data['has_poll'] && $post_data['edit_poll'] )
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM " . VOTE_DESC_TABLE . "
|
|
||||||
WHERE vote_id = $poll_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
|
|
||||||
WHERE vote_id = $poll_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "DELETE FROM " . VOTE_USERS_TABLE . "
|
|
||||||
WHERE vote_id = $poll_id";
|
|
||||||
if ( !($db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_search_post($post_id);
|
|
||||||
|
|
||||||
if ( $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] )
|
|
||||||
{
|
|
||||||
$meta = '<meta http-equiv="refresh" content="3;url=' . "viewforum.$phpEx$SID&" . POST_FORUM_URL . "=" . $forum_id . '">';
|
|
||||||
$message = $lang['Deleted'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$meta = '<meta http-equiv="refresh" content="3;url=' . "viewtopic.$phpEx$SID&" . POST_TOPIC_URL . "=" . $topic_id . '">';
|
|
||||||
$message = ( ( $mode == "poll_delete" ) ? $lang['Poll_delete'] : $lang['Deleted'] ) . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . "viewtopic.$phpEx$SID&" . POST_TOPIC_URL . "=$topic_id" . '">', '</a>');
|
|
||||||
}
|
|
||||||
|
|
||||||
$message .= '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . "viewforum.$phpEx$SID&" . POST_FORUM_URL . "=$forum_id" . '">', '</a>');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Handle user notification on new post
|
|
||||||
//
|
|
||||||
function user_notification($mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$notify_user)
|
|
||||||
{
|
|
||||||
global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
|
|
||||||
global $userdata, $user_ip;
|
|
||||||
|
|
||||||
$current_time = time();
|
|
||||||
|
|
||||||
if ( $mode == 'delete' )
|
|
||||||
{
|
|
||||||
$delete_sql = ( !$post_data['first_post'] && !$post_data['last_post'] ) ? " AND user_id = " . $userdata['user_id'] : "";
|
|
||||||
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = $topic_id" . $delete_sql;
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not change topic notify data', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( $mode == 'reply' || $mode == 'newtopic' )
|
|
||||||
{
|
|
||||||
$sql = "SELECT ban_userid
|
|
||||||
FROM " . BANLIST_TABLE;
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user_id_sql = '';
|
|
||||||
while ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
if ( isset($row['ban_userid']) )
|
|
||||||
{
|
|
||||||
$user_id_sql = ', ' . $row['ban_userid'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, f.forum_name
|
|
||||||
FROM " . FORUMS_WATCH_TABLE . " w, " . FORUMS_TABLE . " f, " . USERS_TABLE . " u
|
|
||||||
WHERE w.forum_id = $forum_id
|
|
||||||
AND w.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " )
|
|
||||||
AND w.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
|
|
||||||
AND f.forum_id = w.forum_id
|
|
||||||
AND u.user_id = w.user_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain list of forum watchers', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$orig_word = array();
|
|
||||||
$replacement_word = array();
|
|
||||||
obtain_word_list($orig_word, $replacement_word);
|
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
|
|
||||||
$emailer = new emailer($board_config['smtp_delivery']);
|
|
||||||
|
|
||||||
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
|
|
||||||
$script_name_f = ( $script_name != '' ) ? $script_name . '/viewforum.'.$phpEx : 'viewforum.'.$phpEx;
|
|
||||||
$server_name = trim($board_config['server_name']);
|
|
||||||
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
|
|
||||||
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
|
|
||||||
|
|
||||||
$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
|
|
||||||
|
|
||||||
$update_watched_sql = '';
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$forum_name = unprepare_message($row['forum_name']);
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if ( $row['user_email'] != '' )
|
|
||||||
{
|
|
||||||
$emailer->use_template('forum_notify', $row['user_lang']);
|
|
||||||
$emailer->email_address($row['user_email']);
|
|
||||||
$emailer->set_subject();//$lang['Topic_reply_notification']
|
|
||||||
$emailer->extra_headers($email_headers);
|
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
|
||||||
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
|
|
||||||
'USERNAME' => $row['username'],
|
|
||||||
'SITENAME' => $board_config['sitename'],
|
|
||||||
'FORUM_NAME' => $forum_name,
|
|
||||||
|
|
||||||
'U_FORUM' => $server_protocol . $server_name . $server_port . $script_name_f . '?' . POST_FORUM_URL . "=$forum_id",
|
|
||||||
'U_STOP_WATCHING_FORUM' => $server_protocol . $server_name . $server_port . $script_name_f . '?' . POST_FORUM_URL . "=$forum_id&unwatch=forum")
|
|
||||||
);
|
|
||||||
|
|
||||||
$emailer->send();
|
|
||||||
$emailer->reset();
|
|
||||||
|
|
||||||
$update_watched_sql .= ( $update_watched_sql != '' ) ? ', ' . $row['user_id'] : $row['user_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ( $row = $db->sql_fetchrow($result) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $update_watched_sql != '' )
|
|
||||||
{
|
|
||||||
$sql = "UPDATE " . FORUMS_WATCH_TABLE . "
|
|
||||||
SET notify_status = " . TOPIC_WATCH_NOTIFIED . "
|
|
||||||
WHERE forum_id = $forum_id
|
|
||||||
AND user_id IN ($update_watched_sql)";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $mode == 'reply' )
|
|
||||||
{
|
|
||||||
$sql = "SELECT u.user_id, u.username, u.user_email, u.user_lang, t.topic_title
|
|
||||||
FROM " . TOPICS_WATCH_TABLE . " tw, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
|
|
||||||
WHERE tw.topic_id = $topic_id
|
|
||||||
AND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . " )
|
|
||||||
AND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "
|
|
||||||
AND t.topic_id = tw.topic_id
|
|
||||||
AND u.user_id = tw.user_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$script_name_t = ( $script_name != '' ) ? $script_name . '/viewtopic.'.$phpEx : 'viewtopic.'.$phpEx;
|
|
||||||
$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
|
|
||||||
|
|
||||||
$update_watched_sql = '';
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$topic_title = preg_replace($orig_word, $replacement_word, unprepare_message($row['topic_title']));
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if ( $row['user_email'] != '' )
|
|
||||||
{
|
|
||||||
$emailer->use_template('topic_notify', $row['user_lang']);
|
|
||||||
$emailer->email_address($row['user_email']);
|
|
||||||
$emailer->set_subject();//$lang['Topic_reply_notification']
|
|
||||||
$emailer->extra_headers($email_headers);
|
|
||||||
|
|
||||||
$emailer->assign_vars(array(
|
|
||||||
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),
|
|
||||||
'USERNAME' => $row['username'],
|
|
||||||
'SITENAME' => $board_config['sitename'],
|
|
||||||
'TOPIC_TITLE' => $topic_title,
|
|
||||||
|
|
||||||
'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name_t . '?' . POST_POST_URL . "=$post_id#$post_id",
|
|
||||||
'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name_t . '?' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
|
|
||||||
);
|
|
||||||
|
|
||||||
$emailer->send();
|
|
||||||
$emailer->reset();
|
|
||||||
|
|
||||||
$update_watched_sql .= ( $update_watched_sql != '' ) ? ', ' . $row['user_id'] : $row['user_id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ( $row = $db->sql_fetchrow($result) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $update_watched_sql != '' )
|
|
||||||
{
|
|
||||||
$sql = "UPDATE " . TOPICS_WATCH_TABLE . "
|
|
||||||
SET notify_status = " . TOPIC_WATCH_NOTIFIED . "
|
|
||||||
WHERE topic_id = $topic_id
|
|
||||||
AND user_id IN ($update_watched_sql)";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT topic_id
|
|
||||||
FROM " . TOPICS_WATCH_TABLE . "
|
|
||||||
WHERE topic_id = $topic_id
|
|
||||||
AND user_id = " . $userdata['user_id'];
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
|
|
||||||
if ( !$notify_user && !empty($row['topic_id']) )
|
|
||||||
{
|
|
||||||
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
|
|
||||||
WHERE topic_id = $topic_id
|
|
||||||
AND user_id = " . $userdata['user_id'];
|
|
||||||
if ( !$result = $db->sql_query($sql) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( $notify_user && empty($row['topic_id']) )
|
|
||||||
{
|
|
||||||
$sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)
|
|
||||||
VALUES (" . $userdata['user_id'] . ", $topic_id, 0)";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -54,9 +54,10 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_smilies',
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars','255');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options','10');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_chars','3');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_chars','3');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_search_chars','20');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_search_chars','10');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes','4');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes','4');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs','50');
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time','0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig','Thanks, The Management');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email','youraddress@yourdomain.com');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery','0');
|
||||||
|
|
|
@ -531,6 +531,7 @@ CREATE TABLE phpbb_styles_imageset (
|
||||||
CREATE TABLE phpbb_topics (
|
CREATE TABLE phpbb_topics (
|
||||||
topic_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
topic_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||||
forum_id smallint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
forum_id smallint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
|
topic_approved tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||||
topic_title varchar(60) NOT NULL,
|
topic_title varchar(60) NOT NULL,
|
||||||
topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
topic_poster mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
topic_time int(11) DEFAULT '0' NOT NULL,
|
topic_time int(11) DEFAULT '0' NOT NULL,
|
||||||
|
@ -547,7 +548,6 @@ CREATE TABLE phpbb_topics (
|
||||||
topic_last_poster_name varchar(30),
|
topic_last_poster_name varchar(30),
|
||||||
topic_last_post_time int(11) DEFAULT '0' NOT NULL,
|
topic_last_post_time int(11) DEFAULT '0' NOT NULL,
|
||||||
topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
post_count_inc tinyint(1) DEFAULT '1' NOT NULL,
|
|
||||||
poll_title varchar(255) NOT NULL,
|
poll_title varchar(255) NOT NULL,
|
||||||
poll_start int(11) NOT NULL DEFAULT '0',
|
poll_start int(11) NOT NULL DEFAULT '0',
|
||||||
poll_length int(11) NOT NULL DEFAULT '0',
|
poll_length int(11) NOT NULL DEFAULT '0',
|
||||||
|
|
|
@ -351,6 +351,8 @@ $lang = array_merge($lang, array(
|
||||||
'Boxes_max_explain' => 'Users can create this many private messaging boxes.',
|
'Boxes_max_explain' => 'Users can create this many private messaging boxes.',
|
||||||
'Boxes_limit' => 'Max messages per box',
|
'Boxes_limit' => 'Max messages per box',
|
||||||
'Boxes_limit_explain' => 'Users are limited to no more than this many messages in each of their private message boxes.',
|
'Boxes_limit_explain' => 'Users are limited to no more than this many messages in each of their private message boxes.',
|
||||||
|
'Edit_time' => 'Limit editing time',
|
||||||
|
'Edit_time_explain' => 'Limits the time available to edit a new post, zero equals infinity',
|
||||||
'Flood_Interval' => 'Flood Interval',
|
'Flood_Interval' => 'Flood Interval',
|
||||||
'Flood_Interval_explain' => 'Number of seconds a user must wait between posting new messages. To enable users to ignore this alter their permissions.',
|
'Flood_Interval_explain' => 'Number of seconds a user must wait between posting new messages. To enable users to ignore this alter their permissions.',
|
||||||
'Search_Interval' => 'Search Flood Interval',
|
'Search_Interval' => 'Search Flood Interval',
|
||||||
|
|
|
@ -205,7 +205,7 @@ $lang = array_merge($lang, array(
|
||||||
'Rules_delete_cannot' => 'You <b>cannot</b> delete your posts in this forum',
|
'Rules_delete_cannot' => 'You <b>cannot</b> delete your posts in this forum',
|
||||||
'Rules_vote_can' => 'You <b>can</b> vote in polls in this forum',
|
'Rules_vote_can' => 'You <b>can</b> vote in polls in this forum',
|
||||||
'Rules_vote_cannot' => 'You <b>cannot</b> vote in polls in this forum',
|
'Rules_vote_cannot' => 'You <b>cannot</b> vote in polls in this forum',
|
||||||
'Rules_moderate' => 'You <b>can</b> %smoderate this forum%s',
|
'MCP' => '[ %sModerator Control Panel%s ]',
|
||||||
'No_topics_post_one' => 'There are no posts in this forum<br />Click on the <b>Post New Topic</b> link on this page to post one',
|
'No_topics_post_one' => 'There are no posts in this forum<br />Click on the <b>Post New Topic</b> link on this page to post one',
|
||||||
'Stop_watching_forum' => 'Stop watching this forum',
|
'Stop_watching_forum' => 'Stop watching this forum',
|
||||||
'Start_watching_forum' => 'Watch this forum for new posts',
|
'Start_watching_forum' => 'Watch this forum for new posts',
|
||||||
|
@ -269,8 +269,10 @@ $lang = array_merge($lang, array(
|
||||||
'Post_Normal' => 'Normal',
|
'Post_Normal' => 'Normal',
|
||||||
'Confirm_delete' => 'Are you sure you want to delete this post?',
|
'Confirm_delete' => 'Are you sure you want to delete this post?',
|
||||||
'Confirm_delete_poll' => 'Are you sure you want to delete this poll?',
|
'Confirm_delete_poll' => 'Are you sure you want to delete this poll?',
|
||||||
|
'Cannot_edit_time' => 'You can no longer edit or delete that post',
|
||||||
'Flood_Error' => 'You cannot make another post so soon after your last, please try again in a short while',
|
'Flood_Error' => 'You cannot make another post so soon after your last, please try again in a short while',
|
||||||
'Empty_subject' => 'You must specify a subject when posting a new topic',
|
'Empty_subject' => 'You must specify a subject when posting a new topic',
|
||||||
|
'To_long_subject' => 'The subject is too long it must be 60 characters or less',
|
||||||
'Empty_message' => 'You must enter a message when posting',
|
'Empty_message' => 'You must enter a message when posting',
|
||||||
'Too_many_chars' => 'Your message contains too many characters',
|
'Too_many_chars' => 'Your message contains too many characters',
|
||||||
'Too_many_smilies' => 'Your message contains too many emoticons',
|
'Too_many_smilies' => 'Your message contains too many emoticons',
|
||||||
|
@ -279,6 +281,11 @@ $lang = array_merge($lang, array(
|
||||||
'No_post_id' => 'No post ID was specified',
|
'No_post_id' => 'No post ID was specified',
|
||||||
'No_topic_id' => 'You must select a topic to reply to',
|
'No_topic_id' => 'You must select a topic to reply to',
|
||||||
'No_valid_mode' => 'You can only post, reply edit or quote messages, please return and try again',
|
'No_valid_mode' => 'You can only post, reply edit or quote messages, please return and try again',
|
||||||
|
'User_cannot_post' => 'You cannot post in this forum',
|
||||||
|
'User_cannot_reply' => 'You cannot reply in this forum',
|
||||||
|
'User_cannot_quote' => 'You cannot quote posts in this forum',
|
||||||
|
'User_cannot_edit' => 'You cannot edit posts in this forum',
|
||||||
|
'User_cannot_delete' => 'You cannot delete posts in this forum',
|
||||||
'No_such_post' => 'There is no such post, please return and try again',
|
'No_such_post' => 'There is no such post, please return and try again',
|
||||||
'Edit_own_posts' => 'Sorry but you can only edit your own posts',
|
'Edit_own_posts' => 'Sorry but you can only edit your own posts',
|
||||||
'Delete_own_posts' => 'Sorry but you can only delete your own posts',
|
'Delete_own_posts' => 'Sorry but you can only delete your own posts',
|
||||||
|
|
|
@ -25,6 +25,12 @@ include($phpbb_root_path . 'extension.inc');
|
||||||
include($phpbb_root_path . 'common.'.$phpEx);
|
include($phpbb_root_path . 'common.'.$phpEx);
|
||||||
include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
|
include($phpbb_root_path . 'includes/functions_posting.'.$phpEx);
|
||||||
|
|
||||||
|
// Start session management
|
||||||
|
$user->start();
|
||||||
|
$user->setup();
|
||||||
|
$auth->acl($user->data);
|
||||||
|
// End session management
|
||||||
|
|
||||||
// Grab all data
|
// Grab all data
|
||||||
extract($_GET);
|
extract($_GET);
|
||||||
extract($_POST);
|
extract($_POST);
|
||||||
|
@ -41,12 +47,6 @@ foreach ( $int_vars as $in_var => $out_var)
|
||||||
$$out_var = ( isset($$in_var) ) ? intval($$in_var) : false;
|
$$out_var = ( isset($$in_var) ) ? intval($$in_var) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start session management
|
|
||||||
$user->start();
|
|
||||||
$user->setup();
|
|
||||||
$auth->acl($user->data);
|
|
||||||
// End session management
|
|
||||||
|
|
||||||
// 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) )
|
||||||
{
|
{
|
||||||
|
@ -54,20 +54,12 @@ if ( !empty($cancel) )
|
||||||
redirect($redirect);
|
redirect($redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// If the mode is set to topic review then output that review ...
|
// If the mode is set to topic review then output that review ...
|
||||||
switch ( $mode )
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 'topicreview':
|
case 'topicreview':
|
||||||
// require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
|
// require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
|
||||||
// topic_review($t, false);
|
// topic_review($topic_id, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'smilies':
|
case 'smilies':
|
||||||
|
@ -76,12 +68,6 @@ switch ( $mode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Set toggles for various options
|
// Set toggles for various options
|
||||||
if ( !$board_config['allow_html'] )
|
if ( !$board_config['allow_html'] )
|
||||||
{
|
{
|
||||||
|
@ -113,131 +99,286 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
$attach_sig = ( $post || $refresh ) ? ( ( !empty($attach_sig) ) ? TRUE : 0 ) : ( ( !$user->data['user_id'] ) ? 0 : $user->data['user_attachsig'] );
|
$attach_sig = ( $post || $refresh ) ? ( ( !empty($attach_sig) ) ? TRUE : 0 ) : ( ( !$user->data['user_id'] ) ? 0 : $user->data['user_attachsig'] );
|
||||||
|
//
|
||||||
|
// FLAGS
|
||||||
|
// -----
|
||||||
|
|
||||||
|
|
||||||
|
// ---------
|
||||||
|
// POST INFO
|
||||||
|
//
|
||||||
|
|
||||||
|
// What is all this following SQL for? Well, we need to know
|
||||||
|
// some basic information in all cases before we do anything.
|
||||||
// Create appropriate SQL for this mode ...
|
switch ($mode)
|
||||||
switch ( $mode )
|
|
||||||
{
|
{
|
||||||
case 'newtopic':
|
case 'post':
|
||||||
if ( empty($f) )
|
break;
|
||||||
|
case 'reply':
|
||||||
|
if ( empty($topic_id) )
|
||||||
{
|
{
|
||||||
trigger($user->lang['Forum_not_exist']);
|
trigger_error($user->lang['No_topic_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM " . FORUMS_TABLE . "
|
FROM " . TOPICS_TABLE . "
|
||||||
WHERE forum_id = $forum_id";
|
WHERE topic_id = $topic_id";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'reply':
|
|
||||||
case 'vote':
|
|
||||||
if ( empty( $t) )
|
|
||||||
{
|
|
||||||
trigger($user->lang['No_topic_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT f.*, t.*
|
|
||||||
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
|
|
||||||
WHERE t.topic_id = $topic_id
|
|
||||||
AND f.forum_id = t.forum_id";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'quote':
|
case 'quote':
|
||||||
case 'editpost':
|
case 'edit':
|
||||||
case 'delete':
|
case 'delete':
|
||||||
case 'poll_delete':
|
if ( empty($post_id) )
|
||||||
if ( empty($p) )
|
|
||||||
{
|
{
|
||||||
trigger($user->lang['No_post_id']);
|
trigger_error($user->lang['No_post_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$select_sql = ( !$submit ) ? ', t.topic_title, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, p.post_username, pt.post_subject, pt.post_text, pt.bbcode_uid, u.username, u.user_id, u.user_sig' : ', pt.post_subject, pt.post_text';
|
$sql = "SELECT t.*, p.*, pt.*
|
||||||
$from_sql = ( !$submit ) ? ', ' . POSTS_TEXT_TABLE . ' pt, ' . USERS_TABLE . ' u' : ', ' . POSTS_TEXT_TABLE . ' pt';
|
FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
|
||||||
$where_sql = ( !$submit ) ? 'AND pt.post_id = p.post_id AND u.user_id = p.poster_id' : 'AND pt.post_id = p.post_id';
|
WHERE p.post_id = $post_id
|
||||||
|
|
||||||
$sql = "SELECT f.*, t.*, p.post_id, p.poster_id" . $select_sql . "
|
|
||||||
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
|
|
||||||
WHERE p.post_id = $p
|
|
||||||
AND t.topic_id = p.topic_id
|
AND t.topic_id = p.topic_id
|
||||||
AND f.forum_id = p.forum_id
|
AND pt.post_id = p.post_id
|
||||||
$where_sql";
|
AND u.user_id = p.poster_id";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
message_die(MESSAGE, $user->lang['No_valid_mode']);
|
trigger_error($user->lang['No_valid_mode']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->sql_query($sql);
|
if ( $sql != '' )
|
||||||
|
|
||||||
if ( $post_info = $db->sql_fetchrow($result) )
|
|
||||||
{
|
{
|
||||||
$forum_id = $post_info['forum_id'];
|
$result = $db->sql_query($sql);
|
||||||
$forum_name = $post_info['forum_name'];
|
|
||||||
|
|
||||||
$topic_title = $post_info['topic_title'];
|
extract($db->sql_fetchrow($result));
|
||||||
$topic_id = $post_info['topic_id'];
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// POST INFO
|
||||||
|
// ---------
|
||||||
|
|
||||||
|
|
||||||
|
// ACL CHECK
|
||||||
|
if (!$auth->acl_get('f_' . $mode, $forum_id))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['User_cannot_' . $mode]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// EDIT TIME CHECK
|
||||||
|
if (($mode == 'edit' || $mode == 'delete') && !empty($board_config['edit_time']) && $post_time < time() - $board_config['edit_time'])
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['Cannot_edit_time']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// User has submitted a post, process it
|
// --------------
|
||||||
|
// PROCESS SUBMIT
|
||||||
|
//
|
||||||
if ( isset($post) )
|
if ( isset($post) )
|
||||||
{
|
{
|
||||||
|
|
||||||
// First check if message has changed (if editing), if not
|
// First check if message has changed (if editing), if not
|
||||||
// don't parse at all else ...
|
// don't parse at all else ...
|
||||||
//
|
//
|
||||||
// Need to parse message, parse search words, parse polls,
|
// Need to parse message, parse search words, parse polls, parse attachments,
|
||||||
// parse attachments, check whether forum is moderated or
|
// check whether forum is moderated or if msg is being saved (and if it is
|
||||||
// if msg is being saved (and if it is whether user has run
|
// whether user has run out of save quota) if not topic/forum needs syncing,
|
||||||
// out of save quota) if not topic/forum needs syncing, if
|
// if replying notifications need sending as appropriate.
|
||||||
// replying notifications need sending as appropriate.
|
|
||||||
|
|
||||||
echo "\$_POST >> ";
|
// $mtime = explode(' ', microtime());
|
||||||
print_r(htmlentities($message));
|
// $starttime = $mtime[1] + $mtime[0];
|
||||||
echo "<br /><hr /><br />\n\n";
|
|
||||||
|
$err_msg = '';
|
||||||
|
$current_time = time();
|
||||||
|
$message_md5 = md5($message);
|
||||||
|
|
||||||
// Check checksum
|
// Check checksum
|
||||||
if ( $mode != 'editpost' || md5($_POST['message']) != $post_info['post_checksum'] )
|
if ($mode != 'edit' || $message_md5 != $post_checksum)
|
||||||
{
|
{
|
||||||
|
// Parse message
|
||||||
$parse_msg = new parse_message();
|
$parse_msg = new parse_message();
|
||||||
$search = new fulltext_search();
|
|
||||||
|
|
||||||
$mtime = explode(' ', microtime());
|
if(($result = $parse_msg->parse($message, $html_on, $bbcode_on, $bbcode_uid, $magic_urls_on, $smilies_on)) != '')
|
||||||
$starttime = $mtime[1] + $mtime[0];
|
{
|
||||||
|
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $result;
|
||||||
$result = $parse_msg->parse($message, $html_on, $bbcode_on, $post_info['bbcode_uid'], $magic_urls_on, $smilies_on);
|
}
|
||||||
|
|
||||||
$mtime = explode(' ', microtime());
|
|
||||||
echo "<br />\nParsed [ '$result' :: " . ( $mtime[1] + $mtime[0] - $starttime ) . " ] >> ";
|
|
||||||
// print_r(htmlentities($message));
|
|
||||||
print_r($message);
|
|
||||||
echo "<br /><hr /><br />\n\n";
|
|
||||||
|
|
||||||
// Fulltext parser
|
|
||||||
// $result = $search->add($p, $message, $post_subject, $post_info['post_text'], $post_info['post_subject']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
if ($mode != 'edit')
|
||||||
|
{
|
||||||
|
// Flood check
|
||||||
|
$where_sql = ($user->data['user_id'] == ANONYMOUS) ? "poster_ip = '$user->ip'" : 'poster_id = ' . $user->data['user_id'];
|
||||||
|
$sql = "SELECT MAX(post_time) AS last_post_time
|
||||||
|
FROM " . POSTS_TABLE . "
|
||||||
|
WHERE $where_sql";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
if (intval($row['last_post_time']) && ($current_time - intval($row['last_post_time'])) < intval($board_config['flood_interval']))
|
||||||
|
{
|
||||||
|
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $user->lang['Flood_Error'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate username
|
||||||
|
if (($username != '' && $user->data['user_id'] == ANONYMOUS) || ($mode == 'edit' && $post_username != ''))
|
||||||
|
{
|
||||||
|
require_once($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
|
||||||
|
|
||||||
|
$username = strip_tags(htmlspecialchars($username));
|
||||||
|
$result = validate_username($username);
|
||||||
|
if ( $result['error'] )
|
||||||
|
{
|
||||||
|
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $result['error_msg'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse subject
|
||||||
|
if (($subject = htmlspecialchars($subject)) == '' && ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)))
|
||||||
|
{
|
||||||
|
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $user->lang['Empty_subject'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($err_msg == '')
|
||||||
|
{
|
||||||
|
$db->sql_transaction();
|
||||||
|
|
||||||
|
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_title' => $subject,
|
||||||
|
'topic_poster' => intval($user->data['user_id']),
|
||||||
|
'topic_time' => $current_time,
|
||||||
|
'forum_id' => intval($forum_id),
|
||||||
|
'topic_type' => intval($type),
|
||||||
|
'topic_icon' => intval($icon),
|
||||||
|
'topic_approved'=> ($forum_moderated) ? 0 : 1,
|
||||||
|
);
|
||||||
|
$db->sql_query_array($sql, $topic_sql);
|
||||||
|
|
||||||
|
$topic_id = ($mode == 'post') ? $db->sql_nextid() : $topic_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$enable_sig = $enable_bbcode = $enable_html = $enable_smilies = $enable_magic_url = $bbcode_uid = 1;
|
||||||
|
|
||||||
|
$sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TABLE . ' SET WHERE post_id = ' . $post_id : 'INSERT INTO ' . POSTS_TABLE;
|
||||||
|
$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 != '') ? $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_count' => ($mode == 'edit') ? 'post_edit_count + 1' : 0,
|
||||||
|
'enable_sig' => $enable_sig,
|
||||||
|
'enable_bbcode' => $enable_bbcode,
|
||||||
|
'enable_html' => $enable_html,
|
||||||
|
'enable_smilies' => $enable_smilies,
|
||||||
|
'enable_magic_url' => $enable_magic_url,
|
||||||
|
);
|
||||||
|
$db->sql_query_array($sql, $post_sql);
|
||||||
|
|
||||||
|
$post_id = ($mode == 'edit') ? $post_id : $db->sql_nextid();
|
||||||
|
|
||||||
|
$sql = ($mode == 'edit') ? 'UPDATE ' . POSTS_TEXT_TABLE . ' SET WHERE post_id = ' . $post_id : 'INSERT INTO ' . POSTS_TEXT_TABLE;
|
||||||
|
$post_text_sql = array(
|
||||||
|
'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' => $message,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$db->sql_query_array($sql, $post_text_sql);
|
||||||
|
|
||||||
|
// Fulltext parse
|
||||||
|
if ($mode != 'edit' || $message_md5 != $post_checksum)
|
||||||
|
{
|
||||||
|
// $search = new fulltext_search();
|
||||||
|
// $result = $search->add($p, $message, $subject, $post_text, $post_subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sync forums, topics and users ...
|
||||||
|
if ($mode != 'edit')
|
||||||
|
{
|
||||||
|
$forum_topics_sql = ($mode == 'post') ? ', forum_topics = forum_topics + 1' : '';
|
||||||
|
$forum_sql = array(
|
||||||
|
'forum_last_post_id' => intval($post_id),
|
||||||
|
'forum_last_post_time' => $current_time,
|
||||||
|
'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);
|
||||||
|
|
||||||
|
$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(
|
||||||
|
'topic_first_post_id' => intval($post_id),
|
||||||
|
'topic_time' => $current_time,
|
||||||
|
'topic_poster' => intval($user->data['user_id']),
|
||||||
|
'topic_first_poster_name' => ($username != '') ? $username : '',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$db->sql_query_array('UPDATE ' . TOPICS_TABLE . ' SET WHERE topic_id = ' . intval($topic_id), $topic_sql);
|
||||||
|
|
||||||
|
if ($post_count_inc)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||||
|
SET user_posts = user_posts + 1
|
||||||
|
WHERE user_id = ' . $user->data['user_id'];
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->sql_transaction('commit');
|
||||||
|
|
||||||
|
// $mtime = explode(' ', microtime());
|
||||||
|
// echo "<br />\nParsed [ '$result' :: " . ( $mtime[1] + $mtime[0] - $starttime ) . " ] >> ";
|
||||||
|
// print_r(htmlentities($message));
|
||||||
|
|
||||||
|
trigger_error($user->lang['Stored']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Houston, we have an error ...
|
||||||
|
$post_text = &$message;
|
||||||
|
$post_subject = $topic_title = &$subject;
|
||||||
|
$topic_icon = &$icon;
|
||||||
|
$topic_type = &$type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// PROCESS SUBMIT
|
||||||
|
// --------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------
|
||||||
// TEMPORARY :D
|
// TEMPORARY SECTION!
|
||||||
$message = $post_info['post_text'];
|
//
|
||||||
|
|
||||||
// Remove encoded bbcode, urls, etc.
|
// Remove encoded bbcode, urls, etc.
|
||||||
$match = array(
|
$match = array(
|
||||||
'#<!\-\- b \-\-><b>(.*?)</b><!\-\- b \-\->#s',
|
'#<!\-\- b \-\-><b>(.*?)</b><!\-\- b \-\->#s',
|
||||||
'#<!\-\- u \-\-><u>(.*?)</u><!\-\- u \-\->#s',
|
'#<!\-\- u \-\-><u>(.*?)</u><!\-\- u \-\->#s',
|
||||||
'#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
|
'#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
|
||||||
'#<!\-\- u \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- u \-\->#',
|
'#<!\-\- m \-\-><a href="(.*?)" target="_blank">.*?</a><!\-\- m \-\->#',
|
||||||
);
|
);
|
||||||
|
|
||||||
$replace = array(
|
$replace = array(
|
||||||
|
@ -247,9 +388,10 @@ $replace = array(
|
||||||
'\1',
|
'\1',
|
||||||
);
|
);
|
||||||
|
|
||||||
$message = preg_replace($match, $replace, $message);
|
$post_text = preg_replace($match, $replace, $post_text);
|
||||||
|
//
|
||||||
|
// TEMPORARY SECTION!
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,13 +400,13 @@ $message = preg_replace($match, $replace, $message);
|
||||||
//
|
//
|
||||||
|
|
||||||
// Notify user checkbox
|
// Notify user checkbox
|
||||||
if ( $post || $refresh )
|
if ($post || $refresh)
|
||||||
{
|
{
|
||||||
$notify_user = ( !empty($notify) ) ? TRUE : 0;
|
$notify_user = (!empty($notify)) ? TRUE : 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( $mode != 'newtopic' && $user->data['user_id'] )
|
if ($mode != 'post' && $user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
$sql = "SELECT topic_id
|
$sql = "SELECT topic_id
|
||||||
FROM " . TOPICS_WATCH_TABLE . "
|
FROM " . TOPICS_WATCH_TABLE . "
|
||||||
|
@ -272,11 +414,11 @@ else
|
||||||
AND user_id = " . $user->data['user_id'];
|
AND user_id = " . $user->data['user_id'];
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $user->data['user_notify'];
|
$notify_user = ($db->sql_fetchrow($result)) ? TRUE : $user->data['user_notify'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$notify_user = ( $user_id['user_id'] ) ? $user->data['user_notify'] : 0;
|
$notify_user = ($user_id['user_id']) ? $user->data['user_notify'] : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +432,7 @@ $sql = "SELECT *
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$s_topic_icons = false;
|
$s_topic_icons = false;
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$s_topic_icons = true;
|
$s_topic_icons = true;
|
||||||
|
|
||||||
|
@ -300,20 +442,22 @@ if ( $row = $db->sql_fetchrow($result) )
|
||||||
'ICON_ID' => $row['icons_id'],
|
'ICON_ID' => $row['icons_id'],
|
||||||
'ICON_IMG' => $board_config['icons_path'] . '/' . $row['icons_url'],
|
'ICON_IMG' => $board_config['icons_path'] . '/' . $row['icons_url'],
|
||||||
'ICON_WIDTH' => $row['icons_width'],
|
'ICON_WIDTH' => $row['icons_width'],
|
||||||
'ICON_HEIGHT' => $row['icons_height'])
|
'ICON_HEIGHT' => $row['icons_height'],
|
||||||
|
|
||||||
|
'S_ICON_CHECKED' => ($row['icons_id'] == $topic_icon) ? ' checked="checked"' : '')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
while ( $row = $db->sql_fetchrow($result) );
|
while ($row = $db->sql_fetchrow($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Topic type selection
|
// Topic type selection ... only for first post in topic?
|
||||||
$topic_type_toggle = '';
|
$topic_type_toggle = '';
|
||||||
if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) )
|
if ($mode == 'post' || $mode == 'edit')
|
||||||
{
|
{
|
||||||
if ( $auth->acl_get('f_sticky', $forum_id) )
|
if ( $auth->acl_get('f_sticky', $forum_id) )
|
||||||
{
|
{
|
||||||
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_STICKY . '"';
|
$topic_type_toggle .= '<input type="radio" name="type" value="' . POST_STICKY . '"';
|
||||||
if ( $post_data['topic_type'] == POST_STICKY || $topic_type == POST_STICKY )
|
if ($topic_type == POST_STICKY)
|
||||||
{
|
{
|
||||||
$topic_type_toggle .= ' checked="checked"';
|
$topic_type_toggle .= ' checked="checked"';
|
||||||
}
|
}
|
||||||
|
@ -322,8 +466,8 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
|
||||||
|
|
||||||
if ( $auth->acl_get('f_announce', $forum_id) )
|
if ( $auth->acl_get('f_announce', $forum_id) )
|
||||||
{
|
{
|
||||||
$topic_type_toggle .= '<input type="radio" name="topictype" value="' . POST_ANNOUNCE . '"';
|
$topic_type_toggle .= '<input type="radio" name="type" value="' . POST_ANNOUNCE . '"';
|
||||||
if ( $post_data['topic_type'] == POST_ANNOUNCE || $topic_type == POST_ANNOUNCE )
|
if ($topic_type == POST_ANNOUNCE)
|
||||||
{
|
{
|
||||||
$topic_type_toggle .= ' checked="checked"';
|
$topic_type_toggle .= ' checked="checked"';
|
||||||
}
|
}
|
||||||
|
@ -332,23 +476,23 @@ if ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] )
|
||||||
|
|
||||||
if ( $topic_type_toggle != '' )
|
if ( $topic_type_toggle != '' )
|
||||||
{
|
{
|
||||||
$topic_type_toggle = $user->lang['Post_topic_as'] . ': <input type="radio" name="topictype" value="' . POST_NORMAL .'"' . ( ( $post_data['topic_type'] == POST_NORMAL || $topic_type == POST_NORMAL ) ? ' checked="checked"' : '' ) . ' /> ' . $user->lang['Post_Normal'] . ' ' . $topic_type_toggle;
|
$topic_type_toggle = $user->lang['Post_topic_as'] . ': <input type="radio" name="type" value="' . POST_NORMAL .'"' . ( ($topic_type == POST_NORMAL) ? ' checked="checked"' : '' ) . ' /> ' . $user->lang['Post_Normal'] . ' ' . $topic_type_toggle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HTML, BBCode, Smilies, Images and Flash status
|
// HTML, BBCode, Smilies, Images and Flash status
|
||||||
$html_status = ( $board_config['allow_html'] && $auth->acl_get('f_html', $forum_id) ) ? true : false;
|
$html_status = ($board_config['allow_html'] && $auth->acl_get('f_html', $forum_id)) ? true : false;
|
||||||
$bbcode_status = ( $board_config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id) ) ? true : false;
|
$bbcode_status = ($board_config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false;
|
||||||
$smilies_status = ( $board_config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id) ) ? true : false;
|
$smilies_status = ($board_config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false;
|
||||||
$img_status = ( $board_config['allow_img'] && $auth->acl_get('f_img', $forum_id) ) ? true : false;
|
$img_status = ($board_config['allow_img'] && $auth->acl_get('f_img', $forum_id)) ? true : false;
|
||||||
$flash_status = ( $board_config['allow_flash'] && $auth->acl_get('f_flash', $forum_id) ) ? true : false;
|
$flash_status = ($board_config['allow_flash'] && $auth->acl_get('f_flash', $forum_id)) ? true : false;
|
||||||
|
|
||||||
// Page title/hidden fields
|
// Page title/hidden fields
|
||||||
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
|
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />';
|
||||||
|
|
||||||
switch( $mode )
|
switch( $mode )
|
||||||
{
|
{
|
||||||
case 'newtopic':
|
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 . '" />';
|
$s_hidden_fields .= '<input type="hidden" name="f" value="' . $forum_id . '" />';
|
||||||
break;
|
break;
|
||||||
|
@ -358,24 +502,27 @@ switch( $mode )
|
||||||
$s_hidden_fields .= '<input type="hidden" name="t" value="' . $topic_id . '" />';
|
$s_hidden_fields .= '<input type="hidden" name="t" value="' . $topic_id . '" />';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'editpost':
|
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_hidden_fields .= '<input type="hidden" name="p" value="' . $post_id . '" />';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nav links for forum
|
||||||
|
forum_nav_links($forum_id, $forum_name);
|
||||||
|
|
||||||
// Start assigning vars for main posting page ...
|
// Start assigning vars for main posting page ...
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'FORUM_NAME' => $forum_name,
|
'FORUM_NAME' => $forum_name,
|
||||||
'TOPIC_TITLE' => ( $mode != 'newtopic' ) ? $topic_title : '',
|
'TOPIC_TITLE' => ($mode != 'post') ? $topic_title : '',
|
||||||
'USERNAME' => $username,
|
'USERNAME' => $post_username,
|
||||||
'SUBJECT' => $subject,
|
'SUBJECT' => (!empty($topic_title)) ? $topic_title : $post_subject,
|
||||||
'MESSAGE' => $message,
|
'MESSAGE' => $post_text,
|
||||||
'HTML_STATUS' => ( $html_status ) ? $user->lang['HTML_is_ON'] : $user->lang['HTML_is_OFF'],
|
'HTML_STATUS' => ($html_status) ? $user->lang['HTML_is_ON'] : $user->lang['HTML_is_OFF'],
|
||||||
'BBCODE_STATUS' => ( $bbcode_status ) ? sprintf($user->lang['BBCode_is_ON'], '<a href="' . "faq.$phpEx$SID&mode=bbcode" . '" target="_phpbbcode">', '</a>') : sprintf($user->lang['BBCode_is_OFF'], '<a href="' . "faq.$phpEx$SID&mode=bbcode" . '" target="_phpbbcode">', '</a>'),
|
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCode_is_ON'], '<a href="' . "faq.$phpEx$SID&mode=bbcode" . '" target="_phpbbcode">', '</a>') : sprintf($user->lang['BBCode_is_OFF'], '<a href="' . "faq.$phpEx$SID&mode=bbcode" . '" target="_phpbbcode">', '</a>'),
|
||||||
'SMILIES_STATUS' => ( $smilies_status ) ? $user->lang['Smilies_are_ON'] : $user->lang['Smilies_are_OFF'],
|
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['Smilies_are_ON'] : $user->lang['Smilies_are_OFF'],
|
||||||
'IMG_STATUS' => ( $img_status ) ? $user->lang['Images_are_ON'] : $user->lang['Images_are_OFF'],
|
'IMG_STATUS' => ($img_status) ? $user->lang['Images_are_ON'] : $user->lang['Images_are_OFF'],
|
||||||
'FLASH_STATUS' => ( $flash_status ) ? $user->lang['Flash_is_ON'] : $user->lang['Flash_is_OFF'],
|
'FLASH_STATUS' => ($flash_status) ? $user->lang['Flash_is_ON'] : $user->lang['Flash_is_OFF'],
|
||||||
|
|
||||||
'L_POST_A' => $page_title,
|
'L_POST_A' => $page_title,
|
||||||
'L_POST_SUBJECT' => $user->lang['Post_subject'],
|
'L_POST_SUBJECT' => $user->lang['Post_subject'],
|
||||||
|
@ -422,29 +569,29 @@ $template->assign_vars(array(
|
||||||
'L_FONT_HUGE' => $user->lang['font_huge'],
|
'L_FONT_HUGE' => $user->lang['font_huge'],
|
||||||
|
|
||||||
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$forum_id",
|
'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$forum_id",
|
||||||
'U_VIEWTOPIC' => ( $mode != 'newtopic' ) ? "viewtopic.$phpEx$SID&t=$topic_id" : '',
|
'U_VIEWTOPIC' => ($mode != 'post') ? "viewtopic.$phpEx$SID&t=$topic_id" : '',
|
||||||
'U_REVIEW_TOPIC' => ( $mode != 'newtopic' ) ? "posting.$phpEx$SID&mmode=topicreview&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=' . $f,
|
'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . $forum_id,
|
||||||
|
|
||||||
'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
|
'S_SHOW_TOPIC_ICONS' => $s_topic_icons,
|
||||||
'S_HTML_CHECKED' => ( !$html_on ) ? 'checked="checked"' : '',
|
'S_HTML_CHECKED' => (!$html_on ) ? 'checked="checked"' : '',
|
||||||
'S_BBCODE_CHECKED' => ( !$bbcode_on ) ? 'checked="checked"' : '',
|
'S_BBCODE_CHECKED' => (!$bbcode_on ) ? 'checked="checked"' : '',
|
||||||
'S_SMILIES_CHECKED' => ( !$smilies_on ) ? 'checked="checked"' : '',
|
'S_SMILIES_CHECKED' => (!$smilies_on ) ? 'checked="checked"' : '',
|
||||||
'S_MAGIC_URL_CHECKED' => ( !$magic_urls_on ) ? 'checked="checked"' : '',
|
'S_MAGIC_URL_CHECKED' => (!$magic_urls_on ) ? 'checked="checked"' : '',
|
||||||
'S_SIGNATURE_CHECKED' => ( $attach_sig ) ? 'checked="checked"' : '',
|
'S_SIGNATURE_CHECKED' => ($attach_sig ) ? 'checked="checked"' : '',
|
||||||
'S_NOTIFY_CHECKED' => ( $notify_user ) ? 'checked="checked"' : '',
|
'S_NOTIFY_CHECKED' => ($notify_user ) ? 'checked="checked"' : '',
|
||||||
'S_DISPLAY_USERNAME' => ( !$user->data['user_id'] || ( $mode == 'editpost' && $post_info['post_username'] ) ) ? true : false,
|
'S_DISPLAY_USERNAME' => ($user->data['user_id'] == ANONYMOUS || ($mode == 'edit' && $post_username)) ? true : false,
|
||||||
|
|
||||||
'S_SAVE_ALLOWED' => ( $auth->acl_get('f_save', $forum_id) ) ? true : false,
|
'S_SAVE_ALLOWED' => ($auth->acl_get('f_save', $forum_id)) ? true : false,
|
||||||
'S_HTML_ALLOWED' => $html_status,
|
'S_HTML_ALLOWED' => $html_status,
|
||||||
'S_BBCODE_ALLOWED' => $bbcode_status,
|
'S_BBCODE_ALLOWED' => $bbcode_status,
|
||||||
'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'] ) ? true : false,
|
'S_NOTIFY_ALLOWED' => ($user->data['user_id'] != ANONYMOUS) ? true : false,
|
||||||
'S_DELETE_ALLOWED' => ( $mode == 'editpost' && ( ( $auth->acl_get('f_delete', $forum_id) && $post_data['last_post'] && ( !$post_data['has_poll'] || $post_data['edit_poll'] ) ) || $auth->acl_get('m_', $forum_id) ) ) ? 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_TYPE_TOGGLE' => $topic_type_toggle,
|
'S_TYPE_TOGGLE' => $topic_type_toggle,
|
||||||
|
|
||||||
'S_TOPIC_ID' => $t,
|
'S_TOPIC_ID' => $topic_id,
|
||||||
'S_POST_ACTION' => "posting.$phpEx$SID",
|
'S_POST_ACTION' => "posting.$phpEx$SID",
|
||||||
'S_HIDDEN_FIELDS' => $s_hidden_fields)
|
'S_HIDDEN_FIELDS' => $s_hidden_fields)
|
||||||
);
|
);
|
||||||
|
@ -454,7 +601,7 @@ if ( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post']
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_SHOW_POLL_BOX' => true,
|
'S_SHOW_POLL_BOX' => true,
|
||||||
'S_POLL_DELETE' => ( $mode == 'editpost' && $post_data['edit_poll'] ) ? true : false,
|
'S_POLL_DELETE' => ($mode == 'edit' && $edit_poll) ? 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'],
|
||||||
|
@ -495,7 +642,7 @@ if ( $auth->acl_get('f_attach', $forum_id) )
|
||||||
|
|
||||||
'L_ADD_FILE' => $user->lang['Add_file'],
|
'L_ADD_FILE' => $user->lang['Add_file'],
|
||||||
'L_FILE_NAME' => $user->lang['Filename'],
|
'L_FILE_NAME' => $user->lang['Filename'],
|
||||||
'L_FILE_COMMENT' => $user->lang['File_comment'],)
|
'L_FILE_COMMENT'=> $user->lang['File_comment'],)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,12 +658,87 @@ make_jumpbox('viewforum.'.$phpEx);
|
||||||
// Topic review
|
// Topic review
|
||||||
if ( $mode == 'reply' )
|
if ( $mode == 'reply' )
|
||||||
{
|
{
|
||||||
require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
|
// require($phpbb_root_path . 'includes/topic_review.'.$phpEx);
|
||||||
topic_review($t, true);
|
// topic_review($topic_id, true);
|
||||||
|
|
||||||
$template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody');
|
// $template->assign_var_from_handle('TOPIC_REVIEW_BOX', 'reviewbody');
|
||||||
}
|
}
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
|
||||||
|
|
||||||
|
function forum_nav_links(&$forum_id, &$forum_name)
|
||||||
|
{
|
||||||
|
global $SID, $template, $phpEx, $auth;
|
||||||
|
|
||||||
|
$type = 'parent';
|
||||||
|
$forum_rows = array();
|
||||||
|
|
||||||
|
if (!($forum_branch = get_forum_branch($forum_id)))
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['Forum_not_exist']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$s_has_subforums = FALSE;
|
||||||
|
foreach ($forum_branch as $row)
|
||||||
|
{
|
||||||
|
if ($type == 'parent')
|
||||||
|
{
|
||||||
|
$link = ($row['forum_status'] == ITEM_CATEGORY) ? 'index.' . $phpEx . $SID . '&c=' . $row['forum_id'] : 'viewforum.' . $phpEx . $SID . '&f=' . $row['forum_id'];
|
||||||
|
|
||||||
|
$template->assign_block_vars('navlinks', array(
|
||||||
|
'FORUM_NAME' => $row['forum_name'],
|
||||||
|
'U_VIEW_FORUM' => $link
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($row['forum_id'] == $forum_id)
|
||||||
|
{
|
||||||
|
$branch_root_id = 0;
|
||||||
|
$forum_data = $row;
|
||||||
|
$type = 'child';
|
||||||
|
|
||||||
|
$forum_name = $row['forum_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($row['parent_id'] == $forum_data['forum_id'])
|
||||||
|
{
|
||||||
|
// Root-level forum
|
||||||
|
$forum_rows[] = $row;
|
||||||
|
$parent_id = $row['forum_id'];
|
||||||
|
|
||||||
|
if ($row['forum_status'] == ITEM_CATEGORY)
|
||||||
|
{
|
||||||
|
$branch_root_id = $row['forum_id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$s_has_subforums = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($row['parent_id'] == $branch_root_id)
|
||||||
|
{
|
||||||
|
// Forum directly under a category
|
||||||
|
$forum_rows[] = $row;
|
||||||
|
$parent_id = $row['forum_id'];
|
||||||
|
|
||||||
|
if ($row['forum_status'] != ITEM_CATEGORY)
|
||||||
|
{
|
||||||
|
$s_has_subforums = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($row['forum_status'] != ITEM_CATEGORY)
|
||||||
|
{
|
||||||
|
// Subforum
|
||||||
|
if ($auth->acl_get('f_list', $row['forum_id']))
|
||||||
|
{
|
||||||
|
$subforums[$parent_id][] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $s_has_subforums;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -274,6 +274,7 @@ $template->assign_vars(array(
|
||||||
'POST_IMG' => ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $user->img('post_locked', $post_alt) : $user->img('post_new', $post_alt),
|
'POST_IMG' => ( $forum_data['forum_status'] == FORUM_LOCKED ) ? $user->img('post_locked', $post_alt) : $user->img('post_new', $post_alt),
|
||||||
'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
|
'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start),
|
||||||
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),
|
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )),
|
||||||
|
'MOD_CP' => ( $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ) ? sprintf($user->lang['MCP'], '<a href="modcp.' . $phpEx . $SID . '&f=' . $forum_id . '">', '</a>') : '',
|
||||||
|
|
||||||
'FOLDER_IMG' => $user->img('folder', 'No_new_posts'),
|
'FOLDER_IMG' => $user->img('folder', 'No_new_posts'),
|
||||||
'FOLDER_NEW_IMG' => $user->img('folder_new', 'New_posts'),
|
'FOLDER_NEW_IMG' => $user->img('folder_new', 'New_posts'),
|
||||||
|
@ -317,7 +318,7 @@ $template->assign_vars(array(
|
||||||
'S_WATCH_FORUM' => $s_watching_forum,
|
'S_WATCH_FORUM' => $s_watching_forum,
|
||||||
'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . "&start=$start",
|
'S_FORUM_ACTION' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . "&start=$start",
|
||||||
|
|
||||||
'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&mode=newtopic&f=' . $forum_id,
|
'U_POST_NEW_TOPIC' => 'posting.' . $phpEx . $SID . '&mode=post&f=' . $forum_id,
|
||||||
'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . $forum_id,
|
'U_VIEW_MODERATORS' => 'memberslist.' . $phpEx . $SID . '&mode=moderators&f=' . $forum_id,
|
||||||
'U_MARK_READ' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '&mark=topics')
|
'U_MARK_READ' => 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '&mark=topics')
|
||||||
);
|
);
|
||||||
|
@ -334,6 +335,24 @@ if ($s_has_subforums)
|
||||||
include($phpbb_root_path . 'includes/forums_display.' . $phpEx);
|
include($phpbb_root_path . 'includes/forums_display.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Topic icons
|
||||||
|
$sql = "SELECT *
|
||||||
|
FROM " . ICONS_TABLE . "
|
||||||
|
WHERE icons_id > 1";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$topic_icons = array();
|
||||||
|
if ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$topic_icons[$row['icons_id']]['img'] = $row['icons_url'];
|
||||||
|
$topic_icons[$row['icons_id']]['width'] = $row['icons_width'];
|
||||||
|
$topic_icons[$row['icons_id']]['height'] = $row['icons_height'];
|
||||||
|
}
|
||||||
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
}
|
||||||
|
|
||||||
// Grab all the basic data. If we're not on page 1 we also grab any
|
// Grab all the basic data. If we're not on page 1 we also grab any
|
||||||
// announcements that may exist.
|
// announcements that may exist.
|
||||||
$total_topics = 0;
|
$total_topics = 0;
|
||||||
|
@ -341,11 +360,10 @@ $topic_rowset = array();
|
||||||
|
|
||||||
if ( $start )
|
if ( $start )
|
||||||
{
|
{
|
||||||
$sql = "SELECT t.*, i.icons_url, i.icons_width, i.icons_height, u.username, u.user_id, u2.username as user2, u2.user_id as id2
|
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2
|
||||||
FROM " . TOPICS_TABLE . " t, " . ICONS_TABLE . " i, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
|
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
|
||||||
WHERE t.forum_id = $forum_id
|
WHERE t.forum_id = $forum_id
|
||||||
AND t.topic_type = " . POST_ANNOUNCE . "
|
AND t.topic_type = " . POST_ANNOUNCE . "
|
||||||
AND i.icons_id = t.topic_icon
|
|
||||||
AND u.user_id = t.topic_poster
|
AND u.user_id = t.topic_poster
|
||||||
AND u2.user_id = t.topic_last_poster_id
|
AND u2.user_id = t.topic_last_poster_id
|
||||||
ORDER BY $sort_order
|
ORDER BY $sort_order
|
||||||
|
@ -360,19 +378,10 @@ if ( $start )
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// topic icon join requires full table scan ... not good ... order by is a killer too
|
|
||||||
/*$sql = "SELECT t.*, i.icons_url, i.icons_width, i.icons_height, u.username, u.user_id, u2.username as user2, u2.user_id as id2
|
|
||||||
FROM " . TOPICS_TABLE . " t, " . ICONS_TABLE . " i, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
|
|
||||||
WHERE t.forum_id = $forum_id
|
|
||||||
AND i.icons_id = t.topic_icon
|
|
||||||
AND u.user_id = t.topic_poster
|
|
||||||
AND u2.user_id = t.topic_last_poster_id
|
|
||||||
$limit_topics_time
|
|
||||||
ORDER BY t.topic_type DESC, $sort_order
|
|
||||||
LIMIT $start, " . $board_config['topics_per_page'];*/
|
|
||||||
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2
|
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2
|
||||||
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
|
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
|
||||||
WHERE t.forum_id = $forum_id
|
WHERE t.forum_id = $forum_id
|
||||||
|
AND t.topic_approved = 1
|
||||||
AND u.user_id = t.topic_poster
|
AND u.user_id = t.topic_poster
|
||||||
AND u2.user_id = t.topic_last_poster_id
|
AND u2.user_id = t.topic_last_poster_id
|
||||||
$limit_topics_time
|
$limit_topics_time
|
||||||
|
@ -517,7 +526,7 @@ if ( $total_topics )
|
||||||
'VIEWS' => $topic_rowset[$i]['topic_views'],
|
'VIEWS' => $topic_rowset[$i]['topic_views'],
|
||||||
'TOPIC_TITLE' => ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'],
|
'TOPIC_TITLE' => ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'],
|
||||||
'TOPIC_TYPE' => $topic_type,
|
'TOPIC_TYPE' => $topic_type,
|
||||||
'TOPIC_ICON' => ( !empty($topic_rowset[$i]['icons_url']) ) ? '<img src="' . $board_config['icons_path'] . '/' . $topic_rowset[$i]['icons_url'] . '" width="' . $topic_rowset[$i]['icons_width'] . '" height="' . $topic_rowset[$i]['icons_height'] . '" alt="" title="" />' : '',
|
'TOPIC_ICON' => ( !empty($topic_rowset[$i]['topic_icon']) ) ? '<img src="' . $board_config['icons_path'] . '/' . $topic_icons[$topic_rowset[$i]['topic_icon']]['img'] . '" width="' . $topic_icons[$topic_rowset[$i]['topic_icon']]['width'] . '" height="' . $topic_icons[$topic_rowset[$i]['topic_icon']]['height'] . '" alt="" title="" />' : '',
|
||||||
'TOPIC_RATING' => ( !empty($topic_rowset[$i]['topic_rating']) ) ? '<img src=' . str_replace('{RATE}', $topic_rowset[$i]['topic_rating'], $theme['rating']) . ' alt="' . $topic_rowset[$i]['topic_rating'] . '" title="' . $topic_rowset[$i]['topic_rating'] . '" />' : '',
|
'TOPIC_RATING' => ( !empty($topic_rowset[$i]['topic_rating']) ) ? '<img src=' . str_replace('{RATE}', $topic_rowset[$i]['topic_rating'], $theme['rating']) . ' alt="' . $topic_rowset[$i]['topic_rating'] . '" title="' . $topic_rowset[$i]['topic_rating'] . '" />' : '',
|
||||||
|
|
||||||
'S_ROW_COUNT' => $i,
|
'S_ROW_COUNT' => $i,
|
||||||
|
|
|
@ -45,9 +45,9 @@ if (isset($_GET['view']) && empty($post_id))
|
||||||
{
|
{
|
||||||
if ( $_GET['view'] == 'newest' )
|
if ( $_GET['view'] == 'newest' )
|
||||||
{
|
{
|
||||||
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) )
|
if ( isset($_COOKIE[$board_config['cookie_name'] . '_sid']) )
|
||||||
{
|
{
|
||||||
$session_id = $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'];
|
$session_id = $_COOKIE[$board_config['cookie_name'] . '_sid'];
|
||||||
|
|
||||||
if ( $session_id )
|
if ( $session_id )
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ $pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx$SID&
|
||||||
// Post, reply and other URL generation for
|
// Post, reply and other URL generation for
|
||||||
// templating vars
|
// templating vars
|
||||||
//
|
//
|
||||||
$new_topic_url = 'posting.' . $phpEx . $SID . '&mode=newtopic&f=' . $forum_id;
|
$new_topic_url = 'posting.' . $phpEx . $SID . '&mode=post&f=' . $forum_id;
|
||||||
$reply_topic_url = 'posting.' . $phpEx . $SID . '&mode=reply&f=' . $forum_id . '&t=' . $topic_id;
|
$reply_topic_url = 'posting.' . $phpEx . $SID . '&mode=reply&f=' . $forum_id . '&t=' . $topic_id;
|
||||||
$view_forum_url = 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id;
|
$view_forum_url = 'viewforum.' . $phpEx . $SID . '&f=' . $forum_id;
|
||||||
$view_prev_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&view=previous';
|
$view_prev_topic_url = 'viewtopic.' . $phpEx . $SID . '&f=' . $forum_id . '&t=' . $topic_id . '&view=previous';
|
||||||
|
@ -355,9 +355,9 @@ $post_img = ( $forum_status == FORUM_LOCKED ) ? $user->img('post_locked', $user-
|
||||||
//
|
//
|
||||||
// Set a cookie for this topic
|
// Set a cookie for this topic
|
||||||
//
|
//
|
||||||
if ( $user->data['user_id'] )
|
if ($user->data['user_id'] != ANONYMOUS)
|
||||||
{
|
{
|
||||||
$mark_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t'])) : array();
|
$mark_topics = ( isset($_COOKIE[$board_config['cookie_name'] . '_t']) ) ? unserialize(stripslashes($_COOKIE[$board_config['cookie_name'] . '_t'])) : array();
|
||||||
|
|
||||||
$mark_topics[$forum_id][$topic_id] = 0;
|
$mark_topics[$forum_id][$topic_id] = 0;
|
||||||
setcookie($board_config['cookie_name'] . '_t', serialize($mark_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
|
setcookie($board_config['cookie_name'] . '_t', serialize($mark_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
|
||||||
|
@ -389,6 +389,7 @@ $template->assign_vars(array(
|
||||||
'TOPIC_TITLE' => $topic_title,
|
'TOPIC_TITLE' => $topic_title,
|
||||||
'PAGINATION' => $pagination,
|
'PAGINATION' => $pagination,
|
||||||
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $board_config['posts_per_page'] ) + 1 ), ceil( $topic_replies / $board_config['posts_per_page'] )),
|
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], ( floor( $start / $board_config['posts_per_page'] ) + 1 ), ceil( $topic_replies / $board_config['posts_per_page'] )),
|
||||||
|
'MOD_CP' => ( $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id) ) ? sprintf($user->lang['MCP'], '<a href="modcp.' . $phpEx . $SID . '&f=' . $forum_id . '">', '</a>') : '',
|
||||||
|
|
||||||
'POST_IMG' => $post_img,
|
'POST_IMG' => $post_img,
|
||||||
'REPLY_IMG' => $reply_img,
|
'REPLY_IMG' => $reply_img,
|
||||||
|
@ -756,7 +757,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&mode=editpost&p=" . $row['post_id'];
|
$temp_url = "posting.$phpEx$SID&mode=edit&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>';
|
||||||
}
|
}
|
||||||
|
@ -992,7 +993,7 @@ if ( $row = $db->sql_fetchrow($result) )
|
||||||
'POST_SUBJECT' => $post_subject,
|
'POST_SUBJECT' => $post_subject,
|
||||||
'MESSAGE' => $message,
|
'MESSAGE' => $message,
|
||||||
'SIGNATURE' => $poster_details[$poster_id]['sig'],
|
'SIGNATURE' => $poster_details[$poster_id]['sig'],
|
||||||
'EDITED_MESSAGE' => $l_edited_by,
|
'EDITED_MESSAGE'=> $l_edited_by,
|
||||||
|
|
||||||
'MINI_POST_IMG' => $mini_post_img,
|
'MINI_POST_IMG' => $mini_post_img,
|
||||||
'EDIT_IMG' => $edit_img,
|
'EDIT_IMG' => $edit_img,
|
||||||
|
@ -1014,7 +1015,7 @@ if ( $row = $db->sql_fetchrow($result) )
|
||||||
'EMAIL' => $poster_details[$poster_id]['email'],
|
'EMAIL' => $poster_details[$poster_id]['email'],
|
||||||
'WWW_IMG' => $poster_details[$poster_id]['www_img'],
|
'WWW_IMG' => $poster_details[$poster_id]['www_img'],
|
||||||
'WWW' => $poster_details[$poster_id]['www'],
|
'WWW' => $poster_details[$poster_id]['www'],
|
||||||
'ICQ_STATUS_IMG' => $poster_details[$poster_id]['icq_status_img'],
|
'ICQ_STATUS_IMG'=> $poster_details[$poster_id]['icq_status_img'],
|
||||||
'ICQ_IMG' => $poster_details[$poster_id]['icq_img'],
|
'ICQ_IMG' => $poster_details[$poster_id]['icq_img'],
|
||||||
'ICQ' => $poster_details[$poster_id]['icq'],
|
'ICQ' => $poster_details[$poster_id]['icq'],
|
||||||
'AIM_IMG' => $poster_details[$poster_id]['aim_img'],
|
'AIM_IMG' => $poster_details[$poster_id]['aim_img'],
|
||||||
|
|
Loading…
Add table
Reference in a new issue