1
1
Fork 0

Several more warnings ... (#5340)

* Some more warnings removed

* Even more warnings ...

* Will it ever end? ;-)

* Avoid warning in dbstructure

* Origin and OStatus ...

* There are more warnings solved ... yeah!

* And again ...

* We are not done yet

* And more ...

* And some new places ...

* And more in the feeds

* Avoid some more

* And some backend stuff

* Notifications cleared

* Some more stuff

* and again ...

* It's getting fewer ...

* Some warnings had been hidden in the notifications

* Fix the fix

* And another missing one ...

* We need the owner here, not the user

* Forgotten user

* And more ...

* And some more warnings disappeared ...

* Some more frontend warnings

* Some backend warnings removed

* Fixed sidebar for "vier"

* And more ...

* Some more ...

* And something for "remote self"

* Am I stuck in an endless loop?

* Fix: Clear tag and file field on update

* Preset page content
This commit is contained in:
Michael Vogel 2018-07-10 14:27:56 +02:00 committed by Hypolite Petovan
commit 0360f7197a
48 changed files with 415 additions and 267 deletions

View file

@ -169,7 +169,8 @@ function api_login(App $a)
$oauth1 = new FKOAuth1();
// login with oauth
try {
list($consumer, $token) = $oauth1->verify_request(OAuthRequest::from_request());
$request = OAuthRequest::from_request();
list($consumer, $token) = $oauth1->verify_request($request);
if (!is_null($token)) {
$oauth1->loginUser($token->uid);
Addon::callHooks('logged_in', $a->user);

View file

@ -349,7 +349,10 @@ function localize_item(&$item)
// add sparkle links to appropriate permalinks
$author = ['uid' => 0, 'id' => $item['author-id'],
'network' => $item['author-network'], 'url' => $item['author-link']];
$item['plink'] = Contact::magicLinkbyContact($author, $item['plink']);
if (!empty($item['plink'])) {
$item['plink'] = Contact::magicLinkbyContact($author, $item['plink']);
}
}
/**
@ -482,7 +485,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
$profile_owner = $a->profile['uid'];
if (!$update) {
$live_update_div = '<div id="live-display"></div>' . "\r\n"
. "<script> var profile_uid = " . $_SESSION['uid'] . ";"
. "<script> var profile_uid = " . defaults($_SESSION, 'uid', 0) . ";"
. " var profile_page = 1; </script>";
}
} elseif ($mode === 'community') {
@ -631,8 +634,8 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
$tmp_item = [
'template' => $tpl,
'id' => (($preview) ? 'P0' : $item['item_id']),
'guid' => (($preview) ? 'Q0' : $item['guid']),
'id' => ($preview ? 'P0' : $item['id']),
'guid' => ($preview ? 'Q0' : $item['guid']),
'network' => $item['network'],
'network_name' => ContactSelector::networkToName($item['network'], $profile_link),
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
@ -679,7 +682,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
$arr = ['item' => $item, 'output' => $tmp_item];
Addon::callHooks('display_item', $arr);
$threads[$threadsid]['id'] = $item['item_id'];
$threads[$threadsid]['id'] = $item['id'];
$threads[$threadsid]['network'] = $item['network'];
$threads[$threadsid]['items'] = [$arr['output']];

View file

@ -34,7 +34,7 @@ function notification($params)
$siteurl = System::baseUrl(true);
$thanks = L10n::t('Thank You,');
$sitename = $a->config['sitename'];
if (!x($a->config['admin_name'])) {
if (empty($a->config['admin_name'])) {
$site_admin = L10n::t('%s Administrator', $sitename);
} else {
$site_admin = L10n::t('%1$s, %2$s Administrator', $a->config['admin_name'], $sitename);
@ -93,6 +93,8 @@ function notification($params)
}
if ($params['type'] == NOTIFY_MAIL) {
$itemlink = $siteurl.'/message/'.$params['item']['id'];
$subject = L10n::t('[Friendica:Notify] New mail received at %s', $sitename);
$preamble = L10n::t('%1$s sent you a new private message at %2$s.', $params['source_name'], $sitename);
@ -101,7 +103,6 @@ function notification($params)
$sitelink = L10n::t('Please visit %s to view and/or reply to your private messages.');
$tsitelink = sprintf($sitelink, $siteurl.'/message/'.$params['item']['id']);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'/message/'.$params['item']['id'].'">'.$sitename.'</a>');
$itemlink = $siteurl.'/message/'.$params['item']['id'];
}
if ($params['type'] == NOTIFY_COMMENT) {
@ -130,10 +131,11 @@ function notification($params)
$item = null;
if ($params['otype'] === 'item' && $parent_id) {
$item = Item::selectFirstForUser($params['uid'], [], ['id' => $parent_id]);
$item = Item::selectFirstForUser($params['uid'], Item::ITEM_FIELDLIST, ['id' => $parent_id]);
}
$item_post_type = item_post_type($item);
$itemlink = $item['plink'];
// "a post"
$dest_str = L10n::t('%1$s commented on [url=%2$s]a %3$s[/url]',
@ -242,6 +244,7 @@ function notification($params)
}
if ($params['type'] == NOTIFY_TAGSHARE) {
$itemlink = $params['link'];
$subject = L10n::t('[Friendica:Notify] %s tagged your post', $params['source_name']);
$preamble = L10n::t('%1$s tagged your post at %2$s', $params['source_name'], $sitename);
@ -253,10 +256,10 @@ function notification($params)
$sitelink = L10n::t('Please visit %s to view and/or reply to the conversation.');
$tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link'];
}
if ($params['type'] == NOTIFY_INTRO) {
$itemlink = $params['link'];
$subject = L10n::t('[Friendica:Notify] Introduction received');
$preamble = L10n::t('You\'ve received an introduction from \'%1$s\' at %2$s', $params['source_name'], $sitename);
@ -270,7 +273,6 @@ function notification($params)
$sitelink = L10n::t('Please visit %s to approve or reject the introduction.');
$tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link'];
switch ($params['verb']) {
case ACTIVITY_FRIEND:
@ -300,6 +302,7 @@ function notification($params)
}
if ($params['type'] == NOTIFY_SUGGEST) {
$itemlink = $params['link'];
$subject = L10n::t('[Friendica:Notify] Friend suggestion received');
$preamble = L10n::t('You\'ve received a friend suggestion from \'%1$s\' at %2$s', $params['source_name'], $sitename);
@ -316,11 +319,11 @@ function notification($params)
$sitelink = L10n::t('Please visit %s to approve or reject the suggestion.');
$tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link'];
}
if ($params['type'] == NOTIFY_CONFIRM) {
if ($params['verb'] == ACTIVITY_FRIEND) { // mutual connection
$itemlink = $params['link'];
$subject = L10n::t('[Friendica:Notify] Connection accepted');
$preamble = L10n::t('\'%1$s\' has accepted your connection request at %2$s', $params['source_name'], $sitename);
@ -334,8 +337,8 @@ function notification($params)
$sitelink = L10n::t('Please visit %s if you wish to make any changes to this relationship.');
$tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link'];
} else { // ACTIVITY_FOLLOW
$itemlink = $params['link'];
$subject = L10n::t('[Friendica:Notify] Connection accepted');
$preamble = L10n::t('\'%1$s\' has accepted your connection request at %2$s', $params['source_name'], $sitename);
@ -351,13 +354,13 @@ function notification($params)
$sitelink = L10n::t('Please visit %s if you wish to make any changes to this relationship.');
$tsitelink = sprintf($sitelink, $siteurl);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
$itemlink = $params['link'];
}
}
if ($params['type'] == NOTIFY_SYSTEM) {
switch($params['event']) {
case "SYSTEM_REGISTER_REQUEST":
$itemlink = $params['link'];
$subject = L10n::t('[Friendica System Notify]') . ' ' . L10n::t('registration request');
$preamble = L10n::t('You\'ve received a registration request from \'%1$s\' at %2$s', $params['source_name'], $sitename);
@ -375,7 +378,6 @@ function notification($params)
$sitelink = L10n::t('Please visit %s to approve or reject the request.');
$tsitelink = sprintf($sitelink, $params['link']);
$hsitelink = sprintf($sitelink, '<a href="'.$params['link'].'">'.$sitename.'</a><br><br>');
$itemlink = $params['link'];
break;
case "SYSTEM_DB_UPDATE_FAIL":
break;
@ -572,7 +574,7 @@ function notification($params)
$datarray['sitename'] = $sitename;
$datarray['siteurl'] = $siteurl;
$datarray['type'] = $params['type'];
$datarray['parent'] = $params['parent'];
$datarray['parent'] = $parent_id;
$datarray['source_name'] = $params['source_name'];
$datarray['source_link'] = $params['source_link'];
$datarray['source_photo'] = $params['source_photo'];
@ -607,7 +609,7 @@ function notification($params)
'$source_name' => $datarray['source_name'],
'$source_link' => $datarray['source_link'],
'$source_photo' => $datarray['source_photo'],
'$username' => $datarray['to_name'],
'$username' => $datarray['username'],
'$hsitelink' => $datarray['hsitelink'],
'$hitemlink' => $datarray['hitemlink'],
'$thanks' => $datarray['thanks'],
@ -628,7 +630,7 @@ function notification($params)
'$source_name' => $datarray['source_name'],
'$source_link' => $datarray['source_link'],
'$source_photo' => $datarray['source_photo'],
'$username' => $datarray['to_name'],
'$username' => $datarray['username'],
'$tsitelink' => $datarray['tsitelink'],
'$titemlink' => $datarray['titemlink'],
'$thanks' => $datarray['thanks'],

View file

@ -33,6 +33,8 @@ function add_page_info_data($data, $no_photos = false) {
$data["type"] = "link";
}
$data["title"] = defaults($data, "title", "");
if ((($data["type"] != "link") && ($data["type"] != "video") && ($data["type"] != "photo")) || ($data["title"] == $data["url"])) {
return "";
}
@ -47,19 +49,19 @@ function add_page_info_data($data, $no_photos = false) {
$text = "[attachment type='".$data["type"]."'";
if ($data["text"] == "") {
if (empty($data["text"])) {
$data["text"] = $data["title"];
}
if ($data["text"] == "") {
if (empty($data["text"])) {
$data["text"] = $data["url"];
}
if ($data["url"] != "") {
if (!empty($data["url"])) {
$text .= " url='".$data["url"]."'";
}
if ($data["title"] != "") {
if (!empty($data["title"])) {
$text .= " title='".$data["title"]."'";
}
@ -427,7 +429,7 @@ function list_post_dates($uid, $wall) {
$start_month = DateTimeFormat::utc($dstart, 'Y-m-d');
$end_month = DateTimeFormat::utc($dend, 'Y-m-d');
$str = day_translate(DateTimeFormat::utc($dnow, 'F'));
if (!$ret[$dyear]) {
if (empty($ret[$dyear])) {
$ret[$dyear] = [];
}
$ret[$dyear][] = [$str, $end_month, $start_month];

View file

@ -643,13 +643,20 @@ function logger($msg, $level = 0) {
}
$callers = debug_backtrace();
if (count($callers) > 1) {
$function = $callers[1]['function'];
} else {
$function = '';
}
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
DateTimeFormat::utcNow(DateTimeFormat::ATOM),
$process_id,
$LOGGER_LEVELS[$level],
basename($callers[0]['file']),
$callers[0]['line'],
$callers[1]['function'],
$function,
$msg
);
@ -1280,7 +1287,8 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
]);
}
$id = end(explode('/', $the_url));
$url_parts = explode('/', $the_url);
$id = end($url_parts);
$as .= replace_macros(get_markup_template('video_top.tpl'), [
'$video' => [
'id' => $id,
@ -1710,11 +1718,11 @@ function reltoabs($text, $base) {
* @return string
*/
function item_post_type($item) {
if (intval($item['event-id'])) {
if (!empty($item['event-id'])) {
return L10n::t('event');
} elseif (strlen($item['resource-id'])) {
} elseif (!empty($item['resource-id'])) {
return L10n::t('photo');
} elseif (strlen($item['verb']) && $item['verb'] !== ACTIVITY_POST) {
} elseif (!empty($item['verb']) && $item['verb'] !== ACTIVITY_POST) {
return L10n::t('activity');
} elseif ($item['id'] != $item['parent']) {
return L10n::t('comment');