Skip to content

Commit

Permalink
Fix bug that causes no content to appera to guests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick committed Feb 19, 2015
1 parent f406a88 commit d46ff2b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion backstage/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,17 @@
<span class="label label-primary">38xx</span> Managing notifications is now possible again<br />
<span class="label label-primary">38xx</span> Maintenance and Prune are split from each other<br />
<span class="label label-primary">38xx</span> The notifications page has been improved<br />
<span class="label label-primary">38xx</span> Split logic from markup for help and Inbox
<span class="label label-primary">38xx</span> Split logic from markup for help and Inbox<br />
<span class="label label-primary">38xx</span> Revamped conversation managment in Inbox
</p>
</div>
<div class="col-sm-6">
<p>
<span class="label label-primary">38xx</span> Maintenance is a new category in the Backstage<br />
<span class="label label-primary">38xx</span> Database has been added under "Maintenance"<br />
<span class="label label-primary">38xx</span> Further usability improvements to Inbox<br />
<span class="label label-primary">38xx</span> More parts of Inbox are now part of the Theme Engine<br />
<span class="label label-primary">38xx</span> Design improvements to Sunrise and Sunset<br />
<span class="label label-primary">38xx</span> Multiple bugfixes
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion include/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Version {
const FORUM_VERSION = '0.3.1-dev';

// The Luna Core version
const FORUM_CORE_VERSION = '0.3.3792';
const FORUM_CORE_VERSION = '0.3.3796';

// The database version number, every change in the database requires this number to go one up
const FORUM_DB_VERSION = '87.50';
Expand Down
8 changes: 4 additions & 4 deletions viewtopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@


// Fetch some info about the topic
if (!$luna_user['is_guest'])
if ($luna_user['is_guest'])
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$luna_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
elseif ($luna_user['is_admmod'])
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'topic_subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$luna_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$luna_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
elseif (!$luna_user['is_admmod'])
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics WHERE soft = 0 INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$luna_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$luna_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
$result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics WHERE soft = 0 INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$luna_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

if (!$db->num_rows($result))
message($lang['Bad request'], false, '404 Not Found');
Expand Down

0 comments on commit d46ff2b

Please sign in to comment.