Clean code

This commit is contained in:
Laurent Destailleur 2020-11-11 16:08:00 +01:00
parent ad04646c05
commit 741806f47e
3 changed files with 26 additions and 30 deletions

View File

@ -378,9 +378,8 @@ if ($result)
print '<td class="center">';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print ' &nbsp; ';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} else {
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$id.'">';

View File

@ -122,24 +122,6 @@ if (!function_exists("utf8_encode"))
}
print '</td></tr>';
print '<tr><td>MBString support</td><td>';
if (!function_exists("mb_check_encoding"))
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "mbstring");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "mbstring");
}
print '</td></tr>';
print '<tr><td>JSon support</td><td>';
if (!function_exists("json_decode"))
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "json");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "json");
}
print '</td></tr>';
print '</table>';
print '<br>';
@ -156,6 +138,28 @@ print '<td align="center">'.$langs->trans("FunctionTest").'</td>';
print '<td>'.$langs->trans("Result").'</td>';
print '</tr>';
$functions = ["mb_check_encoding"];
$name = "MBString";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
$functions = ["json_decode"];
$name = "JSON";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
$functions = ["imagecreate"];
$name = "GD";
@ -189,7 +193,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
}
@ -428,7 +431,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function
}
$html = "<td>";
$html .= $result ? $langs->trans("PHPSupport".$name) : $langs->trans("ErrorPHPDoesNotSupport".$name);
$html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport".$name);
$html .= "</td>";
return $html;

View File

@ -8,15 +8,9 @@ ConfFileIsNotWritable=Configuration file <b>%s</b> is not writable. Check permis
ConfFileIsWritable=Configuration file <b>%s</b> is writable.
ConfFileMustBeAFileNotADir=Configuration file <b>%s</b> must be a file, not a directory.
ConfFileReload=Reloading parameters from configuration file.
PHPSupportSessions=This PHP supports sessions.
PHPSupportPOSTGETOk=This PHP supports variables POST and GET.
PHPSupportPOSTGETKo=It's possible your PHP setup does not support variables POST and/or GET. Check the parameter <b>variables_order</b> in php.ini.
PHPSupportGD=This PHP supports GD graphical functions.
PHPSupportCurl=This PHP supports Curl.
PHPSupportCalendar=This PHP supports calendars extensions.
PHPSupportUTF8=This PHP supports UTF8 functions.
PHPSupportIntl=This PHP supports Intl functions.
PHPSupportxDebug=This PHP supports extended debug functions.
PHPSupportSessions=This PHP supports sessions.
PHPSupport=This PHP supports %s functions.
PHPMemoryOK=Your PHP max session memory is set to <b>%s</b>. This should be enough.
PHPMemoryTooLow=Your PHP max session memory is set to <b>%s</b> bytes. This is too low. Change your <b>php.ini</b> to set <b>memory_limit</b> parameter to at least <b>%s</b> bytes.