Forráskód Böngészése

fix in social import

Lucas Marcouiller 3 éve
szülő
commit
c887f48dee

+ 1 - 1
htdocs/core/lib/functions.lib.php

@@ -2951,7 +2951,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
 		} else {
 			if (!empty($dictsocialnetworks[$type]['url'])) {
 				$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
-				$htmllink .= '&nbsp;<a href="'.$link.'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
+				$htmllink .= '&nbsp;<a href="'.dol_sanitizeUrl($link).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
 			} else {
 				$htmllink .= dol_escape_htmltag($value);
 			}

+ 5 - 3
htdocs/core/modules/import/import_csv.modules.php

@@ -717,14 +717,16 @@ class ImportCsv extends ModeleImports
 								$socialkey = array_search("socialnetworks", $listfields);
 								if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
 									$socialnetwork = explode("_", $fieldname)[1];
-									$newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\'';
-									$listvalues[$socialkey] = $newvalue;
+									$json = new stdClass();
+									$json->$socialnetwork = $newval;
+									$newvalue = json_encode($json);
+									$listvalues[$socialkey] = "'".$this->db->escape($newvalue)."'";
 								} else {
 									$socialnetwork = explode("_", $fieldname)[1];
 									$jsondata = $listvalues[$socialkey];
 									$jsondata = str_replace("'", "", $jsondata);
 									$json = json_decode($jsondata);
-									$json->$socialnetwork = $this->db->escape($newval);
+									$json->$socialnetwork = $newval;
 									$listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'";
 								}
 							}

+ 3 - 1
htdocs/core/modules/import/import_xlsx.modules.php

@@ -760,7 +760,9 @@ class ImportXlsx extends ModeleImports
 								$socialkey = array_search("socialnetworks", $listfields);
 								if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
 									$socialnetwork = explode("_", $fieldname)[1];
-									$newvalue = '\'{ "'.$socialnetwork.'" : "'.$this->db->escape($newval).'" }\'';
+									$json = new stdClass();
+									$json->$socialnetwork = $newval;
+									$newvalue = json_encode($json);
 									$listvalues[$socialkey] = $newvalue;
 								} else {
 									$socialnetwork = explode("_", $fieldname)[1];