@@ -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 | |
@@ -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 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // build path and check is file exists on disk |
| 98 | - $path = '/upload/gallery/' . $this->id . '/orig/' . $pName; |
|
| 98 | + $path = '/upload/gallery/'.$this->id.'/orig/'.$pName; |
|
| 99 | 99 | if (!File::exist($path)) { |
| 100 | 100 | return null; |
| 101 | 101 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | // remove extension, thumbs always in jpeg ;D |
| 118 | 118 | $pName = Str::cleanExtension($pName); |
| 119 | - $path = '/upload/gallery/' . $this->id . '/thumb/' . $pName . '.jpg'; |
|
| 119 | + $path = '/upload/gallery/'.$this->id.'/thumb/'.$pName.'.jpg'; |
|
| 120 | 120 | |
| 121 | 121 | if (!File::exist($path)) { |
| 122 | 122 | return null; |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | foreach (App::$Translate->getAvailableLangs() as $lang) { |
| 34 | 34 | $items[] = [ |
| 35 | 35 | 'type' => 'link', |
| 36 | - 'link' => App::$Alias->baseUrlNoLang . '/' . $lang . App::$Request->getPathInfo(), |
|
| 36 | + 'link' => App::$Alias->baseUrlNoLang.'/'.$lang.App::$Request->getPathInfo(), |
|
| 37 | 37 | 'text' => '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="flag flag-'.$lang.'" />', |
| 38 | 38 | 'html' => true, |
| 39 | 39 | '!secure' => true |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $uriRequest = $_SERVER['REQUEST_URI']; |
| 13 | 13 | |
| 14 | 14 | // get configs to prepare posible route to switch environment |
| 15 | -$configs = require(root . '/Private/Config/Default.php'); |
|
| 15 | +$configs = require(root.'/Private/Config/Default.php'); |
|
| 16 | 16 | // remove base path |
| 17 | 17 | $uriRequest = substr($uriRequest, strlen($configs['basePath'])); |
| 18 | 18 | $uriArray = explode('/', $uriRequest); |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | $uriLoader = ucfirst(strtolower(str_replace('.', '', $uriLoader))); |
| 24 | 24 | |
| 25 | 25 | // if loader of interface is available - require it |
| 26 | -if (in_array($uriLoader, $loaderList, true) && file_exists(root . '/Loader/' . $uriLoader . '/index.php')) { |
|
| 27 | - require_once (root . '/Loader/' . $uriLoader . '/index.php'); |
|
| 26 | +if (in_array($uriLoader, $loaderList, true) && file_exists(root.'/Loader/'.$uriLoader.'/index.php')) { |
|
| 27 | + require_once (root.'/Loader/'.$uriLoader.'/index.php'); |
|
| 28 | 28 | } else { // else - try to load default interface |
| 29 | - require_once (root . '/Loader/Front/index.php'); |
|
| 29 | + require_once (root.'/Loader/Front/index.php'); |
|
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -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 App extends Ffcms\Console\App {} |
| 12 | 12 | |
@@ -18,5 +18,5 @@ discard block |
||
| 18 | 18 | // display output |
| 19 | 19 | echo \App::run(); |
| 20 | 20 | } catch (Exception $e) { |
| 21 | - echo $e . "\n"; |
|
| 21 | + echo $e."\n"; |
|
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |