@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | $this->addBehavior('Timestamp'); |
40 | 40 | |
41 | - $this->hasMany('Tickets', [ |
|
41 | + $this->hasMany('Tickets', [ |
|
42 | 42 | 'foreignKey' => 'tickettype_id' |
43 | 43 | ]); |
44 | 44 |
@@ -43,10 +43,10 @@ |
||
43 | 43 | $this->hasMany('Operations', [ |
44 | 44 | 'foreignKey' => 'ticket_id' |
45 | 45 | ]); |
46 | - $this->belongsTo('Tickettypes', [ |
|
46 | + $this->belongsTo('Tickettypes', [ |
|
47 | 47 | 'foreignKey' => 'tickettype_id' |
48 | 48 | ]); |
49 | - $this->belongsTo('Ticketstatuses', [ |
|
49 | + $this->belongsTo('Ticketstatuses', [ |
|
50 | 50 | 'foreignKey' => 'ticketstatus_id' |
51 | 51 | ]); |
52 | 52 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | 'password' |
40 | 40 | ]; |
41 | 41 | |
42 | - protected function _setPassword($password) |
|
42 | + protected function _setPassword($password) |
|
43 | 43 | { |
44 | 44 | return (new DefaultPasswordHasher)->hash($password); |
45 | 45 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | // Admin account |
28 | 28 | |
29 | 29 | |
30 | - if(!Configure::read('Security.salt')) |
|
30 | + if (!Configure::read('Security.salt')) |
|
31 | 31 | { |
32 | 32 | $salt = $this->in('Salt:'); |
33 | 33 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | Configure::write('Datasources.default.quoteIdentifiers', false); |
49 | 49 | Configure::write('Datasources.default.url', env('DATABASE_URL', null)); |
50 | 50 | $file = new File('config/app_local.php', false); |
51 | - if(!$file->exists()) { |
|
52 | - if($ris = Configure::dump('app_local', 'default')) { |
|
51 | + if (!$file->exists()) { |
|
52 | + if ($ris = Configure::dump('app_local', 'default')) { |
|
53 | 53 | $this->out("Wrote config file app_local.php"); |
54 | 54 | } |
55 | 55 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | 'limit' => 11, |
19 | 19 | 'null' => false, |
20 | 20 | ]); |
21 | - $table->addColumn('name', 'string', [ |
|
21 | + $table->addColumn('name', 'string', [ |
|
22 | 22 | 'default' => null, |
23 | 23 | 'limit' => 255, |
24 | 24 | 'null' => false, |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | $tickettypes = $this->paginate($this->Tickettypes); |
22 | 22 | |
23 | - $title = "Type of ticket"; |
|
23 | + $title = "Type of ticket"; |
|
24 | 24 | |
25 | 25 | $this->set(compact(['tickettypes', 'title'])); |
26 | 26 | $this->set('_serialize', ['tickettypes']); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
22 | + /** |
|
23 | 23 | * Index method |
24 | 24 | * |
25 | 25 | * @return \Cake\Network\Response|null |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | return $this->redirect(['prefix'=>'admin', 'controller'=>'Users', 'action' => 'index']); |
116 | 116 | } |
117 | 117 | |
118 | - public function login() { |
|
119 | - if ($this->request->is('post')) { |
|
118 | + public function login() { |
|
119 | + if ($this->request->is('post')) { |
|
120 | 120 | $user = $this->Auth->identify(); |
121 | - $this->set('lu', $user); |
|
121 | + $this->set('lu', $user); |
|
122 | 122 | if ($user) { |
123 | 123 | $this->Auth->setUser($user); |
124 | 124 | return $this->redirect($this->Auth->redirectUrl()); |
125 | 125 | } |
126 | 126 | $this->Flash->error(__('Invalid username or password, try again')); |
127 | 127 | } |
128 | - } |
|
129 | - public function logout() |
|
130 | - { |
|
131 | - return $this->redirect($this->Auth->logout()); |
|
132 | - } |
|
128 | + } |
|
129 | + public function logout() |
|
130 | + { |
|
131 | + return $this->redirect($this->Auth->logout()); |
|
132 | + } |
|
133 | 133 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function index() |
22 | 22 | { |
23 | 23 | |
24 | - $tickets = $this->paginate($this->Tickets->find('all', ['contain'=>['Tickettypes', 'Ticketstatuses']])); |
|
24 | + $tickets = $this->paginate($this->Tickets->find('all', ['contain'=>['Tickettypes', 'Ticketstatuses']])); |
|
25 | 25 | |
26 | 26 | $this->set(compact('tickets')); |
27 | 27 | $this->set('_serialize', ['tickets']); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | } |
62 | 62 | $this->Flash->error(__('The ticket could not be saved. Please, try again.')); |
63 | 63 | } |
64 | - $types = $this->Tickets->Tickettypes->find('list'); |
|
65 | - $statuses = $this->Tickets->Ticketstatuses->find('list'); |
|
64 | + $types = $this->Tickets->Tickettypes->find('list'); |
|
65 | + $statuses = $this->Tickets->Ticketstatuses->find('list'); |
|
66 | 66 | $this->set(compact('ticket', 'types', 'statuses')); |
67 | 67 | $this->set('_serialize', ['ticket']); |
68 | 68 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | } |
89 | 89 | $this->Flash->error(__('The ticket could not be saved. Please, try again.')); |
90 | 90 | } |
91 | - $tickettypes = $this->Tickets->Tickettypes->find('list'); |
|
92 | - $ticketstatuses = $this->Tickets->Ticketstatuses->find('list'); |
|
91 | + $tickettypes = $this->Tickets->Tickettypes->find('list'); |
|
92 | + $ticketstatuses = $this->Tickets->Ticketstatuses->find('list'); |
|
93 | 93 | $this->set(compact('ticket', 'tickettypes', 'ticketstatuses')); |
94 | 94 | $this->set('_serialize', ['ticket']); |
95 | 95 | } |
@@ -114,29 +114,29 @@ discard block |
||
114 | 114 | return $this->redirect(['prefix'=>false, 'controller'=>'Tickets', 'action' => 'index']); |
115 | 115 | } |
116 | 116 | |
117 | - public function addOperation($id = null) { |
|
118 | - $ticket = $this->Tickets->get($id, [ |
|
117 | + public function addOperation($id = null) { |
|
118 | + $ticket = $this->Tickets->get($id, [ |
|
119 | 119 | 'contain' => [] |
120 | 120 | ]); |
121 | 121 | |
122 | - $this->loadModel('Operations'); |
|
123 | - $newOperation = $this->Operations->newEntity(); |
|
124 | - if ($this->request->is('post')) { |
|
125 | - $datetimeStart = Time::parseDateTime($this->request->data['start']); |
|
126 | - $datetimeEnd = Time::parseDateTime($this->request->data['end']); |
|
127 | - $newOperation->ticket_id = $this->request->data['ticket_id']; |
|
128 | - $newOperation->description = $this->request->data['description']; |
|
129 | - $newOperation->start = $datetimeStart; |
|
130 | - $newOperation->end = $datetimeEnd; |
|
122 | + $this->loadModel('Operations'); |
|
123 | + $newOperation = $this->Operations->newEntity(); |
|
124 | + if ($this->request->is('post')) { |
|
125 | + $datetimeStart = Time::parseDateTime($this->request->data['start']); |
|
126 | + $datetimeEnd = Time::parseDateTime($this->request->data['end']); |
|
127 | + $newOperation->ticket_id = $this->request->data['ticket_id']; |
|
128 | + $newOperation->description = $this->request->data['description']; |
|
129 | + $newOperation->start = $datetimeStart; |
|
130 | + $newOperation->end = $datetimeEnd; |
|
131 | 131 | if ($this->Operations->save($newOperation)) { |
132 | 132 | $this->Flash->success(__('The new operation has been saved.')); |
133 | 133 | return $this->redirect(['prefix'=>false, 'controller'=>'Tickets', 'action' => 'view', $this->request->data['ticket_id']]); |
134 | 134 | } |
135 | 135 | $this->Flash->error(__('The new operation could not be saved. Please, try again.')); |
136 | 136 | } |
137 | - $newOperation->ticket_id = $id; |
|
138 | - $this->set('newOperation', $newOperation); |
|
139 | - } |
|
137 | + $newOperation->ticket_id = $id; |
|
138 | + $this->set('newOperation', $newOperation); |
|
139 | + } |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * @param null $operation_id |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | 'contain' => ['Tickets'] |
150 | 150 | ]); |
151 | 151 | if ($this->request->is(['patch', 'post', 'put'])) { |
152 | - $this->request->data['start'] = Time::parseDateTime($this->request->data['start']); |
|
153 | - $this->request->data['end'] = Time::parseDateTime($this->request->data['end']); |
|
152 | + $this->request->data['start'] = Time::parseDateTime($this->request->data['start']); |
|
153 | + $this->request->data['end'] = Time::parseDateTime($this->request->data['end']); |
|
154 | 154 | $operation = $this->Operations->patchEntity($operation, $this->request->data); |
155 | 155 | |
156 | 156 | if ($this->Operations->save($operation)) { |
@@ -164,25 +164,25 @@ discard block |
||
164 | 164 | $this->set('_serialize', ['operation']); |
165 | 165 | } |
166 | 166 | |
167 | - public function viewOperation($id = null) { |
|
167 | + public function viewOperation($id = null) { |
|
168 | 168 | |
169 | - $this->loadModel('Operations'); |
|
170 | - $operation = $this->Operations->get($id, [ |
|
171 | - 'contain' => ['Tickets'] |
|
172 | - ]); |
|
173 | - |
|
174 | - $this->set('operation', $operation); |
|
175 | - $this->set('_serialize', ['operation']); |
|
176 | - } |
|
169 | + $this->loadModel('Operations'); |
|
170 | + $operation = $this->Operations->get($id, [ |
|
171 | + 'contain' => ['Tickets'] |
|
172 | + ]); |
|
173 | + |
|
174 | + $this->set('operation', $operation); |
|
175 | + $this->set('_serialize', ['operation']); |
|
176 | + } |
|
177 | 177 | |
178 | - public function deleteOperation($id = null) { |
|
178 | + public function deleteOperation($id = null) { |
|
179 | 179 | |
180 | - $this->loadModel('Operations'); |
|
181 | - $this->request->allowMethod(['post', 'delete']); |
|
180 | + $this->loadModel('Operations'); |
|
181 | + $this->request->allowMethod(['post', 'delete']); |
|
182 | 182 | $operation = $this->Operations->get($id, [ |
183 | - 'contain' => ['Tickets'] |
|
184 | - ] |
|
185 | - ); |
|
183 | + 'contain' => ['Tickets'] |
|
184 | + ] |
|
185 | + ); |
|
186 | 186 | if ($this->Operations->delete($operation)) { |
187 | 187 | $this->Flash->success(__('The operation has been deleted.')); |
188 | 188 | } else { |
@@ -190,5 +190,5 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | return $this->redirect(['prefix'=>false, 'controller'=>'Tickets', 'action' => 'view', $operation->ticket_id]); |
193 | - } |
|
193 | + } |
|
194 | 194 | } |
@@ -86,29 +86,41 @@ discard block |
||
86 | 86 | <ul> |
87 | 87 | <?php if (version_compare(PHP_VERSION, '7.2.0', '>=')) : ?> |
88 | 88 | <li class="bullet success">Your version of PHP is 7.2.0 or higher (detected <?php echo PHP_VERSION ?>).</li> |
89 | - <?php else : ?> |
|
89 | + <?php else { |
|
90 | + : ?> |
|
90 | 91 | <li class="bullet problem">Your version of PHP is too low. You need PHP 7.2.0 or higher to use CakePHP (detected <?php echo PHP_VERSION ?>).</li> |
91 | - <?php endif; ?> |
|
92 | + <?php endif; |
|
93 | +} |
|
94 | +?> |
|
92 | 95 | |
93 | 96 | <?php if (extension_loaded('mbstring')) : ?> |
94 | 97 | <li class="bullet success">Your version of PHP has the mbstring extension loaded.</li> |
95 | - <?php else : ?> |
|
98 | + <?php else { |
|
99 | + : ?> |
|
96 | 100 | <li class="bullet problem">Your version of PHP does NOT have the mbstring extension loaded.</li> |
97 | - <?php endif; ?> |
|
101 | + <?php endif; |
|
102 | +} |
|
103 | +?> |
|
98 | 104 | |
99 | 105 | <?php if (extension_loaded('openssl')) : ?> |
100 | 106 | <li class="bullet success">Your version of PHP has the openssl extension loaded.</li> |
101 | 107 | <?php elseif (extension_loaded('mcrypt')) : ?> |
102 | 108 | <li class="bullet success">Your version of PHP has the mcrypt extension loaded.</li> |
103 | - <?php else : ?> |
|
109 | + <?php else { |
|
110 | + : ?> |
|
104 | 111 | <li class="bullet problem">Your version of PHP does NOT have the openssl or mcrypt extension loaded.</li> |
105 | - <?php endif; ?> |
|
112 | + <?php endif; |
|
113 | +} |
|
114 | +?> |
|
106 | 115 | |
107 | 116 | <?php if (extension_loaded('intl')) : ?> |
108 | 117 | <li class="bullet success">Your version of PHP has the intl extension loaded.</li> |
109 | - <?php else : ?> |
|
118 | + <?php else { |
|
119 | + : ?> |
|
110 | 120 | <li class="bullet problem">Your version of PHP does NOT have the intl extension loaded.</li> |
111 | - <?php endif; ?> |
|
121 | + <?php endif; |
|
122 | +} |
|
123 | +?> |
|
112 | 124 | </ul> |
113 | 125 | </div> |
114 | 126 | <div class="column"> |
@@ -116,22 +128,31 @@ discard block |
||
116 | 128 | <ul> |
117 | 129 | <?php if (is_writable(TMP)) : ?> |
118 | 130 | <li class="bullet success">Your tmp directory is writable.</li> |
119 | - <?php else : ?> |
|
131 | + <?php else { |
|
132 | + : ?> |
|
120 | 133 | <li class="bullet problem">Your tmp directory is NOT writable.</li> |
121 | - <?php endif; ?> |
|
134 | + <?php endif; |
|
135 | +} |
|
136 | +?> |
|
122 | 137 | |
123 | 138 | <?php if (is_writable(LOGS)) : ?> |
124 | 139 | <li class="bullet success">Your logs directory is writable.</li> |
125 | - <?php else : ?> |
|
140 | + <?php else { |
|
141 | + : ?> |
|
126 | 142 | <li class="bullet problem">Your logs directory is NOT writable.</li> |
127 | - <?php endif; ?> |
|
143 | + <?php endif; |
|
144 | +} |
|
145 | +?> |
|
128 | 146 | |
129 | 147 | <?php $settings = Cache::getConfig('_cake_core_'); ?> |
130 | 148 | <?php if (!empty($settings)) : ?> |
131 | 149 | <li class="bullet success">The <em><?php echo $settings['className'] ?>Engine</em> is being used for core caching. To change the config edit config/app.php</li> |
132 | - <?php else : ?> |
|
150 | + <?php else { |
|
151 | + : ?> |
|
133 | 152 | <li class="bullet problem">Your cache is NOT working. Please check the settings in config/app.php</li> |
134 | - <?php endif; ?> |
|
153 | + <?php endif; |
|
154 | +} |
|
155 | +?> |
|
135 | 156 | </ul> |
136 | 157 | </div> |
137 | 158 | </div> |
@@ -157,9 +178,12 @@ discard block |
||
157 | 178 | <ul> |
158 | 179 | <?php if ($connected) : ?> |
159 | 180 | <li class="bullet success">CakePHP is able to connect to the database.</li> |
160 | - <?php else : ?> |
|
181 | + <?php else { |
|
182 | + : ?> |
|
161 | 183 | <li class="bullet problem">CakePHP is NOT able to connect to the database.<br /><?php echo $errorMsg ?></li> |
162 | - <?php endif; ?> |
|
184 | + <?php endif; |
|
185 | +} |
|
186 | +?> |
|
163 | 187 | </ul> |
164 | 188 | </div> |
165 | 189 | <div class="column"> |
@@ -167,9 +191,12 @@ discard block |
||
167 | 191 | <ul> |
168 | 192 | <?php if (Plugin::isLoaded('DebugKit')) : ?> |
169 | 193 | <li class="bullet success">DebugKit is loaded.</li> |
170 | - <?php else : ?> |
|
194 | + <?php else { |
|
195 | + : ?> |
|
171 | 196 | <li class="bullet problem">DebugKit is NOT loaded. You need to either install pdo_sqlite, or define the "debug_kit" connection name.</li> |
172 | - <?php endif; ?> |
|
197 | + <?php endif; |
|
198 | +} |
|
199 | +?> |
|
173 | 200 | </ul> |
174 | 201 | </div> |
175 | 202 | </div> |