Merge remote-tracking branch 'upstream/develop' into ap-delivery
This commit is contained in:
commit
0a790227b6
|
@ -1083,9 +1083,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
|
|||
'$geotag' => $geotag,
|
||||
'$nickname' => $x['nickname'],
|
||||
'$ispublic' => L10n::t('Visible to <strong>everybody</strong>'),
|
||||
'$linkurl' => L10n::t('Please enter a link URL:'),
|
||||
'$vidurl' => L10n::t("Please enter a video link/URL:"),
|
||||
'$audurl' => L10n::t("Please enter an audio link/URL:"),
|
||||
'$linkurl' => L10n::t('Please enter a image/video/audio/webpage URL:'),
|
||||
'$term' => L10n::t('Tag term:'),
|
||||
'$fileas' => L10n::t('Save to Folder:'),
|
||||
'$whereareu' => L10n::t('Where are you right now?'),
|
||||
|
@ -1129,12 +1127,14 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
|
|||
'$shortupload' => L10n::t('upload photo'),
|
||||
'$attach' => L10n::t('Attach file'),
|
||||
'$shortattach' => L10n::t('attach file'),
|
||||
'$weblink' => L10n::t('Insert web link'),
|
||||
'$shortweblink' => L10n::t('web link'),
|
||||
'$video' => L10n::t('Insert video link'),
|
||||
'$shortvideo' => L10n::t('video link'),
|
||||
'$audio' => L10n::t('Insert audio link'),
|
||||
'$shortaudio' => L10n::t('audio link'),
|
||||
'$edbold' => L10n::t('Bold'),
|
||||
'$editalic' => L10n::t('Italic'),
|
||||
'$eduline' => L10n::t('Underline'),
|
||||
'$edquote' => L10n::t('Quote'),
|
||||
'$edcode' => L10n::t('Code'),
|
||||
'$edimg' => L10n::t('Image'),
|
||||
'$edurl' => L10n::t('Link'),
|
||||
'$edattach' => L10n::t('Link or Media'),
|
||||
'$setloc' => L10n::t('Set your location'),
|
||||
'$shortsetloc' => L10n::t('set location'),
|
||||
'$noloc' => L10n::t('Clear browser location'),
|
||||
|
|
|
@ -93,6 +93,7 @@ function parse_url_content(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$template = '[bookmark=%s]%s[/bookmark]%s';
|
||||
|
||||
$arr = ['url' => $url, 'text' => ''];
|
||||
|
@ -124,6 +125,12 @@ function parse_url_content(App $a)
|
|||
|
||||
unset($siteinfo['keywords']);
|
||||
|
||||
// Bypass attachment if parse url for a comment
|
||||
if (!empty($_GET['noAttachment'])) {
|
||||
echo $br . '[url=' . $url . ']' . $siteinfo['title'] . '[/url]';
|
||||
exit();
|
||||
}
|
||||
|
||||
// Format it as BBCode attachment
|
||||
$info = add_page_info_data($siteinfo);
|
||||
|
||||
|
|
|
@ -14,12 +14,7 @@ function randprof_init(App $a)
|
|||
|
||||
if ($x) {
|
||||
$link = Contact::magicLink($x);
|
||||
// @TODO making the return of magicLink save to use either externalRedirect or internalRedirect
|
||||
if (filter_var($link, FILTER_VALIDATE_URL)) {
|
||||
System::externalRedirect($link);
|
||||
} else {
|
||||
$a->internalRedirect($link);
|
||||
}
|
||||
$a->redirect($link);
|
||||
}
|
||||
|
||||
$a->internalRedirect('profile');
|
||||
|
|
|
@ -36,7 +36,7 @@ function redir_init(App $a) {
|
|||
|| (!local_user() && !remote_user()) // Visitors (not logged in or not remotes) can't authenticate.
|
||||
|| (!empty($a->contact['id']) && $a->contact['id'] == $cid)) // Local user is already authenticated.
|
||||
{
|
||||
System::externalRedirect(defaults($url, $contact_url));
|
||||
$a->redirect(defaults($url, $contact_url));
|
||||
}
|
||||
|
||||
if ($contact['uid'] == 0 && local_user()) {
|
||||
|
@ -52,7 +52,7 @@ function redir_init(App $a) {
|
|||
// Local user is already authenticated.
|
||||
$target_url = defaults($url, $contact_url);
|
||||
logger($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
|
||||
System::externalRedirect($target_url);
|
||||
$a->redirect($target_url);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ function redir_init(App $a) {
|
|||
// Remote user is already authenticated.
|
||||
$target_url = defaults($url, $contact_url);
|
||||
logger($contact['name'] . " is already authenticated. Redirecting to " . $target_url, LOGGER_DEBUG);
|
||||
System::externalRedirect($target_url);
|
||||
$a->redirect($target_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ function redir_init(App $a) {
|
|||
}
|
||||
|
||||
logger('redirecting to ' . $url, LOGGER_DEBUG);
|
||||
System::externalRedirect($url);
|
||||
$a->redirect($url);
|
||||
}
|
||||
|
||||
notice(L10n::t('Contact not found.'));
|
||||
|
|
16
src/App.php
16
src/App.php
|
@ -2006,4 +2006,20 @@ class App
|
|||
$redirectTo = $this->getBaseURL($ssl) . '/' . ltrim($toUrl, '/');
|
||||
Core\System::externalRedirect($redirectTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically redirects to relative or absolute URL
|
||||
* Should only be used if it isn't clear if the URL is either internal or external
|
||||
*
|
||||
* @param string $toUrl The target URL
|
||||
*
|
||||
*/
|
||||
public function redirect($toUrl)
|
||||
{
|
||||
if (filter_var($toUrl, FILTER_VALIDATE_URL)) {
|
||||
Core\System::externalRedirect($toUrl);
|
||||
} else {
|
||||
$this->internalRedirect($toUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,11 +43,7 @@ class Magic extends BaseModule
|
|||
if (!$cid) {
|
||||
logger('No contact record found: ' . print_r($_REQUEST, true), LOGGER_DEBUG);
|
||||
// @TODO Finding a more elegant possibility to redirect to either internal or external URL
|
||||
if (filter_var($dest, FILTER_VALIDATE_URL)) {
|
||||
System::externalRedirect($dest);
|
||||
} else {
|
||||
$a->internalRedirect($dest);
|
||||
}
|
||||
$a->redirect($dest);
|
||||
}
|
||||
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
|
||||
|
||||
|
@ -117,10 +113,6 @@ class Magic extends BaseModule
|
|||
}
|
||||
|
||||
// @TODO Finding a more elegant possibility to redirect to either internal or external URL
|
||||
if (filter_var($dest, FILTER_VALIDATE_URL)) {
|
||||
System::externalRedirect($dest);
|
||||
} else {
|
||||
$a->internalRedirect($dest);
|
||||
}
|
||||
$a->redirect($dest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -806,7 +806,8 @@ class Post extends BaseObject
|
|||
'$edcode' => L10n::t('Code'),
|
||||
'$edimg' => L10n::t('Image'),
|
||||
'$edurl' => L10n::t('Link'),
|
||||
'$edvideo' => L10n::t('Video'),
|
||||
'$edattach' => L10n::t('Link or Media'),
|
||||
'$prompttext' => L10n::t('Please enter a image/video/audio/webpage URL:'),
|
||||
'$preview' => ((Feature::isEnabled($conv->getProfileOwner(), 'preview')) ? L10n::t('Preview') : ''),
|
||||
'$indent' => $indent,
|
||||
'$sourceapp' => L10n::t($a->sourcename),
|
||||
|
|
|
@ -24,7 +24,7 @@ function openClose(theID) {
|
|||
}
|
||||
|
||||
function openMenu(theID) {
|
||||
var el = document.getElementById(theID)
|
||||
var el = document.getElementById(theID);
|
||||
|
||||
if (el) {
|
||||
el.style.display = "block";
|
||||
|
|
|
@ -2,6 +2,47 @@
|
|||
* @brief The file contains functions for text editing and commenting
|
||||
*/
|
||||
|
||||
function commentGetLink(id, prompttext) {
|
||||
reply = prompt(prompttext);
|
||||
if(reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$.get('parse_url?noAttachment=1&binurl=' + reply, function(data) {
|
||||
addCommentText(data, id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function addCommentText(data, id) {
|
||||
// get the textfield
|
||||
var textfield = document.getElementById("comment-edit-text-" + id);
|
||||
// check if the textfield does have the default-value
|
||||
commentOpenUI(textfield, id);
|
||||
// save already existent content
|
||||
var currentText = $("#comment-edit-text-" + id).val();
|
||||
//insert the data as new value
|
||||
textfield.value = currentText + data;
|
||||
autosize.update($("#comment-edit-text-" + id));
|
||||
}
|
||||
|
||||
function commentLinkDrop(event, id) {
|
||||
var reply = event.dataTransfer.getData("text/uri-list");
|
||||
event.target.textContent = reply;
|
||||
event.preventDefault();
|
||||
if (reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$.get('parse_url?noAttachment=1&binurl=' + reply, function(data) {
|
||||
addCommentText(data, id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function commentLinkDropper(event) {
|
||||
var linkFound = event.dataTransfer.types.contains("text/uri-list");
|
||||
if (linkFound) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function insertFormatting(BBcode, id) {
|
||||
var tmpStr = $("#comment-edit-text-" + id).val();
|
||||
|
|
|
@ -43,11 +43,10 @@
|
|||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" class="btn-link icon bb-video" style="cursor: pointer;" aria-label="{{$edvideo}}" title="{{$edvideo}}" onclick="insertFormatting('video',{{$id}});">
|
||||
<i class="fa fa-video-camera"></i>
|
||||
<button type="button" class="btn-link icon" style="cursor: pointer;" aria-label="{{$edattach}}" title="{{$edattach}}" ondragenter="return commentLinkDrop(event, {{$id}});" ondragover="return commentLinkDrop(event, {{$id}});" ondrop="commentLinkDropper(event);" onclick="commentGetLink({{$id}}, '{{$prompttext}}');">
|
||||
<i class="fa fa-paperclip"></i>
|
||||
</button>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<button type="button" class="btn-link icon underline" style="cursor: pointer;" aria-label="{{$eduline}}" title="{{$eduline}}" onclick="insertFormatting('u',{{$id}});">
|
||||
<i class="fa fa-underline"></i>
|
||||
|
|
|
@ -127,14 +127,20 @@
|
|||
}
|
||||
|
||||
function jotGetLink() {
|
||||
var currentText = $("#profile-jot-text").val();
|
||||
var noAttachment = '';
|
||||
reply = prompt("{{$linkurl}}");
|
||||
if(reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$('#profile-rotator').show();
|
||||
$.get('parse_url?binurl=' + reply, function(data) {
|
||||
if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
|
||||
noAttachment = '&noAttachment=1';
|
||||
}
|
||||
$.get('parse_url?binurl=' + reply + noAttachment, function(data) {
|
||||
addeditortext(data);
|
||||
$('#profile-rotator').hide();
|
||||
});
|
||||
autosize.update($("#profile-jot-text"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,26 +180,31 @@
|
|||
$("#jot-popup").show();
|
||||
}
|
||||
|
||||
function linkdropper(event) {
|
||||
function linkDropper(event) {
|
||||
var linkFound = event.dataTransfer.types.contains("text/uri-list");
|
||||
if(linkFound)
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function linkdrop(event) {
|
||||
function linkDrop(event) {
|
||||
var reply = event.dataTransfer.getData("text/uri-list");
|
||||
var noAttachment = '';
|
||||
event.target.textContent = reply;
|
||||
event.preventDefault();
|
||||
if(reply && reply.length) {
|
||||
reply = bin2hex(reply);
|
||||
$('#profile-rotator').show();
|
||||
$.get('parse_url?binurl=' + reply, function(data) {
|
||||
if (currentText.includes("[attachment") && currentText.includes("[/attachment]")) {
|
||||
noAttachment = '&noAttachment=1';
|
||||
}
|
||||
$.get('parse_url?binurl=' + reply + noAttachment, function(data) {
|
||||
if (!editor) $("#profile-jot-text").val("");
|
||||
initEditor(function(){
|
||||
addeditortext(data);
|
||||
$('#profile-rotator').hide();
|
||||
});
|
||||
});
|
||||
autosize.update($("#profile-jot-text"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,6 +272,7 @@
|
|||
var currentText = $("#profile-jot-text").val();
|
||||
//insert the data as new value
|
||||
textfield.value = currentText + data;
|
||||
autosize.update($("#profile-jot-text"));
|
||||
}
|
||||
|
||||
{{$geotag}}
|
||||
|
|
|
@ -97,9 +97,8 @@
|
|||
<li role="presentation"><button type="button" class="hidden-xs btn-link icon italic" style="cursor: pointer;" aria-label="{{$editalic}}" title="{{$editalic}}" onclick="insertFormattingToPost('i');"><i class="fa fa-italic"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="hidden-xs btn-link icon bold" style="cursor: pointer;" aria-label="{{$edbold}}" title="{{$edbold}}" onclick="insertFormattingToPost('b');"><i class="fa fa-bold"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="hidden-xs btn-link icon quote" style="cursor: pointer;" aria-label="{{$edquote}}" title="{{$edquote}}" onclick="insertFormattingToPost('quote');"><i class="fa fa-quote-left"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-link" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" title="{{$weblink}}"><i class="fa fa-link"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-video" onclick="jotVideoURL();" title="{{$video}}"><i class="fa fa-film" aria-hidden="true"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-audio" onclick="jotAudioURL();" title="{{$audio}}"><i class="fa fa-music" aria-hidden="true"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link icon" style="cursor: pointer;" aria-label="{{$edurl}}" title="{{$edurl}}" onclick="insertFormattingToPost('url');"><i class="fa fa-link"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-attach" ondragenter="return linkDropper(event);" ondragover="return linkDropper(event);" ondrop="linkDrop(event);" onclick="jotGetLink();" title="{{$edattach}}"><i class="fa fa-paperclip"></i></button></li>
|
||||
<li role="presentation"><button type="button" class="btn-link" id="profile-location" onclick="jotGetLocation();" title="{{$setloc}}"><i class="fa fa-map-marker" aria-hidden="true"></i></button></li>
|
||||
<!-- TODO: waiting for a better placement
|
||||
<li><button type="button" class="btn-link" id="profile-nolocation" onclick="jotClearLocation();" title="{{$noloc}}">{{$shortnoloc}}</button></li>
|
||||
|
|
Loading…
Reference in New Issue
Block a user