Compare commits

...

2 Commits

Author SHA1 Message Date
a62842fa35 Merge branch 'master' of ssh://git.lutran.fr:2244/franzz/databap 2021-11-15 19:44:06 +01:00
68a178d445 Fix color customization 2021-11-15 19:43:49 +01:00

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()
@@ -2912,7 +2910,7 @@ 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);