From bdc15cd0240e6fae809da0dbf45f5966ef83c5df Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 20 Aug 2006 05:22:19 +0000 Subject: [PATCH] r1091: - Implementing canviewownhidden - Fixing a bug where I don't think the correct lastposttime would be set in search.php because of a missing array key --- includes/class_sort.php | 5 +++-- index.php | 4 ++-- search.php | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/class_sort.php b/includes/class_sort.php index 67add11..7af123a 100644 --- a/includes/class_sort.php +++ b/includes/class_sort.php @@ -113,8 +113,9 @@ class ListSorter { // this WHERE clause is used for all the queries $basewhere = "bug.product IN (" . fetch_on_bits('canviewbugs') . ") - AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . ")))" . (($this->registry->options['hidestatuses'] OR isset($this->registry->userinfo['hidestatuses'])) ? " - AND bug.status NOT IN (" . ($this->registry->userinfo['hidestatuses'] != '' ? $this->registry->userinfo['hidestatuses'] : $this->registry->options['hidestatuses']) . ")" : ""); + AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $this->registry->userinfo['userid'] . ")" : "") . ")" . + (($this->registry->options['hidestatuses'] OR isset($this->registry->userinfo['hidestatuses'])) ? " + AND bug.status NOT IN (" . ($this->registry->userinfo['hidestatuses'] != '' ? $this->registry->userinfo['hidestatuses'] : $this->registry->options['hidestatuses']) . ")" : ""); // remap the sort keys to be actual SQL fields $querykeys = array( diff --git a/index.php b/index.php index 7c7efa6..59d38bc 100644 --- a/index.php +++ b/index.php @@ -47,7 +47,7 @@ $pagination = new Pagination('p', 'pp'); $count = $db->query_first(" SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "bug - WHERE (!hidden OR (hidden AND product IN (" . fetch_on_bits('canviewhidden') . "))) + WHERE (!hidden OR (hidden AND product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $bugsys->userinfo['userid'] . ")" : "") . ") AND product IN (" . fetch_on_bits('canviewbugs') . ")" . (($bugsys->options['hidestatuses'] OR isset($bugsys->userinfo['hidestatuses'])) ? " AND status NOT IN (" . ($bugsys->userinfo['hidestatuses'] != '' ? $bugsys->userinfo['hidestatuses'] : $bugsys->options['hidestatuses']) . ")" : "") ); @@ -68,7 +68,7 @@ while ($bug = $db->fetch_array($bugs_fetch)) $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; - $bug['hiddendisplay'] = ((!can_perform('canviewhidden', $bug['productid']) AND $bug['hiddenlastposttime']) ? true : false); + $bug['hiddendisplay'] = ((can_perform('canviewhidden', $bug['productid']) OR (can_perform('canviewownhidden') AND $bug['userid'] == $bugsys->userinfo['userid'])) ? false : true); $bug['lastposttime'] = ($bug['hiddendisplay'] ? $bug['hiddenlastposttime'] : $bug['lastposttime']); $bug['lastpost'] = ($bug['hiddendisplay'] ? $bug['hiddenlastpostbyname'] : $bug['lastpostbyname']); diff --git a/search.php b/search.php index 0cff883..65b703e 100644 --- a/search.php +++ b/search.php @@ -257,7 +257,7 @@ if ($_REQUEST['do'] == 'process') ON (bug.bugid = bugfieldvalue.bugid) WHERE bug.bugid <> 0 AND bug.product IN (#<'ONBITS:VIEW'>#) - AND (!bug.hidden OR (bug.hidden AND bug.product IN (#<'ONBITS:HIDDEN'>#))) + AND (!bug.hidden OR (bug.hidden AND bug.product IN (#<'ONBITS:HIDDEN'>#))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $bugsys->userinfo['userid'] . ")" : "") . ") " . implode("\n\t\t", $querybuild) . " GROUP BY bug.bugid $sortclause"; @@ -397,6 +397,7 @@ if ($_REQUEST['do'] == 'results') $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution']; $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; + $bug['hiddendisplay'] = ((can_perform('canviewhidden', $bug['productid']) OR (can_perform('canviewownhidden') AND $bug['userid'] == $bugsys->userinfo['userid'])) ? false : true); $bug['lastposttime'] = ($bug['hiddendisplay'] ? $bug['hiddenlastposttime'] : $bug['lastposttime']); $bug['lastpost'] = ($bug['hiddendisplay'] ? $bug['hiddenlastpostbyname'] : $bug['lastpostbyname']); $bug['lastposttime'] = $datef->format($bugsys->options['dateformat'], $bug['lastposttime']); -- 2.43.5