@@ -90,7 +90,7 @@ |
||
| 90 | 90 | */ |
| 91 | 91 | $file = new File('config/app_local.php', false); |
| 92 | 92 | if($file->exists()) { |
| 93 | - Configure::load('app_local', 'default'); |
|
| 93 | + Configure::load('app_local', 'default'); |
|
| 94 | 94 | } |
| 95 | 95 | $file->close(); |
| 96 | 96 | /* |
@@ -13,46 +13,46 @@ |
||
| 13 | 13 | public function main() |
| 14 | 14 | { |
| 15 | 15 | $this->out('FortuneCookies installation'); |
| 16 | - $this->hr(); |
|
| 16 | + $this->hr(); |
|
| 17 | 17 | $this->out('This procedure will output a file called app_local.php'); |
| 18 | 18 | $this->out('to store Security Salt and Database connection information'); |
| 19 | 19 | |
| 20 | - // Salt |
|
| 21 | - $this->hr(); |
|
| 22 | - $this->out('Configure Security Salt'); |
|
| 23 | - $this->out('A Security Salt is a random string used to encrypt sensitive data inside this app.'); |
|
| 24 | - $salt = $this->in('Type a string:'); |
|
| 25 | - Configure::write('Security.salt', $salt); |
|
| 26 | - // Database\Connection |
|
| 27 | - // Admin account |
|
| 28 | ||
| 20 | + // Salt |
|
| 21 | + $this->hr(); |
|
| 22 | + $this->out('Configure Security Salt'); |
|
| 23 | + $this->out('A Security Salt is a random string used to encrypt sensitive data inside this app.'); |
|
| 24 | + $salt = $this->in('Type a string:'); |
|
| 25 | + Configure::write('Security.salt', $salt); |
|
| 26 | + // Database\Connection |
|
| 27 | + // Admin account |
|
| 28 | ||
| 29 | 29 | |
| 30 | - if(!Configure::read('Security.salt')) |
|
| 31 | - { |
|
| 32 | - $salt = $this->in('Salt:'); |
|
| 33 | - } |
|
| 30 | + if(!Configure::read('Security.salt')) |
|
| 31 | + { |
|
| 32 | + $salt = $this->in('Salt:'); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - Configure::write('debug', false); |
|
| 36 | - Configure::write('Datasources.default.className', 'Cake\Database\Connection'); |
|
| 37 | - Configure::write('Datasources.default.driver', 'Cake\Database\Driver\Mysql'); |
|
| 38 | - Configure::write('Datasources.default.persistent', false); |
|
| 39 | - Configure::write('Datasources.default.host', 'localhost'); |
|
| 40 | - Configure::write('Datasources.default.username', 'root'); |
|
| 41 | - Configure::write('Datasources.default.password', 'semaphoredb'); |
|
| 42 | - Configure::write('Datasources.default.database', 'fc_test'); |
|
| 43 | - Configure::write('Datasources.default.encoding', 'utf8'); |
|
| 44 | - Configure::write('Datasources.default.timezone', 'UTC'); |
|
| 45 | - Configure::write('Datasources.default.flags', []); |
|
| 46 | - Configure::write('Datasources.default.cacheMetadata', true); |
|
| 47 | - Configure::write('Datasources.default.log', false); |
|
| 48 | - Configure::write('Datasources.default.quoteIdentifiers', false); |
|
| 49 | - Configure::write('Datasources.default.url', env('DATABASE_URL', null)); |
|
| 50 | - $file = new File('config/app_local.php', false); |
|
| 51 | - if(!$file->exists()) { |
|
| 52 | - if($ris = Configure::dump('app_local', 'default')) { |
|
| 53 | - $this->out("Wrote config file app_local.php"); |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - $file->close(); |
|
| 35 | + Configure::write('debug', false); |
|
| 36 | + Configure::write('Datasources.default.className', 'Cake\Database\Connection'); |
|
| 37 | + Configure::write('Datasources.default.driver', 'Cake\Database\Driver\Mysql'); |
|
| 38 | + Configure::write('Datasources.default.persistent', false); |
|
| 39 | + Configure::write('Datasources.default.host', 'localhost'); |
|
| 40 | + Configure::write('Datasources.default.username', 'root'); |
|
| 41 | + Configure::write('Datasources.default.password', 'semaphoredb'); |
|
| 42 | + Configure::write('Datasources.default.database', 'fc_test'); |
|
| 43 | + Configure::write('Datasources.default.encoding', 'utf8'); |
|
| 44 | + Configure::write('Datasources.default.timezone', 'UTC'); |
|
| 45 | + Configure::write('Datasources.default.flags', []); |
|
| 46 | + Configure::write('Datasources.default.cacheMetadata', true); |
|
| 47 | + Configure::write('Datasources.default.log', false); |
|
| 48 | + Configure::write('Datasources.default.quoteIdentifiers', false); |
|
| 49 | + Configure::write('Datasources.default.url', env('DATABASE_URL', null)); |
|
| 50 | + $file = new File('config/app_local.php', false); |
|
| 51 | + if(!$file->exists()) { |
|
| 52 | + if($ris = Configure::dump('app_local', 'default')) { |
|
| 53 | + $this->out("Wrote config file app_local.php"); |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + $file->close(); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | \ No newline at end of file |
@@ -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 | } |
@@ -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(['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 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public function index() |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - $tickets = $this->paginate($this->Tickets->find('all', ['contain'=>['Tickettypes', 'Ticketstatuses']])); |
|
| 22 | + $tickets = $this->paginate($this->Tickets->find('all', ['contain'=>['Tickettypes', 'Ticketstatuses']])); |
|
| 23 | 23 | |
| 24 | 24 | $this->set(compact('tickets')); |
| 25 | 25 | $this->set('_serialize', ['tickets']); |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | $this->Flash->error(__('The ticket could not be saved. Please, try again.')); |
| 61 | 61 | } |
| 62 | - $types = $this->Tickets->Tickettypes->find('list'); |
|
| 63 | - $statuses = $this->Tickets->Ticketstatuses->find('list'); |
|
| 62 | + $types = $this->Tickets->Tickettypes->find('list'); |
|
| 63 | + $statuses = $this->Tickets->Ticketstatuses->find('list'); |
|
| 64 | 64 | $this->set(compact('ticket', 'types', 'statuses')); |
| 65 | 65 | $this->set('_serialize', ['ticket']); |
| 66 | 66 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | $this->Flash->error(__('The ticket could not be saved. Please, try again.')); |
| 88 | 88 | } |
| 89 | - $tickettypes = $this->Tickets->Tickettypes->find('list'); |
|
| 90 | - $ticketstatuses = $this->Tickets->Ticketstatuses->find('list'); |
|
| 89 | + $tickettypes = $this->Tickets->Tickettypes->find('list'); |
|
| 90 | + $ticketstatuses = $this->Tickets->Ticketstatuses->find('list'); |
|
| 91 | 91 | $this->set(compact('ticket', 'tickettypes', 'ticketstatuses')); |
| 92 | 92 | $this->set('_serialize', ['ticket']); |
| 93 | 93 | } |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | return $this->redirect(['action' => 'index']); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function addOperation($id = null) { |
|
| 116 | - $ticket = $this->Tickets->get($id, [ |
|
| 115 | + public function addOperation($id = null) { |
|
| 116 | + $ticket = $this->Tickets->get($id, [ |
|
| 117 | 117 | 'contain' => [] |
| 118 | 118 | ]); |
| 119 | 119 | |
| 120 | - $this->loadModel('Operations'); |
|
| 121 | - $newOperation = $this->Operations->newEntity(); |
|
| 122 | - if ($this->request->is('post')) { |
|
| 120 | + $this->loadModel('Operations'); |
|
| 121 | + $newOperation = $this->Operations->newEntity(); |
|
| 122 | + if ($this->request->is('post')) { |
|
| 123 | 123 | $newOperation = $this->Operations->patchEntity($newOperation, $this->request->data); |
| 124 | 124 | if ($this->Operations->save($newOperation)) { |
| 125 | 125 | $this->Flash->success(__('The new operation has been saved.')); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | $this->Flash->error(__('The new operation could not be saved. Please, try again.')); |
| 130 | 130 | } |
| 131 | - $newOperation->ticket_id = $id; |
|
| 132 | - $this->set('newOperation', $newOperation); |
|
| 133 | - } |
|
| 131 | + $newOperation->ticket_id = $id; |
|
| 132 | + $this->set('newOperation', $newOperation); |
|
| 133 | + } |
|
| 134 | 134 | } |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | $this->loadComponent('Flash'); |
| 46 | 46 | $this->loadComponent('Security'); |
| 47 | 47 | $this->loadComponent('Csrf'); |
| 48 | - $this->loadComponent('Auth', [ |
|
| 49 | - 'authorize' => ['Controller'], |
|
| 48 | + $this->loadComponent('Auth', [ |
|
| 49 | + 'authorize' => ['Controller'], |
|
| 50 | 50 | 'authenticate' => [ |
| 51 | 51 | 'Form' => [ |
| 52 | 52 | 'fields' => [ |
@@ -59,25 +59,25 @@ discard block |
||
| 59 | 59 | 'controller' => 'Users', |
| 60 | 60 | 'action' => 'login' |
| 61 | 61 | ], |
| 62 | - 'logoutAction' => [ |
|
| 62 | + 'logoutAction' => [ |
|
| 63 | 63 | 'controller' => 'Users', |
| 64 | 64 | 'action' => 'login' |
| 65 | 65 | ], |
| 66 | - 'unauthorizedRedirect' => $this->referer() |
|
| 67 | - ]); |
|
| 68 | - $this->Auth->deny(); |
|
| 66 | + 'unauthorizedRedirect' => $this->referer() |
|
| 67 | + ]); |
|
| 68 | + $this->Auth->deny(); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function isAuthorized($user) |
|
| 72 | - { |
|
| 73 | - // Admin can access every action |
|
| 74 | - if (isset($user['role']) && $user['role'] === 'admin') { |
|
| 75 | - return true; |
|
| 76 | - } |
|
| 71 | + public function isAuthorized($user) |
|
| 72 | + { |
|
| 73 | + // Admin can access every action |
|
| 74 | + if (isset($user['role']) && $user['role'] === 'admin') { |
|
| 75 | + return true; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - // Default permit |
|
| 79 | - return true; |
|
| 80 | - } |
|
| 78 | + // Default permit |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | /** |