1
0
Fork 0

Warnings fixed

This commit is contained in:
Michael 2018-07-08 09:37:05 +00:00
commit 3e797547a3
17 changed files with 55 additions and 45 deletions

View file

@ -65,13 +65,13 @@ function display_init(App $a)
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $a->argv[2], 'private' => false, 'uid' => 0]);
}
if (!DBM::is_result($item) || $item['deleted']) {
if (!DBM::is_result($item)) {
$a->error = 404;
notice(L10n::t('Item not found.') . EOL);
return;
}
if (strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
logger('Directly serving XML for id '.$item["id"], LOGGER_DEBUG);
displayShowFeed($item["id"], false);
}
@ -347,19 +347,20 @@ function display_content(App $a, $update = false, $update_uid = 0)
Item::update(['unseen' => false], $condition);
}
$items = conv_sort(Item::inArray($items_obj), "`commented`");
$items = Item::inArray($items_obj);
$conversation_items = conv_sort($items, "`commented`");
if (!$update) {
$o .= "<script> var netargs = '?f=&item_id=" . $item_id . "'; </script>";
}
$o .= conversation($a, $items, 'display', $update_uid, false, 'commented', local_user());
$o .= conversation($a, $conversation_items, 'display', $update_uid, false, 'commented', local_user());
// Preparing the meta header
$description = trim(HTML::toPlaintext(BBCode::convert($s[0]["body"], false), 0, true));
$title = trim(HTML::toPlaintext(BBCode::convert($s[0]["title"], false), 0, true));
$author_name = $s[0]["author-name"];
$description = trim(HTML::toPlaintext(BBCode::convert($items["body"], false), 0, true));
$title = trim(HTML::toPlaintext(BBCode::convert($items["title"], false), 0, true));
$author_name = $items["author-name"];
$image = $a->remove_baseurl($s[0]["author-thumb"]);
$image = $a->remove_baseurl($items["author-thumb"]);
if ($title == "") {
$title = $author_name;
@ -391,7 +392,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$a->page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:image" content="'.System::baseUrl().'/'.$image.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:url" content="'.$s[0]["plink"].'" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:url" content="'.$items["plink"].'" />'."\n";
// Dublin Core
$a->page['htmlhead'] .= '<meta name="DC.title" content="'.$title.'" />'."\n";
@ -401,7 +402,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$a->page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:image" content="'.System::baseUrl().'/'.$image.'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:url" content="'.$s[0]["plink"].'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:url" content="'.$items["plink"].'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";
// article:tag

View file

@ -11,7 +11,7 @@ use Friendica\Database\DBM;
function friendica_init(App $a)
{
if ($a->argv[1] == "json") {
if (!empty($a->argv[1]) && ($a->argv[1] == "json")) {
$register_policy = ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'];
$sql_extra = '';

View file

@ -699,9 +699,7 @@ function networkThreadedView(App $a, $update, $parent)
$order_mode = 'commented';
}
if ($sql_order == '') {
$sql_order = "$sql_table.$ordering";
}
$sql_order = "$sql_table.$ordering";
if (x($_GET, 'offset')) {
$sql_range = sprintf(" AND $sql_order <= '%s'", dbesc($_GET['offset']));

View file

@ -130,7 +130,7 @@ function ping_init(App $a)
$condition = ["`unseen` AND `uid` = ? AND `contact-id` != ?", local_user(), local_user()];
$fields = ['id', 'parent', 'verb', 'author-name', 'unseen', 'author-link', 'author-avatar', 'contact-avatar',
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid'];
'network', 'created', 'object', 'parent-author-name', 'parent-author-link', 'parent-guid', 'wall'];
$params = ['order' => ['created' => true]];
$items = Item::selectForUser(local_user(), $fields, $condition, $params);
@ -487,7 +487,7 @@ function ping_get_notifications($uid)
if ($notification["visible"]
&& !$notification["deleted"]
&& !(x($result, $notification["parent"]) && is_array($result[$notification["parent"]]))
&& !(x($result, $notification["parent"]) && !empty($result[$notification["parent"]]))
) {
// Should we condense the notifications or show them all?
if (PConfig::get(local_user(), 'system', 'detailed_notif')) {

View file

@ -43,9 +43,7 @@ function receive_post(App $a)
logger('mod-diaspora: receiving post', LOGGER_DEBUG);
$xml = urldecode($_POST['xml']);
if (!$xml) {
if (empty($_POST['xml'])) {
$postdata = file_get_contents("php://input");
if ($postdata == '') {
System::httpExit(500);
@ -54,6 +52,8 @@ function receive_post(App $a)
logger('mod-diaspora: message is in the new format', LOGGER_DEBUG);
$msg = Diaspora::decodeRaw($importer, $postdata);
} else {
$xml = urldecode($_POST['xml']);
logger('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
$msg = Diaspora::decode($importer, $xml);