Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge

This commit is contained in:
zotlabs 2017-11-03 19:18:35 -07:00
commit 1d903655af
13 changed files with 114 additions and 25 deletions

View File

@ -12,6 +12,7 @@ class Queue {
require_once('include/items.php');
require_once('include/bbcode.php');
if(argc() > 1)
$queue_id = argv(1);
else

View File

@ -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.
$_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
$_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
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['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);

View File

@ -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']))

View File

@ -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) . " )";
}
}
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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']);

View File

@ -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;
}

View File

@ -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

View File

@ -0,0 +1,3 @@
#jot-popup {
display: none;
}

5
view/js/mod_pubstream.js Normal file
View File

@ -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");
});