* Api: Restrict customfield options read from a file to only JSON files. Files should contain an array of options.

ex:
[
  { "value": "Α", "label": "α alpha" },
  { "value": "Β", "label": "β beta" }
]
This commit is contained in:
nathan 2023-07-10 14:43:32 -06:00
parent 0632068664
commit 6286679b0c
12 changed files with 17 additions and 14 deletions

View File

@ -27,7 +27,7 @@
'%1' copied to clipboard common cs '%1' zkopírováno do schránky
'%1' has an invalid format common cs '%1' má nesprávný formát !
'%1' has an invalid format !!! common cs '%1' má nesprávný formát !!!
'%1' is no php file in the egw server root (%2)! common cs '%1' není php souborem v server root EGw (%2)!
'%1' is not a valid json file! common cs '%1' není json souborem v server root EGw!
'%1' is not a valid date !!! common cs '%1' není platné datum !!!
'%1' is not a valid floatingpoint number !!! common cs '%1' není platné číslo s pohyblivou desetinnou čárkou !!!
'%1' is not a valid integer !!! common cs '%1' není platné celé číslo

View File

@ -29,7 +29,7 @@
'%1' copied to clipboard common de '%1' in die Zwischenablage kopiert
'%1' has an invalid format common de '%1' hat ein ungültiges Format !!!
'%1' has an invalid format !!! common de '%1' hat ein ungültiges Format !!!
'%1' is no php file in the egw server root (%2)! common de '%1' ist keine php Datei in dem EGW Server Wurzelverzeichnis (%2)!
'%1' is not a valid json file! common de '%1' ist keine json Datei in dem EGW Server Wurzelverzeichnis!
'%1' is not a valid date !!! common de '%1' ist ein ungültiges Datum !!!
'%1' is not a valid floatingpoint number !!! common de '%1' ist keine gültige Gleitkommazahl !!!
'%1' is not a valid integer !!! common de '%1' ist keine gültige Ganzzahl !!!

View File

@ -29,7 +29,7 @@
'%1' copied to clipboard common en '%1' copied to clipboard
'%1' has an invalid format common en '%1' has an invalid format
'%1' has an invalid format !!! common en '%1' has an invalid format!
'%1' is no php file in the egw server root (%2)! common en '%1' is no php file in the eGW server root (%2)!
'%1' is not a valid json file! common en '%1' is not a valid json file
'%1' is not a valid date !!! common en '%1' is not a valid date!
'%1' is not a valid floatingpoint number !!! common en '%1' is not a valid floating point number!
'%1' is not a valid integer !!! common en '%1' is not a valid integer!

View File

@ -29,7 +29,7 @@
'%1' copied to clipboard common es-es %1' copiado en el portapapeles
'%1' has an invalid format common es-es '%1' no tiene un formato válido
'%1' has an invalid format !!! common es-es ¡'%1' no tiene un formato válido!
'%1' is no php file in the egw server root (%2)! common es-es ¡'%1' no es un archivo php en el directorio raíz de EGroupware (%2)!
'%1' is not a valid json file! common es-es ¡'%1' no es un archivo json en el directorio raíz de EGroupware!
'%1' is not a valid date !!! common es-es ¡'%1' no es una fecha válida!
'%1' is not a valid floatingpoint number !!! common es-es ¡'%1' no es un número válido de coma flotante!
'%1' is not a valid integer !!! common es-es ¡'%1' no es un entero válido!

View File

@ -20,7 +20,7 @@
%s readonly common fi %s vain lukuoikeus
'%1' copied to clipboard common fi '%1' kopioitu leikepöydälle
'%1' has an invalid format !!! common fi %1 on väärässä muodossa!
'%1' is no php file in the egw server root (%2)! common fi '%1' ei ole PHP tiedosto EGroupwaren server rootissa (%2)!
'%1' is not a valid json file! common fi '%1' ei ole json tiedosto EGroupwaren server rootissa!
'%1' is not a valid date !!! common fi %1 on epäkelpo päiväys!
'%1' is not a valid floatingpoint number !!! common fi %1 ei ole desimaaliluku!
'%1' is not a valid integer !!! common fi %1 ei ole kokonaisluku!

View File

@ -16,7 +16,6 @@
%s readonly common id %s readonly
'%1' copied to clipboard common id '%1' disalin ke clipboard
'%1' has an invalid format !!! common id '%1' has an invalid format !!!
'%1' is no php file in the egw server root (%2)! common id '%1' is no php file in the eGW server root (%2)!
'%1' is not a valid date !!! common id '%1' is not a valid date !!!
'%1' is not a valid floatingpoint number !!! common id '%1' is not a valid floatingpoint number !!!
'%1' is not a valid integer !!! common id '%1' is not a valid integer !!!

