mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
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:
parent
70b74fc706
commit
44990dd2b7
7 changed files with 106 additions and 39 deletions
|
@ -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']) ? "<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
|
||||
{
|
||||
$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'];
|
||||
|
@ -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']);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
BIN
phpBB/templates/PSO/images/post-locked.gif
Normal file
BIN
phpBB/templates/PSO/images/post-locked.gif
Normal file
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 |
|
@ -36,13 +36,13 @@
|
|||
<!-- END topicrow -->
|
||||
<!-- BEGIN notopicsrow -->
|
||||
<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>
|
||||
<!-- END notopicsrow -->
|
||||
<tr>
|
||||
<td class="cat" colspan="6"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<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"> <span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span> </td>
|
||||
<td align="right" valign="middle"><span class="gen">{PAGINATION} </span></td>
|
||||
</tr>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<td class="cat" colspan="2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<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> <a href="{U_POST_NEW_TOPIC}"><img src="{IMG_POST}" border="1"></a> </td>
|
||||
<td align="right" valign="middle"><a href="{U_POST_NEW_TOPIC}"><img src="{IMG_POST}" border="1"></a> <a href="{U_POST_REPLY_TOPIC}"><img src="{IMG_REPLY}" border="1"></a></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
|
@ -62,7 +62,7 @@
|
|||
<tr>
|
||||
<td class="cat" colspan="2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<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> <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> <a href="{U_POST_NEW_TOPIC}"><img src="{IMG_POST}" border="1"></a></td>
|
||||
<td align="left" valign="middle"> <span class="gen">{L_PAGE} <b>{ON_PAGE}</b> {L_OF} <b>{TOTAL_PAGES}</b></span> </td>
|
||||
<td align="right" valign="middle"><span class="gen">{PAGINATION}</span></td>
|
||||
</tr>
|
||||
|
|
|
@ -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']) ? "<img src=\"$folder_new\">" : "<img src=\"$folder\">";
|
||||
$folder_image = "<img src=\"$folder_new\">";
|
||||
}
|
||||
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_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)
|
||||
);
|
||||
|
|
|
@ -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<img src="' . $smilies_url . '/' . $smilies[$i]['smile_url'] . '" alt="' . $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]$", "<br /><br />_________________<br />" . nl2br($user_sig), $message);
|
||||
}
|
||||
|
||||
if($board_config['allow_smilies'])
|
||||
{
|
||||
// $message = smilies_pass($message);
|
||||
}
|
||||
|
||||
//
|
||||
// Editing information
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue