GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( e7eb83...70ade0 )
by gyeong-won
12:55
created
libs/tar.class.php 4 patches
Doc Comments   +24 added lines patch added patch discarded remove patch
@@ -84,6 +84,10 @@  discard block
 block discarded – undo
84 84
     // Computes the unsigned Checksum of a file's header
85 85
     // to try to ensure valid file
86 86
     // PRIVATE ACCESS FUNCTION
87
+
88
+    /**
89
+     * @param string $bytestring
90
+     */
87 91
     function __computeUnsignedChecksum($bytestring) {
88 92
         for($i=0; $i<512; $i++)
89 93
             $unsigned_chksum += ord($bytestring[$i]);
@@ -97,6 +101,10 @@  discard block
 block discarded – undo
97 101
 
98 102
     // Converts a NULL padded string to a non-NULL padded string
99 103
     // PRIVATE ACCESS FUNCTION
104
+
105
+    /**
106
+     * @param string $string
107
+     */
100 108
     function __parseNullPaddedString($string) {
101 109
         $position = strpos($string,chr(0));
102 110
 		if(!$position)
@@ -357,6 +365,10 @@  discard block
 block discarded – undo
357 365
 
358 366
 
359 367
     // Open a TAR file
368
+
369
+    /**
370
+     * @param string $filename
371
+     */
360 372
     function openTAR($filename) {
361 373
         // Clear any values from previous tar archives
362 374
         unset($this->filename);
@@ -393,6 +405,10 @@  discard block
 block discarded – undo
393 405
 
394 406
 
395 407
     // Retrieves information about a file in the current tar archive
408
+
409
+    /**
410
+     * @param string $filename
411
+     */
396 412
     function getFile($filename) {
397 413
         if($this->numFiles > 0) {
398 414
             foreach($this->files as $key => $information) {
@@ -467,6 +483,10 @@  discard block
 block discarded – undo
467 483
 
468 484
 
469 485
     // Add a file to the tar archive
486
+
487
+    /**
488
+     * @param string $filename
489
+     */
470 490
     function addFile($filename,$from=null,$to=null) {
471 491
         // Make sure the file we are adding exists!
472 492
         if(!file_exists($filename))
@@ -555,6 +575,10 @@  discard block
 block discarded – undo
555 575
 
556 576
 
557 577
     // Saves tar archive to a different file than the current file
578
+
579
+    /**
580
+     * @param boolean $useGzip
581
+     */
558 582
     function toTar($filename,$useGzip) {
559 583
         if(!$filename)
560 584
             return false;
Please login to merge, or discard this patch.
Indentation   +431 added lines, -431 removed lines patch added patch discarded remove patch
@@ -63,99 +63,99 @@  discard block
 block discarded – undo
63 63
 */
64 64
 
65 65
 class tar {
66
-    // Unprocessed Archive Information
67
-    var $filename;
68
-    var $isGzipped;
69
-    var $tar_file;
70
-
71
-    // Processed Archive Information
72
-    var $files;
73
-    var $directories;
74
-    var $numFiles;
75
-    var $numDirectories;
76
-
77
-
78
-    // Class Constructor -- Does nothing...
79
-    function tar() {
80
-        return true;
81
-    }
82
-
83
-
84
-    // Computes the unsigned Checksum of a file's header
85
-    // to try to ensure valid file
86
-    // PRIVATE ACCESS FUNCTION
87
-    function __computeUnsignedChecksum($bytestring) {
88
-        for($i=0; $i<512; $i++)
89
-            $unsigned_chksum += ord($bytestring[$i]);
90
-        for($i=0; $i<8; $i++)
91
-            $unsigned_chksum -= ord($bytestring[148 + $i]);
92
-        $unsigned_chksum += ord(" ") * 8;
93
-
94
-        return $unsigned_chksum;
95
-    }
96
-
97
-
98
-    // Converts a NULL padded string to a non-NULL padded string
99
-    // PRIVATE ACCESS FUNCTION
100
-    function __parseNullPaddedString($string) {
101
-        $position = strpos($string,chr(0));
66
+	// Unprocessed Archive Information
67
+	var $filename;
68
+	var $isGzipped;
69
+	var $tar_file;
70
+
71
+	// Processed Archive Information
72
+	var $files;
73
+	var $directories;
74
+	var $numFiles;
75
+	var $numDirectories;
76
+
77
+
78
+	// Class Constructor -- Does nothing...
79
+	function tar() {
80
+		return true;
81
+	}
82
+
83
+
84
+	// Computes the unsigned Checksum of a file's header
85
+	// to try to ensure valid file
86
+	// PRIVATE ACCESS FUNCTION
87
+	function __computeUnsignedChecksum($bytestring) {
88
+		for($i=0; $i<512; $i++)
89
+			$unsigned_chksum += ord($bytestring[$i]);
90
+		for($i=0; $i<8; $i++)
91
+			$unsigned_chksum -= ord($bytestring[148 + $i]);
92
+		$unsigned_chksum += ord(" ") * 8;
93
+
94
+		return $unsigned_chksum;
95
+	}
96
+
97
+
98
+	// Converts a NULL padded string to a non-NULL padded string
99
+	// PRIVATE ACCESS FUNCTION
100
+	function __parseNullPaddedString($string) {
101
+		$position = strpos($string,chr(0));
102 102
 		if(!$position)
103 103
 		{
104 104
 			$position = strlen($string);
105 105
 		}
106
-        return substr($string,0,$position);
107
-    }
106
+		return substr($string,0,$position);
107
+	}
108 108
 
109 109
 
110
-    // This function parses the current TAR file
111
-    // PRIVATE ACCESS FUNCTION
112
-    function __parseTar() {
113
-        // Read Files from archive
114
-        $tar_length = strlen($this->tar_file);
115
-        $main_offset = 0;
110
+	// This function parses the current TAR file
111
+	// PRIVATE ACCESS FUNCTION
112
+	function __parseTar() {
113
+		// Read Files from archive
114
+		$tar_length = strlen($this->tar_file);
115
+		$main_offset = 0;
116 116
 		$flag_longlink = false;
117
-        while($main_offset < $tar_length) {
118
-            // If we read a block of 512 nulls, we are at the end of the archive
119
-            if(substr($this->tar_file,$main_offset,512) == str_repeat(chr(0),512))
120
-                break;
117
+		while($main_offset < $tar_length) {
118
+			// If we read a block of 512 nulls, we are at the end of the archive
119
+			if(substr($this->tar_file,$main_offset,512) == str_repeat(chr(0),512))
120
+				break;
121 121
 
122
-            // Parse file name
123
-            $file_name      = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset,100));
122
+			// Parse file name
123
+			$file_name      = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset,100));
124 124
 
125
-            // Parse the file mode
126
-            $file_mode      = substr($this->tar_file,$main_offset + 100,8);
125
+			// Parse the file mode
126
+			$file_mode      = substr($this->tar_file,$main_offset + 100,8);
127 127
 
128
-            // Parse the file user ID
129
-            $file_uid       = octdec(substr($this->tar_file,$main_offset + 108,8));
128
+			// Parse the file user ID
129
+			$file_uid       = octdec(substr($this->tar_file,$main_offset + 108,8));
130 130
 
131
-            // Parse the file group ID
132
-            $file_gid       = octdec(substr($this->tar_file,$main_offset + 116,8));
131
+			// Parse the file group ID
132
+			$file_gid       = octdec(substr($this->tar_file,$main_offset + 116,8));
133 133
 
134
-            // Parse the file size
135
-            $file_size      = octdec(substr($this->tar_file,$main_offset + 124,12));
134
+			// Parse the file size
135
+			$file_size      = octdec(substr($this->tar_file,$main_offset + 124,12));
136 136
 
137
-            // Parse the file update time - unix timestamp format
138
-            $file_time      = octdec(substr($this->tar_file,$main_offset + 136,12));
137
+			// Parse the file update time - unix timestamp format
138
+			$file_time      = octdec(substr($this->tar_file,$main_offset + 136,12));
139 139
 
140
-            // Parse Checksum
141
-            $file_chksum        = octdec(substr($this->tar_file,$main_offset + 148,6));
140
+			// Parse Checksum
141
+			$file_chksum        = octdec(substr($this->tar_file,$main_offset + 148,6));
142 142
 
143
-            // Parse user name
144
-            $file_uname     = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset + 265,32));
143
+			// Parse user name
144
+			$file_uname     = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset + 265,32));
145 145
 
146
-            // Parse Group name
147
-            $file_gname     = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset + 297,32));
146
+			// Parse Group name
147
+			$file_gname     = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset + 297,32));
148 148
 
149
-            $file_type = substr($this->tar_file,$main_offset + 156,1);
149
+			$file_type = substr($this->tar_file,$main_offset + 156,1);
150 150
 
151
-            // Make sure our file is valid
152
-            if($this->__computeUnsignedChecksum(substr($this->tar_file,$main_offset,512)) != $file_chksum)
153
-                return false;
151
+			// Make sure our file is valid
152
+			if($this->__computeUnsignedChecksum(substr($this->tar_file,$main_offset,512)) != $file_chksum)
153
+				return false;
154 154
 
155
-            // Parse File Contents
156
-            $file_contents      = substr($this->tar_file,$main_offset + 512,$file_size);
155
+			// Parse File Contents
156
+			$file_contents      = substr($this->tar_file,$main_offset + 512,$file_size);
157 157
 
158
-            /*  ### Unused Header Information ###
158
+			/*  ### Unused Header Information ###
159 159
                 $activeFile["typeflag"]     = substr($this->tar_file,$main_offset + 156,1);
160 160
                 $activeFile["linkname"]     = substr($this->tar_file,$main_offset + 157,100);
161 161
                 $activeFile["magic"]        = substr($this->tar_file,$main_offset + 257,6);
@@ -228,363 +228,363 @@  discard block
 block discarded – undo
228 228
 				$flag_longlink = false;
229 229
 			}
230 230
 
231
-            // Move our offset the number of blocks we have processed
232
-            $main_offset += 512 + (ceil($file_size / 512) * 512);
233
-        }
234
-
235
-        return true;
236
-    }
237
-
238
-
239
-    // Read a non gzipped tar file in for processing
240
-    // PRIVATE ACCESS FUNCTION
241
-    function __readTar($filename='') {
242
-        // Set the filename to load
243
-        if(!$filename)
244
-            $filename = $this->filename;
245
-
246
-        // Read in the TAR file
247
-        $fp = fopen($filename,"rb");
248
-        $this->tar_file = fread($fp,filesize($filename));
249
-        fclose($fp);
250
-
251
-        if($this->tar_file[0] == chr(31) && $this->tar_file[1] == chr(139) && $this->tar_file[2] == chr(8)) {
252
-            if(!function_exists("gzinflate"))
253
-                return false;
254
-
255
-            $this->isGzipped = TRUE;
256
-
257
-            $this->tar_file = gzinflate(substr($this->tar_file,10,-4));
258
-        }
259
-
260
-        // Parse the TAR file
261
-        $this->__parseTar();
262
-
263
-        return true;
264
-    }
265
-
266
-
267
-    // Generates a TAR file from the processed data
268
-    // PRIVATE ACCESS FUNCTION
269
-    function __generateTAR() {
270
-        // Clear any data currently in $this->tar_file
271
-        unset($this->tar_file);
272
-
273
-        // Generate Records for each directory, if we have directories
274
-        if($this->numDirectories > 0) {
275
-            foreach($this->directories as $key => $information) {
276
-                unset($header);
277
-
278
-                // Generate tar header for this directory
279
-                // Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end
280
-                $header .= str_pad($information["name"],100,chr(0));
281
-                $header .= str_pad(decoct($information["mode"]),7,"0",STR_PAD_LEFT) . chr(0);
282
-                $header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0);
283
-                $header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0);
284
-                $header .= str_pad(decoct(0),11,"0",STR_PAD_LEFT) . chr(0);
285
-                $header .= str_pad(decoct($information["time"]),11,"0",STR_PAD_LEFT) . chr(0);
286
-                $header .= str_repeat(" ",8);
287
-                $header .= "5";
288
-                $header .= str_repeat(chr(0),100);
289
-                $header .= str_pad("ustar",6,chr(32));
290
-                $header .= chr(32) . chr(0);
291
-                $header .= str_pad("",32,chr(0));
292
-                $header .= str_pad("",32,chr(0));
293
-                $header .= str_repeat(chr(0),8);
294
-                $header .= str_repeat(chr(0),8);
295
-                $header .= str_repeat(chr(0),155);
296
-                $header .= str_repeat(chr(0),12);
297
-
298
-                // Compute header checksum
299
-                $checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT);
300
-                for($i=0; $i<6; $i++) {
301
-                    $header[(148 + $i)] = substr($checksum,$i,1);
302
-                }
303
-                $header[154] = chr(0);
304
-                $header[155] = chr(32);
305
-
306
-                // Add new tar formatted data to tar file contents
307
-                $this->tar_file .= $header;
308
-            }
309
-        }
310
-
311
-        // Generate Records for each file, if we have files (We should...)
312
-        if($this->numFiles > 0) {
313
-            foreach($this->files as $key => $information) {
314
-                unset($header);
315
-
316
-                // Generate the TAR header for this file
317
-                // Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end
318
-                $header .= str_pad($information["name"],100,chr(0));
319
-                $header .= str_pad(decoct($information["mode"]),7,"0",STR_PAD_LEFT) . chr(0);
320
-                $header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0);
321
-                $header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0);
322
-                $header .= str_pad(decoct($information["size"]),11,"0",STR_PAD_LEFT) . chr(0);
323
-                $header .= str_pad(decoct($information["time"]),11,"0",STR_PAD_LEFT) . chr(0);
324
-                $header .= str_repeat(" ",8);
325
-                $header .= "0";
326
-                $header .= str_repeat(chr(0),100);
327
-                $header .= str_pad("ustar",6,chr(32));
328
-                $header .= chr(32) . chr(0);
329
-                $header .= str_pad($information["user_name"],32,chr(0));    // How do I get a file's user name from PHP?
330
-                $header .= str_pad($information["group_name"],32,chr(0));   // How do I get a file's group name from PHP?
331
-                $header .= str_repeat(chr(0),8);
332
-                $header .= str_repeat(chr(0),8);
333
-                $header .= str_repeat(chr(0),155);
334
-                $header .= str_repeat(chr(0),12);
335
-
336
-                // Compute header checksum
337
-                $checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT);
338
-                for($i=0; $i<6; $i++) {
339
-                    $header[(148 + $i)] = substr($checksum,$i,1);
340
-                }
341
-                $header[154] = chr(0);
342
-                $header[155] = chr(32);
343
-
344
-                // Pad file contents to byte count divisible by 512
345
-                $file_contents = str_pad($information["file"],(ceil($information["size"] / 512) * 512),chr(0));
346
-
347
-                // Add new tar formatted data to tar file contents
348
-                $this->tar_file .= $header . $file_contents;
349
-            }
350
-        }
351
-
352
-        // Add 512 bytes of NULLs to designate EOF
353
-        $this->tar_file .= str_repeat(chr(0),512);
354
-
355
-        return true;
356
-    }
357
-
358
-
359
-    // Open a TAR file
360
-    function openTAR($filename) {
361
-        // Clear any values from previous tar archives
362
-        unset($this->filename);
363
-        unset($this->isGzipped);
364
-        unset($this->tar_file);
365
-        unset($this->files);
366
-        unset($this->directories);
367
-        unset($this->numFiles);
368
-        unset($this->numDirectories);
369
-
370
-        // If the tar file doesn't exist...
371
-        if(!file_exists($filename))
372
-            return false;
373
-
374
-        $this->filename = $filename;
375
-
376
-        // Parse this file
377
-        $this->__readTar();
378
-
379
-        return true;
380
-    }
381
-
382
-
383
-    // Appends a tar file to the end of the currently opened tar file
384
-    function appendTar($filename) {
385
-        // If the tar file doesn't exist...
386
-        if(!file_exists($filename))
387
-            return false;
388
-
389
-        $this->__readTar($filename);
390
-
391
-        return true;
392
-    }
393
-
394
-
395
-    // Retrieves information about a file in the current tar archive
396
-    function getFile($filename) {
397
-        if($this->numFiles > 0) {
398
-            foreach($this->files as $key => $information) {
399
-                if($information["name"] == $filename)
400
-                    return $information;
401
-            }
402
-        }
403
-
404
-        return false;
405
-    }
406
-
407
-
408
-    // Retrieves information about a directory in the current tar archive
409
-    function getDirectory($dirname) {
410
-        if($this->numDirectories > 0) {
411
-            foreach($this->directories as $key => $information) {
412
-                if($information["name"] == $dirname)
413
-                    return $information;
414
-            }
415
-        }
416
-
417
-        return false;
418
-    }
419
-
420
-
421
-    // Check if this tar archive contains a specific file
422
-    function containsFile($filename) {
423
-        if($this->numFiles > 0) {
424
-            foreach($this->files as $key => $information) {
425
-                if($information["name"] == $filename)
426
-                    return true;
427
-            }
428
-        }
429
-
430
-        return false;
431
-    }
432
-
433
-
434
-    // Check if this tar archive contains a specific directory
435
-    function containsDirectory($dirname) {
436
-        if($this->numDirectories > 0) {
437
-            foreach($this->directories as $key => $information) {
438
-                if($information["name"] == $dirname)
439
-                    return true;
440
-            }
441
-        }
442
-
443
-        return false;
444
-    }
445
-
446
-
447
-    // Add a directory to this tar archive
448
-    function addDirectory($dirname) {
449
-        if(!file_exists($dirname))
450
-            return false;
451
-
452
-        // Get directory information
453
-        $file_information = stat($dirname);
454
-
455
-        // Add directory to processed data
456
-        $this->numDirectories++;
457
-        $activeDir      = &$this->directories[];
458
-        $activeDir["name"]  = $dirname;
459
-        $activeDir["mode"]  = $file_information["mode"];
460
-        $activeDir["time"]  = $file_information["time"];
461
-        $activeDir["user_id"]   = $file_information["uid"];
462
-        $activeDir["group_id"]  = $file_information["gid"];
463
-        $activeDir["checksum"]  = $checksum;
464
-
465
-        return true;
466
-    }
467
-
468
-
469
-    // Add a file to the tar archive
470
-    function addFile($filename,$from=null,$to=null) {
471
-        // Make sure the file we are adding exists!
472
-        if(!file_exists($filename))
473
-            return false;
474
-
475
-        if(filesize($filename)==0)
476
-            return false;
477
-
478
-        // Make sure there are no other files in the archive that have this same filename
479
-        if($this->containsFile($filename))
480
-            return false;
481
-
482
-        // Get file information
483
-        $file_information = stat($filename);
484
-
485
-        // Read in the file's contents
486
-        $fp = fopen($filename,"rb");
487
-        $file_contents = fread($fp,filesize($filename));
488
-        fclose($fp);
489
-
490
-        if($from && $to){
491
-            $file_contents = str_replace($from,$to,$file_contents);
492
-            $file_information["size"] = strlen($file_contents);
493
-        }
494
-
495
-        // Add file to processed data
496
-        $this->numFiles++;
497
-        $activeFile         = &$this->files[];
498
-        $activeFile["name"]     = $filename;
499
-        $activeFile["mode"]     = $file_information["mode"];
500
-        $activeFile["user_id"]      = $file_information["uid"];
501
-        $activeFile["group_id"]     = $file_information["gid"];
502
-        $activeFile["size"]     = $file_information["size"];
503
-        $activeFile["time"]     = $file_information["mtime"];
504
-        $activeFile["checksum"]     = $checksum;
505
-        $activeFile["user_name"]    = "";
506
-        $activeFile["group_name"]   = "";
507
-        $activeFile["file"]     = $file_contents;
508
-
509
-        return true;
510
-    }
511
-
512
-
513
-    // Remove a file from the tar archive
514
-    function removeFile($filename) {
515
-        if($this->numFiles > 0) {
516
-            foreach($this->files as $key => $information) {
517
-                if($information["name"] == $filename) {
518
-                    $this->numFiles--;
519
-                    unset($this->files[$key]);
520
-                    return true;
521
-                }
522
-            }
523
-        }
524
-
525
-        return false;
526
-    }
527
-
528
-
529
-    // Remove a directory from the tar archive
530
-    function removeDirectory($dirname) {
531
-        if($this->numDirectories > 0) {
532
-            foreach($this->directories as $key => $information) {
533
-                if($information["name"] == $dirname) {
534
-                    $this->numDirectories--;
535
-                    unset($this->directories[$key]);
536
-                    return true;
537
-                }
538
-            }
539
-        }
540
-
541
-        return false;
542
-    }
543
-
544
-
545
-    // Write the currently loaded tar archive to disk
546
-    function saveTar() {
547
-        if(!$this->filename)
548
-            return false;
549
-
550
-        // Write tar to current file using specified gzip compression
551
-        $this->toTar($this->filename,$this->isGzipped);
552
-
553
-        return true;
554
-    }
555
-
556
-
557
-    // Saves tar archive to a different file than the current file
558
-    function toTar($filename,$useGzip) {
559
-        if(!$filename)
560
-            return false;
561
-
562
-        // Encode processed files into TAR file format
563
-        $this->__generateTar();
564
-
565
-        // GZ Compress the data if we need to
566
-        if($useGzip) {
567
-            // Make sure we have gzip support
568
-            if(!function_exists("gzencode"))
569
-                return false;
570
-
571
-            $file = gzencode($this->tar_file);
572
-        } else {
573
-            $file = $this->tar_file;
574
-        }
575
-
576
-        // Write the TAR file
577
-        $fp = fopen($filename,"wb");
578
-        fwrite($fp,$file);
579
-        fclose($fp);
580
-
581
-        return true;
582
-    }
583
-
584
-
585
-    function toTarStream() {
586
-        $this->__generateTar();
587
-        return $this->tar_file;
588
-    }
231
+			// Move our offset the number of blocks we have processed
232
+			$main_offset += 512 + (ceil($file_size / 512) * 512);
233
+		}
234
+
235
+		return true;
236
+	}
237
+
238
+
239
+	// Read a non gzipped tar file in for processing
240
+	// PRIVATE ACCESS FUNCTION
241
+	function __readTar($filename='') {
242
+		// Set the filename to load
243
+		if(!$filename)
244
+			$filename = $this->filename;
245
+
246
+		// Read in the TAR file
247
+		$fp = fopen($filename,"rb");
248
+		$this->tar_file = fread($fp,filesize($filename));
249
+		fclose($fp);
250
+
251
+		if($this->tar_file[0] == chr(31) && $this->tar_file[1] == chr(139) && $this->tar_file[2] == chr(8)) {
252
+			if(!function_exists("gzinflate"))
253
+				return false;
254
+
255
+			$this->isGzipped = TRUE;
256
+
257
+			$this->tar_file = gzinflate(substr($this->tar_file,10,-4));
258
+		}
259
+
260
+		// Parse the TAR file
261
+		$this->__parseTar();
262
+
263
+		return true;
264
+	}
265
+
266
+
267
+	// Generates a TAR file from the processed data
268
+	// PRIVATE ACCESS FUNCTION
269
+	function __generateTAR() {
270
+		// Clear any data currently in $this->tar_file
271
+		unset($this->tar_file);
272
+
273
+		// Generate Records for each directory, if we have directories
274
+		if($this->numDirectories > 0) {
275
+			foreach($this->directories as $key => $information) {
276
+				unset($header);
277
+
278
+				// Generate tar header for this directory
279
+				// Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end
280
+				$header .= str_pad($information["name"],100,chr(0));
281
+				$header .= str_pad(decoct($information["mode"]),7,"0",STR_PAD_LEFT) . chr(0);
282
+				$header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0);
283
+				$header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0);
284
+				$header .= str_pad(decoct(0),11,"0",STR_PAD_LEFT) . chr(0);
285
+				$header .= str_pad(decoct($information["time"]),11,"0",STR_PAD_LEFT) . chr(0);
286
+				$header .= str_repeat(" ",8);
287
+				$header .= "5";
288
+				$header .= str_repeat(chr(0),100);
289
+				$header .= str_pad("ustar",6,chr(32));
290
+				$header .= chr(32) . chr(0);
291
+				$header .= str_pad("",32,chr(0));
292
+				$header .= str_pad("",32,chr(0));
293
+				$header .= str_repeat(chr(0),8);
294
+				$header .= str_repeat(chr(0),8);
295
+				$header .= str_repeat(chr(0),155);
296
+				$header .= str_repeat(chr(0),12);
297
+
298
+				// Compute header checksum
299
+				$checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT);
300
+				for($i=0; $i<6; $i++) {
301
+					$header[(148 + $i)] = substr($checksum,$i,1);
302
+				}
303
+				$header[154] = chr(0);
304
+				$header[155] = chr(32);
305
+
306
+				// Add new tar formatted data to tar file contents
307
+				$this->tar_file .= $header;
308
+			}
309
+		}
310
+
311
+		// Generate Records for each file, if we have files (We should...)
312
+		if($this->numFiles > 0) {
313
+			foreach($this->files as $key => $information) {
314
+				unset($header);
315
+
316
+				// Generate the TAR header for this file
317
+				// Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end
318
+				$header .= str_pad($information["name"],100,chr(0));
319
+				$header .= str_pad(decoct($information["mode"]),7,"0",STR_PAD_LEFT) . chr(0);
320
+				$header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0);
321
+				$header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0);
322
+				$header .= str_pad(decoct($information["size"]),11,"0",STR_PAD_LEFT) . chr(0);
323
+				$header .= str_pad(decoct($information["time"]),11,"0",STR_PAD_LEFT) . chr(0);
324
+				$header .= str_repeat(" ",8);
325
+				$header .= "0";
326
+				$header .= str_repeat(chr(0),100);
327
+				$header .= str_pad("ustar",6,chr(32));
328
+				$header .= chr(32) . chr(0);
329
+				$header .= str_pad($information["user_name"],32,chr(0));    // How do I get a file's user name from PHP?
330
+				$header .= str_pad($information["group_name"],32,chr(0));   // How do I get a file's group name from PHP?
331
+				$header .= str_repeat(chr(0),8);
332
+				$header .= str_repeat(chr(0),8);
333
+				$header .= str_repeat(chr(0),155);
334
+				$header .= str_repeat(chr(0),12);
335
+
336
+				// Compute header checksum
337
+				$checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT);
338
+				for($i=0; $i<6; $i++) {
339
+					$header[(148 + $i)] = substr($checksum,$i,1);
340
+				}
341
+				$header[154] = chr(0);
342
+				$header[155] = chr(32);
343
+
344
+				// Pad file contents to byte count divisible by 512
345
+				$file_contents = str_pad($information["file"],(ceil($information["size"] / 512) * 512),chr(0));
346
+
347
+				// Add new tar formatted data to tar file contents
348
+				$this->tar_file .= $header . $file_contents;
349
+			}
350
+		}
351
+
352
+		// Add 512 bytes of NULLs to designate EOF
353
+		$this->tar_file .= str_repeat(chr(0),512);
354
+
355
+		return true;
356
+	}
357
+
358
+
359
+	// Open a TAR file
360
+	function openTAR($filename) {
361
+		// Clear any values from previous tar archives
362
+		unset($this->filename);
363
+		unset($this->isGzipped);
364
+		unset($this->tar_file);
365
+		unset($this->files);
366
+		unset($this->directories);
367
+		unset($this->numFiles);
368
+		unset($this->numDirectories);
369
+
370
+		// If the tar file doesn't exist...
371
+		if(!file_exists($filename))
372
+			return false;
373
+
374
+		$this->filename = $filename;
375
+
376
+		// Parse this file
377
+		$this->__readTar();
378
+
379
+		return true;
380
+	}
381
+
382
+
383
+	// Appends a tar file to the end of the currently opened tar file
384
+	function appendTar($filename) {
385
+		// If the tar file doesn't exist...
386
+		if(!file_exists($filename))
387
+			return false;
388
+
389
+		$this->__readTar($filename);
390
+
391
+		return true;
392
+	}
393
+
394
+
395
+	// Retrieves information about a file in the current tar archive
396
+	function getFile($filename) {
397
+		if($this->numFiles > 0) {
398
+			foreach($this->files as $key => $information) {
399
+				if($information["name"] == $filename)
400
+					return $information;
401
+			}
402
+		}
403
+
404
+		return false;
405
+	}
406
+
407
+
408
+	// Retrieves information about a directory in the current tar archive
409
+	function getDirectory($dirname) {
410
+		if($this->numDirectories > 0) {
411
+			foreach($this->directories as $key => $information) {
412
+				if($information["name"] == $dirname)
413
+					return $information;
414
+			}
415
+		}
416
+
417
+		return false;
418
+	}
419
+
420
+
421
+	// Check if this tar archive contains a specific file
422
+	function containsFile($filename) {
423
+		if($this->numFiles > 0) {
424
+			foreach($this->files as $key => $information) {
425
+				if($information["name"] == $filename)
426
+					return true;
427
+			}
428
+		}
429
+
430
+		return false;
431
+	}
432
+
433
+
434
+	// Check if this tar archive contains a specific directory
435
+	function containsDirectory($dirname) {
436
+		if($this->numDirectories > 0) {
437
+			foreach($this->directories as $key => $information) {
438
+				if($information["name"] == $dirname)
439
+					return true;
440
+			}
441
+		}
442
+
443
+		return false;
444
+	}
445
+
446
+
447
+	// Add a directory to this tar archive
448
+	function addDirectory($dirname) {
449
+		if(!file_exists($dirname))
450
+			return false;
451
+
452
+		// Get directory information
453
+		$file_information = stat($dirname);
454
+
455
+		// Add directory to processed data
456
+		$this->numDirectories++;
457
+		$activeDir      = &$this->directories[];
458
+		$activeDir["name"]  = $dirname;
459
+		$activeDir["mode"]  = $file_information["mode"];
460
+		$activeDir["time"]  = $file_information["time"];
461
+		$activeDir["user_id"]   = $file_information["uid"];
462
+		$activeDir["group_id"]  = $file_information["gid"];
463
+		$activeDir["checksum"]  = $checksum;
464
+
465
+		return true;
466
+	}
467
+
468
+
469
+	// Add a file to the tar archive
470
+	function addFile($filename,$from=null,$to=null) {
471
+		// Make sure the file we are adding exists!
472
+		if(!file_exists($filename))
473
+			return false;
474
+
475
+		if(filesize($filename)==0)
476
+			return false;
477
+
478
+		// Make sure there are no other files in the archive that have this same filename
479
+		if($this->containsFile($filename))
480
+			return false;
481
+
482
+		// Get file information
483
+		$file_information = stat($filename);
484
+
485
+		// Read in the file's contents
486
+		$fp = fopen($filename,"rb");
487
+		$file_contents = fread($fp,filesize($filename));
488
+		fclose($fp);
489
+
490
+		if($from && $to){
491
+			$file_contents = str_replace($from,$to,$file_contents);
492
+			$file_information["size"] = strlen($file_contents);
493
+		}
494
+
495
+		// Add file to processed data
496
+		$this->numFiles++;
497
+		$activeFile         = &$this->files[];
498
+		$activeFile["name"]     = $filename;
499
+		$activeFile["mode"]     = $file_information["mode"];
500
+		$activeFile["user_id"]      = $file_information["uid"];
501
+		$activeFile["group_id"]     = $file_information["gid"];
502
+		$activeFile["size"]     = $file_information["size"];
503
+		$activeFile["time"]     = $file_information["mtime"];
504
+		$activeFile["checksum"]     = $checksum;
505
+		$activeFile["user_name"]    = "";
506
+		$activeFile["group_name"]   = "";
507
+		$activeFile["file"]     = $file_contents;
508
+
509
+		return true;
510
+	}
511
+
512
+
513
+	// Remove a file from the tar archive
514
+	function removeFile($filename) {
515
+		if($this->numFiles > 0) {
516
+			foreach($this->files as $key => $information) {
517
+				if($information["name"] == $filename) {
518
+					$this->numFiles--;
519
+					unset($this->files[$key]);
520
+					return true;
521
+				}
522
+			}
523
+		}
524
+
525
+		return false;
526
+	}
527
+
528
+
529
+	// Remove a directory from the tar archive
530
+	function removeDirectory($dirname) {
531
+		if($this->numDirectories > 0) {
532
+			foreach($this->directories as $key => $information) {
533
+				if($information["name"] == $dirname) {
534
+					$this->numDirectories--;
535
+					unset($this->directories[$key]);
536
+					return true;
537
+				}
538
+			}
539
+		}
540
+
541
+		return false;
542
+	}
543
+
544
+
545
+	// Write the currently loaded tar archive to disk
546
+	function saveTar() {
547
+		if(!$this->filename)
548
+			return false;
549
+
550
+		// Write tar to current file using specified gzip compression
551
+		$this->toTar($this->filename,$this->isGzipped);
552
+
553
+		return true;
554
+	}
555
+
556
+
557
+	// Saves tar archive to a different file than the current file
558
+	function toTar($filename,$useGzip) {
559
+		if(!$filename)
560
+			return false;
561
+
562
+		// Encode processed files into TAR file format
563
+		$this->__generateTar();
564
+
565
+		// GZ Compress the data if we need to
566
+		if($useGzip) {
567
+			// Make sure we have gzip support
568
+			if(!function_exists("gzencode"))
569
+				return false;
570
+
571
+			$file = gzencode($this->tar_file);
572
+		} else {
573
+			$file = $this->tar_file;
574
+		}
575
+
576
+		// Write the TAR file
577
+		$fp = fopen($filename,"wb");
578
+		fwrite($fp,$file);
579
+		fclose($fp);
580
+
581
+		return true;
582
+	}
583
+
584
+
585
+	function toTarStream() {
586
+		$this->__generateTar();
587
+		return $this->tar_file;
588
+	}
589 589
 }
590 590
 ?>
Please login to merge, or discard this patch.
Braces   +60 added lines, -44 removed lines patch added patch discarded remove patch
@@ -85,10 +85,12 @@  discard block
 block discarded – undo
85 85
     // to try to ensure valid file
86 86
     // PRIVATE ACCESS FUNCTION
87 87
     function __computeUnsignedChecksum($bytestring) {
88
-        for($i=0; $i<512; $i++)
89
-            $unsigned_chksum += ord($bytestring[$i]);
90
-        for($i=0; $i<8; $i++)
91
-            $unsigned_chksum -= ord($bytestring[148 + $i]);
88
+        for($i=0; $i<512; $i++) {
89
+                    $unsigned_chksum += ord($bytestring[$i]);
90
+        }
91
+        for($i=0; $i<8; $i++) {
92
+                    $unsigned_chksum -= ord($bytestring[148 + $i]);
93
+        }
92 94
         $unsigned_chksum += ord(" ") * 8;
93 95
 
94 96
         return $unsigned_chksum;
@@ -116,8 +118,9 @@  discard block
 block discarded – undo
116 118
 		$flag_longlink = false;
117 119
         while($main_offset < $tar_length) {
118 120
             // If we read a block of 512 nulls, we are at the end of the archive
119
-            if(substr($this->tar_file,$main_offset,512) == str_repeat(chr(0),512))
120
-                break;
121
+            if(substr($this->tar_file,$main_offset,512) == str_repeat(chr(0),512)) {
122
+                            break;
123
+            }
121 124
 
122 125
             // Parse file name
123 126
             $file_name      = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset,100));
@@ -149,8 +152,9 @@  discard block
 block discarded – undo
149 152
             $file_type = substr($this->tar_file,$main_offset + 156,1);
150 153
 
151 154
             // Make sure our file is valid
152
-            if($this->__computeUnsignedChecksum(substr($this->tar_file,$main_offset,512)) != $file_chksum)
153
-                return false;
155
+            if($this->__computeUnsignedChecksum(substr($this->tar_file,$main_offset,512)) != $file_chksum) {
156
+                            return false;
157
+            }
154 158
 
155 159
             // Parse File Contents
156 160
             $file_contents      = substr($this->tar_file,$main_offset + 512,$file_size);
@@ -170,8 +174,7 @@  discard block
 block discarded – undo
170 174
 			{
171 175
 				$flag_longlink = true;
172 176
 				$longlink_name = $this->__parseNullPaddedString($file_contents);
173
-			}
174
-			elseif($file_type == '0') {
177
+			} elseif($file_type == '0') {
175 178
 				// Increment number of files
176 179
 				$this->numFiles++;
177 180
 
@@ -182,8 +185,7 @@  discard block
 block discarded – undo
182 185
 				if($flag_longlink)
183 186
 				{
184 187
 					$activeFile["name"]     = $longlink_name;
185
-				}
186
-				else
188
+				} else
187 189
 				{
188 190
 					$activeFile["name"]     = $file_name;
189 191
 				}
@@ -211,8 +213,7 @@  discard block
 block discarded – undo
211 213
 				if($flag_longlink)
212 214
 				{
213 215
 					$activeDir["name"]     = $longlink_name;
214
-				}
215
-				else
216
+				} else
216 217
 				{
217 218
 					$activeDir["name"]     = $file_name;
218 219
 				}
@@ -240,8 +241,9 @@  discard block
 block discarded – undo
240 241
     // PRIVATE ACCESS FUNCTION
241 242
     function __readTar($filename='') {
242 243
         // Set the filename to load
243
-        if(!$filename)
244
-            $filename = $this->filename;
244
+        if(!$filename) {
245
+                    $filename = $this->filename;
246
+        }
245 247
 
246 248
         // Read in the TAR file
247 249
         $fp = fopen($filename,"rb");
@@ -249,8 +251,9 @@  discard block
 block discarded – undo
249 251
         fclose($fp);
250 252
 
251 253
         if($this->tar_file[0] == chr(31) && $this->tar_file[1] == chr(139) && $this->tar_file[2] == chr(8)) {
252
-            if(!function_exists("gzinflate"))
253
-                return false;
254
+            if(!function_exists("gzinflate")) {
255
+                            return false;
256
+            }
254 257
 
255 258
             $this->isGzipped = TRUE;
256 259
 
@@ -368,8 +371,9 @@  discard block
 block discarded – undo
368 371
         unset($this->numDirectories);
369 372
 
370 373
         // If the tar file doesn't exist...
371
-        if(!file_exists($filename))
372
-            return false;
374
+        if(!file_exists($filename)) {
375
+                    return false;
376
+        }
373 377
 
374 378
         $this->filename = $filename;
375 379
 
@@ -383,8 +387,9 @@  discard block
 block discarded – undo
383 387
     // Appends a tar file to the end of the currently opened tar file
384 388
     function appendTar($filename) {
385 389
         // If the tar file doesn't exist...
386
-        if(!file_exists($filename))
387
-            return false;
390
+        if(!file_exists($filename)) {
391
+                    return false;
392
+        }
388 393
 
389 394
         $this->__readTar($filename);
390 395
 
@@ -396,8 +401,9 @@  discard block
 block discarded – undo
396 401
     function getFile($filename) {
397 402
         if($this->numFiles > 0) {
398 403
             foreach($this->files as $key => $information) {
399
-                if($information["name"] == $filename)
400
-                    return $information;
404
+                if($information["name"] == $filename) {
405
+                                    return $information;
406
+                }
401 407
             }
402 408
         }
403 409
 
@@ -409,8 +415,9 @@  discard block
 block discarded – undo
409 415
     function getDirectory($dirname) {
410 416
         if($this->numDirectories > 0) {
411 417
             foreach($this->directories as $key => $information) {
412
-                if($information["name"] == $dirname)
413
-                    return $information;
418
+                if($information["name"] == $dirname) {
419
+                                    return $information;
420
+                }
414 421
             }
415 422
         }
416 423
 
@@ -422,8 +429,9 @@  discard block
 block discarded – undo
422 429
     function containsFile($filename) {
423 430
         if($this->numFiles > 0) {
424 431
             foreach($this->files as $key => $information) {
425
-                if($information["name"] == $filename)
426
-                    return true;
432
+                if($information["name"] == $filename) {
433
+                                    return true;
434
+                }
427 435
             }
428 436
         }
429 437
 
@@ -435,8 +443,9 @@  discard block
 block discarded – undo
435 443
     function containsDirectory($dirname) {
436 444
         if($this->numDirectories > 0) {
437 445
             foreach($this->directories as $key => $information) {
438
-                if($information["name"] == $dirname)
439
-                    return true;
446
+                if($information["name"] == $dirname) {
447
+                                    return true;
448
+                }
440 449
             }
441 450
         }
442 451
 
@@ -446,8 +455,9 @@  discard block
 block discarded – undo
446 455
 
447 456
     // Add a directory to this tar archive
448 457
     function addDirectory($dirname) {
449
-        if(!file_exists($dirname))
450
-            return false;
458
+        if(!file_exists($dirname)) {
459
+                    return false;
460
+        }
451 461
 
452 462
         // Get directory information
453 463
         $file_information = stat($dirname);
@@ -469,15 +479,18 @@  discard block
 block discarded – undo
469 479
     // Add a file to the tar archive
470 480
     function addFile($filename,$from=null,$to=null) {
471 481
         // Make sure the file we are adding exists!
472
-        if(!file_exists($filename))
473
-            return false;
482
+        if(!file_exists($filename)) {
483
+                    return false;
484
+        }
474 485
 
475
-        if(filesize($filename)==0)
476
-            return false;
486
+        if(filesize($filename)==0) {
487
+                    return false;
488
+        }
477 489
 
478 490
         // Make sure there are no other files in the archive that have this same filename
479
-        if($this->containsFile($filename))
480
-            return false;
491
+        if($this->containsFile($filename)) {
492
+                    return false;
493
+        }
481 494
 
482 495
         // Get file information
483 496
         $file_information = stat($filename);
@@ -544,8 +557,9 @@  discard block
 block discarded – undo
544 557
 
545 558
     // Write the currently loaded tar archive to disk
546 559
     function saveTar() {
547
-        if(!$this->filename)
548
-            return false;
560
+        if(!$this->filename) {
561
+                    return false;
562
+        }
549 563
 
550 564
         // Write tar to current file using specified gzip compression
551 565
         $this->toTar($this->filename,$this->isGzipped);
@@ -556,8 +570,9 @@  discard block
 block discarded – undo
556 570
 
557 571
     // Saves tar archive to a different file than the current file
558 572
     function toTar($filename,$useGzip) {
559
-        if(!$filename)
560
-            return false;
573
+        if(!$filename) {
574
+                    return false;
575
+        }
561 576
 
562 577
         // Encode processed files into TAR file format
563 578
         $this->__generateTar();
@@ -565,8 +580,9 @@  discard block
 block discarded – undo
565 580
         // GZ Compress the data if we need to
566 581
         if($useGzip) {
567 582
             // Make sure we have gzip support
568
-            if(!function_exists("gzencode"))
569
-                return false;
583
+            if(!function_exists("gzencode")) {
584
+                            return false;
585
+            }
570 586
 
571 587
             $file = gzencode($this->tar_file);
572 588
         } else {
Please login to merge, or discard this patch.
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
     // to try to ensure valid file
86 86
     // PRIVATE ACCESS FUNCTION
87 87
     function __computeUnsignedChecksum($bytestring) {
88
-        for($i=0; $i<512; $i++)
88
+        for ($i = 0; $i < 512; $i++)
89 89
             $unsigned_chksum += ord($bytestring[$i]);
90
-        for($i=0; $i<8; $i++)
90
+        for ($i = 0; $i < 8; $i++)
91 91
             $unsigned_chksum -= ord($bytestring[148 + $i]);
92 92
         $unsigned_chksum += ord(" ") * 8;
93 93
 
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
     // Converts a NULL padded string to a non-NULL padded string
99 99
     // PRIVATE ACCESS FUNCTION
100 100
     function __parseNullPaddedString($string) {
101
-        $position = strpos($string,chr(0));
102
-		if(!$position)
101
+        $position = strpos($string, chr(0));
102
+		if (!$position)
103 103
 		{
104 104
 			$position = strlen($string);
105 105
 		}
106
-        return substr($string,0,$position);
106
+        return substr($string, 0, $position);
107 107
     }
108 108
 
109 109
 
@@ -114,46 +114,46 @@  discard block
 block discarded – undo
114 114
         $tar_length = strlen($this->tar_file);
115 115
         $main_offset = 0;
116 116
 		$flag_longlink = false;
117
-        while($main_offset < $tar_length) {
117
+        while ($main_offset < $tar_length) {
118 118
             // If we read a block of 512 nulls, we are at the end of the archive
119
-            if(substr($this->tar_file,$main_offset,512) == str_repeat(chr(0),512))
119
+            if (substr($this->tar_file, $main_offset, 512) == str_repeat(chr(0), 512))
120 120
                 break;
121 121
 
122 122
             // Parse file name
123
-            $file_name      = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset,100));
123
+            $file_name      = $this->__parseNullPaddedString(substr($this->tar_file, $main_offset, 100));
124 124
 
125 125
             // Parse the file mode
126
-            $file_mode      = substr($this->tar_file,$main_offset + 100,8);
126
+            $file_mode      = substr($this->tar_file, $main_offset + 100, 8);
127 127
 
128 128
             // Parse the file user ID
129
-            $file_uid       = octdec(substr($this->tar_file,$main_offset + 108,8));
129
+            $file_uid       = octdec(substr($this->tar_file, $main_offset + 108, 8));
130 130
 
131 131
             // Parse the file group ID
132
-            $file_gid       = octdec(substr($this->tar_file,$main_offset + 116,8));
132
+            $file_gid       = octdec(substr($this->tar_file, $main_offset + 116, 8));
133 133
 
134 134
             // Parse the file size
135
-            $file_size      = octdec(substr($this->tar_file,$main_offset + 124,12));
135
+            $file_size      = octdec(substr($this->tar_file, $main_offset + 124, 12));
136 136
 
137 137
             // Parse the file update time - unix timestamp format
138
-            $file_time      = octdec(substr($this->tar_file,$main_offset + 136,12));
138
+            $file_time      = octdec(substr($this->tar_file, $main_offset + 136, 12));
139 139
 
140 140
             // Parse Checksum
141
-            $file_chksum        = octdec(substr($this->tar_file,$main_offset + 148,6));
141
+            $file_chksum = octdec(substr($this->tar_file, $main_offset + 148, 6));
142 142
 
143 143
             // Parse user name
144
-            $file_uname     = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset + 265,32));
144
+            $file_uname     = $this->__parseNullPaddedString(substr($this->tar_file, $main_offset + 265, 32));
145 145
 
146 146
             // Parse Group name
147
-            $file_gname     = $this->__parseNullPaddedString(substr($this->tar_file,$main_offset + 297,32));
147
+            $file_gname     = $this->__parseNullPaddedString(substr($this->tar_file, $main_offset + 297, 32));
148 148
 
149
-            $file_type = substr($this->tar_file,$main_offset + 156,1);
149
+            $file_type = substr($this->tar_file, $main_offset + 156, 1);
150 150
 
151 151
             // Make sure our file is valid
152
-            if($this->__computeUnsignedChecksum(substr($this->tar_file,$main_offset,512)) != $file_chksum)
152
+            if ($this->__computeUnsignedChecksum(substr($this->tar_file, $main_offset, 512)) != $file_chksum)
153 153
                 return false;
154 154
 
155 155
             // Parse File Contents
156
-            $file_contents      = substr($this->tar_file,$main_offset + 512,$file_size);
156
+            $file_contents = substr($this->tar_file, $main_offset + 512, $file_size);
157 157
 
158 158
             /*  ### Unused Header Information ###
159 159
                 $activeFile["typeflag"]     = substr($this->tar_file,$main_offset + 156,1);
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
                 $activeFile["endheader"]    = substr($this->tar_file,$main_offset + 500,12);
167 167
             */
168 168
 
169
-			if(strtolower($file_type) == 'l' || $file_name == '././@LongLink')
169
+			if (strtolower($file_type) == 'l' || $file_name == '././@LongLink')
170 170
 			{
171 171
 				$flag_longlink = true;
172 172
 				$longlink_name = $this->__parseNullPaddedString($file_contents);
173 173
 			}
174
-			elseif($file_type == '0') {
174
+			elseif ($file_type == '0') {
175 175
 				// Increment number of files
176 176
 				$this->numFiles++;
177 177
 
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 				$activeFile = &$this->files[];
180 180
 
181 181
 				// Asign Values
182
-				if($flag_longlink)
182
+				if ($flag_longlink)
183 183
 				{
184
-					$activeFile["name"]     = $longlink_name;
184
+					$activeFile["name"] = $longlink_name;
185 185
 				}
186 186
 				else
187 187
 				{
188
-					$activeFile["name"]     = $file_name;
188
+					$activeFile["name"] = $file_name;
189 189
 				}
190 190
 				$activeFile["type"]     = $file_type;
191 191
 				$activeFile["mode"]     = $file_mode;
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
 				$activeFile["user_name"]    = $file_uname;
197 197
 				$activeFile["group_name"]   = $file_gname;
198 198
 				$activeFile["checksum"]     = $file_chksum;
199
-				$activeFile["file"]     = $file_contents;
199
+				$activeFile["file"] = $file_contents;
200 200
 
201 201
 				$flag_longlink = false;
202 202
 
203
-			} elseif($file_type == '5') {
203
+			} elseif ($file_type == '5') {
204 204
 				// Increment number of directories
205 205
 				$this->numDirectories++;
206 206
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 				$activeDir = &$this->directories[];
209 209
 
210 210
 				// Assign values
211
-				if($flag_longlink)
211
+				if ($flag_longlink)
212 212
 				{
213
-					$activeDir["name"]     = $longlink_name;
213
+					$activeDir["name"] = $longlink_name;
214 214
 				}
215 215
 				else
216 216
 				{
@@ -238,23 +238,23 @@  discard block
 block discarded – undo
238 238
 
239 239
     // Read a non gzipped tar file in for processing
240 240
     // PRIVATE ACCESS FUNCTION
241
-    function __readTar($filename='') {
241
+    function __readTar($filename = '') {
242 242
         // Set the filename to load
243
-        if(!$filename)
243
+        if (!$filename)
244 244
             $filename = $this->filename;
245 245
 
246 246
         // Read in the TAR file
247
-        $fp = fopen($filename,"rb");
248
-        $this->tar_file = fread($fp,filesize($filename));
247
+        $fp = fopen($filename, "rb");
248
+        $this->tar_file = fread($fp, filesize($filename));
249 249
         fclose($fp);
250 250
 
251
-        if($this->tar_file[0] == chr(31) && $this->tar_file[1] == chr(139) && $this->tar_file[2] == chr(8)) {
252
-            if(!function_exists("gzinflate"))
251
+        if ($this->tar_file[0] == chr(31) && $this->tar_file[1] == chr(139) && $this->tar_file[2] == chr(8)) {
252
+            if (!function_exists("gzinflate"))
253 253
                 return false;
254 254
 
255 255
             $this->isGzipped = TRUE;
256 256
 
257
-            $this->tar_file = gzinflate(substr($this->tar_file,10,-4));
257
+            $this->tar_file = gzinflate(substr($this->tar_file, 10, -4));
258 258
         }
259 259
 
260 260
         // Parse the TAR file
@@ -271,34 +271,34 @@  discard block
 block discarded – undo
271 271
         unset($this->tar_file);
272 272
 
273 273
         // Generate Records for each directory, if we have directories
274
-        if($this->numDirectories > 0) {
275
-            foreach($this->directories as $key => $information) {
274
+        if ($this->numDirectories > 0) {
275
+            foreach ($this->directories as $key => $information) {
276 276
                 unset($header);
277 277
 
278 278
                 // Generate tar header for this directory
279 279
                 // Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end
280
-                $header .= str_pad($information["name"],100,chr(0));
281
-                $header .= str_pad(decoct($information["mode"]),7,"0",STR_PAD_LEFT) . chr(0);
282
-                $header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0);
283
-                $header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0);
284
-                $header .= str_pad(decoct(0),11,"0",STR_PAD_LEFT) . chr(0);
285
-                $header .= str_pad(decoct($information["time"]),11,"0",STR_PAD_LEFT) . chr(0);
286
-                $header .= str_repeat(" ",8);
280
+                $header .= str_pad($information["name"], 100, chr(0));
281
+                $header .= str_pad(decoct($information["mode"]), 7, "0", STR_PAD_LEFT).chr(0);
282
+                $header .= str_pad(decoct($information["user_id"]), 7, "0", STR_PAD_LEFT).chr(0);
283
+                $header .= str_pad(decoct($information["group_id"]), 7, "0", STR_PAD_LEFT).chr(0);
284
+                $header .= str_pad(decoct(0), 11, "0", STR_PAD_LEFT).chr(0);
285
+                $header .= str_pad(decoct($information["time"]), 11, "0", STR_PAD_LEFT).chr(0);
286
+                $header .= str_repeat(" ", 8);
287 287
                 $header .= "5";
288
-                $header .= str_repeat(chr(0),100);
289
-                $header .= str_pad("ustar",6,chr(32));
290
-                $header .= chr(32) . chr(0);
291
-                $header .= str_pad("",32,chr(0));
292
-                $header .= str_pad("",32,chr(0));
293
-                $header .= str_repeat(chr(0),8);
294
-                $header .= str_repeat(chr(0),8);
295
-                $header .= str_repeat(chr(0),155);
296
-                $header .= str_repeat(chr(0),12);
288
+                $header .= str_repeat(chr(0), 100);
289
+                $header .= str_pad("ustar", 6, chr(32));
290
+                $header .= chr(32).chr(0);
291
+                $header .= str_pad("", 32, chr(0));
292
+                $header .= str_pad("", 32, chr(0));
293
+                $header .= str_repeat(chr(0), 8);
294
+                $header .= str_repeat(chr(0), 8);
295
+                $header .= str_repeat(chr(0), 155);
296
+                $header .= str_repeat(chr(0), 12);
297 297
 
298 298
                 // Compute header checksum
299
-                $checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT);
300
-                for($i=0; $i<6; $i++) {
301
-                    $header[(148 + $i)] = substr($checksum,$i,1);
299
+                $checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)), 6, "0", STR_PAD_LEFT);
300
+                for ($i = 0; $i < 6; $i++) {
301
+                    $header[(148 + $i)] = substr($checksum, $i, 1);
302 302
                 }
303 303
                 $header[154] = chr(0);
304 304
                 $header[155] = chr(32);
@@ -309,48 +309,48 @@  discard block
 block discarded – undo
309 309
         }
310 310
 
311 311
         // Generate Records for each file, if we have files (We should...)
312
-        if($this->numFiles > 0) {
313
-            foreach($this->files as $key => $information) {
312
+        if ($this->numFiles > 0) {
313
+            foreach ($this->files as $key => $information) {
314 314
                 unset($header);
315 315
 
316 316
                 // Generate the TAR header for this file
317 317
                 // Filename, Permissions, UID, GID, size, Time, checksum, typeflag, linkname, magic, version, user name, group name, devmajor, devminor, prefix, end
318
-                $header .= str_pad($information["name"],100,chr(0));
319
-                $header .= str_pad(decoct($information["mode"]),7,"0",STR_PAD_LEFT) . chr(0);
320
-                $header .= str_pad(decoct($information["user_id"]),7,"0",STR_PAD_LEFT) . chr(0);
321
-                $header .= str_pad(decoct($information["group_id"]),7,"0",STR_PAD_LEFT) . chr(0);
322
-                $header .= str_pad(decoct($information["size"]),11,"0",STR_PAD_LEFT) . chr(0);
323
-                $header .= str_pad(decoct($information["time"]),11,"0",STR_PAD_LEFT) . chr(0);
324
-                $header .= str_repeat(" ",8);
318
+                $header .= str_pad($information["name"], 100, chr(0));
319
+                $header .= str_pad(decoct($information["mode"]), 7, "0", STR_PAD_LEFT).chr(0);
320
+                $header .= str_pad(decoct($information["user_id"]), 7, "0", STR_PAD_LEFT).chr(0);
321
+                $header .= str_pad(decoct($information["group_id"]), 7, "0", STR_PAD_LEFT).chr(0);
322
+                $header .= str_pad(decoct($information["size"]), 11, "0", STR_PAD_LEFT).chr(0);
323
+                $header .= str_pad(decoct($information["time"]), 11, "0", STR_PAD_LEFT).chr(0);
324
+                $header .= str_repeat(" ", 8);
325 325
                 $header .= "0";
326
-                $header .= str_repeat(chr(0),100);
327
-                $header .= str_pad("ustar",6,chr(32));
328
-                $header .= chr(32) . chr(0);
329
-                $header .= str_pad($information["user_name"],32,chr(0));    // How do I get a file's user name from PHP?
330
-                $header .= str_pad($information["group_name"],32,chr(0));   // How do I get a file's group name from PHP?
331
-                $header .= str_repeat(chr(0),8);
332
-                $header .= str_repeat(chr(0),8);
333
-                $header .= str_repeat(chr(0),155);
334
-                $header .= str_repeat(chr(0),12);
326
+                $header .= str_repeat(chr(0), 100);
327
+                $header .= str_pad("ustar", 6, chr(32));
328
+                $header .= chr(32).chr(0);
329
+                $header .= str_pad($information["user_name"], 32, chr(0)); // How do I get a file's user name from PHP?
330
+                $header .= str_pad($information["group_name"], 32, chr(0)); // How do I get a file's group name from PHP?
331
+                $header .= str_repeat(chr(0), 8);
332
+                $header .= str_repeat(chr(0), 8);
333
+                $header .= str_repeat(chr(0), 155);
334
+                $header .= str_repeat(chr(0), 12);
335 335
 
336 336
                 // Compute header checksum
337
-                $checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)),6,"0",STR_PAD_LEFT);
338
-                for($i=0; $i<6; $i++) {
339
-                    $header[(148 + $i)] = substr($checksum,$i,1);
337
+                $checksum = str_pad(decoct($this->__computeUnsignedChecksum($header)), 6, "0", STR_PAD_LEFT);
338
+                for ($i = 0; $i < 6; $i++) {
339
+                    $header[(148 + $i)] = substr($checksum, $i, 1);
340 340
                 }
341 341
                 $header[154] = chr(0);
342 342
                 $header[155] = chr(32);
343 343
 
344 344
                 // Pad file contents to byte count divisible by 512
345
-                $file_contents = str_pad($information["file"],(ceil($information["size"] / 512) * 512),chr(0));
345
+                $file_contents = str_pad($information["file"], (ceil($information["size"] / 512) * 512), chr(0));
346 346
 
347 347
                 // Add new tar formatted data to tar file contents
348
-                $this->tar_file .= $header . $file_contents;
348
+                $this->tar_file .= $header.$file_contents;
349 349
             }
350 350
         }
351 351
 
352 352
         // Add 512 bytes of NULLs to designate EOF
353
-        $this->tar_file .= str_repeat(chr(0),512);
353
+        $this->tar_file .= str_repeat(chr(0), 512);
354 354
 
355 355
         return true;
356 356
     }
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
         unset($this->numDirectories);
369 369
 
370 370
         // If the tar file doesn't exist...
371
-        if(!file_exists($filename))
371
+        if (!file_exists($filename))
372 372
             return false;
373 373
 
374 374
         $this->filename = $filename;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
     // Appends a tar file to the end of the currently opened tar file
384 384
     function appendTar($filename) {
385 385
         // If the tar file doesn't exist...
386
-        if(!file_exists($filename))
386
+        if (!file_exists($filename))
387 387
             return false;
388 388
 
389 389
         $this->__readTar($filename);
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 
395 395
     // Retrieves information about a file in the current tar archive
396 396
     function getFile($filename) {
397
-        if($this->numFiles > 0) {
398
-            foreach($this->files as $key => $information) {
399
-                if($information["name"] == $filename)
397
+        if ($this->numFiles > 0) {
398
+            foreach ($this->files as $key => $information) {
399
+                if ($information["name"] == $filename)
400 400
                     return $information;
401 401
             }
402 402
         }
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 
408 408
     // Retrieves information about a directory in the current tar archive
409 409
     function getDirectory($dirname) {
410
-        if($this->numDirectories > 0) {
411
-            foreach($this->directories as $key => $information) {
412
-                if($information["name"] == $dirname)
410
+        if ($this->numDirectories > 0) {
411
+            foreach ($this->directories as $key => $information) {
412
+                if ($information["name"] == $dirname)
413 413
                     return $information;
414 414
             }
415 415
         }
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 
421 421
     // Check if this tar archive contains a specific file
422 422
     function containsFile($filename) {
423
-        if($this->numFiles > 0) {
424
-            foreach($this->files as $key => $information) {
425
-                if($information["name"] == $filename)
423
+        if ($this->numFiles > 0) {
424
+            foreach ($this->files as $key => $information) {
425
+                if ($information["name"] == $filename)
426 426
                     return true;
427 427
             }
428 428
         }
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 
434 434
     // Check if this tar archive contains a specific directory
435 435
     function containsDirectory($dirname) {
436
-        if($this->numDirectories > 0) {
437
-            foreach($this->directories as $key => $information) {
438
-                if($information["name"] == $dirname)
436
+        if ($this->numDirectories > 0) {
437
+            foreach ($this->directories as $key => $information) {
438
+                if ($information["name"] == $dirname)
439 439
                     return true;
440 440
             }
441 441
         }
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
     // Add a directory to this tar archive
448 448
     function addDirectory($dirname) {
449
-        if(!file_exists($dirname))
449
+        if (!file_exists($dirname))
450 450
             return false;
451 451
 
452 452
         // Get directory information
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
         // Add directory to processed data
456 456
         $this->numDirectories++;
457
-        $activeDir      = &$this->directories[];
457
+        $activeDir = &$this->directories[];
458 458
         $activeDir["name"]  = $dirname;
459 459
         $activeDir["mode"]  = $file_information["mode"];
460 460
         $activeDir["time"]  = $file_information["time"];
@@ -467,34 +467,34 @@  discard block
 block discarded – undo
467 467
 
468 468
 
469 469
     // Add a file to the tar archive
470
-    function addFile($filename,$from=null,$to=null) {
470
+    function addFile($filename, $from = null, $to = null) {
471 471
         // Make sure the file we are adding exists!
472
-        if(!file_exists($filename))
472
+        if (!file_exists($filename))
473 473
             return false;
474 474
 
475
-        if(filesize($filename)==0)
475
+        if (filesize($filename) == 0)
476 476
             return false;
477 477
 
478 478
         // Make sure there are no other files in the archive that have this same filename
479
-        if($this->containsFile($filename))
479
+        if ($this->containsFile($filename))
480 480
             return false;
481 481
 
482 482
         // Get file information
483 483
         $file_information = stat($filename);
484 484
 
485 485
         // Read in the file's contents
486
-        $fp = fopen($filename,"rb");
487
-        $file_contents = fread($fp,filesize($filename));
486
+        $fp = fopen($filename, "rb");
487
+        $file_contents = fread($fp, filesize($filename));
488 488
         fclose($fp);
489 489
 
490
-        if($from && $to){
491
-            $file_contents = str_replace($from,$to,$file_contents);
490
+        if ($from && $to) {
491
+            $file_contents = str_replace($from, $to, $file_contents);
492 492
             $file_information["size"] = strlen($file_contents);
493 493
         }
494 494
 
495 495
         // Add file to processed data
496 496
         $this->numFiles++;
497
-        $activeFile         = &$this->files[];
497
+        $activeFile = &$this->files[];
498 498
         $activeFile["name"]     = $filename;
499 499
         $activeFile["mode"]     = $file_information["mode"];
500 500
         $activeFile["user_id"]      = $file_information["uid"];
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         $activeFile["checksum"]     = $checksum;
505 505
         $activeFile["user_name"]    = "";
506 506
         $activeFile["group_name"]   = "";
507
-        $activeFile["file"]     = $file_contents;
507
+        $activeFile["file"] = $file_contents;
508 508
 
509 509
         return true;
510 510
     }
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 
513 513
     // Remove a file from the tar archive
514 514
     function removeFile($filename) {
515
-        if($this->numFiles > 0) {
516
-            foreach($this->files as $key => $information) {
517
-                if($information["name"] == $filename) {
515
+        if ($this->numFiles > 0) {
516
+            foreach ($this->files as $key => $information) {
517
+                if ($information["name"] == $filename) {
518 518
                     $this->numFiles--;
519 519
                     unset($this->files[$key]);
520 520
                     return true;
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 
529 529
     // Remove a directory from the tar archive
530 530
     function removeDirectory($dirname) {
531
-        if($this->numDirectories > 0) {
532
-            foreach($this->directories as $key => $information) {
533
-                if($information["name"] == $dirname) {
531
+        if ($this->numDirectories > 0) {
532
+            foreach ($this->directories as $key => $information) {
533
+                if ($information["name"] == $dirname) {
534 534
                     $this->numDirectories--;
535 535
                     unset($this->directories[$key]);
536 536
                     return true;
@@ -544,28 +544,28 @@  discard block
 block discarded – undo
544 544
 
545 545
     // Write the currently loaded tar archive to disk
546 546
     function saveTar() {
547
-        if(!$this->filename)
547
+        if (!$this->filename)
548 548
             return false;
549 549
 
550 550
         // Write tar to current file using specified gzip compression
551
-        $this->toTar($this->filename,$this->isGzipped);
551
+        $this->toTar($this->filename, $this->isGzipped);
552 552
 
553 553
         return true;
554 554
     }
555 555
 
556 556
 
557 557
     // Saves tar archive to a different file than the current file
558
-    function toTar($filename,$useGzip) {
559
-        if(!$filename)
558
+    function toTar($filename, $useGzip) {
559
+        if (!$filename)
560 560
             return false;
561 561
 
562 562
         // Encode processed files into TAR file format
563 563
         $this->__generateTar();
564 564
 
565 565
         // GZ Compress the data if we need to
566
-        if($useGzip) {
566
+        if ($useGzip) {
567 567
             // Make sure we have gzip support
568
-            if(!function_exists("gzencode"))
568
+            if (!function_exists("gzencode"))
569 569
                 return false;
570 570
 
571 571
             $file = gzencode($this->tar_file);
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
         }
575 575
 
576 576
         // Write the TAR file
577
-        $fp = fopen($filename,"wb");
578
-        fwrite($fp,$file);
577
+        $fp = fopen($filename, "wb");
578
+        fwrite($fp, $file);
579 579
         fclose($fp);
580 580
 
581 581
         return true;
Please login to merge, or discard this patch.
modules/addon/addon.admin.model.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
 	 * @param string $addon Name to get information
142 142
 	 * @param int $site_srl Site srl
143 143
 	 * @param string $gtype site or global
144
-	 * @return object Returns a information
144
+	 * @return null|stdClass Returns a information
145 145
 	 */
146 146
 	function getAddonInfoXml($addon, $site_srl = 0, $gtype = 'site')
147 147
 	{
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	function getAddonPath($addon_name)
28 28
 	{
29 29
 		$class_path = sprintf('./addons/%s/', $addon_name);
30
-		if(is_dir($class_path))
30
+		if (is_dir($class_path))
31 31
 		{
32 32
 			return $class_path;
33 33
 		}
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		$addonList = $this->getAddonList(0, 'site');
45 45
 
46 46
 		$oAutoinstallModel = getModel('autoinstall');
47
-		foreach($addonList as $key => $addon)
47
+		foreach ($addonList as $key => $addon)
48 48
 		{
49 49
 			// get easyinstall remove url
50 50
 			$packageSrl = $oAutoinstallModel->getPackageSrlByPath($addon->path);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			$addonList[$key]->need_update = $package[$packageSrl]->need_update;
56 56
 
57 57
 			// get easyinstall update url
58
-			if($addonList[$key]->need_update == 'Y')
58
+			if ($addonList[$key]->need_update == 'Y')
59 59
 			{
60 60
 				$addonList[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
61 61
 			}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		// Downloaded and installed add-on to the list of Wanted
79 79
 		$searched_list = FileHandler::readDir('./addons', '/^([a-zA-Z0-9-_]+)$/');
80 80
 		$searched_count = count($searched_list);
81
-		if(!$searched_count)
81
+		if (!$searched_count)
82 82
 		{
83 83
 			return;
84 84
 		}
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 
88 88
 		$oAddonAdminController = getAdminController('addon');
89 89
 
90
-		for($i = 0; $i < $searched_count; $i++)
90
+		for ($i = 0; $i < $searched_count; $i++)
91 91
 		{
92 92
 			// Add the name of
93 93
 			$addon_name = $searched_list[$i];
94
-			if($addon_name == "smartphone")
94
+			if ($addon_name == "smartphone")
95 95
 			{
96 96
 				continue;
97 97
 			}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			// Wanted information on the add-on
101 101
 			$info = $this->getAddonInfoXml($addon_name, $site_srl, $gtype);
102 102
 			
103
-			if(!$info) $info = new stdClass();
103
+			if (!$info) $info = new stdClass();
104 104
 
105 105
 			$info->addon = $addon_name;
106 106
 			$info->path = $path;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			$info->mactivated = FALSE;
109 109
 			$info->fixed = FALSE;
110 110
 			// Check if a permossion is granted entered in DB
111
-			if(!in_array($addon_name, array_keys($inserted_addons)))
111
+			if (!in_array($addon_name, array_keys($inserted_addons)))
112 112
 			{
113 113
 				// If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ)
114 114
 				$oAddonAdminController->doInsert($addon_name, $site_srl, $type);
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 			}
117 117
 			else
118 118
 			{
119
-				if($inserted_addons[$addon_name]->is_used == 'Y')
119
+				if ($inserted_addons[$addon_name]->is_used == 'Y')
120 120
 				{
121 121
 					$info->activated = TRUE;
122 122
 				}
123
-				if($inserted_addons[$addon_name]->is_used_m == 'Y')
123
+				if ($inserted_addons[$addon_name]->is_used_m == 'Y')
124 124
 				{
125 125
 					$info->mactivated = TRUE;
126 126
 				}
127
-				if($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y')
127
+				if ($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y')
128 128
 				{
129 129
 					$info->fixed = TRUE;
130 130
 				}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 	{
148 148
 		// Get a path of the requested module. Return if not exists.
149 149
 		$addon_path = $this->getAddonPath($addon);
150
-		if(!$addon_path)
150
+		if (!$addon_path)
151 151
 		{
152 152
 			return;
153 153
 		}
154 154
 
155 155
 		// Read the xml file for module skin information
156 156
 		$xml_file = sprintf("%sconf/info.xml", FileHandler::getRealpath($addon_path));
157
-		if(!file_exists($xml_file))
157
+		if (!file_exists($xml_file))
158 158
 		{
159 159
 			return;
160 160
 		}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
164 164
 		$xml_obj = $tmp_xml_obj->addon;
165 165
 
166
-		if(!$xml_obj)
166
+		if (!$xml_obj)
167 167
 		{
168 168
 			return;
169 169
 		}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		// DB is set to bring history
172 172
 		$db_args = new stdClass();
173 173
 		$db_args->addon = $addon;
174
-		if($gtype == 'global')
174
+		if ($gtype == 'global')
175 175
 		{
176 176
 			$output = executeQuery('addon.getAddonInfo', $db_args);
177 177
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		$extra_vals = unserialize($output->data->extra_vars);
184 184
 
185 185
 		$addon_info = new stdClass();
186
-		if($extra_vals->mid_list)
186
+		if ($extra_vals->mid_list)
187 187
 		{
188 188
 			$addon_info->mid_list = $extra_vals->mid_list;
189 189
 		}
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 			$addon_info->mid_list = array();
193 193
 		}
194 194
 
195
-		if($extra_vals->xe_run_method)
195
+		if ($extra_vals->xe_run_method)
196 196
 		{
197 197
 			$addon_info->xe_run_method = $extra_vals->xe_run_method;
198 198
 		}
199 199
 
200 200
 		// Add information
201
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
201
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
202 202
 		{
203 203
 			// addon format v0.2
204 204
 			$date_obj = new stdClass();
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 			$addon_info->license = $xml_obj->license->body;
214 214
 			$addon_info->license_link = $xml_obj->license->attrs->link;
215 215
 
216
-			if(!is_array($xml_obj->author))
216
+			if (!is_array($xml_obj->author))
217 217
 			{
218 218
 				$author_list = array();
219 219
 				$author_list[] = $xml_obj->author;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			}
225 225
 
226 226
 			$addon_info->author = array();
227
-			foreach($author_list as $author)
227
+			foreach ($author_list as $author)
228 228
 			{
229 229
 				$author_obj = new stdClass();
230 230
 				$author_obj->name = $author->name->body;
@@ -234,39 +234,39 @@  discard block
 block discarded – undo
234 234
 			}
235 235
 
236 236
 			// Expand the variable order
237
-			if($xml_obj->extra_vars)
237
+			if ($xml_obj->extra_vars)
238 238
 			{
239 239
 				$extra_var_groups = $xml_obj->extra_vars->group;
240
-				if(!$extra_var_groups)
240
+				if (!$extra_var_groups)
241 241
 				{
242 242
 					$extra_var_groups = $xml_obj->extra_vars;
243 243
 				}
244
-				if(!is_array($extra_var_groups))
244
+				if (!is_array($extra_var_groups))
245 245
 				{
246 246
 					$extra_var_groups = array($extra_var_groups);
247 247
 				}
248 248
 
249
-				foreach($extra_var_groups as $group)
249
+				foreach ($extra_var_groups as $group)
250 250
 				{
251 251
 					$extra_vars = $group->var;
252
-					if(!is_array($group->var))
252
+					if (!is_array($group->var))
253 253
 					{
254 254
 						$extra_vars = array($group->var);
255 255
 					}
256 256
 
257
-					foreach($extra_vars as $key => $val)
257
+					foreach ($extra_vars as $key => $val)
258 258
 					{
259
-						if(!$val)
259
+						if (!$val)
260 260
 						{
261 261
 							continue;
262 262
 						}
263 263
 
264 264
 						$obj = new stdClass();
265
-						if(!$val->attrs)
265
+						if (!$val->attrs)
266 266
 						{
267 267
 							$val->attrs = new stdClass();
268 268
 						}
269
-						if(!$val->attrs->type)
269
+						if (!$val->attrs->type)
270 270
 						{
271 271
 							$val->attrs->type = 'text';
272 272
 						}
@@ -276,26 +276,26 @@  discard block
 block discarded – undo
276 276
 						$obj->title = $val->title->body;
277 277
 						$obj->type = $val->attrs->type;
278 278
 						$obj->description = $val->description->body;
279
-						if($obj->name)
279
+						if ($obj->name)
280 280
 						{
281 281
 							$obj->value = $extra_vals->{$obj->name};
282 282
 						}
283
-						if(strpos($obj->value, '|@|') != FALSE)
283
+						if (strpos($obj->value, '|@|') != FALSE)
284 284
 						{
285 285
 							$obj->value = explode('|@|', $obj->value);
286 286
 						}
287
-						if($obj->type == 'mid_list' && !is_array($obj->value))
287
+						if ($obj->type == 'mid_list' && !is_array($obj->value))
288 288
 						{
289 289
 							$obj->value = array($obj->value);
290 290
 						}
291 291
 
292 292
 						// 'Select'type obtained from the option list.
293
-						if($val->options && !is_array($val->options))
293
+						if ($val->options && !is_array($val->options))
294 294
 						{
295 295
 							$val->options = array($val->options);
296 296
 						}
297 297
 
298
-						for($i = 0, $c = count($val->options); $i < $c; $i++)
298
+						for ($i = 0, $c = count($val->options); $i < $c; $i++)
299 299
 						{
300 300
 							$obj->options[$i] = new stdClass();
301 301
 							$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -328,30 +328,30 @@  discard block
 block discarded – undo
328 328
 			$addon_info->author = array();
329 329
 			$addon_info->author[] = $author_obj;
330 330
 
331
-			if($xml_obj->extra_vars)
331
+			if ($xml_obj->extra_vars)
332 332
 			{
333 333
 				// Expand the variable order
334 334
 				$extra_var_groups = $xml_obj->extra_vars->group;
335
-				if(!$extra_var_groups)
335
+				if (!$extra_var_groups)
336 336
 				{
337 337
 					$extra_var_groups = $xml_obj->extra_vars;
338 338
 				}
339
-				if(!is_array($extra_var_groups))
339
+				if (!is_array($extra_var_groups))
340 340
 				{
341 341
 					$extra_var_groups = array($extra_var_groups);
342 342
 				}
343
-				foreach($extra_var_groups as $group)
343
+				foreach ($extra_var_groups as $group)
344 344
 				{
345 345
 					$extra_vars = $group->var;
346
-					if(!is_array($group->var))
346
+					if (!is_array($group->var))
347 347
 					{
348 348
 						$extra_vars = array($group->var);
349 349
 					}
350 350
 
351 351
 					$addon_info->extra_vars = array();
352
-					foreach($extra_vars as $key => $val)
352
+					foreach ($extra_vars as $key => $val)
353 353
 					{
354
-						if(!$val)
354
+						if (!$val)
355 355
 						{
356 356
 							continue;
357 357
 						}
@@ -363,26 +363,26 @@  discard block
 block discarded – undo
363 363
 						$obj->title = $val->title->body;
364 364
 						$obj->type = $val->type->body ? $val->type->body : 'text';
365 365
 						$obj->description = $val->description->body;
366
-						if($obj->name)
366
+						if ($obj->name)
367 367
 						{
368 368
 							$obj->value = $extra_vals->{$obj->name};
369 369
 						}
370
-						if(strpos($obj->value, '|@|') != false)
370
+						if (strpos($obj->value, '|@|') != false)
371 371
 						{
372 372
 							$obj->value = explode('|@|', $obj->value);
373 373
 						}
374
-						if($obj->type == 'mid_list' && !is_array($obj->value))
374
+						if ($obj->type == 'mid_list' && !is_array($obj->value))
375 375
 						{
376 376
 							$obj->value = array($obj->value);
377 377
 						}
378 378
 						// 'Select'type obtained from the option list.
379
-						if($val->options && !is_array($val->options))
379
+						if ($val->options && !is_array($val->options))
380 380
 						{
381 381
 							$val->options = array($val->options);
382 382
 						}
383 383
 
384 384
 						$obj->options = array();
385
-						for($i = 0, $c = count($val->options); $i < $c; $i++)
385
+						for ($i = 0, $c = count($val->options); $i < $c; $i++)
386 386
 						{
387 387
 							$obj->options[$i]->title = $val->options[$i]->title->body;
388 388
 							$obj->options[$i]->value = $val->options[$i]->value->body;
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	{
407 407
 		$args = new stdClass();
408 408
 		$args->list_order = 'addon';
409
-		if($gtype == 'global')
409
+		if ($gtype == 'global')
410 410
 		{
411 411
 			$output = executeQueryArray('addon.getAddons', $args);
412 412
 		}
@@ -415,14 +415,14 @@  discard block
 block discarded – undo
415 415
 			$args->site_srl = $site_srl;
416 416
 			$output = executeQueryArray('addon.getSiteAddons', $args);
417 417
 		}
418
-		if(!$output->data)
418
+		if (!$output->data)
419 419
 		{
420 420
 			return array();
421 421
 		}
422 422
 
423 423
 		$activated_count = count($output->data);
424 424
 		$addon_list = array();
425
-		for($i = 0; $i < $activated_count; $i++)
425
+		for ($i = 0; $i < $activated_count; $i++)
426 426
 		{
427 427
 			$addon = $output->data[$i];
428 428
 			$addon_list[$addon->addon] = $addon;
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 	{
444 444
 		$args = new stdClass();
445 445
 		$args->addon = $addon;
446
-		if($gtype == 'global')
446
+		if ($gtype == 'global')
447 447
 		{
448
-			if($type == "pc")
448
+			if ($type == "pc")
449 449
 			{
450 450
 				$output = executeQuery('addon.getAddonIsActivated', $args);
451 451
 			}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		else
458 458
 		{
459 459
 			$args->site_srl = $site_srl;
460
-			if($type == "pc")
460
+			if ($type == "pc")
461 461
 			{
462 462
 				$output = executeQuery('addon.getSiteAddonIsActivated', $args);
463 463
 			}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 				$output = executeQuery('addon.getSiteMAddonIsActivated', $args);
467 467
 			}
468 468
 		}
469
-		if($output->data->count > 0)
469
+		if ($output->data->count > 0)
470 470
 		{
471 471
 			return TRUE;
472 472
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -19 removed lines patch added patch discarded remove patch
@@ -100,7 +100,9 @@  discard block
 block discarded – undo
100 100
 			// Wanted information on the add-on
101 101
 			$info = $this->getAddonInfoXml($addon_name, $site_srl, $gtype);
102 102
 			
103
-			if(!$info) $info = new stdClass();
103
+			if(!$info) {
104
+				$info = new stdClass();
105
+			}
104 106
 
105 107
 			$info->addon = $addon_name;
106 108
 			$info->path = $path;
@@ -113,8 +115,7 @@  discard block
 block discarded – undo
113 115
 				// If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ)
114 116
 				$oAddonAdminController->doInsert($addon_name, $site_srl, $type);
115 117
 				// Is activated
116
-			}
117
-			else
118
+			} else
118 119
 			{
119 120
 				if($inserted_addons[$addon_name]->is_used == 'Y')
120 121
 				{
@@ -174,8 +175,7 @@  discard block
 block discarded – undo
174 175
 		if($gtype == 'global')
175 176
 		{
176 177
 			$output = executeQuery('addon.getAddonInfo', $db_args);
177
-		}
178
-		else
178
+		} else
179 179
 		{
180 180
 			$db_args->site_srl = $site_srl;
181 181
 			$output = executeQuery('addon.getSiteAddonInfo', $db_args);
@@ -186,8 +186,7 @@  discard block
 block discarded – undo
186 186
 		if($extra_vals->mid_list)
187 187
 		{
188 188
 			$addon_info->mid_list = $extra_vals->mid_list;
189
-		}
190
-		else
189
+		} else
191 190
 		{
192 191
 			$addon_info->mid_list = array();
193 192
 		}
@@ -217,8 +216,7 @@  discard block
 block discarded – undo
217 216
 			{
218 217
 				$author_list = array();
219 218
 				$author_list[] = $xml_obj->author;
220
-			}
221
-			else
219
+			} else
222 220
 			{
223 221
 				$author_list = $xml_obj->author;
224 222
 			}
@@ -306,8 +304,7 @@  discard block
 block discarded – undo
306 304
 					}
307 305
 				}
308 306
 			}
309
-		}
310
-		else
307
+		} else
311 308
 		{
312 309
 			// addon format 0.1
313 310
 			$addon_info = new stdClass();
@@ -409,8 +406,7 @@  discard block
 block discarded – undo
409 406
 		if($gtype == 'global')
410 407
 		{
411 408
 			$output = executeQueryArray('addon.getAddons', $args);
412
-		}
413
-		else
409
+		} else
414 410
 		{
415 411
 			$args->site_srl = $site_srl;
416 412
 			$output = executeQueryArray('addon.getSiteAddons', $args);
@@ -448,20 +444,17 @@  discard block
 block discarded – undo
448 444
 			if($type == "pc")
449 445
 			{
450 446
 				$output = executeQuery('addon.getAddonIsActivated', $args);
451
-			}
452
-			else
447
+			} else
453 448
 			{
454 449
 				$output = executeQuery('addon.getMAddonIsActivated', $args);
455 450
 			}
456
-		}
457
-		else
451
+		} else
458 452
 		{
459 453
 			$args->site_srl = $site_srl;
460 454
 			if($type == "pc")
461 455
 			{
462 456
 				$output = executeQuery('addon.getSiteAddonIsActivated', $args);
463
-			}
464
-			else
457
+			} else
465 458
 			{
466 459
 				$output = executeQuery('addon.getSiteMAddonIsActivated', $args);
467 460
 			}
Please login to merge, or discard this patch.
modules/admin/admin.admin.controller.php 3 patches
Doc Comments   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	/**
15 15
 	 * initialization
16
-	 * @return void
16
+	 * @return ModuleObject|null
17 17
 	 */
18 18
 	function init()
19 19
 	{
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	/**
54 54
 	 * Regenerate all cache files
55
-	 * @return void
55
+	 * @return Object|null
56 56
 	 */
57 57
 	function procAdminRecompileCacheFile()
58 58
 	{
@@ -207,6 +207,9 @@  discard block
 block discarded – undo
207 207
 		return new Object();
208 208
 	}
209 209
 
210
+	/**
211
+	 * @param stdClass $designInfo
212
+	 */
210 213
 	function makeDefaultDesignFile($designInfo, $site_srl = 0)
211 214
 	{
212 215
 		$buff = array();
@@ -433,6 +436,8 @@  discard block
 block discarded – undo
433 436
 
434 437
 	/**
435 438
 	 * Insert favorite
439
+	 * @param string $siteSrl
440
+	 * @param string $module
436 441
 	 * @return object query result
437 442
 	 */
438 443
 	function _insertFavorite($siteSrl, $module, $type = 'module')
@@ -471,7 +476,7 @@  discard block
 block discarded – undo
471 476
 
472 477
 	/**
473 478
 	 * Remove admin icon
474
-	 * @return object|void
479
+	 * @return Object|null
475 480
 	 */
476 481
 	function procAdminRemoveIcons()
477 482
 	{
Please login to merge, or discard this patch.
Braces   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -181,8 +181,7 @@  discard block
 block discarded – undo
181 181
 		if(is_readable($siteDesignFile))
182 182
 		{
183 183
 			include($siteDesignFile);
184
-		}
185
-		else
184
+		} else
186 185
 		{
187 186
 			$designInfo = new stdClass();
188 187
 		}
@@ -198,7 +197,9 @@  discard block
 block discarded – undo
198 197
 				$moduleName = 'page';
199 198
 			}
200 199
 
201
-			if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
200
+			if(!isset($designInfo->module->{$moduleName})) {
201
+				$designInfo->module->{$moduleName} = new stdClass();
202
+			}
202 203
 			$designInfo->module->{$moduleName}->{$skinTarget} = $skinName;
203 204
 		}
204 205
 
@@ -337,8 +338,7 @@  discard block
 block discarded – undo
337 338
 		if($isAgree == 'true')
338 339
 		{
339 340
 			$_SESSION['enviroment_gather'] = 'Y';
340
-		}
341
-		else
341
+		} else
342 342
 		{
343 343
 			$_SESSION['enviroment_gather'] = 'N';
344 344
 		}
@@ -374,12 +374,10 @@  discard block
 block discarded – undo
374 374
 			if($type == 3)
375 375
 			{
376 376
 				$ext = 'png';
377
-			}
378
-			elseif($type == 2)
377
+			} elseif($type == 2)
379 378
 			{
380 379
 				$ext = 'jpg';
381
-			}
382
-			else
380
+			} else
383 381
 			{
384 382
 				$ext = 'gif';
385 383
 			}
@@ -392,8 +390,7 @@  discard block
 block discarded – undo
392 390
 		if($adminTitle)
393 391
 		{
394 392
 			$oAdminConfig->adminTitle = strip_tags($adminTitle);
395
-		}
396
-		else
393
+		} else
397 394
 		{
398 395
 			unset($oAdminConfig->adminTitle);
399 396
 		}
@@ -488,8 +485,7 @@  discard block
 block discarded – undo
488 485
 		if($file_exist)
489 486
 		{
490 487
 			@FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
491
-		}
492
-		else
488
+		} else
493 489
 		{
494 490
 			return new Object(-1, 'fail_to_delete');
495 491
 		}
@@ -533,7 +529,9 @@  discard block
 block discarded – undo
533 529
 		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
534 530
 		{
535 531
 			$returnUrl = Context::get('success_return_url');
536
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
532
+			if(!$returnUrl) {
533
+				$returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
534
+			}
537 535
 			header('location:' . $returnUrl);
538 536
 			return;
539 537
 		}
@@ -577,7 +575,9 @@  discard block
 block discarded – undo
577 575
 		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
578 576
 		{
579 577
 			$returnUrl = Context::get('success_return_url');
580
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
578
+			if(!$returnUrl) {
579
+				$returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
580
+			}
581 581
 			header('location:' . $returnUrl);
582 582
 			return;
583 583
 		}
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		// forbit access if the user is not an administrator
21 21
 		$oMemberModel = getModel('member');
22 22
 		$logged_info = $oMemberModel->getLoggedInfo();
23
-		if($logged_info->is_admin != 'Y')
23
+		if ($logged_info->is_admin != 'Y')
24 24
 		{
25 25
 			return $this->stop("msg_is_not_administrator");
26 26
 		}
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 	function procAdminMenuReset()
34 34
 	{
35 35
 		$menuSrl = Context::get('menu_srl');
36
-		if(!$menuSrl)
36
+		if (!$menuSrl)
37 37
 		{
38 38
 			return $this->stop('msg_invalid_request');
39 39
 		}
40 40
 
41 41
 		$oMenuAdminController = getAdminController('menu');
42 42
 		$output = $oMenuAdminController->deleteMenu($menuSrl);
43
-		if(!$output->toBool())
43
+		if (!$output->toBool())
44 44
 		{
45 45
 			return $output;
46 46
 		}
@@ -57,27 +57,27 @@  discard block
 block discarded – undo
57 57
 	function procAdminRecompileCacheFile()
58 58
 	{
59 59
 		// rename cache dir
60
-		$temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
60
+		$temp_cache_dir = './files/cache_'.$_SERVER['REQUEST_TIME'];
61 61
 		FileHandler::rename('./files/cache', $temp_cache_dir);
62 62
 		FileHandler::makeDir('./files/cache');
63 63
 
64 64
 		// remove module extend cache
65
-		FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php');
65
+		FileHandler::removeFile(_XE_PATH_.'files/config/module_extend.php');
66 66
 
67 67
 		// remove debug files
68
-		FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
69
-		FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
70
-		FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
68
+		FileHandler::removeFile(_XE_PATH_.'files/_debug_message.php');
69
+		FileHandler::removeFile(_XE_PATH_.'files/_debug_db_query.php');
70
+		FileHandler::removeFile(_XE_PATH_.'files/_db_slow_query.php');
71 71
 
72 72
 		$oModuleModel = getModel('module');
73 73
 		$module_list = $oModuleModel->getModuleList();
74 74
 
75 75
 		// call recompileCache for each module
76
-		foreach($module_list as $module)
76
+		foreach ($module_list as $module)
77 77
 		{
78 78
 			$oModule = NULL;
79 79
 			$oModule = getClass($module->module);
80
-			if(method_exists($oModule, 'recompileCache'))
80
+			if (method_exists($oModule, 'recompileCache'))
81 81
 			{
82 82
 				$oModule->recompileCache();
83 83
 			}
@@ -88,37 +88,37 @@  discard block
 block discarded – undo
88 88
 		$oObjectCacheHandler = CacheHandler::getInstance('object');
89 89
 		$oTemplateCacheHandler = CacheHandler::getInstance('template');
90 90
 
91
-		if($oObjectCacheHandler->isSupport())
91
+		if ($oObjectCacheHandler->isSupport())
92 92
 		{
93 93
 			$truncated[] = $oObjectCacheHandler->truncate();
94 94
 		}
95 95
 
96
-		if($oTemplateCacheHandler->isSupport())
96
+		if ($oTemplateCacheHandler->isSupport())
97 97
 		{
98 98
 			$truncated[] = $oTemplateCacheHandler->truncate();
99 99
 		}
100 100
 
101
-		if(count($truncated) && in_array(FALSE, $truncated))
101
+		if (count($truncated) && in_array(FALSE, $truncated))
102 102
 		{
103 103
 			return new Object(-1, 'msg_self_restart_cache_engine');
104 104
 		}
105 105
 
106 106
 		// remove cache dir
107 107
 		$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
108
-		if($tmp_cache_list)
108
+		if ($tmp_cache_list)
109 109
 		{
110
-			foreach($tmp_cache_list as $tmp_dir)
110
+			foreach ($tmp_cache_list as $tmp_dir)
111 111
 			{
112
-				if($tmp_dir)
112
+				if ($tmp_dir)
113 113
 				{
114
-					FileHandler::removeDir('./files/' . $tmp_dir);
114
+					FileHandler::removeDir('./files/'.$tmp_dir);
115 115
 				}
116 116
 			}
117 117
 		}
118 118
 
119 119
 		// remove duplicate indexes (only for CUBRID)
120 120
 		$db_type = Context::getDBType();
121
-		if($db_type == 'cubrid')
121
+		if ($db_type == 'cubrid')
122 122
 		{
123 123
 			$db = DB::getInstance();
124 124
 			$db->deleteDuplicateIndexes();
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 		$oMemberController = getController('member');
141 141
 		$oMemberController->procMemberLogout();
142 142
 
143
-		header('Location: ' . getNotEncodedUrl('', 'module', 'admin'));
143
+		header('Location: '.getNotEncodedUrl('', 'module', 'admin'));
144 144
 	}
145 145
 
146 146
 	public function procAdminInsertDefaultDesignInfo()
147 147
 	{
148 148
 		$vars = Context::getRequestVars();
149
-		if(!$vars->site_srl)
149
+		if (!$vars->site_srl)
150 150
 		{
151 151
 			$vars->site_srl = 0;
152 152
 		}
@@ -158,27 +158,27 @@  discard block
 block discarded – undo
158 158
 
159 159
 	public function updateDefaultDesignInfo($vars)
160 160
 	{
161
-		$siteDesignPath = _XE_PATH_ . 'files/site_design/';
161
+		$siteDesignPath = _XE_PATH_.'files/site_design/';
162 162
 
163 163
 		$vars->module_skin = json_decode($vars->module_skin);
164 164
 
165
-		if(!is_dir($siteDesignPath))
165
+		if (!is_dir($siteDesignPath))
166 166
 		{
167 167
 			FileHandler::makeDir($siteDesignPath);
168 168
 		}
169 169
 
170
-		$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $vars->site_srl . '.php';
170
+		$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php';
171 171
 
172 172
 		$layoutTarget = 'layout_srl';
173 173
 		$skinTarget = 'skin';
174 174
 
175
-		if($vars->target_type == 'M')
175
+		if ($vars->target_type == 'M')
176 176
 		{
177 177
 			$layoutTarget = 'mlayout_srl';
178 178
 			$skinTarget = 'mskin';
179 179
 		}
180 180
 
181
-		if(is_readable($siteDesignFile))
181
+		if (is_readable($siteDesignFile))
182 182
 		{
183 183
 			include($siteDesignFile);
184 184
 		}
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 
192 192
 		$designInfo->{$layoutTarget} = $layoutSrl;
193 193
 
194
-		foreach($vars->module_skin as $moduleName => $skinName)
194
+		foreach ($vars->module_skin as $moduleName => $skinName)
195 195
 		{
196
-			if($moduleName == 'ARTICLE')
196
+			if ($moduleName == 'ARTICLE')
197 197
 			{
198 198
 				$moduleName = 'page';
199 199
 			}
200 200
 
201
-			if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
201
+			if (!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
202 202
 			$designInfo->module->{$moduleName}->{$skinTarget} = $skinName;
203 203
 		}
204 204
 
@@ -213,28 +213,28 @@  discard block
 block discarded – undo
213 213
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
214 214
 		$buff[] = '$designInfo = new stdClass;';
215 215
 
216
-		if($designInfo->layout_srl)
216
+		if ($designInfo->layout_srl)
217 217
 		{
218 218
 			$buff[] = sprintf('$designInfo->layout_srl = %s; ', $designInfo->layout_srl);
219 219
 		}
220 220
 
221
-		if($designInfo->mlayout_srl)
221
+		if ($designInfo->mlayout_srl)
222 222
 		{
223 223
 			$buff[] = sprintf('$designInfo->mlayout_srl = %s;', $designInfo->mlayout_srl);
224 224
 		}
225 225
 
226 226
 		$buff[] = '$designInfo->module = new stdClass;';
227 227
 
228
-		foreach($designInfo->module as $moduleName => $skinInfo)
228
+		foreach ($designInfo->module as $moduleName => $skinInfo)
229 229
 		{
230 230
 			$buff[] = sprintf('$designInfo->module->%s = new stdClass;', $moduleName);
231
-			foreach($skinInfo as $target => $skinName)
231
+			foreach ($skinInfo as $target => $skinName)
232 232
 			{
233 233
 				$buff[] = sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName);
234 234
 			}
235 235
 		}
236 236
 
237
-		$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $site_srl . '.php';
237
+		$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$site_srl.'.php';
238 238
 		FileHandler::writeFile($siteDesignFile, implode(PHP_EOL, $buff));
239 239
 	}
240 240
 
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 		// check favorite exists
251 251
 		$oModel = getAdminModel('admin');
252 252
 		$output = $oModel->isExistsFavorite($siteSrl, $moduleName);
253
-		if(!$output->toBool())
253
+		if (!$output->toBool())
254 254
 		{
255 255
 			return $output;
256 256
 		}
257 257
 
258 258
 		// if exists, delete favorite
259
-		if($output->get('result'))
259
+		if ($output->get('result'))
260 260
 		{
261 261
 			$favoriteSrl = $output->get('favoriteSrl');
262 262
 			$output = $this->_deleteFavorite($favoriteSrl);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			$result = 'on';
270 270
 		}
271 271
 
272
-		if(!$output->toBool())
272
+		if (!$output->toBool())
273 273
 		{
274 274
 			return $output;
275 275
 		}
@@ -287,31 +287,31 @@  discard block
 block discarded – undo
287 287
 	{
288 288
 		$oModel = getAdminModel('admin');
289 289
 		$output = $oModel->getFavoriteList();
290
-		if(!$output->toBool())
290
+		if (!$output->toBool())
291 291
 		{
292 292
 			return $output;
293 293
 		}
294 294
 
295 295
 		$favoriteList = $output->get('favoriteList');
296
-		if(!$favoriteList)
296
+		if (!$favoriteList)
297 297
 		{
298 298
 			return new Object();
299 299
 		}
300 300
 
301 301
 		$deleteTargets = array();
302
-		foreach($favoriteList as $favorite)
302
+		foreach ($favoriteList as $favorite)
303 303
 		{
304
-			if($favorite->type == 'module')
304
+			if ($favorite->type == 'module')
305 305
 			{
306
-				$modulePath = _XE_PATH_ . 'modules/' . $favorite->module;
307
-				if(!is_dir($modulePath))
306
+				$modulePath = _XE_PATH_.'modules/'.$favorite->module;
307
+				if (!is_dir($modulePath))
308 308
 				{
309 309
 					$deleteTargets[] = $favorite->admin_favorite_srl;
310 310
 				}
311 311
 			}
312 312
 		}
313 313
 
314
-		if(!count($deleteTargets))
314
+		if (!count($deleteTargets))
315 315
 		{
316 316
 			return new Object();
317 317
 		}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		$args = new stdClass();
320 320
 		$args->admin_favorite_srls = $deleteTargets;
321 321
 		$output = executeQuery('admin.deleteFavorites', $args);
322
-		if(!$output->toBool())
322
+		if (!$output->toBool())
323 323
 		{
324 324
 			return $output;
325 325
 		}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	function procAdminEnviromentGatheringAgreement()
335 335
 	{
336 336
 		$isAgree = Context::get('is_agree');
337
-		if($isAgree == 'true')
337
+		if ($isAgree == 'true')
338 338
 		{
339 339
 			$_SESSION['enviroment_gather'] = 'Y';
340 340
 		}
@@ -359,23 +359,23 @@  discard block
 block discarded – undo
359 359
 		$oModuleModel = getModel('module');
360 360
 		$oAdminConfig = $oModuleModel->getModuleConfig('admin');
361 361
 
362
-		if(!is_object($oAdminConfig))
362
+		if (!is_object($oAdminConfig))
363 363
 		{
364 364
 			$oAdminConfig = new stdClass();
365 365
 		}
366 366
 
367
-		if($file['tmp_name'])
367
+		if ($file['tmp_name'])
368 368
 		{
369 369
 			$target_path = 'files/attach/images/admin/';
370 370
 			FileHandler::makeDir($target_path);
371 371
 
372 372
 			// Get file information
373 373
 			list($width, $height, $type, $attrs) = @getimagesize($file['tmp_name']);
374
-			if($type == 3)
374
+			if ($type == 3)
375 375
 			{
376 376
 				$ext = 'png';
377 377
 			}
378
-			elseif($type == 2)
378
+			elseif ($type == 2)
379 379
 			{
380 380
 				$ext = 'jpg';
381 381
 			}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 			$oAdminConfig->adminLogo = $target_filename;
391 391
 		}
392
-		if($adminTitle)
392
+		if ($adminTitle)
393 393
 		{
394 394
 			$oAdminConfig->adminTitle = strip_tags($adminTitle);
395 395
 		}
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 			unset($oAdminConfig->adminTitle);
399 399
 		}
400 400
 
401
-		if($oAdminConfig)
401
+		if ($oAdminConfig)
402 402
 		{
403 403
 			$oModuleController = getController('module');
404 404
 			$oModuleController->insertModuleConfig('admin', $oAdminConfig);
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		$oModuleModel = getModel('module');
420 420
 		$oAdminConfig = $oModuleModel->getModuleConfig('admin');
421 421
 
422
-		FileHandler::removeFile(_XE_PATH_ . $oAdminConfig->adminLogo);
422
+		FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo);
423 423
 		unset($oAdminConfig->adminLogo);
424 424
 
425 425
 		$oModuleController = getController('module');
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
 
479 479
 		$site_info = Context::get('site_module_info');
480 480
 		$virtual_site = '';
481
-		if($site_info->site_srl) 
481
+		if ($site_info->site_srl) 
482 482
 		{
483
-			$virtual_site = $site_info->site_srl . '/';
483
+			$virtual_site = $site_info->site_srl.'/';
484 484
 		}
485 485
 
486 486
 		$iconname = Context::get('iconname');
487
-		$file_exist = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
488
-		if($file_exist)
487
+		$file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
488
+		if ($file_exist)
489 489
 		{
490
-			@FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
490
+			@FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
491 491
 		}
492 492
 		else
493 493
 		{
@@ -508,33 +508,33 @@  discard block
 block discarded – undo
508 508
 		$db_info->sitelock_message = $vars->sitelock_message;
509 509
 
510 510
 		$whitelist = $vars->sitelock_whitelist;
511
-		$whitelist = preg_replace("/[\r|\n|\r\n]+/",",",$whitelist);
512
-		$whitelist = preg_replace("/\s+/","",$whitelist);
513
-		if(preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
511
+		$whitelist = preg_replace("/[\r|\n|\r\n]+/", ",", $whitelist);
512
+		$whitelist = preg_replace("/\s+/", "", $whitelist);
513
+		if (preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
514 514
 		{
515 515
 			$whitelist = '';
516 516
 		}
517
-		$whitelist .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
518
-		$whitelist = explode(',',trim($whitelist, ','));
517
+		$whitelist .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];
518
+		$whitelist = explode(',', trim($whitelist, ','));
519 519
 		$whitelist = array_unique($whitelist);
520 520
 
521
-		if(!IpFilter::validate($whitelist)) {
521
+		if (!IpFilter::validate($whitelist)) {
522 522
 			return new Object(-1, 'msg_invalid_ip');
523 523
 		}
524 524
 
525 525
 		$db_info->sitelock_whitelist = $whitelist;
526 526
 
527 527
 		$oInstallController = getController('install');
528
-		if(!$oInstallController->makeConfigFile())
528
+		if (!$oInstallController->makeConfigFile())
529 529
 		{
530 530
 			return new Object(-1, 'msg_invalid_request');
531 531
 		}
532 532
 
533
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
533
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
534 534
 		{
535 535
 			$returnUrl = Context::get('success_return_url');
536
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
537
-			header('location:' . $returnUrl);
536
+			if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
537
+			header('location:'.$returnUrl);
538 538
 			return;
539 539
 		}
540 540
 	}
@@ -565,20 +565,20 @@  discard block
 block discarded – undo
565 565
 		$db_info->embed_white_iframe = $white_iframe;
566 566
 
567 567
 		$oInstallController = getController('install');
568
-		if(!$oInstallController->makeConfigFile())
568
+		if (!$oInstallController->makeConfigFile())
569 569
 		{
570 570
 			return new Object(-1, 'msg_invalid_request');
571 571
 		}
572 572
 
573
-		require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
573
+		require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');
574 574
 		$oEmbedFilter = EmbedFilter::getInstance();
575 575
 		$oEmbedFilter->_makeWhiteDomainList($whitelist);
576 576
 
577
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
577
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
578 578
 		{
579 579
 			$returnUrl = Context::get('success_return_url');
580
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
581
-			header('location:' . $returnUrl);
580
+			if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
581
+			header('location:'.$returnUrl);
582 582
 			return;
583 583
 		}
584 584
 	}
Please login to merge, or discard this patch.
modules/admin/admin.admin.model.php 4 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 	/**
277 277
 	 * Add file list to Object after sftp connect
278
-	 * @return void|Object
278
+	 * @return Object|null
279 279
 	 */
280 280
 	function getSFTPList()
281 281
 	{
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
 	/**
318 318
 	 * Add file list to Object after ftp connect
319
-	 * @return void|Object
319
+	 * @return Object|null
320 320
 	 */
321 321
 	function getAdminFTPList()
322 322
 	{
@@ -867,6 +867,7 @@  discard block
 block discarded – undo
867 867
 	 * Returns a list of all sites that contain modules
868 868
 	 * For each site domain and site_srl are retrieved
869 869
 	 *
870
+	 * @param string $domain
870 871
 	 * @return array
871 872
 	 */
872 873
 	function getAllSitesThatHaveModules($domain = NULL)
@@ -945,6 +946,11 @@  discard block
 block discarded – undo
945 946
 		return $this->iconUrlCheck('mobicon.png', 'mobiconSample.png', $default);
946 947
 	}
947 948
 
949
+	/**
950
+	 * @param string $iconname
951
+	 * @param string $default_icon_name
952
+	 * @param boolean $default
953
+	 */
948 954
 	function iconUrlCheck($iconname, $default_icon_name, $default)
949 955
 	{
950 956
 		$site_info = Context::get('site_module_info');
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -956,10 +956,10 @@
 block discarded – undo
956 956
 
957 957
 		$file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
958 958
 		if(!$file_exsit && $default === true)
959
-        {
960
-            $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
961
-        }
962
-        elseif($file_exsit)
959
+		{
960
+			$icon_url = './modules/admin/tpl/img/' . $default_icon_name;
961
+		}
962
+		elseif($file_exsit)
963 963
 		{
964 964
 			$default_url = Context::getDefaultUrl();
965 965
 			$icon_url = $default_url . 'files/attach/xeicon/' . $virtual_site . $iconname;
Please login to merge, or discard this patch.
Braces   +23 added lines, -21 removed lines patch added patch discarded remove patch
@@ -303,8 +303,7 @@  discard block
 block discarded – undo
303 303
 			if(is_dir($curpwd . $file))
304 304
 			{
305 305
 				$file .= "/";
306
-			}
307
-			else
306
+			} else
308 307
 			{
309 308
 				continue;
310 309
 			}
@@ -359,8 +358,7 @@  discard block
 block discarded – undo
359 358
 			{
360 359
 				$_list = $oFtp->ftp_rawlist($this->pwd);
361 360
 				$oFtp->ftp_quit();
362
-			}
363
-			else
361
+			} else
364 362
 			{
365 363
 				return new Object(-1, 'msg_ftp_invalid_auth_info');
366 364
 			}
@@ -380,8 +378,7 @@  discard block
 block discarded – undo
380 378
 					$list[] = substr(strrchr($v, ' '), 1) . '/';
381 379
 				}
382 380
 			}
383
-		}
384
-		else
381
+		} else
385 382
 		{
386 383
 			return new Object(-1, 'msg_ftp_no_directory');
387 384
 		}
@@ -434,11 +431,13 @@  discard block
 block discarded – undo
434 431
 		$info['module'] = '';
435 432
 		$oModuleModel = getModel('module');
436 433
 		$module_list = $oModuleModel->getModuleList();
437
-		if($module_list) foreach($module_list as $module)
434
+		if($module_list) {
435
+			foreach($module_list as $module)
438 436
 		{
439 437
 			if(in_array($module->module, $skip['module']))
440 438
 			{
441 439
 				continue;
440
+		}
442 441
 			}
443 442
 			$info['module'] .= '|' . $module->module;
444 443
 		}
@@ -447,11 +446,13 @@  discard block
 block discarded – undo
447 446
 		$info['addon'] = '';
448 447
 		$oAddonAdminModel = getAdminModel('addon');
449 448
 		$addon_list = $oAddonAdminModel->getAddonList();
450
-		if($addon_list) foreach($addon_list as $addon)
449
+		if($addon_list) {
450
+			foreach($addon_list as $addon)
451 451
 		{
452 452
 			if(in_array($addon->addon, $skip['addon']))
453 453
 			{
454 454
 				continue;
455
+		}
455 456
 			}
456 457
 			$info['addon'] .= '|' . $addon->addon;
457 458
 		}
@@ -460,11 +461,13 @@  discard block
 block discarded – undo
460 461
 		$info['layout'] = "";
461 462
 		$oLayoutModel = getModel('layout');
462 463
 		$layout_list = $oLayoutModel->getDownloadedLayoutList();
463
-		if($layout_list) foreach($layout_list as $layout)
464
+		if($layout_list) {
465
+			foreach($layout_list as $layout)
464 466
 		{
465 467
 			if(in_array($layout->layout, $skip['layout']))
466 468
 			{
467 469
 				continue;
470
+		}
468 471
 			}
469 472
 			$info['layout'] .= '|' . $layout->layout;
470 473
 		}
@@ -473,11 +476,13 @@  discard block
 block discarded – undo
473 476
 		$info['widget'] = "";
474 477
 		$oWidgetModel = getModel('widget');
475 478
 		$widget_list = $oWidgetModel->getDownloadedWidgetList();
476
-		if($widget_list) foreach($widget_list as $widget)
479
+		if($widget_list) {
480
+			foreach($widget_list as $widget)
477 481
 		{
478 482
 			if(in_array($widget->widget, $skip['widget']))
479 483
 			{
480 484
 				continue;
485
+		}
481 486
 			}
482 487
 			$info['widget'] .= '|' . $widget->widget;
483 488
 		}
@@ -486,11 +491,13 @@  discard block
 block discarded – undo
486 491
 		$info['widgetstyle'] = "";
487 492
 		$oWidgetModel = getModel('widget');
488 493
 		$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
489
-		if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle)
494
+		if($widgetstyle_list) {
495
+			foreach($widgetstyle_list as $widgetstyle)
490 496
 		{
491 497
 			if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
492 498
 			{
493 499
 				continue;
500
+		}
494 501
 			}
495 502
 			$info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle;
496 503
 		}
@@ -575,8 +582,7 @@  discard block
 block discarded – undo
575 582
 		{
576 583
 			$publisher_list = array();
577 584
 			$publisher_list[] = $xml_obj->publisher;
578
-		}
579
-		else
585
+		} else
580 586
 		{
581 587
 			$publisher_list = $xml_obj->publisher;
582 588
 		}
@@ -649,8 +655,7 @@  discard block
 block discarded – undo
649 655
 		if(is_array($skin_infos->skininfo))
650 656
 		{
651 657
 			$skin_list = $skin_infos->skininfo;
652
-		}
653
-		else
658
+		} else
654 659
 		{
655 660
 			$skin_list = array($skin_infos->skininfo);
656 661
 		}
@@ -773,8 +778,7 @@  discard block
 block discarded – undo
773 778
 			}
774 779
 			$this->gnbLangBuffer .= ' ?>';
775 780
 			FileHandler::writeFile($cacheFile, $this->gnbLangBuffer);
776
-		}
777
-		else
781
+		} else
778 782
 		{
779 783
 			include $cacheFile;
780 784
 		}
@@ -840,8 +844,7 @@  discard block
 block discarded – undo
840 844
 		{
841 845
 			$returnObject->add('result', TRUE);
842 846
 			$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl);
843
-		}
844
-		else
847
+		} else
845 848
 		{
846 849
 			$returnObject->add('result', FALSE);
847 850
 		}
@@ -958,8 +961,7 @@  discard block
 block discarded – undo
958 961
 		if(!$file_exsit && $default === true)
959 962
         {
960 963
             $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
961
-        }
962
-        elseif($file_exsit)
964
+        } elseif($file_exsit)
963 965
 		{
964 966
 			$default_url = Context::getDefaultUrl();
965 967
 			$icon_url = $default_url . 'files/attach/xeicon/' . $virtual_site . $iconname;
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$ftp_info = Context::getRequestVars();
32 32
 
33
-		if(!$ftp_info->ftp_host)
33
+		if (!$ftp_info->ftp_host)
34 34
 		{
35 35
 			$ftp_info->ftp_host = "127.0.0.1";
36 36
 		}
37 37
 
38
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
38
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
39 39
 		{
40 40
 			$ftp_info->ftp_port = '22';
41 41
 		}
42 42
 
43 43
 		$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
44
-		if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
44
+		if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
45 45
 		{
46 46
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
47 47
 		}
@@ -58,29 +58,29 @@  discard block
 block discarded – undo
58 58
 		$path_candidate = array();
59 59
 
60 60
 		$temp = '';
61
-		foreach($path_info as $path)
61
+		foreach ($path_info as $path)
62 62
 		{
63
-			$temp = '/' . $path . $temp;
63
+			$temp = '/'.$path.$temp;
64 64
 			$path_candidate[] = $temp;
65 65
 		}
66 66
 
67 67
 		// try
68
-		foreach($path_candidate as $path)
68
+		foreach ($path_candidate as $path)
69 69
 		{
70 70
 			// upload check file
71
-			if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html'))
71
+			if (!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path.'ftp_check.html'))
72 72
 			{
73 73
 				continue;
74 74
 			}
75 75
 
76 76
 			// get check file
77
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
77
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
78 78
 
79 79
 			// delete temp check file
80
-			@ssh2_sftp_unlink($sftp, $path . 'ftp_check.html');
80
+			@ssh2_sftp_unlink($sftp, $path.'ftp_check.html');
81 81
 
82 82
 			// found
83
-			if($result == $pin)
83
+			if ($result == $pin)
84 84
 			{
85 85
 				$found_path = $path;
86 86
 				break;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
91 91
 
92
-		if($found_path)
92
+		if ($found_path)
93 93
 		{
94 94
 			$this->add('found_path', $found_path);
95 95
 		}
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 	{
100 100
 		$ftp_info = Context::getRequestVars();
101 101
 
102
-		if(!$ftp_info->ftp_host)
102
+		if (!$ftp_info->ftp_host)
103 103
 		{
104 104
 			$ftp_info->ftp_host = "127.0.0.1";
105 105
 		}
106 106
 
107
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
107
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
108 108
 		{
109 109
 			$ftp_info->ftp_port = '22';
110 110
 		}
111 111
 
112 112
 		$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
113
-		if(!$connection)
113
+		if (!$connection)
114 114
 		{
115 115
 			return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_host));
116 116
 		}
117 117
 
118 118
 		$login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password);
119
-		if(!$login_result)
119
+		if (!$login_result)
120 120
 		{
121 121
 			ftp_close($connection);
122 122
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
@@ -133,29 +133,29 @@  discard block
 block discarded – undo
133 133
 		$path_candidate = array();
134 134
 
135 135
 		$temp = '';
136
-		foreach($path_info as $path)
136
+		foreach ($path_info as $path)
137 137
 		{
138
-			$temp = '/' . $path . $temp;
138
+			$temp = '/'.$path.$temp;
139 139
 			$path_candidate[] = $temp;
140 140
 		}
141 141
 
142 142
 		// try
143
-		foreach($path_candidate as $path)
143
+		foreach ($path_candidate as $path)
144 144
 		{
145 145
 			// upload check file
146
-			if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY))
146
+			if (!ftp_put($connection, $path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY))
147 147
 			{
148 148
 				continue;
149 149
 			}
150 150
 
151 151
 			// get check file
152
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
152
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
153 153
 
154 154
 			// delete temp check file
155
-			ftp_delete($connection, $path . 'ftp_check.html');
155
+			ftp_delete($connection, $path.'ftp_check.html');
156 156
 
157 157
 			// found
158
-			if($result == $pin)
158
+			if ($result == $pin)
159 159
 			{
160 160
 				$found_path = $path;
161 161
 				break;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
166 166
 
167
-		if($found_path)
167
+		if ($found_path)
168 168
 		{
169 169
 			$this->add('found_path', $found_path);
170 170
 		}
@@ -175,39 +175,39 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	function getAdminFTPPath()
177 177
 	{
178
-		Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
178
+		Context::loadLang(_XE_PATH_.'modules/autoinstall/lang');
179 179
 		@set_time_limit(5);
180
-		require_once(_XE_PATH_ . 'libs/ftp.class.php');
180
+		require_once(_XE_PATH_.'libs/ftp.class.php');
181 181
 
182 182
 		$ftp_info = Context::getRequestVars();
183 183
 
184
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
184
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password)
185 185
 		{
186 186
 			return new Object(1, 'msg_ftp_invalid_auth_info');
187 187
 		}
188 188
 
189
-		if(!$ftp_info->ftp_host)
189
+		if (!$ftp_info->ftp_host)
190 190
 		{
191 191
 			$ftp_info->ftp_host = '127.0.0.1';
192 192
 		}
193 193
 
194
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
194
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
195 195
 		{
196 196
 			$ftp_info->ftp_port = '21';
197 197
 		}
198 198
 
199
-		if($ftp_info->sftp == 'Y')
199
+		if ($ftp_info->sftp == 'Y')
200 200
 		{
201
-			if(!function_exists('ssh2_sftp'))
201
+			if (!function_exists('ssh2_sftp'))
202 202
 			{
203 203
 				return new Object(-1, 'disable_sftp_support');
204 204
 			}
205 205
 			return $this->getSFTPPath();
206 206
 		}
207 207
 
208
-		if($ftp_info->ftp_pasv == 'N')
208
+		if ($ftp_info->ftp_pasv == 'N')
209 209
 		{
210
-			if(function_exists('ftp_connect'))
210
+			if (function_exists('ftp_connect'))
211 211
 			{
212 212
 				return $this->getFTPPath();
213 213
 			}
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 
217 217
 		$oFTP = new ftp();
218
-		if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
218
+		if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
219 219
 		{
220 220
 			return new Object(1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
221 221
 		}
222 222
 
223
-		if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
223
+		if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
224 224
 		{
225 225
 			return new Object(1, 'msg_ftp_invalid_auth_info');
226 226
 		}
@@ -236,29 +236,29 @@  discard block
 block discarded – undo
236 236
 		$path_candidate = array();
237 237
 
238 238
 		$temp = '';
239
-		foreach($path_info as $path)
239
+		foreach ($path_info as $path)
240 240
 		{
241
-			$temp = '/' . $path . $temp;
241
+			$temp = '/'.$path.$temp;
242 242
 			$path_candidate[] = $temp;
243 243
 		}
244 244
 
245 245
 		// try
246
-		foreach($path_candidate as $path)
246
+		foreach ($path_candidate as $path)
247 247
 		{
248 248
 			// upload check file
249
-			if(!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check')))
249
+			if (!$oFTP->ftp_put($path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check')))
250 250
 			{
251 251
 				continue;
252 252
 			}
253 253
 
254 254
 			// get check file
255
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
255
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
256 256
 
257 257
 			// delete temp check file
258
-			$oFTP->ftp_delete($path . 'ftp_check.html');
258
+			$oFTP->ftp_delete($path.'ftp_check.html');
259 259
 
260 260
 			// found
261
-			if($result == $pin)
261
+			if ($result == $pin)
262 262
 			{
263 263
 				$found_path = $path;
264 264
 				break;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
269 269
 
270
-		if($found_path)
270
+		if ($found_path)
271 271
 		{
272 272
 			$this->add('found_path', $found_path);
273 273
 		}
@@ -280,27 +280,27 @@  discard block
 block discarded – undo
280 280
 	function getSFTPList()
281 281
 	{
282 282
 		$ftp_info = Context::getRequestVars();
283
-		if(!$ftp_info->ftp_host)
283
+		if (!$ftp_info->ftp_host)
284 284
 		{
285 285
 			$ftp_info->ftp_host = "127.0.0.1";
286 286
 		}
287 287
 		$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
288
-		if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
288
+		if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
289 289
 		{
290 290
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
291 291
 		}
292 292
 
293 293
 		$sftp = ssh2_sftp($connection);
294
-		$curpwd = "ssh2.sftp://$sftp" . $this->pwd;
294
+		$curpwd = "ssh2.sftp://$sftp".$this->pwd;
295 295
 		$dh = @opendir($curpwd);
296
-		if(!$dh)
296
+		if (!$dh)
297 297
 		{
298 298
 			return new Object(-1, 'msg_ftp_invalid_path');
299 299
 		}
300 300
 		$list = array();
301
-		while(($file = readdir($dh)) !== FALSE)
301
+		while (($file = readdir($dh)) !== FALSE)
302 302
 		{
303
-			if(is_dir($curpwd . $file))
303
+			if (is_dir($curpwd.$file))
304 304
 			{
305 305
 				$file .= "/";
306 306
 			}
@@ -320,32 +320,32 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	function getAdminFTPList()
322 322
 	{
323
-		Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
323
+		Context::loadLang(_XE_PATH_.'modules/autoinstall/lang');
324 324
 		@set_time_limit(5);
325 325
 
326
-		require_once(_XE_PATH_ . 'libs/ftp.class.php');
326
+		require_once(_XE_PATH_.'libs/ftp.class.php');
327 327
 
328 328
 		$ftp_info = Context::getRequestVars();
329
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
329
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password)
330 330
 		{
331 331
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
332 332
 		}
333 333
 
334 334
 		$this->pwd = $ftp_info->ftp_root_path;
335 335
 
336
-		if(!$ftp_info->ftp_host)
336
+		if (!$ftp_info->ftp_host)
337 337
 		{
338 338
 			$ftp_info->ftp_host = "127.0.0.1";
339 339
 		}
340 340
 
341
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
341
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
342 342
 		{
343 343
 			$ftp_info->ftp_port = "21";
344 344
 		}
345 345
 
346
-		if($ftp_info->sftp == 'Y')
346
+		if ($ftp_info->sftp == 'Y')
347 347
 		{
348
-			if(!function_exists('ssh2_sftp'))
348
+			if (!function_exists('ssh2_sftp'))
349 349
 			{
350 350
 				return new Object(-1, 'disable_sftp_support');
351 351
 			}
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 		}
354 354
 
355 355
 		$oFtp = new ftp();
356
-		if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
356
+		if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
357 357
 		{
358
-			if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
358
+			if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
359 359
 			{
360 360
 				$_list = $oFtp->ftp_rawlist($this->pwd);
361 361
 				$oFtp->ftp_quit();
@@ -367,17 +367,17 @@  discard block
 block discarded – undo
367 367
 		}
368 368
 		$list = array();
369 369
 
370
-		if($_list)
370
+		if ($_list)
371 371
 		{
372
-			foreach($_list as $k => $v)
372
+			foreach ($_list as $k => $v)
373 373
 			{
374 374
 				$src = new stdClass();
375 375
 				$src->data = $v;
376 376
 				$res = Context::convertEncoding($src);
377 377
 				$v = $res->data;
378
-				if(strpos($v, 'd') === 0 || strpos($v, '<DIR>'))
378
+				if (strpos($v, 'd') === 0 || strpos($v, '<DIR>'))
379 379
 				{
380
-					$list[] = substr(strrchr($v, ' '), 1) . '/';
380
+					$list[] = substr(strrchr($v, ' '), 1).'/';
381 381
 				}
382 382
 			}
383 383
 		}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			, 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget')
401 401
 			, 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image')
402 402
 			, 'layout' => array('default')
403
-			, 'widget' => array('content', 'language_select', 'login_info','mcontent')
403
+			, 'widget' => array('content', 'language_select', 'login_info', 'mcontent')
404 404
 			, 'widgetstyle' => array(),
405 405
 		);
406 406
 		$info = array();
@@ -420,86 +420,86 @@  discard block
 block discarded – undo
420 420
 		$info['use_ssl'] = $db_info->use_ssl;
421 421
 		
422 422
 		$info['phpext'] = '';
423
-		foreach(get_loaded_extensions() as $ext)
423
+		foreach (get_loaded_extensions() as $ext)
424 424
 		{
425 425
 			$ext = strtolower($ext);
426
-			if(in_array($ext, $skip['ext']))
426
+			if (in_array($ext, $skip['ext']))
427 427
 			{
428 428
 				continue;
429 429
 			}
430
-			$info['phpext'] .= '|' . $ext;
430
+			$info['phpext'] .= '|'.$ext;
431 431
 		}
432 432
 		$info['phpext'] = substr($info['phpext'], 1);
433 433
 
434 434
 		$info['module'] = '';
435 435
 		$oModuleModel = getModel('module');
436 436
 		$module_list = $oModuleModel->getModuleList();
437
-		if($module_list) foreach($module_list as $module)
437
+		if ($module_list) foreach ($module_list as $module)
438 438
 		{
439
-			if(in_array($module->module, $skip['module']))
439
+			if (in_array($module->module, $skip['module']))
440 440
 			{
441 441
 				continue;
442 442
 			}
443
-			$info['module'] .= '|' . $module->module;
443
+			$info['module'] .= '|'.$module->module;
444 444
 		}
445 445
 		$info['module'] = substr($info['module'], 1);
446 446
 
447 447
 		$info['addon'] = '';
448 448
 		$oAddonAdminModel = getAdminModel('addon');
449 449
 		$addon_list = $oAddonAdminModel->getAddonList();
450
-		if($addon_list) foreach($addon_list as $addon)
450
+		if ($addon_list) foreach ($addon_list as $addon)
451 451
 		{
452
-			if(in_array($addon->addon, $skip['addon']))
452
+			if (in_array($addon->addon, $skip['addon']))
453 453
 			{
454 454
 				continue;
455 455
 			}
456
-			$info['addon'] .= '|' . $addon->addon;
456
+			$info['addon'] .= '|'.$addon->addon;
457 457
 		}
458 458
 		$info['addon'] = substr($info['addon'], 1);
459 459
 
460 460
 		$info['layout'] = "";
461 461
 		$oLayoutModel = getModel('layout');
462 462
 		$layout_list = $oLayoutModel->getDownloadedLayoutList();
463
-		if($layout_list) foreach($layout_list as $layout)
463
+		if ($layout_list) foreach ($layout_list as $layout)
464 464
 		{
465
-			if(in_array($layout->layout, $skip['layout']))
465
+			if (in_array($layout->layout, $skip['layout']))
466 466
 			{
467 467
 				continue;
468 468
 			}
469
-			$info['layout'] .= '|' . $layout->layout;
469
+			$info['layout'] .= '|'.$layout->layout;
470 470
 		}
471 471
 		$info['layout'] = substr($info['layout'], 1);
472 472
 
473 473
 		$info['widget'] = "";
474 474
 		$oWidgetModel = getModel('widget');
475 475
 		$widget_list = $oWidgetModel->getDownloadedWidgetList();
476
-		if($widget_list) foreach($widget_list as $widget)
476
+		if ($widget_list) foreach ($widget_list as $widget)
477 477
 		{
478
-			if(in_array($widget->widget, $skip['widget']))
478
+			if (in_array($widget->widget, $skip['widget']))
479 479
 			{
480 480
 				continue;
481 481
 			}
482
-			$info['widget'] .= '|' . $widget->widget;
482
+			$info['widget'] .= '|'.$widget->widget;
483 483
 		}
484 484
 		$info['widget'] = substr($info['widget'], 1);
485 485
 
486 486
 		$info['widgetstyle'] = "";
487 487
 		$oWidgetModel = getModel('widget');
488 488
 		$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
489
-		if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle)
489
+		if ($widgetstyle_list) foreach ($widgetstyle_list as $widgetstyle)
490 490
 		{
491
-			if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
491
+			if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
492 492
 			{
493 493
 				continue;
494 494
 			}
495
-			$info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle;
495
+			$info['widgetstyle'] .= '|'.$widgetstyle->widgetStyle;
496 496
 		}
497 497
 		$info['widgetstyle'] = substr($info['widgetstyle'], 1);
498 498
 
499 499
 		$param = '';
500
-		foreach($info as $k => $v)
500
+		foreach ($info as $k => $v)
501 501
 		{
502
-			if($v)
502
+			if ($v)
503 503
 			{
504 504
 				$param .= sprintf('&%s=%s', $k, urlencode($v));
505 505
 			}
@@ -515,13 +515,13 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	function getThemeList()
517 517
 	{
518
-		$path = _XE_PATH_ . 'themes';
518
+		$path = _XE_PATH_.'themes';
519 519
 		$list = FileHandler::readDir($path);
520 520
 
521 521
 		$theme_info = array();
522
-		if(count($list) > 0)
522
+		if (count($list) > 0)
523 523
 		{
524
-			foreach($list as $val)
524
+			foreach ($list as $val)
525 525
 			{
526 526
 				$theme_info[$val] = $this->getThemeInfo($val);
527 527
 			}
@@ -538,20 +538,20 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	function getThemeInfo($theme_name, $layout_list = NULL)
540 540
 	{
541
-		if($GLOBALS['__ThemeInfo__'][$theme_name])
541
+		if ($GLOBALS['__ThemeInfo__'][$theme_name])
542 542
 		{
543 543
 			return $GLOBALS['__ThemeInfo__'][$theme_name];
544 544
 		}
545 545
 
546
-		$info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml';
547
-		if(!file_exists($info_file))
546
+		$info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml';
547
+		if (!file_exists($info_file))
548 548
 		{
549 549
 			return;
550 550
 		}
551 551
 
552 552
 		$oXmlParser = new XmlParser();
553 553
 		$_xml_obj = $oXmlParser->loadXmlFile($info_file);
554
-		if(!$_xml_obj->theme)
554
+		if (!$_xml_obj->theme)
555 555
 		{
556 556
 			return;
557 557
 		}
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
 		$theme_info = new stdClass();
563 563
 		$theme_info->name = $theme_name;
564 564
 		$theme_info->title = $xml_obj->title->body;
565
-		$thumbnail = './themes/' . $theme_name . '/thumbnail.png';
565
+		$thumbnail = './themes/'.$theme_name.'/thumbnail.png';
566 566
 		$theme_info->thumbnail = (FileHandler::exists($thumbnail)) ? $thumbnail : NULL;
567 567
 		$theme_info->version = $xml_obj->version->body;
568 568
 		$date_obj = new stdClass();
569 569
 		sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
570 570
 		$theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
571 571
 		$theme_info->description = $xml_obj->description->body;
572
-		$theme_info->path = './themes/' . $theme_name . '/';
572
+		$theme_info->path = './themes/'.$theme_name.'/';
573 573
 
574
-		if(!is_array($xml_obj->publisher))
574
+		if (!is_array($xml_obj->publisher))
575 575
 		{
576 576
 			$publisher_list = array();
577 577
 			$publisher_list[] = $xml_obj->publisher;
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 		}
583 583
 
584 584
 		$theme_info->publisher = array();
585
-		foreach($publisher_list as $publisher)
585
+		foreach ($publisher_list as $publisher)
586 586
 		{
587 587
 			$publisher_obj = new stdClass();
588 588
 			$publisher_obj->name = $publisher->name->body;
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 		$layout_path = $layout->directory->attrs->path;
596 596
 		$layout_parse = explode('/', $layout_path);
597 597
 		$layout_info = new stdClass();
598
-		switch($layout_parse[1])
598
+		switch ($layout_parse[1])
599 599
 		{
600 600
 			case 'themes' :
601
-					$layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1];
601
+					$layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse) - 1];
602 602
 					break;
603 603
 
604 604
 			case 'layouts' :
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 		$oLayoutModel = getModel('layout');
616 616
 		$layout_info_list = array();
617 617
 		$layout_list = $oLayoutModel->getLayoutList($site_info->site_srl);
618
-		if($layout_list)
618
+		if ($layout_list)
619 619
 		{
620
-			foreach($layout_list as $val)
620
+			foreach ($layout_list as $val)
621 621
 			{
622
-				if($val->layout == $layout_info->name)
622
+				if ($val->layout == $layout_info->name)
623 623
 				{
624 624
 					$is_new_layout = FALSE;
625 625
 					$layout_info->layout_srl = $val->layout_srl;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 			}
629 629
 		}
630 630
 
631
-		if($is_new_layout)
631
+		if ($is_new_layout)
632 632
 		{
633 633
 			$site_module_info = Context::get('site_module_info');
634 634
 			$args = new stdClass();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		$theme_info->layout_info = $layout_info;
647 647
 
648 648
 		$skin_infos = $xml_obj->skininfos;
649
-		if(is_array($skin_infos->skininfo))
649
+		if (is_array($skin_infos->skininfo))
650 650
 		{
651 651
 			$skin_list = $skin_infos->skininfo;
652 652
 		}
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
 
658 658
 		$oModuleModel = getModel('module');
659 659
 		$skins = array();
660
-		foreach($skin_list as $val)
660
+		foreach ($skin_list as $val)
661 661
 		{
662 662
 			$skin_info = new stdClass();
663 663
 			unset($skin_parse);
664 664
 			$skin_parse = explode('/', $val->directory->attrs->path);
665
-			switch($skin_parse[1])
665
+			switch ($skin_parse[1])
666 666
 			{
667 667
 				case 'themes' :
668 668
 						$is_theme = TRUE;
669 669
 						$module_name = $skin_parse[count($skin_parse) - 1];
670
-						$skin_info->name = $theme_name . '|@|' . $module_name;
670
+						$skin_info->name = $theme_name.'|@|'.$module_name;
671 671
 						break;
672 672
 
673 673
 				case 'modules' :
@@ -681,9 +681,9 @@  discard block
 block discarded – undo
681 681
 			$skin_info->is_theme = $is_theme;
682 682
 			$skins[$module_name] = $skin_info;
683 683
 
684
-			if($is_theme)
684
+			if ($is_theme)
685 685
 			{
686
-				if(!$GLOBALS['__ThemeModuleSkin__'][$module_name])
686
+				if (!$GLOBALS['__ThemeModuleSkin__'][$module_name])
687 687
 				{
688 688
 					$GLOBALS['__ThemeModuleSkin__'][$module_name] = array();
689 689
 					$GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array();
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	function getModulesSkinList()
707 707
 	{
708
-		if($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__'])
708
+		if ($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__'])
709 709
 		{
710 710
 			return $GLOBALS['__ThemeModuleSkin__'];
711 711
 		}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		sort($searched_list);
714 714
 
715 715
 		$searched_count = count($searched_list);
716
-		if(!$searched_count)
716
+		if (!$searched_count)
717 717
 		{
718 718
 			return;
719 719
 		}
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 		$exceptionModule = array('editor', 'poll', 'homepage', 'textyle');
722 722
 
723 723
 		$oModuleModel = getModel('module');
724
-		foreach($searched_list as $val)
724
+		foreach ($searched_list as $val)
725 725
 		{
726
-			$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $val);
726
+			$skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$val);
727 727
 
728
-			if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule))
728
+			if (is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule))
729 729
 			{
730
-				if(!$GLOBALS['__ThemeModuleSkin__'][$val])
730
+				if (!$GLOBALS['__ThemeModuleSkin__'][$val])
731 731
 				{
732 732
 					$GLOBALS['__ThemeModuleSkin__'][$val] = array();
733 733
 					$moduleInfo = $oModuleModel->getModuleInfoXml($val);
@@ -752,22 +752,22 @@  discard block
 block discarded – undo
752 752
 		$cacheFile = sprintf('./files/cache/menu/admin_lang/adminMenu.%s.lang.php', $currentLang);
753 753
 
754 754
 		// Update if no cache file exists or it is older than xml file
755
-		if(!is_readable($cacheFile))
755
+		if (!is_readable($cacheFile))
756 756
 		{
757 757
 			$lang = new stdClass();
758 758
 			$oModuleModel = getModel('module');
759 759
 			$installed_module_list = $oModuleModel->getModulesXmlInfo();
760 760
 
761 761
 			$this->gnbLangBuffer = '<?php $lang = new stdClass();';
762
-			foreach($installed_module_list AS $key => $value)
762
+			foreach ($installed_module_list AS $key => $value)
763 763
 			{
764 764
 				$moduleActionInfo = $oModuleModel->getModuleActionXml($value->module);
765
-				if(is_object($moduleActionInfo->menu))
765
+				if (is_object($moduleActionInfo->menu))
766 766
 				{
767
-					foreach($moduleActionInfo->menu AS $key2 => $value2)
767
+					foreach ($moduleActionInfo->menu AS $key2 => $value2)
768 768
 					{
769 769
 						$lang->menu_gnb_sub[$key2] = $value2->title;
770
-						$this->gnbLangBuffer .=sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title);
770
+						$this->gnbLangBuffer .= sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title);
771 771
 					}
772 772
 				}
773 773
 			}
@@ -793,19 +793,19 @@  discard block
 block discarded – undo
793 793
 		$args = new stdClass();
794 794
 		$args->site_srl = $siteSrl;
795 795
 		$output = executeQueryArray('admin.getFavoriteList', $args);
796
-		if(!$output->toBool())
796
+		if (!$output->toBool())
797 797
 		{
798 798
 			return $output;
799 799
 		}
800
-		if(!$output->data)
800
+		if (!$output->data)
801 801
 		{
802 802
 			return new Object();
803 803
 		}
804 804
 
805
-		if($isGetModuleInfo && is_array($output->data))
805
+		if ($isGetModuleInfo && is_array($output->data))
806 806
 		{
807 807
 			$oModuleModel = getModel('module');
808
-			foreach($output->data AS $key => $value)
808
+			foreach ($output->data AS $key => $value)
809 809
 			{
810 810
 				$moduleInfo = $oModuleModel->getModuleInfoXml($value->module);
811 811
 				$output->data[$key]->admin_index_act = $moduleInfo->admin_index_act;
@@ -830,13 +830,13 @@  discard block
 block discarded – undo
830 830
 		$args->site_srl = $siteSrl;
831 831
 		$args->module = $module;
832 832
 		$output = executeQuery('admin.getFavorite', $args);
833
-		if(!$output->toBool())
833
+		if (!$output->toBool())
834 834
 		{
835 835
 			return $output;
836 836
 		}
837 837
 
838 838
 		$returnObject = new Object();
839
-		if($output->data)
839
+		if ($output->data)
840 840
 		{
841 841
 			$returnObject->add('result', TRUE);
842 842
 			$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl);
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 	 */
856 856
 	function getSiteAllList()
857 857
 	{
858
-		if(Context::get('domain'))
858
+		if (Context::get('domain'))
859 859
 		{
860 860
 			$domain = Context::get('domain');
861 861
 		}
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 	function getAllSitesThatHaveModules($domain = NULL)
873 873
 	{
874 874
 		$args = new stdClass();
875
-		if($domain)
875
+		if ($domain)
876 876
 		{
877 877
 			$args->domain = $domain;
878 878
 		}
@@ -880,31 +880,31 @@  discard block
 block discarded – undo
880 880
 
881 881
 		$siteList = array();
882 882
 		$output = executeQueryArray('admin.getSiteAllList', $args, $columnList);
883
-		if($output->toBool())
883
+		if ($output->toBool())
884 884
 		{
885 885
 			$siteList = $output->data;
886 886
 		}
887 887
 
888 888
 		$oModuleModel = getModel('module');
889
-		foreach($siteList as $key => $value)
889
+		foreach ($siteList as $key => $value)
890 890
 		{
891 891
 			$args->site_srl = $value->site_srl;
892 892
 			$list = $oModuleModel->getModuleSrlList($args);
893 893
 
894
-			if(!is_array($list))
894
+			if (!is_array($list))
895 895
 			{
896 896
 				$list = array($list);
897 897
 			}
898 898
 
899
-			foreach($list as $k => $v)
899
+			foreach ($list as $k => $v)
900 900
 			{
901
-				if(!is_dir(_XE_PATH_ . 'modules/' . $v->module))
901
+				if (!is_dir(_XE_PATH_.'modules/'.$v->module))
902 902
 				{
903 903
 					unset($list[$k]);
904 904
 				}
905 905
 			}
906 906
 
907
-			if(!count($list))
907
+			if (!count($list))
908 908
 			{
909 909
 				unset($siteList[$key]);
910 910
 			}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	{
922 922
 		$args = new stdClass();
923 923
 
924
-		if($date)
924
+		if ($date)
925 925
 		{
926 926
 			$args->regDate = date('Ymd', strtotime($date));
927 927
 		}
928 928
 
929 929
 		$output = executeQuery('admin.getSiteCountByDate', $args);
930
-		if(!$output->toBool())
930
+		if (!$output->toBool())
931 931
 		{
932 932
 			return 0;
933 933
 		}
@@ -949,20 +949,20 @@  discard block
 block discarded – undo
949 949
 	{
950 950
 		$site_info = Context::get('site_module_info');
951 951
 		$virtual_site = '';
952
-		if($site_info->site_srl) 
952
+		if ($site_info->site_srl) 
953 953
 		{
954
-			$virtual_site = $site_info->site_srl . '/';
954
+			$virtual_site = $site_info->site_srl.'/';
955 955
 		}
956 956
 
957
-		$file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
958
-		if(!$file_exsit && $default === true)
957
+		$file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
958
+		if (!$file_exsit && $default === true)
959 959
         {
960
-            $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
960
+            $icon_url = './modules/admin/tpl/img/'.$default_icon_name;
961 961
         }
962
-        elseif($file_exsit)
962
+        elseif ($file_exsit)
963 963
 		{
964 964
 			$default_url = Context::getDefaultUrl();
965
-			$icon_url = $default_url . 'files/attach/xeicon/' . $virtual_site . $iconname;
965
+			$icon_url = $default_url.'files/attach/xeicon/'.$virtual_site.$iconname;
966 966
 		}
967 967
 		return $icon_url;
968 968
 	}
Please login to merge, or discard this patch.
modules/adminlogging/adminlogging.controller.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 	/**
16 16
 	 * Initialization
17
-	 * @return void
17
+	 * @return ModuleObject|null
18 18
 	 */
19 19
 	function init()
20 20
 	{
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		// forbit access if the user is not an administrator
22 22
 		$oMemberModel = getModel('member');
23 23
 		$logged_info = $oMemberModel->getLoggedInfo();
24
-		if($logged_info->is_admin != 'Y')
24
+		if ($logged_info->is_admin != 'Y')
25 25
 		{
26 26
 			return $this->stop("msg_is_not_administrator");
27 27
 		}
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	function insertLog($module, $act)
35 35
 	{
36
-		if(!$module || !$act)
36
+		if (!$module || !$act)
37 37
 		{
38 38
 			return;
39 39
 		}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.admin.controller.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -332,6 +332,7 @@
 block discarded – undo
332 332
 	/**
333 333
 	 * Uninstall package by package serial number
334 334
 	 *
335
+	 * @param string $package_srl
335 336
 	 * @return Object
336 337
 	 */
337 338
 	function uninstallPackageByPackageSrl($package_srl)
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -104,8 +104,7 @@  discard block
 block discarded – undo
104 104
 			if($type == "core")
105 105
 			{
106 106
 				$version = __XE_VERSION__;
107
-			}
108
-			else
107
+			} else
109 108
 			{
110 109
 				$config_file = NULL;
111 110
 				switch($type)
@@ -161,8 +160,7 @@  discard block
 block discarded – undo
161 160
 			if(version_compare($args->version, $args->current_version, ">"))
162 161
 			{
163 162
 				$args->need_update = "Y";
164
-			}
165
-			else
163
+			} else
166 164
 			{
167 165
 				$args->need_update = "N";
168 166
 			}
@@ -187,8 +185,7 @@  discard block
 block discarded – undo
187 185
 		if(!$_SESSION['ftp_password'])
188 186
 		{
189 187
 			$ftp_password = Context::get('ftp_password');
190
-		}
191
-		else
188
+		} else
192 189
 		{
193 190
 			$ftp_password = $_SESSION['ftp_password'];
194 191
 		}
@@ -200,16 +197,13 @@  discard block
 block discarded – undo
200 197
 			if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
201 198
 			{
202 199
 				$oModuleInstaller = new DirectModuleInstaller($package);
203
-			}
204
-			else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
200
+			} else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
205 201
 			{
206 202
 				$oModuleInstaller = new SFTPModuleInstaller($package);
207
-			}
208
-			else if(function_exists(ftp_connect))
203
+			} else if(function_exists(ftp_connect))
209 204
 			{
210 205
 				$oModuleInstaller = new PHPFTPModuleInstaller($package);
211
-			}
212
-			else
206
+			} else
213 207
 			{
214 208
 				$oModuleInstaller = new FTPModuleInstaller($package);
215 209
 			}
@@ -230,8 +224,7 @@  discard block
 block discarded – undo
230 224
 		if(Context::get('return_url'))
231 225
 		{
232 226
 			$this->setRedirectUrl(Context::get('return_url'));
233
-		}
234
-		else
227
+		} else
235 228
 		{
236 229
 			$this->setRedirectUrl(preg_replace('/act=[^&]*/', 'act=dispAutoinstallAdminIndex', Context::get('error_return_url')));
237 230
 		}
@@ -265,8 +258,7 @@  discard block
 block discarded – undo
265 258
 			if($oModel->getPackage($args->package_srl))
266 259
 			{
267 260
 				$output = executeQuery("autoinstall.updatePackage", $args);
268
-			}
269
-			else
261
+			} else
270 262
 			{
271 263
 				$output = executeQuery("autoinstall.insertPackage", $args);
272 264
 				if(!$output->toBool())
@@ -322,8 +314,7 @@  discard block
 block discarded – undo
322 314
 		if(Context::get('return_url'))
323 315
 		{
324 316
 			$this->setRedirectUrl(Context::get('return_url'));
325
-		}
326
-		else
317
+		} else
327 318
 		{
328 319
 			$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstalledPackages'));
329 320
 		}
@@ -362,8 +353,7 @@  discard block
 block discarded – undo
362 353
 		if(!$_SESSION['ftp_password'])
363 354
 		{
364 355
 			$ftp_password = Context::get('ftp_password');
365
-		}
366
-		else
356
+		} else
367 357
 		{
368 358
 			$ftp_password = $_SESSION['ftp_password'];
369 359
 		}
@@ -373,16 +363,13 @@  discard block
 block discarded – undo
373 363
 		if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
374 364
 		{
375 365
 			$oModuleInstaller = new DirectModuleInstaller($package);
376
-		}
377
-		else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
366
+		} else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
378 367
 		{
379 368
 			$oModuleInstaller = new SFTPModuleInstaller($package);
380
-		}
381
-		else if(function_exists('ftp_connect'))
369
+		} else if(function_exists('ftp_connect'))
382 370
 		{
383 371
 			$oModuleInstaller = new PHPFTPModuleInstaller($package);
384
-		}
385
-		else
372
+		} else
386 373
 		{
387 374
 			$oModuleInstaller = new FTPModuleInstaller($package);
388 375
 		}
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/autoinstall/autoinstall.lib.php');
4
+require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
5 5
 
6 6
 /**
7 7
  * autoinstall module admin controller class
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	{
65 65
 		$oModel = getModel('autoinstall');
66 66
 		$item = $oModel->getLatestPackage();
67
-		if($item)
67
+		if ($item)
68 68
 		{
69 69
 			$params["updatedate"] = $item->updatedate;
70 70
 		}
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 		executeQuery("autoinstall.deleteInstalledPackage");
93 93
 		$oModel = getModel('autoinstall');
94 94
 		$packages = $oModel->getPackages();
95
-		foreach($packages as $package)
95
+		foreach ($packages as $package)
96 96
 		{
97 97
 			$real_path = FileHandler::getRealPath($package->path);
98
-			if(!file_exists($real_path))
98
+			if (!file_exists($real_path))
99 99
 			{
100 100
 				continue;
101 101
 			}
102 102
 
103 103
 			$type = $oModel->getTypeFromPath($package->path);
104
-			if($type == "core")
104
+			if ($type == "core")
105 105
 			{
106 106
 				$version = __XE_VERSION__;
107 107
 			}
108 108
 			else
109 109
 			{
110 110
 				$config_file = NULL;
111
-				switch($type)
111
+				switch ($type)
112 112
 				{
113 113
 					case "m.layout":
114 114
 						$type = "layout";
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 						break;
139 139
 				}
140 140
 
141
-				if(!$config_file)
141
+				if (!$config_file)
142 142
 				{
143 143
 					continue;
144 144
 				}
145 145
 
146 146
 				$xml = new XmlParser();
147
-				$xmlDoc = $xml->loadXmlFile($real_path . $config_file);
147
+				$xmlDoc = $xml->loadXmlFile($real_path.$config_file);
148 148
 
149
-				if(!$xmlDoc)
149
+				if (!$xmlDoc)
150 150
 				{
151 151
 					continue;
152 152
 				}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			$args->package_srl = $package->package_srl;
159 159
 			$args->version = $package->version;
160 160
 			$args->current_version = $version;
161
-			if(version_compare($args->version, $args->current_version, ">"))
161
+			if (version_compare($args->version, $args->current_version, ">"))
162 162
 			{
163 163
 				$args->need_update = "Y";
164 164
 			}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		$oAdminModel = getAdminModel('autoinstall');
185 185
 		$packages = explode(',', $package_srls);
186 186
 		$ftp_info = Context::getFTPInfo();
187
-		if(!$_SESSION['ftp_password'])
187
+		if (!$_SESSION['ftp_password'])
188 188
 		{
189 189
 			$ftp_password = Context::get('ftp_password');
190 190
 		}
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		$isSftpSupported = function_exists(ssh2_sftp);
197
-		foreach($packages as $package_srl)
197
+		foreach ($packages as $package_srl)
198 198
 		{
199 199
 			$package = $oModel->getPackage($package_srl);
200
-			if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
200
+			if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
201 201
 			{
202 202
 				$oModuleInstaller = new DirectModuleInstaller($package);
203 203
 			}
204
-			else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
204
+			else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
205 205
 			{
206 206
 				$oModuleInstaller = new SFTPModuleInstaller($package);
207 207
 			}
208
-			else if(function_exists(ftp_connect))
208
+			else if (function_exists(ftp_connect))
209 209
 			{
210 210
 				$oModuleInstaller = new PHPFTPModuleInstaller($package);
211 211
 			}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
218 218
 			$oModuleInstaller->setPassword($ftp_password);
219 219
 			$output = $oModuleInstaller->install();
220
-			if(!$output->toBool())
220
+			if (!$output->toBool())
221 221
 			{
222 222
 				return $output;
223 223
 			}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$this->setMessage('success_installed', 'update');
229 229
 
230
-		if(Context::get('return_url'))
230
+		if (Context::get('return_url'))
231 231
 		{
232 232
 			$this->setRedirectUrl(Context::get('return_url'));
233 233
 		}
@@ -246,30 +246,30 @@  discard block
 block discarded – undo
246 246
 	function updatePackages(&$xmlDoc)
247 247
 	{
248 248
 		$oModel = getModel('autoinstall');
249
-		if(!$xmlDoc->response->packages->item)
249
+		if (!$xmlDoc->response->packages->item)
250 250
 		{
251 251
 			return;
252 252
 		}
253
-		if(!is_array($xmlDoc->response->packages->item))
253
+		if (!is_array($xmlDoc->response->packages->item))
254 254
 		{
255 255
 			$xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
256 256
 		}
257 257
 		$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl', 'have_instance');
258
-		foreach($xmlDoc->response->packages->item as $item)
258
+		foreach ($xmlDoc->response->packages->item as $item)
259 259
 		{
260 260
 			$args = new stdClass();
261
-			foreach($targets as $target)
261
+			foreach ($targets as $target)
262 262
 			{
263 263
 				$args->{$target} = $item->{$target}->body;
264 264
 			}
265
-			if($oModel->getPackage($args->package_srl))
265
+			if ($oModel->getPackage($args->package_srl))
266 266
 			{
267 267
 				$output = executeQuery("autoinstall.updatePackage", $args);
268 268
 			}
269 269
 			else
270 270
 			{
271 271
 				$output = executeQuery("autoinstall.insertPackage", $args);
272
-				if(!$output->toBool())
272
+				if (!$output->toBool())
273 273
 				{
274 274
 					$output = executeQuery("autoinstall.deletePackage", $args);
275 275
 					$output = executeQuery("autoinstall.insertPackage", $args);
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 	{
289 289
 		executeQuery("autoinstall.deleteCategory");
290 290
 		$oModel = getModel('autoinstall');
291
-		if(!is_array($xmlDoc->response->categorylist->item))
291
+		if (!is_array($xmlDoc->response->categorylist->item))
292 292
 		{
293 293
 			$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
294 294
 		}
295 295
 		$list_order = 0;
296
-		foreach($xmlDoc->response->categorylist->item as $item)
296
+		foreach ($xmlDoc->response->categorylist->item as $item)
297 297
 		{
298 298
 			$args = new stdClass();
299 299
 			$args->category_srl = $item->category_srl->body;
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
 		$package_srl = Context::get('package_srl');
315 315
 
316 316
 		$output = $this->uninstallPackageByPackageSrl($package_srl);
317
-		if($output->toBool()==FALSE)
317
+		if ($output->toBool() == FALSE)
318 318
 		{
319 319
 			return $output;
320 320
 		}
321 321
 
322
-		if(Context::get('return_url'))
322
+		if (Context::get('return_url'))
323 323
 		{
324 324
 			$this->setRedirectUrl(Context::get('return_url'));
325 325
 		}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$oAdminModel = getAdminModel('autoinstall');
361 361
 
362
-		if(!$_SESSION['ftp_password'])
362
+		if (!$_SESSION['ftp_password'])
363 363
 		{
364 364
 			$ftp_password = Context::get('ftp_password');
365 365
 		}
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 		$ftp_info = Context::getFTPInfo();
371 371
 
372 372
 		$isSftpSupported = function_exists(ssh2_sftp);
373
-		if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
373
+		if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
374 374
 		{
375 375
 			$oModuleInstaller = new DirectModuleInstaller($package);
376 376
 		}
377
-		else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
377
+		else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
378 378
 		{
379 379
 			$oModuleInstaller = new SFTPModuleInstaller($package);
380 380
 		}
381
-		else if(function_exists('ftp_connect'))
381
+		else if (function_exists('ftp_connect'))
382 382
 		{
383 383
 			$oModuleInstaller = new PHPFTPModuleInstaller($package);
384 384
 		}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
 		$oModuleInstaller->setPassword($ftp_password);
393 393
 		$output = $oModuleInstaller->uninstall();
394
-		if(!$output->toBool())
394
+		if (!$output->toBool())
395 395
 		{
396 396
 			return $output;
397 397
 		}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.admin.model.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -15,6 +15,9 @@  discard block
 block discarded – undo
15 15
 
16 16
 	/**
17 17
 	 * Pre process parameters
18
+	 * @param string $order_target
19
+	 * @param string $order_type
20
+	 * @param string $page
18 21
 	 */
19 22
 	function preProcParam(&$order_target, &$order_type, &$page)
20 23
 	{
@@ -115,6 +118,10 @@  discard block
 block discarded – undo
115 118
 
116 119
 	/**
117 120
 	 * Get Package List
121
+	 * @param string $type
122
+	 * @param string $search_keyword
123
+	 * @param integer $category_srl
124
+	 * @param string $parent_program
118 125
 	 */
119 126
 	function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL)
120 127
 	{
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
 		if($type == 'P')
72 72
 		{
73 73
 			$category_srl = $this->layout_category_srl;
74
-		}
75
-		else
74
+		} else
76 75
 		{
77 76
 			$category_srl = $this->mobile_layout_category_srl;
78 77
 		}
@@ -103,8 +102,7 @@  discard block
 block discarded – undo
103 102
 		if($type == 'P')
104 103
 		{
105 104
 			$category_srl = $this->module_skin_category_srl;
106
-		}
107
-		else
105
+		} else
108 106
 		{
109 107
 			$category_srl = $this->module_mobile_skin_category_srl;
110 108
 		}
@@ -121,13 +119,11 @@  discard block
 block discarded – undo
121 119
 		if($type == 'menu')
122 120
 		{
123 121
 			$params["act"] = "getResourceapiMenuPackageList";
124
-		}
125
-		elseif($type == 'skin')
122
+		} elseif($type == 'skin')
126 123
 		{
127 124
 			$params["act"] = "getResourceapiSkinPackageList";
128 125
 			$params['parent_program'] = $parent_program;
129
-		}
130
-		else
126
+		} else
131 127
 		{
132 128
 			$params["act"] = "getResourceapiPackagelist";
133 129
 		}
@@ -170,8 +166,7 @@  discard block
 block discarded – undo
170 166
 		if(!$ftp_info->ftp_root_path)
171 167
 		{
172 168
 			$is_authed = -1;
173
-		}
174
-		else
169
+		} else
175 170
 		{
176 171
 			$is_authed = (int) isset($_SESSION['ftp_password']);
177 172
 		}
@@ -206,8 +201,7 @@  discard block
 block discarded – undo
206 201
 			if($packageInfo->type == 'core')
207 202
 			{
208 203
 				$title = 'XpressEngine';
209
-			}
210
-			else
204
+			} else
211 205
 			{
212 206
 				$configFile = $oModel->getConfigFilePath($packageInfo->type);
213 207
 				$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile);
@@ -228,8 +222,7 @@  discard block
 block discarded – undo
228 222
 						$type = "layout";
229 223
 					}
230 224
 					$title = $xmlDoc->{$type}->title->body;
231
-				}
232
-				else
225
+				} else
233 226
 				{
234 227
 					$pathInfo = explode('/', $package->path);
235 228
 					$title = $pathInfo[count($pathInfo) - 1];
@@ -293,8 +286,7 @@  discard block
 block discarded – undo
293 286
 					{
294 287
 						$package->depends[$key]->installed = FALSE;
295 288
 						$package->package_srl .= "," . $dep->package_srl;
296
-					}
297
-					else
289
+					} else
298 290
 					{
299 291
 						$package->depends[$key]->installed = TRUE;
300 292
 						$package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version;
@@ -308,8 +300,7 @@  discard block
 block discarded – undo
308 300
 								$package->contain_core = TRUE;
309 301
 								$package->contain_core_version = $dep->version;
310 302
 							}
311
-						}
312
-						else
303
+						} else
313 304
 						{
314 305
 							$package->need_update = FALSE;
315 306
 						}
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -19,19 +19,19 @@  discard block
 block discarded – undo
19 19
 	function preProcParam(&$order_target, &$order_type, &$page)
20 20
 	{
21 21
 		$order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1);
22
-		if(!isset($order_target_array[$order_target]))
22
+		if (!isset($order_target_array[$order_target]))
23 23
 		{
24 24
 			$order_target = 'newest';
25 25
 		}
26 26
 
27 27
 		$order_type_array = array('asc' => 1, 'desc' => 1);
28
-		if(!isset($order_type_array[$order_type]))
28
+		if (!isset($order_type_array[$order_type]))
29 29
 		{
30 30
 			$order_type = 'desc';
31 31
 		}
32 32
 
33 33
 		$page = (int) $page;
34
-		if($page < 1)
34
+		if ($page < 1)
35 35
 		{
36 36
 			$page = 1;
37 37
 		}
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 
64 64
 		$type_array = array('M' => 1, 'P' => 1);
65 65
 		$type = Context::get('type');
66
-		if(!isset($type_array[$type]))
66
+		if (!isset($type_array[$type]))
67 67
 		{
68 68
 			$type = 'P';
69 69
 		}
70 70
 
71
-		if($type == 'P')
71
+		if ($type == 'P')
72 72
 		{
73 73
 			$category_srl = $this->layout_category_srl;
74 74
 		}
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 
96 96
 		$type_array = array('M' => 1, 'P' => 1);
97 97
 		$type = Context::get('type');
98
-		if(!isset($type_array[$type]))
98
+		if (!isset($type_array[$type]))
99 99
 		{
100 100
 			$type = 'P';
101 101
 		}
102 102
 
103
-		if($type == 'P')
103
+		if ($type == 'P')
104 104
 		{
105 105
 			$category_srl = $this->module_skin_category_srl;
106 106
 		}
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL)
120 120
 	{
121
-		if($type == 'menu')
121
+		if ($type == 'menu')
122 122
 		{
123 123
 			$params["act"] = "getResourceapiMenuPackageList";
124 124
 		}
125
-		elseif($type == 'skin')
125
+		elseif ($type == 'skin')
126 126
 		{
127 127
 			$params["act"] = "getResourceapiSkinPackageList";
128 128
 			$params['parent_program'] = $parent_program;
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
 		$params["order_type"] = $order_type;
138 138
 		$params["page"] = $page;
139 139
 
140
-		if($category_srl)
140
+		if ($category_srl)
141 141
 		{
142 142
 			$params["category_srl"] = $category_srl;
143 143
 		}
144 144
 
145
-		if($search_keyword)
145
+		if ($search_keyword)
146 146
 		{
147 147
 			$params["search_keyword"] = $search_keyword;
148 148
 		}
149 149
 
150 150
 		$xmlDoc = XmlGenerater::getXmlDoc($params);
151
-		if($xmlDoc && $xmlDoc->response->packagelist->item)
151
+		if ($xmlDoc && $xmlDoc->response->packagelist->item)
152 152
 		{
153 153
 			$item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item);
154 154
 			$this->add('item_list', $item_list);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$is_authed = 0;
168 168
 
169 169
 		$ftp_info = Context::getFTPInfo();
170
-		if(!$ftp_info->ftp_root_path)
170
+		if (!$ftp_info->ftp_root_path)
171 171
 		{
172 172
 			$is_authed = -1;
173 173
 		}
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 	{
187 187
 		$oModel = getModel('autoinstall');
188 188
 		$output = executeQueryArray('autoinstall.getNeedUpdate');
189
-		if(!is_array($output->data))
189
+		if (!is_array($output->data))
190 190
 		{
191 191
 			return NULL;
192 192
 		}
193 193
 
194 194
 		$result = array();
195 195
 		$xml = new XmlParser();
196
-		foreach($output->data as $package)
196
+		foreach ($output->data as $package)
197 197
 		{
198 198
 			$packageSrl = $package->package_srl;
199 199
 
@@ -203,27 +203,27 @@  discard block
 block discarded – undo
203 203
 			$packageInfo->type = $oModel->getTypeFromPath($package->path);
204 204
 			$packageInfo->url = $oModel->getUpdateUrlByPackageSrl($package->package_srl);
205 205
 
206
-			if($packageInfo->type == 'core')
206
+			if ($packageInfo->type == 'core')
207 207
 			{
208 208
 				$title = 'XpressEngine';
209 209
 			}
210 210
 			else
211 211
 			{
212 212
 				$configFile = $oModel->getConfigFilePath($packageInfo->type);
213
-				$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile);
213
+				$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path).$configFile);
214 214
 
215
-				if($xmlDoc)
215
+				if ($xmlDoc)
216 216
 				{
217 217
 					$type = $packageInfo->type;
218
-					if($type == "drcomponent")
218
+					if ($type == "drcomponent")
219 219
 					{
220 220
 						$type = "component";
221 221
 					}
222
-					if($type == "style" || $type == "m.skin")
222
+					if ($type == "style" || $type == "m.skin")
223 223
 					{
224 224
 						$type = "skin";
225 225
 					}
226
-					if($type == "m.layout")
226
+					if ($type == "m.layout")
227 227
 					{
228 228
 						$type = "layout";
229 229
 					}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 		$oModel = getModel('autoinstall');
258 258
 
259 259
 		$targetpackages = array();
260
-		if($xmlDoc)
260
+		if ($xmlDoc)
261 261
 		{
262 262
 			$xmlPackage = $xmlDoc->response->package;
263 263
 			$package = new stdClass();
@@ -266,15 +266,15 @@  discard block
 block discarded – undo
266 266
 			$package->package_description = $xmlPackage->package_description->body;
267 267
 			$package->version = $xmlPackage->version->body;
268 268
 			$package->path = $xmlPackage->path->body;
269
-			if($xmlPackage->depends)
269
+			if ($xmlPackage->depends)
270 270
 			{
271
-				if(!is_array($xmlPackage->depends->item))
271
+				if (!is_array($xmlPackage->depends->item))
272 272
 				{
273 273
 					$xmlPackage->depends->item = array($xmlPackage->depends->item);
274 274
 				}
275 275
 
276 276
 				$package->depends = array();
277
-				foreach($xmlPackage->depends->item as $item)
277
+				foreach ($xmlPackage->depends->item as $item)
278 278
 				{
279 279
 					$dep_item = new stdClass();
280 280
 					$dep_item->package_srl = $item->package_srl->body;
@@ -287,23 +287,23 @@  discard block
 block discarded – undo
287 287
 
288 288
 				$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
289 289
 				$package->deplist = "";
290
-				foreach($package->depends as $key => $dep)
290
+				foreach ($package->depends as $key => $dep)
291 291
 				{
292
-					if(!$packages[$dep->package_srl])
292
+					if (!$packages[$dep->package_srl])
293 293
 					{
294 294
 						$package->depends[$key]->installed = FALSE;
295
-						$package->package_srl .= "," . $dep->package_srl;
295
+						$package->package_srl .= ",".$dep->package_srl;
296 296
 					}
297 297
 					else
298 298
 					{
299 299
 						$package->depends[$key]->installed = TRUE;
300 300
 						$package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version;
301
-						if(version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">"))
301
+						if (version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">"))
302 302
 						{
303 303
 							$package->depends[$key]->need_update = TRUE;
304
-							$package->package_srl .= "," . $dep->package_srl;
304
+							$package->package_srl .= ",".$dep->package_srl;
305 305
 
306
-							if($dep->path === '.')
306
+							if ($dep->path === '.')
307 307
 							{
308 308
 								$package->contain_core = TRUE;
309 309
 								$package->contain_core_version = $dep->version;
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 			}
319 319
 
320 320
 			$installedPackage = $oModel->getInstalledPackage($packageSrl);
321
-			if($installedPackage)
321
+			if ($installedPackage)
322 322
 			{
323 323
 				$package->installed = TRUE;
324 324
 				$package->cur_version = $installedPackage->current_version;
325 325
 				$package->need_update = version_compare($package->version, $installedPackage->current_version, ">");
326 326
 			}
327 327
 
328
-			if($package->path === '.')
328
+			if ($package->path === '.')
329 329
 			{
330 330
 				$package->contain_core = TRUE;
331 331
 				$package->contain_core_version = $package->version;
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	public function getAutoInstallAdminInstallInfo()
342 342
 	{
343 343
 		$packageSrl = Context::get('package_srl');
344
-		if(!$packageSrl)
344
+		if (!$packageSrl)
345 345
 		{
346 346
 			return new Object(-1, 'msg_invalid_request');
347 347
 		}
@@ -355,23 +355,23 @@  discard block
 block discarded – undo
355 355
 		$directModuleInstall = TRUE;
356 356
 		$arrUnwritableDir = array();
357 357
 		$output = $this->isWritableDir($package->path);
358
-		if($output->toBool()==FALSE)
358
+		if ($output->toBool() == FALSE)
359 359
 		{
360 360
 			$directModuleInstall = FALSE;
361 361
 			$arrUnwritableDir[] = $output->get('path');
362 362
 		}
363 363
 
364
-		foreach($package->depends as $dep)
364
+		foreach ($package->depends as $dep)
365 365
 		{
366 366
 			$output = $this->isWritableDir($dep->path);
367
-			if($output->toBool()==FALSE)
367
+			if ($output->toBool() == FALSE)
368 368
 			{
369 369
 				$directModuleInstall = FALSE;
370 370
 				$arrUnwritableDir[] = $output->get('path');
371 371
 			}
372 372
 		}
373 373
 
374
-		if($directModuleInstall==FALSE)
374
+		if ($directModuleInstall == FALSE)
375 375
 		{
376 376
 			$output = new Object(-1, 'msg_direct_inall_invalid');
377 377
 			$output->add('path', $arrUnwritableDir);
@@ -386,17 +386,17 @@  discard block
 block discarded – undo
386 386
 		$path_list = explode('/', dirname($path));
387 387
 		$real_path = './';
388 388
 
389
-		while($path_list)
389
+		while ($path_list)
390 390
 		{
391
-			$check_path = realpath($real_path . implode('/', $path_list));
392
-			if(FileHandler::isDir($check_path))
391
+			$check_path = realpath($real_path.implode('/', $path_list));
392
+			if (FileHandler::isDir($check_path))
393 393
 			{
394 394
 				break;
395 395
 			}
396 396
 			array_pop($path_list);
397 397
 		}
398 398
 
399
-		if(FileHandler::isWritableDir($check_path)==FALSE)
399
+		if (FileHandler::isWritableDir($check_path) == FALSE)
400 400
 		{
401 401
 			$output = new Object(-1, 'msg_unwritable_directory');
402 402
 			$output->add('path', FileHandler::getRealPath($check_path));
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.admin.view.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param object $item
87 87
 	 * @param object $targets
88
-	 * @return object
88
+	 * @return stdClass
89 89
 	 */
90 90
 	function rearrange(&$item, &$targets)
91 91
 	{
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	/**
348 348
 	 * Display install package
349 349
 	 *
350
-	 * @return Object
350
+	 * @return ModuleObject|null
351 351
 	 */
352 352
 	function dispAutoinstallAdminInstall()
353 353
 	{
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	/**
385 385
 	 * Display package list
386 386
 	 *
387
-	 * @return Object
387
+	 * @return ModuleObject|null
388 388
 	 */
389 389
 	function dispAutoinstallAdminIndex()
390 390
 	{
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
 		if(!$ftp_info->ftp_root_path)
37 37
 		{
38 38
 			Context::set('show_ftp_note', TRUE);
39
-		}
40
-		else
39
+		} else
41 40
 		{
42 41
 			$this->ftp_set = TRUE;
43 42
 		}
@@ -217,12 +216,10 @@  discard block
 block discarded – undo
217 216
 				if($v->type == "core")
218 217
 				{
219 218
 					$v->avail_remove = FALSE;
220
-				}
221
-				else if($v->type == "module")
219
+				} else if($v->type == "module")
222 220
 				{
223 221
 					$v->avail_remove = $oModel->checkRemovable($packages[$v->package_srl]->path);
224
-				}
225
-				else
222
+				} else
226 223
 				{
227 224
 					$v->avail_remove = TRUE;
228 225
 				}
@@ -455,8 +452,7 @@  discard block
 block discarded – undo
455 452
 		if($childrenList)
456 453
 		{
457 454
 			$params["category_srl"] = $childrenList;
458
-		}
459
-		else if($category_srl)
455
+		} else if($category_srl)
460 456
 		{
461 457
 			$params["category_srl"] = $category_srl;
462 458
 		}
@@ -565,8 +561,7 @@  discard block
 block discarded – undo
565 561
 			$security->encodeHTML('package.');
566 562
 
567 563
 			$this->setTemplateFile('uninstall');
568
-		}
569
-		else
564
+		} else
570 565
 		{
571 566
 			return $this->stop('msg_connection_fail');
572 567
 		}
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		$this->setTemplatePath($template_path);
34 34
 
35 35
 		$ftp_info = Context::getFTPInfo();
36
-		if(!$ftp_info->ftp_root_path)
36
+		if (!$ftp_info->ftp_root_path)
37 37
 		{
38 38
 			Context::set('show_ftp_note', TRUE);
39 39
 		}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	function rearrange(&$item, &$targets)
91 91
 	{
92 92
 		$ret = new stdClass();
93
-		foreach($targets as $target)
93
+		foreach ($targets as $target)
94 94
 		{
95 95
 			$ret->{$target} = $item->{$target}->body;
96 96
 		}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	function rearranges($items, $packages = null)
171 171
 	{
172
-		if(!is_array($items))
172
+		if (!is_array($items))
173 173
 		{
174 174
 			$items = array($items);
175 175
 		}
@@ -178,47 +178,47 @@  discard block
 block discarded – undo
178 178
 		$targets = array('category_srl', 'package_srl', 'item_screenshot_url', 'package_voted', 'package_voter', 'package_description', 'package_downloaded', 'item_regdate', 'title', 'item_version', 'package_star', 'depfrom');
179 179
 		$targetpackages = array();
180 180
 
181
-		foreach($items as $item)
181
+		foreach ($items as $item)
182 182
 		{
183 183
 			$targetpackages[$item->package_srl->body] = 0;
184 184
 		}
185 185
 
186 186
 		$oModel = getModel('autoinstall');
187 187
 		
188
-		if($package == null)
188
+		if ($package == null)
189 189
 		{
190 190
 			$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
191 191
 		}
192 192
 
193 193
 		$depto = array();
194 194
 
195
-		foreach($items as $item)
195
+		foreach ($items as $item)
196 196
 		{
197 197
 			$v = $this->rearrange($item, $targets);
198 198
 			$v->item_screenshot_url = str_replace('./', _XE_DOWNLOAD_SERVER_, $v->item_screenshot_url);
199 199
 			$v->category = $this->categories[$v->category_srl]->title;
200
-			$v->url = _XE_LOCATION_SITE_ . '?mid=download&package_srl=' . $v->package_srl;
200
+			$v->url = _XE_LOCATION_SITE_.'?mid=download&package_srl='.$v->package_srl;
201 201
 
202
-			if($packages[$v->package_srl])
202
+			if ($packages[$v->package_srl])
203 203
 			{
204 204
 				$v->current_version = $packages[$v->package_srl]->current_version;
205 205
 				$v->need_update = $packages[$v->package_srl]->need_update;
206 206
 				$v->type = $oModel->getTypeFromPath($packages[$v->package_srl]->path);
207 207
 
208
-				if($this->ftp_set && $v->depfrom)
208
+				if ($this->ftp_set && $v->depfrom)
209 209
 				{
210 210
 					$depfrom = explode(",", $v->depfrom);
211
-					foreach($depfrom as $package_srl)
211
+					foreach ($depfrom as $package_srl)
212 212
 					{
213 213
 						$depto[$package_srl][] = $v->package_srl;
214 214
 					}
215 215
 				}
216 216
 
217
-				if($v->type == "core")
217
+				if ($v->type == "core")
218 218
 				{
219 219
 					$v->avail_remove = FALSE;
220 220
 				}
221
-				else if($v->type == "module")
221
+				else if ($v->type == "module")
222 222
 				{
223 223
 					$v->avail_remove = $oModel->checkRemovable($packages[$v->package_srl]->path);
224 224
 				}
@@ -230,41 +230,41 @@  discard block
 block discarded – undo
230 230
 			$item_list[$v->package_srl] = $v;
231 231
 		}
232 232
 
233
-		if(count($depto) > 0)
233
+		if (count($depto) > 0)
234 234
 		{
235 235
 			$installed = $oModel->getInstalledPackages(implode(",", array_keys($depto)));
236
-			foreach($installed as $key => $val)
236
+			foreach ($installed as $key => $val)
237 237
 			{
238 238
 				$path = $val->path;
239 239
 				$type = $oModel->getTypeFromPath($path);
240 240
 
241
-				if(!$type || $type == "core")
241
+				if (!$type || $type == "core")
242 242
 				{
243 243
 					continue;
244 244
 				}
245 245
 
246 246
 				$config_file = $oModel->getConfigFilePath($type);
247
-				if(!$config_file)
247
+				if (!$config_file)
248 248
 				{
249 249
 					continue;
250 250
 				}
251 251
 
252 252
 				$xml = new XmlParser();
253
-				$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path) . $config_file);
254
-				if(!$xmlDoc)
253
+				$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path).$config_file);
254
+				if (!$xmlDoc)
255 255
 				{
256 256
 					continue;
257 257
 				}
258 258
 
259
-				if($type == "drcomponent")
259
+				if ($type == "drcomponent")
260 260
 				{
261 261
 					$type = "component";
262 262
 				}
263
-				if($type == "style" || $type == "m.skin")
263
+				if ($type == "style" || $type == "m.skin")
264 264
 				{
265 265
 					$type = "skin";
266 266
 				}
267
-				if($type == "m.layout")
267
+				if ($type == "m.layout")
268 268
 				{
269 269
 					$type = "layout";
270 270
 				}
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 			$oSecurity = new Security();
277 277
 			$oSecurity->encodeHTML('installed..');
278 278
 
279
-			foreach($installed as $key => $val)
279
+			foreach ($installed as $key => $val)
280 280
 			{
281
-				foreach($depto[$key] as $package_srl)
281
+				foreach ($depto[$key] as $package_srl)
282 282
 				{
283 283
 					$item_list[$package_srl]->avail_remove = false;
284 284
 					$item_list[$package_srl]->deps[] = $key;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	function dispAutoinstallAdminInstalledPackages()
298 298
 	{
299 299
 		$page = Context::get('page');
300
-		if(!$page)
300
+		if (!$page)
301 301
 		{
302 302
 			$page = 1;
303 303
 		}
@@ -313,13 +313,13 @@  discard block
 block discarded – undo
313 313
 		$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
314 314
 		$xml_lUpdate = new XmlParser();
315 315
 		$xmlDoc = $xml_lUpdate->parse($buff);
316
-		if($xmlDoc && $xmlDoc->response->packagelist->item)
316
+		if ($xmlDoc && $xmlDoc->response->packagelist->item)
317 317
 		{
318 318
 			$item_list = $this->rearranges($xmlDoc->response->packagelist->item, $package_list);
319 319
 			$res = array();
320
-			foreach($package_list as $package_srl => $package)
320
+			foreach ($package_list as $package_srl => $package)
321 321
 			{
322
-				if($item_list[$package_srl])
322
+				if ($item_list[$package_srl])
323 323
 				{
324 324
 					$res[] = $item_list[$package_srl];
325 325
 				}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			Context::set('item_list', $res);
328 328
 		}
329 329
 
330
-		if(count($package_list) != count($res))
330
+		if (count($package_list) != count($res))
331 331
 		{
332 332
 			$localPackageSrls = array_keys($package_list);
333 333
 			$remotePackageSrls = array_keys($item_list);
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	function dispAutoinstallAdminInstall()
353 353
 	{
354 354
 		$package_srl = Context::get('package_srl');
355
-		if(!$package_srl)
355
+		if (!$package_srl)
356 356
 		{
357 357
 			return $this->dispAutoinstallAdminIndex();
358 358
 		}
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
 		Context::set("package", $package);
364 364
 		Context::set('contain_core', $package->contain_core);
365 365
 
366
-		if(!$_SESSION['ftp_password'])
366
+		if (!$_SESSION['ftp_password'])
367 367
 		{
368 368
 			Context::set('need_password', TRUE);
369 369
 		}
370 370
 
371 371
 		$output = $oAdminModel->checkUseDirectModuleInstall($package);
372
-		if($output->toBool()==TRUE)
372
+		if ($output->toBool() == TRUE)
373 373
 		{
374 374
 			Context::set('show_ftp_note', FALSE);
375 375
 		}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 		$oModuleModel = getModel('module');
392 392
 		$config = $oModuleModel->getModuleConfig('autoinstall');
393 393
 		$ftp_info = Context::getFTPInfo();
394
-		if(!$ftp_info->ftp_root_path)
394
+		if (!$ftp_info->ftp_root_path)
395 395
 		{
396 396
 			Context::set('show_ftp_note', TRUE);
397 397
 		}
@@ -406,21 +406,21 @@  discard block
 block discarded – undo
406 406
 		$lUpdateDoc = $xml_lUpdate->parse($buff);
407 407
 		$updateDate = $lUpdateDoc->response->updatedate->body;
408 408
 
409
-		if(!$updateDate)
409
+		if (!$updateDate)
410 410
 		{
411 411
 			return $this->stop('msg_connection_fail');
412 412
 		}
413 413
 
414 414
 		$oModel = getModel('autoinstall');
415 415
 		$item = $oModel->getLatestPackage();
416
-		if(!$item || $item->updatedate < $updateDate || count($this->categories) < 1)
416
+		if (!$item || $item->updatedate < $updateDate || count($this->categories) < 1)
417 417
 		{
418 418
 			$oController = getAdminController('autoinstall');
419 419
 			$oController->_updateinfo();
420 420
 
421
-			if(!$_SESSION['__XE_EASYINSTALL_REDIRECT__'])
421
+			if (!$_SESSION['__XE_EASYINSTALL_REDIRECT__'])
422 422
 			{
423
-				header('location: ' . getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminIndex'));
423
+				header('location: '.getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminIndex'));
424 424
 				$_SESSION['__XE_EASYINSTALL_REDIRECT__'] = TRUE;
425 425
 				return;
426 426
 			}
@@ -428,21 +428,21 @@  discard block
 block discarded – undo
428 428
 		unset($_SESSION['__XE_EASYINSTALL_REDIRECT__']);
429 429
 
430 430
 		$page = Context::get('page');
431
-		if(!$page)
431
+		if (!$page)
432 432
 		{
433 433
 			$page = 1;
434 434
 		}
435 435
 		Context::set('page', $page);
436 436
 
437 437
 		$order_type = Context::get('order_type');
438
-		if(!in_array($order_type, array('asc', 'desc')))
438
+		if (!in_array($order_type, array('asc', 'desc')))
439 439
 		{
440 440
 			$order_type = 'desc';
441 441
 		}
442 442
 		Context::set('order_type', $order_type);
443 443
 
444 444
 		$order_target = Context::get('order_target');
445
-		if(!in_array($order_target, array('newest', 'download', 'popular')))
445
+		if (!in_array($order_target, array('newest', 'download', 'popular')))
446 446
 		{
447 447
 			$order_target = 'newest';
448 448
 		}
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
 
453 453
 		$childrenList = Context::get('childrenList');
454 454
 		$category_srl = Context::get('category_srl');
455
-		if($childrenList)
455
+		if ($childrenList)
456 456
 		{
457 457
 			$params["category_srl"] = $childrenList;
458 458
 		}
459
-		else if($category_srl)
459
+		else if ($category_srl)
460 460
 		{
461 461
 			$params["category_srl"] = $category_srl;
462 462
 		}
@@ -465,12 +465,12 @@  discard block
 block discarded – undo
465 465
 		$params["order_target"] = $order_target;
466 466
 		$params["order_type"] = $order_type;
467 467
 		$params["page"] = $page;
468
-		if($search_keyword)
468
+		if ($search_keyword)
469 469
 		{
470 470
 			$params["search_keyword"] = $search_keyword;
471 471
 		}
472 472
 		$xmlDoc = XmlGenerater::getXmlDoc($params);
473
-		if($xmlDoc && $xmlDoc->response->packagelist->item)
473
+		if ($xmlDoc && $xmlDoc->response->packagelist->item)
474 474
 		{
475 475
 			$item_list = $this->rearranges($xmlDoc->response->packagelist->item);
476 476
 			Context::set('item_list', $item_list);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	function dispAutoinstallAdminUninstall()
505 505
 	{
506 506
 		$package_srl = Context::get('package_srl');
507
-		if(!$package_srl)
507
+		if (!$package_srl)
508 508
 		{
509 509
 			return $this->dispAutoinstallAdminIndex();
510 510
 		}
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
 		$oModel = getModel('autoinstall');
513 513
 		$oAdminModel = getAdminModel('autoinstall');
514 514
 		$installedPackage = $oModel->getInstalledPackage($package_srl);
515
-		if(!$installedPackage)
515
+		if (!$installedPackage)
516 516
 		{
517 517
 			return $this->dispAutoinstallAdminInstalledPackages();
518 518
 		}
519 519
 
520
-		if(!$_SESSION['ftp_password'])
520
+		if (!$_SESSION['ftp_password'])
521 521
 		{
522 522
 			Context::set('need_password', TRUE);
523 523
 		}
@@ -526,19 +526,19 @@  discard block
 block discarded – undo
526 526
 		$path = $installedPackage->path;
527 527
 		$type = $oModel->getTypeFromPath($path);
528 528
 
529
-		if(!$type || $type == "core")
529
+		if (!$type || $type == "core")
530 530
 		{
531 531
 			return $this->stop("msg_invalid_request");
532 532
 		}
533 533
 
534 534
 		$config_file = $oModel->getConfigFilePath($type);
535
-		if(!$config_file)
535
+		if (!$config_file)
536 536
 		{
537 537
 			return $this->stop("msg_invalid_request");
538 538
 		}
539 539
 
540 540
 		$output = $oAdminModel->checkUseDirectModuleInstall($installedPackage);
541
-		if($output->toBool()==TRUE)
541
+		if ($output->toBool() == TRUE)
542 542
 		{
543 543
 			Context::set('show_ftp_note', FALSE);
544 544
 		}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml");
551 551
 		$xml_lUpdate = new XmlParser();
552 552
 		$xmlDoc = $xml_lUpdate->parse($buff);
553
-		if($xmlDoc && $xmlDoc->response->packagelist->item)
553
+		if ($xmlDoc && $xmlDoc->response->packagelist->item)
554 554
 		{
555 555
 			$item_list = $this->rearranges($xmlDoc->response->packagelist->item);
556 556
 			$installedPackage->title = $item_list[$package_srl]->title;
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			$installedPackage->deps = $item_list[$package_srl]->deps;
560 560
 			Context::set('package', $installedPackage);
561 561
 			$this->setTemplateFile('uninstall');
562
-			Context::addJsFilter($this->module_path . 'tpl/filter', 'uninstall_package.xml');
562
+			Context::addJsFilter($this->module_path.'tpl/filter', 'uninstall_package.xml');
563 563
 
564 564
 			$security = new Security();
565 565
 			$security->encodeHTML('package.');
Please login to merge, or discard this patch.
modules/board/board.admin.model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
 	/**
23 23
 	 * Get the board module admin simple setting page
24
-	 * @return void
24
+	 * @return null|string
25 25
 	 */
26 26
 	public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl)
27 27
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl)
27 27
 	{
28
-		if(!$moduleSrl)
28
+		if (!$moduleSrl)
29 29
 		{
30 30
 			return;
31 31
 		}
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		$oModuleModel = getModel('module');
36 36
 		$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
37 37
 		$moduleInfo->use_status = explode('|@|', $moduleInfo->use_status);
38
-		if($moduleInfo)
38
+		if ($moduleInfo)
39 39
 		{
40 40
 			Context::set('module_info', $moduleInfo);
41 41
 		}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		Context::set('document_status_list', $documentStatusList);
47 47
 
48 48
 		// set order target list
49
-		foreach($this->order_target AS $key)
49
+		foreach ($this->order_target AS $key)
50 50
 		{
51 51
 			$order_target[$key] = Context::getLang($key);
52 52
 		}
Please login to merge, or discard this patch.