Completed
Pull Request — developer (#4001)
by Thom
542:26 queued 508:45
created
modules/Users/Users.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -296,7 +296,7 @@
 block discarded – undo
296 296
 			$buffer = fread($handle, filesize($validate));
297 297
 			if (substr_count($buffer, $authkey) < $i)
298 298
 				return -1;
299
-		}else {
299
+		} else {
300 300
 			return -1;
301 301
 		}
302 302
 	}
Please login to merge, or discard this patch.
Braces   +32 added lines, -25 removed lines patch added patch discarded remove patch
@@ -118,10 +118,11 @@  discard block
 block discarded – undo
118 118
 	{
119 119
 
120 120
 		\App\Log::trace("Entering getSortOrder() method ...");
121
-		if (AppRequest::has('sorder'))
122
-			$sorder = $this->db->sql_escape_string(AppRequest::get('sorder'));
123
-		else
124
-			$sorder = (($_SESSION['USERS_SORT_ORDER'] != '') ? ($_SESSION['USERS_SORT_ORDER']) : ($this->default_sort_order));
121
+		if (AppRequest::has('sorder')) {
122
+					$sorder = $this->db->sql_escape_string(AppRequest::get('sorder'));
123
+		} else {
124
+					$sorder = (($_SESSION['USERS_SORT_ORDER'] != '') ? ($_SESSION['USERS_SORT_ORDER']) : ($this->default_sort_order));
125
+		}
125 126
 		\App\Log::trace("Exiting getSortOrder method ...");
126 127
 		return $sorder;
127 128
 	}
@@ -140,10 +141,11 @@  discard block
 block discarded – undo
140 141
 			$use_default_order_by = $this->default_order_by;
141 142
 		}
142 143
 
143
-		if (AppRequest::has('order_by'))
144
-			$order_by = $this->db->sql_escape_string(AppRequest::get('order_by'));
145
-		else
146
-			$order_by = (($_SESSION['USERS_ORDER_BY'] != '') ? ($_SESSION['USERS_ORDER_BY']) : ($use_default_order_by));
144
+		if (AppRequest::has('order_by')) {
145
+					$order_by = $this->db->sql_escape_string(AppRequest::get('order_by'));
146
+		} else {
147
+					$order_by = (($_SESSION['USERS_ORDER_BY'] != '') ? ($_SESSION['USERS_ORDER_BY']) : ($use_default_order_by));
148
+		}
147 149
 		\App\Log::trace("Exiting getOrderBy method ...");
148 150
 		return $order_by;
149 151
 	}
@@ -157,10 +159,11 @@  discard block
 block discarded – undo
157 159
 	public function setPreference($name, $value)
158 160
 	{
159 161
 		if (!isset($this->user_preferences)) {
160
-			if (isset($_SESSION["USER_PREFERENCES"]))
161
-				$this->user_preferences = $_SESSION["USER_PREFERENCES"];
162
-			else
163
-				$this->user_preferences = [];
162
+			if (isset($_SESSION["USER_PREFERENCES"])) {
163
+							$this->user_preferences = $_SESSION["USER_PREFERENCES"];
164
+			} else {
165
+							$this->user_preferences = [];
166
+			}
164 167
 		}
165 168
 		if (!array_key_exists($name, $this->user_preferences) || $this->user_preferences[$name] != $value) {
166 169
 			\App\Log::trace("Saving To Preferences:" . $name . "=" . $value);
@@ -284,9 +287,10 @@  discard block
 block discarded – undo
284 287
 		$authkey = base64_decode($authkey);
285 288
 		if (file_exists($validate) && $handle = fopen($validate, 'rb', true)) {
286 289
 			$buffer = fread($handle, filesize($validate));
287
-			if (substr_count($buffer, $authkey) < $i)
288
-				return -1;
289
-		}else {
290
+			if (substr_count($buffer, $authkey) < $i) {
291
+							return -1;
292
+			}
293
+		} else {
290 294
 			return -1;
291 295
 		}
292 296
 	}
@@ -378,8 +382,9 @@  discard block
 block discarded – undo
378 382
 		}
379 383
 		\App\Log::trace("Starting user load for $usr_name");
380 384
 
