aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHabeas Codice <habeascodice@federated.social>2015-01-21 21:27:07 -0800
committerHabeas Codice <habeascodice@federated.social>2015-01-21 21:27:07 -0800
commitc05f0ec40784a17de2e675c4d684d3a0c54228b0 (patch)
treefdab07506568d57c9abbac72511c5c04ea46f2fd
parent6d291d880e14c0489277fd670f235bdb60bcfcd5 (diff)
parent7d0e0366b946093f81e1ea4e358697fe5a22be64 (diff)
downloadvolse-hubzilla-c05f0ec40784a17de2e675c4d684d3a0c54228b0.tar.gz
volse-hubzilla-c05f0ec40784a17de2e675c4d684d3a0c54228b0.tar.bz2
volse-hubzilla-c05f0ec40784a17de2e675c4d684d3a0c54228b0.zip
Merge branch 'master' of https://github.com/friendica/red
-rwxr-xr-xboot.php6
-rw-r--r--doc/roadmap.bb3
-rw-r--r--include/attach.php104
-rw-r--r--include/zot.php2
-rw-r--r--library/jRange/jquery.range-min.js2
-rw-r--r--library/jRange/jquery.range.css3
-rw-r--r--library/jRange/jquery.range.js10
-rw-r--r--library/jRange/jquery.range.less3
-rw-r--r--library/jquery-textcomplete/jquery.textcomplete.js19
-rw-r--r--mod/filestorage.php6
-rw-r--r--mod/locs.php12
-rw-r--r--mod/sharedwithme.php73
-rw-r--r--version.inc2
-rw-r--r--view/css/mod_prep.css4
-rw-r--r--view/js/autocomplete.js14
-rw-r--r--view/theme/redbasic/css/style.css4
-rw-r--r--view/tpl/locmanage.tpl6
17 files changed, 184 insertions, 89 deletions
diff --git a/boot.php b/boot.php
index 2c85d52f0..ee6b7e99b 100755
--- a/boot.php
+++ b/boot.php
@@ -83,7 +83,9 @@ $DIRECTORY_FALLBACK_SERVERS = array(
'https://zotid.net',
'https://red.zottel.red',
'https://red.pixelbits.de',
- 'https://whogotzot.com'
+ 'https://my.federated.social',
+ 'https://whogotzot.com',
+ 'https://redmatrix.nl'
);
@@ -500,7 +502,6 @@ define ( 'ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
define ( 'ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke' );
define ( 'ACTIVITY_MOOD', NAMESPACE_ZOT . '/activity/mood' );
-define ( 'ACTIVITY_FILE', NAMESPACE_ZOT . '/activity/file' );
define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' );
define ( 'ACTIVITY_OBJ_NOTE', NAMESPACE_ACTIVITY_SCHEMA . 'note' );
@@ -514,6 +515,7 @@ define ( 'ACTIVITY_OBJ_TAGTERM', NAMESPACE_ZOT . '/activity/tagterm' );
define ( 'ACTIVITY_OBJ_PROFILE', NAMESPACE_ZOT . '/activity/profile' );
define ( 'ACTIVITY_OBJ_THING', NAMESPACE_ZOT . '/activity/thing' );
define ( 'ACTIVITY_OBJ_LOCATION',NAMESPACE_ZOT . '/activity/location' );
+define ( 'ACTIVITY_OBJ_FILE', NAMESPACE_ZOT . '/activity/file' );
/**
* item weight for query ordering
diff --git a/doc/roadmap.bb b/doc/roadmap.bb
index 9ac51adf2..54dbdc96b 100644
--- a/doc/roadmap.bb
+++ b/doc/roadmap.bb
@@ -2,6 +2,9 @@
Roadmap for Redmatrix V3
+Crypto
+ Convert E2EE to dynamic loading (on demand) using jQuery.getScript() [or other methods] to only load encryption libs when you require them. This should also support multiple encryption libraries (e.g. SJCL, others) triggered from the choice of algorithm and remain pluggable.
+
Subscriptions and business models
Build enough into core(/addons) to generate income (or at least try and cover costs) out of the box
diff --git a/include/attach.php b/include/attach.php
index 5ef3bea24..a6757744f 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -753,7 +753,7 @@ function attach_delete($channel_id, $resource) {
$channel_address = (($c) ? $c[0]['channel_address'] : 'notfound');
- $r = q("SELECT hash, filename, flags, folder FROM attach WHERE hash = '%s' AND uid = %d limit 1",
+ $r = q("SELECT hash, flags, folder FROM attach WHERE hash = '%s' AND uid = %d limit 1",
dbesc($resource),
intval($channel_id)
);
@@ -762,8 +762,6 @@ function attach_delete($channel_id, $resource) {
if(! $r)
return;
- $url = get_parent_cloudpath($channel_id, $channel_address, $resource) . $r[0]['filename'];
-
// If resource is a directory delete everything in the directory recursive
if($r[0]['flags'] & ATTACH_FLAG_DIR) {
$x = q("SELECT hash, flags FROM attach WHERE folder = '%s' AND uid = %d",
@@ -806,7 +804,7 @@ function attach_delete($channel_id, $resource) {
intval($channel_id)
);
- file_activity($channel_id, $resource, $allow_cid='', $allow_gid='', $deny_cid='', $deny_gid='', $url, 'drop', $no_activity=false);
+ file_activity($channel_id, $resource, $cloudpath='', $allow_cid='', $allow_gid='', $deny_cid='', $deny_gid='', 'drop', $no_activity=false);
}
/**
@@ -942,32 +940,77 @@ function pipe_streams($in, $out) {
return $size;
}
-function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $url, $action, $no_activity) {
+function file_activity($channel_id, $hash, $cloudpath, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $verb, $no_activity) {
require_once('include/items.php');
- $url = rawurlencode($url);
-
$poster = get_app()->get_observer();
- $verb = ACTIVITY_FILE . '/' . $action . '/' . $hash;
+ switch($verb) {
+ case 'post':
+ $activity = ACTIVITY_POST;
+ $x = q("SELECT creator, filename, filetype, filesize, revision, folder, flags, created, edited FROM attach WHERE uid = %d AND hash = '%s' LIMIT 1",
+ intval($channel_id),
+ dbesc($hash)
+ );
+ break;
+ case 'drop':
+ $activity = ACTIVITY_UPDATE;
+ break;
+ default:
+ return;
+ break;
+ }
+
+ $url = (($cloudpath && $x[0]['filename']) ? rawurlencode($cloudpath . $x[0]['filename']) : 'unavailable');
$mid = item_message_id();
$item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_UNSEEN;
- if($action == 'post') {
- //check if activity item exists
- //if yes send drop activity and create a new one
+ $links = array();
+ $links[] = array(
+ 'rel' => 'alternate',
+ 'type' => 'text/html',
+ 'href' => $url
+ );
- $r = q("SELECT * FROM item WHERE verb = '%s'",
- dbesc($verb)
+ $objtype = ACTIVITY_OBJ_FILE;
+
+ $object = array(
+ 'type' => ACTIVITY_OBJ_FILE,
+ 'title' => (($x[0]['filename']) ? $x[0]['filename'] : 'unavailable'),
+ 'id' => $url,
+ 'link' => $links,
+
+ 'hash' => $hash,
+ 'creator' => (($x[0]['creator']) ? $x[0]['creator'] : ''),
+ 'filename' => (($x[0]['filename']) ? $x[0]['filename'] : ''),
+ 'filetype' => (($x[0]['filetype']) ? $x[0]['filetype'] : ''),
+ 'filesize' => (($x[0]['filesize']) ? $x[0]['filesize'] : ''),
+ 'revision' => (($x[0]['revision']) ? $x[0]['revision'] : ''),
+ 'folder' => (($x[0]['folder']) ? $x[0]['folder'] : ''),
+ 'flags' => (($x[0]['flags']) ? $x[0]['flags'] : ''),
+ 'created' => (($x[0]['created']) ? $x[0]['created'] : ''),
+ 'edited' => (($x[0]['edited']) ? $x[0]['edited'] : '')
+ );
+
+ $private = (($allow_cid || $allow_gid || $deny_cid || $deny_gid) ? 1 : 0);
+
+ if($verb == 'post') {
+ //check if activity item exists
+ //if yes send update (drop) activity and create a new one
+ $y = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND object LIKE '%s'",
+ dbesc(ACTIVITY_POST),
+ dbesc(ACTIVITY_OBJ_FILE),
+ dbesc('%"hash":"' . $hash . '"%')
);
- if($r) {
+ if($y) {
$dmid = item_message_id();
- $updateverb = ACTIVITY_FILE . '/drop/' . $hash . '#' . $mid;
+
+ $object['mid'] = $mid; //attach mid for update object
$arr = array();
@@ -979,14 +1022,17 @@ function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $d
$arr['author_xchan'] = $poster['xchan_hash'];
$arr['owner_xchan'] = $poster['xchan_hash'];
$arr['title'] = '';
- $arr['allow_cid'] = $allow_cid;
- $arr['allow_gid'] = $allow_gid;
- $arr['deny_cid'] = $deny_cid;
- $arr['deny_gid'] = $deny_gid;
+ //updates must be visible to everybody -> perms may have changed
+ $arr['allow_cid'] = '';
+ $arr['allow_gid'] = '';
+ $arr['deny_cid'] = '';
+ $arr['deny_gid'] = '';
$arr['item_restrict'] = ITEM_HIDDEN;
$arr['item_private'] = 0;
- $arr['verb'] = $updateverb;
- $arr['body'] = $url;
+ $arr['verb'] = ACTIVITY_UPDATE;
+ $arr['obj_type'] = $objtype;
+ $arr['object'] = json_encode($object);
+ $arr['body'] = '';
$post = item_store($arr);
$item_id = $post['item_id'];
@@ -995,7 +1041,9 @@ function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $d
proc_run('php',"include/notifier.php","activity",$item_id);
}
- //call_hooks('post_local_end', $arr);
+ call_hooks('post_local_end', $arr);
+
+ unset($object['mid']); //remove mid for new object
//notice( t('File activity updated') . EOL);
@@ -1025,9 +1073,11 @@ function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $d
$arr['deny_cid'] = $deny_cid;
$arr['deny_gid'] = $deny_gid;
$arr['item_restrict'] = ITEM_HIDDEN;
- $arr['item_private'] = 0;
- $arr['verb'] = $verb;
- $arr['body'] = $url;
+ $arr['item_private'] = $private;
+ $arr['verb'] = $activity;
+ $arr['obj_type'] = $objtype;
+ $arr['object'] = json_encode($object);
+ $arr['body'] = '';
$post = item_store($arr);
$item_id = $post['item_id'];
@@ -1036,9 +1086,9 @@ function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $d
proc_run('php',"include/notifier.php","activity",$item_id);
}
- //call_hooks('post_local_end', $arr);
+ call_hooks('post_local_end', $arr);
- //(($action === 'post') ? notice( t('File activity posted') . EOL) : notice( t('File activity dropped') . EOL));
+ //(($verb === 'post') ? notice( t('File activity posted') . EOL) : notice( t('File activity dropped') . EOL));
return;
diff --git a/include/zot.php b/include/zot.php
index 384769d61..3d92f7824 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -176,7 +176,7 @@ function zot_zot($url,$data) {
*/
-function zot_finger($webbie,$channel,$autofallback = true) {
+function zot_finger($webbie,$channel = null,$autofallback = true) {
if(strpos($webbie,'@') === false) {
diff --git a/library/jRange/jquery.range-min.js b/library/jRange/jquery.range-min.js
index 8aa6e7ecb..00dadf220 100644
--- a/library/jRange/jquery.range-min.js
+++ b/library/jRange/jquery.range-min.js
@@ -1 +1 @@
-!function($,t,i,s){"use strict";var o=function(){return this.init.apply(this,arguments)};o.prototype={defaults:{onstatechange:function(){},isRange:!1,showLabels:!0,showScale:!0,step:1,format:"%s",theme:"theme-green",width:300},template:'<div class="slider-container"> <div class="back-bar"> <div class="selected-bar"></div> <div class="pointer low"></div><div class="pointer-label">123456</div> <div class="pointer high"></div><div class="pointer-label">456789</div> <div class="clickable-dummy"></div> </div> <div class="scale"></div> </div>',init:function(t,i){this.options=$.extend({},this.defaults,i),this.inputNode=$(t),this.options.value=this.inputNode.val()||(this.options.isRange?this.options.from+","+this.options.from:this.options.from),this.domNode=$(this.template),this.domNode.addClass(this.options.theme),this.inputNode.after(this.domNode),this.domNode.on("change",this.onChange),this.pointers=$(".pointer",this.domNode),this.lowPointer=this.pointers.first(),this.highPointer=this.pointers.last(),this.labels=$(".pointer-label",this.domNode),this.lowLabel=this.labels.first(),this.highLabel=this.labels.last(),this.scale=$(".scale",this.domNode),this.bar=$(".selected-bar",this.domNode),this.clickableBar=this.domNode.find(".clickable-dummy"),this.interval=this.options.to-this.options.from,this.render()},render:function(){return 0!==this.inputNode.width()||this.options.width?(this.domNode.width(this.options.width||this.inputNode.width()),this.inputNode.hide(),this.isSingle()&&(this.lowPointer.hide(),this.lowLabel.hide()),this.options.showLabels||this.labels.hide(),this.attachEvents(),this.options.showScale&&this.renderScale(),void this.setValue(this.options.value)):void console.log("jRange : no width found, returning")},isSingle:function(){return"number"==typeof this.options.value?!0:-1!==this.options.value.indexOf(",")||this.options.isRange?!1:!0},attachEvents:function(){this.clickableBar.click($.proxy(this.barClicked,this)),this.pointers.mousedown($.proxy(this.onDragStart,this)),this.pointers.bind("dragstart",function(t){t.preventDefault()})},onDragStart:function(t){if(1===t.which){t.stopPropagation(),t.preventDefault();var s=$(t.target);s.addClass("focused"),this[(s.hasClass("low")?"low":"high")+"Label"].addClass("focused"),$(i).on("mousemove.slider",$.proxy(this.onDrag,this,s)),$(i).on("mouseup.slider",$.proxy(this.onDragEnd,this))}},onDrag:function(t,i){i.stopPropagation(),i.preventDefault();var s=i.clientX-this.domNode.offset().left;this.domNode.trigger("change",[this,t,s])},onDragEnd:function(){this.pointers.removeClass("focused"),this.labels.removeClass("focused"),$(i).off(".slider"),$(i).off(".slider")},barClicked:function(t){var i=t.pageX-this.clickableBar.offset().left;if(this.isSingle())this.setPosition(this.pointers.last(),i,!0,!0);else{var s=Math.abs(parseInt(this.pointers.first().css("left"),10)-i+this.pointers.first().width()/2)<Math.abs(parseInt(this.pointers.last().css("left"),10)-i+this.pointers.first().width()/2)?this.pointers.first():this.pointers.last();this.setPosition(s,i,!0,!0)}},onChange:function(t,i,s,o){var e,n;i.isSingle()?(e=0,n=i.domNode.width()):(e=s.hasClass("high")?i.lowPointer.position().left+i.lowPointer.width()/2:0,n=s.hasClass("low")?i.highPointer.position().left+i.highPointer.width()/2:i.domNode.width());var h=Math.min(Math.max(o,e),n);i.setPosition(s,h,!0)},setPosition:function(t,i,s,o){var e,n=this.lowPointer.position().left,h=this.highPointer.position().left,a=this.highPointer.width()/2;s||(i=this.prcToPx(i)),t[0]===this.highPointer[0]?h=Math.round(i-a):n=Math.round(i-a),t[o?"animate":"css"]({left:Math.round(i-a)}),e=this.isSingle()?0:n+a,this.bar[o?"animate":"css"]({width:Math.round(h+a-e),left:e}),this.showPointerValue(t,i,o)},setValue:function(t){var i=t.toString().split(",");this.options.value=t;var s=this.valuesToPrc(2===i.length?i:[0,i[0]]);this.isSingle()?this.setPosition(this.highPointer,s[1]):(this.setPosition(this.lowPointer,s[0]),this.setPosition(this.highPointer,s[1]))},renderScale:function(){for(var t=this.options.scale||[this.options.from,this.options.to],i=Math.round(100/(t.length-1)*10)/10,s="",o=0;o<t.length;o++)s+='<span style="left: '+o*i+'%">'+("|"!=t[o]?"<ins>"+t[o]+"</ins>":"")+"</span>";this.scale.html(s),$("ins",this.scale).each(function(){$(this).css({marginLeft:-$(this).outerWidth()/2})})},getBarWidth:function(){var t=this.options.value.split(",");return t.length>1?parseInt(t[1],10)-parseInt(t[0],10):parseInt(t[0],10)},showPointerValue:function(t,i,o){var e=$(".pointer-label",this.domNode)[t.hasClass("low")?"first":"last"](),n,h=this.positionToValue(i);if($.isFunction(this.options.format)){var a=this.isSingle()?s:t.hasClass("low")?"low":"high";n=this.options.format(h,a)}else n=this.options.format.replace("%s",h);var r=e.html(n).width(),l=i-r/2;l=Math.min(Math.max(l,0),this.options.width-r),e[o?"animate":"css"]({left:l}),this.setInputValue(t,h)},valuesToPrc:function(t){var i=100*(t[0]-this.options.from)/this.interval,s=100*(t[1]-this.options.from)/this.interval;return[i,s]},prcToPx:function(t){return this.domNode.width()*t/100},positionToValue:function(t){var i=t/this.domNode.width()*this.interval;return i+=this.options.from,Math.round(i/this.options.step)*this.options.step},setInputValue:function(t,i){if(this.isSingle())this.options.value=i.toString();else{var s=this.options.value.split(",");this.options.value=t.hasClass("low")?i+","+s[1]:s[0]+","+i}this.inputNode.val()!==this.options.value&&(this.inputNode.val(this.options.value),this.options.onstatechange.call(this,this.options.value))},getValue:function(){return this.options.value}};var e="jRange";$.fn[e]=function(t){var i=arguments,s;return this.each(function(){var n=$(this),h=$.data(this,"plugin_"+e),a="object"==typeof t&&t;h||n.data("plugin_"+e,h=new o(this,a)),"string"==typeof t&&(s=h[t].apply(h,Array.prototype.slice.call(i,1)))}),s||this}}(jQuery,window,document); \ No newline at end of file
+!function($,t,i,s){"use strict";var o=function(){return this.init.apply(this,arguments)};o.prototype={defaults:{onstatechange:function(){},isRange:!1,showLabels:!0,showScale:!0,step:1,format:"%s",theme:"theme-green",width:300,minRange:0,maxRange:"auto"},template:'<div class="slider-container"> <div class="back-bar"> <div class="selected-bar"></div> <div class="pointer low"></div><div class="pointer-label">123456</div> <div class="pointer high"></div><div class="pointer-label">456789</div> <div class="clickable-dummy"></div> </div> <div class="scale"></div> </div>',init:function(t,i){this.options=$.extend({},this.defaults,i),this.inputNode=$(t),this.options.value=this.inputNode.val()||(this.options.isRange?this.options.from+","+this.options.from:this.options.from),this.domNode=$(this.template),this.domNode.addClass(this.options.theme),this.inputNode.after(this.domNode),this.domNode.on("change",this.onChange),this.pointers=$(".pointer",this.domNode),this.lowPointer=this.pointers.first(),this.highPointer=this.pointers.last(),this.labels=$(".pointer-label",this.domNode),this.lowLabel=this.labels.first(),this.highLabel=this.labels.last(),this.scale=$(".scale",this.domNode),this.bar=$(".selected-bar",this.domNode),this.clickableBar=this.domNode.find(".clickable-dummy"),this.interval=this.options.to-this.options.from,this.render()},render:function(){return 0!==this.inputNode.width()||this.options.width?(this.domNode.width(this.options.width||this.inputNode.width()),this.inputNode.hide(),this.isSingle()&&(this.lowPointer.hide(),this.lowLabel.hide()),this.options.showLabels||this.labels.hide(),this.attachEvents(),this.options.showScale&&this.renderScale(),void this.setValue(this.options.value)):void console.log("jRange : no width found, returning")},isSingle:function(){return"number"==typeof this.options.value?!0:-1!==this.options.value.indexOf(",")||this.options.isRange?!1:!0},attachEvents:function(){this.clickableBar.click($.proxy(this.barClicked,this)),this.pointers.mousedown($.proxy(this.onDragStart,this)),this.pointers.bind("dragstart",function(t){t.preventDefault()})},onDragStart:function(t){if(1===t.which){t.stopPropagation(),t.preventDefault();var s=$(t.target);this.pointers.removeClass("last-active"),s.addClass("focused last-active"),this[(s.hasClass("low")?"low":"high")+"Label"].addClass("focused"),$(i).on("mousemove.slider",$.proxy(this.onDrag,this,s)),$(i).on("mouseup.slider",$.proxy(this.onDragEnd,this))}},onDrag:function(t,i){i.stopPropagation(),i.preventDefault();var s=i.clientX-this.domNode.offset().left;this.domNode.trigger("change",[this,t,s])},onDragEnd:function(){this.pointers.removeClass("focused"),this.labels.removeClass("focused"),$(i).off(".slider"),$(i).off(".slider")},barClicked:function(t){var i=t.pageX-this.clickableBar.offset().left;if(this.isSingle())this.setPosition(this.pointers.last(),i,!0,!0);else{var s=Math.abs(parseInt(this.pointers.first().css("left"),10)-i+this.pointers.first().width()/2)<Math.abs(parseInt(this.pointers.last().css("left"),10)-i+this.pointers.first().width()/2)?this.pointers.first():this.pointers.last();this.setPosition(s,i,!0,!0)}},onChange:function(t,i,s,o){var e,n;i.isSingle()?(e=0,n=i.domNode.width()):(e=s.hasClass("high")?i.lowPointer.position().left+i.lowPointer.width()/2:0,n=s.hasClass("low")?i.highPointer.position().left+i.highPointer.width()/2:i.domNode.width());var h=Math.min(Math.max(o,e),n);i.setPosition(s,h,!0)},setPosition:function(t,i,s,o){var e,n=this.lowPointer.position().left,h=this.highPointer.position().left,a=this.highPointer.width()/2;s||(i=this.prcToPx(i)),t[0]===this.highPointer[0]?h=Math.round(i-a):n=Math.round(i-a),t[o?"animate":"css"]({left:Math.round(i-a)}),e=this.isSingle()?0:n+a,this.bar[o?"animate":"css"]({width:Math.round(h+a-e),left:e}),this.showPointerValue(t,i,o)},setValue:function(t){var i=t.toString().split(",");this.options.value=t;var s=this.valuesToPrc(2===i.length?i:[0,i[0]]);this.isSingle()?this.setPosition(this.highPointer,s[1]):(this.setPosition(this.lowPointer,s[0]),this.setPosition(this.highPointer,s[1]))},renderScale:function(){for(var t=this.options.scale||[this.options.from,this.options.to],i=Math.round(100/(t.length-1)*10)/10,s="",o=0;o<t.length;o++)s+='<span style="left: '+o*i+'%">'+("|"!=t[o]?"<ins>"+t[o]+"</ins>":"")+"</span>";this.scale.html(s),$("ins",this.scale).each(function(){$(this).css({marginLeft:-$(this).outerWidth()/2})})},getBarWidth:function(){var t=this.options.value.split(",");return t.length>1?parseInt(t[1],10)-parseInt(t[0],10):parseInt(t[0],10)},showPointerValue:function(t,i,o){var e=$(".pointer-label",this.domNode)[t.hasClass("low")?"first":"last"](),n,h=this.positionToValue(i);if($.isFunction(this.options.format)){var a=this.isSingle()?s:t.hasClass("low")?"low":"high";n=this.options.format(h,a)}else n=this.options.format.replace("%s",h);var r=e.html(n).width(),l=i-r/2;l=Math.min(Math.max(l,0),this.options.width-r),e[o?"animate":"css"]({left:l}),this.setInputValue(t,h)},valuesToPrc:function(t){var i=100*(t[0]-this.options.from)/this.interval,s=100*(t[1]-this.options.from)/this.interval;return[i,s]},prcToPx:function(t){return this.domNode.width()*t/100},positionToValue:function(t){var i=t/this.domNode.width()*this.interval;return i+=this.options.from,Math.round(i/this.options.step)*this.options.step},setInputValue:function(t,i){if(this.isSingle())this.options.value=i.toString();else{var s=this.options.value.split(",");this.options.value=t.hasClass("low")?i+","+s[1]:s[0]+","+i}this.inputNode.val()!==this.options.value&&(this.inputNode.val(this.options.value),this.options.onstatechange.call(this,this.options.value))},getValue:function(){return this.options.value}};var e="jRange";$.fn[e]=function(t){var i=arguments,s;return this.each(function(){var n=$(this),h=$.data(this,"plugin_"+e),a="object"==typeof t&&t;h||n.data("plugin_"+e,h=new o(this,a)),"string"==typeof t&&(s=h[t].apply(h,Array.prototype.slice.call(i,1)))}),s||this}}(jQuery,window,document); \ No newline at end of file
diff --git a/library/jRange/jquery.range.css b/library/jRange/jquery.range.css
index 27375c846..4fb1578dc 100644
--- a/library/jRange/jquery.range.css
+++ b/library/jRange/jquery.range.css
@@ -19,6 +19,9 @@
opacity: 1;
z-index: 2;
}
+.slider-container .back-bar .pointer.last-active {
+ z-index: 3;
+}
.slider-container .back-bar .pointer-label {
position: absolute;
top: -17px;
diff --git a/library/jRange/jquery.range.js b/library/jRange/jquery.range.js
index 978b3e7ba..b3208387d 100644
--- a/library/jRange/jquery.range.js
+++ b/library/jRange/jquery.range.js
@@ -33,7 +33,9 @@
step : 1,
format: '%s',
theme : 'theme-green',
- width : 300
+ width : 300,
+ minRange: 0,
+ maxRange: 'auto'
},
template : '<div class="slider-container">\
<div class="back-bar">\
@@ -103,7 +105,8 @@
if(e.which !== 1){return;}
e.stopPropagation(); e.preventDefault();
var pointer = $(e.target);
- pointer.addClass('focused');
+ this.pointers.removeClass('last-active');
+ pointer.addClass('focused last-active');
this[(pointer.hasClass('low')?'low':'high') + 'Label'].addClass('focused');
$(document).on('mousemove.slider', $.proxy(this.onDrag, this, pointer));
$(document).on('mouseup.slider', $.proxy(this.onDragEnd, this));
@@ -280,6 +283,7 @@
options = typeof option === 'object' && option;
if (!data) {
$this.data('plugin_' + pluginName, (data = new jRange(this, options)));
+ $(window).resize(function() { data.setValue(data.getValue()); }); // Update slider position when window is resized to keep it in sync with scale
}
// if first argument is a string, call silimarly named function
// this gives flexibility to call functions of the plugin e.g.
@@ -294,4 +298,4 @@
return result || this;
};
-})(jQuery, window, document); \ No newline at end of file
+})(jQuery, window, document);
diff --git a/library/jRange/jquery.range.less b/library/jRange/jquery.range.less
index 979ed2e1a..cb6e12288 100644
--- a/library/jRange/jquery.range.less
+++ b/library/jRange/jquery.range.less
@@ -73,6 +73,9 @@
cursor: move;
opacity: 1;
z-index: 2;
+ &.last-active{
+ z-index: 3;
+ }
}
.pointer-label {
position: absolute;
diff --git a/library/jquery-textcomplete/jquery.textcomplete.js b/library/jquery-textcomplete/jquery.textcomplete.js
index c8303eaa0..3df84f3b4 100644
--- a/library/jquery-textcomplete/jquery.textcomplete.js
+++ b/library/jquery-textcomplete/jquery.textcomplete.js
@@ -124,9 +124,8 @@ if (typeof jQuery === 'undefined') {
this.views = [];
this.option = $.extend({}, Completer._getDefaults(), option);
-
if (!this.$el.is('input[type=text]') && !this.$el.is('textarea') && !element.isContentEditable && element.contentEditable != 'true') {
- throw new Error('textcomplete must be called on a input[type=text], Textarea or a ContentEditable.');
+ throw new Error('textcomplete must be called on a Textarea or a ContentEditable.');
}
if (element === document.activeElement) {
@@ -414,6 +413,22 @@ if (typeof jQuery === 'undefined') {
setPosition: function (position) {
this.$el.css(this._applyPlacement(position));
+
+ // Make the dropdown fixed if the input is also fixed
+ // This can't be done during init, as textcomplete may be used on multiple elements on the same page
+ // Because the same dropdown is reused behind the scenes, we need to recheck every time the dropdown is showed
+ var position = 'absolute';
+ // Check if input or one of its parents has positioning we need to care about
+ this.$inputEl.add(this.$inputEl.parents()).each(function() {
+ if($(this).css('position') === 'absolute') // The element has absolute positioning, so it's all OK
+ return false;
+ if($(this).css('position') === 'fixed') {
+ position = 'fixed';
+ return false;
+ }
+ });
+ this.$el.css({ position: position }); // Update positioning
+
return this;
},
diff --git a/mod/filestorage.php b/mod/filestorage.php
index 67abc2eab..9852f4e73 100644
--- a/mod/filestorage.php
+++ b/mod/filestorage.php
@@ -21,7 +21,6 @@ function filestorage_post(&$a) {
$recurse = ((x($_POST, 'recurse')) ? intval($_POST['recurse']) : 0);
$resource = ((x($_POST, 'filehash')) ? notags($_POST['filehash']) : '');
-
$no_activity = ((x($_POST, 'no_activity')) ? intval($_POST['no_activity']) : 0);
if(! $resource) {
@@ -40,10 +39,7 @@ function filestorage_post(&$a) {
$channel = $a->get_channel();
$cloudPath = get_parent_cloudpath($channel_id, $channel['channel_address'], $resource);
- $filename = find_filename_by_hash($channel_id, $resource);
- $url = $cloudPath . $filename;
-
- file_activity($channel_id, $resource, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, $url, 'post', $no_activity);
+ file_activity($channel_id, $resource, $cloudPath, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny, 'post', $no_activity);
goaway($cloudPath);
}
diff --git a/mod/locs.php b/mod/locs.php
index b1169fcca..bf2737718 100644
--- a/mod/locs.php
+++ b/mod/locs.php
@@ -11,24 +11,28 @@ function locs_post(&$a) {
if($_REQUEST['primary']) {
$hubloc_id = intval($_REQUEST['primary']);
if($hubloc_id) {
+
$r = q("select hubloc_id from hubloc where hubloc_id = %d and hubloc_hash = '%s' limit 1",
intval($hubloc_id),
dbesc($channel['channel_hash'])
);
+
if(! $r) {
notice( t('Location not found.') . EOL);
return;
}
- $r = q("update hubloc set hubloc_flags = (hubloc_flags & ~%d) where (hubloc_flags & %d)>0 and hubloc_hash = '%s' ",
+
+ $r = q("update hubloc set hubloc_flags = (hubloc_flags - %d) where (hubloc_flags & %d)>0 and hubloc_hash = '%s' ",
intval(HUBLOC_FLAGS_PRIMARY),
intval(HUBLOC_FLAGS_PRIMARY),
dbesc($channel['channel_hash'])
);
- $r = q("update hubloc set hubloc_flags = (hubloc_flags & %d) where hubloc_id = %d and hubloc_hash = '%s'",
+ $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d and hubloc_hash = '%s'",
intval(HUBLOC_FLAGS_PRIMARY),
intval($hubloc_id),
dbesc($channel['channel_hash'])
);
+
proc_run('php','include/notifier.php','location',$channel['channel_id']);
return;
}
@@ -36,12 +40,14 @@ function locs_post(&$a) {
if($_REQUEST['drop']) {
$hubloc_id = intval($_REQUEST['drop']);
+
if($hubloc_id) {
$r = q("select hubloc_id, hubloc_flags from hubloc where hubloc_id = %d and hubloc_url != '%s' and hubloc_hash = '%s' limit 1",
intval($hubloc_id),
dbesc(z_root()),
dbesc($channel['channel_hash'])
);
+
if(! $r) {
notice( t('Location not found.') . EOL);
return;
@@ -50,7 +56,7 @@ function locs_post(&$a) {
notice( t('Primary location cannot be removed.') . EOL);
return;
}
- $r = q("update hubloc set hubloc_flags = (hubloc_flags & %d) where hubloc_id = %d and hubloc_hash = '%s'",
+ $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d and hubloc_hash = '%s'",
intval(HUBLOC_FLAGS_DELETED),
intval($hubloc_id),
dbesc($channel['channel_hash'])
diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php
index d4aa129ac..ff93051da 100644
--- a/mod/sharedwithme.php
+++ b/mod/sharedwithme.php
@@ -1,6 +1,6 @@
<?php
-require_once('include/text.php');
require_once('include/conversation.php');
+require_once('include/text.php');
function sharedwithme_content(&$a) {
if(! local_user()) {
@@ -12,38 +12,44 @@ function sharedwithme_content(&$a) {
$is_owner = (local_user() && (local_user() == $channel['channel_id']));
- $postverb = ACTIVITY_FILE . '/post/';
- $dropverb = ACTIVITY_FILE . '/drop/';
-
//maintenance - see if a file got dropped and remove it systemwide
- $x = q("SELECT * FROM item WHERE verb LIKE '%s' AND uid = %d",
- dbesc($dropverb . '%'),
+ $x = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d",
+ dbesc(ACTIVITY_UPDATE),
+ dbesc(ACTIVITY_OBJ_FILE),
intval(local_user())
);
-
+
if($x) {
-
+
foreach($x as $xx) {
- $hash = substr($xx['verb'], 39);
+ $object = json_decode($xx['object'],true);
+ $hash = $object['hash'];
+
+ //If object has a mid it's an update - the inlcuded mid is the latest and should not be removed
+ $update = (($object['mid']) ? true : false);
+
+ if($update) {
- $update = strpos($hash, '#');
+ $mid = $object['mid'];
- if($update === false) {
- q("DELETE FROM item WHERE verb = '%s' OR verb = '%s'",
- dbesc($postverb . $hash),
- dbesc($dropverb . $hash)
+ $y = q("DELETE FROM item WHERE (mid != '%s' AND obj_type = '%s' AND object LIKE '%s') AND (verb = '%s' OR verb = '%s')",
+ dbesc($mid),
+ dbesc(ACTIVITY_OBJ_FILE),
+ dbesc('%"hash":"' . $hash . '"%'),
+ dbesc(ACTIVITY_POST),
+ dbesc(ACTIVITY_UPDATE)
);
+
}
else {
-
- $arr = explode('#', $hash);
-
- q("DELETE FROM item WHERE mid != '%s' AND verb = '%s' OR verb = '%s'",
- dbesc($arr[1]),
- dbesc($postverb . $arr[0]),
- dbesc($dropverb . $hash)
+
+ $z = q("DELETE FROM item WHERE (obj_type = '%s' AND object LIKE '%s') AND (verb = '%s' OR verb = '%s')",
+ dbesc(ACTIVITY_OBJ_FILE),
+ dbesc('%"hash":"' . $hash . '"%'),
+ dbesc(ACTIVITY_POST),
+ dbesc(ACTIVITY_UPDATE)
);
}
@@ -68,8 +74,9 @@ function sharedwithme_content(&$a) {
//drop all files - localuser
if((argc() > 1) && (argv(1) === 'dropall')) {
- q("DELETE FROM item WHERE verb LIKE '%s' AND uid = %d",
- dbesc($postverb . '%'),
+ q("DELETE FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d",
+ dbesc(ACTIVITY_POST),
+ dbesc(ACTIVITY_OBJ_FILE),
intval(local_user())
);
@@ -77,11 +84,13 @@ function sharedwithme_content(&$a) {
}
//list files
- $r = q("SELECT * FROM item WHERE verb LIKE '%s' AND uid = %d",
- dbesc($postverb . '%'),
- intval(local_user())
+ $r = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'",
+ dbesc(ACTIVITY_POST),
+ dbesc(ACTIVITY_OBJ_FILE),
+ intval(local_user()),
+ dbesc($channel['channel_hash'])
);
-
+
$o = profile_tabs($a, $is_owner, $channel['channel_address']);
$o .= '<div class="section-title-wrapper">';
@@ -96,19 +105,15 @@ function sharedwithme_content(&$a) {
if($r) {
foreach($r as $rr) {
- //don't display the files we shared with others
- if($rr['owner_xchan'] != $channel['channel_hash']) {
- unobscure($rr);
- $url = rawurldecode($rr['body']);
- $o .= '<a href="' . $url . '?f=&zid=' . $channel['xchan_addr'] . '">' . $url . '</a>&nbsp;<a href="/sharedwithme/' . $rr['id'] . '/drop" onclick="return confirmDelete();"><i class="icon-trash drop-icons"></i></a><br><br>';
- }
+ $object = json_decode($rr['object'],true);
+ $url = rawurldecode(get_rel_link($object['link'],'alternate'));
+ $o .= '<a href="' . $url . '?f=&zid=' . $channel['xchan_addr'] . '">' . $url . '</a>&nbsp;<a href="/sharedwithme/' . $rr['id'] . '/drop" onclick="return confirmDelete();"><i class="icon-trash drop-icons"></i></a><br><br>';
}
}
$o .= '</div>';
return $o;
-
}
diff --git a/version.inc b/version.inc
index 986738806..742b0e1ed 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-01-20.922
+2015-01-21.923
diff --git a/view/css/mod_prep.css b/view/css/mod_prep.css
index 3701cbdff..bb29086da 100644
--- a/view/css/mod_prep.css
+++ b/view/css/mod_prep.css
@@ -5,4 +5,8 @@
.prep-details {
float: left;
+}
+
+.directory-item {
+ margin: 10px;
} \ No newline at end of file
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 1c524789d..86847cb35 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -3,15 +3,18 @@
*
* require jQuery, jquery.textcomplete
*/
-function contact_search(term, callback, backend_url, type, extra_channels) {
+function contact_search(term, callback, backend_url, type, extra_channels, spinelement) {
+ if(spinelement){
+ $(spinelement).spin('tiny');
+ }
// Check if there is a cached result that contains the same information we would get with a full server-side search
-
var bt = backend_url+type;
if(!(bt in contact_search.cache)) contact_search.cache[bt] = {};
var lterm = term.toLowerCase(); // Ignore case
for(t in contact_search.cache[bt]) {
if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results
+ $(spinelement).spin(false);
// Filter old results locally
var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one
matching.unshift({taggable:false, text: term, replace: term});
@@ -44,6 +47,7 @@ function contact_search(term, callback, backend_url, type, extra_channels) {
var items = data.items.slice(0);
items.unshift({taggable:false, text: term, replace: term});
callback(items);
+ $(spinelement).spin(false);
},
}).fail(function () {callback([]); }); // Callback must be invoked even if something went wrong.
}
@@ -98,7 +102,7 @@ function submit_form(e) {
contacts = {
match: /(^|\s)(@\!*)([^ \n]+)$/,
index: 3,
- search: function(term, callback) { contact_search(term, callback, backend_url, 'c', extra_channels); },
+ search: function(term, callback) { contact_search(term, callback, backend_url, 'c', extra_channels, spinelement=false); },
replace: editor_replace,
template: contact_format,
}
@@ -125,7 +129,7 @@ function submit_form(e) {
contacts = {
match: /(^@)([^\n]{2,})$/,
index: 2,
- search: function(term, callback) { contact_search(term, callback, backend_url, 'x',[]); },
+ search: function(term, callback) { contact_search(term, callback, backend_url, 'x', [], spinelement='#nav-search-spinner'); },
replace: basic_replace,
template: contact_format,
}
@@ -147,7 +151,7 @@ function submit_form(e) {
contacts = {
match: /(^)([^\n]+)$/,
index: 2,
- search: function(term, callback) { contact_search(term, callback, backend_url, typ,[]); },
+ search: function(term, callback) { contact_search(term, callback, backend_url, typ,[], spinelement=false); },
replace: basic_replace,
template: contact_format,
}
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index ce933ba10..c95909085 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -876,8 +876,8 @@ footer {
nav .acpopup {
top: 49px !important;
- right: 30px !important;
- margin-left: -45px;
+ margin-left: -35px;
+ width: 290px;
}
.profile-clear {
diff --git a/view/tpl/locmanage.tpl b/view/tpl/locmanage.tpl
index 5a25850a1..d1bb00543 100644
--- a/view/tpl/locmanage.tpl
+++ b/view/tpl/locmanage.tpl
@@ -2,10 +2,10 @@
<script>
function primehub(id) {
- $.post('locs','primary='+id,function(data) { window.location.href=window.location.href; });
+ $.post(baseurl + '/locs','primary='+id,function(data) { window.location.href=window.location.href; });
}
function drophub(id) {
- $.post('locs','drop='+id,function(data) { window.location.href=window.location.href; });
+ $.post(baseurl + '/locs','drop='+id,function(data) { window.location.href=window.location.href; });
}
</script>
@@ -17,7 +17,7 @@ function drophub(id) {
{{$hub.hubloc_url}} ({{$hub.hubloc_addr}}){{if $hub.deleted}}</strike>{{/if}}</td>
<td>
-{{if $hub.primary}}<i class="icon-check"></i>{{else}}<button class="btn btn-std"><i class="icon-check-empty" onclick="primehub({{$hub.hubloc_id}}); return false;" ></i></button>{{/if}}
+{{if $hub.primary}}<i class="icon-check"></i>{{else}}<button class="btn btn-std" onclick="primehub({{$hub.hubloc_id}}); return false;" ><i class="icon-check-empty" ></i></button>{{/if}}
</td>
<td>{{if $hub.primary}}{{else}}{{if ! $hub.deleted}}<button class="btn btn-std" onclick="drophub({{$hub.hubloc_id}}); return false;"><i class="icon-remove"></i></button>{{/if}}{{/if}}</td>
</tr>