@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function __construct($query, $limit = 10) |
27 | 27 | { |
28 | 28 | $this->query = $query; |
29 | - $this->limit = (int)$limit; |
|
29 | + $this->limit = (int) $limit; |
|
30 | 30 | if ($this->limit < 1) { |
31 | 31 | $this->limit = 1; |
32 | 32 | } |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | $instance = new AbstractSearchResult(); |
62 | 62 | $instance->setTitle(App::$Translate->get('Search', 'Comment on the page')); |
63 | 63 | $instance->setSnippet($snippet); |
64 | - $instance->setUri($item->pathway . '#comments-list'); |
|
64 | + $instance->setUri($item->pathway.'#comments-list'); |
|
65 | 65 | $instance->setDate($item->created_at); |
66 | - $instance->setRelevance((int)$item->relevance); |
|
66 | + $instance->setRelevance((int) $item->relevance); |
|
67 | 67 | |
68 | 68 | // add instance to result set |
69 | 69 | $result[] = $instance; |
@@ -30,11 +30,11 @@ |
||
30 | 30 | 3 => ['text' => $user->login], |
31 | 31 | 4 => ['text' => $user->getRole()->name], |
32 | 32 | 5 => ['text' => Date::convertToDatetime($user->created_at, Date::FORMAT_TO_DAY)], |
33 | - 6 => ['text' => Url::link(['user/update', $user->id], '<i class="fa fa-pencil fa-lg"></i>') . |
|
33 | + 6 => ['text' => Url::link(['user/update', $user->id], '<i class="fa fa-pencil fa-lg"></i>'). |
|
34 | 34 | Url::link(['user/delete', $user->id], ' <i class="fa fa-trash-o fa-lg"></i>'), |
35 | 35 | 'html' => true, 'property' => ['class' => 'text-center']], |
36 | 36 | 'property' => [ |
37 | - 'class' => 'checkbox-row' . ($user->approve_token != '0' ? ' alert-warning' : null) |
|
37 | + 'class' => 'checkbox-row'.($user->approve_token != '0' ? ' alert-warning' : null) |
|
38 | 38 | ] |
39 | 39 | ]; |
40 | 40 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $results = $model->getRelevanceSortedResult(); |
31 | 31 | |
32 | 32 | if (!\Ffcms\Core\Helper\Type\Obj::isArray($results) || count($results) < 1) { |
33 | - echo '<p class="alert alert-warning">' . __('Matches not founded') . '</p>'; |
|
33 | + echo '<p class="alert alert-warning">'.__('Matches not founded').'</p>'; |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | ?> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | <div class="col-md-12"> |
41 | 41 | <div class="search-result"> |
42 | 42 | <div class="h4"> |
43 | - <a href="<?= \App::$Alias->baseUrl . $item['uri'] ?>"><?= $model->highlightText($item['title'], 'span', ['class' => 'search-highlight']) ?></a> |
|
43 | + <a href="<?= \App::$Alias->baseUrl.$item['uri'] ?>"><?= $model->highlightText($item['title'], 'span', ['class' => 'search-highlight']) ?></a> |
|
44 | 44 | <small class="pull-right"><?= $item['date'] ?></small> |
45 | 45 | </div> |
46 | 46 | <small><?= $model->highlightText($item['snippet'], 'span', ['class' => 'search-highlight']) ?>...</small> |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $class = 'label-danger'; |
66 | 66 | $tooltip = __('Location: %loc%. Required permissions: +rw', ['loc' => $dir]); |
67 | 67 | } |
68 | - echo '<span class="label ' . $class . '" data-toggle="tooltip" title="' . $tooltip . '">' . $dir . '</span> '; |
|
68 | + echo '<span class="label '.$class.'" data-toggle="tooltip" title="'.$tooltip.'">'.$dir.'</span> '; |
|
69 | 69 | } |
70 | 70 | ?> |
71 | 71 | <hr /> |
@@ -4,11 +4,9 @@ |
||
4 | 4 | |
5 | 5 | use Apps\ActiveRecord\Profile; |
6 | 6 | use Apps\ActiveRecord\User; |
7 | -use Apps\Model\Front\User\FormLogin; |
|
8 | 7 | use Ffcms\Core\App; |
9 | 8 | use Ffcms\Core\Arch\Model; |
10 | 9 | use Ffcms\Core\Helper\Type\Str; |
11 | -use Ffcms\Core\Interfaces\iUser; |
|
12 | 10 | |
13 | 11 | class FormRegister extends Model |
14 | 12 | { |
@@ -44,8 +44,8 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | - * Parse user identifier to attributes |
|
48 | - */ |
|
47 | + * Parse user identifier to attributes |
|
48 | + */ |
|
49 | 49 | public function before() |
50 | 50 | { |
51 | 51 | // set unique user id from provider response |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct($provider, $identity) |
40 | 40 | { |
41 | - $this->_provider_name = (string)$provider; |
|
41 | + $this->_provider_name = (string) $provider; |
|
42 | 42 | $this->_identity = $identity; |
43 | 43 | parent::__construct(false); |
44 | 44 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | // set birthday if available |
127 | 127 | if ($this->_identity->birthDay !== null && $this->_identity->birthMonth !== null && $this->_identity->birthYear !== null) { |
128 | - $profile->birthday = $this->_identity->birthYear . '-' . $this->_identity->birthMonth . '-' . $this->_identity->birthDay; |
|
128 | + $profile->birthday = $this->_identity->birthYear.'-'.$this->_identity->birthMonth.'-'.$this->_identity->birthDay; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // try to parse avatar from remote service |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | protected function parseAvatar($url, $userId) |
149 | 149 | { |
150 | 150 | // check if user is defined |
151 | - if ((int)$userId < 1) { |
|
151 | + if ((int) $userId < 1) { |
|
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | // write image to filesystem |
168 | - $imagePath = '/upload/user/avatar/original/' . $userId . '.' . $imageExtension; |
|
168 | + $imagePath = '/upload/user/avatar/original/'.$userId.'.'.$imageExtension; |
|
169 | 169 | $write = File::write($imagePath, $imageContent); |
170 | 170 | if ($write === false) { |
171 | 171 | return; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | // try to write and resize file |
175 | 175 | try { |
176 | - $fileObject = new FileObject(root . $imagePath); |
|
176 | + $fileObject = new FileObject(root.$imagePath); |
|
177 | 177 | $avatarUpload = new FormAvatarUpload(); |
178 | 178 | $avatarUpload->resizeAndSave($fileObject, $userId, 'small'); |
179 | 179 | $avatarUpload->resizeAndSave($fileObject, $userId, 'medium'); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | die(); |
7 | 7 | } |
8 | 8 | |
9 | -require_once (root . '/Loader/Autoload.php'); |
|
9 | +require_once (root.'/Loader/Autoload.php'); |
|
10 | 10 | |
11 | 11 | class Console extends Ffcms\Console\Console {} |
12 | 12 | |
@@ -18,5 +18,5 @@ discard block |
||
18 | 18 | // display output |
19 | 19 | echo \Console::run(); |
20 | 20 | } catch (Exception $e) { |
21 | - echo $e->getMessage() . "\n"; |
|
21 | + echo $e->getMessage()."\n"; |
|
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function actionImport($activeRecord) |
26 | 26 | { |
27 | - $importFile = root . '/Private/Database/Tables/' . ucfirst(strtolower($activeRecord)) . '.php'; |
|
27 | + $importFile = root.'/Private/Database/Tables/'.ucfirst(strtolower($activeRecord)).'.php'; |
|
28 | 28 | if (!File::exist($importFile)) { |
29 | - return 'Database model table not founded: ' . $activeRecord; |
|
29 | + return 'Database model table not founded: '.$activeRecord; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | @include($importFile); |
33 | - return 'Database table import done: ' . $activeRecord; |
|
33 | + return 'Database table import done: '.$activeRecord; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function actionImportAll($connectName = 'default') |
42 | 42 | { |
43 | - $importFile = root . '/Private/Database/install.php'; |
|
43 | + $importFile = root.'/Private/Database/install.php'; |
|
44 | 44 | if (!File::exist($importFile)) { |
45 | - return 'Import file is not exist: ' . $importFile; |
|
45 | + return 'Import file is not exist: '.$importFile; |
|
46 | 46 | } |
47 | 47 | @include($importFile); |
48 | 48 | return 'All database tables was imported!'; |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | throw new NativeException('Password is bad'); |
72 | 72 | } |
73 | 73 | echo "RoleId (1 = onlyread, 2 = user, 3 = moderator, 4 = admin):"; |
74 | - $role = (int)Console::$Input->read(); |
|
75 | - if (!Arr::in($role, [1,2,3,4])) { |
|
74 | + $role = (int) Console::$Input->read(); |
|
75 | + if (!Arr::in($role, [1, 2, 3, 4])) { |
|
76 | 76 | $role = 2; |
77 | 77 | } |
78 | 78 |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function actionHelp() |
28 | 28 | { |
29 | - $text = "You are using FFCMS console application." . PHP_EOL; |
|
30 | - $text .= "This application support next basic commands:" . PHP_EOL; |
|
31 | - $text .= "\t main/info - show info about CMS" . PHP_EOL; |
|
32 | - $text .= "\t main/install - install FFCMS from console line." . PHP_EOL; |
|
33 | - $text .= "\t main/update - update package to current minor version if available." . PHP_EOL; |
|
34 | - $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment." . PHP_EOL; |
|
35 | - $text .= "\t main/buildperms - build and update permissions map for applications." . PHP_EOL; |
|
36 | - $text .= "\t create/model workground/modelName - create model carcase default." . PHP_EOL; |
|
37 | - $text .= "\t create/ar activeRecordName - create active record table and model." . PHP_EOL; |
|
38 | - $text .= "\t create/controller workground/controllerName - create default controller carcase." . PHP_EOL; |
|
39 | - $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase." . PHP_EOL; |
|
40 | - $text .= "\t db/import activeRecordName - import to database single schema from ar model." . PHP_EOL; |
|
41 | - $text .= "\t db/importAll - import all active record tables to database." . PHP_EOL; |
|
42 | - $text .= "\t db/adduser - add new user into database." . PHP_EOL; |
|
29 | + $text = "You are using FFCMS console application.".PHP_EOL; |
|
30 | + $text .= "This application support next basic commands:".PHP_EOL; |
|
31 | + $text .= "\t main/info - show info about CMS".PHP_EOL; |
|
32 | + $text .= "\t main/install - install FFCMS from console line.".PHP_EOL; |
|
33 | + $text .= "\t main/update - update package to current minor version if available.".PHP_EOL; |
|
34 | + $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment.".PHP_EOL; |
|
35 | + $text .= "\t main/buildperms - build and update permissions map for applications.".PHP_EOL; |
|
36 | + $text .= "\t create/model workground/modelName - create model carcase default.".PHP_EOL; |
|
37 | + $text .= "\t create/ar activeRecordName - create active record table and model.".PHP_EOL; |
|
38 | + $text .= "\t create/controller workground/controllerName - create default controller carcase.".PHP_EOL; |
|
39 | + $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase.".PHP_EOL; |
|
40 | + $text .= "\t db/import activeRecordName - import to database single schema from ar model.".PHP_EOL; |
|
41 | + $text .= "\t db/importAll - import all active record tables to database.".PHP_EOL; |
|
42 | + $text .= "\t db/adduser - add new user into database.".PHP_EOL; |
|
43 | 43 | return $text; |
44 | 44 | } |
45 | 45 | |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function actionInfo() |
51 | 51 | { |
52 | - $text = "Information about FFCMS package and environment:" . PHP_EOL; |
|
53 | - $text .= "\t PHP version: " . phpversion() . PHP_EOL; |
|
54 | - $text .= "\t Dist path: " . root . PHP_EOL; |
|
55 | - $text .= "\t Used version: " . Console::$Properties->version['num'] . ' [build: ' . Console::$Properties->version['date'] . ']' . PHP_EOL; |
|
56 | - $text .= "Information about FFCMS cmf packages:" . PHP_EOL; |
|
52 | + $text = "Information about FFCMS package and environment:".PHP_EOL; |
|
53 | + $text .= "\t PHP version: ".phpversion().PHP_EOL; |
|
54 | + $text .= "\t Dist path: ".root.PHP_EOL; |
|
55 | + $text .= "\t Used version: ".Console::$Properties->version['num'].' [build: '.Console::$Properties->version['date'].']'.PHP_EOL; |
|
56 | + $text .= "Information about FFCMS cmf packages:".PHP_EOL; |
|
57 | 57 | |
58 | 58 | $composerInfo = File::read('/composer.lock'); |
59 | 59 | if (false !== $composerInfo) { |
60 | 60 | $jsonInfo = json_decode($composerInfo); |
61 | 61 | foreach ($jsonInfo->packages as $item) { |
62 | - $text .= "\t Package: " . $item->name . ' => ' . $item->version . PHP_EOL; |
|
62 | + $text .= "\t Package: ".$item->name.' => '.$item->version.PHP_EOL; |
|
63 | 63 | } |
64 | 64 | } else { |
65 | 65 | $text .= "\t Composer is never be used - no information available."; |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | preg_match_all('/public function action(\w*?)\(/', $byte, $matches); // matches[0] contains all methods ;) |
96 | 96 | if (Obj::isArray($matches[1]) && count($matches[1]) > 0) { |
97 | 97 | foreach ($matches[1] as $perm) { |
98 | - $permissions[] = 'Admin/' . $className . '/' . $perm; |
|
98 | + $permissions[] = 'Admin/'.$className.'/'.$perm; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | // prepare save string |
104 | - $stringSave = "<?php \n\nreturn " . var_export($permissions, true) . ';'; |
|
104 | + $stringSave = "<?php \n\nreturn ".var_export($permissions, true).';'; |
|
105 | 105 | File::write('/Private/Config/Permissions.php', $stringSave); |
106 | 106 | |
107 | - return 'Permissions configuration is successful updated! Founded permissions: ' . count($permissions); |
|
107 | + return 'Permissions configuration is successful updated! Founded permissions: '.count($permissions); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | if (Directory::exist($obj)) { |
119 | 119 | Directory::recursiveChmod($obj, 0777); |
120 | 120 | } elseif (File::exist($obj)) { |
121 | - chmod(root . $obj, 0777); |
|
121 | + chmod(root.$obj, 0777); |
|
122 | 122 | } else { |
123 | - $errors .= Console::$Output->write('Filesystem object is not founded: ' . $obj); |
|
123 | + $errors .= Console::$Output->write('Filesystem object is not founded: '.$obj); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -154,38 +154,38 @@ discard block |
||
154 | 154 | |
155 | 155 | // database config from input |
156 | 156 | echo Console::$Output->writeHeader('Database connection configuration'); |
157 | - echo 'Driver(default:' . $config['driver'] . '):'; |
|
157 | + echo 'Driver(default:'.$config['driver'].'):'; |
|
158 | 158 | $dbDriver = Console::$Input->read(); |
159 | 159 | if (Arr::in($dbDriver, ['mysql', 'pgsql', 'sqlite'])) { |
160 | 160 | $newConfig['driver'] = $dbDriver; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // for sqlite its would be a path |
164 | - echo 'Host(default:' . $config['host'] . '):'; |
|
164 | + echo 'Host(default:'.$config['host'].'):'; |
|
165 | 165 | $dbHost = Console::$Input->read(); |
166 | 166 | if (!Str::likeEmpty($dbHost)) { |
167 | 167 | $newConfig['host'] = $dbHost; |
168 | 168 | } |
169 | 169 | |
170 | - echo 'Database name(default:' . $config['database'] . '):'; |
|
170 | + echo 'Database name(default:'.$config['database'].'):'; |
|
171 | 171 | $dbName = Console::$Input->read(); |
172 | 172 | if (!Str::likeEmpty($dbName)) { |
173 | 173 | $newConfig['database'] = $dbName; |
174 | 174 | } |
175 | 175 | |
176 | - echo 'User(default:' . $config['username'] . '):'; |
|
176 | + echo 'User(default:'.$config['username'].'):'; |
|
177 | 177 | $dbUser = Console::$Input->read(); |
178 | 178 | if (!Str::likeEmpty($dbUser)) { |
179 | 179 | $newConfig['username'] = $dbUser; |
180 | 180 | } |
181 | 181 | |
182 | - echo 'Password(default:' . $config['password'] . '):'; |
|
182 | + echo 'Password(default:'.$config['password'].'):'; |
|
183 | 183 | $dbPwd = Console::$Input->read(); |
184 | 184 | if (!Str::likeEmpty($dbPwd)) { |
185 | 185 | $newConfig['password'] = $dbPwd; |
186 | 186 | } |
187 | 187 | |
188 | - echo 'Table prefix(default:' . $config['prefix'] . '):'; |
|
188 | + echo 'Table prefix(default:'.$config['prefix'].'):'; |
|
189 | 189 | $dbPrefix = Console::$Input->read(); |
190 | 190 | if (!Str::likeEmpty($dbPrefix)) { |
191 | 191 | $newConfig['prefix'] = $dbPrefix; |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | try { |
199 | 199 | Console::$Database->connection('install')->getDatabaseName(); |
200 | 200 | } catch (\Exception $e) { |
201 | - return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: ' . $e->getMessage(); |
|
201 | + return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: '.$e->getMessage(); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | // autoload isn't work here |
205 | - include(root . '/Apps/Controller/Console/Db.php'); |
|
205 | + include(root.'/Apps/Controller/Console/Db.php'); |
|
206 | 206 | |
207 | 207 | // import db data |
208 | 208 | $dbController = new DbController(); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | // set website send from email from input |
212 | 212 | $emailConfig = Console::$Properties->get('adminEmail'); |
213 | - echo 'Website sendFrom email(default: ' . $emailConfig . '):'; |
|
213 | + echo 'Website sendFrom email(default: '.$emailConfig.'):'; |
|
214 | 214 | $email = Console::$Input->read(); |
215 | 215 | if (!Str::isEmail($email)) { |
216 | 216 | $email = $emailConfig; |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | $allCfg['database'] = $dbConfigs; |
224 | 224 | $allCfg['adminEmail'] = $email; |
225 | 225 | echo Console::$Output->write('Generate password salt for BLOWFISH crypt'); |
226 | - $allCfg['passwordSalt'] = '$2a$07$' . Str::randomLatinNumeric(mt_rand(21, 30)) . '$'; |
|
226 | + $allCfg['passwordSalt'] = '$2a$07$'.Str::randomLatinNumeric(mt_rand(21, 30)).'$'; |
|
227 | 227 | echo Console::$Output->write('Generate security cookies for debug panel'); |
228 | - $allCfg['debug']['cookie']['key'] = 'fdebug_' . Str::randomLatinNumeric(mt_rand(8, 32)); |
|
228 | + $allCfg['debug']['cookie']['key'] = 'fdebug_'.Str::randomLatinNumeric(mt_rand(8, 32)); |
|
229 | 229 | $allCfg['debug']['cookie']['value'] = Str::randomLatinNumeric(mt_rand(32, 128)); |
230 | 230 | |
231 | 231 | // write config data |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Apps\Controller\Console; |
4 | 4 | |
5 | -use Apps\ActiveRecord\App; |
|
6 | 5 | use Ffcms\Console\Console; |
7 | 6 | use Ffcms\Core\Exception\NativeException; |
8 | 7 | use Ffcms\Core\Helper\FileSystem\Directory; |