From 55eae1cff1d8bd8ebd77f5499c476169e3f0f43b Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 2 Apr 2014 16:52:03 -0500 Subject: [PATCH] lint: Fix several issues from regression tests --- apps/dispatcher.php | 3 +-- include/ajax.content.php | 1 + include/ajax.users.php | 1 + include/class.client.php | 4 ++++ include/class.orm.php | 2 +- include/class.staff.php | 2 +- include/class.ticket.php | 2 +- scp/apps/dispatcher.php | 3 +-- 8 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/dispatcher.php b/apps/dispatcher.php index 0a3ed9d34..47c4685e5 100644 --- a/apps/dispatcher.php +++ b/apps/dispatcher.php @@ -25,8 +25,7 @@ require('client.inc.php'); if(!defined('INCLUDE_DIR')) Http::response(500, 'Server configuration error'); require_once INCLUDE_DIR.'/class.dispatcher.php'; -$dispatcher = patterns('', -); +$dispatcher = new Dispatcher(); Signal::send('ajax.client', $dispatcher); print $dispatcher->resolve($ost->get_path_info()); diff --git a/include/ajax.content.php b/include/ajax.content.php index 463248382..1703ba28e 100644 --- a/include/ajax.content.php +++ b/include/ajax.content.php @@ -157,6 +157,7 @@ class ContentAjaxAPI extends AjaxController { Http::response(404, 'No such content'); $vars = array_merge($content->getHashtable(), $_POST); + $errors = array(); if (!$content->save($id, $vars, $errors)) { if ($errors['err']) Http::response(422, $errors['err']); diff --git a/include/ajax.users.php b/include/ajax.users.php index 5529cf6c6..8c19ec0e7 100644 --- a/include/ajax.users.php +++ b/include/ajax.users.php @@ -309,6 +309,7 @@ class UsersAjaxAPI extends AjaxController { || !($account=$user->getAccount())) Http::response(404, 'Unknown user account'); + $info = array(); $info['title'] = 'Organization for '.$user->getName(); $info['action'] = '#users/'.$user->getId().'/org'; $info['onselect'] = 'ajax.php/users/'.$user->getId().'/org'; diff --git a/include/class.client.php b/include/class.client.php index 3ad25fa39..e8a30dd22 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -13,6 +13,8 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ +require_once INCLUDE_DIR.'class.user.php'; + abstract class TicketUser { static private $token_regex = '/^(?P<type>\w{1})(?P<algo>\d+)x(?P<hash>.*)$/i'; @@ -307,6 +309,8 @@ class ClientAccount extends UserAccount { } function update($vars, &$errors) { + global $cfg; + $rtoken = $_SESSION['_client']['reset-token']; if ($vars['passwd1'] || $vars['passwd2'] || $vars['cpasswd'] || $rtoken) { diff --git a/include/class.orm.php b/include/class.orm.php index ce8edcf2a..2817c66dc 100644 --- a/include/class.orm.php +++ b/include/class.orm.php @@ -828,7 +828,7 @@ class MySqlCompiler extends SqlCompiler { return (string)$q; } elseif ($what instanceof SqlFunction) { - return $val->toSql($this); + return $what->toSql($this); } else { $this->params[] = $what; diff --git a/include/class.staff.php b/include/class.staff.php index 2c60d98d0..fac31e542 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -789,7 +789,7 @@ class Staff extends AuthenticatedUser { $_config = new Config('pwreset'); $_config->set($vars['token'], $this->getId()); - $email->send($this->getEmail(), Format::stripTags($msg['subj']), + $email->send($this->getEmail(), Format::striptags($msg['subj']), $msg['body']); } diff --git a/include/class.ticket.php b/include/class.ticket.php index 4b7bf4c41..a61717b81 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2157,7 +2157,7 @@ class Ticket { }; }; - $reject_ticket = function($message) use (&$errors) { + $reject_ticket = function($message) use (&$errors, $ost) { $errors = array( 'errno' => 403, 'err' => 'This help desk is for use by authorized users only'); diff --git a/scp/apps/dispatcher.php b/scp/apps/dispatcher.php index d1cf05fd8..ac5ac5850 100644 --- a/scp/apps/dispatcher.php +++ b/scp/apps/dispatcher.php @@ -32,8 +32,7 @@ ini_set('display_startup_errors','0'); if(!defined('INCLUDE_DIR')) Http::response(500, 'Server configuration error'); require_once INCLUDE_DIR.'/class.dispatcher.php'; -$dispatcher = patterns('', -); +$dispatcher = new Dispatcher(); Signal::send('apps.scp', $dispatcher); -- GitLab