function bugList($count, $resource) { $ret = ""; $ret .= "\n<table class = 'sortable' >\n\t<tr class = 'nobg' >\n\t\t<th>ID</th> <th> Status </th> <th> Severity </th> <th>Owner</th> <th>Project</th> <th>Private</th> <th>Title</th>\n\t</tr>\n"; global $PROJECT_OBJECT; global $USER_OBJECT; global $BUG_OBJECT; global $SITE_PREFIX; $p = $PROJECT_OBJECT; $u = $USER_OBJECT; $b = $BUG_OBJECT; $p->getAll(); $u->getAll(); $b->getAll(); $s = 0; $bugs = $resource; $bCount = count($bugs); while ($s < $bCount) { $row = $bugs[$s]; $b->getAllByPK($row['bID']); $u->getAllByPK($row['owner']); $u->getByCol('uID', $row['owner']); $user = $u->getNext(); $p->getByCol('pID', $row['package']); $project = $p->getNext(); if ($row['bug_status'] == 8) { $ret .= ""; $s++; } else { if ($user == '') { $user = '******'; } if ($row['private'] == 1) { $private = "Yep"; } else { $private = "No"; } $status = getStatus($row['bug_status']); $severity = getSeverity($row['bug_severity']); $statusClass = "goodthings"; $severityClass = "goodthings"; $overrideOne = False; $overrideTwo = False; if ($status['critical']) { $statusClass = "badthings"; } if ($severity['critical']) { $severityClass = "badthings"; } if (strpos($row['title'], ' ')) { $bugLink = str_replace(' ', '-', $row['title']); } else { $bugLink = clean($row['title']); } $ret .= "\t<tr style=\"cursor:pointer\" onclick=\"document.location.href = '" . $SITE_PREFIX . "t/bug/" . $row['bID'] . "'\" >\n<td>" . $row['bID'] . "</td><td class = '" . $statusClass . "' >" . $status['status_name'] . "</td><td class = '" . $severityClass . "'>" . $severity['severity_name'] . "</td><td>" . $user['real_name'] . "</td>\n\t\t\t<td>" . $project['project_name'] . "</td>\n\t\t\t<td>" . $private . "</td>\n\t\t\t<td><a href='" . $SITE_PREFIX . "t/bug/" . $row['bID'] . "/" . $bugLink . "'>" . $row['title'] . "</a></td>\n\t</tr>\n"; $s++; } } $ret .= "\n</table><br /><br />\n"; return $ret; }
$privacy = checkBugViewAuth($row['bID'], $id); if ($privacy[1]) { $picon = "<img src = '" . $SITE_PREFIX . "imgs/locked.png' alt = 'Private' />"; } else { $picon = "<img src = '" . $SITE_PREFIX . "imgs/unlocked.png' alt = 'Public' />"; } if (!$privacy[0]) { if ($i < $Count) { $CONTENT .= "\t<tr>\n<td>" . $row['bID'] . "<td>Unknown</td><td>Unknown</td></td><td>Unknown</td><td>Private</td><td>" . $picon . "</td><td>Private</td>\n\t</tr>\n"; } else { break; } } else { if ($i < $Count) { $status = getStatus($row['bug_status']); $severity = getSeverity($row['bug_severity']); $statusClass = "goodthings"; $severityClass = "goodthings"; $overrideOne = False; $overrideTwo = False; if ($status['critical']) { $statusClass = "badthings"; } if ($severity['critical']) { $severityClass = "badthings"; } if ($status['critical']) { $CONTENT .= "\t<tr onclick=\"document.location.href = '" . $SITE_PREFIX . "t/bug/" . $row['bID'] . "'\" >\n<td>" . $row['bID'] . "</td><td class = '" . $statusClass . "' >" . $status['status_name'] . "</td><td class = '" . $severityClass . "'>" . $severity['severity_name'] . "</td><td>" . $owner['real_name'] . "</td><td>" . $package['project_name'] . "</td><td>" . $picon . "</td><td><a href = '" . $SITE_PREFIX . "t/bug/" . $row['bID'] . "' >" . $row['title'] . "</a></td>\n\t</tr>\n"; } $i++; } else {
function handleBugRequest($argv) { global $BUG_OBJECT; global $USER_OBJECT; global $PROJECT_OBJECT; $ret = array(); $f = array(); $frobber = array(); $ret['message'] = ""; $ret['errors'] = true; $ret['success'] = false; $b = $BUG_OBJECT; $bID = $argv[1]; if (isset($argv[1])) { $b->getAllByPK($argv[1]); $row = $b->getNext(); // owner // reporter // project $metadata = array(); if (isset($row['owner'])) { $USER_OBJECT->getAllByPK($row['owner']); $owner = $USER_OBJECT->getNext(); $metadata['owner'] = $owner['username']; } else { $metadata['owner'] = NULL; } if (isset($row['reporter'])) { $USER_OBJECT->getAllByPK($row['reporter']); $reporter = $USER_OBJECT->getNext(); $metadata['reporter'] = $reporter['username']; } else { $metadata['reporter'] = NULL; } if (isset($row['package'])) { $PROJECT_OBJECT->getAllByPK($row['package']); $package = $PROJECT_OBJECT->getNext(); $metadata['package'] = $package['project_name']; } else { $metadata['package'] = NULL; } if (isset($row['bID']) && !$row['private']) { $frobber['bug_identifier'] = $row['bID']; $frobber['bug_descr'] = $row['descr']; $frobber['bug_title'] = $row['title']; $frobber['bug_filed'] = $row['startstamp']; $frobber['bug_last_touch'] = $row['trampstamp']; $status = getStatus($row['bug_status']); $severity = getSeverity($row['bug_severity']); $frobber['bug_status'] = $status; $frobber['bug_severity'] = $severity; $frobber['bug_meta'] = $metadata; $ret['message'] = $frobber; $ret['errors'] = false; $ret['success'] = true; } else { $ret['message'] = "This bug does not exist, or it's private!"; $ret['errors'] = true; $ret['success'] = false; } } return $ret; }