aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Apps.php5
-rw-r--r--Zotlabs/Module/Connedit.php2
-rw-r--r--Zotlabs/Module/Feed.php9
-rw-r--r--Zotlabs/Module/Network.php18
-rw-r--r--Zotlabs/Module/Ofeed.php9
-rw-r--r--Zotlabs/Module/Profile_photo.php7
-rw-r--r--Zotlabs/Module/Settings/Featured.php24
7 files changed, 44 insertions, 30 deletions
diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php
index 2f61f2932..c672ea467 100644
--- a/Zotlabs/Module/Apps.php
+++ b/Zotlabs/Module/Apps.php
@@ -22,7 +22,8 @@ class Apps extends \Zotlabs\Web\Controller {
if(local_channel()) {
Zlib\Apps::import_system_apps();
$syslist = array();
- $list = Zlib\Apps::app_list(local_channel(), (($mode == 'edit') ? true : false), $_GET['cat']);
+ $cat = ((array_key_exists('cat',$_GET) && $_GET['cat']) ? [ escape_tags($_GET['cat']) ] : '');
+ $list = Zlib\Apps::app_list(local_channel(), (($mode == 'edit') ? true : false), $cat);
if($list) {
foreach($list as $x) {
$syslist[] = Zlib\Apps::app_encode($x);
@@ -43,7 +44,7 @@ class Apps extends \Zotlabs\Web\Controller {
return replace_macros(get_markup_template('myapps.tpl'), array(
'$sitename' => get_config('system','sitename'),
- '$cat' => ((array_key_exists('cat',$_GET) && $_GET['cat']) ? escape_tags($_GET['cat']) : ''),
+ '$cat' => $cat,
'$title' => t('Apps'),
'$apps' => $apps,
'$authed' => ((local_channel()) ? true : false),
diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php
index 23c5282e3..e0511b0d3 100644
--- a/Zotlabs/Module/Connedit.php
+++ b/Zotlabs/Module/Connedit.php
@@ -567,7 +567,7 @@ class Connedit extends \Zotlabs\Web\Controller {
$contact_id = \App::$poi['abook_id'];
$contact = \App::$poi;
- $cn = q("SELECT abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 order by xchan_name",
+ $cn = q("SELECT abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and xchan_deleted = 0 order by xchan_name",
intval(local_channel())
);
diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php
index 06637b6d2..36869abbe 100644
--- a/Zotlabs/Module/Feed.php
+++ b/Zotlabs/Module/Feed.php
@@ -16,12 +16,15 @@ class Feed extends \Zotlabs\Web\Controller {
$params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml');
$params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0);
$params['top'] = ((x($_REQUEST,'top')) ? intval($_REQUEST['top']) : 0);
- $params['start'] = ((x($params,'start')) ? intval($params['start']) : 0);
- $params['records'] = ((x($params,'records')) ? intval($params['records']) : 40);
- $params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc');
+ $params['start'] = ((x($_REQUEST,'start')) ? intval($_REQUEST['start']) : 0);
+ $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 40);
+ $params['direction'] = ((x($_REQUEST,'direction')) ? dbesc($_REQUEST['direction']) : 'desc');
$params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : '');
$params['compat'] = ((x($_REQUEST,'compat')) ? intval($_REQUEST['compat']) : 0);
+ if(! in_array($params['direction'],['asc','desc'])) {
+ $params['direction'] = 'desc';
+ }
if(argc() > 1) {
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 4deb7c9e8..551303984 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -35,9 +35,12 @@ class Network extends \Zotlabs\Web\Controller {
return login(false);
}
- if($load)
+ $o = '';
+
+ if($load) {
$_SESSION['loadtime'] = datetime_convert();
-
+ }
+
$arr = array('query' => \App::$query_string);
call_hooks('network_content_init', $arr);
@@ -104,8 +107,10 @@ class Network extends \Zotlabs\Web\Controller {
$def_acl = array('allow_gid' => '<' . $r[0]['hash'] . '>');
}
- $o = '';
+ $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0);
+ $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
+
// if no tabs are selected, defaults to comments
@@ -115,8 +120,8 @@ class Network extends \Zotlabs\Web\Controller {
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
$spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0);
- $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : 0);
- $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99);
+ $cmin = ((array_key_exists('cmin',$_GET)) ? intval($_GET['cmin']) : $default_cmin);
+ $cmax = ((array_key_exists('cmax',$_GET)) ? intval($_GET['cmax']) : $default_cmax);
$file = ((x($_GET,'file')) ? $_GET['file'] : '');
$xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : '');
$net = ((x($_GET,'net')) ? $_GET['net'] : '');
@@ -404,7 +409,6 @@ class Network extends \Zotlabs\Web\Controller {
if($cmax == 99)
$sql_nets .= " OR abook.abook_closeness IS NULL ) ";
-
}
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
@@ -473,7 +477,6 @@ class Network extends \Zotlabs\Web\Controller {
if($load) {
// 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.owner_xchan = abook.abook_xchan $abook_uids )
$net_query
@@ -484,7 +487,6 @@ class Network extends \Zotlabs\Web\Controller {
$net_query2
ORDER BY $ordering DESC $pager_sql "
);
-
}
else {
diff --git a/Zotlabs/Module/Ofeed.php b/Zotlabs/Module/Ofeed.php
index 58488d4af..d18a43ae5 100644
--- a/Zotlabs/Module/Ofeed.php
+++ b/Zotlabs/Module/Ofeed.php
@@ -17,12 +17,15 @@ class Ofeed extends \Zotlabs\Web\Controller {
$params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml');
$params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0);
$params['top'] = ((x($_REQUEST,'top')) ? intval($_REQUEST['top']) : 0);
- $params['start'] = ((x($params,'start')) ? intval($params['start']) : 0);
- $params['records'] = ((x($params,'records')) ? intval($params['records']) : 10);
- $params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc');
+ $params['start'] = ((x($_REQUEST,'start')) ? intval($_REQUEST['start']) : 0);
+ $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 10);
+ $params['direction'] = ((x($_REQUEST,'direction')) ? dbesc($_REQUEST['direction']) : 'desc');
$params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : '');
$params['compat'] = ((x($_REQUEST,'compat')) ? intval($_REQUEST['compat']) : 1);
+ if(! in_array($params['direction'],['asc','desc'])) {
+ $params['direction'] = 'desc';
+ }
if(argc() > 1) {
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index 411518c61..45a606d5f 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -179,7 +179,10 @@ class Profile_photo extends \Zotlabs\Web\Controller {
);
}
- profiles_build_sync(local_channel());
+ // set $send to false in profiles_build_sync() to return the data
+ // so that we only send one sync packet.
+
+ $sync_profiles = profiles_build_sync(local_channel(),false);
// We'll set the updated profile-photo timestamp even if it isn't the default profile,
// so that browsers will do a cache update unconditionally
@@ -201,7 +204,7 @@ class Profile_photo extends \Zotlabs\Web\Controller {
$sync = attach_export_data($channel,$base_image['resource_id']);
if($sync)
- build_sync_packet($channel['channel_id'],array('file' => array($sync)));
+ build_sync_packet($channel['channel_id'],array('file' => array($sync), 'profile' => $sync_profiles));
// Similarly, tell the nav bar to bypass the cache and update the avatar image.
diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php
index ebe2996d3..9c5a7b16c 100644
--- a/Zotlabs/Module/Settings/Featured.php
+++ b/Zotlabs/Module/Settings/Featured.php
@@ -11,15 +11,17 @@ class Featured {
call_hooks('feature_settings_post', $_POST);
if($_POST['affinity_slider-submit']) {
- if(intval($_POST['affinity_cmax'])) {
- set_pconfig(local_channel(),'affinity','cmax',intval($_POST['affinity_cmax']));
- }
- if(intval($_POST['affinity_cmin'])) {
- set_pconfig(local_channel(),'affinity','cmin',intval($_POST['affinity_cmin']));
- }
- if(intval($_POST['affinity_cmax']) || intval($_POST['affinity_cmin'])) {
- info( t('Affinity Slider settings updated.') . EOL);
- }
+ $cmax = intval($_POST['affinity_cmax']);
+ if($cmax < 0 || $cmax > 99)
+ $cmax = 99;
+ $cmin = intval($_POST['affinity_cmin']);
+ if($cmin < 0 || $cmin > 99)
+ $cmin = 0;
+ set_pconfig(local_channel(),'affinity','cmin',$cmin);
+ set_pconfig(local_channel(),'affinity','cmax',$cmax);
+
+ info( t('Affinity Slider settings updated.') . EOL);
+
}
build_sync_packet();
@@ -40,12 +42,12 @@ class Featured {
$cmax = intval(get_pconfig(local_channel(),'affinity','cmax'));
$cmax = (($cmax) ? $cmax : 99);
$setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array(
- '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, '')
+ '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, t('0-99 default 99'))
));
$cmin = intval(get_pconfig(local_channel(),'affinity','cmin'));
$cmin = (($cmin) ? $cmin : 0);
$setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array(
- '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, '')
+ '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, t('0-99 - default 0'))
));
$settings_addons .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array(