381
-		if (!isset($this->column_fields["user_name"]) || $this->column_fields["user_name"] == "" || !isset($user_password) || $user_password == "")
382
-			return null;
385
+		if (!isset($this->column_fields["user_name"]) || $this->column_fields["user_name"] == "" || !isset($user_password) || $user_password == "") {
386
+					return null;
387
+		}
383 388
 
384 389
 		$authCheck = false;
385 390
 		$authCheck = $this->doLogin($user_password);
@@ -407,8 +412,9 @@  discard block
 block discarded – undo
407 412
 		$this->loadPreferencesFromDB($row['user_preferences']);
408 413
 
409 414
 
410
-		if ($row['status'] != "Inactive")
411
-			$this->authenticated = true;
415
+		if ($row['status'] != "Inactive") {
416
+					$this->authenticated = true;
417
+		}
412 418
 
413 419
 		unset($_SESSION['loginattempts']);
414 420
 		return $this;
@@ -940,8 +946,9 @@  discard block
 block discarded – undo
940 946
 		$db = App\Db::getInstance();
941 947
 		//to get the owner id
942 948
 		$ownerid = $this->column_fields['assigned_user_id'];
943
-		if (!isset($ownerid) || $ownerid == '')
944
-			$ownerid = $currentUserId;
949
+		if (!isset($ownerid) || $ownerid == '') {
950
+					$ownerid = $currentUserId;
951
+		}
945 952
 		$fileInstance = \App\Fields\File::loadFromRequest($fileDetails);
946 953
 		if (!$fileInstance->validate('image')) {
947 954
 			\App\Log::trace('Skip the save attachment process.');
@@ -1202,10 +1209,10 @@  discard block
 block discarded – undo
1202 1209
 					$result = $adb->pquery($qry, [$id, $this->homeorder_array[$i]]);
1203 1210
 				}
1204 1211
 			}
1205
-			if ($save_array != "")
1206
-				$homeorder = implode(',', $save_array);
1207
-		}
1208
-		else {
1212
+			if ($save_array != "") {
1213
+							$homeorder = implode(',', $save_array);
1214
+			}
1215
+		} else {
1209 1216
 			$this->insertUserdetails('postinstall');
1210 1217
 		}
1211 1218
 		\App\Log::trace("Exiting from function saveHomeOrder($id)");
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -204,7 +204,6 @@  discard block
 block discarded – undo
204 204
 
205 205
 	/**
206 206
 	 * @return string encrypted password for storage in DB and comparison against DB password.
207
-	 * @param string $user_name - Must be non null and at least 2 characters
208 207
 	 * @param string $user_password - Must be non null and at least 1 character.
209 208
 	 * @desc Take an unencrypted username and password and return the encrypted password
210 209
 	 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
@@ -452,7 +451,6 @@  discard block
 block discarded – undo
452 451
 	}
453 452
 
454 453
 	/**
455
-	 * @param string $user name - Must be non null and at least 1 character.
456 454
 	 * @param string $userPassword - Must be non null and at least 1 character.
457 455
 	 * @param string $newPassword - Must be non null and at least 1 character.
458 456
 	 * @return boolean - If passwords pass verification and query succeeds, return true, else return false.
@@ -869,7 +867,7 @@  discard block
 block discarded – undo
869 867
 
870 868
 	/** Function to retreive the user info of the specifed user id The user info will be available in $this->column_fields array
871 869
 	 * @param $record -- record id:: Type integer
872
-	 * @param $module -- module:: Type varchar
870
+	 * @param string $module -- module:: Type varchar
873 871
 	 */
874 872
 	public function retrieve_entity_info($record, $module)
875 873
 	{
@@ -1092,6 +1090,9 @@  discard block
 block discarded – undo
1092 1090
 		return $return_array;
1093 1091
 	}
1094 1092
 
1093
+	/**
1094
+	 * @param string $home_string
1095
+	 */
1095 1096
 	public function getDefaultHomeModuleVisibility($home_string, $inVal)
1096 1097
 	{
1097 1098
 		$homeModComptVisibility = 1;
@@ -1105,6 +1106,9 @@  discard block
 block discarded – undo
1105 1106
 		return $homeModComptVisibility;
1106 1107
 	}
1107 1108
 
