1
0
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

@ -265,6 +265,8 @@ function dfrn_dispatch_private($user, $postdata)
// Set the user id. This is important if this is a public contact
$importer['importer_uid'] = $user['uid'];
$importer = array_merge($importer, $user);
logger('Importing post from ' . $msg['author'] . ' to ' . $user['nickname'] . ' with the private envelope.', LOGGER_DEBUG);
// Now we should be able to import it
@ -333,7 +335,8 @@ function dfrn_notify_content(App $a) {
);
if (!DBM::is_result($r)) {
$status = 1;
logger('No user data found for ' . $a->argv[1] . ' - SQL: ' . $sql_extra);
killme();
}
logger("Remote rino version: ".$rino_remote." for ".$r[0]["url"], LOGGER_DATA);

View file

@ -185,7 +185,7 @@ function dirfind_content(App $a, $prefix = "") {
$a->set_pager_itemspage($j->items_page);
}
if (count($j->results)) {
if (!empty($j->results)) {
$id = 0;

View file

@ -140,29 +140,29 @@ function display_fetchauthor($a, $item)
if (!$skip) {
$author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
}
preg_match('/author="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
}
$profile = "";
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$profiledata["url"] = $matches[1];
}
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$profiledata["url"] = $matches[1];
}
$avatar = "";
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$profiledata["photo"] = $matches[1];
}
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$profiledata["photo"] = $matches[1];
}
$profiledata["nickname"] = $profiledata["name"];
@ -212,6 +212,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$item_parent_uri = $item['parent-uri'];
} else {
$item_id = (($a->argc > 2) ? $a->argv[2] : 0);
$item_parent = $item_id;
if ($a->argc == 2) {
$item_parent = 0;

View file

@ -23,7 +23,8 @@ function fetch_init(App $a)
$guid = $a->argv[2];
// Fetch the item
$fields = ['uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'app', 'location', 'coord', 'network'];
$fields = ['uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'app', 'location', 'coord', 'network',
'event-id', 'resource-id', 'author-link', 'owner-link', 'attach'];
$condition = ['wall' => true, 'private' => false, 'guid' => $guid, 'network' => [NETWORK_DFRN, NETWORK_DIASPORA]];
$item = Item::selectFirst($fields, $condition);
if (!DBM::is_result($item)) {

View file

@ -219,10 +219,10 @@ function item_post(App $a) {
$str_contact_deny = $user['deny_cid'];
} else {
// use the posted permissions
$str_group_allow = perms2str($_REQUEST['group_allow']);
$str_contact_allow = perms2str($_REQUEST['contact_allow']);
$str_group_deny = perms2str($_REQUEST['group_deny']);
$str_contact_deny = perms2str($_REQUEST['contact_deny']);
$str_group_allow = perms2str(defaults($_REQUEST, 'group_allow', ''));
$str_contact_allow = perms2str(defaults($_REQUEST, 'contact_allow', ''));
$str_group_deny = perms2str(defaults($_REQUEST, 'group_deny', ''));
$str_contact_deny = perms2str(defaults($_REQUEST, 'contact_deny', ''));
}
$title = notags(trim(defaults($_REQUEST, 'title' , '')));
@ -245,7 +245,6 @@ function item_post(App $a) {
// If this is a comment, set the permissions from the parent.
if ($parent_item) {
// for non native networks use the network of the original post as network of the item
if (($parent_item['network'] != NETWORK_DIASPORA)
&& ($parent_item['network'] != NETWORK_OSTATUS)
@ -651,16 +650,18 @@ function item_post(App $a) {
$conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['parent-uri']]);
if (DBM::is_result($conversation)) {
if ($r['conversation-uri'] != '') {
if ($conversation['conversation-uri'] != '') {
$datarray['conversation-uri'] = $conversation['conversation-uri'];
}
if ($r['conversation-href'] != '') {
if ($conversation['conversation-href'] != '') {
$datarray['conversation-href'] = $conversation['conversation-href'];
}
}
if ($orig_post) {
$datarray['edit'] = true;
} else {
$datarray['edit'] = false;
}
// Check for hashtags in the body and repair or add hashtag links
@ -674,6 +675,9 @@ function item_post(App $a) {
// We set the datarray ID to -1 because in preview mode the dataray
// doesn't have an ID.
$datarray["id"] = -1;
$datarray["item_id"] = -1;
$datarray["author-network"] = NETWORK_DFRN;
$o = conversation($a,[array_merge($contact_record,$datarray)],'search', false, true);
logger('preview: ' . $o);
echo json_encode(['preview' => $o]);

View file

@ -118,7 +118,7 @@ function message_content(App $a)
}
// Check if we should do HTML-based delete confirmation
if ($_REQUEST['confirm']) {
if (!empty($_REQUEST['confirm'])) {
// <form> can't take arguments in its "action" parameter
// so add any arguments as hidden inputs
$query = explode_querystring($a->query_string);
@ -143,7 +143,7 @@ function message_content(App $a)
}
// Now check how the user responded to the confirmation query
if ($_REQUEST['canceled']) {
if (!empty($_REQUEST['canceled'])) {
goaway($_SESSION['return_url']);
}
@ -308,8 +308,10 @@ function message_content(App $a)
WHERE `mail`.`uid` = %d $sql_extra ORDER BY `mail`.`created` ASC",
intval(local_user())
);
} else {
$messages = false;
}
if (!count($messages)) {
if (!DBM::is_result($messages)) {
notice(L10n::t('Message not available.') . EOL);
return $o;
}

View file

@ -833,7 +833,7 @@ function networkThreadedView(App $a, $update, $parent)
$top_limit = DateTimeFormat::utcNow();
}
$items = dba::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date` FROM `item`
$items = dba::p("SELECT `item`.`parent-uri` AS `uri`, 0 AS `item_id`, `item`.$ordering AS `order_date`, `author`.`url` AS `author-link` FROM `item`
STRAIGHT_JOIN (SELECT `oid` FROM `term` WHERE `term` IN
(SELECT SUBSTR(`term`, 2) FROM `search` WHERE `uid` = ? AND `term` LIKE '#%') AND `otype` = ? AND `type` = ? AND `uid` = 0) AS `term`
ON `item`.`id` = `term`.`oid`

View file

@ -79,6 +79,7 @@ function notifications_content(App $a)
// Get the nav tabs for the notification pages
$tabs = $nm->getTabs();
$notif_content = [];
$notif_nocontent = '';
// Notification results per page
$perpage = 20;
@ -184,7 +185,11 @@ function notifications_content(App $a)
$dfrn_tpl = get_markup_template('netfriend.tpl');
$knowyou = '';
$lbl_knowyou = '';
$dfrn_text = '';
$helptext = '';
$helptext2 = '';
$helptext3 = '';
if ($it['network'] === NETWORK_DFRN || $it['network'] === NETWORK_DIASPORA) {
if ($it['network'] === NETWORK_DFRN) {

View file

@ -39,7 +39,9 @@ function photo_init(App $a)
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
header('HTTP/1.1 304 Not Modified');
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header('Etag: ' . $_SERVER['HTTP_IF_NONE_MATCH']);
if (!empty($_SERVER['HTTP_IF_NONE_MATCH'])) {
header('Etag: ' . $_SERVER['HTTP_IF_NONE_MATCH']);
}
header("Expires: " . gmdate("D, d M Y H:i:s", time() + (31536000)) . " GMT");
header("Cache-Control: max-age=31536000");
if (function_exists('header_remove')) {

View file

@ -101,6 +101,8 @@ function photos_init(App $a) {
if (local_user() && $a->data['user']['uid'] == local_user()) {
$can_post = true;
} else {
$can_post = false;
}
if ($ret['success']) {
@ -950,6 +952,7 @@ function photos_content(App $a)
$contact = null;
$remote_contact = false;
$contact_id = 0;
$edit = false;
$owner_uid = $a->data['user']['uid'];

View file

@ -278,6 +278,7 @@ function ping_init(App $a)
if (DBM::is_result($intros)) {
foreach ($intros as $intro) {
$notif = [
'id' => 0,
'href' => System::baseUrl() . '/notifications/intros/' . $intro['id'],
'name' => $intro['name'],
'url' => $intro['url'],
@ -293,6 +294,7 @@ function ping_init(App $a)
if (DBM::is_result($mails)) {
foreach ($mails as $mail) {
$notif = [
'id' => 0,
'href' => System::baseUrl() . '/message/' . $mail['id'],
'name' => $mail['from-name'],
'url' => $mail['from-url'],
@ -308,6 +310,7 @@ function ping_init(App $a)
if (DBM::is_result($regs)) {
foreach ($regs as $reg) {
$notif = [
'id' => 0,
'href' => System::baseUrl() . '/admin/users/',
'name' => $reg['name'],
'url' => $reg['url'],

View file

@ -23,9 +23,9 @@ function poco_init(App $a) {
if ($a->argc > 1) {
$user = notags(trim($a->argv[1]));
}
if (! x($user)) {
if (empty($user)) {
$c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
if (! DBM::is_result($c)) {
if (!DBM::is_result($c)) {
System::httpExit(401);
}
$system_mode = true;

View file

@ -282,6 +282,8 @@ function profile_content(App $a, $update = 0)
if (!DBM::is_result($r)) {
$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
} else {
$sql_extra3 = "";
}
// check if we serve a mobile device and get the user settings

View file

@ -74,6 +74,11 @@ function search_init(App $a) {
dba::delete('search', ['uid' => local_user(), 'term' => $search]);
}
/// @todo Check if there is a case at all that "aside" is prefilled here
if (!isset($a->page['aside'])) {
$a->page['aside'] = '';
}
$a->page['aside'] .= search_saved_searches();
} else {

View file

@ -12,14 +12,14 @@ function xrd_init(App $a)
{
if ($a->argv[0] == 'xrd') {
$uri = urldecode(notags(trim($_GET['uri'])));
if ($_SERVER['HTTP_ACCEPT'] == 'application/jrd+json') {
if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/jrd+json') {
$mode = 'json';
} else {
$mode = 'xml';
}
} else {
$uri = urldecode(notags(trim($_GET['resource'])));
if ($_SERVER['HTTP_ACCEPT'] == 'application/xrd+xml') {
if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/xrd+xml') {
$mode = 'xml';
} else {
$mode = 'json';