Merge branch 'master' into develop

This commit is contained in:
Eric
2019-02-15 17:44:59 +01:00
5 changed files with 27 additions and 30 deletions

View File

@@ -5,8 +5,7 @@
<rank>15</rank>
<parent>AdminTools</parent>
<url>status.php</url>
<enable_class>ResourceAdminMenu</enable_class>
<enable_action>UR_ACTION_MODIFY</enable_action>
<enable_admin_only>1</enable_admin_only>
</menu>
</menus>
</itop_design>

View File

@@ -84,10 +84,10 @@ function CheckDBPasswordInNewConfig($sSafeContent)
{
$bIsWindows = (array_key_exists('WINDIR', $_SERVER) || array_key_exists('windir', $_SERVER));
if ($bIsWindows && (preg_match("@'db_pwd' => '[^%']+',@", $sSafeContent) === 0))
if ($bIsWindows && (preg_match("@'db_pwd' => '[^%!\"]+',@U", $sSafeContent) === 0))
{
// Unsupported Password
throw new Exception("Database password should not contain % character (backups won't work)...");
throw new Exception("On Windows, database password must not contain %, ! or \" character (backups won't work)...");
}
}

View File

@@ -5,8 +5,7 @@
<rank>50</rank>
<parent>AdminTools</parent>
<url>config.php</url>
<enable_class>ResourceAdminMenu</enable_class>
<enable_action>UR_ACTION_MODIFY</enable_action>
<enable_admin_only>1</enable_admin_only>
</menu>
</menus>
</itop_design>

View File

@@ -44,17 +44,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
$('#dlg_'+me.id).remove();
});
$('#linkedset_'+me.id+' :input').off('change').on('change', function() {
if (!($(this).hasClass('selection')) && !($(this).hasClass('select_all'))) {
var oCheckbox = $(this).closest('tr').find('.selection');
var iLink = oCheckbox.attr('data-link-id');
var iUniqueId = oCheckbox.attr('data-unique-id');
var sAttCode = $(this).closest('.attribute-edit').attr('data-attcode');
var value = $(this).val();
return me.OnValueChange(iLink, iUniqueId, sAttCode, value);
}
return true;
});
me.RegisterChange();
var oInput = $('#'+this.iInputId);
oInput.bind('update_value', function() { $(this).val(me.GetUpdatedValue()); });
@@ -348,17 +338,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
this.OnLinkAdded = function(iAddedId, iRemote)
{
this.AddLink(iAddedId, iRemote);
$('#linkedset_'+me.id+' :input').off('change').on('change', function() {
if (!($(this).hasClass('selection'))) {
var oCheckbox = $(this).closest('tr').find('.selection');
var iLink = oCheckbox.attr('data-link-id');
var iUniqueId = oCheckbox.attr('data-unique-id');
var sAttCode = $(this).closest('.attribute-edit').attr('data-attcode');
var value = $(this).val();
return me.OnValueChange(iLink, iUniqueId, sAttCode, value);
}
return true;
});
me.RegisterChange();
};
this.UpdateSizes = function(event, ui)
@@ -435,6 +415,22 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
return JSON.stringify(aValues);
};
this.RegisterChange = function()
{
// Listen only used inputs
$('#linkedset_'+me.id+' :input[name^="attr_'+me.sAttCode+'["]').off('change').on('change', function() {
if (!($(this).hasClass('selection'))) {
var oCheckbox = $(this).closest('tr').find('.selection');
var iLink = oCheckbox.attr('data-link-id');
var iUniqueId = oCheckbox.attr('data-unique-id');
var sAttCode = $(this).closest('.attribute-edit').attr('data-attcode');
var value = $(this).val();
return me.OnValueChange(iLink, iUniqueId, sAttCode, value);
}
return true;
});
};
this.OnValueChange = function(iLink, iUniqueId, sAttCode, value)
{
var sFormPrefix = me.iInputId;
@@ -476,5 +472,8 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
});
var sToBeCreated = JSON.stringify(aToBeCreated);
$('<input type="hidden" name="attr_'+me.sAttCode+'_tbc">').val(sToBeCreated).appendTo(oDiv);
// Remove unused inputs
$('#linkedset_'+me.id+' :input[name^="attr_'+me.sAttCode+'["]').prop("disabled", true);
};
}

View File

@@ -1304,11 +1304,11 @@ EOF
$sDBName = $aParameters['db_name'];
$bIsWindows = (array_key_exists('WINDIR', $_SERVER) || array_key_exists('windir', $_SERVER));
if ($bIsWindows && (strpos($sDBPwd, '%') !== false))
if ($bIsWindows && (preg_match('@([%!"])@',$sDBPwd) > 0))
{
// Unsuported Password, disable the "Next" button
$oPage->add_ready_script('$("#wiz_form").data("db_connection", "error");');
$oPage->add_ready_script('$("#db_info").html("<img src=\'../images/error.png\'/>&nbsp;Database password cannot contain % character...");');
$oPage->add_ready_script('$("#db_info").html("<img src=\'../images/error.png\'/>&nbsp;On Windows, database password must not contain %, ! or &quot; character");');
}
else
{