Forum locking now implemented + some updates for future functionality

git-svn-id: file:///svn/phpbb/trunk@744 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-07-24 17:34:40 +00:00
parent 70b74fc706
commit 44990dd2b7
7 changed files with 106 additions and 39 deletions

View file

@ -25,9 +25,6 @@ $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
$pagetype = "index";
$page_title = "Forum Index";
// //
// Start session management // Start session management
// //
@ -135,13 +132,29 @@ if($total_categories = $db->sql_numrows($q_categories))
// //
// Obtain list of moderators of each forum // 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 $sql = "SELECT aa.forum_id, g.group_name, g.group_id, g.group_single_user, u.user_id, u.username
FROM " . FORUMS_TABLE . " f, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa 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 WHERE aa.forum_id = f.forum_id
AND aa.auth_mod = " . TRUE . " AND aa.auth_mod = " . TRUE . "
AND g.group_id = aa.group_id AND (
AND ug.group_id = g.group_id ( ug.user_id = aa.user_id
ORDER BY f.forum_id, g.group_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)) if(!$q_forum_mods = $db->sql_query($sql))
{ {
message_die(GENERAL_ERROR, "Could not query forum moderator information", "", __LINE__, __FILE__, $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++) for($i = 0; $i < count($forum_mods_list); $i++)
{ {
$forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_name']; if($forum_mods_list[$i]['group_single_user'] || !$forum_mods_list[$i]['group_id'])
$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'])
{ {
$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']; $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id'];
} }
else 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']; $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 // Output page header and open the index body template
// //
$page_title = "Forum Index";
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
@ -213,13 +230,18 @@ if($total_categories = $db->sql_numrows($q_categories))
$gen_cat[$cat_id] = 1; $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']) ? "<img src=\"" . $images['folder_new'] . "\">" : "<img src=\"" . $images['folder'] . "\">"; $folder_image = "<img src=\"" . $images['folder_locked'] . "\">";
}
else if($userdata['session_start'] == $userdata['session_time'])
{
$folder_image = ($forum_rows[$i]['post_time'] > $userdata['session_last_visit']) ? "<img src=\"" . $images['folder_new'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
} }
else else
{ {
$folder_image = ($forum_rows[$j]['post_time'] >= $userdata['session_time'] - 300) ? "<img src=\"" . $images['folder_new'] . "\">" : "<img src=\"" . $images['folder'] . "\">"; $folder_image = ($forum_rows[$i]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"" . $images['folder_new'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
} }
$posts = $forum_rows[$j]['forum_posts']; $posts = $forum_rows[$j]['forum_posts'];
@ -249,12 +271,12 @@ if($total_categories = $db->sql_numrows($q_categories))
} }
$mod_count = 0; $mod_count = 0;
unset($moderators_links); $moderators_links = "";
for($mods = 0; $mods < count($forum_mods_name[$forum_id]); $mods++) for($mods = 0; $mods < count($forum_mods_name[$forum_id]); $mods++)
{ {
if( !strstr($moderators_links, $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 .= ", "; $moderators_links .= ", ";
} }
@ -276,6 +298,10 @@ if($total_categories = $db->sql_numrows($q_categories))
$mod_count++; $mod_count++;
} }
} }
if($moderators_links == "")
{
$moderators_links = "&nbsp;";
}
// //
// This should end up in the template using IF...ELSE...ENDIF // 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 }// if ... total_categories
else else
{ {
message_die(GENERAL_MESSAGE, "There are no Categories or Forums on this board", "", __LINE__, __FILE__, $sql); message_die(GENERAL_MESSAGE, $lang['No_forums']);
} }
// //

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -36,13 +36,13 @@
<!-- END topicrow --> <!-- END topicrow -->
<!-- BEGIN notopicsrow --> <!-- BEGIN notopicsrow -->
<tr> <tr>
<td class="row1" colspan="6" align="center" valign="middle"><span class="gen">{L_NO_TOPICS}{topicrow.REPLIES}</span></td> <td class="row1" colspan="6" height="30" align="center" valign="middle"><span class="gen">{L_NO_TOPICS}</span></td>
</tr> </tr>
<!-- END notopicsrow --> <!-- END notopicsrow -->
<tr> <tr>
<td class="cat" colspan="6"><table width="100%" cellspacing="0" cellpadding="0" border="0"> <td class="cat" colspan="6"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td width="5" align="left" valign="middle"><a href="{U_POST_NEW_TOPIC}"><img src="templates/PSO/images/post.gif" border="1"></a></td> <td width="5" align="left" valign="middle"><a href="{U_POST_NEW_TOPIC}"><img src="{IMG_POST}" border="1"></a></td>
<td align="left" valign="middle">&nbsp;&nbsp;&nbsp;<span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span>&nbsp;</td> <td align="left" valign="middle">&nbsp;&nbsp;&nbsp;<span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span>&nbsp;</td>
<td align="right" valign="middle"><span class="gen">{PAGINATION}&nbsp;</span></td> <td align="right" valign="middle"><span class="gen">{PAGINATION}&nbsp;</span></td>
</tr> </tr>

View file

