@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | return imagejpeg($imageResource, $path, $quality); |
| 60 | 60 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
| 61 | 61 | return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
| 65 | 64 | } |
| 66 | 65 | return false; |
@@ -101,8 +100,9 @@ discard block |
||
| 101 | 100 | // Load the image into a string |
| 102 | 101 | $file = fopen($p_sFile,"rb"); |
| 103 | 102 | $read = fread($file,10); |
| 104 | - while(!feof($file)&&($read<>"")) |
|
| 105 | - $read .= fread($file,1024); |
|
| 103 | + while(!feof($file)&&($read<>"")) { |
|
| 104 | + $read .= fread($file,1024); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | $temp = unpack("H*",$read); |
| 108 | 108 | $hex = $temp[1]; |
@@ -153,8 +153,9 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | // If padding needed, ignore image-padding |
| 155 | 155 | // Shift i to the ending of the current 32-bit-block |
| 156 | - if ($usePadding) |
|
| 157 | - $i += $width%4; |
|
| 156 | + if ($usePadding) { |
|
| 157 | + $i += $width%4; |
|
| 158 | + } |
|
| 158 | 159 | |
| 159 | 160 | // Reset horizontal position |
| 160 | 161 | $x = 0; |
@@ -163,8 +164,9 @@ discard block |
||
| 163 | 164 | $y++; |
| 164 | 165 | |
| 165 | 166 | // Reached the image-height? Break the for-loop |
| 166 | - if ($y>$height) |
|
| 167 | - break; |
|
| 167 | + if ($y>$height) { |
|
| 168 | + break; |
|
| 169 | + } |
|
| 168 | 170 | } |
| 169 | 171 | |
| 170 | 172 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
@@ -73,6 +73,7 @@ |
||
| 73 | 73 | * @see http://www.php.net/manual/en/function.image-type-to-mime-type.php |
| 74 | 74 | * @param string $imagePath |
| 75 | 75 | * @param bool $getExtension |
| 76 | + * @return integer |
|
| 76 | 77 | */ |
| 77 | 78 | public function GetImageMimeType($imagePath, $getExtension = false) |
| 78 | 79 | { |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | $imageContent = file_get_contents($imageContainer); |
| 33 | 33 | $this->_imageResource = imagecreatefromstring($imageContent); |
| 34 | 34 | } |
| 35 | - } elseif(is_string($imageContainer)) { |
|
| 35 | + } elseif (is_string($imageContainer)) { |
|
| 36 | 36 | $this->_imageResource = imagecreatefromstring($imageContainer); |
| 37 | 37 | } else { |
| 38 | - throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>' . var_export($imageContainer, true) . '</pre>'); |
|
| 38 | + throw new \Exception('Could not create image resource, accepted inputs are: "resource of type (gd)", path_to_image and "string". <br /><pre>'.var_export($imageContainer, true).'</pre>'); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | if ($mimeTypeConstantValue == IMAGETYPE_GIF) { |
| 57 | 57 | return imagegif($imageResource, $path); |
| 58 | - } elseif ($mimeTypeConstantValue == IMAGETYPE_JPEG) { |
|
| 58 | + } elseif ($mimeTypeConstantValue == IMAGETYPE_JPEG) { |
|
| 59 | 59 | return imagejpeg($imageResource, $path, $quality); |
| 60 | 60 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
| 61 | - return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
|
| 61 | + return imagepng($imageResource, $path, (intval($quality / 10) - 1)); |
|
| 62 | 62 | } |
| 63 | 63 | else { |
| 64 | 64 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | if (function_exists('exif_imagetype')) { |
| 80 | 80 | $exif = exif_imagetype($imagePath); |
| 81 | 81 | } else { |
| 82 | - if ((list($width, $height, $type, $attr) = getimagesize($imagePath)) !== false ) { |
|
| 82 | + if ((list($width, $height, $type, $attr) = getimagesize($imagePath)) !== false) { |
|
| 83 | 83 | $exif = $type; |
| 84 | 84 | } else { |
| 85 | 85 | $exif = false; |
@@ -99,86 +99,86 @@ discard block |
||
| 99 | 99 | public function CreateImageFromBmp($p_sFile) |
| 100 | 100 | { |
| 101 | 101 | // Load the image into a string |
| 102 | - $file = fopen($p_sFile,"rb"); |
|
| 103 | - $read = fread($file,10); |
|
| 104 | - while(!feof($file)&&($read<>"")) |
|
| 105 | - $read .= fread($file,1024); |
|
| 102 | + $file = fopen($p_sFile, "rb"); |
|
| 103 | + $read = fread($file, 10); |
|
| 104 | + while (!feof($file) && ($read <> "")) |
|
| 105 | + $read .= fread($file, 1024); |
|
| 106 | 106 | |
| 107 | - $temp = unpack("H*",$read); |
|
| 108 | - $hex = $temp[1]; |
|
| 109 | - $header = substr($hex,0,108); |
|
| 110 | - $width=null; |
|
| 111 | - $height=null; |
|
| 107 | + $temp = unpack("H*", $read); |
|
| 108 | + $hex = $temp[1]; |
|
| 109 | + $header = substr($hex, 0, 108); |
|
| 110 | + $width = null; |
|
| 111 | + $height = null; |
|
| 112 | 112 | |
| 113 | 113 | // Process the header |
| 114 | 114 | // Structure: http://www.fastgraph.com/help/bmp_header_format.html |
| 115 | - if (substr($header,0,4)=="424d") |
|
| 115 | + if (substr($header, 0, 4) == "424d") |
|
| 116 | 116 | { |
| 117 | 117 | // Cut it in parts of 2 bytes |
| 118 | - $header_parts = str_split($header,2); |
|
| 118 | + $header_parts = str_split($header, 2); |
|
| 119 | 119 | |
| 120 | 120 | // Get the width 4 bytes |
| 121 | - $width = hexdec($header_parts[19].$header_parts[18]); |
|
| 121 | + $width = hexdec($header_parts[19].$header_parts[18]); |
|
| 122 | 122 | |
| 123 | 123 | // Get the height 4 bytes |
| 124 | - $height = hexdec($header_parts[23].$header_parts[22]); |
|
| 124 | + $height = hexdec($header_parts[23].$header_parts[22]); |
|
| 125 | 125 | |
| 126 | 126 | // Unset the header params |
| 127 | 127 | unset($header_parts); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // Define starting X and Y |
| 131 | - $x = 0; |
|
| 132 | - $y = 1; |
|
| 131 | + $x = 0; |
|
| 132 | + $y = 1; |
|
| 133 | 133 | |
| 134 | 134 | // Create newimage |
| 135 | - $image = imagecreatetruecolor($width,$height); |
|
| 135 | + $image = imagecreatetruecolor($width, $height); |
|
| 136 | 136 | |
| 137 | 137 | // Grab the body from the image |
| 138 | - $body = substr($hex,108); |
|
| 138 | + $body = substr($hex, 108); |
|
| 139 | 139 | |
| 140 | 140 | // Calculate if padding at the end-line is needed |
| 141 | 141 | // Divided by two to keep overview. |
| 142 | 142 | // 1 byte = 2 HEX-chars |
| 143 | - $body_size = (strlen($body)/2); |
|
| 144 | - $header_size = ($width*$height); |
|
| 143 | + $body_size = (strlen($body) / 2); |
|
| 144 | + $header_size = ($width * $height); |
|
| 145 | 145 | |
| 146 | 146 | // Use end-line padding? Only when needed |
| 147 | - $usePadding = ($body_size>($header_size*3)+4); |
|
| 147 | + $usePadding = ($body_size > ($header_size * 3) + 4); |
|
| 148 | 148 | |
| 149 | 149 | // Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption |
| 150 | 150 | // Calculate the next DWORD-position in the body |
| 151 | - for ($i=0;$i<$body_size;$i+=3) |
|
| 151 | + for ($i = 0; $i < $body_size; $i += 3) |
|
| 152 | 152 | { |
| 153 | 153 | // Calculate line-ending and padding |
| 154 | - if ($x>=$width) |
|
| 154 | + if ($x >= $width) |
|
| 155 | 155 | { |
| 156 | 156 | // If padding needed, ignore image-padding |
| 157 | 157 | // Shift i to the ending of the current 32-bit-block |
| 158 | 158 | if ($usePadding) |
| 159 | - $i += $width%4; |
|
| 159 | + $i += $width % 4; |
|
| 160 | 160 | |
| 161 | 161 | // Reset horizontal position |
| 162 | - $x = 0; |
|
| 162 | + $x = 0; |
|
| 163 | 163 | |
| 164 | 164 | // Raise the height-position (bottom-up) |
| 165 | 165 | $y++; |
| 166 | 166 | |
| 167 | 167 | // Reached the image-height? Break the for-loop |
| 168 | - if ($y>$height) |
|
| 168 | + if ($y > $height) |
|
| 169 | 169 | break; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
| 173 | 173 | // Define $i_pos as absolute position in the body |
| 174 | - $i_pos = $i*2; |
|
| 175 | - $r = hexdec($body[$i_pos+4].$body[$i_pos+5]); |
|
| 176 | - $g = hexdec($body[$i_pos+2].$body[$i_pos+3]); |
|
| 177 | - $b = hexdec($body[$i_pos].$body[$i_pos+1]); |
|
| 174 | + $i_pos = $i * 2; |
|
| 175 | + $r = hexdec($body[$i_pos + 4].$body[$i_pos + 5]); |
|
| 176 | + $g = hexdec($body[$i_pos + 2].$body[$i_pos + 3]); |
|
| 177 | + $b = hexdec($body[$i_pos].$body[$i_pos + 1]); |
|
| 178 | 178 | |
| 179 | 179 | // Calculate and draw the pixel |
| 180 | - $color = imagecolorallocate($image,$r,$g,$b); |
|
| 181 | - imagesetpixel($image,$x,$height-$y,$color); |
|
| 180 | + $color = imagecolorallocate($image, $r, $g, $b); |
|
| 181 | + imagesetpixel($image, $x, $height - $y, $color); |
|
| 182 | 182 | |
| 183 | 183 | // Raise the horizontal position |
| 184 | 184 | $x++; |
@@ -61,7 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function calculateX($imageResource) |
| 63 | 63 | { |
| 64 | - if (intval($this->_x) === $this->_x) return $this->_x; |
|
| 64 | + if (intval($this->_x) === $this->_x) { |
|
| 65 | + return $this->_x; |
|
| 66 | + } |
|
| 65 | 67 | |
| 66 | 68 | $x = strtolower($this->_x); |
| 67 | 69 | |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | */ |
| 87 | 89 | public function calculateY($imageResource) |
| 88 | 90 | { |
| 89 | - if (intval($this->_y) === $this->_y) return $this->_y; |
|
| 91 | + if (intval($this->_y) === $this->_y) { |
|
| 92 | + return $this->_y; |
|
| 93 | + } |
|
| 90 | 94 | |
| 91 | 95 | $y = strtolower($this->_y); |
| 92 | 96 | |
@@ -123,7 +127,9 @@ discard block |
||
| 123 | 127 | */ |
| 124 | 128 | public function GetWatermark() |
| 125 | 129 | { |
| 126 | - if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
| 130 | + if ($this->_watermark == null) { |
|
| 131 | + throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
| 132 | + } |
|
| 127 | 133 | return $this->_watermark; |
| 128 | 134 | } |
| 129 | 135 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * Use build-in logic to position the x of watermark |
| 58 | 58 | * |
| 59 | 59 | * @param string $imageResource |
| 60 | - * @return self |
|
| 60 | + * @return integer |
|
| 61 | 61 | */ |
| 62 | 62 | protected function calculateX($imageResource) |
| 63 | 63 | { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * Use build-in logic to position the y of watermark |
| 83 | 83 | * |
| 84 | 84 | * @param string $imageResource |
| 85 | - * @return self |
|
| 85 | + * @return integer |
|
| 86 | 86 | */ |
| 87 | 87 | public function calculateY($imageResource) |
| 88 | 88 | { |
@@ -131,6 +131,7 @@ discard block |
||
| 131 | 131 | * Set the x |
| 132 | 132 | * |
| 133 | 133 | * @param int | string $x |
| 134 | + * @param string $x |
|
| 134 | 135 | * @return self |
| 135 | 136 | */ |
| 136 | 137 | public function SetX($x) |
@@ -143,6 +144,7 @@ discard block |
||
| 143 | 144 | * Set the y |
| 144 | 145 | * |
| 145 | 146 | * @param int | string $y |
| 147 | + * @param string $y |
|
| 146 | 148 | * @return self |
| 147 | 149 | */ |
| 148 | 150 | public function SetY($y) |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | |
| 64 | 64 | // Define the ratio and adjust the width and height |
| 65 | 65 | if ($this->_preserveAspectRatio) { |
| 66 | - $ratio = min($this->_width/$originalWidth, $this->_height/$originalHeight); |
|
| 66 | + $ratio = min($this->_width / $originalWidth, $this->_height / $originalHeight); |
|
| 67 | 67 | $this->_width = $originalWidth * $ratio; |
| 68 | 68 | $this->_height = $originalHeight * $ratio; |
| 69 | 69 | } |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | |
| 27 | 27 | // Define which ratio will be used, depending on which is the smallest side |
| 28 | 28 | $ratio = min($hRatio, $wRatio); |
| 29 | - if($ratio > 1) $ratio = 1; |
|
| 29 | + if ($ratio > 1) $ratio = 1; |
|
| 30 | 30 | |
| 31 | 31 | // Define sizes |
| 32 | 32 | $this->_destWidth = floor($originalWidth * $ratio); |
| 33 | 33 | $this->_destHeight = floor($originalHeight * $ratio); |
| 34 | 34 | |
| 35 | 35 | // Define margins |
| 36 | - $this->_destX = floor(($this->_width - $this->_destWidth) / 2); |
|
| 36 | + $this->_destX = floor(($this->_width - $this->_destWidth) / 2); |
|
| 37 | 37 | $this->_destY = floor(($this->_height - $this->_destHeight) / 2); |
| 38 | 38 | |
| 39 | 39 | // Execute the Crop method with the given parameters |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | // Define which ratio will be used, depending on which is the smallest side |
| 28 | 28 | $ratio = min($hRatio, $wRatio); |
| 29 | - if($ratio > 1) $ratio = 1; |
|
| 29 | + if($ratio > 1) { |
|
| 30 | + $ratio = 1; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | // Define sizes |
| 32 | 34 | $this->_destWidth = floor($originalWidth * $ratio); |
@@ -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 | |
@@ -40,7 +40,9 @@ |
||
| 40 | 40 | |
| 41 | 41 | // Define which ratio will be used, depending on which is the biggest side |
| 42 | 42 | $ratio = $wRatio < $hRatio ? $wRatio : $hRatio; |
| 43 | - if ($ratio < 1) $ratio = 1; |
|
| 43 | + if ($ratio < 1) { |
|
| 44 | + $ratio = 1; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | // Calculate the destination width, height, x and y |
| 46 | 48 | $this->_destWidth = $originalWidth / $ratio; |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $output = ''; |
| 50 | 50 | for ($i = 0; $i < $count; $i += 16) { |
| 51 | 51 | $random_state = |
| 52 | - md5(microtime() . $random_state); |
|
| 52 | + md5(microtime().$random_state); |
|
| 53 | 53 | $output .= |
| 54 | 54 | pack('H*', md5($random_state)); |
| 55 | 55 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | $relativeDocumentUri = current($this->matchedSitemapItem->matches[1]); |
| 17 | 17 | if (isset($this->parameters['folder'])) { |
| 18 | - $relativeDocumentUri = $this->parameters['folder'] . $relativeDocumentUri; |
|
| 18 | + $relativeDocumentUri = $this->parameters['folder'].$relativeDocumentUri; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $document = $storage->getDocumentBySlug($relativeDocumentUri); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param array $parameters |
| 41 | 41 | * @param $matchedSitemapItem |
| 42 | 42 | */ |
| 43 | - public function __construct($template='', Request $request, $parameters=array(), $matchedSitemapItem) |
|
| 43 | + public function __construct($template = '', Request $request, $parameters = array(), $matchedSitemapItem) |
|
| 44 | 44 | { |
| 45 | 45 | $this->template = $template; |
| 46 | 46 | $this->request = $request; |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | * @return string |
| 87 | 87 | * @throws \Exception |
| 88 | 88 | */ |
| 89 | - public function renderTemplate($template='') |
|
| 89 | + public function renderTemplate($template = '') |
|
| 90 | 90 | { |
| 91 | - $templatePath = __DIR__ . '/../../templates/' . $template . '.php'; |
|
| 91 | + $templatePath = __DIR__.'/../../templates/'.$template.'.php'; |
|
| 92 | 92 | if (realpath($templatePath) !== false) { |
| 93 | 93 | ob_clean(); |
| 94 | 94 | $this->parameters['request'] = $this->request; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | include($templatePath); |
| 97 | 97 | return ob_get_contents(); |
| 98 | 98 | } else { |
| 99 | - throw new \Exception('Couldnt find template ' . $templatePath); |
|
| 99 | + throw new \Exception('Couldnt find template '.$templatePath); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $this->parameters['mainNavClass'] = 'documents'; |
| 126 | 126 | if (isset($request::$post['title'], $request::$post['path'])) { |
| 127 | 127 | $this->storage->addDocumentFolder($request::$post); |
| 128 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
| 128 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
| 129 | 129 | exit; |
| 130 | 130 | } |
| 131 | 131 | } elseif ($relativeCmsUri == '/documents/new-document' && isset($request::$get['path']) && in_array('documents', $userRights)) { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if (isset($request::$get['documentType'])) { |
| 136 | 136 | if (isset($request::$post['title'], $request::$get['documentType'], $request::$get['path'])) { |
| 137 | 137 | $this->storage->addDocument($request::$post); |
| 138 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
| 138 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
| 139 | 139 | exit; |
| 140 | 140 | } |
| 141 | 141 | $this->parameters['documentType'] = $this->storage->getDocumentTypeBySlug($request::$get['documentType'], true); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $this->parameters['smallestImage'] = $this->storage->getSmallestImageSet()->slug; |
| 150 | 150 | if (isset($request::$post['title'], $request::$get['slug'])) { |
| 151 | 151 | $this->storage->saveDocument($request::$post); |
| 152 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
| 152 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
| 153 | 153 | exit; |
| 154 | 154 | } |
| 155 | 155 | $this->parameters['document'] = $this->storage->getDocumentBySlug($request::$get['slug']); |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | array_pop($path); |
| 171 | 171 | $path = implode('/', $path); |
| 172 | 172 | |
| 173 | - $request::$get['path'] = '/' . $path; |
|
| 173 | + $request::$get['path'] = '/'.$path; |
|
| 174 | 174 | |
| 175 | 175 | if (isset($request::$post['title'], $request::$post['content'])) { |
| 176 | 176 | $this->storage->saveDocumentFolder($request::$post); |
| 177 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
| 177 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
| 178 | 178 | exit; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | $this->parameters['folder'] = $folder; |
| 183 | 183 | } else if ($relativeCmsUri == '/documents/delete-document' && isset($request::$get['slug']) && in_array('documents', $userRights)) { |
| 184 | 184 | $this->storage->deleteDocumentBySlug($request::$get['slug']); |
| 185 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
| 185 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
| 186 | 186 | exit; |
| 187 | 187 | } else if ($relativeCmsUri == '/documents/delete-folder' && isset($request::$get['slug']) && in_array('documents', $userRights)) { |
| 188 | 188 | $this->storage->deleteDocumentFolderBySlug($request::$get['slug']); |
| 189 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/documents'); |
|
| 189 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/documents'); |
|
| 190 | 190 | exit; |
| 191 | 191 | } elseif ($relativeCmsUri == '/sitemap' && in_array('sitemap', $userRights)) { |
| 192 | 192 | $template = 'cms/sitemap'; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $this->parameters['mainNavClass'] = 'sitemap'; |
| 201 | 201 | if (isset($request::$post['title'], $request::$post['template'], $request::$post['component'])) { |
| 202 | 202 | $this->storage->addSitemapItem($request::$post); |
| 203 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
| 203 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
| 204 | 204 | exit; |
| 205 | 205 | } |
| 206 | 206 | } elseif ($relativeCmsUri == '/sitemap/edit' && isset($request::$get['slug']) && in_array('sitemap', $userRights)) { |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | $sitemapItem = $this->storage->getSitemapItemBySlug($request::$get['slug']); |
| 210 | 210 | if (isset($request::$post['title'], $request::$post['template'], $request::$post['component'])) { |
| 211 | 211 | $this->storage->saveSitemapItem($request::$get['slug'], $request::$post); |
| 212 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
| 212 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
| 213 | 213 | exit; |
| 214 | 214 | } |
| 215 | 215 | $this->parameters['sitemapItem'] = $sitemapItem; |
| 216 | 216 | } elseif ($relativeCmsUri == '/sitemap/delete' && isset($request::$get['slug']) && in_array('sitemap', $userRights)) { |
| 217 | 217 | $this->storage->deleteSitemapItemBySlug($request::$get['slug']); |
| 218 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/sitemap'); |
|
| 218 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/sitemap'); |
|
| 219 | 219 | exit; |
| 220 | 220 | } elseif ($relativeCmsUri == '/images' && in_array('images', $userRights)) { |
| 221 | 221 | $template = 'cms/images'; |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | $this->parameters['mainNavClass'] = 'images'; |
| 232 | 232 | if (isset($_FILES['file'])) { |
| 233 | 233 | $this->storage->addImage($_FILES['file']); |
| 234 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/images'); |
|
| 234 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/images'); |
|
| 235 | 235 | exit; |
| 236 | 236 | } |
| 237 | 237 | } elseif ($relativeCmsUri == '/images/delete' && isset($request::$get['file']) && in_array('images', $userRights)) { |
| 238 | 238 | $this->storage->deleteImageByName($request::$get['file']); |
| 239 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/images'); |
|
| 239 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/images'); |
|
| 240 | 240 | exit; |
| 241 | 241 | } elseif ($relativeCmsUri == '/images/show' && isset($request::$get['file']) && in_array('images', $userRights)) { |
| 242 | 242 | $template = 'cms/images/show'; |
@@ -255,30 +255,30 @@ discard block |
||
| 255 | 255 | $this->parameters['mainNavClass'] = 'files'; |
| 256 | 256 | if (isset($_FILES['file'])) { |
| 257 | 257 | $this->storage->addFile($_FILES['file']); |
| 258 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/files'); |
|
| 258 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/files'); |
|
| 259 | 259 | exit; |
| 260 | 260 | } |
| 261 | 261 | } elseif ($relativeCmsUri == '/files/get' && isset($request::$get['file']) && in_array('files', $userRights)) { |
| 262 | 262 | $file = $this->storage->getFileByName($request::$get['file']); |
| 263 | - $path = realpath(__DIR__ . '/../../www/files/'); |
|
| 264 | - $quoted = sprintf('"%s"', addcslashes(basename($path . '/' . $file->file), '"\\')); |
|
| 265 | - $size = filesize($path . '/' . $file->file); |
|
| 263 | + $path = realpath(__DIR__.'/../../www/files/'); |
|
| 264 | + $quoted = sprintf('"%s"', addcslashes(basename($path.'/'.$file->file), '"\\')); |
|
| 265 | + $size = filesize($path.'/'.$file->file); |
|
| 266 | 266 | |
| 267 | 267 | header('Content-Description: File Transfer'); |
| 268 | - header('Content-Type: ' . $file->type); |
|
| 269 | - header('Content-Disposition: attachment; filename=' . $quoted); |
|
| 268 | + header('Content-Type: '.$file->type); |
|
| 269 | + header('Content-Disposition: attachment; filename='.$quoted); |
|
| 270 | 270 | header('Content-Transfer-Encoding: binary'); |
| 271 | 271 | header('Connection: Keep-Alive'); |
| 272 | 272 | header('Expires: 0'); |
| 273 | 273 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
| 274 | 274 | header('Pragma: public'); |
| 275 | - header('Content-Length: ' . $size); |
|
| 275 | + header('Content-Length: '.$size); |
|
| 276 | 276 | |
| 277 | - readfile($path . '/' . $file->file); |
|
| 277 | + readfile($path.'/'.$file->file); |
|
| 278 | 278 | exit; |
| 279 | 279 | } elseif ($relativeCmsUri == '/files/delete' && isset($request::$get['file']) && in_array('files', $userRights)) { |
| 280 | 280 | $this->storage->deleteFileByName($request::$get['file']); |
| 281 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/files'); |
|
| 281 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/files'); |
|
| 282 | 282 | exit; |
| 283 | 283 | } elseif ($relativeCmsUri == '/configuration' && in_array('configuration', $userRights)) { |
| 284 | 284 | $template = 'cms/configuration'; |
@@ -292,12 +292,12 @@ discard block |
||
| 292 | 292 | $this->parameters['mainNavClass'] = 'configuration'; |
| 293 | 293 | if (isset($_POST['username'])) { |
| 294 | 294 | $this->storage->addUser($request::$post); |
| 295 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/users'); |
|
| 295 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/users'); |
|
| 296 | 296 | exit; |
| 297 | 297 | } |
| 298 | 298 | } elseif ($relativeCmsUri == '/configuration/users/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
| 299 | 299 | $this->storage->deleteUserBySlug($request::$get['slug']); |
| 300 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/users'); |
|
| 300 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/users'); |
|
| 301 | 301 | exit; |
| 302 | 302 | } elseif ($relativeCmsUri == '/configuration/users/edit' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
| 303 | 303 | $template = 'cms/configuration/users-form'; |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $this->parameters['user'] = $this->storage->getUserBySlug($request::$get['slug']); |
| 306 | 306 | if (isset($_POST['username'])) { |
| 307 | 307 | $this->storage->saveUser($request::$get['slug'], $request::$post); |
| 308 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/users'); |
|
| 308 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/users'); |
|
| 309 | 309 | exit; |
| 310 | 310 | } |
| 311 | 311 | } elseif ($relativeCmsUri == '/configuration/document-types' && in_array('configuration', $userRights)) { |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $bricks = $this->storage->getBricks(); |
| 319 | 319 | if (isset($request::$post['title'])) { |
| 320 | 320 | $this->storage->addDocumentType($request::$post); |
| 321 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
| 321 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
| 322 | 322 | exit; |
| 323 | 323 | } |
| 324 | 324 | $this->parameters['bricks'] = $bricks; |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | $bricks = $this->storage->getBricks(); |
| 330 | 330 | if (isset($request::$post['title'])) { |
| 331 | 331 | $this->storage->saveDocumentType($request::$get['slug'], $request::$post); |
| 332 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
| 332 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
| 333 | 333 | exit; |
| 334 | 334 | } |
| 335 | 335 | $this->parameters['documentType'] = $documentType; |
| 336 | 336 | $this->parameters['bricks'] = $bricks; |
| 337 | 337 | } elseif ($relativeCmsUri == '/configuration/document-types/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
| 338 | 338 | $this->storage->deleteDocumentTypeBySlug($request::$get['slug']); |
| 339 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/document-types'); |
|
| 339 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/document-types'); |
|
| 340 | 340 | exit; |
| 341 | 341 | } elseif ($relativeCmsUri == '/configuration/bricks' && in_array('configuration', $userRights)) { |
| 342 | 342 | $template = 'cms/configuration/bricks'; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $this->parameters['mainNavClass'] = 'configuration'; |
| 348 | 348 | if (isset($request::$post['title'])) { |
| 349 | 349 | $this->storage->addBrick($request::$post); |
| 350 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
| 350 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
| 351 | 351 | exit; |
| 352 | 352 | } |
| 353 | 353 | } elseif ($relativeCmsUri == '/configuration/bricks/edit' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
@@ -356,13 +356,13 @@ discard block |
||
| 356 | 356 | $brick = $this->storage->getBrickBySlug($request::$get['slug']); |
| 357 | 357 | if (isset($request::$post['title'])) { |
| 358 | 358 | $this->storage->saveBrick($request::$get['slug'], $request::$post); |
| 359 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
| 359 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
| 360 | 360 | exit; |
| 361 | 361 | } |
| 362 | 362 | $this->parameters['brick'] = $brick; |
| 363 | 363 | } elseif ($relativeCmsUri == '/configuration/bricks/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
| 364 | 364 | $this->storage->deleteBrickBySlug($request::$get['slug']); |
| 365 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/bricks'); |
|
| 365 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/bricks'); |
|
| 366 | 366 | exit; |
| 367 | 367 | } elseif ($relativeCmsUri == '/configuration/image-set' && in_array('configuration', $userRights)) { |
| 368 | 368 | $template = 'cms/configuration/image-set'; |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $imageSet = $this->storage->getImageSetBySlug($request::$get['slug']); |
| 375 | 375 | if (isset($request::$post['title'])) { |
| 376 | 376 | $this->storage->saveImageSet($request::$get['slug'], $request::$post); |
| 377 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/image-set'); |
|
| 377 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/image-set'); |
|
| 378 | 378 | exit; |
| 379 | 379 | } |
| 380 | 380 | $this->parameters['imageSet'] = $imageSet; |
@@ -383,17 +383,17 @@ discard block |
||
| 383 | 383 | $this->parameters['mainNavClass'] = 'configuration'; |
| 384 | 384 | if (isset($request::$post['title'])) { |
| 385 | 385 | $this->storage->addImageSet($request::$post); |
| 386 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/image-set'); |
|
| 386 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/image-set'); |
|
| 387 | 387 | exit; |
| 388 | 388 | } |
| 389 | 389 | } elseif ($relativeCmsUri == '/configuration/image-set/delete' && isset($request::$get['slug']) && in_array('configuration', $userRights)) { |
| 390 | 390 | $this->storage->deleteImageSetBySlug($request::$get['slug']); |
| 391 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix'] . '/configuration/image-set'); |
|
| 391 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix'].'/configuration/image-set'); |
|
| 392 | 392 | exit; |
| 393 | 393 | } elseif ($relativeCmsUri == '/log-off') { |
| 394 | 394 | $_SESSION['cloudcontrol'] = null; |
| 395 | 395 | unset($_SESSION['cloudcontrol']); |
| 396 | - header('Location: ' . $request::$subfolders . $this->parameters['cmsPrefix']); |
|
| 396 | + header('Location: '.$request::$subfolders.$this->parameters['cmsPrefix']); |
|
| 397 | 397 | exit; |
| 398 | 398 | } |
| 399 | 399 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | $whitelistIps = explode(',', $this->parameters['whitelistIps']); |
| 409 | 409 | $whitelistIps = array_map("trim", $whitelistIps); |
| 410 | 410 | if (!in_array($remoteAddress, $whitelistIps)) { |
| 411 | - throw new \Exception('Ip address ' . $remoteAddress . ' is not on whitelist'); |
|
| 411 | + throw new \Exception('Ip address '.$remoteAddress.' is not on whitelist'); |
|
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | $blacklistIps = explode(',', $this->parameters['blacklistIps']); |
| 420 | 420 | $blacklistIps = array_map("trim", $blacklistIps); |
| 421 | 421 | if (in_array($remoteAddress, $blacklistIps)) { |
| 422 | - throw new \Exception('Ip address ' . $remoteAddress . ' is on blacklist'); |
|
| 422 | + throw new \Exception('Ip address '.$remoteAddress.' is on blacklist'); |
|
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | } |