diff options
author | habeascodice <habeascodice@federated.social> | 2014-11-13 13:30:29 -0800 |
---|---|---|
committer | habeascodice <habeascodice@federated.social> | 2014-11-13 13:30:29 -0800 |
commit | 2dbecf95454993cdf4996d2d65463d7759cd479b (patch) | |
tree | cbef39a4779efed1c0ab3b61a9ff09e37fadb49e /include/datetime.php | |
parent | bc02b933727da7a000d43d2d7d495f066616dc81 (diff) | |
parent | ac27db22c18ee7a82a52cbadb3efe2760b910499 (diff) | |
download | volse-hubzilla-2dbecf95454993cdf4996d2d65463d7759cd479b.tar.gz volse-hubzilla-2dbecf95454993cdf4996d2d65463d7759cd479b.tar.bz2 volse-hubzilla-2dbecf95454993cdf4996d2d65463d7759cd479b.zip |
Merge branch 'master' of https://github.com/habeascodice/red
Diffstat (limited to 'include/datetime.php')
-rw-r--r-- | include/datetime.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/include/datetime.php b/include/datetime.php index fe0f29c7a..270be5e3d 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -134,7 +134,17 @@ function dob($dob) { if(! $f) $f = 'ymd'; - $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob'); + if($dob === '0000-00-00') + $value = ''; + else + $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d')); + + $o = '<input type="text" name="dob" value="' . $value . '" placeholder="' . t('YYYY-MM-DD or MM-DD') . '" />'; + +// if ($dob && $dob != '0000-00-00') +// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob'); +// else +// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob'); return $o; } @@ -450,7 +460,10 @@ function update_birthdays() { require_once('include/permissions.php'); $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_dob > utc_timestamp() + interval 7 day and abook_dob < utc_timestamp() + interval 14 day"); + WHERE abook_dob > %s + interval %s and abook_dob < %s + interval %s", + db_utcnow(), db_quoteinterval('7 day'), + db_utcnow(), db_quoteinterval('14 day') + ); if($r) { foreach($r as $rr) { @@ -472,7 +485,7 @@ function update_birthdays() { $z = event_store_event($ev); if($z) { $item_id = event_store_item($ev,$z); - q("update abook set abook_dob = '%s' where abook_id = %d limit 1", + q("update abook set abook_dob = '%s' where abook_id = %d", dbesc(intval($rr['abook_dob']) + 1 . substr($rr['abook_dob'],4)), intval($rr['abook_id']) ); |