fix query as @annado comment
This commit is contained in:
parent
d7b514c2c0
commit
f55a22cb19
1 changed files with 72 additions and 70 deletions
|
@ -993,14 +993,16 @@ function item_store($arr,$force_parent = false) {
|
|||
|
||||
/* check for create date and expire time */
|
||||
$uid = intval($arr['uid']);
|
||||
$r = q("SELECT expire FROM user WHERE expire != 0 AND uid = %d", $uid);
|
||||
$r = q("SELECT expire FROM user WHERE uid = %d", $uid);
|
||||
if(count($r)) {
|
||||
$expire_interval = $r[0]['expire'];
|
||||
$expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC'));
|
||||
$created_date = new DateTime($arr['created'], new DateTimeZone('UTC'));
|
||||
if ($created_date < $expire_date) {
|
||||
logger('item-store: item created ('.$arr['created'].') before expiration time ('.$expire_date->format(DateTime::W3C).'). ignored. ' . print_r($arr,true), LOGGER_DEBUG);
|
||||
return 0;
|
||||
if ($expire_interval>0) {
|
||||
$expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC'));
|
||||
$created_date = new DateTime($arr['created'], new DateTimeZone('UTC'));
|
||||
if ($created_date < $expire_date) {
|
||||
logger('item-store: item created ('.$arr['created'].') before expiration time ('.$expire_date->format(DateTime::W3C).'). ignored. ' . print_r($arr,true), LOGGER_DEBUG);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue