From 44990dd2b7b9debbd38445a21a06effcbe75c301 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 24 Jul 2001 17:34:40 +0000 Subject: Forum locking now implemented + some updates for future functionality git-svn-id: file:///svn/phpbb/trunk@744 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/index.php | 62 ++++++++++++++++++++-------- phpBB/templates/PSO/images/post-locked.gif | Bin 0 -> 1709 bytes phpBB/templates/PSO/images/reply-locked.gif | Bin 2061 -> 1588 bytes phpBB/templates/PSO/viewforum_body.tpl | 4 +- phpBB/templates/PSO/viewtopic_body.tpl | 4 +- phpBB/viewforum.php | 24 +++++++---- phpBB/viewtopic.php | 51 +++++++++++++++++++---- 7 files changed, 106 insertions(+), 39 deletions(-) create mode 100644 phpBB/templates/PSO/images/post-locked.gif diff --git a/phpBB/index.php b/phpBB/index.php index e0857a2f90..41e86ed68f 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -25,9 +25,6 @@ $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); -$pagetype = "index"; -$page_title = "Forum Index"; - // // Start session management // @@ -135,13 +132,29 @@ if($total_categories = $db->sql_numrows($q_categories)) // // Obtain list of moderators of each forum // - $sql = "SELECT f.forum_id, g.group_name, g.group_id, g.group_single_user, ug.user_id - FROM " . FORUMS_TABLE . " f, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa + $sql = "SELECT aa.forum_id, g.group_name, g.group_id, g.group_single_user, u.user_id, u.username + FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u + WHERE aa.auth_mod = " . TRUE . " + AND ug.group_id = aa.group_id + AND g.group_id = aa.group_id + AND u.user_id = ug.user_id + ORDER BY aa.forum_id, g.group_id, u.user_id"; + +/* $sql = "SELECT f.forum_id, g.group_name, g.group_id, u.user_id, u.username + FROM " . AUTH_ACCESS_TABLE . " aa, " . FORUMS_TABLE . " f, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u, " . GROUPS_TABLE . " g WHERE aa.forum_id = f.forum_id AND aa.auth_mod = " . TRUE . " - AND g.group_id = aa.group_id - AND ug.group_id = g.group_id - ORDER BY f.forum_id, g.group_id"; + AND ( + ( ug.user_id = aa.user_id + AND u.user_id = ug.user_id + AND g.group_id = 0 ) + OR + ( ug.group_id = aa.group_id + AND u.user_id = ug.user_id + AND g.group_id <> 0 ) + ) + AND g.group_id = ug.group_id + ORDER BY f.forum_id, g.group_id, u.user_id";*/ if(!$q_forum_mods = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not query forum moderator information", "", __LINE__, __FILE__, $sql); @@ -150,15 +163,18 @@ if($total_categories = $db->sql_numrows($q_categories)) for($i = 0; $i < count($forum_mods_list); $i++) { - $forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_name']; - $forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_single_user']; - - if($forum_mods_list[$i]['group_single_user']) + if($forum_mods_list[$i]['group_single_user'] || !$forum_mods_list[$i]['group_id']) { + $forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 1; + + $forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['username']; $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id']; } else { + $forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 0; + + $forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_name']; $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_id']; } } @@ -171,6 +187,7 @@ if($total_categories = $db->sql_numrows($q_categories)) // // Output page header and open the index body template // + $page_title = "Forum Index"; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( @@ -213,13 +230,18 @@ if($total_categories = $db->sql_numrows($q_categories)) $gen_cat[$cat_id] = 1; } - if($userdata['session_start'] >= $userdata['session_time'] - 300) + if($forum_rows[$j]['forum_status'] == FORUM_LOCKED) { - $folder_image = ($forum_rows[$j]['post_time'] > $userdata['session_last_visit']) ? "" : ""; + $folder_image = ""; + + } + else if($userdata['session_start'] == $userdata['session_time']) + { + $folder_image = ($forum_rows[$i]['post_time'] > $userdata['session_last_visit']) ? "" : ""; } else { - $folder_image = ($forum_rows[$j]['post_time'] >= $userdata['session_time'] - 300) ? "" : ""; + $folder_image = ($forum_rows[$i]['post_time'] > $userdata['session_time'] - 300) ? "" : ""; } $posts = $forum_rows[$j]['forum_posts']; @@ -249,12 +271,12 @@ if($total_categories = $db->sql_numrows($q_categories)) } $mod_count = 0; - unset($moderators_links); + $moderators_links = ""; for($mods = 0; $mods < count($forum_mods_name[$forum_id]); $mods++) { if( !strstr($moderators_links, $forum_mods_name[$forum_id][$mods]) ) { - if(isset($moderators_links)) + if($mods > 0) { $moderators_links .= ", "; } @@ -276,6 +298,10 @@ if($total_categories = $db->sql_numrows($q_categories)) $mod_count++; } } + if($moderators_links == "") + { + $moderators_links = " "; + } // // This should end up in the template using IF...ELSE...ENDIF @@ -320,7 +346,7 @@ if($total_categories = $db->sql_numrows($q_categories)) }// if ... total_categories else { - message_die(GENERAL_MESSAGE, "There are no Categories or Forums on this board", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_MESSAGE, $lang['No_forums']); } // diff --git a/phpBB/templates/PSO/images/post-locked.gif b/phpBB/templates/PSO/images/post-locked.gif new file mode 100644 index 0000000000..b25fa215f8 Binary files /dev/null and b/phpBB/templates/PSO/images/post-locked.gif differ diff --git a/phpBB/templates/PSO/images/reply-locked.gif b/phpBB/templates/PSO/images/reply-locked.gif index 90173f19d3..df36f1c20b 100644 Binary files a/phpBB/templates/PSO/images/reply-locked.gif and b/phpBB/templates/PSO/images/reply-locked.gif differ diff --git a/phpBB/templates/PSO/viewforum_body.tpl b/phpBB/templates/PSO/viewforum_body.tpl index 843571b19b..75a4fb1ec6 100644 --- a/phpBB/templates/PSO/viewforum_body.tpl +++ b/phpBB/templates/PSO/viewforum_body.tpl @@ -36,13 +36,13 @@ - {L_NO_TOPICS}{topicrow.REPLIES} + {L_NO_TOPICS} - + diff --git a/phpBB/templates/PSO/viewtopic_body.tpl b/phpBB/templates/PSO/viewtopic_body.tpl index cc5299fa09..8e3e7cd216 100644 --- a/phpBB/templates/PSO/viewtopic_body.tpl +++ b/phpBB/templates/PSO/viewtopic_body.tpl @@ -12,7 +12,7 @@ @@ -62,7 +62,7 @@
   {L_PAGE} {ON_PAGE} {L_OF} {TOTAL_PAGES}  {PAGINATION} 
