Completed
Push — master ( e5db64...945d9a )
by Schlaefer
05:09 queued 28s
created
app/Controller/SearchesController.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -180,6 +180,9 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
app/Lib/Saito/Test/AssertTrait.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -18,6 +18,9 @@
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
app/Lib/Saito/Test/ControllerTestCase.php 1 patch
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -48,6 +48,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
app/Lib/Saito/Test/SecurityMockTrait.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
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'])) {
Please login to merge, or discard this patch.
app/Model/UserIgnore.php 1 patch
Doc Comments   +12 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,6 +29,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
app/Plugin/Embedly/Vendor/Embedly.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 if (!$match) {
203 203
                     //print("rejecting $url");
204 204
                     unset($params['urls'][$i]);
205
-                    $rejects[$i] = (object)array(
205
+                    $rejects[$i] = (object) array(
206 206
                         'error_code' => '401',
207 207
                         'error_message' => 'This service requires an Embedly key',
208 208
                         'type' => 'error'
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             array_push($merged_result, $obj);
244 244
         }
245 245
 
246
-        if($justone) {
246
+        if ($justone) {
247 247
             return array_shift($merged_result);
248 248
         }
249 249
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      */
366 366
     public static function paramify($input)
367 367
     {
368
-        if(is_string($input)) {
368
+        if (is_string($input)) {
369 369
             return array('urls' => $input);
370 370
         }
371 371
 
Please login to merge, or discard this patch.
app/Plugin/FileUpload/Vendor/uploader.php 2 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,6 +94,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     */
56 56
   var $finalFile = null;
57 57
 
58
-  function __construct($options = array()){
58
+  function __construct($options = array()) {
59 59
     $this->options = array_merge($this->options, $options);
60 60
   }
61 61
 
@@ -66,25 +66,25 @@  discard block
 block discarded – undo
66 66
     * @return string of resulting filename
67 67
     * @access private
68 68
     */
69
-  function __handleFileNameCallback($fileName){
70
-    if($this->options['fileNameFunction']){
71
-      if($this->options['fileModel']){
69
+  function __handleFileNameCallback($fileName) {
70
+    if ($this->options['fileNameFunction']) {
71
+      if ($this->options['fileModel']) {
72 72
         $Model = ClassRegistry::init($this->options['fileModel']);
73
-        if(method_exists($Model, $this->options['fileNameFunction'])){
73
+        if (method_exists($Model, $this->options['fileNameFunction'])) {
74 74
           $fileName = $Model->{$this->options['fileNameFunction']}($fileName);
75 75
         }
76
-        elseif(function_exists($this->options['fileNameFunction'])){
76
+        elseif (function_exists($this->options['fileNameFunction'])) {
77 77
           $fileName = call_user_func($this->options['fileNameFunction'], $fileName);
78 78
         }
79 79
       }
80 80
       else {
81
-        if(function_exists($this->options['fileNameFunction'])){
81
+        if (function_exists($this->options['fileNameFunction'])) {
82 82
           $fileName = call_user_func($this->options['fileNameFunction'], $fileName);
83 83
         }
84 84
       }
85 85
 
86
-      if(!$fileName){
87
-        $this->_error('No filename resulting after parsing. Function: ' . $this->options['fileNameFunction']);
86
+      if (!$fileName) {
87
+        $this->_error('No filename resulting after parsing. Function: '.$this->options['fileNameFunction']);
88 88
       }
89 89
     }
90 90
     return $fileName;
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
     * @return string of resulting target_path
98 98
     * @access private
99 99
     */
100
-  function __handleUnique($target_path){
101
-    if($this->options['unique']){
100
+  function __handleUnique($target_path) {
101
+    if ($this->options['unique']) {
102 102
       $temp_path = substr($target_path, 0, strlen($target_path) - strlen($this->_ext())); //temp path without the ext
103
-      $i=1;
104
-      while(file_exists($target_path)){
105
-        $target_path = $temp_path . "-" . $i . $this->_ext();
103
+      $i = 1;
104
+      while (file_exists($target_path)) {
105
+        $target_path = $temp_path."-".$i.$this->_ext();
106 106
         $i++;
107 107
       }
108 108
 		}
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
     * @return String | false String of finalFile name saved to the file system or false if unable to save to file system.
119 119
     * @access public
120 120
     */
121
-  function processFile($file = null){
121
+  function processFile($file = null) {
122 122
     $this->setFile($file);
123 123
 
124 124
     //check if we have a file and if we allow the type, return false otherwise.
125
-    if(!$this->checkFile() || !$this->checkType() || !$this->checkSize()){
125
+    if (!$this->checkFile() || !$this->checkType() || !$this->checkSize()) {
126 126
       return false;
127 127
     }
128 128
 
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
     $up_dir = $this->options['uploadDir'];
131 131
     $fileName = $this->__handleFileNameCallback($this->file['name']);
132 132
     //if callback returns false hault the upload
133
-    if(!$fileName){
133
+    if (!$fileName) {
134 134
       return false;
135 135
     }
136
-    $target_path = $up_dir . DS . $fileName;
136
+    $target_path = $up_dir.DS.$fileName;
137 137
     $target_path = $this->__handleUnique($target_path);
138 138
 
139 139
     //now move the file.
140
-    if(move_uploaded_file($this->file['tmp_name'], $target_path)){
140
+    if (move_uploaded_file($this->file['tmp_name'], $target_path)) {
141 141
       $this->finalFile = basename($target_path);
142 142
       return $this->finalFile;
143 143
     }
144
-    else{
144
+    else {
145 145
       $this->_error('Unable to save temp file to file system.');
146 146
       return false;
147 147
     }
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
     * @param file array of uploaded file. (optional)
154 154
     * @return void
155 155
     */
156
-  function setFile($file = null){
157
-    if($file) $this->file = $file;
156
+  function setFile($file = null) {
157
+    if ($file) $this->file = $file;
158 158
   }
159 159
 
160 160
   /**
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
     * @param file array of uploaded file (optional)
165 165
     * @access protected
166 166
     */
167
-  function _ext($file = null){
167
+  function _ext($file = null) {
168 168
     $this->setFile($file);
169
-    return strrchr($this->file['name'],".");
169
+    return strrchr($this->file['name'], ".");
170 170
   }
171 171
 
172 172
   /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
   * @return void
177 177
   * @access protected
178 178
   */
179
-  function _error($text){
179
+  function _error($text) {
180 180
     $this->errors[] = __($text);
181 181
   }
182 182
 
@@ -187,20 +187,20 @@  discard block
 block discarded – undo
187 187
   * @param file array of uploaded file (optional)
188 188
   * @access public
189 189
   */
190
-  function checkType($file = null){
190
+  function checkType($file = null) {
191 191
     $this->setFile($file);
192
-    foreach($this->options['allowedTypes'] as $ext => $types){
193
-      if(!is_string($ext)){
192
+    foreach ($this->options['allowedTypes'] as $ext => $types) {
193
+      if (!is_string($ext)) {
194 194
         $ext = $types;
195 195
       }
196
-      if($ext == '*'){
196
+      if ($ext == '*') {
197 197
         return true;
198 198
       }
199 199
 
200
-      $ext = strtolower('.' . str_replace('.','', $ext));
200
+      $ext = strtolower('.'.str_replace('.', '', $ext));
201 201
       $file_ext = strtolower($this->_ext());
202
-      if($file_ext == $ext){
203
-        if(is_array($types) && !in_array($this->file['type'], $types)){
202
+      if ($file_ext == $ext) {
203
+        if (is_array($types) && !in_array($this->file['type'], $types)) {
204 204
           $this->_error("{$this->file['type']} is not an allowed type.");
205 205
           return false;
206 206
         }
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
     * @access public
222 222
     * @param file array of uploaded file (optional)
223 223
     */
224
-  function checkFile($file = null){
224
+  function checkFile($file = null) {
225 225
     $this->setFile($file);
226
-    if($this->hasUpload() && $this->file){
227
-      if(isset($this->file['error']) && $this->file['error'] == UPLOAD_ERR_OK ) {
226
+    if ($this->hasUpload() && $this->file) {
227
+      if (isset($this->file['error']) && $this->file['error'] == UPLOAD_ERR_OK) {
228 228
         return true;
229 229
       }
230 230
       else {
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
     * @access public
242 242
     * @param file array of uploaded file (optional)
243 243
     */
244
-  function checkSize($file = null){
244
+  function checkSize($file = null) {
245 245
     $this->setFile($file);
246
-    if($this->hasUpload() && $this->file){
247
-      if(!$this->options['maxFileSize']){ //We don't want to test maxFileSize
246
+    if ($this->hasUpload() && $this->file) {
247
+      if (!$this->options['maxFileSize']) { //We don't want to test maxFileSize
248 248
         return true;
249 249
       }
250
-      elseif($this->options['maxFileSize'] && $this->file['size'] < $this->options['maxFileSize']){
250
+      elseif ($this->options['maxFileSize'] && $this->file['size'] < $this->options['maxFileSize']) {
251 251
         return true;
252 252
       }
253 253
       else {
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
     * @return boolean
266 266
     * @access public
267 267
     */
268
-  function removeFile($name = null){
269
-    if(!$name || strpos($name, '://')){
268
+  function removeFile($name = null) {
269
+    if (!$name || strpos($name, '://')) {
270 270
       return false;
271 271
     }
272 272
 
273 273
     $up_dir = $this->options['uploadDir'];
274
-    $target_path = $up_dir . DS . $name;
274
+    $target_path = $up_dir.DS.$name;
275 275
 
276 276
     //delete main image -- $name
277
-    if(@unlink($target_path)){
277
+    if (@unlink($target_path)) {
278 278
       return true;
279 279
     } else {
280 280
       return false;
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     * @return boolean true | false depending if a file was actually uploaded.
288 288
     * @param file array of uploaded file (optional)
289 289
     */
290
-  function hasUpload($file = null){
290
+  function hasUpload($file = null) {
291 291
     $this->setFile($file);
292 292
     return ($this->_multiArrayKeyExists("tmp_name", $this->file));
293 293
   }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
   /**
296 296
     * @return boolean true if errors were detected.
297 297
     */
298
-  function hasErrors(){
298
+  function hasErrors() {
299 299
     return count($this->errors);
300 300
   }
301 301
 
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
     * @return string
309 309
     * @access public
310 310
     */
311
-  function showErrors($sep = " "){
311
+  function showErrors($sep = " ") {
312 312
     $retval = "";
313
-    foreach($this->errors as $error){
313
+    foreach ($this->errors as $error) {
314 314
       $retval .= "$error $sep";
315 315
     }
316 316
     return $retval;
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
     * @access protected
326 326
     */
327 327
   function _multiArrayKeyExists($needle, $haystack) {
328
-    if(is_array($haystack)){
328
+    if (is_array($haystack)) {
329 329
       foreach ($haystack as $key=>$value) {
330
-        if ($needle===$key && $value) {
330
+        if ($needle === $key && $value) {
331 331
           return true;
332 332
         }
333 333
         if (is_array($value)) {
334
-          if($this->_multiArrayKeyExists($needle, $value)){
334
+          if ($this->_multiArrayKeyExists($needle, $value)) {
335 335
             return true;
336 336
           }
337 337
         }
Please login to merge, or discard this patch.
app/Plugin/FileUpload/View/Helper/FileUploadHelper.php 2 patches
Doc Comments   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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")){
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
   *
21 21
   */
22 22
 App::import('Config', 'FileUpload.file_upload_settings');
23
-class FileUploadHelper extends AppHelper{
23
+class FileUploadHelper extends AppHelper {
24 24
   var $helpers = array('Html', 'Form');
25 25
 
26 26
   /**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     * Constructor, initiallizes the FileUpload Component
65 65
     * and sets the default options.
66 66
     */
67
-  function __construct(View $View, $settings = array()){
67
+  function __construct(View $View, $settings = array()) {
68 68
 		parent::__construct($View, $settings);
69 69
     $this->FileUploadSettings = new FileUploadSettings;
70 70
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     * @access public
78 78
     * @return void
79 79
     */
80
-  function reset(){
80
+  function reset() {
81 81
     $this->fileName = null;
82 82
     $this->options = array(
83 83
       'width' => 0,
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
     * @access public
102 102
     * @return mixed html tag, url string, or false if unable to find image.
103 103
     */
104
-  function image($name, $options = array()){
104
+  function image($name, $options = array()) {
105 105
     $this->fileName = $name;
106 106
     //options takes in a width as well
107
-    if(is_int($options)){
107
+    if (is_int($options)) {
108 108
       $width = $options;
109 109
       $options = array();
110 110
       $options['width'] = $width;
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
     $this->settings = array_merge($this->settings, $options);
114 114
 
115 115
     $img = false;
116
-    if(is_string($name)){
116
+    if (is_string($name)) {
117 117
       $img = $this->_getImageByName();
118 118
     }
119
-    elseif(is_int($name)){
119
+    elseif (is_int($name)) {
120 120
       $img = $this->_getImageById();
121 121
     }
122 122
 
123
-    if($img){
123
+    if ($img) {
124 124
       return $img;
125 125
     }
126 126
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
     * @return String HTML form input element configured for the FileUploadComponent
136 136
     * @access public
137 137
     */
138
-  function input($options = array()){
138
+  function input($options = array()) {
139 139
     $options = array_merge(
140
-      array('var' => $this->settings['fileVar'],'model' => $this->settings['fileModel']),
140
+      array('var' => $this->settings['fileVar'], 'model' => $this->settings['fileModel']),
141 141
       $options
142 142
     );
143 143
     $configs = $options;
144
-    if($configs['model']){
144
+    if ($configs['model']) {
145 145
       unset($options['model'], $options['var']);
146 146
 
147 147
       return $this->Form->input("{$configs['model']}.".$this->inputCount++.".{$configs['var']}", array_merge(array('type'=>'file'), $options));
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
   /**
155 155
     * @access protected
156 156
     */
157
-  function _getImageById(){
157
+  function _getImageById() {
158 158
     App::import('Component', 'FileUpload.FileUpload');
159 159
     $this->FileUpload = new FileUploadComponent;
160 160
 
161 161
     $id = $this->fileName;
162 162
     $this->FileUpload->options['fileModel'] = $this->settings['fileModel'];
163
-    $Model =& $this->FileUpload->getModel();
163
+    $Model = & $this->FileUpload->getModel();
164 164
     $Model->recursive = -1;
165 165
     $upload = $Model->findById($id);
166
-    if(!empty($upload)){
166
+    if (!empty($upload)) {
167 167
       $this->fileName = $upload[$this->settings['fileModel']][$this->settings['fields']['name']];
168 168
       return $this->_getImageByName();
169 169
     }
170
-    else{
170
+    else {
171 171
       return false;
172 172
     }
173 173
   }
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
     * @access protected
178 178
     * @return String full path of the file name
179 179
     */
180
-  function _getFullPath(){
181
-    if($this->_isOutsideSource()){
180
+  function _getFullPath() {
181
+    if ($this->_isOutsideSource()) {
182 182
       return $this->fileName;
183 183
     }
184 184
     else {
185
-      return WWW_ROOT . $this->_getUploadPath();
185
+      return WWW_ROOT.$this->_getUploadPath();
186 186
     }
187 187
   }
188 188
 
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
     * @access protected
192 192
     * @return String full path of the file name
193 193
     */
194
-  function _getImagePath(){
195
-    if($this->_isOutsideSource()){
194
+  function _getImagePath() {
195
+    if ($this->_isOutsideSource()) {
196 196
       return $this->fileName;
197 197
     }
198 198
     else {
199
-      return '/' . $this->_getUploadPath();
199
+      return '/'.$this->_getUploadPath();
200 200
     }
201 201
   }
202 202
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
     * @access protected
206 206
     * @return String upload path of all files
207 207
     */
208
-  function _getUploadPath(){
209
-    return $this->settings['uploadDir'] . '/' . $this->fileName;
208
+  function _getUploadPath() {
209
+    return $this->settings['uploadDir'].'/'.$this->fileName;
210 210
   }
211 211
 
212 212
   /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
     * @access protected
215 215
     * @return String extension of filename
216 216
     */
217
-  function _getExt(){
218
-    return strrchr($this->fileName,".");
217
+  function _getExt() {
218
+    return strrchr($this->fileName, ".");
219 219
   }
220 220
 
221 221
   /**
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
     * if not, make it, save it, and return it.
226 226
     * @return String HTML of resized or full image.
227 227
     */
228
-  function _getImageByName(){
228
+  function _getImageByName() {
229 229
     //only proceed if we actually have the file in question
230
-    if(!$this->_isOutsideSource() && !file_exists($this->_getFullPath())) return false;
230
+    if (!$this->_isOutsideSource() && !file_exists($this->_getFullPath())) return false;
231 231
 
232 232
     //resize if we have resize on, a width, and if it doesn't already exist.
233
-    if($this->options['autoResize'] && $this->options['width'] > 0 && !file_exists($this->_getResizeNameOrPath($this->_getFullPath()))){
233
+    if ($this->options['autoResize'] && $this->options['width'] > 0 && !file_exists($this->_getResizeNameOrPath($this->_getFullPath()))) {
234 234
       $this->_resizeImage();
235 235
     }
236 236
     return $this->_htmlImage();
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
     * @return String of the resizedpath of a filename or path.
241 241
     * @access protected
242 242
     */
243
-  function _getResizeNameOrPath($file_name_or_path){
243
+  function _getResizeNameOrPath($file_name_or_path) {
244 244
     $file_name = basename($file_name_or_path);
245 245
     $path = substr($file_name_or_path, 0, strlen($file_name_or_path) - strlen($file_name));
246
-    $temp_path = substr($file_name,0,strlen($file_name) - strlen($this->_getExt())) . "x" . $this->options['width'] . $this->_getExt();
247
-    $full_path = (strlen($this->options['resizedDir']) > 0) ? $path . $this->options['resizedDir'] . '/' . $temp_path : $path . $temp_path;
246
+    $temp_path = substr($file_name, 0, strlen($file_name) - strlen($this->_getExt()))."x".$this->options['width'].$this->_getExt();
247
+    $full_path = (strlen($this->options['resizedDir']) > 0) ? $path.$this->options['resizedDir'].'/'.$temp_path : $path.$temp_path;
248 248
     return $full_path;
249 249
   }
250 250
 
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
     * @access protected
254 254
     * @return null
255 255
     */
256
-  function _resizeImage(){
256
+  function _resizeImage() {
257 257
     $this->newImage = new RResizeImage($this->_getFullPath());
258
-    if($this->newImage->imgWidth > $this->options['width']){
258
+    if ($this->newImage->imgWidth > $this->options['width']) {
259 259
       $this->newImage->resize_limitwh($this->options['width'], 0, $this->_getResizeNameOrPath($this->_getFullPath()));
260 260
     }
261 261
     else {
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
     * @access protected
269 269
     * @return String HTML image asked for
270 270
     */
271
-  function _htmlImage(){
272
-    if(!$this->_isOutsideSource() && $this->options['autoResize'] && $this->options['width'] > 0){
273
-      if(isset($this->newImage) && $this->newImage->imgWidth && $this->newImage->imgWidth <= $this->options['width']){
271
+  function _htmlImage() {
272
+    if (!$this->_isOutsideSource() && $this->options['autoResize'] && $this->options['width'] > 0) {
273
+      if (isset($this->newImage) && $this->newImage->imgWidth && $this->newImage->imgWidth <= $this->options['width']) {
274 274
         $image = $this->_getImagePath();
275 275
       }
276 276
       else {
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
     //unset the default options
286 286
     unset($options['resizedDir'], $options['uploadDir'], $options['imagePathOnly'], $options['autoResize'], $options['resizeThumbOnly']);
287 287
     //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']);
288
+    if (!$this->_isOutsideSource() && ($this->options['resizeThumbOnly'] || !$options['width'])) unset($options['width']);
289 289
 
290 290
     //return the impage path or image html
291
-    if($this->options['imagePathOnly']){
291
+    if ($this->options['imagePathOnly']) {
292 292
       return $image;
293 293
     }
294 294
     else {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
   /**
300 300
     * _isOutsideSource searches the fileName string for :// to determine if the image source is inside or outside our server
301 301
     */
302
-  function _isOutsideSource(){
302
+  function _isOutsideSource() {
303 303
     return !!strpos($this->fileName, '://');
304 304
   }
305 305
 }
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 */
317 317
 	//define("HAR_AUTO_NAME",1);
318
-	Class RResizeImage	{
319
-		var $imgFile="";
320
-		var $imgWidth=0;
321
-		var $imgHeight=0;
322
-		var $imgType="";
323
-		var $imgAttr="";
324
-		var $type=NULL;
325
-		var $_img=NULL;
326
-		var $_error="";
318
+	Class RResizeImage {
319
+		var $imgFile = "";
320
+		var $imgWidth = 0;
321
+		var $imgHeight = 0;
322
+		var $imgType = "";
323
+		var $imgAttr = "";
324
+		var $type = NULL;
325
+		var $_img = NULL;
326
+		var $_error = "";
327 327
 
328 328
 		/**
329 329
 		 * Constructor
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		 * @param [String $imgFile] Image File Name
332 332
 		 * @return RESIZEIMAGE (Class Object)
333 333
 		 */
334
-		function __construct($imgFile=""){
335
-			if (!function_exists("imagecreate")){
336
-				$this->_error="Error: GD Library is not available.";
334
+		function __construct($imgFile = "") {
335
+			if (!function_exists("imagecreate")) {
336
+				$this->_error = "Error: GD Library is not available.";
337 337
 				return false;
338 338
 			}
339 339
 
340
-			$this->type=Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM');
341
-			if(!empty($imgFile)){
340
+			$this->type = Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM');
341
+			if (!empty($imgFile)) {
342 342
 				$this->setImage($imgFile);
343 343
       }
344 344
 		}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 		 *
349 349
 		 * @return String
350 350
 		 */
351
-		function error(){
351
+		function error() {
352 352
 			return $this->_error;
353 353
 		}
354 354
 
@@ -358,15 +358,15 @@  discard block
 block discarded – undo
358 358
 		 * @param String $imgFile
359 359
 		 * @return void
360 360
 		 */
361
-		function setImage($imgFile){
362
-			$this->imgFile=$imgFile;
361
+		function setImage($imgFile) {
362
+			$this->imgFile = $imgFile;
363 363
 			return $this->_createImage();
364 364
 		}
365 365
 
366 366
     /**
367 367
 		 * @return void
368 368
 		 */
369
-		function close(){
369
+		function close() {
370 370
 			return @imagedestroy($this->_img);
371 371
 		}
372 372
 
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
 		 * @param Numnber $imgheight
378 378
 		 * @param String $newfile
379 379
 		 */
380
-		function resize_limitwh($imgwidth,$imgheight,$newfile=NULL){
380
+		function resize_limitwh($imgwidth, $imgheight, $newfile = NULL) {
381 381
 			$image_per = 100;
382 382
 			list($width, $height, $type, $attr) = @getimagesize($this->imgFile);
383
-			if($width > $imgwidth && $imgwidth > 0){
384
-				$image_per = (double)(($imgwidth * 100) / $width);
383
+			if ($width > $imgwidth && $imgwidth > 0) {
384
+				$image_per = (double) (($imgwidth * 100) / $width);
385 385
       }
386 386
 
387
-			if(floor(($height * $image_per)/100)>$imgheight && $imgheight > 0){
388
-				$image_per = (double)(($imgheight * 100) / $height);
387
+			if (floor(($height * $image_per) / 100) > $imgheight && $imgheight > 0) {
388
+				$image_per = (double) (($imgheight * 100) / $height);
389 389
       }
390 390
 
391
-			$this->resize_percentage($image_per,$newfile);
391
+			$this->resize_percentage($image_per, $newfile);
392 392
 		}
393 393
 
394 394
     /**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
 		 * @param String $newfile
399 399
 		 * @return Boolean
400 400
 		 */
401
-		function resize_percentage($percent=100,$newfile=NULL)	{
402
-			$newWidth=($this->imgWidth*$percent)/100;
403
-			$newHeight=($this->imgHeight*$percent)/100;
404
-			return $this->resize($newWidth,$newHeight,$newfile);
401
+		function resize_percentage($percent = 100, $newfile = NULL) {
402
+			$newWidth = ($this->imgWidth * $percent) / 100;
403
+			$newHeight = ($this->imgHeight * $percent) / 100;
404
+			return $this->resize($newWidth, $newHeight, $newfile);
405 405
 		}
406 406
 
407 407
     /**
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
 		 * @param String $newfile
413 413
 		 * @return Boolean
414 414
 		 */
415
-		function resize_xypercentage($xpercent=100,$ypercent=100,$newfile=NULL)		{
416
-			$newWidth=($this->imgWidth*$xpercent)/100;
417
-			$newHeight=($this->imgHeight*$ypercent)/100;
418
-			return $this->resize($newWidth,$newHeight,$newfile);
415
+		function resize_xypercentage($xpercent = 100, $ypercent = 100, $newfile = NULL) {
416
+			$newWidth = ($this->imgWidth * $xpercent) / 100;
417
+			$newHeight = ($this->imgHeight * $ypercent) / 100;
418
+			return $this->resize($newWidth, $newHeight, $newfile);
419 419
 		}
420 420
 
421 421
 		/**
@@ -426,19 +426,19 @@  discard block
 block discarded – undo
426 426
 		 * @param String $newfile
427 427
 		 * @return Boolean
428 428
 		 */
429
-		function resize($width,$height,$newfile=NULL){
430
-			if(empty($this->imgFile)){
431
-				$this->_error="File name is not initialised.";
429
+		function resize($width, $height, $newfile = NULL) {
430
+			if (empty($this->imgFile)) {
431
+				$this->_error = "File name is not initialised.";
432 432
 				return false;
433 433
 			}
434
-			if($this->imgWidth<=0 || $this->imgHeight<=0){
435
-				$this->_error="Could not resize given image";
434
+			if ($this->imgWidth <= 0 || $this->imgHeight <= 0) {
435
+				$this->_error = "Could not resize given image";
436 436
 				return false;
437 437
 			}
438
-			if($width<=0)	$width=$this->imgWidth;
439
-			if($height<=0) $height=$this->imgHeight;
438
+			if ($width <= 0)	$width = $this->imgWidth;
439
+			if ($height <= 0) $height = $this->imgHeight;
440 440
 
441
-			return $this->_resize($width,$height,$newfile);
441
+			return $this->_resize($width, $height, $newfile);
442 442
 		}
443 443
 
444 444
 		/**
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 		 */
449 449
 		function _getImageInfo()
450 450
 		{
451
-			@list($this->imgWidth,$this->imgHeight,$type,$this->imgAttr)=@getimagesize($this->imgFile);
452
-			$this->imgType=$this->type[$type];
451
+			@list($this->imgWidth, $this->imgHeight, $type, $this->imgAttr) = @getimagesize($this->imgFile);
452
+			$this->imgType = $this->type[$type];
453 453
 		}
454 454
 
455 455
 		/**
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 		 * @access Private
458 458
 		 * @return Boolean
459 459
 		 */
460
-		function _createImage(){
460
+		function _createImage() {
461 461
 			$this->_getImageInfo();
462
-			if($this->imgType=='GIF'){
463
-				$this->_img=@imagecreatefromgif($this->imgFile);
462
+			if ($this->imgType == 'GIF') {
463
+				$this->_img = @imagecreatefromgif($this->imgFile);
464 464
 			}
465
-			elseif($this->imgType=='JPG'){
466
-				$this->_img=@imagecreatefromjpeg($this->imgFile);
465
+			elseif ($this->imgType == 'JPG') {
466
+				$this->_img = @imagecreatefromjpeg($this->imgFile);
467 467
 			}
468
-			elseif($this->imgType=='PNG'){
469
-				$this->_img=@imagecreatefrompng($this->imgFile);
468
+			elseif ($this->imgType == 'PNG') {
469
+				$this->_img = @imagecreatefrompng($this->imgFile);
470 470
 			}
471 471
 
472
-			if(!$this->_img || !@is_resource($this->_img)){
473
-				$this->_error="Error loading ".$this->imgFile;
472
+			if (!$this->_img || !@is_resource($this->_img)) {
473
+				$this->_error = "Error loading ".$this->imgFile;
474 474
 				return false;
475 475
 			}
476 476
 			return true;
@@ -485,64 +485,64 @@  discard block
 block discarded – undo
485 485
 		 * @param String $newfile
486 486
 		 * @return Boolean
487 487
 		 */
488
-		function _resize($width,$height,$newfile=NULL){
489
-			if (!function_exists("imagecreate")){
490
-				$this->_error="Error: GD Library is not available.";
488
+		function _resize($width, $height, $newfile = NULL) {
489
+			if (!function_exists("imagecreate")) {
490
+				$this->_error = "Error: GD Library is not available.";
491 491
 				return false;
492 492
 			}
493 493
 
494
-			$newimg=@imagecreatetruecolor($width,$height);
494
+			$newimg = @imagecreatetruecolor($width, $height);
495 495
 			//imagecolortransparent( $newimg, imagecolorat( $newimg, 0, 0 ) );
496 496
 
497
-			if($this->imgType=='GIF' || $this->imgType=='PNG')	{
497
+			if ($this->imgType == 'GIF' || $this->imgType == 'PNG') {
498 498
 				/** Code to keep transparency of image **/
499 499
 				$colorcount = imagecolorstotal($this->_img);
500 500
 				if ($colorcount == 0) $colorcount = 256;
501
-				imagetruecolortopalette($newimg,true,$colorcount);
502
-				imagepalettecopy($newimg,$this->_img);
501
+				imagetruecolortopalette($newimg, true, $colorcount);
502
+				imagepalettecopy($newimg, $this->_img);
503 503
 				$transparentcolor = imagecolortransparent($this->_img);
504
-				imagefill($newimg,0,0,$transparentcolor);
505
-				imagecolortransparent($newimg,$transparentcolor);
504
+				imagefill($newimg, 0, 0, $transparentcolor);
505
+				imagecolortransparent($newimg, $transparentcolor);
506 506
 			}
507 507
 
508
-			@imagecopyresampled ( $newimg, $this->_img, 0,0,0,0, $width, $height, $this->imgWidth,$this->imgHeight);
508
+			@imagecopyresampled($newimg, $this->_img, 0, 0, 0, 0, $width, $height, $this->imgWidth, $this->imgHeight);
509 509
 
510
-			if($newfile===1)	{
511
-				if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)){
512
-			   		$newfile=@substr_replace($this->imgFile,"_har",-@strlen($matches[0]),0);
510
+			if ($newfile === 1) {
511
+				if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches)) {
512
+			   		$newfile = @substr_replace($this->imgFile, "_har", -@strlen($matches[0]), 0);
513 513
         }
514 514
 			}
515
-			elseif(!empty($newfile)){
516
-				if(!@preg_match("/\..*+$/",@basename($newfile))){
517
-					if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)){
518
-					   $newfile=$newfile.$matches[0];
515
+			elseif (!empty($newfile)) {
516
+				if (!@preg_match("/\..*+$/", @basename($newfile))) {
517
+					if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches)) {
518
+					   $newfile = $newfile.$matches[0];
519 519
           }
520 520
 				}
521 521
 			}
522 522
 
523
-			if($this->imgType=='GIF'){
524
-				if(!empty($newfile)){
525
-          @imagegif($newimg,$newfile);
523
+			if ($this->imgType == 'GIF') {
524
+				if (!empty($newfile)) {
525
+          @imagegif($newimg, $newfile);
526 526
         }
527 527
 				else {
528 528
 					@header("Content-type: image/gif");
529 529
 					@imagegif($newimg);
530 530
 				}
531 531
 			}
532
-			elseif($this->imgType=='JPG'){
533
-				if(!empty($newfile)){
534
-					@imagejpeg($newimg,$newfile);
532
+			elseif ($this->imgType == 'JPG') {
533
+				if (!empty($newfile)) {
534
+					@imagejpeg($newimg, $newfile);
535 535
         }
536
-				else	{
536
+				else {
537 537
 					@header("Content-type: image/jpeg");
538 538
 					@imagejpeg($newimg);
539 539
 				}
540 540
 			}
541
-			elseif($this->imgType=='PNG'){
542
-				if(!empty($newfile)){
543
-					@imagepng($newimg,$newfile);
541
+			elseif ($this->imgType == 'PNG') {
542
+				if (!empty($newfile)) {
543
+					@imagepng($newimg, $newfile);
544 544
         }
545
-				else{
545
+				else {
546 546
 					@header("Content-type: image/png");
547 547
 					@imagepng($newimg);
548 548
 				}
Please login to merge, or discard this patch.
app/Plugin/Install/Controller/InstallController.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
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() {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  * @return void
84 84
  */
85 85
 	protected function _check() {
86
-		if (file_exists(APP . 'Config' . DS . 'installed.txt')) {
86
+		if (file_exists(APP.'Config'.DS.'installed.txt')) {
87 87
 //		if (Configure::read('Install.installed') && Configure::read('Install.secured')) {
88 88
 			$this->Session->setFlash('Already Installed');
89 89
 			$this->redirect('/');
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
 			return;
143 143
 		}
144 144
 
145
-		copy(APP . 'Config' . DS.'database.php.install', APP . 'Config' . DS.'database.php');
145
+		copy(APP.'Config'.DS.'database.php.install', APP.'Config'.DS.'database.php');
146 146
 		App::uses('File', 'Utility');
147
-		$file = new File(APP . 'Config' . DS.'database.php', true);
147
+		$file = new File(APP.'Config'.DS.'database.php', true);
148 148
 		$content = $file->read();
149 149
 
150 150
 		foreach ($config AS $configKey => $configValue) {
151
-			$content = str_replace('{default_' . $configKey . '}', $configValue, $content);
151
+			$content = str_replace('{default_'.$configKey.'}', $configValue, $content);
152 152
 		}
153 153
 
154
-		if($file->write($content) ) {
154
+		if ($file->write($content)) {
155 155
 			return $this->redirect(array('action' => 'data'));
156 156
 		} else {
157 157
 			$this->Session->setFlash(__('Could not write database.php file.'), 'default', array('class' => 'error'));
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$nextValue = $model->find('first', array(
167 167
 			'fields' => sprintf('MAX(%s.%s) as max', $model->alias, $model->primaryKey),
168 168
 			));
169
-		$nextValue = empty($nextValue[0]['max']) ? 1 :  $nextValue[0]['max'] + 1;
169
+		$nextValue = empty($nextValue[0]['max']) ? 1 : $nextValue[0]['max'] + 1;
170 170
 		$sql = sprintf('alter sequence %s restart with %d', $db->getSequence($model), $nextValue);
171 171
 		$db->execute($sql);
172 172
 	}
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
 
188 188
 			$db = ConnectionManager::getDataSource('default');
189 189
 			$brokenSequence = $db instanceof Postgres;
190
-			if(!$db->isConnected()) {
190
+			if (!$db->isConnected()) {
191 191
 				$this->Session->setFlash(__('Could not connect to database.'), 'default', array('class' => 'error'));
192 192
 			} else {
193 193
 				$schema = new CakeSchema(array('name'=>'app'));
194 194
 				$schema = $schema->load();
195
-				foreach($schema->tables as $table => $fields) {
195
+				foreach ($schema->tables as $table => $fields) {
196 196
 					$create = $db->createSchema($schema, $table);
197 197
 					try {
198 198
 						$db->execute($create);
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
 					}
204 204
 				}
205 205
 
206
-				$path = CakePlugin::path('Install') .DS. 'Config' .DS. 'Data' .DS;
206
+				$path = CakePlugin::path('Install').DS.'Config'.DS.'Data'.DS;
207 207
 				$dataObjects = App::objects('class', $path);
208 208
 				foreach ($dataObjects as $data) {
209
-					include($path . $data . '.php');
209
+					include($path.$data.'.php');
210 210
 					$classVars = get_class_vars($data);
211 211
 					$modelAlias = substr($data, 0, -4);
212 212
 					$table = $classVars['table'];
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 					));
220 220
 					if (is_array($records) && count($records) > 0) {
221 221
 						$i = 1;
222
-						foreach($records as $record) {
222
+						foreach ($records as $record) {
223 223
 							if (!isset($record['id'])) {
224 224
 								$record['id'] = $i++;
225 225
 							}
Please login to merge, or discard this patch.