@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $currentPage = 1; |
| 45 | 45 | if (isset($this->request->named['page']) && $this->request->named['page'] != 1) { |
| 46 | - $currentPage = (int)$this->request->named['page']; |
|
| 47 | - $this->set('title_for_layout', __('page') . ' ' . $currentPage); |
|
| 46 | + $currentPage = (int) $this->request->named['page']; |
|
| 47 | + $this->set('title_for_layout', __('page').' '.$currentPage); |
|
| 48 | 48 | } |
| 49 | 49 | if ($currentPage === 1 && $this->CurrentUser->isLoggedIn() |
| 50 | 50 | && $this->CurrentUser['user_automaticaly_mark_as_read'] |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | public function source($id = null) { |
| 147 | 147 | $this->autoRender = false; |
| 148 | 148 | |
| 149 | - $data = $this->requestAction('/entries/view/' . $id); |
|
| 149 | + $data = $this->requestAction('/entries/view/'.$id); |
|
| 150 | 150 | |
| 151 | 151 | $out = array(); |
| 152 | 152 | $out[] = '<pre style="white-space: pre-wrap;">'; |
| 153 | - $out[] = $data['Entry']['subject'] . "\n"; |
|
| 153 | + $out[] = $data['Entry']['subject']."\n"; |
|
| 154 | 154 | $out[] = $data['Entry']['text']; |
| 155 | 155 | $out[] = '</pre>'; |
| 156 | 156 | return implode("\n", $out); |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | return json_encode( |
| 235 | 235 | [ |
| 236 | - 'id' => (int)$newPosting['Entry']['id'], |
|
| 237 | - 'pid' => (int)$newPosting['Entry']['pid'], |
|
| 238 | - 'tid' => (int)$newPosting['Entry']['tid'] |
|
| 236 | + 'id' => (int) $newPosting['Entry']['id'], |
|
| 237 | + 'pid' => (int) $newPosting['Entry']['pid'], |
|
| 238 | + 'tid' => (int) $newPosting['Entry']['tid'] |
|
| 239 | 239 | ] |
| 240 | 240 | ); |
| 241 | 241 | } else { |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $this->set('is_answer', (int)$this->request->data['Entry']['pid'] !== 0); |
|
| 340 | - $this->set('is_inline', (int)$this->request->data['Entry']['pid'] !== 0); |
|
| 339 | + $this->set('is_answer', (int) $this->request->data['Entry']['pid'] !== 0); |
|
| 340 | + $this->set('is_inline', (int) $this->request->data['Entry']['pid'] !== 0); |
|
| 341 | 341 | $this->set('form_id', $this->request->data['Entry']['pid']); |
| 342 | 342 | $this->_setAddViewVars(); |
| 343 | 343 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | ); |
| 440 | 440 | $this->set('notis', $notis); |
| 441 | 441 | |
| 442 | - $this->set('is_answer', (int)$this->request->data['Entry']['pid'] !== 0); |
|
| 442 | + $this->set('is_answer', (int) $this->request->data['Entry']['pid'] !== 0); |
|
| 443 | 443 | $this->set('is_inline', false); |
| 444 | 444 | $this->set('form_id', $this->request->data['Entry']['pid']); |
| 445 | 445 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $this->redirect('/'); |
| 488 | 488 | } else { |
| 489 | 489 | $this->Session->setFlash(__('delete_subtree_success'), 'flash/success'); |
| 490 | - $this->redirect('/entries/view/' . $entry['Entry']['pid']); |
|
| 490 | + $this->redirect('/entries/view/'.$entry['Entry']['pid']); |
|
| 491 | 491 | } |
| 492 | 492 | } else { |
| 493 | 493 | $this->Session->setFlash(__('delete_tree_error'), 'flash/error'); |
@@ -587,16 +587,16 @@ discard block |
||
| 587 | 587 | else : |
| 588 | 588 | // validation errors |
| 589 | 589 | foreach ($errors as $field => $error) { |
| 590 | - $message = __d('nondynamic', $field) . ": " . __d( 'nondynamic', $error[0]); |
|
| 590 | + $message = __d('nondynamic', $field).": ".__d('nondynamic', $error[0]); |
|
| 591 | 591 | $this->JsData->addAppJsMessage( |
| 592 | 592 | $message, |
| 593 | 593 | [ |
| 594 | 594 | 'type' => 'error', |
| 595 | 595 | 'channel' => 'form', |
| 596 | - 'element' => '#Entry' . array_reduce( |
|
| 596 | + 'element' => '#Entry'.array_reduce( |
|
| 597 | 597 | explode('_', $field), |
| 598 | - function ($carry, $item) { |
|
| 599 | - return $carry . ucfirst($item); |
|
| 598 | + function($carry, $item) { |
|
| 599 | + return $carry.ucfirst($item); |
|
| 600 | 600 | }, |
| 601 | 601 | '' |
| 602 | 602 | ) |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | $this->Entry->contain(); |
| 627 | 627 | $data = $this->Entry->findById($id); |
| 628 | 628 | |
| 629 | - if (!$data || (int)$data['Entry']['pid'] !== 0) { |
|
| 629 | + if (!$data || (int) $data['Entry']['pid'] !== 0) { |
|
| 630 | 630 | throw new NotFoundException(); |
| 631 | 631 | } |
| 632 | 632 | |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $targetId = $this->request->data['Entry']['targetId']; |
| 636 | 636 | $this->Entry->id = $id; |
| 637 | 637 | if ($this->Entry->threadMerge($targetId)) { |
| 638 | - $this->redirect('/entries/view/' . $id); |
|
| 638 | + $this->redirect('/entries/view/'.$id); |
|
| 639 | 639 | return; |
| 640 | 640 | } else { |
| 641 | 641 | $this->Session->setFlash(__("Error"), 'flash/error'); |
@@ -676,10 +676,10 @@ discard block |
||
| 676 | 676 | //* let's toggle |
| 677 | 677 | $this->Entry->id = $id; |
| 678 | 678 | $this->request->data = $this->Entry->toggle($toggle); |
| 679 | - return ($this->request->data == 0) ? __d('nondynamic', $toggle . '_set_entry_link') : __d('nondynamic', $toggle . '_unset_entry_link'); |
|
| 679 | + return ($this->request->data == 0) ? __d('nondynamic', $toggle.'_set_entry_link') : __d('nondynamic', $toggle.'_unset_entry_link'); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - $this->set('json_data', (string)$this->request->data); |
|
| 682 | + $this->set('json_data', (string) $this->request->data); |
|
| 683 | 683 | $this->render('/Elements/json/json_data'); |
| 684 | 684 | } |
| 685 | 685 | |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | // … directly in entries/mix |
| 926 | 926 | || $this->request->action === 'mix' |
| 927 | 927 | // … inline viewing … on entries/index. |
| 928 | - || ( $this->localReferer('controller') === 'entries' && $this->localReferer('action') === 'index') |
|
| 928 | + || ($this->localReferer('controller') === 'entries' && $this->localReferer('action') === 'index') |
|
| 929 | 929 | ): |
| 930 | 930 | $showAnsweringPanel = true; |
| 931 | 931 | endif; |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | protected function _setRootEntry($entry) { |
| 937 | - if ((int)$entry['Entry']['pid'] !== 0) { |
|
| 937 | + if ((int) $entry['Entry']['pid'] !== 0) { |
|
| 938 | 938 | $_rootEntry = $this->Entry->find('first', |
| 939 | 939 | [ |
| 940 | 940 | 'contain' => false, |
@@ -949,9 +949,9 @@ discard block |
||
| 949 | 949 | |
| 950 | 950 | protected function _setTitleFromEntry($entry, $type = null) { |
| 951 | 951 | if ($type === null) { |
| 952 | - $template = __(':subject | :category'); |
|
| 952 | + $template = __(':subject | :category'); |
|
| 953 | 953 | } else { |
| 954 | - $template = __(':subject (:type) | :category'); |
|
| 954 | + $template = __(':subject (:type) | :category'); |
|
| 955 | 955 | } |
| 956 | 956 | $this->set('title_for_layout', |
| 957 | 957 | CakeText::insert($template, |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | $Logger->write('Contact email failed', ['e' => $e]); |
| 129 | 129 | |
| 130 | 130 | $this->Session->setFlash( |
| 131 | - __('Message couldn\'t be send! ' . $e->getMessage()), |
|
| 131 | + __('Message couldn\'t be send! '.$e->getMessage()), |
|
| 132 | 132 | 'flash/error' |
| 133 | 133 | ); |
| 134 | 134 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $code = $this->request->query('c'); |
| 158 | 158 | |
| 159 | 159 | try { |
| 160 | - $activated = $this->User->activate((int)$id, $code); |
|
| 160 | + $activated = $this->User->activate((int) $id, $code); |
|
| 161 | 161 | } catch (Exception $e) { |
| 162 | 162 | $activated = false; |
| 163 | 163 | } |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | return; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - $id = (int)$this->request->data('User.lockUserId'); |
|
| 424 | + $id = (int) $this->request->data('User.lockUserId'); |
|
| 425 | 425 | if (!$id) { |
| 426 | 426 | throw new BadRequestException; |
| 427 | 427 | } |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | ); |
| 446 | 446 | } else { |
| 447 | 447 | try { |
| 448 | - $duration = (int)$this->request->data('User.lockPeriod'); |
|
| 448 | + $duration = (int) $this->request->data('User.lockPeriod'); |
|
| 449 | 449 | $status = $this->User->UserBlock->block( |
| 450 | 450 | new \Saito\User\Blocker\ManualBlocker, |
| 451 | 451 | $id, |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | $allowed = $this->viewVars['slidetabs']; |
| 611 | - $order = array_filter( $order, function ($item) use ($allowed) { |
|
| 611 | + $order = array_filter($order, function($item) use ($allowed) { |
|
| 612 | 612 | return in_array($item, $allowed); |
| 613 | 613 | }); |
| 614 | 614 | $order = serialize($order); |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | if ($CurrentUser->isAdmin()) { |
| 668 | 668 | return true; |
| 669 | 669 | } |
| 670 | - return $CurrentUser->getId() === (int)$userId; |
|
| 670 | + return $CurrentUser->getId() === (int) $userId; |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | protected function _passwordAuthSwitch($data) { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | $deactivate = $this->Esnotification->read('deactivate'); |
| 27 | 27 | if (!isset($this->request->params['named']['token']) |
| 28 | - || (int)$this->request->params['named']['token'] !== (int)$deactivate['Esnotification']['deactivate'] |
|
| 28 | + || (int) $this->request->params['named']['token'] !== (int) $deactivate['Esnotification']['deactivate'] |
|
| 29 | 29 | ) { |
| 30 | 30 | throw new MethodNotAllowedException(); |
| 31 | 31 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'entry_id' => $this->request->data['id'], |
| 49 | 49 | ]; |
| 50 | 50 | $this->Bookmark->create(); |
| 51 | - return (bool)$this->Bookmark->save($data); |
|
| 51 | + return (bool) $this->Bookmark->save($data); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->_getBookmark($id, $this->CurrentUser->getId()); |
| 99 | 99 | $this->autoRender = false; |
| 100 | 100 | $this->Bookmark->id = $id; |
| 101 | - return (bool)$this->Bookmark->delete(); |
|
| 101 | + return (bool) $this->Bookmark->delete(); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function beforeFilter() { |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | if (isset($this->request->data['Category']['modeMove']) && isset($this->request->data['Category']['targetCategory'])): |
| 73 | 73 | /* move category items before deleting the cateogry */ |
| 74 | 74 | |
| 75 | - $targetId = (int)$this->request->data['Category']['targetCategory']; |
|
| 75 | + $targetId = (int) $this->request->data['Category']['targetCategory']; |
|
| 76 | 76 | |
| 77 | 77 | /* make sure that target category exists */ |
| 78 | 78 | $this->Category->contain(); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | |
| 64 | 64 | public function admin_edit($id = null) { |
| 65 | 65 | if (!$id) { |
| 66 | - $this->redirect(array( 'action ' => 'index' )); |
|
| 66 | + $this->redirect(array('action ' => 'index')); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $this->Setting->id = $id; |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | $order = '`Entry`.`time` DESC'; |
| 80 | 80 | $fields = '*'; |
| 81 | 81 | if ($query['order'] === 'rank') { |
| 82 | - $order = 'rating DESC, ' . $order; |
|
| 83 | - $fields = $fields . ", (MATCH (Entry.subject) AGAINST ('$q' IN BOOLEAN MODE)*2) + (MATCH (Entry.text) AGAINST ('$q' IN BOOLEAN MODE)) + (MATCH (Entry.name) AGAINST ('$q' IN BOOLEAN MODE)*4) AS rating"; |
|
| 82 | + $order = 'rating DESC, '.$order; |
|
| 83 | + $fields = $fields.", (MATCH (Entry.subject) AGAINST ('$q' IN BOOLEAN MODE)*2) + (MATCH (Entry.text) AGAINST ('$q' IN BOOLEAN MODE)) + (MATCH (Entry.name) AGAINST ('$q' IN BOOLEAN MODE)*4) AS rating"; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // query |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | 'Y-m-d H:i:s', |
| 153 | 153 | mktime(0, 0, 0, $month, 1, $year)); |
| 154 | 154 | |
| 155 | - if (isset($query['category_id']) && (int)$query['category_id'] !== 0) { |
|
| 156 | - if (!isset($categories[(int)$query['category_id']])) { |
|
| 155 | + if (isset($query['category_id']) && (int) $query['category_id'] !== 0) { |
|
| 156 | + if (!isset($categories[(int) $query['category_id']])) { |
|
| 157 | 157 | throw new NotFoundException; |
| 158 | 158 | } |
| 159 | 159 | } else { |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $this->response->disableCache(); |
| 37 | 37 | $_out = ''; |
| 38 | 38 | $_out .= "retry: $_retry\n"; |
| 39 | - $_out .= 'data: ' . $data . "\n\n"; |
|
| 39 | + $_out .= 'data: '.$data."\n\n"; |
|
| 40 | 40 | return $_out; |
| 41 | 41 | } |
| 42 | 42 | |