Basic new post folder colour change

git-svn-id: file:///svn/phpbb/trunk@430 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-06-05 13:34:23 +00:00
parent b238891d8c
commit c5ea123ae7
3 changed files with 44 additions and 11 deletions

View file

@ -56,6 +56,7 @@ $images['msnm'] = "$url_images/msnm.gif";
$images['quote'] = "$url_images/quote.gif"; $images['quote'] = "$url_images/quote.gif";
$images['posticon'] = "$url_images/posticon.gif"; $images['posticon'] = "$url_images/posticon.gif";
$images['folder'] = "$url_images/folder.gif"; $images['folder'] = "$url_images/folder.gif";
$images['new_folder'] = "$url_images/red_folder.gif";
$images['latest_reply'] = "$url_images/latest_reply.gif"; $images['latest_reply'] = "$url_images/latest_reply.gif";
include('includes/template.inc'); include('includes/template.inc');

View file

@ -94,12 +94,11 @@ if($total_categories)
{ {
case 'postgresql': case 'postgresql':
$limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : ""; $limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : "";
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, af.auth_view, af.auth_read, af.auth_post, af.auth_reply, af.auth_edit, af.auth_delete, af.auth_votecreate, af.auth_vote $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
FROM ".FORUMS_TABLE." f, ".TOPICS_TABLE." t, ".POSTS_TABLE." p, ".USERS_TABLE." u, ".AUTH_FORUMS_TABLE." af FROM ".FORUMS_TABLE." f, ".TOPICS_TABLE." t, ".POSTS_TABLE." p, ".USERS_TABLE." u
WHERE f.forum_last_post_id = p.post_id WHERE f.forum_last_post_id = p.post_id
AND p.post_id = t.topic_last_post_id AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id AND p.poster_id = u.user_id
AND af.forum_id = f.forum_id
$limit_forums $limit_forums
UNION ( UNION (
SELECT f.*, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL SELECT f.*, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
@ -116,12 +115,11 @@ if($total_categories)
case 'oracle': case 'oracle':
$limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : ""; $limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : "";
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, af.auth_view, af.auth_read, af.auth_post, af.auth_reply, af.auth_edit, af.auth_delete, af.auth_votecreate, af.auth_vote $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
FROM ".FORUMS_TABLE." f, ".POSTS_TABLE." p, ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".AUTH_FORUMS_TABLE." af FROM ".FORUMS_TABLE." f, ".POSTS_TABLE." p, ".TOPICS_TABLE." t, ".USERS_TABLE." u
WHERE f.forum_last_post_id = p.post_id(+) WHERE f.forum_last_post_id = p.post_id(+)
AND p.post_id = t.topic_last_post_id(+) AND p.post_id = t.topic_last_post_id(+)
AND p.poster_id = u.user_id(+) AND p.poster_id = u.user_id(+)
AND af.forum_id = f.forum_id(+)
$limit_forums $limit_forums
ORDER BY f.cat_id, f.forum_order"; ORDER BY f.cat_id, f.forum_order";
break; break;
@ -129,6 +127,15 @@ if($total_categories)
default: default:
// This works on: MySQL, MSSQL and ODBC (Access) // This works on: MySQL, MSSQL and ODBC (Access)
$limit_forums = ($viewcat != -1) ? "WHERE f.cat_id = $viewcat " : ""; $limit_forums = ($viewcat != -1) ? "WHERE f.cat_id = $viewcat " : "";
/*
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
FROM ((( ".FORUMS_TABLE." f
LEFT JOIN ".POSTS_TABLE." p ON f.forum_last_post_id = p.post_id )
LEFT JOIN ".TOPICS_TABLE." t ON p.post_id = t.topic_last_post_id )
LEFT JOIN ".USERS_TABLE." u ON p.poster_id = u.user_id )
$limit_forums
ORDER BY f.cat_id, f.forum_order";
*/
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, af.auth_view, af.auth_read, af.auth_post, af.auth_reply, af.auth_edit, af.auth_delete, af.auth_votecreate, af.auth_vote $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, af.auth_view, af.auth_read, af.auth_post, af.auth_reply, af.auth_edit, af.auth_delete, af.auth_votecreate, af.auth_vote
FROM ((( ".FORUMS_TABLE." f FROM ((( ".FORUMS_TABLE." f
LEFT JOIN ".POSTS_TABLE." p ON f.forum_last_post_id = p.post_id ) LEFT JOIN ".POSTS_TABLE." p ON f.forum_last_post_id = p.post_id )
@ -139,6 +146,7 @@ if($total_categories)
ORDER BY f.cat_id, f.forum_order"; ORDER BY f.cat_id, f.forum_order";
break; break;
} }
if(!$q_forums = $db->sql_query($sql)) if(!$q_forums = $db->sql_query($sql))
{ {
if(DEBUG) if(DEBUG)
@ -199,10 +207,18 @@ if($total_categories)
for($j = 0; $j < $total_forums; $j++) for($j = 0; $j < $total_forums; $j++)
{ {
if( ( ($forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $viewcat == -1) || if( ( ($forum_rows[$j]['cat_id'] == $category_rows[$i]['cat_id'] && $viewcat == -1) ||
($category_rows[$i]['cat_id'] == $viewcat) ) && ($category_rows[$i]['cat_id'] == $viewcat) ) && $is_auth_ary[$forum_rows[$j]['forum_id']]['auth_view'])
$is_auth_ary[$forum_rows[$j]['forum_id']]['auth_view'])
{ {
$folder_image = "<img src=\"".$images['folder']."\">";
if($userdata['session_start'] == $userdata['session_time'])
{
$folder_image = ($forum_rows[$j]['post_time'] > $userdata['session_last_visit']) ? "<img src=\"".$images['new_folder']."\">" : "<img src=\"".$images['folder']."\">";
}
else
{
$folder_image = ($forum_rows[$j]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"".$images['new_folder']."\">" : "<img src=\"".$images['folder']."\">";
}
$posts = $forum_rows[$j]['forum_posts']; $posts = $forum_rows[$j]['forum_posts'];
$topics = $forum_rows[$j]['forum_topics']; $topics = $forum_rows[$j]['forum_topics'];
if($forum_rows[$j]['username'] != "" && $forum_rows[$j]['post_time'] > 0) if($forum_rows[$j]['username'] != "" && $forum_rows[$j]['post_time'] > 0)

View file

@ -56,6 +56,15 @@ init_userprefs($userdata);
// //
if(isset($forum_id)) if(isset($forum_id))
{ {
/*
$sql = "SELECT f.forum_name, f.forum_topics, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_votecreate, f.auth_vote, u.username, u.user_id
FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa
WHERE f.forum_id = $forum_id
AND aa.auth_mod = 1
AND aa.forum_id = f.forum_id
AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id";
*/
$sql = "SELECT f.forum_name, f.forum_topics, u.username, u.user_id, fa.* $sql = "SELECT f.forum_name, f.forum_topics, u.username, u.user_id, fa.*
FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa, ".AUTH_FORUMS_TABLE." fa FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa, ".AUTH_FORUMS_TABLE." fa
WHERE f.forum_id = $forum_id WHERE f.forum_id = $forum_id
@ -275,7 +284,14 @@ if($total_topics)
$goto_page = ""; $goto_page = "";
} }
$folder_img = "<img src=\"".$images['folder']."\">"; if($userdata['session_start'] == $userdata['session_time'])
{
$folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_last_visit']) ? "<img src=\"".$images['new_folder']."\">" : "<img src=\"".$images['folder']."\">";
}
else
{
$folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"".$images['new_folder']."\">" : "<img src=\"".$images['folder']."\">";
}
$view_topic_url = append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&".$replies); $view_topic_url = append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&".$replies);
@ -291,7 +307,7 @@ if($total_topics)
$template->assign_block_vars("topicrow", array( $template->assign_block_vars("topicrow", array(
"FORUM_ID" => $forum_id, "FORUM_ID" => $forum_id,
"TOPIC_ID" => $topic_id, "TOPIC_ID" => $topic_id,
"FOLDER" => $folder_img, "FOLDER" => $folder_image,
"TOPIC_POSTER" => $topic_poster, "TOPIC_POSTER" => $topic_poster,
"GOTO_PAGE" => $goto_page, "GOTO_PAGE" => $goto_page,
"REPLIES" => $replies, "REPLIES" => $replies,