Skip to content

Commit 31c46e1

Browse files
xh3n1Sam Tuke
authored andcommitted
check if domain is set, also increase length (#431)
Signed-off-by: Xheni Myrtaj <[email protected]>
1 parent e4a97e4 commit 31c46e1

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

public_html/lists/admin/defaults.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,29 @@ function readentry($file)
4848
if ($lc_name == '') {
4949
Fatal_Error($GLOBALS['I18N']->get('Name cannot be empty:')." $lc_name");
5050
}
51-
$lc_name = getNewAttributeTablename($lc_name);
51+
5252

5353
$typeValue = 'select';
54-
if($lc_name === 'termsofservice'){
54+
$terms = 'termsofservice';
55+
$adult = 'subscriberisanadult';
56+
57+
if ($lc_name == '') {
58+
Fatal_Error($GLOBALS['I18N']->get('Name cannot be empty:')." $lc_name");
59+
}
60+
$lc_name = getNewAttributeTablename($lc_name);
61+
62+
if(substr($lc_name, 0, strlen($terms)) === $terms){
5563
$typeValue = 'checkbox';
56-
$name.= getConfig('domain');
64+
if(getConfig('domain')!==null && getConfig('domain')!==''){
65+
$name.= getConfig('domain');
66+
} else $name.= 'our website';
67+
5768
}
58-
if($lc_name === 'subscriberisanadult'){
69+
if(substr($lc_name, 0, strlen($adult)) === $adult){
5970
$typeValue= 'checkbox';
6071
}
6172

62-
$query = sprintf('insert into %s (name,type,required,tablename) values("%s","%s",%d,"%s")',
73+
$query = sprintf('insert into %s (name,type,required,tablename) values("%s","%s",%d,"%s")',
6374
$tables['attribute'], addslashes($name), $typeValue, 1, $lc_name);
6475
Sql_Query($query);
6576
$insertid = Sql_Insert_id();

public_html/lists/admin/inc/userlib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ function getNewAttributeTablename($name)
11451145
} else {
11461146
$table = 'attribute';
11471147
}
1148-
$lc_name = substr(preg_replace("/\W/", '', strtolower($name)), 0, 10);
1148+
$lc_name = substr(preg_replace("/\W/", '', strtolower($name)), 0, 25);
11491149
// if ($lc_name == "") Fatal_Error("Name cannot be empty: $lc_name");
11501150
if (!$lc_name) {
11511151
$lc_name = 'attribute';

0 commit comments

Comments
 (0)