| @@ -109,8 +109,8 @@ | ||
| 109 | 109 | |
| 110 | 110 | // Preserve transparency | 
| 111 | 111 | imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); | 
| 112 | - imagealphablending($new, false); | |
| 113 | - imagesavealpha($new, true); | |
| 112 | + imagealphablending($new, false); | |
| 113 | + imagesavealpha($new, true); | |
| 114 | 114 | |
| 115 | 115 | imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $this->_destWidth, $this->_destHeight); | 
| 116 | 116 | |
| @@ -62,8 +62,8 @@ | ||
| 62 | 62 | |
| 63 | 63 | // Preserve transparency | 
| 64 | 64 | imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); | 
| 65 | - imagealphablending($new, false); | |
| 66 | - imagesavealpha($new, true); | |
| 65 | + imagealphablending($new, false); | |
| 66 | + imagesavealpha($new, true); | |
| 67 | 67 | |
| 68 | 68 | imagecopyresampled($new, $imageResource, $this->_destX, $this->_destY, $this->_x, $this->_y, $this->_destWidth, $this->_destHeight, $originalWidth, $originalHeight); | 
| 69 | 69 | |
| @@ -17,7 +17,7 @@ | ||
| 17 | 17 | /** | 
| 18 | 18 | * @param resource $imageResource | 
| 19 | 19 | * @return resource | 
| 20 | - */ | |
| 20 | + */ | |
| 21 | 21 | public function Execute($imageResource) | 
| 22 | 22 |  		{ | 
| 23 | 23 | // Define the origial width and height | 
| @@ -14,24 +14,24 @@ | ||
| 14 | 14 | class SitemapRouting implements CmsRouting | 
| 15 | 15 |  { | 
| 16 | 16 | |
| 17 | - /** | |
| 18 | - * SitemapRouting constructor. | |
| 19 | - * @param \library\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 \library\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 | - } | |
| 34 | - } | |
| 33 | + } | |
| 34 | + } | |
| 35 | 35 | |
| 36 | 36 | /** | 
| 37 | 37 | * @param $request | 
| @@ -6,124 +6,124 @@ | ||
| 6 | 6 | |
| 7 | 7 | class LanguageComponent implements Component | 
| 8 | 8 |  { | 
| 9 | - protected $request; | |
| 10 | - protected $parameters; | |
| 11 | - | |
| 12 | - protected $defaultLanguage = 'en'; | |
| 13 | - protected $acceptedLanguages = null; | |
| 14 | - protected $languageParameterName = 'language'; | |
| 15 | - protected $forceRedirect = false; | |
| 16 | - protected $sessionValues; | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * Component constructor. | |
| 20 | - * | |
| 21 | - * @param $template | |
| 22 | - * @param Request $request | |
| 23 | - * @param $parameters | |
| 24 | - * @param $matchedSitemapItem | |
| 25 | - */ | |
| 26 | - public function __construct($template, Request $request, $parameters, $matchedSitemapItem) | |
| 27 | -    { | |
| 28 | - $this->parameters = (array) $parameters; | |
| 29 | - $this->checkParameters(); | |
| 30 | - | |
| 31 | - $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2); | |
| 32 | - $_SESSION['LanguageComponent']['detectedLanguage'] = $lang; | |
| 33 | - | |
| 34 | - $this->checkLanguageSwitch($request); | |
| 35 | - | |
| 36 | -        if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) { | |
| 37 | - $this->detectLanguage($lang, $request); | |
| 38 | -        } else { | |
| 39 | -            if ($this->forceRedirect === true) { | |
| 40 | - $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request); | |
| 41 | - } | |
| 42 | - } | |
| 43 | - | |
| 44 | - $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName]; | |
| 45 | - } | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * Checks to see if any parameters are given from the configuration in the CMS | |
| 49 | - */ | |
| 50 | - private function checkParameters() | |
| 51 | -    { | |
| 52 | -        if (isset($this->parameters['defaultLanguage'])) { | |
| 53 | - $this->defaultLanguage = $this->parameters['defaultLanguage']; | |
| 54 | - unset($this->parameters['defaultLanguage']); | |
| 55 | - } | |
| 56 | -        if (isset($this->parameters['acceptedLanguages'])) { | |
| 57 | -            $this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']); | |
| 58 | - unset($this->parameters['acceptedLanguages']); | |
| 59 | - } | |
| 60 | -        if (isset($this->parameters['languageParameterName'])) { | |
| 61 | - $this->languageParameterName = $this->parameters['languageParameterName']; | |
| 62 | - unset($this->parameters['languageParameterName']); | |
| 63 | - } | |
| 64 | -        if (isset($this->parameters['forceRedirect'])) { | |
| 65 | - $this->forceRedirect = (bool) $this->parameters['forceRedirect']; | |
| 66 | - unset($this->parameters['forceRedirect']); | |
| 67 | - } | |
| 68 | - } | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * @return array | |
| 72 | - */ | |
| 73 | - public function getParameters() | |
| 74 | -    { | |
| 75 | - return $this->parameters; | |
| 76 | - } | |
| 77 | - | |
| 78 | - | |
| 79 | - /** | |
| 80 | - * Check if the found language is allowed and | |
| 81 | - * if an action is to be taken. | |
| 82 | - * | |
| 83 | - * @param $lang | |
| 84 | - * @param $request | |
| 85 | - */ | |
| 86 | - private function detectLanguage($lang, $request) | |
| 87 | -    { | |
| 88 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage; | |
| 89 | - | |
| 90 | -        if ($this->acceptedLanguages === null) { | |
| 91 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; | |
| 92 | -        } else if (in_array($lang, $this->acceptedLanguages)) { | |
| 93 | - $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; | |
| 94 | -        } else { | |
| 95 | - $lang = $this->defaultLanguage; | |
| 96 | - } | |
| 97 | - | |
| 98 | - $this->sessionValues = $_SESSION['LanguageComponent']; | |
| 99 | - | |
| 100 | -        if ($this->forceRedirect === true) { | |
| 101 | -            if (substr($request::$relativeUri, 0, 2) !== $lang ) { | |
| 102 | -                if ($lang !== $this->defaultLanguage) { | |
| 103 | -                    header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri); | |
| 104 | - exit; | |
| 105 | - } | |
| 106 | - } | |
| 107 | - } | |
| 108 | - } | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * Detect if the language is switched manually | |
| 112 | - * | |
| 113 | - * @param $request | |
| 114 | - */ | |
| 115 | - private function checkLanguageSwitch($request) | |
| 116 | -    { | |
| 117 | -        if (isset($request::$get['langSwitch'])) { | |
| 118 | - $this->forceRedirect = true; | |
| 119 | - $this->detectLanguage($request::$get['langSwitch'], $request); | |
| 120 | - } | |
| 121 | - } | |
| 122 | - | |
| 123 | - /* | |
| 9 | + protected $request; | |
| 10 | + protected $parameters; | |
| 11 | + | |
| 12 | + protected $defaultLanguage = 'en'; | |
| 13 | + protected $acceptedLanguages = null; | |
| 14 | + protected $languageParameterName = 'language'; | |
| 15 | + protected $forceRedirect = false; | |
| 16 | + protected $sessionValues; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * Component constructor. | |
| 20 | + * | |
| 21 | + * @param $template | |
| 22 | + * @param Request $request | |
| 23 | + * @param $parameters | |
| 24 | + * @param $matchedSitemapItem | |
| 25 | + */ | |
| 26 | + public function __construct($template, Request $request, $parameters, $matchedSitemapItem) | |
| 27 | +	{ | |
| 28 | + $this->parameters = (array) $parameters; | |
| 29 | + $this->checkParameters(); | |
| 30 | + | |
| 31 | + $lang = substr(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : $this->defaultLanguage, 0, 2); | |
| 32 | + $_SESSION['LanguageComponent']['detectedLanguage'] = $lang; | |
| 33 | + | |
| 34 | + $this->checkLanguageSwitch($request); | |
| 35 | + | |
| 36 | +		if (!isset($_SESSION['LanguageComponent'][$this->languageParameterName])) { | |
| 37 | + $this->detectLanguage($lang, $request); | |
| 38 | +		} else { | |
| 39 | +			if ($this->forceRedirect === true) { | |
| 40 | + $this->detectLanguage($_SESSION['LanguageComponent'][$this->languageParameterName], $request); | |
| 41 | + } | |
| 42 | + } | |
| 43 | + | |
| 44 | + $this->parameters[$this->languageParameterName] = $_SESSION['LanguageComponent'][$this->languageParameterName]; | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Checks to see if any parameters are given from the configuration in the CMS | |
| 49 | + */ | |
| 50 | + private function checkParameters() | |
| 51 | +	{ | |
| 52 | +		if (isset($this->parameters['defaultLanguage'])) { | |
| 53 | + $this->defaultLanguage = $this->parameters['defaultLanguage']; | |
| 54 | + unset($this->parameters['defaultLanguage']); | |
| 55 | + } | |
| 56 | +		if (isset($this->parameters['acceptedLanguages'])) { | |
| 57 | +			$this->acceptedLanguages = explode(',', $this->parameters['acceptedLanguages']); | |
| 58 | + unset($this->parameters['acceptedLanguages']); | |
| 59 | + } | |
| 60 | +		if (isset($this->parameters['languageParameterName'])) { | |
| 61 | + $this->languageParameterName = $this->parameters['languageParameterName']; | |
| 62 | + unset($this->parameters['languageParameterName']); | |
| 63 | + } | |
| 64 | +		if (isset($this->parameters['forceRedirect'])) { | |
| 65 | + $this->forceRedirect = (bool) $this->parameters['forceRedirect']; | |
| 66 | + unset($this->parameters['forceRedirect']); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * @return array | |
| 72 | + */ | |
| 73 | + public function getParameters() | |
| 74 | +	{ | |
| 75 | + return $this->parameters; | |
| 76 | + } | |
| 77 | + | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Check if the found language is allowed and | |
| 81 | + * if an action is to be taken. | |
| 82 | + * | |
| 83 | + * @param $lang | |
| 84 | + * @param $request | |
| 85 | + */ | |
| 86 | + private function detectLanguage($lang, $request) | |
| 87 | +	{ | |
| 88 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $this->defaultLanguage; | |
| 89 | + | |
| 90 | +		if ($this->acceptedLanguages === null) { | |
| 91 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; | |
| 92 | +		} else if (in_array($lang, $this->acceptedLanguages)) { | |
| 93 | + $_SESSION['LanguageComponent'][$this->languageParameterName] = $lang; | |
| 94 | +		} else { | |
| 95 | + $lang = $this->defaultLanguage; | |
| 96 | + } | |
| 97 | + | |
| 98 | + $this->sessionValues = $_SESSION['LanguageComponent']; | |
| 99 | + | |
| 100 | +		if ($this->forceRedirect === true) { | |
| 101 | +			if (substr($request::$relativeUri, 0, 2) !== $lang ) { | |
| 102 | +				if ($lang !== $this->defaultLanguage) { | |
| 103 | +					header('Location: ' . $request::$subfolders . $lang . '/' . $request::$relativeUri); | |
| 104 | + exit; | |
| 105 | + } | |
| 106 | + } | |
| 107 | + } | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * Detect if the language is switched manually | |
| 112 | + * | |
| 113 | + * @param $request | |
| 114 | + */ | |
| 115 | + private function checkLanguageSwitch($request) | |
| 116 | +	{ | |
| 117 | +		if (isset($request::$get['langSwitch'])) { | |
| 118 | + $this->forceRedirect = true; | |
| 119 | + $this->detectLanguage($request::$get['langSwitch'], $request); | |
| 120 | + } | |
| 121 | + } | |
| 122 | + | |
| 123 | + /* | |
| 124 | 124 | * These functions are required by the interface, but not for the functionality | 
| 125 | 125 | */ | 
| 126 | -    public function run(JsonStorage $storage) {} | |
| 127 | -    public function render() {} | |
| 128 | -    public function get() {} | |
| 126 | +	public function run(JsonStorage $storage) {} | |
| 127 | +	public function render() {} | |
| 128 | +	public function get() {} | |
| 129 | 129 | } | 
| 130 | 130 | \ No newline at end of file | 
| @@ -11,37 +11,37 @@ | ||
| 11 | 11 | |
| 12 | 12 | abstract class StopWordsFilter implements Filter | 
| 13 | 13 |  { | 
| 14 | - protected $tokens; | |
| 15 | - protected $stopWords = array(); | |
| 14 | + protected $tokens; | |
| 15 | + protected $stopWords = array(); | |
| 16 | 16 | |
| 17 | - /** | |
| 18 | - * StopWordsFilter constructor. | |
| 19 | - * @param array $tokens | |
| 20 | - */ | |
| 21 | - public function __construct($tokens) | |
| 22 | -    { | |
| 23 | - $this->tokens = $tokens; | |
| 24 | - } | |
| 17 | + /** | |
| 18 | + * StopWordsFilter constructor. | |
| 19 | + * @param array $tokens | |
| 20 | + */ | |
| 21 | + public function __construct($tokens) | |
| 22 | +	{ | |
| 23 | + $this->tokens = $tokens; | |
| 24 | + } | |
| 25 | 25 | |
| 26 | - /** | |
| 27 | - * @return array | |
| 28 | - */ | |
| 29 | - public function getFilterResults() | |
| 30 | -    { | |
| 31 | -        foreach ($this->stopWords as $stopWord) { | |
| 32 | -            foreach ($this->tokens as $field => $tokens) { | |
| 33 | -                if (isset($tokens[$stopWord])) { | |
| 34 | - $tokens[$stopWord] = null; | |
| 35 | - unset($tokens[$stopWord]); | |
| 36 | - $tokens = array_filter($tokens); | |
| 37 | - asort($tokens); | |
| 38 | - } | |
| 26 | + /** | |
| 27 | + * @return array | |
| 28 | + */ | |
| 29 | + public function getFilterResults() | |
| 30 | +	{ | |
| 31 | +		foreach ($this->stopWords as $stopWord) { | |
| 32 | +			foreach ($this->tokens as $field => $tokens) { | |
| 33 | +				if (isset($tokens[$stopWord])) { | |
| 34 | + $tokens[$stopWord] = null; | |
| 35 | + unset($tokens[$stopWord]); | |
| 36 | + $tokens = array_filter($tokens); | |
| 37 | + asort($tokens); | |
| 38 | + } | |
| 39 | 39 | |
| 40 | - $this->tokens[$field] = $tokens; | |
| 41 | - } | |
| 42 | - } | |
| 43 | - $this->tokens = array_filter($this->tokens); | |
| 44 | - asort($this->tokens); | |
| 45 | - return $this->tokens; | |
| 46 | - } | |
| 40 | + $this->tokens[$field] = $tokens; | |
| 41 | + } | |
| 42 | + } | |
| 43 | + $this->tokens = array_filter($this->tokens); | |
| 44 | + asort($this->tokens); | |
| 45 | + return $this->tokens; | |
| 46 | + } | |
| 47 | 47 | } | 
| 48 | 48 | \ No newline at end of file | 
| @@ -32,11 +32,11 @@ | ||
| 32 | 32 | */ | 
| 33 | 33 |  function shutdownHandler () { | 
| 34 | 34 | $error = error_get_last(); | 
| 35 | -    if (isset($error['type'], $error['message'], $error['file'], $error['line'])) {  | |
| 35 | +	if (isset($error['type'], $error['message'], $error['file'], $error['line'])) {  | |
| 36 | 36 | \library\cc\ErrorHandlingUtil::renderError($error['message'],$error['file'],$error['line'], $error['type']); | 
| 37 | -    }elseif ($error['type'] == 1) { | |
| 38 | - dump($error); | |
| 39 | - } | |
| 37 | +	}elseif ($error['type'] == 1) { | |
| 38 | + dump($error); | |
| 39 | + } | |
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | |
| @@ -18,87 +18,87 @@ | ||
| 18 | 18 | */ | 
| 19 | 19 | class Document | 
| 20 | 20 |  { | 
| 21 | - public $id; | |
| 22 | - public $path; | |
| 23 | - public $title; | |
| 24 | - public $slug; | |
| 25 | - public $type; | |
| 26 | - public $documentType; | |
| 27 | - public $documentTypeSlug; | |
| 28 | - public $state; | |
| 29 | - public $lastModificationDate; | |
| 30 | - public $creationDate; | |
| 31 | - public $lastModifiedBy; | |
| 32 | - protected $fields; | |
| 33 | - protected $bricks; | |
| 34 | - protected $dynamicBricks; | |
| 35 | - protected $content; | |
| 21 | + public $id; | |
| 22 | + public $path; | |
| 23 | + public $title; | |
| 24 | + public $slug; | |
| 25 | + public $type; | |
| 26 | + public $documentType; | |
| 27 | + public $documentTypeSlug; | |
| 28 | + public $state; | |
| 29 | + public $lastModificationDate; | |
| 30 | + public $creationDate; | |
| 31 | + public $lastModifiedBy; | |
| 32 | + protected $fields; | |
| 33 | + protected $bricks; | |
| 34 | + protected $dynamicBricks; | |
| 35 | + protected $content; | |
| 36 | 36 | |
| 37 | - protected $dbHandle; | |
| 37 | + protected $dbHandle; | |
| 38 | 38 | |
| 39 | -    protected $jsonEncodedFields = array('fields', 'bricks', 'dynamicBricks'); | |
| 39 | +	protected $jsonEncodedFields = array('fields', 'bricks', 'dynamicBricks'); | |
| 40 | 40 | |
| 41 | -    public function __get($name) { | |
| 42 | -        if (in_array($name, $this->jsonEncodedFields)) { | |
| 43 | -            if (is_string($this->$name)) { | |
| 44 | - return json_decode($this->$name); | |
| 45 | -            } else { | |
| 46 | - return $this->$name; | |
| 47 | - } | |
| 48 | -        } elseif ($name === 'content') { | |
| 49 | -            if ($this->dbHandle === null) { | |
| 50 | -                throw new \Exception('Document doesnt have a dbHandle handle. (path: ' . $this->path . ')'); | |
| 51 | -            } else { | |
| 52 | -                if ($this->content === null) { | |
| 53 | - $this->getContent(); | |
| 54 | - } | |
| 55 | - return $this->content; | |
| 56 | - } | |
| 57 | -        } elseif ($name === 'dbHandle') { | |
| 58 | -            throw new \Exception('Trying to get protected property repository.'); | |
| 59 | - } | |
| 60 | - return $this->$name; | |
| 61 | - } | |
| 41 | +	public function __get($name) { | |
| 42 | +		if (in_array($name, $this->jsonEncodedFields)) { | |
| 43 | +			if (is_string($this->$name)) { | |
| 44 | + return json_decode($this->$name); | |
| 45 | +			} else { | |
| 46 | + return $this->$name; | |
| 47 | + } | |
| 48 | +		} elseif ($name === 'content') { | |
| 49 | +			if ($this->dbHandle === null) { | |
| 50 | +				throw new \Exception('Document doesnt have a dbHandle handle. (path: ' . $this->path . ')'); | |
| 51 | +			} else { | |
| 52 | +				if ($this->content === null) { | |
| 53 | + $this->getContent(); | |
| 54 | + } | |
| 55 | + return $this->content; | |
| 56 | + } | |
| 57 | +		} elseif ($name === 'dbHandle') { | |
| 58 | +			throw new \Exception('Trying to get protected property repository.'); | |
| 59 | + } | |
| 60 | + return $this->$name; | |
| 61 | + } | |
| 62 | 62 | |
| 63 | -    public function __set($name, $value) { | |
| 64 | -        if (in_array($name, $this->jsonEncodedFields)) { | |
| 65 | - $this->$name = json_encode($value); | |
| 66 | -        } elseif ($name === 'content') { | |
| 67 | - // Dont do anything for now.. | |
| 68 | - return; | |
| 69 | - } | |
| 63 | +	public function __set($name, $value) { | |
| 64 | +		if (in_array($name, $this->jsonEncodedFields)) { | |
| 65 | + $this->$name = json_encode($value); | |
| 66 | +		} elseif ($name === 'content') { | |
| 67 | + // Dont do anything for now.. | |
| 68 | + return; | |
| 69 | + } | |
| 70 | 70 | |
| 71 | - $this->$name = $value; | |
| 72 | - } | |
| 71 | + $this->$name = $value; | |
| 72 | + } | |
| 73 | 73 | |
| 74 | - /** | |
| 75 | - * @throws \Exception | |
| 76 | - */ | |
| 77 | - protected function getContent() | |
| 78 | -    { | |
| 79 | - $folderPathWithWildcard = $this->path . '%'; | |
| 80 | - $sql = ' SELECT * | |
| 74 | + /** | |
| 75 | + * @throws \Exception | |
| 76 | + */ | |
| 77 | + protected function getContent() | |
| 78 | +	{ | |
| 79 | + $folderPathWithWildcard = $this->path . '%'; | |
| 80 | + $sql = ' SELECT * | |
| 81 | 81 | FROM documents | 
| 82 | 82 | WHERE `path` LIKE ' . $this->dbHandle->quote($folderPathWithWildcard) . ' | 
| 83 | 83 | AND substr(`path`, ' . (strlen($this->path) + 2) . ') NOT LIKE "%/%" | 
| 84 | 84 | AND substr(`path`, ' . (strlen($this->path) + 1) . ', 1) = "/" | 
| 85 | 85 | AND path != ' . $this->dbHandle->quote($this->path) . ' | 
| 86 | 86 | '; | 
| 87 | - $stmt = $this->dbHandle->query($sql); | |
| 88 | -        if ($stmt === false) { | |
| 89 | - $errorInfo = $this->dbHandle->errorInfo(); | |
| 90 | - $errorMsg = $errorInfo[2]; | |
| 91 | -            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); | |
| 92 | - } | |
| 93 | - $contents = $stmt->fetchAll(\PDO::FETCH_CLASS, '\library\storage\Document'); | |
| 94 | -        foreach ($contents as $key => $document) { | |
| 95 | -            if ($document->type === 'folder') { | |
| 96 | - $document->dbHandle = $this->dbHandle; | |
| 97 | - $contents[$key] = $document; | |
| 98 | - } | |
| 99 | - } | |
| 100 | - $this->content = $contents; | |
| 101 | - } | |
| 87 | + $stmt = $this->dbHandle->query($sql); | |
| 88 | +		if ($stmt === false) { | |
| 89 | + $errorInfo = $this->dbHandle->errorInfo(); | |
| 90 | + $errorMsg = $errorInfo[2]; | |
| 91 | +			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); | |
| 92 | + } | |
| 93 | + $contents = $stmt->fetchAll(\PDO::FETCH_CLASS, '\library\storage\Document'); | |
| 94 | +		foreach ($contents as $key => $document) { | |
| 95 | +			if ($document->type === 'folder') { | |
| 96 | + $document->dbHandle = $this->dbHandle; | |
| 97 | + $contents[$key] = $document; | |
| 98 | + } | |
| 99 | + } | |
| 100 | + $this->content = $contents; | |
| 101 | + } | |
| 102 | 102 | |
| 103 | 103 | /** | 
| 104 | 104 | * @return string | 
| @@ -13,26 +13,26 @@ | ||
| 13 | 13 | class ImagesRouting implements CmsRouting | 
| 14 | 14 |  { | 
| 15 | 15 | |
| 16 | - /** | |
| 17 | - * ImagesRouting constructor. | |
| 18 | - * @param \library\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 \library\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 |