aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2003-06-21 12:36:00 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2003-06-21 12:36:00 +0000
commit251a5b8f94c956f722660207f6ceb67057b6de81 (patch)
treecc0829a82cc896366ff42c19bc0b029b686ca9d7 /phpBB
parent3d36530308e85b4ec7da1e9ffb26e1bbc93cb5f2 (diff)
downloadforums-251a5b8f94c956f722660207f6ceb67057b6de81.tar
forums-251a5b8f94c956f722660207f6ceb67057b6de81.tar.gz
forums-251a5b8f94c956f722660207f6ceb67057b6de81.tar.bz2
forums-251a5b8f94c956f722660207f6ceb67057b6de81.tar.xz
forums-251a5b8f94c956f722660207f6ceb67057b6de81.zip
only small addition for further use...
git-svn-id: file:///svn/phpbb/trunk@4162 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_posting.php94
-rw-r--r--phpBB/install/schemas/firebird_schema.sql1
-rw-r--r--phpBB/install/schemas/mysql_schema.sql1
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/viewforum.php3
-rw-r--r--phpBB/viewtopic.php2
6 files changed, 56 insertions, 47 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index b5e5792d44..73fdc70b6f 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -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);
}
}
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index f867aae8fd..4090469598 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.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,
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index c886e67d8c..2b6cc777bd 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -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',
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 5d42cc2e09..30e0a8f85d 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -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 #
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index b2274b5522..80285cbe74 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -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'],
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 0c1037774e..ac871350a1 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -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);