@@ -11,131 +11,131 @@ |
||
| 11 | 11 | |
| 12 | 12 | class CloudControl |
| 13 | 13 | { |
| 14 | - public static function run() |
|
| 15 | - { |
|
| 16 | - new Application(); |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - public static function postInstall(Event $event) |
|
| 20 | - { |
|
| 21 | - $event->getIO()->write("Post install"); |
|
| 22 | - self::checkInstall($event); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - public static function postUpdate(Event $event) |
|
| 26 | - { |
|
| 27 | - $event->getIO()->write("Post update"); |
|
| 28 | - self::checkInstall($event); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @param Event $event |
|
| 33 | - */ |
|
| 34 | - private static function checkInstall(Event $event) |
|
| 35 | - { |
|
| 36 | - $event->getIO()->write("*** Checking installation of Cloud Control framework ***"); |
|
| 37 | - |
|
| 38 | - $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); |
|
| 39 | - $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); |
|
| 40 | - |
|
| 41 | - $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json'; |
|
| 42 | - $configObject = self::getConfig($baseConfigTargetPath); |
|
| 43 | - |
|
| 44 | - $configObject->{'vendorDir'} = realpath($vendorDir); |
|
| 45 | - $configObject->{'rootDir'} = $rootDir; |
|
| 46 | - $configObject->{'templateDir'} = self::createDir($event, $rootDir, 'templates'); |
|
| 47 | - $configObject->{'storageDir'} = self::createDir($event, $rootDir, $configObject->{'storageDir'}); |
|
| 48 | - $configObject->{'publicDir'} = self::createDir($event, $rootDir, 'public'); |
|
| 49 | - $configObject->{'jsDir'} = self::createDir($event, $configObject->{'publicDir'}, 'js'); |
|
| 50 | - $configObject->{'cssDir'} = self::createDir($event, $configObject->{'publicDir'}, 'css'); |
|
| 51 | - $configObject->{'imagesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'images'); |
|
| 52 | - $configObject->{'filesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'files'); |
|
| 53 | - |
|
| 54 | - // TODO Fie FilesStorage to use filesDir from config, similar to ImagesStorage |
|
| 55 | - |
|
| 56 | - $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json'; |
|
| 57 | - $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql'; |
|
| 58 | - |
|
| 59 | - self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath); |
|
| 60 | - self::saveConfig($event, $baseConfigTargetPath, $configObject); |
|
| 61 | - self::copyInstallFile($event, 'public.htaccess', $configObject->{'publicDir'}, '.htaccess'); |
|
| 62 | - self::copyInstallFile($event, 'root.htaccess', $configObject->{'rootDir'}, '.htaccess'); |
|
| 63 | - self::copyInstallFile($event, 'base.php', $configObject->{'templateDir'}); |
|
| 64 | - self::copyInstallFile($event, 'cms.css', $configObject->{'cssDir'}); |
|
| 65 | - self::copyInstallFile($event, 'cms.js', $configObject->{'jsDir'}); |
|
| 66 | - self::copyInstallFile($event, 'index.php', $configObject->{'publicDir'}); |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @param Event $event |
|
| 71 | - * @param $baseConfigTargetPath |
|
| 72 | - * @param $configObject |
|
| 73 | - * @internal param $rootDir |
|
| 74 | - * @internal param $vendorDir |
|
| 75 | - * @internal param $templateDir |
|
| 76 | - * @internal param $storageDir |
|
| 77 | - * @internal param $baseConfigDefaultPath |
|
| 78 | - * @internal param $baseConfigTargetPath |
|
| 79 | - * @internal param $storageDir |
|
| 80 | - */ |
|
| 81 | - private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject) |
|
| 82 | - { |
|
| 83 | - file_put_contents($baseConfigTargetPath, json_encode($configObject)); |
|
| 84 | - $event->getIO()->write("Saved config to: " . $baseConfigTargetPath); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null) |
|
| 88 | - { |
|
| 89 | - $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName); |
|
| 90 | - |
|
| 91 | - if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) { |
|
| 92 | - if ($destinationFileName !== null) { |
|
| 93 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName); |
|
| 94 | - } else { |
|
| 95 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $sourceFileName); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - $event->getIO()->write("Copied file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 99 | - } else { |
|
| 100 | - $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * @param $storageDir |
|
| 106 | - * @param $baseStorageDefaultPath |
|
| 107 | - * @param $baseStorageSqlPath |
|
| 108 | - */ |
|
| 109 | - private static function createStorage($storageDir, $baseStorageDefaultPath, $baseStorageSqlPath) |
|
| 110 | - { |
|
| 111 | - $repository = new Repository($storageDir); |
|
| 112 | - $repository->init($baseStorageDefaultPath, $baseStorageSqlPath); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - private static function createDir(Event $event, $rootDir, $dirName) |
|
| 116 | - { |
|
| 117 | - $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR; |
|
| 118 | - if (!is_dir($dir)) { |
|
| 119 | - mkdir($dir); |
|
| 120 | - $event->getIO()->write("Created dir: " . $dir); |
|
| 121 | - } |
|
| 122 | - return realpath($dir); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * @param $configTargetPath |
|
| 127 | - * @return mixed |
|
| 128 | - */ |
|
| 129 | - private static function getConfig($configTargetPath) |
|
| 130 | - { |
|
| 131 | - $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_config.json'); |
|
| 132 | - |
|
| 133 | - if (file_exists($configTargetPath)) { |
|
| 134 | - $config = json_decode(file_get_contents($configTargetPath)); |
|
| 135 | - } else { |
|
| 136 | - $config = json_decode(file_get_contents($baseConfigDefaultPath)); |
|
| 137 | - } |
|
| 138 | - return $config; |
|
| 139 | - } |
|
| 14 | + public static function run() |
|
| 15 | + { |
|
| 16 | + new Application(); |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + public static function postInstall(Event $event) |
|
| 20 | + { |
|
| 21 | + $event->getIO()->write("Post install"); |
|
| 22 | + self::checkInstall($event); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + public static function postUpdate(Event $event) |
|
| 26 | + { |
|
| 27 | + $event->getIO()->write("Post update"); |
|
| 28 | + self::checkInstall($event); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @param Event $event |
|
| 33 | + */ |
|
| 34 | + private static function checkInstall(Event $event) |
|
| 35 | + { |
|
| 36 | + $event->getIO()->write("*** Checking installation of Cloud Control framework ***"); |
|
| 37 | + |
|
| 38 | + $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); |
|
| 39 | + $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); |
|
| 40 | + |
|
| 41 | + $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json'; |
|
| 42 | + $configObject = self::getConfig($baseConfigTargetPath); |
|
| 43 | + |
|
| 44 | + $configObject->{'vendorDir'} = realpath($vendorDir); |
|
| 45 | + $configObject->{'rootDir'} = $rootDir; |
|
| 46 | + $configObject->{'templateDir'} = self::createDir($event, $rootDir, 'templates'); |
|
| 47 | + $configObject->{'storageDir'} = self::createDir($event, $rootDir, $configObject->{'storageDir'}); |
|
| 48 | + $configObject->{'publicDir'} = self::createDir($event, $rootDir, 'public'); |
|
| 49 | + $configObject->{'jsDir'} = self::createDir($event, $configObject->{'publicDir'}, 'js'); |
|
| 50 | + $configObject->{'cssDir'} = self::createDir($event, $configObject->{'publicDir'}, 'css'); |
|
| 51 | + $configObject->{'imagesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'images'); |
|
| 52 | + $configObject->{'filesDir'} = self::createDir($event, $configObject->{'publicDir'}, 'files'); |
|
| 53 | + |
|
| 54 | + // TODO Fie FilesStorage to use filesDir from config, similar to ImagesStorage |
|
| 55 | + |
|
| 56 | + $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json'; |
|
| 57 | + $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql'; |
|
| 58 | + |
|
| 59 | + self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath); |
|
| 60 | + self::saveConfig($event, $baseConfigTargetPath, $configObject); |
|
| 61 | + self::copyInstallFile($event, 'public.htaccess', $configObject->{'publicDir'}, '.htaccess'); |
|
| 62 | + self::copyInstallFile($event, 'root.htaccess', $configObject->{'rootDir'}, '.htaccess'); |
|
| 63 | + self::copyInstallFile($event, 'base.php', $configObject->{'templateDir'}); |
|
| 64 | + self::copyInstallFile($event, 'cms.css', $configObject->{'cssDir'}); |
|
| 65 | + self::copyInstallFile($event, 'cms.js', $configObject->{'jsDir'}); |
|
| 66 | + self::copyInstallFile($event, 'index.php', $configObject->{'publicDir'}); |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @param Event $event |
|
| 71 | + * @param $baseConfigTargetPath |
|
| 72 | + * @param $configObject |
|
| 73 | + * @internal param $rootDir |
|
| 74 | + * @internal param $vendorDir |
|
| 75 | + * @internal param $templateDir |
|
| 76 | + * @internal param $storageDir |
|
| 77 | + * @internal param $baseConfigDefaultPath |
|
| 78 | + * @internal param $baseConfigTargetPath |
|
| 79 | + * @internal param $storageDir |
|
| 80 | + */ |
|
| 81 | + private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject) |
|
| 82 | + { |
|
| 83 | + file_put_contents($baseConfigTargetPath, json_encode($configObject)); |
|
| 84 | + $event->getIO()->write("Saved config to: " . $baseConfigTargetPath); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null) |
|
| 88 | + { |
|
| 89 | + $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName); |
|
| 90 | + |
|
| 91 | + if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) { |
|
| 92 | + if ($destinationFileName !== null) { |
|
| 93 | + copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName); |
|
| 94 | + } else { |
|
| 95 | + copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $sourceFileName); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + $event->getIO()->write("Copied file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 99 | + } else { |
|
| 100 | + $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * @param $storageDir |
|
| 106 | + * @param $baseStorageDefaultPath |
|
| 107 | + * @param $baseStorageSqlPath |
|
| 108 | + */ |
|
| 109 | + private static function createStorage($storageDir, $baseStorageDefaultPath, $baseStorageSqlPath) |
|
| 110 | + { |
|
| 111 | + $repository = new Repository($storageDir); |
|
| 112 | + $repository->init($baseStorageDefaultPath, $baseStorageSqlPath); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + private static function createDir(Event $event, $rootDir, $dirName) |
|
| 116 | + { |
|
| 117 | + $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR; |
|
| 118 | + if (!is_dir($dir)) { |
|
| 119 | + mkdir($dir); |
|
| 120 | + $event->getIO()->write("Created dir: " . $dir); |
|
| 121 | + } |
|
| 122 | + return realpath($dir); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * @param $configTargetPath |
|
| 127 | + * @return mixed |
|
| 128 | + */ |
|
| 129 | + private static function getConfig($configTargetPath) |
|
| 130 | + { |
|
| 131 | + $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_config.json'); |
|
| 132 | + |
|
| 133 | + if (file_exists($configTargetPath)) { |
|
| 134 | + $config = json_decode(file_get_contents($configTargetPath)); |
|
| 135 | + } else { |
|
| 136 | + $config = json_decode(file_get_contents($baseConfigDefaultPath)); |
|
| 137 | + } |
|
| 138 | + return $config; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | \ No newline at end of file |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | $event->getIO()->write("*** Checking installation of Cloud Control framework ***"); |
| 37 | 37 | |
| 38 | 38 | $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); |
| 39 | - $rootDir = realpath($vendorDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); |
|
| 39 | + $rootDir = realpath($vendorDir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR); |
|
| 40 | 40 | |
| 41 | - $baseConfigTargetPath = $rootDir . DIRECTORY_SEPARATOR . 'config.json'; |
|
| 41 | + $baseConfigTargetPath = $rootDir.DIRECTORY_SEPARATOR.'config.json'; |
|
| 42 | 42 | $configObject = self::getConfig($baseConfigTargetPath); |
| 43 | 43 | |
| 44 | 44 | $configObject->{'vendorDir'} = realpath($vendorDir); |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // TODO Fie FilesStorage to use filesDir from config, similar to ImagesStorage |
| 55 | 55 | |
| 56 | - $baseStorageDefaultPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.json'; |
|
| 57 | - $baseStorageSqlPath = __DIR__ . DIRECTORY_SEPARATOR . 'install' . DIRECTORY_SEPARATOR . '_storage.sql'; |
|
| 56 | + $baseStorageDefaultPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.json'; |
|
| 57 | + $baseStorageSqlPath = __DIR__.DIRECTORY_SEPARATOR.'install'.DIRECTORY_SEPARATOR.'_storage.sql'; |
|
| 58 | 58 | |
| 59 | 59 | self::createStorage($configObject->{'storageDir'}, $baseStorageDefaultPath, $baseStorageSqlPath); |
| 60 | 60 | self::saveConfig($event, $baseConfigTargetPath, $configObject); |
@@ -81,23 +81,23 @@ discard block |
||
| 81 | 81 | private static function saveConfig(Event $event, $baseConfigTargetPath, $configObject) |
| 82 | 82 | { |
| 83 | 83 | file_put_contents($baseConfigTargetPath, json_encode($configObject)); |
| 84 | - $event->getIO()->write("Saved config to: " . $baseConfigTargetPath); |
|
| 84 | + $event->getIO()->write("Saved config to: ".$baseConfigTargetPath); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | private static function copyInstallFile(Event $event, $sourceFileName, $destinationPath, $destinationFileName = null) |
| 88 | 88 | { |
| 89 | - $sourceFilePath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_' . $sourceFileName); |
|
| 89 | + $sourceFilePath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install/_'.$sourceFileName); |
|
| 90 | 90 | |
| 91 | 91 | if (file_exists($sourceFilePath) && realpath($destinationPath) !== false) { |
| 92 | 92 | if ($destinationFileName !== null) { |
| 93 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $destinationFileName); |
|
| 93 | + copy($sourceFilePath, realpath($destinationPath).DIRECTORY_SEPARATOR.$destinationFileName); |
|
| 94 | 94 | } else { |
| 95 | - copy($sourceFilePath, realpath($destinationPath) . DIRECTORY_SEPARATOR . $sourceFileName); |
|
| 95 | + copy($sourceFilePath, realpath($destinationPath).DIRECTORY_SEPARATOR.$sourceFileName); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $event->getIO()->write("Copied file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 98 | + $event->getIO()->write("Copied file: ".$sourceFileName.' to '.$destinationPath); |
|
| 99 | 99 | } else { |
| 100 | - $event->getIO()->write("[ERROR] Couldnt copy file: " . $sourceFileName . ' to ' . $destinationPath); |
|
| 100 | + $event->getIO()->write("[ERROR] Couldnt copy file: ".$sourceFileName.' to '.$destinationPath); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | private static function createDir(Event $event, $rootDir, $dirName) |
| 116 | 116 | { |
| 117 | - $dir = $rootDir . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR; |
|
| 117 | + $dir = $rootDir.DIRECTORY_SEPARATOR.$dirName.DIRECTORY_SEPARATOR; |
|
| 118 | 118 | if (!is_dir($dir)) { |
| 119 | 119 | mkdir($dir); |
| 120 | - $event->getIO()->write("Created dir: " . $dir); |
|
| 120 | + $event->getIO()->write("Created dir: ".$dir); |
|
| 121 | 121 | } |
| 122 | 122 | return realpath($dir); |
| 123 | 123 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private static function getConfig($configTargetPath) |
| 130 | 130 | { |
| 131 | - $baseConfigDefaultPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . 'install/_config.json'); |
|
| 131 | + $baseConfigDefaultPath = realpath(__DIR__.DIRECTORY_SEPARATOR.'install/_config.json'); |
|
| 132 | 132 | |
| 133 | 133 | if (file_exists($configTargetPath)) { |
| 134 | 134 | $config = json_decode(file_get_contents($configTargetPath)); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | } |
| 18 | 18 | } else { |
| 19 | 19 | ob_clean(); |
| 20 | - echo <<<END |
|
| 20 | + echo <<<END |
|
| 21 | 21 | <!DOCTYPE html> |
| 22 | 22 | <html> |
| 23 | 23 | <head> |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $debug_backtrace = current(debug_backtrace()); |
| 13 | 13 | if (PHP_SAPI == 'cli') { |
| 14 | - echo 'Dump: ' . $debug_backtrace['file'] . ':' . $debug_backtrace['line'] . "\n"; |
|
| 14 | + echo 'Dump: '.$debug_backtrace['file'].':'.$debug_backtrace['line']."\n"; |
|
| 15 | 15 | foreach (func_get_args() as $data) { |
| 16 | 16 | var_dump($data); |
| 17 | 17 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | <body> |
| 30 | 30 | END; |
| 31 | 31 | |
| 32 | - echo '<div>Dump: ' . $debug_backtrace['file'] . ':<b>' . $debug_backtrace['line'] . "</b></div>"; |
|
| 32 | + echo '<div>Dump: '.$debug_backtrace['file'].':<b>'.$debug_backtrace['line']."</b></div>"; |
|
| 33 | 33 | echo '<pre>'; |
| 34 | 34 | foreach (func_get_args() as $data) { |
| 35 | 35 | echo "<code>"; |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function utf8Convert($array) |
| 55 | 55 | { |
| 56 | - array_walk_recursive($array, function(&$item){ |
|
| 57 | - if(!mb_detect_encoding($item, 'utf-8', true)){ |
|
| 56 | + array_walk_recursive($array, function(&$item) { |
|
| 57 | + if (!mb_detect_encoding($item, 'utf-8', true)) { |
|
| 58 | 58 | $item = utf8_encode($item); |
| 59 | 59 | } |
| 60 | 60 | }); |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $file = $cmsComponent->storage->getFiles()->getFileByName($slug); |
| 42 | 42 | // TODO FIX THIS PATH |
| 43 | - $path = realpath(__DIR__ . '/../www/files/'); |
|
| 44 | - $quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\')); |
|
| 45 | - $size = filesize($path . '/' . $file->file); |
|
| 43 | + $path = realpath(__DIR__.'/../www/files/'); |
|
| 44 | + $quoted = sprintf('"%s"', addcslashes(basename($path.'/'.$file->file), '"\\')); |
|
| 45 | + $size = filesize($path.'/'.$file->file); |
|
| 46 | 46 | |
| 47 | 47 | header('Content-Description: File Transfer'); |
| 48 | - header('Content-Type: ' . $file->type); |
|
| 49 | - header('Content-Disposition: attachment; filename=' . $quoted); |
|
| 48 | + header('Content-Type: '.$file->type); |
|
| 49 | + header('Content-Disposition: attachment; filename='.$quoted); |
|
| 50 | 50 | header('Content-Transfer-Encoding: binary'); |
| 51 | 51 | header('Connection: Keep-Alive'); |
| 52 | 52 | header('Expires: 0'); |
| 53 | 53 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 54 | 54 | header('Pragma: public'); |
| 55 | - header('Content-Length: ' . $size); |
|
| 55 | + header('Content-Length: '.$size); |
|
| 56 | 56 | |
| 57 | - readfile($path . '/' . $file->file); |
|
| 57 | + readfile($path.'/'.$file->file); |
|
| 58 | 58 | exit; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_FILES); |
| 79 | 79 | if (isset($_FILES[CmsComponent::FILES_PARAMETER_FILE])) { |
| 80 | 80 | $cmsComponent->storage->getFiles()->addFile($_FILES[CmsComponent::FILES_PARAMETER_FILE]); |
| 81 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
| 81 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
| 82 | 82 | exit; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | private function deleteRoute($request, $cmsComponent) |
| 91 | 91 | { |
| 92 | 92 | $cmsComponent->storage->getFiles()->deleteFileByName($request::$get[CmsComponent::FILES_PARAMETER_FILE]); |
| 93 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/files'); |
|
| 93 | + header('Location: '.$request::$subfolders.$cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX).'/files'); |
|
| 94 | 94 | exit; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -12,33 +12,33 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class DocumentRouting implements CmsRouting |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * DocumentRouting constructor. |
|
| 17 | - * @param $request |
|
| 18 | - * @param $relativeCmsUri |
|
| 19 | - * @param CmsComponent $cmsComponent |
|
| 20 | - */ |
|
| 21 | - public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 22 | - { |
|
| 23 | - if ($relativeCmsUri == '/documents') { |
|
| 24 | - $cmsComponent->subTemplate = 'documents'; |
|
| 25 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENTS, $cmsComponent->storage->getDocuments()->getDocumentsWithState()); |
|
| 26 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
|
| 27 | - } |
|
| 28 | - $this->documentRouting($request, $relativeCmsUri, $cmsComponent); |
|
| 29 | - $this->folderRouting($request, $relativeCmsUri, $cmsComponent); |
|
| 15 | + /** |
|
| 16 | + * DocumentRouting constructor. |
|
| 17 | + * @param $request |
|
| 18 | + * @param $relativeCmsUri |
|
| 19 | + * @param CmsComponent $cmsComponent |
|
| 20 | + */ |
|
| 21 | + public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 22 | + { |
|
| 23 | + if ($relativeCmsUri == '/documents') { |
|
| 24 | + $cmsComponent->subTemplate = 'documents'; |
|
| 25 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_DOCUMENTS, $cmsComponent->storage->getDocuments()->getDocumentsWithState()); |
|
| 26 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_DOCUMENTS); |
|
| 27 | + } |
|
| 28 | + $this->documentRouting($request, $relativeCmsUri, $cmsComponent); |
|
| 29 | + $this->folderRouting($request, $relativeCmsUri, $cmsComponent); |
|
| 30 | 30 | $this->valuelistsRouting($request, $relativeCmsUri, $cmsComponent); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @param $request |
|
| 36 | - * @param $relativeCmsUri |
|
| 37 | - * @param CmsComponent $cmsComponent |
|
| 38 | - * @throws \Exception |
|
| 39 | - */ |
|
| 40 | - private function documentRouting($request, $relativeCmsUri, $cmsComponent) |
|
| 41 | - { |
|
| 34 | + /** |
|
| 35 | + * @param $request |
|
| 36 | + * @param $relativeCmsUri |
|
| 37 | + * @param CmsComponent $cmsComponent |
|
| 38 | + * @throws \Exception |
|
| 39 | + */ |
|
| 40 | + private function documentRouting($request, $relativeCmsUri, $cmsComponent) |
|
| 41 | + { |
|
| 42 | 42 | if ($relativeCmsUri == '/documents/new-document' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
| 43 | 43 | $this->documentNewRoute($request, $cmsComponent); |
| 44 | 44 | } elseif (isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])){ |
@@ -50,23 +50,23 @@ discard block |
||
| 50 | 50 | case '/documents/unpublish-document': $this->unpublishDocumentRoute($request, $cmsComponent); break; |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @param $request |
|
| 57 | - * @param $relativeCmsUri |
|
| 58 | - * @param CmsComponent $cmsComponent |
|
| 59 | - */ |
|
| 60 | - private function folderRouting($request, $relativeCmsUri, $cmsComponent) |
|
| 61 | - { |
|
| 62 | - if ($relativeCmsUri == '/documents/new-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
| 55 | + /** |
|
| 56 | + * @param $request |
|
| 57 | + * @param $relativeCmsUri |
|
| 58 | + * @param CmsComponent $cmsComponent |
|
| 59 | + */ |
|
| 60 | + private function folderRouting($request, $relativeCmsUri, $cmsComponent) |
|
| 61 | + { |
|
| 62 | + if ($relativeCmsUri == '/documents/new-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_PATH])) { |
|
| 63 | 63 | $this->newFolderRoute($request, $cmsComponent); |
| 64 | - } else if ($relativeCmsUri == '/documents/edit-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 64 | + } else if ($relativeCmsUri == '/documents/edit-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 65 | 65 | $this->editFolderRoute($request, $cmsComponent); |
| 66 | - } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 66 | + } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 67 | 67 | $this->deleteFolderRoute($request, $cmsComponent); |
| 68 | - } |
|
| 69 | - } |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | private function valuelistsRouting($request, $relativeCmsUri, $cmsComponent) |
| 72 | 72 | { |
@@ -13,26 +13,26 @@ |
||
| 13 | 13 | class ImagesRouting implements CmsRouting |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * ImagesRouting constructor. |
|
| 18 | - * @param \CloudControl\Cms\cc\Request $request |
|
| 19 | - * @param mixed|string $relativeCmsUri |
|
| 20 | - * @param CmsComponent $cmsComponent |
|
| 21 | - */ |
|
| 22 | - public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 23 | - { |
|
| 24 | - if ($relativeCmsUri == '/images') { |
|
| 16 | + /** |
|
| 17 | + * ImagesRouting constructor. |
|
| 18 | + * @param \CloudControl\Cms\cc\Request $request |
|
| 19 | + * @param mixed|string $relativeCmsUri |
|
| 20 | + * @param CmsComponent $cmsComponent |
|
| 21 | + */ |
|
| 22 | + public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 23 | + { |
|
| 24 | + if ($relativeCmsUri == '/images') { |
|
| 25 | 25 | $this->overviewRoute($cmsComponent); |
| 26 | - } elseif ($relativeCmsUri == '/images.json') { |
|
| 26 | + } elseif ($relativeCmsUri == '/images.json') { |
|
| 27 | 27 | $this->jsonRoute($cmsComponent); |
| 28 | - } elseif ($relativeCmsUri == '/images/new') { |
|
| 28 | + } elseif ($relativeCmsUri == '/images/new') { |
|
| 29 | 29 | $this->newRoute($request, $cmsComponent); |
| 30 | - } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 30 | + } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 31 | 31 | $this->deleteRoute($request, $cmsComponent); |
| 32 | - } elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 32 | + } elseif ($relativeCmsUri == '/images/show' && isset($request::$get[CmsComponent::FILES_PARAMETER_FILE])) { |
|
| 33 | 33 | $this->showRoute($request, $cmsComponent); |
| 34 | - } |
|
| 35 | - } |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param CmsComponent $cmsComponent |
@@ -14,26 +14,26 @@ discard block |
||
| 14 | 14 | class SitemapRouting implements CmsRouting |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * SitemapRouting constructor. |
|
| 19 | - * @param \CloudControl\Cms\cc\Request $request |
|
| 20 | - * @param mixed|string $relativeCmsUri |
|
| 21 | - * @param CmsComponent $cmsComponent |
|
| 22 | - */ |
|
| 23 | - public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 24 | - { |
|
| 25 | - if ($relativeCmsUri == '/sitemap') { |
|
| 17 | + /** |
|
| 18 | + * SitemapRouting constructor. |
|
| 19 | + * @param \CloudControl\Cms\cc\Request $request |
|
| 20 | + * @param mixed|string $relativeCmsUri |
|
| 21 | + * @param CmsComponent $cmsComponent |
|
| 22 | + */ |
|
| 23 | + public function __construct($request, $relativeCmsUri, $cmsComponent) |
|
| 24 | + { |
|
| 25 | + if ($relativeCmsUri == '/sitemap') { |
|
| 26 | 26 | $this->overviewRoute($request, $cmsComponent); |
| 27 | - } elseif ($relativeCmsUri == '/sitemap/new') { |
|
| 27 | + } elseif ($relativeCmsUri == '/sitemap/new') { |
|
| 28 | 28 | $this->newRoute($request, $cmsComponent); |
| 29 | - } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 29 | + } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 30 | 30 | $this->editRoute($request, $cmsComponent); |
| 31 | - } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 31 | + } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 32 | 32 | $this->deleteRoute($request, $cmsComponent); |
| 33 | - } else { |
|
| 34 | - $this->redirectRoutes($relativeCmsUri, $request, $cmsComponent); |
|
| 35 | - } |
|
| 36 | - } |
|
| 33 | + } else { |
|
| 34 | + $this->redirectRoutes($relativeCmsUri, $request, $cmsComponent); |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @param $request |
@@ -92,54 +92,54 @@ discard block |
||
| 92 | 92 | exit; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - private function redirectRoutes($relativeCmsUri, $request, $cmsComponent) |
|
| 96 | - { |
|
| 97 | - if ($relativeCmsUri == '/sitemap/redirects') { |
|
| 98 | - $this->redirectsOverviewRoute($cmsComponent); |
|
| 99 | - } elseif ($relativeCmsUri == '/sitemap/redirects/new') { |
|
| 100 | - $this->redirectsNewRoute($request, $cmsComponent); |
|
| 101 | - } elseif ($relativeCmsUri == '/sitemap/redirects/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 102 | - $this->redirectEditRoute($request, $cmsComponent); |
|
| 103 | - } elseif ($relativeCmsUri == '/sitemap/redirects/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 104 | - $this->redirectDeleteRoute($request, $cmsComponent); |
|
| 105 | - } |
|
| 106 | - } |
|
| 95 | + private function redirectRoutes($relativeCmsUri, $request, $cmsComponent) |
|
| 96 | + { |
|
| 97 | + if ($relativeCmsUri == '/sitemap/redirects') { |
|
| 98 | + $this->redirectsOverviewRoute($cmsComponent); |
|
| 99 | + } elseif ($relativeCmsUri == '/sitemap/redirects/new') { |
|
| 100 | + $this->redirectsNewRoute($request, $cmsComponent); |
|
| 101 | + } elseif ($relativeCmsUri == '/sitemap/redirects/edit' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 102 | + $this->redirectEditRoute($request, $cmsComponent); |
|
| 103 | + } elseif ($relativeCmsUri == '/sitemap/redirects/delete' && isset($request::$get[CmsComponent::GET_PARAMETER_SLUG])) { |
|
| 104 | + $this->redirectDeleteRoute($request, $cmsComponent); |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - private function redirectsOverviewRoute($cmsComponent) |
|
| 109 | - { |
|
| 110 | - $cmsComponent->subTemplate = 'sitemap/redirects'; |
|
| 111 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP); |
|
| 112 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECTS, $cmsComponent->storage->getRedirects()->getRedirects()); |
|
| 113 | - } |
|
| 108 | + private function redirectsOverviewRoute($cmsComponent) |
|
| 109 | + { |
|
| 110 | + $cmsComponent->subTemplate = 'sitemap/redirects'; |
|
| 111 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP); |
|
| 112 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECTS, $cmsComponent->storage->getRedirects()->getRedirects()); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - private function redirectsNewRoute($request, $cmsComponent) |
|
| 116 | - { |
|
| 117 | - $cmsComponent->subTemplate = 'sitemap/redirects-form'; |
|
| 118 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP); |
|
| 119 | - if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) { |
|
| 120 | - $cmsComponent->storage->getRedirects()->addRedirect($request::$post); |
|
| 121 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects'); |
|
| 122 | - exit; |
|
| 123 | - } |
|
| 124 | - } |
|
| 115 | + private function redirectsNewRoute($request, $cmsComponent) |
|
| 116 | + { |
|
| 117 | + $cmsComponent->subTemplate = 'sitemap/redirects-form'; |
|
| 118 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP); |
|
| 119 | + if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) { |
|
| 120 | + $cmsComponent->storage->getRedirects()->addRedirect($request::$post); |
|
| 121 | + header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects'); |
|
| 122 | + exit; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - private function redirectEditRoute($request, $cmsComponent) |
|
| 127 | - { |
|
| 128 | - $cmsComponent->subTemplate = 'sitemap/redirects-form'; |
|
| 129 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP); |
|
| 130 | - $redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
|
| 131 | - if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) { |
|
| 132 | - $cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post); |
|
| 133 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects'); |
|
| 134 | - exit; |
|
| 135 | - } |
|
| 136 | - $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect); |
|
| 137 | - } |
|
| 126 | + private function redirectEditRoute($request, $cmsComponent) |
|
| 127 | + { |
|
| 128 | + $cmsComponent->subTemplate = 'sitemap/redirects-form'; |
|
| 129 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_MAIN_NAV_CLASS, CmsComponent::PARAMETER_SITEMAP); |
|
| 130 | + $redirect = $cmsComponent->storage->getRedirects()->getRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
|
| 131 | + if (isset($request::$post[CmsComponent::POST_PARAMETER_TITLE], $request::$post[CmsComponent::POST_PARAMETER_FROM_URL], $request::$post[CmsComponent::POST_PARAMETER_TO_URL])) { |
|
| 132 | + $cmsComponent->storage->getRedirects()->saveRedirect($request::$get[CmsComponent::GET_PARAMETER_SLUG], $request::$post); |
|
| 133 | + header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects'); |
|
| 134 | + exit; |
|
| 135 | + } |
|
| 136 | + $cmsComponent->setParameter(CmsComponent::PARAMETER_REDIRECT, $redirect); |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - private function redirectDeleteRoute($request, $cmsComponent) |
|
| 140 | - { |
|
| 141 | - $cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
|
| 142 | - header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects'); |
|
| 143 | - exit; |
|
| 144 | - } |
|
| 139 | + private function redirectDeleteRoute($request, $cmsComponent) |
|
| 140 | + { |
|
| 141 | + $cmsComponent->storage->getRedirects()->deleteRedirectBySlug($request::$get[CmsComponent::GET_PARAMETER_SLUG]); |
|
| 142 | + header('Location: ' . $request::$subfolders . $cmsComponent->getParameter(CmsComponent::PARAMETER_CMS_PREFIX) . '/sitemap/redirects'); |
|
| 143 | + exit; |
|
| 144 | + } |
|
| 145 | 145 | } |
| 146 | 146 | \ No newline at end of file |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace CloudControl\Cms\components { |
| 3 | 3 | |
| 4 | - use storage\Storage; |
|
| 4 | + use storage\Storage; |
|
| 5 | 5 | |
| 6 | - /** |
|
| 6 | + /** |
|
| 7 | 7 | * Class DocumentComponent |
| 8 | 8 | * |
| 9 | 9 | * Has optional parameter `folder` to prefix the relative url with a folder |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace CloudControl\Cms\components { |
| 3 | 3 | |
| 4 | - use CloudControl\Cms\components\cms\ConfigurationRouting; |
|
| 5 | - use CloudControl\Cms\components\cms\DocumentRouting; |
|
| 6 | - use CloudControl\Cms\components\cms\FilesRouting; |
|
| 7 | - use CloudControl\Cms\components\cms\ImagesRouting; |
|
| 8 | - use CloudControl\Cms\components\cms\SearchRouting; |
|
| 9 | - use CloudControl\Cms\components\cms\SitemapRouting; |
|
| 10 | - use CloudControl\Cms\crypt\Crypt; |
|
| 11 | - use CloudControl\Cms\storage\Storage; |
|
| 12 | - |
|
| 13 | - class CmsComponent extends BaseComponent |
|
| 4 | + use CloudControl\Cms\components\cms\ConfigurationRouting; |
|
| 5 | + use CloudControl\Cms\components\cms\DocumentRouting; |
|
| 6 | + use CloudControl\Cms\components\cms\FilesRouting; |
|
| 7 | + use CloudControl\Cms\components\cms\ImagesRouting; |
|
| 8 | + use CloudControl\Cms\components\cms\SearchRouting; |
|
| 9 | + use CloudControl\Cms\components\cms\SitemapRouting; |
|
| 10 | + use CloudControl\Cms\crypt\Crypt; |
|
| 11 | + use CloudControl\Cms\storage\Storage; |
|
| 12 | + |
|
| 13 | + class CmsComponent extends BaseComponent |
|
| 14 | 14 | { |
| 15 | - /** |
|
| 15 | + /** |
|
| 16 | 16 | * @var \CloudControl\Cms\storage\Storage |
| 17 | 17 | */ |
| 18 | 18 | public $storage; |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | const PARAMETER_IMAGE_SET = 'imageSet'; |
| 42 | 42 | const PARAMETER_MAIN_NAV_CLASS = 'mainNavClass'; |
| 43 | 43 | const PARAMETER_MY_BRICK_SLUG = 'myBrickSlug'; |
| 44 | - const PARAMETER_REDIRECT = 'redirect'; |
|
| 45 | - const PARAMETER_REDIRECTS = 'redirects'; |
|
| 44 | + const PARAMETER_REDIRECT = 'redirect'; |
|
| 45 | + const PARAMETER_REDIRECTS = 'redirects'; |
|
| 46 | 46 | const PARAMETER_SEARCH = 'search'; |
| 47 | 47 | const PARAMETER_SEARCH_LOG = "searchLog"; |
| 48 | 48 | const PARAMETER_SEARCH_NEEDS_UPDATE = "searchNeedsUpdate"; |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | const PARAMETER_VALUELISTS = "valuelists"; |
| 58 | 58 | const PARAMETER_WHITELIST_IPS = 'whitelistIps'; |
| 59 | 59 | |
| 60 | - const POST_PARAMETER_COMPONENT = 'component'; |
|
| 61 | - const POST_PARAMETER_FROM_URL = "fromUrl"; |
|
| 62 | - const POST_PARAMETER_PASSWORD = 'password'; |
|
| 63 | - const POST_PARAMETER_SAVE = 'save'; |
|
| 64 | - const POST_PARAMETER_TEMPLATE = 'template'; |
|
| 65 | - const POST_PARAMETER_TITLE = 'title'; |
|
| 66 | - const POST_PARAMETER_TO_URL = "toUrl"; |
|
| 67 | - const POST_PARAMETER_USERNAME = 'username'; |
|
| 60 | + const POST_PARAMETER_COMPONENT = 'component'; |
|
| 61 | + const POST_PARAMETER_FROM_URL = "fromUrl"; |
|
| 62 | + const POST_PARAMETER_PASSWORD = 'password'; |
|
| 63 | + const POST_PARAMETER_SAVE = 'save'; |
|
| 64 | + const POST_PARAMETER_TEMPLATE = 'template'; |
|
| 65 | + const POST_PARAMETER_TITLE = 'title'; |
|
| 66 | + const POST_PARAMETER_TO_URL = "toUrl"; |
|
| 67 | + const POST_PARAMETER_USERNAME = 'username'; |
|
| 68 | 68 | |
| 69 | 69 | const GET_PARAMETER_PATH = 'path'; |
| 70 | 70 | const GET_PARAMETER_SLUG = 'slug'; |
@@ -369,9 +369,9 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - protected function getTemplatePath($template, $application = null) |
|
| 373 | - { |
|
| 374 | - return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php'; |
|
| 375 | - } |
|
| 376 | - } |
|
| 372 | + protected function getTemplatePath($template, $application = null) |
|
| 373 | + { |
|
| 374 | + return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php'; |
|
| 375 | + } |
|
| 376 | + } |
|
| 377 | 377 | } |
| 378 | 378 | \ No newline at end of file |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $whitelistIps = explode(',', $this->parameters[self::PARAMETER_WHITELIST_IPS]); |
| 171 | 171 | $whitelistIps = array_map("trim", $whitelistIps); |
| 172 | 172 | if (!in_array($remoteAddress, $whitelistIps)) { |
| 173 | - throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist'); |
|
| 173 | + throw new \Exception('Ip address '.$remoteAddress.' is not on whitelist'); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $blacklistIps = explode(',', $this->parameters[self::PARAMETER_BLACKLIST_IPS]); |
| 187 | 187 | $blacklistIps = array_map("trim", $blacklistIps); |
| 188 | 188 | if (in_array($remoteAddress, $blacklistIps)) { |
| 189 | - throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist'); |
|
| 189 | + throw new \Exception('Ip address '.$remoteAddress.' is on blacklist'); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | if ($relativeCmsUri == '/log-off') { |
| 231 | 231 | $_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL] = null; |
| 232 | 232 | unset($_SESSION[self::SESSION_PARAMETER_CLOUD_CONTROL]); |
| 233 | - header('Location: ' . $request::$subfolders . $this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
| 233 | + header('Location: '.$request::$subfolders.$this->parameters[self::PARAMETER_CMS_PREFIX]); |
|
| 234 | 234 | exit; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | protected function getTemplatePath($template, $application = null) |
| 373 | 373 | { |
| 374 | - return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.php'; |
|
| 374 | + return __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$template.'.php'; |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | \ No newline at end of file |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | namespace CloudControl\Cms\components |
| 3 | 3 | { |
| 4 | 4 | |
| 5 | - use CloudControl\Cms\cc\Request; |
|
| 6 | - use CloudControl\Cms\storage\Storage; |
|
| 5 | + use CloudControl\Cms\cc\Request; |
|
| 6 | + use CloudControl\Cms\storage\Storage; |
|
| 7 | 7 | |
| 8 | - /** |
|
| 8 | + /** |
|
| 9 | 9 | * Interface Component |
| 10 | 10 | * @package CloudControl\Cms\components |
| 11 | 11 | */ |