View File

@ -27,7 +27,7 @@
'%1' copied to clipboard common ja '%1' がクリップボードにコピーされました。
'%1' has an invalid format common ja '%1' のフォーマットが不正です。
'%1' has an invalid format !!! common ja '%1' のフォーマットが不正です!
'%1' is no php file in the egw server root (%2)! common ja '%1' is no php file in the eGW server root (%2)!
'%1' is not a valid json file! common ja '%1' is no json file in the eGW server root!
'%1' is not a valid date !!! common ja '%1' の日付が不正です!
'%1' is not a valid floatingpoint number !!! common ja '%1' は不正な浮動小数です!
'%1' is not a valid integer !!! common ja '%1' は無効な整数です!

View File

@ -20,7 +20,7 @@
%s readonly common pt-br %s apenas leitura
'%1' copied to clipboard common pt-br %1' copiado para prancheta
'%1' has an invalid format !!! common pt-br '%1' está em um formato inválido !!!
'%1' is no php file in the egw server root (%2)! common pt-br '%1' não é um arquivo php na pasta raiz do servidor eGW (%2)!
'%1' is not a valid json file! common pt-br '%1' não é um arquivo json na pasta raiz do servidor eGW!
'%1' is not a valid date !!! common pt-br '%1' não é uma data válida !!!
'%1' is not a valid floatingpoint number !!! common pt-br %1' não é um número válido para o ponto flutuante!!!
'%1' is not a valid integer !!! common pt-br %1' não é um inteiro válido!!!

View File

@ -24,7 +24,7 @@
'%1' copied to clipboard common ru '%1' скопировано в буфер обмена
'%1' has an invalid format common ru Неверный формат '%1'
'%1' has an invalid format !!! common ru '%1' имеет неверный формат!
'%1' is no php file in the egw server root (%2)! common ru '%1' нет файла php в корневом каталоге eGW (%2)!
'%1' is not a valid json file! common ru '%1' нет файла json в корневом каталоге eGW!
'%1' is not a valid date !!! common ru '%1' неверная дата!
'%1' is not a valid floatingpoint number !!! common ru '%1' неверное число с плавающей запятой!
'%1' is not a valid integer !!! common ru '%1' неверное целое !

View File

@ -29,7 +29,7 @@
'%1' copied to clipboard common sk '%1' skopírované do schránky
'%1' has an invalid format common sk '%1' má nesprávny formát!
'%1' has an invalid format !!! common sk '%1' má nesprávny formát!
'%1' is no php file in the egw server root (%2)! common sk '%1' nie je php súborom v root adresári eGW servera (%2)!
'%1' is not a valid json file! common sk '%1' nie je json súborom v root adresári eGW servera!
'%1' is not a valid date !!! common sk '%1' nie je platný dátum!
'%1' is not a valid floatingpoint number !!! common sk '%1' nie je platné číslo s plávajúcou desatinnou čiarkou!
'%1' is not a valid integer !!! common sk '%1' nie je platné celé číslo !

View File

@ -27,7 +27,7 @@
'%1' copied to clipboard common sl '%1' se kopira v odložišče
'%1' has an invalid format common sl '%1' ima nepravilen format
'%1' has an invalid format !!! common sl '%1' ima nepravilen format
'%1' is no php file in the egw server root (%2)! common sl '%1' ni datoteka php v koraku eGW strežnika (%2)!
'%1' is not a valid json file! common sl '%1' ni datoteka json v koraku eGW strežnika!
'%1' is not a valid date !!! common sl '%1' ni veljaven datum !!!
'%1' is not a valid floatingpoint number !!! common sl '%1' ni pravilno decimalno število
'%1' is not a valid integer !!! common sl '%1' ni pravilno celo število

View File

@ -291,12 +291,16 @@ class Customfields implements \IteratorAggregate
$options = array();
if(!($path = Api\Vfs::resolve_url($file)) || // file does not exist // we are NOT inside the eGW root
basename($path, '.php') . '.php' != basename($path) || // extension is NOT .php
basename($path, '.json') . '.json' != basename($path) || // extension is NOT .php
basename($path) == 'header.inc.php') // dont allow to include our header again
{
return array(lang("'%1' is no php file in the eGW server root (%2)!" . ': ' . $path, $file, EGW_SERVER_ROOT));
return array(lang("'%1' is not a valid json file!", $file));
}
$options = json_decode(file_get_contents($path), true);
if($options === null)
{
return array(lang("'%1' is not a valid json file!", $file));
}
include($path);
return $options;
}