@@ -180,6 +180,9 @@ |
||
| 180 | 180 | return Sanitize::escape($string, $this->Entry->useDbConfig); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | + /** |
|
| 184 | + * @param string[] $params |
|
| 185 | + */ |
|
| 183 | 186 | protected function _filterQuery($params) { |
| 184 | 187 | $this->request->query = array_intersect_key($this->request->query, |
| 185 | 188 | array_fill_keys($params, 1)); |
@@ -18,6 +18,9 @@ |
||
| 18 | 18 | return $this->assertEquals($count, $length, "Failed XPath. Expected '$path' to be found $count times instead of $length."); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $path |
|
| 23 | + */ |
|
| 21 | 24 | public function assertNotXPath($html, $path) { |
| 22 | 25 | return !$this->assertXPath($html, $path, 0); |
| 23 | 26 | } |
@@ -48,6 +48,9 @@ discard block |
||
| 48 | 48 | unset($_ENV['HTTP_X_REQUESTED_WITH']); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param string $agent |
|
| 53 | + */ |
|
| 51 | 54 | protected function _setUserAgent($agent) { |
| 52 | 55 | if (isset($this->_env['HTTP_USER_AGENT'])) { |
| 53 | 56 | $this->_env['HTTP_USER_AGENT'] = $_ENV['HTTP_USER_AGENT']; |
@@ -63,6 +66,9 @@ discard block |
||
| 63 | 66 | } |
| 64 | 67 | } |
| 65 | 68 | |
| 69 | + /** |
|
| 70 | + * @param integer $id |
|
| 71 | + */ |
|
| 66 | 72 | protected function _loginUser($id) { |
| 67 | 73 | // see: http://stackoverflow.com/a/10411128/1372085 |
| 68 | 74 | $this->_logoutUser(); |
@@ -100,6 +106,9 @@ discard block |
||
| 100 | 106 | endif; |
| 101 | 107 | } |
| 102 | 108 | |
| 109 | + /** |
|
| 110 | + * @param string $name |
|
| 111 | + */ |
|
| 103 | 112 | protected function _notImplementedOnDatasource($name) { |
| 104 | 113 | $mc = $this->controller->modelClass; |
| 105 | 114 | $Ds = $this->controller->{$mc}->getDataSource(); |
@@ -4,6 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | trait SecurityMockTrait { |
| 6 | 6 | |
| 7 | + /** |
|
| 8 | + * @param string $controller |
|
| 9 | + */ |
|
| 7 | 10 | public function generate($controller, $mocks = []) { |
| 8 | 11 | $byPassSecurity = false; |
| 9 | 12 | if (!isset($mocks['components']['Security'])) { |
@@ -29,6 +29,10 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public $duration = 8035200; |
| 31 | 31 | |
| 32 | + /** |
|
| 33 | + * @param integer $userId |
|
| 34 | + * @param integer $blockedUserId |
|
| 35 | + */ |
|
| 32 | 36 | public function ignore($userId, $blockedUserId) { |
| 33 | 37 | $exists = $this->_get($userId, $blockedUserId); |
| 34 | 38 | if ($exists) { |
@@ -62,6 +66,9 @@ discard block |
||
| 62 | 66 | ]); |
| 63 | 67 | } |
| 64 | 68 | |
| 69 | + /** |
|
| 70 | + * @param integer $id |
|
| 71 | + */ |
|
| 65 | 72 | public function ignoredBy($id) { |
| 66 | 73 | return $this->find( |
| 67 | 74 | 'all', |
@@ -72,6 +79,9 @@ discard block |
||
| 72 | 79 | ); |
| 73 | 80 | } |
| 74 | 81 | |
| 82 | + /** |
|
| 83 | + * @param integer $userId |
|
| 84 | + */ |
|
| 75 | 85 | public function deleteUser($userId) { |
| 76 | 86 | $success = $this->deleteAll(['user_id' => $userId], false); |
| 77 | 87 | $success = $success && $this->deleteAll(['blocked_user_id' => $userId], false); |
@@ -81,8 +91,8 @@ discard block |
||
| 81 | 91 | /** |
| 82 | 92 | * counts how many users ignore the user with ID $id |
| 83 | 93 | * |
| 84 | - * @param $id |
|
| 85 | - * @return array |
|
| 94 | + * @param integer $id |
|
| 95 | + * @return integer |
|
| 86 | 96 | */ |
| 87 | 97 | public function countIgnored($id) { |
| 88 | 98 | return count($this->getIgnored($id)); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | /** |
| 170 | 170 | * |
| 171 | 171 | * @param string $version |
| 172 | - * @param array $action |
|
| 172 | + * @param string $action |
|
| 173 | 173 | * @param array $params |
| 174 | 174 | * @return object |
| 175 | 175 | */ |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | /** |
| 292 | 292 | * |
| 293 | 293 | * @param resource $ch |
| 294 | - * @param array $headers |
|
| 294 | + * @param string[] $headers |
|
| 295 | 295 | * @return void |
| 296 | 296 | */ |
| 297 | 297 | protected function setCurlOptions(&$ch, $headers = array()) |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | 335 | * |
| 336 | - * @param stdClass $o |
|
| 336 | + * @param \stdClass $o |
|
| 337 | 337 | * @return string |
| 338 | 338 | */ |
| 339 | 339 | public static function reg_imploder(\stdClass $o) |
@@ -94,6 +94,7 @@ discard block |
||
| 94 | 94 | * Preform requested target patch checks depending on the unique setting |
| 95 | 95 | * |
| 96 | 96 | * @var string chosen filename target_path |
| 97 | + * @param string $target_path |
|
| 97 | 98 | * @return string of resulting target_path |
| 98 | 99 | * @access private |
| 99 | 100 | */ |
@@ -217,7 +218,7 @@ discard block |
||
| 217 | 218 | /** |
| 218 | 219 | * Checks if there is a file uploaded |
| 219 | 220 | * |
| 220 | - * @return void |
|
| 221 | + * @return boolean |
|
| 221 | 222 | * @access public |
| 222 | 223 | * @param file array of uploaded file (optional) |
| 223 | 224 | */ |
@@ -293,7 +294,7 @@ discard block |
||
| 293 | 294 | } |
| 294 | 295 | |
| 295 | 296 | /** |
| 296 | - * @return boolean true if errors were detected. |
|
| 297 | + * @return integer true if errors were detected. |
|
| 297 | 298 | */ |
| 298 | 299 | function hasErrors(){ |
| 299 | 300 | return count($this->errors); |
@@ -72,12 +72,10 @@ discard block |
||
| 72 | 72 | $Model = ClassRegistry::init($this->options['fileModel']); |
| 73 | 73 | if(method_exists($Model, $this->options['fileNameFunction'])){ |
| 74 | 74 | $fileName = $Model->{$this->options['fileNameFunction']}($fileName); |
| 75 | - } |
|
| 76 | - elseif(function_exists($this->options['fileNameFunction'])){ |
|
| 75 | + } elseif(function_exists($this->options['fileNameFunction'])){ |
|
| 77 | 76 | $fileName = call_user_func($this->options['fileNameFunction'], $fileName); |
| 78 | 77 | } |
| 79 | - } |
|
| 80 | - else { |
|
| 78 | + } else { |
|
| 81 | 79 | if(function_exists($this->options['fileNameFunction'])){ |
| 82 | 80 | $fileName = call_user_func($this->options['fileNameFunction'], $fileName); |
| 83 | 81 | } |
@@ -140,8 +138,7 @@ discard block |
||
| 140 | 138 | if(move_uploaded_file($this->file['tmp_name'], $target_path)){ |
| 141 | 139 | $this->finalFile = basename($target_path); |
| 142 | 140 | return $this->finalFile; |
| 143 | - } |
|
| 144 | - else{ |
|
| 141 | + } else{ |
|
| 145 | 142 | $this->_error('Unable to save temp file to file system.'); |
| 146 | 143 | return false; |
| 147 | 144 | } |
@@ -154,7 +151,9 @@ discard block |
||
| 154 | 151 | * @return void |
| 155 | 152 | */ |
| 156 | 153 | function setFile($file = null){ |
| 157 | - if($file) $this->file = $file; |
|
| 154 | + if($file) { |
|
| 155 | + $this->file = $file; |
|
| 156 | + } |
|
| 158 | 157 | } |
| 159 | 158 | |
| 160 | 159 | /** |
@@ -203,8 +202,7 @@ discard block |
||
| 203 | 202 | if(is_array($types) && !in_array($this->file['type'], $types)){ |
| 204 | 203 | $this->_error("{$this->file['type']} is not an allowed type."); |
| 205 | 204 | return false; |
| 206 | - } |
|
| 207 | - else { |
|
| 205 | + } else { |
|
| 208 | 206 | return true; |
| 209 | 207 | } |
| 210 | 208 | } |
@@ -226,8 +224,7 @@ discard block |
||
| 226 | 224 | if($this->hasUpload() && $this->file){ |
| 227 | 225 | if(isset($this->file['error']) && $this->file['error'] == UPLOAD_ERR_OK ) { |
| 228 | 226 | return true; |
| 229 | - } |
|
| 230 | - else { |
|
| 227 | + } else { |
|
| 231 | 228 | $this->_error($this->uploadErrors[$this->file['error']]); |
| 232 | 229 | } |
| 233 | 230 | } |
@@ -246,11 +243,9 @@ discard block |
||
| 246 | 243 | if($this->hasUpload() && $this->file){ |
| 247 | 244 | if(!$this->options['maxFileSize']){ //We don't want to test maxFileSize |
| 248 | 245 | return true; |
| 249 | - } |
|
| 250 | - elseif($this->options['maxFileSize'] && $this->file['size'] < $this->options['maxFileSize']){ |
|
| 246 | + } elseif($this->options['maxFileSize'] && $this->file['size'] < $this->options['maxFileSize']){ |
|
| 251 | 247 | return true; |
| 252 | - } |
|
| 253 | - else { |
|
| 248 | + } else { |
|
| 254 | 249 | // $this->_error("File exceeds {$this->options['maxFileSize']} byte limit."); |
| 255 | 250 | $this->_error("File exceeds size limit."); |
| 256 | 251 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param Array|Int $options takes an array of options passed to the image helper, or an integer representing the width of the image to display |
| 100 | 100 | * options: width = 100 (default), if width is set along with autoResize the uploaded image will be resized. |
| 101 | 101 | * @access public |
| 102 | - * @return mixed html tag, url string, or false if unable to find image. |
|
| 102 | + * @return string|false html tag, url string, or false if unable to find image. |
|
| 103 | 103 | */ |
| 104 | 104 | function image($name, $options = array()){ |
| 105 | 105 | $this->fileName = $name; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * Constructor |
| 330 | 330 | * |
| 331 | 331 | * @param [String $imgFile] Image File Name |
| 332 | - * @return RESIZEIMAGE (Class Object) |
|
| 332 | + * @return false|null (Class Object) |
|
| 333 | 333 | */ |
| 334 | 334 | function __construct($imgFile=""){ |
| 335 | 335 | if (!function_exists("imagecreate")){ |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * Set image file name |
| 357 | 357 | * |
| 358 | 358 | * @param String $imgFile |
| 359 | - * @return void |
|
| 359 | + * @return boolean |
|
| 360 | 360 | */ |
| 361 | 361 | function setImage($imgFile){ |
| 362 | 362 | $this->imgFile=$imgFile; |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | * Resize a image to given width and height and keep it's current width and height ratio |
| 375 | 375 | * |
| 376 | 376 | * @param Number $imgwidth |
| 377 | - * @param Numnber $imgheight |
|
| 377 | + * @param integer $imgheight |
|
| 378 | 378 | * @param String $newfile |
| 379 | 379 | */ |
| 380 | 380 | function resize_limitwh($imgwidth,$imgheight,$newfile=NULL){ |
@@ -394,9 +394,9 @@ discard block |
||
| 394 | 394 | /** |
| 395 | 395 | * Resize an image to given percentage. |
| 396 | 396 | * |
| 397 | - * @param Number $percent |
|
| 397 | + * @param integer $percent |
|
| 398 | 398 | * @param String $newfile |
| 399 | - * @return Boolean |
|
| 399 | + * @return false|null |
|
| 400 | 400 | */ |
| 401 | 401 | function resize_percentage($percent=100,$newfile=NULL) { |
| 402 | 402 | $newWidth=($this->imgWidth*$percent)/100; |
@@ -407,10 +407,10 @@ discard block |
||
| 407 | 407 | /** |
| 408 | 408 | * Resize an image to given X and Y percentage. |
| 409 | 409 | * |
| 410 | - * @param Number $xpercent |
|
| 411 | - * @param Number $ypercent |
|
| 410 | + * @param integer $xpercent |
|
| 411 | + * @param integer $ypercent |
|
| 412 | 412 | * @param String $newfile |
| 413 | - * @return Boolean |
|
| 413 | + * @return false|null |
|
| 414 | 414 | */ |
| 415 | 415 | function resize_xypercentage($xpercent=100,$ypercent=100,$newfile=NULL) { |
| 416 | 416 | $newWidth=($this->imgWidth*$xpercent)/100; |
@@ -421,10 +421,10 @@ discard block |
||
| 421 | 421 | /** |
| 422 | 422 | * Resize an image to given width and height |
| 423 | 423 | * |
| 424 | - * @param Number $width |
|
| 425 | - * @param Number $height |
|
| 424 | + * @param integer $width |
|
| 425 | + * @param integer $height |
|
| 426 | 426 | * @param String $newfile |
| 427 | - * @return Boolean |
|
| 427 | + * @return false|null |
|
| 428 | 428 | */ |
| 429 | 429 | function resize($width,$height,$newfile=NULL){ |
| 430 | 430 | if(empty($this->imgFile)){ |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | * @param Number $width |
| 484 | 484 | * @param Number $height |
| 485 | 485 | * @param String $newfile |
| 486 | - * @return Boolean |
|
| 486 | + * @return false|null |
|
| 487 | 487 | */ |
| 488 | 488 | function _resize($width,$height,$newfile=NULL){ |
| 489 | 489 | if (!function_exists("imagecreate")){ |
@@ -115,8 +115,7 @@ discard block |
||
| 115 | 115 | $img = false; |
| 116 | 116 | if(is_string($name)){ |
| 117 | 117 | $img = $this->_getImageByName(); |
| 118 | - } |
|
| 119 | - elseif(is_int($name)){ |
|
| 118 | + } elseif(is_int($name)){ |
|
| 120 | 119 | $img = $this->_getImageById(); |
| 121 | 120 | } |
| 122 | 121 | |
@@ -145,8 +144,7 @@ discard block |
||
| 145 | 144 | unset($options['model'], $options['var']); |
| 146 | 145 | |
| 147 | 146 | return $this->Form->input("{$configs['model']}.".$this->inputCount++.".{$configs['var']}", array_merge(array('type'=>'file'), $options)); |
| 148 | - } |
|
| 149 | - else { |
|
| 147 | + } else { |
|
| 150 | 148 | return "<input type='file' name='data[{$configs['var']}][".$this->inputCount++."]' />"; |
| 151 | 149 | } |
| 152 | 150 | } |
@@ -166,8 +164,7 @@ discard block |
||
| 166 | 164 | if(!empty($upload)){ |
| 167 | 165 | $this->fileName = $upload[$this->settings['fileModel']][$this->settings['fields']['name']]; |
| 168 | 166 | return $this->_getImageByName(); |
| 169 | - } |
|
| 170 | - else{ |
|
| 167 | + } else{ |
|
| 171 | 168 | return false; |
| 172 | 169 | } |
| 173 | 170 | } |
@@ -180,8 +177,7 @@ discard block |
||
| 180 | 177 | function _getFullPath(){ |
| 181 | 178 | if($this->_isOutsideSource()){ |
| 182 | 179 | return $this->fileName; |
| 183 | - } |
|
| 184 | - else { |
|
| 180 | + } else { |
|
| 185 | 181 | return WWW_ROOT . $this->_getUploadPath(); |
| 186 | 182 | } |
| 187 | 183 | } |
@@ -194,8 +190,7 @@ discard block |
||
| 194 | 190 | function _getImagePath(){ |
| 195 | 191 | if($this->_isOutsideSource()){ |
| 196 | 192 | return $this->fileName; |
| 197 | - } |
|
| 198 | - else { |
|
| 193 | + } else { |
|
| 199 | 194 | return '/' . $this->_getUploadPath(); |
| 200 | 195 | } |
| 201 | 196 | } |
@@ -227,7 +222,9 @@ discard block |
||
| 227 | 222 | */ |
| 228 | 223 | function _getImageByName(){ |
| 229 | 224 | //only proceed if we actually have the file in question |
| 230 | - if(!$this->_isOutsideSource() && !file_exists($this->_getFullPath())) return false; |
|
| 225 | + if(!$this->_isOutsideSource() && !file_exists($this->_getFullPath())) { |
|
| 226 | + return false; |
|
| 227 | + } |
|
| 231 | 228 | |
| 232 | 229 | //resize if we have resize on, a width, and if it doesn't already exist. |
| 233 | 230 | if($this->options['autoResize'] && $this->options['width'] > 0 && !file_exists($this->_getResizeNameOrPath($this->_getFullPath()))){ |
@@ -257,8 +254,7 @@ discard block |
||
| 257 | 254 | $this->newImage = new RResizeImage($this->_getFullPath()); |
| 258 | 255 | if($this->newImage->imgWidth > $this->options['width']){ |
| 259 | 256 | $this->newImage->resize_limitwh($this->options['width'], 0, $this->_getResizeNameOrPath($this->_getFullPath())); |
| 260 | - } |
|
| 261 | - else { |
|
| 257 | + } else { |
|
| 262 | 258 | //$this->autoResize = false; |
| 263 | 259 | } |
| 264 | 260 | } |
@@ -272,12 +268,10 @@ discard block |
||
| 272 | 268 | if(!$this->_isOutsideSource() && $this->options['autoResize'] && $this->options['width'] > 0){ |
| 273 | 269 | if(isset($this->newImage) && $this->newImage->imgWidth && $this->newImage->imgWidth <= $this->options['width']){ |
| 274 | 270 | $image = $this->_getImagePath(); |
| 275 | - } |
|
| 276 | - else { |
|
| 271 | + } else { |
|
| 277 | 272 | $image = $this->_getResizeNameOrPath($this->_getImagePath()); |
| 278 | 273 | } |
| 279 | - } |
|
| 280 | - else { |
|
| 274 | + } else { |
|
| 281 | 275 | $image = $this->_getImagePath(); |
| 282 | 276 | } |
| 283 | 277 | |
@@ -285,13 +279,14 @@ discard block |
||
| 285 | 279 | //unset the default options |
| 286 | 280 | unset($options['resizedDir'], $options['uploadDir'], $options['imagePathOnly'], $options['autoResize'], $options['resizeThumbOnly']); |
| 287 | 281 | //unset width only if we're not an outsourced image, we have resize turned on, or we don't have a width to begin with. |
| 288 | - if(!$this->_isOutsideSource() && ($this->options['resizeThumbOnly'] || !$options['width'])) unset($options['width']); |
|
| 282 | + if(!$this->_isOutsideSource() && ($this->options['resizeThumbOnly'] || !$options['width'])) { |
|
| 283 | + unset($options['width']); |
|
| 284 | + } |
|
| 289 | 285 | |
| 290 | 286 | //return the impage path or image html |
| 291 | 287 | if($this->options['imagePathOnly']){ |
| 292 | 288 | return $image; |
| 293 | - } |
|
| 294 | - else { |
|
| 289 | + } else { |
|
| 295 | 290 | return $this->Html->image($image, $options); |
| 296 | 291 | } |
| 297 | 292 | } |
@@ -435,8 +430,12 @@ discard block |
||
| 435 | 430 | $this->_error="Could not resize given image"; |
| 436 | 431 | return false; |
| 437 | 432 | } |
| 438 | - if($width<=0) $width=$this->imgWidth; |
|
| 439 | - if($height<=0) $height=$this->imgHeight; |
|
| 433 | + if($width<=0) { |
|
| 434 | + $width=$this->imgWidth; |
|
| 435 | + } |
|
| 436 | + if($height<=0) { |
|
| 437 | + $height=$this->imgHeight; |
|
| 438 | + } |
|
| 440 | 439 | |
| 441 | 440 | return $this->_resize($width,$height,$newfile); |
| 442 | 441 | } |
@@ -461,11 +460,9 @@ discard block |
||
| 461 | 460 | $this->_getImageInfo(); |
| 462 | 461 | if($this->imgType=='GIF'){ |
| 463 | 462 | $this->_img=@imagecreatefromgif($this->imgFile); |
| 464 | - } |
|
| 465 | - elseif($this->imgType=='JPG'){ |
|
| 463 | + } elseif($this->imgType=='JPG'){ |
|
| 466 | 464 | $this->_img=@imagecreatefromjpeg($this->imgFile); |
| 467 | - } |
|
| 468 | - elseif($this->imgType=='PNG'){ |
|
| 465 | + } elseif($this->imgType=='PNG'){ |
|
| 469 | 466 | $this->_img=@imagecreatefrompng($this->imgFile); |
| 470 | 467 | } |
| 471 | 468 | |
@@ -497,7 +494,9 @@ discard block |
||
| 497 | 494 | if($this->imgType=='GIF' || $this->imgType=='PNG') { |
| 498 | 495 | /** Code to keep transparency of image **/ |
| 499 | 496 | $colorcount = imagecolorstotal($this->_img); |
| 500 | - if ($colorcount == 0) $colorcount = 256; |
|
| 497 | + if ($colorcount == 0) { |
|
| 498 | + $colorcount = 256; |
|
| 499 | + } |
|
| 501 | 500 | imagetruecolortopalette($newimg,true,$colorcount); |
| 502 | 501 | imagepalettecopy($newimg,$this->_img); |
| 503 | 502 | $transparentcolor = imagecolortransparent($this->_img); |
@@ -511,8 +510,7 @@ discard block |
||
| 511 | 510 | if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)){ |
| 512 | 511 | $newfile=@substr_replace($this->imgFile,"_har",-@strlen($matches[0]),0); |
| 513 | 512 | } |
| 514 | - } |
|
| 515 | - elseif(!empty($newfile)){ |
|
| 513 | + } elseif(!empty($newfile)){ |
|
| 516 | 514 | if(!@preg_match("/\..*+$/",@basename($newfile))){ |
| 517 | 515 | if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)){ |
| 518 | 516 | $newfile=$newfile.$matches[0]; |
@@ -523,26 +521,21 @@ discard block |
||
| 523 | 521 | if($this->imgType=='GIF'){ |
| 524 | 522 | if(!empty($newfile)){ |
| 525 | 523 | @imagegif($newimg,$newfile); |
| 526 | - } |
|
| 527 | - else { |
|
| 524 | + } else { |
|
| 528 | 525 | @header("Content-type: image/gif"); |
| 529 | 526 | @imagegif($newimg); |
| 530 | 527 | } |
| 531 | - } |
|
| 532 | - elseif($this->imgType=='JPG'){ |
|
| 528 | + } elseif($this->imgType=='JPG'){ |
|
| 533 | 529 | if(!empty($newfile)){ |
| 534 | 530 | @imagejpeg($newimg,$newfile); |
| 535 | - } |
|
| 536 | - else { |
|
| 531 | + } else { |
|
| 537 | 532 | @header("Content-type: image/jpeg"); |
| 538 | 533 | @imagejpeg($newimg); |
| 539 | 534 | } |
| 540 | - } |
|
| 541 | - elseif($this->imgType=='PNG'){ |
|
| 535 | + } elseif($this->imgType=='PNG'){ |
|
| 542 | 536 | if(!empty($newfile)){ |
| 543 | 537 | @imagepng($newimg,$newfile); |
| 544 | - } |
|
| 545 | - else{ |
|
| 538 | + } else{ |
|
| 546 | 539 | @header("Content-type: image/png"); |
| 547 | 540 | @imagepng($newimg); |
| 548 | 541 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * credentials or create the missing database |
| 111 | 111 | * Create the database file and insert the submitted details |
| 112 | 112 | * |
| 113 | - * @return void |
|
| 113 | + * @return null|CakeResponse |
|
| 114 | 114 | * @access public |
| 115 | 115 | */ |
| 116 | 116 | public function database() { |
@@ -132,8 +132,7 @@ discard block |
||
| 132 | 132 | try { |
| 133 | 133 | @ConnectionManager::create('default', $config); |
| 134 | 134 | $db = ConnectionManager::getDataSource('default'); |
| 135 | - } |
|
| 136 | - catch (MissingConnectionException $e) { |
|
| 135 | + } catch (MissingConnectionException $e) { |
|
| 137 | 136 | $this->Session->setFlash(__('Could not connect to database: %s', $e->getMessage()), 'default', array('class' => 'error')); |
| 138 | 137 | $this->redirect(array('action' => 'database')); |
| 139 | 138 | } |
@@ -196,8 +195,7 @@ discard block |
||
| 196 | 195 | $create = $db->createSchema($schema, $table); |
| 197 | 196 | try { |
| 198 | 197 | $db->execute($create); |
| 199 | - } |
|
| 200 | - catch (PDOException $e) { |
|
| 198 | + } catch (PDOException $e) { |
|
| 201 | 199 | $this->Session->setFlash(__('Could not create table: %s', $e->getMessage()), 'default', array('class' => 'error')); |
| 202 | 200 | $this->redirect(array('action' => 'database')); |
| 203 | 201 | } |