Completed
Pull Request — developer (#4001)
by Thom
542:26 queued 508:45
created
vtlib/Vtiger/Unzip.php 1 patch
Braces   +34 added lines, -22 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 	public function __checkPathInArray($path, $pathArray)
26 26
 	{
27 27
 		foreach ($pathArray as $checkPath) {
28
-			if (strpos($path, $checkPath) === 0)
29
-				return true;
28
+			if (strpos($path, $checkPath) === 0) {
29
+							return true;
30
+			}
30 31
 		}
31 32
 		return false;
32 33
 	}
@@ -37,8 +38,9 @@  discard block
 block discarded – undo
37 38
 	 */
38 39
 	public function isdir($filepath)
39 40
 	{
40
-		if (substr($filepath, -1, 1) == "/")
41
-			return true;
41
+		if (substr($filepath, -1, 1) == "/") {
42
+					return true;
43
+		}
42 44
 		return false;
43 45
 	}
44 46
 
@@ -53,11 +55,13 @@  discard block
 block discarded – undo
53 55
 		// We want to always maintain the structure
54 56
 		$maintainStructure = true;
55 57
 
56
-		if ($targetDir === false)
57
-			$targetDir = dirname(__FILE__) . "/";
58
+		if ($targetDir === false) {
59
+					$targetDir = dirname(__FILE__) . "/";
60
+		}
58 61
 
59
-		if ($renamePaths === false)
60
-			$renamePaths = [];
62
+		if ($renamePaths === false) {
63
+					$renamePaths = [];
64
+		}
61 65
 
62 66
 		/*
63 67
 		 * Setup includeExclude parameter
@@ -70,17 +74,19 @@  discard block
 block discarded – undo
70 74
 		 * DEFAULT: If include is specified only files under the specified path will be included.
71 75
 		 * If exclude is specified folders or files will be excluded.
72 76
 		 */
73
-		if ($includeExclude === false)
74
-			$includeExclude = [];
77
+		if ($includeExclude === false) {
78
+					$includeExclude = [];
79
+		}
75 80
 
76 81
 		$lista = $this->getList();
77
-		if (sizeof($lista))
78
-			foreach ($lista as $fileName => $trash) {
82
+		if (sizeof($lista)) {
83
+					foreach ($lista as $fileName => $trash) {
79 84
 				// Should the file be ignored?
80 85
 				if ($includeExclude['include'] &&
81 86
 					!$this->__checkPathInArray($fileName, $includeExclude['include'])) {
82 87
 					// Do not include something not specified in include
83 88
 					continue;
89
+		}
84 90
 				}
85 91
 				if ($includeExclude['exclude'] &&
86 92
 					$this->__checkPathInArray($fileName, $includeExclude['exclude'])) {
@@ -104,8 +110,9 @@  discard block
 block discarded – undo
104 110
 
105 111
 				$outDN = "$targetDir/$dirname";
106 112
 
107
-				if (substr($dirname, 0, strlen($baseDir)) != $baseDir)
108
-					continue;
113
+				if (substr($dirname, 0, strlen($baseDir)) != $baseDir) {
114
+									continue;
115
+				}
109 116
 
110 117
 				if (!is_dir($outDN) && $maintainStructure) {
111 118
 					$str = '';
@@ -115,16 +122,20 @@  discard block
 block discarded – undo
115 122
 						if (!is_dir("$targetDir/$str")) {
116 123
 							$this->debugMsg(1, "Creating folder: $targetDir/$str");
117 124
 							mkdir("$targetDir/$str");
118
-							if ($applyChmod)
119
-								@chmod("$targetDir/$str", $applyChmod);
125
+							if ($applyChmod) {
126
+															@chmod("$targetDir/$str", $applyChmod);
127
+							}
120 128
 						}
121 129
 					}
122 130
 				}
123
-				if (substr($fileName, -1, 1) == '/')
124
-					continue;
131
+				if (substr($fileName, -1, 1) == '/') {
132
+									continue;
133
+				}
125 134
 
126
-				if (substr($fileName, -3) == '.sh')
127
-					$applyChmod = 0775; // Script executable.
135
+				if (substr($fileName, -3) == '.sh') {
136
+									$applyChmod = 0775;
137
+				}
138
+				// Script executable.
128 139
 				$this->unzip($fileName, "$targetDir/$dirname/" . basename($fileName), $applyChmod);
129 140
 			}
130 141
 	}
@@ -138,8 +149,9 @@  discard block
 block discarded – undo
138 149
 	{
139 150
 		$fileList = $this->getList();
140 151
 		foreach ($fileList as $file => $details) {
141
-			if ($fileName === $file)
142
-				return true;
152
+			if ($fileName === $file) {
153
+							return true;
154
+			}
143 155
 		}
144 156
 		return false;
145 157
 	}
Please login to merge, or discard this patch.
vtlib/Vtiger/ThemeImport.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,8 +78,9 @@  discard block
 block discarded – undo
78 78
 		foreach ($filelist as $filename => $fileinfo) {
79 79
 			if (!$unzip->isdir($filename)) {
80 80
 
81
-				if (strpos($filename, '/') === false)
82
-					continue;
81
+				if (strpos($filename, '/') === false) {
82
+									continue;
83
+				}
83 84
 
84 85
 
85 86
 				$targetdir = substr($filename, 0, strripos($filename, '/'));
@@ -107,8 +108,9 @@  discard block
 block discarded – undo
107 108
 				}
108 109
 			}
109 110
 		}
