pull/5338/head
Michael 2018-07-08 09:37:05 +00:00
rodzic c25c3b5981
commit 3e797547a3
17 zmienionych plików z 55 dodań i 45 usunięć

Wyświetl plik

@ -579,7 +579,9 @@ function api_get_user(App $a, $contact_id = null)
// $called_api is the API path exploded on / and is expected to have at least 2 elements
if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (count($called_api) > 0)) {
$argid = count($called_api);
list($user, $null) = explode(".", $a->argv[$argid]);
if (!empty($a->argv[$argid])) {
list($user, $null) = explode(".", $a->argv[$argid]);
}
if (is_numeric($user)) {
$user = dbesc(api_unique_id_to_nurl(intval($user)));

Wyświetl plik

@ -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

Wyświetl plik

@ -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 = '';

Wyświetl plik

@ -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']));

Wyświetl plik

@ -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')) {

Wyświetl plik

@ -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);

Wyświetl plik

@ -571,9 +571,9 @@ class BBCode extends BaseObject
$return = sprintf('<div class="type-%s">', $data["type"]);
}
if ($data["image"] != "") {
if (!empty($data["image"])) {
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], self::proxyUrl($data["image"], $simplehtml), $data["title"]);
} elseif ($data["preview"] != "") {
} elseif (!empty($data["preview"])) {
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], self::proxyUrl($data["preview"], $simplehtml), $data["title"]);
}

Wyświetl plik

@ -144,6 +144,10 @@ class L10n
{
$a = get_app();
if (empty($s)) {
return '';
}
if (x($a->strings, $s)) {
$t = $a->strings[$s];
$s = is_array($t) ? $t[0] : $t;

Wyświetl plik

@ -152,12 +152,8 @@ EOT;
if (isset($description["title"])) {
$tpl = get_markup_template('http_status.tpl');
echo replace_macros(
$tpl,
[
'$title' => $description["title"],
'$description' => $description["description"]]
);
echo replace_macros($tpl, ['$title' => $description["title"],
'$description' => defaults($description, 'description', '')]);
}
killme();

Wyświetl plik

@ -662,6 +662,11 @@ class GContact
$last_failure_str = '';
$last_contact_str = '';
if (empty($contact["network"])) {
logger("Empty network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
return false;
}
if (in_array($contact["network"], [NETWORK_PHANTOM])) {
logger("Invalid network for contact url ".$contact["url"]." - Called by: ".System::callstack(), LOGGER_DEBUG);
return false;

Wyświetl plik

@ -1030,10 +1030,8 @@ class Item extends BaseObject
private static function guid($item, $notify)
{
$guid = notags(trim($item['guid']));
if (!empty($guid)) {
return $guid;
if (!empty($item['guid'])) {
return notags(trim($item['guid']));
}
if ($notify) {

Wyświetl plik

@ -356,8 +356,8 @@ class Post extends BaseObject
'guid' => urlencode($item['guid']),
'isevent' => $isevent,
'attend' => $attend,
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, defaults($item, 'author-link', $item['url'])),
'olinktitle' => L10n::t('View %s\'s profile @ %s', htmlentities($this->getOwnerName()), defaults($item, 'owner-link', $item['url'])),
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
'olinktitle' => L10n::t('View %s\'s profile @ %s', htmlentities($this->getOwnerName()), $item['owner-link']),
'to' => L10n::t('to'),
'via' => L10n::t('via'),
'wall' => L10n::t('Wall-to-Wall'),

Wyświetl plik

@ -952,10 +952,10 @@ class DFRN
if (isset($parent_item)) {
$conversation = dba::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $item['parent-uri']]);
if (DBM::is_result($conversation)) {
if ($r['conversation-uri'] != '') {
if ($conversation['conversation-uri'] != '') {
$conversation_uri = $conversation['conversation-uri'];
}
if ($r['conversation-href'] != '') {
if ($conversation['conversation-href'] != '') {
$conversation_href = $conversation['conversation-href'];
}
}

Wyświetl plik

@ -1349,7 +1349,7 @@ class Diaspora
$author = "";
// Fetch the author - for the old and the new Diaspora version
if ($source_xml->post->status_message->diaspora_handle) {
if ($source_xml->post->status_message && $source_xml->post->status_message->diaspora_handle) {
$author = (string)$source_xml->post->status_message->diaspora_handle;
} elseif ($source_xml->author && ($source_xml->getName() == "status_message")) {
$author = (string)$source_xml->author;
@ -2165,7 +2165,7 @@ class Diaspora
}
// Send all existing comments and likes to the requesting server
$comments = Item::select(['id', 'verb', 'self'], ['parent' => $item['id']]);
$comments = Item::select(['id', 'parent', 'verb', 'self'], ['parent' => $item['id']]);
while ($comment = Item::fetch($comments)) {
if ($comment['id'] == $comment['parent']) {
continue;

Wyświetl plik

@ -1173,12 +1173,12 @@ class OStatus
$guid = "";
preg_match("/guid='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$guid = $matches[1];
}
preg_match('/guid="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
if (!empty($matches[1])) {
$guid = $matches[1];
}

Wyświetl plik

@ -61,7 +61,7 @@ class Delivery extends BaseObject
$condition = ['id' => [$item_id, $parent_id], 'visible' => true, 'moderated' => false];
$params = ['order' => ['id']];
$itemdata = Item::select([], $condition, $params);
$itemdata = Item::select(Item::ITEM_FIELDLIST, $condition, $params);
$items = [];
while ($item = Item::fetch($itemdata)) {
@ -259,6 +259,10 @@ class Delivery extends BaseObject
return;
}
$user = dba::selectFirst('user', [], ['uid' => $target_uid]);
$target_importer = array_merge($target_importer, $user);
// Set the user id. This is important if this is a public contact
$target_importer['importer_uid'] = $target_uid;
DFRN::import($atom, $target_importer);

Wyświetl plik

@ -29,10 +29,12 @@ function vier_init(App $a)
$a->set_template_engine('smarty3');
if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] || $a->argv[0] === "network" && local_user()) {
vier_community_info();
if (!empty($a->argv[0]) && !empty($a->argv[1])) {
if ($a->argv[0].$a->argv[1] === "profile".$a->user['nickname'] || $a->argv[0] === "network" && local_user()) {
vier_community_info();
$a->page['htmlhead'] .= "<link rel='stylesheet' type='text/css' href='view/theme/vier/wide.css' media='screen and (min-width: 1300px)'/>\n";
$a->page['htmlhead'] .= "<link rel='stylesheet' type='text/css' href='view/theme/vier/wide.css' media='screen and (min-width: 1300px)'/>\n";
}
}
if ($a->is_mobile || $a->is_tablet) {
@ -104,7 +106,7 @@ EOT;
// Hide the left menu bar
/// @TODO maybe move this static array out where it should belong?
if (($a->page['aside'] == "") && in_array($a->argv[0], ["community", "events", "help", "manage", "notifications",
if (empty($a->page['aside']) && in_array($a->argv[0], ["community", "events", "help", "manage", "notifications",
"probe", "webfinger", "login", "invite", "credits"])) {
$a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
}