- +
{TOPIC_TITLE}     
- + diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 510c1eb39a..64e1d6f32f 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -25,9 +25,6 @@ $phpbb_root_path = "./"; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); -$pagetype = "viewforum"; -$page_title = "View Forum - $forum_name"; - // // Start initial var setup // @@ -60,7 +57,7 @@ init_userprefs($userdata); // if(isset($forum_id)) { - $sql = "SELECT forum_name, forum_topics, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_votecreate, auth_vote, prune_enable, prune_next + $sql = "SELECT forum_name, forum_status, forum_topics, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_votecreate, auth_vote, prune_enable, prune_next FROM " . FORUMS_TABLE . " WHERE forum_id = $forum_id"; if(!$result = $db->sql_query($sql)) @@ -269,6 +266,7 @@ if( $is_auth['auth_mod'] ) // // Dump out the page header and load viewforum template // +$page_title = $lang['View_forum'] . " - $forum_name"; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( @@ -288,7 +286,7 @@ $template->assign_vars(array( "FORUM_NAME" => $forum_name, "MODERATORS" => $forum_moderators, - "IMG_POST" => $images['topic_new'], + "IMG_POST" => ($forum_row['forum_status'] == FORUM_LOCKED) ? $images['post_locked'] : $images['post_new'], "S_AUTH_LIST" => $s_auth_can) ); @@ -380,13 +378,20 @@ if($total_topics) $folder_new = $images['folder_new']; } - if($userdata['session_start'] >= $userdata['session_time'] - 300) + if(empty($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) && $topic_rowset[$i]['post_time'] > $userdata['session_last_visit']) { - $folder_image = ($topic_rowset[$i]['post_time'] > $userdata['session_last_visit']) ? "" : ""; + $folder_image = ""; } else { - $folder_image = ($topic_rowset[$i]['post_time'] > $userdata['session_time'] - 300) ? "" : ""; + if( isset($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) ) + { + $folder_image = ($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id] < $topic_rowset[$i]['post_time'] ) ? "" : ""; + } + else + { + $folder_image = ""; + } } } @@ -448,8 +453,9 @@ else // // No topics // + $no_topics_msg = ($forum_row['forum_status'] == FORUM_LOCKED) ? $lang['Forum_locked'] : $lang['No_topics_post_one']; $template->assign_vars(array( - "L_NO_TOPICS" => $lang['No_topics_post_one'], + "L_NO_TOPICS" => $no_topics_msg, "S_NO_TOPICS" => TRUE) ); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b40c8ed55a..7fb63e1f10 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -25,6 +25,37 @@ include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx); + +// +// +// +function smilies_pass($message) +{ + global $db, $smilies_url; + static $smilies; + + if(empty($smilies)) + { + $sql = "SELECT code, smile_url + FROM " . SMILIES_TABLE; + if($result = $db->sql_query($sql)) + { + $smilies = $db->sql_fetchrowset($result); + } + } + + for($i = 0; $i < count($smilies); $i++) + { + $message = preg_replace("'([\n\\ \\.])" . preg_quote($smilies[$i]['code']) . "'s", '\1' . $smilies[$i]['smile_url'] . '', ' ' . $message); + } + return($message); +} +// +// +// + + + // // Start initial var setup // @@ -104,7 +135,7 @@ $count_sql = (!isset($post_id)) ? "" : ", COUNT(p2.post_id) AS prev_posts"; $order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_votecreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC"; -$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_votecreate, f.auth_vote, f.auth_attachments" . $count_sql . " +$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_votecreate, f.auth_vote, f.auth_attachments" . $count_sql . " FROM $join_sql_table " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f WHERE $join_sql AND f.forum_id = t.forum_id @@ -194,11 +225,7 @@ $ranksrow = $db->sql_fetchrowset($ranksresult); // // Dump out the page header and load viewtopic body template // -// This is wrong ... more like index is needed -//if($topic_time > $userdata['session_last_visit']) -//{ -// setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), 0, $cookiepath, $cookiedomain, $cookiesecure); -//} +setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), time()+6000, $cookiepath, $cookiedomain, $cookiesecure); $page_title = $lang['View_topic'] ." - $topic_title"; include($phpbb_root_path . 'includes/page_header.'.$phpEx); @@ -238,6 +265,9 @@ $view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id" $view_prev_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=previous"); $view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=next"); +$reply_img = ($forum_row['forum_status'] == FORUM_LOCKED || $forum_row['topic_status'] == TOPIC_LOCKED) ? $images['reply_locked'] : $images['reply_new']; +$post_img = ($forum_row['forum_status'] == FORUM_LOCKED) ? $images['post_locked'] : $images['post_new']; + $template->assign_vars(array( "FORUM_NAME" => $forum_name, "TOPIC_TITLE" => $topic_title, @@ -247,8 +277,8 @@ $template->assign_vars(array( "L_VIEW_NEXT_TOPIC" => $lang['View_next_topic'], "L_VIEW_PREVIOUS_TOPIC" => $lang['View_previous_topic'], - "IMG_POST" => $images['topic_new'], - "IMG_REPLY" => ( ($forum_row['topic_status'] == TOPIC_LOCKED) ? $images['topic_locked'] : $images['topic_reply'] ), + "IMG_POST" => $post_img, + "IMG_REPLY" => $reply_img, "U_VIEW_FORUM" => $view_forum_url, "U_VIEW_OLDER_TOPIC" => $view_prev_topic_url, @@ -425,6 +455,11 @@ for($i = 0; $i < $total_posts; $i++) $message = eregi_replace("\[addsig]$", "

_________________
" . nl2br($user_sig), $message); } + if($board_config['allow_smilies']) + { +// $message = smilies_pass($message); + } + // // Editing information // -- cgit v1.2.1
      {L_PAGE} {ON_PAGE} {L_OF} {TOTAL_PAGES}  {PAGINATION}