@ -12,7 +12,7 @@
<td class="cat" colspan="2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> <td class="cat" colspan="2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td><span class="cattitle"><b>{TOPIC_TITLE}</b></span></td> <td><span class="cattitle"><b>{TOPIC_TITLE}</b></span></td>
<td align="right" valign="middle"><a href="{U_POST_REPLY_TOPIC}"><img src="{IMG_REPLY}" border="1"></a>&nbsp;&nbsp;<a href="{U_POST_NEW_TOPIC}"><img src="{IMG_POST}" border="1"></a>&nbsp;</td> <td align="right" valign="middle"><a href="{U_POST_NEW_TOPIC}"><img src="{IMG_POST}" border="1"></a>&nbsp;&nbsp;<a href="{U_POST_REPLY_TOPIC}"><img src="{IMG_REPLY}" border="1"></a></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
@ -62,7 +62,7 @@
<tr> <tr>
<td class="cat" colspan="2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> <td class="cat" colspan="2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td width="140" align="left" valign="middle" nowrap><a href="{U_POST_REPLY_TOPIC}"><img src="templates/PSO/images/reply.gif" border="1"></a>&nbsp;&nbsp;<a href="{U_POST_NEW_TOPIC}"><img src="templates/PSO/images/post.gif" border="1"></a></td> <td width="140" align="left" valign="middle" nowrap><a href="{U_POST_REPLY_TOPIC}"><img src="{IMG_REPLY}" border="1"></a>&nbsp;&nbsp;<a href="{U_POST_NEW_TOPIC}"><img src="{IMG_POST}" border="1"></a></td>
<td align="left" valign="middle">&nbsp;<span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span>&nbsp;</td> <td align="left" valign="middle">&nbsp;<span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span>&nbsp;</td>
<td align="right" valign="middle"><span class="gen">{PAGINATION}</span></td> <td align="right" valign="middle"><span class="gen">{PAGINATION}</span></td>
</tr> </tr>

View file

@ -25,9 +25,6 @@ $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
$pagetype = "viewforum";
$page_title = "View Forum - $forum_name";
// //
// Start initial var setup // Start initial var setup
// //
@ -60,7 +57,7 @@ init_userprefs($userdata);
// //
if(isset($forum_id)) 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 . " FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if(!$result = $db->sql_query($sql)) if(!$result = $db->sql_query($sql))
@ -269,6 +266,7 @@ if( $is_auth['auth_mod'] )
// //
// Dump out the page header and load viewforum template // Dump out the page header and load viewforum template
// //
$page_title = $lang['View_forum'] . " - $forum_name";
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
@ -288,7 +286,7 @@ $template->assign_vars(array(
"FORUM_NAME" => $forum_name, "FORUM_NAME" => $forum_name,
"MODERATORS" => $forum_moderators, "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) "S_AUTH_LIST" => $s_auth_can)
); );
@ -380,13 +378,20 @@ if($total_topics)
$folder_new = $images['folder_new']; $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']) ? "<img src=\"$folder_new\">" : "<img src=\"$folder\">"; $folder_image = "<img src=\"$folder_new\">";
} }
else else
{ {
$folder_image = ($topic_rowset[$i]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"$folder_new\">" : "<img src=\"$folder\">"; 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'] ) ? "<img src=\"$folder_new\">" : "<img src=\"$folder\">";
}
else
{
$folder_image = "<img src=\"$folder\">";
}
} }
} }
@ -448,8 +453,9 @@ else
// //
// No topics // No topics
// //
$no_topics_msg = ($forum_row['forum_status'] == FORUM_LOCKED) ? $lang['Forum_locked'] : $lang['No_topics_post_one'];
$template->assign_vars(array( $template->assign_vars(array(
"L_NO_TOPICS" => $lang['No_topics_post_one'], "L_NO_TOPICS" => $no_topics_msg,
"S_NO_TOPICS" => TRUE) "S_NO_TOPICS" => TRUE)
); );

View file

@ -25,6 +25,37 @@ include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$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<img src="' . $smilies_url . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['smile_url'] . '">', ' ' . $message);
}
return($message);
}
//
//
//
// //
// Start initial var setup // 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"; $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 FROM $join_sql_table " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE $join_sql WHERE $join_sql
AND f.forum_id = t.forum_id 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 // Dump out the page header and load viewtopic body template
// //
// This is wrong ... more like index is needed setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), time()+6000, $cookiepath, $cookiedomain, $cookiesecure);
//if($topic_time > $userdata['session_last_visit'])
//{
// setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), 0, $cookiepath, $cookiedomain, $cookiesecure);
//}
$page_title = $lang['View_topic'] ." - $topic_title"; $page_title = $lang['View_topic'] ." - $topic_title";
include($phpbb_root_path . 'includes/page_header.'.$phpEx); 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_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"); $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( $template->assign_vars(array(
"FORUM_NAME" => $forum_name, "FORUM_NAME" => $forum_name,
"TOPIC_TITLE" => $topic_title, "TOPIC_TITLE" => $topic_title,
@ -247,8 +277,8 @@ $template->assign_vars(array(
"L_VIEW_NEXT_TOPIC" => $lang['View_next_topic'], "L_VIEW_NEXT_TOPIC" => $lang['View_next_topic'],
"L_VIEW_PREVIOUS_TOPIC" => $lang['View_previous_topic'], "L_VIEW_PREVIOUS_TOPIC" => $lang['View_previous_topic'],
"IMG_POST" => $images['topic_new'], "IMG_POST" => $post_img,
"IMG_REPLY" => ( ($forum_row['topic_status'] == TOPIC_LOCKED) ? $images['topic_locked'] : $images['topic_reply'] ), "IMG_REPLY" => $reply_img,
"U_VIEW_FORUM" => $view_forum_url, "U_VIEW_FORUM" => $view_forum_url,
"U_VIEW_OLDER_TOPIC" => $view_prev_topic_url, "U_VIEW_OLDER_TOPIC" => $view_prev_topic_url,
@ -425,6 +455,11 @@ for($i = 0; $i < $total_posts; $i++)
$message = eregi_replace("\[addsig]$", "<br /><br />_________________<br />" . nl2br($user_sig), $message); $message = eregi_replace("\[addsig]$", "<br /><br />_________________<br />" . nl2br($user_sig), $message);
} }
if($board_config['allow_smilies'])
{
// $message = smilies_pass($message);
}
// //
// Editing information // Editing information
// //