1109
+	/**
1110
+	 * @param string $inVal
1111
+	 */
1108 1112
 	public function insertUserdetails($inVal)
1109 1113
 	{
1110 1114
 		$adb = PearDatabase::getInstance();
Please login to merge, or discard this patch.
modules/OSSTimeControl/actions/GetTCInfo.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,17 +37,19 @@
 block discarded – undo
37 37
 			$sourceData = $entity->column_fields;
38 38
 			if ($sourceModule == 'HelpDesk') {
39 39
 				$sourceData['contact_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['contact_id']);
40
-				if (vtlib\Functions::getCRMRecordType($sourceData['parent_id']) != 'Accounts')
41
-					unset($sourceData['parent_id']);
42
-				else
43
-					$sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['parent_id']);
40
+				if (vtlib\Functions::getCRMRecordType($sourceData['parent_id']) != 'Accounts') {
41
+									unset($sourceData['parent_id']);
42
+				} else {
43
+									$sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['parent_id']);
44
+				}
44 45
 			} else if ($sourceModule == 'Project') {
45 46
 				$query = sprintf("select * from vtiger_account where accountid = %s", $sourceData['linktoaccountscontacts']);
46 47
 				$ifExist = $adb->query($query, true, "Błąd podczas pobierania danych z vtiger_crmentityrel");
47
-				if ($adb->num_rows($ifExist) > 0)
48
-					$sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']);
49
-				else
50
-					$sourceData['contact_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']);
48
+				if ($adb->num_rows($ifExist) > 0) {
49
+									$sourceData['account_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']);
50
+				} else {
51
+									$sourceData['contact_label'] = vtlib\Functions::getCRMRecordLabel($sourceData['linktoaccountscontacts']);
52
+				}
51 53
 			}
52 54
 		}
53 55
 
Please login to merge, or discard this patch.
modules/ModComments/ModCommentsCore.php 1 patch
Braces   +21 added lines, -16 removed lines patch added patch discarded remove patch
@@ -96,10 +96,11 @@  discard block
 block discarded – undo
96 96
 		$currentModule = vglobal('currentModule');
97 97
 
98 98
 		$sortorder = $this->default_sort_order;
99
-		if (!AppRequest::isEmpty('sorder'))
100
-			$sortorder = $this->db->sql_escape_string(AppRequest::get('sorder'));
101
-		else if ($_SESSION[$currentModule . '_Sort_Order'])
102
-			$sortorder = $_SESSION[$currentModule . '_Sort_Order'];
99
+		if (!AppRequest::isEmpty('sorder')) {
100
+					$sortorder = $this->db->sql_escape_string(AppRequest::get('sorder'));
101
+		} else if ($_SESSION[$currentModule . '_Sort_Order']) {
102
+					$sortorder = $_SESSION[$currentModule . '_Sort_Order'];
103
+		}
103 104
 
104 105
 		return $sortorder;
105 106
 	}
@@ -114,10 +115,11 @@  discard block
 block discarded – undo
114 115
 		}
115 116
 
116 117
 		$orderby = $use_default_order_by;
117
-		if (!AppRequest::isEmpty('order_by'))
118
-			$orderby = $this->db->sql_escape_string(AppRequest::get('order_by'));
119
-		else if ($_SESSION[$currentModule . '_Order_By'])
120
-			$orderby = $_SESSION[$currentModule . '_Order_By'];
118
+		if (!AppRequest::isEmpty('order_by')) {
119
+					$orderby = $this->db->sql_escape_string(AppRequest::get('order_by'));
120
+		} else if ($_SESSION[$currentModule . '_Order_By']) {
121
+					$orderby = $_SESSION[$currentModule . '_Order_By'];
122
+		}
121 123
 		return $orderby;
122 124
 	}
123 125
 
@@ -146,8 +148,9 @@  discard block
 block discarded – undo
146 148
 		$joinedTables = array();
147 149
 
148 150
 		// Select Custom Field Table Columns if present
149
-		if (!empty($this->customFieldTable))
150
-			$query .= ", " . $this->customFieldTable[0] . ".* ";
151
+		if (!empty($this->customFieldTable)) {
152
+					$query .= ", " . $this->customFieldTable[0] . ".* ";
153
+		}
151 154
 
