NULL_DATE is now a constant

This commit is contained in:
Michael 2017-02-27 23:37:15 +00:00
commit 0afb0c2ea4
21 changed files with 162 additions and 146 deletions

View file

@ -534,11 +534,11 @@ function contacts_content(App $a) {
$insecure = t('Private communications are not available for this contact.');
$last_update = (($contact['last-update'] == '0000-00-00 00:00:00')
$last_update = (($contact['last-update'] <= NULL_DATE)
? t('Never')
: datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
if($contact['last-update'] !== '0000-00-00 00:00:00')
if($contact['last-update'] > NULL_DATE)
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
@ -558,7 +558,7 @@ function contacts_content(App $a) {
// tabs
$tab_str = contacts_tab($a, $contact_id, 2);
$lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
if ($contact['network'] == NETWORK_FEED)
$fetch_further_information = array('fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t('Fetch further information for feeds'),

View file

@ -60,7 +60,7 @@ function events_post(App $a) {
}
if ($nofinish) {
$finish = '0000-00-00 00:00:00';
$finish = NULL_DATE;
}
if ($finish_text) {

View file

@ -75,7 +75,7 @@ function hovercard_content() {
'tags' => $contact["keywords"],
// 'nsfw' => intval($contact["nsfw"]),
// 'server_url' => $contact["server_url"],
'bd' => (($contact["birthday"] == "0000-00-00") ? "" : $contact["birthday"]),
'bd' => (($contact["birthday"] <= "0001-01-01") ? "" : $contact["birthday"]),
// 'generation' => $contact["generation"],
'account_type' => account_type($contact),
'actions' => $actions,

View file

@ -191,21 +191,21 @@ function profiles_post(App $a) {
return;
}
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0001-01-01'; // FIXME: Needs to be validated?
$y = substr($dob,0,4);
if((! ctype_digit($y)) || ($y < 1900))
$ignore_year = true;
else
$ignore_year = false;
if($dob != '0000-00-00') {
if(strpos($dob,'0000-') === 0) {
if($dob > '0001-01-01') {
if(strpos($dob,'000') === 0) {
$ignore_year = true;
$dob = substr($dob,5);
}
$dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
if($ignore_year)
$dob = '0000-' . $dob;
$dob = '0001-' . $dob;
}
$name = notags(trim($_POST['name']));
@ -234,7 +234,7 @@ function profiles_post(App $a) {
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
if(! strlen($howlong))
$howlong = '0000-00-00 00:00:00';
$howlong = NULL_DATE;
else
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
@ -721,7 +721,7 @@ function profiles_content(App $a) {
'$gender' => gender_selector($r[0]['gender']),
'$marital' => marital_selector($r[0]['marital']),
'$with' => array('with', t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), t('Examples: cathy123, Cathy Williams, cathy@example.com')),
'$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
'$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))),
'$sexual' => sexpref_selector($r[0]['sexual']),
'$about' => array('about', t('Tell us about yourself...'), $r[0]['about']),
'$xmpp' => array('xmpp', t('XMPP (Jabber) address:'), $r[0]['xmpp'], t("The XMPP address will be propagated to your contacts so that they can follow you.")),

View file

@ -872,7 +872,7 @@ function settings_content(App $a) {
$mail_pubmail = ((dbm::is_result($r)) ? $r[0]['pubmail'] : 0);
$mail_action = ((dbm::is_result($r)) ? $r[0]['action'] : 0);
$mail_movetofolder = ((dbm::is_result($r)) ? $r[0]['movetofolder'] : '');
$mail_chk = ((dbm::is_result($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
$mail_chk = ((dbm::is_result($r)) ? $r[0]['last_check'] : NULL_DATE);
$tpl = get_markup_template("settings_connectors.tpl");