@@ -106,6 +106,10 @@ |
||
| 106 | 106 | $this->out("Generated $i users."); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | + /** |
|
| 110 | + * @param integer $i |
|
| 111 | + * @param integer $off |
|
| 112 | + */ |
|
| 109 | 113 | protected function _progress($i, $off) { |
| 110 | 114 | if ($i < 1) { |
| 111 | 115 | return; |
@@ -42,12 +42,18 @@ |
||
| 42 | 42 | exec($command); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $urlFilePath |
|
| 47 | + */ |
|
| 45 | 48 | protected function _cleanup($urlFilePath) { |
| 46 | 49 | if (file_exists($urlFilePath)) { |
| 47 | 50 | unlink($urlFilePath); |
| 48 | 51 | } |
| 49 | 52 | } |
| 50 | 53 | |
| 54 | + /** |
|
| 55 | + * @param string[] $out |
|
| 56 | + */ |
|
| 51 | 57 | protected function _generateEntriesIndex(&$out) { |
| 52 | 58 | for ($i = 0; $i < 400; $i++) { |
| 53 | 59 | $out[] = $this->_prefix . 'entries/index/page:' . rand(1, 2); |
@@ -104,6 +104,10 @@ discard block |
||
| 104 | 104 | return $this->_countYearStats(['fields' => ['COUNT(DISTINCT `user_id`) AS `count`']]); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | + /** |
|
| 108 | + * @param string $model |
|
| 109 | + * @param string $field |
|
| 110 | + */ |
|
| 107 | 111 | protected function _getYearStats($model, $field) { |
| 108 | 112 | return $this->_countYearStats(['fields' => ['COUNT(*) AS `count`']], |
| 109 | 113 | [], $model, $field); |
@@ -147,6 +151,10 @@ discard block |
||
| 147 | 151 | return $this->_wrapData($data); |
| 148 | 152 | } |
| 149 | 153 | |
| 154 | + /** |
|
| 155 | + * @param string $model |
|
| 156 | + * @param string $field |
|
| 157 | + */ |
|
| 150 | 158 | protected function _getMonthStats($model, $field) { |
| 151 | 159 | $results = $this->_countYearStats( |
| 152 | 160 | ['fields' => ['COUNT(*) AS `count`']], |
@@ -15,6 +15,9 @@ |
||
| 15 | 15 | return $hashWithSalt; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | + /** |
|
| 19 | + * @param integer $maxLength |
|
| 20 | + */ |
|
| 18 | 21 | protected static function _generateRandomString($maxLength = null) { |
| 19 | 22 | $string = Security::generateAuthKey(); |
| 20 | 23 | if ($maxLength) { |
@@ -268,6 +268,7 @@ |
||
| 268 | 268 | |
| 269 | 269 | /** |
| 270 | 270 | * write the settings to the session, so that they are available on next request |
| 271 | + * @param Controller $controller |
|
| 271 | 272 | */ |
| 272 | 273 | protected function _writeSession(&$controller) { |
| 273 | 274 | if ($controller->action !== 'logout' && $controller->Auth->user()): |
@@ -305,8 +305,10 @@ |
||
| 305 | 305 | |
| 306 | 306 | if ($this->isLoggedIn()): |
| 307 | 307 | $this->_Controller->Auth->allow(); |
| 308 | - else: |
|
| 308 | + else { |
|
| 309 | + : |
|
| 309 | 310 | $this->_Controller->Auth->deny(); |
| 311 | + } |
|
| 310 | 312 | endif; |
| 311 | 313 | |
| 312 | 314 | $this->_Controller->Auth->autoRedirect = false; // don't redirect after Auth->login() |
@@ -203,6 +203,9 @@ |
||
| 203 | 203 | $this->_CakeEmail->config('saito'); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | + /** |
|
| 207 | + * @param string $type |
|
| 208 | + */ |
|
| 206 | 209 | public function getPredefinedSender($type) { |
| 207 | 210 | $this->_init(); |
| 208 | 211 | return ['User' => [ |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | * @param null $id |
| 651 | 651 | * @param null $toggle |
| 652 | 652 | * |
| 653 | - * @return translated |
|
| 653 | + * @return null|string |
|
| 654 | 654 | */ |
| 655 | 655 | public function ajax_toggle($id = null, $toggle = null) { |
| 656 | 656 | $this->autoLayout = false; |
@@ -781,6 +781,9 @@ discard block |
||
| 781 | 781 | } |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | + /** |
|
| 785 | + * @param string $type |
|
| 786 | + */ |
|
| 784 | 787 | protected function _incrementViews($entry, $type = null) { |
| 785 | 788 | if ($this->CurrentUser->isBot()) { |
| 786 | 789 | return; |
@@ -947,6 +950,9 @@ discard block |
||
| 947 | 950 | $this->set('rootEntry', $_rootEntry); |
| 948 | 951 | } |
| 949 | 952 | |
| 953 | + /** |
|
| 954 | + * @param string $type |
|
| 955 | + */ |
|
| 950 | 956 | protected function _setTitleFromEntry($entry, $type = null) { |
| 951 | 957 | if ($type === null) { |
| 952 | 958 | $template = __(':subject | :category'); |
@@ -242,7 +242,8 @@ discard block |
||
| 242 | 242 | $this->_stop(); |
| 243 | 243 | } |
| 244 | 244 | // answering through POST request |
| 245 | - else : |
|
| 245 | + else { |
|
| 246 | + : |
|
| 246 | 247 | if ($this->localReferer('action') === 'mix') { |
| 247 | 248 | // answer request came from mix ansicht |
| 248 | 249 | $this->redirect( |
@@ -253,6 +254,7 @@ discard block |
||
| 253 | 254 | '#' => $this->Entry->id |
| 254 | 255 | ] |
| 255 | 256 | ); |
| 257 | + } |
|
| 256 | 258 | |
| 257 | 259 | } else { |
| 258 | 260 | // normal posting from entries/add or entries/view |
@@ -267,7 +269,8 @@ discard block |
||
| 267 | 269 | } |
| 268 | 270 | return; |
| 269 | 271 | endif; |
| 270 | - else : |
|
| 272 | + else { |
|
| 273 | + : |
|
| 271 | 274 | // Error while trying to save a post |
| 272 | 275 | if (count($this->Entry->validationErrors) === 0) { |
| 273 | 276 | $this->Session->setFlash( |
@@ -276,6 +279,7 @@ discard block |
||
| 276 | 279 | ), |
| 277 | 280 | 'flash/error' |
| 278 | 281 | ); |
| 282 | + } |
|
| 279 | 283 | } |
| 280 | 284 | endif; |
| 281 | 285 | |
@@ -584,10 +588,12 @@ discard block |
||
| 584 | 588 | ); |
| 585 | 589 | $entry = $this->dic->newInstance('\Saito\Posting\Posting', ['rawData' => $newEntry]); |
| 586 | 590 | $this->set('entry', $entry); |
| 587 | - else : |
|
| 591 | + else { |
|
| 592 | + : |
|
| 588 | 593 | // validation errors |
| 589 | 594 | foreach ($errors as $field => $error) { |
| 590 | 595 | $message = __d('nondynamic', $field) . ": " . __d( 'nondynamic', $error[0]); |
| 596 | + } |
|
| 591 | 597 | $this->JsData->addAppJsMessage( |
| 592 | 598 | $message, |
| 593 | 599 | [ |
@@ -176,10 +176,16 @@ |
||
| 176 | 176 | $this->set(compact('month', 'year')); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | + /** |
|
| 180 | + * @param string $string |
|
| 181 | + */ |
|
| 179 | 182 | protected function _sanitize($string) { |
| 180 | 183 | return Sanitize::escape($string, $this->Entry->useDbConfig); |
| 181 | 184 | } |
| 182 | 185 | |
| 186 | + /** |
|
| 187 | + * @param string[] $params |
|
| 188 | + */ |
|
| 183 | 189 | protected function _filterQuery($params) { |
| 184 | 190 | $this->request->query = array_intersect_key($this->request->query, |
| 185 | 191 | array_fill_keys($params, 1)); |
@@ -28,6 +28,9 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | + /** |
|
| 32 | + * @param string $data |
|
| 33 | + */ |
|
| 31 | 34 | protected function _statusAsEventStream($data) { |
| 32 | 35 | // time in ms to next request |
| 33 | 36 | $_retry = '10000'; |
@@ -40,6 +43,9 @@ discard block |
||
| 40 | 43 | return $_out; |
| 41 | 44 | } |
| 42 | 45 | |
| 46 | + /** |
|
| 47 | + * @param string $data |
|
| 48 | + */ |
|
| 43 | 49 | protected function _statusAsJson($data) { |
| 44 | 50 | if ($this->request->is('ajax') === false) { |
| 45 | 51 | throw new BadRequestException(); |