Merge pull request #5789 from friendica/master
Update develop from master-2019.09
This commit is contained in:
commit
a6996601d5
125 changed files with 17335 additions and 17104 deletions
|
@ -6,9 +6,11 @@
|
|||
use Friendica\Content\Text;
|
||||
use Friendica\Core\L10n;
|
||||
|
||||
function visible_lf($s)
|
||||
function visible_whitespace($s)
|
||||
{
|
||||
return str_replace("\n", '<br />', $s);
|
||||
$s = str_replace(' ', ' ', $s);
|
||||
|
||||
return str_replace(["\r\n", "\n", "\r"], '<br />', $s);
|
||||
}
|
||||
|
||||
function babel_content()
|
||||
|
@ -20,19 +22,19 @@ function babel_content()
|
|||
$bbcode = trim($_REQUEST['text']);
|
||||
$results[] = [
|
||||
'title' => L10n::t('Source input'),
|
||||
'content' => visible_lf($bbcode)
|
||||
'content' => visible_whitespace($bbcode)
|
||||
];
|
||||
|
||||
$plain = Text\BBCode::toPlaintext($bbcode, false);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toPlaintext'),
|
||||
'content' => visible_lf($plain)
|
||||
'content' => visible_whitespace($plain)
|
||||
];
|
||||
|
||||
$html = Text\BBCode::convert($bbcode);
|
||||
$results[] = [
|
||||
'title' => L10n::t("BBCode::convert \x28raw HTML\x29"),
|
||||
'content' => htmlspecialchars($html)
|
||||
'title' => L10n::t('BBCode::convert (raw HTML)'),
|
||||
'content' => visible_whitespace(htmlspecialchars($html))
|
||||
];
|
||||
|
||||
$results[] = [
|
||||
|
@ -43,13 +45,13 @@ function babel_content()
|
|||
$bbcode2 = Text\HTML::toBBCode($html);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::convert => HTML::toBBCode'),
|
||||
'content' => visible_lf($bbcode2)
|
||||
'content' => visible_whitespace($bbcode2)
|
||||
];
|
||||
|
||||
$markdown = Text\BBCode::toMarkdown($bbcode);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toMarkdown'),
|
||||
'content' => visible_lf($markdown)
|
||||
'content' => visible_whitespace($markdown)
|
||||
];
|
||||
|
||||
$html2 = Text\Markdown::convert($markdown);
|
||||
|
@ -61,22 +63,33 @@ function babel_content()
|
|||
$bbcode3 = Text\Markdown::toBBCode($markdown);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
|
||||
'content' => visible_lf($bbcode3)
|
||||
'content' => visible_whitespace($bbcode3)
|
||||
];
|
||||
|
||||
$bbcode4 = Text\HTML::toBBCode($html2);
|
||||
$results[] = [
|
||||
'title' => L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'),
|
||||
'content' => visible_lf($bbcode4)
|
||||
'content' => visible_whitespace($bbcode4)
|
||||
];
|
||||
break;
|
||||
case 'markdown':
|
||||
$markdown = trim($_REQUEST['text']);
|
||||
$results[] = [
|
||||
'title' => L10n::t('Source input \x28Diaspora format\x29'),
|
||||
'title' => L10n::t('Source input (Diaspora format)'),
|
||||
'content' => '<pre>' . $markdown . '</pre>'
|
||||
];
|
||||
|
||||
$html = Text\Markdown::convert($markdown);
|
||||
$results[] = [
|
||||
'title' => L10n::t('Markdown::convert (raw HTML)'),
|
||||
'content' => htmlspecialchars($html)
|
||||
];
|
||||
|
||||
$results[] = [
|
||||
'title' => L10n::t('Markdown::convert'),
|
||||
'content' => $html
|
||||
];
|
||||
|
||||
$bbcode = Text\Markdown::toBBCode($markdown);
|
||||
$results[] = [
|
||||
'title' => L10n::t('Markdown::toBBCode'),
|
||||
|
@ -86,7 +99,7 @@ function babel_content()
|
|||
case 'html' :
|
||||
$html = trim($_REQUEST['text']);
|
||||
$results[] = [
|
||||
'title' => L10n::t("Raw HTML input"),
|
||||
'title' => L10n::t('Raw HTML input'),
|
||||
'content' => htmlspecialchars($html)
|
||||
];
|
||||
|
||||
|
@ -98,7 +111,13 @@ function babel_content()
|
|||
$bbcode = Text\HTML::toBBCode($html);
|
||||
$results[] = [
|
||||
'title' => L10n::t('HTML::toBBCode'),
|
||||
'content' => visible_lf($bbcode)
|
||||
'content' => visible_whitespace($bbcode)
|
||||
];
|
||||
|
||||
$markdown = Text\HTML::toMarkdown($html);
|
||||
$results[] = [
|
||||
'title' => L10n::t('HTML::toMarkdown'),
|
||||
'content' => visible_whitespace($markdown)
|
||||
];
|
||||
|
||||
$text = Text\HTML::toPlaintext($html);
|
||||
|
@ -111,7 +130,7 @@ function babel_content()
|
|||
|
||||
$tpl = get_markup_template('babel.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
'$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
|
||||
'$text' => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''],
|
||||
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
|
||||
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
|
||||
'$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
|
||||
|
|
|
@ -30,6 +30,10 @@ function bookmarklet_content(App $a)
|
|||
$page = normalise_link(System::baseUrl() . "/bookmarklet");
|
||||
|
||||
if (!strstr($referer, $page)) {
|
||||
if (empty($_REQUEST["url"])) {
|
||||
System::httpExit(400, ["title" => L10n::t('Bad Request')]);
|
||||
}
|
||||
|
||||
$content = add_page_info($_REQUEST["url"]);
|
||||
|
||||
$x = [
|
||||
|
|
|
@ -47,6 +47,11 @@ function contacts_init(App $a)
|
|||
if (!DBA::isResult($contact)) {
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0]);
|
||||
}
|
||||
|
||||
// Don't display contacts that are about to be deleted
|
||||
if ($contact['network'] == Protocol::PHANTOM) {
|
||||
$contact = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (DBA::isResult($contact)) {
|
||||
|
@ -122,11 +127,12 @@ function contacts_init(App $a)
|
|||
|
||||
function contacts_batch_actions(App $a)
|
||||
{
|
||||
$contacts_id = $_POST['contact_batch'];
|
||||
if (!is_array($contacts_id)) {
|
||||
if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contacts_id = $_POST['contact_batch'];
|
||||
|
||||
$orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
|
||||
implode(",", $contacts_id),
|
||||
intval(local_user())
|
||||
|
@ -367,7 +373,7 @@ function _contact_drop($orig_record)
|
|||
return;
|
||||
}
|
||||
|
||||
Contact::terminateFriendship($r[0], $orig_record);
|
||||
Contact::terminateFriendship($r[0], $orig_record, true);
|
||||
Contact::remove($orig_record['id']);
|
||||
}
|
||||
|
||||
|
@ -595,17 +601,12 @@ function contacts_content(App $a, $update = 0)
|
|||
/// @todo Only show the following link with DFRN when the remote version supports it
|
||||
$follow = '';
|
||||
$follow_text = '';
|
||||
if (in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
|
||||
if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
|
||||
if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
|
||||
if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||
$follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]);
|
||||
$follow_text = L10n::t("Disconnect/Unfollow");
|
||||
} else {
|
||||
$follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
|
||||
$follow_text = L10n::t("Connect/Follow");
|
||||
}
|
||||
}
|
||||
|
||||
if ($contact['uid'] == 0) {
|
||||
} else {
|
||||
$follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
|
||||
$follow_text = L10n::t("Connect/Follow");
|
||||
}
|
||||
|
@ -723,6 +724,8 @@ function contacts_content(App $a, $update = 0)
|
|||
$sql_extra = " AND `blocked` = 0 ";
|
||||
}
|
||||
|
||||
$sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
|
||||
|
||||
$search = x($_GET, 'search') ? notags(trim($_GET['search'])) : '';
|
||||
$nets = x($_GET, 'nets' ) ? notags(trim($_GET['nets'])) : '';
|
||||
|
||||
|
|
|
@ -79,13 +79,13 @@ function dfrn_notify_post(App $a) {
|
|||
$condition = [];
|
||||
switch ($direction) {
|
||||
case (-1):
|
||||
$condition = ["`issued-id` = ? OR `dfrn-id` = ?", $dfrn_id, $dfrn_id];
|
||||
$condition = ["(`issued-id` = ? OR `dfrn-id` = ?) AND `uid` = ?", $dfrn_id, $dfrn_id, $user['uid']];
|
||||
break;
|
||||
case 0:
|
||||
$condition = ['issued-id' => $dfrn_id, 'duplex' => true];
|
||||
$condition = ['issued-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||
break;
|
||||
case 1:
|
||||
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true];
|
||||
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||
break;
|
||||
default:
|
||||
System::xmlExit(3, 'Invalid direction');
|
||||
|
@ -182,7 +182,7 @@ function dfrn_notify_post(App $a) {
|
|||
|
||||
function dfrn_dispatch_public($postdata)
|
||||
{
|
||||
$msg = Diaspora::decodeRaw([], $postdata);
|
||||
$msg = Diaspora::decodeRaw([], $postdata, true);
|
||||
if (!$msg) {
|
||||
// We have to fail silently to be able to hand it over to the salmon parser
|
||||
return false;
|
||||
|
@ -287,15 +287,15 @@ function dfrn_notify_content(App $a) {
|
|||
$condition = [];
|
||||
switch ($direction) {
|
||||
case (-1):
|
||||
$condition = ["`issued-id` = ? OR `dfrn-id` = ?", $dfrn_id, $dfrn_id];
|
||||
$condition = ["(`issued-id` = ? OR `dfrn-id` = ?) AND `uid` = ?", $dfrn_id, $dfrn_id, $user['uid']];
|
||||
$my_id = $dfrn_id;
|
||||
break;
|
||||
case 0:
|
||||
$condition = ['issued-id' => $dfrn_id, 'duplex' => true];
|
||||
$condition = ['issued-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||
$my_id = '1:' . $dfrn_id;
|
||||
break;
|
||||
case 1:
|
||||
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true];
|
||||
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||
$my_id = '0:' . $dfrn_id;
|
||||
break;
|
||||
default:
|
||||
|
@ -322,8 +322,8 @@ function dfrn_notify_content(App $a) {
|
|||
$encrypted_id = '';
|
||||
$id_str = $my_id . '.' . mt_rand(1000,9999);
|
||||
|
||||
$prv_key = trim($importer['prvkey']);
|
||||
$pub_key = trim($importer['pubkey']);
|
||||
$prv_key = trim($importer['cprvkey']);
|
||||
$pub_key = trim($importer['cpubkey']);
|
||||
$dplx = intval($importer['duplex']);
|
||||
|
||||
if (($dplx && strlen($prv_key)) || (strlen($prv_key) && !strlen($pub_key))) {
|
||||
|
|
|
@ -44,7 +44,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
|
||||
$local = Config::get('system','poco_local_search');
|
||||
|
||||
$search = $prefix.notags(trim($_REQUEST['search']));
|
||||
$search = $prefix.notags(trim(defaults($_REQUEST, 'search', '')));
|
||||
|
||||
$header = '';
|
||||
|
||||
|
|
140
mod/events.php
140
mod/events.php
|
@ -20,7 +20,8 @@ use Friendica\Util\Temporal;
|
|||
|
||||
require_once 'include/items.php';
|
||||
|
||||
function events_init(App $a) {
|
||||
function events_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
@ -42,7 +43,8 @@ function events_init(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
function events_post(App $a) {
|
||||
function events_post(App $a)
|
||||
{
|
||||
|
||||
logger('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
|
||||
|
||||
|
@ -50,15 +52,15 @@ function events_post(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
$event_id = (x($_POST, 'event_id') ? intval($_POST['event_id']) : 0);
|
||||
$cid = (x($_POST, 'cid') ? intval($_POST['cid']) : 0);
|
||||
$event_id = !empty($_POST['event_id']) ? intval($_POST['event_id']) : 0;
|
||||
$cid = !empty($_POST['cid']) ? intval($_POST['cid']) : 0;
|
||||
$uid = local_user();
|
||||
|
||||
$start_text = escape_tags($_REQUEST['start_text']);
|
||||
$finish_text = escape_tags($_REQUEST['finish_text']);
|
||||
$start_text = escape_tags(defaults($_REQUEST, 'start_text', ''));
|
||||
$finish_text = escape_tags(defaults($_REQUEST, 'finish_text', ''));
|
||||
|
||||
$adjust = intval($_POST['adjust']);
|
||||
$nofinish = intval($_POST['nofinish']);
|
||||
$adjust = intval(defaults($_POST, 'adjust', 0));
|
||||
$nofinish = intval(defaults($_POST, 'nofinish', 0));
|
||||
|
||||
// The default setting for the `private` field in event_store() is false, so mirror that
|
||||
$private_event = false;
|
||||
|
@ -91,9 +93,9 @@ function events_post(App $a) {
|
|||
// and we'll waste a bunch of time responding to it. Time that
|
||||
// could've been spent doing something else.
|
||||
|
||||
$summary = escape_tags(trim($_POST['summary']));
|
||||
$desc = escape_tags(trim($_POST['desc']));
|
||||
$location = escape_tags(trim($_POST['location']));
|
||||
$summary = escape_tags(trim(defaults($_POST, 'summary', '')));
|
||||
$desc = escape_tags(trim(defaults($_POST, 'desc', '')));
|
||||
$location = escape_tags(trim(defaults($_POST, 'location', '')));
|
||||
$type = 'event';
|
||||
|
||||
$action = ($event_id == '') ? 'new' : "event/" . $event_id;
|
||||
|
@ -117,7 +119,7 @@ function events_post(App $a) {
|
|||
goaway($onerror_url);
|
||||
}
|
||||
|
||||
$share = (intval($_POST['share']) ? intval($_POST['share']) : 0);
|
||||
$share = intval(defaults($_POST, 'share', 0));
|
||||
|
||||
$c = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
||||
intval(local_user())
|
||||
|
@ -137,7 +139,7 @@ function events_post(App $a) {
|
|||
$str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : '';
|
||||
|
||||
// Undo the pseudo-contact of self, since there are real contacts now
|
||||
if (strpos($str_contact_allow, '<' . $self . '>') !== false ) {
|
||||
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
|
||||
$str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
|
||||
}
|
||||
// Make sure to set the `private` field as true. This is necessary to
|
||||
|
@ -187,8 +189,8 @@ function events_post(App $a) {
|
|||
goaway($_SESSION['return_url']);
|
||||
}
|
||||
|
||||
function events_content(App $a) {
|
||||
|
||||
function events_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
return;
|
||||
|
@ -244,7 +246,7 @@ function events_content(App $a) {
|
|||
$mode = 'view';
|
||||
$y = 0;
|
||||
$m = 0;
|
||||
$ignored = (x($_REQUEST, 'ignored') ? intval($_REQUEST['ignored']) : 0);
|
||||
$ignored = !empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0;
|
||||
|
||||
if ($a->argc > 1) {
|
||||
if ($a->argc > 2 && $a->argv[1] == 'event') {
|
||||
|
@ -272,7 +274,6 @@ function events_content(App $a) {
|
|||
|
||||
// The view mode part is similiar to /mod/cal.php
|
||||
if ($mode == 'view') {
|
||||
|
||||
$thisyear = DateTimeFormat::localNow('Y');
|
||||
$thismonth = DateTimeFormat::localNow('m');
|
||||
if (!$y) {
|
||||
|
@ -312,10 +313,10 @@ function events_content(App $a) {
|
|||
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
||||
|
||||
if ($a->argc > 1 && $a->argv[1] === 'json') {
|
||||
if (x($_GET, 'start')) {
|
||||
$start = $_GET['start'];
|
||||
if (!empty($_GET['start'])) {
|
||||
$start = $_GET['start'];
|
||||
}
|
||||
if (x($_GET, 'end')) {
|
||||
if (!empty($_GET['end'])) {
|
||||
$finish = $_GET['end'];
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +350,7 @@ function events_content(App $a) {
|
|||
$r = Event::sortByDate($r);
|
||||
foreach ($r as $rr) {
|
||||
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
|
||||
if (!x($links,$j)) {
|
||||
if (empty($links[$j])) {
|
||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||
}
|
||||
}
|
||||
|
@ -363,12 +364,12 @@ function events_content(App $a) {
|
|||
$events = Event::prepareListForTemplate($r);
|
||||
}
|
||||
|
||||
if ($a->argc > 1 && $a->argv[1] === 'json'){
|
||||
if ($a->argc > 1 && $a->argv[1] === 'json') {
|
||||
echo json_encode($events);
|
||||
killme();
|
||||
}
|
||||
|
||||
if (x($_GET, 'id')) {
|
||||
if (!empty($_GET['id'])) {
|
||||
$tpl = get_markup_template("event.tpl");
|
||||
} else {
|
||||
$tpl = get_markup_template("events_js.tpl");
|
||||
|
@ -378,7 +379,7 @@ function events_content(App $a) {
|
|||
foreach ($events as $key => $event) {
|
||||
$event_item = [];
|
||||
foreach ($event['item'] as $k => $v) {
|
||||
$k = str_replace('-' ,'_', $k);
|
||||
$k = str_replace('-', '_', $k);
|
||||
$event_item[$k] = $v;
|
||||
}
|
||||
$events[$key]['item'] = $event_item;
|
||||
|
@ -403,7 +404,7 @@ function events_content(App $a) {
|
|||
'$list' => L10n::t('list'),
|
||||
]);
|
||||
|
||||
if (x($_GET, 'id')) {
|
||||
if (!empty($_GET['id'])) {
|
||||
echo $o;
|
||||
killme();
|
||||
}
|
||||
|
@ -428,41 +429,45 @@ function events_content(App $a) {
|
|||
}
|
||||
|
||||
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
|
||||
if (x($_REQUEST, 'nofinish')) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
||||
if (x($_REQUEST, 'adjust')) {$orig_event['adjust'] = $_REQUEST['adjust'];}
|
||||
if (x($_REQUEST, 'summary')) {$orig_event['summary'] = $_REQUEST['summary'];}
|
||||
if (x($_REQUEST, 'description')) {$orig_event['description'] = $_REQUEST['description'];}
|
||||
if (x($_REQUEST, 'location')) {$orig_event['location'] = $_REQUEST['location'];}
|
||||
if (x($_REQUEST, 'start')) {$orig_event['start'] = $_REQUEST['start'];}
|
||||
if (x($_REQUEST, 'finish')) {$orig_event['finish'] = $_REQUEST['finish'];}
|
||||
if (x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
|
||||
if (!empty($_REQUEST['nofinish'])) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
||||
if (!empty($_REQUEST['adjust'])) {$orig_event['adjust'] = $_REQUEST['adjust'];}
|
||||
if (!empty($_REQUEST['summary'])) {$orig_event['summary'] = $_REQUEST['summary'];}
|
||||
if (!empty($_REQUEST['description'])) {$orig_event['description'] = $_REQUEST['description'];}
|
||||
if (!empty($_REQUEST['location'])) {$orig_event['location'] = $_REQUEST['location'];}
|
||||
if (!empty($_REQUEST['start'])) {$orig_event['start'] = $_REQUEST['start'];}
|
||||
if (!empty($_REQUEST['finish'])) {$orig_event['finish'] = $_REQUEST['finish'];}
|
||||
|
||||
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||
$n_checked = (!empty($orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||
$a_checked = (!empty($orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||
|
||||
$t_orig = (x($orig_event) ? $orig_event['summary'] : '');
|
||||
$d_orig = (x($orig_event) ? $orig_event['desc'] : '');
|
||||
$l_orig = (x($orig_event) ? $orig_event['location'] : '');
|
||||
$eid = (x($orig_event) ? $orig_event['id'] : 0);
|
||||
$cid = (x($orig_event) ? $orig_event['cid'] : 0);
|
||||
$uri = (x($orig_event) ? $orig_event['uri'] : '');
|
||||
$t_orig = !empty($orig_event) ? $orig_event['summary'] : '';
|
||||
$d_orig = !empty($orig_event) ? $orig_event['desc'] : '';
|
||||
$l_orig = !empty($orig_event) ? $orig_event['location'] : '';
|
||||
$eid = !empty($orig_event) ? $orig_event['id'] : 0;
|
||||
$cid = !empty($orig_event) ? $orig_event['cid'] : 0;
|
||||
$uri = !empty($orig_event) ? $orig_event['uri'] : '';
|
||||
|
||||
$sh_disabled = '';
|
||||
$sh_checked = '';
|
||||
$sh_checked = '';
|
||||
|
||||
if (x($orig_event)) {
|
||||
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && !$orig_event['allow_gid'] && !$orig_event['deny_cid'] && !$orig_event['deny_gid']) ? '' : ' checked="checked" ');
|
||||
if (!empty($orig_event)
|
||||
&& ($orig_event['allow_cid'] !== '<' . local_user() . '>'
|
||||
|| $orig_event['allow_gid']
|
||||
|| $orig_event['deny_cid']
|
||||
|| $orig_event['deny_gid']))
|
||||
{
|
||||
$sh_checked = ' checked="checked" ';
|
||||
}
|
||||
|
||||
if ($cid || $mode === 'edit') {
|
||||
$sh_disabled = 'disabled="disabled"';
|
||||
}
|
||||
|
||||
$sdt = (x($orig_event) ? $orig_event['start'] : 'now');
|
||||
$fdt = (x($orig_event) ? $orig_event['finish'] : 'now');
|
||||
$sdt = !empty($orig_event) ? $orig_event['start'] : 'now';
|
||||
$fdt = !empty($orig_event) ? $orig_event['finish'] : 'now';
|
||||
|
||||
$tz = date_default_timezone_get();
|
||||
if (x($orig_event)) {
|
||||
if (!empty($orig_event)) {
|
||||
$tz = ($orig_event['adjust'] ? date_default_timezone_get() : 'UTC');
|
||||
}
|
||||
|
||||
|
@ -470,20 +475,22 @@ function events_content(App $a) {
|
|||
$smonth = DateTimeFormat::convert($sdt, $tz, 'UTC', 'm');
|
||||
$sday = DateTimeFormat::convert($sdt, $tz, 'UTC', 'd');
|
||||
|
||||
$shour = (x($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'H') : '00');
|
||||
$sminute = (x($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'i') : '00');
|
||||
$shour = !empty($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'H') : '00';
|
||||
$sminute = !empty($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'i') : '00';
|
||||
|
||||
$fyear = DateTimeFormat::convert($fdt, $tz, 'UTC', 'Y');
|
||||
$fmonth = DateTimeFormat::convert($fdt, $tz, 'UTC', 'm');
|
||||
$fday = DateTimeFormat::convert($fdt, $tz, 'UTC', 'd');
|
||||
|
||||
$fhour = (x($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00');
|
||||
$fminute = (x($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00');
|
||||
$fhour = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00';
|
||||
$fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
|
||||
|
||||
$perms = ACL::getDefaultUserPermissions($orig_event);
|
||||
|
||||
if ($mode === 'new' || $mode === 'copy') {
|
||||
$acl = ($cid ? '' : ACL::getFullSelectorHTML($a->user, false, $orig_event));
|
||||
if (!$cid && in_array($mode, ['new', 'copy'])) {
|
||||
$acl = ACL::getFullSelectorHTML($a->user, false, $orig_event);
|
||||
} else {
|
||||
$acl = '';
|
||||
}
|
||||
|
||||
// If we copy an old event, we need to remove the ID and URI
|
||||
|
@ -495,7 +502,7 @@ function events_content(App $a) {
|
|||
|
||||
$tpl = get_markup_template('event_form.tpl');
|
||||
|
||||
$o .= replace_macros($tpl,[
|
||||
$o .= replace_macros($tpl, [
|
||||
'$post' => System::baseUrl() . '/events',
|
||||
'$eid' => $eid,
|
||||
'$cid' => $cid,
|
||||
|
@ -509,11 +516,31 @@ function events_content(App $a) {
|
|||
'$title' => L10n::t('Event details'),
|
||||
'$desc' => L10n::t('Starting date and Title are required.'),
|
||||
'$s_text' => L10n::t('Event Starts:') . ' <span class="required" title="' . L10n::t('Required') . '">*</span>',
|
||||
'$s_dsel' => Temporal::getDateTimeField(new DateTime(), DateTime::createFromFormat('Y', $syear+5), DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"), L10n::t('Event Starts:'), 'start_text', true, true, '', '', true),
|
||||
'$s_dsel' => Temporal::getDateTimeField(
|
||||
new DateTime(),
|
||||
DateTime::createFromFormat('Y', $syear+5),
|
||||
DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"),
|
||||
L10n::t('Event Starts:'),
|
||||
'start_text',
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
),
|
||||
'$n_text' => L10n::t('Finish date/time is not known or not relevant'),
|
||||
'$n_checked' => $n_checked,
|
||||
'$f_text' => L10n::t('Event Finishes:'),
|
||||
'$f_dsel' => Temporal::getDateTimeField(new DateTime(), DateTime::createFromFormat('Y', $fyear+5), DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"), L10n::t('Event Finishes:'), 'finish_text', true, true, 'start_text'),
|
||||
'$f_dsel' => Temporal::getDateTimeField(
|
||||
new DateTime(),
|
||||
DateTime::createFromFormat('Y', $fyear+5),
|
||||
DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"),
|
||||
L10n::t('Event Finishes:'),
|
||||
'finish_text',
|
||||
true,
|
||||
true,
|
||||
'start_text'
|
||||
),
|
||||
'$a_text' => L10n::t('Adjust for viewer timezone'),
|
||||
'$a_checked' => $a_checked,
|
||||
'$d_text' => L10n::t('Description:'),
|
||||
|
@ -534,7 +561,6 @@ function events_content(App $a) {
|
|||
'$basic' => L10n::t('Basic'),
|
||||
'$advanced' => L10n::t('Advanced'),
|
||||
'$permissions' => L10n::t('Permissions'),
|
||||
|
||||
]);
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -25,7 +25,7 @@ function fetch_init(App $a)
|
|||
|
||||
// Fetch the item
|
||||
$fields = ['uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'app', 'location', 'coord', 'network',
|
||||
'event-id', 'resource-id', 'author-link', 'owner-link', 'attach'];
|
||||
'event-id', 'resource-id', 'author-link', 'author-avatar', 'author-name', 'plink', 'owner-link', 'attach'];
|
||||
$condition = ['wall' => true, 'private' => false, 'guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
if (!DBA::isResult($item)) {
|
||||
|
|
10
mod/item.php
10
mod/item.php
|
@ -39,7 +39,7 @@ require_once 'include/items.php';
|
|||
|
||||
function item_post(App $a) {
|
||||
if (!local_user() && !remote_user()) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
require_once 'include/security.php';
|
||||
|
@ -154,7 +154,7 @@ function item_post(App $a) {
|
|||
if (($message_id != '') && ($profile_uid != 0)) {
|
||||
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) {
|
||||
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ function item_post(App $a) {
|
|||
$user = DBA::selectFirst('user', [], ['uid' => $profile_uid]);
|
||||
|
||||
if (!DBA::isResult($user) && !$parent) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
$categories = '';
|
||||
|
@ -843,6 +843,10 @@ function item_post(App $a) {
|
|||
|
||||
logger('post_complete');
|
||||
|
||||
if ($api_source) {
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
item_post_return(System::baseUrl(), $api_source, $return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
|
|
@ -8,27 +8,31 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
function lockview_content(App $a) {
|
||||
|
||||
function lockview_content(App $a)
|
||||
{
|
||||
$type = (($a->argc > 1) ? $a->argv[1] : 0);
|
||||
if (is_numeric($type)) {
|
||||
$item_id = intval($type);
|
||||
$type='item';
|
||||
$type = 'item';
|
||||
} else {
|
||||
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
||||
}
|
||||
|
||||
if (!$item_id)
|
||||
if (!$item_id) {
|
||||
killme();
|
||||
}
|
||||
|
||||
if (!in_array($type, ['item','photo','event']))
|
||||
if (!in_array($type, ['item','photo','event'])) {
|
||||
killme();
|
||||
}
|
||||
|
||||
$fields = ['uid', 'private', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
||||
$fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
||||
$condition = ['id' => $item_id];
|
||||
|
||||
if ($type != 'item') {
|
||||
$item = DBA::selectFirst($type, $fields, $condition);
|
||||
} else {
|
||||
$fields[] = 'private';
|
||||
$item = Item::selectFirst($fields, $condition);
|
||||
}
|
||||
|
||||
|
@ -43,18 +47,21 @@ function lockview_content(App $a) {
|
|||
killme();
|
||||
}
|
||||
|
||||
|
||||
if (($item['private'] == 1) && empty($item['allow_cid']) && empty($item['allow_gid'])
|
||||
&& empty($item['deny_cid']) && empty($item['deny_gid'])) {
|
||||
|
||||
if (isset($item['private'])
|
||||
&& $item['private'] == 1
|
||||
&& empty($item['allow_cid'])
|
||||
&& empty($item['allow_gid'])
|
||||
&& empty($item['deny_cid'])
|
||||
&& empty($item['deny_gid']))
|
||||
{
|
||||
echo L10n::t('Remote privacy information not available.') . '<br />';
|
||||
killme();
|
||||
}
|
||||
|
||||
$allowed_users = expand_acl($item['allow_cid']);
|
||||
$allowed_users = expand_acl($item['allow_cid']);
|
||||
$allowed_groups = expand_acl($item['allow_gid']);
|
||||
$deny_users = expand_acl($item['deny_cid']);
|
||||
$deny_groups = expand_acl($item['deny_gid']);
|
||||
$deny_users = expand_acl($item['deny_cid']);
|
||||
$deny_groups = expand_acl($item['deny_gid']);
|
||||
|
||||
$o = L10n::t('Visible to:') . '<br />';
|
||||
$l = [];
|
||||
|
@ -63,36 +70,44 @@ function lockview_content(App $a) {
|
|||
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
||||
DBA::escape(implode(', ', $allowed_groups))
|
||||
);
|
||||
if (DBA::isResult($r))
|
||||
foreach($r as $rr)
|
||||
if (DBA::isResult($r)) {
|
||||
foreach ($r as $rr) {
|
||||
$l[] = '<b>' . $rr['name'] . '</b>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($allowed_users)) {
|
||||
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
||||
DBA::escape(implode(', ',$allowed_users))
|
||||
DBA::escape(implode(', ', $allowed_users))
|
||||
);
|
||||
if (DBA::isResult($r))
|
||||
foreach($r as $rr)
|
||||
if (DBA::isResult($r)) {
|
||||
foreach ($r as $rr) {
|
||||
$l[] = $rr['name'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($deny_groups)) {
|
||||
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
||||
DBA::escape(implode(', ', $deny_groups))
|
||||
);
|
||||
if (DBA::isResult($r))
|
||||
foreach($r as $rr)
|
||||
if (DBA::isResult($r)) {
|
||||
foreach ($r as $rr) {
|
||||
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($deny_users)) {
|
||||
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
||||
DBA::escape(implode(', ',$deny_users))
|
||||
DBA::escape(implode(', ', $deny_users))
|
||||
);
|
||||
if (DBA::isResult($r))
|
||||
foreach($r as $rr)
|
||||
if (DBA::isResult($r)) {
|
||||
foreach ($r as $rr) {
|
||||
$l[] = '<strike>' . $rr['name'] . '</strike>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $o . implode(', ', $l);
|
||||
|
|
|
@ -488,7 +488,7 @@ function render_messages(array $msg, $t)
|
|||
'$id' => $rr['id'],
|
||||
'$from_name' => $participants,
|
||||
'$from_url' => Contact::magicLink($rr['url']),
|
||||
'$from_addr' => $contact['addr'],
|
||||
'$from_addr' => defaults($contact, 'addr', ''),
|
||||
'$sparkle' => ' sparkle',
|
||||
'$from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
|
||||
'$subject' => $subject_e,
|
||||
|
|
|
@ -70,8 +70,11 @@ function notes_content(App $a, $update = false)
|
|||
$count = 0;
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
$count = count($r);
|
||||
$o .= conversation($a, DBA::toArray($r), 'notes', $update);
|
||||
$notes = DBA::toArray($r);
|
||||
|
||||
$count = count($notes);
|
||||
|
||||
$o .= conversation($a, $notes, 'notes', $update);
|
||||
}
|
||||
|
||||
$o .= alt_pager($a, $count);
|
||||
|
|
|
@ -21,7 +21,7 @@ function notifications_post(App $a)
|
|||
|
||||
$request_id = (($a->argc > 1) ? $a->argv[1] : 0);
|
||||
|
||||
if ($request_id === "all") {
|
||||
if ($request_id === 'all') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@ function notifications_content(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$page = (x($_REQUEST,'page') ? $_REQUEST['page'] : 1);
|
||||
$show = (x($_REQUEST,'show') ? $_REQUEST['show'] : 0);
|
||||
$page = defaults($_REQUEST, 'page', 1);
|
||||
$show = defaults($_REQUEST, 'show', 0);
|
||||
|
||||
Nav::setSelected('notifications');
|
||||
|
||||
|
@ -87,10 +87,11 @@ function notifications_content(App $a)
|
|||
$perpage = 20;
|
||||
$startrec = ($page * $perpage) - $perpage;
|
||||
|
||||
$notif_header = L10n::t('Notifications');
|
||||
|
||||
// Get introductions
|
||||
if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
|
||||
Nav::setSelected('introductions');
|
||||
$notif_header = L10n::t('Notifications');
|
||||
|
||||
$all = (($a->argc > 2) && ($a->argv[2] == 'all'));
|
||||
|
||||
|
@ -115,10 +116,8 @@ function notifications_content(App $a)
|
|||
} elseif (($a->argc > 1) && ($a->argv[1] == 'home')) {
|
||||
$notif_header = L10n::t('Home Notifications');
|
||||
$notifs = $nm->homeNotifs($show, $startrec, $perpage);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Set the pager
|
||||
$a->set_pager_itemspage($perpage);
|
||||
|
||||
|
@ -133,14 +132,15 @@ function notifications_content(App $a)
|
|||
|
||||
$notif_tpl = get_markup_template('notifications.tpl');
|
||||
|
||||
if (!isset($notifs['ident'])) {
|
||||
logger('Missing data in notifs: ' . System::callstack(20), LOGGER_DEBUG);
|
||||
}
|
||||
$notif_show_lnk = [
|
||||
'href' => ($show ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all' ),
|
||||
'text' => ($show ? L10n::t('Show unread') : L10n::t('Show all')),
|
||||
];
|
||||
|
||||
// Process the data for template creation
|
||||
if ($notifs['ident'] === 'introductions') {
|
||||
if (defaults($notifs, 'ident', '') === 'introductions') {
|
||||
$sugg = get_markup_template('suggestions.tpl');
|
||||
$tpl = get_markup_template("intros.tpl");
|
||||
$tpl = get_markup_template('intros.tpl');
|
||||
|
||||
// The link to switch between ignored and normal connection requests
|
||||
$notif_show_lnk = [
|
||||
|
@ -150,127 +150,121 @@ function notifications_content(App $a)
|
|||
|
||||
// Loop through all introduction notifications.This creates an array with the output html for each
|
||||
// introduction
|
||||
foreach ($notifs['notifications'] as $it) {
|
||||
foreach ($notifs['notifications'] as $notif) {
|
||||
|
||||
// There are two kind of introduction. Contacts suggested by other contacts and normal connection requests.
|
||||
// We have to distinguish between these two because they use different data.
|
||||
switch ($it['label']) {
|
||||
switch ($notif['label']) {
|
||||
case 'friend_suggestion':
|
||||
$notif_content[] = replace_macros($sugg, [
|
||||
'$type' => $it['label'],
|
||||
'$type' => $notif['label'],
|
||||
'$str_notifytype' => L10n::t('Notification type:'),
|
||||
'$notify_type' => $it['notify_type'],
|
||||
'$intro_id' => $it['intro_id'],
|
||||
'$notify_type'=> $notif['notify_type'],
|
||||
'$intro_id' => $notif['intro_id'],
|
||||
'$lbl_madeby' => L10n::t('Suggested by:'),
|
||||
'$madeby' => $it['madeby'],
|
||||
'$madeby_url' => $it['madeby_url'],
|
||||
'$madeby_zrl' => $it['madeby_zrl'],
|
||||
'$madeby_addr' => $it['madeby_addr'],
|
||||
'$contact_id' => $it['contact_id'],
|
||||
'$photo' => $it['photo'],
|
||||
'$fullname' => $it['name'],
|
||||
'$url' => $it['url'],
|
||||
'$zrl' => $it['zrl'],
|
||||
'$lbl_url' => L10n::t('Profile URL'),
|
||||
'$addr' => $it['addr'],
|
||||
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
|
||||
|
||||
'$knowyou' => $it['knowyou'],
|
||||
'$approve' => L10n::t('Approve'),
|
||||
'$note' => $it['note'],
|
||||
'$request' => $it['request'],
|
||||
'$ignore' => L10n::t('Ignore'),
|
||||
'$discard' => L10n::t('Discard'),
|
||||
'$madeby' => $notif['madeby'],
|
||||
'$madeby_url' => $notif['madeby_url'],
|
||||
'$madeby_zrl' => $notif['madeby_zrl'],
|
||||
'$madeby_addr'=> $notif['madeby_addr'],
|
||||
'$contact_id' => $notif['contact_id'],
|
||||
'$photo' => $notif['photo'],
|
||||
'$fullname' => $notif['name'],
|
||||
'$url' => $notif['url'],
|
||||
'$zrl' => $notif['zrl'],
|
||||
'$lbl_url' => L10n::t('Profile URL'),
|
||||
'$addr' => $notif['addr'],
|
||||
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($notif['hidden'] == 1), ''],
|
||||
'$knowyou' => $notif['knowyou'],
|
||||
'$approve' => L10n::t('Approve'),
|
||||
'$note' => $notif['note'],
|
||||
'$request' => $notif['request'],
|
||||
'$ignore' => L10n::t('Ignore'),
|
||||
'$discard' => L10n::t('Discard'),
|
||||
]);
|
||||
break;
|
||||
|
||||
// Normal connection requests
|
||||
default:
|
||||
$friend_selected = (($it['network'] !== Protocol::OSTATUS) ? ' checked="checked" ' : ' disabled ');
|
||||
$fan_selected = (($it['network'] === Protocol::OSTATUS) ? ' checked="checked" disabled ' : '');
|
||||
$dfrn_tpl = get_markup_template('netfriend.tpl');
|
||||
$friend_selected = (($notif['network'] !== Protocol::OSTATUS) ? ' checked="checked" ' : ' disabled ');
|
||||
$fan_selected = (($notif['network'] === Protocol::OSTATUS) ? ' checked="checked" disabled ' : '');
|
||||
|
||||
$knowyou = '';
|
||||
$lbl_knowyou = '';
|
||||
$dfrn_text = '';
|
||||
$helptext = '';
|
||||
$helptext2 = '';
|
||||
$helptext3 = '';
|
||||
$knowyou = '';
|
||||
$helptext = '';
|
||||
$helptext2 = '';
|
||||
$helptext3 = '';
|
||||
|
||||
if ($it['network'] === Protocol::DFRN || $it['network'] === Protocol::DIASPORA) {
|
||||
if ($it['network'] === Protocol::DFRN) {
|
||||
$lbl_knowyou = L10n::t('Claims to be known to you: ');
|
||||
$knowyou = (($it['knowyou']) ? L10n::t('yes') : L10n::t('no'));
|
||||
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
||||
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $it['name'], $it['name']);
|
||||
$helptext3 = L10n::t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $it['name']);
|
||||
} else {
|
||||
$knowyou = '';
|
||||
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
||||
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $it['name'], $it['name']);
|
||||
$helptext3 = L10n::t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $it['name']);
|
||||
}
|
||||
if ($notif['network'] === Protocol::DFRN) {
|
||||
$lbl_knowyou = L10n::t('Claims to be known to you: ');
|
||||
$knowyou = (($notif['knowyou']) ? L10n::t('yes') : L10n::t('no'));
|
||||
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
||||
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $notif['name'], $notif['name']);
|
||||
$helptext3 = L10n::t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $notif['name']);
|
||||
} elseif ($notif['network'] === Protocol::DIASPORA) {
|
||||
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
||||
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $notif['name'], $notif['name']);
|
||||
$helptext3 = L10n::t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $notif['name']);
|
||||
}
|
||||
|
||||
$dfrn_text = replace_macros($dfrn_tpl,[
|
||||
'$intro_id' => $it['intro_id'],
|
||||
$dfrn_tpl = get_markup_template('netfriend.tpl');
|
||||
$dfrn_text = replace_macros($dfrn_tpl, [
|
||||
'$intro_id' => $notif['intro_id'],
|
||||
'$friend_selected' => $friend_selected,
|
||||
'$fan_selected' => $fan_selected,
|
||||
'$fan_selected'=> $fan_selected,
|
||||
'$approve_as1' => $helptext,
|
||||
'$approve_as2' => $helptext2,
|
||||
'$approve_as3' => $helptext3,
|
||||
'$as_friend' => L10n::t('Friend'),
|
||||
'$as_fan' => (($it['network'] == Protocol::DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber'))
|
||||
'$as_friend' => L10n::t('Friend'),
|
||||
'$as_fan' => (($notif['network'] == Protocol::DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber'))
|
||||
]);
|
||||
|
||||
$header = $it["name"];
|
||||
$header = $notif['name'];
|
||||
|
||||
if ($it["addr"] != "") {
|
||||
$header .= " <".$it["addr"].">";
|
||||
if ($notif['addr'] != '') {
|
||||
$header .= ' <' . $notif['addr'] . '>';
|
||||
}
|
||||
|
||||
$header .= " (".ContactSelector::networkToName($it['network'], $it['url']).")";
|
||||
$header .= ' (' . ContactSelector::networkToName($notif['network'], $notif['url']) . ')';
|
||||
|
||||
if ($it['network'] != Protocol::DIASPORA) {
|
||||
if ($notif['network'] != Protocol::DIASPORA) {
|
||||
$discard = L10n::t('Discard');
|
||||
} else {
|
||||
$discard = '';
|
||||
}
|
||||
|
||||
$notif_content[] = replace_macros($tpl, [
|
||||
'$type' => $it['label'],
|
||||
'$header' => htmlentities($header),
|
||||
'$type' => $notif['label'],
|
||||
'$header' => htmlentities($header),
|
||||
'$str_notifytype' => L10n::t('Notification type:'),
|
||||
'$notify_type' => $it['notify_type'],
|
||||
'$dfrn_text' => $dfrn_text,
|
||||
'$dfrn_id' => $it['dfrn_id'],
|
||||
'$uid' => $it['uid'],
|
||||
'$intro_id' => $it['intro_id'],
|
||||
'$contact_id' => $it['contact_id'],
|
||||
'$photo' => $it['photo'],
|
||||
'$fullname' => $it['name'],
|
||||
'$location' => $it['location'],
|
||||
'$lbl_location' => L10n::t('Location:'),
|
||||
'$about' => $it['about'],
|
||||
'$lbl_about' => L10n::t('About:'),
|
||||
'$keywords' => $it['keywords'],
|
||||
'$lbl_keywords' => L10n::t('Tags:'),
|
||||
'$gender' => $it['gender'],
|
||||
'$lbl_gender' => L10n::t('Gender:'),
|
||||
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
|
||||
'$url' => $it['url'],
|
||||
'$zrl' => $it['zrl'],
|
||||
'$lbl_url' => L10n::t('Profile URL'),
|
||||
'$addr' => $it['addr'],
|
||||
'$notify_type' => $notif['notify_type'],
|
||||
'$dfrn_text' => $dfrn_text,
|
||||
'$dfrn_id' => $notif['dfrn_id'],
|
||||
'$uid' => $notif['uid'],
|
||||
'$intro_id' => $notif['intro_id'],
|
||||
'$contact_id' => $notif['contact_id'],
|
||||
'$photo' => $notif['photo'],
|
||||
'$fullname' => $notif['name'],
|
||||
'$location' => $notif['location'],
|
||||
'$lbl_location'=> L10n::t('Location:'),
|
||||
'$about' => $notif['about'],
|
||||
'$lbl_about' => L10n::t('About:'),
|
||||
'$keywords' => $notif['keywords'],
|
||||
'$lbl_keywords'=> L10n::t('Tags:'),
|
||||
'$gender' => $notif['gender'],
|
||||
'$lbl_gender' => L10n::t('Gender:'),
|
||||
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($notif['hidden'] == 1), ''],
|
||||
'$url' => $notif['url'],
|
||||
'$zrl' => $notif['zrl'],
|
||||
'$lbl_url' => L10n::t('Profile URL'),
|
||||
'$addr' => $notif['addr'],
|
||||
'$lbl_knowyou' => $lbl_knowyou,
|
||||
'$lbl_network' => L10n::t('Network:'),
|
||||
'$network' => ContactSelector::networkToName($it['network'], $it['url']),
|
||||
'$knowyou' => $knowyou,
|
||||
'$approve' => L10n::t('Approve'),
|
||||
'$note' => $it['note'],
|
||||
'$ignore' => L10n::t('Ignore'),
|
||||
'$discard' => $discard,
|
||||
|
||||
'$network' => ContactSelector::networkToName($notif['network'], $notif['url']),
|
||||
'$knowyou' => $knowyou,
|
||||
'$approve' => L10n::t('Approve'),
|
||||
'$note' => $notif['note'],
|
||||
'$ignore' => L10n::t('Ignore'),
|
||||
'$discard' => $discard,
|
||||
]);
|
||||
break;
|
||||
}
|
||||
|
@ -280,57 +274,47 @@ function notifications_content(App $a)
|
|||
info(L10n::t('No introductions.') . EOL);
|
||||
}
|
||||
|
||||
// Normal notifications (no introductions)
|
||||
} else {
|
||||
// The template files we need in different cases for formatting the content
|
||||
$tpl_item_like = 'notifications_likes_item.tpl';
|
||||
$tpl_item_dislike = 'notifications_dislikes_item.tpl';
|
||||
$tpl_item_attend = 'notifications_attend_item.tpl';
|
||||
$tpl_item_attendno = 'notifications_attend_item.tpl';
|
||||
$tpl_item_attendmaybe = 'notifications_attend_item.tpl';
|
||||
$tpl_item_friend = 'notifications_friends_item.tpl';
|
||||
$tpl_item_comment = 'notifications_comments_item.tpl';
|
||||
$tpl_item_post = 'notifications_posts_item.tpl';
|
||||
$tpl_item_notify = 'notify.tpl';
|
||||
|
||||
// Normal notifications (no introductions)
|
||||
} elseif (!empty($notifs['notifications'])) {
|
||||
// Loop trough ever notification This creates an array with the output html for each
|
||||
// notification and apply the correct template according to the notificationtype (label).
|
||||
foreach ($notifs['notifications'] as $it) {
|
||||
foreach ($notifs['notifications'] as $notif) {
|
||||
$notification_templates = [
|
||||
'like' => 'notifications_likes_item.tpl',
|
||||
'dislike' => 'notifications_dislikes_item.tpl',
|
||||
'attend' => 'notifications_attend_item.tpl',
|
||||
'attendno' => 'notifications_attend_item.tpl',
|
||||
'attendmaybe' => 'notifications_attend_item.tpl',
|
||||
'friend' => 'notifications_friends_item.tpl',
|
||||
'comment' => 'notifications_comments_item.tpl',
|
||||
'post' => 'notifications_posts_item.tpl',
|
||||
'notify' => 'notify.tpl',
|
||||
];
|
||||
|
||||
// We use the notification label to get the correct template file
|
||||
$tpl_var_name = 'tpl_item_'.$it['label'];
|
||||
$tpl_notif = get_markup_template($$tpl_var_name);
|
||||
$tpl_notif = get_markup_template($notification_templates[$notif['label']]);
|
||||
|
||||
$notif_content[] = replace_macros($tpl_notif,[
|
||||
'$item_label' => $it['label'],
|
||||
'$item_link' => $it['link'],
|
||||
'$item_image' => $it['image'],
|
||||
'$item_url' => $it['url'],
|
||||
'$item_text' => $it['text'],
|
||||
'$item_when' => $it['when'],
|
||||
'$item_ago' => $it['ago'],
|
||||
'$item_seen' => $it['seen'],
|
||||
$notif_content[] = replace_macros($tpl_notif, [
|
||||
'$item_label' => $notif['label'],
|
||||
'$item_link' => $notif['link'],
|
||||
'$item_image' => $notif['image'],
|
||||
'$item_url' => $notif['url'],
|
||||
'$item_text' => $notif['text'],
|
||||
'$item_when' => $notif['when'],
|
||||
'$item_ago' => $notif['ago'],
|
||||
'$item_seen' => $notif['seen'],
|
||||
]);
|
||||
}
|
||||
|
||||
$notif_show_lnk = [
|
||||
'href' => ($show ? 'notifications/'.$notifs['ident'] : 'notifications/'.$notifs['ident'].'?show=all' ),
|
||||
'text' => ($show ? L10n::t('Show unread') : L10n::t('Show all')),
|
||||
];
|
||||
|
||||
// Output if there aren't any notifications available
|
||||
if (count($notifs['notifications']) == 0) {
|
||||
$notif_nocontent = L10n::t('No more %s notifications.', $notifs['ident']);
|
||||
}
|
||||
} else {
|
||||
$notif_nocontent = L10n::t('No more %s notifications.', $notifs['ident']);
|
||||
}
|
||||
|
||||
$o .= replace_macros($notif_tpl, [
|
||||
'$notif_header' => $notif_header,
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
'$notif_header' => $notif_header,
|
||||
'$tabs' => $tabs,
|
||||
'$notif_content' => $notif_content,
|
||||
'$notif_nocontent' => $notif_nocontent,
|
||||
'$notif_show_lnk' => $notif_show_lnk,
|
||||
'$notif_paginate' => alt_pager($a, count($notif_content))
|
||||
'$notif_show_lnk' => $notif_show_lnk,
|
||||
'$notif_paginate' => alt_pager($a, count($notif_content))
|
||||
]);
|
||||
|
||||
return $o;
|
||||
|
|
|
@ -8,128 +8,127 @@
|
|||
* information and does format this information to BBCode
|
||||
*
|
||||
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
|
||||
*/
|
||||
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
|
||||
require_once("include/items.php");
|
||||
|
||||
function parse_url_content(App $a) {
|
||||
require_once 'include/items.php';
|
||||
|
||||
function parse_url_content(App $a)
|
||||
{
|
||||
$text = null;
|
||||
$str_tags = "";
|
||||
$str_tags = '';
|
||||
|
||||
$br = "\n";
|
||||
|
||||
if (!empty($_GET["binurl"])) {
|
||||
$url = trim(hex2bin($_GET["binurl"]));
|
||||
if (!empty($_GET['binurl'])) {
|
||||
$url = trim(hex2bin($_GET['binurl']));
|
||||
} else {
|
||||
$url = trim($_GET["url"]);
|
||||
$url = trim($_GET['url']);
|
||||
}
|
||||
|
||||
if (!empty($_GET["title"])) {
|
||||
$title = strip_tags(trim($_GET["title"]));
|
||||
if (!empty($_GET['title'])) {
|
||||
$title = strip_tags(trim($_GET['title']));
|
||||
}
|
||||
|
||||
if (!empty($_GET["description"])) {
|
||||
$text = strip_tags(trim($_GET["description"]));
|
||||
if (!empty($_GET['description'])) {
|
||||
$text = strip_tags(trim($_GET['description']));
|
||||
}
|
||||
|
||||
if (!empty($_GET["tags"])) {
|
||||
$arr_tags = ParseUrl::convertTagsToArray($_GET["tags"]);
|
||||
if (!empty($_GET['tags'])) {
|
||||
$arr_tags = ParseUrl::convertTagsToArray($_GET['tags']);
|
||||
if (count($arr_tags)) {
|
||||
$str_tags = $br . implode(" ", $arr_tags) . $br;
|
||||
$str_tags = $br . implode(' ', $arr_tags) . $br;
|
||||
}
|
||||
}
|
||||
|
||||
// Add url scheme if it is missing
|
||||
$arrurl = parse_url($url);
|
||||
if (!x($arrurl, "scheme")) {
|
||||
if (x($arrurl, "host")) {
|
||||
$url = "http:".$url;
|
||||
if (!x($arrurl, 'scheme')) {
|
||||
if (x($arrurl, 'host')) {
|
||||
$url = 'http:' . $url;
|
||||
} else {
|
||||
$url = "http://".$url;
|
||||
$url = 'http://' . $url;
|
||||
}
|
||||
}
|
||||
|
||||
logger("prse_url: " . $url);
|
||||
logger($url);
|
||||
|
||||
// Check if the URL is an image, video or audio file. If so format
|
||||
// the URL with the corresponding BBCode media tag
|
||||
$redirects = 0;
|
||||
// Fetch the header of the URL
|
||||
$result = Network::curl($url, false, $redirects, ["novalidate" => true, "nobody" => true]);
|
||||
if($result["success"]) {
|
||||
$result = Network::curl($url, false, $redirects, ['novalidate' => true, 'nobody' => true]);
|
||||
|
||||
if ($result['success']) {
|
||||
// Convert the header fields into an array
|
||||
$hdrs = [];
|
||||
$h = explode("\n", $result["header"]);
|
||||
$h = explode("\n", $result['header']);
|
||||
foreach ($h as $l) {
|
||||
$header = array_map("trim", explode(":", trim($l), 2));
|
||||
$header = array_map('trim', explode(':', trim($l), 2));
|
||||
if (count($header) == 2) {
|
||||
list($k,$v) = $header;
|
||||
list($k, $v) = $header;
|
||||
$hdrs[$k] = $v;
|
||||
}
|
||||
}
|
||||
if (array_key_exists("Content-Type", $hdrs)) {
|
||||
$type = $hdrs["Content-Type"];
|
||||
if (array_key_exists('Content-Type', $hdrs)) {
|
||||
$type = $hdrs['Content-Type'];
|
||||
}
|
||||
if ($type) {
|
||||
if(stripos($type, "image/") !== false) {
|
||||
echo $br . "[img]" . $url . "[/img]" . $br;
|
||||
killme();
|
||||
if (stripos($type, 'image/') !== false) {
|
||||
echo $br . '[img]' . $url . '[/img]' . $br;
|
||||
exit();
|
||||
}
|
||||
if (stripos($type, "video/") !== false) {
|
||||
echo $br . "[video]" . $url . "[/video]" . $br;
|
||||
killme();
|
||||
if (stripos($type, 'video/') !== false) {
|
||||
echo $br . '[video]' . $url . '[/video]' . $br;
|
||||
exit();
|
||||
}
|
||||
if (stripos($type, "audio/") !== false) {
|
||||
echo $br . "[audio]" . $url . "[/audio]" . $br;
|
||||
killme();
|
||||
if (stripos($type, 'audio/') !== false) {
|
||||
echo $br . '[audio]' . $url . '[/audio]' . $br;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$template = "[bookmark=%s]%s[/bookmark]%s";
|
||||
$template = '[bookmark=%s]%s[/bookmark]%s';
|
||||
|
||||
$arr = ["url" => $url, "text" => ""];
|
||||
$arr = ['url' => $url, 'text' => ''];
|
||||
|
||||
Addon::callHooks("parse_link", $arr);
|
||||
Addon::callHooks('parse_link', $arr);
|
||||
|
||||
if (strlen($arr["text"])) {
|
||||
echo $arr["text"];
|
||||
killme();
|
||||
if (strlen($arr['text'])) {
|
||||
echo $arr['text'];
|
||||
exit();
|
||||
}
|
||||
|
||||
// If there is already some content information submitted we don't
|
||||
// need to parse the url for content.
|
||||
if (!empty($url) && !empty($title) && !empty($text)) {
|
||||
$title = str_replace(["\r", "\n"], ['', ''], $title);
|
||||
|
||||
$title = str_replace(["\r","\n"],["",""],$title);
|
||||
|
||||
$text = "[quote]" . trim($text) . "[/quote]" . $br;
|
||||
$text = '[quote]' . trim($text) . '[/quote]' . $br;
|
||||
|
||||
$result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags;
|
||||
|
||||
logger("parse_url (unparsed): returns: " . $result);
|
||||
logger('(unparsed): returns: ' . $result);
|
||||
|
||||
echo $result;
|
||||
killme();
|
||||
exit();
|
||||
}
|
||||
|
||||
// Fetch the information directly from the webpage
|
||||
$siteinfo = ParseUrl::getSiteinfo($url);
|
||||
|
||||
unset($siteinfo["keywords"]);
|
||||
unset($siteinfo['keywords']);
|
||||
|
||||
// Format it as BBCode attachment
|
||||
$info = add_page_info_data($siteinfo);
|
||||
|
||||
echo $info;
|
||||
|
||||
killme();
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +150,8 @@ function parse_url_content(App $a) {
|
|||
* @todo Remove this function after all Addons has been changed to use
|
||||
* ParseUrl::getSiteinfoCached
|
||||
*/
|
||||
function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = true) {
|
||||
function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = true)
|
||||
{
|
||||
$siteinfo = ParseUrl::getSiteinfoCached($url, $no_guessing, $do_oembed);
|
||||
return $siteinfo;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ function photos_post(App $a)
|
|||
}
|
||||
|
||||
// Check if the user has responded to a delete confirmation query
|
||||
if ($_REQUEST['canceled']) {
|
||||
if (!empty($_REQUEST['canceled'])) {
|
||||
goaway($_SESSION['photo_return']);
|
||||
}
|
||||
|
||||
|
@ -762,12 +762,14 @@ function photos_post(App $a)
|
|||
$filesize = $ret['filesize'];
|
||||
$type = $ret['type'];
|
||||
$error = UPLOAD_ERR_OK;
|
||||
} else {
|
||||
} elseif (!empty($_FILES['userfile'])) {
|
||||
$src = $_FILES['userfile']['tmp_name'];
|
||||
$filename = basename($_FILES['userfile']['name']);
|
||||
$filesize = intval($_FILES['userfile']['size']);
|
||||
$type = $_FILES['userfile']['type'];
|
||||
$error = $_FILES['userfile']['error'];
|
||||
} else {
|
||||
$error = UPLOAD_ERR_NO_FILE;
|
||||
}
|
||||
|
||||
if ($error !== UPLOAD_ERR_OK) {
|
||||
|
@ -1633,7 +1635,7 @@ function photos_content(App $a)
|
|||
'$paginate' => $paginate,
|
||||
]);
|
||||
|
||||
$a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="photo" />' . "\n";
|
||||
$a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n";
|
||||
$a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
|
||||
$a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
|
||||
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
|
||||
|
|
17
mod/ping.php
17
mod/ping.php
|
@ -510,16 +510,17 @@ function ping_get_notifications($uid)
|
|||
* @brief Backward-compatible XML formatting for ping.php output
|
||||
* @deprecated
|
||||
*
|
||||
* @param array $data The initial ping data array
|
||||
* @param int $sysnotify Number of unseen system notifications
|
||||
* @param array $notifs Complete list of notification
|
||||
* @param array $sysmsgs List of system notice messages
|
||||
* @param array $sysmsgs_info List of system info messages
|
||||
* @param int $groups_unseen Number of unseen group items
|
||||
* @param int $forums_unseen Number of unseen forum items
|
||||
* @param array $data The initial ping data array
|
||||
* @param int $sysnotify_count Number of unseen system notifications
|
||||
* @param array $notifs Complete list of notification
|
||||
* @param array $sysmsgs List of system notice messages
|
||||
* @param array $sysmsgs_info List of system info messages
|
||||
* @param int $groups_unseen Number of unseen group items
|
||||
* @param int $forums_unseen Number of unseen forum items
|
||||
*
|
||||
* @return array XML-transform ready data array
|
||||
*/
|
||||
function ping_format_xml_data($data, $sysnotify, $notifs, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen)
|
||||
function ping_format_xml_data($data, $sysnotify_count, $notifs, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen)
|
||||
{
|
||||
$notifications = [];
|
||||
foreach ($notifs as $key => $notif) {
|
||||
|
|
37
mod/poke.php
37
mod/poke.php
|
@ -24,19 +24,20 @@ use Friendica\Model\Item;
|
|||
require_once 'include/security.php';
|
||||
require_once 'include/items.php';
|
||||
|
||||
function poke_init(App $a) {
|
||||
|
||||
function poke_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$uid = local_user();
|
||||
$verb = notags(trim($_GET['verb']));
|
||||
|
||||
if (!$verb) {
|
||||
if (empty($_GET['verb'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$verb = notags(trim($_GET['verb']));
|
||||
|
||||
$verbs = get_poke_verbs();
|
||||
|
||||
if (!array_key_exists($verb, $verbs)) {
|
||||
|
@ -99,7 +100,7 @@ function poke_init(App $a) {
|
|||
$arr['guid'] = System::createGUID(32);
|
||||
$arr['uid'] = $uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = ($parent_uri ? $parent_uri : $uri);
|
||||
$arr['parent-uri'] = (!empty($parent_uri) ? $parent_uri : $uri);
|
||||
$arr['wall'] = 1;
|
||||
$arr['contact-id'] = $poster['id'];
|
||||
$arr['owner-name'] = $poster['name'];
|
||||
|
@ -121,7 +122,7 @@ function poke_init(App $a) {
|
|||
$arr['origin'] = 1;
|
||||
$arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . L10n::t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]';
|
||||
|
||||
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . System::baseUrl() . '/contact/' . $target['id'] . '</id>';
|
||||
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . $target['url'] . '</id>';
|
||||
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n");
|
||||
|
||||
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
|
||||
|
@ -137,10 +138,8 @@ function poke_init(App $a) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function poke_content(App $a) {
|
||||
|
||||
function poke_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
return;
|
||||
|
@ -149,17 +148,17 @@ function poke_content(App $a) {
|
|||
$name = '';
|
||||
$id = '';
|
||||
|
||||
if (intval($_GET['c'])) {
|
||||
$r = q("SELECT `id`,`name` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($_GET['c']),
|
||||
intval(local_user())
|
||||
);
|
||||
if (DBA::isResult($r)) {
|
||||
$name = $item['name'];
|
||||
$id = $item['id'];
|
||||
}
|
||||
if (empty($_GET['c'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['id', 'name'], ['id' => $_GET['c'], 'uid' => local_user()]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$name = $contact['name'];
|
||||
$id = $contact['id'];
|
||||
|
||||
$base = System::baseUrl();
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ function profile_content(App $a, $update = 0)
|
|||
}
|
||||
}
|
||||
|
||||
$o .= conversation($a, $items, 'profile', $update, false, 'commented', local_user());
|
||||
$o .= conversation($a, $items, 'profile', $update, false, 'created', local_user());
|
||||
|
||||
if (!$update) {
|
||||
$o .= alt_pager($a, count($items));
|
||||
|
|
|
@ -41,14 +41,14 @@ function salmon_post(App $a, $xml = '') {
|
|||
$base = null;
|
||||
|
||||
// figure out where in the DOM tree our data is hiding
|
||||
if($dom->provenance->data)
|
||||
if (!empty($dom->provenance->data))
|
||||
$base = $dom->provenance;
|
||||
elseif($dom->env->data)
|
||||
elseif (!empty($dom->env->data))
|
||||
$base = $dom->env;
|
||||
elseif($dom->data)
|
||||
elseif (!empty($dom->data))
|
||||
$base = $dom;
|
||||
|
||||
if(! $base) {
|
||||
if (empty($base)) {
|
||||
logger('unable to locate salmon data in xml ');
|
||||
System::httpExit(400);
|
||||
}
|
||||
|
|
158
mod/unfollow.php
158
mod/unfollow.php
|
@ -10,53 +10,67 @@ use Friendica\Core\System;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
|
||||
function unfollow_post(App $a)
|
||||
function unfollow_post()
|
||||
{
|
||||
$return_url = $_SESSION['return_url'];
|
||||
|
||||
if (!local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
goaway($_SESSION['return_url']);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
goaway($return_url);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if ($_REQUEST['cancel']) {
|
||||
goaway($_SESSION['return_url']);
|
||||
if (!empty($_REQUEST['cancel'])) {
|
||||
goaway($return_url);
|
||||
}
|
||||
|
||||
$uid = local_user();
|
||||
$url = notags(trim($_REQUEST['url']));
|
||||
$return_url = $_SESSION['return_url'];
|
||||
$url = notags(trim(defaults($_REQUEST, 'url', '')));
|
||||
|
||||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||
$uid, Contact::FRIEND, normalise_link($url),
|
||||
normalise_link($url), $url, Protocol::STATUSNET];
|
||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
$uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||
normalise_link($url), $url];
|
||||
$contact = DBA::selectFirst('contact', [], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
notice(L10n::t("Contact wasn't found or can't be unfollowed."));
|
||||
} else {
|
||||
if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN])) {
|
||||
$r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
|
||||
WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
|
||||
intval($uid)
|
||||
);
|
||||
if (DBA::isResult($r)) {
|
||||
Contact::terminateFriendship($r[0], $contact);
|
||||
}
|
||||
}
|
||||
DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]);
|
||||
|
||||
info(L10n::t('Contact unfollowed').EOL);
|
||||
goaway(System::baseUrl().'/contacts/'.$contact['id']);
|
||||
notice(L10n::t("You aren't following this contact."));
|
||||
goaway($return_url);
|
||||
// NOTREACHED
|
||||
}
|
||||
goaway($return_url);
|
||||
|
||||
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||
notice(L10n::t('Unfollowing is currently not supported by your network.'));
|
||||
goaway($return_url);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$dissolve = ($contact['rel'] == Contact::SHARING);
|
||||
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if ($owner) {
|
||||
Contact::terminateFriendship($owner, $contact, $dissolve);
|
||||
}
|
||||
|
||||
// Sharing-only contacts get deleted as there no relationship any more
|
||||
if ($dissolve) {
|
||||
Contact::remove($contact['id']);
|
||||
$return_path = 'contacts';
|
||||
} else {
|
||||
DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]);
|
||||
$return_path = 'contacts/' . $contact['id'];
|
||||
}
|
||||
|
||||
info(L10n::t('Contact unfollowed'));
|
||||
goaway($return_path);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
function unfollow_content(App $a)
|
||||
{
|
||||
if (! local_user()) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
if (!local_user()) {
|
||||
notice(L10n::t('Permission denied.'));
|
||||
goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
@ -64,78 +78,74 @@ function unfollow_content(App $a)
|
|||
$uid = local_user();
|
||||
$url = notags(trim($_REQUEST['url']));
|
||||
|
||||
$submit = L10n::t('Submit Request');
|
||||
|
||||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
||||
local_user(), Contact::FRIEND, normalise_link($url),
|
||||
normalise_link($url), $url, Protocol::STATUSNET];
|
||||
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||
local_user(), Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||
normalise_link($url), $url];
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
||||
|
||||
if (!DBA::isResult($contact)) {
|
||||
notice(L10n::t("You aren't a friend of this contact.").EOL);
|
||||
$submit = "";
|
||||
notice(L10n::t("You aren't following this contact."));
|
||||
goaway('contacts');
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (!in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
|
||||
notice(L10n::t("Unfollowing is currently not supported by your network.").EOL);
|
||||
$submit = "";
|
||||
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||
notice(L10n::t('Unfollowing is currently not supported by your network.'));
|
||||
goaway('contacts/' . $contact['id']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$request = System::baseUrl()."/unfollow";
|
||||
$request = System::baseUrl() . '/unfollow';
|
||||
$tpl = get_markup_template('auto_request.tpl');
|
||||
|
||||
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
|
||||
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||
|
||||
if (!$r) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
if (!DBA::isResult($self)) {
|
||||
notice(L10n::t('Permission denied.'));
|
||||
goaway($_SESSION['return_url']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
$myaddr = $r[0]["url"];
|
||||
|
||||
// Makes the connection request for friendica contacts easier
|
||||
$_SESSION["fastlane"] = $contact["url"];
|
||||
$_SESSION['fastlane'] = $contact['url'];
|
||||
|
||||
$header = L10n::t("Disconnect/Unfollow");
|
||||
$header = L10n::t('Disconnect/Unfollow');
|
||||
|
||||
$o = replace_macros($tpl, [
|
||||
'$header' => htmlentities($header),
|
||||
'$desc' => "",
|
||||
'$pls_answer' => "",
|
||||
'$does_know_you' => "",
|
||||
'$add_note' => "",
|
||||
'$page_desc' => "",
|
||||
'$friendica' => "",
|
||||
'$statusnet' => "",
|
||||
'$diaspora' => "",
|
||||
'$diasnote' => "",
|
||||
'$your_address' => L10n::t('Your Identity Address:'),
|
||||
'$invite_desc' => "",
|
||||
'$emailnet' => "",
|
||||
'$submit' => $submit,
|
||||
'$cancel' => L10n::t('Cancel'),
|
||||
'$nickname' => "",
|
||||
'$name' => $contact["name"],
|
||||
'$url' => $contact["url"],
|
||||
'$zrl' => Contact::magicLink($contact["url"]),
|
||||
'$url_label' => L10n::t("Profile URL"),
|
||||
'$myaddr' => $myaddr,
|
||||
'$request' => $request,
|
||||
'$keywords' => "",
|
||||
'$keywords_label' => ""
|
||||
$o = replace_macros($tpl, [
|
||||
'$header' => htmlentities($header),
|
||||
'$desc' => '',
|
||||
'$pls_answer' => '',
|
||||
'$does_know_you' => '',
|
||||
'$add_note' => '',
|
||||
'$page_desc' => '',
|
||||
'$friendica' => '',
|
||||
'$statusnet' => '',
|
||||
'$diaspora' => '',
|
||||
'$diasnote' => '',
|
||||
'$your_address' => L10n::t('Your Identity Address:'),
|
||||
'$invite_desc' => '',
|
||||
'$emailnet' => '',
|
||||
'$submit' => L10n::t('Submit Request'),
|
||||
'$cancel' => L10n::t('Cancel'),
|
||||
'$nickname' => '',
|
||||
'$name' => $contact['name'],
|
||||
'$url' => $contact['url'],
|
||||
'$zrl' => Contact::magicLink($contact['url']),
|
||||
'$url_label' => L10n::t('Profile URL'),
|
||||
'$myaddr' => $self['url'],
|
||||
'$request' => $request,
|
||||
'$keywords' => '',
|
||||
'$keywords_label'=> ''
|
||||
]);
|
||||
|
||||
$a->page['aside'] = "";
|
||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
||||
$a->page['aside'] = '';
|
||||
Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url']));
|
||||
|
||||
$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
|
||||
|
||||
// Show last public posts
|
||||
$o .= Contact::getPostsFromUrl($contact["url"]);
|
||||
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
|
39
mod/update_contacts.php
Normal file
39
mod/update_contacts.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
// See update_profile.php for documentation
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
require_once 'mod/contacts.php';
|
||||
|
||||
function update_contacts_content(App $a)
|
||||
{
|
||||
header("Content-type: text/html");
|
||||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
echo "<section>";
|
||||
|
||||
if ($_GET["force"] == 1) {
|
||||
$text = contacts_content($a, true);
|
||||
} else {
|
||||
$text = '';
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
}
|
||||
|
||||
echo str_replace("\t", " ", $text);
|
||||
echo "</section>";
|
||||
echo "</body></html>\r\n";
|
||||
killme();
|
||||
}
|
|
@ -367,11 +367,12 @@ function videos_content(App $a)
|
|||
foreach ($r as $rr) {
|
||||
$alt_e = $rr['filename'];
|
||||
/// @todo The album isn't part of the above query. This seems to be some unfinished code that needs to be reworked completely.
|
||||
$rr['album'] = '';
|
||||
$name_e = $rr['album'];
|
||||
|
||||
$videos[] = [
|
||||
'id' => $rr['id'],
|
||||
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['resource-id'],
|
||||
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['hash'],
|
||||
'title' => L10n::t('View Video'),
|
||||
'src' => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
|
||||
'alt' => $alt_e,
|
||||
|
|
|
@ -23,7 +23,7 @@ function webfinger_content(App $a)
|
|||
$o = '<h3>Webfinger Diagnostic</h3>';
|
||||
|
||||
$o .= '<form action="webfinger" method="get">';
|
||||
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
|
||||
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . defaults($_GET, 'addr', '') .'" />';
|
||||
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
||||
|
||||
$o .= '<br /><br />';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue