This is long overdue - use a symblic constant NULL_DATE instead of the easily mis-typed sequence '0000-00-00 00:00:00'

This commit is contained in:
friendica 2014-09-08 20:35:15 -07:00
parent 8fbeb370db
commit c6d07feff5
22 changed files with 47 additions and 46 deletions

View File

@ -52,7 +52,7 @@ define ( 'DB_UPDATE_VERSION', 1129 );
define ( 'EOL', '<br />' . "\r\n" ); define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
define ( 'NULL_DATE', '0000-00-00 00:00:00' );
define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' ); define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' );
define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // This is technically DIRECTORY_MODE_TERTIARY, but it's the default, hence 0x0000 define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // This is technically DIRECTORY_MODE_TERTIARY, but it's the default, hence 0x0000

View File

@ -256,7 +256,7 @@ class Item extends BaseObject {
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), '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')) : ''), '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, 'lock' => $lock,
'verified' => $verified, 'verified' => $verified,
'unverified' => $unverified, 'unverified' => $unverified,

View File

@ -108,7 +108,7 @@ function create_account($arr) {
$parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 ); $parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 );
$flags = ((x($arr,'account_flags')) ? intval($arr['account_flags']) : ACCOUNT_OK); $flags = ((x($arr,'account_flags')) ? intval($arr['account_flags']) : ACCOUNT_OK);
$roles = ((x($arr,'account_roles')) ? intval($arr['account_roles']) : 0 ); $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'); $default_service_class = get_config('system','default_service_class');
@ -511,8 +511,9 @@ function user_approve($hash) {
function downgrade_accounts() { function downgrade_accounts() {
$r = q("select * from account where not ( account_flags & %d ) $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() ", and account_expires < UTC_TIMESTAMP() ",
dbesc(NULL_DATE),
intval(ACCOUNT_EXPIRED) intval(ACCOUNT_EXPIRED)
); );
@ -528,7 +529,7 @@ function downgrade_accounts() {
$x = q("UPDATE account set account_service_class = '%s', account_expires = '%s' $x = q("UPDATE account set account_service_class = '%s', account_expires = '%s'
where account_id = %d limit 1", where account_id = %d limit 1",
dbesc($basic), dbesc($basic),
dbesc('0000-00-00 00:00:00'), dbesc(NULL_DATE),
intval($rr['account_id']) intval($rr['account_id'])
); );
$ret = array('account' => $rr); $ret = array('account' => $rr);

View File

@ -707,7 +707,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), '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')) : ''), '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, 'location' => $location,
'indent' => '', 'indent' => '',
'owner_name' => $owner_name, 'owner_name' => $owner_name,

View File

@ -271,7 +271,7 @@ function relative_date($posted_date,$format = null) {
$abs = strtotime($localtime); $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'); return t('never');
} }

View File

@ -700,7 +700,7 @@ function diaspora_request($importer,$xml) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), 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) intval(($default_perms) ? 0 : ABOOK_FLAG_PENDING)
); );

View File

