@@ -40,19 +40,19 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | // get configs |
| 42 | 42 | $configs = $this->getConfigs(); |
| 43 | - if (!App::$User->isAuth() && (int)$configs['guestAdd'] !== 1) { |
|
| 43 | + if (!App::$User->isAuth() && (int) $configs['guestAdd'] !== 1) { |
|
| 44 | 44 | throw new ForbiddenException(__('Feedback available only for authorized users')); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // initialize model |
| 48 | - $model = new FormFeedbackAdd((int)$configs['useCaptcha'] === 1); |
|
| 48 | + $model = new FormFeedbackAdd((int) $configs['useCaptcha'] === 1); |
|
| 49 | 49 | if ($model->send()) { |
| 50 | 50 | if ($model->validate()) { |
| 51 | 51 | // if validation is passed save data to db and get row |
| 52 | 52 | $record = $model->make(); |
| 53 | 53 | App::$Session->getFlashBag()->add('success', __('Your message was added successful')); |
| 54 | 54 | // todo: add email notification |
| 55 | - App::$Response->redirect('feedback/read/' . $record->id . '/' . $record->hash); |
|
| 55 | + App::$Response->redirect('feedback/read/'.$record->id.'/'.$record->hash); |
|
| 56 | 56 | } else { |
| 57 | 57 | App::$Session->getFlashBag()->add('error', __('Message is not sended! Please, fix issues in form below')); |
| 58 | 58 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | // render output view |
| 62 | 62 | return App::$View->render('create', [ |
| 63 | 63 | 'model' => $model->export(), |
| 64 | - 'useCaptcha' => (int)$configs['useCaptcha'] === 1 |
|
| 64 | + 'useCaptcha' => (int) $configs['useCaptcha'] === 1 |
|
| 65 | 65 | ]); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $userId = App::$User->isAuth() ? App::$User->identity()->getId() : 0; |
| 93 | 93 | $model = null; |
| 94 | 94 | // check if feedback post is not closed for answers |
| 95 | - if ((int)$recordPost->closed === 0) { |
|
| 95 | + if ((int) $recordPost->closed === 0) { |
|
| 96 | 96 | // init new answer add model |
| 97 | 97 | $model = new FormAnswerAdd($recordPost, $userId); |
| 98 | 98 | // if answer is sender lets try to make it model |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | // check if action is submited |
| 128 | 128 | if (App::$Request->request->get('closeRequest', false)) { |
| 129 | 129 | // if created by authorized user |
| 130 | - if ((int)$record->user_id !== 0) { |
|
| 130 | + if ((int) $record->user_id !== 0) { |
|
| 131 | 131 | $user = App::$User->identity(); |
| 132 | 132 | // button is pressed not by request creator |
| 133 | - if ($user === null || $user->getId() !== (int)$record->user_id) { |
|
| 133 | + if ($user === null || $user->getId() !== (int) $record->user_id) { |
|
| 134 | 134 | throw new ForbiddenException(__('This feedback request was created by another user')); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | // add notification and redirect |
| 143 | 143 | App::$Session->getFlashBag()->add('warning', __('Feedback request now is closed!')); |
| 144 | - App::$Response->redirect('feedback/read/' . $id . '/' . $hash); |
|
| 144 | + App::$Response->redirect('feedback/read/'.$id.'/'.$hash); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return App::$View->render('close'); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function actionList() |
| 157 | 157 | { |
| 158 | 158 | // set current page and offset |
| 159 | - $page = (int)App::$Request->query->get('page'); |
|
| 159 | + $page = (int) App::$Request->query->get('page'); |
|
| 160 | 160 | $offset = $page * self::ITEM_PER_PAGE; |
| 161 | 161 | |
| 162 | 162 | // check if user is authorized or throw exception |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | $records = null; |
| 37 | 37 | |
| 38 | 38 | // set current page and offset |
| 39 | - $page = (int)App::$Request->query->get('page'); |
|
| 39 | + $page = (int) App::$Request->query->get('page'); |
|
| 40 | 40 | $cfgs = Serialize::decode($this->application->configs); |
| 41 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
| 41 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
| 42 | 42 | if ($userPerPage < 1) { |
| 43 | 43 | $userPerPage = 1; |
| 44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | switch ($filter_name) { |
| 48 | 48 | case 'rating': // rating list, order by rating DESC |
| 49 | 49 | // check if rating is enabled |
| 50 | - if ((int)$cfgs['rating'] !== 1) { |
|
| 50 | + if ((int) $cfgs['rating'] !== 1) { |
|
| 51 | 51 | throw new NotFoundException(); |
| 52 | 52 | } |
| 53 | 53 | $records = (new ProfileRecords())->orderBy('rating', 'DESC'); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | if (Str::likeEmpty($filter_value)) { |
| 57 | 57 | throw new NotFoundException(); |
| 58 | 58 | } |
| 59 | - $records = (new ProfileRecords())->where('hobby', 'like', '%' . $filter_value . '%'); |
|
| 59 | + $records = (new ProfileRecords())->where('hobby', 'like', '%'.$filter_value.'%'); |
|
| 60 | 60 | break; |
| 61 | 61 | case 'city': |
| 62 | 62 | if (Str::likeEmpty($filter_value)) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if ($filter_value === null || !Obj::isLikeInt($filter_value)) { |
| 69 | 69 | throw new NotFoundException(); |
| 70 | 70 | } |
| 71 | - $records = (new ProfileRecords())->where('birthday', 'like', $filter_value . '-%'); |
|
| 71 | + $records = (new ProfileRecords())->where('birthday', 'like', $filter_value.'-%'); |
|
| 72 | 72 | break; |
| 73 | 73 | case 'all': |
| 74 | 74 | $records = (new ProfileRecords())->orderBy('id', 'DESC'); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | 'pagination' => $pagination, |
| 92 | 92 | 'id' => $filter_name, |
| 93 | 93 | 'add' => $filter_value, |
| 94 | - 'ratingOn' => (int)$cfgs['rating'] |
|
| 94 | + 'ratingOn' => (int) $cfgs['rating'] |
|
| 95 | 95 | ]); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function actionShow($userId) |
| 105 | 105 | { |
| 106 | 106 | $cfg = Serialize::decode($this->application->configs); |
| 107 | - if ((int)$cfg['guestView'] !== 1 && !App::$User->isAuth()) { |
|
| 107 | + if ((int) $cfg['guestView'] !== 1 && !App::$User->isAuth()) { |
|
| 108 | 108 | throw new ForbiddenException('You must be registered user to view other profile'); |
| 109 | 109 | } |
| 110 | 110 | // check if target exists |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | App::$Session->getFlashBag()->add('error', __('This user are in your black list or you are in blacklist!')); |
| 127 | 127 | } else { |
| 128 | 128 | // check if message added |
| 129 | - if ($wallModel->makePost($targetPersone, $viewerPersone, (int)$cfg['delayBetweenPost'])) { |
|
| 129 | + if ($wallModel->makePost($targetPersone, $viewerPersone, (int) $cfg['delayBetweenPost'])) { |
|
| 130 | 130 | App::$Session->getFlashBag()->add('success', __('The message was successful posted!')); |
| 131 | 131 | } else { |
| 132 | 132 | App::$Session->getFlashBag()->add('warning', __('Posting message was failed! You need to wait some time...')); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | $query = $targetPersone->getWall(); // relation hasMany from users to walls |
| 139 | 139 | // pagination and query params |
| 140 | - $wallPage = (int)App::$Request->query->get('page'); |
|
| 141 | - $wallItems = (int)$cfg['wallPostOnPage']; |
|
| 140 | + $wallPage = (int) App::$Request->query->get('page'); |
|
| 141 | + $wallItems = (int) $cfg['wallPostOnPage']; |
|
| 142 | 142 | $wallOffset = $wallPage * $wallItems; |
| 143 | 143 | |
| 144 | 144 | // build pagination |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | 'notify' => App::$Session->getFlashBag()->all(), |
| 161 | 161 | 'wallRecords' => $wallRecords, |
| 162 | 162 | 'pagination' => $wallPagination, |
| 163 | - 'ratingOn' => (int)$cfg['rating'] === 1 |
|
| 163 | + 'ratingOn' => (int) $cfg['rating'] === 1 |
|
| 164 | 164 | ]); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $wallModel = new FormWallPostDelete($wallPost); |
| 228 | 228 | if ($wallModel->send() && $wallModel->validate()) { |
| 229 | 229 | $wallModel->make(); |
| 230 | - App::$Response->redirect('profile/show/' . $wallPost->target_id); |
|
| 230 | + App::$Response->redirect('profile/show/'.$wallPost->target_id); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | return App::$View->render('wall_delete', [ |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | // set user id from ?id= get param if form not sended |
| 322 | 322 | if (!$model->send()) { |
| 323 | - $uid = (int)App::$Request->query->get('id'); |
|
| 323 | + $uid = (int) App::$Request->query->get('id'); |
|
| 324 | 324 | if ($uid > 0) { |
| 325 | 325 | $model->id = $uid; |
| 326 | 326 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | // get blocked users |
| 339 | 339 | $records = Blacklist::where('user_id', '=', $user->getId()); |
| 340 | 340 | |
| 341 | - $page = (int)App::$Request->query->get('page'); |
|
| 341 | + $page = (int) App::$Request->query->get('page'); |
|
| 342 | 342 | $offset = $page * self::BLOCK_PER_PAGE; |
| 343 | 343 | |
| 344 | 344 | // build pagination |
@@ -410,9 +410,9 @@ discard block |
||
| 410 | 410 | // check if request is sended |
| 411 | 411 | if ($model->send() && $model->validate()) { |
| 412 | 412 | // get records from db |
| 413 | - $records = ProfileRecords::where('nick', 'like', '%' . $model->query . '%'); |
|
| 414 | - $page = (int)App::$Request->query->get('page'); |
|
| 415 | - $userPerPage = (int)$cfgs['usersOnPage']; |
|
| 413 | + $records = ProfileRecords::where('nick', 'like', '%'.$model->query.'%'); |
|
| 414 | + $page = (int) App::$Request->query->get('page'); |
|
| 415 | + $userPerPage = (int) $cfgs['usersOnPage']; |
|
| 416 | 416 | if ($userPerPage < 1) { |
| 417 | 417 | $userPerPage = 1; |
| 418 | 418 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | 'model' => $model->export(), |
| 435 | 435 | 'records' => $records, |
| 436 | 436 | 'pagination' => $pagination, |
| 437 | - 'ratingOn' => (int)$cfgs['rating'] |
|
| 437 | + 'ratingOn' => (int) $cfgs['rating'] |
|
| 438 | 438 | ]); |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | \ No newline at end of file |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $path = App::$Request->getPathWithoutControllerAction(); |
| 52 | 52 | $configs = $this->getConfigs(); |
| 53 | - $page = (int)App::$Request->query->get('page'); |
|
| 54 | - $itemCount = (int)$configs['itemPerCategory']; |
|
| 53 | + $page = (int) App::$Request->query->get('page'); |
|
| 54 | + $itemCount = (int) $configs['itemPerCategory']; |
|
| 55 | 55 | |
| 56 | 56 | // build special model with content list and category list information |
| 57 | 57 | $model = new EntityCategoryList($path, $configs, $page); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $model = new EntityContentRead($categoryRecord, $contentRecord->first()); |
| 126 | 126 | $search = null; |
| 127 | 127 | // check if similar search is enabled for item category |
| 128 | - if ((int)$model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) { |
|
| 128 | + if ((int) $model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) { |
|
| 129 | 129 | $search = new EntityContentSearch($model->title, $model->id); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | $configs = $this->getConfigs(); |
| 156 | 156 | // check if tags is enabled |
| 157 | - if ((int)$configs['keywordsAsTags'] !== 1) { |
|
| 157 | + if ((int) $configs['keywordsAsTags'] !== 1) { |
|
| 158 | 158 | throw new NotFoundException(__('Tag system is disabled')); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // get equal rows order by creation date |
| 170 | - $records = ContentEntity::where('meta_keywords', 'like', '%' . $tagName . '%')->orderBy('created_at', 'DESC')->take(self::TAG_PER_PAGE); |
|
| 170 | + $records = ContentEntity::where('meta_keywords', 'like', '%'.$tagName.'%')->orderBy('created_at', 'DESC')->take(self::TAG_PER_PAGE); |
|
| 171 | 171 | // check if result is not empty |
| 172 | 172 | if ($records->count() < 1) { |
| 173 | 173 | throw new NotFoundException(__('Nothing founded')); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $this->layout = null; |
| 202 | 202 | |
| 203 | 203 | // check if rss display allowed for this category |
| 204 | - if ((int)$model->category['configs']['showRss'] !== 1) { |
|
| 204 | + if ((int) $model->category['configs']['showRss'] !== 1) { |
|
| 205 | 205 | throw new ForbiddenException(__('Rss feed is disabled for this category')); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | // set channel data |
| 213 | 213 | $channel->title($model->category['title']) |
| 214 | 214 | ->description($model->category['description']) |
| 215 | - ->url(App::$Alias->baseUrl . '/content/list/' . $model->category['path']) |
|
| 215 | + ->url(App::$Alias->baseUrl.'/content/list/'.$model->category['path']) |
|
| 216 | 216 | ->appendTo($feed); |
| 217 | 217 | |
| 218 | 218 | // add content data |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | // add title, short text, url |
| 223 | 223 | $item->title($row['title']) |
| 224 | 224 | ->description($row['text']) |
| 225 | - ->url(App::$Alias->baseUrl . $row['uri']); |
|
| 225 | + ->url(App::$Alias->baseUrl.$row['uri']); |
|
| 226 | 226 | // add poster |
| 227 | 227 | if ($row['thumb'] !== null) { |
| 228 | - $item->enclosure(App::$Alias->scriptUrl . $row['thumb'], $row['thumbSize'], 'image/jpeg'); |
|
| 228 | + $item->enclosure(App::$Alias->scriptUrl.$row['thumb'], $row['thumbSize'], 'image/jpeg'); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // append response to channel |
@@ -41,16 +41,16 @@ discard block |
||
| 41 | 41 | public function actionInfo() |
| 42 | 42 | { |
| 43 | 43 | $text = "\nInformation about FFCMS package and environment: \n\n"; |
| 44 | - $text .= "\t PHP version: " . phpversion() . "\n"; |
|
| 45 | - $text .= "\t Dist path: " . root . "\n"; |
|
| 46 | - $text .= "\t Used version: " . App::$Properties->version['num'] . ' [build: ' . App::$Properties->version['date'] . "]\n\n"; |
|
| 44 | + $text .= "\t PHP version: ".phpversion()."\n"; |
|
| 45 | + $text .= "\t Dist path: ".root."\n"; |
|
| 46 | + $text .= "\t Used version: ".App::$Properties->version['num'].' [build: '.App::$Properties->version['date']."]\n\n"; |
|
| 47 | 47 | $text .= "Information about FFCMS cmf packages: \n\n"; |
| 48 | 48 | |
| 49 | 49 | $composerInfo = File::read('/composer.lock'); |
| 50 | 50 | if (false !== $composerInfo) { |
| 51 | 51 | $jsonInfo = json_decode($composerInfo); |
| 52 | 52 | foreach ($jsonInfo->packages as $item) { |
| 53 | - $text .= "\t Package: " . $item->name . ' => ' . $item->version . "\n"; |
|
| 53 | + $text .= "\t Package: ".$item->name.' => '.$item->version."\n"; |
|
| 54 | 54 | } |
| 55 | 55 | } else { |
| 56 | 56 | $text .= "\t Composer is never be used - no information available."; |
@@ -86,16 +86,16 @@ discard block |
||
| 86 | 86 | preg_match_all('/public function action(\w*?)\(/', $byte, $matches); // matches[0] contains all methods ;) |
| 87 | 87 | if (Obj::isArray($matches[1]) && count($matches[1]) > 0) { |
| 88 | 88 | foreach ($matches[1] as $perm) { |
| 89 | - $permissions[] = 'Admin/' . $className . '/' . $perm; |
|
| 89 | + $permissions[] = 'Admin/'.$className.'/'.$perm; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // prepare save string |
| 95 | - $stringSave = "<?php \n\nreturn " . var_export($permissions, true) . ';'; |
|
| 95 | + $stringSave = "<?php \n\nreturn ".var_export($permissions, true).';'; |
|
| 96 | 96 | File::write('/Private/Config/Permissions.php', $stringSave); |
| 97 | 97 | |
| 98 | - return App::$Output->write('Permission mas is successful updated! Founded permissions: ' . count($permissions)); |
|
| 98 | + return App::$Output->write('Permission mas is successful updated! Founded permissions: '.count($permissions)); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | if (Directory::exist($obj)) { |
| 109 | 109 | Directory::recursiveChmod($obj, 0777); |
| 110 | 110 | } elseif (File::exist($obj)) { |
| 111 | - chmod(root . $obj, 0777); |
|
| 111 | + chmod(root.$obj, 0777); |
|
| 112 | 112 | } else { |
| 113 | - $errors .= App::$Output->write('Filesystem object is not founded: ' . $obj); |
|
| 113 | + $errors .= App::$Output->write('Filesystem object is not founded: '.$obj); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -144,38 +144,38 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | // database config from input |
| 146 | 146 | echo App::$Output->writeHeader('Database connection configuration'); |
| 147 | - echo 'Driver(default:' . $config['driver'] . '):'; |
|
| 147 | + echo 'Driver(default:'.$config['driver'].'):'; |
|
| 148 | 148 | $dbDriver = App::$Input->read(); |
| 149 | 149 | if (Arr::in($dbDriver, ['mysql', 'pgsql', 'sqlite'])) { |
| 150 | 150 | $newConfig['driver'] = $dbDriver; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // for sqlite its would be a path |
| 154 | - echo 'Host(default:' . $config['host'] . '):'; |
|
| 154 | + echo 'Host(default:'.$config['host'].'):'; |
|
| 155 | 155 | $dbHost = App::$Input->read(); |
| 156 | 156 | if (!Str::likeEmpty($dbHost)) { |
| 157 | 157 | $newConfig['host'] = $dbHost; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - echo 'Database name(default:' . $config['database'] . '):'; |
|
| 160 | + echo 'Database name(default:'.$config['database'].'):'; |
|
| 161 | 161 | $dbName = App::$Input->read(); |
| 162 | 162 | if (!Str::likeEmpty($dbName)) { |
| 163 | 163 | $newConfig['database'] = $dbName; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - echo 'User(default:' . $config['username'] . '):'; |
|
| 166 | + echo 'User(default:'.$config['username'].'):'; |
|
| 167 | 167 | $dbUser = App::$Input->read(); |
| 168 | 168 | if (!Str::likeEmpty($dbUser)) { |
| 169 | 169 | $newConfig['username'] = $dbUser; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - echo 'Password(default:' . $config['password'] . '):'; |
|
| 172 | + echo 'Password(default:'.$config['password'].'):'; |
|
| 173 | 173 | $dbPwd = App::$Input->read(); |
| 174 | 174 | if (!Str::likeEmpty($dbPwd)) { |
| 175 | 175 | $newConfig['password'] = $dbPwd; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - echo 'Table prefix(default:' . $config['prefix'] . '):'; |
|
| 178 | + echo 'Table prefix(default:'.$config['prefix'].'):'; |
|
| 179 | 179 | $dbPrefix = App::$Input->read(); |
| 180 | 180 | if (!Str::likeEmpty($dbPrefix)) { |
| 181 | 181 | $newConfig['prefix'] = $dbPrefix; |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | try { |
| 189 | 189 | App::$Database->connection('install')->getDatabaseName(); |
| 190 | 190 | } catch (\Exception $e) { |
| 191 | - return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: ' . $e->getMessage(); |
|
| 191 | + return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: '.$e->getMessage(); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // autoload isn't work here |
| 195 | - include(root . '/Apps/Controller/Console/Db.php'); |
|
| 195 | + include(root.'/Apps/Controller/Console/Db.php'); |
|
| 196 | 196 | |
| 197 | 197 | // import db data |
| 198 | 198 | $dbController = new DbController(); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | // set website send from email from input |
| 202 | 202 | $emailConfig = App::$Properties->get('adminEmail'); |
| 203 | - echo 'Website sendFrom email(default: ' . $emailConfig . '):'; |
|
| 203 | + echo 'Website sendFrom email(default: '.$emailConfig.'):'; |
|
| 204 | 204 | $email = App::$Input->read(); |
| 205 | 205 | if (!Str::isEmail($email)) { |
| 206 | 206 | $email = $emailConfig; |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | $allCfg['database'] = $dbConfigs; |
| 213 | 213 | $allCfg['adminEmail'] = $email; |
| 214 | 214 | echo App::$Output->write('Generate password salt for BLOWFISH crypt'); |
| 215 | - $allCfg['passwordSalt'] = '$2a$07$' . Str::randomLatinNumeric(mt_rand(21, 30)) . '$'; |
|
| 215 | + $allCfg['passwordSalt'] = '$2a$07$'.Str::randomLatinNumeric(mt_rand(21, 30)).'$'; |
|
| 216 | 216 | echo App::$Output->write('Generate security cookies for debug panel'); |
| 217 | - $allCfg['debug']['cookie']['key'] = 'fdebug_' . Str::randomLatinNumeric(mt_rand(8, 32)); |
|
| 217 | + $allCfg['debug']['cookie']['key'] = 'fdebug_'.Str::randomLatinNumeric(mt_rand(8, 32)); |
|
| 218 | 218 | $allCfg['debug']['cookie']['value'] = Str::randomLatinNumeric(mt_rand(32, 128)); |
| 219 | 219 | |
| 220 | 220 | // write config data |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | public function actionImport($activeRecord) |
| 17 | 17 | { |
| 18 | - $importFile = root . '/Private/Database/Tables/' . ucfirst(strtolower($activeRecord)) . '.php'; |
|
| 18 | + $importFile = root.'/Private/Database/Tables/'.ucfirst(strtolower($activeRecord)).'.php'; |
|
| 19 | 19 | if (!File::exist($importFile)) { |
| 20 | - return App::$Output->write('Database model table not founded: ' . $activeRecord); |
|
| 20 | + return App::$Output->write('Database model table not founded: '.$activeRecord); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | @include($importFile); |
| 24 | - return App::$Output->write('Database table import runned: ' . $activeRecord); |
|
| 24 | + return App::$Output->write('Database table import runned: '.$activeRecord); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function actionImportAll($connectName = 'default') |
| 28 | 28 | { |
| 29 | - $importFile = root . '/Private/Database/install.php'; |
|
| 29 | + $importFile = root.'/Private/Database/install.php'; |
|
| 30 | 30 | if (!File::exist($importFile)) { |
| 31 | - return App::$Output->write('Import file is not exist: ' . $importFile); |
|
| 31 | + return App::$Output->write('Import file is not exist: '.$importFile); |
|
| 32 | 32 | } |
| 33 | 33 | @include($importFile); |
| 34 | 34 | return App::$Output->write('All database tables was imported!'); |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | throw new NativeException('Password is bad'); |
| 53 | 53 | } |
| 54 | 54 | echo "RoleId (1 = user, 3 = admin):"; |
| 55 | - $role = (int)App::$Input->read(); |
|
| 56 | - if (!Arr::in($role, [1,2,3])) { |
|
| 55 | + $role = (int) App::$Input->read(); |
|
| 56 | + if (!Arr::in($role, [1, 2, 3])) { |
|
| 57 | 57 | $role = 1; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $connector = new \elFinderConnector(new \elFinder([ |
| 33 | 33 | 'locale' => '', |
| 34 | 34 | 'roots' => [ |
| 35 | - ['driver' => 'LocalFileSystem', 'path' => root . '/upload/', 'URL' => App::$Alias->scriptUrl . '/upload/'] |
|
| 35 | + ['driver' => 'LocalFileSystem', 'path' => root.'/upload/', 'URL' => App::$Alias->scriptUrl.'/upload/'] |
|
| 36 | 36 | ] |
| 37 | 37 | ])); |
| 38 | 38 | |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | parent::before(); |
| 34 | 34 | $configs = AppRecord::getConfigs('app', 'Content'); |
| 35 | 35 | // prevent null-type config data |
| 36 | - if ((int)$configs['gallerySize'] > 0) { |
|
| 37 | - $this->maxSize = (int)$configs['gallerySize'] * 1024; |
|
| 36 | + if ((int) $configs['gallerySize'] > 0) { |
|
| 37 | + $this->maxSize = (int) $configs['gallerySize'] * 1024; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if ((int)$configs['galleryResize'] > 0) { |
|
| 41 | - $this->maxResize = (int)$configs['galleryResize']; |
|
| 40 | + if ((int) $configs['galleryResize'] > 0) { |
|
| 41 | + $this->maxResize = (int) $configs['galleryResize']; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // check if directory exist |
| 119 | - if (!Directory::exist('/upload/gallery/' . $id)) { |
|
| 120 | - Directory::create('/upload/gallery/' . $id); |
|
| 119 | + if (!Directory::exist('/upload/gallery/'.$id)) { |
|
| 120 | + Directory::create('/upload/gallery/'.$id); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // get file object |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | // check file size |
| 131 | 131 | if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) { |
| 132 | - throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => intval($this->maxSize/1024)])); |
|
| 132 | + throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => intval($this->maxSize / 1024)])); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // check file extension |
@@ -138,37 +138,37 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // create origin directory |
| 141 | - $originPath = '/upload/gallery/' . $id . '/orig/'; |
|
| 141 | + $originPath = '/upload/gallery/'.$id.'/orig/'; |
|
| 142 | 142 | if (!Directory::exist($originPath)) { |
| 143 | 143 | Directory::create($originPath); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // lets make a new file name |
| 147 | - $fileName = App::$Security->simpleHash($file->getFilename() . $file->getSize()); |
|
| 148 | - $fileNewName = $fileName . '.' . $file->guessExtension(); |
|
| 147 | + $fileName = App::$Security->simpleHash($file->getFilename().$file->getSize()); |
|
| 148 | + $fileNewName = $fileName.'.'.$file->guessExtension(); |
|
| 149 | 149 | // save file from tmp to gallery origin directory |
| 150 | 150 | $file->move(Normalize::diskFullPath($originPath), $fileNewName); |
| 151 | 151 | |
| 152 | 152 | // lets resize preview image for it |
| 153 | - $thumbPath = '/upload/gallery/' . $id . '/thumb/'; |
|
| 153 | + $thumbPath = '/upload/gallery/'.$id.'/thumb/'; |
|
| 154 | 154 | if (!Directory::exist($thumbPath)) { |
| 155 | 155 | Directory::create($thumbPath); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $thumb = new Image(); |
| 159 | - $thumb->setCacheDir(root . '/Private/Cache/images'); |
|
| 159 | + $thumb->setCacheDir(root.'/Private/Cache/images'); |
|
| 160 | 160 | |
| 161 | 161 | // open original file, resize it and save |
| 162 | - $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg'; |
|
| 163 | - $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName) |
|
| 162 | + $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg'; |
|
| 163 | + $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName) |
|
| 164 | 164 | ->cropResize($this->maxResize) |
| 165 | 165 | ->save($thumbSaveName, 'jpg', 90); |
| 166 | 166 | $thumb = null; |
| 167 | 167 | |
| 168 | 168 | // dont ask me why there is 2nd lvl array (can contains multiply items to frontend response) |
| 169 | 169 | $output = [ |
| 170 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
| 171 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName, |
|
| 170 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
| 171 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName, |
|
| 172 | 172 | 'name' => $fileNewName |
| 173 | 173 | ]; |
| 174 | 174 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | throw new NativeException('Permission denied'); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/'); |
|
| 200 | + $thumbDir = Normalize::diskFullPath('/upload/gallery/'.$id.'/orig/'); |
|
| 201 | 201 | if (!Directory::exist($thumbDir)) { |
| 202 | 202 | throw new NotFoundException('Nothing found'); |
| 203 | 203 | } |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | $fileExt = Str::lastIn($file, '.'); |
| 213 | 213 | $fileName = Str::sub($file, 0, -Str::length($fileExt)); |
| 214 | 214 | $output[] = [ |
| 215 | - 'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg', |
|
| 216 | - 'url' => '/upload/gallery/' . $id . '/orig/' . $file, |
|
| 215 | + 'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg', |
|
| 216 | + 'url' => '/upload/gallery/'.$id.'/orig/'.$file, |
|
| 217 | 217 | 'name' => $file |
| 218 | 218 | ]; |
| 219 | 219 | } |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // generate path |
| 248 | - $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg'; |
|
| 249 | - $full = '/upload/gallery/' . $id . '/orig/' . $file; |
|
| 248 | + $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg'; |
|
| 249 | + $full = '/upload/gallery/'.$id.'/orig/'.$file; |
|
| 250 | 250 | |
| 251 | 251 | // check if file exists and remove |
| 252 | 252 | if (File::exist($thumb) || File::exist($full)) { |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // check in cache |
| 49 | - if (MainApp::$Memory->get('profile.object.cache.' . $user_id) !== null) { |
|
| 50 | - return MainApp::$Memory->get('profile.object.cache.' . $user_id); |
|
| 49 | + if (MainApp::$Memory->get('profile.object.cache.'.$user_id) !== null) { |
|
| 50 | + return MainApp::$Memory->get('profile.object.cache.'.$user_id); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // find row |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $object = $profile->first(); |
| 62 | 62 | |
| 63 | - MainApp::$Memory->set('profile.object.cache.' . $user_id, $object); |
|
| 63 | + MainApp::$Memory->set('profile.object.cache.'.$user_id, $object); |
|
| 64 | 64 | return $object; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function getAvatarUrl($type = 'small') |
| 73 | 73 | { |
| 74 | - $default = '/upload/user/avatar/' . $type . '/default.jpg'; |
|
| 74 | + $default = '/upload/user/avatar/'.$type.'/default.jpg'; |
|
| 75 | 75 | if (!Arr::in($type, ['small', 'big', 'medium'])) { |
| 76 | - return MainApp::$Alias->scriptUrl . $default; |
|
| 76 | + return MainApp::$Alias->scriptUrl.$default; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $route = '/upload/user/avatar/' . $type . '/' . $this->user_id . '.jpg'; |
|
| 79 | + $route = '/upload/user/avatar/'.$type.'/'.$this->user_id.'.jpg'; |
|
| 80 | 80 | if (File::exist($route)) { |
| 81 | - return MainApp::$Alias->scriptUrl . $route . '?mtime=' . File::mTime($route); |
|
| 81 | + return MainApp::$Alias->scriptUrl.$route.'?mtime='.File::mTime($route); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - return MainApp::$Alias->scriptUrl . $default; |
|
| 84 | + return MainApp::$Alias->scriptUrl.$default; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $userNick = $this->nick; |
| 94 | 94 | if ($userNick === null || Str::likeEmpty($userNick)) { |
| 95 | - $userNick = 'id' . $this->id; |
|
| 95 | + $userNick = 'id'.$this->id; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $userNick; |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public static function getByPath($path = '') |
| 29 | 29 | { |
| 30 | - if (MainApp::$Memory->get('cache.content.category.path.' . $path) !== null) { |
|
| 31 | - return MainApp::$Memory->get('cache.content.category.path.' . $path); |
|
| 30 | + if (MainApp::$Memory->get('cache.content.category.path.'.$path) !== null) { |
|
| 31 | + return MainApp::$Memory->get('cache.content.category.path.'.$path); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $record = self::where('path', '=', $path)->first(); |
| 35 | - MainApp::$Memory->set('cache.content.category.path.' . $path, $record); |
|
| 35 | + MainApp::$Memory->set('cache.content.category.path.'.$path, $record); |
|
| 36 | 36 | return $record; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public static function getById($id) |
| 45 | 45 | { |
| 46 | - if (MainApp::$Memory->get('cache.content.category.id.' . $id) !== null) { |
|
| 47 | - return MainApp::$Memory->get('cache.content.category.id.' . $id); |
|
| 46 | + if (MainApp::$Memory->get('cache.content.category.id.'.$id) !== null) { |
|
| 47 | + return MainApp::$Memory->get('cache.content.category.id.'.$id); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $record = self::find($id); |
| 51 | - MainApp::$Memory->set('cache.content.category.id.' . $id, $record); |
|
| 51 | + MainApp::$Memory->set('cache.content.category.id.'.$id, $record); |
|
| 52 | 52 | return $record; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | } else { |
| 83 | 83 | // set level marker based on slashes count in pathway |
| 84 | 84 | $slashCount = Str::entryCount($path, '/'); |
| 85 | - for ($i=-1; $i <= $slashCount; $i++) { |
|
| 85 | + for ($i = -1; $i <= $slashCount; $i++) { |
|
| 86 | 86 | $title .= '--'; |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | // add canonical title from db |
| 90 | - $title .= ' ' . Serialize::getDecodeLocale($data->title); |
|
| 90 | + $title .= ' '.Serialize::getDecodeLocale($data->title); |
|
| 91 | 91 | // set response as array [id => title, ... ] |
| 92 | 92 | $response[$data->id] = $title; |
| 93 | 93 | } |