Fix crash with expiration, false logger constant, no empty postings
This commit is contained in:
parent
f71bd4f1f7
commit
4a7ca0d44f
|
@ -52,7 +52,7 @@ function update_fail($update_id, $error_message) {
|
||||||
|
|
||||||
// No valid result?
|
// No valid result?
|
||||||
if (!dbm::is_result($adminlist)) {
|
if (!dbm::is_result($adminlist)) {
|
||||||
logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_WARNING);
|
logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
|
||||||
|
|
||||||
// Don't continue
|
// Don't continue
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -569,9 +569,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
$r = q("SELECT expire FROM user WHERE uid = %d", intval($uid));
|
$r = q("SELECT expire FROM user WHERE uid = %d", intval($uid));
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$expire_interval = $r[0]['expire'];
|
$expire_interval = $r[0]['expire'];
|
||||||
if ($expire_interval>0) {
|
if ($expire_interval > 0) {
|
||||||
$expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC'));
|
$expire_date = datetime_convert('UTC', 'UTC', '- '.$expire_interval.' days');
|
||||||
$created_date = new DateTime($arr['created'], new DateTimeZone('UTC'));
|
$created_date = datetime_convert('UTC', 'UTC', $arr['created']);
|
||||||
if ($created_date < $expire_date) {
|
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);
|
logger('item-store: item created ('.$arr['created'].') before expiration time ('.$expire_date->format(DateTime::W3C).'). ignored. ' . print_r($arr,true), LOGGER_DEBUG);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -654,6 +654,11 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
$arr['inform'] = ((x($arr, 'inform')) ? trim($arr['inform']) : '');
|
$arr['inform'] = ((x($arr, 'inform')) ? trim($arr['inform']) : '');
|
||||||
$arr['file'] = ((x($arr, 'file')) ? trim($arr['file']) : '');
|
$arr['file'] = ((x($arr, 'file')) ? trim($arr['file']) : '');
|
||||||
|
|
||||||
|
// When there is no content then we don't post it
|
||||||
|
if ($arr['body'].$arr['title'] == '') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Items cannot be stored before they happen ...
|
// Items cannot be stored before they happen ...
|
||||||
if ($arr['created'] > datetime_convert()) {
|
if ($arr['created'] > datetime_convert()) {
|
||||||
$arr['created'] = datetime_convert();
|
$arr['created'] = datetime_convert();
|
||||||
|
|
Loading…
Reference in a new issue