Tada permissions

This commit is contained in:
Ice
2008-04-15 21:29:55 +00:00
parent 9139822134
commit fc0523da4e

View File

@@ -109,7 +109,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
{ {
foreach( $disallow_access as $acc_id ) foreach( $disallow_access as $acc_id )
{ {
$str_where .= "t.forum_id <> $acc_id OR "; $str_where .= "t.forum_id <> $acc_id AND ";
} }
} }
@@ -118,7 +118,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
case "announcements": case "announcements":
$topic_type = '(( t.topic_type = ' . POST_ANNOUNCE . ') OR ( t.topic_type = ' . POST_GLOBAL . '))'; $topic_type = '(( t.topic_type = ' . POST_ANNOUNCE . ') OR ( t.topic_type = ' . POST_GLOBAL . '))';
$str_where = ( strlen($str_where) > 0 ) ? 'AND (t.forum_id = 0 OR ' . substr($str_where, 0, -4) . ')' : ''; $str_where = ( strlen($str_where) > 0 ) ? 'AND (t.forum_id = 0 OR (' . trim(substr($str_where, 0, -4)) . '))' : '';
$user_link = 't.topic_poster = u.user_id'; $user_link = 't.topic_poster = u.user_id';
$post_link = 't.topic_first_post_id = p.post_id'; $post_link = 't.topic_first_post_id = p.post_id';
$topic_order = 't.topic_time DESC'; $topic_order = 't.topic_time DESC';
@@ -127,7 +127,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
case "news": case "news":
$topic_type = 't.topic_type = ' . POST_NORMAL; $topic_type = 't.topic_type = ' . POST_NORMAL;
$str_where = ( strlen($str_where) > 0 ) ? 'AND (' . substr($str_where, 0, -4) . ')' : ''; $str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
$user_link = 't.topic_last_poster_id = u.user_id'; $user_link = 't.topic_last_poster_id = u.user_id';
$post_link = 't.topic_last_post_id = p.post_id'; $post_link = 't.topic_last_post_id = p.post_id';
$topic_order = 't.topic_last_post_time DESC'; $topic_order = 't.topic_last_post_time DESC';
@@ -135,8 +135,8 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
break; break;
case "news_all": case "news_all":
$topic_type = '( t.topic_type != ' . POST_ANNOUNCE . ' ) AND ( t.topic_type != ' . POST_GLOBAL . ')'; $topic_type = '( t.topic_type <> ' . POST_ANNOUNCE . ' ) AND ( t.topic_type <> ' . POST_GLOBAL . ')';
$str_where = ( strlen($str_where) > 0 ) ? 'AND (' . substr($str_where, 0, -4) . ')' : ''; $str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
$user_link = 't.topic_last_poster_id = u.user_id'; $user_link = 't.topic_last_poster_id = u.user_id';
$post_link = 't.topic_last_post_id = p.post_id'; $post_link = 't.topic_last_post_id = p.post_id';
$topic_order = 't.topic_last_post_time DESC'; $topic_order = 't.topic_last_post_time DESC';
@@ -251,27 +251,35 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
$global_f = $row['forum_id']; $global_f = $row['forum_id'];
} }
$posts[$i]['post_text'] = ap_validate($message); $posts[$i] = array(
$posts[$i]['topic_id'] = $row['topic_id']; 'post_text' => ap_validate($message),
$posts[$i]['topic_last_post_id'] = $row['topic_last_post_id']; 'topic_id' => $row['topic_id'],
$posts[$i]['forum_id'] = $row['forum_id']; 'topic_last_post_id' => $row['topic_last_post_id'],
$posts[$i]['topic_replies'] = $row['topic_replies']; 'forum_id' => $row['forum_id'],
$posts[$i]['topic_time'] = $user->format_date($row['post_time']); 'topic_replies' => $row['topic_replies'],
$posts[$i]['topic_last_post_time'] = $row['topic_last_post_time']; 'topic_time' => $user->format_date($row['post_time']),
$posts[$i]['topic_title'] = $row['topic_title']; 'topic_last_post_time' => $row['topic_last_post_time'],
$posts[$i]['username'] = $row['username']; 'topic_title' => $row['topic_title'],
$posts[$i]['user_id'] = $row['user_id']; 'username' => $row['username'],
$posts[$i]['user_type'] = $row['user_type']; 'user_id' => $row['user_id'],
$posts[$i]['user_user_colour'] = $row['user_colour']; 'user_type' => $row['user_type'],
$posts[$i]['poll'] = ($row['poll_title']) ? true : false; 'user_user_colour' => $row['user_colour'],
$posts[$i]['attachment'] = ($row['topic_attachment']) ? true : false; 'poll' => ($row['poll_title']) ? true : false,
$posts[$i]['topic_views'] = $row['topic_views']; 'attachment' => ($row['topic_attachment']) ? true : false,
$posts[$i]['forum_name'] = $row['forum_name']; 'topic_views' => $row['topic_views'],
$posts['global_id'] = $global_f; 'forum_name' => $row['forum_name']
);
$posts['global_id'] = $global_f;
$i++; $i++;
} }
return $posts;
if( $global_f < 1 )
{
return array();
} else {
return $posts;
}
} }
/** /**