152 155
 		$query .= " FROM $this->table_name";
153 156
 
@@ -285,10 +288,11 @@  discard block
 block discarded – undo
285 288
 
286 289
 		$where_auto = " vtiger_crmentity.deleted=0";
287 290
 
288
-		if ($where != '')
289
-			$query .= " WHERE ($where) && $where_auto";
290
-		else
291
-			$query .= " WHERE $where_auto";
291
+		if ($where != '') {
292
+					$query .= " WHERE ($where) && $where_auto";
293
+		} else {
294
+					$query .= " WHERE $where_auto";
295
+		}
292 296
 
293 297
 		require('user_privileges/user_privileges_' . $current_user->id . '.php');
294 298
 		require('user_privileges/sharing_privileges_' . $current_user->id . '.php');
@@ -317,8 +321,9 @@  discard block
 block discarded – undo
317 321
 		$select_clause = sprintf('SELECT %s.%s AS recordid, vtiger_users_last_import.deleted, %s', $this->table_name, $this->table_index, $table_cols);
318 322
 
319 323
 		// Select Custom Field Table Columns if present
320
-		if (isset($this->customFieldTable))
321
-			$query .= ", " . $this->customFieldTable[0] . ".* ";
324
+		if (isset($this->customFieldTable)) {
325
+					$query .= ", " . $this->customFieldTable[0] . ".* ";
326
+		}
322 327
 
323 328
 		$from_clause = " FROM $this->table_name";
324 329
 
Please login to merge, or discard this patch.
modules/Settings/QuickCreateEditor/models/Module.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 		$db = PearDatabase::getInstance();
19 19
 
20 20
 		$query = 'UPDATE vtiger_field SET ';
21
-		$query .=' quickcreatesequence= CASE ';
21
+		$query .= ' quickcreatesequence= CASE ';
22 22
 		foreach ($blockFieldSequence as $newFieldSequence) {
23 23
 			$fieldId = $newFieldSequence['fieldid'];
24 24
 			$sequence = $newFieldSequence['sequence'];
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			$query .= ' WHEN fieldid=' . $fieldId . ' THEN ' . $sequence;
28 28
 		}
29 29
 
30
-		$query .=' END ';
30
+		$query .= ' END ';
31 31
 		$query .= sprintf(' WHERE fieldid IN (%s)', generateQuestionMarks($fieldIdList));
32 32
 		$db->pquery($query, array($fieldIdList));
33 33
 	}
Please login to merge, or discard this patch.
modules/Settings/QuickCreateEditor/views/Index.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,13 +37,15 @@
 block discarded – undo
37 37
 			//To get the first element
38 38
 			$firstElement = reset($menuModelsList);
39 39
 			$sourceModule = array($firstElement->get('name'));
40
-		} else
41
-			$sourceModule = array($sourceModule);
40
+		} else {
41
+					$sourceModule = array($sourceModule);
42
+		}
42 43
 
43 44
 		$quickCreateContents = array();
44 45
 
45
-		if (in_array('Calendar', $sourceModule))
46
-			$sourceModule = array('Calendar', 'Events');
46
+		if (in_array('Calendar', $sourceModule)) {
47
+					$sourceModule = array('Calendar', 'Events');
48
+		}
47 49
 
