mirror of
https://github.com/friendica/friendica
synced 2025-04-30 15:44:24 +02:00
Notices again (#5543)
* And again notices * Notices in the directory * Much more places * Fix some double $ * Notice in ping * Missing field * Fix: We now remove deleted users from the directory * Some more stuff * Notices when removing users * Added logging * More logging * Two more
This commit is contained in:
parent
c960a97682
commit
c72c64a6d8
17 changed files with 95 additions and 57 deletions
|
@ -86,7 +86,7 @@ class BBCode extends BaseObject
|
|||
$post["url"] = $matches[1];
|
||||
$post["title"] = $matches[2];
|
||||
}
|
||||
if (($post["url"] == "") && (in_array($post["type"], ["link", "video"]))
|
||||
if (!empty($post["url"] == "") && (in_array($post["type"], ["link", "video"]))
|
||||
&& preg_match("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $attacheddata, $matches)) {
|
||||
$post["url"] = $matches[1];
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ class BBCode extends BaseObject
|
|||
if (!$data) {
|
||||
return $Text;
|
||||
} elseif ($nolink) {
|
||||
return $data["text"] . $data["after"];
|
||||
return $data["text"] . defaults($data, 'after', '');
|
||||
}
|
||||
|
||||
$title = htmlentities(defaults($data, 'title', ''), ENT_QUOTES, 'UTF-8', false);
|
||||
|
@ -632,7 +632,7 @@ class BBCode extends BaseObject
|
|||
|
||||
$text = $data["text"];
|
||||
|
||||
if (!empty($data["url"]) && ($data["title"] != "")) {
|
||||
if (!empty($data["url"]) && !empty($data["title"])) {
|
||||
$text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
|
||||
} elseif (!empty($data["url"])) {
|
||||
$text .= "\n[url]" . $data["url"] . "[/url]";
|
||||
|
|
|
@ -1563,20 +1563,24 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
public static function addRelationship($importer, $contact, $datarray, $item, $sharing = false) {
|
||||
$url = notags(trim($datarray['author-link']));
|
||||
$name = notags(trim($datarray['author-name']));
|
||||
$photo = notags(trim($datarray['author-avatar']));
|
||||
$nick = '';
|
||||
|
||||
if (is_object($item)) {
|
||||
$rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor');
|
||||
if ($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) {
|
||||
$nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data'];
|
||||
}
|
||||
} else {
|
||||
$nick = $item;
|
||||
// Should always be set
|
||||
if (empty($datarray['author-id'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fields = ['url', 'name', 'nick', 'photo', 'network'];
|
||||
$pub_contact = DBA::selectFirst('contact', $fields, ['id' => $datarray['author-id']]);
|
||||
if (!DBA::isResult($pub_contact)) {
|
||||
// Should never happen
|
||||
return;
|
||||
}
|
||||
|
||||
$url = $pub_contact['url'];
|
||||
$name = $pub_contact['name'];
|
||||
$photo = $pub_contact['photo'];
|
||||
$nick = $pub_contact['nick'];
|
||||
$network = $pub_contact['network'];
|
||||
|
||||
if (is_array($contact)) {
|
||||
if (($contact['rel'] == self::SHARING)
|
||||
|| ($sharing && $contact['rel'] == self::FOLLOWER)) {
|
||||
|
@ -1601,13 +1605,13 @@ class Contact extends BaseObject
|
|||
DBA::escape($name),
|
||||
DBA::escape($nick),
|
||||
DBA::escape($photo),
|
||||
DBA::escape(NETWORK_OSTATUS),
|
||||
DBA::escape($network),
|
||||
intval(self::FOLLOWER)
|
||||
);
|
||||
|
||||
$contact_record = [
|
||||
'id' => DBA::lastInsertId(),
|
||||
'network' => NETWORK_OSTATUS,
|
||||
'network' => $network,
|
||||
'name' => $name,
|
||||
'url' => $url,
|
||||
'photo' => $photo
|
||||
|
|
|
@ -89,7 +89,7 @@ class Event extends BaseObject
|
|||
$o .= '<div class="description event-description">' . BBCode::convert($event['desc'], false, $simple) . '</div>' . "\r\n";
|
||||
}
|
||||
|
||||
if (strlen($event['location'])) {
|
||||
if (!empty($event['location'])) {
|
||||
$o .= '<div class="event-location"><span class="event-label">' . L10n::t('Location:') . '</span> <span class="location">'
|
||||
. BBCode::convert($event['location'], false, $simple)
|
||||
. '</span></div>' . "\r\n";
|
||||
|
|
|
@ -729,7 +729,8 @@ class User
|
|||
Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
|
||||
|
||||
// Send an update to the directory
|
||||
Worker::add(PRIORITY_LOW, "Directory", $user['url']);
|
||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
Worker::add(PRIORITY_LOW, "Directory", $self['url']);
|
||||
|
||||
if ($uid == local_user()) {
|
||||
unset($_SESSION['authenticated']);
|
||||
|
|
|
@ -139,7 +139,7 @@ class Proxy extends BaseModule
|
|||
$cachefile = get_cachefile(hash('md5', $_REQUEST['url']));
|
||||
if ($cachefile != '' && file_exists($cachefile)) {
|
||||
$img_str = file_get_contents($cachefile);
|
||||
$mime = image_type_to_mime_type(exif_imagetype($cachefile));
|
||||
$mime = mime_content_type($cachefile);
|
||||
|
||||
header('Content-type: ' . $mime);
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
|
||||
|
@ -187,7 +187,7 @@ class Proxy extends BaseModule
|
|||
|
||||
$tempfile = tempnam(get_temppath(), 'cache');
|
||||
file_put_contents($tempfile, $img_str);
|
||||
$mime = image_type_to_mime_type(exif_imagetype($tempfile));
|
||||
$mime = mime_content_type($tempfile);
|
||||
unlink($tempfile);
|
||||
|
||||
// If there is an error then return a blank image
|
||||
|
|
|
@ -946,7 +946,7 @@ class Probe
|
|||
|
||||
// This logging is for temporarily debugging reasons
|
||||
if (!isset($data["poco"])) {
|
||||
logger('POCO not defined for ' . profile_link, LOGGER_DEBUG);
|
||||
logger('POCO not defined for ' . $profile_link . ' - ' . System::callstack(), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
logger("Result for profile ".$profile_link.": ".print_r($prof_data, true), LOGGER_DEBUG);
|
||||
|
@ -1603,14 +1603,16 @@ class Probe
|
|||
|
||||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
|
||||
|
||||
if (DBA::isResult($x) && DBA::isResult($r)) {
|
||||
$mailbox = Email::constructMailboxName($r[0]);
|
||||
$password = '';
|
||||
openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);
|
||||
$mbox = Email::connect($mailbox, $r[0]['user'], $password);
|
||||
if (!$mbox) {
|
||||
return false;
|
||||
}
|
||||
if (!DBA::isResult($x) || !DBA::isResult($r)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$mailbox = Email::constructMailboxName($r[0]);
|
||||
$password = '';
|
||||
openssl_private_decrypt(hex2bin($r[0]['pass']), $password, $x[0]['prvkey']);
|
||||
$mbox = Email::connect($mailbox, $r[0]['user'], $password);
|
||||
if (!$mbox) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$msgs = Email::poll($mbox, $uri);
|
||||
|
|
|
@ -25,6 +25,16 @@ class Email
|
|||
|
||||
$mbox = @imap_open($mailbox, $username, $password);
|
||||
|
||||
$errors = imap_errors();
|
||||
if (!empty($errors)) {
|
||||
logger('IMAP Errors occured: ' . json_encode($errors));
|
||||
}
|
||||
|
||||
$alerts = imap_alerts();
|
||||
if (!empty($alerts)) {
|
||||
logger('IMAP Alerts occured: ' . json_encode($alerts));
|
||||
}
|
||||
|
||||
return $mbox;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue