Completed
Push — developer ( 07972d...14e3b3 )
by Błażej
208:43 queued 165:33
created
libraries/htmlpurifier/library/HTMLPurifier/PropertyList.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -5,118 +5,118 @@
 block discarded – undo
5 5
  */
6 6
 class HTMLPurifier_PropertyList
7 7
 {
8
-    /**
9
-     * Internal data-structure for properties.
10
-     * @type array
11
-     */
12
-    protected $data = array();
8
+	/**
9
+	 * Internal data-structure for properties.
10
+	 * @type array
11
+	 */
12
+	protected $data = array();
13 13
 
14
-    /**
15
-     * Parent plist.
16
-     * @type HTMLPurifier_PropertyList
17
-     */
18
-    protected $parent;
14
+	/**
15
+	 * Parent plist.
16
+	 * @type HTMLPurifier_PropertyList
17
+	 */
18
+	protected $parent;
19 19
 
20
-    /**
21
-     * Cache.
22
-     * @type array
23
-     */
24
-    protected $cache;
20
+	/**
21
+	 * Cache.
22
+	 * @type array
23
+	 */
24
+	protected $cache;
25 25
 
26
-    /**
27
-     * @param HTMLPurifier_PropertyList $parent Parent plist
28
-     */
29
-    public function __construct($parent = null)
30
-    {
31
-        $this->parent = $parent;
32
-    }
26
+	/**
27
+	 * @param HTMLPurifier_PropertyList $parent Parent plist
28
+	 */
29
+	public function __construct($parent = null)
30
+	{
31
+		$this->parent = $parent;
32
+	}
33 33
 
34
-    /**
35
-     * Recursively retrieves the value for a key
36
-     * @param string $name
37
-     * @throws HTMLPurifier_Exception
38
-     */
39
-    public function get($name)
40
-    {
41
-        if ($this->has($name)) {
42
-            return $this->data[$name];
43
-        }
44
-        // possible performance bottleneck, convert to iterative if necessary
45
-        if ($this->parent) {
46
-            return $this->parent->get($name);
47
-        }
48
-        throw new HTMLPurifier_Exception("Key '$name' not found");
49
-    }
34
+	/**
35
+	 * Recursively retrieves the value for a key
36
+	 * @param string $name
37
+	 * @throws HTMLPurifier_Exception
38
+	 */
39
+	public function get($name)
40
+	{
41
+		if ($this->has($name)) {
42
+			return $this->data[$name];
43
+		}
44
+		// possible performance bottleneck, convert to iterative if necessary
45
+		if ($this->parent) {
46
+			return $this->parent->get($name);
47
+		}
48
+		throw new HTMLPurifier_Exception("Key '$name' not found");
49
+	}
50 50
 
51
-    /**
52
-     * Sets the value of a key, for this plist
53
-     * @param string $name
54
-     * @param mixed $value
55
-     */
56
-    public function set($name, $value)
57
-    {
58
-        $this->data[$name] = $value;
59
-    }
51
+	/**
52
+	 * Sets the value of a key, for this plist
53
+	 * @param string $name
54
+	 * @param mixed $value
55
+	 */
56
+	public function set($name, $value)
57
+	{
58
+		$this->data[$name] = $value;
59
+	}
60 60
 
61
-    /**
62
-     * Returns true if a given key exists
63
-     * @param string $name
64
-     * @return bool
65
-     */
66
-    public function has($name)
67
-    {
68
-        return array_key_exists($name, $this->data);
69
-    }
61
+	/**
62
+	 * Returns true if a given key exists
63
+	 * @param string $name
64
+	 * @return bool
65
+	 */
66
+	public function has($name)
67
+	{
68
+		return array_key_exists($name, $this->data);
69
+	}
70 70
 
71
-    /**
72
-     * Resets a value to the value of it's parent, usually the default. If
73
-     * no value is specified, the entire plist is reset.
74
-     * @param string $name
75
-     */
76
-    public function reset($name = null)
77
-    {
78
-        if ($name === null) {
79
-            $this->data = array();
80
-        } else {
81
-            unset($this->data[$name]);
82
-        }
83
-    }
71
+	/**
72
+	 * Resets a value to the value of it's parent, usually the default. If
73
+	 * no value is specified, the entire plist is reset.
74
+	 * @param string $name
75
+	 */
76
+	public function reset($name = null)
77
+	{
78
+		if ($name === null) {
79
+			$this->data = array();
80
+		} else {
81
+			unset($this->data[$name]);
82
+		}
83
+	}
84 84
 
85
-    /**
86
-     * Squashes this property list and all of its property lists into a single
87
-     * array, and returns the array. This value is cached by default.
88
-     * @param bool $force If true, ignores the cache and regenerates the array.
89
-     * @return array
90
-     */
91
-    public function squash($force = false)
92
-    {
93
-        if ($this->cache !== null && !$force) {
94
-            return $this->cache;
95
-        }
96
-        if ($this->parent) {
97
-            return $this->cache = array_merge($this->parent->squash($force), $this->data);
98
-        } else {
99
-            return $this->cache = $this->data;
100
-        }
101
-    }
85
+	/**
86
+	 * Squashes this property list and all of its property lists into a single
87
+	 * array, and returns the array. This value is cached by default.
88
+	 * @param bool $force If true, ignores the cache and regenerates the array.
89
+	 * @return array
90
+	 */
91
+	public function squash($force = false)
92
+	{
93
+		if ($this->cache !== null && !$force) {
94
+			return $this->cache;
95
+		}
96
+		if ($this->parent) {
97
+			return $this->cache = array_merge($this->parent->squash($force), $this->data);
98
+		} else {
99
+			return $this->cache = $this->data;
100
+		}
101
+	}
102 102
 
103
-    /**
104
-     * Returns the parent plist.
105
-     * @return HTMLPurifier_PropertyList
106
-     */
107
-    public function getParent()
108
-    {
109
-        return $this->parent;
110
-    }
103
+	/**
104
+	 * Returns the parent plist.
105
+	 * @return HTMLPurifier_PropertyList
106
+	 */
107
+	public function getParent()
108
+	{
109
+		return $this->parent;
110
+	}
111 111
 
112
-    /**
113
-     * Sets the parent plist.
114
-     * @param HTMLPurifier_PropertyList $plist Parent plist
115
-     */
116
-    public function setParent($plist)
117
-    {
118
-        $this->parent = $plist;
119
-    }
112
+	/**
113
+	 * Sets the parent plist.
114
+	 * @param HTMLPurifier_PropertyList $plist Parent plist
115
+	 */
116
+	public function setParent($plist)
117
+	{
118
+		$this->parent = $plist;
119
+	}
120 120
 }
121 121
 
122 122
 // vim: et sw=4 sts=4
Please login to merge, or discard this patch.
libraries/antlr/ANTLRStringStream.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 			$this->markDepth = 0;
29 29
 		}
30 30
 
31
-	    public function consume() {
32
-	        if ( $this->p < $this->n ) {
31
+		public function consume() {
32
+			if ( $this->p < $this->n ) {
33 33
 				$this->charPositionInLine++;
34 34
 				if ( $this->data[$this->p]==ord("\n") ) {
35 35
 					$this->line++;
36 36
 					$this->charPositionInLine=0;
37 37
 				}
38
-	            $this->p++;
39
-	        }
40
-	    }
38
+				$this->p++;
39
+			}
40
+		}
41 41
 
42
-	    public function LA($i) {
42
+		public function LA($i) {
43 43
 			if ( $i==0 ) {
44 44
 				return 0; // undefined
45 45
 			}
@@ -51,36 +51,36 @@  discard block
 block discarded – undo
51 51
 			}
52 52
 
53 53
 			if ( ($this->p+$i-1) >= $this->n ) {
54
-	            //System.out.println("char LA("+i+")=EOF; p="+p);
55
-	            return CharStreamConst::$EOF;
56
-	        }
57
-	        //System.out.println("char LA("+i+")="+(char)data[p+i-1]+"; p="+p);
54
+				//System.out.println("char LA("+i+")=EOF; p="+p);
55
+				return CharStreamConst::$EOF;
56
+			}
57
+			//System.out.println("char LA("+i+")="+(char)data[p+i-1]+"; p="+p);
58 58
 			//System.out.println("LA("+i+"); p="+p+" n="+n+" data.length="+data.length);
59 59
 			return $this->data[$this->p+$i-1];
60
-	    }
60
+		}
61 61
 
62 62
 		public function LT($i) {
63 63
 			return $this->LA($i);
64 64
 		}
65 65
 
66 66
 		/** Return the current input symbol index 0..n where n indicates the
67
-	     *  last symbol has been read.  The index is the index of char to
67
+		 *  last symbol has been read.  The index is the index of char to
68 68
 		 *  be returned from LA(1).
69
-	     */
70
-	    public function index() {
71
-	        return $this->p;
72
-	    }
69
+		 */
70
+		public function index() {
71
+			return $this->p;
72
+		}
73 73
 
74 74
 		public function size() {
75 75
 			return $this->n;
76 76
 		}
77 77
 
78 78
 		public function mark() {
79
-	        if ( $this->markers === null) {
80
-	            $this->markers = array();
81
-	            $this->markers[] = null; // depth 0 means no backtracking, leave blank
82
-	        }
83
-	        $this->markDepth++;
79
+			if ( $this->markers === null) {
80
+				$this->markers = array();
81
+				$this->markers[] = null; // depth 0 means no backtracking, leave blank
82
+			}
83
+			$this->markDepth++;
84 84
 			$state = null;
85 85
 			if ($this->markDepth>=sizeof($this->markers)) {
86 86
 				$state = new CharStreamState();
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 			$state->charPositionInLine = $this->charPositionInLine;
95 95
 			$this->lastMarker = $this->markDepth;
96 96
 			return $this->markDepth;
97
-	    }
97
+		}
98 98
 
