Use default value for uid parameter in Contact::getIdForURL
This commit is contained in:
parent
01c7945b7a
commit
9f21e7f34f
|
@ -384,7 +384,7 @@ function admin_page_contactblock_post(App $a)
|
||||||
check_form_security_token_redirectOnErr('/admin/contactblock', 'admin_contactblock');
|
check_form_security_token_redirectOnErr('/admin/contactblock', 'admin_contactblock');
|
||||||
|
|
||||||
if (x($_POST, 'page_contactblock_block')) {
|
if (x($_POST, 'page_contactblock_block')) {
|
||||||
$contact_id = Contact::getIdForURL($contact_url, 0);
|
$contact_id = Contact::getIdForURL($contact_url);
|
||||||
if ($contact_id) {
|
if ($contact_id) {
|
||||||
Contact::block($contact_id);
|
Contact::block($contact_id);
|
||||||
notice(L10n::t('The contact has been blocked from the node'));
|
notice(L10n::t('The contact has been blocked from the node'));
|
||||||
|
|
|
@ -593,11 +593,11 @@ function item_post(App $a) {
|
||||||
$datarray['owner-name'] = $contact_record['name'];
|
$datarray['owner-name'] = $contact_record['name'];
|
||||||
$datarray['owner-link'] = $contact_record['url'];
|
$datarray['owner-link'] = $contact_record['url'];
|
||||||
$datarray['owner-avatar'] = $contact_record['thumb'];
|
$datarray['owner-avatar'] = $contact_record['thumb'];
|
||||||
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link'], 0);
|
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
|
||||||
$datarray['author-name'] = $author['name'];
|
$datarray['author-name'] = $author['name'];
|
||||||
$datarray['author-link'] = $author['url'];
|
$datarray['author-link'] = $author['url'];
|
||||||
$datarray['author-avatar'] = $author['thumb'];
|
$datarray['author-avatar'] = $author['thumb'];
|
||||||
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link'], 0);
|
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
|
||||||
$datarray['created'] = DateTimeFormat::utcNow();
|
$datarray['created'] = DateTimeFormat::utcNow();
|
||||||
$datarray['edited'] = DateTimeFormat::utcNow();
|
$datarray['edited'] = DateTimeFormat::utcNow();
|
||||||
$datarray['commented'] = DateTimeFormat::utcNow();
|
$datarray['commented'] = DateTimeFormat::utcNow();
|
||||||
|
|
|
@ -162,8 +162,8 @@ class PostUpdate
|
||||||
|
|
||||||
// Set the "author-id" and "owner-id" in the item table and add a new public contact entry if needed
|
// Set the "author-id" and "owner-id" in the item table and add a new public contact entry if needed
|
||||||
foreach ($item_arr as $item) {
|
foreach ($item_arr as $item) {
|
||||||
$author_id = Contact::getIdForURL($item["author-link"], 0);
|
$author_id = Contact::getIdForURL($item["author-link"]);
|
||||||
$owner_id = Contact::getIdForURL($item["owner-link"], 0);
|
$owner_id = Contact::getIdForURL($item["owner-link"]);
|
||||||
|
|
||||||
if ($author_id == 0)
|
if ($author_id == 0)
|
||||||
$author_id = -1;
|
$author_id = -1;
|
||||||
|
|
|
@ -474,14 +474,14 @@ class Item extends BaseObject
|
||||||
// The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes
|
// The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes
|
||||||
$item["contact-id"] = self::contactId($item);
|
$item["contact-id"] = self::contactId($item);
|
||||||
|
|
||||||
$item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"], 0));
|
$item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"]));
|
||||||
|
|
||||||
if (Contact::isBlocked($item["author-id"])) {
|
if (Contact::isBlocked($item["author-id"])) {
|
||||||
logger('Contact '.$item["author-id"].' is blocked, item '.$item["uri"].' will not be stored');
|
logger('Contact '.$item["author-id"].' is blocked, item '.$item["uri"].' will not be stored');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"], 0));
|
$item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"]));
|
||||||
|
|
||||||
if (Contact::isBlocked($item["owner-id"])) {
|
if (Contact::isBlocked($item["owner-id"])) {
|
||||||
logger('Contact '.$item["owner-id"].' is blocked, item '.$item["uri"].' will not be stored');
|
logger('Contact '.$item["owner-id"].' is blocked, item '.$item["uri"].' will not be stored');
|
||||||
|
@ -897,7 +897,7 @@ class Item extends BaseObject
|
||||||
$item['uid'] = 0;
|
$item['uid'] = 0;
|
||||||
$item['origin'] = 0;
|
$item['origin'] = 0;
|
||||||
$item['wall'] = 0;
|
$item['wall'] = 0;
|
||||||
$item['contact-id'] = Contact::getIdForURL($item['author-link'], 0);
|
$item['contact-id'] = Contact::getIdForURL($item['author-link']);
|
||||||
|
|
||||||
if (in_array($item['type'], ["net-comment", "wall-comment"])) {
|
if (in_array($item['type'], ["net-comment", "wall-comment"])) {
|
||||||
$item['type'] = 'remote-comment';
|
$item['type'] = 'remote-comment';
|
||||||
|
@ -951,7 +951,7 @@ class Item extends BaseObject
|
||||||
$item['uid'] = 0;
|
$item['uid'] = 0;
|
||||||
$item['origin'] = 0;
|
$item['origin'] = 0;
|
||||||
$item['wall'] = 0;
|
$item['wall'] = 0;
|
||||||
$item['contact-id'] = Contact::getIdForURL($item['author-link'], 0);
|
$item['contact-id'] = Contact::getIdForURL($item['author-link']);
|
||||||
|
|
||||||
if (in_array($item['type'], ["net-comment", "wall-comment"])) {
|
if (in_array($item['type'], ["net-comment", "wall-comment"])) {
|
||||||
$item['type'] = 'remote-comment';
|
$item['type'] = 'remote-comment';
|
||||||
|
|
|
@ -43,7 +43,7 @@ require_once '.htconfig.php';
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
|
|
||||||
$contact_id = Contact::getIdForURL($argv[1], 0);
|
$contact_id = Contact::getIdForURL($argv[1]);
|
||||||
if (!$contact_id) {
|
if (!$contact_id) {
|
||||||
echo L10n::t('Could not find any contact entry for this URL (%s)', $nurl);
|
echo L10n::t('Could not find any contact entry for this URL (%s)', $nurl);
|
||||||
echo "\r\n";
|
echo "\r\n";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user