@ -107,7 +107,7 @@ function sync_directories($dirmode) {
$r = array( $r = array(
'site_url' => DIRECTORY_FALLBACK_MASTER, 'site_url' => DIRECTORY_FALLBACK_MASTER,
'site_flags' => DIRECTORY_MODE_PRIMARY, 'site_flags' => DIRECTORY_MODE_PRIMARY,
'site_update' => '0000-00-00 00:00:00', 'site_update' => NULL_DATE,
'site_directory' => DIRECTORY_FALLBACK_MASTER . '/dirsearch', 'site_directory' => DIRECTORY_FALLBACK_MASTER . '/dirsearch',
'site_realm' => DIRECTORY_REALM '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. // 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)); $x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate));
if(! $x['success']) if(! $x['success'])

View File

@ -60,7 +60,7 @@ function externals_run($argv, $argc){
} }
if($url) { 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')); $mindate = urlencode(datetime_convert('','',$r[0]['site_pull'] . ' - 1 day'));
else { else {
$days = get_config('externals','since_days'); $days = get_config('externals','since_days');

View File

@ -1042,7 +1042,7 @@ function advanced_profile(&$a) {
if($a->profile['with']) $profile['marital']['with'] = bbcode($a->profile['with']); 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')); $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
} }

View File

@ -144,7 +144,7 @@ function filter_insecure($channel_id,$arr) {
function comments_are_now_closed($item) { 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(); $d = datetime_convert();
if($d > $item['comments_closed']) if($d > $item['comments_closed'])
return true; return true;
@ -448,7 +448,7 @@ function post_activity_item($arr) {
function get_public_feed($channel,$params) { function get_public_feed($channel,$params) {
$type = 'xml'; $type = 'xml';
$begin = '0000-00-00 00:00:00'; $begin = NULL_DATE;
$end = ''; $end = '';
$start = 0; $start = 0;
$records = 40; $records = 40;
@ -459,7 +459,7 @@ function get_public_feed($channel,$params) {
$params = array(); $params = array();
$params['type'] = ((x($params,'type')) ? $params['type'] : 'xml'); $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['end'] = ((x($params,'end')) ? $params['end'] : datetime_convert('UTC','UTC','now'));
$params['start'] = ((x($params,'start')) ? $params['start'] : 0); $params['start'] = ((x($params,'start')) ? $params['start'] : 0);
$params['records'] = ((x($params,'records')) ? $params['records'] : 40); $params['records'] = ((x($params,'records')) ? $params['records'] : 40);
@ -758,14 +758,14 @@ function get_item_elements($x) {
$arr['expires'] = ((x($x,'expires') && $x['expires']) $arr['expires'] = ((x($x,'expires') && $x['expires'])
? datetime_convert('UTC','UTC',$x['expires']) ? datetime_convert('UTC','UTC',$x['expires'])
: '0000-00-00 00:00:00'); : NULL_DATE);
$arr['commented'] = ((x($x,'commented') && $x['commented']) $arr['commented'] = ((x($x,'commented') && $x['commented'])
? datetime_convert('UTC','UTC',$x['commented']) ? datetime_convert('UTC','UTC',$x['commented'])
: $arr['created']); : $arr['created']);
$arr['comments_closed'] = ((x($x,'comments_closed') && $x['comments_closed']) $arr['comments_closed'] = ((x($x,'comments_closed') && $x['comments_closed'])
? datetime_convert('UTC','UTC',$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) : ''); $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)) if($y = encode_item_flags($item))
$x['flags'] = $y; $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['comments_closed'] = $item['comments_closed'];
$x['public_scope'] = $scope; $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['title'] = (($x['title'])? htmlspecialchars($x['title'],ENT_COMPAT,'UTF-8',false) : '');
$arr['created'] = datetime_convert('UTC','UTC',$x['created']); $arr['created'] = datetime_convert('UTC','UTC',$x['created']);
if((! array_key_exists('expires',$x)) || ($x['expires'] === '0000-00-00 00:00:00')) if((! array_key_exists('expires',$x)) || ($x['expires'] === NULL_DATE))
$arr['expires'] = '0000-00-00 00:00:00'; $arr['expires'] = NULL_DATE;
else else
$arr['expires'] = datetime_convert('UTC','UTC',$x['expires']); $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['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['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['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['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['received'] = datetime_convert();
$arr['changed'] = 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['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']); $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']); $arr['comments_closed'] = datetime_convert('UTC','UTC',$arr['comments_closed']);
else else
$arr['comments_closed'] = $orig[0]['comments_closed']; $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['from_xchan'] = ((x($arr,'from_xchan')) ? notags(trim($arr['from_xchan'])) : '');
$arr['to_xchan'] = ((x($arr,'to_xchan')) ? notags(trim($arr['to_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['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['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
$arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : ''); $arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : '');
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : ''); $arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
@ -4076,7 +4076,7 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$result = array(); $result = array();
$mindate = datetime_convert('UTC','UTC',$mindate); $mindate = datetime_convert('UTC','UTC',$mindate);
if(! $mindate) if(! $mindate)
$mindate = '0000-00-00 00:00:00'; $mindate = NULL_DATE;
$mindate = dbesc($mindate); $mindate = dbesc($mindate);
@ -4092,7 +4092,7 @@ function zot_feed($uid,$observer_xchan,$mindate) {
$sql_extra = item_permissions_sql($uid); $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' ) "; $sql_extra .= " and ( created > '$mindate' or edited > '$mindate' ) ";
$limit = ""; $limit = "";
} }

View File

@ -23,7 +23,7 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$subject = t('[no subject]'); $subject = t('[no subject]');
// if(! $expires) // if(! $expires)
// $expires = '0000-00-00 00:00:00'; // $expires = NULL_DATE;
// else // else
// $expires = datetime_convert(date_default_timezone_get(),'UTC',$expires); // $expires = datetime_convert(date_default_timezone_get(),'UTC',$expires);

View File

@ -67,7 +67,7 @@ function onepoll_run($argv, $argc){
logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['xchan_name']}, CONTACT: {$contact['xchan_name']}"); 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','now - 7 days')
: datetime_convert('UTC','UTC',$contact['abook_updated'] . ' - 2 days') : datetime_convert('UTC','UTC',$contact['abook_updated'] . ' - 2 days')
); );

View File

@ -35,11 +35,11 @@ function poller_run($argv, $argc){
// expire any expired mail // 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 // 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 ) ", and not ( item_restrict & %d ) ",
intval(ITEM_DELETED) intval(ITEM_DELETED)
); );
@ -285,7 +285,7 @@ function poller_run($argv, $argc){
else { else {
// if we've never connected with them, start the mark for death countdown from now // 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", $r = q("update abook set abook_connected = '%s' where abook_id = %d limit 1",
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($contact['abook_id']) intval($contact['abook_id'])
@ -338,7 +338,7 @@ function poller_run($argv, $argc){
} }
if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) { 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) intval(UPDATE_FLAGS_UPDATED)
); );
if($r) { 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 // If they didn't respond when we attempted before, back off to once a day
// After 7 days we won't bother anymore // 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')) if($rr['ud_last'] > datetime_convert('UTC','UTC', 'now - 1 day'))
continue; continue;
proc_run('php','include/onedirsync.php',$rr['ud_id']); proc_run('php','include/onedirsync.php',$rr['ud_id']);

View File

@ -384,7 +384,7 @@ function zot_refresh($them,$channel = null, $force = false) {
$next_birthday = datetime_convert('UTC','UTC',$j['profile']['next_birthday']); $next_birthday = datetime_convert('UTC','UTC',$j['profile']['next_birthday']);
} }
else { else {
$next_birthday = '0000-00-00 00:00:00'; $next_birthday = NULL_DATE;
} }
if($r) { if($r) {

View File

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

View File

@ -7,7 +7,7 @@ function feed_init(&$a) {
$params = array(); $params = array();
$params['begin'] = ((x($_REQUEST,'date_begin')) ? $_REQUEST['date_begin'] : '0000-00-00 00:00:00'); $params['begin'] = ((x($_REQUEST,'date_begin')) ? $_REQUEST['date_begin'] : NULL_DATE);
$params['end'] = ((x($_REQUEST,'date_end')) ? $_REQUEST['date_end'] : ''); $params['end'] = ((x($_REQUEST,'date_end')) ? $_REQUEST['date_end'] : '');
$params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml'); $params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml');
$params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0); $params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0);

View File

@ -256,7 +256,7 @@ function import_post(&$a) {
require_once('include/photo/photo_driver.php'); require_once('include/photo/photo_driver.php');
$photos = import_profile_photo($xchan['xchan_photo_l'],$xchan['xchan_hash']); $photos = import_profile_photo($xchan['xchan_photo_l'],$xchan['xchan_hash']);
if($photos[4]) if($photos[4])
$photodate = '0000-00-00 00:00:00'; $photodate = NULL_DATE;
else else
$photodate = $xchan['xchan_photo_date']; $photodate = $xchan['xchan_photo_date'];

View File

@ -384,13 +384,13 @@ function item_post(&$a) {
} }
$expires = '0000-00-00 00:00:00'; $expires = NULL_DATE;
if(feature_enabled($profile_uid,'content_expire')) { if(feature_enabled($profile_uid,'content_expire')) {
if(x($_REQUEST,'expire')) { if(x($_REQUEST,'expire')) {
$expires = datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expire']); $expires = datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expire']);
if($expires <= datetime_convert()) if($expires <= datetime_convert())
$expires = '0000-00-00 00:00:00'; $expires = NULL_DATE;
} }
} }

View File

@ -17,7 +17,7 @@ function mail_post(&$a) {
$body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = ((x($_REQUEST,'messageto')) ? notags(trim($_REQUEST['messageto'])) : ''); $recipient = ((x($_REQUEST,'messageto')) ? notags(trim($_REQUEST['messageto'])) : '');
$rstr = ((x($_REQUEST,'messagerecip')) ? notags(trim($_REQUEST['messagerecip'])) : ''); $rstr = ((x($_REQUEST,'messagerecip')) ? notags(trim($_REQUEST['messagerecip'])) : '');
$expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : '0000-00-00 00:00:00'); $expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : NULL_DATE);
// If we have a raw string for a recipient which hasn't been auto-filled, // If we have a raw string for a recipient which hasn't been auto-filled,
// it means they probably aren't in our address book, hence we don't know // it means they probably aren't in our address book, hence we don't know

View File

@ -304,7 +304,7 @@ function profiles_post(&$a) {
$with = ((x($_POST,'with')) ? escape_tags(trim($_POST['with'])) : ''); $with = ((x($_POST,'with')) ? escape_tags(trim($_POST['with'])) : '');
if(! strlen($howlong)) if(! strlen($howlong))
$howlong = '0000-00-00 00:00:00'; $howlong = NULL_DATE;
else else
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong); $howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
@ -707,7 +707,7 @@ logger('extra_fields: ' . print_r($extra_fields,true));
'$marital' => marital_selector($r[0]['marital']), '$marital' => marital_selector($r[0]['marital']),
'$marital_min' => marital_selector_min($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']),
'$with' => $r[0]['with'], '$with' => $r[0]['with'],
'$howlong' => ($r[0]['howlong'] === '0000-00-00 00:00:00' ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong'])), '$howlong' => ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong'])),
'$sexual' => sexpref_selector($r[0]['sexual']), '$sexual' => sexpref_selector($r[0]['sexual']),
'$sexual_min' => sexpref_selector_min($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']),
'$about' => $r[0]['about'], '$about' => $r[0]['about'],

View File

@ -24,7 +24,7 @@ function removeaccount_post(&$a) {
if(! account_verify_password($account['account_email'],$_POST['qxz_password'])) if(! account_verify_password($account['account_email'],$_POST['qxz_password']))
return; return;
if($account['account_password_changed'] != '0000-00-00 00:00:00') { if($account['account_password_changed'] != NULL_DATE) {
$d1 = datetime_convert('UTC','UTC','now - 48 hours'); $d1 = datetime_convert('UTC','UTC','now - 48 hours');
if($account['account_password_changed'] > d1) { if($account['account_password_changed'] > d1) {
notice( t('Account removals are not allowed within 48 hours of changing the account password.') . EOL); notice( t('Account removals are not allowed within 48 hours of changing the account password.') . EOL);

View File

@ -23,7 +23,7 @@ function removeme_post(&$a) {
if(! account_verify_password($account['account_email'],$_POST['qxz_password'])) if(! account_verify_password($account['account_email'],$_POST['qxz_password']))
return; return;
if($account['account_password_changed'] != '0000-00-00 00:00:00') { if($account['account_password_changed'] != NULL_DATE) {
$d1 = datetime_convert('UTC','UTC','now - 48 hours'); $d1 = datetime_convert('UTC','UTC','now - 48 hours');
if($account['account_password_changed'] > d1) { if($account['account_password_changed'] > d1) {
notice( t('Channel removals are not allowed within 48 hours of changing the account password.') . EOL); notice( t('Channel removals are not allowed within 48 hours of changing the account password.') . EOL);