110
-		if ($unzip)
111
-			$unzip->close();
111
+		if ($unzip) {
112
+					$unzip->close();
113
+		}
112 114
 
113 115
 		self::register($label, $name, $parent);
114 116
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -28,6 +28,7 @@
 block discarded – undo
28 28
 	/**
29 29
 	 * Initialize Import
30 30
 	 * @access private
31
+	 * @param boolean $overwrite
31 32
 	 */
32 33
 	public function initImport($zipfile, $overwrite)
33 34
 	{
Please login to merge, or discard this patch.
vtlib/Vtiger/LanguageImport.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
 		foreach ($filelist as $filename => $fileinfo) {
85 85
 			if (!$unzip->isdir($filename)) {
86 86
 
87
-				if (strpos($filename, '/') === false)
88
-					continue;
87
+				if (strpos($filename, '/') === false) {
88
+									continue;
89
+				}
89 90
 
90 91
 				$targetdir = substr($filename, 0, strripos($filename, '/'));
91 92
 				$targetfile = basename($filename);
@@ -146,8 +147,9 @@  discard block
 block discarded – undo
146 147
 				}
147 148
 			}
148 149
 		}
149
-		if ($unzip)
150
-			$unzip->close();
150
+		if ($unzip) {
151
+					$unzip->close();
152
+		}
151 153
 
152 154
 		self::register($prefix, $label, $name);
153 155
 
Please login to merge, or discard this patch.
modules/WSAPP/WorkFlowHandlers/WSAPPAssignToTracker.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		//END
36 36
 
37 37
 		$recordId = $entityData->getId();
38
-		$vtEntityDelta = new VTEntityDelta ();
38
+		$vtEntityDelta = new VTEntityDelta();
39 39
 		$newEntityData = $vtEntityDelta->getNewEntity($moduleName, $recordId);
40 40
 		$recordValues = $newEntityData->getData();
41 41
 		$isAssignToModified = $this->isAssignToChanged($moduleName, $recordId, $current_user);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$meta = $handler->getMeta();
61 61
 		$moduleOwnerFields = $meta->getOwnerFields();
62 62
 		$assignToChanged = false;
63
-		$vtEntityDelta = new VTEntityDelta ();
63
+		$vtEntityDelta = new VTEntityDelta();
64 64
 		foreach ($moduleOwnerFields as $ownerField) {
65 65
 			$assignToChanged = $vtEntityDelta->hasChanged($moduleName, $recordId, $ownerField);
66 66
 			if ($assignToChanged)
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,8 +62,9 @@  discard block
 block discarded – undo
62 62
 		$vtEntityDelta = new VTEntityDelta ();
63 63
 		foreach ($moduleOwnerFields as $ownerField) {
64 64
 			$assignToChanged = $vtEntityDelta->hasChanged($moduleName, $recordId, $ownerField);
65
-			if ($assignToChanged)
66
-				break;
65
+			if ($assignToChanged) {
66
+							break;
67
+			}
67 68
 		}
68 69
 		return $assignToChanged;
69 70
 	}
@@ -71,8 +72,9 @@  discard block
 block discarded – undo
71 72
 	public function getWsModuleName($workFlowModuleName)
72 73
 	{
73 74
 		$wsModuleName = $workFlowModuleName;
74
-		if ($workFlowModuleName == "Activity")
75
-			$wsModuleName = "Calendar";
75
+		if ($workFlowModuleName == "Activity") {
76
+					$wsModuleName = "Calendar";
77
+		}
76 78
 		return $wsModuleName;
77 79
 	}
78 80
 }
Please login to merge, or discard this patch.
modules/WSAPP/Utils.php 2 patches
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -42,15 +42,19 @@  discard block
 block discarded – undo
