diff options
author | Habeas Codice <habeascodice@federated.social> | 2015-02-16 15:09:43 -0800 |
---|---|---|
committer | Habeas Codice <habeascodice@federated.social> | 2015-02-16 15:09:43 -0800 |
commit | ca8e22101803454be60af35d2cf71ae80224805a (patch) | |
tree | 946111723a3150ee75ed7dbab0951b7f595a18cc /include/zot.php | |
parent | 972fc91e12b08eb0aae31c448b7879408ddab229 (diff) | |
download | volse-hubzilla-ca8e22101803454be60af35d2cf71ae80224805a.tar.gz volse-hubzilla-ca8e22101803454be60af35d2cf71ae80224805a.tar.bz2 volse-hubzilla-ca8e22101803454be60af35d2cf71ae80224805a.zip |
normalize age data
mysql has type tinyint(3) which probably turns into a 24-bit value, but
postgres uses 3-digit decimal as its constraint (probably what the mysql
schema was intended to do). either that or mysql silently truncates while
postgres respects the constraint. Either way, bad data gets in unchecked, now
it's checked.
Diffstat (limited to 'include/zot.php')
-rw-r--r-- | include/zot.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/zot.php b/include/zot.php index da6ca16c3..cbe0c9303 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2243,6 +2243,11 @@ function import_directory_profile($hash,$profile,$addr,$ud_flags = UPDATE_FLAGS_ $r = q("select * from xprof where xprof_hash = '%s' limit 1", dbesc($hash) ); + + $age = intval($arr['xprof_age']); + if($age > 150) + $age = 150; + if($r) { $update = false; foreach($r[0] as $k => $v) { @@ -2271,7 +2276,7 @@ function import_directory_profile($hash,$profile,$addr,$ud_flags = UPDATE_FLAGS_ where xprof_hash = '%s'", dbesc($arr['xprof_desc']), dbesc($arr['xprof_dob']), - intval($arr['xprof_age']), + $age, dbesc($arr['xprof_gender']), dbesc($arr['xprof_marital']), dbesc($arr['xprof_sexual']), @@ -2294,7 +2299,7 @@ function import_directory_profile($hash,$profile,$addr,$ud_flags = UPDATE_FLAGS_ dbesc($arr['xprof_hash']), dbesc($arr['xprof_desc']), dbesc($arr['xprof_dob']), - intval($arr['xprof_age']), + $age, dbesc($arr['xprof_gender']), dbesc($arr['xprof_marital']), dbesc($arr['xprof_sexual']), |