// We have to avoid that different routines could accidentally create the same value
$parsed = parse_url($uri);
+ // When the hostname isn't given, we take it from the uri
if ($host == "") {
- $host = $parsed["host"];
+ // Is it in the format data@host.tld?
+ if ((count($parsed) == 1) && strstr($uri, '@')) {
+ $mailparts = explode('@', $uri);
+ $host = array_pop($mailparts);
+ } else {
+ $host = $parsed["host"];
+ }
}
+ // We use a hash of the hostname as prefix for the guid
$guid_prefix = hash("crc32", $host);
// Remove the scheme to make sure that "https" and "http" doesn't make a difference
unset($parsed["scheme"]);
+ // Glue it together to be able to make a hash from it
$host_id = implode("/", $parsed);
// We could use any hash algorithm since it isn't a security issue
$expire_interval = Config::get('system', 'dbclean-expire-days', 0);
$r = dba::select('user', array('expire'), array('uid' => $uid), array("limit" => 1));
- if (dbm::is_result($r) && ($r['expire'] > 0) && ($r['expire'] < $expire_interval)) {
+ if (dbm::is_result($r) && ($r['expire'] > 0) && (($r['expire'] < $expire_interval) || ($expire_interval == 0))) {
$expire_interval = $r['expire'];
}
$arr["author-id"] = get_contact($arr["author-link"], 0);
}
+ if (blockedContact($arr["author-id"])) {
+ logger('Contact '.$arr["author-id"].' is blocked, item '.$arr["uri"].' will not be stored');
+ return 0;
+ }
+
if ($arr["owner-id"] == 0) {
$arr["owner-id"] = get_contact($arr["owner-link"], 0);
}
+ if (blockedContact($arr["owner-id"])) {
+ logger('Contact '.$arr["owner-id"].' is blocked, item '.$arr["uri"].' will not be stored');
+ return 0;
+ }
+
if ($arr['guid'] != "") {
// Checking if there is already an item with the same guid
logger('checking for an item for user '.$arr['uid'].' on network '.$arr['network'].' with the guid '.$arr['guid'], LOGGER_DEBUG);
intval($importer['uid'])
);
- if (dbm::is_result($r) && !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
+ if (dbm::is_result($r) && !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY))) {
// create notification
$hash = random_string();
));
}
- } elseif (dbm::is_result($r) && in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
+ } elseif (dbm::is_result($r) && in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_COMMUNITY))) {
$r = q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
intval($importer['uid']),
dbesc($url)