diff --git a/app/admin/actions/AssigneeController.php b/app/admin/actions/AssigneeController.php index 427e21d5ca..66249f987f 100644 --- a/app/admin/actions/AssigneeController.php +++ b/app/admin/actions/AssigneeController.php @@ -124,7 +124,7 @@ protected function assigneeBindFormEvents() return; $assignable = $widget->model; - if (!$assignable->hasAssignToGroup() OR $assignable->hasAssignTo()) + if (!$assignable->hasAssignToGroup() || $assignable->hasAssignTo()) return; // Let the allocator handle assignment when auto assign is enabled diff --git a/app/admin/actions/CalendarController.php b/app/admin/actions/CalendarController.php index 4705f64bfc..93c0fdad32 100644 --- a/app/admin/actions/CalendarController.php +++ b/app/admin/actions/CalendarController.php @@ -128,7 +128,7 @@ protected function makeCalendar($alias) $widget->bindToController(); // Prep the optional toolbar widget - if (isset($modelConfig['toolbar']) AND isset($this->controller->widgets['toolbar'])) { + if (isset($modelConfig['toolbar']) && isset($this->controller->widgets['toolbar'])) { $this->toolbarWidget = $this->controller->widgets['toolbar']; if ($this->toolbarWidget instanceof \Admin\Widgets\Toolbar) $this->toolbarWidget->reInitialize($modelConfig['toolbar']); @@ -139,7 +139,7 @@ protected function makeCalendar($alias) public function renderCalendar($alias = null) { - if (is_null($alias) OR !isset($this->listConfig[$alias])) + if (is_null($alias) || !isset($this->listConfig[$alias])) $alias = $this->primaryAlias; $list = []; diff --git a/app/admin/actions/FormController.php b/app/admin/actions/FormController.php index 096a4bfb9c..fc0c8c5081 100644 --- a/app/admin/actions/FormController.php +++ b/app/admin/actions/FormController.php @@ -199,7 +199,7 @@ public function initForm($model, $context = null) $this->formWidget->bindToController(); // Prep the optional toolbar widget - if (isset($modelConfig['toolbar']) AND isset($this->controller->widgets['toolbar'])) { + if (isset($modelConfig['toolbar']) && isset($this->controller->widgets['toolbar'])) { $this->toolbarWidget = $this->controller->widgets['toolbar']; if ($this->toolbarWidget instanceof Toolbar) { $this->toolbarWidget->reInitialize($modelConfig['toolbar']); @@ -440,11 +440,11 @@ protected function createModel() public function makeRedirect($context = null, $model = null) { $redirectUrl = null; - if (post('new') AND !ends_with($context, '-new')) { + if (post('new') && !ends_with($context, '-new')) { $context .= '-new'; } - if (post('close') AND !ends_with($context, '-close')) { + if (post('close') && !ends_with($context, '-close')) { $context .= '-close'; } @@ -454,7 +454,7 @@ public function makeRedirect($context = null, $model = null) $redirectUrl = $this->getRedirectUrl($context); - if ($model AND $redirectUrl) { + if ($model && $redirectUrl) { $redirectUrl = parse_values($model->getAttributes(), $redirectUrl); } @@ -502,7 +502,7 @@ protected function prepareModelsToSave($model, $saveData) */ protected function setModelAttributes($model, $saveData) { - if (!is_array($saveData) OR !$model) { + if (!is_array($saveData) || !$model) { return; } @@ -510,12 +510,12 @@ protected function setModelAttributes($model, $saveData) $singularTypes = ['belongsTo', 'hasOne', 'morphOne']; foreach ($saveData as $attribute => $value) { - $isNested = ($attribute == 'pivot' OR ( - $model->hasRelation($attribute) AND + $isNested = ($attribute == 'pivot' || ( + $model->hasRelation($attribute) && in_array($model->getRelationType($attribute), $singularTypes) )); - if ($isNested AND is_array($value) AND $model->{$attribute}) { + if ($isNested && is_array($value) && $model->{$attribute}) { $this->setModelAttributes($model->{$attribute}, $value); } elseif ($value !== FormField::NO_SAVE_DATA) { diff --git a/app/admin/actions/ListController.php b/app/admin/actions/ListController.php index 55d3b11856..bb085d49ac 100644 --- a/app/admin/actions/ListController.php +++ b/app/admin/actions/ListController.php @@ -103,7 +103,7 @@ public function index() public function index_onDelete() { $checkedIds = post('checked'); - if (!$checkedIds OR !is_array($checkedIds) OR !count($checkedIds)) { + if (!$checkedIds || !is_array($checkedIds) || !count($checkedIds)) { flash()->success(lang('admin::lang.list.delete_empty')); return $this->controller->refreshList(); @@ -165,7 +165,7 @@ public function makeLists() */ public function makeList($alias) { - if (!$alias OR !isset($this->listConfig[$alias])) + if (!$alias || !isset($this->listConfig[$alias])) $alias = $this->primaryAlias; $listConfig = $this->controller->getListConfig($alias); @@ -210,7 +210,7 @@ public function makeList($alias) $widget->bindToController(); // Prep the optional toolbar widget - if (isset($this->controller->widgets['toolbar']) AND (isset($listConfig['toolbar']) OR isset($modelConfig['toolbar']))) { + if (isset($this->controller->widgets['toolbar']) && (isset($listConfig['toolbar']) || isset($modelConfig['toolbar']))) { $this->toolbarWidget = $this->controller->widgets['toolbar']; if ($this->toolbarWidget instanceof \Admin\Widgets\Toolbar) $this->toolbarWidget->reInitialize($listConfig['toolbar'] ?? $modelConfig['toolbar']); @@ -266,7 +266,7 @@ public function makeList($alias) public function renderList($alias = null) { - if (is_null($alias) OR !isset($this->listConfig[$alias])) + if (is_null($alias) || !isset($this->listConfig[$alias])) $alias = $this->primaryAlias; $list = []; @@ -290,7 +290,7 @@ public function refreshList($alias = null) $this->makeLists(); } - if (!$alias OR !isset($this->listConfig[$alias])) { + if (!$alias || !isset($this->listConfig[$alias])) { $alias = $this->primaryAlias; } diff --git a/app/admin/actions/LocationAwareController.php b/app/admin/actions/LocationAwareController.php index ac0e9b7030..641c2e1413 100644 --- a/app/admin/actions/LocationAwareController.php +++ b/app/admin/actions/LocationAwareController.php @@ -74,7 +74,7 @@ protected function locationBindEvents() Event::listen('admin.filter.extendQuery', function ($filterWidget, $query, $scope) { if (array_get($scope->config, 'locationAware') === TRUE - AND (bool)$this->getConfig('applyScopeOnListQuery', TRUE) + && (bool)$this->getConfig('applyScopeOnListQuery', TRUE) ) $this->locationApplyScope($query); }); } diff --git a/app/admin/activitytypes/AssigneeUpdated.php b/app/admin/activitytypes/AssigneeUpdated.php index bef9ebb94d..c420e22a67 100644 --- a/app/admin/activitytypes/AssigneeUpdated.php +++ b/app/admin/activitytypes/AssigneeUpdated.php @@ -38,7 +38,7 @@ public static function log(Assignable_logs_model $assignableLog, User $user = nu $recipients = []; foreach ($assignableLog->assignable->listGroupAssignees() as $assignee) { - if ($user AND $assignee->getKey() === $user->staff->getKey()) continue; + if ($user && $assignee->getKey() === $user->staff->getKey()) continue; $recipients[] = $assignee->user; } diff --git a/app/admin/activitytypes/StatusUpdated.php b/app/admin/activitytypes/StatusUpdated.php index bd422b21fa..c77d87f084 100644 --- a/app/admin/activitytypes/StatusUpdated.php +++ b/app/admin/activitytypes/StatusUpdated.php @@ -37,11 +37,11 @@ public static function log(Status_history_model $history, User $user = null) $type = $history->isForOrder() ? self::ORDER_UPDATED_TYPE : self::RESERVATION_UPDATED_TYPE; $recipients = []; - if ($history->object->assignee AND $history->object->assignee->getKey() !== $user->staff->getKey()) + if ($history->object->assignee && $history->object->assignee->getKey() !== $user->staff->getKey()) $recipients[] = $history->object->assignee->user; $statusHistory = $history->object->getLatestStatusHistory(); - if ($history->object->customer AND $statusHistory AND $statusHistory->notify) + if ($history->object->customer && $statusHistory && $statusHistory->notify) $recipients[] = $history->object->customer; activity()->logActivity(new self($type, $history->object, $user), $recipients); diff --git a/app/admin/classes/AdminController.php b/app/admin/classes/AdminController.php index cc529eeed0..1cba0cc43d 100644 --- a/app/admin/classes/AdminController.php +++ b/app/admin/classes/AdminController.php @@ -170,7 +170,7 @@ public function initialize() $toolbar->bindToController(); // Media Manager widget is available on all admin pages - if ($this->currentUser AND $this->currentUser->hasPermission('Admin.MediaManager')) { + if ($this->currentUser && $this->currentUser->hasPermission('Admin.MediaManager')) { $manager = new MediaManager($this, ['alias' => 'mediamanager']); $manager->bindToController(); } @@ -188,7 +188,7 @@ public function remap($action, $params) } // Determine if this request is a public action or authentication is required - $requireAuthentication = !(in_array($action, $this->publicActions) OR !$this->requireAuthentication); + $requireAuthentication = !(in_array($action, $this->publicActions) || !$this->requireAuthentication); // Ensures that a user is logged in, if required if ($requireAuthentication) { @@ -199,7 +199,7 @@ public function remap($action, $params) } // Check that user has permission to view this page - if ($this->requiredPermissions AND !$this->getUser()->hasAnyPermission($this->requiredPermissions)) { + if ($this->requiredPermissions && !$this->getUser()->hasAnyPermission($this->requiredPermissions)) { return Response::make(Request::ajax() ? lang('admin::lang.alert_user_restricted') : View::make('admin::access_denied'), 403 @@ -215,7 +215,7 @@ public function remap($action, $params) } // Execute post handler and AJAX event - if ($handlerResponse = $this->processHandlers() AND $handlerResponse !== TRUE) { + if (($handlerResponse = $this->processHandlers()) && $handlerResponse !== TRUE) { return $handlerResponse; } @@ -280,10 +280,10 @@ protected function execPageAction($action, $params) array_unshift($params, $action); // Execute the action - $result = call_user_func_array([$this, $action], $params); + $result = call_user_func_array([$this, $action], array_values($params)); // Render the controller view if not already loaded - if (is_null($result) AND !$this->suppressView) { + if (is_null($result) && !$this->suppressView) { return $this->makeView($this->fatalError ? 'admin::error' : $action); } @@ -313,7 +313,7 @@ protected function makeMainMenuWidget() */ public function getHandler() { - if (Request::ajax() AND $handler = Request::header('X-IGNITER-REQUEST-HANDLER')) + if (Request::ajax() && $handler = Request::header('X-IGNITER-REQUEST-HANDLER')) return trim($handler); if ($handler = post('_handler')) @@ -465,8 +465,8 @@ protected function runHandler($handler, $params) throw new Exception(sprintf(lang('admin::lang.alert_widget_not_bound_to_controller'), $widgetName)); } - if (($widget = $this->widgets[$widgetName]) AND method_exists($widget, $handlerName)) { - $result = call_user_func_array([$widget, $handlerName], $params); + if (($widget = $this->widgets[$widgetName]) && method_exists($widget, $handlerName)) { + $result = call_user_func_array([$widget, $handlerName], array_values($params)); return $result ?: TRUE; } @@ -476,14 +476,14 @@ protected function runHandler($handler, $params) $pageHandler = $this->action.'_'.$handler; if ($this->methodExists($pageHandler)) { - $result = call_user_func_array([$this, $pageHandler], $params); + $result = call_user_func_array([$this, $pageHandler], array_values($params)); return $result ?: TRUE; } // Process page global handler (onSomething) if ($this->methodExists($handler)) { - $result = call_user_func_array([$this, $handler], $params); + $result = call_user_func_array([$this, $handler], array_values($params)); return $result ?: TRUE; } @@ -494,7 +494,7 @@ protected function runHandler($handler, $params) foreach ((array)$this->widgets as $widget) { if ($widget->methodExists($handler)) { - $result = call_user_func_array([$widget, $handler], $params); + $result = call_user_func_array([$widget, $handler], array_values($params)); return $result ?: TRUE; } diff --git a/app/admin/classes/BaseWidget.php b/app/admin/classes/BaseWidget.php index 165116a721..9e78c80f08 100644 --- a/app/admin/classes/BaseWidget.php +++ b/app/admin/classes/BaseWidget.php @@ -202,7 +202,7 @@ public function getConfig($name = null, $default = null) $result = isset($this->config[$fieldName]) ? $this->config[$fieldName] : $default; foreach ($nameArray as $key) { - if (!is_array($result) OR !array_key_exists($key, $result)) + if (!is_array($result) || !array_key_exists($key, $result)) return $default; $result = $result[$key]; diff --git a/app/admin/classes/FormField.php b/app/admin/classes/FormField.php index 8875b111b5..1cc05df7ee 100644 --- a/app/admin/classes/FormField.php +++ b/app/admin/classes/FormField.php @@ -457,14 +457,14 @@ protected function filterAttributes($attributes, $position = 'field') $attributes = $this->filterTriggerAttributes($attributes, $position); $attributes = $this->filterPresetAttributes($attributes, $position); - if ($position == 'field' AND $this->disabled) { + if ($position == 'field' && $this->disabled) { $attributes += ['disabled' => 'disabled']; } if ($position == 'field' && $this->readOnly) { $attributes += ['readonly' => 'readonly']; - if ($this->type == 'checkbox' OR $this->type == 'switch') { + if ($this->type == 'checkbox' || $this->type == 'switch') { $attributes += ['onclick' => 'return false;']; } } @@ -482,7 +482,7 @@ protected function filterAttributes($attributes, $position = 'field') */ protected function filterTriggerAttributes($attributes, $position = 'field') { - if (!$this->trigger OR !is_array($this->trigger)) { + if (!$this->trigger || !is_array($this->trigger)) { return $attributes; } @@ -491,12 +491,12 @@ protected function filterTriggerAttributes($attributes, $position = 'field') $triggerCondition = array_get($this->trigger, 'condition'); // Apply these to container - if (in_array($triggerAction, ['hide', 'show']) AND $position != 'container') { + if (in_array($triggerAction, ['hide', 'show']) && $position != 'container') { return $attributes; } // Apply these to field/input - if (in_array($triggerAction, ['enable', 'disable', 'empty']) AND $position != 'field') { + if (in_array($triggerAction, ['enable', 'disable', 'empty']) && $position != 'field') { return $attributes; } @@ -529,7 +529,7 @@ protected function filterTriggerAttributes($attributes, $position = 'field') */ protected function filterPresetAttributes($attributes, $position = 'field') { - if (!$this->preset OR $position != 'field') { + if (!$this->preset || $position != 'field') { return $attributes; } @@ -705,7 +705,7 @@ protected function getFieldNameFromData($fieldName, $data, $default = null) // To support relations only the last field should return th // relation value, all others will look up the relation object as normal. foreach ($keyParts as $key) { - if ($result instanceof Model AND $result->hasRelation($key)) { + if ($result instanceof Model && $result->hasRelation($key)) { if ($key == $lastField) { $result = $result->getRelationValue($key) ?: $default; } diff --git a/app/admin/classes/Location.php b/app/admin/classes/Location.php index f7c4ff8c9e..137ce29a32 100644 --- a/app/admin/classes/Location.php +++ b/app/admin/classes/Location.php @@ -28,14 +28,14 @@ public function current() } else { $id = $this->getSession('id'); - if (!$id AND $this->hasOneLocation() AND !$this->getAuth()->isSuperUser()) + if (!$id && $this->hasOneLocation() && !$this->getAuth()->isSuperUser()) $id = $this->getDefaultLocation(); - if ($id AND !$this->isAttachedToAuth($id)) + if ($id && !$this->isAttachedToAuth($id)) $id = $this->getDefaultLocation(); } - if ($id AND $model = $this->getById($id)) + if ($id && $model = $this->getById($id)) $this->setCurrent($model); return $this->model; diff --git a/app/admin/classes/Navigation.php b/app/admin/classes/Navigation.php index 0a5af1fd57..7acbd0f9e6 100644 --- a/app/admin/classes/Navigation.php +++ b/app/admin/classes/Navigation.php @@ -60,7 +60,7 @@ public function getVisibleNavItems() $navItems = $this->filterPermittedNavItems($navItems); foreach ($navItems as $code => &$navItem) { - if (!isset($navItem['child']) OR !count($navItem['child'])) { + if (!isset($navItem['child']) || !count($navItem['child'])) { continue; } @@ -216,7 +216,7 @@ public function registerNavItems($definitions = null, $parent = null) } foreach ($definitions as $name => $definition) { - if (isset($definition['child']) AND count($definition['child'])) { + if (isset($definition['child']) && count($definition['child'])) { $this->registerNavItems($definition['child'], $name); } diff --git a/app/admin/classes/PaymentGateways.php b/app/admin/classes/PaymentGateways.php index 19ea900f27..608a74280a 100644 --- a/app/admin/classes/PaymentGateways.php +++ b/app/admin/classes/PaymentGateways.php @@ -190,7 +190,7 @@ public static function createPartials() foreach ($paymentMethods as $paymentMethod) { $class = $paymentMethod->getGatewayClass(); - if (!$class OR get_parent_class($class) != BasePaymentGateway::class) + if (!$class || get_parent_class($class) != BasePaymentGateway::class) continue; $partialName = 'payregister/'.strtolower(class_basename($class)); diff --git a/app/admin/classes/PermissionManager.php b/app/admin/classes/PermissionManager.php index 37a5900024..6c386f3b6d 100644 --- a/app/admin/classes/PermissionManager.php +++ b/app/admin/classes/PermissionManager.php @@ -85,14 +85,14 @@ public function checkPermission($permissions, $checkPermissions, $checkAll) $matched = FALSE; foreach ($checkPermissions as $permission) { if ($this->checkPermissionStartsWith($permission, $permissions) - OR $this->checkPermissionEndsWith($permission, $permissions) - OR $this->checkPermissionMatches($permission, $permissions) + || $this->checkPermissionEndsWith($permission, $permissions) + || $this->checkPermissionMatches($permission, $permissions) ) $matched = TRUE; - if ($checkAll === FALSE AND $matched === TRUE) + if ($checkAll === FALSE && $matched === TRUE) return TRUE; - if ($checkAll === TRUE AND $matched === FALSE) + if ($checkAll === TRUE && $matched === FALSE) return FALSE; } @@ -101,14 +101,14 @@ public function checkPermission($permissions, $checkPermissions, $checkAll) protected function checkPermissionStartsWith($permission, $permissions) { - if (strlen($permission) > 1 AND ends_with($permission, '*')) { + if (strlen($permission) > 1 && ends_with($permission, '*')) { $checkPermission = substr($permission, 0, -1); foreach ($permissions as $groupPermission => $permitted) { // Let's make sure the available permission starts with our permission if ($checkPermission != $groupPermission - AND starts_with($groupPermission, $checkPermission) - AND $permitted == 1 + && starts_with($groupPermission, $checkPermission) + && $permitted == 1 ) return TRUE; } } @@ -116,14 +116,14 @@ protected function checkPermissionStartsWith($permission, $permissions) protected function checkPermissionEndsWith($permission, $permissions) { - if (strlen($permission) > 1 AND starts_with($permission, '*')) { + if (strlen($permission) > 1 && starts_with($permission, '*')) { $checkPermission = substr($permission, 1); foreach ($permissions as $groupPermission => $permitted) { // Let's make sure the available permission ends with our permission if ($checkPermission != $groupPermission - AND ends_with($groupPermission, $checkPermission) - AND $permitted == 1 + && ends_with($groupPermission, $checkPermission) + && $permitted == 1 ) return TRUE; } } @@ -132,17 +132,17 @@ protected function checkPermissionEndsWith($permission, $permissions) protected function checkPermissionMatches($permission, $permissions) { foreach ($permissions as $groupPermission => $permitted) { - if ((strlen($groupPermission) > 1) AND ends_with($groupPermission, '*')) { + if ((strlen($groupPermission) > 1) && ends_with($groupPermission, '*')) { $checkMergedPermission = substr($groupPermission, 0, -1); // Let's make sure the our permission starts with available permission if ($checkMergedPermission != $permission - AND starts_with($permission, $checkMergedPermission) - AND $permitted == 1 + && starts_with($permission, $checkMergedPermission) + && $permitted == 1 ) return TRUE; } // Match permissions explicitly. - elseif ($permission == $groupPermission AND $permitted == 1) { + elseif ($permission == $groupPermission && $permitted == 1) { return TRUE; } } @@ -159,7 +159,7 @@ public function registerPermissions($owner, array $definitions) } foreach ($definitions as $code => $definition) { - if (!isset($definition['label']) AND isset($definition['description'])) { + if (!isset($definition['label']) && isset($definition['description'])) { $definition['label'] = $definition['description']; unset($definition['description']); } diff --git a/app/admin/classes/ScheduleItem.php b/app/admin/classes/ScheduleItem.php index adb4e8e2d1..d6d2c0cf1b 100644 --- a/app/admin/classes/ScheduleItem.php +++ b/app/admin/classes/ScheduleItem.php @@ -110,7 +110,7 @@ protected function flexible(array $data) $result = []; foreach (Working_hours_model::$weekDays as $key => $weekDay) { $hour = array_get($data, $key, []); - if (isset($hour['open']) AND isset($hour['close'])) { + if (isset($hour['open']) && isset($hour['close'])) { $hour['hours'] = sprintf('%s-%s', $hour['open'], $hour['close']); unset($hour['open'], $hour['close']); } diff --git a/app/admin/classes/ToolbarButton.php b/app/admin/classes/ToolbarButton.php index 14cf3fc32f..5882bd1c73 100644 --- a/app/admin/classes/ToolbarButton.php +++ b/app/admin/classes/ToolbarButton.php @@ -85,7 +85,7 @@ public function getAttributes($htmlBuild = TRUE) foreach ($config as $key => $value) { if (!is_string($value)) continue; - $value = ($key == 'href' AND !preg_match('#^(\w+:)?//#i', $value)) + $value = ($key == 'href' && !preg_match('#^(\w+:)?//#i', $value)) ? admin_url($value) : $value; diff --git a/app/admin/classes/User.php b/app/admin/classes/User.php index 18bcbf33b2..69e6929e35 100644 --- a/app/admin/classes/User.php +++ b/app/admin/classes/User.php @@ -96,7 +96,7 @@ public function register(array $attributes, $activate = FALSE) $staff->user = [ 'username' => $attributes['username'], 'password' => $attributes['password'], - 'super_user' => FALSE, + 'super_user' => $attributes['super_user'] ?? FALSE, 'activate' => $activate, ]; diff --git a/app/admin/classes/UserPanel.php b/app/admin/classes/UserPanel.php index 6646705434..01a22af511 100644 --- a/app/admin/classes/UserPanel.php +++ b/app/admin/classes/UserPanel.php @@ -103,6 +103,11 @@ public function listGroupNames() return $this->user->staff->groups->pluck('staff_group_name')->all(); } + public function getRoleName() + { + return optional($this->user->staff->role)->name; + } + public function listLocations() { return AdminLocation::listLocations()->map(function ($value, $key) { diff --git a/app/admin/controllers/Categories.php b/app/admin/controllers/Categories.php index 08aed0d19f..372edc46c2 100644 --- a/app/admin/controllers/Categories.php +++ b/app/admin/controllers/Categories.php @@ -61,7 +61,7 @@ public function __construct() public function formBeforeSave($model) { - if (!$model->getRgt() OR !$model->getLft()) + if (!$model->getRgt() || !$model->getLft()) $model->fixTree(); if (Categories_model::isBroken()) diff --git a/app/admin/controllers/Customers.php b/app/admin/controllers/Customers.php index 37e478b9a7..edf5cd3323 100644 --- a/app/admin/controllers/Customers.php +++ b/app/admin/controllers/Customers.php @@ -86,7 +86,7 @@ public function edit_onActivate($context, $recordId = null) public function formExtendModel($model) { - if ($model->exists AND !$model->is_activated) { + if ($model->exists && !$model->is_activated) { Template::setButton(lang('admin::lang.customers.button_activate'), [ 'class' => 'btn btn-success pull-right', 'data-request' => 'onActivate', @@ -96,10 +96,10 @@ public function formExtendModel($model) public function formAfterSave($model) { - if (!$model->group OR $model->group->requiresApproval()) + if (!$model->group || $model->group->requiresApproval()) return; - if ($this->status AND !$this->is_activated) + if ($this->status && !$this->is_activated) $model->completeActivation($model->getActivationCode()); } } diff --git a/app/admin/controllers/Locations.php b/app/admin/controllers/Locations.php index 8d8a11c891..ec0b0d4727 100644 --- a/app/admin/controllers/Locations.php +++ b/app/admin/controllers/Locations.php @@ -62,7 +62,7 @@ public function __construct() public function remap($action, $params) { - if ($action != 'settings' AND AdminLocation::check()) + if ($action != 'settings' && AdminLocation::check()) return $this->redirect('locations/settings'); return parent::remap($action, $params); diff --git a/app/admin/controllers/Login.php b/app/admin/controllers/Login.php index f91b3f47f4..627e0f55f0 100644 --- a/app/admin/controllers/Login.php +++ b/app/admin/controllers/Login.php @@ -42,7 +42,7 @@ public function reset() } $code = input('code'); - if (strlen($code) AND !Users_model::whereResetCode(input('code'))->first()) { + if (strlen($code) && !Users_model::whereResetCode(input('code'))->first()) { flash()->error(lang('admin::lang.login.alert_failed_reset')); return $this->redirect('login'); @@ -89,7 +89,7 @@ public function onRequestResetPassword() ]); $staff = Staffs_model::whereStaffEmail(post('email'))->first(); - if ($staff AND $user = $staff->user) { + if ($staff && $user = $staff->user) { if (!$user->resetPassword()) throw new ValidationException(['email' => lang('admin::lang.login.alert_failed_reset')]); $data = [ @@ -119,7 +119,7 @@ public function onResetPassword() $code = array_get($data, 'code'); $user = Users_model::whereResetCode($code)->first(); - if (!$user OR !$user->completeResetPassword($code, post('password'))) + if (!$user || !$user->completeResetPassword($code, post('password'))) throw new ValidationException(['password' => lang('admin::lang.login.alert_failed_reset')]); $data = [ diff --git a/app/admin/controllers/Orders.php b/app/admin/controllers/Orders.php index 2513ebd415..9b02b19ca9 100644 --- a/app/admin/controllers/Orders.php +++ b/app/admin/controllers/Orders.php @@ -78,7 +78,7 @@ public function index_onUpdateStatus() { $model = Orders_model::find((int)post('recordId')); $status = Statuses_model::find((int)post('statusId')); - if (!$model OR !$status) + if (!$model || !$status) return; if ($record = $model->addStatusHistory($status)) diff --git a/app/admin/controllers/Payments.php b/app/admin/controllers/Payments.php index 9ca4b37771..4109ff5ce1 100644 --- a/app/admin/controllers/Payments.php +++ b/app/admin/controllers/Payments.php @@ -152,7 +152,7 @@ public function formValidate($model, $form) ['status', 'lang:admin::lang.label_status', 'required|integer'], ]; - if ($form->model->exists AND ($mergeRules = $form->model->getConfigRules())) + if ($form->model->exists && ($mergeRules = $form->model->getConfigRules())) array_push($rules, ...$mergeRules); return $this->validatePasses($form->getSaveData(), $rules); diff --git a/app/admin/controllers/Reservations.php b/app/admin/controllers/Reservations.php index 6c71a438a3..b96572a21e 100644 --- a/app/admin/controllers/Reservations.php +++ b/app/admin/controllers/Reservations.php @@ -96,7 +96,7 @@ public function index_onUpdateStatus() { $model = Reservations_model::find((int)post('recordId')); $status = Statuses_model::find((int)post('statusId')); - if (!$model OR !$status) + if (!$model || !$status) return; if ($record = $model->addStatusHistory($status)) diff --git a/app/admin/controllers/Staffs.php b/app/admin/controllers/Staffs.php index 9272cd54fb..e1d1e13966 100644 --- a/app/admin/controllers/Staffs.php +++ b/app/admin/controllers/Staffs.php @@ -75,7 +75,7 @@ public function account_onSave() $usernameChanged = $this->currentUser->username != post('Staff[user][username]'); $passwordChanged = strlen(post('Staff[user][password]')); $languageChanged = $this->currentUser->language != post('Staff[language_id]'); - if ($usernameChanged OR $passwordChanged OR $languageChanged) { + if ($usernameChanged || $passwordChanged || $languageChanged) { $this->currentUser->reload()->reloadRelations(); AdminAuth::login($this->currentUser, TRUE); } diff --git a/app/admin/dashboardwidgets/onboarding/onboarding.blade.php b/app/admin/dashboardwidgets/onboarding/onboarding.blade.php index c71afe71e7..e13c771e76 100644 --- a/app/admin/dashboardwidgets/onboarding/onboarding.blade.php +++ b/app/admin/dashboardwidgets/onboarding/onboarding.blade.php @@ -3,7 +3,7 @@
@if ($field->commentHtml) {!! lang($field->comment) !!} @else @lang($field->comment) @endif
@@ -14,7 +14,7 @@ {!! $this->renderFieldElement($field) !!} - @if ($field->comment AND $field->commentPosition == 'below') + @if ($field->comment && $field->commentPosition == 'below')@if ($field->commentHtml) {!! lang($field->comment) !!} @else @lang($field->comment) @endif
diff --git a/app/admin/widgets/form/field_checkboxlist.blade.php b/app/admin/widgets/form/field_checkboxlist.blade.php index 940d9d99ce..e3a4d91200 100644 --- a/app/admin/widgets/form/field_checkboxlist.blade.php +++ b/app/admin/widgets/form/field_checkboxlist.blade.php @@ -33,7 +33,7 @@ class="custom-control-input" @endforeach -@elseif (!$this->previewMode AND count($fieldOptions)) +@elseif (!$this->previewMode && count($fieldOptions))