mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°4517 - PHP 8.1: Replace htmlentities(***, ENT_QUOTES, 'UTF-8') with utils::EscapeHtml
This commit is contained in:
@@ -1020,23 +1020,21 @@ class SetupUtils
|
||||
|
||||
//-- DB connection params
|
||||
$oPage->add('<tbody>');
|
||||
$oPage->add('<tr><td>Server Name:</td><td><input id="db_server" class="ibo-input" type="text" name="db_server" value="'.htmlentities($sDBServer, ENT_QUOTES, 'UTF-8').'" size="15"/></td><td><i class="fas fa-question-circle setup-input--hint--icon" data-tooltip-content="E.g. \'localhost\', \'dbserver.mycompany.com\' or \'192.142.10.23\'"></i></td></tr>');
|
||||
$oPage->add('<tr><td>Login:</td><td><input id="db_user" class="ibo-input" type="text" name="db_user" value="'
|
||||
.htmlentities($sDBUser, ENT_QUOTES, 'UTF-8')
|
||||
$oPage->add('<tr><td>Server Name:</td><td><input id="db_server" class="ibo-input" type="text" name="db_server" value="'.utils::EscapeHtml($sDBServer).'" size="15"/></td><td><i class="fas fa-question-circle setup-input--hint--icon" data-tooltip-content="E.g. \'localhost\', \'dbserver.mycompany.com\' or \'192.142.10.23\'"></i></td></tr>');
|
||||
$oPage->add('<tr><td>Login:</td><td><input id="db_user" class="ibo-input" type="text" name="db_user" value="'.utils::EscapeHtml($sDBUser)
|
||||
.'" size="15"/></td><td><i class="fas fa-question-circle setup-input--hint--icon" data-tooltip-content="The account must have the following privileges on the database: SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, CREATE VIEW, SHOW VIEW, LOCK TABLE, SUPER, TRIGGER"></i></td></tr>');
|
||||
$oPage->add('<tr><td>Password:</td><td><input id="db_pwd" class="ibo-input" autocomplete="off" type="password" name="db_pwd" value="'.htmlentities($sDBPwd, ENT_QUOTES, 'UTF-8').'" size="15"/></td></tr>');
|
||||
$oPage->add('<tr><td>Password:</td><td><input id="db_pwd" class="ibo-input" autocomplete="off" type="password" name="db_pwd" value="'.utils::EscapeHtml($sDBPwd).'" size="15"/></td></tr>');
|
||||
$oPage->add('</tbody></table>');
|
||||
|
||||
//-- TLS params (N°1260)
|
||||
$sTlsEnabledChecked = $bTlsEnabled ? ' checked' : '';
|
||||
$sTlsCaDisabled = $bTlsEnabled ? '' : ' disabled';
|
||||
$sTlsCaDisabled = $bTlsEnabled ? '' : ' disabled';
|
||||
$oPage->add('<div id="tls_options" class="collapsable-options">');
|
||||
$oPage->add('<span data-role="setup-collapsable-options--toggler"><img id="db_tls_img"><label>Use TLS encrypted connection</label></span>');
|
||||
$oPage->add('<div class="message message-error" style="display:none;">Before configuring MySQL with TLS encryption, read the documentation <a href="'.$sMysqlTlsWikiPageUrl.'" target="_blank">on Combodo\'s Wiki</a></div>');
|
||||
$oPage->add('<label style="display:none;"><input id="db_tls_enabled" type="checkbox" '.$sTlsEnabledChecked.' name="db_tls_enabled" value="1"> Encrypted connection enabled</label>');
|
||||
$oPage->add('<div class="setup-tls--input--container" style="display:none">SSL CA:');
|
||||
$oPage->add('<input id="db_tls_ca" class="ibo-input" autocomplete="off" type="text" name="db_tls_ca" value="'.htmlentities($sTlsCA,
|
||||
ENT_QUOTES, 'UTF-8').'" size="15"'.$sTlsCaDisabled.'>');
|
||||
$oPage->add('<input id="db_tls_ca" class="ibo-input" autocomplete="off" type="text" name="db_tls_ca" value="'.utils::EscapeHtml($sTlsCA,).'" size="15"'.$sTlsCaDisabled.'>');
|
||||
$oPage->add('Path to certificate authority file for SSL</div>');
|
||||
$oPage->add('</div>');
|
||||
|
||||
@@ -1047,22 +1045,18 @@ class SetupUtils
|
||||
$oPage->add('');
|
||||
$oPage->add('<fieldset><legend>Database</legend>');
|
||||
$oPage->add('<table>');
|
||||
if ($bIsItopInstall)
|
||||
{
|
||||
if ($bIsItopInstall) {
|
||||
$oPage->add('<tr><td><input type="radio" id="create_db" name="create_db" value="yes"/><label for="create_db"> Create a new database:</label></td>');
|
||||
$oPage->add('<td><input id="db_new_name" class="ibo-input" type="text" name="db_new_name" value="'.htmlentities($sNewDBName, ENT_QUOTES, 'UTF-8').'" size="15" maxlength="32"/><span style="width:20px;" id="v_db_new_name"></span></td></tr>');
|
||||
$oPage->add('<td><input id="db_new_name" class="ibo-input" type="text" name="db_new_name" value="'.utils::EscapeHtml($sNewDBName).'" size="15" maxlength="32"/><span style="width:20px;" id="v_db_new_name"></span></td></tr>');
|
||||
$oPage->add('<tr><td><input type="radio" id="existing_db" name="create_db" value="no"/><label for="existing_db"> Use the existing database:</label></td>');
|
||||
$oPage->add('<td id="db_name_container" class="ibo-input-select-wrapper"><input id="db_name" class="ibo-input ibo-input-select" name="db_name" size="15" maxlen="32" value="'.htmlentities($sDBName, ENT_QUOTES, 'UTF-8').'"/><span style="width:20px;" id="v_db_name"></span></td></tr>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$oPage->add('<tr><td>Database Name:</td><td id="db_name_container" class="ibo-input-select-wrapper"><input id="db_name" class="ibo-input ibo-input-select" name="db_name" size="15" maxlen="32" value="'.htmlentities($sDBName, ENT_QUOTES, 'UTF-8').'"/><span style="width:20px;" id="v_db_name"></span></td></tr>');
|
||||
$oPage->add('<td id="db_name_container" class="ibo-input-select-wrapper"><input id="db_name" class="ibo-input ibo-input-select" name="db_name" size="15" maxlen="32" value="'.utils::EscapeHtml($sDBName).'"/><span style="width:20px;" id="v_db_name"></span></td></tr>');
|
||||
} else {
|
||||
$oPage->add('<tr><td>Database Name:</td><td id="db_name_container" class="ibo-input-select-wrapper"><input id="db_name" class="ibo-input ibo-input-select" name="db_name" size="15" maxlen="32" value="'.utils::EscapeHtml($sDBName).'"/><span style="width:20px;" id="v_db_name"></span></td></tr>');
|
||||
}
|
||||
$oPage->add('</table>');
|
||||
$oPage->add('<div id="prefix_option" class="collapsable-options">');
|
||||
$oPage->add('<span data-role="setup-collapsable-options--toggler"><label style="font-weight: normal;"><img>Use shared database</label></span>');
|
||||
$oPage->add('<div class="setup-prefix-toggler--input--container" style="display:none">Use a prefix for the tables:<input id="db_prefix" class="ibo-input" type="text" name="db_prefix" value="'.htmlentities($sDBPrefix,
|
||||
ENT_QUOTES, 'UTF-8').'" size="15"/><span style="width:20px;" id="v_db_prefix"></span></div>');
|
||||
$oPage->add('<div class="setup-prefix-toggler--input--container" style="display:none">Use a prefix for the tables:<input id="db_prefix" class="ibo-input" type="text" name="db_prefix" value="'.utils::EscapeHtml($sDBPrefix).'" size="15"/><span style="width:20px;" id="v_db_prefix"></span></div>');
|
||||
$oPage->add('</div>');
|
||||
$oPage->add('</fieldset>');
|
||||
$oPage->add('<span id="table_info"></span>');
|
||||
@@ -1476,23 +1470,18 @@ JS
|
||||
}
|
||||
}
|
||||
|
||||
if ($checks['databases'] == null)
|
||||
{
|
||||
$sDBNameInput = '<input id="db_name" name="db_name" size="15" maxlen="32" value="'.htmlentities($sDBName, ENT_QUOTES, 'UTF-8').'"/><span style="width:20px;" id="v_db_name"></span>';
|
||||
if ($checks['databases'] == null) {
|
||||
$sDBNameInput = '<input id="db_name" name="db_name" size="15" maxlen="32" value="'.utils::EscapeHtml($sDBName).'"/><span style="width:20px;" id="v_db_name"></span>';
|
||||
$oPage->add_ready_script(
|
||||
<<<JS
|
||||
<<<JS
|
||||
$("#table_info").html('<div class="message message-error"><span class="message-title">Error:</span>Not enough rights to enumerate the databases</div>');
|
||||
JS
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sDBNameInput = '<select id="db_name" class="ibo-input ibo-input-select" name="db_name">';
|
||||
foreach ($checks['databases'] as $sDatabaseName)
|
||||
{
|
||||
if ($sDatabaseName != 'information_schema')
|
||||
{
|
||||
$sEncodedName = htmlentities($sDatabaseName, ENT_QUOTES, 'UTF-8');
|
||||
foreach ($checks['databases'] as $sDatabaseName) {
|
||||
if ($sDatabaseName != 'information_schema') {
|
||||
$sEncodedName = utils::EscapeHtml($sDatabaseName);
|
||||
$sSelected = ($sDatabaseName == $sDBName) ? ' selected ' : '';
|
||||
$sDBNameInput .= '<option value="'.$sEncodedName.'" '.$sSelected.'>'.$sEncodedName.'</option>';
|
||||
}
|
||||
@@ -1541,8 +1530,7 @@ JS
|
||||
$aLanguages = SetupUtils::GetAvailableLanguages($sSourceDir);
|
||||
foreach ($aLanguages as $sCode => $aInfo) {
|
||||
$sSelected = ($sCode == $sDefaultLanguageCode) ? 'selected ' : '';
|
||||
$sHtml .= '<option value="'.$sCode.'" '.$sSelected.'>'.htmlentities($aInfo['description'], ENT_QUOTES,
|
||||
'UTF-8').' ('.htmlentities($aInfo['localized_description'], ENT_QUOTES, 'UTF-8').')</option>';
|
||||
$sHtml .= '<option value="'.$sCode.'" '.$sSelected.'>'.utils::EscapeHtml($aInfo['description']).' ('.utils::EscapeHtml($aInfo['localized_description']).')</option>';
|
||||
}
|
||||
$sHtml .= '</select></div>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user