From e11db6f169b7885b97d24dea492dd890076ab537 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 16 Apr 2014 08:27:27 -0500
Subject: [PATCH] lint: Fixup undefined variables and methods

---
 include/ajax.users.php   | 2 +-
 include/class.auth.php   | 2 +-
 include/class.thread.php | 2 +-
 include/class.ticket.php | 7 ++++---
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/ajax.users.php b/include/ajax.users.php
index 5da92b78c..2193abf85 100644
--- a/include/ajax.users.php
+++ b/include/ajax.users.php
@@ -291,7 +291,7 @@ class UsersAjaxAPI extends AjaxController {
             Http::response(400, 'Query argument is required');
 
         $users = array();
-        foreach (AuthenticationBackend::searchDirectories() as $ab) {
+        foreach (AuthenticationBackend::getSearchDirectories() as $ab) {
             foreach ($ab->search($_REQUEST['q']) as $u)
                 $users[] = $u;
         }
diff --git a/include/class.auth.php b/include/class.auth.php
index 487dbe3c6..b28d0c987 100644
--- a/include/class.auth.php
+++ b/include/class.auth.php
@@ -253,7 +253,7 @@ abstract class AuthenticationBackend {
     static function searchUsers($query) {
         $users = array();
         foreach (static::getSearchDirectories() as $bk)
-            $users += $bk->search($query);
+            $users = array_merge($users, $bk->search($query));
 
         return $users;
     }
diff --git a/include/class.thread.php b/include/class.thread.php
index 9ab7958e7..5aed962fd 100644
--- a/include/class.thread.php
+++ b/include/class.thread.php
@@ -1399,7 +1399,7 @@ class HtmlThreadBody extends ThreadBody {
     }
 
     function getClean() {
-        return trim($body, " <>br/\t\n\r") ? Format::sanitize($body) : '';
+        return trim($this->body, " <>br/\t\n\r") ? Format::sanitize($this->body) : '';
     }
 
     function display($output=false) {
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 57cfe653c..dc298c084 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -940,7 +940,7 @@ class Ticket {
             // Account manager
             if ($cfg->alertAcctManagerONNewMessage()
                     && ($org = $this->getOwner()->getOrganization())
-                    && ($acct_manager = $org->getAcctManager())) {
+                    && ($acct_manager = $org->getAccountManager())) {
                 if ($acct_manager instanceof Team)
                     $recipients = array_merge($recipients, $acct_manager->getMembers());
                 else
@@ -1633,7 +1633,7 @@ class Ticket {
             // Account manager
             if ($cfg->alertAcctManagerONNewMessage()
                     && ($org = $this->getOwner()->getOrganization())
-                    && ($acct_manager = $org->getAcctManager())) {
+                    && ($acct_manager = $org->getAccountManager())) {
                 if ($acct_manager instanceof Team)
                     $recipients = array_merge($recipients, $acct_manager->getMembers());
                 else
@@ -2306,7 +2306,8 @@ class Ticket {
             if (!$user) {
                 // Reject emails if not from registered clients (if
                 // configured)
-                if ($source == 'email' && !$cfg->acceptUnregisteredEmail()) {
+                if (strcasecmp($origin, 'email') === 0
+                        && !$cfg->acceptUnregisteredEmail()) {
                     list($mailbox, $domain) = explode('@', $vars['email'], 2);
                     // Users not yet created but linked to an organization
                     // are still acceptable
-- 
GitLab