@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $platform = trim(Config::getInstance()->get('platform.name', 'PSFS')); |
| 36 | 36 | header('HTTP/1.1 401 Unauthorized'); |
| 37 | - header('WWW-Authenticate: Basic Realm="' . $platform . '"'); |
|
| 37 | + header('WWW-Authenticate: Basic Realm="'.$platform.'"'); |
|
| 38 | 38 | echo t('Zona restringida'); |
| 39 | 39 | exit(); |
| 40 | 40 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $admin['class'] = 'primary'; |
| 77 | 77 | break; |
| 78 | 78 | } |
| 79 | - } else { |
|
| 79 | + }else { |
|
| 80 | 80 | $admin['class'] = 'primary'; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function createStructureModule($module, $force = false, $type = "", $apiClass = "") |
| 40 | 40 | { |
| 41 | - $modPath = CORE_DIR . DIRECTORY_SEPARATOR; |
|
| 41 | + $modPath = CORE_DIR.DIRECTORY_SEPARATOR; |
|
| 42 | 42 | $module = ucfirst($module); |
| 43 | 43 | $this->createModulePath($module, $modPath); |
| 44 | 44 | $this->createModulePathTree($module, $modPath); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '') |
| 61 | 61 | { |
| 62 | - $modulePath = $modPath . $module; |
|
| 62 | + $modulePath = $modPath.$module; |
|
| 63 | 63 | $this->generateControllerTemplate($module, $modulePath, $force, $controllerType); |
| 64 | 64 | $this->generateServiceTemplate($module, $modulePath, $force); |
| 65 | 65 | $this->genereateAutoloaderTemplate($module, $modulePath, $force); |
@@ -87,28 +87,28 @@ discard block |
||
| 87 | 87 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 88 | 88 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 89 | 89 | "class" => $class, |
| 90 | - "controllerType" => $class . "Base", |
|
| 90 | + "controllerType" => $class."Base", |
|
| 91 | 91 | "is_base" => false |
| 92 | 92 | )); |
| 93 | - $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
| 94 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
| 93 | + $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
| 94 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
| 95 | 95 | |
| 96 | 96 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
| 97 | 97 | "module" => $module, |
| 98 | 98 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 99 | 99 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 100 | - "class" => $class . "Base", |
|
| 100 | + "class" => $class."Base", |
|
| 101 | 101 | "service" => $class, |
| 102 | 102 | "controllerType" => $controllerType, |
| 103 | 103 | "is_base" => true, |
| 104 | 104 | "domain" => $class, |
| 105 | 105 | )); |
| 106 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
| 107 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
| 106 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
| 107 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
| 108 | 108 | |
| 109 | - $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php"; |
|
| 109 | + $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php"; |
|
| 110 | 110 | $test = true; |
| 111 | - if(!file_exists($filename)) { |
|
| 111 | + if (!file_exists($filename)) { |
|
| 112 | 112 | $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array( |
| 113 | 113 | "module" => $module, |
| 114 | 114 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | private function createModuleModels($module, $path) |
| 129 | 129 | { |
| 130 | - $modulePath = $path . $module; |
|
| 131 | - $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $modulePath); |
|
| 130 | + $modulePath = $path.$module; |
|
| 131 | + $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $modulePath); |
|
| 132 | 132 | |
| 133 | 133 | $configGenerator = $this->getConfigGenerator($modulePath); |
| 134 | 134 | |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array( |
| 139 | 139 | "module" => $module, |
| 140 | 140 | )); |
| 141 | - $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" . |
|
| 142 | - DIRECTORY_SEPARATOR . "config.php", true); |
|
| 141 | + $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config". |
|
| 142 | + DIRECTORY_SEPARATOR."config.php", true); |
|
| 143 | 143 | Logger::log("Generado config genérico para propel"); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "") |
| 155 | 155 | { |
| 156 | 156 | $created = true; |
| 157 | - $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 158 | - $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
| 157 | + $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 158 | + $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api'; |
|
| 159 | 159 | if (file_exists($modelPath)) { |
| 160 | 160 | $dir = dir($modelPath); |
| 161 | 161 | $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | //Generamos el fichero de configuración |
| 174 | 174 | Logger::log("Generamos fichero vacío de configuración"); |
| 175 | 175 | return $this->writeTemplateToFile("<?php\n\t", |
| 176 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
| 176 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
| 177 | 177 | $force); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | "db" => $this->config->get("db_name"), |
| 195 | 195 | )); |
| 196 | 196 | return $this->writeTemplateToFile($schema, |
| 197 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
| 197 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
| 198 | 198 | $force); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
| 213 | 213 | )); |
| 214 | 214 | return $this->writeTemplateToFile($buildProperties, |
| 215 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php", |
|
| 215 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php", |
|
| 216 | 216 | $force); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | "module" => $module, |
| 231 | 231 | )); |
| 232 | 232 | return $this->writeTemplateToFile($index, |
| 233 | - $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
| 233 | + $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
| 234 | 234 | $force); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | )); |
| 261 | 261 | |
| 262 | 262 | return $this->writeTemplateToFile($controller, |
| 263 | - $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 263 | + $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | /** |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | "package" => $package, |
| 286 | 286 | )); |
| 287 | 287 | |
| 288 | - return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 288 | + return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -302,15 +302,15 @@ discard block |
||
| 302 | 302 | $base = $dir->path; |
| 303 | 303 | while ($file = $dir->read()) { |
| 304 | 304 | if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) { |
| 305 | - if (is_dir($base . DIRECTORY_SEPARATOR . $file)) { |
|
| 306 | - $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file); |
|
| 307 | - } else if (!preg_match('/Query\.php$/i', $file) |
|
| 305 | + if (is_dir($base.DIRECTORY_SEPARATOR.$file)) { |
|
| 306 | + $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file); |
|
| 307 | + }else if (!preg_match('/Query\.php$/i', $file) |
|
| 308 | 308 | && !preg_match('/I18n\.php$/i', $file) |
| 309 | 309 | && preg_match('/\.php$/i', $file) |
| 310 | 310 | ) { |
| 311 | 311 | $filename = str_replace(".php", "", $file); |
| 312 | 312 | $this->log->addLog("Generamos Api BASES para {$filename}"); |
| 313 | - if($this->checkIfIsModel($module, $filename, $package)) { |
|
| 313 | + if ($this->checkIfIsModel($module, $filename, $package)) { |
|
| 314 | 314 | $this->createApiBaseFile($module, $apiPath, $filename, $apiClass, $package); |
| 315 | 315 | $this->createApi($module, $apiPath, $force, $filename, $package); |
| 316 | 316 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $parts[] = $package; |
| 334 | 334 | } |
| 335 | 335 | $parts[] = $filename; |
| 336 | - $namespace = '\\' . implode('\\', $parts); |
|
| 336 | + $namespace = '\\'.implode('\\', $parts); |
|
| 337 | 337 | $reflectorClass = new \ReflectionClass($namespace); |
| 338 | 338 | $isModel = $reflectorClass->isInstantiable(); |
| 339 | 339 | return $isModel; |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | { |
| 119 | 119 | if ($this->hasInternet()) { |
| 120 | 120 | $this->markTestIncomplete('Pending make tests'); |
| 121 | - } else { |
|
| 121 | + }else { |
|
| 122 | 122 | $this->assertTrue(true, 'Not connected to internet'); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | use PSFS\base\types\helpers\FileHelper; |
| 9 | 9 | use PSFS\base\types\helpers\GeneratorHelper; |
| 10 | 10 | |
| 11 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
| 11 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Class DispatcherTest |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | class ConfigTest extends TestCase |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - const CONFIG_BACKUP_PATH = CONFIG_DIR . DIRECTORY_SEPARATOR . 'config.json.bak'; |
|
| 20 | + const CONFIG_BACKUP_PATH = CONFIG_DIR.DIRECTORY_SEPARATOR.'config.json.bak'; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Creates an instance of Config |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | // Check if config can create the config dir |
| 65 | 65 | $dirtmp = uniqid('test', true); |
| 66 | - GeneratorHelper::createDir(CONFIG_DIR . DIRECTORY_SEPARATOR . $dirtmp); |
|
| 67 | - $this->assertFileExists(CONFIG_DIR . DIRECTORY_SEPARATOR . $dirtmp, 'Can\'t create test dir'); |
|
| 68 | - @rmdir(CONFIG_DIR . DIRECTORY_SEPARATOR . $dirtmp); |
|
| 66 | + GeneratorHelper::createDir(CONFIG_DIR.DIRECTORY_SEPARATOR.$dirtmp); |
|
| 67 | + $this->assertFileExists(CONFIG_DIR.DIRECTORY_SEPARATOR.$dirtmp, 'Can\'t create test dir'); |
|
| 68 | + @rmdir(CONFIG_DIR.DIRECTORY_SEPARATOR.$dirtmp); |
|
| 69 | 69 | |
| 70 | 70 | // Check if platform is configured |
| 71 | 71 | $this->assertTrue(is_bool($config->getDebugMode())); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | ]); |
| 138 | 138 | |
| 139 | 139 | $this->assertEquals(Config::getParam('test'), $test_data, 'The value is not the same'); |
| 140 | - $this->assertEquals(Config::getParam('test' . uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
| 140 | + $this->assertEquals(Config::getParam('test'.uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
| 141 | 141 | $this->assertEquals(Config::getParam('test', null, 'test'), $test_data, 'The value is not the same without module value'); |
| 142 | 142 | |
| 143 | 143 | $test_data2 = microtime(true); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | 'value' => [$test_data2], |
| 148 | 148 | ]); |
| 149 | 149 | $this->assertEquals(Config::getParam('test'), $test_data, 'The value is not the same'); |
| 150 | - $this->assertEquals(Config::getParam('test' . uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
| 150 | + $this->assertEquals(Config::getParam('test'.uniqid('t', true), $test_data), $test_data, 'The value is not the same with default value'); |
|
| 151 | 151 | $this->assertEquals(Config::getParam('test', null, 'test'), $test_data2, 'The value is not the same with module value'); |
| 152 | 152 | $this->assertEquals(Config::getParam('test', null, 'testa'), $test_data, 'The value is not the same with module value and default value'); |
| 153 | 153 | $this->assertEquals(Config::getParam('test', $test_data2, 'testa'), $test_data, 'The value is not the same with module value and default value'); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $security = $this->getInstance(); |
| 72 | 72 | $security->saveUser($user); |
| 73 | 73 | |
| 74 | - $this->assertFileExists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', 'Error trying to save admins'); |
|
| 74 | + $this->assertFileExists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', 'Error trying to save admins'); |
|
| 75 | 75 | $this->assertNull($security->getUser()); |
| 76 | 76 | $this->assertNull($security->getAdmin()); |
| 77 | 77 | $this->assertTrue($security->canDo('something')); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->assertFalse($security->checkAdmin(uniqid('test', true), uniqid('error', true), true), 'Error checking admin user'); |
| 84 | 84 | $this->assertNull($security->getAdmin(), 'Wrong admin parser'); |
| 85 | 85 | |
| 86 | - $_COOKIE[substr(Security::MANAGER_ID_TOKEN, 0, 8)] = base64_encode($user['username'] . ':' . $user['password']); |
|
| 86 | + $_COOKIE[substr(Security::MANAGER_ID_TOKEN, 0, 8)] = base64_encode($user['username'].':'.$user['password']); |
|
| 87 | 87 | Request::getInstance()->init(); |
| 88 | 88 | $this->assertTrue($security->checkAdmin(null, null, true), 'An error occurred verifying the admin user'); |
| 89 | 89 | AdminServices::setTest(true); |
@@ -22,23 +22,23 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | // try to create html folders |
| 24 | 24 | GeneratorHelper::createDir(WEB_DIR); |
| 25 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'css'); |
|
| 26 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'js'); |
|
| 27 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'media'); |
|
| 28 | - GeneratorHelper::createDir(WEB_DIR . DIRECTORY_SEPARATOR . 'font'); |
|
| 25 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'css'); |
|
| 26 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'js'); |
|
| 27 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'media'); |
|
| 28 | + GeneratorHelper::createDir(WEB_DIR.DIRECTORY_SEPARATOR.'font'); |
|
| 29 | 29 | |
| 30 | 30 | // Checks if exists all the folders |
| 31 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'css', 'css folder not exists'); |
|
| 32 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'js', 'js folder not exists'); |
|
| 33 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'media', 'media folder not exists'); |
|
| 34 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'font', 'font folder not exists'); |
|
| 31 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'css', 'css folder not exists'); |
|
| 32 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'js', 'js folder not exists'); |
|
| 33 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'media', 'media folder not exists'); |
|
| 34 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'font', 'font folder not exists'); |
|
| 35 | 35 | |
| 36 | 36 | GeneratorHelper::clearDocumentRoot(); |
| 37 | 37 | // Checks if not exists all the folders |
| 38 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'css', 'css folder still exists'); |
|
| 39 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'js', 'js folder still exists'); |
|
| 40 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'media', 'media folder still exists'); |
|
| 41 | - $this->assertFileDoesNotExist(WEB_DIR . DIRECTORY_SEPARATOR . 'font', 'font folder still exists'); |
|
| 38 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'css', 'css folder still exists'); |
|
| 39 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'js', 'js folder still exists'); |
|
| 40 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'media', 'media folder still exists'); |
|
| 41 | + $this->assertFileDoesNotExist(WEB_DIR.DIRECTORY_SEPARATOR.'font', 'font folder still exists'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | GeneratorHelper::createRoot(WEB_DIR, null, true); |
| 50 | 50 | // Checks if exists all the folders |
| 51 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'css', 'css folder not exists'); |
|
| 52 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'js', 'js folder not exists'); |
|
| 53 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'media', 'media folder not exists'); |
|
| 54 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . 'font', 'font folder not exists'); |
|
| 55 | - $this->assertFileExists(BASE_DIR . DIRECTORY_SEPARATOR . 'locale', 'locale folder not exists'); |
|
| 51 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'css', 'css folder not exists'); |
|
| 52 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'js', 'js folder not exists'); |
|
| 53 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'media', 'media folder not exists'); |
|
| 54 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.'font', 'font folder not exists'); |
|
| 55 | + $this->assertFileExists(BASE_DIR.DIRECTORY_SEPARATOR.'locale', 'locale folder not exists'); |
|
| 56 | 56 | |
| 57 | 57 | // Check if base files in the document root exists |
| 58 | 58 | $files = [ |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'robots.txt', |
| 64 | 64 | ]; |
| 65 | 65 | foreach ($files as $file) { |
| 66 | - $this->assertFileExists(WEB_DIR . DIRECTORY_SEPARATOR . $file, $file . ' not exists in html path'); |
|
| 66 | + $this->assertFileExists(WEB_DIR.DIRECTORY_SEPARATOR.$file, $file.' not exists in html path'); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
| 3 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
| 2 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
| 3 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $headers = []; |
| 90 | 90 | foreach ($this->getHeaders() as $key => $value) { |
| 91 | - $headers[] = $key . ': ' . $value; |
|
| 91 | + $headers[] = $key.': '.$value; |
|
| 92 | 92 | } |
| 93 | 93 | $headers[self::PSFS_TRACK_HEADER] = Logger::getUid(); |
| 94 | 94 | if (count($headers)) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | case Request::VERB_GET: |
| 119 | 119 | if (!empty($this->params)) { |
| 120 | 120 | $sep = !str_contains($this->getUrl(), '?') ? '?' : ''; |
| 121 | - $this->setUrl($this->getUrl() . $sep . http_build_query($this->getParams()), false); |
|
| 121 | + $this->setUrl($this->getUrl().$sep.http_build_query($this->getParams()), false); |
|
| 122 | 122 | } |
| 123 | 123 | break; |
| 124 | 124 | case Request::VERB_POST: |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if ($this->isDebug() && is_resource($verbose)) { |
| 150 | 150 | $this->dumpVerboseLogs($verbose); |
| 151 | 151 | } |
| 152 | - Logger::log($this->getUrl() . ' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
| 152 | + Logger::log($this->getUrl().' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
| 153 | 153 | $this->info = array_merge($this->info, curl_getinfo($this->con)); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | && (preg_match('/^\/(admin|setup\-admin)/i', $route) || Config::getParam('restricted', false)) |
| 35 | 35 | ) { |
| 36 | 36 | if (!self::isTest() && |
| 37 | - null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) { |
|
| 37 | + null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) { |
|
| 38 | 38 | throw new AdminCredentialsException(); |
| 39 | 39 | } |
| 40 | 40 | if (!Security::getInstance()->checkAdmin()) { |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | $token = ''; |
| 55 | 55 | $length = strlen($timestamp); |
| 56 | 56 | for ($i = 0; $i < $length; $i++) { |
| 57 | - $token = substr($hash, $i, 1) . |
|
| 58 | - substr($timestamp, $i, 1) . |
|
| 57 | + $token = substr($hash, $i, 1). |
|
| 58 | + substr($timestamp, $i, 1). |
|
| 59 | 59 | $token; |
| 60 | 60 | } |
| 61 | 61 | return $token; |
@@ -74,16 +74,16 @@ discard block |
||
| 74 | 74 | $charsLength = strlen(self::RAND_SEP) - 1; |
| 75 | 75 | $tsLength = strlen($timestamp); |
| 76 | 76 | $i = 0; |
| 77 | - $partCount = ceil($hashRest / 4); |
|
| 78 | - $part = substr($hash, $tsLength + $partCount * $i, $partCount); |
|
| 77 | + $partCount = ceil($hashRest/4); |
|
| 78 | + $part = substr($hash, $tsLength + $partCount*$i, $partCount); |
|
| 79 | 79 | while (false !== $part && strlen($part) > 0) { |
| 80 | - $mixedToken .= $part . |
|
| 81 | - substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) . |
|
| 80 | + $mixedToken .= $part. |
|
| 81 | + substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1). |
|
| 82 | 82 | substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1); |
| 83 | - $part = substr($hash, $tsLength + $partCount * $i, $partCount); |
|
| 83 | + $part = substr($hash, $tsLength + $partCount*$i, $partCount); |
|
| 84 | 84 | $i++; |
| 85 | 85 | } |
| 86 | - return $mixedToken . $token; |
|
| 86 | + return $mixedToken.$token; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | private static function getTs($isOdd = null) |
| 94 | 94 | { |
| 95 | 95 | $timestamp = time(); |
| 96 | - $tsIsOdd = (bool)((int)substr($timestamp, -1) % 2); |
|
| 96 | + $tsIsOdd = (bool)((int)substr($timestamp, -1)%2); |
|
| 97 | 97 | if (false === $isOdd && !$tsIsOdd) { |
| 98 | 98 | $timestamp--; |
| 99 | 99 | } elseif (true === $isOdd && !$tsIsOdd) { |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | $timestamp = ''; |
| 130 | 130 | $part = strrev($part); |
| 131 | 131 | for ($i = 0, $ct = strlen($part); $i < $ct; $i++) { |
| 132 | - if ($i % 2 == 0) { |
|
| 132 | + if ($i%2 == 0) { |
|
| 133 | 133 | $timestamp .= substr($part, $i, 1); |
| 134 | - } else { |
|
| 134 | + }else { |
|
| 135 | 135 | $partToken .= substr($part, $i, 1); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | list($partToken, $timestamp) = self::extractTs(array_pop($parts)); |
| 149 | 149 | $token = null; |
| 150 | 150 | if ($timestamp > 0) { |
| 151 | - $token = $partToken . implode('', $parts); |
|
| 151 | + $token = $partToken.implode('', $parts); |
|
| 152 | 152 | } |
| 153 | 153 | return [$token, $timestamp]; |
| 154 | 154 | } |