From f15bb89cee5f02058f1bad529aa0427f5f3e0e6e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 25 Jun 2008 11:38:59 -0400 Subject: [PATCH] Change the $this->registry big three arrays to also use bugdar --- includes/api_bug.php | 30 +++++++++---------- includes/api_comment.php | 2 +- includes/api_language.php | 2 +- includes/api_priority.php | 2 +- includes/api_resolution.php | 2 +- includes/api_severity.php | 2 +- includes/api_status.php | 2 +- includes/api_user.php | 6 ++-- includes/class_notification.php | 24 +++++++-------- includes/class_sort.php | 12 ++++---- locale/en_US/emails/bugnotification.xml.tpl | 8 ++--- .../en_US/emails/notice_attachment.part.tpl | 2 +- locale/en_US/emails/notice_priority.part.tpl | 2 +- .../en_US/emails/notice_resolution.part.tpl | 2 +- locale/en_US/emails/notice_severity.part.tpl | 2 +- locale/en_US/emails/notice_status.part.tpl | 2 +- 16 files changed, 51 insertions(+), 51 deletions(-) diff --git a/includes/api_bug.php b/includes/api_bug.php index bf4d8d1..213d1c1 100644 --- a/includes/api_bug.php +++ b/includes/api_bug.php @@ -146,7 +146,7 @@ class BugAPI extends API return $nozero; } - if (!$this->registry->datastore['product'][ $this->values['product'] ]) + if (!bugdar::$datastore['product'][ $this->values['product'] ]) { return false; } @@ -163,9 +163,9 @@ class BugAPI extends API { if ($this->values['component'] != 0) { - $component = $this->registry->datastore['component'][ $this->values['component'] ]; - $product = $this->registry->datastore['product'][ $this->values['product'] ]; - $version = $this->registry->datastore['version'][ $this->values['version'] ]; + $component = bugdar::$datastore['component'][ $this->values['component'] ]; + $product = bugdar::$datastore['product'][ $this->values['product'] ]; + $version = bugdar::$datastore['version'][ $this->values['version'] ]; if ($component['parentid'] != $product['productid']) { return false; @@ -191,7 +191,7 @@ class BugAPI extends API return $nozero; } - if (!$this->registry->datastore['version'][ $this->values['version'] ]) + if (!bugdar::$datastore['version'][ $this->values['version'] ]) { return false; } @@ -206,9 +206,9 @@ class BugAPI extends API */ function verify_priority() { - if (!$this->registry->datastore['priority'][ $this->values['priority'] ]) + if (!bugdar::$datastore['priority'][ $this->values['priority'] ]) { - $this->set('priority', $this->registry->options['defaultpriority']); + $this->set('priority', bugdar::$options['defaultpriority']); } return true; } @@ -221,9 +221,9 @@ class BugAPI extends API */ function verify_severity() { - if (!$this->registry->datastore['severity'][ $this->values['severity'] ]) + if (!bugdar::$datastore['severity'][ $this->values['severity'] ]) { - $this->set('severity', $this->registry->options['defaultseverity']); + $this->set('severity', bugdar::$options['defaultseverity']); } return true; } @@ -236,9 +236,9 @@ class BugAPI extends API */ function verify_status() { - if (!$this->registry->datastore['status'][ $this->values['status'] ]) + if (!bugdar::$datastore['status'][ $this->values['status'] ]) { - $this->set('status', $this->registry->options['defaultstatus']); + $this->set('status', bugdar::$options['defaultstatus']); } return true; } @@ -251,9 +251,9 @@ class BugAPI extends API */ function verify_resolution() { - if (!$this->registry->datastore['resolution'][ $this->values['resolution'] ]) + if (!bugdar::$datastore['resolution'][ $this->values['resolution'] ]) { - $this->set('resolution', $this->registry->options['defaultresolve']); + $this->set('resolution', bugdar::$options['defaultresolve']); } return true; } @@ -266,9 +266,9 @@ class BugAPI extends API */ function verify_assignedto() { - if (!$this->registry->datastore['assignto'][ $this->values['assignedto'] ] AND $this->values['assignedto'] != 0) + if (!bugdar::$datastore['assignto'][ $this->values['assignedto'] ] AND $this->values['assignedto'] != 0) { - $this->set('assignedto', $this->registry->options['defaultassign']); + $this->set('assignedto', bugdar::$options['defaultassign']); } return true; } diff --git a/includes/api_comment.php b/includes/api_comment.php index 738c0f2..719ed8a 100644 --- a/includes/api_comment.php +++ b/includes/api_comment.php @@ -89,7 +89,7 @@ class CommentAPI extends API $comment = preg_replace('#(https?://|www\.)\S+#i', '\0', $comment); } - if ($this->registry->options['allowhtml']) + if (bugdar::$options['allowhtml']) { $this->set('comment_parsed', nl2br($this->registry->unsanitize($comment))); } diff --git a/includes/api_language.php b/includes/api_language.php index 856f701..d0297a4 100644 --- a/includes/api_language.php +++ b/includes/api_language.php @@ -96,7 +96,7 @@ class LanguageAPI extends API $this->error(T('At least one language needs to be present. Deleting this language would violate that.')); } - if ($this->registry->options['defaultlanguage'] == $this->values['languageid']) + if (bugdar::$options['defaultlanguage'] == $this->values['languageid']) { $this->error(T('You cannot delete the default language. Please select another language to be the default language and then delete this one.')); } diff --git a/includes/api_priority.php b/includes/api_priority.php index 03511a0..d5fd90d 100644 --- a/includes/api_priority.php +++ b/includes/api_priority.php @@ -90,7 +90,7 @@ class PriorityAPI extends API function post_delete() { build_priorities(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . $this->registry->options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']); + $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . bugdar::$options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']); } } diff --git a/includes/api_resolution.php b/includes/api_resolution.php index e0b87a9..aeb59ca 100644 --- a/includes/api_resolution.php +++ b/includes/api_resolution.php @@ -90,7 +90,7 @@ class ResolutionAPI extends API function post_delete() { build_resolutions(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET resolution = " . $this->registry->clean($this->registry->options['defaultresolve'], TYPE_UINT) . " WHERE resolution = " . $this->values['resolutionid']); + $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET resolution = " . $this->registry->clean(bugdar::$options['defaultresolve'], TYPE_UINT) . " WHERE resolution = " . $this->values['resolutionid']); } } diff --git a/includes/api_severity.php b/includes/api_severity.php index ef083e0..cfff5c2 100644 --- a/includes/api_severity.php +++ b/includes/api_severity.php @@ -90,7 +90,7 @@ class SeverityAPI extends API function post_delete() { build_severities(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET severity = " . $this->registry->options['defaultseverity'] . " WHERE severity = " . $this->values['severityid']); + $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET severity = " . bugdar::$options['defaultseverity'] . " WHERE severity = " . $this->values['severityid']); } } diff --git a/includes/api_status.php b/includes/api_status.php index 71810a1..fea567d 100644 --- a/includes/api_status.php +++ b/includes/api_status.php @@ -91,7 +91,7 @@ class StatusAPI extends API function post_delete() { build_statuses(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . $this->registry->options['defaultstatus'] . " WHERE status = " . $this->values['statusid']); + $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . bugdar::$options['defaultstatus'] . " WHERE status = " . $this->values['statusid']); } } diff --git a/includes/api_user.php b/includes/api_user.php index 8a78ff0..9067bdf 100644 --- a/includes/api_user.php +++ b/includes/api_user.php @@ -182,7 +182,7 @@ class UserAPI extends BSApi */ function verify_usergroupid() { - if (!isset($this->registry->datastore['usergroup'][ $this->values['usergroupid'] ])) + if (!isset(bugdar::$datastore['usergroup'][ $this->values['usergroupid'] ])) { return false; } @@ -206,7 +206,7 @@ class UserAPI extends BSApi foreach ($groups AS $group) { - if (!isset($this->registry->datastore['usergroup']["$group"])) + if (!isset(bugdar::$datastore['usergroup']["$group"])) { return false; } @@ -271,7 +271,7 @@ class UserAPI extends BSApi */ function pre_delete() { - if ($this->values['userid'] == $this->registry->userinfo['userid']) + if ($this->values['userid'] == bugdar::$userinfo['userid']) { $this->error(T('You cannot delete your own account!')); } diff --git a/includes/class_notification.php b/includes/class_notification.php index ce043c7..2831a3c 100644 --- a/includes/class_notification.php +++ b/includes/class_notification.php @@ -280,7 +280,7 @@ class NotificationCenter { if ($this->users["$userid"]['options'][0] & $this->registry->emailoptions['notifications']['assignedto'] AND in_array($userid, $this->roles['-notapplicable-'])) { - $user = construct_user_display($this->registry->userinfo, false); + $user = construct_user_display(bugdar::$userinfo, false); eval('$part = "' . $this->registry->template->fetch(FetchEmailPath('notice_unassigned.part', $this->_localeFromUserId($userid))) . '";'); $this->notices["$userid"][] = $part; } @@ -298,7 +298,7 @@ class NotificationCenter { if ($this->users["$userid"]['options'][0] & $this->registry->emailoptions['notifications']['assignedto'] AND in_array($userid, $this->roles['-notapplicable-'])) { - $user = construct_user_display($this->registry->userinfo, false); + $user = construct_user_display(bugdar::$userinfo, false); eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_assigned.part', $this->_localeFromUserId($userid))) . '";'); $this->notices["$userid"][] = $email; } @@ -414,8 +414,8 @@ class NotificationCenter { $userlist = $this->fetch_users_with_on_bit('otherfield'); - $old = $this->registry->datastore['product']["$old[0]"]['title'] . '/' . ($old[1] ? $this->registry->datastore['product']["$old[1]"]['title'] . '/' : '') . $this->registry->datastore['version']["$old[2]"]['version']; - $new = $this->registry->datastore['product']["$new[0]"]['title'] . '/' . ($new[1] ? $this->registry->datastore['product']["$new[1]"]['title'] . '/' : '') . $this->registry->datastore['version']["$new[2]"]['version']; + $old = bugdar::$datastore['product']["$old[0]"]['title'] . '/' . ($old[1] ? bugdar::$datastore['product']["$old[1]"]['title'] . '/' : '') . bugdar::$datastore['version']["$old[2]"]['version']; + $new = bugdar::$datastore['product']["$new[0]"]['title'] . '/' . ($new[1] ? bugdar::$datastore['product']["$new[1]"]['title'] . '/' : '') . bugdar::$datastore['version']["$new[2]"]['version']; foreach ($userlist AS $userid => $user) { @@ -438,8 +438,8 @@ class NotificationCenter $userlist = $this->fetch_users_with_on_bit('newcomment'); foreach ($userlist AS $userid => $user) { - $user = construct_user_display($this->registry->userinfo, false); - $date = $this->registry->modules['date']->format($this->registry->options['dateformat'], $comment['dateline']); + $user = construct_user_display(bugdar::$userinfo, false); + $date = $this->registry->modules['date']->format(bugdar::$options['dateformat'], $comment['dateline']); eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_comment.part', $this->_localeFromUserId($userid))) . '";'); $this->notices["$userid"][] = $email; @@ -482,7 +482,7 @@ class NotificationCenter $userlist = $this->fetch_users_with_on_bit('newattachment'); foreach ($userlist AS $userid => $user) { - $user = construct_user_display($this->registry->userinfo, false); + $user = construct_user_display(bugdar::$userinfo, false); $obsoletes = implode(', ', (array)$obsolete); eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_attachment.part', $this->_localeFromUserId($userid))) . '";'); @@ -515,9 +515,9 @@ class NotificationCenter { if (!is_array($this->users["$userInfo[userid]"])) { - $user = construct_user_display($this->registry->userinfo, false); + $user = construct_user_display(bugdar::$userinfo, false); $this->users["$userInfo[userid]"] = $userInfo; - $product = $this->registry->datastore['product']["$bug[product]"]['title'] . '/' . ($bug['component'] ? $this->registry->datastore['product']["$bug[component]"]['title'] . '/' : '') . $this->registry->datastore['version']["$bug[version]"]['version']; + $product = bugdar::$datastore['product']["$bug[product]"]['title'] . '/' . ($bug['component'] ? bugdar::$datastore['product']["$bug[component]"]['title'] . '/' : '') . bugdar::$datastore['version']["$bug[version]"]['version']; eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_new_bug.part', $this->_localeFromUserId($userInfo['userid']))) . '";'); $this->notices["$userInfo[userid]"][] = $email; unset($this->users["$userInfo[userid]"]['mask'], $this->users["$userInfo[userid]"]['relation']); @@ -575,7 +575,7 @@ class NotificationCenter $bug = $this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $this->bug['bugid']); foreach ($this->notices AS $userid => $noticelist) { - if ($userid == $this->registry->userinfo['userid']) + if ($userid == bugdar::$userinfo['userid']) { $this->registry->debug("skipping user $userid because they're the one doing the thing"); continue; @@ -616,10 +616,10 @@ class NotificationCenter */ function _localeFromUserId($userid) { - $langcode = $this->registry->datastore['language'][$this->users[$userid]['languageid']]['langcode']; + $langcode = bugdar::$datastore['language'][$this->users[$userid]['languageid']]['langcode']; if (!$langcode) { - $langcode = $this->registry->datastore['language'][$this->registry->options['defaultlanguage']]['langcode']; + $langcode = bugdar::$datastore['language'][bugdar::$options['defaultlanguage']]['langcode']; } return $langcode; } diff --git a/includes/class_sort.php b/includes/class_sort.php index 4b02369..dba2291 100644 --- a/includes/class_sort.php +++ b/includes/class_sort.php @@ -94,13 +94,13 @@ class ListSorter $this->sortkey = $this->registry->in['by']; if (!$this->fetch_by_text($this->registry->in['by'])) { - $this->sortkey = (isset($this->registry->userinfo['defaultsortkey']) ? $this->registry->userinfo['defaultsortkey'] : $this->registry->options['defaultsortkey']); + $this->sortkey = (isset(bugdar::$userinfo['defaultsortkey']) ? bugdar::$userinfo['defaultsortkey'] : bugdar::$options['defaultsortkey']); } $this->direction = $this->registry->in['as']; if (!in_array($this->direction, array('asc', 'desc'))) { - $this->direction = (isset($this->registry->userinfo['defaultsortas']) ? $this->registry->userinfo['defaultsortas'] : $this->registry->options['defaultsortas']); + $this->direction = (isset(bugdar::$userinfo['defaultsortas']) ? bugdar::$userinfo['defaultsortas'] : bugdar::$options['defaultsortas']); } } @@ -119,9 +119,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') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $this->registry->userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")" . - (($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 = " . bugdar::$userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")" . + ((bugdar::$options['hidestatuses'] OR isset(bugdar::$userinfo['hidestatuses'])) ? " + AND bug.status NOT IN (" . (bugdar::$userinfo['hidestatuses'] != '' ? bugdar::$userinfo['hidestatuses'] : bugdar::$options['hidestatuses']) . ")" : ""); // remap the sort keys to be actual SQL fields $querykeys = array( @@ -481,7 +481,7 @@ class ListSorter $columns = self::fetch_by_text(false); - $array = (($this->registry->userinfo['userid'] AND is_array($this->registry->userinfo['columnoptions'])) ? $this->registry->userinfo['columnoptions'] : $this->registry->options['columnoptions']); + $array = ((bugdar::$userinfo['userid'] AND is_array(bugdar::$userinfo['columnoptions'])) ? bugdar::$userinfo['columnoptions'] : bugdar::$options['columnoptions']); foreach ($array AS $column => $position) { diff --git a/locale/en_US/emails/bugnotification.xml.tpl b/locale/en_US/emails/bugnotification.xml.tpl index e301974..9b6651f 100644 --- a/locale/en_US/emails/bugnotification.xml.tpl +++ b/locale/en_US/emails/bugnotification.xml.tpl @@ -1,10 +1,10 @@ - {$this->registry->options['trackertitle']} Bug Notification - {$this->bug['summary']} + {bugdar::$options['trackertitle']} Bug Notification - {$this->bug['summary']} Hi {$this->users[$userid]['displayname']}, -You are receiving this email because you have opted to get notifications for the {$this->registry->options['trackertitle']} bug tracker. +You are receiving this email because you have opted to get notifications for the {bugdar::$options['trackertitle']} bug tracker. -The bug is "{$this->bug['summary']}" (id: {$this->bug['bugid']}) located at {$this->registry->options['trackerurl']}/showreport.php?bugid={$this->bug['bugid']} +The bug is "{$this->bug['summary']}" (id: {$this->bug['bugid']}) located at {bugdar::$options['trackerurl']}/showreport.php?bugid={$this->bug['bugid']} Here are the notices: ################################################################### @@ -14,5 +14,5 @@ $parts ################################################################### If you no longer want to receive email from us, please log into your account and click the "My Controls" tab at the top of the screen to change email preferences. -{$this->registry->options['trackerurl']} +{bugdar::$options['trackerurl']} \ No newline at end of file diff --git a/locale/en_US/emails/notice_attachment.part.tpl b/locale/en_US/emails/notice_attachment.part.tpl index 53fee41..3dfd93a 100644 --- a/locale/en_US/emails/notice_attachment.part.tpl +++ b/locale/en_US/emails/notice_attachment.part.tpl @@ -4,5 +4,5 @@ File name: $attachment[filename] Description: $attachment[description] File size: $attachment[filesize] Bytes Makes obsolete: $obsoletes -View: {$this->registry->options['trackerurl']}/viewattachment.php?attachmentid=$id +View: {bugdar::$options['trackerurl']}/viewattachment.php?attachmentid=$id ============================================ \ No newline at end of file diff --git a/locale/en_US/emails/notice_priority.part.tpl b/locale/en_US/emails/notice_priority.part.tpl index c8294fb..467ebfd 100644 --- a/locale/en_US/emails/notice_priority.part.tpl +++ b/locale/en_US/emails/notice_priority.part.tpl @@ -1 +1 @@ -The priority has been elevatd from "{$this->registry->datastore['priority'][$old]['priority']}" to "{$this->registry->datastore['priority'][$new]['priority']}". \ No newline at end of file +The priority has been elevatd from "{bugdar::$datastore['priority'][$old]['priority']}" to "{bugdar::$datastore['priority'][$new]['priority']}". \ No newline at end of file diff --git a/locale/en_US/emails/notice_resolution.part.tpl b/locale/en_US/emails/notice_resolution.part.tpl index 5ed9152..86b0475 100644 --- a/locale/en_US/emails/notice_resolution.part.tpl +++ b/locale/en_US/emails/notice_resolution.part.tpl @@ -1 +1 @@ -This bug has been resolved with resolution "{$this->registry->datastore['resolution'][$new]['resolution']}", from "{$this->registry->datastore['resolution'][$old]['resolution']}". \ No newline at end of file +This bug has been resolved with resolution "{bugdar::$datastore['resolution'][$new]['resolution']}", from "{bugdar::$datastore['resolution'][$old]['resolution']}". \ No newline at end of file diff --git a/locale/en_US/emails/notice_severity.part.tpl b/locale/en_US/emails/notice_severity.part.tpl index 4408d92..1292ab7 100644 --- a/locale/en_US/emails/notice_severity.part.tpl +++ b/locale/en_US/emails/notice_severity.part.tpl @@ -1 +1 @@ -The severity has been elevated from "{$this->registry->datastore['severity'][$old]['severity']}" to "{$this->registry->datastore['severity'][$new]['severity']}". \ No newline at end of file +The severity has been elevated from "{bugdar::$datastore['severity'][$old]['severity']}" to "{bugdar::$datastore['severity'][$new]['severity']}". \ No newline at end of file diff --git a/locale/en_US/emails/notice_status.part.tpl b/locale/en_US/emails/notice_status.part.tpl index 6115362..5bd532c 100644 --- a/locale/en_US/emails/notice_status.part.tpl +++ b/locale/en_US/emails/notice_status.part.tpl @@ -1 +1 @@ -The status of the bug is now "{$this->registry->datastore['status'][$new]['status']}", from "{$this->registry->datastore['status'][$old]['status']}". \ No newline at end of file +The status of the bug is now "{bugdar::$datastore['status'][$new]['status']}", from "{bugdar::$datastore['status'][$old]['status']}". \ No newline at end of file -- 2.43.5