From 044f3d7b80ede563760410ba3b8c01858b78c48c Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 18 Apr 2020 17:44:29 -0400 Subject: [PATCH] Replace some datastore access via the registry with the global statics. --- includes/api_bug.php | 20 ++++++++++---------- includes/api_user.php | 4 ++-- includes/class_notification.php | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/includes/api_bug.php b/includes/api_bug.php index 4d8f905..8dd9a5b 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,7 +206,7 @@ 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']); } @@ -221,7 +221,7 @@ 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']); } @@ -236,7 +236,7 @@ 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']); } @@ -251,7 +251,7 @@ 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']); } @@ -266,7 +266,7 @@ 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']); } diff --git a/includes/api_user.php b/includes/api_user.php index 6ade4a2..072e1ba 100644 --- a/includes/api_user.php +++ b/includes/api_user.php @@ -183,7 +183,7 @@ class UserAPI extends API */ function verify_usergroupid() { - if (!isset($this->registry->datastore['usergroup'][ $this->values['usergroupid'] ])) + if (!isset(bugdar::$datastore['usergroup'][ $this->values['usergroupid'] ])) { return false; } @@ -207,7 +207,7 @@ class UserAPI extends API foreach ($groups AS $group) { - if (!isset($this->registry->datastore['usergroup']["$group"])) + if (!isset(bugdar::$datastore['usergroup']["$group"])) { return false; } diff --git a/includes/class_notification.php b/includes/class_notification.php index 0ad92dd..bad5d67 100644 --- a/includes/class_notification.php +++ b/includes/class_notification.php @@ -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) { @@ -517,7 +517,7 @@ class NotificationCenter { $user = construct_user_display($this->registry->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']); @@ -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'][$this->registry->options['defaultlanguage']]['langcode']; } return $langcode; } -- 2.22.5