@@ -19,60 +19,60 @@ |
||
| 19 | 19 | </head><body> |
| 20 | 20 | "; |
| 21 | 21 | if($is_error) { |
| 22 | - $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'> MODX Parse Error </h3> |
|
| 22 | + $parsedMessageString .= "<h3 style='color:red;background:#e0e0e0;padding:2px;'> MODX Parse Error </h3> |
|
| 23 | 23 | <table border='0' cellpadding='1' cellspacing='0'> |
| 24 | 24 | <tr><td colspan='3'>MODX encountered the following error while attempting to parse the requested resource:</td></tr> |
| 25 | 25 | <tr><td colspan='3'><b style='color:red;'>« $msg »</b></td></tr>"; |
| 26 | 26 | } else { |
| 27 | - $parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'> MODX Debug/ stop message </h3> |
|
| 27 | + $parsedMessageString .= "<h3 style='color:#003399; background:#eeeeee;padding:2px;'> MODX Debug/ stop message </h3> |
|
| 28 | 28 | <table border='0' cellpadding='1' cellspacing='0'> |
| 29 | 29 | <tr><td colspan='3'>The MODX parser recieved the following debug/ stop message:</td></tr> |
| 30 | 30 | <tr><td colspan='3'><b style='color:#003399;'>« $msg »</b></td></tr>"; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | if(!empty($query)) { |
| 34 | - $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'> SQL: <span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/> |
|
| 34 | + $parsedMessageString .= "<tr><td colspan='3'><hr size='1' width='98%' style='color:#e0e0e0'/><b style='color:#999;font-size: 9px;border-left:1px solid #c0c0c0; margin-left:10px;'> SQL: <span id='sqlHolder'>$query</span></b><hr size='1' width='98%' style='color:#e0e0e0'/> |
|
| 35 | 35 | <a href='javascript:copyToClip();' style='color:#821517;font-size: 9px; text-decoration: none'>[Copy SQL to ClipBoard]</a><textarea id='holdtext' style='display:none;'></textarea></td></tr>"; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if($text!='') { |
| 39 | 39 | |
| 40 | - $errortype = array ( |
|
| 41 | - E_ERROR => "Error", |
|
| 42 | - E_WARNING => "Warning", |
|
| 43 | - E_PARSE => "Parsing Error", |
|
| 44 | - E_NOTICE => "Notice", |
|
| 45 | - E_CORE_ERROR => "Core Error", |
|
| 46 | - E_CORE_WARNING => "Core Warning", |
|
| 47 | - E_COMPILE_ERROR => "Compile Error", |
|
| 48 | - E_COMPILE_WARNING => "Compile Warning", |
|
| 49 | - E_USER_ERROR => "User Error", |
|
| 50 | - E_USER_WARNING => "User Warning", |
|
| 51 | - E_USER_NOTICE => "User Notice", |
|
| 52 | - ); |
|
| 40 | + $errortype = array ( |
|
| 41 | + E_ERROR => "Error", |
|
| 42 | + E_WARNING => "Warning", |
|
| 43 | + E_PARSE => "Parsing Error", |
|
| 44 | + E_NOTICE => "Notice", |
|
| 45 | + E_CORE_ERROR => "Core Error", |
|
| 46 | + E_CORE_WARNING => "Core Warning", |
|
| 47 | + E_COMPILE_ERROR => "Compile Error", |
|
| 48 | + E_COMPILE_WARNING => "Compile Warning", |
|
| 49 | + E_USER_ERROR => "User Error", |
|
| 50 | + E_USER_WARNING => "User Warning", |
|
| 51 | + E_USER_NOTICE => "User Notice", |
|
| 52 | + ); |
|
| 53 | 53 | |
| 54 | - $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>"; |
|
| 54 | + $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>PHP error debug</b></td></tr>"; |
|
| 55 | 55 | |
| 56 | - $parsedMessageString .= "<tr><td valign='top'> Error: </td>"; |
|
| 57 | - $parsedMessageString .= "<td colspan='2'>$text</td><td> </td>"; |
|
| 58 | - $parsedMessageString .= "</tr>"; |
|
| 56 | + $parsedMessageString .= "<tr><td valign='top'> Error: </td>"; |
|
| 57 | + $parsedMessageString .= "<td colspan='2'>$text</td><td> </td>"; |
|
| 58 | + $parsedMessageString .= "</tr>"; |
|
| 59 | 59 | |
| 60 | - $parsedMessageString .= "<tr><td valign='top'> Error type/ Nr.: </td>"; |
|
| 61 | - $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td> </td>"; |
|
| 62 | - $parsedMessageString .= "</tr>"; |
|
| 60 | + $parsedMessageString .= "<tr><td valign='top'> Error type/ Nr.: </td>"; |
|
| 61 | + $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td> </td>"; |
|
| 62 | + $parsedMessageString .= "</tr>"; |
|
| 63 | 63 | |
| 64 | - $parsedMessageString .= "<tr><td> File: </td>"; |
|
| 65 | - $parsedMessageString .= "<td colspan='2'>$file</td><td> </td>"; |
|
| 66 | - $parsedMessageString .= "</tr>"; |
|
| 64 | + $parsedMessageString .= "<tr><td> File: </td>"; |
|
| 65 | + $parsedMessageString .= "<td colspan='2'>$file</td><td> </td>"; |
|
| 66 | + $parsedMessageString .= "</tr>"; |
|
| 67 | 67 | |
| 68 | - $parsedMessageString .= "<tr><td> Line: </td>"; |
|
| 69 | - $parsedMessageString .= "<td colspan='2'>$line</td><td> </td>"; |
|
| 70 | - $parsedMessageString .= "</tr>"; |
|
| 71 | - if($source!='') { |
|
| 72 | - $parsedMessageString .= "<tr><td valign='top'> Line $line source: </td>"; |
|
| 73 | - $parsedMessageString .= "<td colspan='2'>$source</td><td> </td>"; |
|
| 74 | - $parsedMessageString .= "</tr>"; |
|
| 75 | - } |
|
| 68 | + $parsedMessageString .= "<tr><td> Line: </td>"; |
|
| 69 | + $parsedMessageString .= "<td colspan='2'>$line</td><td> </td>"; |
|
| 70 | + $parsedMessageString .= "</tr>"; |
|
| 71 | + if($source!='') { |
|
| 72 | + $parsedMessageString .= "<tr><td valign='top'> Line $line source: </td>"; |
|
| 73 | + $parsedMessageString .= "<td colspan='2'>$source</td><td> </td>"; |
|
| 74 | + $parsedMessageString .= "</tr>"; |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $parsedMessageString .= "<tr><td> </td></tr><tr><td colspan='3'><b>Parser timing</b></td></tr>"; |
@@ -1,44 +1,44 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** This file is part of KCFinder project |
| 4 | - * |
|
| 5 | - * @desc GD extension class |
|
| 6 | - * @package KCFinder |
|
| 7 | - * @version 2.51 |
|
| 8 | - * @author Pavel Tzonkov <[email protected]> |
|
| 9 | - * @copyright 2010, 2011 KCFinder Project |
|
| 10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | - * @link http://kcfinder.sunhater.com |
|
| 13 | - */ |
|
| 4 | + * |
|
| 5 | + * @desc GD extension class |
|
| 6 | + * @package KCFinder |
|
| 7 | + * @version 2.51 |
|
| 8 | + * @author Pavel Tzonkov <[email protected]> |
|
| 9 | + * @copyright 2010, 2011 KCFinder Project |
|
| 10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | + * @link http://kcfinder.sunhater.com |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class gd {
|
| 16 | 16 | |
| 17 | - /** GD resource |
|
| 18 | - * @var resource */ |
|
| 17 | + /** GD resource |
|
| 18 | + * @var resource */ |
|
| 19 | 19 | protected $image; |
| 20 | 20 | |
| 21 | - /** Image width |
|
| 22 | - * @var integer */ |
|
| 21 | + /** Image width |
|
| 22 | + * @var integer */ |
|
| 23 | 23 | protected $width; |
| 24 | 24 | |
| 25 | - /** Image height |
|
| 26 | - * @var integer */ |
|
| 25 | + /** Image height |
|
| 26 | + * @var integer */ |
|
| 27 | 27 | protected $height; |
| 28 | 28 | |
| 29 | - /** Init error |
|
| 30 | - * @var bool */ |
|
| 29 | + /** Init error |
|
| 30 | + * @var bool */ |
|
| 31 | 31 | public $init_error = false; |
| 32 | 32 | |
| 33 | - /** Last builded image type constant (IMAGETYPE_XXX) |
|
| 34 | - * @var integer */ |
|
| 33 | + /** Last builded image type constant (IMAGETYPE_XXX) |
|
| 34 | + * @var integer */ |
|
| 35 | 35 | public $type; |
| 36 | 36 | |
| 37 | - /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. |
|
| 38 | - * Returns FALSE on failure. The only one parameter $image can be an instance of this class, |
|
| 39 | - * a GD resource, an array(width, height) or path to image file. |
|
| 40 | - * @param mixed $image |
|
| 41 | - * @return array */ |
|
| 37 | + /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height. |
|
| 38 | + * Returns FALSE on failure. The only one parameter $image can be an instance of this class, |
|
| 39 | + * a GD resource, an array(width, height) or path to image file. |
|
| 40 | + * @param mixed $image |
|
| 41 | + * @return array */ |
|
| 42 | 42 | |
| 43 | 43 | protected function build_image($image) {
|
| 44 | 44 | |
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | return $return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - /** Parameter $image can be: |
|
| 91 | - * 1. An instance of this class (copy instance). |
|
| 92 | - * 2. A GD resource. |
|
| 93 | - * 3. An array with two elements. First - width, second - height. Create a blank image. |
|
| 94 | - * 4. A filename string. Get image form file. |
|
| 95 | - * The non-required parameter $bigger_size is the bigger dimension (width or height) the image |
|
| 96 | - * will be resized to. The other dimension (height or width) will be calculated autamaticaly |
|
| 97 | - * @param mixed $image |
|
| 98 | - * @param integer $bigger_size |
|
| 99 | - * @return gd */ |
|
| 90 | + /** Parameter $image can be: |
|
| 91 | + * 1. An instance of this class (copy instance). |
|
| 92 | + * 2. A GD resource. |
|
| 93 | + * 3. An array with two elements. First - width, second - height. Create a blank image. |
|
| 94 | + * 4. A filename string. Get image form file. |
|
| 95 | + * The non-required parameter $bigger_size is the bigger dimension (width or height) the image |
|
| 96 | + * will be resized to. The other dimension (height or width) will be calculated autamaticaly |
|
| 97 | + * @param mixed $image |
|
| 98 | + * @param integer $bigger_size |
|
| 99 | + * @return gd */ |
|
| 100 | 100 | |
| 101 | 101 | public function __construct($image, $bigger_size=null) {
|
| 102 | 102 | $this->image = $this->width = $this->height = null; |
@@ -123,30 +123,30 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - /** Returns the GD resource |
|
| 127 | - * @return resource */ |
|
| 126 | + /** Returns the GD resource |
|
| 127 | + * @return resource */ |
|
| 128 | 128 | |
| 129 | 129 | public function get_image() {
|
| 130 | 130 | return $this->image; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - /** Returns the image width |
|
| 134 | - * @return integer */ |
|
| 133 | + /** Returns the image width |
|
| 134 | + * @return integer */ |
|
| 135 | 135 | |
| 136 | 136 | public function get_width() {
|
| 137 | 137 | return $this->width; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - /** Returns the image height |
|
| 141 | - * @return integer */ |
|
| 140 | + /** Returns the image height |
|
| 141 | + * @return integer */ |
|
| 142 | 142 | |
| 143 | 143 | public function get_height() {
|
| 144 | 144 | return $this->height; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - /** Returns calculated proportional width from the given height |
|
| 148 | - * @param integer $resized_height |
|
| 149 | - * @return integer */ |
|
| 147 | + /** Returns calculated proportional width from the given height |
|
| 148 | + * @param integer $resized_height |
|
| 149 | + * @return integer */ |
|
| 150 | 150 | |
| 151 | 151 | public function get_prop_width($resized_height) {
|
| 152 | 152 | $width = intval(($this->width * $resized_height) / $this->height); |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | return $width; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - /** Returns calculated proportional height from the given width |
|
| 158 | - * @param integer $resized_width |
|
| 159 | - * @return integer */ |
|
| 157 | + /** Returns calculated proportional height from the given width |
|
| 158 | + * @param integer $resized_width |
|
| 159 | + * @return integer */ |
|
| 160 | 160 | |
| 161 | 161 | public function get_prop_height($resized_width) {
|
| 162 | 162 | $height = intval(($this->height * $resized_width) / $this->width); |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | return $height; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - /** Returns an array with calculated proportional width & height. |
|
| 168 | - * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
|
| 169 | - * The other dimension (height or width) will be calculated autamaticaly |
|
| 170 | - * @param integer $bigger_size |
|
| 171 | - * @return array */ |
|
| 167 | + /** Returns an array with calculated proportional width & height. |
|
| 168 | + * The parameter $bigger_size is the bigger dimension (width or height) of calculated sizes. |
|
| 169 | + * The other dimension (height or width) will be calculated autamaticaly |
|
| 170 | + * @param integer $bigger_size |
|
| 171 | + * @return array */ |
|
| 172 | 172 | |
| 173 | 173 | public function get_prop_size($bigger_size) {
|
| 174 | 174 | |
@@ -186,10 +186,10 @@ discard block |
||
| 186 | 186 | return array($width, $height); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - /** Resize image. Returns TRUE on success or FALSE on failure |
|
| 190 | - * @param integer $width |
|
| 191 | - * @param integer $height |
|
| 192 | - * @return bool */ |
|
| 189 | + /** Resize image. Returns TRUE on success or FALSE on failure |
|
| 190 | + * @param integer $width |
|
| 191 | + * @param integer $height |
|
| 192 | + * @return bool */ |
|
| 193 | 193 | |
| 194 | 194 | public function resize($width, $height) {
|
| 195 | 195 | if (!$width) $width = 1; |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | ); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - /** Resize the given image source (GD, gd object or image file path) to fit in the own image. |
|
| 207 | - * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure |
|
| 208 | - * @param mixed $src |
|
| 209 | - * @return bool */ |
|
| 206 | + /** Resize the given image source (GD, gd object or image file path) to fit in the own image. |
|
| 207 | + * The outside ares will be cropped out. Returns TRUE on success or FALSE on failure |
|
| 208 | + * @param mixed $src |
|
| 209 | + * @return bool */ |
|
| 210 | 210 | |
| 211 | 211 | public function resize_crop($src) {
|
| 212 | 212 | $image_details = $this->build_image($src); |
@@ -233,10 +233,10 @@ discard block |
||
| 233 | 233 | return false; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure |
|
| 237 | - * @param integer $width |
|
| 238 | - * @param integer $height |
|
| 239 | - * @return bool */ |
|
| 236 | + /** Resize image to fit in given resolution. Returns TRUE on success or FALSE on failure |
|
| 237 | + * @param integer $width |
|
| 238 | + * @param integer $height |
|
| 239 | + * @return bool */ |
|
| 240 | 240 | |
| 241 | 241 | public function resize_fit($width, $height) {
|
| 242 | 242 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
@@ -250,12 +250,12 @@ discard block |
||
| 250 | 250 | return $this->resize($width, $height); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. |
|
| 254 | - * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, |
|
| 255 | - * no samo po edno (x ili y) izmerenie |
|
| 256 | - * @param integer $width |
|
| 257 | - * @param integer $height |
|
| 258 | - * @return bool */ |
|
| 253 | + /** Neka si predstavim vyobrazhaem pravoygylnik s razmeri $width i $height. |
|
| 254 | + * Izobrazhenieto shte se preorazmeri taka che to shte izliza ot tozi pravoygylnik, |
|
| 255 | + * no samo po edno (x ili y) izmerenie |
|
| 256 | + * @param integer $width |
|
| 257 | + * @param integer $height |
|
| 258 | + * @return bool */ |
|
| 259 | 259 | |
| 260 | 260 | public function resize_overflow($width, $height) {
|
| 261 | 261 | |
@@ -368,30 +368,30 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | |
| 370 | 370 | |
| 371 | - /*** gif transparent fix - 1.10.2013 ***/ |
|
| 371 | + /*** gif transparent fix - 1.10.2013 ***/ |
|
| 372 | 372 | |
| 373 | - $transindex = imagecolortransparent($src); |
|
| 374 | - $palletsize = imagecolorstotal($src); |
|
| 375 | - if($transindex >= 0 && $transindex < $palletsize) {
|
|
| 376 | - $transcol = imagecolorsforindex($src, $transindex); |
|
| 373 | + $transindex = imagecolortransparent($src); |
|
| 374 | + $palletsize = imagecolorstotal($src); |
|
| 375 | + if($transindex >= 0 && $transindex < $palletsize) {
|
|
| 376 | + $transcol = imagecolorsforindex($src, $transindex); |
|
| 377 | 377 | |
| 378 | - /*** end gif transparent fix ***/ |
|
| 378 | + /*** end gif transparent fix ***/ |
|
| 379 | 379 | |
| 380 | - $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
| 381 | - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
|
| 382 | - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
| 383 | - imagecolortransparent($this->image, $transindex); |
|
| 384 | - for($y=0; $y<$dst_h; ++$y) |
|
| 385 | - for($x=0; $x<$dst_w; ++$x) |
|
| 386 | - if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
| 387 | - imagetruecolortopalette($this->image, true, 255); |
|
| 388 | - } |
|
| 389 | - else {
|
|
| 390 | - $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); |
|
| 391 | - imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); |
|
| 392 | - imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
| 393 | - } |
|
| 394 | - return $this->image; |
|
| 380 | + $transindex = imagecolorallocatealpha($this->image, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
| 381 | + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transindex); |
|
| 382 | + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
| 383 | + imagecolortransparent($this->image, $transindex); |
|
| 384 | + for($y=0; $y<$dst_h; ++$y) |
|
| 385 | + for($x=0; $x<$dst_w; ++$x) |
|
| 386 | + if(((imagecolorat($this->image, $x, $y)>>24) & 0x7F) >= 100) imagesetpixel($this->image, $x, $y, $transindex); |
|
| 387 | + imagetruecolortopalette($this->image, true, 255); |
|
| 388 | + } |
|
| 389 | + else {
|
|
| 390 | + $transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127); |
|
| 391 | + imagefilledrectangle($this->image, 0, 0, $dst_w, $dst_h, $transparent); |
|
| 392 | + imagecopyresampled($this->image, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); |
|
| 393 | + } |
|
| 394 | + return $this->image; |
|
| 395 | 395 | |
| 396 | 396 | } else |
| 397 | 397 | return false; |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | public function imagegif($filename=null) {
|
| 420 | 420 | if (is_null($filename) && !headers_sent()) |
| 421 | 421 | header("Content-Type: image/gif");
|
| 422 | - @imagesavealpha($this->image, true); |
|
| 422 | + @imagesavealpha($this->image, true); |
|
| 423 | 423 | return imagegif($this->image, $filename); |
| 424 | 424 | } |
| 425 | 425 | } |
@@ -13,227 +13,227 @@ |
||
| 13 | 13 | |
| 14 | 14 | class fastImage |
| 15 | 15 | { |
| 16 | - private $strpos = 0; |
|
| 17 | - private $str; |
|
| 18 | - private $uri; |
|
| 19 | - private $type; |
|
| 20 | - private $handle; |
|
| 16 | + private $strpos = 0; |
|
| 17 | + private $str; |
|
| 18 | + private $uri; |
|
| 19 | + private $type; |
|
| 20 | + private $handle; |
|
| 21 | 21 | |
| 22 | - public function __construct($uri = null) |
|
| 23 | - { |
|
| 24 | - if ($uri) $this->load($uri); |
|
| 25 | - } |
|
| 22 | + public function __construct($uri = null) |
|
| 23 | + { |
|
| 24 | + if ($uri) $this->load($uri); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - public function load($uri) |
|
| 29 | - { |
|
| 30 | - if ($this->handle) $this->close(); |
|
| 31 | - |
|
| 32 | - $this->uri = $uri; |
|
| 33 | - $this->handle = fopen($uri, 'r'); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - |
|
| 37 | - public function close() |
|
| 38 | - { |
|
| 39 | - if (is_resource($this->handle)) fclose($this->handle); |
|
| 40 | - } |
|
| 28 | + public function load($uri) |
|
| 29 | + { |
|
| 30 | + if ($this->handle) $this->close(); |
|
| 31 | + |
|
| 32 | + $this->uri = $uri; |
|
| 33 | + $this->handle = fopen($uri, 'r'); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + |
|
| 37 | + public function close() |
|
| 38 | + { |
|
| 39 | + if (is_resource($this->handle)) fclose($this->handle); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - public function getSize() |
|
| 44 | - { |
|
| 45 | - $this->strpos = 0; |
|
| 46 | - if ($this->getType()) |
|
| 47 | - { |
|
| 48 | - return array_values($this->parseSize()); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - |
|
| 55 | - public function getType() |
|
| 56 | - { |
|
| 57 | - $this->strpos = 0; |
|
| 58 | - |
|
| 59 | - if (!$this->type) |
|
| 60 | - { |
|
| 61 | - switch ($this->getChars(2)) |
|
| 62 | - { |
|
| 63 | - case "BM": |
|
| 64 | - return $this->type = 'bmp'; |
|
| 65 | - case "GI": |
|
| 66 | - return $this->type = 'gif'; |
|
| 67 | - case chr(0xFF).chr(0xd8): |
|
| 68 | - return $this->type = 'jpeg'; |
|
| 69 | - case chr(0x89).'P': |
|
| 70 | - return $this->type = 'png'; |
|
| 71 | - default: |
|
| 72 | - return false; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return $this->type; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - private function parseSize() |
|
| 81 | - { |
|
| 82 | - $this->strpos = 0; |
|
| 83 | - |
|
| 84 | - switch ($this->type) |
|
| 85 | - { |
|
| 86 | - case 'png': |
|
| 87 | - return $this->parseSizeForPNG(); |
|
| 88 | - case 'gif': |
|
| 89 | - return $this->parseSizeForGIF(); |
|
| 90 | - case 'bmp': |
|
| 91 | - return $this->parseSizeForBMP(); |
|
| 92 | - case 'jpeg': |
|
| 93 | - return $this->parseSizeForJPEG(); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - return null; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - private function parseSizeForPNG() |
|
| 101 | - { |
|
| 102 | - $chars = $this->getChars(25); |
|
| 103 | - |
|
| 104 | - return unpack("N*", substr($chars, 16, 8)); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - |
|
| 108 | - private function parseSizeForGIF() |
|
| 109 | - { |
|
| 110 | - $chars = $this->getChars(11); |
|
| 111 | - |
|
| 112 | - return unpack("S*", substr($chars, 6, 4)); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - |
|
| 116 | - private function parseSizeForBMP() |
|
| 117 | - { |
|
| 118 | - $chars = $this->getChars(29); |
|
| 119 | - $chars = substr($chars, 14, 14); |
|
| 120 | - $type = unpack('C', $chars); |
|
| 121 | - |
|
| 122 | - return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8)); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - |
|
| 126 | - private function parseSizeForJPEG() |
|
| 127 | - { |
|
| 128 | - $state = null; |
|
| 129 | - |
|
| 130 | - while (true) |
|
| 131 | - { |
|
| 132 | - switch ($state) |
|
| 133 | - { |
|
| 134 | - default: |
|
| 135 | - $this->getChars(2); |
|
| 136 | - $state = 'started'; |
|
| 137 | - break; |
|
| 138 | - |
|
| 139 | - case 'started': |
|
| 140 | - $b = $this->getByte(); |
|
| 141 | - if ($b === false) return false; |
|
| 142 | - |
|
| 143 | - $state = $b == 0xFF ? 'sof' : 'started'; |
|
| 144 | - break; |
|
| 145 | - |
|
| 146 | - case 'sof': |
|
| 147 | - $b = $this->getByte(); |
|
| 148 | - if (in_array($b, range(0xe0, 0xef))) |
|
| 149 | - { |
|
| 150 | - $state = 'skipframe'; |
|
| 151 | - } |
|
| 152 | - elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) |
|
| 153 | - { |
|
| 154 | - $state = 'readsize'; |
|
| 155 | - } |
|
| 156 | - elseif ($b == 0xFF) |
|
| 157 | - { |
|
| 158 | - $state = 'sof'; |
|
| 159 | - } |
|
| 160 | - else |
|
| 161 | - { |
|
| 162 | - $state = 'skipframe'; |
|
| 163 | - } |
|
| 164 | - break; |
|
| 165 | - |
|
| 166 | - case 'skipframe': |
|
| 167 | - $skip = $this->readInt($this->getChars(2)) - 2; |
|
| 168 | - $state = 'doskip'; |
|
| 169 | - break; |
|
| 170 | - |
|
| 171 | - case 'doskip': |
|
| 172 | - $this->getChars($skip); |
|
| 173 | - $state = 'started'; |
|
| 174 | - break; |
|
| 175 | - |
|
| 176 | - case 'readsize': |
|
| 177 | - $c = $this->getChars(7); |
|
| 178 | - |
|
| 179 | - return array($this->readInt(substr($c, 5, 2)), $this->readInt(substr($c, 3, 2))); |
|
| 180 | - } |
|
| 181 | - } |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - |
|
| 185 | - private function getChars($n) |
|
| 186 | - { |
|
| 187 | - $response = null; |
|
| 188 | - |
|
| 189 | - // do we need more data? |
|
| 190 | - if ($this->strpos + $n -1 >= strlen($this->str)) |
|
| 191 | - { |
|
| 192 | - $end = ($this->strpos + $n); |
|
| 193 | - |
|
| 194 | - while (strlen($this->str) < $end && $response !== false) |
|
| 195 | - { |
|
| 196 | - // read more from the file handle |
|
| 197 | - $need = $end - ftell($this->handle); |
|
| 198 | - |
|
| 199 | - if ($response = fread($this->handle, $need)) |
|
| 200 | - { |
|
| 201 | - $this->str .= $response; |
|
| 202 | - } |
|
| 203 | - else |
|
| 204 | - { |
|
| 205 | - return false; |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - $result = substr($this->str, $this->strpos, $n); |
|
| 211 | - $this->strpos += $n; |
|
| 212 | - |
|
| 213 | - // we are dealing with bytes here, so force the encoding |
|
| 214 | - return mb_convert_encoding($result, "8BIT"); |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - |
|
| 218 | - private function getByte() |
|
| 219 | - { |
|
| 220 | - $c = $this->getChars(1); |
|
| 221 | - $b = unpack("C", $c); |
|
| 222 | - |
|
| 223 | - return reset($b); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - |
|
| 227 | - private function readInt($str) |
|
| 228 | - { |
|
| 229 | - $size = unpack("C*", $str); |
|
| 230 | - |
|
| 231 | - return ($size[1] << 8) + $size[2]; |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - |
|
| 235 | - public function __destruct() |
|
| 236 | - { |
|
| 237 | - $this->close(); |
|
| 238 | - } |
|
| 43 | + public function getSize() |
|
| 44 | + { |
|
| 45 | + $this->strpos = 0; |
|
| 46 | + if ($this->getType()) |
|
| 47 | + { |
|
| 48 | + return array_values($this->parseSize()); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + |
|
| 55 | + public function getType() |
|
| 56 | + { |
|
| 57 | + $this->strpos = 0; |
|
| 58 | + |
|
| 59 | + if (!$this->type) |
|
| 60 | + { |
|
| 61 | + switch ($this->getChars(2)) |
|
| 62 | + { |
|
| 63 | + case "BM": |
|
| 64 | + return $this->type = 'bmp'; |
|
| 65 | + case "GI": |
|
| 66 | + return $this->type = 'gif'; |
|
| 67 | + case chr(0xFF).chr(0xd8): |
|
| 68 | + return $this->type = 'jpeg'; |
|
| 69 | + case chr(0x89).'P': |
|
| 70 | + return $this->type = 'png'; |
|
| 71 | + default: |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return $this->type; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + private function parseSize() |
|
| 81 | + { |
|
| 82 | + $this->strpos = 0; |
|
| 83 | + |
|
| 84 | + switch ($this->type) |
|
| 85 | + { |
|
| 86 | + case 'png': |
|
| 87 | + return $this->parseSizeForPNG(); |
|
| 88 | + case 'gif': |
|
| 89 | + return $this->parseSizeForGIF(); |
|
| 90 | + case 'bmp': |
|
| 91 | + return $this->parseSizeForBMP(); |
|
| 92 | + case 'jpeg': |
|
| 93 | + return $this->parseSizeForJPEG(); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + return null; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + private function parseSizeForPNG() |
|
| 101 | + { |
|
| 102 | + $chars = $this->getChars(25); |
|
| 103 | + |
|
| 104 | + return unpack("N*", substr($chars, 16, 8)); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + |
|
| 108 | + private function parseSizeForGIF() |
|
| 109 | + { |
|
| 110 | + $chars = $this->getChars(11); |
|
| 111 | + |
|
| 112 | + return unpack("S*", substr($chars, 6, 4)); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + |
|
| 116 | + private function parseSizeForBMP() |
|
| 117 | + { |
|
| 118 | + $chars = $this->getChars(29); |
|
| 119 | + $chars = substr($chars, 14, 14); |
|
| 120 | + $type = unpack('C', $chars); |
|
| 121 | + |
|
| 122 | + return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8)); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + |
|
| 126 | + private function parseSizeForJPEG() |
|
| 127 | + { |
|
| 128 | + $state = null; |
|
| 129 | + |
|
| 130 | + while (true) |
|
| 131 | + { |
|
| 132 | + switch ($state) |
|
| 133 | + { |
|
| 134 | + default: |
|
| 135 | + $this->getChars(2); |
|
| 136 | + $state = 'started'; |
|
| 137 | + break; |
|
| 138 | + |
|
| 139 | + case 'started': |
|
| 140 | + $b = $this->getByte(); |
|
| 141 | + if ($b === false) return false; |
|
| 142 | + |
|
| 143 | + $state = $b == 0xFF ? 'sof' : 'started'; |
|
| 144 | + break; |
|
| 145 | + |
|
| 146 | + case 'sof': |
|
| 147 | + $b = $this->getByte(); |
|
| 148 | + if (in_array($b, range(0xe0, 0xef))) |
|
| 149 | + { |
|
| 150 | + $state = 'skipframe'; |
|
| 151 | + } |
|
| 152 | + elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) |
|
| 153 | + { |
|
| 154 | + $state = 'readsize'; |
|
| 155 | + } |
|
| 156 | + elseif ($b == 0xFF) |
|
| 157 | + { |
|
| 158 | + $state = 'sof'; |
|
| 159 | + } |
|
| 160 | + else |
|
| 161 | + { |
|
| 162 | + $state = 'skipframe'; |
|
| 163 | + } |
|
| 164 | + break; |
|
| 165 | + |
|
| 166 | + case 'skipframe': |
|
| 167 | + $skip = $this->readInt($this->getChars(2)) - 2; |
|
| 168 | + $state = 'doskip'; |
|
| 169 | + break; |
|
| 170 | + |
|
| 171 | + case 'doskip': |
|
| 172 | + $this->getChars($skip); |
|
| 173 | + $state = 'started'; |
|
| 174 | + break; |
|
| 175 | + |
|
| 176 | + case 'readsize': |
|
| 177 | + $c = $this->getChars(7); |
|
| 178 | + |
|
| 179 | + return array($this->readInt(substr($c, 5, 2)), $this->readInt(substr($c, 3, 2))); |
|
| 180 | + } |
|
| 181 | + } |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + |
|
| 185 | + private function getChars($n) |
|
| 186 | + { |
|
| 187 | + $response = null; |
|
| 188 | + |
|
| 189 | + // do we need more data? |
|
| 190 | + if ($this->strpos + $n -1 >= strlen($this->str)) |
|
| 191 | + { |
|
| 192 | + $end = ($this->strpos + $n); |
|
| 193 | + |
|
| 194 | + while (strlen($this->str) < $end && $response !== false) |
|
| 195 | + { |
|
| 196 | + // read more from the file handle |
|
| 197 | + $need = $end - ftell($this->handle); |
|
| 198 | + |
|
| 199 | + if ($response = fread($this->handle, $need)) |
|
| 200 | + { |
|
| 201 | + $this->str .= $response; |
|
| 202 | + } |
|
| 203 | + else |
|
| 204 | + { |
|
| 205 | + return false; |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + $result = substr($this->str, $this->strpos, $n); |
|
| 211 | + $this->strpos += $n; |
|
| 212 | + |
|
| 213 | + // we are dealing with bytes here, so force the encoding |
|
| 214 | + return mb_convert_encoding($result, "8BIT"); |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + |
|
| 218 | + private function getByte() |
|
| 219 | + { |
|
| 220 | + $c = $this->getChars(1); |
|
| 221 | + $b = unpack("C", $c); |
|
| 222 | + |
|
| 223 | + return reset($b); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + |
|
| 227 | + private function readInt($str) |
|
| 228 | + { |
|
| 229 | + $size = unpack("C*", $str); |
|
| 230 | + |
|
| 231 | + return ($size[1] << 8) + $size[2]; |
|
| 232 | + } |
|
| 233 | + |
|
| 234 | + |
|
| 235 | + public function __destruct() |
|
| 236 | + { |
|
| 237 | + $this->close(); |
|
| 238 | + } |
|
| 239 | 239 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) |
| 23 | 23 | { |
| 24 | - $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
| 24 | + $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | foreach( $cm->getCategories() as $category ) |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | if( empty( $category ) ) |
| 108 | 108 | { |
| 109 | - $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
| 110 | - return; |
|
| 109 | + $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' ); |
|
| 110 | + return; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if( $cm->isCategoryExists( $category ) ) |
| 114 | 114 | { |
| 115 | - $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
| 116 | - return; |
|
| 115 | + $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); |
|
| 116 | + return; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if( $cm->addCategory( $category, $rank ) !== 0 ) |
@@ -3,17 +3,17 @@ |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('delete_eventlog')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | if (isset($_GET['cls']) && $_GET['cls']==1) { |
| 10 | - $where = ''; |
|
| 10 | + $where = ''; |
|
| 11 | 11 | } else { |
| 12 | - $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 13 | - if($id==0) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 15 | - } |
|
| 16 | - $where = "id='{$id}'"; |
|
| 12 | + $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 13 | + if($id==0) { |
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 15 | + } |
|
| 16 | + $where = "id='{$id}'"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // delete event log |
@@ -248,9 +248,9 @@ |
||
| 248 | 248 | echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>'; |
| 249 | 249 | $errors++; |
| 250 | 250 | echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>'; |
| 251 | - } else { |
|
| 251 | + } else { |
|
| 252 | 252 | echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
| 253 | - } |
|
| 253 | + } |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // check mysql version |
@@ -3,12 +3,12 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $children = array(); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $udperms->duplicateDoc = true; |
| 22 | 22 | |
| 23 | 23 | if(!$udperms->checkPermissions()) { |
| 24 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 24 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Run the duplicator |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!$modx->hasPermission('web_access_permissions')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // web access group processor. |
@@ -20,111 +20,111 @@ discard block |
||
| 20 | 20 | $operation = $_REQUEST['operation']; |
| 21 | 21 | |
| 22 | 22 | switch ($operation) { |
| 23 | - case "add_user_group" : |
|
| 24 | - $newgroup = $_REQUEST['newusergroup']; |
|
| 25 | - if(empty($newgroup)) { |
|
| 26 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 27 | - } else { |
|
| 28 | - $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_webgroup_names); |
|
| 23 | + case "add_user_group" : |
|
| 24 | + $newgroup = $_REQUEST['newusergroup']; |
|
| 25 | + if(empty($newgroup)) { |
|
| 26 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 27 | + } else { |
|
| 28 | + $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_webgroup_names); |
|
| 29 | 29 | |
| 30 | - // invoke OnWebCreateGroup event |
|
| 31 | - $modx->invokeEvent('OnWebCreateGroup', array( |
|
| 32 | - 'groupid' => $id, |
|
| 33 | - 'groupname' => $newgroup, |
|
| 34 | - )); |
|
| 35 | - } |
|
| 36 | - break; |
|
| 37 | - case "add_document_group" : |
|
| 38 | - $newgroup = $_REQUEST['newdocgroup']; |
|
| 39 | - if(empty($newgroup)) { |
|
| 40 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 41 | - } else { |
|
| 42 | - $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
| 30 | + // invoke OnWebCreateGroup event |
|
| 31 | + $modx->invokeEvent('OnWebCreateGroup', array( |
|
| 32 | + 'groupid' => $id, |
|
| 33 | + 'groupname' => $newgroup, |
|
| 34 | + )); |
|
| 35 | + } |
|
| 36 | + break; |
|
| 37 | + case "add_document_group" : |
|
| 38 | + $newgroup = $_REQUEST['newdocgroup']; |
|
| 39 | + if(empty($newgroup)) { |
|
| 40 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 41 | + } else { |
|
| 42 | + $id = $modx->getDatabase()->insert(array('name'=>$modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
| 43 | 43 | |
| 44 | - // invoke OnCreateDocGroup event |
|
| 45 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
| 46 | - 'groupid' => $id, |
|
| 47 | - 'groupname' => $newgroup, |
|
| 48 | - )); |
|
| 49 | - } |
|
| 50 | - break; |
|
| 51 | - case "delete_user_group" : |
|
| 52 | - $updategroupaccess = true; |
|
| 53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
| 54 | - if(empty($usergroup)) { |
|
| 55 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
| 56 | - } else { |
|
| 57 | - $modx->getDatabase()->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
|
| 44 | + // invoke OnCreateDocGroup event |
|
| 45 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
| 46 | + 'groupid' => $id, |
|
| 47 | + 'groupname' => $newgroup, |
|
| 48 | + )); |
|
| 49 | + } |
|
| 50 | + break; |
|
| 51 | + case "delete_user_group" : |
|
| 52 | + $updategroupaccess = true; |
|
| 53 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
| 54 | + if(empty($usergroup)) { |
|
| 55 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
| 56 | + } else { |
|
| 57 | + $modx->getDatabase()->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
|
| 58 | 58 | |
| 59 | - $modx->getDatabase()->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
| 59 | + $modx->getDatabase()->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
| 60 | 60 | |
| 61 | - $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$usergroup}'"); |
|
| 62 | - } |
|
| 63 | - break; |
|
| 64 | - case "delete_document_group" : |
|
| 65 | - $group = (int)$_REQUEST['documentgroup']; |
|
| 66 | - if(empty($group)) { |
|
| 67 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
| 68 | - } else { |
|
| 69 | - $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
| 61 | + $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$usergroup}'"); |
|
| 62 | + } |
|
| 63 | + break; |
|
| 64 | + case "delete_document_group" : |
|
| 65 | + $group = (int)$_REQUEST['documentgroup']; |
|
| 66 | + if(empty($group)) { |
|
| 67 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
| 68 | + } else { |
|
| 69 | + $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
| 70 | 70 | |
| 71 | - $modx->getDatabase()->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
| 71 | + $modx->getDatabase()->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
| 72 | 72 | |
| 73 | - $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
| 74 | - } |
|
| 75 | - break; |
|
| 76 | - case "rename_user_group" : |
|
| 77 | - $newgroupname = $_REQUEST['newgroupname']; |
|
| 78 | - if(empty($newgroupname)) { |
|
| 79 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 80 | - } |
|
| 81 | - $groupid = (int)$_REQUEST['groupid']; |
|
| 82 | - if(empty($groupid)) { |
|
| 83 | - $modx->webAlertAndQuit("No user group id specified for rename."); |
|
| 84 | - } |
|
| 85 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
| 86 | - break; |
|
| 87 | - case "rename_document_group" : |
|
| 88 | - $newgroupname = $_REQUEST['newgroupname']; |
|
| 89 | - if(empty($newgroupname)) { |
|
| 90 | - $modx->webAlertAndQuit("No group name specified."); |
|
| 91 | - } |
|
| 92 | - $groupid = (int)$_REQUEST['groupid']; |
|
| 93 | - if(empty($groupid)) { |
|
| 94 | - $modx->webAlertAndQuit("No document group id specified for rename."); |
|
| 95 | - } |
|
| 96 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
| 97 | - break; |
|
| 98 | - case "add_document_group_to_user_group" : |
|
| 99 | - $updategroupaccess = true; |
|
| 100 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
| 101 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
| 102 | - $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
| 103 | - $limit = $modx->getDatabase()->getValue($rs); |
|
| 104 | - if($limit<=0) { |
|
| 105 | - $modx->getDatabase()->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
| 106 | - } else { |
|
| 107 | - //alert user that coupling already exists? |
|
| 108 | - } |
|
| 109 | - break; |
|
| 110 | - case "remove_document_group_from_user_group" : |
|
| 111 | - $updategroupaccess = true; |
|
| 112 | - $coupling = (int)$_REQUEST['coupling']; |
|
| 113 | - $modx->getDatabase()->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
| 114 | - break; |
|
| 115 | - default : |
|
| 116 | - $modx->webAlertAndQuit("No operation set in request."); |
|
| 73 | + $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
| 74 | + } |
|
| 75 | + break; |
|
| 76 | + case "rename_user_group" : |
|
| 77 | + $newgroupname = $_REQUEST['newgroupname']; |
|
| 78 | + if(empty($newgroupname)) { |
|
| 79 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 80 | + } |
|
| 81 | + $groupid = (int)$_REQUEST['groupid']; |
|
| 82 | + if(empty($groupid)) { |
|
| 83 | + $modx->webAlertAndQuit("No user group id specified for rename."); |
|
| 84 | + } |
|
| 85 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
| 86 | + break; |
|
| 87 | + case "rename_document_group" : |
|
| 88 | + $newgroupname = $_REQUEST['newgroupname']; |
|
| 89 | + if(empty($newgroupname)) { |
|
| 90 | + $modx->webAlertAndQuit("No group name specified."); |
|
| 91 | + } |
|
| 92 | + $groupid = (int)$_REQUEST['groupid']; |
|
| 93 | + if(empty($groupid)) { |
|
| 94 | + $modx->webAlertAndQuit("No document group id specified for rename."); |
|
| 95 | + } |
|
| 96 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
| 97 | + break; |
|
| 98 | + case "add_document_group_to_user_group" : |
|
| 99 | + $updategroupaccess = true; |
|
| 100 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
| 101 | + $docgroup = (int)$_REQUEST['docgroup']; |
|
| 102 | + $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
| 103 | + $limit = $modx->getDatabase()->getValue($rs); |
|
| 104 | + if($limit<=0) { |
|
| 105 | + $modx->getDatabase()->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
| 106 | + } else { |
|
| 107 | + //alert user that coupling already exists? |
|
| 108 | + } |
|
| 109 | + break; |
|
| 110 | + case "remove_document_group_from_user_group" : |
|
| 111 | + $updategroupaccess = true; |
|
| 112 | + $coupling = (int)$_REQUEST['coupling']; |
|
| 113 | + $modx->getDatabase()->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
| 114 | + break; |
|
| 115 | + default : |
|
| 116 | + $modx->webAlertAndQuit("No operation set in request."); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | // secure web documents - flag as private |
| 120 | 120 | if($updategroupaccess==true){ |
| 121 | - include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
| 122 | - secureWebDocument(); |
|
| 121 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
| 122 | + secureWebDocument(); |
|
| 123 | 123 | |
| 124 | - // Update the private group column |
|
| 125 | - $modx->getDatabase()->update( |
|
| 126 | - 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
| 127 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
| 124 | + // Update the private group column |
|
| 125 | + $modx->getDatabase()->update( |
|
| 126 | + 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
| 127 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $header = "Location: index.php?a=91"; |
@@ -3,33 +3,33 @@ |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | if(!($modx->hasPermission('settings') && ($modx->hasPermission('logs')||$modx->hasPermission('bk_manager')))) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | if (isset($_REQUEST['t'])) { |
| 10 | 10 | |
| 11 | - if (empty($_REQUEST['t'])) { |
|
| 12 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
| 13 | - } |
|
| 11 | + if (empty($_REQUEST['t'])) { |
|
| 12 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - // Set the item name for logger |
|
| 16 | - $_SESSION['itemname'] = $_REQUEST['t']; |
|
| 15 | + // Set the item name for logger |
|
| 16 | + $_SESSION['itemname'] = $_REQUEST['t']; |
|
| 17 | 17 | |
| 18 | - $modx->getDatabase()->optimize($_REQUEST['t']); |
|
| 18 | + $modx->getDatabase()->optimize($_REQUEST['t']); |
|
| 19 | 19 | |
| 20 | 20 | } elseif (isset($_REQUEST['u'])) { |
| 21 | 21 | |
| 22 | - if (empty($_REQUEST['u'])) { |
|
| 23 | - $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
| 24 | - } |
|
| 22 | + if (empty($_REQUEST['u'])) { |
|
| 23 | + $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - // Set the item name for logger |
|
| 27 | - $_SESSION['itemname'] = $_REQUEST['u']; |
|
| 26 | + // Set the item name for logger |
|
| 27 | + $_SESSION['itemname'] = $_REQUEST['u']; |
|
| 28 | 28 | |
| 29 | - $modx->getDatabase()->truncate($_REQUEST['u']); |
|
| 29 | + $modx->getDatabase()->truncate($_REQUEST['u']); |
|
| 30 | 30 | |
| 31 | 31 | } else { |
| 32 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
| 32 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $mode = (int)$_REQUEST['mode']; |