aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-11-01 22:34:31 -0700
committerzotlabs <mike@macgirvin.com>2017-11-01 22:34:31 -0700
commitf23c8e7597b6d96639738d0180e8cb277682ce23 (patch)
treeffcb15dd536800b67c9918756e41bb4accde3320 /Zotlabs/Module
parente539a9e7bdd035f96d8e8406e3433d34d99435da (diff)
parent11cdc36bcc7414002c2e72fd0c45d285d9515f0c (diff)
downloadvolse-hubzilla-f23c8e7597b6d96639738d0180e8cb277682ce23.tar.gz
volse-hubzilla-f23c8e7597b6d96639738d0180e8cb277682ce23.tar.bz2
volse-hubzilla-f23c8e7597b6d96639738d0180e8cb277682ce23.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Admin/Site.php7
-rw-r--r--Zotlabs/Module/Channel.php1
-rw-r--r--Zotlabs/Module/Cloud_tiles.php17
-rw-r--r--Zotlabs/Module/Display.php1
-rw-r--r--Zotlabs/Module/Magic.php13
-rw-r--r--Zotlabs/Module/Network.php16
-rw-r--r--Zotlabs/Module/Owa.php4
-rw-r--r--Zotlabs/Module/Page.php24
-rw-r--r--Zotlabs/Module/Pdledit.php8
-rw-r--r--Zotlabs/Module/Profile_photo.php10
-rw-r--r--Zotlabs/Module/Pubstream.php20
-rw-r--r--Zotlabs/Module/Search.php1
-rw-r--r--Zotlabs/Module/Settings/Display.php3
-rw-r--r--Zotlabs/Module/Starred.php2
14 files changed, 100 insertions, 27 deletions
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index d3d058c53..2df8b9908 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -61,8 +61,9 @@ class Site {
$maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50);
$feed_contacts = ((x($_POST,'feed_contacts')) ? intval($_POST['feed_contacts']) : 0);
$verify_email = ((x($_POST,'verify_email')) ? 1 : 0);
- $techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0);
- $imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : '');
+ $techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0);
+ $imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : '');
+ $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 300);
$techlevel = null;
if(array_key_exists('techlevel', $_POST))
@@ -128,6 +129,7 @@ class Site {
set_config('system','allowed_sites', $allowed_sites);
set_config('system','publish_all', $force_publish);
set_config('system','disable_discover_tab', $disable_discover_tab);
+ set_config('system','force_queue_threshold', $force_queue);
if ($global_directory == '') {
del_config('system', 'directory_submit_url');
} else {
@@ -318,6 +320,7 @@ class Site {
'$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
'$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
'$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
+ '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',300), t("Always defer immediate delivery if queue contains more than this number of entries.")),
'$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
'$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 14d02d873..7c4c900a1 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -332,6 +332,7 @@ class Channel extends \Zotlabs\Web\Controller {
'$tags' => (($hashtags) ? urlencode($hashtags) : ''),
'$mid' => $mid,
'$verb' => '',
+ '$net' => '',
'$dend' => $datequery,
'$dbegin' => $datequery2
));
diff --git a/Zotlabs/Module/Cloud_tiles.php b/Zotlabs/Module/Cloud_tiles.php
new file mode 100644
index 000000000..45124cdfa
--- /dev/null
+++ b/Zotlabs/Module/Cloud_tiles.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace Zotlabs\Module;
+
+class Cloud_tiles extends \Zotlabs\Web\Controller {
+
+ function init() {
+
+ if(intval($_SESSION['cloud_tiles']))
+ $_SESSION['cloud_tiles'] = 0;
+ else
+ $_SESSION['cloud_tiles'] = 1;
+
+ goaway(z_root() . '/' . hex2bin(argv(1)));
+
+ }
+} \ No newline at end of file
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 785274105..85f08fd08 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -188,6 +188,7 @@ class Display extends \Zotlabs\Web\Controller {
'$dend' => '',
'$dbegin' => '',
'$verb' => '',
+ '$net' => '',
'$mid' => $mid
));
diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php
index 879085f96..9ad9c951c 100644
--- a/Zotlabs/Module/Magic.php
+++ b/Zotlabs/Module/Magic.php
@@ -146,10 +146,17 @@ class Magic extends \Zotlabs\Web\Controller {
if($x['success']) {
$j = json_decode($x['body'],true);
- if($j['success'] && $j['token']) {
- $x = strpbrk($dest,'?&');
- $args = (($x) ? '&owt=' . $j['token'] : '?f=&owt=' . $j['token']) . (($delegate) ? '&delegate=1' : '');
+ if($j['success']) {
+ $token = '';
+ if($j['encrypted_token']) {
+ openssl_private_decrypt(base64url_decode($j['encrypted_token']),$token,$channel['channel_prvkey']);
+ }
+ else {
+ $token = $j['token'];
+ }
+ $x = strpbrk($dest,'?&');
+ $args = (($x) ? '&owt=' . $token : '?f=&owt=' . $token) . (($delegate) ? '&delegate=1' : '');
goaway($dest . $args);
}
}
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index ee736ff42..66032aada 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -119,6 +119,7 @@ class Network extends \Zotlabs\Web\Controller {
$cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99);
$file = ((x($_GET,'file')) ? $_GET['file'] : '');
$xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : '');
+ $net = ((x($_GET,'net')) ? $_GET['net'] : '');
$deftag = '';
@@ -326,7 +327,8 @@ class Network extends \Zotlabs\Web\Controller {
'$tags' => urlencode($hashtags),
'$dend' => $datequery,
'$mid' => '',
- '$verb' => $verb,
+ '$verb' => $verb,
+ '$net' => $net,
'$dbegin' => $datequery2
));
}
@@ -404,7 +406,10 @@ class Network extends \Zotlabs\Web\Controller {
}
-
+
+ $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
+ $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : '');
+
$abook_uids = " and abook.abook_channel = " . local_channel() . " ";
$uids = " and item.uid = " . local_channel() . " ";
@@ -441,10 +446,12 @@ class Network extends \Zotlabs\Web\Controller {
$items = q("SELECT item.*, item.id AS item_id, received FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
+ $net_query
WHERE true $uids $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$simple_update
$sql_extra $sql_nets
+ $net_query2
ORDER BY item.received DESC $pager_sql "
);
@@ -469,10 +476,12 @@ class Network extends \Zotlabs\Web\Controller {
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
+ $net_query
WHERE true $uids $item_normal
AND item.parent = item.id
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra3 $sql_extra $sql_nets
+ $net_query2
ORDER BY $ordering DESC $pager_sql "
);
@@ -482,9 +491,10 @@ class Network extends \Zotlabs\Web\Controller {
// this is an update
$r = q("SELECT item.parent AS item_id FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
+ $net_query
WHERE true $uids $item_normal_update $simple_update
and (abook.abook_blocked = 0 or abook.abook_flags is null)
- $sql_extra3 $sql_extra $sql_nets "
+ $sql_extra3 $sql_extra $sql_nets $net_query2"
);
$_SESSION['loadtime'] = datetime_convert();
}
diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php
index 4b0d855c5..d58fd7a41 100644
--- a/Zotlabs/Module/Owa.php
+++ b/Zotlabs/Module/Owa.php
@@ -41,7 +41,9 @@ class Owa extends \Zotlabs\Web\Controller {
$ret['success'] = true;
$token = random_string(32);
\Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']);
- $ret['token'] = $token;
+ $result = '';
+ openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']);
+ $ret['encrypted_token'] = base64url_encode($result);
}
}
}
diff --git a/Zotlabs/Module/Page.php b/Zotlabs/Module/Page.php
index c142afe77..5fdd32825 100644
--- a/Zotlabs/Module/Page.php
+++ b/Zotlabs/Module/Page.php
@@ -89,22 +89,30 @@ class Page extends \Zotlabs\Web\Controller {
if(! $ignore_language) {
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
- and (( iconfig.k = 'WEBPAGE' and item_type = %d )
- OR ( iconfig.k = 'PDL' AND item_type = %d )) $sql_options $revision limit 1",
+ and iconfig.k = 'WEBPAGE' and item_type = %d
+ $sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($lang_page_id),
- intval(ITEM_TYPE_WEBPAGE),
- intval(ITEM_TYPE_PDL)
+ intval(ITEM_TYPE_WEBPAGE)
+ );
+ }
+ if(! $r) {
+ $r = q("select item.* from item left join iconfig on item.id = iconfig.iid
+ where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
+ and iconfig.k = 'WEBPAGE' and item_type = %d
+ $sql_options $revision limit 1",
+ intval($u[0]['channel_id']),
+ dbesc($page_id),
+ intval(ITEM_TYPE_WEBPAGE)
);
}
if(! $r) {
+ // no webpage by that name, but we do allow you to load/preview a layout using this module. Try that.
$r = q("select item.* from item left join iconfig on item.id = iconfig.iid
where item.uid = %d and iconfig.cat = 'system' and iconfig.v = '%s' and item.item_delayed = 0
- and (( iconfig.k = 'WEBPAGE' and item_type = %d )
- OR ( iconfig.k = 'PDL' AND item_type = %d )) $sql_options $revision limit 1",
+ and iconfig.k = 'PDL' AND item_type = %d $sql_options $revision limit 1",
intval($u[0]['channel_id']),
dbesc($page_id),
- intval(ITEM_TYPE_WEBPAGE),
intval(ITEM_TYPE_PDL)
);
}
@@ -129,7 +137,7 @@ class Page extends \Zotlabs\Web\Controller {
}
return;
}
-
+
if($r[0]['title'])
\App::$page['title'] = escape_tags($r[0]['title']);
diff --git a/Zotlabs/Module/Pdledit.php b/Zotlabs/Module/Pdledit.php
index f8af470ac..9b86b599b 100644
--- a/Zotlabs/Module/Pdledit.php
+++ b/Zotlabs/Module/Pdledit.php
@@ -77,8 +77,10 @@ class Pdledit extends \Zotlabs\Web\Controller {
}
$t = get_pconfig(local_channel(),'system',$module);
- if(! $t)
- $t = file_get_contents(theme_include($module));
+ $s = file_get_contents(theme_include($module));
+ if(! $t) {
+ $t = $s;
+ }
if(! $t) {
notice( t('Layout not found.') . EOL);
return '';
@@ -89,7 +91,9 @@ class Pdledit extends \Zotlabs\Web\Controller {
'$mname' => t('Module Name:'),
'$help' => t('Layout Help'),
'$another' => t('Edit another layout'),
+ '$original' => t('System layout'),
'$module' => argv(1),
+ '$src' => $s,
'$content' => htmlspecialchars($t,ENT_COMPAT,'UTF-8'),
'$submit' => t('Submit')
));
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 27e6bc445..411518c61 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -150,6 +150,14 @@ class Profile_photo extends \Zotlabs\Web\Controller {
// If setting for the default profile, unset the profile photo flag from any other photos I own
if($is_default_profile) {
+
+ $r = q("update profile set photo = '%s', thumb = '%s' where is_default = 1 and uid = %d",
+ dbesc(z_root() . '/photo/profile/l/' . local_channel()),
+ dbesc(z_root() . '/photo/profile/m/' . local_channel()),
+ intval(local_channel())
+ );
+
+
$r = q("UPDATE photo SET photo_usage = %d WHERE photo_usage = %d
AND resource_id != '%s' AND uid = %d",
intval(PHOTO_NORMAL),
@@ -159,8 +167,6 @@ class Profile_photo extends \Zotlabs\Web\Controller {
);
-
-
send_profile_photo_activity($channel,$base_image,$profile);
}
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 15e2d8a74..e83de6bc0 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -31,6 +31,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$item_normal_update = item_normal_update();
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);
+ $net = ((array_key_exists('net',$_REQUEST)) ? escape_tags($_REQUEST['net']) : '');
if(! $update && !$load) {
@@ -81,7 +82,8 @@ class Pubstream extends \Zotlabs\Web\Controller {
'$tags' => '',
'$dend' => '',
'$mid' => $mid,
- '$verb' => '',
+ '$verb' => '',
+ '$net' => $net,
'$dbegin' => ''
));
}
@@ -112,6 +114,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
$page_mode = 'list';
else
$page_mode = 'client';
+
+
+ $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
+ $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : '');
$simple_update = (($update) ? " and item.item_unseen = 1 " : '');
@@ -134,9 +140,10 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($mid) {
$r = q("SELECT parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
+ $net_query
WHERE mid like '%s' $uids $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
- $sql_extra3 $sql_extra $sql_nets LIMIT 1",
+ $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1",
dbesc($mid . '%')
);
}
@@ -144,10 +151,11 @@ class Pubstream extends \Zotlabs\Web\Controller {
// Fetch a page full of parent items for this page
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
left join abook on item.author_xchan = abook.abook_xchan
+ $net_query
WHERE true $uids $item_normal
AND item.parent = item.id
and (abook.abook_blocked = 0 or abook.abook_flags is null)
- $sql_extra3 $sql_extra $sql_nets
+ $sql_extra3 $sql_extra $sql_nets $net_query2
ORDER BY $ordering DESC $pager_sql "
);
}
@@ -156,19 +164,21 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($mid) {
$r = q("SELECT parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
+ $net_query
WHERE mid like '%s' $uids $item_normal_update $simple_update
and (abook.abook_blocked = 0 or abook.abook_flags is null)
- $sql_extra3 $sql_extra $sql_nets LIMIT 1",
+ $sql_extra3 $sql_extra $sql_nets $net_query2 LIMIT 1",
dbesc($mid . '%')
);
}
else {
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
left join abook on item.author_xchan = abook.abook_xchan
+ $net_query
WHERE true $uids $item_normal_update
AND item.parent = item.id $simple_update
and (abook.abook_blocked = 0 or abook.abook_flags is null)
- $sql_extra3 $sql_extra $sql_nets"
+ $sql_extra3 $sql_extra $sql_nets $net_query2"
);
}
$_SESSION['loadtime'] = datetime_convert();
diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index 37e9a336f..7bc3429b1 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -138,6 +138,7 @@ class Search extends \Zotlabs\Web\Controller {
'$tags' => '',
'$mid' => '',
'$verb' => '',
+ '$net' => '',
'$dend' => '',
'$dbegin' => ''
));
diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php
index a444d28a2..e1ea0e3e5 100644
--- a/Zotlabs/Module/Settings/Display.php
+++ b/Zotlabs/Module/Settings/Display.php
@@ -23,6 +23,7 @@ class Display {
$mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
$preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0);
+ $channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0);
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
$title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0);
@@ -63,6 +64,7 @@ class Display {
set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height);
set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update);
+ set_pconfig(local_channel(),'system','channel_menu', $channel_menu);
$newschema = '';
if($theme){
@@ -217,6 +219,7 @@ class Display {
'$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
'$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')),
'$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1-intval($nosmile), '', $yes_no),
+ '$channel_menu' => [ 'channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(),'system','channel_menu',get_config('system','channel_menu',0)), t('Default: channel menu located in app menu'),$yes_no ],
'$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no),
'$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no),
'$layout_editor' => t('System Page Layout Editor - (advanced)'),
diff --git a/Zotlabs/Module/Starred.php b/Zotlabs/Module/Starred.php
index 4f1d99ec6..8349ae25c 100644
--- a/Zotlabs/Module/Starred.php
+++ b/Zotlabs/Module/Starred.php
@@ -16,7 +16,7 @@ class Starred extends \Zotlabs\Web\Controller {
if(! $message_id)
killme();
- $r = q("SELECT item_flags FROM item WHERE uid = %d AND id = %d LIMIT 1",
+ $r = q("SELECT item_starred FROM item WHERE uid = %d AND id = %d LIMIT 1",
intval(local_channel()),
intval($message_id)
);