diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-03 19:18:35 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-11-03 19:18:35 -0700 |
commit | 1d903655afdd8e49942c6d6c9ca1a7feadeaaa82 (patch) | |
tree | 892c93a0a3e434b6e8ff8c04d3d7107cf1e12750 | |
parent | 0403738981487b7edec20b11a85849254366a202 (diff) | |
parent | a899ce1c22386b9ff882048cba35d46f560ee654 (diff) | |
download | volse-hubzilla-1d903655afdd8e49942c6d6c9ca1a7feadeaaa82.tar.gz volse-hubzilla-1d903655afdd8e49942c6d6c9ca1a7feadeaaa82.tar.bz2 volse-hubzilla-1d903655afdd8e49942c6d6c9ca1a7feadeaaa82.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
-rw-r--r-- | Zotlabs/Daemon/Queue.php | 1 | ||||
-rw-r--r-- | Zotlabs/Module/Cloud.php | 19 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Ping.php | 14 | ||||
-rw-r--r-- | Zotlabs/Module/Pubstream.php | 42 | ||||
-rwxr-xr-x | include/items.php | 8 | ||||
-rw-r--r-- | include/network.php | 9 | ||||
-rw-r--r-- | include/photos.php | 3 | ||||
-rw-r--r-- | include/queue_fn.php | 7 | ||||
-rw-r--r-- | include/zid.php | 25 | ||||
-rw-r--r-- | view/css/mod_pubstream.css | 3 | ||||
-rw-r--r-- | view/js/mod_pubstream.js | 5 |
13 files changed, 115 insertions, 26 deletions
diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php index 11cbe4494..17d150250 100644 --- a/Zotlabs/Daemon/Queue.php +++ b/Zotlabs/Daemon/Queue.php @@ -12,6 +12,7 @@ class Queue { require_once('include/items.php'); require_once('include/bbcode.php'); + if(argc() > 1) $queue_id = argv(1); else diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index 75191a279..d2264092b 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -57,12 +57,21 @@ class Cloud extends \Zotlabs\Web\Controller { $auth->observer = $ob_hash; } + // if we arrived at this path with any query parameters in the url, build a clean url without + // them and redirect. + // @fixme if the filename has an ampersand in it AND there are query parameters, + // this may not do the right thing. + + if((strpos($_SERVER['QUERY_STRING'],'?') !== false) || (strpos($_SERVER['QUERY_STRING'],'&') !== false && strpos($_SERVER['QUERY_STRING'],'&') === false)) { + $path = z_root(); + if(argc()) { + foreach(\App::$argv as $a) { + $path .= '/' . $a; + } + } + goaway($path); + } - $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']); - $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']); - - $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']); - $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); $rootDirectory = new \Zotlabs\Storage\Directory('/', $auth); diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 85f08fd08..266a5b6bf 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -12,6 +12,8 @@ class Display extends \Zotlabs\Web\Controller { function get($update = 0, $load = false) { + $module_format = 'html'; + if(argc() > 1) { $module_format = substr(argv(1),strrpos(argv(1),'.') + 1); if(! in_array($module_format,['atom','zot','json'])) diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 66032aada..4deb7c9e8 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -533,13 +533,12 @@ class Network extends \Zotlabs\Web\Controller { if($parents_str) { $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )"; - $update_unseen .= " AND obj_type != '" . dbesc(ACTIVITY_OBJ_FILE) . "'"; $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) "; } } else { if($parents_str) { - $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " ) AND obj_type != '" . dbesc(ACTIVITY_OBJ_FILE) . "'"; + $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )"; } } } diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index c91659f2f..5e2d04c1f 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -169,15 +169,13 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM item WHERE uid = %d AND author_xchan != '%s' - AND obj_type != '%s' AND item_unseen = 1 AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "' $item_normal ORDER BY created DESC LIMIT 300", intval($sys['channel_id']), - dbesc(get_observer_hash()), - dbesc(ACTIVITY_OBJ_FILE) + dbesc(get_observer_hash()) ); if($r) { @@ -313,11 +311,9 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM item WHERE item_unseen = 1 and uid = %d $item_normal AND author_xchan != '%s' - AND obj_type != '%s' ORDER BY created DESC limit 300", intval(local_channel()), - dbesc($ob_hash), - dbesc(ACTIVITY_OBJ_FILE) + dbesc($ob_hash) ); if($r) { @@ -487,11 +483,9 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT id, item_wall FROM item WHERE item_unseen = 1 and uid = %d $item_normal - AND author_xchan != '%s' - AND obj_type != '%s'", + AND author_xchan != '%s'", intval(local_channel()), - dbesc($ob_hash), - dbesc(ACTIVITY_OBJ_FILE) + dbesc($ob_hash) ); if($r) { diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index e83de6bc0..4224fa3c8 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -2,6 +2,7 @@ namespace Zotlabs\Module; require_once('include/conversation.php'); +require_once('include/acl_selectors.php'); class Pubstream extends \Zotlabs\Web\Controller { @@ -33,6 +34,47 @@ class Pubstream extends \Zotlabs\Web\Controller { $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); $net = ((array_key_exists('net',$_REQUEST)) ? escape_tags($_REQUEST['net']) : ''); + + if(local_channel() && (! $update)) { + + $channel = \App::get_channel(); + + $channel_acl = array( + 'allow_cid' => $channel['channel_allow_cid'], + 'allow_gid' => $channel['channel_allow_gid'], + 'deny_cid' => $channel['channel_deny_cid'], + 'deny_gid' => $channel['channel_deny_gid'] + ); + + $x = array( + 'is_owner' => true, + 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), + 'default_location' => $channel['channel_location'], + 'nickname' => $channel['channel_address'], + 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + + 'acl' => populate_acl($channel_acl), + 'permissions' => $channel_acl, + 'bang' => '', + 'visitor' => true, + 'profile_uid' => local_channel(), + 'return_path' => 'channel/' . $channel['channel_address'], + 'expanded' => true, + 'editor_autocomplete' => true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true, + 'jotnets' => true + ); + + $o = '<div id="jot-popup">'; + $o .= status_editor($a,$x); + $o .= '</div>'; + } + + + + + if(! $update && !$load) { diff --git a/include/items.php b/include/items.php index dd8b394d3..08e53553b 100755 --- a/include/items.php +++ b/include/items.php @@ -173,19 +173,19 @@ function comments_are_now_closed($item) { function item_normal() { return " and item.item_hidden = 0 and item.item_type = 0 and item.item_deleted = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 - and item.item_blocked = 0 "; + and item.item_blocked = 0 and item.obj_type != '" . ACTIVITY_OBJ_FILE . "' "; } function item_normal_search() { return " and item.item_hidden = 0 and item.item_type in (0,3,6) and item.item_deleted = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 - and item.item_blocked = 0 "; + and item.item_blocked = 0 and item.obj_type != '" . ACTIVITY_OBJ_FILE . "' "; } function item_normal_update() { return " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 - and item.item_blocked = 0 "; + and item.item_blocked = 0 and item.obj_type != '" . ACTIVITY_OBJ_FILE . "' "; } @@ -201,7 +201,7 @@ function is_item_normal($item) { if(intval($item['item_hidden']) || intval($item['item_type']) || intval($item['item_deleted']) || intval($item['item_unpublished']) || intval($item['item_delayed']) || intval($item['item_pending_remove']) - || intval($item['item_blocked'])) + || intval($item['item_blocked']) || ($item['obj_type'] == ACTIVITY_OBJ_FILE)) return false; return true; diff --git a/include/network.php b/include/network.php index 73a6aeff2..2caf29ab5 100644 --- a/include/network.php +++ b/include/network.php @@ -1433,14 +1433,19 @@ function scrape_feed($url) { -function do_delivery($deliveries) { + + +function do_delivery($deliveries, $force = false) { + + // $force is set if a site that wasn't responding suddenly returns to life. + // Try and shove through everything going to that site while it's responding. if(! (is_array($deliveries) && count($deliveries))) return; $x = q("select count(outq_hash) as total from outq where outq_delivered = 0"); - if(intval($x[0]['total']) > intval(get_config('system','force_queue_threshold',300))) { + if(intval($x[0]['total']) > intval(get_config('system','force_queue_threshold',300)) && (! $force)) { logger('immediate delivery deferred.', LOGGER_DEBUG, LOG_INFO); foreach($deliveries as $d) { update_queue_item($d); diff --git a/include/photos.php b/include/photos.php index 5de68f162..503a725cd 100644 --- a/include/photos.php +++ b/include/photos.php @@ -75,6 +75,9 @@ function photo_upload($channel, $observer, $args) { $imagedata = @file_get_contents($tmp_name); @unlink($tmp_name); } + else { + $imagedata = @file_get_contents($args['os_syspath']); + } } else { $imagedata = @file_get_contents($args['os_syspath']); diff --git a/include/queue_fn.php b/include/queue_fn.php index 0d98e1e21..5fb0d5f1e 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -42,7 +42,7 @@ function update_queue_item($id, $add_priority = 0) { $next = datetime_convert('UTC','UTC','now + 1 hour'); } else { - $next = datetime_convert('UTC','UTC','now + 15 minutes'); + $next = datetime_convert('UTC','UTC','now + ' . intval($add_priority) . ' minutes'); } q("UPDATE outq SET outq_updated = '%s', @@ -200,14 +200,15 @@ function queue_deliver($outq, $immediate = false) { } } if($piled_up) { - do_delivery($piled_up); + // call do_delivery() with the force flag + do_delivery($piled_up, true); } } } else { logger('deliver: queue post returned ' . $result['return_code'] . ' from ' . $outq['outq_posturl'],LOGGER_DEBUG); - update_queue_item($outq['outq_hash']); + update_queue_item($outq['outq_hash'],10); } return; } diff --git a/include/zid.php b/include/zid.php index ce9f70385..5ade6b0f8 100644 --- a/include/zid.php +++ b/include/zid.php @@ -89,10 +89,35 @@ function strip_zids($s) { return preg_replace('/[\?&]zid=(.*?)(&|$)/ism','$2',$s); } +function strip_owt($s) { + return preg_replace('/[\?&]owt=(.*?)(&|$)/ism','$2',$s); +} + function strip_zats($s) { return preg_replace('/[\?&]zat=(.*?)(&|$)/ism','$2',$s); } +function strip_auth_query_params() { + + $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']); + $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']); + $_SERVER['QUERY_STRING'] = strip_owt($_SERVER['QUERY_STRING']); + + $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']); + $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); + $_SERVER['REQUEST_URI'] = strip_owt($_SERVER['REQUEST_URI']); + + + $_ENV['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['QUERY_STRING']); + $_ENV['QUERY_STRING'] = strip_zids($_ENV['QUERY_STRING']); + $_ENV['QUERY_STRING'] = strip_owt($_ENV['QUERY_STRING']); + + $_ENV['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['REQUEST_URI']); + $_ENV['REQUEST_URI'] = strip_zids($_ENV['REQUEST_URI']); + $_ENV['REQUEST_URI'] = strip_owt($_ENV['REQUEST_URI']); + +} + /** * zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links diff --git a/view/css/mod_pubstream.css b/view/css/mod_pubstream.css new file mode 100644 index 000000000..dde242d4e --- /dev/null +++ b/view/css/mod_pubstream.css @@ -0,0 +1,3 @@ +#jot-popup { + display: none; +} diff --git a/view/js/mod_pubstream.js b/view/js/mod_pubstream.js new file mode 100644 index 000000000..7e24a7f86 --- /dev/null +++ b/view/js/mod_pubstream.js @@ -0,0 +1,5 @@ +$(document).ready(function() { + $(".comment-edit-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1"); + // make auto-complete work in more places + $(".wall-item-comment-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1"); +}); |