1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-18 14:48:28 +01:00

prepare files, last commit before committing initial attachment functionality - please see thread within development forum.

git-svn-id: file:///svn/phpbb/trunk@3695 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2003-03-20 13:21:58 +00:00
parent ab3209af48
commit 73ffe96e2e
3 changed files with 48 additions and 78 deletions

View File

@ -164,12 +164,6 @@ function decode_text(&$message)
return;
}
// Quote Text
function quote_text(&$message, $username = '')
{
$message = ' [quote' . ( (empty($username)) ? ']' : '="' . addslashes(trim($username)) . '"]') . trim($message) . '[/quote] ';
}
// Topic Review
function topic_review($topic_id, $is_inline_review = false)
{
@ -332,27 +326,28 @@ function update_last_post_information($type, $id)
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($type == 'forum')
switch ($type)
{
// Update forums: last post info, topics, posts ... we need to update
// each parent too ...
$forum_ids = $id;
$forum_parents = trim($row['forum_parents']);
case 'forum':
// Update forums: last post info, topics, posts ... we need to update
// each parent too ...
$forum_ids = $id;
$forum_parents = trim($row['forum_parents']);
if ($forum_parents != '')
{
$forum_parents = unserialize($forum_parents);
foreach ($forum_parents as $parent_forum_id => $parent_name)
if ($forum_parents != '')
{
$forum_ids .= ', ' . $parent_forum_id;
$forum_parents = unserialize($forum_parents);
foreach ($forum_parents as $parent_forum_id => $parent_name)
{
$forum_ids .= ', ' . $parent_forum_id;
}
}
}
$where_clause = 'forum_id IN (' . $forum_ids . ')';
}
else if ($type == 'topic')
{
$where_clause = 'topic_id = ' . $id;
$where_clause = 'forum_id IN (' . $forum_ids . ')';
break;
case 'topic':
$where_clause = 'topic_id = ' . $id;
break;
}
$update_sql = array(
@ -650,7 +645,8 @@ function submit_poll($topic_id, $mode, $poll)
if (sizeof($poll['poll_options']) < sizeof($cur_poll_options))
{
$sql = "DELETE FROM " . POLL_OPTIONS_TABLE . "
WHERE poll_option_id > " . sizeof($poll['poll_options']) . " AND topic_id = " . $topic_id;
WHERE poll_option_id > " . sizeof($poll['poll_options']) . "
AND topic_id = " . $topic_id;
$db->sql_query($sql);
}
}
@ -845,11 +841,11 @@ function delete_poll($topic_id)
global $db;
$sql = "DELETE FROM " . POLL_OPTIONS_TABLE . "
WHERE topic_id = " . $topic_id;
WHERE topic_id = " . $topic_id;
$db->sql_query($sql);
$sql = "DELETE FROM " . POLL_VOTES_TABLE . "
WHERE topic_id = " . $topic_id;
WHERE topic_id = " . $topic_id;
$db->sql_query($sql);
$topic_sql = array(
@ -873,7 +869,7 @@ function delete_post($mode, $post_id, $topic_id, $forum_id, $post_data)
$db->sql_transaction();
$sql = "DELETE FROM " . POSTS_TABLE . "
WHERE post_id = " . $post_id;
WHERE post_id = " . $post_id;
$db->sql_query($sql);
// User tries to delete the post twice ? Exit... we do not want the topics table screwed up.
@ -894,12 +890,12 @@ function delete_post($mode, $post_id, $topic_id, $forum_id, $post_data)
if ($post_data['topic_first_post_id'] == $post_data['topic_last_post_id'])
{
$sql = "DELETE FROM " . TOPICS_TABLE . "
WHERE topic_id = " . $topic_id . "
OR topic_moved_id = " . $topic_id;
WHERE topic_id = " . $topic_id . "
OR topic_moved_id = " . $topic_id;
$db->sql_query($sql);
$sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = " . $topic_id;
WHERE topic_id = " . $topic_id;
$db->sql_query($sql);
$forum_update_sql .= ($forum_update_sql != '') ? ', ' : '';
@ -945,27 +941,24 @@ function delete_post($mode, $post_id, $topic_id, $forum_id, $post_data)
if (($forum_update_sql != '') || (count($forum_sql) > 0))
{
$sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . ( (count($forum_sql) > 0) ? $db->sql_build_array('UPDATE', $forum_sql) : '') .
( ($forum_update_sql != '') ? ((count($forum_sql) > 0) ? ', ' . $forum_update_sql : $forum_update_sql) : '') . '
WHERE forum_id = ' . $forum_id;
( ($forum_update_sql != '') ? ((count($forum_sql) > 0) ? ', ' . $forum_update_sql : $forum_update_sql) : '') . '
WHERE forum_id = ' . $forum_id;
$db->sql_query($sql);
}
if (($topic_update_sql != '') || (count($topic_sql) > 0))
{
$sql = 'UPDATE ' . TOPICS_TABLE . ' SET ' . ( (count($topic_sql) > 0) ? $db->sql_build_array('UPDATE', $topic_sql) : '') .
( ($topic_update_sql != '') ? ((count($topic_sql) > 0) ? ', ' . $topic_update_sql : $topic_update_sql) : '') . '
WHERE topic_id = ' . $topic_id;
( ($topic_update_sql != '') ? ((count($topic_sql) > 0) ? ', ' . $topic_update_sql : $topic_update_sql) : '') . '
WHERE topic_id = ' . $topic_id;
$db->sql_query($sql);
}
if (($user_update_sql != '') || (count($user_sql) > 0))
{
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . ( (count($user_sql) > 0) ? $db->sql_build_array('UPDATE', $user_sql) : '') .
( ($user_update_sql != '') ? ((count($user_sql) > 0) ? ', ' . $user_update_sql : $user_update_sql) : '') . '
WHERE user_id = ' . $post_data['user_id'];
( ($user_update_sql != '') ? ((count($user_sql) > 0) ? ', ' . $user_update_sql : $user_update_sql) : '') . '
WHERE user_id = ' . $post_data['user_id'];
$db->sql_query($sql);
}

View File

@ -31,7 +31,7 @@ class parse_message
$this->message_mode = $message_type;
}
function parse(&$message, $html, $bbcode, $uid, $url, $smilies, $attach = false)
function parse(&$message, $html, $bbcode, $uid, $url, $smilies, $attach)
{
global $config, $db, $user;
@ -54,7 +54,7 @@ class parse_message
if (intval($config['max_post_smilies']) && $smilies )
{
$sql = "SELECT code
FROM " . SMILIES_TABLE;
FROM " . SMILIES_TABLE;
$result = $db->sql_query($sql);
$match = 0;
@ -156,7 +156,7 @@ class parse_message
global $db, $user;
$sql = "SELECT *
FROM " . SMILIES_TABLE;
FROM " . SMILIES_TABLE;
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))

View File

@ -127,7 +127,7 @@ switch ($mode)
}
$sql = "SELECT t.*, f.*
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.topic_id = " . $topic_id . "
AND f.forum_id = t.forum_id";
@ -182,8 +182,7 @@ if ($sql != '')
$topic_id = intval($row['topic_id']);
$post_id = intval($row['post_id']);
@reset($forum_fields);
while (list($var, $type) = each($forum_fields))
foreach ($forum_fields as $var => $type)
{
switch ($type)
{
@ -198,8 +197,7 @@ if ($sql != '')
}
}
@reset($topic_fields);
while (list($var, $type) = each($topic_fields))
foreach ($topic_fields as $var => $type)
{
switch ($type)
{
@ -214,8 +212,7 @@ if ($sql != '')
}
}
@reset($post_fields);
while (list($var, $type) = each($post_fields))
foreach ($post_fields as $var => $type)
{
switch ($type)
{
@ -238,9 +235,9 @@ if ($sql != '')
if ($poll_start)
{
$sql = "SELECT poll_option_text
FROM " . POLL_OPTIONS_TABLE . "
WHERE topic_id = " . $topic_id . "
ORDER BY poll_option_id";
FROM " . POLL_OPTIONS_TABLE . "
WHERE topic_id = " . $topic_id . "
ORDER BY poll_option_id";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@ -276,9 +273,9 @@ if ($sql != '')
if ($mode != 'post' && $user->data['user_id'] != ANONYMOUS)
{
$sql = "SELECT topic_id
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = " . $topic_id . "
AND user_id = " . $user->data['user_id'];
FROM " . TOPICS_WATCH_TABLE . "
WHERE topic_id = " . $topic_id . "
AND user_id = " . $user->data['user_id'];
$result = $db->sql_query($sql);
$notify_set = ($db->sql_fetchrow($result)) ? true : false;
@ -301,10 +298,6 @@ $perm = array(
'f_save' => $auth->acl_gets('f_save', 'm_', 'a_', $forum_id)
);
// DEBUG - Show Permissions
//debug_print_permissions($perm);
// DEBUG - Show Permissions
if ( (!$auth->acl_gets('f_' . $mode, 'm_', 'a_', $forum_id)) && ($forum_postable) )
{
trigger_error($user->lang['USER_CANNOT_' . strtoupper($mode)]);
@ -447,7 +440,7 @@ if (($submit) || ($preview))
if ($mode != 'edit' || $message_md5 != $post_checksum)
{
// Parse message
if (($result = $message_parser->parse($message, $enable_html, $enable_bbcode, $bbcode_uid, $enable_urls, $enable_smilies)) != '')
if (($result = $message_parser->parse($message, $enable_html, $enable_bbcode, $bbcode_uid, $enable_urls, $enable_smilies, false)) != '')
{
$err_msg .= ((!empty($err_msg)) ? '<br />' : '') . $result;
}
@ -459,7 +452,7 @@ if (($submit) || ($preview))
$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";
WHERE " . $where_sql;
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
@ -613,7 +606,7 @@ $poll_options = explode("\n", $poll_options_tmp);
if (($mode == 'quote') && (!$preview))
{
quote_text($post_text, $username);
$post_text = ' [quote' . ( (empty($username)) ? ']' : '="' . addslashes(trim($username)) . '"]') . trim($post_text) . '[/quote] ';
}
if ( (($mode == 'reply') || ($mode == 'quote')) && (!$preview) )
@ -642,8 +635,7 @@ if ( ($mode == 'post') || (($mode == 'edit') && ($post_id == $topic_first_post_i
// 'global_announce' => array('const' => POST_GLOBAL_ANNOUNCE, 'lang' => 'POST_GLOBAL_ANNOUNCE')
);
@reset($topic_types);
while (list($auth_key, $topic_value) = each($topic_types))
foreach ($topic_types as $auth_key => $topic_value)
{
if ($perm['f_' . $auth_key])
{
@ -797,19 +789,4 @@ if ($mode == 'reply' || $mode == 'quote')
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
function debug_print_permissions($perm)
{
global $forum_id;
@reset($perm);
echo '<span class="gensmall">Permission Settings -> Forum ID ' . $forum_id . ': <br />';
while (list($perm_key, $authed) = each($perm))
{
echo $perm_key . ' -> ' . (($authed) ? 'yes' : 'no') . '<br />';
}
echo '</span>';
}
?>