aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ItemObject.php2
-rw-r--r--include/account.php7
-rw-r--r--include/conversation.php2
-rw-r--r--include/datetime.php2
-rwxr-xr-xinclude/diaspora.php2
-rw-r--r--include/dir_fns.php4
-rw-r--r--include/externals.php2
-rw-r--r--include/identity.php2
-rwxr-xr-xinclude/items.php28
-rw-r--r--include/message.php2
-rw-r--r--include/onepoll.php2
-rw-r--r--include/poller.php10
-rw-r--r--include/zot.php2
13 files changed, 34 insertions, 33 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index b4a60762b..451e369b0 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -256,7 +256,7 @@ class Item extends BaseObject {
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''),
- 'expiretime' => (($item['expires'] !== '0000-00-00 00:00:00') ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''),
+ 'expiretime' => (($item['expires'] !== NULL_DATE) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''),
'lock' => $lock,
'verified' => $verified,
'unverified' => $unverified,
diff --git a/include/account.php b/include/account.php
index 6cc203dc8..9b4dc409c 100644
--- a/include/account.php
+++ b/include/account.php
@@ -108,7 +108,7 @@ function create_account($arr) {
$parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 );
$flags = ((x($arr,'account_flags')) ? intval($arr['account_flags']) : ACCOUNT_OK);
$roles = ((x($arr,'account_roles')) ? intval($arr['account_roles']) : 0 );
- $expires = ((x($arr,'expires')) ? intval($arr['expires']) : '0000-00-00 00:00:00');
+ $expires = ((x($arr,'expires')) ? intval($arr['expires']) : NULL_DATE);
$default_service_class = get_config('system','default_service_class');
@@ -511,8 +511,9 @@ function user_approve($hash) {
function downgrade_accounts() {
$r = q("select * from account where not ( account_flags & %d )
- and account_expires != '0000-00-00 00:00:00'
+ and account_expires != '%s'
and account_expires < UTC_TIMESTAMP() ",
+ dbesc(NULL_DATE),
intval(ACCOUNT_EXPIRED)
);
@@ -528,7 +529,7 @@ function downgrade_accounts() {
$x = q("UPDATE account set account_service_class = '%s', account_expires = '%s'
where account_id = %d limit 1",
dbesc($basic),
- dbesc('0000-00-00 00:00:00'),
+ dbesc(NULL_DATE),
intval($rr['account_id'])
);
$ret = array('account' => $rr);
diff --git a/include/conversation.php b/include/conversation.php
index c346a204c..05ae72d61 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -707,7 +707,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
'editedtime' => (($item['edited'] != $item['created']) ? sprintf( t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : ''),
- 'expiretime' => (($item['expires'] !== '0000-00-00 00:00:00') ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''),
+ 'expiretime' => (($item['expires'] !== NULL_DATE) ? sprintf( t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')):''),
'location' => $location,
'indent' => '',
'owner_name' => $owner_name,
diff --git a/include/datetime.php b/include/datetime.php
index 0214b9e4c..84ab1e2fa 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -271,7 +271,7 @@ function relative_date($posted_date,$format = null) {
$abs = strtotime($localtime);
- if (is_null($posted_date) || $posted_date === '0000-00-00 00:00:00' || $abs === False) {
+ if (is_null($posted_date) || $posted_date === NULL_DATE || $abs === False) {
return t('never');
}
diff --git a/include/diaspora.php b/include/diaspora.php
index 27843e4c7..0d797d915 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -700,7 +700,7 @@ function diaspora_request($importer,$xml) {
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
- dbesc('0000-00-00 00:00:00'),
+ dbesc(NULL_DATE),
intval(($default_perms) ? 0 : ABOOK_FLAG_PENDING)
);
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 5fad6567e..f58e7c307 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -107,7 +107,7 @@ function sync_directories($dirmode) {
$r = array(
'site_url' => DIRECTORY_FALLBACK_MASTER,
'site_flags' => DIRECTORY_MODE_PRIMARY,
- 'site_update' => '0000-00-00 00:00:00',
+ 'site_update' => NULL_DATE,
'site_directory' => DIRECTORY_FALLBACK_MASTER . '/dirsearch',
'site_realm' => DIRECTORY_REALM
);
@@ -137,7 +137,7 @@ function sync_directories($dirmode) {
// for brand new directory servers, only load the last couple of days. Everything before that will be repeats.
- $syncdate = (($rr['site_sync'] === '0000-00-00 00:00:00') ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']);
+ $syncdate = (($rr['site_sync'] === NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']);
$x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate));
if(! $x['success'])
diff --git a/include/externals.php b/include/externals.php
index ad2c71ac9..acfaae3b6 100644
--- a/include/externals.php
+++ b/include/externals.php
@@ -60,7 +60,7 @@ function externals_run($argv, $argc){
}
if($url) {
- if($r[0]['site_pull'] !== '0000-00-00 00:00:00')
+ if($r[0]['site_pull'] !== NULL_DATE)
$mindate = urlencode(datetime_convert('','',$r[0]['site_pull'] . ' - 1 day'));
else {
$days = get_config('externals','since_days');
diff --git a/include/identity.php b/include/identity.php
index 282d323be..d8f59e56c 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -1042,7 +1042,7 @@ function advanced_profile(&$a) {
if($a->profile['with']) $profile['marital']['with'] = bbcode($a->profile['with']);
- if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
+ if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== NULL_DATE) {
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
}
diff --git a/include/items.php b/include/items.php
index a0a19be1f..b93bf05ee 100755
--- a/include/items.php
+++ b/include/items.php
@@ -144,7 +144,7 @@ function filter_insecure($channel_id,$arr) {
function comments_are_now_closed($item) {
- if($item['comments_closed'] !== '0000-00-00 00:00:00') {
+ if($item['comments_closed'] !== NULL_DATE) {
$d = datetime_convert();
if($d > $item['comments_closed'])
return true;
@@ -448,7 +448,7 @@ function post_activity_item($arr) {
function get_public_feed($channel,$params) {
$type = 'xml';
- $begin = '0000-00-00 00:00:00';
+ $begin = NULL_DATE;
$end = '';
$start = 0;
$records = 40;
@@ -459,7 +459,7 @@ function get_public_feed($channel,$params) {
$params = array();
$params['type'] = ((x($params,'type')) ? $params['type'] : 'xml');
- $params['begin'] = ((x($params,'begin')) ? $params['begin'] : '0000-00-00 00:00:00');
+ $params['begin'] = ((x($params,'begin')) ? $params['begin'] : NULL_DATE);
$params['end'] = ((x($params,'end')) ? $params['end'] : datetime_convert('UTC','UTC','now'));
$params['start'] = ((x($params,'start')) ? $params['start'] : 0);
$params['records'] = ((x($params,'records')) ? $params['records'] : 40);
@@ -758,14 +758,14 @@ function get_item_elements($x) {
$arr['expires'] = ((x($x,'expires') && $x['expires'])
? datetime_convert('UTC','UTC',$x['expires'])
- : '0000-00-00 00:00:00');
+ : NULL_DATE);
$arr['commented'] = ((x($x,'commented') && $x['commented'])
? datetime_convert('UTC','UTC',$x['commented'])
: $arr['created']);
$arr['comments_closed'] = ((x($x,'comments_closed') && $x['comments_closed'])
? datetime_convert('UTC','UTC',$x['comments_closed'])
- : '0000-00-00 00:00:00');
+ : NULL_DATE);
$arr['title'] = (($x['title']) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8',false) : '');
@@ -1003,7 +1003,7 @@ function encode_item($item) {
if($y = encode_item_flags($item))
$x['flags'] = $y;
- if($item['comments_closed'] !== '0000-00-00 00:00:00')
+ if($item['comments_closed'] !== NULL_DATE)
$x['comments_closed'] = $item['comments_closed'];
$x['public_scope'] = $scope;
@@ -1242,8 +1242,8 @@ function get_mail_elements($x) {
$arr['title'] = (($x['title'])? htmlspecialchars($x['title'],ENT_COMPAT,'UTF-8',false) : '');
$arr['created'] = datetime_convert('UTC','UTC',$x['created']);
- if((! array_key_exists('expires',$x)) || ($x['expires'] === '0000-00-00 00:00:00'))
- $arr['expires'] = '0000-00-00 00:00:00';
+ if((! array_key_exists('expires',$x)) || ($x['expires'] === NULL_DATE))
+ $arr['expires'] = NULL_DATE;
else
$arr['expires'] = datetime_convert('UTC','UTC',$x['expires']);
@@ -1839,9 +1839,9 @@ function item_store($arr,$allow_exec = false) {
$arr['owner_xchan'] = ((x($arr,'owner_xchan')) ? notags(trim($arr['owner_xchan'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
$arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
- $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : '0000-00-00 00:00:00');
+ $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : NULL_DATE);
$arr['commented'] = ((x($arr,'commented') !== false) ? datetime_convert('UTC','UTC',$arr['commented']) : datetime_convert());
- $arr['comments_closed'] = ((x($arr,'comments_closed') !== false) ? datetime_convert('UTC','UTC',$arr['comments_closed']) : '0000-00-00 00:00:00');
+ $arr['comments_closed'] = ((x($arr,'comments_closed') !== false) ? datetime_convert('UTC','UTC',$arr['comments_closed']) : NULL_DATE);
$arr['received'] = datetime_convert();
$arr['changed'] = datetime_convert();
@@ -2248,7 +2248,7 @@ function item_store_update($arr,$allow_exec = false) {
$arr['edited'] = ((x($arr,'edited') !== false) ? datetime_convert('UTC','UTC',$arr['edited']) : datetime_convert());
$arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : $orig[0]['expires']);
- if(array_key_exists('comments_closed',$arr) && $arr['comments_closed'] != '0000-00-00 00:00:00')
+ if(array_key_exists('comments_closed',$arr) && $arr['comments_closed'] != NULL_DATE)
$arr['comments_closed'] = datetime_convert('UTC','UTC',$arr['comments_closed']);
else
$arr['comments_closed'] = $orig[0]['comments_closed'];
@@ -3018,7 +3018,7 @@ function mail_store($arr) {
$arr['from_xchan'] = ((x($arr,'from_xchan')) ? notags(trim($arr['from_xchan'])) : '');
$arr['to_xchan'] = ((x($arr,'to_xchan')) ? notags(trim($arr['to_xchan'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
- $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : '0000-00-00 00:00:00');
+ $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : NULL_DATE);
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
$arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : '');
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
@@ -4076,7 +4076,7 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$result = array();
$mindate = datetime_convert('UTC','UTC',$mindate);
if(! $mindate)
- $mindate = '0000-00-00 00:00:00';
+ $mindate = NULL_DATE;
$mindate = dbesc($mindate);
@@ -4092,7 +4092,7 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$sql_extra = item_permissions_sql($uid);
}
- if($mindate != '0000-00-00 00:00:00') {
+ if($mindate != NULL_DATE) {
$sql_extra .= " and ( created > '$mindate' or edited > '$mindate' ) ";
$limit = "";
}
diff --git a/include/message.php b/include/message.php
index 607166ec9..96c3532c1 100644
--- a/include/message.php
+++ b/include/message.php
@@ -23,7 +23,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$subject = t('[no subject]');
// if(! $expires)
-// $expires = '0000-00-00 00:00:00';
+// $expires = NULL_DATE;
// else
// $expires = datetime_convert(date_default_timezone_get(),'UTC',$expires);
diff --git a/include/onepoll.php b/include/onepoll.php
index d64785f92..1f28852e9 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -67,7 +67,7 @@ function onepoll_run($argv, $argc){
logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['xchan_name']}, CONTACT: {$contact['xchan_name']}");
- $last_update = ((($contact['abook_updated'] === $contact['abook_created']) || ($contact['abook_updated'] === '0000-00-00 00:00:00'))
+ $last_update = ((($contact['abook_updated'] === $contact['abook_created']) || ($contact['abook_updated'] === NULL_DATE))
? datetime_convert('UTC','UTC','now - 7 days')
: datetime_convert('UTC','UTC',$contact['abook_updated'] . ' - 2 days')
);
diff --git a/include/poller.php b/include/poller.php
index b26b9e696..fe242d659 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -35,11 +35,11 @@ function poller_run($argv, $argc){
// expire any expired mail
- q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() ");
+ q("delete from mail where expires != NULL_DATE and expires < UTC_TIMESTAMP() ");
// expire any expired items
- $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP()
+ $r = q("select id from item where expires != NULL_DATE and expires < UTC_TIMESTAMP()
and not ( item_restrict & %d ) ",
intval(ITEM_DELETED)
);
@@ -285,7 +285,7 @@ function poller_run($argv, $argc){
else {
// if we've never connected with them, start the mark for death countdown from now
- if($c == '0000-00-00 00:00:00') {
+ if($c == NULL_DATE) {
$r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1",
dbesc(datetime_convert()),
intval($contact['abook_id'])
@@ -338,7 +338,7 @@ function poller_run($argv, $argc){
}
if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
- $r = q("select distinct ud_addr, updates.* from updates where not ( ud_flags & %d ) and ud_addr != '' and ( ud_last = '0000-00-00 00:00:00' OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) group by ud_addr ",
+ $r = q("select distinct ud_addr, updates.* from updates where not ( ud_flags & %d ) and ud_addr != '' and ( ud_last = NULL_DATE OR ud_last > UTC_TIMESTAMP() - INTERVAL 7 DAY ) group by ud_addr ",
intval(UPDATE_FLAGS_UPDATED)
);
if($r) {
@@ -347,7 +347,7 @@ function poller_run($argv, $argc){
// If they didn't respond when we attempted before, back off to once a day
// After 7 days we won't bother anymore
- if($rr['ud_last'] != '0000-00-00 00:00:00')
+ if($rr['ud_last'] != NULL_DATE)
if($rr['ud_last'] > datetime_convert('UTC','UTC', 'now - 1 day'))
continue;
proc_run('php','include/onedirsync.php',$rr['ud_id']);
diff --git a/include/zot.php b/include/zot.php
index a53b39663..f5099df8c 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -384,7 +384,7 @@ function zot_refresh($them,$channel = null, $force = false) {
$next_birthday = datetime_convert('UTC','UTC',$j['profile']['next_birthday']);
}
else {
- $next_birthday = '0000-00-00 00:00:00';
+ $next_birthday = NULL_DATE;
}
if($r) {