Skip to content
Snippets Groups Projects
Commit 0628da58 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update all page files

parent e6674d60
No related branches found
No related tags found
1 merge request!66php8 only; added variable types; short array syntax; remove glyphicons
This commit is part of merge request !66. Comments created here will be created in the context of that merge request.
Showing
with 604 additions and 578 deletions
......@@ -116,4 +116,3 @@ if (array_key_exists("confirm", $aParams)) {
// -- Ausgabe
echo $sOut;
?>
......@@ -8,9 +8,10 @@
---------------------------------------------------------------------
2023-12-19 Axel <axel.hahn@unibe.ch>
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
$oHtml = new htmlguielements($sPrj);
$oHtml = new htmlguielements();
$BODY =
$renderAdminLTE->addRow(
......@@ -28,7 +29,8 @@ $renderAdminLTE->addRow(
[t('page-about-php'), phpversion()],
]
]),
]), 8
]),
8
)
. $renderAdminLTE->addCol(
$renderAdminLTE->getCard([
......@@ -44,7 +46,8 @@ $renderAdminLTE->addRow(
['winbox 0.2.82', '<a href="https://nextapps-de.github.io/winbox/">https://nextapps-de.github.io/winbox/</a>'],
]
]),
]), 4
]),
4
)
);
......@@ -8,6 +8,8 @@
---------------------------------------------------------------------
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./classes/project_gui.class.php");
......@@ -104,7 +106,8 @@ if (array_key_exists("confirm", $aParams)) {
'type' => 'success',
'variant' => 'outline',
'text' => $sOut,
]), 12
]),
12
)
);
......
......@@ -8,18 +8,17 @@
---------------------------------------------------------------------
2018-02-01 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
$sOK = '<span class="ok">' . t('ok') . '</span>';
$sFAILED = '<span class="error">' . t('error') . '</span>';
$aErrors=array();
$aErrors = [];
global $sOK;
global $sFAILED;
global $aErrors;
// test only
// $aConfig['mirrorPackages']=array('puppet' => array('target' => 'ladmin@calcium.iml.unibe.ch:/share/imldeployment'),);
// ----------------------------------------------------------------------
// functions
// ----------------------------------------------------------------------
......@@ -29,10 +28,12 @@ global $aErrors;
*
* @global string $sOK
* @global string $sFAILED
*
* @param string $sCmd command to execute
* @return string
*/
function myExec($sCmd){
function myExec(string $sCmd): string
{
global $sOK, $sFAILED, $aErrors;
$sReturn = '';
......@@ -99,6 +100,6 @@ foreach ($oPrj1->getProjects() as $sPrj) {
}
if (count($aErrors)) {
echo $oHtml->getBox('error', '<ol><li>'.implode('<li>', $aErrors), '</ol>');
echo $oHtml->getBox('error', '<ol><li>' . implode('<li>', $aErrors). '</ol>');
}
echo $sOut;
......@@ -36,4 +36,3 @@ $sOut = '
// -- Ausgabe
echo $sOut;
?>
......@@ -11,6 +11,8 @@
---------------------------------------------------------------------
2014-03-24 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./classes/project_gui.class.php");
......@@ -30,52 +32,52 @@ if (!array_key_exists("confirm", $aParams)) {
$i = 0;
$aForms = array(
'setup' => array(
'meta' => array(
$aForms = [
'setup' => [
'meta' => [
'method' => 'POST',
'action' => '?',
),
'validate' => array(),
'form' => array(
'input' . $i++ => array(
],
'validate' => [],
'form' => [
'input' . $i++ => [
'type' => 'hidden',
'name' => 'confirm',
'value' => '1',
),
'input' . $i++ => array(
],
'input' . $i++ => [
'type' => 'checkbox',
'name' => 'removeOptions',
'label' => t("page-delete-remove-options"),
'validate' => 'isastring',
'value' => 1,
'options' => array(
'bRemoveRepolinks' => array(
'options' => [
'bRemoveRepolinks' => [
'label' => t("page-delete-cb-label-remove-links-for-repo"),
'checked' => false,
),
'bRemoveArchive' => array(
],
'bRemoveArchive' => [
'label' => t("page-delete-cb-label-remove-archive"),
'checked' => false,
),
'bRemoveConfig' => array(
],
'bRemoveConfig' => [
'label' => t("page-delete-cb-label-remove-config"),
'checked' => true,
),
),
),
'markup' . $i++ => array(
],
],
],
'markup' . $i++ => [
'type' => 'markup',
'value' => '<hr>',
),
'button' . $i++ => array(
],
'button' . $i++ => [
'type' => 'submit',
'class' => 'btn-danger',
'value' => $oHtml->getIcon('delete') . t("page-delete-project-buttonlabel"),
),
),
),
);
],
],
],
];
$oForm = new formgen($aForms);
$sOut .= $oForm->renderHtml("setup");
$sHome = aPrjHome();
......@@ -85,8 +87,8 @@ if (!array_key_exists("confirm", $aParams)) {
// ----- delete the project
$sHome = aHome();
$aOptions = array();
foreach (array("bRemoveRepolinks", "bRemoveArchive", "bRemoveConfig") as $sOption) {
$aOptions = [];
foreach (["bRemoveRepolinks", "bRemoveArchive", "bRemoveConfig"] as $sOption) {
if (array_search($sOption, $aParams["removeOptions"]) !== false) {
$aOptions[$sOption] = 1;
}
......
......@@ -8,6 +8,8 @@
---------------------------------------------------------------------
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./classes/project_gui.class.php");
......@@ -50,39 +52,39 @@ if (array_key_exists("confirm", $aParams)) {
// Eingabe Kommentare zum Deployment
$i = 0;
$aForms = array(
'deploy' => array(
'meta' => array(
$aForms = [
'deploy' => [
'meta' => [
'method' => 'POST',
'action' => '?',
),
'validate' => array(),
'form' => array(
'input' . $i++ => array(
],
'validate' => [],
'form' => [
'input' . $i++ => [
'type' => 'hidden',
'name' => 'confirm',
'value' => '1',
),
'input' . $i++ => array(
],
'input' . $i++ => [
'type' => 'checkbox',
'name' => 'aIgnore',
'label' => t("deploy-settings"),
'validate' => 'isastring',
'options' => array(
'bIgnoreDeploytimes' => array(
'options' => [
'bIgnoreDeploytimes' => [
'label' => t("page-deploy-info-ignore-deploytime"),
'checked' => false,
),
),
),
'button' . $i++ => array(
],
],
],
'button' . $i++ => [
'type' => 'submit',
'class' => $sPhase,
'value' => $oHtml->getIcon('deploy').t("deploy"),
),
),
),
);
],
],
],
];
$oForm = new formgen($aForms);
$sOut .= $oForm->renderHtml("deploy");
......@@ -107,4 +109,3 @@ if (array_key_exists("confirm", $aParams)) {
// -- Ausgabe
echo $sOut;
?>
......@@ -8,28 +8,29 @@
---------------------------------------------------------------------
2013-11-19 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./classes/classinfos.class.php");
$aClasses = array(
"actionlog" => array("name" => "actionLog"),
"cache" => array("name" => "AhCache"),
"config-replacement" => array("name" => "configreplacement"),
"deploy-foreman" => array("name" => "deployForeman"),
"foremanapi" => array("name" => "ForemanApi"),
"formgen" => array("name" => "formgen"),
"htmlguielements" => array("name" => "htmlguielements"),
"ldap" => array("name" => "imlldap"),
"logger" => array("name" => "logger"),
"messenger" => array("name" => "messenger"),
"page" => array("name" => "Page"),
"project" => array("name" => "project"),
"projectlist" => array("name" => "projectlist"),
"rollout_base" => array("name" => "rollout_base"),
"user" => array("name" => "user"),
"vcs.git" => array("name" => "vcs"),
);
$aClasses = [
"actionlog" => ["name" => "actionLog"],
// "cache" => ["name" => "AhCache"),
"config-replacement" => ["name" => "configreplacement"],
"foremanapi" => ["name" => "ForemanApi"],
"formgen" => ["name" => "formgen"],
"htmlguielements" => ["name" => "htmlguielements"],
"ldap" => ["name" => "imlldap"],
"logger" => ["name" => "logger"],
"messenger" => ["name" => "messenger"],
"page" => ["name" => "Page"],
"project" => ["name" => "project"],
"projectlist" => ["name" => "projectlist"],
"rollout_base" => ["name" => "rollout_base"],
"user" => ["name" => "user"],
"vcs.git" => ["name" => "vcs"],
];
$sOut = '';
$sOut .= '<a href="/deployment/all/doc/">Start</a> | ';
......@@ -60,5 +61,3 @@ if (array_key_exists("par3", $aParams)) {
// -- Ausgabe
echo $sOut;
?>
......@@ -4,25 +4,25 @@
IML DEPLOYMENT
webgui - build a package
webgui - html tester
---------------------------------------------------------------------
2014-11-14 Axel <axel.hahn@iml.unibe.ch> selector for branches
2014-02-14 Axel <axel.hahn@iml.unibe.ch> build was "ajaxified"
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./classes/project.class.php");
/**
* helper: render html code for a table row
* helper: get html code for a table row
* @global htmlguielements $oHtml
* @param string $sDescr description
* @param string $sCode php code
* @return string
*/
function addHtmltestTest($sDescr, $sCode){
function addHtmltestTest(string $sDescr, string $sCode): string
{
$oHtml = new htmlguielements();
$sOut = '??';
eval ("\$sOut=$sCode;");
......@@ -52,8 +52,11 @@ $oHtml=new htmlguielements();
// generate a List of al icons
$sIconlist = '';
$sIconlist .= '<strong>Buttons</strong><br>';
foreach ($oHtml->aCfg['buttons'] as $sLabel => $aItems) {
$sIconlist.=$oHtml->getIcon($aItems['icon']).' - '.$sLabel.' - '.$aItems['icon'].'<br>';
$sIconlist .= $oHtml->getIcon((string)$aItems['icon']) . ' - ' . $sLabel . ' - ' . $aItems['icon'] . '<br>';
}
$sIconlist .= '<br><strong>Icons</strong><br>';
foreach ($oHtml->aCfg['icons'] as $sLabel => $sIcon) {
......@@ -75,54 +78,56 @@ $sRows=''
. '<td>-</td>'
. '</tr>'
. addHtmltestTest("Link", "\$oHtml->getLink(array(
. addHtmltestTest("Link", "\$oHtml->getLink([
'href'=>'https://www.axel-hahn.de/',
'icon'=>'fa-globe',
'label'=>'Axels Webseite',
));")
. addHtmltestTest("Link als Button", "\$oHtml->getLinkButton(array(
]);")
. addHtmltestTest("Link als Button", "\$oHtml->getLinkButton([
'href'=>'https://www.axel-hahn.de/',
'target'=>'_blank',
'icon'=>'fa-globe',
'label'=>'Axels Webseite',
));")
. addHtmltestTest("Link als Button mit Type OK", "\$oHtml->getLinkButton(array('type'=>'ok',));")
. addHtmltestTest("Link als Button mit Type close", "\$oHtml->getLinkButton(array('type'=>'close',));")
. addHtmltestTest("Link als Button mit Type error", "\$oHtml->getLinkButton(array('type'=>'error','label'=>'Fehler'));")
]);")
. addHtmltestTest("Link als Button mit Type OK", "\$oHtml->getLinkButton(['type'=>'ok',]);")
. addHtmltestTest("Link als Button mit Type close", "\$oHtml->getLinkButton(['type'=>'close',]);")
. addHtmltestTest("Link als Button mit Type error", "\$oHtml->getLinkButton(['type'=>'error','label'=>'Fehler']);")
// . addHtmltestTest("Tabs", "\$oHtml->getNav(
// array(
// 'options' => array(
// [
// 'options' => [
// 'type'=>'tabs',
// 'justified'=>1,
// ),
// 'tabs' => array(
// ],
// 'tabs' => [
// 'tab 1'=>'Inhalt #1',
// 'tab 2'=>'Inhalt #2',
// ),
// )
// ],
// ]
// );")
// . addHtmltestTest("Tabs", "\$oHtml->getNav(
// array(
// 'options' => array(
// [
// 'options' => [
// 'type'=>'pills',
// 'stacked'=>1,
// ),
// 'tabs' => array(
// ],
// 'tabs' => [
// 'tab 1'=>'Inhalt #1',
// 'tab 2'=>'Inhalt #2',
// ),
// )
// ],
// ]
// );")
. addHtmltestTest("Tabelle", "\$oHtml->getTable(
array(
'header'=>array('A', 'B'),
'body'=>array(
array('Zelle A 1', 'Zelle B 1'),
array('Zelle A 2', 'Zelle B 2'),
array('Zelle A 3', 'Zelle B 3'),
),
));"
. addHtmltestTest(
"Tabelle",
"\$oHtml->getTable(
[
'header'=>['A', 'B'],
'body'=>[
['Zelle A 1', 'Zelle B 1'],
['Zelle A 2', 'Zelle B 2'],
['Zelle A 3', 'Zelle B 3'],
],
]);"
)
;
......
......@@ -8,6 +8,8 @@
---------------------------------------------------------------------
2015-04-21 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./inc_functions.php");
......@@ -100,15 +102,15 @@ if ($oUser->getUsername()) {
$i = 0;
require_once("./classes/formgen.class.php");
$aForms = array(
'login' => array(
'meta' => array(
$aForms = [
'login' => [
'meta' => [
'method' => 'POST',
'action' => '?',
),
'validate' => array(),
'form' => array(
'input' . $i++ => array(
],
'validate' => [],
'form' => [
'input' . $i++ => [
'type' => 'text',
'name' => 'user',
'label' => t('page-login-username'),
......@@ -119,8 +121,8 @@ if ($oUser->getUsername()) {
'placeholder' => t('page-login-username'),
'autofocus' => 'autofocus',
// 'inline' => '1',
),
'input' . $i++ => array(
],
'input' . $i++ => [
'type' => 'password',
'name' => 'password',
'label' => t('page-login-password'),
......@@ -130,17 +132,16 @@ if ($oUser->getUsername()) {
'value' => $aParams['password'],
'placeholder' => t('page-login-password'),
// 'inline' => '1',
),
'input' . $i++ => array(
],
'input' . $i++ => [
'type' => 'submit',
'label' => "",
'name' => 'btnsave',
'label' => t("login"),
'value' => $oHtml->getIcon('sign-ok') . t("login"),
),
),
)
);
],
],
]
];
$oForm = new formgen($aForms);
$sOut .= ''
......@@ -164,7 +165,8 @@ $renderAdminLTE->addRow(
'type' => '',
'variant' => 'outline',
'text' => $sOut,
]),5
]),
5
)
. $renderAdminLTE->addCol('', 4)
);
......@@ -9,10 +9,12 @@
* for a single project
---------------------------------------------------------------------
2014-11-17 Axel <axel.hahn@iml.unibe.ch> added tags and branches
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
2014-04-24 Axel <axel.hahn@iml.unibe.ch> new visual; sortorder in
project overview
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
2014-11-17 Axel <axel.hahn@iml.unibe.ch> added tags and branches
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
......@@ -41,7 +43,7 @@ if (!array_key_exists("prj", $aParams)) {
$sBuildErrorContent = '<p>' . t('build-failes-hint') . '</p>';
if ($iCountOfBuildErrors) {
$aTabdata=array();
$aTabdata = [];
$aErrorfiles = $oPrj->getBuildErrors();
rsort($aErrorfiles);
foreach ($aErrorfiles as $sNumber => $sErrorfile) {
......@@ -52,12 +54,13 @@ if (!array_key_exists("prj", $aParams)) {
. $oPrj->getBuildErrorContent($sErrorfile);
}
/*
$sBuildErrorContent.=$oHtml->getNav(array(
'options' => array(
$sBuildErrorContent.=$oHtml->getNav([
'options' => [
'type'=>'pills',
'justified'=>0,
),
'tabs'=>$aTabdata)
],
'tabs'=>$aTabdata
]
);
*/
$sBuildErrorContent .= $renderAdminLTE->getTabbedContent(['tabs' => $aTabdata]);
......@@ -118,7 +121,8 @@ if (!array_key_exists("prj", $aParams)) {
'type' => 'gray',
'variant' => 'outline',
'text' => $sOut,
]), 12
]),
12
)
/*
$renderAdminLTE->addCol(
......
......@@ -10,6 +10,7 @@
---------------------------------------------------------------------
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
2024-02-28 Axel <axel.hahn@unibe.ch> remove foreman; update replacements
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./classes/project_gui.class.php");
......@@ -25,7 +26,7 @@ if (isset($aParams["par3"])) {
}
if ($sPhase) {
$aWarnings=array();
$aWarnings=[];
$sOutReplace='';
// ----------------------------------------------------------------------
......@@ -65,14 +66,14 @@ if ($sPhase) {
// open all/ close all
if(count($aReplacements)>1){
$sOutReplace.=$oHtml->getLinkButton(array(
$sOutReplace.=$oHtml->getLinkButton([
'onclick'=>'$(\'.divfileinfos\').slideDown(); $(\'.expandable\').removeClass(\'closed\'); this.blur(); return false;',
'icon'=>$oHtml->getIconClass('box-down'),
))
.$oHtml->getLinkButton(array(
])
.$oHtml->getLinkButton([
'onclick'=>'$(\'.divfileinfos\').slideUp(); $(\'.expandable\').addClass(\'closed\'); this.blur(); return false;',
'icon'=>$oHtml->getIconClass('box-up'),
))
])
;
}
......@@ -86,12 +87,12 @@ if ($sPhase) {
$sOutReplace.='<h4>' .
// --- link filename of template to toggle details.
$oHtml->getLink(array(
$oHtml->getLink([
'onclick'=>'$(\'#'.$sDivIdFile.'\').slideToggle(); $(this).toggleClass(\'closed\'); return false;',
'class'=>'expandable closed',
'icon'=>'templatefile',
'label'=>$tTplFile,
)) . '</h4>'
]) . '</h4>'
. '<div id="'.$sDivIdFile.'" class="divfileinfos" style="display: none;">'
;
......
......@@ -10,6 +10,8 @@
---------------------------------------------------------------------
2013-11-08 Axel <axel.hahn@iml.unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
require_once("./classes/project_gui.class.php");
......@@ -19,53 +21,56 @@ $sOut = '';
$sFakePassword = '********************';
// items to mask
$aMask=array(
'auth'=>array(
'ldap'=>array(
$aMask = [
'auth' => [
'ldap' => [
'PwLdapUser' => $sFakePassword
)
),
'foreman'=>array(
]
],
'foreman' => [
'password' => $sFakePassword
),
'projects'=>array(
'ldap'=>array(
],
'projects' => [
'ldap' => [
'PwLdapUser' => $sFakePassword
)
),
);
]
],
];
/**
* hide entries in config array
* @param array $aMask
* @param array $aConfig
* @return type
* @return array
*/
function maskEntries($aMask, $aConfig){
function maskEntries(array $aMask, array $aConfig): array
{
$aReturn = $aConfig;
foreach ($aMask as $sKey => $aValue) {
if (array_key_exists($sKey, $aConfig)){
$aConfig[$sKey]=(is_array($aValue)
? maskEntries($aMask[$sKey], $aConfig[$sKey])
if (array_key_exists($sKey, $aReturn)) {
$aReturn[$sKey] = (is_array($aValue)
? maskEntries($aMask[$sKey], $aReturn[$sKey])
: $aMask[$sKey]
)
;
}
}
return $aConfig;
return $aReturn;
}
/**
* recursive replace of values in a hash
* Recursive replace of values in a hash
* source: https://www.w3schools.in/php-script/recursive-array-replace-by-Key-or-Value/
* FIX: 3x "=" in if($Key === $Find)
*
* @param array $Array Array
* @param string $Find key to scan for
* @param strin $Replace new value
* @param string $Replace new value
* @return array
*/
function ArrayReplace($Array, $Find, $Replace) {
function ArrayReplace(array $Array, string $Find, string $Replace): array
{
if (is_array($Array)) {
foreach ($Array as $Key => $Val) {
if (is_array($Array[$Key])) {
......@@ -106,51 +111,46 @@ if ($aParams["prj"] == "all") {
require_once("./classes/formgen.class.php");
// define editable options
$aMapping=array(
'general'=>array(
'["workDir"]'=>array('type'=>'text'),
'["versionsToKeep"]'=>array('type'=>'text', 'validate'=>'isinteger'),
'["builtsToKeep"]'=>array('type'=>'text', 'validate'=>'isinteger'),
'["lang"]'=>array('type'=>'text'),
),
);
$aMapping = [
'general' => [
'["workDir"]' => ['type' => 'text'],
'["versionsToKeep"]' => ['type' => 'text', 'validate' => 'isinteger'],
'["builtsToKeep"]' => ['type' => 'text', 'validate' => 'isinteger'],
'["lang"]' => ['type' => 'text'],
],
];
foreach ($aConfig['phases'] as $sPhase => $aPhaseData) {
$aMapping['phase-'.$sPhase]=array(
'["phases"]["'.$sPhase.'"]["css"]["bgdark"]'=>array('type'=>'text'),
'["phases"]["'.$sPhase.'"]["css"]["bglight"]'=>array('type'=>'text'),
'["phases"]["'.$sPhase.'"]["css"]["bgbutton"]'=>array('type'=>'text'),
);
/*
if (array_key_exists("deploytimes", $aConfig["phases"][$sPhase])){
$aMapping['phase-'.$sPhase]['["phases"]["'.$sPhase.'"]["deploytimes"]']=array('type'=>'text');
}
*
*/
$aMapping['phase-' . $sPhase] = [
'["phases"]["' . $sPhase . '"]["css"]["bgdark"]' => ['type' => 'text'],
'["phases"]["' . $sPhase . '"]["css"]["bglight"]' => ['type' => 'text'],
'["phases"]["' . $sPhase . '"]["css"]["bgbutton"]' => ['type' => 'text'],
];
}
$aForms = array(
'setup' => array(
'meta' => array(
$aForms = [
'setup' => [
'meta' => [
'method' => 'POST',
'action' => '?',
),
'validate' => array(),
'form' => array(
'input' . $i++ => array(
],
'validate' => [],
'form' => [
'input' . $i++ => [
'type' => 'hidden',
'name' => 'setupaction',
'value' => 'save',
),
),
)
);
],
],
]
];
foreach ($aMapping as $sPartname => $aPartData) {
// add a headline
$aForms['setup']['form']['input' . $i++] = array(
$aForms['setup']['form']['input' . $i++] = [
'type' => 'markup',
'value' => '<h3>' . t('setup-deployment-' . $sPartname) . '</h3>',
);
];
// add input items
foreach ($aPartData as $sName => $aFormOptions) {
......@@ -166,8 +166,8 @@ if ($aParams["prj"] == "all") {
$sFormname = str_replace('"', '', 'aConfig' . $sName);
$aForms['setup']['form']['input' . $i++] = array(
'value' => '<h3>'.t('setup-deployment-'.$sPartname).'</h3>',
$aForms['setup']['form']['input' . $i++] = [
// 'value' => '<h3>' . t('setup-deployment-' . $sPartname) . '</h3>',
'type' => $aFormOptions['type'],
'name' => $sFormname,
'label' => 'aConfig' . $sName,
......@@ -177,7 +177,7 @@ if ($aParams["prj"] == "all") {
'title' => htmlentities($sCfgVal),
'size' => 100,
'placeholder' => htmlentities($sCfgVal),
);
];
}
}
if ($sError) {
......@@ -215,7 +215,8 @@ if ($aParams["prj"] == "all") {
'type' => 'primary',
'variant' => 'outline',
'text' => $sOut,
]), 12
]),
12
)
);
......@@ -232,7 +233,7 @@ if ($aParams["prj"] == "all") {
$aUser2Roles=$oUserCfg->getUser2Roles();
// $aUser2Projects=$oUserCfg->getUser2Projects();
$aUsers=array();
$aUsers=[];
$sOut.=print_r($aUser2Roles,1).'<br>';
$sRoles='';
foreach ($aUser2Roles as $sRole=>$aUserlist){
......@@ -264,9 +265,8 @@ if ($aParams["prj"] == "all") {
$TITLE = t("menu-checklang");
$sOut .= '<p>' . t("page-setup-info-check-lang-intro") . '</p>';
// $sOut.=print_r($aConfig, true);
$aTmp=array();
$aLangs=array();
$aTmp = [];
$aLangs = [];
// --- fetch data
foreach (glob($aConfig["configDir"] . '/lang/*.json') as $filename) {
$sLang = basename($filename);
......@@ -305,8 +305,10 @@ if ($aParams["prj"] == "all") {
$sTable .= '</tr>';
}
$sTable .= '</tbody></table>';
if ($sWarnings)$sWarnings='<ol class="warning">'.$sWarnings.'</ol>';
if ($sErrors)$sErrors='<ol class="error">'.$sErrors.'</ol>';
if ($sWarnings)
$sWarnings = '<ol class="warning">' . $sWarnings . '</ol>';
if ($sErrors)
$sErrors = '<ol class="error">' . $sErrors . '</ol>';
$sOut .= $sErrors . $sWarnings . $sTable;
}
// ------------------------------------------------------------
......@@ -318,7 +320,7 @@ if ($aParams["prj"] == "all") {
require_once("./classes/actionlog.class.php");
$oLog = new Actionlog('');
$sOut.=$oLog->renderLogs(array(), true);
$sOut .= $oLog->renderLogs([], true);
}
// ------------------------------------------------------------
......@@ -331,7 +333,7 @@ if ($aParams["prj"] == "all") {
$oLog = new Actionlog('');
$sOut .= 'TODO'
//. $oLog->renderStats(array(), true)
//. $oLog->renderStats([], true)
;
}
......@@ -368,7 +370,8 @@ if ($aParams["prj"] == "all") {
'type' => 'primary',
'variant' => 'outline',
'text' => $sOut,
]), 12
]),
12
)
);
......
......@@ -6,8 +6,12 @@
VALUESTORE
TODO: use queryparam.class.php
---------------------------------------------------------------------
2023-11-24 Axel <axel.hahn@unibe.ch>
...
2024-09-03 Axel <axel.hahn@unibe.ch> php8 only; added variable types; short array syntax
###################################################################### */
......@@ -18,26 +22,26 @@ $TITLE=t('menu-valuestore');
// ----------------------------------------------------------------------
/**
* show an error message and quit with http status code 400 (Bad request)
* Show an error message and quit with http status code 400 (Bad request)
* @param string $sMessage message to show
* @return boolean
* @return void
*/
function quit($sMessage)
function quit(string $sMessage): void
{
$sProtocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
header("$sProtocol 400: Bad request");
die("<h1>Bad request</h1>" . $sMessage);
return false;
die("<h1>Bad request</h1>$sMessage");
}
/**
* get a request param from GET and POST scope (POST has priority) and
* Get a request param from GET and POST scope (POST has priority) and
* verify it with execution of a cleanup array
*
* @param string $sKey key to search for in GET or POST
* @param string $sRegex4Cleanup regex for filtering
* @return type
* @return bool|string
*/
function getParam($sKey, $sRegex4Cleanup = false)
function getParam(string $sKey, string $sRegex4Cleanup = ''): bool|string
{
$sValue = false;
if (array_key_exists($sKey, $_GET)) {
......@@ -65,7 +69,7 @@ if (!$_GET || !count($_GET)) {
quit("no parameter was found.");
}
foreach (array("action", "project") as $sKey) {
foreach (["action", "project"] as $sKey) {
if (!array_key_exists($sKey, $_GET)) {
quit("value required: $sKey=");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment