Skip to content

Commit

Permalink
merged fix for a bug where user can view site blogs when not logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Jul 18, 2006
1 parent 3279a35 commit 626fddc
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions blog/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ function fetch_entries($userid, $postid='', $fetchlimit=10, $fetchstart='', $fil

case 'site':

if (!isguest() && isloggedin()) {

if (isloggedin()) {
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
.$CFG->prefix.'user u
WHERE p.userid = u.id '.$tagquerysql.'
Expand Down Expand Up @@ -469,22 +469,33 @@ function fetch_entries($userid, $postid='', $fetchlimit=10, $fetchstart='', $fil

case 'group':

$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
.$CFG->prefix.'groups_members m, '.$CFG->prefix.'user u
WHERE p.userid = m.userid '.$tagquerysql.'
AND u.id = p.userid
AND m.groupid = '.$filterselect.'
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
.$CFG->prefix.'groups_members m, '.$CFG->prefix.'user u
WHERE p.userid = m.userid '.$tagquerysql.'
AND u.id = p.userid
AND m.groupid = '.$filterselect.'
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';

break;

case 'user':

$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
.$CFG->prefix.'user u
WHERE p.userid = u.id '.$tagquerysql.'
AND u.id = '.$filterselect.'
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';

if (isloggedin()) {

$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
.$CFG->prefix.'user u
WHERE p.userid = u.id '.$tagquerysql.'
AND u.id = '.$filterselect.'
AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
} else {

$SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
.$CFG->prefix.'user u
WHERE p.userid = u.id '.$tagquerysql.'
AND u.id = '.$filterselect.'
AND p.publishstate = \'public\'';

}

break;

Expand Down

0 comments on commit 626fddc

Please sign in to comment.