aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/ThreadItem.php1
-rw-r--r--Zotlabs/Module/Ap_probe.php2
-rw-r--r--Zotlabs/Module/Channel.php10
-rw-r--r--Zotlabs/Module/Item.php2
-rw-r--r--Zotlabs/Module/Mail.php2
-rw-r--r--Zotlabs/Module/Network.php13
-rw-r--r--Zotlabs/Module/Notify.php16
-rw-r--r--doc/hook/update_unseen.bb9
-rw-r--r--doc/hooklist.bb3
-rw-r--r--include/bbcode.php2
-rw-r--r--include/conversation.php2
-rw-r--r--include/markdown.php7
-rw-r--r--view/js/main.js1
-rw-r--r--view/theme/redbasic/css/style.css3
-rw-r--r--view/tpl/cdav_widget_addressbook.tpl1
-rwxr-xr-xview/tpl/conv_item.tpl1
-rwxr-xr-xview/tpl/jot-header.tpl3
-rwxr-xr-xview/tpl/msg-header.tpl53
-rwxr-xr-xview/tpl/prv_message.tpl1
-rwxr-xr-xview/tpl/search_item.tpl1
20 files changed, 81 insertions, 52 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 72d8af4dd..9ee16480a 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -407,6 +407,7 @@ class ThreadItem {
'showdislike' => $showdislike,
'comment' => $this->get_comment_box($indent),
'previewing' => ($conv->is_preview() ? true : false ),
+ 'preview_lbl' => t('This is an unsaved preview'),
'wait' => t('Please wait'),
'submid' => str_replace(['+','='], ['',''], base64_encode(substr($item['mid'],0,32))),
'thread_level' => $thread_level
diff --git a/Zotlabs/Module/Ap_probe.php b/Zotlabs/Module/Ap_probe.php
index f788fa73a..769cd4c4e 100644
--- a/Zotlabs/Module/Ap_probe.php
+++ b/Zotlabs/Module/Ap_probe.php
@@ -30,7 +30,7 @@ class Ap_probe extends \Zotlabs\Web\Controller {
$redirects = 0;
$x = z_fetch_url($addr,true,$redirects, [ 'headers' => [ $headers ]]);
if($x['success'])
- $o .= '<pre>' . str_replace('\\','',jindent($x['body'])) . '</pre>';
+ $o .= '<pre>' . str_replace(['\\n','\\'],["\n",''],jindent($x['body'])) . '</pre>';
}
return $o;
}
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index a44984c97..c006d65d4 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -358,9 +358,13 @@ class Channel extends \Zotlabs\Web\Controller {
}
if($is_owner && $update_unseen) {
- $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen",
- intval(local_channel())
- );
+ $x = [ 'channel_id' => local_channel(), 'update' => 'unset' ];
+ call_hooks('update_unseen',$x);
+ if($x['update'] === 'unset' || intval($x['update'])) {
+ $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen",
+ intval(local_channel())
+ );
+ }
}
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 9e64528fa..5e7a3fbc0 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -634,7 +634,7 @@ class Item extends \Zotlabs\Web\Controller {
$attach_link = '';
$hash = substr($mtch,0,strpos($mtch,','));
$rev = intval(substr($mtch,strpos($mtch,',')));
- $r = attach_by_hash_nodata($hash,$rev);
+ $r = attach_by_hash_nodata($hash, $observer['xchan_hash'], $rev);
if($r['success']) {
$attachments[] = array(
'href' => z_root() . '/attach/' . $r['data']['hash'],
diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php
index 7e6ec0cf9..e5509961a 100644
--- a/Zotlabs/Module/Mail.php
+++ b/Zotlabs/Module/Mail.php
@@ -53,8 +53,8 @@ class Mail extends \Zotlabs\Web\Controller {
}
$body = trim(str_replace($match[1],'',$body));
}
- echo json_encode(['preview' => zidify_links(smilies(bbcode($body)))]);
}
+ echo json_encode(['preview' => zidify_links(smilies(bbcode($body)))]);
}
killme();
}
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 597ba084b..1954df549 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -545,10 +545,15 @@ class Network extends \Zotlabs\Web\Controller {
}
}
- if(($update_unseen) && (! $firehose))
- $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d $update_unseen ",
- intval(local_channel())
- );
+ if(($update_unseen) && (! $firehose)) {
+ $x = [ 'channel_id' => local_channel(), 'update' => 'unset' ];
+ call_hooks('update_unseen',$x);
+ if($x['update'] === 'unset' || intval($x['update'])) {
+ $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d $update_unseen ",
+ intval(local_channel())
+ );
+ }
+ }
$mode = (($nouveau) ? 'network-new' : 'network');
diff --git a/Zotlabs/Module/Notify.php b/Zotlabs/Module/Notify.php
index f592f6f37..3d6e1c2e7 100644
--- a/Zotlabs/Module/Notify.php
+++ b/Zotlabs/Module/Notify.php
@@ -15,12 +15,16 @@ class Notify extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r) {
- q("update notify set seen = 1 where (( parent != '' and parent = '%s' and otype = '%s' ) or link = '%s' ) and uid = %d",
- dbesc($r[0]['parent']),
- dbesc($r[0]['otype']),
- dbesc($r[0]['link']),
- intval(local_channel())
- );
+ $x = [ 'channel_id' => local_channel(), 'update' => 'unset' ];
+ call_hooks('update_unseen',$x);
+ if($x['update'] === 'unset' || intval($x['update'])) {
+ q("update notify set seen = 1 where (( parent != '' and parent = '%s' and otype = '%s' ) or link = '%s' ) and uid = %d",
+ dbesc($r[0]['parent']),
+ dbesc($r[0]['otype']),
+ dbesc($r[0]['link']),
+ intval(local_channel())
+ );
+ }
goaway($r[0]['link']);
}
goaway(z_root());
diff --git a/doc/hook/update_unseen.bb b/doc/hook/update_unseen.bb
new file mode 100644
index 000000000..8fb02c239
--- /dev/null
+++ b/doc/hook/update_unseen.bb
@@ -0,0 +1,9 @@
+[h3]update_unseen[/h3]
+
+Called prior to automatically marking items 'seen'; allowing a plugin the choice to not perform this action.
+
+hook data
+
+[ 'channel_id' => local_channel(), 'update' => 'unset' ];
+
+If 'update' is set to 0 or false on return, the update operation is not performed. \ No newline at end of file
diff --git a/doc/hooklist.bb b/doc/hooklist.bb
index da4d9596b..9a17fdb91 100644
--- a/doc/hooklist.bb
+++ b/doc/hooklist.bb
@@ -572,6 +572,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/tagged]tagged[/zrl]
Called when a delivery is processed which results in you being tagged
+[zrl=[baseurl]/help/hook/update_unseen]update_unseen[/zrl]
+ Called prior to automatically marking items seen which were loaded in the browser
+
[zrl=[baseurl]/help/hook/validate_channelname]validate_channelname[/zrl]
Used to validate the names used by a channel
diff --git a/include/bbcode.php b/include/bbcode.php
index c408af35d..9f9b5c5e1 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -7,7 +7,7 @@
require_once('include/oembed.php');
require_once('include/event.php');
require_once('include/zot.php');
-
+require_once('include/html2plain.php');
function get_bb_tag_pos($s, $name, $occurance = 1) {
diff --git a/include/conversation.php b/include/conversation.php
index 1c1a4479d..460c97efb 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -467,6 +467,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$preview = (($page_mode === 'preview') ? true : false);
$previewing = (($preview) ? ' preview ' : '');
+ $preview_lbl = t('This is an unsaved preview');
if ($mode === 'network') {
@@ -684,6 +685,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
'mode' => $mode,
'approve' => t('Approve'),
'delete' => t('Delete'),
+ 'preview_lbl' => $preview_lbl,
'id' => (($preview) ? 'P0' : $item['item_id']),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url),
'profile_url' => $profile_link,
diff --git a/include/markdown.php b/include/markdown.php
index 530af57a0..0cd9ab237 100644
--- a/include/markdown.php
+++ b/include/markdown.php
@@ -157,11 +157,11 @@ function bb_to_markdown($Text, $options = []) {
* Transform #tags, strip off the [url] and replace spaces with underscore
*/
- $Text = preg_replace_callback('/#\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/[(zu)]rl\]/i',
+ $Text = preg_replace_callback('/#\[([zu])rl\=(.*?)\](.*?)\[\/[(zu)]rl\]/i',
create_function('$match', 'return \'#\'. str_replace(\' \', \'_\', $match[3]);'), $Text);
- $Text = preg_replace('/#\^\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/([zu])rl\]/i', '[$1rl=$2]$3[/$4rl]', $Text);
+ $Text = preg_replace('/#\^\[([zu])rl\=(.*?)\](.*?)\[\/([zu])rl\]/i', '[$1rl=$2]$3[/$4rl]', $Text);
// Converting images with size parameters to simple images. Markdown doesn't know it.
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text);
@@ -197,9 +197,6 @@ function bb_to_markdown($Text, $options = []) {
// Remove empty zrl links
$Text = preg_replace("/\[zrl\=\].*?\[\/zrl\]/is", "", $Text);
- // escape all unconverted tags
- $Text = escape_tags($Text);
-
$Text = trim($Text);
call_hooks('bb_to_markdown', $Text);
diff --git a/view/js/main.js b/view/js/main.js
index 54450858a..aaadff99b 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -149,6 +149,7 @@ function insertCommentURL(comment, id) {
textarea = document.getElementById("comment-edit-text-" +id);
textarea.value = textarea.value + data;
+ preview_comment(id);
$('body').css('cursor', 'auto');
});
}
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index fd2ceb2c9..37277b612 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -251,8 +251,7 @@ footer {
margin-top: 15px;
}
-.preview {
- background: url('../img/gray_and_white_diagonal_stripes_background_seamless.gif');
+.preview-indicator {
}
#theme-preview {
diff --git a/view/tpl/cdav_widget_addressbook.tpl b/view/tpl/cdav_widget_addressbook.tpl
index c875dc977..80b5feaf6 100644
--- a/view/tpl/cdav_widget_addressbook.tpl
+++ b/view/tpl/cdav_widget_addressbook.tpl
@@ -47,6 +47,7 @@
</li>
<div id="upload-form" class="sub-menu-wrapper">
<div class="sub-menu">
+ <form enctype="multipart/form-data" method="post" action="">
<div class="form-group">
<select id="import" name="target" class="form-control">
<option value="">{{$import_placeholder}}</option>
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 36cb4cc83..663b02890 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -39,6 +39,7 @@
</div>
{{/if}}
<div class="wall-item-author">
+ {{if $item.previewing}}<span class="preview-indicator"><i class="fa fa-eye" title="{{$item.preview_lbl}}"></i></span>&nbsp;{{/if}}
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}">
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index d8f296aa4..815d17c3c 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -126,6 +126,7 @@ function enableOnUser(){
$('#jot-media').val($('#jot-media').val() + data.result.message);
},
stop: function(e,data) {
+ preview_post();
$('#profile-rotator').spin(false);
},
});
@@ -175,6 +176,7 @@ function enableOnUser(){
$('#profile-rotator').spin('tiny');
$.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) {
addeditortext(data);
+ preview_post();
$('#profile-rotator').spin(false);
});
}
@@ -421,6 +423,7 @@ function enableOnUser(){
function(ddata) {
if (ddata['status']) {
addeditortext(ddata['photolink']);
+ preview_post();
} else {
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
}
diff --git a/view/tpl/msg-header.tpl b/view/tpl/msg-header.tpl
index 013e1cfdc..0e8fb0389 100755
--- a/view/tpl/msg-header.tpl
+++ b/view/tpl/msg-header.tpl
@@ -1,34 +1,31 @@
-<script type="text/javascript" src="view/js/ajaxupload.js" ></script>
-<script language="javascript" type="text/javascript">
-
- $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
-
-
+<script src="library/blueimp_upload/js/vendor/jquery.ui.widget.js"></script>
+<script src="library/blueimp_upload/js/jquery.iframe-transport.js"></script>
+<script src="library/blueimp_upload/js/jquery.fileupload.js"></script>
+<script>
$(document).ready(function() {
- var file_uploader = new window.AjaxUpload(
- 'prvmail-attach-wrapper',
- { action: 'wall_attach/{{$nickname}}',
- name: 'userfile',
- onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); },
- onComplete: function(file,response) {
- addmailtext(response);
- $('#prvmail-rotator').spin(false);
- }
- }
- );
+ $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
+
+ $('#invisible-wall-file-upload').fileupload({
+ url: 'wall_attach/{{$nickname}}',
+ dataType: 'json',
+ dropZone: $('#prvmail-text'),
+ maxChunkSize: 4 * 1024 * 1024,
+ add: function(e,data) {
+ $('#prvmail-rotator').spin('tiny');
+ data.submit();
+ },
+ done: function(e,data) {
+ addmailtext(data.result.message);
+ $('#jot-media').val($('#jot-media').val() + data.result.message);
+ },
+ stop: function(e,data) {
+ $('#prvmail-rotator').spin(false);
+ },
+ });
- var file_uploader_sub = new window.AjaxUpload(
- 'prvmail-attach-sub',
- { action: 'wall_attach/{{$nickname}}',
- name: 'userfile',
- onSubmit: function(file,ext) { $('#prvmail-rotator').spin('tiny'); },
- onComplete: function(file,response) {
- addmailtext(response);
- $('#prvmail-rotator').spin(false);
- }
- }
- );
+ $('#prvmail-attach-wrapper').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
+ $('#prvmail-attach-wrapper-sub').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
});
diff --git a/view/tpl/prv_message.tpl b/view/tpl/prv_message.tpl
index 925447ff2..af6315c7e 100755
--- a/view/tpl/prv_message.tpl
+++ b/view/tpl/prv_message.tpl
@@ -6,6 +6,7 @@
<div class="section-content-wrapper">
{{/if}}
<div id="prvmail-wrapper" >
+ <input id="invisible-wall-file-upload" type="file" name="files" style="visibility:hidden;position:absolute;top:-50;left:-50;width:0;height:0;" multiple>
<form id="prvmail-form" action="mail" method="post" >
<input type="hidden" id="inp-prvmail-expires" name="expires" value="{{$defexpire}}" />
<input type="hidden" name="media_str" id="jot-media" value="" />
diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl
index 4ca6378b8..28667eb58 100755
--- a/view/tpl/search_item.tpl
+++ b/view/tpl/search_item.tpl
@@ -32,6 +32,7 @@
</div>
{{/if}}
<div class="wall-item-author">
+ {{if $item.previewing}}<span class="preview-indicator"><i class="fa fa-eye" title="{{$item.preview_lbl}}"></i></span>&nbsp;{{/if}}
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}}&nbsp;{{$item.via}}&nbsp;<a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}">