This commit is contained in:
Mario Vavti 2016-01-21 10:42:41 +01:00
commit 2b3b6268dd
3 changed files with 15 additions and 14 deletions

View File

@ -331,6 +331,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($channel_id) intval($channel_id)
); );
// if this was the default channel, set another one as default // if this was the default channel, set another one as default
if($a->account['account_default_channel'] == $channel_id) { if($a->account['account_default_channel'] == $channel_id) {
$r = q("select channel_id from channel where channel_account_id = %d and channel_removed = 0 limit 1", $r = q("select channel_id from channel where channel_account_id = %d and channel_removed = 0 limit 1",
@ -344,12 +345,11 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
} }
else { else {
$rr = q("update account set account_default_channel = 0 where account_id = %d", $rr = q("update account set account_default_channel = 0 where account_id = %d",
intval($r[0]['channel_id']), intval($a->account['account_id'])
intval($a->account['account_id'])); );
} }
} }
logger('deleting hublocs',LOGGER_DEBUG); logger('deleting hublocs',LOGGER_DEBUG);
$r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ", $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ",

View File

@ -817,25 +817,26 @@ function item_post(&$a) {
dbesc($body) dbesc($body)
); );
if($z && $z[0]['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) { if($z) {
foreach($z as $zz) {
if($zz['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) {
$datarray['cancel'] = 1; $datarray['cancel'] = 1;
notice( t('Duplicate post suppressed.') . EOL); notice( t('Duplicate post suppressed.') . EOL);
logger('Duplicate post. Faking plugin cancel.'); logger('Duplicate post. Faking plugin cancel.');
} }
} }
}
}
call_hooks('post_local',$datarray); call_hooks('post_local',$datarray);
if(x($datarray,'cancel')) { if(x($datarray,'cancel')) {
logger('mod_item: post cancelled by plugin.'); logger('mod_item: post cancelled by plugin or duplicate suppressed.');
if($return_path) { if($return_path)
goaway($a->get_baseurl() . "/" . $return_path); goaway($a->get_baseurl() . "/" . $return_path);
}
$json = array('cancel' => 1); $json = array('cancel' => 1);
if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
$json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload']; $json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
echo json_encode($json); echo json_encode($json);
killme(); killme();
} }

View File

@ -1 +1 @@
2016-01-19.1283H 2016-01-20.1284H