Fix color customization

This commit is contained in:
2021-11-15 19:43:49 +01:00
parent 1c4b1f93b3
commit 68a178d445

View File

@@ -313,8 +313,7 @@ class Databap extends PhpObject
{ {
if($sType!='') if($sType!='')
{ {
if($sType!='' && !array_key_exists($sType, self::$TYPES)) self::addError('Type "'.$sType.'" inconnu'); if(array_key_exists($sType, self::$TYPES)) $asResult = array($sType=>self::$TYPES[$sType]);
else $asResult = array($sType=>self::$TYPES[$sType]);
} }
else $asResult = self::$TYPES; else $asResult = self::$TYPES;
@@ -328,8 +327,7 @@ class Databap extends PhpObject
$asResult[$sType] = array(); $asResult[$sType] = array();
foreach($oInfo as $sInfo) foreach($oInfo as $sInfo)
{ {
if(!array_key_exists($sInfo, $asTypeInfo)) self::addError('Info "'.$sInfo.'" inconnue'); if(array_key_exists($sInfo, $asTypeInfo)) $asResult[$sType][$sInfo] = $asTypeInfo[$sInfo];
else $asResult[$sType][$sInfo] = $asTypeInfo[$sInfo];
} }
if($bUnique) $asResult[$sType] = $asResult[$sType][$sInfo]; if($bUnique) $asResult[$sType] = $asResult[$sType][$sInfo];
} }
@@ -808,7 +806,7 @@ class Databap extends PhpObject
return $asPost; return $asPost;
} }
private function getRemotePageDom($sUrl) private function getRemotePageDom($sUrl): DOMDocument
{ {
$oDom = new DOMDocument(); $oDom = new DOMDocument();
if(mb_substr($sUrl, 0, 4)!='http') $sUrl = 'http://'.$sUrl; if(mb_substr($sUrl, 0, 4)!='http') $sUrl = 'http://'.$sUrl;
@@ -1769,7 +1767,7 @@ class Databap extends PhpObject
} }
else $sDesc = 'Nom de chan non autorisé (nom de personne / nom de société interdit)'; else $sDesc = 'Nom de chan non autorisé (nom de personne / nom de société interdit)';
return self::getJsonPostResult($bSuccess, $sDesc, $asVars); return $this->getJsonPostResult($bSuccess, $sDesc, $asVars);
} }
private function isUserConnected($iChanId=0, $iUserId=0) private function isUserConnected($iChanId=0, $iUserId=0)
@@ -2844,7 +2842,7 @@ class Databap extends PhpObject
public function getUrlAvailability($sLink) public function getUrlAvailability($sLink)
{ {
$bAvailable = !$this->checkValue(self::URL_TABLE, array('phrase'=>$sLink)); $bAvailable = !$this->checkValue(self::URL_TABLE, array('phrase'=>$sLink));
return self::getJsonPostResult($bAvailable, ''); return $this->getJsonPostResult($bAvailable, '');
} }
public function resetChanSafeNames() public function resetChanSafeNames()
@@ -2911,8 +2909,8 @@ class Databap extends PhpObject
//Inserting Color Anchors //Inserting Color Anchors
$asDefaultValues = $this->getDefaultOptionValues($asStyleParams, false); $asDefaultValues = $this->getDefaultOptionValues($asStyleParams, false);
foreach($asDefaultValues as $iOptionNameId=>$sDefaultValue) $asColorAnchors[$iOptionNameId] = '[OPT#'.$iOptionNameId.']'; foreach($asDefaultValues as $iOptionNameId=>$sDefaultValue) $asColorAnchors[$iOptionNameId] = '[OPT#'.$iOptionNameId.']';
$sStyle = str_replace($asDefaultValues, $asColorAnchors, $sStyle); $sStyle = str_ireplace($asDefaultValues, $asColorAnchors, $sStyle);
//Switching color Anchors with user colors //Switching color Anchors with user colors
$asOptionvalues = $this->getUserOptions($asStyleParams); $asOptionvalues = $this->getUserOptions($asStyleParams);