@@ -2,7 +2,7 @@ |
||
2 | 2 | <div class="grid-container"> |
3 | 3 | <div class="grid-box-2"> |
4 | 4 | <div class="grid-inner"> |
5 | - <div<?=isset($value) ? ' style="background-image:url(\'' . $request::$subfolders . 'images/' . $value . '\');"' : '' ?> class="selected-image" id="<?=$field->slug?>_selectedImage"></div> |
|
5 | + <div<?=isset($value) ? ' style="background-image:url(\''.$request::$subfolders.'images/'.$value.'\');"' : '' ?> class="selected-image" id="<?=$field->slug?>_selectedImage"></div> |
|
6 | 6 | </div> |
7 | 7 | </div> |
8 | 8 | <div class="grid-box-10"> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | <div class="show-image"> |
11 | 11 | <label>File</label> |
12 | 12 | <div class="value"> |
13 | - <?=isset($image)? $image->file : '' ?> |
|
13 | + <?=isset($image) ? $image->file : '' ?> |
|
14 | 14 | </div> |
15 | 15 | <label>Type</label> |
16 | 16 | <div class="value"> |
17 | - <?=isset($image)? $image->type : '' ?> |
|
17 | + <?=isset($image) ? $image->type : '' ?> |
|
18 | 18 | </div> |
19 | 19 | <label>Size</label> |
20 | 20 | <div class="value"> |
21 | - <?=isset($image)? humanFileSize($image->size) : '' ?> |
|
21 | + <?=isset($image) ? humanFileSize($image->size) : '' ?> |
|
22 | 22 | </div> |
23 | 23 | <label>Set</label> |
24 | 24 | <? if (isset($image)) : ?> |
25 | 25 | <? foreach ($image->set as $key => $set) : ?> |
26 | 26 | <div class="sets"> |
27 | 27 | <label><?=$key?></label> |
28 | - <img src="<?=\library\cc\Request::$subfolders . 'images/' . $set?>" /> |
|
28 | + <img src="<?=\library\cc\Request::$subfolders.'images/'.$set?>" /> |
|
29 | 29 | </div> |
30 | 30 | <? endforeach ?> |
31 | 31 | <? endif ?> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders . $cmsPrefix?>/documents?path=/');};</script> |
|
1 | +<script>window.onload=function(){History.init();History.replaceState(null, 'Cloud Control CMS', '/<?=$request::$subfolders.$cmsPrefix?>/documents?path=/');};</script> |
|
2 | 2 | <section class="documents"> |
3 | 3 | <h2><i class="fa fa-file-text-o"></i> Documents</h2> |
4 | 4 | <nav class="actions"> |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | <? foreach ($documents as $document) : ?> |
25 | 25 | <li class="grid-container"> |
26 | 26 | <? if ($document->type == 'document') : ?> |
27 | - <?renderDocument($document, $cmsPrefix);?> |
|
27 | + <?renderDocument($document, $cmsPrefix); ?> |
|
28 | 28 | <? elseif ($document->type == 'folder') : ?> |
29 | - <?renderFolder($document, $cmsPrefix, '', true);?> |
|
29 | + <?renderFolder($document, $cmsPrefix, '', true); ?> |
|
30 | 30 | <? endif ?> |
31 | 31 | </li> |
32 | 32 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | <? function renderDocument($document, $cmsPrefix, $slugPrefix = '') {?> |
38 | 38 | <div class="grid-box-10"> |
39 | 39 | <h3> |
40 | - <a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"> |
|
40 | + <a class="btn documentTitle" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit"> |
|
41 | 41 | <i class="fa fa-file-text-o"></i> <?=$document->title?> |
42 | 42 | </a> |
43 | 43 | <small class="small state <?=strtolower($document->state)?>"><?=ucfirst($document->state)?></small> |
@@ -53,29 +53,29 @@ discard block |
||
53 | 53 | </h3> |
54 | 54 | </div> |
55 | 55 | <div class="documentActions grid-box-2"> |
56 | - <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
57 | - <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
56 | + <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-document?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
57 | + <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-document?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
58 | 58 | </div> |
59 | 59 | <?}?> |
60 | -<? function renderFolder($document, $cmsPrefix, $slugPrefix ='', $root = false) {?> |
|
60 | +<? function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false) {?> |
|
61 | 61 | <div class="grid-box-8"> |
62 | 62 | <h3> |
63 | - <a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix . $document->slug?>" title="Open"> |
|
63 | + <a class="btn documentTitle openFolder" data-slug="<?=$slugPrefix.$document->slug?>" title="Open"> |
|
64 | 64 | <i class="fa fa-folder-o "></i> <?=$document->title?> |
65 | 65 | </a> |
66 | 66 | </h3> |
67 | 67 | </div> |
68 | 68 | <div class="documentActions grid-box-4"> |
69 | - <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix . $document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
70 | - <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix . $document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
69 | + <a class="btn" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/edit-folder?slug=<?=$slugPrefix.$document->slug?>" title="Edit"><i class="fa fa-pencil"></i></a> |
|
70 | + <a onclick="return confirm('Are you sure you want to delete this item?');" class="btn error" href="<?=\library\cc\Request::$subfolders?><?=$cmsPrefix?>/documents/delete-folder?slug=<?=$slugPrefix.$document->slug?>" title="Delete"><i class="fa fa-times"></i></a> |
|
71 | 71 | </div> |
72 | 72 | <ul class="documents grid-wrapper nested<?=$root ? ' root' : '' ?>"> |
73 | 73 | <? foreach ($document->content as $subDocument) : ?> |
74 | 74 | <li class="grid-container"> |
75 | 75 | <? if ($subDocument->type == 'document') : ?> |
76 | - <?renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?> |
|
76 | + <?renderDocument($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?> |
|
77 | 77 | <? elseif ($subDocument->type == 'folder') : ?> |
78 | - <?renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/');?> |
|
78 | + <?renderFolder($subDocument, $cmsPrefix, $slugPrefix.$document->slug.'/'); ?> |
|
79 | 79 | <? endif ?> |
80 | 80 | </li> |
81 | 81 | <? endforeach ?> |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | </li> |
63 | 63 | <? $nrOfMenuItems += 1 ?> |
64 | 64 | <? endif ?> |
65 | - <li class="grid-box-<?=6 + (5-$nrOfMenuItems)?> log-off-box"> |
|
65 | + <li class="grid-box-<?=6 + (5 - $nrOfMenuItems)?> log-off-box"> |
|
66 | 66 | <a class="btn log-off grid-inner" href="<?=$request::$subfolders?><?=$cmsPrefix?>/log-off"> |
67 | 67 | <i class="fa fa-power-off"></i> |
68 | 68 | <span>Log off</span> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | </main> |
87 | 87 | <script> |
88 | 88 | var subfolders = '<?=$request::$subfolders?>', |
89 | - cmsSubfolders = '<?=$request::$subfolders . $cmsPrefix?>'; |
|
89 | + cmsSubfolders = '<?=$request::$subfolders.$cmsPrefix?>'; |
|
90 | 90 | </script> |
91 | 91 | <script src="<?=$request::$subfolders?>js/cms.js"></script> |
92 | 92 | </body> |
@@ -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 |
@@ -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 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | spl_autoload_extensions('.php'); |
3 | 3 | spl_autoload_register("autoloader"); |
4 | 4 | |
5 | -$rootPath = str_replace('\\', '/', realpath(str_replace('\\', '/', dirname(__FILE__)) . '/../../') . '/'); |
|
5 | +$rootPath = str_replace('\\', '/', realpath(str_replace('\\', '/', dirname(__FILE__)).'/../../').'/'); |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * The function to be registered as the default autoload functino |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | global $rootPath; |
35 | - $file = $rootPath . str_replace('\\', '/', $class) . ".php"; |
|
35 | + $file = $rootPath.str_replace('\\', '/', $class).".php"; |
|
36 | 36 | $debug_backtrace = debug_backtrace(); |
37 | 37 | |
38 | 38 | if (file_exists($file)) { |
39 | 39 | require_once($file); |
40 | 40 | if ($throwException) { |
41 | 41 | if (class_exists($class, false) == false && interface_exists($class, false) == false) { |
42 | - throw new \Exception('Could not load class "' . $class . '" in file ' . $file); |
|
42 | + throw new \Exception('Could not load class "'.$class.'" in file '.$file); |
|
43 | 43 | } else { |
44 | 44 | return true; |
45 | 45 | } |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | } else { |
49 | 49 | if (isset($debug_backtrace[2]) && isset($debug_backtrace[2]['file']) && isset($debug_backtrace[2]['line'])) { |
50 | 50 | if ($throwException) { |
51 | - errorHandler(0, 'Could not load class \'' . $class . '\' in file ' . $rootPath . $file, $debug_backtrace[2]['file'], $debug_backtrace[2]['line']); |
|
51 | + errorHandler(0, 'Could not load class \''.$class.'\' in file '.$rootPath.$file, $debug_backtrace[2]['file'], $debug_backtrace[2]['line']); |
|
52 | 52 | } else { |
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | } else { |
56 | 56 | if ($throwException) { |
57 | - throw new \Exception('Could not load class "' . $class . '" in file ' . $file . "\n" . 'Called from unknown origin.'); |
|
57 | + throw new \Exception('Could not load class "'.$class.'" in file '.$file."\n".'Called from unknown origin.'); |
|
58 | 58 | } else { |
59 | 59 | return false; |
60 | 60 | } |
@@ -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++; |