42 42
 	$entityMetaList = array();
43 43
 	$db = PearDatabase::getInstance();
44 44
 
45
-	if (empty($entityNames))
46
-		return;
47
-
48
-	if (!is_array($entityNames))
49
-		$entityNames = array($entityNames);
50
-	if (empty($modules))
51
-		return array();
52
-	if (!is_array($modules))
53
-		$modules = array($modules);
45
+	if (empty($entityNames)) {
46
+			return;
47
+	}
48
+
49
+	if (!is_array($entityNames)) {
50
+			$entityNames = array($entityNames);
51
+	}
52
+	if (empty($modules)) {
53
+			return array();
54
+	}
55
+	if (!is_array($modules)) {
56
+			$modules = array($modules);
57
+	}
54 58
 	$entityNameIds = array();
55 59
 	foreach ($modules as $moduleName) {
56 60
 		if (empty($entityMetaList[$moduleName])) {
@@ -62,8 +66,9 @@  discard block
 block discarded – undo
62 66
 		$nameFieldsArray = explode(",", $meta->getNameFields());
63 67
 		if (count($nameFieldsArray) > 1) {
64 68
 			$nameFields = "concat(" . implode(",' ',", $nameFieldsArray) . ")";
65
-		} else
66
-			$nameFields = $nameFieldsArray[0];
69
+		} else {
70
+					$nameFields = $nameFieldsArray[0];
71
+		}
67 72
 
68 73
 		$query = sprintf("SELECT %s as id,%s as entityname 
69 74
 				FROM %s as moduleentity 
@@ -102,12 +107,15 @@  discard block
 block discarded – undo
102 107
 function wsapp_checkIfRecordsAssignToUser($recordsIds, $userIds)
103 108
 {
104 109
 	$assignedRecordIds = [];
105
-	if (!is_array($recordsIds))
106
-		$recordsIds = [$recordsIds];
107
-	if (count($recordsIds) <= 0)
108
-		return $assignedRecordIds;
109
-	if (!is_array($userIds))
110
-		$userIds = [$userIds];
110
+	if (!is_array($recordsIds)) {
111
+			$recordsIds = [$recordsIds];
112
+	}
113
+	if (count($recordsIds) <= 0) {
114
+			return $assignedRecordIds;
115
+	}
116
+	if (!is_array($userIds)) {
117
+			$userIds = [$userIds];
118
+	}
111 119
 	$db = PearDatabase::getInstance();
112 120
 	$query = sprintf("SELECT * FROM vtiger_crmentity where crmid IN (%s) and smownerid in (%s)", generateQuestionMarks($recordsIds), generateQuestionMarks($userIds));
113 121
 	$params = [];
Please login to merge, or discard this patch.
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -126,6 +126,9 @@  discard block
 block discarded – undo
126 126
 	return $assignedRecordIds;
127 127
 }
128 128
 
129
+/**
130
+ * @param string $appName
131
+ */
129 132
 function wsapp_getAppKey($appName)
130 133
 {
131 134
 	$db = PearDatabase::getInstance();
@@ -152,6 +155,11 @@  discard block
 block discarded – undo
152 155
 	return $syncType;
153 156
 }
154 157
 
158
+/**
159
+ * @param string $type
160
+ * @param string $handlerClass
161
+ * @param string $handlerPath
162
+ */
155 163
 function wsapp_RegisterHandler($type, $handlerClass, $handlerPath)
156 164
 {
157 165
 	$db = PearDatabase::getInstance();
Please login to merge, or discard this patch.
modules/WSAPP/OutlookSyncServer.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,10 +38,11 @@  discard block
 block discarded – undo
38 38
 			throw new WebServiceException('WSAPP04', "Access restricted to app");
39 39
 		}
40 40
 
41
-		if (!is_array($element))
42
-			$records = array($element);
43
-		else
44
-			$records = $element;
41
+		if (!is_array($element)) {
42
+					$records = array($element);
43
+		} else {
44
+					$records = $element;
45
+		}
45 46
 
46 47
 		//hardcoded since the destination handler will be vtigerCRM
47 48
 		$serverKey = wsapp_getAppKey("vtigerCRM");
@@ -64,16 +65,18 @@  discard block
 block discarded – undo
64 65
 			$clientRecordId = $record['id'];
65 66
 
66 67
 			// Missing client record id?
67
-			if (empty($clientRecordId))
68
-				continue;
68
+			if (empty($clientRecordId)) {
69
+							continue;
70
+			}
69 71
 
70 72
 			$lookupRecordId = false;
71 73
 			// Added for Duplication handling
72 74
 			if (!empty($record['crmid'])) {
73 75
 				$crmid = vtws_getIdComponents($record['crmid']);
74 76
 				$lookupResult = $db->pquery("SELECT crmid,modifiedtime FROM vtiger_crmentity WHERE crmid=?", array($crmid[1]));
75
-				if ($db->num_rows($lookupResult))
76
-					$lookupRecordId = $record['crmid'];
77
+				if ($db->num_rows($lookupResult)) {
78
+									$lookupRecordId = $record['crmid'];
79
+				}
77 80
 				if (!(empty($lookupRecordId))) {
78 81
 					$clientLastModifiedTime = $db->query_result($lookupResult, 0, 'modifiedtime');
79 82
 					$record['values']['id'] = $lookupRecordId;
@@ -86,8 +89,9 @@  discard block
 block discarded – undo
86 89
 			// End
87 90
 			else {
88 91
 				$lookupResult = $db->pquery("SELECT serverid,clientmodifiedtime FROM vtiger_wsapp_recordmapping WHERE appid=? && clientid=?", array($appid, $clientRecordId));
89
-				if ($db->num_rows($lookupResult))
90
-					$lookupRecordId = $db->query_result($lookupResult, 0, 'serverid');
92
+				if ($db->num_rows($lookupResult)) {
93
+									$lookupRecordId = $db->query_result($lookupResult, 0, 'serverid');
94
+				}
91 95
 				if (empty($lookupRecordId) && $record['mode'] != "delete") {
92 96
 					$createRecords[$clientRecordId] = $record['values'];
93 97
 					$createRecords[$clientRecordId]['module'] = $record['module'];
@@ -97,8 +101,9 @@  discard block
 block discarded – undo
97 101
 						$deleteRecords[$clientRecordId] = $lookupRecordId;
98 102
 					} else if (!(empty($lookupRecordId))) {
99 103
 						$clientLastModifiedTime = $db->query_result($lookupResult, 0, 'clientmodifiedtime');
100
-						if ($clientLastModifiedTime >= $record['values']['modifiedtime'])
101
-							continue;
104
+						if ($clientLastModifiedTime >= $record['values']['modifiedtime']) {
105
+													continue;
106
+						}
102 107
 						$record['values']['id'] = $lookupRecordId;
103 108
 						$updateRecords[$clientRecordId] = $record['values'];
104 109
 						$updateRecords[$clientRecordId]['module'] = $record['module'];
Please login to merge, or discard this patch.
modules/WSAPP/WSAPP.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,8 +124,9 @@
 block discarded – undo
124 124
 		$appTypehandler['handlerpath'] = "modules/WSAPP/Handlers/vtigerCRMHandler.php";
125 125
 		$handlerDetails[] = $appTypehandler;
126 126
 
127
-		foreach ($handlerDetails as $appHandlerDetails)
128
-			$adb->pquery("INSERT INTO vtiger_wsapp_handlerdetails VALUES(?,?,?)", array($appHandlerDetails['type'], $appHandlerDetails['handlerclass'], $appHandlerDetails['handlerpath']));
127
+		foreach ($handlerDetails as $appHandlerDetails) {
128
+					$adb->pquery("INSERT INTO vtiger_wsapp_handlerdetails VALUES(?,?,?)", array($appHandlerDetails['type'], $appHandlerDetails['handlerclass'], $appHandlerDetails['handlerpath']));
129
+		}
129 130
 	}
130 131
 
131 132
 	public function registerVtigerCRMApp()
Please login to merge, or discard this patch.
modules/Assets/views/EditFieldByModal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 		}
29 29
 		$showFields = array_keys($recordModel->getModule()->getQuickCreateFields());
30 30
 		$configureFields = AppConfig::module($moduleName, 'SHOW_FIELD_IN_MODAL');
31
-		if($configureFields){
31
+		if ($configureFields) {
32 32
 			$showFields = array_merge($showFields, $configureFields);
33 33
 		}
34 34
 
Please login to merge, or discard this patch.
modules/Reports/views/Edit.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,8 +97,9 @@
 block discarded – undo
97 97
 			$viewer->assign('MODE', 'edit');
98 98
 		} else {
99 99
 			$firstModuleName = reset($modulesList);
100
-			if ($firstModuleName)
101
-				$reportModel->setPrimaryModule($firstModuleName);
100
+			if ($firstModuleName) {
101
+							$reportModel->setPrimaryModule($firstModuleName);
102
+			}
102 103
 			$viewer->assign('MODE', '');
103 104
 		}
104 105
 
Please login to merge, or discard this patch.