From 68308b02a5dc20de4bfa390f68197fead7aa8328 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Jul 2017 21:57:29 -0400 Subject: [PATCH 001/130] Some sort of progress on category endpoint --- .../Categories/CategoryHandler.php | 28 ++++++++++++++ .../Categories/CategoryController.php | 15 ++++++++ api/DataAccess/Categories/CategoryGateway.php | 19 ++++++++++ .../Categories/CategoryHandlerTest.php | 37 +++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 api/BusinessLogic/Categories/CategoryHandler.php create mode 100644 api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php new file mode 100644 index 00000000..ca315998 --- /dev/null +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -0,0 +1,28 @@ +categoryGateway = $categoryGateway; + } + + /** + * @param $category Category + * @param $heskSettings array + */ + function createCategory($category, $heskSettings) { + $this->categoryGateway->createCategory($category, $heskSettings); + } + + function editCategory($category, $heskSettings) { + + + } +} \ No newline at end of file diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index e376afef..bb729ca7 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -4,6 +4,7 @@ namespace Controllers\Categories; use BusinessLogic\Categories\CategoryRetriever; use BusinessLogic\Exceptions\ApiFriendlyException; +use Controllers\JsonRetriever; class CategoryController { function get($id) { @@ -28,4 +29,18 @@ class CategoryController { return $categoryRetriever->getAllCategories($hesk_settings, $userContext); } + + function post() { + //-- TODO: Create Category + $data = JsonRetriever::getJsonData(); + + } + + function put($id) { + //-- TODO: Edit category + } + + function delete($id) { + //-- TODO: Delete category + } } \ No newline at end of file diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index 4fd35c7b..fde6f824 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -40,4 +40,23 @@ class CategoryGateway extends CommonDao { return $results; } + + /** + * @param $category Category + * @param $heskSettings array + */ + function createCategory($category, $heskSettings) { + $this->init(); + + $sql = "INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` () + VALUES ()"; + + $this->close(); + } + + function updateCategory($category, $heskSettings) { + $this->init(); + + $this->close(); + } } \ No newline at end of file diff --git a/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php b/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php new file mode 100644 index 00000000..32b5f99c --- /dev/null +++ b/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php @@ -0,0 +1,37 @@ +categoryGateway = $this->createMock(CategoryGateway::class); + + $this->categoryHandler = new CategoryHandler($this->categoryGateway); + $this->heskSettings = array(); + } + + function testCreateCallsTheGatewayWithTheCategory() { + //-- Arrange + $category = new Category(); + + //-- Assert + $this->categoryGateway->expects($this->once())->method('createCategory')->with($category, $this->heskSettings); + + //-- Act + $this->categoryHandler->createCategory($category, $this->heskSettings); + } +} From f7d03f66cd47d4009a5119e865596e14608ec8fa Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 17 Aug 2017 22:03:33 -0400 Subject: [PATCH 002/130] Making more progress on category API endpoint --- api/BusinessLogic/Categories/Category.php | 5 ++++ .../Categories/CategoryHandler.php | 30 +++++++++++++++++++ api/DataAccess/Categories/CategoryGateway.php | 22 ++++++++++++-- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/api/BusinessLogic/Categories/Category.php b/api/BusinessLogic/Categories/Category.php index 755188f3..8a1f2dc8 100644 --- a/api/BusinessLogic/Categories/Category.php +++ b/api/BusinessLogic/Categories/Category.php @@ -60,4 +60,9 @@ class Category { * @var bool Indication if the user has access to the Categories */ public $accessible; + + /** + * @var string + */ + public $description; } \ No newline at end of file diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index ca315998..4d1111a6 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -3,6 +3,7 @@ namespace BusinessLogic\Categories; +use BusinessLogic\ValidationModel; use DataAccess\Categories\CategoryGateway; class CategoryHandler { @@ -18,9 +19,38 @@ class CategoryHandler { * @param $heskSettings array */ function createCategory($category, $heskSettings) { + + $this->categoryGateway->createCategory($category, $heskSettings); } + /** + * @param $category Category + * @param $heskSettings array + * @param $creating bool + * @return ValidationModel + */ + function validate($category, $heskSettings, $creating = true) { + $validationModel = new ValidationModel(); + if (!$creating && $category->id < 1) { + $validationModel->errorKeys[] = 'ID_MISSING'; + } + + if ($category->backgroundColor === null || trim($category->backgroundColor) === '') { + $validationModel->errorKeys[] = 'BACKGROUND_COLOR_MISSING'; + } + + if ($category->foregroundColor === null || trim($category->foregroundColor) === '') { + $validationModel->errorKeys[] = 'FOREGROUND_COLOR_MISSING'; + } + + if ($category->name === null || trim($category->name) === '') { + $validationModel->errorKeys[] = 'NAME_MISSING'; + } + + return $validationModel; + } + function editCategory($category, $heskSettings) { diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index fde6f824..f72847c9 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -33,6 +33,7 @@ class CategoryGateway extends CommonDao { $category->displayBorder = $row['display_border_outline'] === '1'; $category->priority = intval($row['priority']); $category->manager = intval($row['manager']) == 0 ? NULL : intval($row['manager']); + $category->description = $row['description']; $results[$category->id] = $category; } @@ -44,14 +45,31 @@ class CategoryGateway extends CommonDao { /** * @param $category Category * @param $heskSettings array + * @return int The ID of the newly created category */ function createCategory($category, $heskSettings) { $this->init(); - $sql = "INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` () - VALUES ()"; + $newOrderRs = hesk_dbQuery("SELECT `cat_order` FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` ORDER BY `cat_order` DESC LIMIT 1"); + $newOrder = hesk_dbFetchAssoc($newOrderRs); + + $sql = "INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` + (`name`, `cat_order`, `autoassign`, `type`, `priority`, `manager`, `background_color`, `usage`, + `foreground_color`, `display_border_outline`, `description`) + VALUES ('" . hesk_dbEscape($category->name) . "', " . intval($newOrder['cat_order']) . ", + '" . $category->autoAssign ? 1 : 0 . "', '" . intval($category->type) . "', + '" . intval($category->priority) . "', " . $category->manager === null ? 'NULL' : intval($category->manager) . ", + '" . hesk_dbEscape($category->backgroundColor) . "', " . intval($category->usage) . ", + '" . hesk_dbEscape($category->foregroundColor) . "', '" . $category->displayBorder ? 1 : 0 . "', + '" . hesk_dbEscape($category->description) . "')"; + + hesk_dbQuery($sql); + + $id = hesk_dbInsertID(); $this->close(); + + return $id; } function updateCategory($category, $heskSettings) { From 1185785dbd5fcb67e50d11333144900ad49d3b09 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 18 Aug 2017 08:15:50 -0400 Subject: [PATCH 003/130] Should be able to create categories now... --- .../Categories/CategoryHandler.php | 15 +++++++-- .../Categories/CategoryController.php | 33 ++++++++++++++++++- api/RequestMethod.php | 10 ++++++ api/index.php | 12 +++++-- 4 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 api/RequestMethod.php diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 4d1111a6..0cca431d 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -3,6 +3,7 @@ namespace BusinessLogic\Categories; +use BusinessLogic\Exceptions\ValidationException; use BusinessLogic\ValidationModel; use DataAccess\Categories\CategoryGateway; @@ -17,11 +18,20 @@ class CategoryHandler { /** * @param $category Category * @param $heskSettings array + * @return Category The newly created category with ID + * @throws ValidationException When validation fails */ + //TODO Test function createCategory($category, $heskSettings) { + $validationModel = $this->validate($category, $heskSettings); + if (count($validationModel->errorKeys) > 0) { + throw new ValidationException($validationModel); + } + + $category->id = $this->categoryGateway->createCategory($category, $heskSettings); - $this->categoryGateway->createCategory($category, $heskSettings); + return $category; } /** @@ -30,7 +40,8 @@ class CategoryHandler { * @param $creating bool * @return ValidationModel */ - function validate($category, $heskSettings, $creating = true) { + //TODO Test + private function validate($category, $heskSettings, $creating = true) { $validationModel = new ValidationModel(); if (!$creating && $category->id < 1) { $validationModel->errorKeys[] = 'ID_MISSING'; diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index bb729ca7..a739ab45 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -2,8 +2,11 @@ namespace Controllers\Categories; +use BusinessLogic\Categories\Category; +use BusinessLogic\Categories\CategoryHandler; use BusinessLogic\Categories\CategoryRetriever; use BusinessLogic\Exceptions\ApiFriendlyException; +use BusinessLogic\Helpers; use Controllers\JsonRetriever; class CategoryController { @@ -31,9 +34,37 @@ class CategoryController { } function post() { - //-- TODO: Create Category + global $hesk_settings, $applicationContext; + $data = JsonRetriever::getJsonData(); + $category = $this->buildCategoryFromJson($data); + + /* @var $categoryHandler CategoryHandler */ + $categoryHandler = $applicationContext->get[CategoryHandler::class]; + + $category = $categoryHandler->createCategory($category, $hesk_settings); + + return output($category); + } + + private function buildCategoryFromJson($json) { + $category = new Category(); + + $category->id = Helpers::safeArrayGet($json, 'id'); + $category->autoAssign = Helpers::safeArrayGet($json, 'autoassign'); + $category->backgroundColor = Helpers::safeArrayGet($json, 'backgroundColor'); + $category->catOrder = Helpers::safeArrayGet($json, 'order'); + $category->description = Helpers::safeArrayGet($json, 'description'); + $category->displayBorder = Helpers::safeArrayGet($json, 'displayBorder'); + $category->foregroundColor = Helpers::safeArrayGet($json, 'foregroundColor'); + $category->manager = Helpers::safeArrayGet($json, 'manager'); + $category->name = Helpers::safeArrayGet($json, 'name'); + $category->priority = Helpers::safeArrayGet($json, 'priority'); + $category->type = Helpers::safeArrayGet($json, 'type'); + $category->usage = Helpers::safeArrayGet($json, 'usage'); + + return $category; } function put($id) { diff --git a/api/RequestMethod.php b/api/RequestMethod.php new file mode 100644 index 00000000..e692c03d --- /dev/null +++ b/api/RequestMethod.php @@ -0,0 +1,10 @@ + action(\Controllers\Categories\CategoryController::class . '::printAllCategories'), + '/v1/categories' => action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET]), '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class), // Tickets '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::class), @@ -225,8 +225,14 @@ Link::all(array( '404' => 'handle404' )); -function action($class, $securityHandler = SecurityHandler::AUTH_TOKEN) { - return [$class, $class, $securityHandler]; +/** + * @param $class object|string The class name (and optional static method) + * @param $requestMethods array The accepted request methods for this endpoint + * @param $securityHandler string The proper security handler + * @return array The configured path + */ +function action($class, $requestMethods = RequestMethod::ALL, $securityHandler = SecurityHandler::AUTH_TOKEN) { + return [$class, $class, $securityHandler, $requestMethods]; } class SecurityHandler { From 8f52400aeac755223dcf30b8448a81acbbb8e88c Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 20 Aug 2017 11:47:35 -0400 Subject: [PATCH 004/130] Change column name --- api/DataAccess/Categories/CategoryGateway.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index f72847c9..bf48f5b4 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -33,7 +33,7 @@ class CategoryGateway extends CommonDao { $category->displayBorder = $row['display_border_outline'] === '1'; $category->priority = intval($row['priority']); $category->manager = intval($row['manager']) == 0 ? NULL : intval($row['manager']); - $category->description = $row['description']; + $category->description = $row['mfh_description']; $results[$category->id] = $category; } @@ -55,7 +55,7 @@ class CategoryGateway extends CommonDao { $sql = "INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` (`name`, `cat_order`, `autoassign`, `type`, `priority`, `manager`, `background_color`, `usage`, - `foreground_color`, `display_border_outline`, `description`) + `foreground_color`, `display_border_outline`, `mfh_description`) VALUES ('" . hesk_dbEscape($category->name) . "', " . intval($newOrder['cat_order']) . ", '" . $category->autoAssign ? 1 : 0 . "', '" . intval($category->type) . "', '" . intval($category->priority) . "', " . $category->manager === null ? 'NULL' : intval($category->manager) . ", From 7d2479d5b64247b7164257eceb46e70c8abfb94c Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 20 Aug 2017 15:47:30 -0400 Subject: [PATCH 005/130] Categories can be created --- api/ApplicationContext.php | 2 + api/DataAccess/Categories/CategoryGateway.php | 7 ++-- api/Link.php | 42 ++++++++++++------- api/index.php | 3 +- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/api/ApplicationContext.php b/api/ApplicationContext.php index dae5a238..55cb52b7 100644 --- a/api/ApplicationContext.php +++ b/api/ApplicationContext.php @@ -3,6 +3,7 @@ // Responsible for loading in all necessary classes. AKA a poor man's DI solution. use BusinessLogic\Attachments\AttachmentHandler; use BusinessLogic\Attachments\AttachmentRetriever; +use BusinessLogic\Categories\CategoryHandler; use BusinessLogic\Categories\CategoryRetriever; use BusinessLogic\Emails\BasicEmailSender; use BusinessLogic\Emails\EmailSenderHelper; @@ -73,6 +74,7 @@ class ApplicationContext { // Categories $this->get[CategoryGateway::class] = new CategoryGateway(); $this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class]); + $this->get[CategoryHandler::class] = new CategoryHandler($this->get[CategoryGateway::class]); // Bans $this->get[BanGateway::class] = new BanGateway(); diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index bf48f5b4..00d24edb 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -4,6 +4,7 @@ namespace DataAccess\Categories; use BusinessLogic\Categories\Category; use DataAccess\CommonDao; +use DataAccess\Logging\LoggingGateway; use Exception; class CategoryGateway extends CommonDao { @@ -57,10 +58,10 @@ class CategoryGateway extends CommonDao { (`name`, `cat_order`, `autoassign`, `type`, `priority`, `manager`, `background_color`, `usage`, `foreground_color`, `display_border_outline`, `mfh_description`) VALUES ('" . hesk_dbEscape($category->name) . "', " . intval($newOrder['cat_order']) . ", - '" . $category->autoAssign ? 1 : 0 . "', '" . intval($category->type) . "', - '" . intval($category->priority) . "', " . $category->manager === null ? 'NULL' : intval($category->manager) . ", + '" . ($category->autoAssign ? 1 : 0) . "', '" . intval($category->type) . "', + '" . intval($category->priority) . "', " . ($category->manager === null ? 0 : intval($category->manager)) . ", '" . hesk_dbEscape($category->backgroundColor) . "', " . intval($category->usage) . ", - '" . hesk_dbEscape($category->foregroundColor) . "', '" . $category->displayBorder ? 1 : 0 . "', + '" . hesk_dbEscape($category->foregroundColor) . "', '" . ($category->displayBorder ? 1 : 0) . "', '" . hesk_dbEscape($category->description) . "')"; hesk_dbQuery($sql); diff --git a/api/Link.php b/api/Link.php index f2dbba22..38b8c6e3 100644 --- a/api/Link.php +++ b/api/Link.php @@ -1,5 +1,7 @@ action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET]), + '/v1/categories/all' => action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET]), + '/v1/categories' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::POST]), '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class), // Tickets '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::class), From dd690decb23ed7f08b1888bafc868ed0606dac3f Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 20 Aug 2017 21:53:02 -0400 Subject: [PATCH 006/130] Editing categories possible, add security check --- api/ApplicationContext.php | 8 ++- .../Categories/CategoryHandler.php | 67 ++++++++++++++++--- .../Security/PermissionChecker.php | 23 +++++++ api/BusinessLogic/Security/UserPrivilege.php | 1 + .../Categories/CategoryController.php | 21 +++++- api/DataAccess/Categories/CategoryGateway.php | 38 +++++++++++ 6 files changed, 146 insertions(+), 12 deletions(-) create mode 100644 api/BusinessLogic/Security/PermissionChecker.php diff --git a/api/ApplicationContext.php b/api/ApplicationContext.php index 55cb52b7..9de65544 100644 --- a/api/ApplicationContext.php +++ b/api/ApplicationContext.php @@ -12,6 +12,7 @@ use BusinessLogic\Emails\EmailTemplateRetriever; use BusinessLogic\Emails\MailgunEmailSender; use BusinessLogic\Navigation\CustomNavElementHandler; use BusinessLogic\Security\BanRetriever; +use BusinessLogic\Security\PermissionChecker; use BusinessLogic\Security\UserContextBuilder; use BusinessLogic\Security\UserToTicketChecker; use BusinessLogic\Settings\ApiChecker; @@ -50,6 +51,9 @@ class ApplicationContext { function __construct() { $this->get = array(); + // Permissions + $this->get[PermissionChecker::class] = new PermissionChecker(); + // Settings $this->get[ModsForHeskSettingsGateway::class] = new ModsForHeskSettingsGateway(); @@ -74,7 +78,9 @@ class ApplicationContext { // Categories $this->get[CategoryGateway::class] = new CategoryGateway(); $this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class]); - $this->get[CategoryHandler::class] = new CategoryHandler($this->get[CategoryGateway::class]); + $this->get[CategoryHandler::class] = new CategoryHandler( + $this->get[CategoryGateway::class], + $this->get[PermissionChecker::class]); // Bans $this->get[BanGateway::class] = new BanGateway(); diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 0cca431d..895f1b34 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -3,7 +3,10 @@ namespace BusinessLogic\Categories; +use BusinessLogic\Exceptions\AccessViolationException; use BusinessLogic\Exceptions\ValidationException; +use BusinessLogic\Security\PermissionChecker; +use BusinessLogic\Security\UserPrivilege; use BusinessLogic\ValidationModel; use DataAccess\Categories\CategoryGateway; @@ -11,8 +14,12 @@ class CategoryHandler { /* @var $categoryGateway CategoryGateway */ private $categoryGateway; - function __construct($categoryGateway) { + /* @var $permissionChecker PermissionChecker */ + private $permissionChecker; + + function __construct($categoryGateway, $permissionChecker) { $this->categoryGateway = $categoryGateway; + $this->permissionChecker = $permissionChecker; } /** @@ -22,27 +29,35 @@ class CategoryHandler { * @throws ValidationException When validation fails */ //TODO Test - function createCategory($category, $heskSettings) { - $validationModel = $this->validate($category, $heskSettings); + function createCategory($category, $userContext, $heskSettings) { + $validationModel = $this->validate($category, $userContext); if (count($validationModel->errorKeys) > 0) { throw new ValidationException($validationModel); } - $category->id = $this->categoryGateway->createCategory($category, $heskSettings); + $id = $this->categoryGateway->createCategory($category, $heskSettings); + + $allCategories = $this->categoryGateway->getAllCategories($heskSettings); - return $category; + return $allCategories[$id]; } /** * @param $category Category - * @param $heskSettings array + * @param $userContext * @param $creating bool * @return ValidationModel + * @throws AccessViolationException */ //TODO Test - private function validate($category, $heskSettings, $creating = true) { + private function validate($category, $userContext, $creating = true) { $validationModel = new ValidationModel(); + + if (!$this->permissionChecker->doesUserHavePermission($userContext, UserPrivilege::CAN_MANAGE_CATEGORIES)) { + throw new AccessViolationException('User cannot manage categories!'); + } + if (!$creating && $category->id < 1) { $validationModel->errorKeys[] = 'ID_MISSING'; } @@ -59,11 +74,47 @@ class CategoryHandler { $validationModel->errorKeys[] = 'NAME_MISSING'; } + if ($category->priority === null || intval($category->priority) < 0 || intval($category->priority) > 3) { + $validationModel->errorKeys[] = 'INVALID_PRIORITY'; + } + + if ($category->autoAssign === null || !is_bool($category->autoAssign)) { + $validationModel->errorKeys[] = 'INVALID_AUTOASSIGN'; + } + + if ($category->displayBorder === null || !is_bool($category->displayBorder)) { + $validationModel->errorKeys[] = 'INVALID_DISPLAY_BORDER'; + } + + if ($category->type === null || (intval($category->type) !== 0 && intval($category->type) !== 1)) { + $validationModel->errorKeys[] = 'INVALID_TYPE'; + } + + if ($category->type === null || intval($category->type) < 0 || intval($category->type) > 2) { + $validationModel->errorKeys[] = 'INVALID_TYPE'; + } + return $validationModel; } - function editCategory($category, $heskSettings) { + /** + * @param $category Category + * @param $heskSettings array + * @return Category + * @throws ValidationException + */ + function editCategory($category, $userContext, $heskSettings) { + $validationModel = $this->validate($category, $userContext, false); + + if (count($validationModel->errorKeys) > 0) { + throw new ValidationException($validationModel); + } + + $this->categoryGateway->updateCategory($category, $heskSettings); + $this->categoryGateway->resortAllCategories($heskSettings); + $allCategories = $this->categoryGateway->getAllCategories($heskSettings); + return $allCategories[$category->id]; } } \ No newline at end of file diff --git a/api/BusinessLogic/Security/PermissionChecker.php b/api/BusinessLogic/Security/PermissionChecker.php new file mode 100644 index 00000000..cf2b1a43 --- /dev/null +++ b/api/BusinessLogic/Security/PermissionChecker.php @@ -0,0 +1,23 @@ +admin) { + return true; + } + + if (in_array($permission, $userContext->permissions)) { + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/api/BusinessLogic/Security/UserPrivilege.php b/api/BusinessLogic/Security/UserPrivilege.php index ad6064cc..1e90ff70 100644 --- a/api/BusinessLogic/Security/UserPrivilege.php +++ b/api/BusinessLogic/Security/UserPrivilege.php @@ -14,4 +14,5 @@ class UserPrivilege { const CAN_REPLY_TO_TICKETS = 'can_reply_tickets'; const CAN_EDIT_TICKETS = 'can_edit_tickets'; const CAN_DELETE_TICKETS = 'can_del_tickets'; + const CAN_MANAGE_CATEGORIES = 'can_man_cat'; } \ No newline at end of file diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index a739ab45..90aa2882 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -48,13 +48,16 @@ class CategoryController { return output($category); } + /** + * @param $json + * @return Category + */ private function buildCategoryFromJson($json) { $category = new Category(); - $category->id = Helpers::safeArrayGet($json, 'id'); $category->autoAssign = Helpers::safeArrayGet($json, 'autoassign'); $category->backgroundColor = Helpers::safeArrayGet($json, 'backgroundColor'); - $category->catOrder = Helpers::safeArrayGet($json, 'order'); + $category->catOrder = Helpers::safeArrayGet($json, 'catOrder'); $category->description = Helpers::safeArrayGet($json, 'description'); $category->displayBorder = Helpers::safeArrayGet($json, 'displayBorder'); $category->foregroundColor = Helpers::safeArrayGet($json, 'foregroundColor'); @@ -68,7 +71,19 @@ class CategoryController { } function put($id) { - //-- TODO: Edit category + global $hesk_settings, $applicationContext; + + $data = JsonRetriever::getJsonData(); + + $category = $this->buildCategoryFromJson($data); + $category->id = $id; + + /* @var $categoryHandler CategoryHandler */ + $categoryHandler = $applicationContext->get[CategoryHandler::class]; + + $category = $categoryHandler->editCategory($category, $hesk_settings); + + return output($category); } function delete($id) { diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index 00d24edb..fbf518ec 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -73,9 +73,47 @@ class CategoryGateway extends CommonDao { return $id; } + /** + * @param $category Category + * @param $heskSettings array + */ function updateCategory($category, $heskSettings) { $this->init(); + $sql = "UPDATE `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` SET + `name` = '" . hesk_dbEscape($category->name) . "', + `cat_order` = " . intval($category->catOrder) . ", + `autoassign` = '" . ($category->autoAssign ? 1 : 0) . "', + `type` = '" . intval($category->type) . "', + `priority` = '" . intval($category->priority) . "', + `manager` = " . ($category->manager === null ? 0 : intval($category->manager)) . ", + `background_color` = '" . hesk_dbEscape($category->backgroundColor) . "', + `usage` = " . intval($category->usage) . ", + `foreground_color` = '" . hesk_dbEscape($category->foregroundColor) . "', + `display_border_outline` = '" . ($category->displayBorder ? 1 : 0) . "', + `mfh_description` = '" . hesk_dbEscape($category->description) . "' + WHERE `id` = " . intval($category->id); + + hesk_dbQuery($sql); + + $this->close(); + } + + function resortAllCategories($heskSettings) { + $this->init(); + + $rs = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` + ORDER BY `cat_order` ASC"); + + $sortValue = 10; + while ($row = hesk_dbFetchAssoc($rs)) { + hesk_dbQuery("UPDATE `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` + SET `cat_order` = " . intval($sortValue) . " + WHERE `id` = " . intval($row['id'])); + + $sortValue += 10; + } + $this->close(); } } \ No newline at end of file From 9582689f2a414a3a39105bfb5078d537270d0b76 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 21 Aug 2017 12:54:31 -0400 Subject: [PATCH 007/130] Categories can be deleted, fixed request methods --- .../Categories/CategoryHandler.php | 9 +++++++++ .../Categories/CategoryController.php | 19 +++++++++++++------ api/DataAccess/Categories/CategoryGateway.php | 8 ++++++++ api/Link.php | 1 + api/index.php | 2 +- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 895f1b34..dd68a176 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -117,4 +117,13 @@ class CategoryHandler { return $allCategories[$category->id]; } + + function deleteCategory($id, $userContext, $heskSettings) { + if (!$this->permissionChecker->doesUserHavePermission($userContext, UserPrivilege::CAN_MANAGE_CATEGORIES)) { + throw new AccessViolationException('User cannot manage categories!'); + } + + $this->categoryGateway->deleteCategory($id, $heskSettings); + $this->categoryGateway->resortAllCategories($heskSettings); + } } \ No newline at end of file diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index 90aa2882..cb63f050 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -34,7 +34,7 @@ class CategoryController { } function post() { - global $hesk_settings, $applicationContext; + global $hesk_settings, $userContext, $applicationContext; $data = JsonRetriever::getJsonData(); @@ -43,9 +43,9 @@ class CategoryController { /* @var $categoryHandler CategoryHandler */ $categoryHandler = $applicationContext->get[CategoryHandler::class]; - $category = $categoryHandler->createCategory($category, $hesk_settings); + $category = $categoryHandler->createCategory($category, $userContext, $hesk_settings); - return output($category); + return output($category, 201); } /** @@ -71,7 +71,7 @@ class CategoryController { } function put($id) { - global $hesk_settings, $applicationContext; + global $hesk_settings, $userContext, $applicationContext; $data = JsonRetriever::getJsonData(); @@ -81,12 +81,19 @@ class CategoryController { /* @var $categoryHandler CategoryHandler */ $categoryHandler = $applicationContext->get[CategoryHandler::class]; - $category = $categoryHandler->editCategory($category, $hesk_settings); + $category = $categoryHandler->editCategory($category, $userContext, $hesk_settings); return output($category); } function delete($id) { - //-- TODO: Delete category + global $hesk_settings, $userContext, $applicationContext; + + /* @var $categoryHandler CategoryHandler */ + $categoryHandler = $applicationContext->get[CategoryHandler::class]; + + $categoryHandler->deleteCategory($id, $userContext, $hesk_settings); + + return http_response_code(204); } } \ No newline at end of file diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index fbf518ec..5215a03b 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -116,4 +116,12 @@ class CategoryGateway extends CommonDao { $this->close(); } + + function deleteCategory($id, $heskSettings) { + $this->init(); + + hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` WHERE `id` = " . intval($id)); + + $this->close(); + } } \ No newline at end of file diff --git a/api/Link.php b/api/Link.php index 38b8c6e3..0e745ee3 100644 --- a/api/Link.php +++ b/api/Link.php @@ -82,6 +82,7 @@ class Link $handler = $routeDesc[0]; if( isset( $routeDesc[2] )) { $middleware = $routeDesc[2]; + $acceptedMethods = $routeDesc[3]; } } else diff --git a/api/index.php b/api/index.php index 78432bdd..a41b13fc 100644 --- a/api/index.php +++ b/api/index.php @@ -189,7 +189,7 @@ Link::all(array( // Categories '/v1/categories/all' => action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET]), '/v1/categories' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::POST]), - '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class), + '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE]), // Tickets '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::class), // Tickets - Staff From c86788e7fde17d66f6d3da9dbd277008ad837557 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 21 Aug 2017 13:01:39 -0400 Subject: [PATCH 008/130] Getting started on manage categories page changes, fixed API config issue --- admin/manage_categories.php | 326 +++++++++++++++++++----------------- api/index.php | 14 +- 2 files changed, 178 insertions(+), 162 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index c90aebc8..c3c85e98 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -93,10 +93,11 @@ while ($mycat = hesk_dbFetchAssoc($res)) { ?>
-
+ + +

@@ -253,6 +255,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {

+ - - - - - - - - - - - - - ' - ', - 1 => '', - 2 => ' ' - ); - - while ($mycat = hesk_dbFetchAssoc($res)) { - $j++; - - if (isset($_SESSION['selcat2']) && $mycat['id'] == $_SESSION['selcat2']) { - $color = 'admin_green'; - unset($_SESSION['selcat2']); - } else { - $color = $i ? 'admin_white' : 'admin_gray'; - } - - $tmp = $i ? 'White' : 'Blue'; - $style = 'background: ' . $mycat['background_color']; - $backgroundVolatile = 'background-volatile'; - if ($mycat['foreground_color'] != 'AUTO') { - $style .= '; color: ' . $mycat['foreground_color']; - $backgroundVolatile = ''; - - if ($mycat['display_border_outline']) { - $style .= '; border: solid 1px ' . $mycat['foreground_color']; +
+
+ +
+
+
+ + + + + + + + + + + + + + '; - } else { - $remove_code = ' '; - } - - /* Is category private or public? */ - if ($mycat['type']) { - $type_code = ''; - } else { - $type_code = ''; - } - - /* Is auto assign enabled? */ - if ($hesk_settings['autoassign']) { - if ($mycat['autoassign']) { - $autoassign_code = ''; - } else { - $autoassign_code = ''; + + /* Get list of categories */ + $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `" . $orderBy . "` ASC"); + $usersRes = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0' ORDER BY `name` ASC"); + $users = array(); + while ($userRow = hesk_dbFetchAssoc($usersRes)) { + array_push($users, $userRow); } - } else { - $autoassign_code = ''; - } - echo ' + $i = 1; + $j = 0; + $num = hesk_dbNumRows($res); + + $usage = array( + 0 => ' + ', + 1 => '', + 2 => ' ' + ); + + while ($mycat = hesk_dbFetchAssoc($res)) { + $j++; + + if (isset($_SESSION['selcat2']) && $mycat['id'] == $_SESSION['selcat2']) { + $color = 'admin_green'; + unset($_SESSION['selcat2']); + } else { + $color = $i ? 'admin_white' : 'admin_gray'; + } + + $tmp = $i ? 'White' : 'Blue'; + $style = 'background: ' . $mycat['background_color']; + $backgroundVolatile = 'background-volatile'; + if ($mycat['foreground_color'] != 'AUTO') { + $style .= '; color: ' . $mycat['foreground_color']; + $backgroundVolatile = ''; + + if ($mycat['display_border_outline']) { + $style .= '; border: solid 1px ' . $mycat['foreground_color']; + } + } + + if ($mycat['foreground_color'] == 'AUTO') { + $mycat['foreground_color'] = ''; + } + + $i = $i ? 0 : 1; + + /* Number of tickets and graph width */ + $all = isset($tickets_all[$mycat['id']]) ? $tickets_all[$mycat['id']] : 0; + $width_all = 0; + if ($tickets_total && $all) { + $width_all = round(($all / $tickets_total) * 100); + } + + /* Deleting category with ID 1 (default category) is not allowed */ + if ($mycat['id'] == 1) { + $remove_code = ' '; + } else { + $remove_code = ' '; + } + + /* Is category private or public? */ + if ($mycat['type']) { + $type_code = ''; + } else { + $type_code = ''; + } + + /* Is auto assign enabled? */ + if ($hesk_settings['autoassign']) { + if ($mycat['autoassign']) { + $autoassign_code = ''; + } else { + $autoassign_code = ''; + } + } else { + $autoassign_code = ''; + } + + echo ' 1) { - if ($j == 1) { - echo ' '; - } elseif ($j == $num) { - echo ''; - } else { - echo ' + if ($orderBy != 'name' && $num > 1) { + if ($j == 1) { + echo ' '; + } elseif ($j == $num) { + echo ''; + } else { + echo '   '; - } - } - echo ''; - echo $remove_code . ' + } + } + echo ''; + echo $remove_code . ' '; - } // End while + } // End while - ?> -
+ ?> + + +
+
diff --git a/api/index.php b/api/index.php index a41b13fc..fbe12a8b 100644 --- a/api/index.php +++ b/api/index.php @@ -206,21 +206,21 @@ Link::all(array( /* Internal use only routes */ // Resend email response '/v1-internal/staff/tickets/{i}/resend-email' => - action(\Controllers\Tickets\ResendTicketEmailToCustomerController::class, SecurityHandler::INTERNAL), + action(\Controllers\Tickets\ResendTicketEmailToCustomerController::class, RequestMethod::ALL, SecurityHandler::INTERNAL), // Custom Navigation '/v1-internal/custom-navigation/all' => - action(\Controllers\Navigation\CustomNavElementController::class . '::getAll', SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class . '::getAll', RequestMethod::ALL, SecurityHandler::INTERNAL), '/v1-internal/custom-navigation' => - action(\Controllers\Navigation\CustomNavElementController::class, SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::ALL, SecurityHandler::INTERNAL), '/v1-internal/custom-navigation/{i}' => - action(\Controllers\Navigation\CustomNavElementController::class, SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::ALL, SecurityHandler::INTERNAL), '/v1-internal/custom-navigation/{i}/sort/{s}' => - action(\Controllers\Navigation\CustomNavElementController::class . '::sort', SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class . '::sort', RequestMethod::ALL, SecurityHandler::INTERNAL), '/v1-public/hesk-version' => - action(\Controllers\System\HeskVersionController::class . '::getHeskVersion', SecurityHandler::OPEN), + action(\Controllers\System\HeskVersionController::class . '::getHeskVersion', RequestMethod::ALL, SecurityHandler::OPEN), '/v1-public/mods-for-hesk-version' => - action(\Controllers\System\HeskVersionController::class . '::getModsForHeskVersion', SecurityHandler::OPEN), + action(\Controllers\System\HeskVersionController::class . '::getModsForHeskVersion', RequestMethod::ALL, SecurityHandler::OPEN), // Any URL that doesn't match goes to the 404 handler '404' => 'handle404' From d76cc27e8edc4b4e7c3e060a7ccfe209b5f9dfef Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 21 Aug 2017 21:25:54 -0400 Subject: [PATCH 009/130] Add number of tickets to category --- admin/manage_categories.php | 53 ++++++++++++------- api/BusinessLogic/Categories/Category.php | 5 ++ api/DataAccess/Categories/CategoryGateway.php | 7 ++- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index c3c85e98..3471288a 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -84,12 +84,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ' . $mycat['name'] . ''; -} ?>
@@ -241,21 +235,22 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
--> -
-
-

- -

-
- +
+
+

+ +

+
+ +
+
-
+
+ + + + + + + + + + + + + + + +
+
+
@@ -425,6 +439,9 @@ while ($mycat = hesk_dbFetchAssoc($res)) { +
+ +
diff --git a/api/BusinessLogic/Categories/Category.php b/api/BusinessLogic/Categories/Category.php index 8a1f2dc8..e2c3db9b 100644 --- a/api/BusinessLogic/Categories/Category.php +++ b/api/BusinessLogic/Categories/Category.php @@ -65,4 +65,9 @@ class Category { * @var string */ public $description; + + /** + * @var int + */ + public $numberOfTickets; } \ No newline at end of file diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index 5215a03b..5776ba30 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -15,7 +15,11 @@ class CategoryGateway extends CommonDao { function getAllCategories($hesk_settings) { $this->init(); - $sql = 'SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories`'; + $sql = 'SELECT `cat`.*, COUNT(`tickets`.`id`) AS `number_of_tickets` + FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` `cat` + LEFT JOIN `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` `tickets` + ON `cat`.`id` = `tickets`.`category` + GROUP BY `cat`.`id`'; $response = hesk_dbQuery($sql); @@ -35,6 +39,7 @@ class CategoryGateway extends CommonDao { $category->priority = intval($row['priority']); $category->manager = intval($row['manager']) == 0 ? NULL : intval($row['manager']); $category->description = $row['mfh_description']; + $category->numberOfTickets = intval($row['number_of_tickets']); $results[$category->id] = $category; } From 38cea8282130219029e218b05958586a99045a2f Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 21 Aug 2017 22:11:30 -0400 Subject: [PATCH 010/130] More work on manage categories page --- admin/manage_categories.php | 3 + api/ApplicationContext.php | 6 +- .../Categories/CategoryHandler.php | 35 +++++- .../Categories/CategoryRetriever.php | 13 ++- .../Categories/CategoryController.php | 8 +- api/DataAccess/Categories/CategoryGateway.php | 12 +- api/index.php | 2 +- internal-api/js/manage-categories.js | 105 ++++++++++++++++++ 8 files changed, 167 insertions(+), 17 deletions(-) create mode 100644 internal-api/js/manage-categories.js diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 3471288a..725178ac 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -16,6 +16,7 @@ define('HESK_PATH', '../'); define('VALIDATOR', 1); define('PAGE_TITLE', 'ADMIN_CATEGORIES'); define('MFH_PAGE_LAYOUT', 'TOP_ONLY'); +define('EXTRA_JS', ''); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); @@ -632,6 +633,8 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) get[CategoryGateway::class] = new CategoryGateway(); - $this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class]); + $this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class], + $this->get[ModsForHeskSettingsGateway::class]); $this->get[CategoryHandler::class] = new CategoryHandler( $this->get[CategoryGateway::class], - $this->get[PermissionChecker::class]); + $this->get[PermissionChecker::class], + $this->get[ModsForHeskSettingsGateway::class]); // Bans $this->get[BanGateway::class] = new BanGateway(); diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index dd68a176..87020fe1 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -9,6 +9,7 @@ use BusinessLogic\Security\PermissionChecker; use BusinessLogic\Security\UserPrivilege; use BusinessLogic\ValidationModel; use DataAccess\Categories\CategoryGateway; +use DataAccess\Settings\ModsForHeskSettingsGateway; class CategoryHandler { /* @var $categoryGateway CategoryGateway */ @@ -17,19 +18,27 @@ class CategoryHandler { /* @var $permissionChecker PermissionChecker */ private $permissionChecker; - function __construct($categoryGateway, $permissionChecker) { + /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ + private $modsForHeskSettingsGateway; + + function __construct($categoryGateway, $permissionChecker, $modsForHeskSettingsGateway) { $this->categoryGateway = $categoryGateway; $this->permissionChecker = $permissionChecker; + $this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway; } /** * @param $category Category + * @param $userContext * @param $heskSettings array * @return Category The newly created category with ID * @throws ValidationException When validation fails + * @throws \Exception When the newly created category was not retrieved */ //TODO Test function createCategory($category, $userContext, $heskSettings) { + $modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings); + $validationModel = $this->validate($category, $userContext); if (count($validationModel->errorKeys) > 0) { @@ -38,9 +47,15 @@ class CategoryHandler { $id = $this->categoryGateway->createCategory($category, $heskSettings); - $allCategories = $this->categoryGateway->getAllCategories($heskSettings); + $allCategories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings); + + foreach ($allCategories as $innerCategory) { + if ($innerCategory->id === $id) { + return $innerCategory; + } + } - return $allCategories[$id]; + throw new \Exception("Newly created category {$id} lost! :O"); } /** @@ -99,11 +114,15 @@ class CategoryHandler { /** * @param $category Category + * @param $userContext * @param $heskSettings array * @return Category * @throws ValidationException + * @throws \Exception When the category is missing */ function editCategory($category, $userContext, $heskSettings) { + $modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings); + $validationModel = $this->validate($category, $userContext, false); if (count($validationModel->errorKeys) > 0) { @@ -113,9 +132,15 @@ class CategoryHandler { $this->categoryGateway->updateCategory($category, $heskSettings); $this->categoryGateway->resortAllCategories($heskSettings); - $allCategories = $this->categoryGateway->getAllCategories($heskSettings); + $allCategories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings); + + foreach ($allCategories as $innerCategory) { + if ($innerCategory->id === $category->id) { + return $innerCategory; + } + } - return $allCategories[$category->id]; + throw new \Exception("Category {$category->id} vanished! :O"); } function deleteCategory($id, $userContext, $heskSettings) { diff --git a/api/BusinessLogic/Categories/CategoryRetriever.php b/api/BusinessLogic/Categories/CategoryRetriever.php index 4a46466f..548765c9 100644 --- a/api/BusinessLogic/Categories/CategoryRetriever.php +++ b/api/BusinessLogic/Categories/CategoryRetriever.php @@ -4,6 +4,7 @@ namespace BusinessLogic\Categories; use BusinessLogic\Security\UserContext; use DataAccess\Categories\CategoryGateway; +use DataAccess\Settings\ModsForHeskSettingsGateway; class CategoryRetriever { /** @@ -11,8 +12,14 @@ class CategoryRetriever { */ private $categoryGateway; - function __construct($categoryGateway) { + /** + * @param $modsForHeskSettingsGateway ModsForHeskSettingsGateway + */ + private $modsForHeskSettingsGateway; + + function __construct($categoryGateway, $modsForHeskSettingsGateway) { $this->categoryGateway = $categoryGateway; + $this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway; } /** @@ -21,7 +28,9 @@ class CategoryRetriever { * @return array */ function getAllCategories($heskSettings, $userContext) { - $categories = $this->categoryGateway->getAllCategories($heskSettings); + $modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings); + + $categories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings); foreach ($categories as $category) { $category->accessible = $userContext->admin || diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index cb63f050..53ccf22c 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -13,11 +13,13 @@ class CategoryController { function get($id) { $categories = self::getAllCategories(); - if (!isset($categories[$id])) { - throw new ApiFriendlyException("Category {$id} not found!", "Category Not Found", 404); + foreach ($categories as $category) { + if ($category->id === $id) { + return output($category); + } } - output($categories[$id]); + throw new ApiFriendlyException("Category {$id} not found!", "Category Not Found", 404); } static function printAllCategories() { diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index 5776ba30..2191373d 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -12,14 +12,18 @@ class CategoryGateway extends CommonDao { * @param $hesk_settings * @return Category[] */ - function getAllCategories($hesk_settings) { + function getAllCategories($hesk_settings, $modsForHesk_settings) { $this->init(); + $sortColumn = $modsForHesk_settings['category_order_column']; + $sql = 'SELECT `cat`.*, COUNT(`tickets`.`id`) AS `number_of_tickets` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` `cat` LEFT JOIN `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` `tickets` - ON `cat`.`id` = `tickets`.`category` - GROUP BY `cat`.`id`'; + ON `cat`.`id` = `tickets`.`category` + GROUP BY `cat`.`id` + ORDER BY `cat`.`' . $sortColumn . '` ASC'; + $response = hesk_dbQuery($sql); @@ -40,7 +44,7 @@ class CategoryGateway extends CommonDao { $category->manager = intval($row['manager']) == 0 ? NULL : intval($row['manager']); $category->description = $row['mfh_description']; $category->numberOfTickets = intval($row['number_of_tickets']); - $results[$category->id] = $category; + $results[] = $category; } $this->close(); diff --git a/api/index.php b/api/index.php index fbe12a8b..25b77ee3 100644 --- a/api/index.php +++ b/api/index.php @@ -187,7 +187,7 @@ Link::before('globalBefore'); Link::all(array( // Categories - '/v1/categories/all' => action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET]), + '/v1/categories/all' => action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), '/v1/categories' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::POST]), '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE]), // Tickets diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js new file mode 100644 index 00000000..d826c295 --- /dev/null +++ b/internal-api/js/manage-categories.js @@ -0,0 +1,105 @@ +var categories = []; + +$(document).ready(function() { + loadTable(); +}); + + +function loadTable() { + $('#overlay').show(); + var heskUrl = $('p#hesk-path').text(); + var $tableBody = $('#table-body'); + + $.ajax({ + method: 'GET', + url: heskUrl + 'api/index.php/v1/categories/all', + headers: { 'X-Internal-Call': true }, + success: function(data) { + $tableBody.html(''); + elements = []; + + if (data.length === 0) { + mfhAlert.error("I couldn't find any categories :(", "No categories found"); + $('#overlay').hide(); + return; + } + + var sortedElements = []; + + $.each(data, function() { + + }); + + var currentPlace = 0; + var addedElementToPlace = false; + var first = true; + var lastElement = null; + $.each(data, function() { + if (this.place !== currentPlace) { + if (lastElement !== null) { + //-- Hide the down arrow on the last element + $('[data-value="' + lastElement.id + '"]').parent().parent() + .find('[data-direction="down"]').css('visibility', 'hidden'); + lastElement = null; + } + + $('#table-body').append(''); + currentPlace = this.place; + addedElementToPlace = false; + first = true; + } + + var $template = $($('#nav-element-template').html()); + + $template.find('span[data-property="id"]').text(this.id).attr('data-value', this.id); + if (this.imageUrl === null) { + $template.find('span[data-property="image-or-font"]').html(''); + } else { + $template.find('span[data-property="image-or-font"]').text(this.imageUrl); + } + + $template.find('span[data-property="url"]').text(this.url); + + var text = ''; + $.each(this.text, function(key, value) { + text += '
  • ' + escape(key) + ': ' + escape(value) + '
  • '; + }); + $template.find('ul[data-property="text"]').html(text); + + var subtext = '-'; + if (this.place === 1) { + subtext = ''; + $.each(this.subtext, function(key, value) { + subtext += '
  • ' + escape(key) + ': ' + escape(value) + '
  • '; + }); + } + $template.find('ul[data-property="subtext"]').html(subtext); + + if (first) { + $template.find('[data-direction="up"]').css('visibility', 'hidden'); + first = false; + } + + $tableBody.append($template); + + elements[this.id] = this; + + addedElementToPlace = true; + lastElement = this; + }); + + if (lastElement) { + //-- Hide the down arrow on the last element + $('[data-value="' + lastElement.id + '"]').parent().parent() + .find('[data-direction="down"]').css('visibility', 'hidden'); + } + }, + error: function(data) { + mfhAlert.errorWithLog(mfhLang.text('failed_to_load_custom_nav_elements'), data.responseJSON); + console.error(data); + }, + complete: function() { + $('#overlay').hide(); + } + }); +} \ No newline at end of file From 7fb7a8bec479955a62db746876f90db27b3c2028 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 22 Aug 2017 22:03:11 -0400 Subject: [PATCH 011/130] Table being loaded. Need to handle proper name display though --- admin/manage_categories.php | 64 ++++++++++++++++++++-- internal-api/js/manage-categories.js | 80 ++++++++++++---------------- 2 files changed, 93 insertions(+), 51 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 725178ac..32c7b4a6 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -271,13 +271,12 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix'])
    ' + places[this.place] + '
    - + - @@ -631,9 +630,66 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) }); }); - +'); - currentPlace = this.place; - addedElementToPlace = false; - first = true; - } - - var $template = $($('#nav-element-template').html()); + var $template = $($('#category-row-template').html()); $template.find('span[data-property="id"]').text(this.id).attr('data-value', this.id); - if (this.imageUrl === null) { - $template.find('span[data-property="image-or-font"]').html(''); + $template.find('span[data-property="category-name"]').text(this.name); + var $priority = $template.find('span[data-property="priority"]'); + if (this.priority === 0) { + // Critical + $priority.text(mfhLang.text('critical')).addClass('critical'); + } else if (this.priority === 1) { + // High + $priority.text(mfhLang.text('high')).addClass('important'); + } else if (this.priority === 2) { + // Medium + $priority.text(mfhLang.text('medium')).addClass('medium'); } else { - $template.find('span[data-property="image-or-font"]').text(this.imageUrl); + // Low + $priority.text(mfhLang.text('low')).addClass('normal'); } - - $template.find('span[data-property="url"]').text(this.url); - - var text = ''; - $.each(this.text, function(key, value) { - text += '
  • ' + escape(key) + ': ' + escape(value) + '
  • '; - }); - $template.find('ul[data-property="text"]').html(text); - - var subtext = '-'; - if (this.place === 1) { - subtext = ''; - $.each(this.subtext, function(key, value) { - subtext += '
  • ' + escape(key) + ': ' + escape(value) + '
  • '; - }); + $template.find('a[data-property="number-of-tickets"]') + .text(this.numberOfTickets) + .attr('href', '#' + this.numberOfTickets); + var percentText = mfhLang.text('perat'); + var percentage = Math.round(this.numberOfTickets / totalNumberOfTickets * 100); + $template.find('div.progress').attr('title', percentText.replace('%s', percentage + '%')); + $template.find('div.progress-bar').attr('aria-value-now', percentage).css('width', percentage + '%'); + + if (this.usage === 1) { + // Tickets only + $template.find('.fa-calendar').removeClass('fa-calendar'); + } else if (this.usage === 2) { + // Events only + $template.find('.fa-ticket').removeClass('fa-ticket'); } - $template.find('ul[data-property="subtext"]').html(subtext); - if (first) { - $template.find('[data-direction="up"]').css('visibility', 'hidden'); - first = false; - } + // TODO Action buttons $tableBody.append($template); - elements[this.id] = this; + categories[this.id] = this; - addedElementToPlace = true; lastElement = this; }); @@ -95,7 +81,7 @@ function loadTable() { } }, error: function(data) { - mfhAlert.errorWithLog(mfhLang.text('failed_to_load_custom_nav_elements'), data.responseJSON); + mfhAlert.errorWithLog(mfhLang.text('Something bad happened...'), data.responseJSON); console.error(data); }, complete: function() { From 60301f4aabe57663848e4d7408a7b251ca302325 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 22 Aug 2017 22:06:42 -0400 Subject: [PATCH 012/130] Hide the up arrow for the top-most element --- internal-api/js/manage-categories.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index 8364e57e..8cfe46b7 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -72,6 +72,11 @@ function loadTable() { categories[this.id] = this; lastElement = this; + + if (first) { + $template.find('[data-direction="up"]').css('visibility', 'hidden'); + first = false; + } }); if (lastElement) { From aa307e6b15d742ccd8a7dc767e0c91ff3ed795be Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 23 Aug 2017 22:00:30 -0400 Subject: [PATCH 013/130] Some more category changes --- admin/manage_categories.php | 111 +++++-------------------- internal-api/js/manage-categories.js | 120 ++++++++++++++++++++++++++- 2 files changed, 137 insertions(+), 94 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 32c7b4a6..f945efab 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -445,13 +445,16 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) - - + @@ -474,6 +475,11 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) + + @@ -480,6 +481,10 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) +
    ' + places[this.place] + '
    + + + + @@ -499,9 +505,6 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) - - - diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index c660e747..30d7c93b 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -93,16 +93,14 @@ function loadTable() { if (this.type === 1) { // Private - $template.find('[data-property="type-link"]').attr('href', '#private') - .find('i').addClass('fa-lock').attr('title', mfhLang.text('cat_private')).addClass('gray'); - $template.find('.generate-link-group').find('i.fa-ban'); + $template.find('[data-property="type"]').text(mfhLang.text('cat_private')); + $template.find('.fa-lock').show(); $template.find('.generate-link-group').find('a').hide(); } else { // Public - $template.find('[data-property="type-link"]').attr('href', '#public') - .find('i').addClass('fa-unlock-alt').attr('title', mfhLang.text('cat_public')).addClass('blue'); + $template.find('[data-property="type"]').text(mfhLang.text('cat_public')); + $template.find('.fa-unlock-alt').show(); $template.find('.generate-link-group').find('i.fa-ban').hide(); - $template.find('.generate-link-group').find('a'); } $tableBody.append($template); From 499b604cc36f03930a10655575e3bc220fb8ed2b Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 31 Aug 2017 22:09:56 -0400 Subject: [PATCH 019/130] Some more changes --- admin/manage_categories.php | 19 +++++++++++-------- internal-api/js/manage-categories.js | 18 ++++++++++++------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 6802c366..7ca3e40a 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -272,6 +272,7 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) + + + @@ -495,16 +500,10 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) - + - - - - @@ -542,6 +541,10 @@ echo mfh_get_hidden_fields_for_language(array( 'cat_public', 'cat_removed', 'error_deleting_category', + 'enabled_title_case', + 'disabled_title_case', + 'geco', + 'cpric', )); require_once(HESK_PATH . 'inc/footer.inc.php'); diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index 30d7c93b..53e0c5a5 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -84,23 +84,29 @@ function loadTable() { } if (this.autoAssign) { - $template.find('[data-property="autoassign-link"]').attr('href', '#on') - .find('i').attr('title', mfhLang.text('aaon')).addClass('orange'); + $template.find('.fa-bolt').addClass('orange'); + $template.find('[data-property="autoassign"]').text(mfhLang.text('enabled_title_case')); } else { - $template.find('[data-property="autoassign-link"]').attr('href', '#off') - .find('i').attr('title', mfhLang.text('aaoff')).addClass('gray'); + $template.find('.fa-bolt').addClass('gray'); + $template.find('[data-property="autoassign"]').text(mfhLang.text('disabled_title_case')); } if (this.type === 1) { // Private $template.find('[data-property="type"]').text(mfhLang.text('cat_private')); $template.find('.fa-lock').show(); - $template.find('.generate-link-group').find('a').hide(); + $template.find('[data-property="generate-link"]').find('i') + .addClass('fa-ban') + .addClass('red') + .attr('title', mfhLang.text('cpric')); } else { // Public $template.find('[data-property="type"]').text(mfhLang.text('cat_public')); $template.find('.fa-unlock-alt').show(); - $template.find('.generate-link-group').find('i.fa-ban').hide(); + $template.find('[data-property="generate-link"]').find('i') + .addClass('fa-code') + .addClass('green') + .attr('title', mfhLang.text('geco')); } $tableBody.append($template); From 2238a52c4098097c3aaee0fb5c72e0940b192892 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 1 Sep 2017 21:54:37 -0400 Subject: [PATCH 020/130] Add generate link modal --- admin/manage_categories.php | 143 ++++++++------------------- css/mods-for-hesk-new.css | 9 ++ inc/headerAdmin.inc.php | 2 + internal-api/js/manage-categories.js | 23 ++++- js/clipboard.min.js | 9 ++ 5 files changed, 83 insertions(+), 103 deletions(-) create mode 100644 js/clipboard.min.js diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 7ca3e40a..f2fe07d6 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -469,6 +469,43 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) + + " class=" fixed js"> + diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index 53e0c5a5..6157e3f4 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -7,6 +7,7 @@ $(document).ready(function() { bindFormSubmit(); bindDeleteButton(); bindCreateModal(); + bindGenerateLinkModal(); }); @@ -73,7 +74,9 @@ function loadTable() { $template.find('div.progress').attr('title', percentText.replace('%s', percentage + '%')); $template.find('div.progress-bar').attr('aria-value-now', percentage).css('width', percentage + '%'); - $template.find('[data-property="generate-link"]').find('i').attr('title', mfhLang.text('geco')); + $template.find('[data-property="generate-link"]') + .attr('data-category-id', this.id) + .find('i').attr('title', mfhLang.text('geco')); if (this.usage === 1) { // Tickets only @@ -318,4 +321,22 @@ function bindDeleteButton() { } }); }); +} + +function bindGenerateLinkModal() { + $(document).on('click', '[data-property="generate-link"] i.fa-code', function () { + + var $modal = $('#generate-link-modal'); + + var heskUrl = $('p#hesk-url').text(); + + var url = heskUrl + '/index.php?a=add&catid=' + $(this).parent().data('category-id'); + + $modal.find('input[type="text"]').val(url).end() + .find('.input-group-addon').click(function() { + clipboard.copy($modal.find('input[type="text"]').val()); + mfhAlert.success('Copied to clipboard', 'Success'); + }).end() + .modal('show'); + }); } \ No newline at end of file diff --git a/js/clipboard.min.js b/js/clipboard.min.js new file mode 100644 index 00000000..0f4ca9a5 --- /dev/null +++ b/js/clipboard.min.js @@ -0,0 +1,9 @@ +(function(e,c){"undefined"!==typeof module?module.exports=c():"function"===typeof define&&"object"===typeof define.amd?define(c):this[e]=c()})("clipboard",function(){if("undefined"===typeof document||!document.addEventListener)return null;var e={};e.copy=function(){function c(){d=!1;b=null;g&&window.getSelection().removeAllRanges();g=!1}var d=!1,b=null,g=!1;document.addEventListener("copy",function(c){if(d){for(var g in b)c.clipboardData.setData(g,b[g]);c.preventDefault()}});return function(f){return new Promise(function(m, +e){function k(b){try{if(document.execCommand("copy"))c(),m();else{if(b)throw c(),Error("Unable to copy. Perhaps it's not available in your browser?");var d=document.getSelection();if(!document.queryCommandEnabled("copy")&&d.isCollapsed){var f=document.createRange();f.selectNodeContents(document.body);d.removeAllRanges();d.addRange(f);g=!0}k(!0)}}catch(a){c(),e(a)}}d=!0;"string"===typeof f?b={"text/plain":f}:f instanceof Node?b={"text/html":(new XMLSerializer).serializeToString(f)}:f instanceof Object? +b=f:e("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings.");k(!1)})}}();e.paste=function(){var c=!1,d,b;document.addEventListener("paste",function(g){if(c){c=!1;g.preventDefault();var f=d;d=null;f(g.clipboardData.getData(b))}});return function(g){return new Promise(function(f,e){c=!0;d=f;b=g||"text/plain";try{document.execCommand("paste")||(c=!1,e(Error("Unable to paste. Pasting only works in Internet Explorer at the moment.")))}catch(h){c=!1,e(Error(h))}})}}(); +"undefined"===typeof ClipboardEvent&&"undefined"!==typeof window.clipboardData&&"undefined"!==typeof window.clipboardData.setData&&(function(c){function d(a,b){return function(){a.apply(b,arguments)}}function b(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._value=this._state=null;this._deferreds=[];l(a,d(f,this),d(e,this))}function g(a){var b=this;return null===this._state?void this._deferreds.push(a): +void n(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function f(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var b=a.then;if("function"==typeof b)return void l(d(b,a),d(f,this),d(e,this))}this._state=!0;this._value=a;h.call(this)}catch(c){e.call(this,c)}}function e(a){this._state= +!1;this._value=a;h.call(this)}function h(){for(var a=0,b=this._deferreds.length;b>a;a++)g.call(this,this._deferreds[a]);this._deferreds=null}function k(a,b,c,d){this.onFulfilled="function"==typeof a?a:null;this.onRejected="function"==typeof b?b:null;this.resolve=c;this.reject=d}function l(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){d||(d=!0,c(e))}}var n=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},p=Array.isArray|| +function(a){return"[object Array]"===Object.prototype.toString.call(a)};b.prototype["catch"]=function(a){return this.then(null,a)};b.prototype.then=function(a,c){var d=this;return new b(function(b,e){g.call(d,new k(a,c,b,e))})};b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&p(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f, +a)},c)}a[f]=g;0===--e&&b(a)}catch(k){c(k)}}if(0===a.length)return b([]);for(var e=a.length,f=0;fd;d++)a[d].then(b,c)})};"undefined"!=typeof module&&module.exports?module.exports=b:c.Promise||(c.Promise=b)}(this),e.copy=function(c){return new Promise(function(d, +b){if("string"!==typeof c&&!("text/plain"in c))throw Error("You must provide a text/plain type.");window.clipboardData.setData("Text","string"===typeof c?c:c["text/plain"])?d():b(Error("Copying was rejected."))})},e.paste=function(){return new Promise(function(c,d){var b=window.clipboardData.getData("Text");b?c(b):d(Error("Pasting was rejected."))})});return e}); From 29f1eb35033266957e66558f82285589028c66e9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 1 Sep 2017 22:08:40 -0400 Subject: [PATCH 021/130] Fixed up editing/creating --- admin/manage_categories.php | 22 +++++++++++++++------- internal-api/js/manage-categories.js | 26 +++++++++++++------------- language/en/text.php | 1 + 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index f2fe07d6..a0757cf7 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -307,7 +307,7 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) + diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index 285dfec0..7b426270 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -51,6 +51,12 @@ function loadTable() { $nameField.css('border', 'solid 1px ' + this.foregroundColor); } $nameField.html(this.name); + + if (this.description === '' || this.description === null) { + $template.find('.fa-info-circle').hide(); + } else { + $template.find('.fa-info-circle').attr('data-content', this.description); + } var $priority = $template.find('span[data-property="priority"]'); if (this.priority === 0) { // Critical @@ -136,6 +142,10 @@ function loadTable() { }, complete: function() { refreshBackgroundVolatileItems(); + $('[data-toggle="popover"]').popover({ + trigger: 'hover', + container: 'body' + }); $('#overlay').hide(); } }); From 45726bd388fdf1a69db575f23f9e78dd8390c027 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 5 Sep 2017 13:06:56 -0400 Subject: [PATCH 023/130] Categories can be sorted --- admin/manage_categories.php | 233 ------------------ .../Categories/CategoryHandler.php | 27 ++ .../Categories/CategoryController.php | 9 + api/index.php | 1 + internal-api/js/manage-categories.js | 24 ++ language/en/text.php | 1 + 6 files changed, 62 insertions(+), 233 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 30b89afa..0acb4d09 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -445,237 +445,4 @@ echo mfh_get_hidden_fields_for_language(array( require_once(HESK_PATH . 'inc/footer.inc.php'); exit(); - -function new_cat() -{ - global $hesk_settings, $hesklang; - - /* A security check */ - hesk_token_check('POST'); - - /* Options */ - $_SESSION['cat_autoassign'] = hesk_POST('autoassign') == 'Y' ? 1 : 0; - $_SESSION['cat_type'] = hesk_POST('type') == 'Y' ? 1 : 0; - - // Default priority - $_SESSION['cat_priority'] = intval(hesk_POST('priority', 3)); - if ($_SESSION['cat_priority'] < 0 || $_SESSION['cat_priority'] > 3) { - $_SESSION['cat_priority'] = 3; - } - - /* Category name */ - $catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php'); - - $background_color = hesk_POST('background-color', '#ffffff'); - $foreground_color = hesk_POST('foreground-color', '#000000'); - $display_border = hesk_POST('display-border', 0); - if ($foreground_color == '') { - $foreground_color = 'AUTO'; - $display_border = 0; - } - - $usage = hesk_POST('usage', 0); - - /* Do we already have a category with this name? */ - $res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `name` LIKE '" . hesk_dbEscape(hesk_dbLike($catname)) . "' LIMIT 1"); - if (hesk_dbNumRows($res) != 0) { - $_SESSION['catname'] = $catname; - hesk_process_messages($hesklang['cndupl'], 'manage_categories.php'); - } - - /* Get the latest cat_order */ - $res = hesk_dbQuery("SELECT `cat_order` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `cat_order` DESC LIMIT 1"); - $row = hesk_dbFetchRow($res); - $my_order = $row[0] + 10; - - hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` - (`name`,`cat_order`,`autoassign`,`type`, `priority`, `background_color`, `foreground_color`, `display_border_outline`, `usage`) VALUES - ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "', - '" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', '" . hesk_dbEscape($background_color) . "', - '" . hesk_dbEscape($foreground_color) . "', '" . intval($display_border) . "', " . intval($usage) . ")"); - - hesk_cleanSessionVars('catname'); - hesk_cleanSessionVars('cat_autoassign'); - hesk_cleanSessionVars('cat_type'); - hesk_cleanSessionVars('cat_priority'); - - $_SESSION['selcat2'] = hesk_dbInsertID(); - - hesk_process_messages(sprintf($hesklang['cat_name_added'], '' . stripslashes($catname) . ''), 'manage_categories.php', 'SUCCESS'); -} // End new_cat() - - -function update_category() -{ - global $hesk_settings, $hesklang; - - /* A security check */ - hesk_token_check('POST'); - - $_SERVER['PHP_SELF'] = 'manage_categories.php?catid=' . intval(hesk_POST('catid')); - - $catid = hesk_isNumber(hesk_POST('id'), $hesklang['choose_cat_ren'], $_SERVER['PHP_SELF']); - $_SESSION['selcat'] = $catid; - $_SESSION['selcat2'] = $catid; - - $catname = hesk_input(hesk_POST('name'), $hesklang['cat_ren_name'], $_SERVER['PHP_SELF']); - $_SESSION['catname2'] = $catname; - - $background_color = hesk_POST('background-color', '#ffffff'); - $foreground_color = hesk_POST('foreground-color', '#000000'); - $display_border = hesk_POST('display-border', 0); - if ($foreground_color == '') { - $foreground_color = 'AUTO'; - $display_border = 0; - } - $manager = hesk_POST('manager', 0); - $priority = hesk_POST('priority', 0); - $usage = hesk_POST('usage', 0); - - - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `name`='" . hesk_dbEscape($catname) . "', - `priority` = '" . hesk_dbEscape($priority) . "', - `manager` = " . intval($manager) . ", - `background_color` = '" . hesk_dbEscape($background_color) . "', - `foreground_color` = '" . hesk_dbEscape($foreground_color) . "', - `display_border_outline` = '" . intval($display_border) . "', - `usage` = " . intval($usage) . " - WHERE `id`='" . intval($catid) . "'"); - - unset($_SESSION['selcat']); - unset($_SESSION['catname2']); - - hesk_process_messages(sprintf($hesklang['category_updated'], stripslashes($catname)), $_SERVER['PHP_SELF'], 'SUCCESS'); -} // End rename_cat() - - -function remove() -{ - global $hesk_settings, $hesklang; - - /* A security check */ - hesk_token_check(); - - $_SERVER['PHP_SELF'] = 'manage_categories.php'; - - $mycat = intval(hesk_GET('catid')) or hesk_error($hesklang['no_cat_id']); - if ($mycat == 1) { - hesk_process_messages($hesklang['cant_del_default_cat'], $_SERVER['PHP_SELF']); - } - - hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='" . intval($mycat) . "'"); - if (hesk_dbAffectedRows() != 1) { - hesk_error("$hesklang[int_error]: $hesklang[cat_not_found]."); - } - - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `category`=1 WHERE `category`='" . intval($mycat) . "'"); - - hesk_process_messages($hesklang['cat_removed_db'], $_SERVER['PHP_SELF'], 'SUCCESS'); -} // End remove() - - -function order_cat() -{ - global $hesk_settings, $hesklang; - - /* A security check */ - hesk_token_check(); - - $catid = intval(hesk_GET('catid')) or hesk_error($hesklang['cat_move_id']); - $_SESSION['selcat2'] = $catid; - - $cat_move = intval(hesk_GET('move')); - - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `cat_order`=`cat_order`+" . intval($cat_move) . " WHERE `id`='" . intval($catid) . "'"); - if (hesk_dbAffectedRows() != 1) { - hesk_error("$hesklang[int_error]: $hesklang[cat_not_found]."); - } - - /* Update all category fields with new order */ - $res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `cat_order` ASC"); - - $i = 10; - while ($mycat = hesk_dbFetchAssoc($res)) { - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `cat_order`=" . intval($i) . " WHERE `id`='" . intval($mycat['id']) . "'"); - $i += 10; - } - - header('Location: manage_categories.php'); - exit(); -} // End order_cat() - - -function toggle_autoassign() -{ - global $hesk_settings, $hesklang; - - /* A security check */ - hesk_token_check(); - - $catid = intval(hesk_GET('catid')) or hesk_error($hesklang['cat_move_id']); - $_SESSION['selcat2'] = $catid; - - if (intval(hesk_GET('s'))) { - $autoassign = 1; - $tmp = $hesklang['caaon']; - } else { - $autoassign = 0; - $tmp = $hesklang['caaoff']; - } - - /* Update auto-assign settings */ - $res = hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `autoassign`='" . intval($autoassign) . "' WHERE `id`='" . intval($catid) . "'"); - if (hesk_dbAffectedRows() != 1) { - hesk_process_messages($hesklang['int_error'] . ': ' . $hesklang['cat_not_found'], './manage_categories.php'); - } - - hesk_process_messages($tmp, './manage_categories.php', 'SUCCESS'); - -} // End toggle_autoassign() - - -function toggle_type() -{ - global $hesk_settings, $hesklang; - - /* A security check */ - hesk_token_check(); - - $catid = intval(hesk_GET('catid')) or hesk_error($hesklang['cat_move_id']); - $_SESSION['selcat2'] = $catid; - - if (intval(hesk_GET('s'))) { - $type = 1; - $tmp = $hesklang['cpriv']; - } else { - $type = 0; - $tmp = $hesklang['cpub']; - } - - /* Update auto-assign settings */ - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `type`='{$type}' WHERE `id`='" . intval($catid) . "'"); - if (hesk_dbAffectedRows() != 1) { - hesk_process_messages($hesklang['int_error'] . ': ' . $hesklang['cat_not_found'], './manage_categories.php'); - } - - hesk_process_messages($tmp, './manage_categories.php', 'SUCCESS'); - -} // End toggle_type() - -function get_manager($user_id, $user_array) { - global $hesklang; - - if ($user_id == 0) { - return $hesklang['no_manager']; - } - - foreach ($user_array as $user) { - if ($user['id'] == $user_id) { - return $user['name']; - } - } - - return 'Error!'; -} - ?> diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 87020fe1..2df16882 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -5,6 +5,7 @@ namespace BusinessLogic\Categories; use BusinessLogic\Exceptions\AccessViolationException; use BusinessLogic\Exceptions\ValidationException; +use BusinessLogic\Navigation\Direction; use BusinessLogic\Security\PermissionChecker; use BusinessLogic\Security\UserPrivilege; use BusinessLogic\ValidationModel; @@ -151,4 +152,30 @@ class CategoryHandler { $this->categoryGateway->deleteCategory($id, $heskSettings); $this->categoryGateway->resortAllCategories($heskSettings); } + + function sortCategory($id, $direction, $heskSettings) { + $modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings); + + $categories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings); + $category = null; + foreach ($categories as $innerCategory) { + if ($innerCategory->id === intval($id)) { + $category = $innerCategory; + break; + } + } + + if ($category === null) { + throw new \Exception("Could not find category with ID {$id}!"); + } + + if ($direction === Direction::UP) { + $category->catOrder -= 15; + } else { + $category->catOrder += 15; + } + + $this->categoryGateway->updateCategory($category, $heskSettings); + $this->categoryGateway->resortAllCategories($heskSettings); + } } \ No newline at end of file diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index 902f7250..8daa326f 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -98,4 +98,13 @@ class CategoryController { return http_response_code(204); } + + static function sort($id, $direction) { + global $applicationContext, $hesk_settings; + + /* @var $handler CategoryHandler */ + $handler = $applicationContext->get[CategoryHandler::class]; + + $handler->sortCategory(intval($id), $direction, $hesk_settings); + } } \ No newline at end of file diff --git a/api/index.php b/api/index.php index ffaf590d..05dba913 100644 --- a/api/index.php +++ b/api/index.php @@ -190,6 +190,7 @@ Link::all(array( '/v1/categories/all' => action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), '/v1/categories' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::POST], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), + '/v1-internal/categories/{i}/sort/{s}' => action(\Controllers\Categories\CategoryController::class . '::sort', [RequestMethod::POST], SecurityHandler::INTERNAL), // Tickets '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::class), // Tickets - Staff diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index 7b426270..767be236 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -8,6 +8,7 @@ $(document).ready(function() { bindDeleteButton(); bindCreateModal(); bindGenerateLinkModal(); + bindSortButtons(); }); @@ -349,4 +350,27 @@ function bindGenerateLinkModal() { $modal.find('input[type="text"]').val(url).end().modal('show'); }); +} + +function bindSortButtons() { + $(document).on('click', '[data-action="sort"]', function() { + $('#overlay').show(); + var heskUrl = $('p#hesk-path').text(); + var direction = $(this).data('direction'); + var element = categories[$(this).parent().parent().parent().find('[data-property="id"]').text()]; + + $.ajax({ + method: 'POST', + url: heskUrl + 'api/index.php/v1-internal/categories/' + element.id + '/sort/' + direction, + headers: { 'X-Internal-Call': true }, + success: function() { + loadTable(); + }, + error: function(data) { + mfhAlert.errorWithLog(mfhLang.text('error_sorting_categories'), data.responseJSON); + console.error(data); + $('#overlay').hide(); + } + }) + }); } \ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index fab88193..a58ba6fe 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -2177,6 +2177,7 @@ $hesklang['error_deleting_category'] = 'An error occurred when trying to delete $hesklang['cat_private'] = 'Private'; $hesklang['cat_public'] = 'Public'; $hesklang['cat_name_description'] = 'Name / Description'; +$hesklang['error_sorting_categories'] = 'An error occurred sorting categories!'; // DO NOT CHANGE BELOW if (!defined('IN_SCRIPT')) die('PHP syntax OK!'); From 02d965e2d91da2161851a6f52f086bae335cb20d Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 5 Sep 2017 22:20:57 -0400 Subject: [PATCH 024/130] Localized some stuff, add descriptions to create ticket pages --- admin/manage_categories.php | 9 ++++- admin/new_ticket.php | 50 +++++++++++++++++++----- index.php | 47 ++++++++++++++++++---- install/mods-for-hesk/sql/installSql.php | 10 +++++ internal-api/js/lang.js | 3 ++ internal-api/js/manage-categories.js | 15 ++++--- language/en/text.php | 4 ++ 7 files changed, 112 insertions(+), 26 deletions(-) diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 0acb4d09..6ddce2d4 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -375,8 +375,8 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) - - + + @@ -437,6 +437,11 @@ echo mfh_get_hidden_fields_for_language(array( 'cat_public', 'cat_removed', 'error_deleting_category', + 'error_retrieving_categories', + 'error_saving_updating_category', + 'copied_to_clipboard', + 'category_updated', + 'cat_name_added', 'enabled_title_case', 'disabled_title_case', 'geco', diff --git a/admin/new_ticket.php b/admin/new_ticket.php index 9233b35b..e831ec15 100644 --- a/admin/new_ticket.php +++ b/admin/new_ticket.php @@ -113,13 +113,13 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); $hesk_settings['categories'] = array(); if (hesk_checkPermission('can_submit_any_cat', 0)) { - $res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC"); + $res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC"); } else { - $res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC"); + $res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC"); } while ($row = hesk_dbFetchAssoc($res)) { - $hesk_settings['categories'][$row['id']] = $row['name']; + $hesk_settings['categories'][$row['id']] = $row; } $number_of_categories = count($hesk_settings['categories']); @@ -147,7 +147,7 @@ $show_quick_help = $show['show'];
  • 1): ?>
  • -
  • +
  • @@ -1038,9 +1038,10 @@ function print_select_category($number_of_categories) { // Print a select box if number of categories is large if ($number_of_categories > $hesk_settings['cat_show_select']) { + $firstDescription = null; ?> - $v) { - echo ''; + if ($firstDescription === null) { + $firstDescription = $v['mfh_description']; + } + echo ''; } ?> + - + if (!$hesk_settings['select_cat'] && $firstDescription !== null && trim($firstDescription) !== '') { + $display = ''; + } + ?> + > + + + +
    + » '.$v.''; $new_row = 1; foreach ($hesk_settings['categories'] as $k=>$v): @@ -1079,7 +1102,14 @@ function print_select_category($number_of_categories) {
    - + '; + } + ?>
    diff --git a/index.php b/index.php index 61eba1f7..8ab81bd9 100644 --- a/index.php +++ b/index.php @@ -87,9 +87,10 @@ function print_select_category($number_of_categories) // Print a select box if number of categories is large if ($number_of_categories > $hesk_settings['cat_show_select']) { + $firstDescription = null; ?>
    - $v) { - echo ''; + if ($firstDescription === null) { + $firstDescription = $v['mfh_description']; + } + echo ''; } ?> + - + if (!$hesk_settings['select_cat'] && $firstDescription !== null && trim($firstDescription) !== '') { + $display = ''; + } + ?> + > + + + +
    +
    - + '; + } + ?>
    @@ -220,9 +251,9 @@ function print_add_ticket() // Get categories $hesk_settings['categories'] = array(); - $res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE `type`='0' ORDER BY `cat_order` ASC"); + $res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE `type`='0' ORDER BY `cat_order` ASC"); while ($row=hesk_dbFetchAssoc($res)) { - $hesk_settings['categories'][$row['id']] = $row['name']; + $hesk_settings['categories'][$row['id']] = $row; } $number_of_categories = count($hesk_settings['categories']); @@ -254,7 +285,7 @@ function print_add_ticket() -
  • +
  • diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 2970c923..c8922f46 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -1130,4 +1130,14 @@ function execute311Scripts() { hesk_dbConnect(); updateVersion('3.1.1'); +} + +function execute320Scripts() { + global $hesk_settings; + hesk_dbConnect(); + + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` + ADD COLUMN `mfh_description` VARCHAR(255)"); + + updateVersion('3.2.0'); } \ No newline at end of file diff --git a/internal-api/js/lang.js b/internal-api/js/lang.js index d0f232cc..c87c5184 100644 --- a/internal-api/js/lang.js +++ b/internal-api/js/lang.js @@ -1,5 +1,8 @@ var mfhLang = { text: function(key) { return $('#lang_' + key).text(); + }, + html: function(key) { + return $('#lang_' + key).html() } }; \ No newline at end of file diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index 767be236..521198d8 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -25,7 +25,7 @@ function loadTable() { $tableBody.html(''); if (data.length === 0) { - mfhAlert.error("I couldn't find any categories :(", "No categories found"); + mfhAlert.error("No categories were found. This shouldn't happen.", "No categories found"); $('#overlay').hide(); return; } @@ -138,7 +138,7 @@ function loadTable() { } }, error: function(data) { - mfhAlert.errorWithLog(mfhLang.text('Something bad happened...'), data.responseJSON); + mfhAlert.errorWithLog(mfhLang.text('error_retrieving_categories'), data.responseJSON); console.error(data); }, complete: function() { @@ -288,16 +288,19 @@ function bindFormSubmit() { }, data: JSON.stringify(data), success: function(data) { + var format = undefined; if (categoryId === -1) { - mfhAlert.success('CREATED'); + format = mfhLang.html('cat_name_added'); + mfhAlert.success(format.replace('%s', data.name)); } else { - mfhAlert.success('SAVED'); + format = mfhLang.html('category_updated'); + mfhAlert.success(format.replace('%s', data.name)); } $modal.modal('hide'); loadTable(); }, error: function(data) { - mfhAlert.errorWithLog('ERROR SAVING/CREATING', data.responseJSON); + mfhAlert.errorWithLog(mfhLang.text('error_saving_updating_category'), data.responseJSON); console.error(data); }, complete: function(data) { @@ -340,7 +343,7 @@ function bindGenerateLinkModal() { $modal.find('.input-group-addon').click(function() { clipboard.copy($modal.find('input[type="text"]').val()); - mfhAlert.success('Copied to clipboard', 'Success'); + mfhAlert.success(mfhLang.text('copied_to_clipboard')); }); $(document).on('click', '[data-property="generate-link"] i.fa-code', function () { diff --git a/language/en/text.php b/language/en/text.php index a58ba6fe..743ed201 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -2178,6 +2178,10 @@ $hesklang['cat_private'] = 'Private'; $hesklang['cat_public'] = 'Public'; $hesklang['cat_name_description'] = 'Name / Description'; $hesklang['error_sorting_categories'] = 'An error occurred sorting categories!'; +$hesklang['error_retrieving_categories'] = 'An error occurred retrieving categories!'; +$hesklang['error_saving_updating_category'] = 'An error occurred creating / saving the category!'; +$hesklang['description_colon'] = 'Description:'; // Same as 'description', but with a colon (:) afterwards +$hesklang['copied_to_clipboard'] = 'Copied to clipboard'; // DO NOT CHANGE BELOW if (!defined('IN_SCRIPT')) die('PHP syntax OK!'); From 5caac8452e9630e273cc4f1df5a99f3a700a25aa Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 6 Sep 2017 07:54:33 -0400 Subject: [PATCH 025/130] Don't allow category 1 to be deleted --- api/ApplicationContext.php | 71 ++++++------------- .../Categories/CategoryHandler.php | 12 +++- api/DataAccess/Tickets/TicketGateway.php | 10 +++ internal-api/js/manage-categories.js | 4 ++ 4 files changed, 48 insertions(+), 49 deletions(-) diff --git a/api/ApplicationContext.php b/api/ApplicationContext.php index 40f8d002..8dbb6079 100644 --- a/api/ApplicationContext.php +++ b/api/ApplicationContext.php @@ -51,66 +51,51 @@ class ApplicationContext { function __construct() { $this->get = array(); - // Permissions $this->get[PermissionChecker::class] = new PermissionChecker(); - - // Settings $this->get[ModsForHeskSettingsGateway::class] = new ModsForHeskSettingsGateway(); - - // API Checker - $this->get[ApiChecker::class] = new ApiChecker($this->get[ModsForHeskSettingsGateway::class]); - - // Custom Navigation $this->get[CustomNavElementGateway::class] = new CustomNavElementGateway(); - $this->get[CustomNavElementHandler::class] = new CustomNavElementHandler($this->get[CustomNavElementGateway::class]); - - // Logging $this->get[LoggingGateway::class] = new LoggingGateway(); - - // Verified Email Checker $this->get[VerifiedEmailGateway::class] = new VerifiedEmailGateway(); - $this->get[VerifiedEmailChecker::class] = new VerifiedEmailChecker($this->get[VerifiedEmailGateway::class]); - - // Users $this->get[UserGateway::class] = new UserGateway(); - $this->get[UserContextBuilder::class] = new UserContextBuilder($this->get[UserGateway::class]); - - // Categories $this->get[CategoryGateway::class] = new CategoryGateway(); + $this->get[BanGateway::class] = new BanGateway(); + $this->get[StatusGateway::class] = new StatusGateway(); + $this->get[BasicEmailSender::class] = new BasicEmailSender(); + $this->get[MailgunEmailSender::class] = new MailgunEmailSender(); + $this->get[EmailTemplateRetriever::class] = new EmailTemplateRetriever(); + $this->get[TicketGateway::class] = new TicketGateway(); + $this->get[FileWriter::class] = new FileWriter(); + $this->get[FileReader::class] = new FileReader(); + $this->get[FileDeleter::class] = new FileDeleter(); + $this->get[AttachmentGateway::class] = new AttachmentGateway(); + + $this->get[ApiChecker::class] = new ApiChecker($this->get[ModsForHeskSettingsGateway::class]); + $this->get[CustomNavElementHandler::class] = new CustomNavElementHandler($this->get[CustomNavElementGateway::class]); + $this->get[VerifiedEmailChecker::class] = new VerifiedEmailChecker($this->get[VerifiedEmailGateway::class]); + $this->get[UserContextBuilder::class] = new UserContextBuilder($this->get[UserGateway::class]); + $this->get[BanRetriever::class] = new BanRetriever($this->get[BanGateway::class]); + $this->get[UserToTicketChecker::class] = new UserToTicketChecker($this->get[UserGateway::class]); + $this->get[StatusRetriever::class] = new StatusRetriever($this->get[StatusGateway::class]); + $this->get[SettingsRetriever::class] = new SettingsRetriever($this->get[ModsForHeskSettingsGateway::class]); + $this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]); + $this->get[TrackingIdGenerator::class] = new TrackingIdGenerator($this->get[TicketGateway::class]); + $this->get[Autoassigner::class] = new Autoassigner($this->get[CategoryGateway::class], $this->get[UserGateway::class]); $this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class], $this->get[ModsForHeskSettingsGateway::class]); $this->get[CategoryHandler::class] = new CategoryHandler( $this->get[CategoryGateway::class], + $this->get[TicketGateway::class], $this->get[PermissionChecker::class], $this->get[ModsForHeskSettingsGateway::class]); - - // Bans - $this->get[BanGateway::class] = new BanGateway(); - $this->get[BanRetriever::class] = new BanRetriever($this->get[BanGateway::class]); - - // Statuses - $this->get[StatusGateway::class] = new StatusGateway(); - - // Email Sender - $this->get[EmailTemplateRetriever::class] = new EmailTemplateRetriever(); $this->get[EmailTemplateParser::class] = new EmailTemplateParser($this->get[StatusGateway::class], $this->get[CategoryGateway::class], $this->get[UserGateway::class], $this->get[EmailTemplateRetriever::class]); - $this->get[BasicEmailSender::class] = new BasicEmailSender(); - $this->get[MailgunEmailSender::class] = new MailgunEmailSender(); $this->get[EmailSenderHelper::class] = new EmailSenderHelper($this->get[EmailTemplateParser::class], $this->get[BasicEmailSender::class], $this->get[MailgunEmailSender::class]); - - // Tickets - $this->get[UserToTicketChecker::class] = new UserToTicketChecker($this->get[UserGateway::class]); - $this->get[TicketGateway::class] = new TicketGateway(); $this->get[TicketRetriever::class] = new TicketRetriever($this->get[TicketGateway::class], $this->get[UserToTicketChecker::class]); - $this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]); - $this->get[TrackingIdGenerator::class] = new TrackingIdGenerator($this->get[TicketGateway::class]); - $this->get[Autoassigner::class] = new Autoassigner($this->get[CategoryGateway::class], $this->get[UserGateway::class]); $this->get[NewTicketValidator::class] = new NewTicketValidator($this->get[CategoryRetriever::class], $this->get[BanRetriever::class], $this->get[TicketValidators::class]); @@ -123,10 +108,6 @@ class ApplicationContext { $this->get[EmailSenderHelper::class], $this->get[UserGateway::class], $this->get[ModsForHeskSettingsGateway::class]); - $this->get[FileWriter::class] = new FileWriter(); - $this->get[FileReader::class] = new FileReader(); - $this->get[FileDeleter::class] = new FileDeleter(); - $this->get[AttachmentGateway::class] = new AttachmentGateway(); $this->get[AttachmentHandler::class] = new AttachmentHandler($this->get[TicketGateway::class], $this->get[AttachmentGateway::class], $this->get[FileWriter::class], @@ -142,11 +123,5 @@ class ApplicationContext { $this->get[AttachmentHandler::class]); $this->get[TicketEditor::class] = new TicketEditor($this->get[TicketGateway::class], $this->get[UserToTicketChecker::class]); - - // Statuses - $this->get[StatusRetriever::class] = new StatusRetriever($this->get[StatusGateway::class]); - - // Settings - $this->get[SettingsRetriever::class] = new SettingsRetriever($this->get[ModsForHeskSettingsGateway::class]); } } \ No newline at end of file diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 2df16882..8c6c42ca 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -11,19 +11,24 @@ use BusinessLogic\Security\UserPrivilege; use BusinessLogic\ValidationModel; use DataAccess\Categories\CategoryGateway; use DataAccess\Settings\ModsForHeskSettingsGateway; +use DataAccess\Tickets\TicketGateway; class CategoryHandler { /* @var $categoryGateway CategoryGateway */ private $categoryGateway; + /* @var $ticketGateway TicketGateway */ + private $ticketGateway; + /* @var $permissionChecker PermissionChecker */ private $permissionChecker; /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ private $modsForHeskSettingsGateway; - function __construct($categoryGateway, $permissionChecker, $modsForHeskSettingsGateway) { + function __construct($categoryGateway, $ticketGateway, $permissionChecker, $modsForHeskSettingsGateway) { $this->categoryGateway = $categoryGateway; + $this->ticketGateway = $ticketGateway; $this->permissionChecker = $permissionChecker; $this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway; } @@ -149,6 +154,11 @@ class CategoryHandler { throw new AccessViolationException('User cannot manage categories!'); } + if ($id === 1) { + throw new \Exception("Category 1 cannot be deleted!"); + } + + $this->ticketGateway->moveTicketsToDefaultCategory($id, $heskSettings); $this->categoryGateway->deleteCategory($id, $heskSettings); $this->categoryGateway->resortAllCategories($heskSettings); } diff --git a/api/DataAccess/Tickets/TicketGateway.php b/api/DataAccess/Tickets/TicketGateway.php index 1645618b..a14d623e 100644 --- a/api/DataAccess/Tickets/TicketGateway.php +++ b/api/DataAccess/Tickets/TicketGateway.php @@ -358,4 +358,14 @@ class TicketGateway extends CommonDao { $this->close(); } + + function moveTicketsToDefaultCategory($oldCategoryId, $heskSettings) { + $this->init(); + + hesk_dbQuery("UPDATE `" . hesk_dbEscape($heskSettings['db_pfix']) . "tickets` + SET `category` = 1 + WHERE `category` = " . intval($oldCategoryId)); + + $this->close(); + } } \ No newline at end of file diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index 521198d8..853e06e1 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -119,6 +119,10 @@ function loadTable() { .attr('title', mfhLang.text('geco')); } + if (this.id === 1) { + $template.find('[data-action="delete"]').hide(); + } + $tableBody.append($template); categories[this.id] = this; From f700addda5e760b2256bc88c5ed0a22ddf4061f1 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 6 Sep 2017 12:56:44 -0400 Subject: [PATCH 026/130] Update composer for php-di --- api/composer.json | 5 +- api/composer.lock | 2337 +++++++++++++++++++++++---------------------- 2 files changed, 1213 insertions(+), 1129 deletions(-) diff --git a/api/composer.json b/api/composer.json index f23ca66a..ba08aee6 100644 --- a/api/composer.json +++ b/api/composer.json @@ -10,7 +10,7 @@ } ], "require-dev": { - "phpunit/phpunit": "5.7.9" + "phpunit/phpunit": "6.3.0" }, "require": { "phpmailer/phpmailer": "^5.2", @@ -18,6 +18,7 @@ "php-http/guzzle6-adapter": "^1.1", "php-http/message": "^1.5", "php-http/curl-client": "^1.7", - "guzzlehttp/psr7": "^1.3" + "guzzlehttp/psr7": "^1.3", + "php-di/php-di": "4.4.10" } } diff --git a/api/composer.lock b/api/composer.lock index 7ac81d56..ec939825 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,25 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "266b9167ab52abc3c4a2514bf29491ed", + "content-hash": "d7d3d7ef4a481f28ec59f1218cbc9a1a", "packages": [ { "name": "clue/stream-filter", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/clue/php-stream-filter.git", - "reference": "e3bf9415da163d9ad6701dccb407ed501ae69785" + "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/e3bf9415da163d9ad6701dccb407ed501ae69785", - "reference": "e3bf9415da163d9ad6701dccb407ed501ae69785", + "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0", + "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0", "shasum": "" }, "require": { "php": ">=5.3" }, + "require-dev": { + "phpunit/phpunit": "^5.0 || ^4.8" + }, "type": "library", "autoload": { "psr-4": { @@ -53,7 +56,38 @@ "stream_filter_append", "stream_filter_register" ], - "time": "2015-11-08T23:41:30+00:00" + "time": "2017-08-18T09:54:01+00:00" + }, + { + "name": "container-interop/container-interop", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop", + "time": "2017-02-14T19:40:03+00:00" }, { "name": "doctrine/annotations", @@ -61,17 +95,17 @@ "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" + "reference": "2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", - "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e", + "reference": "2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { "doctrine/cache": "1.*", @@ -80,7 +114,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -121,7 +155,7 @@ "docblock", "parser" ], - "time": "2017-02-24 16:22:25" + "time": "2017-07-22 11:08:38" }, { "name": "doctrine/cache", @@ -129,28 +163,35 @@ "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "0da649fce4838f7a6121c501c9a86d4b8921b648" + "reference": "beb0fa35b61e9073f8612d9ffd34920bdaec406a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/0da649fce4838f7a6121c501c9a86d4b8921b648", - "reference": "0da649fce4838f7a6121c501c9a86d4b8921b648", + "url": "https://api.github.com/repos/doctrine/cache/zipball/beb0fa35b61e9073f8612d9ffd34920bdaec406a", + "reference": "beb0fa35b61e9073f8612d9ffd34920bdaec406a", "shasum": "" }, "require": { - "php": "~5.6|~7.0" + "php": "~7.1" }, "conflict": { "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "phpunit/phpunit": "^5.7", - "predis/predis": "~1.0" + "alcaeus/mongo-php-adapter": "^1.1", + "doctrine/coding-standard": "^1.0", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^6.3", + "predis/predis": "~1.0", + "squizlabs/php_codesniffer": "^3.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -190,38 +231,34 @@ "cache", "caching" ], - "time": "2017-03-06 14:38:51" + "time": "2017-08-25 06:51:37" }, { - "name": "doctrine/collections", - "version": "v1.4.0", + "name": "doctrine/lexer", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/doctrine/collections.git", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" + "url": "https://github.com/doctrine/lexer.git", + "reference": "cc709ba91eee09540091ad5a5f2616727662e41b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/cc709ba91eee09540091ad5a5f2616727662e41b", + "reference": "cc709ba91eee09540091ad5a5f2616727662e41b", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/coding-standard": "~0.1@dev", - "phpunit/phpunit": "^5.7" + "php": ">=5.3.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Collections\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } }, "notification-url": "https://packagist.org/downloads/", @@ -233,66 +270,62 @@ "name": "Roman Borschel", "email": "roman@code-factory.org" }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, { "name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com" }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com" } ], - "description": "Collections Abstraction library", + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", "homepage": "http://www.doctrine-project.org", "keywords": [ - "array", - "collections", - "iterator" + "lexer", + "parser" ], - "time": "2017-01-03T10:49:41+00:00" + "time": "2017-07-24 09:37:08" }, { - "name": "doctrine/common", - "version": "dev-master", + "name": "guzzlehttp/guzzle", + "version": "6.3.0", "source": { "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "4b434dbf8d204198dac708f2e938f7c805864dd6" + "url": "https://github.com/guzzle/guzzle.git", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/4b434dbf8d204198dac708f2e938f7c805864dd6", - "reference": "4b434dbf8d204198dac708f2e938f7c805864dd6", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "shasum": "" }, "require": { - "doctrine/annotations": "1.*", - "doctrine/cache": "1.*", - "doctrine/collections": "1.*", - "doctrine/inflector": "1.*", - "doctrine/lexer": "1.*", - "php": "~5.6|~7.0" + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4", + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^5.7" + "ext-curl": "*", + "phpunit/phpunit": "^4.0 || ^5.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8.x-dev" + "dev-master": "6.2-dev" } }, "autoload": { + "files": [ + "src/functions_include.php" + ], "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" + "GuzzleHttp\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -301,76 +334,57 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" } ], - "description": "Common Library for Doctrine projects", - "homepage": "http://www.doctrine-project.org", + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", "keywords": [ - "annotations", - "collections", - "eventmanager", - "persistence", - "spl" + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" ], - "time": "2017-03-06 07:30:42" + "time": "2017-06-22T18:50:49+00:00" }, { - "name": "doctrine/dbal", + "name": "guzzlehttp/promises", "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/doctrine/dbal.git", - "reference": "50bf623418be0feb3282bb50d07a4aea977fb33a" + "url": "https://github.com/guzzle/promises.git", + "reference": "09e549f5534380c68761260a71f847644d8f65aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/50bf623418be0feb3282bb50d07a4aea977fb33a", - "reference": "50bf623418be0feb3282bb50d07a4aea977fb33a", + "url": "https://api.github.com/repos/guzzle/promises/zipball/09e549f5534380c68761260a71f847644d8f65aa", + "reference": "09e549f5534380c68761260a71f847644d8f65aa", "shasum": "" }, "require": { - "doctrine/common": "^2.7.1", - "php": "^7.0" + "php": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "^5.4.6", - "phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5", - "symfony/console": "2.*||^3.0" - }, - "suggest": { - "symfony/console": "For helpful console commands such as SQL execution and import of files." + "phpunit/phpunit": "^4.0" }, - "bin": [ - "bin/doctrine-dbal" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6.x-dev" + "dev-master": "1.4-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\DBAL\\": "lib/" - } + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -378,62 +392,54 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" } ], - "description": "Database Abstraction Layer", - "homepage": "http://www.doctrine-project.org", + "description": "Guzzle promises library", "keywords": [ - "database", - "dbal", - "persistence", - "queryobject" + "promise" ], - "time": "2017-02-25 22:09:19" + "time": "2017-05-20 23:14:18" }, { - "name": "doctrine/inflector", + "name": "guzzlehttp/psr7", "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "803a2ed9fea02f9ca47cd45395089fe78769a392" + "url": "https://github.com/guzzle/psr7.git", + "reference": "811b676fbab9c99e359885032e5ebc70e442f5b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/803a2ed9fea02f9ca47cd45395089fe78769a392", - "reference": "803a2ed9fea02f9ca47cd45395089fe78769a392", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/811b676fbab9c99e359885032e5ebc70e442f5b8", + "reference": "811b676fbab9c99e359885032e5ebc70e442f5b8", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.4-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "lib/" - } + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -441,69 +447,59 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" }, { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" } ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", + "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ - "inflection", - "pluralize", - "singularize", - "string" + "http", + "message", + "request", + "response", + "stream", + "uri", + "url" ], - "time": "2016-05-12 17:23:41" + "time": "2017-07-17 09:11:21" }, { - "name": "doctrine/instantiator", - "version": "dev-master", + "name": "mailgun/mailgun-php", + "version": "2.3.4", "source": { "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "68099b02b60bbf3b088ff5cb67bf506770ef9cac" + "url": "https://github.com/mailgun/mailgun-php.git", + "reference": "f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/68099b02b60bbf3b088ff5cb67bf506770ef9cac", - "reference": "68099b02b60bbf3b088ff5cb67bf506770ef9cac", + "url": "https://api.github.com/repos/mailgun/mailgun-php/zipball/f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a", + "reference": "f58c5914aefa16fa6ed2b5cf9ee84d40cbda1b3a", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^5.5|^7.0", + "php-http/client-common": "^1.1", + "php-http/discovery": "^1.0", + "php-http/httplug": "^1.0", + "php-http/message": "^1.0", + "php-http/multipart-stream-builder": "^1.0", + "webmozart/assert": "^1.2" }, "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "guzzlehttp/psr7": "^1.4", + "php-http/guzzle6-adapter": "^1.0", + "phpunit/phpunit": "~4.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + "psr-0": { + "Mailgun": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -512,45 +508,38 @@ ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "name": "Travis Swientek", + "email": "travis@mailgunhq.com" } ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2017-01-23 09:23:06" + "description": "The Mailgun SDK provides methods for all API functions.", + "time": "2017-06-20T19:56:09+00:00" }, { - "name": "doctrine/lexer", - "version": "dev-master", + "name": "myclabs/php-enum", + "version": "1.5.2", "source": { "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + "url": "https://github.com/myclabs/php-enum.git", + "reference": "3ed7088cfd0a0e06534b7f8b0eee82acea574fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/3ed7088cfd0a0e06534b7f8b0eee82acea574fac", + "reference": "3ed7088cfd0a0e06534b7f8b0eee82acea574fac", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.7|^6.0", + "squizlabs/php_codesniffer": "1.*" }, + "type": "library", "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" + "psr-4": { + "MyCLabs\\Enum\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -559,91 +548,56 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "PHP Enum contributors", + "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" } ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", + "description": "PHP Enum implementation", + "homepage": "http://github.com/myclabs/php-enum", "keywords": [ - "lexer", - "parser" + "enum" ], - "time": "2014-09-09 13:34:57" + "time": "2017-06-28T16:24:08+00:00" }, { - "name": "guzzle/guzzle", - "version": "dev-master", + "name": "ocramius/proxy-manager", + "version": "0.5.2", "source": { "type": "git", - "url": "https://github.com/guzzle/guzzle3.git", - "reference": "f7778ed85e3db90009d79725afd6c3a82dab32fe" + "url": "https://github.com/Ocramius/ProxyManager.git", + "reference": "0ac0eb3e8e04c7fa75caaf1a43c5405623abf8f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/f7778ed85e3db90009d79725afd6c3a82dab32fe", - "reference": "f7778ed85e3db90009d79725afd6c3a82dab32fe", + "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/0ac0eb3e8e04c7fa75caaf1a43c5405623abf8f5", + "reference": "0ac0eb3e8e04c7fa75caaf1a43c5405623abf8f5", "shasum": "" }, "require": { - "ext-curl": "*", "php": ">=5.3.3", - "symfony/event-dispatcher": "~2.1" - }, - "replace": { - "guzzle/batch": "self.version", - "guzzle/cache": "self.version", - "guzzle/common": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version", - "guzzle/iterator": "self.version", - "guzzle/log": "self.version", - "guzzle/parser": "self.version", - "guzzle/plugin": "self.version", - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-error-response": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version", - "guzzle/service": "self.version", - "guzzle/stream": "self.version" + "zendframework/zend-code": ">2.2.5,<3.0" }, "require-dev": { - "doctrine/cache": "~1.3", - "monolog/monolog": "~1.0", - "phpunit/phpunit": "3.7.*", - "psr/log": "~1.0", - "symfony/class-loader": "~2.1", - "zendframework/zend-cache": "2.*,<2.3", - "zendframework/zend-log": "2.*,<2.3" + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "1.5.*" }, "suggest": { - "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." + "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects", + "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", + "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)", + "zendframework/zend-stdlib": "To use the hydrator proxy", + "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.9-dev" + "dev-master": "0.6.x-dev" } }, "autoload": { "psr-0": { - "Guzzle": "src/", - "Guzzle\\Tests": "tests/" + "ProxyManager\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -652,239 +606,145 @@ ], "authors": [ { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" } ], - "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", - "homepage": "http://guzzlephp.org/", + "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", + "homepage": "https://github.com/Ocramius/ProxyManager", "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" + "aop", + "lazy loading", + "proxy", + "proxy pattern", + "service proxies" ], - "abandoned": "guzzlehttp/guzzle", - "time": "2016-10-26 18:22:07" + "time": "2014-09-28T14:18:11+00:00" }, { - "name": "guzzlehttp/guzzle", - "version": "dev-master", + "name": "php-di/php-di", + "version": "4.4.10", "source": { "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "6a99df94a22f01b4b9c32ed8789cf30d05bdba92" + "url": "https://github.com/PHP-DI/PHP-DI.git", + "reference": "cc10862b66267b6e6f793eda2867b0aef5b693be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/6a99df94a22f01b4b9c32ed8789cf30d05bdba92", - "reference": "6a99df94a22f01b4b9c32ed8789cf30d05bdba92", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/cc10862b66267b6e6f793eda2867b0aef5b693be", + "reference": "cc10862b66267b6e6f793eda2867b0aef5b693be", "shasum": "" }, "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", - "php": ">=5.5" + "container-interop/container-interop": "~1.0", + "doctrine/annotations": "~1.2", + "doctrine/cache": "~1.0", + "myclabs/php-enum": "~1.1", + "ocramius/proxy-manager": "~0.5", + "php": ">=5.3.3", + "php-di/phpdoc-reader": "~1.3" }, "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.0", - "psr/log": "^1.0" - }, - "suggest": { - "psr/log": "Required for using the Log middleware" + "phpunit/phpunit": "~4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { - "GuzzleHttp\\": "src/" - } + "DI\\": "src/DI/" + }, + "files": [ + "src/DI/functions.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", + "description": "PHP-DI is a Container that makes Dependency Injection as practical as possible in PHP", + "homepage": "http://mnapoli.github.com/PHP-DI/", "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" + "container", + "dependency injection", + "di" ], - "time": "2017-02-19 15:59:27" + "time": "2015-07-24T09:21:24+00:00" }, { - "name": "guzzlehttp/promises", - "version": "dev-master", + "name": "php-di/phpdoc-reader", + "version": "1.3.0", "source": { "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "url": "https://github.com/PHP-DI/PhpDocReader.git", + "reference": "8a6e123fd1ce54f7fcbd71747b3bf04e465da229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/8a6e123fd1ce54f7fcbd71747b3bf04e465da229", + "reference": "8a6e123fd1ce54f7fcbd71747b3bf04e465da229", "shasum": "" }, "require": { - "php": ">=5.5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0" + "doctrine/annotations": "1.*", + "php": ">=5.3.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + "psr-0": { + "PhpDocReader": "src/", + "UnitTest": "tests/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", "keywords": [ - "promise" + "phpdoc", + "reflection" ], - "time": "2016-12-20 10:07:11" + "time": "2014-08-21T08:20:45+00:00" }, { - "name": "guzzlehttp/psr7", + "name": "php-http/client-common", "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "41972f428b31bc3ebff0707f63dd2165d3ac4cf6" + "url": "https://github.com/php-http/client-common.git", + "reference": "600ea9a5d867a7bbe1c4e03722b8dc2ebc9bd3c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/41972f428b31bc3ebff0707f63dd2165d3ac4cf6", - "reference": "41972f428b31bc3ebff0707f63dd2165d3ac4cf6", + "url": "https://api.github.com/repos/php-http/client-common/zipball/600ea9a5d867a7bbe1c4e03722b8dc2ebc9bd3c8", + "reference": "600ea9a5d867a7bbe1c4e03722b8dc2ebc9bd3c8", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" + "php": ">=5.4", + "php-http/httplug": "^1.1", + "php-http/message": "^1.2", + "php-http/message-factory": "^1.0", + "symfony/options-resolver": "^2.6 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "guzzlehttp/psr7": "^1.4", + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "suggest": { + "php-http/cache-plugin": "PSR-6 Cache plugin", + "php-http/logger-plugin": "PSR-3 Logger plugin", + "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.6-dev" } }, "autoload": { "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2017-02-18 11:43:27" - }, - { - "name": "mailgun/mailgun-php", - "version": "v2.1.2", - "source": { - "type": "git", - "url": "https://github.com/mailgun/mailgun-php.git", - "reference": "54b7f851b8e0241d593897dc2d50906bf4a43995" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mailgun/mailgun-php/zipball/54b7f851b8e0241d593897dc2d50906bf4a43995", - "reference": "54b7f851b8e0241d593897dc2d50906bf4a43995", - "shasum": "" - }, - "require": { - "php": "^5.5|^7.0", - "php-http/discovery": "^1.0", - "php-http/httplug": "^1.0", - "php-http/message": "^1.0", - "php-http/multipart-stream-builder": "^0.1" - }, - "require-dev": { - "php-http/guzzle6-adapter": "^1.0", - "phpunit/phpunit": "~4.6" - }, - "type": "library", - "autoload": { - "psr-0": { - "Mailgun": "src/" + "Http\\Client\\Common\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -893,54 +753,19 @@ ], "authors": [ { - "name": "Travis Swientek", - "email": "travis@mailgunhq.com" - } - ], - "description": "The Mailgun SDK provides methods for all API functions.", - "time": "2016-08-10T16:58:18+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" ], - "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", + "description": "Common HTTP Client implementations and tools for HTTPlug", + "homepage": "http://httplug.io", "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" + "client", + "common", + "http", + "httplug" ], - "time": "2017-01-26T22:05:40+00:00" + "time": "2017-08-05 15:50:10" }, { "name": "php-http/curl-client", @@ -1004,12 +829,12 @@ "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "cc5669d9cb51170ad0278a3b984cd3c7894d6ff9" + "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/cc5669d9cb51170ad0278a3b984cd3c7894d6ff9", - "reference": "cc5669d9cb51170ad0278a3b984cd3c7894d6ff9", + "url": "https://api.github.com/repos/php-http/discovery/zipball/7b50ab4d6c9fdaa1ed53ae310c955900af6e3372", + "reference": "7b50ab4d6c9fdaa1ed53ae310c955900af6e3372", "shasum": "" }, "require": { @@ -1058,7 +883,7 @@ "message", "psr7" ], - "time": "2017-02-12 08:49:24" + "time": "2017-08-03 10:12:53" }, { "name": "php-http/guzzle6-adapter", @@ -1066,12 +891,12 @@ "source": { "type": "git", "url": "https://github.com/php-http/guzzle6-adapter.git", - "reference": "c0168c6e5fa286c3837310d591114d2683b9b9a5" + "reference": "54181ff8455a4c2e1706a53e0d98060b93030321" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/c0168c6e5fa286c3837310d591114d2683b9b9a5", - "reference": "c0168c6e5fa286c3837310d591114d2683b9b9a5", + "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/54181ff8455a4c2e1706a53e0d98060b93030321", + "reference": "54181ff8455a4c2e1706a53e0d98060b93030321", "shasum": "" }, "require": { @@ -1085,7 +910,7 @@ }, "require-dev": { "ext-curl": "*", - "php-http/client-integration-tests": "^0.5.1" + "php-http/client-integration-tests": "^0.6" }, "type": "library", "extra": { @@ -1118,7 +943,7 @@ "Guzzle", "http" ], - "time": "2016-08-02 09:03:17" + "time": "2017-05-29 15:06:15" }, { "name": "php-http/httplug", @@ -1126,12 +951,12 @@ "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "f32fefee51cb96e99edb0c4bb1d11b5026ad5069" + "reference": "036f86f0cb1f37c13dd9b5e75b71866e7ab3f60b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/f32fefee51cb96e99edb0c4bb1d11b5026ad5069", - "reference": "f32fefee51cb96e99edb0c4bb1d11b5026ad5069", + "url": "https://api.github.com/repos/php-http/httplug/zipball/036f86f0cb1f37c13dd9b5e75b71866e7ab3f60b", + "reference": "036f86f0cb1f37c13dd9b5e75b71866e7ab3f60b", "shasum": "" }, "require": { @@ -1174,7 +999,7 @@ "client", "http" ], - "time": "2017-01-02 06:37:42" + "time": "2017-08-18 18:51:51" }, { "name": "php-http/message", @@ -1182,12 +1007,12 @@ "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "13df8c48f40ca7925303aa336f19be4b80984f01" + "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/13df8c48f40ca7925303aa336f19be4b80984f01", - "reference": "13df8c48f40ca7925303aa336f19be4b80984f01", + "url": "https://api.github.com/repos/php-http/message/zipball/2edd63bae5f52f79363c5f18904b05ce3a4b7253", + "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253", "shasum": "" }, "require": { @@ -1196,6 +1021,9 @@ "php-http/message-factory": "^1.0.2", "psr/http-message": "^1.0" }, + "provide": { + "php-http/message-factory-implementation": "1.0" + }, "require-dev": { "akeneo/phpspec-skip-example-extension": "^1.0", "coduo/phpspec-data-provider-extension": "^1.0", @@ -1243,7 +1071,7 @@ "message", "psr-7" ], - "time": "2017-02-14 08:58:37" + "time": "2017-07-05 06:40:53" }, { "name": "php-http/message-factory", @@ -1293,114 +1121,700 @@ "stream", "uri" ], - "time": "2016-02-03 08:16:31" + "time": "2016-02-03 08:16:31" + }, + { + "name": "php-http/multipart-stream-builder", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-http/multipart-stream-builder.git", + "reference": "0f66890b095841c1606be107d68be250fe8ed768" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/0f66890b095841c1606be107d68be250fe8ed768", + "reference": "0f66890b095841c1606be107d68be250fe8ed768", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "php-http/discovery": "^1.0", + "php-http/message-factory": "^1.0.2", + "psr/http-message": "^1.0" + }, + "require-dev": { + "php-http/message": "^1.5", + "phpunit/phpunit": "^4.8 || ^5.4", + "zendframework/zend-diactoros": "^1.3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Message\\MultipartStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + } + ], + "description": "A builder class that help you create a multipart stream", + "homepage": "http://php-http.org", + "keywords": [ + "factory", + "http", + "message", + "multipart stream", + "stream" + ], + "time": "2017-05-21 18:01:57" + }, + { + "name": "php-http/promise", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-http/promise.git", + "reference": "810b30da8bcf69e4b82c4b9bc6b31518234293ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/promise/zipball/810b30da8bcf69e4b82c4b9bc6b31518234293ab", + "reference": "810b30da8bcf69e4b82c4b9bc6b31518234293ab", + "shasum": "" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + } + ], + "description": "Promise used for asynchronous HTTP requests", + "homepage": "http://httplug.io", + "keywords": [ + "promise" + ], + "time": "2016-01-28 07:54:12" + }, + { + "name": "phpmailer/phpmailer", + "version": "v5.2.25", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "2baf20b01690fba8cf720c1ebcf9b988eda50915" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2baf20b01690fba8cf720c1ebcf9b988eda50915", + "reference": "2baf20b01690fba8cf720c1ebcf9b988eda50915", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": ">=5.0.0" + }, + "require-dev": { + "doctrine/annotations": "1.2.*", + "jms/serializer": "0.16.*", + "phpdocumentor/phpdocumentor": "2.*", + "phpunit/phpunit": "4.8.*", + "symfony/debug": "2.8.*", + "symfony/filesystem": "2.8.*", + "symfony/translation": "2.8.*", + "symfony/yaml": "2.8.*", + "zendframework/zend-cache": "2.5.1", + "zendframework/zend-config": "2.5.1", + "zendframework/zend-eventmanager": "2.5.1", + "zendframework/zend-filter": "2.5.1", + "zendframework/zend-i18n": "2.5.1", + "zendframework/zend-json": "2.5.1", + "zendframework/zend-math": "2.5.1", + "zendframework/zend-serializer": "2.5.*", + "zendframework/zend-servicemanager": "2.5.*", + "zendframework/zend-stdlib": "2.5.1" + }, + "suggest": { + "league/oauth2-google": "Needed for Google XOAUTH2 authentication" + }, + "type": "library", + "autoload": { + "classmap": [ + "class.phpmailer.php", + "class.phpmaileroauth.php", + "class.phpmaileroauthgoogle.php", + "class.smtp.php", + "class.pop3.php", + "extras/EasyPeasyICS.php", + "extras/ntlm_sasl_client.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Jim Jagielski", + "email": "jimjag@gmail.com" + }, + { + "name": "Marcus Bointon", + "email": "phpmailer@synchromedia.co.uk" + }, + { + "name": "Andy Prevost", + "email": "codeworxtech@users.sourceforge.net" + }, + { + "name": "Brent R. Matzelle" + } + ], + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "time": "2017-08-28T11:12:07+00:00" + }, + { + "name": "psr/container", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "2cc4a01788191489dc7459446ba832fa79a216a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/2cc4a01788191489dc7459446ba832fa79a216a7", + "reference": "2cc4a01788191489dc7459446ba832fa79a216a7", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-06-28 15:35:32" + }, + { + "name": "psr/http-message", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "symfony/options-resolver", + "version": "3.4.x-dev", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "9e2ed813a4683bfa310a45d416b922fd7ede638c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/9e2ed813a4683bfa310a45d416b922fd7ede638c", + "reference": "9e2ed813a4683bfa310a45d416b922fd7ede638c", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2017-08-03 09:34:20" + }, + { + "name": "webmozart/assert", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "4a8bf11547e139e77b651365113fc12850c43d9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/4a8bf11547e139e77b651365113fc12850c43d9a", + "reference": "4a8bf11547e139e77b651365113fc12850c43d9a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23 20:04:41" + }, + { + "name": "zendframework/zend-code", + "version": "2.6.3", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-code.git", + "reference": "95033f061b083e16cdee60530ec260d7d628b887" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-code/zipball/95033f061b083e16cdee60530ec260d7d628b887", + "reference": "95033f061b083e16cdee60530ec260d7d628b887", + "shasum": "" + }, + "require": { + "php": "^5.5 || 7.0.0 - 7.0.4 || ^7.0.6", + "zendframework/zend-eventmanager": "^2.6 || ^3.0" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "^4.8.21", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "suggest": { + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", + "zendframework/zend-stdlib": "Zend\\Stdlib component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev", + "dev-develop": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides facilities to generate arbitrary code using an object oriented interface", + "homepage": "https://github.com/zendframework/zend-code", + "keywords": [ + "code", + "zf2" + ], + "time": "2016-04-20T17:26:42+00:00" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "071016ade1deee5b8346ec9d8d48935437746c37" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/071016ade1deee5b8346ec9d8d48935437746c37", + "reference": "071016ade1deee5b8346ec9d8d48935437746c37", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "^6.0.7 || ^5.7.14", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev", + "dev-develop": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "event", + "eventmanager", + "events", + "zf2" + ], + "time": "2017-07-11 19:19:12" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22 11:58:36" + }, + { + "name": "myclabs/deep-copy", + "version": "1.x-dev", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-04-12 18:52:22" }, { - "name": "php-http/multipart-stream-builder", - "version": "0.1.6", + "name": "phar-io/manifest", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/php-http/multipart-stream-builder.git", - "reference": "74d5ac517778ae87a065c6f4076316c35b58a777" + "url": "https://github.com/phar-io/manifest.git", + "reference": "014feadb268809af7c8e2f7ccd396b8494901f58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/74d5ac517778ae87a065c6f4076316c35b58a777", - "reference": "74d5ac517778ae87a065c6f4076316c35b58a777", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/014feadb268809af7c8e2f7ccd396b8494901f58", + "reference": "014feadb268809af7c8e2f7ccd396b8494901f58", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "php-http/discovery": "^1.0", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0" - }, - "require-dev": { - "php-http/message": "^1.5", - "phpunit/phpunit": "^4.8 || ^5.4", - "zendframework/zend-diactoros": "^1.3.5" + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.2-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-4": { - "Http\\Message\\MultipartStream\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "A builder class that help you create a multipart stream", - "homepage": "http://php-http.org", - "keywords": [ - "factory", - "http", - "message", - "multipart stream", - "stream" - ], - "time": "2017-02-16T08:52:59+00:00" + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-04-07T07:07:10+00:00" }, { - "name": "php-http/promise", - "version": "dev-master", + "name": "phar-io/version", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/php-http/promise.git", - "reference": "810b30da8bcf69e4b82c4b9bc6b31518234293ab" + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/promise/zipball/810b30da8bcf69e4b82c4b9bc6b31518234293ab", - "reference": "810b30da8bcf69e4b82c4b9bc6b31518234293ab", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", "shasum": "" }, - "require-dev": { - "henrikbjorn/phpspec-code-coverage": "^1.0", - "phpspec/phpspec": "^2.4" + "require": { + "php": "^5.6 || ^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, "autoload": { - "psr-4": { - "Http\\Promise\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" }, { - "name": "Joel Wurtz", - "email": "joel.wurtz@gmail.com" + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Promise used for asynchronous HTTP requests", - "homepage": "http://httplug.io", - "keywords": [ - "promise" - ], - "time": "2016-01-28 07:54:12" + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1408,12 +1822,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "a046af61c36e9162372f205de091a1cab7340f1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/a046af61c36e9162372f205de091a1cab7340f1c", + "reference": "a046af61c36e9162372f205de091a1cab7340f1c", "shasum": "" }, "require": { @@ -1454,26 +1868,26 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2017-04-30 11:58:12" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^7.0", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -1499,24 +1913,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "time": "2017-08-30T18:51:59+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -1546,67 +1960,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" - }, - { - "name": "phpmailer/phpmailer", - "version": "v5.2.22", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/b18cb98131bd83103ccb26a888fdfe3177b8a663", - "reference": "b18cb98131bd83103ccb26a888fdfe3177b8a663", - "shasum": "" - }, - "require": { - "php": ">=5.0.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "*", - "phpunit/phpunit": "4.7.*" - }, - "suggest": { - "league/oauth2-google": "Needed for Google XOAUTH2 authentication" - }, - "type": "library", - "autoload": { - "classmap": [ - "class.phpmailer.php", - "class.phpmaileroauth.php", - "class.phpmaileroauthgoogle.php", - "class.smtp.php", - "class.pop3.php", - "extras/EasyPeasyICS.php", - "extras/ntlm_sasl_client.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2017-01-09T09:33:47+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", @@ -1614,29 +1968,29 @@ "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0", + "phpspec/phpspec": "^2.5|^3.2", "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -1669,44 +2023,45 @@ "spy", "stub" ], - "time": "2016-11-21 14:58:47" + "time": "2017-09-04 11:05:03" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "7a2bfe73aa381a76cb6d13599ae37bf74a12a02f" + "reference": "77a1ba8076365f943e2a3d75573b6c9822840ac6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7a2bfe73aa381a76cb6d13599ae37bf74a12a02f", - "reference": "7a2bfe73aa381a76cb6d13599ae37bf74a12a02f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/77a1ba8076365f943e2a3d75573b6c9822840ac6", + "reference": "77a1ba8076365f943e2a3d75573b6c9822840ac6", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "~1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "~1.0|~2.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.4.0", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.2.x-dev" } }, "autoload": { @@ -1732,7 +2087,7 @@ "testing", "xunit" ], - "time": "2017-01-24 16:35:00" + "time": "2017-08-25T06:32:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1824,25 +2179,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "d107f347d368dd8a384601398280c7c608390ab7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/d107f347d368dd8a384601398280c7c608390ab7", + "reference": "d107f347d368dd8a384601398280c7c608390ab7", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1864,7 +2224,7 @@ "keywords": [ "timer" ], - "time": "2016-05-12T18:03:57+00:00" + "time": "2017-03-07 15:42:04" }, { "name": "phpunit/php-token-stream", @@ -1872,25 +2232,25 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", + "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.2.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1913,20 +2273,20 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15 14:06:22" + "time": "2017-08-20 05:47:52" }, { "name": "phpunit/phpunit", - "version": "5.7.9", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "69f832b87c731d5cacad7f91948778fe98335fdd" + "reference": "9501bab711403a1ab5b8378a8adb4ec3db3debdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/69f832b87c731d5cacad7f91948778fe98335fdd", - "reference": "69f832b87c731d5cacad7f91948778fe98335fdd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9501bab711403a1ab5b8378a8adb4ec3db3debdb", + "reference": "9501bab711403a1ab5b8378a8adb4ec3db3debdb", "shasum": "" }, "require": { @@ -1935,33 +2295,35 @@ "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.0 || ^2.0", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", - "symfony/yaml": "~2.1|~3.0" + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.2.2", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^4.0.3", + "sebastian/comparator": "^2.0.2", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^1.1" }, "bin": [ "phpunit" @@ -1969,7 +2331,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "6.3.x-dev" } }, "autoload": { @@ -1995,167 +2357,66 @@ "testing", "xunit" ], - "time": "2017-01-28T06:14:33+00:00" + "time": "2017-08-04T05:20:39+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2016-12-08 20:27:08" - }, - { - "name": "psr/http-message", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06 14:39:51" - }, - { - "name": "sabre/event", - "version": "2.0.x-dev", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/fruux/sabre-event.git", - "reference": "337b6f5e10ea6e0b21e22c7e5788dd3883ae73ff" + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fruux/sabre-event/zipball/337b6f5e10ea6e0b21e22c7e5788dd3883ae73ff", - "reference": "337b6f5e10ea6e0b21e22c7e5788dd3883ae73ff", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", "shasum": "" }, "require": { - "php": ">=5.4.1" + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.0" + }, + "conflict": { + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "*", - "sabre/cs": "~0.0.1" + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-soap": "*" }, "type": "library", - "autoload": { - "psr-4": { - "Sabre\\Event\\": "lib/" + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { - "name": "Evert Pot", - "email": "me@evertpot.com", - "homepage": "http://evertpot.com/", - "role": "Developer" + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" } ], - "description": "sabre/event is a library for lightweight event-based programming", - "homepage": "http://sabre.io/event/", + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", "keywords": [ - "EventEmitter", - "events", - "hooks", - "plugin", - "promise", - "signal" + "mock", + "xunit" ], - "time": "2015-05-19 10:24:22" + "time": "2017-08-03T14:08:16+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2163,19 +2424,19 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "11606652af09e847cdbbbc3ca17df26b1173a454" + "reference": "3488be0a7b346cd6e5361510ed07e88f9bea2e88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/11606652af09e847cdbbbc3ca17df26b1173a454", - "reference": "11606652af09e847cdbbbc3ca17df26b1173a454", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/3488be0a7b346cd6e5361510ed07e88f9bea2e88", + "reference": "3488be0a7b346cd6e5361510ed07e88f9bea2e88", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -2200,34 +2461,34 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-12-06 20:05:00" + "time": "2017-03-04 10:23:55" }, { "name": "sebastian/comparator", - "version": "1.2.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "fb3213355da37bf91569ca7a944af19bc57b80e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fb3213355da37bf91569ca7a944af19bc57b80e9", + "reference": "fb3213355da37bf91569ca7a944af19bc57b80e9", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.0", + "sebastian/diff": "^2.0", + "sebastian/exporter": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -2258,13 +2519,13 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-08-20T14:03:32+00:00" }, { "name": "sebastian/diff", @@ -2272,24 +2533,24 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "d0814318784b7756fb932116acd19ee3b0cbe67a" + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/d0814318784b7756fb932116acd19ee3b0cbe67a", - "reference": "d0814318784b7756fb932116acd19ee3b0cbe67a", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2316,7 +2577,7 @@ "keywords": [ "diff" ], - "time": "2016-10-03 07:45:03" + "time": "2017-08-03 08:09:46" }, { "name": "sebastian/environment", @@ -2324,24 +2585,24 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -2366,7 +2627,7 @@ "environment", "hhvm" ], - "time": "2016-11-26 07:53:53" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", @@ -2374,26 +2635,26 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -2433,7 +2694,7 @@ "export", "exporter" ], - "time": "2016-11-19 08:54:04" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", @@ -2441,19 +2702,19 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "ab3e5ce501d9d45288b53f885a54c87e0cdc7164" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ab3e5ce501d9d45288b53f885a54c87e0cdc7164", - "reference": "ab3e5ce501d9d45288b53f885a54c87e0cdc7164", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -2484,7 +2745,7 @@ "keywords": [ "global state" ], - "time": "2016-12-12 08:07:45" + "time": "2017-04-27 15:39:26" }, { "name": "sebastian/object-enumerator", @@ -2492,25 +2753,26 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2530,7 +2792,52 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19 07:35:10" + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", @@ -2538,24 +2845,24 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "a0e54bc9bf04e2c5b302236984cebc277631f0f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/a0e54bc9bf04e2c5b302236984cebc277631f0f1", + "reference": "a0e54bc9bf04e2c5b302236984cebc277631f0f1", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2583,7 +2890,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19 07:33:16" + "time": "2017-03-07 15:09:59" }, { "name": "sebastian/resource-operations", @@ -2671,270 +2978,46 @@ "time": "2016-10-03 07:35:21" }, { - "name": "symfony/event-dispatcher", - "version": "2.8.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "3178c0e247b81da8a0265b460ac23bec6d2e6627" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3178c0e247b81da8a0265b460ac23bec6d2e6627", - "reference": "3178c0e247b81da8a0265b460ac23bec6d2e6627", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-02-18 19:13:35" - }, - { - "name": "symfony/yaml", - "version": "dev-master", + "name": "theseer/tokenizer", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "7928849b226f065dae93ec0e8be3b829f73ba67b" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/7928849b226f065dae93ec0e8be3b829f73ba67b", - "reference": "7928849b226f065dae93ec0e8be3b829f73ba67b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", "shasum": "" }, "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-01-21 17:10:26" - }, - { - "name": "vlucas/spot2", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/vlucas/spot2.git", - "reference": "f30e5439c1c8d969490d773bc3f87937e675083a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/spot2/zipball/f30e5439c1c8d969490d773bc3f87937e675083a", - "reference": "f30e5439c1c8d969490d773bc3f87937e675083a", - "shasum": "" - }, - "require": { - "doctrine/dbal": "~2.4", - "php": ">=5.4", - "sabre/event": "~2.0", - "vlucas/valitron": "1.x" - }, - "type": "library", - "autoload": { - "psr-0": { - "Spot": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" + "BSD-3-Clause" ], "authors": [ { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "http://www.vancelucas.com", + "name": "Arne Blankerts", + "email": "arne@blankerts.de", "role": "Developer" } ], - "description": "Simple DataMapper built on top of Doctrine DBAL", - "homepage": "https://github.com/vlucas/spot2", - "keywords": [ - "database", - "datamapper", - "dbal", - "doctrine", - "entity", - "mapper", - "model", - "orm" - ], - "time": "2014-07-03T14:29:08+00:00" - }, - { - "name": "vlucas/valitron", - "version": "v1.4.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/valitron.git", - "reference": "b33c79116260637337187b7125f955ae26d306cc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/valitron/zipball/b33c79116260637337187b7125f955ae26d306cc", - "reference": "b33c79116260637337187b7125f955ae26d306cc", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Valitron": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "authors": [ - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "http://www.vancelucas.com" - } - ], - "description": "Simple, elegant, stand-alone validation library with NO dependencies", - "homepage": "http://github.com/vlucas/valitron", - "keywords": [ - "valid", - "validation", - "validator" - ], - "time": "2017-02-23T08:31:59+00:00" - }, - { - "name": "webmozart/assert", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "4a8bf11547e139e77b651365113fc12850c43d9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/4a8bf11547e139e77b651365113fc12850c43d9a", - "reference": "4a8bf11547e139e77b651365113fc12850c43d9a", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23 20:04:41" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" } ], - "packages-dev": [], "aliases": [], "minimum-stability": "dev", "stability-flags": [], From 7ca00fecbe88aa90ff48bc208985784ea57fcaa7 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 7 Sep 2017 20:31:57 -0400 Subject: [PATCH 027/130] Add strongly typed constructor args on BusinessLogic layer --- api/BusinessLogic/Attachments/AttachmentHandler.php | 6 +++++- api/BusinessLogic/Categories/CategoryHandler.php | 5 ++++- api/BusinessLogic/Categories/CategoryRetriever.php | 3 ++- api/BusinessLogic/Emails/EmailSenderHelper.php | 4 +++- api/BusinessLogic/Emails/EmailTemplateParser.php | 6 +++++- api/BusinessLogic/Emails/ParsedEmailProperties.php | 6 ------ .../Navigation/CustomNavElementHandler.php | 2 +- api/BusinessLogic/Security/BanRetriever.php | 2 +- api/BusinessLogic/Security/UserContextBuilder.php | 2 +- api/BusinessLogic/Security/UserToTicketChecker.php | 2 +- api/BusinessLogic/Settings/ApiChecker.php | 2 +- api/BusinessLogic/Settings/SettingsRetriever.php | 2 +- api/BusinessLogic/Statuses/StatusRetriever.php | 2 +- api/BusinessLogic/Tickets/Autoassigner.php | 3 ++- api/BusinessLogic/Tickets/NewTicketValidator.php | 4 +++- api/BusinessLogic/Tickets/TicketCreator.php | 11 +++++++++-- api/BusinessLogic/Tickets/TicketDeleter.php | 4 +++- api/BusinessLogic/Tickets/TicketEditor.php | 3 ++- api/BusinessLogic/Tickets/TicketRetriever.php | 3 ++- api/BusinessLogic/Tickets/TicketValidators.php | 2 +- api/BusinessLogic/Tickets/TrackingIdGenerator.php | 2 +- api/BusinessLogic/Tickets/VerifiedEmailChecker.php | 2 +- 22 files changed, 50 insertions(+), 28 deletions(-) diff --git a/api/BusinessLogic/Attachments/AttachmentHandler.php b/api/BusinessLogic/Attachments/AttachmentHandler.php index 3a874ae9..08c3d39a 100644 --- a/api/BusinessLogic/Attachments/AttachmentHandler.php +++ b/api/BusinessLogic/Attachments/AttachmentHandler.php @@ -33,7 +33,11 @@ class AttachmentHandler { /* @var $userToTicketChecker UserToTicketChecker */ private $userToTicketChecker; - function __construct($ticketGateway, $attachmentGateway, $fileWriter, $userToTicketChecker, $fileDeleter) { + function __construct(TicketGateway $ticketGateway, + AttachmentGateway $attachmentGateway, + FileWriter $fileWriter, + UserToTicketChecker $userToTicketChecker, + FileDeleter $fileDeleter) { $this->ticketGateway = $ticketGateway; $this->attachmentGateway = $attachmentGateway; $this->fileWriter = $fileWriter; diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 8c6c42ca..5a40255a 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -26,7 +26,10 @@ class CategoryHandler { /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ private $modsForHeskSettingsGateway; - function __construct($categoryGateway, $ticketGateway, $permissionChecker, $modsForHeskSettingsGateway) { + function __construct(CategoryGateway $categoryGateway, + TicketGateway $ticketGateway, + PermissionChecker $permissionChecker, + ModsForHeskSettingsGateway $modsForHeskSettingsGateway) { $this->categoryGateway = $categoryGateway; $this->ticketGateway = $ticketGateway; $this->permissionChecker = $permissionChecker; diff --git a/api/BusinessLogic/Categories/CategoryRetriever.php b/api/BusinessLogic/Categories/CategoryRetriever.php index 88fa413c..526d9f88 100644 --- a/api/BusinessLogic/Categories/CategoryRetriever.php +++ b/api/BusinessLogic/Categories/CategoryRetriever.php @@ -17,7 +17,8 @@ class CategoryRetriever { */ private $modsForHeskSettingsGateway; - function __construct($categoryGateway, $modsForHeskSettingsGateway) { + function __construct(CategoryGateway $categoryGateway, + ModsForHeskSettingsGateway $modsForHeskSettingsGateway) { $this->categoryGateway = $categoryGateway; $this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway; } diff --git a/api/BusinessLogic/Emails/EmailSenderHelper.php b/api/BusinessLogic/Emails/EmailSenderHelper.php index b02453ab..5c6b23cb 100644 --- a/api/BusinessLogic/Emails/EmailSenderHelper.php +++ b/api/BusinessLogic/Emails/EmailSenderHelper.php @@ -21,7 +21,9 @@ class EmailSenderHelper { */ private $mailgunEmailSender; - function __construct($emailTemplateParser, $basicEmailSender, $mailgunEmailSender) { + function __construct(EmailTemplateParser $emailTemplateParser, + BasicEmailSender $basicEmailSender, + MailgunEmailSender $mailgunEmailSender) { $this->emailTemplateParser = $emailTemplateParser; $this->basicEmailSender = $basicEmailSender; $this->mailgunEmailSender = $mailgunEmailSender; diff --git a/api/BusinessLogic/Emails/EmailTemplateParser.php b/api/BusinessLogic/Emails/EmailTemplateParser.php index e53a03b2..e96db960 100644 --- a/api/BusinessLogic/Emails/EmailTemplateParser.php +++ b/api/BusinessLogic/Emails/EmailTemplateParser.php @@ -35,7 +35,10 @@ class EmailTemplateParser { */ private $emailTemplateRetriever; - function __construct($statusGateway, $categoryGateway, $userGateway, $emailTemplateRetriever) { + function __construct(StatusGateway $statusGateway, + CategoryGateway $categoryGateway, + UserGateway $userGateway, + EmailTemplateRetriever $emailTemplateRetriever) { $this->statusGateway = $statusGateway; $this->categoryGateway = $categoryGateway; $this->userGateway = $userGateway; @@ -50,6 +53,7 @@ class EmailTemplateParser { * @param $modsForHeskSettings array * @return ParsedEmailProperties * @throws InvalidEmailTemplateException + * @throws \Exception */ function getFormattedEmailForLanguage($templateId, $languageCode, $ticket, $heskSettings, $modsForHeskSettings) { global $hesklang; diff --git a/api/BusinessLogic/Emails/ParsedEmailProperties.php b/api/BusinessLogic/Emails/ParsedEmailProperties.php index 5cbe594f..a0421bca 100644 --- a/api/BusinessLogic/Emails/ParsedEmailProperties.php +++ b/api/BusinessLogic/Emails/ParsedEmailProperties.php @@ -1,10 +1,4 @@ customNavElementGateway = $customNavElementGateway; } diff --git a/api/BusinessLogic/Security/BanRetriever.php b/api/BusinessLogic/Security/BanRetriever.php index e44fa344..66213cf5 100644 --- a/api/BusinessLogic/Security/BanRetriever.php +++ b/api/BusinessLogic/Security/BanRetriever.php @@ -11,7 +11,7 @@ class BanRetriever { */ private $banGateway; - function __construct($banGateway) { + function __construct(BanGateway $banGateway) { $this->banGateway = $banGateway; } diff --git a/api/BusinessLogic/Security/UserContextBuilder.php b/api/BusinessLogic/Security/UserContextBuilder.php index 65c4972e..7bb975ee 100644 --- a/api/BusinessLogic/Security/UserContextBuilder.php +++ b/api/BusinessLogic/Security/UserContextBuilder.php @@ -14,7 +14,7 @@ class UserContextBuilder { */ private $userGateway; - function __construct($userGateway) { + function __construct(UserGateway $userGateway) { $this->userGateway = $userGateway; } diff --git a/api/BusinessLogic/Security/UserToTicketChecker.php b/api/BusinessLogic/Security/UserToTicketChecker.php index 3da75192..9a2f9c90 100644 --- a/api/BusinessLogic/Security/UserToTicketChecker.php +++ b/api/BusinessLogic/Security/UserToTicketChecker.php @@ -10,7 +10,7 @@ class UserToTicketChecker { /* @var $userGateway UserGateway */ private $userGateway; - function __construct($userGateway) { + function __construct(UserGateway $userGateway) { $this->userGateway = $userGateway; } diff --git a/api/BusinessLogic/Settings/ApiChecker.php b/api/BusinessLogic/Settings/ApiChecker.php index 863a6e06..8645dd5c 100644 --- a/api/BusinessLogic/Settings/ApiChecker.php +++ b/api/BusinessLogic/Settings/ApiChecker.php @@ -9,7 +9,7 @@ class ApiChecker { /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ private $modsForHeskSettingsGateway; - function __construct($modsForHeskSettingsGateway) { + function __construct(ModsForHeskSettingsGateway $modsForHeskSettingsGateway) { $this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway; } diff --git a/api/BusinessLogic/Settings/SettingsRetriever.php b/api/BusinessLogic/Settings/SettingsRetriever.php index e8db0e48..21eeb13a 100644 --- a/api/BusinessLogic/Settings/SettingsRetriever.php +++ b/api/BusinessLogic/Settings/SettingsRetriever.php @@ -9,7 +9,7 @@ class SettingsRetriever { /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ private $modsForHeskSettingsGateway; - function __construct($modsForHeskSettingsGateway) { + function __construct(ModsForHeskSettingsGateway $modsForHeskSettingsGateway) { $this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway; } diff --git a/api/BusinessLogic/Statuses/StatusRetriever.php b/api/BusinessLogic/Statuses/StatusRetriever.php index 0bcfe844..181ceae1 100644 --- a/api/BusinessLogic/Statuses/StatusRetriever.php +++ b/api/BusinessLogic/Statuses/StatusRetriever.php @@ -10,7 +10,7 @@ class StatusRetriever { /* @var $statusGateway StatusGateway */ private $statusGateway; - function __construct($statusGateway) { + function __construct(StatusGateway $statusGateway) { $this->statusGateway = $statusGateway; } diff --git a/api/BusinessLogic/Tickets/Autoassigner.php b/api/BusinessLogic/Tickets/Autoassigner.php index 49723095..e4095815 100644 --- a/api/BusinessLogic/Tickets/Autoassigner.php +++ b/api/BusinessLogic/Tickets/Autoassigner.php @@ -15,7 +15,8 @@ class Autoassigner { /* @var $userGateway UserGateway */ private $userGateway; - function __construct($categoryGateway, $userGateway) { + function __construct(CategoryGateway $categoryGateway, + UserGateway $userGateway) { $this->categoryGateway = $categoryGateway; $this->userGateway = $userGateway; } diff --git a/api/BusinessLogic/Tickets/NewTicketValidator.php b/api/BusinessLogic/Tickets/NewTicketValidator.php index bb80a1f8..7697f860 100644 --- a/api/BusinessLogic/Tickets/NewTicketValidator.php +++ b/api/BusinessLogic/Tickets/NewTicketValidator.php @@ -24,7 +24,9 @@ class NewTicketValidator { */ private $ticketValidators; - function __construct($categoryRetriever, $banRetriever, $ticketValidators) { + function __construct(CategoryRetriever $categoryRetriever, + BanRetriever $banRetriever, + TicketValidators $ticketValidators) { $this->categoryRetriever = $categoryRetriever; $this->banRetriever = $banRetriever; $this->ticketValidators = $ticketValidators; diff --git a/api/BusinessLogic/Tickets/TicketCreator.php b/api/BusinessLogic/Tickets/TicketCreator.php index 245da2a1..d9e8c346 100644 --- a/api/BusinessLogic/Tickets/TicketCreator.php +++ b/api/BusinessLogic/Tickets/TicketCreator.php @@ -56,8 +56,15 @@ class TicketCreator { /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ private $modsForHeskSettingsGateway; - function __construct($newTicketValidator, $trackingIdGenerator, $autoassigner, $statusGateway, $ticketGateway, - $verifiedEmailChecker, $emailSenderHelper, $userGateway, $modsForHeskSettingsGateway) { + function __construct(NewTicketValidator $newTicketValidator, + TrackingIdGenerator $trackingIdGenerator, + Autoassigner $autoassigner, + StatusGateway $statusGateway, + TicketGateway $ticketGateway, + VerifiedEmailChecker $verifiedEmailChecker, + EmailSenderHelper $emailSenderHelper, + UserGateway $userGateway, + ModsForHeskSettingsGateway $modsForHeskSettingsGateway) { $this->newTicketValidator = $newTicketValidator; $this->trackingIdGenerator = $trackingIdGenerator; $this->autoassigner = $autoassigner; diff --git a/api/BusinessLogic/Tickets/TicketDeleter.php b/api/BusinessLogic/Tickets/TicketDeleter.php index fde51ee7..7d1fa4d9 100644 --- a/api/BusinessLogic/Tickets/TicketDeleter.php +++ b/api/BusinessLogic/Tickets/TicketDeleter.php @@ -20,7 +20,9 @@ class TicketDeleter { /* @var $attachmentHandler AttachmentHandler */ private $attachmentHandler; - function __construct($ticketGateway, $userToTicketChecker, $attachmentHandler) { + function __construct(TicketGateway $ticketGateway, + UserToTicketChecker $userToTicketChecker, + AttachmentHandler $attachmentHandler) { $this->ticketGateway = $ticketGateway; $this->userToTicketChecker = $userToTicketChecker; $this->attachmentHandler = $attachmentHandler; diff --git a/api/BusinessLogic/Tickets/TicketEditor.php b/api/BusinessLogic/Tickets/TicketEditor.php index a5fe9774..ac0bca61 100644 --- a/api/BusinessLogic/Tickets/TicketEditor.php +++ b/api/BusinessLogic/Tickets/TicketEditor.php @@ -22,7 +22,8 @@ class TicketEditor { /* @var $userToTicketChecker UserToTicketChecker */ private $userToTicketChecker; - function __construct($ticketGateway, $userToTicketChecker) { + function __construct(TicketGateway $ticketGateway, + UserToTicketChecker $userToTicketChecker) { $this->ticketGateway = $ticketGateway; $this->userToTicketChecker = $userToTicketChecker; } diff --git a/api/BusinessLogic/Tickets/TicketRetriever.php b/api/BusinessLogic/Tickets/TicketRetriever.php index 5a237a98..569210ef 100644 --- a/api/BusinessLogic/Tickets/TicketRetriever.php +++ b/api/BusinessLogic/Tickets/TicketRetriever.php @@ -19,7 +19,8 @@ class TicketRetriever { /* @var $userToTicketChecker UserToTicketChecker */ private $userToTicketChecker; - function __construct($ticketGateway, $userToTicketChecker) { + function __construct(TicketGateway $ticketGateway, + UserToTicketChecker $userToTicketChecker) { $this->ticketGateway = $ticketGateway; $this->userToTicketChecker = $userToTicketChecker; } diff --git a/api/BusinessLogic/Tickets/TicketValidators.php b/api/BusinessLogic/Tickets/TicketValidators.php index 15a53bb3..ff310757 100644 --- a/api/BusinessLogic/Tickets/TicketValidators.php +++ b/api/BusinessLogic/Tickets/TicketValidators.php @@ -10,7 +10,7 @@ class TicketValidators { */ private $ticketGateway; - function __construct($ticketGateway) { + function __construct(TicketGateway $ticketGateway) { $this->ticketGateway = $ticketGateway; } diff --git a/api/BusinessLogic/Tickets/TrackingIdGenerator.php b/api/BusinessLogic/Tickets/TrackingIdGenerator.php index 623ab1fe..892953e5 100644 --- a/api/BusinessLogic/Tickets/TrackingIdGenerator.php +++ b/api/BusinessLogic/Tickets/TrackingIdGenerator.php @@ -12,7 +12,7 @@ class TrackingIdGenerator { */ private $ticketGateway; - function __construct($ticketGateway) { + function __construct(TicketGateway $ticketGateway) { $this->ticketGateway = $ticketGateway; } diff --git a/api/BusinessLogic/Tickets/VerifiedEmailChecker.php b/api/BusinessLogic/Tickets/VerifiedEmailChecker.php index fccb32fc..3846fbc3 100644 --- a/api/BusinessLogic/Tickets/VerifiedEmailChecker.php +++ b/api/BusinessLogic/Tickets/VerifiedEmailChecker.php @@ -17,7 +17,7 @@ class VerifiedEmailChecker { */ private $verifiedEmailGateway; - function __construct($verifiedEmailGateway) { + function __construct(VerifiedEmailGateway $verifiedEmailGateway) { $this->verifiedEmailGateway = $verifiedEmailGateway; } From be42fe04fbd06457a5f0ab9a9d77621360a5ae1e Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 9 Sep 2017 21:24:05 -0400 Subject: [PATCH 028/130] Use a proper DI system --- api/ApplicationContext.php | 127 ------------------ .../PublicAttachmentController.php | 2 +- .../StaffTicketAttachmentsController.php | 6 +- .../Categories/CategoryController.php | 10 +- .../Navigation/CustomNavElementController.php | 13 +- .../Settings/SettingsController.php | 6 +- api/Controllers/Statuses/StatusController.php | 2 +- .../Tickets/CustomerTicketController.php | 4 +- .../ResendTicketEmailToCustomerController.php | 6 +- .../Tickets/StaffTicketController.php | 6 +- api/autoload.php | 5 +- api/composer.json | 8 +- api/composer.lock | 44 +++--- api/index.php | 12 +- 14 files changed, 69 insertions(+), 182 deletions(-) delete mode 100644 api/ApplicationContext.php diff --git a/api/ApplicationContext.php b/api/ApplicationContext.php deleted file mode 100644 index 8dbb6079..00000000 --- a/api/ApplicationContext.php +++ /dev/null @@ -1,127 +0,0 @@ -get = array(); - - $this->get[PermissionChecker::class] = new PermissionChecker(); - $this->get[ModsForHeskSettingsGateway::class] = new ModsForHeskSettingsGateway(); - $this->get[CustomNavElementGateway::class] = new CustomNavElementGateway(); - $this->get[LoggingGateway::class] = new LoggingGateway(); - $this->get[VerifiedEmailGateway::class] = new VerifiedEmailGateway(); - $this->get[UserGateway::class] = new UserGateway(); - $this->get[CategoryGateway::class] = new CategoryGateway(); - $this->get[BanGateway::class] = new BanGateway(); - $this->get[StatusGateway::class] = new StatusGateway(); - $this->get[BasicEmailSender::class] = new BasicEmailSender(); - $this->get[MailgunEmailSender::class] = new MailgunEmailSender(); - $this->get[EmailTemplateRetriever::class] = new EmailTemplateRetriever(); - $this->get[TicketGateway::class] = new TicketGateway(); - $this->get[FileWriter::class] = new FileWriter(); - $this->get[FileReader::class] = new FileReader(); - $this->get[FileDeleter::class] = new FileDeleter(); - $this->get[AttachmentGateway::class] = new AttachmentGateway(); - - $this->get[ApiChecker::class] = new ApiChecker($this->get[ModsForHeskSettingsGateway::class]); - $this->get[CustomNavElementHandler::class] = new CustomNavElementHandler($this->get[CustomNavElementGateway::class]); - $this->get[VerifiedEmailChecker::class] = new VerifiedEmailChecker($this->get[VerifiedEmailGateway::class]); - $this->get[UserContextBuilder::class] = new UserContextBuilder($this->get[UserGateway::class]); - $this->get[BanRetriever::class] = new BanRetriever($this->get[BanGateway::class]); - $this->get[UserToTicketChecker::class] = new UserToTicketChecker($this->get[UserGateway::class]); - $this->get[StatusRetriever::class] = new StatusRetriever($this->get[StatusGateway::class]); - $this->get[SettingsRetriever::class] = new SettingsRetriever($this->get[ModsForHeskSettingsGateway::class]); - $this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]); - $this->get[TrackingIdGenerator::class] = new TrackingIdGenerator($this->get[TicketGateway::class]); - $this->get[Autoassigner::class] = new Autoassigner($this->get[CategoryGateway::class], $this->get[UserGateway::class]); - $this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class], - $this->get[ModsForHeskSettingsGateway::class]); - $this->get[CategoryHandler::class] = new CategoryHandler( - $this->get[CategoryGateway::class], - $this->get[TicketGateway::class], - $this->get[PermissionChecker::class], - $this->get[ModsForHeskSettingsGateway::class]); - $this->get[EmailTemplateParser::class] = new EmailTemplateParser($this->get[StatusGateway::class], - $this->get[CategoryGateway::class], - $this->get[UserGateway::class], - $this->get[EmailTemplateRetriever::class]); - $this->get[EmailSenderHelper::class] = new EmailSenderHelper($this->get[EmailTemplateParser::class], - $this->get[BasicEmailSender::class], - $this->get[MailgunEmailSender::class]); - $this->get[TicketRetriever::class] = new TicketRetriever($this->get[TicketGateway::class], - $this->get[UserToTicketChecker::class]); - $this->get[NewTicketValidator::class] = new NewTicketValidator($this->get[CategoryRetriever::class], - $this->get[BanRetriever::class], - $this->get[TicketValidators::class]); - $this->get[TicketCreator::class] = new TicketCreator($this->get[NewTicketValidator::class], - $this->get[TrackingIdGenerator::class], - $this->get[Autoassigner::class], - $this->get[StatusGateway::class], - $this->get[TicketGateway::class], - $this->get[VerifiedEmailChecker::class], - $this->get[EmailSenderHelper::class], - $this->get[UserGateway::class], - $this->get[ModsForHeskSettingsGateway::class]); - $this->get[AttachmentHandler::class] = new AttachmentHandler($this->get[TicketGateway::class], - $this->get[AttachmentGateway::class], - $this->get[FileWriter::class], - $this->get[UserToTicketChecker::class], - $this->get[FileDeleter::class]); - $this->get[AttachmentRetriever::class] = new AttachmentRetriever($this->get[AttachmentGateway::class], - $this->get[FileReader::class], - $this->get[TicketGateway::class], - $this->get[UserToTicketChecker::class]); - $this->get[TicketDeleter::class] = - new TicketDeleter($this->get[TicketGateway::class], - $this->get[UserToTicketChecker::class], - $this->get[AttachmentHandler::class]); - $this->get[TicketEditor::class] = - new TicketEditor($this->get[TicketGateway::class], $this->get[UserToTicketChecker::class]); - } -} \ No newline at end of file diff --git a/api/Controllers/Attachments/PublicAttachmentController.php b/api/Controllers/Attachments/PublicAttachmentController.php index c5e9077c..c12325a5 100644 --- a/api/Controllers/Attachments/PublicAttachmentController.php +++ b/api/Controllers/Attachments/PublicAttachmentController.php @@ -14,7 +14,7 @@ class PublicAttachmentController { self::verifyAttachmentsAreEnabled($hesk_settings); /* @var $attachmentRetriever AttachmentRetriever */ - $attachmentRetriever = $applicationContext->get[AttachmentRetriever::class]; + $attachmentRetriever = $applicationContext->get(AttachmentRetriever::class); $attachment = $attachmentRetriever->getAttachmentContentsForTrackingId($trackingId, $attachmentId, $userContext, $hesk_settings); diff --git a/api/Controllers/Attachments/StaffTicketAttachmentsController.php b/api/Controllers/Attachments/StaffTicketAttachmentsController.php index 1d32f812..7f6a09c0 100644 --- a/api/Controllers/Attachments/StaffTicketAttachmentsController.php +++ b/api/Controllers/Attachments/StaffTicketAttachmentsController.php @@ -18,7 +18,7 @@ class StaffTicketAttachmentsController { $this->verifyAttachmentsAreEnabled($hesk_settings); /* @var $attachmentRetriever AttachmentRetriever */ - $attachmentRetriever = $applicationContext->get[AttachmentRetriever::class]; + $attachmentRetriever = $applicationContext->get(AttachmentRetriever::class); $contents = $attachmentRetriever->getAttachmentContentsForTicket($ticketId, $attachmentId, $userContext, $hesk_settings); @@ -37,7 +37,7 @@ class StaffTicketAttachmentsController { $this->verifyAttachmentsAreEnabled($hesk_settings); /* @var $attachmentHandler AttachmentHandler */ - $attachmentHandler = $applicationContext->get[AttachmentHandler::class]; + $attachmentHandler = $applicationContext->get(AttachmentHandler::class); $createAttachmentForTicketModel = $this->createModel(JsonRetriever::getJsonData(), $ticketId); @@ -61,7 +61,7 @@ class StaffTicketAttachmentsController { global $applicationContext, $hesk_settings, $userContext; /* @var $attachmentHandler AttachmentHandler */ - $attachmentHandler = $applicationContext->get[AttachmentHandler::class]; + $attachmentHandler = $applicationContext->get(AttachmentHandler::class); $attachmentHandler->deleteAttachmentFromTicket($ticketId, $attachmentId, $userContext, $hesk_settings); diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index 8daa326f..e72f680b 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -30,7 +30,7 @@ class CategoryController { global $hesk_settings, $applicationContext, $userContext; /* @var $categoryRetriever CategoryRetriever */ - $categoryRetriever = $applicationContext->get[CategoryRetriever::class]; + $categoryRetriever = $applicationContext->get(CategoryRetriever::class); return $categoryRetriever->getAllCategories($hesk_settings, $userContext); } @@ -43,7 +43,7 @@ class CategoryController { $category = $this->buildCategoryFromJson($data); /* @var $categoryHandler CategoryHandler */ - $categoryHandler = $applicationContext->get[CategoryHandler::class]; + $categoryHandler = $applicationContext->get(CategoryHandler::class); $category = $categoryHandler->createCategory($category, $userContext, $hesk_settings); @@ -81,7 +81,7 @@ class CategoryController { $category->id = intval($id); /* @var $categoryHandler CategoryHandler */ - $categoryHandler = $applicationContext->get[CategoryHandler::class]; + $categoryHandler = $applicationContext->get(CategoryHandler::class); $category = $categoryHandler->editCategory($category, $userContext, $hesk_settings); @@ -92,7 +92,7 @@ class CategoryController { global $hesk_settings, $userContext, $applicationContext; /* @var $categoryHandler CategoryHandler */ - $categoryHandler = $applicationContext->get[CategoryHandler::class]; + $categoryHandler = $applicationContext->get(CategoryHandler::class); $categoryHandler->deleteCategory($id, $userContext, $hesk_settings); @@ -103,7 +103,7 @@ class CategoryController { global $applicationContext, $hesk_settings; /* @var $handler CategoryHandler */ - $handler = $applicationContext->get[CategoryHandler::class]; + $handler = $applicationContext->get(CategoryHandler::class); $handler->sortCategory(intval($id), $direction, $hesk_settings); } diff --git a/api/Controllers/Navigation/CustomNavElementController.php b/api/Controllers/Navigation/CustomNavElementController.php index d4a514e7..8196eb16 100644 --- a/api/Controllers/Navigation/CustomNavElementController.php +++ b/api/Controllers/Navigation/CustomNavElementController.php @@ -3,7 +3,6 @@ namespace Controllers\Navigation; -use BusinessLogic\Exceptions\ApiFriendlyException; use BusinessLogic\Helpers; use BusinessLogic\Navigation\CustomNavElement; use BusinessLogic\Navigation\CustomNavElementHandler; @@ -17,7 +16,7 @@ class CustomNavElementController extends InternalApiController { self::staticCheckForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get[CustomNavElementHandler::class]; + $handler = $applicationContext->get(CustomNavElementHandler::class); output($handler->getAllCustomNavElements($hesk_settings)); } @@ -28,7 +27,7 @@ class CustomNavElementController extends InternalApiController { self::staticCheckForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get[CustomNavElementHandler::class]; + $handler = $applicationContext->get(CustomNavElementHandler::class); $handler->sortCustomNavElement(intval($id), $direction, $hesk_settings); } @@ -39,7 +38,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get[CustomNavElementHandler::class]; + $handler = $applicationContext->get(CustomNavElementHandler::class); output($handler->getCustomNavElement($id, $hesk_settings)); } @@ -50,7 +49,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get[CustomNavElementHandler::class]; + $handler = $applicationContext->get(CustomNavElementHandler::class); $data = JsonRetriever::getJsonData(); $element = $handler->createCustomNavElement($this->buildElementModel($data), $hesk_settings); @@ -64,7 +63,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get[CustomNavElementHandler::class]; + $handler = $applicationContext->get(CustomNavElementHandler::class); $data = JsonRetriever::getJsonData(); $handler->saveCustomNavElement($this->buildElementModel($data, $id), $hesk_settings); @@ -78,7 +77,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get[CustomNavElementHandler::class]; + $handler = $applicationContext->get(CustomNavElementHandler::class); $handler->deleteCustomNavElement($id, $hesk_settings); diff --git a/api/Controllers/Settings/SettingsController.php b/api/Controllers/Settings/SettingsController.php index c8e53941..4e66016a 100644 --- a/api/Controllers/Settings/SettingsController.php +++ b/api/Controllers/Settings/SettingsController.php @@ -7,11 +7,11 @@ use BusinessLogic\Settings\SettingsRetriever; class SettingsController { function get() { - global $applicationContext, $hesk_settings, $modsForHesk_settings; + global $applicationContext, $hesk_settings; /* @var $settingsRetriever SettingsRetriever */ - $settingsRetriever = $applicationContext->get[SettingsRetriever::class]; + $settingsRetriever = $applicationContext->get(SettingsRetriever::class); - output($settingsRetriever->getAllSettings($hesk_settings, $modsForHesk_settings)); + output($settingsRetriever->getAllSettings($hesk_settings)); } } \ No newline at end of file diff --git a/api/Controllers/Statuses/StatusController.php b/api/Controllers/Statuses/StatusController.php index f9e2f087..536c6b60 100644 --- a/api/Controllers/Statuses/StatusController.php +++ b/api/Controllers/Statuses/StatusController.php @@ -10,7 +10,7 @@ class StatusController { global $applicationContext, $hesk_settings; /* @var $statusRetriever StatusRetriever */ - $statusRetriever = $applicationContext->get[StatusRetriever::class]; + $statusRetriever = $applicationContext->get(StatusRetriever::class); output($statusRetriever->getAllStatuses($hesk_settings)); } diff --git a/api/Controllers/Tickets/CustomerTicketController.php b/api/Controllers/Tickets/CustomerTicketController.php index cd8e9481..2b1b2614 100644 --- a/api/Controllers/Tickets/CustomerTicketController.php +++ b/api/Controllers/Tickets/CustomerTicketController.php @@ -18,7 +18,7 @@ class CustomerTicketController { $emailAddress = isset($_GET['email']) ? $_GET['email'] : null; /* @var $ticketRetriever TicketRetriever */ - $ticketRetriever = $applicationContext->get[TicketRetriever::class]; + $ticketRetriever = $applicationContext->get(TicketRetriever::class); output($ticketRetriever->getTicketByTrackingIdAndEmail($trackingId, $emailAddress, $hesk_settings)); } @@ -27,7 +27,7 @@ class CustomerTicketController { global $applicationContext, $hesk_settings, $userContext; /* @var $ticketCreator TicketCreator */ - $ticketCreator = $applicationContext->get[TicketCreator::class]; + $ticketCreator = $applicationContext->get(TicketCreator::class); $jsonRequest = JsonRetriever::getJsonData(); diff --git a/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php b/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php index 79fb5a62..fe2aa7be 100644 --- a/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php +++ b/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php @@ -19,15 +19,15 @@ class ResendTicketEmailToCustomerController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $ticketRetriever TicketRetriever */ - $ticketRetriever = $applicationContext->get[TicketRetriever::class]; + $ticketRetriever = $applicationContext->get(TicketRetriever::class); $ticket = $ticketRetriever->getTicketById($ticketId, $hesk_settings, $userContext); /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ - $modsForHeskSettingsGateway = $applicationContext->get[ModsForHeskSettingsGateway::class]; + $modsForHeskSettingsGateway = $applicationContext->get(ModsForHeskSettingsGateway::class); $modsForHeskSettings = $modsForHeskSettingsGateway->getAllSettings($hesk_settings); /* @var $emailSender EmailSenderHelper */ - $emailSender = $applicationContext->get[EmailSenderHelper::class]; + $emailSender = $applicationContext->get(EmailSenderHelper::class); $language = $ticket->language; diff --git a/api/Controllers/Tickets/StaffTicketController.php b/api/Controllers/Tickets/StaffTicketController.php index 001cd556..a4860f07 100644 --- a/api/Controllers/Tickets/StaffTicketController.php +++ b/api/Controllers/Tickets/StaffTicketController.php @@ -15,7 +15,7 @@ class StaffTicketController { global $applicationContext, $userContext, $hesk_settings; /* @var $ticketRetriever TicketRetriever */ - $ticketRetriever = $applicationContext->get[TicketRetriever::class]; + $ticketRetriever = $applicationContext->get(TicketRetriever::class); output($ticketRetriever->getTicketById($id, $hesk_settings, $userContext)); } @@ -24,7 +24,7 @@ class StaffTicketController { global $applicationContext, $userContext, $hesk_settings; /* @var $ticketDeleter TicketDeleter */ - $ticketDeleter = $applicationContext->get[TicketDeleter::class]; + $ticketDeleter = $applicationContext->get(TicketDeleter::class); $ticketDeleter->deleteTicket($id, $userContext, $hesk_settings); @@ -35,7 +35,7 @@ class StaffTicketController { global $applicationContext, $userContext, $hesk_settings; /* @var $ticketEditor TicketEditor */ - $ticketEditor = $applicationContext->get[TicketEditor::class]; + $ticketEditor = $applicationContext->get(TicketEditor::class); $jsonRequest = JsonRetriever::getJsonData(); diff --git a/api/autoload.php b/api/autoload.php index b9c2292e..0712c2e1 100644 --- a/api/autoload.php +++ b/api/autoload.php @@ -21,4 +21,7 @@ global $hesk_settings; require_once(__DIR__ . '/../inc/custom_fields.inc.php'); // Load the ApplicationContext -$applicationContext = new \ApplicationContext(); \ No newline at end of file +$builder = new \DI\ContainerBuilder(); +$builder->setDefinitionCache(new \Doctrine\Common\Cache\ArrayCache()); + +$applicationContext = $builder->build(); \ No newline at end of file diff --git a/api/composer.json b/api/composer.json index ba08aee6..d5194dea 100644 --- a/api/composer.json +++ b/api/composer.json @@ -12,6 +12,12 @@ "require-dev": { "phpunit/phpunit": "6.3.0" }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/mike-koch/PHP-DI" + } + ], "require": { "phpmailer/phpmailer": "^5.2", "mailgun/mailgun-php": "^2.1", @@ -19,6 +25,6 @@ "php-http/message": "^1.5", "php-http/curl-client": "^1.7", "guzzlehttp/psr7": "^1.3", - "php-di/php-di": "4.4.10" + "php-di/php-di": "dev-master" } } diff --git a/api/composer.lock b/api/composer.lock index ec939825..c9d00a68 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "d7d3d7ef4a481f28ec59f1218cbc9a1a", + "content-hash": "c94a62f4b72739c52334647f4b759251", "packages": [ { "name": "clue/stream-filter", @@ -624,16 +624,16 @@ }, { "name": "php-di/php-di", - "version": "4.4.10", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/PHP-DI/PHP-DI.git", - "reference": "cc10862b66267b6e6f793eda2867b0aef5b693be" + "url": "https://github.com/mike-koch/PHP-DI.git", + "reference": "02ae2f2f79f3c09f711f8936e2c69cc65a530f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/cc10862b66267b6e6f793eda2867b0aef5b693be", - "reference": "cc10862b66267b6e6f793eda2867b0aef5b693be", + "url": "https://api.github.com/repos/mike-koch/PHP-DI/zipball/02ae2f2f79f3c09f711f8936e2c69cc65a530f1b", + "reference": "02ae2f2f79f3c09f711f8936e2c69cc65a530f1b", "shasum": "" }, "require": { @@ -657,7 +657,12 @@ "src/DI/functions.php" ] }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "DI\\Test\\IntegrationTest\\": "tests/IntegrationTest/", + "DI\\Test\\UnitTest\\": "tests/UnitTest/" + } + }, "license": [ "MIT" ], @@ -668,7 +673,10 @@ "dependency injection", "di" ], - "time": "2015-07-24T09:21:24+00:00" + "support": { + "source": "https://github.com/mike-koch/PHP-DI/tree/master" + }, + "time": "2017-09-08 02:07:52" }, { "name": "php-di/phpdoc-reader", @@ -1767,7 +1775,7 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-04-07T07:07:10+00:00" + "time": "2017-04-07 07:07:10" }, { "name": "phar-io/version", @@ -2087,7 +2095,7 @@ "testing", "xunit" ], - "time": "2017-08-25T06:32:04+00:00" + "time": "2017-08-25 06:32:04" }, { "name": "phpunit/php-file-iterator", @@ -2416,7 +2424,7 @@ "mock", "xunit" ], - "time": "2017-08-03T14:08:16+00:00" + "time": "2017-08-03 14:08:16" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2525,7 +2533,7 @@ "compare", "equality" ], - "time": "2017-08-20T14:03:32+00:00" + "time": "2017-08-20 14:03:32" }, { "name": "sebastian/diff", @@ -2627,7 +2635,7 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "time": "2017-07-01 08:51:00" }, { "name": "sebastian/exporter", @@ -2694,7 +2702,7 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" + "time": "2017-04-03 13:19:02" }, { "name": "sebastian/global-state", @@ -2792,7 +2800,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "time": "2017-08-03 12:35:26" }, { "name": "sebastian/object-reflector", @@ -2837,7 +2845,7 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "time": "2017-03-29 09:07:27" }, { "name": "sebastian/recursion-context", @@ -3020,7 +3028,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "php-di/php-di": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], diff --git a/api/index.php b/api/index.php index 05dba913..b4c3b490 100644 --- a/api/index.php +++ b/api/index.php @@ -50,7 +50,7 @@ function assertApiIsEnabled() { global $applicationContext, $hesk_settings; /* @var $apiChecker \BusinessLogic\Settings\ApiChecker */ - $apiChecker = $applicationContext->get[\BusinessLogic\Settings\ApiChecker::class]; + $apiChecker = $applicationContext->get(\BusinessLogic\Settings\ApiChecker::class); if (!$apiChecker->isApiEnabled($hesk_settings)) { print output(array('message' => 'API Disabled'), 404); @@ -77,7 +77,7 @@ function buildUserContext($xAuthToken) { global $applicationContext, $userContext, $hesk_settings; /* @var $userContextBuilder \BusinessLogic\Security\UserContextBuilder */ - $userContextBuilder = $applicationContext->get[\BusinessLogic\Security\UserContextBuilder::class]; + $userContextBuilder = $applicationContext->get(\BusinessLogic\Security\UserContextBuilder::class); $userContext = $userContextBuilder->buildUserContext($xAuthToken, $hesk_settings); } @@ -90,17 +90,13 @@ function errorHandler($errorNumber, $errorMessage, $errorFile, $errorLine) { * @param $exception Exception */ function exceptionHandler($exception) { - global $applicationContext, $userContext, $hesk_settings; + global $userContext, $hesk_settings; if (strpos($exception->getTraceAsString(), 'LoggingGateway') !== false) { //-- Suppress these for now, as it would cause issues to output two JSONs at one time. return; } - - /* @var $loggingGateway \DataAccess\Logging\LoggingGateway */ - $loggingGateway = $applicationContext->get[\DataAccess\Logging\LoggingGateway::class]; - // We don't cast API Friendly Exceptions as they're user-generated errors if (exceptionIsOfType($exception, \BusinessLogic\Exceptions\ApiFriendlyException::class)) { /* @var $castedException \BusinessLogic\Exceptions\ApiFriendlyException */ @@ -142,7 +138,7 @@ function tryToLog($location, $message, $stackTrace, $userContext, $heskSettings) global $applicationContext; /* @var $loggingGateway \DataAccess\Logging\LoggingGateway */ - $loggingGateway = $applicationContext->get[\DataAccess\Logging\LoggingGateway::class]; + $loggingGateway = $applicationContext->get(\DataAccess\Logging\LoggingGateway::class); try { return $loggingGateway->logError($location, $message, $stackTrace, $userContext, $heskSettings); From c8e2128c4cbff747f4d4ef3ceb525e55518b6d3f Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 9 Sep 2017 21:29:40 -0400 Subject: [PATCH 029/130] Switch to mike-koch/PHP-DI --- api/composer.json | 8 +--- api/composer.lock | 110 +++++++++++++++++++++------------------------- 2 files changed, 51 insertions(+), 67 deletions(-) diff --git a/api/composer.json b/api/composer.json index d5194dea..e4c083d0 100644 --- a/api/composer.json +++ b/api/composer.json @@ -12,12 +12,6 @@ "require-dev": { "phpunit/phpunit": "6.3.0" }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/mike-koch/PHP-DI" - } - ], "require": { "phpmailer/phpmailer": "^5.2", "mailgun/mailgun-php": "^2.1", @@ -25,6 +19,6 @@ "php-http/message": "^1.5", "php-http/curl-client": "^1.7", "guzzlehttp/psr7": "^1.3", - "php-di/php-di": "dev-master" + "mike-koch/php-di": "4.4.11" } } diff --git a/api/composer.lock b/api/composer.lock index c9d00a68..c5a1a92d 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "c94a62f4b72739c52334647f4b759251", + "content-hash": "f84b1b3e118e669dc5110809cbc86e4c", "packages": [ { "name": "clue/stream-filter", @@ -515,6 +515,54 @@ "description": "The Mailgun SDK provides methods for all API functions.", "time": "2017-06-20T19:56:09+00:00" }, + { + "name": "mike-koch/php-di", + "version": "4.4.11", + "source": { + "type": "git", + "url": "https://github.com/mike-koch/PHP-DI.git", + "reference": "c1a18d55666983901e542fc2626a51b831f30f0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mike-koch/PHP-DI/zipball/c1a18d55666983901e542fc2626a51b831f30f0e", + "reference": "c1a18d55666983901e542fc2626a51b831f30f0e", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.0", + "doctrine/annotations": "~1.2", + "doctrine/cache": "~1.0", + "myclabs/php-enum": "~1.1", + "ocramius/proxy-manager": "~0.5", + "php": ">=5.3.3", + "php-di/phpdoc-reader": "~1.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "DI\\": "src/DI/" + }, + "files": [ + "src/DI/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHP-DI is a Container that makes Dependency Injection as practical as possible in PHP. This fork fixes an issue in 4.x that prevented it from working in PHP 7.1.", + "homepage": "https://github.com/mike-koch/PHP-DI/", + "keywords": [ + "container", + "dependency injection", + "di" + ], + "time": "2017-09-08T02:23:09+00:00" + }, { "name": "myclabs/php-enum", "version": "1.5.2", @@ -622,62 +670,6 @@ ], "time": "2014-09-28T14:18:11+00:00" }, - { - "name": "php-di/php-di", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/mike-koch/PHP-DI.git", - "reference": "02ae2f2f79f3c09f711f8936e2c69cc65a530f1b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mike-koch/PHP-DI/zipball/02ae2f2f79f3c09f711f8936e2c69cc65a530f1b", - "reference": "02ae2f2f79f3c09f711f8936e2c69cc65a530f1b", - "shasum": "" - }, - "require": { - "container-interop/container-interop": "~1.0", - "doctrine/annotations": "~1.2", - "doctrine/cache": "~1.0", - "myclabs/php-enum": "~1.1", - "ocramius/proxy-manager": "~0.5", - "php": ">=5.3.3", - "php-di/phpdoc-reader": "~1.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "DI\\": "src/DI/" - }, - "files": [ - "src/DI/functions.php" - ] - }, - "autoload-dev": { - "psr-4": { - "DI\\Test\\IntegrationTest\\": "tests/IntegrationTest/", - "DI\\Test\\UnitTest\\": "tests/UnitTest/" - } - }, - "license": [ - "MIT" - ], - "description": "PHP-DI is a Container that makes Dependency Injection as practical as possible in PHP", - "homepage": "http://mnapoli.github.com/PHP-DI/", - "keywords": [ - "container", - "dependency injection", - "di" - ], - "support": { - "source": "https://github.com/mike-koch/PHP-DI/tree/master" - }, - "time": "2017-09-08 02:07:52" - }, { "name": "php-di/phpdoc-reader", "version": "1.3.0", @@ -3028,9 +3020,7 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "php-di/php-di": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": [], From 5b7c2f7ec7afbf553005f74c13616c9e1f92ae56 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 9 Sep 2017 22:03:42 -0400 Subject: [PATCH 030/130] Remove all manager usages --- README.md | 1 - admin/admin_reply_ticket.php | 6 +-- admin/admin_ticket.php | 51 ++++--------------- admin/change_status.php | 6 +-- admin/edit_post.php | 13 ++--- admin/manage_users.php | 36 ------------- api/BusinessLogic/Categories/Category.php | 5 -- .../Security/UserToTicketChecker.php | 6 --- .../Categories/CategoryController.php | 1 - api/DataAccess/Categories/CategoryGateway.php | 6 +-- api/DataAccess/Security/UserGateway.php | 21 -------- .../Security/UserToTicketCheckerTest.php | 19 ------- inc/common.inc.php | 1 - install/mods-for-hesk/database-validation.php | 1 - language/en/text.php | 4 -- 15 files changed, 19 insertions(+), 158 deletions(-) diff --git a/README.md b/README.md index a53bd5d5..ea4cdd5d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ Mods for HESK is a set of modifications for [HESK](https://www.hesk.com) v2.7.x,
  • Custom service message icons
  • Permission templates
  • Request users location in tickets
  • -
  • Category managers
  • Show number of merged tickets in ticket search view
  • Enable / disable staff members
  • More-restricted settings page access
  • diff --git a/admin/admin_reply_ticket.php b/admin/admin_reply_ticket.php index 96ab9f9f..aa373e96 100644 --- a/admin/admin_reply_ticket.php +++ b/admin/admin_reply_ticket.php @@ -39,9 +39,7 @@ hesk_dbConnect(); hesk_isLoggedIn(); /* Check permissions for this feature */ -if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) { - hesk_checkPermission('can_reply_tickets'); -} +hesk_checkPermission('can_reply_tickets'); /* A security check */ # hesk_token_check('POST'); @@ -281,7 +279,7 @@ if ($time_worked == '00:00:00') { $sql .= ",`time_worked` = ADDTIME(`time_worked`,'" . hesk_dbEscape($time_worked) . "') "; } -if (!empty($_POST['assign_self']) && (hesk_checkPermission('can_assign_self', 0) || (isset($_REQUEST['isManager']) && $_REQUEST['isManager']))) { +if (!empty($_POST['assign_self']) && (hesk_checkPermission('can_assign_self', 0))) { $revision = sprintf($hesklang['thist2'], hesk_date(), $_SESSION['name'] . ' (' . $_SESSION['user'] . ')', $_SESSION['name'] . ' (' . $_SESSION['user'] . ')'); $sql .= " , `owner`=" . intval($_SESSION['id']) . ", `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') "; } diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 899d37e6..3f7dfbf5 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -107,33 +107,14 @@ if ($ticket['lastreplier']) { } /* Get category name and ID */ -$result = hesk_dbQuery("SELECT `id`, `name`, `manager` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='" . intval($ticket['category']) . "' LIMIT 1"); +$result = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='" . intval($ticket['category']) . "' LIMIT 1"); /* If this category has been deleted use the default category with ID 1 */ if (hesk_dbNumRows($result) != 1) { - $result = hesk_dbQuery("SELECT `id`, `name`, `manager` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='1' LIMIT 1"); + $result = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='1' LIMIT 1"); } $category = hesk_dbFetchAssoc($result); -$managerRS = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` WHERE `id` = ' . intval($_SESSION['id'])); -$managerRow = hesk_dbFetchAssoc($managerRS); -$isManager = $managerRow['id'] == $category['manager']; -if ($isManager) { - $can_del_notes = - $can_reply = - $can_delete = - $can_edit = - $can_archive = - $can_assign_self = - $can_view_unassigned = - $can_change_own_cat = - $can_change_cat = - $can_ban_emails = - $can_unban_emails = - $can_ban_ips = - $can_unban_ips = - $can_resolve = true; -} /* Is this user allowed to view tickets inside this category? */ hesk_okCategory($category['id']); @@ -973,9 +954,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); '; - if ($isManager) { - echo ''; - } echo ' @@ -999,15 +977,12 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); '; - if ($isManager) { - echo ''; - } echo ' '; echo '

    ' . $hesklang['owner'] . '

    '; - if (hesk_checkPermission('can_assign_others', 0) || $isManager) { + if (hesk_checkPermission('can_assign_others', 0)) { echo '
    @@ -1250,15 +1225,14 @@ require_once(HESK_PATH . 'inc/footer.inc.php'); function hesk_getAdminButtons($category_id) { - global $hesk_settings, $hesklang, $modsForHesk_settings, $ticket, $reply, $trackingID, $can_edit, $can_archive, $can_delete, $can_resolve, $isManager; + global $hesk_settings, $hesklang, $modsForHesk_settings, $ticket, $reply, $trackingID, $can_edit, $can_archive, $can_delete, $can_resolve; $options = ''; /* Edit post */ if ($can_edit) { $tmp = $reply ? '&reply=' . $reply['id'] : ''; - $mgr = $isManager ? '&isManager=true' : ''; - $options .= ' ' . $hesklang['edit'] . ' '; + $options .= ' ' . $hesklang['edit'] . ' '; } @@ -1304,13 +1278,12 @@ function hesk_getAdminButtons($category_id) $isTicketClosed = $isTicketClosedRow['IsClosed']; $isClosable = $isTicketClosedRow['Closable'] == 'yes' || $isTicketClosedRow['Closable'] == 'sonly'; - $mgr = $isManager ? '&isManager=1' : ''; if ($isTicketClosed == 0 && $isClosable && $can_resolve) // Ticket is still open { - $options .= ' + $options .= ' ' . $hesklang['close_action'] . ' '; } elseif ($isTicketClosed == 1) { - $options .= ' + $options .= ' ' . $hesklang['open_action'] . ' '; } @@ -1496,7 +1469,7 @@ function hesk_getAdminButtons($category_id) function hesk_getAdminButtonsInTicket($reply = 0, $white = 1) { - global $hesk_settings, $hesklang, $ticket, $reply, $trackingID, $can_edit, $can_archive, $can_delete, $isManager; + global $hesk_settings, $hesklang, $ticket, $reply, $trackingID, $can_edit, $can_archive, $can_delete; $options = $reply ? '' : '
    '; @@ -1519,8 +1492,7 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1) /* Edit post */ if ($can_edit) { $tmp = $reply ? '&reply=' . $reply['id'] : ''; - $mgr = $isManager ? '&isManager=true' : ''; - $options .= ' ' . $hesklang['edtt'] . ' '; + $options .= ' ' . $hesklang['edtt'] . ' '; } @@ -1834,7 +1806,7 @@ function hesk_printTicketReplies() function hesk_printReplyForm() { - global $hesklang, $hesk_settings, $ticket, $admins, $can_options, $can_resolve, $options, $can_assign_self, $isManager, $modsForHesk_settings; + global $hesklang, $hesk_settings, $ticket, $admins, $can_options, $can_resolve, $options, $can_assign_self, $modsForHesk_settings; // Force assigning a ticket before allowing to reply? if ($hesk_settings['require_owner'] && ! $ticket['owner']) @@ -2056,9 +2028,6 @@ function hesk_printReplyForm()
    - - -
    diff --git a/admin/change_status.php b/admin/change_status.php index 42d002f1..d1d6551a 100644 --- a/admin/change_status.php +++ b/admin/change_status.php @@ -26,10 +26,8 @@ hesk_isLoggedIn(); $modsForHesk_settings = mfh_getSettings(); /* Check permissions for this feature */ -if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) { - hesk_checkPermission('can_view_tickets'); - hesk_checkPermission('can_reply_tickets'); -} +hesk_checkPermission('can_view_tickets'); +hesk_checkPermission('can_reply_tickets'); /* A security check */ hesk_token_check(); diff --git a/admin/edit_post.php b/admin/edit_post.php index ee3a9e19..7dcdda44 100644 --- a/admin/edit_post.php +++ b/admin/edit_post.php @@ -32,10 +32,8 @@ hesk_dbConnect(); hesk_isLoggedIn(); /* Check permissions for this feature */ -if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) { - hesk_checkPermission('can_view_tickets'); - hesk_checkPermission('can_edit_tickets'); -} +hesk_checkPermission('can_view_tickets'); +hesk_checkPermission('can_edit_tickets'); $modsForHesk_settings = mfh_getSettings(); /* Ticket ID */ @@ -61,9 +59,7 @@ if (defined('HESK_DEMO')) { } /* Is this user allowed to view tickets inside this category? */ -if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) { - hesk_okCategory($ticket['category']); -} +hesk_okCategory($ticket['category']); if (hesk_isREQUEST('reply')) { $tmpvar['id'] = intval(hesk_REQUEST('reply')) or die($hesklang['id_not_valid']); @@ -630,9 +626,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> - - - diff --git a/admin/manage_users.php b/admin/manage_users.php index 2ed5999a..4159d638 100644 --- a/admin/manage_users.php +++ b/admin/manage_users.php @@ -621,31 +621,6 @@ function update_user() hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `owner`=0 WHERE `owner`='" . intval($myuser['id']) . "' AND `category` NOT IN (" . $myuser['categories'] . ")"); } - // Find the list of categories they are manager of. If they no longer have access to the category, revoke their manager permission. - if ($myuser['isadmin']) { - // Admins can't be managers - hesk_dbQuery('UPDATE `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` SET `manager` = 0 WHERE `manager` = ' . intval($myuser['id'])); - } else { - $currentCatRs = hesk_dbQuery("SELECT `categories` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id` = '" . intval($myuser['id']) . "' LIMIT 1"); - $rowOfCategories = hesk_dbFetchAssoc($currentCatRs); - $cats = $rowOfCategories['categories']; - $currentCategories = explode(',', $cats); - $newCategories = explode(',', $myuser['categories']); - - // If any any elements are in current but not in new, add them to the revoke array - $revokeCats = array(); - foreach ($currentCategories as $currentCategory) { - if (!in_array($currentCategory, $newCategories) && $currentCategory != '') { - array_push($revokeCats, $currentCategory); - } - } - - if (count($revokeCats) > 0) { - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `manager` = 0 WHERE `id` IN (" . implode(',', $revokeCats) . ")"); - } - } - - hesk_dbQuery( "UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `user`='" . hesk_dbEscape($myuser['user']) . "', @@ -676,11 +651,6 @@ function update_user() `default_calendar_view`=" . intval($myuser['default_calendar_view']) . " WHERE `id`='" . intval($myuser['id']) . "'"); - // If they are now inactive, remove any manager rights - if (!$myuser['active']) { - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `manager` = 0 WHERE `manager` = " . intval($myuser['id'])); - } - unset($_SESSION['save_userdata']); unset($_SESSION['userdata']); @@ -844,9 +814,6 @@ function remove() hesk_process_messages($hesklang['cant_del_own'], './manage_users.php'); } - // Revoke manager rights - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `manager` = 0 WHERE `manager` = " . intval($myuser)); - /* Un-assign all tickets for this user */ $res = hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `owner`=0 WHERE `owner`='" . intval($myuser) . "'"); @@ -910,9 +877,6 @@ function toggle_active() $active = 0; $tmp = $hesklang['user_deactivated']; - // Revoke any manager rights - hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `manager` = 0 WHERE `manager` = " . intval($myuser)); - $notificationSql = ", `autoassign` = '0', `notify_new_unassigned` = '0', `notify_new_my` = '0', `notify_reply_unassigned` = '0', `notify_reply_my` = '0', `notify_assigned` = '0', `notify_pm` = '0', `notify_note` = '0', `notify_note_unassigned` = '0', `notify_overdue_unassigned` = '0'"; } diff --git a/api/BusinessLogic/Categories/Category.php b/api/BusinessLogic/Categories/Category.php index e2c3db9b..bf17c56e 100644 --- a/api/BusinessLogic/Categories/Category.php +++ b/api/BusinessLogic/Categories/Category.php @@ -51,11 +51,6 @@ class Category { */ public $priority; - /** - * @var int|null The manager for the Categories, if applicable - */ - public $manager; - /** * @var bool Indication if the user has access to the Categories */ diff --git a/api/BusinessLogic/Security/UserToTicketChecker.php b/api/BusinessLogic/Security/UserToTicketChecker.php index 9a2f9c90..0f21d785 100644 --- a/api/BusinessLogic/Security/UserToTicketChecker.php +++ b/api/BusinessLogic/Security/UserToTicketChecker.php @@ -31,12 +31,6 @@ class UserToTicketChecker { return false; } - $categoryManagerId = $this->userGateway->getManagerForCategory($ticket->categoryId, $heskSettings); - - if ($user->id === $categoryManagerId) { - return true; - } - $extraPermissions[] = UserPrivilege::CAN_VIEW_TICKETS; foreach ($extraPermissions as $permission) { diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index e72f680b..0ef2bf75 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -63,7 +63,6 @@ class CategoryController { $category->description = Helpers::safeArrayGet($json, 'description'); $category->displayBorder = Helpers::safeArrayGet($json, 'displayBorder'); $category->foregroundColor = Helpers::safeArrayGet($json, 'foregroundColor'); - $category->manager = Helpers::safeArrayGet($json, 'manager'); $category->name = Helpers::safeArrayGet($json, 'name'); $category->priority = Helpers::safeArrayGet($json, 'priority'); $category->type = Helpers::safeArrayGet($json, 'type'); diff --git a/api/DataAccess/Categories/CategoryGateway.php b/api/DataAccess/Categories/CategoryGateway.php index 2191373d..1a4c0d1c 100644 --- a/api/DataAccess/Categories/CategoryGateway.php +++ b/api/DataAccess/Categories/CategoryGateway.php @@ -41,7 +41,6 @@ class CategoryGateway extends CommonDao { $category->foregroundColor = $row['foreground_color']; $category->displayBorder = $row['display_border_outline'] === '1'; $category->priority = intval($row['priority']); - $category->manager = intval($row['manager']) == 0 ? NULL : intval($row['manager']); $category->description = $row['mfh_description']; $category->numberOfTickets = intval($row['number_of_tickets']); $results[] = $category; @@ -64,11 +63,11 @@ class CategoryGateway extends CommonDao { $newOrder = hesk_dbFetchAssoc($newOrderRs); $sql = "INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` - (`name`, `cat_order`, `autoassign`, `type`, `priority`, `manager`, `background_color`, `usage`, + (`name`, `cat_order`, `autoassign`, `type`, `priority`, `background_color`, `usage`, `foreground_color`, `display_border_outline`, `mfh_description`) VALUES ('" . hesk_dbEscape($category->name) . "', " . intval($newOrder['cat_order']) . ", '" . ($category->autoAssign ? 1 : 0) . "', '" . intval($category->type) . "', - '" . intval($category->priority) . "', " . ($category->manager === null ? 0 : intval($category->manager)) . ", + '" . intval($category->priority) . "', '" . hesk_dbEscape($category->backgroundColor) . "', " . intval($category->usage) . ", '" . hesk_dbEscape($category->foregroundColor) . "', '" . ($category->displayBorder ? 1 : 0) . "', '" . hesk_dbEscape($category->description) . "')"; @@ -95,7 +94,6 @@ class CategoryGateway extends CommonDao { `autoassign` = '" . ($category->autoAssign ? 1 : 0) . "', `type` = '" . intval($category->type) . "', `priority` = '" . intval($category->priority) . "', - `manager` = " . ($category->manager === null ? 0 : intval($category->manager)) . ", `background_color` = '" . hesk_dbEscape($category->backgroundColor) . "', `usage` = " . intval($category->usage) . ", `foreground_color` = '" . hesk_dbEscape($category->foregroundColor) . "', diff --git a/api/DataAccess/Security/UserGateway.php b/api/DataAccess/Security/UserGateway.php index e836f18a..3ed4191b 100644 --- a/api/DataAccess/Security/UserGateway.php +++ b/api/DataAccess/Security/UserGateway.php @@ -99,25 +99,4 @@ class UserGateway extends CommonDao { return $users; } - - function getManagerForCategory($categoryId, $heskSettings) { - $this->init(); - - $rs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "users` - WHERE `id` = ( - SELECT `manager` - FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "categories` - WHERE `id` = " . intval($categoryId) . ")"); - - if (hesk_dbNumRows($rs) === 0) { - $this->close(); - return null; - } - - $user = UserContext::fromDataRow(hesk_dbFetchAssoc($rs)); - - $this->close(); - - return $user; - } } \ No newline at end of file diff --git a/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php b/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php index d3afb126..07318d66 100644 --- a/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php +++ b/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php @@ -92,23 +92,4 @@ class UserToTicketCheckerTest extends TestCase { //-- Assert self::assertThat($result, self::isFalse()); } - - function testItReturnsTrueWhenTheUserDoesNotHaveEditPermissionsButIsTheCategoryManager() { - //-- Arrange - $user = new UserContext(); - $user->admin = false; - $user->categories = array(1); - $user->permissions = array(UserPrivilege::CAN_VIEW_TICKETS, 'something else'); - $user->id = 1; - $this->userGateway->method('getManagerForCategory')->willReturn(1); - - $ticket = new Ticket(); - $ticket->categoryId = 1; - - //-- Act - $result = $this->userToTicketChecker->isTicketAccessibleToUser($user, $ticket, $this->heskSettings, array(UserPrivilege::CAN_EDIT_TICKETS)); - - //-- Assert - self::assertThat($result, self::isTrue()); - } } diff --git a/inc/common.inc.php b/inc/common.inc.php index 94f487dc..ec0ed464 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -2026,7 +2026,6 @@ function hesk_getFeatureArray() 'can_service_msg', /* User can manage service messages shown in customer interface */ 'can_email_tpl', /* User can manage email templates */ 'can_man_ticket_statuses', /* User can manage ticket statuses */ - 'can_set_manager', /* User can set category managers */ 'can_man_permission_tpl', /* User can manage permission templates */ 'can_man_settings', /* User can manage helpdesk settings */ 'can_change_notification_settings', /* User can change notification settings */ diff --git a/install/mods-for-hesk/database-validation.php b/install/mods-for-hesk/database-validation.php index 22c34c98..7f1534e8 100644 --- a/install/mods-for-hesk/database-validation.php +++ b/install/mods-for-hesk/database-validation.php @@ -93,7 +93,6 @@ hesk_dbConnect(); $all_good = $all_good & run_column_check('tickets', 'longitude'); $all_good = $all_good & run_column_check('stage_tickets', 'latitude'); $all_good = $all_good & run_column_check('stage_tickets', 'longitude'); - $all_good = $all_good & run_column_check('categories', 'manager'); $all_good = $all_good & run_column_check('users', 'permission_template'); $all_good = $all_good & run_table_check('permission_templates'); $all_good = $all_good & run_column_check('permission_templates', 'id'); diff --git a/language/en/text.php b/language/en/text.php index 743ed201..c7f35f4c 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -1831,10 +1831,6 @@ $hesklang['your_current_location'] = 'Your location'; $hesklang['requesting_location_ellipsis'] = 'Requesting location...'; $hesklang['unable_to_determine_location'] = 'Unable to determine your location, or you declined to share it.'; $hesklang['save_to_see_updated_address'] = 'Save the new location to see the updated address'; -$hesklang['manager'] = 'Manager'; -$hesklang['manager_updated'] = 'Category manager has been updated.'; -$hesklang['can_set_manager'] = 'Can set category managers'; -$hesklang['no_manager'] = 'No manager'; $hesklang['manage_permission_templates'] = 'Manage Permission Templates'; $hesklang['manage_permission_templates_help'] = 'Here you can create and edit permission templates. These templates will appear when creating/editing a user. Please note that if you change the permission template\'s settings, it will NOT change the permissions of any users that are set to this permission template.'; From dd699b7165fb8dea0a06c4b143a779dc21e1744f Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 9 Sep 2017 22:06:47 -0400 Subject: [PATCH 031/130] Try fixing .gitlabci.yml --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05e2a432..22ba8e8b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,8 +5,6 @@ stages: - deploy before_script: - - apt-get update - - apt-get install zip unzip - cd api - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php @@ -24,9 +22,11 @@ deploy: when: manual stage: deploy script: + - apt-get update + - apt-get install zip unzip - composer install --no-dev - cd ../ci - bash build_zip.sh artifacts: paths: - - release.zip \ No newline at end of file + - release.zip From 3ed01ba92f3c1fbd5d82de0ec265963a7e6d3917 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 10 Sep 2017 21:44:49 -0400 Subject: [PATCH 032/130] Fix tests --- .../Categories/CategoryHandler.php | 4 -- .../Categories/CategoryHandlerTest.php | 45 +++++++++++++++++-- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 5a40255a..4c3451ac 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -114,10 +114,6 @@ class CategoryHandler { $validationModel->errorKeys[] = 'INVALID_TYPE'; } - if ($category->type === null || intval($category->type) < 0 || intval($category->type) > 2) { - $validationModel->errorKeys[] = 'INVALID_TYPE'; - } - return $validationModel; } diff --git a/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php b/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php index 32b5f99c..9cb886c9 100644 --- a/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php +++ b/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php @@ -4,34 +4,71 @@ namespace BusinessLogic\Categories; +use BusinessLogic\Security\PermissionChecker; +use BusinessLogic\Security\UserContext; +use Core\Constants\Priority; use DataAccess\Categories\CategoryGateway; +use DataAccess\Settings\ModsForHeskSettingsGateway; +use DataAccess\Tickets\TicketGateway; use PHPUnit\Framework\TestCase; class CategoryHandlerTest extends TestCase { - /* @var $categoryGateway \PHPUnit_Framework_MockObject_MockObject */ + /* @var $categoryGateway CategoryGateway|\PHPUnit_Framework_MockObject_MockObject */ private $categoryGateway; /* @var $categoryHandler CategoryHandler */ private $categoryHandler; + /* @var $ticketGateway TicketGateway|\PHPUnit_Framework_MockObject_MockObject */ + private $ticketGateway; + + /* @var $permissionChecker PermissionChecker|\PHPUnit_Framework_MockObject_MockObject */ + private $permissionChecker; + + /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway|\PHPUnit_Framework_MockObject_MockObject */ + private $modsForHeskSettingsGateway; + /* @var $heskSettings array */ private $heskSettings; protected function setUp() { $this->categoryGateway = $this->createMock(CategoryGateway::class); + $this->ticketGateway = $this->createMock(TicketGateway::class); + $this->permissionChecker = $this->createMock(PermissionChecker::class); + $this->modsForHeskSettingsGateway = $this->createMock(ModsForHeskSettingsGateway::class); - $this->categoryHandler = new CategoryHandler($this->categoryGateway); + $this->categoryHandler = new CategoryHandler($this->categoryGateway, + $this->ticketGateway, + $this->permissionChecker, + $this->modsForHeskSettingsGateway); $this->heskSettings = array(); + + //TODO write proper tests! + $this->permissionChecker->method('doesUserHavePermission')->willReturn(true); } function testCreateCallsTheGatewayWithTheCategory() { //-- Arrange $category = new Category(); + $category->autoAssign = true; + $category->backgroundColor = 'a'; + $category->foregroundColor = 'a'; + $category->catOrder = 1000; + $category->description = 'd'; + $category->displayBorder = false; + $category->name = 'n'; + $category->priority = Priority::LOW; + $category->usage = 0; + $category->type = 0; + $category->id = 1; + $this->categoryGateway->method('getAllCategories')->willReturn([$category]); //-- Assert - $this->categoryGateway->expects($this->once())->method('createCategory')->with($category, $this->heskSettings); + $this->categoryGateway->expects($this->once())->method('createCategory') + ->willReturn(1) + ->with($category, $this->heskSettings); //-- Act - $this->categoryHandler->createCategory($category, $this->heskSettings); + $this->categoryHandler->createCategory($category, new UserContext(), $this->heskSettings); } } From 560197eebeeb25af7c34cad12516a217426b26f7 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 12:34:58 -0400 Subject: [PATCH 033/130] Testing some gitlab ci changes --- .gitlab-ci.yml | 21 ++++++++++++++++++--- ci/php_lint.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 ci/php_lint.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 22ba8e8b..1fd7b24a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,24 +1,39 @@ -image: tetraweb/php - stages: - test - deploy before_script: + - bash ci/docker_install.sh > /dev/null - cd api - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php -r "unlink('composer-setup.php');" - php composer.phar update -test: +test:7.1: + image: php:7.1 stage: test script: - composer install - cd Tests - phpunit + - cd ../../ + - bash ci/php_lint.sh ./ + +test:7.0: + image: php:7.0 + stage: test + script: + - bash ci/php_lint.sh ./ + +test:5.5: + image: php:5.5 + stage: test + script: + - bash ci/php_lint.sh ./ deploy: + image: tetraweb/php when: manual stage: deploy script: diff --git a/ci/php_lint.sh b/ci/php_lint.sh new file mode 100644 index 00000000..1e0c3ad1 --- /dev/null +++ b/ci/php_lint.sh @@ -0,0 +1,33 @@ +#!/bin/bash +error=false + +while test $# -gt 0; do + current=$1 + shift + + if [ ! -d $current ] && [ ! -f $current ] ; then + echo "Invalid directory or file: $current" + error=true + + continue + fi + + for file in `find $current -type f -not -path "*vendor/*" -name "*.php"` ; do + RESULTS=`php -l $file` + echo $RESULTS + + if [ "$RESULTS" != "No syntax errors detected in $file" ] ; then + echo $RESULTS + error=true + fi + done +done + + +if [ "$error" = true ] ; then + exit 1 +else + exit 0 +fi + + From 3b0c8ad3a6c192ccf26f31c194f1c7d6c27a5b31 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 12:43:11 -0400 Subject: [PATCH 034/130] More CI changes --- .gitlab-ci.yml | 56 +++++++++++++++++++++++++++++++++++++------------- ci/php_lint.sh | 2 +- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1fd7b24a..c6cc1486 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: + - validate - test - - deploy + - package before_script: - bash ci/docker_install.sh > /dev/null @@ -8,34 +9,61 @@ before_script: - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php composer-setup.php - php -r "unlink('composer-setup.php');" - - php composer.phar update -test:7.1: +validate:7.1: image: php:7.1 - stage: test + stage: validate script: - - composer install - - cd Tests - - phpunit - - cd ../../ + - php composer.phar update --no-dev + - php composer.phar install --no-dev - bash ci/php_lint.sh ./ -test:7.0: +validate:7.0: image: php:7.0 - stage: test + stage: validate script: + - php composer.phar update --no-dev + - php composer.phar install --no-dev - bash ci/php_lint.sh ./ -test:5.5: +validate:5.6: + image: php:5.6 + stage: validate + script: + - php composer.phar update --no-dev + - php composer.phar install --no-dev + - bash ci/php_lint.sh ./ + +validate:5.5: image: php:5.5 - stage: test + stage: validate script: + - php composer.phar update --no-dev + - php composer.phar install --no-dev - bash ci/php_lint.sh ./ -deploy: +test:7.1: + image: php:7.1 + stage: test + script: + - php composer.phar update + - php composer.phar install + - cd Tests + - phpunit + +test:7.0: + image: php:7.0 + stage: test + script: + - php composer.phar update + - php composer.phar install + - cd Tests + - phpunit + +package: image: tetraweb/php when: manual - stage: deploy + stage: package script: - apt-get update - apt-get install zip unzip diff --git a/ci/php_lint.sh b/ci/php_lint.sh index 1e0c3ad1..8c58e1aa 100644 --- a/ci/php_lint.sh +++ b/ci/php_lint.sh @@ -12,7 +12,7 @@ while test $# -gt 0; do continue fi - for file in `find $current -type f -not -path "*vendor/*" -name "*.php"` ; do + for file in `find $current -type f -not -path "*vendor/*" -not -path "*api/*" -name "*.php"` ; do RESULTS=`php -l $file` echo $RESULTS From 02ccb65b27f211e0da5c39f630b1e2212f60bf31 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 12:46:26 -0400 Subject: [PATCH 035/130] More changes --- .gitlab-ci.yml | 8 -------- ci/php_lint.sh | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6cc1486..b7b12e73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,32 +14,24 @@ validate:7.1: image: php:7.1 stage: validate script: - - php composer.phar update --no-dev - - php composer.phar install --no-dev - bash ci/php_lint.sh ./ validate:7.0: image: php:7.0 stage: validate script: - - php composer.phar update --no-dev - - php composer.phar install --no-dev - bash ci/php_lint.sh ./ validate:5.6: image: php:5.6 stage: validate script: - - php composer.phar update --no-dev - - php composer.phar install --no-dev - bash ci/php_lint.sh ./ validate:5.5: image: php:5.5 stage: validate script: - - php composer.phar update --no-dev - - php composer.phar install --no-dev - bash ci/php_lint.sh ./ test:7.1: diff --git a/ci/php_lint.sh b/ci/php_lint.sh index 8c58e1aa..1e0c3ad1 100644 --- a/ci/php_lint.sh +++ b/ci/php_lint.sh @@ -12,7 +12,7 @@ while test $# -gt 0; do continue fi - for file in `find $current -type f -not -path "*vendor/*" -not -path "*api/*" -name "*.php"` ; do + for file in `find $current -type f -not -path "*vendor/*" -name "*.php"` ; do RESULTS=`php -l $file` echo $RESULTS From 0f902f683c6486c214ddcc9a7c15ac543fc09770 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 12:48:34 -0400 Subject: [PATCH 036/130] More CI fixes --- .gitlab-ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b7b12e73..dfe1eb8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,10 +5,6 @@ stages: before_script: - bash ci/docker_install.sh > /dev/null - - cd api - - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - - php composer-setup.php - - php -r "unlink('composer-setup.php');" validate:7.1: image: php:7.1 @@ -38,6 +34,10 @@ test:7.1: image: php:7.1 stage: test script: + - cd api + - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + - php composer-setup.php + - php -r "unlink('composer-setup.php');" - php composer.phar update - php composer.phar install - cd Tests @@ -47,6 +47,10 @@ test:7.0: image: php:7.0 stage: test script: + - cd api + - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + - php composer-setup.php + - php -r "unlink('composer-setup.php');" - php composer.phar update - php composer.phar install - cd Tests From 37d730dfdcb1884b4a4689deffbb5c112badaf87 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 12:55:56 -0400 Subject: [PATCH 037/130] Fix a syntax error in PHP 5.5 --- api/RequestMethod.php | 5 ++++- api/index.php | 30 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/api/RequestMethod.php b/api/RequestMethod.php index e692c03d..d6423708 100644 --- a/api/RequestMethod.php +++ b/api/RequestMethod.php @@ -6,5 +6,8 @@ class RequestMethod { const PUT = 'PUT'; const DELETE = 'DELETE'; const PATCH = 'PATCH'; - const ALL = [self::GET, self::POST, self::PUT, self::DELETE, self::PATCH]; + + static function all() { + return array(self::GET, self::POST, self::PUT, self::DELETE, self::PATCH); + } } \ No newline at end of file diff --git a/api/index.php b/api/index.php index b4c3b490..c8115d2c 100644 --- a/api/index.php +++ b/api/index.php @@ -188,36 +188,36 @@ Link::all(array( '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), '/v1-internal/categories/{i}/sort/{s}' => action(\Controllers\Categories\CategoryController::class . '::sort', [RequestMethod::POST], SecurityHandler::INTERNAL), // Tickets - '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::class), + '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::class, RequestMethod::all()), // Tickets - Staff - '/v1/staff/tickets/{i}' => action(\Controllers\Tickets\StaffTicketController::class), + '/v1/staff/tickets/{i}' => action(\Controllers\Tickets\StaffTicketController::class, RequestMethod::all()), // Attachments - '/v1/tickets/{a}/attachments/{i}' => action(\Controllers\Attachments\PublicAttachmentController::class . '::getRaw'), - '/v1/staff/tickets/{i}/attachments' => action(\Controllers\Attachments\StaffTicketAttachmentsController::class), - '/v1/staff/tickets/{i}/attachments/{i}' => action(\Controllers\Attachments\StaffTicketAttachmentsController::class), + '/v1/tickets/{a}/attachments/{i}' => action(\Controllers\Attachments\PublicAttachmentController::class . '::getRaw', RequestMethod::all()), + '/v1/staff/tickets/{i}/attachments' => action(\Controllers\Attachments\StaffTicketAttachmentsController::class, RequestMethod::all()), + '/v1/staff/tickets/{i}/attachments/{i}' => action(\Controllers\Attachments\StaffTicketAttachmentsController::class, RequestMethod::all()), // Statuses - '/v1/statuses' => action(\Controllers\Statuses\StatusController::class), + '/v1/statuses' => action(\Controllers\Statuses\StatusController::class, RequestMethod::all()), // Settings - '/v1/settings' => action(\Controllers\Settings\SettingsController::class), + '/v1/settings' => action(\Controllers\Settings\SettingsController::class, RequestMethod::all()), /* Internal use only routes */ // Resend email response '/v1-internal/staff/tickets/{i}/resend-email' => - action(\Controllers\Tickets\ResendTicketEmailToCustomerController::class, RequestMethod::ALL, SecurityHandler::INTERNAL), + action(\Controllers\Tickets\ResendTicketEmailToCustomerController::class, RequestMethod::all(), SecurityHandler::INTERNAL), // Custom Navigation '/v1-internal/custom-navigation/all' => - action(\Controllers\Navigation\CustomNavElementController::class . '::getAll', RequestMethod::ALL, SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class . '::getAll', RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-internal/custom-navigation' => - action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::ALL, SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-internal/custom-navigation/{i}' => - action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::ALL, SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-internal/custom-navigation/{i}/sort/{s}' => - action(\Controllers\Navigation\CustomNavElementController::class . '::sort', RequestMethod::ALL, SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::class . '::sort', RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-public/hesk-version' => - action(\Controllers\System\HeskVersionController::class . '::getHeskVersion', RequestMethod::ALL, SecurityHandler::OPEN), + action(\Controllers\System\HeskVersionController::class . '::getHeskVersion', RequestMethod::all(), SecurityHandler::OPEN), '/v1-public/mods-for-hesk-version' => - action(\Controllers\System\HeskVersionController::class . '::getModsForHeskVersion', RequestMethod::ALL, SecurityHandler::OPEN), + action(\Controllers\System\HeskVersionController::class . '::getModsForHeskVersion', RequestMethod::all(), SecurityHandler::OPEN), // Any URL that doesn't match goes to the 404 handler '404' => 'handle404' @@ -229,7 +229,7 @@ Link::all(array( * @param $securityHandler string The proper security handler * @return array The configured path */ -function action($class, $requestMethods = RequestMethod::ALL, $securityHandler = SecurityHandler::AUTH_TOKEN) { +function action($class, $requestMethods, $securityHandler = SecurityHandler::AUTH_TOKEN) { return [$class, $class, $securityHandler, $requestMethods]; } From 3c4018ace3f409f6abf96bb8e4d050d16cb6c0bb Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 12:56:18 -0400 Subject: [PATCH 038/130] Add validation steps for PHP 5.4 and 5.3 --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfe1eb8e..f9779aa5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,18 @@ validate:5.5: script: - bash ci/php_lint.sh ./ +validate:5.4: + image: php:5.4 + stage: validate + script: + - bash ci/php_lint.sh ./ + +validate:5.3: + image: php:5.3 + stage: validate + script: + - bash ci/php_lint.sh ./ + test:7.1: image: php:7.1 stage: test From 016a50878df484f5666b21d4573a67dc3aa4105b Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 21:03:03 -0400 Subject: [PATCH 039/130] Add a BaseClass/BaseException for 5.4 compatibility --- api/BaseClass.php | 7 +++ api/BaseException.php | 7 +++ api/BusinessLogic/Attachments/Attachment.php | 2 +- .../Attachments/AttachmentHandler.php | 2 +- .../Attachments/AttachmentRetriever.php | 2 +- .../Attachments/AttachmentType.php | 2 +- .../Attachments/CreateAttachmentModel.php | 2 +- api/BusinessLogic/Categories/Category.php | 2 +- .../Categories/CategoryHandler.php | 2 +- .../Categories/CategoryRetriever.php | 2 +- api/BusinessLogic/Emails/Addressees.php | 2 +- api/BusinessLogic/Emails/BasicEmailSender.php | 2 +- api/BusinessLogic/Emails/EmailBuilder.php | 2 +- .../Emails/EmailSenderHelper.php | 2 +- api/BusinessLogic/Emails/EmailTemplate.php | 2 +- .../Emails/EmailTemplateParser.php | 2 +- .../Emails/EmailTemplateRetriever.php | 2 +- .../Emails/MailgunEmailSender.php | 2 +- .../Emails/ParsedEmailProperties.php | 2 +- .../Exceptions/ApiFriendlyException.php | 2 +- api/BusinessLogic/Helpers.php | 2 +- .../Navigation/CustomNavElement.php | 2 +- .../Navigation/CustomNavElementHandler.php | 2 +- .../Navigation/CustomNavElementPlace.php | 2 +- api/BusinessLogic/Navigation/Direction.php | 2 +- api/BusinessLogic/Security/BanRetriever.php | 2 +- api/BusinessLogic/Security/BannedEmail.php | 2 +- api/BusinessLogic/Security/BannedIp.php | 2 +- .../Security/PermissionChecker.php | 2 +- api/BusinessLogic/Security/UserContext.php | 2 +- .../Security/UserContextBuilder.php | 2 +- .../Security/UserContextNotifications.php | 2 +- .../Security/UserContextPreferences.php | 2 +- api/BusinessLogic/Security/UserPrivilege.php | 2 +- .../Security/UserToTicketChecker.php | 2 +- api/BusinessLogic/Settings/ApiChecker.php | 2 +- .../Settings/SettingsRetriever.php | 2 +- api/BusinessLogic/Statuses/Closable.php | 2 +- .../Statuses/DefaultStatusForAction.php | 2 +- api/BusinessLogic/Statuses/Status.php | 2 +- .../Statuses/StatusRetriever.php | 2 +- api/BusinessLogic/Tickets/Attachment.php | 2 +- api/BusinessLogic/Tickets/Autoassigner.php | 2 +- .../Tickets/CreateTicketByCustomerModel.php | 2 +- .../Tickets/CreatedTicketModel.php | 2 +- .../CustomFields/CustomFieldValidator.php | 2 +- api/BusinessLogic/Tickets/EditTicketModel.php | 2 +- .../UnableToGenerateTrackingIdException.php | 4 +- .../Tickets/NewTicketValidator.php | 2 +- api/BusinessLogic/Tickets/Reply.php | 2 +- api/BusinessLogic/Tickets/Ticket.php | 2 +- api/BusinessLogic/Tickets/TicketCreator.php | 2 +- api/BusinessLogic/Tickets/TicketDeleter.php | 2 +- api/BusinessLogic/Tickets/TicketEditor.php | 2 +- .../Tickets/TicketGatewayGeneratedFields.php | 2 +- api/BusinessLogic/Tickets/TicketRetriever.php | 2 +- .../Tickets/TicketValidators.php | 2 +- .../Tickets/TrackingIdGenerator.php | 2 +- .../Tickets/VerifiedEmailChecker.php | 2 +- api/BusinessLogic/ValidationModel.php | 2 +- api/BusinessLogic/Validators.php | 2 +- .../PublicAttachmentController.php | 2 +- .../StaffTicketAttachmentsController.php | 2 +- .../Categories/CategoryController.php | 2 +- api/Controllers/InternalApiController.php | 2 +- api/Controllers/JsonRetriever.php | 2 +- .../Settings/SettingsController.php | 2 +- api/Controllers/Statuses/StatusController.php | 2 +- .../System/HeskVersionController.php | 2 +- .../Tickets/CustomerTicketController.php | 2 +- .../Tickets/StaffTicketController.php | 2 +- api/Core/Constants/CustomField.php | 2 +- api/Core/Constants/Priority.php | 2 +- api/Core/Exceptions/SQLException.php | 4 +- api/DataAccess/CommonDao.php | 2 +- api/DataAccess/Files/FileDeleter.php | 4 +- api/DataAccess/Files/FileReader.php | 2 +- api/DataAccess/Files/FileWriter.php | 2 +- api/DataAccess/Logging/Severity.php | 2 +- api/Link.php | 2 +- api/index.php | 46 +++++++++---------- 81 files changed, 115 insertions(+), 107 deletions(-) create mode 100644 api/BaseClass.php create mode 100644 api/BaseException.php diff --git a/api/BaseClass.php b/api/BaseClass.php new file mode 100644 index 00000000..51ca30ae --- /dev/null +++ b/api/BaseClass.php @@ -0,0 +1,7 @@ +subject = $subject; $this->message = $message; diff --git a/api/BusinessLogic/Exceptions/ApiFriendlyException.php b/api/BusinessLogic/Exceptions/ApiFriendlyException.php index f9fac53b..b9db70e8 100644 --- a/api/BusinessLogic/Exceptions/ApiFriendlyException.php +++ b/api/BusinessLogic/Exceptions/ApiFriendlyException.php @@ -5,7 +5,7 @@ namespace BusinessLogic\Exceptions; use Exception; -class ApiFriendlyException extends Exception { +class ApiFriendlyException extends \BaseException { public $title; public $httpResponseCode; diff --git a/api/BusinessLogic/Helpers.php b/api/BusinessLogic/Helpers.php index 61f6af2d..5a36c723 100644 --- a/api/BusinessLogic/Helpers.php +++ b/api/BusinessLogic/Helpers.php @@ -3,7 +3,7 @@ namespace BusinessLogic; -class Helpers { +class Helpers extends \BaseClass { static function getHeader($key) { $headers = getallheaders(); diff --git a/api/BusinessLogic/Navigation/CustomNavElement.php b/api/BusinessLogic/Navigation/CustomNavElement.php index 74b4ca1a..dfaf43f2 100644 --- a/api/BusinessLogic/Navigation/CustomNavElement.php +++ b/api/BusinessLogic/Navigation/CustomNavElement.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Navigation; -class CustomNavElement { +class CustomNavElement extends \BaseClass { /* @var $id int*/ public $id; diff --git a/api/BusinessLogic/Navigation/CustomNavElementHandler.php b/api/BusinessLogic/Navigation/CustomNavElementHandler.php index 8f5ac644..85fba023 100644 --- a/api/BusinessLogic/Navigation/CustomNavElementHandler.php +++ b/api/BusinessLogic/Navigation/CustomNavElementHandler.php @@ -6,7 +6,7 @@ namespace BusinessLogic\Navigation; use BusinessLogic\Exceptions\ApiFriendlyException; use DataAccess\Navigation\CustomNavElementGateway; -class CustomNavElementHandler { +class CustomNavElementHandler extends \BaseClass { /* @var $customNavElementGateway CustomNavElementGateway */ private $customNavElementGateway; diff --git a/api/BusinessLogic/Navigation/CustomNavElementPlace.php b/api/BusinessLogic/Navigation/CustomNavElementPlace.php index 3114fdc7..2a2984b9 100644 --- a/api/BusinessLogic/Navigation/CustomNavElementPlace.php +++ b/api/BusinessLogic/Navigation/CustomNavElementPlace.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Navigation; -class CustomNavElementPlace { +class CustomNavElementPlace extends \BaseClass { const HOMEPAGE_BLOCK = 1; const CUSTOMER_NAVIGATION = 2; const ADMIN_NAVIGATION = 3; diff --git a/api/BusinessLogic/Navigation/Direction.php b/api/BusinessLogic/Navigation/Direction.php index f14a00cf..390b9915 100644 --- a/api/BusinessLogic/Navigation/Direction.php +++ b/api/BusinessLogic/Navigation/Direction.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Navigation; -class Direction { +class Direction extends \BaseClass { const UP = 'up'; const DOWN = 'down'; } \ No newline at end of file diff --git a/api/BusinessLogic/Security/BanRetriever.php b/api/BusinessLogic/Security/BanRetriever.php index 66213cf5..4d1676fe 100644 --- a/api/BusinessLogic/Security/BanRetriever.php +++ b/api/BusinessLogic/Security/BanRetriever.php @@ -5,7 +5,7 @@ namespace BusinessLogic\Security; use DataAccess\Security\BanGateway; -class BanRetriever { +class BanRetriever extends \BaseClass { /** * @var BanGateway */ diff --git a/api/BusinessLogic/Security/BannedEmail.php b/api/BusinessLogic/Security/BannedEmail.php index 691a6604..9cd4a408 100644 --- a/api/BusinessLogic/Security/BannedEmail.php +++ b/api/BusinessLogic/Security/BannedEmail.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Security; -class BannedEmail { +class BannedEmail extends \BaseClass { /** * @var int */ diff --git a/api/BusinessLogic/Security/BannedIp.php b/api/BusinessLogic/Security/BannedIp.php index e34b2516..f2c8572b 100644 --- a/api/BusinessLogic/Security/BannedIp.php +++ b/api/BusinessLogic/Security/BannedIp.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Security; -class BannedIp { +class BannedIp extends \BaseClass { /** * @var int */ diff --git a/api/BusinessLogic/Security/PermissionChecker.php b/api/BusinessLogic/Security/PermissionChecker.php index cf2b1a43..de47465f 100644 --- a/api/BusinessLogic/Security/PermissionChecker.php +++ b/api/BusinessLogic/Security/PermissionChecker.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Security; -class PermissionChecker { +class PermissionChecker extends \BaseClass { /** * @param $userContext UserContext * @param $permission string diff --git a/api/BusinessLogic/Security/UserContext.php b/api/BusinessLogic/Security/UserContext.php index 0beedc07..ee1522a9 100644 --- a/api/BusinessLogic/Security/UserContext.php +++ b/api/BusinessLogic/Security/UserContext.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Security; -class UserContext { +class UserContext extends \BaseClass { /* @var $id int */ public $id; diff --git a/api/BusinessLogic/Security/UserContextBuilder.php b/api/BusinessLogic/Security/UserContextBuilder.php index 7bb975ee..a236f4be 100644 --- a/api/BusinessLogic/Security/UserContextBuilder.php +++ b/api/BusinessLogic/Security/UserContextBuilder.php @@ -8,7 +8,7 @@ use BusinessLogic\Exceptions\MissingAuthenticationTokenException; use BusinessLogic\Helpers; use DataAccess\Security\UserGateway; -class UserContextBuilder { +class UserContextBuilder extends \BaseClass { /** * @var UserGateway */ diff --git a/api/BusinessLogic/Security/UserContextNotifications.php b/api/BusinessLogic/Security/UserContextNotifications.php index 9c32547c..c75742f4 100644 --- a/api/BusinessLogic/Security/UserContextNotifications.php +++ b/api/BusinessLogic/Security/UserContextNotifications.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Security; -class UserContextNotifications { +class UserContextNotifications extends \BaseClass { public $newUnassigned; public $newAssignedToMe; public $replyUnassigned; diff --git a/api/BusinessLogic/Security/UserContextPreferences.php b/api/BusinessLogic/Security/UserContextPreferences.php index f860d3ec..b342070c 100644 --- a/api/BusinessLogic/Security/UserContextPreferences.php +++ b/api/BusinessLogic/Security/UserContextPreferences.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Security; -class UserContextPreferences { +class UserContextPreferences extends \BaseClass { public $afterReply; public $autoStartTimeWorked; public $autoreload; diff --git a/api/BusinessLogic/Security/UserPrivilege.php b/api/BusinessLogic/Security/UserPrivilege.php index 1e90ff70..353e8e43 100644 --- a/api/BusinessLogic/Security/UserPrivilege.php +++ b/api/BusinessLogic/Security/UserPrivilege.php @@ -9,7 +9,7 @@ namespace BusinessLogic\Security; -class UserPrivilege { +class UserPrivilege extends \BaseClass { const CAN_VIEW_TICKETS = 'can_view_tickets'; const CAN_REPLY_TO_TICKETS = 'can_reply_tickets'; const CAN_EDIT_TICKETS = 'can_edit_tickets'; diff --git a/api/BusinessLogic/Security/UserToTicketChecker.php b/api/BusinessLogic/Security/UserToTicketChecker.php index 0f21d785..13d88226 100644 --- a/api/BusinessLogic/Security/UserToTicketChecker.php +++ b/api/BusinessLogic/Security/UserToTicketChecker.php @@ -6,7 +6,7 @@ namespace BusinessLogic\Security; use BusinessLogic\Tickets\Ticket; use DataAccess\Security\UserGateway; -class UserToTicketChecker { +class UserToTicketChecker extends \BaseClass { /* @var $userGateway UserGateway */ private $userGateway; diff --git a/api/BusinessLogic/Settings/ApiChecker.php b/api/BusinessLogic/Settings/ApiChecker.php index 8645dd5c..da1a3d11 100644 --- a/api/BusinessLogic/Settings/ApiChecker.php +++ b/api/BusinessLogic/Settings/ApiChecker.php @@ -5,7 +5,7 @@ namespace BusinessLogic\Settings; use DataAccess\Settings\ModsForHeskSettingsGateway; -class ApiChecker { +class ApiChecker extends \BaseClass { /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ private $modsForHeskSettingsGateway; diff --git a/api/BusinessLogic/Settings/SettingsRetriever.php b/api/BusinessLogic/Settings/SettingsRetriever.php index 21eeb13a..a18ce15a 100644 --- a/api/BusinessLogic/Settings/SettingsRetriever.php +++ b/api/BusinessLogic/Settings/SettingsRetriever.php @@ -5,7 +5,7 @@ namespace BusinessLogic\Settings; // TODO Test! use DataAccess\Settings\ModsForHeskSettingsGateway; -class SettingsRetriever { +class SettingsRetriever extends \BaseClass { /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ private $modsForHeskSettingsGateway; diff --git a/api/BusinessLogic/Statuses/Closable.php b/api/BusinessLogic/Statuses/Closable.php index 9d87efca..2dd68c03 100644 --- a/api/BusinessLogic/Statuses/Closable.php +++ b/api/BusinessLogic/Statuses/Closable.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Statuses; -class Closable { +class Closable extends \BaseClass { const YES = "yes"; const STAFF_ONLY = "sonly"; const CUSTOMERS_ONLY = "conly"; diff --git a/api/BusinessLogic/Statuses/DefaultStatusForAction.php b/api/BusinessLogic/Statuses/DefaultStatusForAction.php index bfafff7c..a6ce7ac6 100644 --- a/api/BusinessLogic/Statuses/DefaultStatusForAction.php +++ b/api/BusinessLogic/Statuses/DefaultStatusForAction.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Statuses; -class DefaultStatusForAction { +class DefaultStatusForAction extends \BaseClass { const NEW_TICKET = "IsNewTicketStatus"; const CLOSED_STATUS = "IsClosed"; const CLOSED_BY_CLIENT = "IsClosedByClient"; diff --git a/api/BusinessLogic/Statuses/Status.php b/api/BusinessLogic/Statuses/Status.php index c5ef3242..fc5babd4 100644 --- a/api/BusinessLogic/Statuses/Status.php +++ b/api/BusinessLogic/Statuses/Status.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Statuses; -class Status { +class Status extends \BaseClass { static function fromDatabase($row, $languageRs) { $status = new Status(); $status->id = intval($row['ID']); diff --git a/api/BusinessLogic/Statuses/StatusRetriever.php b/api/BusinessLogic/Statuses/StatusRetriever.php index 181ceae1..a16d0ca7 100644 --- a/api/BusinessLogic/Statuses/StatusRetriever.php +++ b/api/BusinessLogic/Statuses/StatusRetriever.php @@ -6,7 +6,7 @@ namespace BusinessLogic\Statuses; use DataAccess\Statuses\StatusGateway; // TODO Test! -class StatusRetriever { +class StatusRetriever extends \BaseClass { /* @var $statusGateway StatusGateway */ private $statusGateway; diff --git a/api/BusinessLogic/Tickets/Attachment.php b/api/BusinessLogic/Tickets/Attachment.php index 295864bc..e665f69b 100644 --- a/api/BusinessLogic/Tickets/Attachment.php +++ b/api/BusinessLogic/Tickets/Attachment.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Tickets; -class Attachment { +class Attachment extends \BaseClass { /** * @var int */ diff --git a/api/BusinessLogic/Tickets/Autoassigner.php b/api/BusinessLogic/Tickets/Autoassigner.php index e4095815..fd9797b9 100644 --- a/api/BusinessLogic/Tickets/Autoassigner.php +++ b/api/BusinessLogic/Tickets/Autoassigner.php @@ -8,7 +8,7 @@ use BusinessLogic\Security\UserPrivilege; use DataAccess\Categories\CategoryGateway; use DataAccess\Security\UserGateway; -class Autoassigner { +class Autoassigner extends \BaseClass { /* @var $categoryGateway CategoryGateway */ private $categoryGateway; diff --git a/api/BusinessLogic/Tickets/CreateTicketByCustomerModel.php b/api/BusinessLogic/Tickets/CreateTicketByCustomerModel.php index 7163e6b8..d5fa6126 100644 --- a/api/BusinessLogic/Tickets/CreateTicketByCustomerModel.php +++ b/api/BusinessLogic/Tickets/CreateTicketByCustomerModel.php @@ -2,7 +2,7 @@ namespace BusinessLogic\Tickets; -class CreateTicketByCustomerModel { +class CreateTicketByCustomerModel extends \BaseClass { /** * @var string */ diff --git a/api/BusinessLogic/Tickets/CreatedTicketModel.php b/api/BusinessLogic/Tickets/CreatedTicketModel.php index daeee757..a45385e9 100644 --- a/api/BusinessLogic/Tickets/CreatedTicketModel.php +++ b/api/BusinessLogic/Tickets/CreatedTicketModel.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Tickets; -class CreatedTicketModel { +class CreatedTicketModel extends \BaseClass { /* @var $ticket Ticket */ public $ticket; diff --git a/api/BusinessLogic/Tickets/CustomFields/CustomFieldValidator.php b/api/BusinessLogic/Tickets/CustomFields/CustomFieldValidator.php index 12e1ccc7..dee499b9 100644 --- a/api/BusinessLogic/Tickets/CustomFields/CustomFieldValidator.php +++ b/api/BusinessLogic/Tickets/CustomFields/CustomFieldValidator.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Tickets\CustomFields; -class CustomFieldValidator { +class CustomFieldValidator extends \BaseClass { static function isCustomFieldInCategory($customFieldId, $categoryId, $staff, $heskSettings) { $customField = $heskSettings['custom_fields']["custom{$customFieldId}"]; diff --git a/api/BusinessLogic/Tickets/EditTicketModel.php b/api/BusinessLogic/Tickets/EditTicketModel.php index 21e95ef1..b1b0fdd2 100644 --- a/api/BusinessLogic/Tickets/EditTicketModel.php +++ b/api/BusinessLogic/Tickets/EditTicketModel.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Tickets; -class EditTicketModel { +class EditTicketModel extends \BaseClass { /* @var $id int */ public $id; diff --git a/api/BusinessLogic/Tickets/Exceptions/UnableToGenerateTrackingIdException.php b/api/BusinessLogic/Tickets/Exceptions/UnableToGenerateTrackingIdException.php index 0d2718a8..65e041d2 100644 --- a/api/BusinessLogic/Tickets/Exceptions/UnableToGenerateTrackingIdException.php +++ b/api/BusinessLogic/Tickets/Exceptions/UnableToGenerateTrackingIdException.php @@ -3,9 +3,7 @@ namespace BusinessLogic\Tickets\Exceptions; -use Exception; - -class UnableToGenerateTrackingIdException extends Exception { +class UnableToGenerateTrackingIdException extends \BaseException { public function __construct() { parent::__construct("Error generating a unique ticket ID."); } diff --git a/api/BusinessLogic/Tickets/NewTicketValidator.php b/api/BusinessLogic/Tickets/NewTicketValidator.php index 7697f860..8f1c10d6 100644 --- a/api/BusinessLogic/Tickets/NewTicketValidator.php +++ b/api/BusinessLogic/Tickets/NewTicketValidator.php @@ -10,7 +10,7 @@ use BusinessLogic\ValidationModel; use BusinessLogic\Validators; use Core\Constants\CustomField; -class NewTicketValidator { +class NewTicketValidator extends \BaseClass { /** * @var $categoryRetriever CategoryRetriever */ diff --git a/api/BusinessLogic/Tickets/Reply.php b/api/BusinessLogic/Tickets/Reply.php index 77c1d4b9..3c623f2c 100644 --- a/api/BusinessLogic/Tickets/Reply.php +++ b/api/BusinessLogic/Tickets/Reply.php @@ -9,7 +9,7 @@ namespace BusinessLogic\Tickets; -class Reply { +class Reply extends \BaseClass { /** * @var $id int */ diff --git a/api/BusinessLogic/Tickets/Ticket.php b/api/BusinessLogic/Tickets/Ticket.php index 42eda13c..0b7c56cf 100644 --- a/api/BusinessLogic/Tickets/Ticket.php +++ b/api/BusinessLogic/Tickets/Ticket.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Tickets; -class Ticket { +class Ticket extends \BaseClass { static function fromDatabaseRow($row, $linkedTicketsRs, $repliesRs, $heskSettings) { $ticket = new Ticket(); $ticket->id = intval($row['id']); diff --git a/api/BusinessLogic/Tickets/TicketCreator.php b/api/BusinessLogic/Tickets/TicketCreator.php index d9e8c346..7f677c50 100644 --- a/api/BusinessLogic/Tickets/TicketCreator.php +++ b/api/BusinessLogic/Tickets/TicketCreator.php @@ -12,7 +12,7 @@ use DataAccess\Settings\ModsForHeskSettingsGateway; use DataAccess\Statuses\StatusGateway; use DataAccess\Tickets\TicketGateway; -class TicketCreator { +class TicketCreator extends \BaseClass { /** * @var $newTicketValidator NewTicketValidator */ diff --git a/api/BusinessLogic/Tickets/TicketDeleter.php b/api/BusinessLogic/Tickets/TicketDeleter.php index 7d1fa4d9..bbc22c2a 100644 --- a/api/BusinessLogic/Tickets/TicketDeleter.php +++ b/api/BusinessLogic/Tickets/TicketDeleter.php @@ -10,7 +10,7 @@ use BusinessLogic\Security\UserPrivilege; use BusinessLogic\Security\UserToTicketChecker; use DataAccess\Tickets\TicketGateway; -class TicketDeleter { +class TicketDeleter extends \BaseClass { /* @var $ticketGateway TicketGateway */ private $ticketGateway; diff --git a/api/BusinessLogic/Tickets/TicketEditor.php b/api/BusinessLogic/Tickets/TicketEditor.php index ac0bca61..e15b33d9 100644 --- a/api/BusinessLogic/Tickets/TicketEditor.php +++ b/api/BusinessLogic/Tickets/TicketEditor.php @@ -15,7 +15,7 @@ use BusinessLogic\Validators; use Core\Constants\CustomField; use DataAccess\Tickets\TicketGateway; -class TicketEditor { +class TicketEditor extends \BaseClass { /* @var $ticketGateway TicketGateway */ private $ticketGateway; diff --git a/api/BusinessLogic/Tickets/TicketGatewayGeneratedFields.php b/api/BusinessLogic/Tickets/TicketGatewayGeneratedFields.php index 56c2a8b3..602321f8 100644 --- a/api/BusinessLogic/Tickets/TicketGatewayGeneratedFields.php +++ b/api/BusinessLogic/Tickets/TicketGatewayGeneratedFields.php @@ -3,7 +3,7 @@ namespace BusinessLogic\Tickets; -class TicketGatewayGeneratedFields { +class TicketGatewayGeneratedFields extends \BaseClass { public $id; public $dateCreated; public $dateModified; diff --git a/api/BusinessLogic/Tickets/TicketRetriever.php b/api/BusinessLogic/Tickets/TicketRetriever.php index 569210ef..ec71329d 100644 --- a/api/BusinessLogic/Tickets/TicketRetriever.php +++ b/api/BusinessLogic/Tickets/TicketRetriever.php @@ -10,7 +10,7 @@ use BusinessLogic\Security\UserToTicketChecker; use BusinessLogic\ValidationModel; use DataAccess\Tickets\TicketGateway; -class TicketRetriever { +class TicketRetriever extends \BaseClass { /** * @var $ticketGateway TicketGateway */ diff --git a/api/BusinessLogic/Tickets/TicketValidators.php b/api/BusinessLogic/Tickets/TicketValidators.php index ff310757..ce9d9582 100644 --- a/api/BusinessLogic/Tickets/TicketValidators.php +++ b/api/BusinessLogic/Tickets/TicketValidators.php @@ -4,7 +4,7 @@ namespace BusinessLogic\Tickets; use DataAccess\Tickets\TicketGateway; -class TicketValidators { +class TicketValidators extends \BaseClass { /** * @var $ticketGateway TicketGateway */ diff --git a/api/BusinessLogic/Tickets/TrackingIdGenerator.php b/api/BusinessLogic/Tickets/TrackingIdGenerator.php index 892953e5..c397c7c2 100644 --- a/api/BusinessLogic/Tickets/TrackingIdGenerator.php +++ b/api/BusinessLogic/Tickets/TrackingIdGenerator.php @@ -6,7 +6,7 @@ namespace BusinessLogic\Tickets; use BusinessLogic\Tickets\Exceptions\UnableToGenerateTrackingIdException; use DataAccess\Tickets\TicketGateway; -class TrackingIdGenerator { +class TrackingIdGenerator extends \BaseClass { /** * @var $ticketGateway TicketGateway */ diff --git a/api/BusinessLogic/Tickets/VerifiedEmailChecker.php b/api/BusinessLogic/Tickets/VerifiedEmailChecker.php index 3846fbc3..5770b9c1 100644 --- a/api/BusinessLogic/Tickets/VerifiedEmailChecker.php +++ b/api/BusinessLogic/Tickets/VerifiedEmailChecker.php @@ -11,7 +11,7 @@ namespace BusinessLogic\Tickets; use DataAccess\Tickets\VerifiedEmailGateway; -class VerifiedEmailChecker { +class VerifiedEmailChecker extends \BaseClass { /** * @var $verifiedEmailGateway VerifiedEmailGateway */ diff --git a/api/BusinessLogic/ValidationModel.php b/api/BusinessLogic/ValidationModel.php index b3e085cd..0ca28eaf 100644 --- a/api/BusinessLogic/ValidationModel.php +++ b/api/BusinessLogic/ValidationModel.php @@ -2,7 +2,7 @@ namespace BusinessLogic; -class ValidationModel { +class ValidationModel extends \BaseClass { /** * @var array */ diff --git a/api/BusinessLogic/Validators.php b/api/BusinessLogic/Validators.php index a718dfd4..e0303434 100644 --- a/api/BusinessLogic/Validators.php +++ b/api/BusinessLogic/Validators.php @@ -3,7 +3,7 @@ namespace BusinessLogic; -class Validators { +class Validators extends \BaseClass { /** * @param string $address - the email address * @param array $multiple_emails - true if HESK (or custom field) supports multiple emails diff --git a/api/Controllers/Attachments/PublicAttachmentController.php b/api/Controllers/Attachments/PublicAttachmentController.php index c12325a5..da489d42 100644 --- a/api/Controllers/Attachments/PublicAttachmentController.php +++ b/api/Controllers/Attachments/PublicAttachmentController.php @@ -7,7 +7,7 @@ use BusinessLogic\Attachments\Attachment; use BusinessLogic\Attachments\AttachmentRetriever; use BusinessLogic\Exceptions\ApiFriendlyException; -class PublicAttachmentController { +class PublicAttachmentController extends \BaseClass { static function getRaw($trackingId, $attachmentId) { global $hesk_settings, $applicationContext, $userContext; diff --git a/api/Controllers/Attachments/StaffTicketAttachmentsController.php b/api/Controllers/Attachments/StaffTicketAttachmentsController.php index 7f6a09c0..c97b0d1f 100644 --- a/api/Controllers/Attachments/StaffTicketAttachmentsController.php +++ b/api/Controllers/Attachments/StaffTicketAttachmentsController.php @@ -11,7 +11,7 @@ use BusinessLogic\Helpers; use BusinessLogic\Security\UserToTicketChecker; use Controllers\JsonRetriever; -class StaffTicketAttachmentsController { +class StaffTicketAttachmentsController extends \BaseClass { function get($ticketId, $attachmentId) { global $hesk_settings, $applicationContext, $userContext; diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index 0ef2bf75..a9943bcd 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -9,7 +9,7 @@ use BusinessLogic\Exceptions\ApiFriendlyException; use BusinessLogic\Helpers; use Controllers\JsonRetriever; -class CategoryController { +class CategoryController extends \BaseClass { function get($id) { $categories = self::getAllCategories(); diff --git a/api/Controllers/InternalApiController.php b/api/Controllers/InternalApiController.php index c629e136..dd7286fe 100644 --- a/api/Controllers/InternalApiController.php +++ b/api/Controllers/InternalApiController.php @@ -6,7 +6,7 @@ namespace Controllers; use BusinessLogic\Exceptions\InternalUseOnlyException; use BusinessLogic\Helpers; -abstract class InternalApiController { +abstract class InternalApiController extends \BaseClass { static function staticCheckForInternalUseOnly() { $tokenHeader = Helpers::getHeader('X-AUTH-TOKEN'); if ($tokenHeader !== null && trim($tokenHeader) !== '') { diff --git a/api/Controllers/JsonRetriever.php b/api/Controllers/JsonRetriever.php index 6b0810d3..fef06694 100644 --- a/api/Controllers/JsonRetriever.php +++ b/api/Controllers/JsonRetriever.php @@ -3,7 +3,7 @@ namespace Controllers; -class JsonRetriever { +class JsonRetriever extends \BaseClass { /** * Support POST, PUT, and PATCH request (and possibly more) * diff --git a/api/Controllers/Settings/SettingsController.php b/api/Controllers/Settings/SettingsController.php index 4e66016a..6737052f 100644 --- a/api/Controllers/Settings/SettingsController.php +++ b/api/Controllers/Settings/SettingsController.php @@ -5,7 +5,7 @@ namespace Controllers\Settings; use BusinessLogic\Settings\SettingsRetriever; -class SettingsController { +class SettingsController extends \BaseClass { function get() { global $applicationContext, $hesk_settings; diff --git a/api/Controllers/Statuses/StatusController.php b/api/Controllers/Statuses/StatusController.php index 536c6b60..16473ae3 100644 --- a/api/Controllers/Statuses/StatusController.php +++ b/api/Controllers/Statuses/StatusController.php @@ -5,7 +5,7 @@ namespace Controllers\Statuses; use BusinessLogic\Statuses\StatusRetriever; -class StatusController { +class StatusController extends \BaseClass { function get() { global $applicationContext, $hesk_settings; diff --git a/api/Controllers/System/HeskVersionController.php b/api/Controllers/System/HeskVersionController.php index c07122ed..0b578595 100644 --- a/api/Controllers/System/HeskVersionController.php +++ b/api/Controllers/System/HeskVersionController.php @@ -3,7 +3,7 @@ namespace Controllers\System; -class HeskVersionController { +class HeskVersionController extends \BaseClass { static function getHeskVersion() { global $hesk_settings; diff --git a/api/Controllers/Tickets/CustomerTicketController.php b/api/Controllers/Tickets/CustomerTicketController.php index 2b1b2614..8b8b65fc 100644 --- a/api/Controllers/Tickets/CustomerTicketController.php +++ b/api/Controllers/Tickets/CustomerTicketController.php @@ -10,7 +10,7 @@ use BusinessLogic\ValidationModel; use Controllers\JsonRetriever; -class CustomerTicketController { +class CustomerTicketController extends \BaseClass { function get() { global $applicationContext, $hesk_settings; diff --git a/api/Controllers/Tickets/StaffTicketController.php b/api/Controllers/Tickets/StaffTicketController.php index a4860f07..658d7e7f 100644 --- a/api/Controllers/Tickets/StaffTicketController.php +++ b/api/Controllers/Tickets/StaffTicketController.php @@ -10,7 +10,7 @@ use BusinessLogic\Tickets\TicketEditor; use BusinessLogic\Tickets\TicketRetriever; use Controllers\JsonRetriever; -class StaffTicketController { +class StaffTicketController extends \BaseClass { function get($id) { global $applicationContext, $userContext, $hesk_settings; diff --git a/api/Core/Constants/CustomField.php b/api/Core/Constants/CustomField.php index 6d92cfe8..3bb6ad95 100644 --- a/api/Core/Constants/CustomField.php +++ b/api/Core/Constants/CustomField.php @@ -3,7 +3,7 @@ namespace Core\Constants; -class CustomField { +class CustomField extends \BaseClass { const RADIO = 'radio'; const SELECT = 'select'; const CHECKBOX = 'checkbox'; diff --git a/api/Core/Constants/Priority.php b/api/Core/Constants/Priority.php index 88f98cc3..39b86313 100644 --- a/api/Core/Constants/Priority.php +++ b/api/Core/Constants/Priority.php @@ -3,7 +3,7 @@ namespace Core\Constants; -class Priority { +class Priority extends \BaseClass { const CRITICAL = 0; const HIGH = 1; const MEDIUM = 2; diff --git a/api/Core/Exceptions/SQLException.php b/api/Core/Exceptions/SQLException.php index e9530a5b..2dbfccbe 100644 --- a/api/Core/Exceptions/SQLException.php +++ b/api/Core/Exceptions/SQLException.php @@ -2,9 +2,7 @@ namespace Core\Exceptions; -use Exception; - -class SQLException extends Exception { +class SQLException extends \BaseException { /** * @var $failingQuery string */ diff --git a/api/DataAccess/CommonDao.php b/api/DataAccess/CommonDao.php index f98056fb..cb3f5b3e 100644 --- a/api/DataAccess/CommonDao.php +++ b/api/DataAccess/CommonDao.php @@ -5,7 +5,7 @@ namespace DataAccess; use Exception; -class CommonDao { +class CommonDao extends \BaseClass { /** * @throws Exception if the database isn't properly configured */ diff --git a/api/DataAccess/Files/FileDeleter.php b/api/DataAccess/Files/FileDeleter.php index a625d764..eca69406 100644 --- a/api/DataAccess/Files/FileDeleter.php +++ b/api/DataAccess/Files/FileDeleter.php @@ -3,9 +3,7 @@ namespace DataAccess\Files; -use BusinessLogic\Exceptions\ApiFriendlyException; - -class FileDeleter { +class FileDeleter extends \BaseClass { function deleteFile($name, $folder) { $path = __DIR__ . "/../../../{$folder}/{$name}"; if (!file_exists($path)) { diff --git a/api/DataAccess/Files/FileReader.php b/api/DataAccess/Files/FileReader.php index c4ef2eb0..dd2a8ce7 100644 --- a/api/DataAccess/Files/FileReader.php +++ b/api/DataAccess/Files/FileReader.php @@ -5,7 +5,7 @@ namespace DataAccess\Files; use BusinessLogic\Exceptions\ApiFriendlyException; -class FileReader { +class FileReader extends \BaseClass { /** * @param $name string - The file name (including extension) * @param $folder - The folder name (relative to the ROOT of the helpdesk) diff --git a/api/DataAccess/Files/FileWriter.php b/api/DataAccess/Files/FileWriter.php index 8ca47891..368a4f3b 100644 --- a/api/DataAccess/Files/FileWriter.php +++ b/api/DataAccess/Files/FileWriter.php @@ -3,7 +3,7 @@ namespace DataAccess\Files; -class FileWriter { +class FileWriter extends \BaseClass { /** * @param $name string - The file name (including extension) * @param $folder - The folder name (relative to the ROOT of the helpdesk) diff --git a/api/DataAccess/Logging/Severity.php b/api/DataAccess/Logging/Severity.php index 46124c35..6cdd94ec 100644 --- a/api/DataAccess/Logging/Severity.php +++ b/api/DataAccess/Logging/Severity.php @@ -3,7 +3,7 @@ namespace DataAccess\Logging; -class Severity { +class Severity extends \BaseClass { const DEBUG = 0; const INFO = 1; const WARNING = 2; diff --git a/api/Link.php b/api/Link.php index 0e745ee3..10e5758d 100644 --- a/api/Link.php +++ b/api/Link.php @@ -42,7 +42,7 @@ class Link self::$routes = $routes; $method = self::getRequestMethod(); - $acceptedMethods = RequestMethod::ALL; + $acceptedMethods = RequestMethod::all(); $path = '/'; $handler = null; $matched = array(); diff --git a/api/index.php b/api/index.php index c8115d2c..8de69fc5 100644 --- a/api/index.php +++ b/api/index.php @@ -50,7 +50,7 @@ function assertApiIsEnabled() { global $applicationContext, $hesk_settings; /* @var $apiChecker \BusinessLogic\Settings\ApiChecker */ - $apiChecker = $applicationContext->get(\BusinessLogic\Settings\ApiChecker::class); + $apiChecker = $applicationContext->get(\BusinessLogic\Settings\ApiChecker::clazz()); if (!$apiChecker->isApiEnabled($hesk_settings)) { print output(array('message' => 'API Disabled'), 404); @@ -77,7 +77,7 @@ function buildUserContext($xAuthToken) { global $applicationContext, $userContext, $hesk_settings; /* @var $userContextBuilder \BusinessLogic\Security\UserContextBuilder */ - $userContextBuilder = $applicationContext->get(\BusinessLogic\Security\UserContextBuilder::class); + $userContextBuilder = $applicationContext->get(\BusinessLogic\Security\UserContextBuilder::clazz()); $userContext = $userContextBuilder->buildUserContext($xAuthToken, $hesk_settings); } @@ -98,12 +98,12 @@ function exceptionHandler($exception) { } // We don't cast API Friendly Exceptions as they're user-generated errors - if (exceptionIsOfType($exception, \BusinessLogic\Exceptions\ApiFriendlyException::class)) { + if (exceptionIsOfType($exception, \BusinessLogic\Exceptions\ApiFriendlyException::clazz())) { /* @var $castedException \BusinessLogic\Exceptions\ApiFriendlyException */ $castedException = $exception; print_error($castedException->title, $castedException->getMessage(), $castedException->httpResponseCode); - } elseif (exceptionIsOfType($exception, \Core\Exceptions\SQLException::class)) { + } elseif (exceptionIsOfType($exception, \Core\Exceptions\SQLException::clazz())) { /* @var $castedException \Core\Exceptions\SQLException */ $castedException = $exception; @@ -138,7 +138,7 @@ function tryToLog($location, $message, $stackTrace, $userContext, $heskSettings) global $applicationContext; /* @var $loggingGateway \DataAccess\Logging\LoggingGateway */ - $loggingGateway = $applicationContext->get(\DataAccess\Logging\LoggingGateway::class); + $loggingGateway = $applicationContext->get(\DataAccess\Logging\LoggingGateway::clazz()); try { return $loggingGateway->logError($location, $message, $stackTrace, $userContext, $heskSettings); @@ -183,41 +183,41 @@ Link::before('globalBefore'); Link::all(array( // Categories - '/v1/categories/all' => action(\Controllers\Categories\CategoryController::class . '::printAllCategories', [RequestMethod::GET], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), - '/v1/categories' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::POST], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), - '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::class, [RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), - '/v1-internal/categories/{i}/sort/{s}' => action(\Controllers\Categories\CategoryController::class . '::sort', [RequestMethod::POST], SecurityHandler::INTERNAL), + '/v1/categories/all' => action(\Controllers\Categories\CategoryController::clazz() . '::printAllCategories', [RequestMethod::GET], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), + '/v1/categories' => action(\Controllers\Categories\CategoryController::clazz(), [RequestMethod::POST], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), + '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::clazz(), [RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), + '/v1-internal/categories/{i}/sort/{s}' => action(\Controllers\Categories\CategoryController::clazz() . '::sort', [RequestMethod::POST], SecurityHandler::INTERNAL), // Tickets - '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::class, RequestMethod::all()), + '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::clazz(), RequestMethod::all()), // Tickets - Staff - '/v1/staff/tickets/{i}' => action(\Controllers\Tickets\StaffTicketController::class, RequestMethod::all()), + '/v1/staff/tickets/{i}' => action(\Controllers\Tickets\StaffTicketController::clazz(), RequestMethod::all()), // Attachments - '/v1/tickets/{a}/attachments/{i}' => action(\Controllers\Attachments\PublicAttachmentController::class . '::getRaw', RequestMethod::all()), - '/v1/staff/tickets/{i}/attachments' => action(\Controllers\Attachments\StaffTicketAttachmentsController::class, RequestMethod::all()), - '/v1/staff/tickets/{i}/attachments/{i}' => action(\Controllers\Attachments\StaffTicketAttachmentsController::class, RequestMethod::all()), + '/v1/tickets/{a}/attachments/{i}' => action(\Controllers\Attachments\PublicAttachmentController::clazz() . '::getRaw', RequestMethod::all()), + '/v1/staff/tickets/{i}/attachments' => action(\Controllers\Attachments\StaffTicketAttachmentsController::clazz(), RequestMethod::all()), + '/v1/staff/tickets/{i}/attachments/{i}' => action(\Controllers\Attachments\StaffTicketAttachmentsController::clazz(), RequestMethod::all()), // Statuses - '/v1/statuses' => action(\Controllers\Statuses\StatusController::class, RequestMethod::all()), + '/v1/statuses' => action(\Controllers\Statuses\StatusController::clazz(), RequestMethod::all()), // Settings - '/v1/settings' => action(\Controllers\Settings\SettingsController::class, RequestMethod::all()), + '/v1/settings' => action(\Controllers\Settings\SettingsController::clazz(), RequestMethod::all()), /* Internal use only routes */ // Resend email response '/v1-internal/staff/tickets/{i}/resend-email' => - action(\Controllers\Tickets\ResendTicketEmailToCustomerController::class, RequestMethod::all(), SecurityHandler::INTERNAL), + action(\Controllers\Tickets\ResendTicketEmailToCustomerController::clazz(), RequestMethod::all(), SecurityHandler::INTERNAL), // Custom Navigation '/v1-internal/custom-navigation/all' => - action(\Controllers\Navigation\CustomNavElementController::class . '::getAll', RequestMethod::all(), SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::clazz() . '::getAll', RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-internal/custom-navigation' => - action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::all(), SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::clazz(), RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-internal/custom-navigation/{i}' => - action(\Controllers\Navigation\CustomNavElementController::class, RequestMethod::all(), SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::clazz(), RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-internal/custom-navigation/{i}/sort/{s}' => - action(\Controllers\Navigation\CustomNavElementController::class . '::sort', RequestMethod::all(), SecurityHandler::INTERNAL), + action(\Controllers\Navigation\CustomNavElementController::clazz() . '::sort', RequestMethod::all(), SecurityHandler::INTERNAL), '/v1-public/hesk-version' => - action(\Controllers\System\HeskVersionController::class . '::getHeskVersion', RequestMethod::all(), SecurityHandler::OPEN), + action(\Controllers\System\HeskVersionController::clazz() . '::getHeskVersion', RequestMethod::all(), SecurityHandler::OPEN), '/v1-public/mods-for-hesk-version' => - action(\Controllers\System\HeskVersionController::class . '::getModsForHeskVersion', RequestMethod::all(), SecurityHandler::OPEN), + action(\Controllers\System\HeskVersionController::clazz() . '::getModsForHeskVersion', RequestMethod::all(), SecurityHandler::OPEN), // Any URL that doesn't match goes to the 404 handler '404' => 'handle404' From 41cbdadb72b7321dbd6dc2484ad16c9915708006 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 21:17:34 -0400 Subject: [PATCH 040/130] More PHP 5.4/5.3 fixes --- .../Categories/CategoryHandler.php | 8 ++--- .../Emails/EmailTemplateParser.php | 32 ++++++++++++++----- api/BusinessLogic/Tickets/TicketCreator.php | 2 +- api/BusinessLogic/ValidationModel.php | 2 +- .../PublicAttachmentController.php | 2 +- .../StaffTicketAttachmentsController.php | 6 ++-- .../Categories/CategoryController.php | 10 +++--- .../Navigation/CustomNavElementController.php | 12 +++---- .../Settings/SettingsController.php | 2 +- api/Controllers/Statuses/StatusController.php | 2 +- .../Tickets/CustomerTicketController.php | 4 +-- .../ResendTicketEmailToCustomerController.php | 6 ++-- .../Tickets/StaffTicketController.php | 6 ++-- api/DataAccess/Files/FileReader.php | 2 +- api/DataAccess/Files/FileWriter.php | 2 +- api/Link.php | 4 +-- .../Attachments/AttachmentHandlerTest.php | 30 ++++++++--------- .../Attachments/AttachmentRetrieverTest.php | 8 ++--- .../Categories/CategoryHandlerTest.php | 8 ++--- .../Emails/EmailSenderHelperTest.php | 6 ++-- .../Security/BanRetrieverTest.php | 2 +- .../Security/UserToTicketCheckerTest.php | 2 +- .../Tickets/AutoassignerTest.php | 4 +-- .../Tickets/NewTicketValidatorTest.php | 6 ++-- .../CreateTicketForCustomerTest.php | 18 +++++------ .../Tickets/TicketDeleterTest.php | 8 ++--- .../Tickets/TicketRetrieverTest.php | 6 ++-- .../Tickets/TicketValidatorsTest.php | 2 +- .../Tickets/TrackingIdGeneratorTest.php | 2 +- .../Tickets/VerifiedEmailCheckerTest.php | 2 +- api/index.php | 10 +++--- ci/php_lint.sh | 2 +- .../admin/api-authentication/index.php | 2 +- 33 files changed, 118 insertions(+), 102 deletions(-) diff --git a/api/BusinessLogic/Categories/CategoryHandler.php b/api/BusinessLogic/Categories/CategoryHandler.php index 3b542127..98e5b6d4 100644 --- a/api/BusinessLogic/Categories/CategoryHandler.php +++ b/api/BusinessLogic/Categories/CategoryHandler.php @@ -64,7 +64,7 @@ class CategoryHandler extends \BaseClass { } } - throw new \Exception("Newly created category {$id} lost! :O"); + throw new \BaseException("Newly created category {$id} lost! :O"); } /** @@ -145,7 +145,7 @@ class CategoryHandler extends \BaseClass { } } - throw new \Exception("Category {$category->id} vanished! :O"); + throw new \BaseException("Category {$category->id} vanished! :O"); } function deleteCategory($id, $userContext, $heskSettings) { @@ -154,7 +154,7 @@ class CategoryHandler extends \BaseClass { } if ($id === 1) { - throw new \Exception("Category 1 cannot be deleted!"); + throw new \BaseException("Category 1 cannot be deleted!"); } $this->ticketGateway->moveTicketsToDefaultCategory($id, $heskSettings); @@ -175,7 +175,7 @@ class CategoryHandler extends \BaseClass { } if ($category === null) { - throw new \Exception("Could not find category with ID {$id}!"); + throw new \BaseException("Could not find category with ID {$id}!"); } if ($direction === Direction::UP) { diff --git a/api/BusinessLogic/Emails/EmailTemplateParser.php b/api/BusinessLogic/Emails/EmailTemplateParser.php index 2518c1b6..13fd3091 100644 --- a/api/BusinessLogic/Emails/EmailTemplateParser.php +++ b/api/BusinessLogic/Emails/EmailTemplateParser.php @@ -3,7 +3,6 @@ namespace BusinessLogic\Emails; -use BusinessLogic\Exceptions\ApiFriendlyException; use BusinessLogic\Exceptions\EmailTemplateNotFoundException; use BusinessLogic\Exceptions\InvalidEmailTemplateException; use BusinessLogic\Statuses\DefaultStatusForAction; @@ -77,10 +76,10 @@ class EmailTemplateParser extends \BaseClass { } if ($fullLanguageName === null) { - throw new \Exception("Language code {$languageCode} did not return any valid HESK languages!"); + throw new \BaseException("Language code {$languageCode} did not return any valid HESK languages!"); } - $subject = $this->parseSubject($subject, $ticket, $fullLanguageName, $heskSettings); + $subject = $this->parseSubject($subject, $ticket, $fullLanguageName, $heskSettings, $modsForHeskSettings); $message = $this->parseMessage($template, $ticket, $fullLanguageName, $emailTemplate->forStaff, $heskSettings, $modsForHeskSettings, false); $htmlMessage = $this->parseMessage($htmlTemplate, $ticket, $fullLanguageName, $emailTemplate->forStaff, $heskSettings, $modsForHeskSettings, true); @@ -117,11 +116,11 @@ class EmailTemplateParser extends \BaseClass { * @return string * @throws \Exception if common.inc.php isn't loaded */ - private function parseSubject($subjectTemplate, $ticket, $language, $heskSettings) { + private function parseSubject($subjectTemplate, $ticket, $language, $heskSettings, $modsForHeskSettings) { global $hesklang; if (!function_exists('hesk_msgToPlain')) { - throw new \Exception("common.inc.php not loaded!"); + throw new \BaseException("common.inc.php not loaded!"); } if ($ticket === null) { @@ -131,7 +130,14 @@ class EmailTemplateParser extends \BaseClass { // Status name and category name $defaultStatus = $this->statusGateway->getStatusForDefaultAction(DefaultStatusForAction::NEW_TICKET, $heskSettings); $statusName = $defaultStatus->localizedNames[$language]; - $category = $this->categoryGateway->getAllCategories($heskSettings)[$ticket->categoryId]; + $categories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings); + $category = null; + foreach ($categories as $innerCategory) { + if ($innerCategory->id === $ticket->categoryId) { + $category = $innerCategory; + break; + } + } switch ($ticket->priorityId) { case Priority::CRITICAL: @@ -173,7 +179,7 @@ class EmailTemplateParser extends \BaseClass { global $hesklang; if (!function_exists('hesk_msgToPlain')) { - throw new \Exception("common.inc.php not loaded!"); + throw new \BaseException("common.inc.php not loaded!"); } if ($ticket === null) { @@ -193,7 +199,17 @@ class EmailTemplateParser extends \BaseClass { // Status name and category name $defaultStatus = $this->statusGateway->getStatusForDefaultAction(DefaultStatusForAction::NEW_TICKET, $heskSettings); $statusName = hesk_msgToPlain($defaultStatus->localizedNames[$language]); - $category = hesk_msgToPlain($this->categoryGateway->getAllCategories($heskSettings)[$ticket->categoryId]->name); + + $categories = $this->categoryGateway->getAllCategories($heskSettings, $modsForHeskSettings); + $category = null; + foreach ($categories as $innerCategory) { + if ($innerCategory->id === $ticket->categoryId) { + $category = $innerCategory; + break; + } + } + + $category = hesk_msgToPlain($category->name); $owner = $this->userGateway->getUserById($ticket->ownerId, $heskSettings); $ownerName = $owner === null ? $hesklang['unas'] : hesk_msgToPlain($owner->name); diff --git a/api/BusinessLogic/Tickets/TicketCreator.php b/api/BusinessLogic/Tickets/TicketCreator.php index 7f677c50..5956de9b 100644 --- a/api/BusinessLogic/Tickets/TicketCreator.php +++ b/api/BusinessLogic/Tickets/TicketCreator.php @@ -130,7 +130,7 @@ class TicketCreator extends \BaseClass { $status = $this->statusGateway->getStatusForDefaultAction(DefaultStatusForAction::NEW_TICKET, $heskSettings); if ($status === null) { - throw new \Exception("Could not find the default status for a new ticket!"); + throw new \BaseException("Could not find the default status for a new ticket!"); } $ticket->statusId = $status->id; diff --git a/api/BusinessLogic/ValidationModel.php b/api/BusinessLogic/ValidationModel.php index 0ca28eaf..3878a0be 100644 --- a/api/BusinessLogic/ValidationModel.php +++ b/api/BusinessLogic/ValidationModel.php @@ -9,6 +9,6 @@ class ValidationModel extends \BaseClass { public $errorKeys; function __construct() { - $this->errorKeys = []; + $this->errorKeys = array(); } } \ No newline at end of file diff --git a/api/Controllers/Attachments/PublicAttachmentController.php b/api/Controllers/Attachments/PublicAttachmentController.php index da489d42..8b1dc555 100644 --- a/api/Controllers/Attachments/PublicAttachmentController.php +++ b/api/Controllers/Attachments/PublicAttachmentController.php @@ -14,7 +14,7 @@ class PublicAttachmentController extends \BaseClass { self::verifyAttachmentsAreEnabled($hesk_settings); /* @var $attachmentRetriever AttachmentRetriever */ - $attachmentRetriever = $applicationContext->get(AttachmentRetriever::class); + $attachmentRetriever = $applicationContext->get(AttachmentRetriever::clazz()); $attachment = $attachmentRetriever->getAttachmentContentsForTrackingId($trackingId, $attachmentId, $userContext, $hesk_settings); diff --git a/api/Controllers/Attachments/StaffTicketAttachmentsController.php b/api/Controllers/Attachments/StaffTicketAttachmentsController.php index c97b0d1f..d7bb3cba 100644 --- a/api/Controllers/Attachments/StaffTicketAttachmentsController.php +++ b/api/Controllers/Attachments/StaffTicketAttachmentsController.php @@ -18,7 +18,7 @@ class StaffTicketAttachmentsController extends \BaseClass { $this->verifyAttachmentsAreEnabled($hesk_settings); /* @var $attachmentRetriever AttachmentRetriever */ - $attachmentRetriever = $applicationContext->get(AttachmentRetriever::class); + $attachmentRetriever = $applicationContext->get(AttachmentRetriever::clazz()); $contents = $attachmentRetriever->getAttachmentContentsForTicket($ticketId, $attachmentId, $userContext, $hesk_settings); @@ -37,7 +37,7 @@ class StaffTicketAttachmentsController extends \BaseClass { $this->verifyAttachmentsAreEnabled($hesk_settings); /* @var $attachmentHandler AttachmentHandler */ - $attachmentHandler = $applicationContext->get(AttachmentHandler::class); + $attachmentHandler = $applicationContext->get(AttachmentHandler::clazz()); $createAttachmentForTicketModel = $this->createModel(JsonRetriever::getJsonData(), $ticketId); @@ -61,7 +61,7 @@ class StaffTicketAttachmentsController extends \BaseClass { global $applicationContext, $hesk_settings, $userContext; /* @var $attachmentHandler AttachmentHandler */ - $attachmentHandler = $applicationContext->get(AttachmentHandler::class); + $attachmentHandler = $applicationContext->get(AttachmentHandler::clazz()); $attachmentHandler->deleteAttachmentFromTicket($ticketId, $attachmentId, $userContext, $hesk_settings); diff --git a/api/Controllers/Categories/CategoryController.php b/api/Controllers/Categories/CategoryController.php index a9943bcd..c89d1a1a 100644 --- a/api/Controllers/Categories/CategoryController.php +++ b/api/Controllers/Categories/CategoryController.php @@ -30,7 +30,7 @@ class CategoryController extends \BaseClass { global $hesk_settings, $applicationContext, $userContext; /* @var $categoryRetriever CategoryRetriever */ - $categoryRetriever = $applicationContext->get(CategoryRetriever::class); + $categoryRetriever = $applicationContext->get(CategoryRetriever::clazz()); return $categoryRetriever->getAllCategories($hesk_settings, $userContext); } @@ -43,7 +43,7 @@ class CategoryController extends \BaseClass { $category = $this->buildCategoryFromJson($data); /* @var $categoryHandler CategoryHandler */ - $categoryHandler = $applicationContext->get(CategoryHandler::class); + $categoryHandler = $applicationContext->get(CategoryHandler::clazz()); $category = $categoryHandler->createCategory($category, $userContext, $hesk_settings); @@ -80,7 +80,7 @@ class CategoryController extends \BaseClass { $category->id = intval($id); /* @var $categoryHandler CategoryHandler */ - $categoryHandler = $applicationContext->get(CategoryHandler::class); + $categoryHandler = $applicationContext->get(CategoryHandler::clazz()); $category = $categoryHandler->editCategory($category, $userContext, $hesk_settings); @@ -91,7 +91,7 @@ class CategoryController extends \BaseClass { global $hesk_settings, $userContext, $applicationContext; /* @var $categoryHandler CategoryHandler */ - $categoryHandler = $applicationContext->get(CategoryHandler::class); + $categoryHandler = $applicationContext->get(CategoryHandler::clazz()); $categoryHandler->deleteCategory($id, $userContext, $hesk_settings); @@ -102,7 +102,7 @@ class CategoryController extends \BaseClass { global $applicationContext, $hesk_settings; /* @var $handler CategoryHandler */ - $handler = $applicationContext->get(CategoryHandler::class); + $handler = $applicationContext->get(CategoryHandler::clazz()); $handler->sortCategory(intval($id), $direction, $hesk_settings); } diff --git a/api/Controllers/Navigation/CustomNavElementController.php b/api/Controllers/Navigation/CustomNavElementController.php index 8196eb16..9ae6d741 100644 --- a/api/Controllers/Navigation/CustomNavElementController.php +++ b/api/Controllers/Navigation/CustomNavElementController.php @@ -16,7 +16,7 @@ class CustomNavElementController extends InternalApiController { self::staticCheckForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get(CustomNavElementHandler::class); + $handler = $applicationContext->get(CustomNavElementHandler::clazz()); output($handler->getAllCustomNavElements($hesk_settings)); } @@ -27,7 +27,7 @@ class CustomNavElementController extends InternalApiController { self::staticCheckForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get(CustomNavElementHandler::class); + $handler = $applicationContext->get(CustomNavElementHandler::clazz()); $handler->sortCustomNavElement(intval($id), $direction, $hesk_settings); } @@ -38,7 +38,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get(CustomNavElementHandler::class); + $handler = $applicationContext->get(CustomNavElementHandler::clazz()); output($handler->getCustomNavElement($id, $hesk_settings)); } @@ -49,7 +49,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get(CustomNavElementHandler::class); + $handler = $applicationContext->get(CustomNavElementHandler::clazz()); $data = JsonRetriever::getJsonData(); $element = $handler->createCustomNavElement($this->buildElementModel($data), $hesk_settings); @@ -63,7 +63,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get(CustomNavElementHandler::class); + $handler = $applicationContext->get(CustomNavElementHandler::clazz()); $data = JsonRetriever::getJsonData(); $handler->saveCustomNavElement($this->buildElementModel($data, $id), $hesk_settings); @@ -77,7 +77,7 @@ class CustomNavElementController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $handler CustomNavElementHandler */ - $handler = $applicationContext->get(CustomNavElementHandler::class); + $handler = $applicationContext->get(CustomNavElementHandler::clazz()); $handler->deleteCustomNavElement($id, $hesk_settings); diff --git a/api/Controllers/Settings/SettingsController.php b/api/Controllers/Settings/SettingsController.php index 6737052f..d96adeaf 100644 --- a/api/Controllers/Settings/SettingsController.php +++ b/api/Controllers/Settings/SettingsController.php @@ -10,7 +10,7 @@ class SettingsController extends \BaseClass { global $applicationContext, $hesk_settings; /* @var $settingsRetriever SettingsRetriever */ - $settingsRetriever = $applicationContext->get(SettingsRetriever::class); + $settingsRetriever = $applicationContext->get(SettingsRetriever::clazz()); output($settingsRetriever->getAllSettings($hesk_settings)); } diff --git a/api/Controllers/Statuses/StatusController.php b/api/Controllers/Statuses/StatusController.php index 16473ae3..648768b4 100644 --- a/api/Controllers/Statuses/StatusController.php +++ b/api/Controllers/Statuses/StatusController.php @@ -10,7 +10,7 @@ class StatusController extends \BaseClass { global $applicationContext, $hesk_settings; /* @var $statusRetriever StatusRetriever */ - $statusRetriever = $applicationContext->get(StatusRetriever::class); + $statusRetriever = $applicationContext->get(StatusRetriever::clazz()); output($statusRetriever->getAllStatuses($hesk_settings)); } diff --git a/api/Controllers/Tickets/CustomerTicketController.php b/api/Controllers/Tickets/CustomerTicketController.php index 8b8b65fc..1daeff9f 100644 --- a/api/Controllers/Tickets/CustomerTicketController.php +++ b/api/Controllers/Tickets/CustomerTicketController.php @@ -18,7 +18,7 @@ class CustomerTicketController extends \BaseClass { $emailAddress = isset($_GET['email']) ? $_GET['email'] : null; /* @var $ticketRetriever TicketRetriever */ - $ticketRetriever = $applicationContext->get(TicketRetriever::class); + $ticketRetriever = $applicationContext->get(TicketRetriever::clazz()); output($ticketRetriever->getTicketByTrackingIdAndEmail($trackingId, $emailAddress, $hesk_settings)); } @@ -27,7 +27,7 @@ class CustomerTicketController extends \BaseClass { global $applicationContext, $hesk_settings, $userContext; /* @var $ticketCreator TicketCreator */ - $ticketCreator = $applicationContext->get(TicketCreator::class); + $ticketCreator = $applicationContext->get(TicketCreator::clazz()); $jsonRequest = JsonRetriever::getJsonData(); diff --git a/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php b/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php index fe2aa7be..ddab20cc 100644 --- a/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php +++ b/api/Controllers/Tickets/ResendTicketEmailToCustomerController.php @@ -19,15 +19,15 @@ class ResendTicketEmailToCustomerController extends InternalApiController { $this->checkForInternalUseOnly(); /* @var $ticketRetriever TicketRetriever */ - $ticketRetriever = $applicationContext->get(TicketRetriever::class); + $ticketRetriever = $applicationContext->get(TicketRetriever::clazz()); $ticket = $ticketRetriever->getTicketById($ticketId, $hesk_settings, $userContext); /* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */ - $modsForHeskSettingsGateway = $applicationContext->get(ModsForHeskSettingsGateway::class); + $modsForHeskSettingsGateway = $applicationContext->get(ModsForHeskSettingsGateway::clazz()); $modsForHeskSettings = $modsForHeskSettingsGateway->getAllSettings($hesk_settings); /* @var $emailSender EmailSenderHelper */ - $emailSender = $applicationContext->get(EmailSenderHelper::class); + $emailSender = $applicationContext->get(EmailSenderHelper::clazz()); $language = $ticket->language; diff --git a/api/Controllers/Tickets/StaffTicketController.php b/api/Controllers/Tickets/StaffTicketController.php index 658d7e7f..023f5352 100644 --- a/api/Controllers/Tickets/StaffTicketController.php +++ b/api/Controllers/Tickets/StaffTicketController.php @@ -15,7 +15,7 @@ class StaffTicketController extends \BaseClass { global $applicationContext, $userContext, $hesk_settings; /* @var $ticketRetriever TicketRetriever */ - $ticketRetriever = $applicationContext->get(TicketRetriever::class); + $ticketRetriever = $applicationContext->get(TicketRetriever::clazz()); output($ticketRetriever->getTicketById($id, $hesk_settings, $userContext)); } @@ -24,7 +24,7 @@ class StaffTicketController extends \BaseClass { global $applicationContext, $userContext, $hesk_settings; /* @var $ticketDeleter TicketDeleter */ - $ticketDeleter = $applicationContext->get(TicketDeleter::class); + $ticketDeleter = $applicationContext->get(TicketDeleter::clazz()); $ticketDeleter->deleteTicket($id, $userContext, $hesk_settings); @@ -35,7 +35,7 @@ class StaffTicketController extends \BaseClass { global $applicationContext, $userContext, $hesk_settings; /* @var $ticketEditor TicketEditor */ - $ticketEditor = $applicationContext->get(TicketEditor::class); + $ticketEditor = $applicationContext->get(TicketEditor::clazz()); $jsonRequest = JsonRetriever::getJsonData(); diff --git a/api/DataAccess/Files/FileReader.php b/api/DataAccess/Files/FileReader.php index dd2a8ce7..39a327a7 100644 --- a/api/DataAccess/Files/FileReader.php +++ b/api/DataAccess/Files/FileReader.php @@ -23,7 +23,7 @@ class FileReader extends \BaseClass { $fileContents = file_get_contents($location); if ($fileContents === false) { - throw new \Exception("Failed to read the file!"); + throw new \BaseException("Failed to read the file!"); } return $fileContents; diff --git a/api/DataAccess/Files/FileWriter.php b/api/DataAccess/Files/FileWriter.php index 368a4f3b..d35b302a 100644 --- a/api/DataAccess/Files/FileWriter.php +++ b/api/DataAccess/Files/FileWriter.php @@ -17,7 +17,7 @@ class FileWriter extends \BaseClass { $fileSize = file_put_contents($location, $contents); if ($fileSize === false) { - throw new \Exception("Failed to save the file!"); + throw new \BaseException("Failed to save the file!"); } return $fileSize; diff --git a/api/Link.php b/api/Link.php index 10e5758d..dff9c7cf 100644 --- a/api/Link.php +++ b/api/Link.php @@ -224,7 +224,7 @@ class Link */ public static function before( $funcName, $params = null ) { - array_push( self::$beforeFuncs, [ $funcName, $params ]); + array_push( self::$beforeFuncs, array($funcName, $params)); } /** @@ -236,6 +236,6 @@ class Link */ public static function after( $funcName, $params = null ) { - array_push( self::$afterFuncs, [ $funcName, $params ]); + array_push( self::$afterFuncs, array($funcName, $params)); } } \ No newline at end of file diff --git a/api/Tests/BusinessLogic/Attachments/AttachmentHandlerTest.php b/api/Tests/BusinessLogic/Attachments/AttachmentHandlerTest.php index 74e6a9dd..767bc780 100644 --- a/api/Tests/BusinessLogic/Attachments/AttachmentHandlerTest.php +++ b/api/Tests/BusinessLogic/Attachments/AttachmentHandlerTest.php @@ -46,11 +46,11 @@ class AttachmentHandlerTest extends TestCase { private $heskSettings; protected function setUp() { - $this->ticketGateway = $this->createMock(TicketGateway::class); - $this->attachmentGateway = $this->createMock(AttachmentGateway::class); - $this->fileWriter = $this->createMock(FileWriter::class); - $this->fileDeleter = $this->createMock(FileDeleter::class); - $this->userToTicketChecker = $this->createMock(UserToTicketChecker::class); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); + $this->attachmentGateway = $this->createMock(AttachmentGateway::clazz()); + $this->fileWriter = $this->createMock(FileWriter::clazz()); + $this->fileDeleter = $this->createMock(FileDeleter::clazz()); + $this->userToTicketChecker = $this->createMock(UserToTicketChecker::clazz()); $this->heskSettings = array( 'attach_dir' => 'attachments', 'attachments' => array( @@ -78,7 +78,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->attachmentContents = null; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/CONTENTS_EMPTY/'); //-- Act @@ -91,7 +91,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->attachmentContents = ''; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/CONTENTS_EMPTY/'); //-- Act @@ -106,7 +106,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->attachmentContents = 'invalid base 64'; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/CONTENTS_NOT_BASE_64/'); //-- Act @@ -119,7 +119,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->displayName = null; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/DISPLAY_NAME_EMPTY/'); //-- Act @@ -132,7 +132,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->displayName = ''; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/DISPLAY_NAME_EMPTY/'); //-- Act @@ -145,7 +145,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->ticketId = null; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/TICKET_ID_MISSING/'); //-- Act @@ -158,7 +158,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->ticketId = 0; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/TICKET_ID_MISSING/'); //-- Act @@ -172,7 +172,7 @@ class AttachmentHandlerTest extends TestCase { $this->createAttachmentForTicketModel->ticketId = 0; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/EXTENSION_NOT_PERMITTED/'); //-- Act @@ -186,7 +186,7 @@ class AttachmentHandlerTest extends TestCase { $this->heskSettings['attachments']['max_size'] = 1; //-- Assert - $this->expectException(ValidationException::class); + $this->expectException(ValidationException::clazz()); $this->expectExceptionMessageRegExp('/FILE_SIZE_TOO_LARGE/'); //-- Act @@ -261,7 +261,7 @@ class AttachmentHandlerTest extends TestCase { ->willReturn(false); //-- Assert - $this->expectException(\Exception::class); + $this->expectException(\BaseException::clazz()); $this->expectExceptionMessage("User does not have access to ticket {$ticketId} being created / edited!"); //-- Act diff --git a/api/Tests/BusinessLogic/Attachments/AttachmentRetrieverTest.php b/api/Tests/BusinessLogic/Attachments/AttachmentRetrieverTest.php index 776fe1eb..426d585c 100644 --- a/api/Tests/BusinessLogic/Attachments/AttachmentRetrieverTest.php +++ b/api/Tests/BusinessLogic/Attachments/AttachmentRetrieverTest.php @@ -32,10 +32,10 @@ class AttachmentRetrieverTest extends TestCase { private $heskSettings; protected function setUp() { - $this->attachmentGateway = $this->createMock(AttachmentGateway::class); - $this->fileReader = $this->createMock(FileReader::class); - $this->ticketGateway = $this->createMock(TicketGateway::class); - $this->userToTicketChecker = $this->createMock(UserToTicketChecker::class); + $this->attachmentGateway = $this->createMock(AttachmentGateway::clazz()); + $this->fileReader = $this->createMock(FileReader::clazz()); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); + $this->userToTicketChecker = $this->createMock(UserToTicketChecker::clazz()); $this->heskSettings = array('attach_dir' => 'attachments'); $this->attachmentRetriever = new AttachmentRetriever($this->attachmentGateway, $this->fileReader, diff --git a/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php b/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php index 9cb886c9..6b316669 100644 --- a/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php +++ b/api/Tests/BusinessLogic/Categories/CategoryHandlerTest.php @@ -32,10 +32,10 @@ class CategoryHandlerTest extends TestCase { private $heskSettings; protected function setUp() { - $this->categoryGateway = $this->createMock(CategoryGateway::class); - $this->ticketGateway = $this->createMock(TicketGateway::class); - $this->permissionChecker = $this->createMock(PermissionChecker::class); - $this->modsForHeskSettingsGateway = $this->createMock(ModsForHeskSettingsGateway::class); + $this->categoryGateway = $this->createMock(CategoryGateway::clazz()); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); + $this->permissionChecker = $this->createMock(PermissionChecker::clazz()); + $this->modsForHeskSettingsGateway = $this->createMock(ModsForHeskSettingsGateway::clazz()); $this->categoryHandler = new CategoryHandler($this->categoryGateway, $this->ticketGateway, diff --git a/api/Tests/BusinessLogic/Emails/EmailSenderHelperTest.php b/api/Tests/BusinessLogic/Emails/EmailSenderHelperTest.php index c9d5c0cb..1c34786a 100644 --- a/api/Tests/BusinessLogic/Emails/EmailSenderHelperTest.php +++ b/api/Tests/BusinessLogic/Emails/EmailSenderHelperTest.php @@ -38,9 +38,9 @@ class EmailSenderHelperTest extends TestCase { private $modsForHeskSettings; protected function setUp() { - $this->emailTemplateParser = $this->createMock(EmailTemplateParser::class); - $this->basicEmailSender = $this->createMock(BasicEmailSender::class); - $this->mailgunEmailSender = $this->createMock(MailgunEmailSender::class); + $this->emailTemplateParser = $this->createMock(EmailTemplateParser::clazz()); + $this->basicEmailSender = $this->createMock(BasicEmailSender::clazz()); + $this->mailgunEmailSender = $this->createMock(MailgunEmailSender::clazz()); $this->heskSettings = array( 'languages' => array( 'English' => array('folder' => 'en') diff --git a/api/Tests/BusinessLogic/Security/BanRetrieverTest.php b/api/Tests/BusinessLogic/Security/BanRetrieverTest.php index 304bffa0..6cfaaf3b 100644 --- a/api/Tests/BusinessLogic/Security/BanRetrieverTest.php +++ b/api/Tests/BusinessLogic/Security/BanRetrieverTest.php @@ -22,7 +22,7 @@ class BanRetrieverTests extends TestCase { private $banRetriever; protected function setUp() { - $this->banGateway = $this->createMock(BanGateway::class); + $this->banGateway = $this->createMock(BanGateway::clazz()); $this->banRetriever = new BanRetriever($this->banGateway); } diff --git a/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php b/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php index 07318d66..cf6d1719 100644 --- a/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php +++ b/api/Tests/BusinessLogic/Security/UserToTicketCheckerTest.php @@ -20,7 +20,7 @@ class UserToTicketCheckerTest extends TestCase { private $heskSettings; protected function setUp() { - $this->userGateway = $this->createMock(UserGateway::class); + $this->userGateway = $this->createMock(UserGateway::clazz()); $this->userToTicketChecker = new UserToTicketChecker($this->userGateway); } diff --git a/api/Tests/BusinessLogic/Tickets/AutoassignerTest.php b/api/Tests/BusinessLogic/Tickets/AutoassignerTest.php index 8e9836ac..e7192b9a 100644 --- a/api/Tests/BusinessLogic/Tickets/AutoassignerTest.php +++ b/api/Tests/BusinessLogic/Tickets/AutoassignerTest.php @@ -28,8 +28,8 @@ class AutoassignerTest extends TestCase { private $heskSettings; protected function setUp() { - $this->categoryGateway = $this->createMock(CategoryGateway::class); - $this->userGateway = $this->createMock(UserGateway::class); + $this->categoryGateway = $this->createMock(CategoryGateway::clazz()); + $this->userGateway = $this->createMock(UserGateway::clazz()); $this->autoassigner = new Autoassigner($this->categoryGateway, $this->userGateway); $this->heskSettings = array( 'autoassign' => 1 diff --git a/api/Tests/BusinessLogic/Tickets/NewTicketValidatorTest.php b/api/Tests/BusinessLogic/Tickets/NewTicketValidatorTest.php index 2ace5299..108859cd 100644 --- a/api/Tests/BusinessLogic/Tickets/NewTicketValidatorTest.php +++ b/api/Tests/BusinessLogic/Tickets/NewTicketValidatorTest.php @@ -48,9 +48,9 @@ class NewTicketValidatorTest extends TestCase { private $heskSettings = array(); function setUp() { - $this->banRetriever = $this->createMock(BanRetriever::class); - $this->categoryRetriever = $this->createMock(CategoryRetriever::class); - $this->ticketValidators = $this->createMock(TicketValidators::class); + $this->banRetriever = $this->createMock(BanRetriever::clazz()); + $this->categoryRetriever = $this->createMock(CategoryRetriever::clazz()); + $this->ticketValidators = $this->createMock(TicketValidators::clazz()); $this->newTicketValidator = new NewTicketValidator($this->categoryRetriever, $this->banRetriever, $this->ticketValidators); $this->userContext = new UserContext(); diff --git a/api/Tests/BusinessLogic/Tickets/TicketCreatorTests/CreateTicketForCustomerTest.php b/api/Tests/BusinessLogic/Tickets/TicketCreatorTests/CreateTicketForCustomerTest.php index a0a3ea07..c2577ab0 100644 --- a/api/Tests/BusinessLogic/Tickets/TicketCreatorTests/CreateTicketForCustomerTest.php +++ b/api/Tests/BusinessLogic/Tickets/TicketCreatorTests/CreateTicketForCustomerTest.php @@ -98,15 +98,15 @@ class CreateTicketTest extends TestCase { private $modsForHeskSettings; protected function setUp() { - $this->ticketGateway = $this->createMock(TicketGateway::class); - $this->newTicketValidator = $this->createMock(NewTicketValidator::class); - $this->trackingIdGenerator = $this->createMock(TrackingIdGenerator::class); - $this->autoassigner = $this->createMock(Autoassigner::class); - $this->statusGateway = $this->createMock(StatusGateway::class); - $this->verifiedEmailChecker = $this->createMock(VerifiedEmailChecker::class); - $this->emailSenderHelper = $this->createMock(EmailSenderHelper::class); - $this->userGateway = $this->createMock(UserGateway::class); - $this->modsForHeskSettingsGateway = $this->createMock(ModsForHeskSettingsGateway::class); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); + $this->newTicketValidator = $this->createMock(NewTicketValidator::clazz()); + $this->trackingIdGenerator = $this->createMock(TrackingIdGenerator::clazz()); + $this->autoassigner = $this->createMock(Autoassigner::clazz()); + $this->statusGateway = $this->createMock(StatusGateway::clazz()); + $this->verifiedEmailChecker = $this->createMock(VerifiedEmailChecker::clazz()); + $this->emailSenderHelper = $this->createMock(EmailSenderHelper::clazz()); + $this->userGateway = $this->createMock(UserGateway::clazz()); + $this->modsForHeskSettingsGateway = $this->createMock(ModsForHeskSettingsGateway::clazz()); $this->ticketCreator = new TicketCreator($this->newTicketValidator, $this->trackingIdGenerator, $this->autoassigner, $this->statusGateway, $this->ticketGateway, $this->verifiedEmailChecker, diff --git a/api/Tests/BusinessLogic/Tickets/TicketDeleterTest.php b/api/Tests/BusinessLogic/Tickets/TicketDeleterTest.php index bce86231..b55194fd 100644 --- a/api/Tests/BusinessLogic/Tickets/TicketDeleterTest.php +++ b/api/Tests/BusinessLogic/Tickets/TicketDeleterTest.php @@ -30,9 +30,9 @@ class TicketDeleterTest extends TestCase { private $userToTicketChecker; protected function setUp() { - $this->userToTicketChecker = $this->createMock(UserToTicketChecker::class); - $this->ticketGateway = $this->createMock(TicketGateway::class); - $this->attachmentHandler = $this->createMock(AttachmentHandler::class); + $this->userToTicketChecker = $this->createMock(UserToTicketChecker::clazz()); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); + $this->attachmentHandler = $this->createMock(AttachmentHandler::clazz()); $this->ticketDeleter = new TicketDeleter($this->ticketGateway, $this->userToTicketChecker, $this->attachmentHandler); } @@ -43,7 +43,7 @@ class TicketDeleterTest extends TestCase { $this->userToTicketChecker->method('isTicketAccessibleToUser')->willReturn(false); //-- Assert - $this->expectException(\Exception::class); + $this->expectException(\BaseException::clazz()); $this->expectExceptionMessage("User does not have access to ticket 1"); //-- Act diff --git a/api/Tests/BusinessLogic/Tickets/TicketRetrieverTest.php b/api/Tests/BusinessLogic/Tickets/TicketRetrieverTest.php index 8065c5a7..90ec9280 100644 --- a/api/Tests/BusinessLogic/Tickets/TicketRetrieverTest.php +++ b/api/Tests/BusinessLogic/Tickets/TicketRetrieverTest.php @@ -21,8 +21,8 @@ class TicketRetrieverTest extends TestCase { private $heskSettings; protected function setUp() { - $this->ticketGateway = $this->createMock(TicketGateway::class); - $this->userToTicketChecker = $this->createMock(UserToTicketChecker::class); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); + $this->userToTicketChecker = $this->createMock(UserToTicketChecker::clazz()); $this->heskSettings = array('email_view_ticket' => 0); $this->ticketRetriever = new TicketRetriever($this->ticketGateway, $this->userToTicketChecker); @@ -65,7 +65,7 @@ class TicketRetrieverTest extends TestCase { $this->ticketGateway->method('getTicketByTrackingId')->with($trackingId, $this->heskSettings)->willReturn($ticket); //-- Assert - $this->expectException(\Exception::class); + $this->expectException(\BaseException::clazz()); $this->expectExceptionMessage("Email 'email@example.com' entered in for ticket '12345' does not match!"); //-- Act diff --git a/api/Tests/BusinessLogic/Tickets/TicketValidatorsTest.php b/api/Tests/BusinessLogic/Tickets/TicketValidatorsTest.php index 6fceb76e..fcd05d17 100644 --- a/api/Tests/BusinessLogic/Tickets/TicketValidatorsTest.php +++ b/api/Tests/BusinessLogic/Tickets/TicketValidatorsTest.php @@ -18,7 +18,7 @@ class TicketValidatorsTest extends TestCase { private $ticketValidator; protected function setUp() { - $this->ticketGateway = $this->createMock(TicketGateway::class); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); $this->ticketValidator = new TicketValidators($this->ticketGateway); } diff --git a/api/Tests/BusinessLogic/Tickets/TrackingIdGeneratorTest.php b/api/Tests/BusinessLogic/Tickets/TrackingIdGeneratorTest.php index f879e579..f72957ec 100644 --- a/api/Tests/BusinessLogic/Tickets/TrackingIdGeneratorTest.php +++ b/api/Tests/BusinessLogic/Tickets/TrackingIdGeneratorTest.php @@ -19,7 +19,7 @@ class TrackingIdGeneratorTest extends TestCase { private $trackingIdGenerator; function setUp() { - $this->ticketGateway = $this->createMock(TicketGateway::class); + $this->ticketGateway = $this->createMock(TicketGateway::clazz()); $this->trackingIdGenerator = new TrackingIdGenerator($this->ticketGateway); } diff --git a/api/Tests/BusinessLogic/Tickets/VerifiedEmailCheckerTest.php b/api/Tests/BusinessLogic/Tickets/VerifiedEmailCheckerTest.php index 2cf838c5..328d898b 100644 --- a/api/Tests/BusinessLogic/Tickets/VerifiedEmailCheckerTest.php +++ b/api/Tests/BusinessLogic/Tickets/VerifiedEmailCheckerTest.php @@ -23,7 +23,7 @@ class VerifiedEmailCheckerTest extends TestCase { private $heskSettings; protected function setUp() { - $this->verifiedEmailGateway = $this->createMock(VerifiedEmailGateway::class); + $this->verifiedEmailGateway = $this->createMock(VerifiedEmailGateway::clazz()); $this->heskSettings = array(); $this->verifiedEmailChecker = new VerifiedEmailChecker($this->verifiedEmailGateway); } diff --git a/api/index.php b/api/index.php index 8de69fc5..393455a4 100644 --- a/api/index.php +++ b/api/index.php @@ -183,10 +183,10 @@ Link::before('globalBefore'); Link::all(array( // Categories - '/v1/categories/all' => action(\Controllers\Categories\CategoryController::clazz() . '::printAllCategories', [RequestMethod::GET], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), - '/v1/categories' => action(\Controllers\Categories\CategoryController::clazz(), [RequestMethod::POST], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), - '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::clazz(), [RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE], SecurityHandler::INTERNAL_OR_AUTH_TOKEN), - '/v1-internal/categories/{i}/sort/{s}' => action(\Controllers\Categories\CategoryController::clazz() . '::sort', [RequestMethod::POST], SecurityHandler::INTERNAL), + '/v1/categories/all' => action(\Controllers\Categories\CategoryController::clazz() . '::printAllCategories', array(RequestMethod::GET), SecurityHandler::INTERNAL_OR_AUTH_TOKEN), + '/v1/categories' => action(\Controllers\Categories\CategoryController::clazz(), array(RequestMethod::POST), SecurityHandler::INTERNAL_OR_AUTH_TOKEN), + '/v1/categories/{i}' => action(\Controllers\Categories\CategoryController::clazz(), array(RequestMethod::GET, RequestMethod::PUT, RequestMethod::DELETE), SecurityHandler::INTERNAL_OR_AUTH_TOKEN), + '/v1-internal/categories/{i}/sort/{s}' => action(\Controllers\Categories\CategoryController::clazz() . '::sort', array(RequestMethod::POST), SecurityHandler::INTERNAL), // Tickets '/v1/tickets' => action(\Controllers\Tickets\CustomerTicketController::clazz(), RequestMethod::all()), // Tickets - Staff @@ -230,7 +230,7 @@ Link::all(array( * @return array The configured path */ function action($class, $requestMethods, $securityHandler = SecurityHandler::AUTH_TOKEN) { - return [$class, $class, $securityHandler, $requestMethods]; + return array($class, $class, $securityHandler, $requestMethods); } class SecurityHandler { diff --git a/ci/php_lint.sh b/ci/php_lint.sh index 1e0c3ad1..0cef4eb2 100644 --- a/ci/php_lint.sh +++ b/ci/php_lint.sh @@ -12,7 +12,7 @@ while test $# -gt 0; do continue fi - for file in `find $current -type f -not -path "*vendor/*" -name "*.php"` ; do + for file in `find $current -type f -not -path "*vendor/*" -not -path "api/Tests/*" -name "*.php"` ; do RESULTS=`php -l $file` echo $RESULTS diff --git a/internal-api/admin/api-authentication/index.php b/internal-api/admin/api-authentication/index.php index 4908246a..a297d1eb 100644 --- a/internal-api/admin/api-authentication/index.php +++ b/internal-api/admin/api-authentication/index.php @@ -31,7 +31,7 @@ if ($request_method == 'POST') { if ($action == 'generate') { $token = ''; - $letter_array = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']; + $letter_array = array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'); // Pick 32 random characters. That will be the hash for ($i = 0; $i < 32; $i++) { $letter = $letter_array[rand(0, 15)]; From ea0a612e4faefac9a1612e9d207b1c12d642cefd Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 11 Sep 2017 21:34:16 -0400 Subject: [PATCH 041/130] Trying to fix the PHP linter --- ci/php_lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/php_lint.sh b/ci/php_lint.sh index 0cef4eb2..4a1a3f0e 100644 --- a/ci/php_lint.sh +++ b/ci/php_lint.sh @@ -12,7 +12,7 @@ while test $# -gt 0; do continue fi - for file in `find $current -type f -not -path "*vendor/*" -not -path "api/Tests/*" -name "*.php"` ; do + for file in `find $current -type f -not -path "*vendor/*" -not -path "*/api/Tests/*" -name "*.php"` ; do RESULTS=`php -l $file` echo $RESULTS From 9ae189430d80299f0b370ec828bf9b5147e1fc47 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 12 Sep 2017 12:32:30 -0400 Subject: [PATCH 042/130] Localize calendar pages --- inc/header.inc.php | 5 ++++- inc/headerAdmin.inc.php | 5 +++-- js/calendar/locale-all.js | 5 +++++ js/calendar/mods-for-hesk-calendar-admin-readonly.js | 1 + js/calendar/mods-for-hesk-calendar-readonly.js | 1 + js/calendar/mods-for-hesk-calendar.js | 1 + language/en/text.php | 7 +++++++ 7 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 js/calendar/locale-all.js diff --git a/inc/header.inc.php b/inc/header.inc.php index f35f50fa..5100cb7c 100644 --- a/inc/header.inc.php +++ b/inc/header.inc.php @@ -97,6 +97,8 @@ header('X-UA-Compatible: IE=edge'); + + + + + + + + + diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index a498ab67..9606199e 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -16,7 +16,7 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: define('HESK_NEW_VERSION','2.7.3'); -define('MODS_FOR_HESK_NEW_VERSION','3.1.1'); +define('MODS_FOR_HESK_NEW_VERSION','3.2.0'); define('REQUIRE_PHP_VERSION','5.3.0'); define('REQUIRE_MYSQL_VERSION','5.0.7'); From 23fc8ef6d5b08943b5b805a1f2fa852771ea4d32 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 27 Sep 2017 13:00:20 -0400 Subject: [PATCH 077/130] Landing page looks good, moved database-validation --- .../database-validation.php | 6 +++--- install/index.php | 18 ++++++++++++++++-- install/logo.png | Bin 0 -> 28524 bytes 3 files changed, 19 insertions(+), 5 deletions(-) rename install/{mods-for-hesk => }/database-validation.php (98%) create mode 100644 install/logo.png diff --git a/install/mods-for-hesk/database-validation.php b/install/database-validation.php similarity index 98% rename from install/mods-for-hesk/database-validation.php rename to install/database-validation.php index 22c34c98..7e3d462f 100644 --- a/install/mods-for-hesk/database-validation.php +++ b/install/database-validation.php @@ -1,6 +1,6 @@ Mods For HESK Database Validation - + - + @@ -40,11 +41,24 @@ hesk_dbConnect(); @@ -61,7 +75,7 @@ hesk_dbConnect();

    Are you sure you want to uninstall Mods for HESK?

    diff --git a/install/logo.png b/install/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..5406b9ae535ba4855fe3a061c45bded9c736d93b GIT binary patch literal 28524 zcmXtf19W5G*LLboZQHgxwL8_+n%cH)E44Az)V8Km+qP}%&F{ayFImAlS;@WkoPG9# zy%VXVAcY8r2L}KE5M`vrl>q=ST+sVYSZL6*T=VKD=mpYTL|y~{sEdbxH-rKJ;P@=X z#FUgQ>|N}gE$kggWW>Zs9GvXUENx5y0O`n_RCiU?C9LqNE_bhj2^I`mv8ygbk}mG@ zS#iU3Tmu>iBzBHE(n4@l32{hFksvbYm@u+BvZ&AigFd1JlKg)L7(ah{ve&D-92|6| zrEL+L`&#F9Jqeg!`7X8t5;{NHI$bp30yuI5h<6WU<71*qjNiZzt^p9^0E2oqc5qRF z{s3t~BD;IJMD%Ae*Z^+#fAj$E*v{Z%m+LQ?%#=Rth*`+U<)DcXlgL)3f8{Gd2z9=a z|K^`DSo>*M?<8O_>N?ZWu~)7erpWlCGjaxvqcwdF5!~=}#s$bWGb#5YaBi?2e`2Kp z8FzKa7UeKY93|e>39<$a&A`}zVgLweZ|LK`qM)(~0-u%b zPH@|N?2M8Es>f!FvQ}2vjyJQv(BH1JmGpcXNb(Nb2gemklqP zH7_no9uAu6W1jZdeac6AcSzR+2|XbcKKRysr09DI0AjR$+PeAF4O~Ix8?ys$pL&)# zkiki4Pj%jUHJ%D0k0@nGhHK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_R00-ATcId{h+bkj6@Z~t9@ARc-t2SZL(CgUoM5Iy}B|5vj zjr#gn$^Q{kY{L3D&JVM{w$4My|3YKM%W%!!I3O!4hJ}IhL^n@$sW_FUqOR`veG!cT z*7X)5atPqxLDgp10T~Nk`C0XHX5^V!0~cUel-C>F*Z{)J%t_pVgE|F32%spg+OMTQ zgCAsNK1U4L%D;8U1g9%(z7NlxLpDYU=)hBrnsF-AT->O>C>hmTT-YABmZ+R$P{lE+ z4+~=>319|Bu~k!fq|KnjX=!OMnz~^Bnaf*op+kPj`v zADrS{T%2Lk=F_ZzR;q?56H-$J1wA=szZ|;JOAJ70*piZx@}C39yT^ny#T*_StR%TH zdPLjy0Ut>V^ObIs8)9aCD;V>4ewT>Om(_EZACsBNefi!e+lsCZLi)$=wNqOPaOU6| zk69{z$xk0C6Gg|Hu#f-H95?<1kMN`bXGfKr5p*2N{x4nF+yC}c5gw_c@5@|D|4@I} zZxa0?sm#sHWEG3u)%kggAL72oV3NTnBr(7vBymH-se3-4=po`nkez1RC6m%{j*egV zydvw7OGCFlToZqjtog~sbV+ge@+W})QJ^}OogjN9KHE>Dps+MUa#?V%wmD!N+0iEa zW=OU*tR#7SFB#5S({1*WbGL`PFnn*7uMfb-Q$1xpw=3@{+5Q@@OJ)Wz0;oY~J6$NA z#aT+^`9a<5|H#>4mKZij*5nHPBB=C5wsvKGZ&YJ8<}{84>20`Wi8me~Kp ziGt{%!11bIc~9ZXyqT?xU^Nt&H{Q3Rr*RrDJCtZP;mp>yg i3;qA)Pdf1hp%@*xtnTYuLh!33fSk0lRE30b;Qs(!18FD# literal 0 HcmV?d00001 From 43264318c43baaac2bceb84a735617f7769ada8f Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 27 Sep 2017 22:01:34 -0400 Subject: [PATCH 078/130] Some progress --- install/index.php | 85 ++++++++++++++++++++++++++---------- install/js/install-script.js | 49 +++++++++++++++++++++ 2 files changed, 111 insertions(+), 23 deletions(-) create mode 100644 install/js/install-script.js diff --git a/install/index.php b/install/index.php index 6af0ef16..82784cb6 100644 --- a/install/index.php +++ b/install/index.php @@ -5,51 +5,90 @@ require(HESK_PATH . 'install/install_functions.inc.php'); require(HESK_PATH . 'hesk_settings.inc.php'); hesk_dbConnect(); + +/* +We have four possible installation scenarios: + +1. Fresh install - the user has never installed Mods for HESK before. Simply start at migration #0. +2. Installed a really old version - we don't have a previous version to start from. +3. Installed a recent version, but before migrations began - just pull the version # and use the dictionary below. +4. Migration number present in the settings table. Take that number and run with it. + */ ?> - Mods For HESK <?php echo MODS_FOR_HESK_NEW_VERSION; ?> Install / Upgrade - + Mods for HESK <?php echo MODS_FOR_HESK_NEW_VERSION; ?> Install / Upgrade + - - - - - + - - + - + \ No newline at end of file diff --git a/install/js/install-script.js b/install/js/install-script.js new file mode 100644 index 00000000..293fff3c --- /dev/null +++ b/install/js/install-script.js @@ -0,0 +1,49 @@ +var steps = [ + { + name: 'intro', + text: 'Thanks for choosing Mods for HESK', + callback: undefined + }, + { + name: 'db-confirm', + text: 'Confirm the information below', + callback: confirmDatabaseInformation + } +]; + +$(document).ready(function() { + var currentStep = 0; + + $('#next-button').click(function() { + goToStep(++currentStep); + }); + + $('#back-button').click(function() { + goToStep(--currentStep); + }); +}); + +function goToStep(step) { + $('[data-step]').hide(); + $('[data-step="' + steps[step].name + '"]').show(); + + if (step === 0) { + $('#tools-button').show(); + $('#back-button').hide(); + } else { + $('#tools-button').hide(); + $('#back-button').show(); + } + + if (step === steps.length - 1) { + $('#next-button').hide(); + } else { + $('#next-button').show(); + } + + $('#header-text').text(steps[step].text); +} + +function confirmDatabaseInformation() { + +} \ No newline at end of file From 8aac741b6fae9af88af207750859c431908c4ff9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 28 Sep 2017 08:17:45 -0400 Subject: [PATCH 079/130] Added logic to get the starting migration number --- install/index.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/install/index.php b/install/index.php index 82784cb6..e12bbe28 100644 --- a/install/index.php +++ b/install/index.php @@ -14,6 +14,42 @@ We have four possible installation scenarios: 3. Installed a recent version, but before migrations began - just pull the version # and use the dictionary below. 4. Migration number present in the settings table. Take that number and run with it. */ + +$tableSql = hesk_dbQuery("SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings'"); +$startingMigrationNumber = 0; +if (hesk_dbNumRows($tableSql) > 0) { + // They have installed at LEAST to version 1.6.0. Just pull the version number OR migration number + $migrationNumberSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'lastMigration'"); + if ($migrationRow = hesk_dbFetchAssoc($migrationNumberSql)) { + $startingMigrationNumber = $migrationRow['Value']; + } else { + $versionSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'modsForHeskVersion'"); + $versionRow = hesk_dbFetchAssoc($versionSql); + + //TODO Actually map this + $startingMigrationNumber = $versionRow['Value']; + } +} else { + // migration # => sql for checking + $versionChecks = array( + // 1.5.0 -> users.active + 1 => "SHOW COLUMNS FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` LIKE 'active'", + // 1.4.1 -> denied_emails + 2 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails'", + // 1.4.0 -> denied ips + 3 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips'", + // Pre-1.4.0 but still something -> statuses + 4 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses'" + ); + + foreach ($versionChecks as $migrationNumber => $sql) { + $rs = hesk_dbQuery($sql); + if (hesk_dbNumRows($rs) > 0) { + $startingMigrationNumber = $migrationNumber; + break; + } + } +} ?> @@ -85,6 +121,9 @@ We have four possible installation scenarios:
    +
    +

    Here we'd actually be doing some things

    +
    From 8b0fe2cdaf143e8467ce50cc37a3fe2a79d29292 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 28 Sep 2017 08:18:42 -0400 Subject: [PATCH 080/130] Start at -1 as the last installed migration # for new installs --- install/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/index.php b/install/index.php index e12bbe28..c527f8e1 100644 --- a/install/index.php +++ b/install/index.php @@ -16,7 +16,7 @@ We have four possible installation scenarios: */ $tableSql = hesk_dbQuery("SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings'"); -$startingMigrationNumber = 0; +$startingMigrationNumber = -1; if (hesk_dbNumRows($tableSql) > 0) { // They have installed at LEAST to version 1.6.0. Just pull the version number OR migration number $migrationNumberSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'lastMigration'"); From 5aeb90852bcdd9e12fe95516df87ef703e0788e9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 28 Sep 2017 13:04:22 -0400 Subject: [PATCH 081/130] Add progress bar for installer...still need to write the actual migrations --- install/index.php | 8 +++++++- install/js/install-script.js | 11 ++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/install/index.php b/install/index.php index c527f8e1..7e80de85 100644 --- a/install/index.php +++ b/install/index.php @@ -122,7 +122,13 @@ if (hesk_dbNumRows($tableSql) > 0) {
    -

    Here we'd actually be doing some things

    +
    +
    + 100% Complete + 100% +
    +
    diff --git a/install/js/install-script.js b/install/js/install-script.js index 293fff3c..13688100 100644 --- a/install/js/install-script.js +++ b/install/js/install-script.js @@ -7,7 +7,12 @@ var steps = [ { name: 'db-confirm', text: 'Confirm the information below', - callback: confirmDatabaseInformation + callback: undefined + }, + { + name: 'install-or-update', + text: 'Updating to the latest version...', + callback: undefined } ]; @@ -42,8 +47,4 @@ function goToStep(step) { } $('#header-text').text(steps[step].text); -} - -function confirmDatabaseInformation() { - } \ No newline at end of file From dbf9baca753ac335bb4ea389e952c064bb480b02 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 29 Sep 2017 08:13:24 -0400 Subject: [PATCH 082/130] Getting started on the AJAX portion --- install/ajax/get-migration-ajax.php | 12 +++++++ install/index.php | 9 +++-- install/js/install-script.js | 54 ++++++++++++++++++++++++++++- install/migrations/core.php | 7 ++++ 4 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 install/ajax/get-migration-ajax.php create mode 100644 install/migrations/core.php diff --git a/install/ajax/get-migration-ajax.php b/install/ajax/get-migration-ajax.php new file mode 100644 index 00000000..5e49928c --- /dev/null +++ b/install/ajax/get-migration-ajax.php @@ -0,0 +1,12 @@ + key($allMigrations))); \ No newline at end of file diff --git a/install/index.php b/install/index.php index 7e80de85..47589f69 100644 --- a/install/index.php +++ b/install/index.php @@ -83,7 +83,7 @@ if (hesk_dbNumRows($tableSql) > 0) {
    - + \ No newline at end of file diff --git a/install/js/install-script.js b/install/js/install-script.js index f80af6c6..2c93141b 100644 --- a/install/js/install-script.js +++ b/install/js/install-script.js @@ -113,9 +113,15 @@ function executeMigration(startingMigrationNumber, migrationNumber, latestMigrat executeMigration(startingMigrationNumber, newMigrationNumber, latestMigrationNumber, direction); } }, - error: function(data) { + error: function(response) { + try { + message = JSON.parse(response); + } catch (e) { + message = response.responseText; + } + $('#error-block').html("An error occurred! (Error Code: " + migrationNumber + ")
    " + message).show(); updateProgressBar(migrationNumber, latestMigrationNumber, true, true); - console.error(data); + console.error(message); } }) } @@ -125,13 +131,14 @@ function updateProgressBar(migrationNumber, latestMigrationNumber, isError, isFi if (isError === true) { $progressBar.find('.progress-bar').removeClass('progress-bar-success') + .removeClass('active') .addClass('progress-bar-danger'); } else { var percentage = Math.round(migrationNumber / latestMigrationNumber * 100); $progressBar.find('.progress-bar').css('width', percentage + '%'); } - if (isFinished) { + if (isFinished && !isError) { goToStep(steps.length - 1); } } \ No newline at end of file From 78559de051f9697b8c9134b363dabd2a8a2511bd Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 15 Oct 2017 21:23:56 -0400 Subject: [PATCH 100/130] Trying to get downgrades working properly --- install/js/install-script.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/install/js/install-script.js b/install/js/install-script.js index 2c93141b..ef4e54c9 100644 --- a/install/js/install-script.js +++ b/install/js/install-script.js @@ -85,12 +85,12 @@ function installOrUpdate() { $('[data-step="install-or-update"] > .progress').show(); // Recursive call that will increment by 1 each time - executeMigration(startingMigrationNumber, startingMigrationNumber, data.lastMigrationNumber, 'up'); + executeMigration(startingMigrationNumber, data.lastMigrationNumber, 'up'); } }) } -function executeMigration(startingMigrationNumber, migrationNumber, latestMigrationNumber, direction) { +function executeMigration(migrationNumber, latestMigrationNumber, direction) { var heskPath = $('p#hesk-path').text(); $.ajax({ @@ -103,14 +103,14 @@ function executeMigration(startingMigrationNumber, migrationNumber, latestMigrat success: function(data) { console.log('migrationNumber: ' + migrationNumber); console.log('latestMigrationNumber: ' + latestMigrationNumber); - console.log(migrationNumber === latestMigrationNumber); - if (migrationNumber === latestMigrationNumber) { - updateProgressBar(migrationNumber, latestMigrationNumber, false, true); + console.info('---'); + if (migrationNumber === latestMigrationNumber || (migrationNumber === 1 && direction === 'down')) { + updateProgressBar(migrationNumber, latestMigrationNumber, direction === 'down', true); console.log('DONE'); } else { updateProgressBar(migrationNumber, latestMigrationNumber, false, false); var newMigrationNumber = direction === 'up' ? migrationNumber + 1 : migrationNumber - 1; - executeMigration(startingMigrationNumber, newMigrationNumber, latestMigrationNumber, direction); + executeMigration(newMigrationNumber, latestMigrationNumber, direction); } }, error: function(response) { @@ -131,8 +131,14 @@ function updateProgressBar(migrationNumber, latestMigrationNumber, isError, isFi if (isError === true) { $progressBar.find('.progress-bar').removeClass('progress-bar-success') - .removeClass('active') .addClass('progress-bar-danger'); + + if (isFinished) { + var $errorBlock = $('#error-block'); + $errorBlock.html($errorBlock.html() + '

    Successfully reverted database to before the installation/update.'); + } else { + executeMigration(migrationNumber - 1, latestMigrationNumber, 'down', true); + } } else { var percentage = Math.round(migrationNumber / latestMigrationNumber * 100); $progressBar.find('.progress-bar').css('width', percentage + '%'); From f5907bf476041d9db90bd4697992f8db384a1e08 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 16 Oct 2017 13:08:53 -0400 Subject: [PATCH 101/130] Some changes --- install/js/install-script.js | 14 ++++++++++---- install/js/migration-handler.js | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 install/js/migration-handler.js diff --git a/install/js/install-script.js b/install/js/install-script.js index ef4e54c9..b6515cb0 100644 --- a/install/js/install-script.js +++ b/install/js/install-script.js @@ -106,7 +106,7 @@ function executeMigration(migrationNumber, latestMigrationNumber, direction) { console.info('---'); if (migrationNumber === latestMigrationNumber || (migrationNumber === 1 && direction === 'down')) { updateProgressBar(migrationNumber, latestMigrationNumber, direction === 'down', true); - console.log('DONE'); + console.log('%c Success! ', 'color: white; background-color: green; font-size: 2em'); } else { updateProgressBar(migrationNumber, latestMigrationNumber, false, false); var newMigrationNumber = direction === 'up' ? migrationNumber + 1 : migrationNumber - 1; @@ -120,7 +120,15 @@ function executeMigration(migrationNumber, latestMigrationNumber, direction) { message = response.responseText; } $('#error-block').html("An error occurred! (Error Code: " + migrationNumber + ")
    " + message).show(); - updateProgressBar(migrationNumber, latestMigrationNumber, true, true); + + updateProgressBar(migrationNumber, latestMigrationNumber, true, false); + + if (direction === 'up') { + // Revert! + executeMigration(migrationNumber - 1, 1, 'down'); + } else { + console.error("I even failed to roll back. Yikes! :'("); + } console.error(message); } }) @@ -136,8 +144,6 @@ function updateProgressBar(migrationNumber, latestMigrationNumber, isError, isFi if (isFinished) { var $errorBlock = $('#error-block'); $errorBlock.html($errorBlock.html() + '

    Successfully reverted database to before the installation/update.'); - } else { - executeMigration(migrationNumber - 1, latestMigrationNumber, 'down', true); } } else { var percentage = Math.round(migrationNumber / latestMigrationNumber * 100); diff --git a/install/js/migration-handler.js b/install/js/migration-handler.js new file mode 100644 index 00000000..ba3793c6 --- /dev/null +++ b/install/js/migration-handler.js @@ -0,0 +1,14 @@ +function executeMigration(migrationNumber, direction, success, error) { + var heskPath = $('p#hesk-path').text(); + + $.ajax({ + url: heskPath + 'install/ajax/process-migration.php', + method: 'POST', + data: JSON.stringify({ + migrationNumber: migrationNumber, + direction: direction + }), + success: success(data), + error: error(data) + }) +} \ No newline at end of file From cae76032d137c81ccf706305416748909783a168 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 16 Oct 2017 20:39:16 -0400 Subject: [PATCH 102/130] I *think* the rollback feature is working? --- install/js/install-script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/js/install-script.js b/install/js/install-script.js index b6515cb0..ae58bc7a 100644 --- a/install/js/install-script.js +++ b/install/js/install-script.js @@ -125,7 +125,7 @@ function executeMigration(migrationNumber, latestMigrationNumber, direction) { if (direction === 'up') { // Revert! - executeMigration(migrationNumber - 1, 1, 'down'); + executeMigration(migrationNumber - 1, latestMigrationNumber, 'down'); } else { console.error("I even failed to roll back. Yikes! :'("); } From d35cf4d35800845bbd91490ae6d3de69949092a1 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 16 Oct 2017 22:02:04 -0400 Subject: [PATCH 103/130] Fix some migrations --- install/index.php | 2 +- install/js/install-script.js | 2 +- install/migrations/v200/MigrateIpAndEmailBans.php | 4 ++-- .../migrations/v230/MovePermissionsToHeskPrivilegesColumn.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/install/index.php b/install/index.php index 599dc49a..5be220f7 100644 --- a/install/index.php +++ b/install/index.php @@ -139,7 +139,7 @@ if (hesk_dbNumRows($tableSql) > 0) {

    -
    +
    diff --git a/install/js/install-script.js b/install/js/install-script.js index ae58bc7a..8bf51617 100644 --- a/install/js/install-script.js +++ b/install/js/install-script.js @@ -119,7 +119,7 @@ function executeMigration(migrationNumber, latestMigrationNumber, direction) { } catch (e) { message = response.responseText; } - $('#error-block').html("An error occurred! (Error Code: " + migrationNumber + ")
    " + message).show(); + $('#error-block').html("

    An error occurred! (Error Code: " + migrationNumber + ")
    " + message).show(); updateProgressBar(migrationNumber, latestMigrationNumber, true, false); diff --git a/install/migrations/v200/MigrateIpAndEmailBans.php b/install/migrations/v200/MigrateIpAndEmailBans.php index 5d2f1534..604b370a 100644 --- a/install/migrations/v200/MigrateIpAndEmailBans.php +++ b/install/migrations/v200/MigrateIpAndEmailBans.php @@ -7,14 +7,14 @@ class MigrateIpAndEmailBans extends \AbstractMigration { function up($hesk_settings) { // Insert the email bans - $emailBanRS = executeQuery("SELECT `Email` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`"); + $emailBanRS = $this->executeQuery("SELECT `Email` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`"); while ($row = hesk_dbFetchAssoc($emailBanRS)) { $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_emails` (`email`, `banned_by`, `dt`) VALUES ('" . hesk_dbEscape($row['Email']) . "', 1, NOW())"); } // Insert the IP bans - $ipBanRS = executeQuery("SELECT `RangeStart`, `RangeEnd` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`"); + $ipBanRS = $this->executeQuery("SELECT `RangeStart`, `RangeEnd` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`"); while ($row = hesk_dbFetchAssoc($ipBanRS)) { $ipFrom = long2ip($row['RangeStart']); $ipTo = long2ip($row['RangeEnd']); diff --git a/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn.php b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn.php index 9ace4515..f4a5a5b4 100644 --- a/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn.php +++ b/install/migrations/v230/MovePermissionsToHeskPrivilegesColumn.php @@ -44,7 +44,7 @@ class MovePermissionsToHeskPrivilegesColumn extends \AbstractMigration { $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_manage_settings` ENUM ('0', '1') NOT NULL DEFAULT '1'"); $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` - SET `can_change_settings` = '0' + SET `can_manage_settings` = '0' WHERE `heskprivileges` NOT LIKE '%can_man_settings%'"); $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `can_change_notification_settings` = '0' From 8b7f0ace3ac4e0f792644edc0e06821cb4fe4282 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 17 Oct 2017 21:48:58 -0400 Subject: [PATCH 104/130] Fixed error logger --- install/js/install-script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/js/install-script.js b/install/js/install-script.js index 8bf51617..097fc242 100644 --- a/install/js/install-script.js +++ b/install/js/install-script.js @@ -119,7 +119,8 @@ function executeMigration(migrationNumber, latestMigrationNumber, direction) { } catch (e) { message = response.responseText; } - $('#error-block').html("

    An error occurred! (Error Code: " + migrationNumber + ")
    " + message).show(); + $errorBlock = $('#error-block'); + $errorBlock.html($errorBlock.html() + "

    An error occurred! (Error Code: " + migrationNumber + ")
    " + message).show(); updateProgressBar(migrationNumber, latestMigrationNumber, true, false); From 0df87dde57700eac62b8971e113abee3d90bdd9c Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 18 Oct 2017 13:02:48 -0400 Subject: [PATCH 105/130] Fix some migrations, add new ones to keep track of migration number --- install/database-validation.php | 5 + .../migrations/AbstractUpdatableMigration.php | 27 ++++ install/migrations/LegacyUpdateMigration.php | 19 +++ install/migrations/UpdateMigration.php | 10 +- install/migrations/core.php | 125 +++++++++--------- .../migrations/v200/MigrateIpAndEmailBans.php | 3 - .../v230/CreatePermissionTemplates.php | 3 +- .../v310/ConvertPresetToIndividualColors.php | 2 +- .../migrations/v320/AddMigrationSetting.php | 16 +++ 9 files changed, 140 insertions(+), 70 deletions(-) create mode 100644 install/migrations/AbstractUpdatableMigration.php create mode 100644 install/migrations/LegacyUpdateMigration.php create mode 100644 install/migrations/v320/AddMigrationSetting.php diff --git a/install/database-validation.php b/install/database-validation.php index 7e3d462f..e26c45cf 100644 --- a/install/database-validation.php +++ b/install/database-validation.php @@ -199,6 +199,11 @@ hesk_dbConnect(); $all_good = $all_good & run_setting_check('admin_sidebar_font_weight'); $all_good = $all_good & run_setting_check('admin_sidebar_header_background'); $all_good = $all_good & run_setting_check('admin_sidebar_header_text'); + output_header_row('3.2.0'); + $all_good &= run_table_check('audit_trail'); + $all_good &= run_table_check('audit_trail_to_replacement_values'); + $all_good &= run_column_check('categories', 'mfh_description'); + $all_good &= run_column_check('custom_fields', 'mfh_description'); if ($all_good) { echo ""; diff --git a/install/migrations/AbstractUpdatableMigration.php b/install/migrations/AbstractUpdatableMigration.php new file mode 100644 index 00000000..98311b79 --- /dev/null +++ b/install/migrations/AbstractUpdatableMigration.php @@ -0,0 +1,27 @@ +migrationNumber = $migrationNumber; + } + + function up($hesk_settings) { + $this->innerUp($hesk_settings); + + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = " . intval($this->migrationNumber) . " + WHERE `Key` = 'migrationNumber'"); + } + + abstract function innerUp($hesk_settings); + + function down($hesk_settings) { + $this->innerDown($hesk_settings); + + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = " . (intval($this->migrationNumber) - 1) . " + WHERE `Key` = 'migrationNumber'"); + } + + abstract function innerDown($hesk_settings); +} \ No newline at end of file diff --git a/install/migrations/LegacyUpdateMigration.php b/install/migrations/LegacyUpdateMigration.php new file mode 100644 index 00000000..ffbc9afb --- /dev/null +++ b/install/migrations/LegacyUpdateMigration.php @@ -0,0 +1,19 @@ +upVersion = $upVersion; + $this->downVersion = $downVersion; + } + + function up($hesk_settings) { + $this->updateVersion($this->upVersion, $hesk_settings); + } + + function down($hesk_settings) { + $this->updateVersion($this->downVersion, $hesk_settings); + } +} \ No newline at end of file diff --git a/install/migrations/UpdateMigration.php b/install/migrations/UpdateMigration.php index 89fc3a86..2a585e69 100644 --- a/install/migrations/UpdateMigration.php +++ b/install/migrations/UpdateMigration.php @@ -1,19 +1,21 @@ upVersion = $upVersion; $this->downVersion = $downVersion; } - function up($hesk_settings) { + function innerUp($hesk_settings) { $this->updateVersion($this->upVersion, $hesk_settings); } - function down($hesk_settings) { + function innerDown($hesk_settings) { $this->updateVersion($this->downVersion, $hesk_settings); } } \ No newline at end of file diff --git a/install/migrations/core.php b/install/migrations/core.php index 732d9726..8f9fa300 100644 --- a/install/migrations/core.php +++ b/install/migrations/core.php @@ -38,113 +38,116 @@ function getAllMigrations() { 14 => new \v160\CreateSettingsTable(), 15 => new \v160\InsertVersionRecord(), //1.6.1 - 16 => new UpdateMigration('1.6.1', '1.6.0'), + 16 => new LegacyUpdateMigration('1.6.1', '1.6.0'), //1.7.0 17 => new \v170\CreateVerifiedEmailsTable(), 18 => new \v170\CreatePendingVerificationEmailsTable(), 19 => new \v170\CreateStageTicketsTable(), - 20 => new UpdateMigration('1.7.0', '1.6.1'), + 20 => new LegacyUpdateMigration('1.7.0', '1.6.1'), //2.0.0 21 => new \v200\RemoveNoteIdFromAttachments(), 22 => new \v200\RemoveEditInfoFromNotes(), 23 => new \v200\RemoveDefaultNotifyCustomerEmailPreference(), 24 => new \v200\AddMissingKeyToTickets(), 25 => new \v200\MigrateIpAndEmailBans(), - 26 => new UpdateMigration('2.0.0', '1.7.0'), + 26 => new LegacyUpdateMigration('2.0.0', '1.7.0'), //2.0.1 - 27 => new UpdateMigration('2.0.1', '2.0.0'), + 27 => new LegacyUpdateMigration('2.0.1', '2.0.0'), //2.1.0 - 28 => new UpdateMigration('2.1.0', '2.0.1'), + 28 => new LegacyUpdateMigration('2.1.0', '2.0.1'), //2.1.1 29 => new \v211\FixStageTicketsTable(), - 30 => new UpdateMigration('2.1.1', '2.1.0'), + 30 => new LegacyUpdateMigration('2.1.1', '2.1.0'), //2.2.0 31 => new \v220\AddIsAutocloseOptionToStatuses(), 32 => new \v220\AddClosableColumnToStatuses(), - 33 => new UpdateMigration('2.2.0', '2.1.1'), + 33 => new LegacyUpdateMigration('2.2.0', '2.1.1'), //2.2.1 - 34 => new UpdateMigration('2.2.1', '2.2.0'), + 34 => new LegacyUpdateMigration('2.2.1', '2.2.0'), //2.3.0 35 => new \v230\AddIconToServiceMessages(), 36 => new \v230\ConsolidateStatusColumns(), 37 => new \v230\AddCoordinatesToTickets(), 38 => new \v230\AddCategoryManager(), 39 => new \v230\MovePermissionsToHeskPrivilegesColumn(), - 40 => new UpdateMigration('2.3.0', '2.2.1'), + 40 => new \v230\CreatePermissionTemplates(), + 41 => new LegacyUpdateMigration('2.3.0', '2.2.1'), //2.3.1 - 41 => new UpdateMigration('2.3.1', '2.3.0'), + 42 => new LegacyUpdateMigration('2.3.1', '2.3.0'), //2.3.2 - 42 => new UpdateMigration('2.3.2', '2.3.1'), + 43 => new LegacyUpdateMigration('2.3.2', '2.3.1'), //2.4.0 - 43 => new \v240\CreateQuickHelpSectionsTable(), - 44 => new \v240\CreateNewStatusNameTable(), - 45 => new \v240\AddDownloadCountToAttachments(), - 46 => new \v240\AddHtmlColumnToTickets(), - 47 => new UpdateMigration('2.4.0', '2.3.2'), + 44 => new \v240\CreateQuickHelpSectionsTable(), + 45 => new \v240\CreateNewStatusNameTable(), + 46 => new \v240\AddDownloadCountToAttachments(), + 47 => new \v240\AddHtmlColumnToTickets(), + 48 => new LegacyUpdateMigration('2.4.0', '2.3.2'), //2.4.1 - 48 => new UpdateMigration('2.4.1', '2.4.0'), + 49 => new LegacyUpdateMigration('2.4.1', '2.4.0'), //2.4.2 - 49 => new UpdateMigration('2.4.2', '2.4.1'), + 50 => new LegacyUpdateMigration('2.4.2', '2.4.1'), //2.5.0 - 50 => new \v250\MigrateSettingsToDatabase(), - 51 => new \v250\AddUserAgentAndScreenResToTickets(), - 52 => new \v250\AddNavbarTitleUrl(), - 53 => new UpdateMigration('2.5.0', '2.4.2'), + 51 => new \v250\MigrateSettingsToDatabase(), + 52 => new \v250\AddUserAgentAndScreenResToTickets(), + 53 => new \v250\AddNavbarTitleUrl(), + 54 => new LegacyUpdateMigration('2.5.0', '2.4.2'), //2.5.1 - 54 => new UpdateMigration('2.5.1', '2.5.0'), + 55 => new LegacyUpdateMigration('2.5.1', '2.5.0'), //2.5.2 - 55 => new UpdateMigration('2.5.2', '2.5.1'), + 56 => new LegacyUpdateMigration('2.5.2', '2.5.1'), //2.5.3 - 56 => new UpdateMigration('2.5.3', '2.5.2'), + 57 => new LegacyUpdateMigration('2.5.3', '2.5.2'), //2.5.4 - 57 => new UpdateMigration('2.5.4', '2.5.3'), + 58 => new LegacyUpdateMigration('2.5.4', '2.5.3'), //2.5.5 - 58 => new UpdateMigration('2.5.5', '2.5.4'), + 59 => new LegacyUpdateMigration('2.5.5', '2.5.4'), //2.6.0 - 59 => new \v260\AddApiTables(), - 60 => new \v260\AddLoggingTable(), - 61 => new \v260\AddTempAttachmentTable(), - 62 => new \v260\AddCalendarModule(), - 63 => new \v260\AddPrimaryKeyToSettings(), - 64 => new \v260\ConvertStatusPropertiesToInts(), - 65 => new UpdateMigration('2.6.0', '2.5.5'), + 60 => new \v260\AddApiTables(), + 61 => new \v260\AddLoggingTable(), + 62 => new \v260\AddTempAttachmentTable(), + 63 => new \v260\AddCalendarModule(), + 64 => new \v260\AddPrimaryKeyToSettings(), + 65 => new \v260\ConvertStatusPropertiesToInts(), + 66 => new LegacyUpdateMigration('2.6.0', '2.5.5'), //2.6.1 - 66 => new UpdateMigration('2.6.1', '2.6.0'), + 67 => new LegacyUpdateMigration('2.6.1', '2.6.0'), //2.6.2 - 67 => new \v262\AddMissingColumnsToStageTickets(), - 68 => new UpdateMigration('2.6.2', '2.6.1'), + 68 => new \v262\AddMissingColumnsToStageTickets(), + 69 => new LegacyUpdateMigration('2.6.2', '2.6.1'), //2.6.3 - 69 => new UpdateMigration('2.6.3', '2.6.2'), + 70 => new LegacyUpdateMigration('2.6.3', '2.6.2'), //2.6.4 - 70 => new UpdateMigration('2.6.4', '2.6.3'), + 71 => new LegacyUpdateMigration('2.6.4', '2.6.3'), //3.0.0 - 71 => new \v300\MigrateHeskCustomStatuses(), - 72 => new \v300\MigrateAutorefreshOption(), - 73 => new \v300\AddColorSchemeSetting(), - 74 => new UpdateMigration('3.0.0', '2.6.4'), + 72 => new \v300\MigrateHeskCustomStatuses(), + 73 => new \v300\MigrateAutorefreshOption(), + 74 => new \v300\AddColorSchemeSetting(), + 75 => new LegacyUpdateMigration('3.0.0', '2.6.4'), //3.0.1 - 75 => new UpdateMigration('3.0.1', '3.0.0'), + 76 => new LegacyUpdateMigration('3.0.1', '3.0.0'), //3.0.2 - 76 => new \v302\AddMissingCustomFields(), - 77 => new UpdateMigration('3.0.2', '3.0.1'), + 77 => new \v302\AddMissingCustomFields(), + 78 => new LegacyUpdateMigration('3.0.2', '3.0.1'), //3.0.3 - 3.0.7 - 78 => new UpdateMigration('3.0.3', '3.0.2'), - 79 => new UpdateMigration('3.0.4', '3.0.3'), - 80 => new UpdateMigration('3.0.5', '3.0.4'), - 81 => new UpdateMigration('3.0.6', '3.0.5'), - 82 => new UpdateMigration('3.0.7', '3.0.6'), + 79 => new LegacyUpdateMigration('3.0.3', '3.0.2'), + 80 => new LegacyUpdateMigration('3.0.4', '3.0.3'), + 81 => new LegacyUpdateMigration('3.0.5', '3.0.4'), + 82 => new LegacyUpdateMigration('3.0.6', '3.0.5'), + 83 => new LegacyUpdateMigration('3.0.7', '3.0.6'), //3.1.0 - 83 => new \v310\AddStackTraceToLogs(), - 84 => new \v310\AddCustomNavElements(), - 85 => new \v310\AddMoreColorOptionsToCategories(), - 86 => new \v310\AddNewLoginSettings(), - 87 => new \v310\AddApiUrlRewriteSetting(), - 88 => new \v310\ConvertPresetToIndividualColors(), - 89 => new UpdateMigration('3.1.0', '3.0.7'), + 84 => new \v310\AddStackTraceToLogs(), + 85 => new \v310\AddCustomNavElements(), + 86 => new \v310\AddMoreColorOptionsToCategories(), + 87 => new \v310\AddNewLoginSettings(), + 88 => new \v310\AddApiUrlRewriteSetting(), + 89 => new \v310\ConvertPresetToIndividualColors(), + 90 => new LegacyUpdateMigration('3.1.0', '3.0.7'), //3.1.1 - 90 => new UpdateMigration('3.1.1', '3.1.0'), + 91 => new LegacyUpdateMigration('3.1.1', '3.1.0'), //3.2.0 - 91 => new \v320\AddDescriptionToCategoriesAndCustomFields(), - 92 => new \v320\AddAuditTrail(), + 92 => new \v320\AddDescriptionToCategoriesAndCustomFields(), + 93 => new \v320\AddAuditTrail(), + 94 => new \v320\AddMigrationSetting(), + 95 => new UpdateMigration('3.2.0', '3.1.1', 95), ); } \ No newline at end of file diff --git a/install/migrations/v200/MigrateIpAndEmailBans.php b/install/migrations/v200/MigrateIpAndEmailBans.php index 604b370a..3174fe83 100644 --- a/install/migrations/v200/MigrateIpAndEmailBans.php +++ b/install/migrations/v200/MigrateIpAndEmailBans.php @@ -46,8 +46,5 @@ class MigrateIpAndEmailBans extends \AbstractMigration { while ($row = hesk_dbFetchAssoc($ips)) { $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips` (`RangeStart`, `RangeEnd`) VALUES (" . $row['ip_from'] . ", " . $row['ip_to'] . ")"); } - - $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_ips`"); - $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "banned_emails`"); } } \ No newline at end of file diff --git a/install/migrations/v230/CreatePermissionTemplates.php b/install/migrations/v230/CreatePermissionTemplates.php index bd7365ca..fad3cff9 100644 --- a/install/migrations/v230/CreatePermissionTemplates.php +++ b/install/migrations/v230/CreatePermissionTemplates.php @@ -19,6 +19,7 @@ class CreatePermissionTemplates extends \AbstractMigration { } function down($hesk_settings) { - // TODO: Implement down() method. + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `permission_template`"); + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates`"); } } \ No newline at end of file diff --git a/install/migrations/v310/ConvertPresetToIndividualColors.php b/install/migrations/v310/ConvertPresetToIndividualColors.php index b3c0127b..c0d8461d 100644 --- a/install/migrations/v310/ConvertPresetToIndividualColors.php +++ b/install/migrations/v310/ConvertPresetToIndividualColors.php @@ -14,7 +14,7 @@ class ConvertPresetToIndividualColors extends \AbstractMigration { $theme = $theme_preset_row['Value']; } - $light_theme = preg_match('/.*-light/g', $theme); + $light_theme = preg_match_all('/.*-light/', $theme); $navbar = array( 'background' => '', 'text' => '#fff', diff --git a/install/migrations/v320/AddMigrationSetting.php b/install/migrations/v320/AddMigrationSetting.php new file mode 100644 index 00000000..72c9c0b3 --- /dev/null +++ b/install/migrations/v320/AddMigrationSetting.php @@ -0,0 +1,16 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('migrationNumber', '94')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'migrationNumber'"); + } +} \ No newline at end of file From 60ac53fe94f96ed2ad1b2a200bdd3ddd6a2dc174 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 18 Oct 2017 13:03:11 -0400 Subject: [PATCH 106/130] Change key --- install/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/index.php b/install/index.php index 5be220f7..e8bf76a0 100644 --- a/install/index.php +++ b/install/index.php @@ -19,7 +19,7 @@ $tableSql = hesk_dbQuery("SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db $startingMigrationNumber = 1; if (hesk_dbNumRows($tableSql) > 0) { // They have installed at LEAST to version 1.6.0. Just pull the version number OR migration number - $migrationNumberSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'lastMigration'"); + $migrationNumberSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'migrationNumber'"); if ($migrationRow = hesk_dbFetchAssoc($migrationNumberSql)) { $startingMigrationNumber = intval($migrationRow['Value']) + 1; } else { From 7aa7526a17ea20c56b13c678bb274b29ef044af0 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 18 Oct 2017 22:00:00 -0400 Subject: [PATCH 107/130] Working on the uninstaller --- install/database-validation.php | 256 +++++++++--------- install/js/uninstall-script.js | 157 +++++++++++ install/mods-for-hesk/js/uninstall-scripts.js | 102 ------- .../mods-for-hesk/uninstallModsForHesk.php | 86 ------ install/uninstall.php | 177 ++++++++++++ 5 files changed, 463 insertions(+), 315 deletions(-) create mode 100644 install/js/uninstall-script.js delete mode 100644 install/mods-for-hesk/js/uninstall-scripts.js delete mode 100644 install/mods-for-hesk/uninstallModsForHesk.php create mode 100644 install/uninstall.php diff --git a/install/database-validation.php b/install/database-validation.php index e26c45cf..4eaf4c8a 100644 --- a/install/database-validation.php +++ b/install/database-validation.php @@ -31,7 +31,7 @@ hesk_dbConnect();
    - - \ No newline at end of file diff --git a/install/js/uninstall-script.js b/install/js/uninstall-script.js index 5e088c8d..edb0b833 100644 --- a/install/js/uninstall-script.js +++ b/install/js/uninstall-script.js @@ -81,8 +81,8 @@ function uninstall() { success: function(data) { data = JSON.parse(data); - $('[data-step="install-or-update"] > #spinner').hide(); - $('[data-step="install-or-update"] > .progress').show(); + $('[data-step="uninstall"] > #spinner').hide(); + $('[data-step="uninstall"] > .progress').show(); // Recursive call that will increment by 1 each time executeMigration(startingMigrationNumber, 1, 'down'); @@ -104,8 +104,8 @@ function executeMigration(migrationNumber, latestMigrationNumber, direction) { console.log('migrationNumber: ' + migrationNumber); console.log('latestMigrationNumber: ' + latestMigrationNumber); console.info('---'); - if (migrationNumber === latestMigrationNumber || (migrationNumber === 1 && direction === 'down')) { - updateProgressBar(migrationNumber, latestMigrationNumber, direction === 'down', true); + if (migrationNumber === latestMigrationNumber) { + updateProgressBar(migrationNumber, latestMigrationNumber, false, true); console.log('%c Success! ', 'color: white; background-color: green; font-size: 2em'); } else { updateProgressBar(migrationNumber, latestMigrationNumber, false, false); @@ -124,12 +124,6 @@ function executeMigration(migrationNumber, latestMigrationNumber, direction) { updateProgressBar(migrationNumber, latestMigrationNumber, true, false); - if (direction === 'up') { - // Revert! - executeMigration(migrationNumber - 1, latestMigrationNumber, 'down'); - } else { - console.error("I even failed to roll back. Yikes! :'("); - } console.error(message); } }) diff --git a/install/uninstall.php b/install/uninstall.php index 7fd08339..0ba8272b 100644 --- a/install/uninstall.php +++ b/install/uninstall.php @@ -146,32 +146,15 @@ if (hesk_dbNumRows($tableSql) > 0) {
    + +    Back to installer +
    Next   
    - - \ No newline at end of file From 109a4fa25feb962e18d48aeb98ae1b2990582702 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 20 Oct 2017 13:07:01 -0400 Subject: [PATCH 109/130] Uninstaller works --- install/database-validation.php | 4 ++-- install/js/install-script.js | 10 +++++----- install/js/uninstall-script.js | 16 ++++++++-------- install/uninstall.php | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/install/database-validation.php b/install/database-validation.php index 4eaf4c8a..e7ae6853 100644 --- a/install/database-validation.php +++ b/install/database-validation.php @@ -31,7 +31,7 @@ hesk_dbConnect();