mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-19 15:17:16 +01:00
only small addition for further use...
git-svn-id: file:///svn/phpbb/trunk@4162 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
3d36530308
commit
251a5b8f94
@ -283,7 +283,7 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = '
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (count($post_id_array) == 0)
|
||||
if (!count($post_id_array))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -312,7 +312,7 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = '
|
||||
}
|
||||
}
|
||||
|
||||
if (count($post_id_array) == 0)
|
||||
if (!count($post_id_array))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -335,7 +335,7 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = '
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (count($attach_id_array) == 0)
|
||||
if (!count($attach_id_array))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -359,7 +359,7 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = '
|
||||
}
|
||||
}
|
||||
|
||||
if (count($attach_id_array) == 0)
|
||||
if (!count($attach_id_array))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -421,22 +421,22 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = '
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE attach_id IN (' . implode(', ', $attach_id_array) . ')
|
||||
AND ' . $sql_id . ' IN (' . implode(', ', $post_id_array) . ')';
|
||||
WHERE attach_id IN (" . implode(', ', $attach_id_array) . ")
|
||||
AND $sql_id IN (" . implode(', ', $post_id_array) . ")";
|
||||
$db->sql_query($sql);
|
||||
|
||||
foreach ($attach_id_array as $attach_id)
|
||||
{
|
||||
$sql = 'SELECT attach_id
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE attach_id = ' . $attach_id;
|
||||
FROM ' . ATTACHMENTS_TABLE . "
|
||||
WHERE attach_id = $attach_id";
|
||||
$select_result = $db->sql_query($sql);
|
||||
|
||||
if (!is_array($db->sql_fetchrow($select_result)))
|
||||
{
|
||||
$sql = 'SELECT attach_id, physical_filename, thumbnail
|
||||
FROM ' . ATTACHMENTS_DESC_TABLE . '
|
||||
WHERE attach_id = ' . $attach_id;
|
||||
FROM ' . ATTACHMENTS_DESC_TABLE . "
|
||||
WHERE attach_id = $attach_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
// delete attachments
|
||||
@ -490,9 +490,9 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = '
|
||||
$topic_id = intval($row['topic_id']);
|
||||
|
||||
$sql = 'SELECT post_id
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE topic_id = ' . $topic_id . '
|
||||
GROUP BY post_id';
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE topic_id = $topic_id
|
||||
GROUP BY post_id";
|
||||
$result2 = $db->sql_query($sql);
|
||||
|
||||
$post_ids = array();
|
||||
@ -508,29 +508,29 @@ function delete_attachment($post_id_array = -1, $attach_id_array = -1, $page = '
|
||||
$post_id_sql = implode(', ', $post_ids);
|
||||
|
||||
$sql = 'SELECT attach_id
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE post_id IN (' . $post_id_sql . ') ';
|
||||
FROM ' . ATTACHMENTS_TABLE . "
|
||||
WHERE post_id IN ($post_id_sql)";
|
||||
$select_result = $db->sql_query_limit($sql, 1);
|
||||
$set_id = ( !is_array($db->sql_fetchrow($select_result))) ? 0 : 1;
|
||||
$set_id = (!is_array($db->sql_fetchrow($select_result))) ? 0 : 1;
|
||||
$db->sql_freeresult($select_result);
|
||||
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||
SET topic_attachment = ' . $set_id . '
|
||||
WHERE topic_id = ' . $topic_id;
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||
SET topic_attachment = $set_id
|
||||
WHERE topic_id = $topic_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
foreach ($post_ids as $post_id)
|
||||
{
|
||||
$sql = 'SELECT attach_id
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE post_id = ' . $post_id;
|
||||
FROM ' . ATTACHMENTS_TABLE . "
|
||||
WHERE post_id = $post_id";
|
||||
$select_result = $db->sql_query_limit($sql, 1);
|
||||
$set_id = ( !is_array($db->sql_fetchrow($select_result))) ? 0 : 1;
|
||||
$set_id = (!is_array($db->sql_fetchrow($select_result))) ? 0 : 1;
|
||||
$db->sql_freeresult($select_result);
|
||||
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||
SET post_attachment = ' . $set_id . '
|
||||
WHERE post_id = ' . $post_id;
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . "
|
||||
SET post_attachment = $set_id
|
||||
WHERE post_id = $post_id";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
@ -1045,49 +1045,53 @@ function submit_post($mode, $message, $subject, $username, $topic_type, $bbcode_
|
||||
'comment' => trim($attach_row['comment'])
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' WHERE attach_id = ' . intval($attach_row['attach_id']);
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $attach_sql) . '
|
||||
WHERE attach_id = ' . intval($attach_row['attach_id']);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
// insert attachment into db
|
||||
$attach_sql = array(
|
||||
'physical_filename' => $attach_row['physical_filename'],
|
||||
'real_filename' => $attach_row['real_filename'],
|
||||
'comment' => trim($attach_row['comment']),
|
||||
'extension' => $attach_row['extension'],
|
||||
'mimetype' => $attach_row['mimetype'],
|
||||
'filesize' => $attach_row['filesize'],
|
||||
'filetime' => $attach_row['filetime'],
|
||||
'thumbnail' => $attach_row['thumbnail']
|
||||
'physical_filename' => $attach_row['physical_filename'],
|
||||
'real_filename' => $attach_row['real_filename'],
|
||||
'comment' => trim($attach_row['comment']),
|
||||
'extension' => $attach_row['extension'],
|
||||
'mimetype' => $attach_row['mimetype'],
|
||||
'filesize' => $attach_row['filesize'],
|
||||
'filetime' => $attach_row['filetime'],
|
||||
'thumbnail' => $attach_row['thumbnail']
|
||||
);
|
||||
|
||||
$sql = 'INSERT INTO ' . ATTACHMENTS_DESC_TABLE . ' ' . $db->sql_build_array('INSERT', $attach_sql);
|
||||
$sql = 'INSERT INTO ' . ATTACHMENTS_DESC_TABLE . ' ' .
|
||||
$db->sql_build_array('INSERT', $attach_sql);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$attach_sql = array(
|
||||
'attach_id' => $db->sql_nextid(),
|
||||
'post_id' => $post_data['post_id'],
|
||||
'privmsgs_id' => 0,
|
||||
'user_id_from' => ($mode == 'edit') ? $post_data['poster_id'] : intval($user->data['user_id']),
|
||||
'user_id_to' => 0
|
||||
'attach_id' => $db->sql_nextid(),
|
||||
'post_id' => $post_data['post_id'],
|
||||
'privmsgs_id' => 0,
|
||||
'user_id_from' => ($mode == 'edit') ? $post_data['poster_id'] : intval($user->data['user_id']),
|
||||
'user_id_to' => 0
|
||||
);
|
||||
|
||||
$sql = 'INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $attach_sql);
|
||||
$sql = 'INSERT INTO ' . ATTACHMENTS_TABLE . ' ' .
|
||||
$db->sql_build_array('INSERT', $attach_sql);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($attachment_data))
|
||||
{
|
||||
$sql = "UPDATE " . POSTS_TABLE . "
|
||||
$sql = 'UPDATE ' . POSTS_TABLE . '
|
||||
SET post_attachment = 1
|
||||
WHERE post_id = " . $post_data['post_id'];
|
||||
WHERE post_id = ' . $post_data['post_id'];
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = "UPDATE " . TOPICS_TABLE . "
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||
SET topic_attachment = 1
|
||||
WHERE topic_id = " . $post_data['topic_id'];
|
||||
WHERE topic_id = ' . $post_data['topic_id'];
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
@ -832,6 +832,7 @@ CREATE TABLE phpbb_topics (
|
||||
topic_last_poster_id INTEGER DEFAULT 0 NOT NULL,
|
||||
topic_last_poster_name VARCHAR(30),
|
||||
topic_last_post_time INTEGER DEFAULT 0 NOT NULL,
|
||||
topic_last_view_time INTEGER DEFAULT 0 NOT NULL,
|
||||
topic_moved_id INTEGER DEFAULT 0 NOT NULL,
|
||||
poll_title VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
poll_start INTEGER DEFAULT 0 NOT NULL,
|
||||
|
@ -576,6 +576,7 @@ CREATE TABLE phpbb_topics (
|
||||
topic_last_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
topic_last_poster_name varchar(30),
|
||||
topic_last_post_time int(11) DEFAULT '0' NOT NULL,
|
||||
topic_last_view_time int(11) DEFAULT '0' NOT NULL,
|
||||
topic_moved_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
poll_title varchar(255) NOT NULL,
|
||||
poll_start int(11) NOT NULL DEFAULT '0',
|
||||
|
@ -362,7 +362,7 @@ INSERT INTO phpbb_moderator_cache (user_id, forum_id, username) VALUES (2, 2, 'A
|
||||
# MSSQL IDENTITY phpbb_topics ON #
|
||||
|
||||
# -- Demo Topic
|
||||
INSERT INTO phpbb_topics (topic_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_post_time) VALUES (1, 'Welcome to phpBB 2', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 1, 2, 'Admin', 972086460);
|
||||
INSERT INTO phpbb_topics (topic_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_post_time, topic_last_view_time) VALUES (1, 'Welcome to phpBB 2', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 1, 2, 'Admin', 972086460, 972086460);
|
||||
|
||||
# MSSQL IDENTITY phpbb_topics OFF #
|
||||
|
||||
|
@ -509,6 +509,8 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||
|
||||
$last_post_time = $user->format_date($row['topic_last_post_time']);
|
||||
|
||||
$last_view_time = $user->format_date($row['topic_last_view_time']);
|
||||
|
||||
// This will allow the style designer to output a different header
|
||||
// or even seperate the list of announcements from sticky and normal
|
||||
// topics
|
||||
@ -522,6 +524,7 @@ if ($forum_data['forum_type'] == FORUM_POST)
|
||||
'FIRST_POST_TIME' => $first_post_time,
|
||||
'LAST_POST_TIME' => $last_post_time,
|
||||
'LAST_POST_AUTHOR' => $last_post_author,
|
||||
'LAST_VIEW_TIME' => $last_view_time,
|
||||
'GOTO_PAGE' => $goto_page,
|
||||
'REPLIES' => ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'],
|
||||
'VIEWS' => $row['topic_views'],
|
||||
|
@ -1045,7 +1045,7 @@ unset($user_cache);
|
||||
if (!preg_match("#&t=$topic_id#", $user->data['session_page']))
|
||||
{
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||
SET topic_views = topic_views + 1
|
||||
SET topic_views = topic_views + 1, topic_last_view_time = " . time() . "
|
||||
WHERE topic_id = $topic_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user