From 68308b02a5dc20de4bfa390f68197fead7aa8328 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Jul 2017 21:57:29 -0400 Subject: [PATCH 01/32] 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 02/32] 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 03/32] 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 04/32] 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 05/32] 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 06/32] 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 07/32] 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 08/32] 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 09/32] 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 10/32] 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 11/32] 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 12/32] 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 13/32] 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 19/32] 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 20/32] 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 21/32] 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 23/32] 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 24/32] 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 25/32] 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 26/32] 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 27/32] 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 28/32] 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 29/32] 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 30/32] 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 31/32] 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 32/32] 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); } }