99
-	    public function rewind($m=null) {
99
+		public function rewind($m=null) {
100 100
 			if($m===null){
101 101
 				$this->rewind((int)$this->lastMarker);
102 102
 			}else{
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 
6 6
 		/** Copy data in string to a local char array */
7 7
 		public function __construct($input) {
8
-			$this->p=0;
8
+			$this->p = 0;
9 9
 			$this->line = 1;
10 10
 			$this->charPositionInLine = 0;
11 11
 			$this->markDepth = 0;
12 12
 			$this->markers = null;
13
-			$this->lastMarker=0;
14
-			$this->name=null;
13
+			$this->lastMarker = 0;
14
+			$this->name = null;
15 15
 			
16 16
 			$this->data = strToIntArray($input);
17 17
 			$this->n = strlen($input);
@@ -29,34 +29,34 @@  discard block
 block discarded – undo
29 29
 		}
30 30
 
31 31
 	    public function consume() {
32
-	        if ( $this->p < $this->n ) {
32
+	        if ($this->p < $this->n) {
33 33
 				$this->charPositionInLine++;
34
-				if ( $this->data[$this->p]==ord("\n") ) {
34
+				if ($this->data[$this->p] == ord("\n")) {
35 35
 					$this->line++;
36
-					$this->charPositionInLine=0;
36
+					$this->charPositionInLine = 0;
37 37
 				}
38 38
 	            $this->p++;
39 39
 	        }
40 40
 	    }
41 41
 
42 42
 	    public function LA($i) {
43
-			if ( $i==0 ) {
43
+			if ($i == 0) {
44 44
 				return 0; // undefined
45 45
 			}
46
-			if ( $i<0 ) {
46
+			if ($i < 0) {
47 47
 				$i++; // e.g., translate LA(-1) to use offset i=0; then data[p+0-1]
48
-				if ( ($this->p+$i-1) < 0 ) {
48
+				if (($this->p + $i - 1) < 0) {
49 49
 					return CharStreamConst::$EOF; // invalid; no char before first char
50 50
 				}
51 51
 			}
52 52
 
53
-			if ( ($this->p+$i-1) >= $this->n ) {
53
+			if (($this->p + $i - 1) >= $this->n) {
54 54
 	            //System.out.println("char LA("+i+")=EOF; p="+p);
55 55
 	            return CharStreamConst::$EOF;
56 56
 	        }
57 57
 	        //System.out.println("char LA("+i+")="+(char)data[p+i-1]+"; p="+p);
58 58
 			//System.out.println("LA("+i+"); p="+p+" n="+n+" data.length="+data.length);
59
-			return $this->data[$this->p+$i-1];
59
+			return $this->data[$this->p + $i - 1];
60 60
 	    }
61 61
 
62 62
 		public function LT($i) {
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 		}
77 77
 
78 78
 		public function mark() {
79
-	        if ( $this->markers === null) {
79
+	        if ($this->markers === null) {
80 80
 	            $this->markers = array();
81 81
 	            $this->markers[] = null; // depth 0 means no backtracking, leave blank
82 82
 	        }
83 83
 	        $this->markDepth++;
84 84
 			$state = null;
85
-			if ($this->markDepth>=sizeof($this->markers)) {
85
+			if ($this->markDepth >= sizeof($this->markers)) {
86 86
 				$state = new CharStreamState();
87 87
 				$this->markers[] = $state;
88 88
 			}
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 			return $this->markDepth;
97 97
 	    }
98 98
 
99
-	    public function rewind($m=null) {
100
-			if($m===null){
101
-				$this->rewind((int)$this->lastMarker);
102
-			}else{
99
+	    public function rewind($m = null) {
100
+			if ($m === null) {
101
+				$this->rewind((int) $this->lastMarker);
102
+			} else {
103 103
 				$state = $this->markers[$m];
104 104
 				// restore stream state
105 105
 				$this->seek($state->p);
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
 		 *  update line and charPositionInLine.
121 121
 		 */
122 122
 		public function seek($index) {
123
-			if ( $index<=$this->p ) {
123
+			if ($index <= $this->p) {
124 124
 				$this->p = $index; // just jump; don't update stream state (line, ...)
125 125
 				return;
126 126
 			}
127 127
 			// seek forward, consume until p hits index
128
-			while ( $this->p<$index ) {
128
+			while ($this->p < $index) {
129 129
 				$this->consume();
130 130
 			}
131 131
 		}
132 132
 
133 133
 		public function substring($start, $stop) {
134
-			return implode(array_map('chr', array_slice($this->data, $start, $stop-$start+1)));
134
+			return implode(array_map('chr', array_slice($this->data, $start, $stop - $start + 1)));
135 135
 		}
136 136
 
137 137
 		public function getLine() {
Please login to merge, or discard this patch.
include/runtime/Viewer.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 	protected function log($message, $delimiter = '\n')
30 30
 	{
31 31
 		static $file = null;
32
-		if ($file === null)
33
-			$file = dirname(__FILE__) . '/../../cache/logs/viewer-debug.log';
32
+		if ($file === null) {
33
+					$file = dirname(__FILE__) . '/../../cache/logs/viewer-debug.log';
34
+		}
34 35
 		if (self::$debugViewer) {
35 36
 			file_put_contents($file, $message . $delimiter, FILE_APPEND);
36 37
 		}
@@ -177,10 +178,11 @@  discard block
 block discarded – undo
177 178
 			foreach ($this->tpl_vars as $key => $smarty_variable) {
178 179
 				// Determine type of value being pased.
179 180
 				$valueType = 'literal';
180
-				if (is_object($smarty_variable->value))
181
-					$valueType = get_class($smarty_variable->value);
182
-				else if (is_array($smarty_variable->value))
183
-					$valueType = 'array';
181
+				if (is_object($smarty_variable->value)) {
182
+									$valueType = get_class($smarty_variable->value);
183
+				} else if (is_array($smarty_variable->value)) {
184
+									$valueType = 'array';
185
+				}
184 186
 				$this->log(sprintf("DATA: %s, TYPE: %s", $key, $valueType));
185 187
 			}
186 188
 		}
Please login to merge, or discard this patch.
include/CRMEntity.php 1 patch
Braces   +157 added lines, -114 removed lines patch added patch discarded remove patch
@@ -169,8 +169,9 @@  discard block
 block discarded – undo
169 169
 
170 170
 		//to get the owner id
171 171
 		$ownerid = $this->column_fields['assigned_user_id'];
172
-		if (!isset($ownerid) || $ownerid == '')
173
-			$ownerid = $current_user->id;
172
+		if (!isset($ownerid) || $ownerid == '') {
173
+					$ownerid = $current_user->id;
174
+		}
174 175
 
175 176
 		if (isset($file_details['original_name']) && $file_details['original_name'] != null) {
176 177
 			$file_name = $file_details['original_name'];
@@ -337,16 +338,18 @@  discard block
 block discarded – undo
337 338
 			} else {
338 339
 				$this->id = $this->newRecord;
339 340
 			}
340
-			if (empty($currentUser->id))
341
-				$currentUser->id = 0;
341
+			if (empty($currentUser->id)) {
342
+							$currentUser->id = 0;
343
+			}
342 344
 
343 345
 			// Customization
344 346
 			$created_date_var = $adb->formatDate($date_var, true);
345 347
 			$modified_date_var = $adb->formatDate($date_var, true);
346 348
 			// Preserve the timestamp
347 349
 			if (self::isBulkSaveMode()) {
348
-				if (!empty($this->column_fields['createdtime']))
349
-					$created_date_var = $adb->formatDate($this->column_fields['createdtime'], true);
350
+				if (!empty($this->column_fields['createdtime'])) {
351
+									$created_date_var = $adb->formatDate($this->column_fields['createdtime'], true);
352
+				}
350 353
 				//NOTE : modifiedtime ignored to support vtws_sync API track changes.
351 354
 			}
352 355
 			// END
@@ -376,10 +379,11 @@  discard block
 block discarded – undo
376 379
 	private function resolve_query_result_value($result, $index, $columnname)
377 380
 	{
378 381
 		$adb = PearDatabase::getInstance();
379
-		if (is_array($result))
380
-			return $result[$index][$columnname];
381
-		else
382
-			return $adb->query_result($result, $index, $columnname);
382
+		if (is_array($result)) {
383
+					return $result[$index][$columnname];
384
+		} else {
385
+					return $adb->query_result($result, $index, $columnname);
386
+		}
383 387
 	}
384 388
 
385 389
 	/** Function to insert values in the specifed table for the specified module
@@ -595,10 +599,10 @@  discard block
 block discarded – undo
595 599
 				} else {
596 600
 					$fldvalue = $this->column_fields[$fieldname];
597 601
 				}
598
-				if ($uitype != 33 && $uitype != 8)
599
-					$fldvalue = \vtlib\Functions::fromHTML($fldvalue, ($insertion_mode == 'edit') ? true : false);
600
-			}
601
-			else {
602
+				if ($uitype != 33 && $uitype != 8) {
603
+									$fldvalue = \vtlib\Functions::fromHTML($fldvalue, ($insertion_mode == 'edit') ? true : false);
604
+				}
605
+			} else {
602 606
 				$fldvalue = '';
603 607
 			}
604 608
 
@@ -656,8 +660,9 @@  discard block
 block discarded – undo
656 660
 		$query1 = "select * from vtiger_seattachmentsrel where crmid=?";
657 661
 		$result = $adb->pquery($query1, array($notesid));
658 662
 		$noofrows = $adb->num_rows($result);
659
-		if ($noofrows != 0)
660
-			$attachmentid = $adb->query_result($result, 0, 'attachmentsid');
663
+		if ($noofrows != 0) {
664
+					$attachmentid = $adb->query_result($result, 0, 'attachmentsid');
665
+		}
661 666
 		if ($attachmentid != '') {
662 667
 			$query2 = "select * from vtiger_attachments where attachmentsid=?";
663 668
 			$filename = $adb->query_result($adb->pquery($query2, array($attachmentid)), 0, 'name');
@@ -708,10 +713,11 @@  discard block
 block discarded – undo
708 713
 		// Lookup module field cache
709 714
 		if ($module == 'Calendar' || $module == 'Events') {
710 715
 			getColumnFields('Calendar');
711
-			if (VTCacheUtils::lookupFieldInfo_Module('Events'))
712
-				$cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
713
-			else
714
-				$cachedEventsFields = [];
716
+			if (VTCacheUtils::lookupFieldInfo_Module('Events')) {
717
+							$cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
718
+			} else {
719
+							$cachedEventsFields = [];
720
+			}
715 721
 			$cachedCalendarFields = VTCacheUtils::lookupFieldInfo_Module('Calendar');
716 722
 			$cachedModuleFields = array_merge($cachedEventsFields, $cachedCalendarFields);
717 723
 			$module = 'Calendar';
@@ -856,10 +862,11 @@  discard block
 block discarded – undo
856 862
 			while ($row = $this->db->fetchByAssoc($result)) {
857 863
 				$rowid = $row[$this->table_index];
858 864
 
859
-				if (isset($rowid))
860
-					$this->retrieve_entity_info($rowid, $this->module_name);
861
-				else
862
-					$this->db->println("rowid not set unable to retrieve");
865
+				if (isset($rowid)) {
866
+									$this->retrieve_entity_info($rowid, $this->module_name);
867
+				} else {
868
+									$this->db->println("rowid not set unable to retrieve");
869
+				}
863 870
 
864 871
 
865 872
 
@@ -872,10 +879,11 @@  discard block
 block discarded – undo
872 879
 			}
873 880
 		}
874 881
 
875
-		if (isset($list))
876
-			return $list;
877
-		else
878
-			return null;
882
+		if (isset($list)) {
883
+					return $list;
884
+		} else {
885
+					return null;
886
+		}
879 887
 	}
880 888
 
881 889
 	/** This function should be overridden in each module.  It marks an item as deleted.
@@ -1045,19 +1053,22 @@  discard block
 block discarded – undo
1045 1053
 		require_once('include/utils/UserInfoUtil.php');
1046 1054
 		foreach ($this->column_fields as $fieldname => $fieldvalue) {
1047 1055
 			$reset_value = false;
1048
-			if (getFieldVisibilityPermission($moduleName, $current_user->id, $fieldname) != '0')
1049
-				$reset_value = true;
1056
+			if (getFieldVisibilityPermission($moduleName, $current_user->id, $fieldname) != '0') {
1057
+							$reset_value = true;
1058
+			}
1050 1059
 
1051
-			if ($fieldname == "record_id" || $fieldname == "record_module")
1052
-				$reset_value = false;
1060
+			if ($fieldname == "record_id" || $fieldname == "record_module") {
1061
+							$reset_value = false;
1062
+			}
1053 1063
 
1054 1064
 			/*
1055 1065
 			  if (isset($this->additional_column_fields) && in_array($fieldname, $this->additional_column_fields) === true)
1056 1066
 			  $reset_value = false;
1057 1067
 			 */
1058 1068
 
1059
-			if ($reset_value === true)
1060
-				$this->column_fields[$fieldname] = "";
1069
+			if ($reset_value === true) {
1070
+							$this->column_fields[$fieldname] = "";
1071
+			}
1061 1072
 		}
1062 1073
 	}
1063 1074
 
@@ -1103,8 +1114,9 @@  discard block
 block discarded – undo
1103 1114
 		}
1104 1115
 
1105 1116
 		foreach ($colf as $key => $value) {
1106
-			if (getFieldVisibilityPermission($module, $current_user->id, $key, 'readwrite') == '0')
1107
-				$this->importable_fields[$key] = $value;
1117
+			if (getFieldVisibilityPermission($module, $current_user->id, $key, 'readwrite') == '0') {
1118
+							$this->importable_fields[$key] = $value;
1119
+			}
1108 1120
 		}
1109 1121
 	}
1110 1122
 
@@ -1354,13 +1366,15 @@  discard block
 block discarded – undo
1354 1366
 		$num_rows = $adb->num_rows($result);
1355 1367
 		for ($i = 0; $i < $num_rows; $i++) {
1356 1368
 			$columnname = $adb->query_result($result, $i, 'columnname');
1357
-			if (in_array($columnname, $this->sortby_fields))
1358
-				continue;
1359
-			else
1360
-				$this->sortby_fields[] = $columnname;
1369
+			if (in_array($columnname, $this->sortby_fields)) {
1370
+							continue;
1371
+			} else {
1372
+							$this->sortby_fields[] = $columnname;
1373
+			}
1374
+		}
1375
+		if ($tabid == 21 || $tabid == 22) {
1376
+					$this->sortby_fields[] = 'crmid';
1361 1377
 		}
1362
-		if ($tabid == 21 || $tabid == 22)
1363
-			$this->sortby_fields[] = 'crmid';
1364 1378
 		$log->debug("Exiting initSortByField");
1365 1379
 	}
1366 1380
 	/* Function to check if the mod number already exits */
@@ -1370,10 +1384,11 @@  discard block
 block discarded – undo
1370 1384
 		$adb = PearDatabase::getInstance();
1371 1385
 		$result = $adb->pquery(sprintf("SELECT %s FROM *s WHERE %s = ?", $adb->sql_escape_string($column), $adb->sql_escape_string($table), $adb->sql_escape_string($column)), [$no]);
1372 1386
 		$num_rows = $adb->num_rows($result);
1373
-		if ($num_rows > 0)
1374
-			return true;
1375
-		else
1376
-			return false;
1387
+		if ($num_rows > 0) {
1388
+					return true;
1389
+		} else {
1390
+					return false;
1391
+		}
1377 1392
 	}
1378 1393
 
1379 1394
 	// END
@@ -1386,8 +1401,9 @@  discard block
 block discarded – undo
1386 1401
 
1387 1402
 		vtlib_setup_modulevars($module, $this);
1388 1403
 		$tabid = \includes\Modules::getModuleId($module);
1389
-		if (!\includes\fields\RecordNumber::isModuleSequenceConfigured($tabid))
1390
-			return;
1404
+		if (!\includes\fields\RecordNumber::isModuleSequenceConfigured($tabid)) {
1405
+					return;
1406
+		}
1391 1407
 		$fieldinfo = $adb->pquery("SELECT * FROM vtiger_field WHERE tabid = ? && uitype = 4", Array($tabid));
1392 1408
 
1393 1409
 		$returninfo = [];
@@ -1441,8 +1457,9 @@  discard block
 block discarded – undo
1441 1457
 		$singular_modname = vtlib_toSingular($related_module);
1442 1458
 		$button = '';
1443 1459
 		if ($actions) {
1444
-			if (is_string($actions))
1445
-				$actions = explode(',', strtoupper($actions));
1460
+			if (is_string($actions)) {
1461
+							$actions = explode(',', strtoupper($actions));
1462
+			}
1446 1463
 			if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
1447 1464
 				$button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'>&nbsp;";
1448 1465
 			}
@@ -1455,10 +1472,11 @@  discard block
 block discarded – undo
1455 1472
 		}
1456 1473
 
1457 1474
 		// To make the edit or del link actions to return back to same view.
1458
-		if ($singlepane_view == 'true')
1459
-			$returnset = "&return_module=$this_module&return_action=DetailView&return_id=$id";
1460
-		else
1461
-			$returnset = "&return_module=$this_module&return_action=CallRelatedList&return_id=$id";
1475
+		if ($singlepane_view == 'true') {
1476
+					$returnset = "&return_module=$this_module&return_action=DetailView&return_id=$id";
1477
+		} else {
1478
+					$returnset = "&return_module=$this_module&return_action=CallRelatedList&return_id=$id";
1479
+		}
1462 1480
 
1463 1481
 		$userNameSql = \vtlib\Deprecated::getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name',
1464 1482
 				'last_name' => 'vtiger_users.last_name'), 'Users');
@@ -1480,8 +1498,9 @@  discard block
 block discarded – undo
1480 1498
 
1481 1499
 		$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
1482 1500
 
1483
-		if ($return_value === null)
1484
-			$return_value = [];
1501
+		if ($return_value === null) {
1502
+					$return_value = [];
1503
+		}
1485 1504
 		$return_value['CUSTOM_BUTTON'] = $button;
1486 1505
 		return $return_value;
1487 1506
 	}
@@ -1513,8 +1532,9 @@  discard block
 block discarded – undo
1513 1532
 				return true;
1514 1533
 			} else if ($lastviewed && $modifiedon) {
1515 1534
 				/** Lastviewed and Modified time is available. */
1516
-				if ($this->__timediff($modifiedon, $lastviewed) > 0)
1517
-					return true;
1535
+				if ($this->__timediff($modifiedon, $lastviewed) > 0) {
1536
+									return true;
1537
+				}
1518 1538
 			}
1519 1539
 		}
1520 1540
 		return false;
@@ -1534,8 +1554,9 @@  discard block
 block discarded – undo
1534 1554
 
1535 1555
 		$t2 = mktime($t2_h, $t2_i, $t2_s, $t2_m, $t2_d, $t2_y);
1536 1556
 
1537
-		if ($t1 == $t2)
1538
-			return 0;
1557
+		if ($t1 == $t2) {
1558
+					return 0;
1559
+		}
1539 1560
 		return $t2 - $t1;
1540 1561
 	}
1541 1562
 
@@ -1555,8 +1576,9 @@  discard block
 block discarded – undo
1555 1576
 	 */
1556 1577
 	public function save_related_module($module, $crmid, $withModule, $withCrmid, $relatedName = false)
1557 1578
 	{
1558
-		if (!is_array($withCrmid))
1559
-			$withCrmid = [$withCrmid];
1579
+		if (!is_array($withCrmid)) {
1580
+					$withCrmid = [$withCrmid];
1581
+		}
1560 1582
 		switch ($relatedName) {
1561 1583
 			case 'get_many_to_many':
1562 1584
 				$this->saveRelatedM2M($module, $crmid, $withModule, $withCrmid);
@@ -1577,8 +1599,9 @@  discard block
 block discarded – undo
1577 1599
 		foreach ($withCrmid as $relcrmid) {
1578 1600
 			$check = $db->pquery(sprintf('SELECT 1 FROM `%s` WHERE %s = ? && %s = ?', $referenceInfo['table'], $referenceInfo['base'], $referenceInfo['rel']), [$relcrmid, $crmid]);
1579 1601
 			// Relation already exists? No need to add again
1580
-			if ($check && $db->getRowCount($check))
1581
-				continue;
1602
+			if ($check && $db->getRowCount($check)) {
1603
+							continue;
1604
+			}
1582 1605
 			$db->insert($referenceInfo['table'], [
1583 1606
 				$referenceInfo['base'] => $relcrmid,
1584 1607
 				$referenceInfo['rel'] => $crmid
@@ -1594,8 +1617,9 @@  discard block
 block discarded – undo
1594 1617
 			if ($withModule == 'Documents') {
1595 1618
 				$checkpresence = $db->pquery('SELECT crmid FROM vtiger_senotesrel WHERE crmid = ? && notesid = ?', [$crmid, $relcrmid]);
1596 1619
 				// Relation already exists? No need to add again
1597
-				if ($checkpresence && $db->getRowCount($checkpresence))
1598
-					continue;
1620
+				if ($checkpresence && $db->getRowCount($checkpresence)) {
1621
+									continue;
1622
+				}
1599 1623
 
1600 1624
 				$db->insert('vtiger_senotesrel', [
1601 1625
 					'crmid' => $crmid,
@@ -1605,8 +1629,9 @@  discard block
 block discarded – undo
1605 1629
 				$checkpresence = $db->pquery('SELECT crmid FROM vtiger_crmentityrel WHERE crmid = ? && module = ? && relcrmid = ? && relmodule = ?', [$crmid, $module, $relcrmid, $withModule]
1606 1630
 				);
1607 1631
 				// Relation already exists? No need to add again
1608
-				if ($checkpresence && $db->getRowCount($checkpresence))
1609
-					continue;
1632
+				if ($checkpresence && $db->getRowCount($checkpresence)) {
1633
+									continue;
1634
+				}
1610 1635
 
1611 1636
 				$db->insert('vtiger_crmentityrel', [
1612 1637
 					'crmid' => $crmid,
@@ -1630,8 +1655,9 @@  discard block
 block discarded – undo
1630 1655
 	public function delete_related_module($module, $crmid, $withModule, $withCrmid)
1631 1656
 	{
1632 1657
 		$db = PearDatabase::getInstance();
1633
-		if (!is_array($withCrmid))
1634
-			$withCrmid = Array($withCrmid);
1658
+		if (!is_array($withCrmid)) {
1659
+					$withCrmid = Array($withCrmid);
1660
+		}
1635 1661
 		foreach ($withCrmid as $relcrmid) {
1636 1662
 
1637 1663
 			if ($withModule == 'Documents') {
@@ -1665,8 +1691,9 @@  discard block
 block discarded – undo
1665 1691
 
1666 1692
 		$button = '';
1667 1693
 		if ($actions) {
1668
-			if (is_string($actions))
1669
-				$actions = explode(',', strtoupper($actions));
1694
+			if (is_string($actions)) {
1695
+							$actions = explode(',', strtoupper($actions));
1696
+			}
1670 1697
 			if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
1671 1698
 				$button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' " .
1672 1699
 					" type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$current_module&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\"" .
@@ -1681,10 +1708,11 @@  discard block
 block discarded – undo
1681 1708
 		}
1682 1709
 
1683 1710
 		// To make the edit or del link actions to return back to same view.
1684
-		if ($singlepane_view == 'true')
1685
-			$returnset = "&return_module=$current_module&return_action=DetailView&return_id=$id";
1686
-		else
1687
-			$returnset = "&return_module=$current_module&return_action=CallRelatedList&return_id=$id";
1711
+		if ($singlepane_view == 'true') {
1712
+					$returnset = "&return_module=$current_module&return_action=DetailView&return_id=$id";
1713
+		} else {
1714
+					$returnset = "&return_module=$current_module&return_action=CallRelatedList&return_id=$id";
1715
+		}
1688 1716
 
1689 1717
 		$query = "SELECT vtiger_crmentity.*, $other->table_name.*";
1690 1718
 
@@ -1698,10 +1726,12 @@  discard block
 block discarded – undo
1698 1726
 				$query .= ", $tname.*";
1699 1727
 
1700 1728
 				// Setup the default JOIN conditions if not specified
1701
-				if (empty($relmap[1]))
1702
-					$relmap[1] = $other->table_name;
1703
-				if (empty($relmap[2]))
1704
-					$relmap[2] = $relmap[0];
1729
+				if (empty($relmap[1])) {
1730
+									$relmap[1] = $other->table_name;
1731
+				}
1732
+				if (empty($relmap[2])) {
1733
+									$relmap[2] = $relmap[0];
1734
+				}
1705 1735
 				$more_relation .= " LEFT JOIN $tname ON $tname.$relmap[0] = $relmap[1].$relmap[2]";
1706 1736
 			}
1707 1737
 		}
@@ -1715,8 +1745,9 @@  discard block
 block discarded – undo
1715 1745
 		$query .= " WHERE vtiger_crmentity.deleted = 0 && (vtiger_crmentityrel.crmid = $id || vtiger_crmentityrel.relcrmid = $id)";
1716 1746
 		$return_value = GetRelatedList($current_module, $related_module, $other, $query, $button, $returnset);
1717 1747
 
1718
-		if ($return_value === null)
1719
-			$return_value = [];
1748
+		if ($return_value === null) {
1749
+					$return_value = [];
1750
+		}
1720 1751
 		$return_value['CUSTOM_BUTTON'] = $button;
1721 1752
 
1722 1753
 		return $return_value;
@@ -1749,10 +1780,11 @@  discard block
 block discarded – undo
1749 1780
 		$row = [];
1750 1781
 
1751 1782
 		// To make the edit or del link actions to return back to same view.
1752
-		if ($singlepane_view == 'true')
1753
-			$returnset = "&return_module=$currentModule&return_action=DetailView&return_id=$id";
1754
-		else
1755
-			$returnset = "&return_module=$currentModule&return_action=CallRelatedList&return_id=$id";
1783
+		if ($singlepane_view == 'true') {
1784
+					$returnset = "&return_module=$currentModule&return_action=DetailView&return_id=$id";
1785
+		} else {
1786
+					$returnset = "&return_module=$currentModule&return_action=CallRelatedList&return_id=$id";
1787
+		}
1756 1788
 
1757 1789
 		$return_value = null;
1758 1790
 
@@ -1783,8 +1815,9 @@  discard block
 block discarded – undo
1783 1815
 			$button .= '<input type="hidden" name="' . $dependentColumn . '" id="' . $dependentColumn . '" value="' . $id . '">';
1784 1816
 			$button .= '<input type="hidden" name="' . $dependentColumn . '_type" id="' . $dependentColumn . '_type" value="' . $currentModule . '">';
1785 1817
 			if ($actions) {
1786
-				if (is_string($actions))
1787
-					$actions = explode(',', strtoupper($actions));
1818
+				if (is_string($actions)) {
1819
+									$actions = explode(',', strtoupper($actions));
1820
+				}
1788 1821
 				if (in_array('ADD', $actions) && isPermitted($relatedModule, 1, '') == 'yes' && getFieldVisibilityPermission($relatedModule, $current_user->id, $dependentField, 'readwrite') == '0') {
1789 1822
 					$button .= "<input title='" . \includes\Language::translate('LBL_ADD_NEW') . " " . \includes\Language::translate($singular_modname, $relatedModule) . "' class='crmbutton small create'" .
1790 1823
 						" onclick='this.form.action.value=\"EditView\";this.form.module.value=\"$relatedModule\"' type='submit' name='button'" .
@@ -1794,8 +1827,9 @@  discard block
 block discarded – undo
1794 1827
 			$query = $this->createDependentQuery($other, $row, $id);
1795 1828
 			$return_value = GetRelatedList($currentModule, $relatedModule, $other, $query, $button, $returnset);
1796 1829
 		}
1797
-		if ($return_value === null)
1798
-			$return_value = [];
1830
+		if ($return_value === null) {
1831
+					$return_value = [];
1832
+		}
1799 1833
 		$return_value['CUSTOM_BUTTON'] = $button;
1800 1834
 
1801 1835
 		return $return_value;
@@ -1823,10 +1857,12 @@  discard block
 block discarded – undo
1823 1857
 					continue;
1824 1858
 				}
1825 1859
 				// Setup the default JOIN conditions if not specified
1826
-				if (empty($relmap[1]))
1827
-					$relmap[1] = $other->table_name;
1828
-				if (empty($relmap[2]))
1829
-					$relmap[2] = $relmap[0];
1860
+				if (empty($relmap[1])) {
1861
+									$relmap[1] = $other->table_name;
1862
+				}
1863
+				if (empty($relmap[2])) {
1864
+									$relmap[2] = $relmap[0];
1865
+				}
1830 1866
 				$join .= " LEFT JOIN $tname ON $tname.$relmap[0] = $relmap[1].$relmap[2]";
1831 1867
 			}
1832 1868
 		}
@@ -2355,8 +2391,9 @@  discard block
 block discarded – undo
2355 2391
 	{
2356 2392
 		$adb = PearDatabase::getInstance();
2357 2393
 
2358
-		if (!is_array($uitypes))
2359
-			$uitypes = array($uitypes);
2394
+		if (!is_array($uitypes)) {
2395
+					$uitypes = array($uitypes);
2396
+		}
2360 2397
 		$module = get_class($this);
2361 2398
 
2362 2399
 		$cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
@@ -2400,10 +2437,11 @@  discard block
 block discarded – undo
2400 2437
 			$columnCount = count($lookupcolumns);
2401 2438
 			foreach ($lookupcolumns as $columnname) {
2402 2439
 				if (!empty($columnname)) {
2403
-					if ($i == 0 || $i == ($columnCount))
2404
-						$query .= sprintf("%s = '%s'", $columnname, $value);
2405
-					else
2406
-						$query .= sprintf(" || %s = '%s'", $columnname, $value);
2440
+					if ($i == 0 || $i == ($columnCount)) {
2441
+											$query .= sprintf("%s = '%s'", $columnname, $value);
2442
+					} else {
2443
+											$query .= sprintf(" || %s = '%s'", $columnname, $value);
2444
+					}
2407 2445
 					$i++;
2408 2446
 				}
2409 2447
 			}
@@ -2460,8 +2498,9 @@  discard block
 block discarded – undo
2460 2498
 
2461 2499
 	public function getUserAccessConditionsQuerySR($module, $currentUser = false, $relatedRecord = false)
2462 2500
 	{
2463
-		if ($currentUser === false)
2464
-			$currentUser = vglobal('current_user');
2501
+		if ($currentUser === false) {
2502
+					$currentUser = vglobal('current_user');
2503
+		}
2465 2504
 
2466 2505
 		$userid = $currentUser->id;
2467 2506
 		$userPrivileges = \Vtiger_Util_Helper::getUserPrivilegesFile($userid);
@@ -2687,10 +2726,11 @@  discard block
 block discarded – undo
2687 2726
 		$log = LoggerManager::getInstance();
2688 2727
 		$currentModule = vglobal('currentModule');
2689 2728
 		$log->debug("Entering getSortOrder() method ...");
2690
-		if (AppRequest::has('sorder'))
2691
-			$sorder = $this->db->sql_escape_string(AppRequest::getForSql('sorder'));
2692
-		else
2693
-			$sorder = (($_SESSION[$currentModule . '_Sort_Order'] != '') ? ($_SESSION[$currentModule . '_Sort_Order']) : ($this->default_sort_order));
2729
+		if (AppRequest::has('sorder')) {
2730
+					$sorder = $this->db->sql_escape_string(AppRequest::getForSql('sorder'));
2731
+		} else {
2732
+					$sorder = (($_SESSION[$currentModule . '_Sort_Order'] != '') ? ($_SESSION[$currentModule . '_Sort_Order']) : ($this->default_sort_order));
2733
+		}
2694 2734
 		$log->debug("Exiting getSortOrder() method ...");
2695 2735
 		return $sorder;
2696 2736
 	}
@@ -2710,10 +2750,11 @@  discard block
 block discarded – undo
2710 2750
 			$use_default_order_by = $this->default_order_by;
2711 2751
 		}
2712 2752
 
2713
-		if (AppRequest::has('order_by'))
2714
-			$order_by = $this->db->sql_escape_string(AppRequest::getForSql('order_by'));
2715
-		else
2716
-			$order_by = (($_SESSION[$currentModule . '_Order_By'] != '') ? ($_SESSION[$currentModule . '_Order_By']) : ($use_default_order_by));
2753
+		if (AppRequest::has('order_by')) {
2754
+					$order_by = $this->db->sql_escape_string(AppRequest::getForSql('order_by'));
2755
+		} else {
2756
+					$order_by = (($_SESSION[$currentModule . '_Order_By'] != '') ? ($_SESSION[$currentModule . '_Order_By']) : ($use_default_order_by));
2757
+		}
2717 2758
 		$log->debug("Exiting getOrderBy method ...");
2718 2759
 		return $order_by;
2719 2760
 	}
@@ -2753,8 +2794,9 @@  discard block
 block discarded – undo
2753 2794
 		$selectClause = sprintf('SELECT %s.%s AS recordid,%s%s', $this->table_name, $this->table_index, $tableColumnsString, $additionalColumns);
2754 2795
 
2755 2796
 		// Select Custom Field Table Columns if present
2756
-		if (isset($this->customFieldTable))
2757
-			$query .= ", " . $this->customFieldTable[0] . ".* ";
2797
+		if (isset($this->customFieldTable)) {
2798
+					$query .= ", " . $this->customFieldTable[0] . ".* ";
2799
+		}
2758 2800
 
2759 2801
 		$fromClause = " FROM $this->table_name";
2760 2802
 
@@ -2798,8 +2840,9 @@  discard block
 block discarded – undo
2798 2840
 		foreach ($tableColumns as $tableColumn) {
2799 2841
 			$tableInfo = explode('.', $tableColumn);
2800 2842
 			$duplicateCheckClause .= " ifnull($tableColumn,'null') = ifnull(temp.$tableInfo[1],'null')";
2801
-			if (count($tableColumns) != $i++)
2802
-				$duplicateCheckClause .= ' && ';
2843
+			if (count($tableColumns) != $i++) {
2844
+							$duplicateCheckClause .= ' && ';
2845
+			}
2803 2846
 		}
2804 2847
 
2805 2848
 		$query = $selectClause . $fromClause .
Please login to merge, or discard this patch.
include/http/Response.php 1 patch
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -69,8 +69,9 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function setError($code, $message = null)
71 71
 	{
72
-		if ($message === null)
73
-			$message = $code;
72
+		if ($message === null) {
73
+					$message = $code;
74
+		}
74 75
 		$error = array('code' => $code, 'message' => $message);
75 76
 		$this->error = $error;
76 77
 	}
@@ -172,24 +173,29 @@  discard block
 block discarded – undo
172 173
 
173 174
 		/* Set right charset (UTF-8) to avoid IE complaining about c00ce56e error */
174 175
 		if ($this->emitType == self::$EMIT_JSON) {
175
-			if (!$contentTypeSent)
176
-				header('Content-type: text/json; charset=UTF-8');
176
+			if (!$contentTypeSent) {
177
+							header('Content-type: text/json; charset=UTF-8');
178
+			}
177 179
 			$this->emitJSON();
178 180
 		} else if ($this->emitType == self::$EMIT_JSONTEXT) {
179
-			if (!$contentTypeSent)
180
-				header('Content-type: text/json; charset=UTF-8');
181
+			if (!$contentTypeSent) {
182
+							header('Content-type: text/json; charset=UTF-8');
183
+			}
181 184
 			$this->emitText();
182 185
 		} else if ($this->emitType == self::$EMIT_HTML) {
183
-			if (!$contentTypeSent)
184
-				header('Content-type: text/html; charset=UTF-8');
186
+			if (!$contentTypeSent) {
187
+							header('Content-type: text/html; charset=UTF-8');
188
+			}
185 189
 			$this->emitRaw();
186 190
 		} else if ($this->emitType == self::$EMIT_RAW) {
187
-			if (!$contentTypeSent)
188
-				header('Content-type: text/plain; charset=UTF-8');
191
+			if (!$contentTypeSent) {
192
+							header('Content-type: text/plain; charset=UTF-8');
193
+			}
189 194
 			$this->emitRaw();
190 195
 		} else if ($this->emitType == self::$EMIT_JSONP) {
191
-			if (!$contentTypeSent)
192
-				header('Content-type: application/javascript; charset=UTF-8');
196
+			if (!$contentTypeSent) {
197
+							header('Content-type: application/javascript; charset=UTF-8');
198
+			}
193 199
 			echo $this->emitJSONPFn . "(";
194 200
 			$this->emitJSON();
195 201
 			echo ")";
@@ -210,15 +216,17 @@  discard block
 block discarded – undo
210 216
 	protected function emitText()
211 217
 	{
212 218
 		if ($this->result === NULL) {
213
-			if (is_string($this->error))
214
-				echo $this->error;
215
-			else
216
-				echo \includes\utils\Json::encode($this->prepareResponse());
219
+			if (is_string($this->error)) {
220
+							echo $this->error;
221
+			} else {
222
+							echo \includes\utils\Json::encode($this->prepareResponse());
223
+			}
217 224
 		} else {
218
-			if (is_string($this->result))
219
-				echo $this->result;
220
-			else
221
-				echo \includes\utils\Json::encode($this->prepareResponse());
225
+			if (is_string($this->result)) {
226
+							echo $this->result;
227
+			} else {
228
+							echo \includes\utils\Json::encode($this->prepareResponse());
229
+			}
222 230
 		}
223 231
 	}
224 232
 
@@ -227,8 +235,9 @@  discard block
 block discarded – undo
227 235
 	 */
228 236
 	protected function emitRaw()
229 237
 	{
230
-		if ($this->result === NULL)
231
-			echo (is_string($this->error)) ? $this->error : var_export($this->error, true);
238
+		if ($this->result === NULL) {
239
+					echo (is_string($this->error)) ? $this->error : var_export($this->error, true);
240
+		}
232 241
 		echo $this->result;
233 242
 	}
234 243
 }
Please login to merge, or discard this patch.
include/database/PearDatabase.php 1 patch
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -441,8 +441,9 @@  discard block
 block discarded – undo
441 441
 			$this->checkError('Missing table name');
442 442
 			return false;
443 443
 		}
444
-		if ($where != '')
445
-			$where = sprintf('WHERE %s', $where);
444
+		if ($where != '') {
445
+					$where = sprintf('WHERE %s', $where);
446
+		}
446 447
 		if (count($params) === 0) {
447 448
 			$this->query(sprintf('DELETE FROM %s %s', $table, $where));
448 449
 		} else {
@@ -530,10 +531,12 @@  discard block
 block discarded – undo
530 531
 	 */
531 532
 	public function flatten_array($input, $output = null)
532 533
 	{
533
-		if ($input === null)
534
-			return null;
535
-		if ($output === null)
536
-			$output = [];
534
+		if ($input === null) {
535
+					return null;
536
+		}
537
+		if ($output === null) {
538
+					$output = [];
539
+		}
537 540
 		foreach ($input as $value) {
538 541
 			if (is_array($value)) {
539 542
 				$output = $this->flatten_array($value, $output);
@@ -606,15 +609,17 @@  discard block
 block discarded – undo
606 609
 	{
607 610
 		if (isset($result) && $rowNum < 0) {
608 611
 			$row = $this->getRow($result);
609
-			if ($encode && is_array($row))
610
-				return array_map('to_html', $row);
612
+			if ($encode && is_array($row)) {
613
+							return array_map('to_html', $row);
614
+			}
611 615
 			return $row;
612 616
 		}
613 617
 		if ($this->getRowCount($result) > $rowNum) {
614 618
 			$row = $this->raw_query_result_rowdata($result, $rowNum);
615 619
 		}
616
-		if ($encode && is_array($row))
617
-			return array_map('to_html', $row);
620
+		if ($encode && is_array($row)) {
621
+					return array_map('to_html', $row);
622
+		}
618 623
 		return $row;
619 624
 	}
620 625
 
@@ -759,8 +764,9 @@  discard block
 block discarded – undo
759 764
 			$this->log('sqlExprDatalist: empty arrays not allowed', 'error');
760 765
 			$this->checkError('sqlExprDatalist: empty arrays not allowed');
761 766
 		}
762
-		foreach ($array as $key => $val)
763
-			$l .= ($l ? ',' : '') . $this->quote($val);
767
+		foreach ($array as $key => $val) {
768
+					$l .= ($l ? ',' : '') . $this->quote($val);
769
+		}
764 770
 		return ' ( ' . $l . ' ) ';
765 771
 	}
766 772
 
@@ -775,8 +781,9 @@  discard block
 block discarded – undo
775 781
 	{
776 782
 		$result = $this->query($sql, $dieOnError, $msg);
777 783
 
778
-		if ($this->getRowCount($result) == 1)
779
-			return $result;
784
+		if ($this->getRowCount($result) == 1) {
785
+					return $result;
786
+		}
780 787
 		$this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error');
781 788
 		$this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError);
782 789
 		return '';
@@ -788,8 +795,9 @@  discard block
 block discarded – undo
788 795
 	{
789 796
 		$result = $this->pquery($sql, $params, $dieOnError, $msg);
790 797
 
791
-		if ($this->getRowCount($result) == 1)
792
-			return $result;
798
+		if ($this->getRowCount($result) == 1) {
799
+					return $result;
800
+		}
793 801
 		$this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error');
794 802
 		$this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError);
795 803
 		return '';
@@ -853,8 +861,9 @@  discard block
 block discarded – undo
853 861
 			if (isset($_SERVER['REQUEST_METHOD'])) {
854 862
 				$uri = $_SERVER['REQUEST_URI'];
855 863
 				$qmarkIndex = strpos($_SERVER['REQUEST_URI'], '?');
856
-				if ($qmarkIndex !== false)
857
-					$uri = substr($uri, 0, $qmarkIndex);
864
+				if ($qmarkIndex !== false) {
865
+									$uri = substr($uri, 0, $qmarkIndex);
866
+				}
858 867
 				$data = $uri . '?' . http_build_query($_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST);
859 868
 			}
860 869
 			$stmt = $db->database->prepare($logQuery);
@@ -889,10 +898,12 @@  discard block
 block discarded – undo
889 898
 					}
890 899
 					$args = rtrim($args, ',');
891 900
 				}
892
-				if (!empty($callerfunc))
893
-					$callerfunc = " ($callerfunc)";
894
-				if (!empty($args))
895
-					$callerfunc .= "[$args] ";
901
+				if (!empty($callerfunc)) {
902
+									$callerfunc = " ($callerfunc)";
903
+				}
904
+				if (!empty($args)) {
905
+									$callerfunc .= "[$args] ";
906
+				}
896 907
 			}
897 908
 			$data[] = 'CALLER: (' . $callers[$calleridx]['line'] . ') ' . $callers[$calleridx]['file'] . $callerfunc;
898 909
 		}
Please login to merge, or discard this patch.
vtlib/Vtiger/Zip.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@  discard block
 block discarded – undo
50 50
 		if ($search_index === 0) {
51 51
 			$startindex = strlen($base_realpath) + 1;
52 52
 			// On windows $base_realpath ends with / and On Linux it will not have / at end!
53
-			if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1)
54
-				$startindex -= 1;
53
+			if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) {
54
+							$startindex -= 1;
55
+			}
55 56
 			$relpath = substr($src_realpath, $startindex);
56 57
 		}
57 58
 		return $relpath;
@@ -62,8 +63,9 @@  discard block
 block discarded – undo
62 63
 	 */
63 64
 	public function __fixDirSeparator($path)
64 65
 	{
65
-		if ($path != '' && (strripos($path, '/') != strlen($path) - 1))
66
-			$path .= '/';
66
+		if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) {
67
+					$path .= '/';
68
+		}
67 69
 		return $path;
68 70
 	}
69 71
 
@@ -72,8 +74,9 @@  discard block
 block discarded – undo
72 74
 	 */
73 75
 	public function __normalizePath($path)
74 76
 	{
75
-		if ($path && strpos($path, '\\') !== false)
76
-			$path = preg_replace("/\\\\/", "/", $path);
77
+		if ($path && strpos($path, '\\') !== false) {
78
+					$path = preg_replace("/\\\\/", "/", $path);
79
+		}
77 80
 		return $path;
78 81
 	}
79 82
 
@@ -83,18 +86,21 @@  discard block
 block discarded – undo
83 86
 	public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null)
84 87
 	{
85 88
 		$dir = opendir($dirname);
86
-		if (strripos($dirname, '/') != strlen($dirname) - 1)
87
-			$dirname .= '/';
89
+		if (strripos($dirname, '/') != strlen($dirname) - 1) {
90
+					$dirname .= '/';
91
+		}
88 92
 
89
-		if ($basedirname === null)
90
-			$basedirname = realpath($dirname);
93
+		if ($basedirname === null) {
94
+					$basedirname = realpath($dirname);
95
+		}
91 96
 
92 97
 		while (false !== ($file = readdir($dir))) {
93 98
 			if ($file != '.' && $file != '..' &&
94 99
 				$file != '.svn' && $file != 'CVS') {
95 100
 				// Exclude the file/directory 
96
-				if (!empty($excludeList) && in_array("$dirname$file", $excludeList))
97
-					continue;
101
+				if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) {
102
+									continue;
103
+				}
98 104
 
99 105
 				if (is_dir("$dirname$file")) {
100 106
 					$this->copyDirectoryFromDisk("$dirname$file", $zipdirname, $excludeList, $basedirname);
Please login to merge, or discard this patch.
vtlib/Vtiger/Utils.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -122,15 +122,17 @@  discard block
 block discarded – undo
122 122
 		$utilsLog = vglobal('tiger_Utils_Log');
123 123
 
124 124
 		$log->debug($message);
125
-		if (!isset($utilsLog) || $utilsLog === false)
126
-			return;
125
+		if (!isset($utilsLog) || $utilsLog === false) {
126
+					return;
127
+		}
127 128
 
128 129
 		echo $message;
129 130
 		if ($delimit) {
130
-			if (isset($_REQUEST))
131
-				echo "<BR>";
132
-			else
133
-				echo "\n";
131
+			if (isset($_REQUEST)) {
132
+							echo "<BR>";
133
+			} else {
134
+							echo "\n";
135
+			}
134 136
 		}
135 137
 	}
136 138
 
@@ -140,8 +142,9 @@  discard block
 block discarded – undo
140 142
 	 */
141 143
 	static function SQLEscape($value)
142 144
 	{
143
-		if ($value === null)
144
-			return $value;
145
+		if ($value === null) {
146
+					return $value;
147
+		}
145 148
 		$adb = \PearDatabase::getInstance();
146 149
 		return $adb->sql_escape_string($value);
147 150
 	}
@@ -220,8 +223,9 @@  discard block
 block discarded – undo
220 223
 		$adb = \PearDatabase::getInstance();
221 224
 		$old_dieOnError = $adb->dieOnError;
222 225
 
223
-		if ($supressdie)
224
-			$adb->dieOnError = false;
226
+		if ($supressdie) {
227
+					$adb->dieOnError = false;
228
+		}
225 229
 
226 230
 		$adb->pquery($sqlquery, []);
227 231
 
@@ -294,8 +298,9 @@  discard block
 block discarded – undo
294 298
 			};
295 299
 
296 300
 			if ($extra) {
297
-				if (is_array($extra))
298
-					$extra = json_encode($extra);
301
+				if (is_array($extra)) {
302
+									$extra = json_encode($extra);
303
+				}
299 304
 				array_push($log, $extra);
300 305
 			} else {
301 306
 				array_push($log, "");
Please login to merge, or discard this patch.
modules/Partners/Partners.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -88,8 +88,9 @@  discard block
 block discarded – undo
88 88
 			$modcommentsModuleInstance = vtlib\Module::getInstance('ModComments');
89 89
 			if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) {
90 90
 				include_once 'modules/ModComments/ModComments.php';
91
-				if (class_exists('ModComments'))
92
-					ModComments::addWidgetTo(array('Partners'));
91
+				if (class_exists('ModComments')) {
92
+									ModComments::addWidgetTo(array('Partners'));
93
+				}
93 94
 			}
94 95
 			$modcommentsModuleInstance = vtlib\Module::getInstance('ModTracker');
95 96
 			if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) {
@@ -139,18 +140,20 @@  discard block
 block discarded – undo
139 140
 		vtlib_setup_modulevars($related_module, $other);
140 141
 		$singular_modname = vtlib_toSingular($related_module);
141 142
 
142
-		if ($singlepane_view == 'true')
143
-			$returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
144
-		else
145
-			$returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
143
+		if ($singlepane_view == 'true') {
144
+					$returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
145
+		} else {
146
+					$returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
147
+		}
146 148
 
147 149
 		$button = '';
148 150
 
149 151
 		$button .= '<input type="hidden" name="email_directing_module"><input type="hidden" name="record">';
150 152
 
151 153
 		if ($actions) {
152
-			if (is_string($actions))
153
-				$actions = explode(',', strtoupper($actions));
154
+			if (is_string($actions)) {
155
+							$actions = explode(',', strtoupper($actions));
156
+			}
154 157
 			if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
155 158
 				$button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'>&nbsp;";
156 159
 			}
@@ -171,8 +174,9 @@  discard block
 block discarded – undo
171 174
 
172 175
 		$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
173 176
 
174
-		if ($return_value === null)
175
-			$return_value = Array();
177
+		if ($return_value === null) {
178
+					$return_value = Array();
179
+		}
176 180
 		$return_value['CUSTOM_BUTTON'] = $button;
177 181
 
178 182
 		$log->debug("Exiting get_campaigns method ...");
@@ -236,8 +240,9 @@  discard block
 block discarded – undo
236 240
 	public function unlinkRelationship($id, $returnModule, $returnId, $relatedName = false)
237 241
 	{
238 242
 		$log = LoggerManager::getInstance();
239
-		if (empty($returnModule) || empty($returnId))
240
-			return;
243
+		if (empty($returnModule) || empty($returnId)) {
244
+					return;
245
+		}
241 246
 		if ($returnModule == 'Campaigns') {
242 247
 			$this->db->delete('vtiger_campaign_records', 'crmid=? && campaignid=?', [$id, $returnId]);
243 248
 		} else {
@@ -249,8 +254,9 @@  discard block
 block discarded – undo
249 254
 	{
250 255
 		$adb = PearDatabase::getInstance();
251 256
 
252
-		if (!is_array($withCrmids))
253
-			$withCrmids = [$withCrmids];
257
+		if (!is_array($withCrmids)) {
258
+					$withCrmids = [$withCrmids];
259
+		}
254 260
 		if ($withModule != 'Campaigns') {
255 261
 			parent::save_related_module($module, $crmid, $withModule, $withCrmids, $relatedName);
256 262
 		} else {
Please login to merge, or discard this patch.