$input_errors[]=sprintf(gettext("Cannot use a reserved keyword as alias name %s"),$rk);
$input_errors[]=sprintf(gettext("Cannot use a reserved keyword as alias name %s"),$rk);
...
@@ -164,8 +163,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -164,8 +163,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
break;
break;
}
}
}
}
if(is_validaliasname($pconfig['name'])!==true){
$input_errors[]=gettext("The alias name must be less than 32 characters long and may only consist of the characters")." a-z, A-Z, 0-9, _.";
$valid=is_validaliasname($pconfig['name']);
if($valid===false){
$input_errors[]=sprintf(gettext('The name must be less than 32 characters long and may only consist of the following characters: %s'),'a-z, A-Z, 0-9, _');
}elseif($valid===null){
$input_errors[]=sprintf(gettext('The name cannot be the internally reserved keyword "%s".'),$pconfig['name']);
$input_errors[]=gettext("The alias name may only consist of the characters")." a-z, A-Z, 0-9, _.";
if($valid===false){
$input_errors[]=sprintf(gettext('The name must be less than 32 characters long and may only consist of the following characters: %s'),'a-z, A-Z, 0-9, _');
}elseif($valid===null){
$input_errors[]=sprintf(gettext('The name cannot be the internally reserved keyword "%s".'),$pconfig['name']);
}
}
/* check for name duplicates */
/* check for name duplicates */
...
@@ -58,6 +61,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -58,6 +61,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors[]=gettext("An alias with this name already exists.");
$input_errors[]=gettext("An alias with this name already exists.");
}
}
// Keywords not allowed in names
$reserved_keywords=array();
// Add all Load balance names to reserved_keywords
// Add all Load balance names to reserved_keywords
@@ -113,18 +113,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -113,18 +113,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig=$_POST;
$pconfig=$_POST;
// validate
// validate
if(strtolower($pconfig['name'])=="lan")
if(strtolower($pconfig['name'])=='lan'){
$input_errors[]=gettext("Schedule may not be named LAN.");
$input_errors[]=gettext('Schedule may not be named LAN.');
if(strtolower($pconfig['name'])=="wan")
$input_errors[]=gettext("Schedule may not be named WAN.");
if(strtolower($pconfig['name'])=="")
$input_errors[]=gettext("Schedule name cannot be blank.");
$x=is_validaliasname($pconfig['name']);
if(!isset($x)){
$input_errors[]=gettext("Reserved word used for schedule name.");
}elseif($x==false){
$input_errors[]=gettext("The schedule name may only consist of the characters a-z, A-Z, 0-9");
}
}
if(strtolower($pconfig['name'])=='wan'){
$input_errors[]=gettext('Schedule may not be named WAN.');
}
if(empty($pconfig['name'])){
$input_errors[]=gettext('Schedule may not use a blank name.');
}
$valid=is_validaliasname($pconfig['name']);
if($valid===false){
$input_errors[]=sprintf(gettext('The schedule name must be less than 32 characters long and may only consist of the following characters: %s'),'a-z, A-Z, 0-9, _');
}elseif($valid===null){
$input_errors[]=sprintf(gettext('The schedule name cannot be the internally reserved keyword "%s".'),$pconfig['name']);
@@ -76,8 +76,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
...
@@ -76,8 +76,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if(empty($pconfig['name'])){
if(empty($pconfig['name'])){
$input_errors[]=gettext("A valid gateway group name must be specified.");
$input_errors[]=gettext("A valid gateway group name must be specified.");
}
}
if(!is_validaliasname($pconfig['name'])){
$input_errors[]=gettext("The gateway name must not contain invalid characters.");
$valid=is_validaliasname($pconfig['name']);
if($valid===false){
$input_errors[]=sprintf(gettext('The name must be less than 32 characters long and may only consist of the following characters: %s'),'a-z, A-Z, 0-9, _');
}elseif($valid===null){
$input_errors[]=sprintf(gettext('The name cannot be the internally reserved keyword "%s".'),$pconfig['name']);
@@ -57,9 +57,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
...
@@ -57,9 +57,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if(!isset($pconfig['name'])){
if(!isset($pconfig['name'])){
$input_errors[]=gettext("A valid gateway name must be specified.");
$input_errors[]=gettext("A valid gateway name must be specified.");
}
}
if(!is_validaliasname($pconfig['name'])){
$input_errors[]=gettext("The gateway name must not contain invalid characters.");
$valid=is_validaliasname($pconfig['name']);
if($valid===false){
$input_errors[]=sprintf(gettext('The name must be less than 32 characters long and may only consist of the following characters: %s'),'a-z, A-Z, 0-9, _');
}elseif($valid===null){
$input_errors[]=sprintf(gettext('The name cannot be the internally reserved keyword "%s".'),$pconfig['name']);
}
}
/* skip system gateways which have been automatically added */
/* skip system gateways which have been automatically added */