Completed
Branch develop (14bc9d)
by
unknown
24:28
created
htdocs/admin/remotestore/class/externalModules.class.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -185,10 +185,10 @@  discard block
 block discarded – undo
185 185
 			$httpheader[] = 'Authorization: Basic '.base64_encode($basicAuthLogin.':'.$basicAuthPassword);
186 186
 		}
187 187
 
188
-		$url = $this->dolistore_api_url . (preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/') . $resource;
188
+		$url = $this->dolistore_api_url.(preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/').$resource;
189 189
 
190 190
 		if ($options) {
191
-			$url .= '?' . http_build_query($options);
191
+			$url .= '?'.http_build_query($options);
192 192
 		}
193 193
 
194 194
 		$response = getURLContent($url, 'POST', '', 1, $httpheader);
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 		$modules = array();
213 213
 
214 214
 		if (!empty($this->cache_file) && file_exists($this->cache_file)) {
215
-			dol_syslog(__METHOD__ . " - Loading cache file: " . $this->cache_file, LOG_DEBUG);
215
+			dol_syslog(__METHOD__." - Loading cache file: ".$this->cache_file, LOG_DEBUG);
216 216
 
217 217
 			$content = file_get_contents($this->cache_file);
218 218
 			if ($content !== false) {
219 219
 				$modules = $this->readYaml($content);
220 220
 			} else {
221
-				dol_syslog(__METHOD__ . " - Error reading cache file", LOG_ERR);
221
+				dol_syslog(__METHOD__." - Error reading cache file", LOG_ERR);
222 222
 			}
223 223
 		}
224 224
 
@@ -243,20 +243,20 @@  discard block
 block discarded – undo
243 243
 		if (isset($resCategories['response']) && is_array($resCategories['response'])) {
244 244
 			$organized_tree = $resCategories['response'];
245 245
 		} else {
246
-			return $html ;
246
+			return $html;
247 247
 		}
248 248
 
249 249
 		$html = '';
250 250
 		foreach ($organized_tree as $key => $value) {
251 251
 			if ($value['label'] != "Versions" && $value['label'] != "Specials") {
252 252
 				$html .= '<li>';
253
-				$html .= '<a href="?mode=marketplace&categorie=' . $value['rowid'] . '">' . $value['label'] . '</a>';
253
+				$html .= '<a href="?mode=marketplace&categorie='.$value['rowid'].'">'.$value['label'].'</a>';
254 254
 				if (isset($value['children'])) {
255 255
 					$html .= '<ul>';
256 256
 					usort($value['children'], $this->buildSorter('position'));
257 257
 					foreach ($value['children'] as $key_children => $value_children) {
258 258
 						$html .= '<li>';
259
-						$html .= '<a href="?mode=marketplace&categorie=' . $value_children['rowid'] . '" title="' . dol_escape_htmltag(strip_tags($value_children['description'])) . '">' . $value_children['label'] . '</a>';
259
+						$html .= '<a href="?mode=marketplace&categorie='.$value_children['rowid'].'" title="'.dol_escape_htmltag(strip_tags($value_children['description'])).'">'.$value_children['label'].'</a>';
260 260
 						$html .= '</li>';
261 261
 					}
262 262
 					$html .= '</ul>';
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
 		$this->categorie = $options['categorie'] ?? 0;
287 287
 		$this->per_page  = $options['per_page'] ?? 11;
288
-		$this->no_page  = $options['no_page'] ?? 1;
288
+		$this->no_page = $options['no_page'] ?? 1;
289 289
 		$this->search    = $options['search'] ?? '';
290 290
 
291 291
 		$data = [
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		// fetch from github repo
311 311
 		$fileProducts = array();
312 312
 		if (!empty($this->githubFileStatus) && $options['search_source_github'] == 1) {
313
-			$fileProducts = $this->fetchModulesFromFile($data);			// Return an array with all modules from the cache filecontent in $data
313
+			$fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data
314 314
 			$fileProducts = $this->adaptData($fileProducts, 'githubcommunity');
315 315
 			$fileProducts = $this->applyFilters($fileProducts, $data);
316 316
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			 * @param array<string, mixed> $b Second product for comparison.
329 329
 			 * @return int
330 330
 			 */
331
-			static function ($a, $b) {
331
+			static function($a, $b) {
332 332
 				return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0');
333 333
 			}
334 334
 		);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 				if ($product['source'] === 'githubcommunity') {
368 368
 					$download_link = '<a class="paddingleft paddingright" target="_blank" href="'.$product["link"].'"><img width="32" src="'.DOL_URL_ROOT.'/admin/remotestore/img/follow.png" /></a>';
369 369
 					if (!empty($product['direct-download']) && $product['direct-download'] == 'yes') {
370
-						$urldownload = $product["dolistore-download"];		// In a future, we will have the download to the zip file
370
+						$urldownload = $product["dolistore-download"]; // In a future, we will have the download to the zip file
371 371
 						$reg = array();
372 372
 						if (preg_match('/https:.*\?id=(\d+)$/', $urldownload, $reg)) {
373 373
 							$urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p='.$reg[1];
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
 			//output template
421 421
 			$html .= '<tr class="app oddeven '.dol_escape_htmltag($compatible).'">';
422 422
 			$html .= '<td class="center" width="160"><div class="newAppParent">';
423
-			$html .= $newapp.$images;	// No dol_escape_htmltag, it is already escape html
423
+			$html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html
424 424
 			$html .= '</div></td>';
425 425
 			$html .= '<td class="margeCote"><h2 class="appTitle">';
426 426
 			$html .= dol_escape_htmltag(dol_string_nohtmltag($product["label"]));
427 427
 			$html .= '<br><small>';
428
-			$html .= $version;			// No dol_escape_htmltag, it is already escape html
428
+			$html .= $version; // No dol_escape_htmltag, it is already escape html
429 429
 			$html .= '</small></h2>';
430 430
 			$html .= '<small> ';
431 431
 			if (empty($product['tms'])) {
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		}
466 466
 
467 467
 
468
-		return $html ;
468
+		return $html;
469 469
 	}
470 470
 
471 471
 	/**
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 		 * @param array<string, mixed> $b
483 483
 		 * @return int
484 484
 		 */
485
-		function (array $a, array $b) use ($key) {
485
+		function(array $a, array $b) use ($key) {
486 486
 			$valA = isset($a[$key]) && is_scalar($a[$key]) ? (string) $a[$key] : '';
487 487
 			$valB = isset($b[$key]) && is_scalar($b[$key]) ? (string) $b[$key] : '';
488 488
 
@@ -625,12 +625,12 @@  discard block
 block discarded – undo
625 625
 		}
626 626
 
627 627
 		// Get the predefined error message or use a default one
628
-		$error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: ' . $request['status_code'];
628
+		$error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: '.$request['status_code'];
629 629
 
630 630
 		// Append error details if available
631 631
 		if (!empty($request['response']) && isset($request['response']['errors']) && is_array($request['response']['errors'])) {
632 632
 			foreach ($request['response']['errors'] as $error) {
633
-				$error_message .= ' - (Code ' . $error['code'] . '): ' . $error['message'];
633
+				$error_message .= ' - (Code '.$error['code'].'): '.$error['message'];
634 634
 			}
635 635
 		}
636 636
 
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 			 *
857 857
 			 * @return int
858 858
 			 */
859
-			static function ($a, $b) {
859
+			static function($a, $b) {
860 860
 				return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0');
861 861
 			}
862 862
 		);
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 				 *
872 872
 				 * @return bool
873 873
 				 */
874
-				static function ($package) use ($options) {
874
+				static function($package) use ($options) {
875 875
 					return stripos($package['label'], $options['search']) !== false || stripos($package['description'], $options['search']) !== false;
876 876
 				}
877 877
 			);
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 				 *
888 888
 				 * @return bool
889 889
 				 */
890
-				static function ($package) use ($options) {
890
+				static function($package) use ($options) {
891 891
 					return in_array($options['categorieid'], $package['category']);
892 892
 				}
893 893
 			);
Please login to merge, or discard this patch.
htdocs/admin/modules.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 $options['no_page']   		= ((int) GETPOSTINT('no_page') ? GETPOSTINT('no_page') : 1);
90 90
 $options['categorie'] 		= ((int) (GETPOSTINT('categorie') ? GETPOSTINT('categorie') : 0));
91 91
 $options['search']    		= GETPOST('search_keyword', 'alpha');
92
-$options['search_source_dolistore']	= GETPOSTINT('search_source_dolistore');
93
-$options['search_source_github']	= GETPOSTINT('search_source_github');
92
+$options['search_source_dolistore'] = GETPOSTINT('search_source_dolistore');
93
+$options['search_source_github'] = GETPOSTINT('search_source_github');
94 94
 
95 95
 // Set default values
96 96
 if (empty($options['search_source_dolistore']) && empty($options['search_source_github'])) {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 				//var_dump($modulenamearrays);exit;
334 334
 
335 335
 				// Lop on each packages (can have several if package is a metapackage)
336
-				if (! $error) {
336
+				if (!$error) {
337 337
 					foreach ($modulenamearrays as $modulenameval) {
338 338
 						if (strpos($modulenameval, '#') === 0) {
339 339
 							continue; // Discard comments
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			'search_version' => '-1'
403 403
 		);
404 404
 		$queryString = http_build_query($searchParams);
405
-		$redirectUrl = DOL_URL_ROOT . '/admin/modules.php?' . $queryString;
405
+		$redirectUrl = DOL_URL_ROOT.'/admin/modules.php?'.$queryString;
406 406
 
407 407
 		$message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules"));
408 408
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 								} else {
604 604
 									$familykey = $objMod->family;
605 605
 								}
606
-								'@phan-var-force string $familykey';  // if not, phan considers $familykey may be null
606
+								'@phan-var-force string $familykey'; // if not, phan considers $familykey may be null
607 607
 
608 608
 								$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
609 609
 								if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) {
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
710 710
 
711 711
 // Start to show page
712
-$deschelp  = '';
712
+$deschelp = '';
713 713
 if ($mode == 'common' || $mode == 'commonkanban') {
714 714
 	$desc = $langs->trans("ModulesDesc", '{picto}');
715 715
 	$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 		}
997 997
 
998 998
 		if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) {
999
-			$checkRes = $objMod->checkForCompliance();	// Check if module is reported as non compliant with Dolibarr rules and law
999
+			$checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law
1000 1000
 			if (!is_numeric($checkRes) && $checkRes != '') {
1001 1001
 				$langs->load("errors");
1002 1002
 				setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors');
Please login to merge, or discard this patch.