48 50
 		foreach ($sourceModule as $module) {
49 51
 			$recordModel = Vtiger_Record_Model::getCleanInstance($module);
Please login to merge, or discard this patch.
modules/Settings/OSSPasswords/views/ConfigurePass.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -237,10 +237,11 @@
 block discarded – undo
237 237
 		$viewer->assign('MODULENAME', $moduleName);
238 238
 		$viewer->assign('SAVE', 'Save');
239 239
 		$viewer->assign('CANCEL', 'Cancel');
240
-		if (\vtlib\Functions::userIsAdministrator($current_user))
241
-			$viewer->assign('ISADMIN', 1);
242
-		else
243
-			$viewer->assign('ISADMIN', 0);
240
+		if (\vtlib\Functions::userIsAdministrator($current_user)) {
241
+					$viewer->assign('ISADMIN', 1);
242
+		} else {
243
+					$viewer->assign('ISADMIN', 0);
244
+		}
244 245
 
245 246
 		// encryption variables
246 247
 		$viewer->assign('CONFIG', (!$config ? false : array('key' => $config['key'])));
Please login to merge, or discard this patch.
modules/Vtiger/CRMEntity.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 		$query = "SELECT vtiger_crmentity.*, $this->table_name.*";
53 53
 
54 54
 		// Select Custom Field Table Columns if present
55
-		if (!empty($this->customFieldTable))
56
-			$query .= ", " . $this->customFieldTable[0] . ".* ";
55
+		if (!empty($this->customFieldTable)) {
56
+					$query .= ", " . $this->customFieldTable[0] . ".* ";
57
+		}
57 58
 
58 59
 		$query .= " FROM $this->table_name";
59 60
 
@@ -180,10 +181,11 @@  discard block
 block discarded – undo
180 181
 		$query .= $this->getNonAdminAccessControlQuery($thismodule, $current_user);
181 182
 		$where_auto = " vtiger_crmentity.deleted=0";
182 183
 
183
-		if ($where != '')
184
-			$query .= " WHERE ($where) && $where_auto";
185
-		else
186
-			$query .= " WHERE $where_auto";
184
+		if ($where != '') {
185
+					$query .= " WHERE ($where) && $where_auto";
186
+		} else {
187
+					$query .= " WHERE $where_auto";
188
+		}
187 189
 
188 190
 		return $query;
189 191
 	}
@@ -196,8 +198,9 @@  discard block
 block discarded – undo
196 198
 		$select_clause = sprintf("SELECT %s.%s AS recordid, vtiger_users_last_import.deleted,%s", $this->table_name, $this->table_index, $table_cols);
197 199
 
198 200
 		// Select Custom Field Table Columns if present
199
-		if (isset($this->customFieldTable))
200
-			$query .= ", " . $this->customFieldTable[0] . ".* ";
201
+		if (isset($this->customFieldTable)) {
202
+					$query .= ", " . $this->customFieldTable[0] . ".* ";
203
+		}
201 204
 
202 205
 		$from_clause = " FROM $this->table_name";
203 206
 
Please login to merge, or discard this patch.
modules/Vtiger/actions/TransferOwnership.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,10 +22,11 @@
 block discarded – undo
22 22
 		$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'TransferOwnership', $module);
23 23
 		$transferModel = new $modelClassName();
24 24
 
25
-		if (empty($record))
26
-			$recordIds = $this->getBaseModuleRecordIds($request);
27
-		else
28
-			$recordIds = [$record];
25
+		if (empty($record)) {
26
+					$recordIds = $this->getBaseModuleRecordIds($request);
27
+		} else {
28
+					$recordIds = [$record];
29
+		}
29 30
 		if (!empty($recordIds)) {
30 31
 			$transferModel->transferRecordsOwnership($module, $transferOwnerId, $recordIds);
31 32
 		}
Please login to merge, or discard this patch.
modules/Vtiger/models/DetailView.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@
 block discarded – undo
144 144
 			$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($editViewLinks);
145 145
 		}
146 146
 
147
-		if (($recordModel->isEditable() && $recordModel->editFieldByModalPermission() ) || $recordModel->editFieldByModalPermission(true)) {
147
+		if (($recordModel->isEditable() && $recordModel->editFieldByModalPermission()) || $recordModel->editFieldByModalPermission(true)) {
148 148
 			$fieldByEditData = $recordModel->getFieldToEditByModal();
149 149
 			$basicActionLink = [
150 150
 				'linktype' => 'DETAILVIEW',
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
 	/**
21 21
 	 * Function to get Module instance
22
-	 * @return Vtiger_Module_Model
22
+	 * @return boolean
23 23
 	 */
24 24
 	public function getModule()
25 25
 	{
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -306,8 +306,9 @@
 block discarded – undo
306 306
 	 */
307 307
 	public function getWidgets()
308 308
 	{
309
-		if (count($this->widgetsList) > 0)
310
-			return;
309
+		if (count($this->widgetsList) > 0) {
310
+					return;
311
+		}
311 312
 		$moduleModel = $this->getModule();
312 313
 		$module = $this->getModuleName();
313 314
 		$record = $this->getRecord()->getId();
Please login to merge, or discard this patch.