aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Connections.php17
-rw-r--r--Zotlabs/Module/Display.php18
-rw-r--r--Zotlabs/Module/Sitelist.php48
3 files changed, 46 insertions, 37 deletions
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index 0f674965d..0effcdfc3 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -45,7 +45,7 @@ class Connections extends \Zotlabs\Web\Controller {
$unconnected = false;
$all = false;
- if(! $_REQUEST['aj'])
+ if(!(isset($_REQUEST['aj']) && $_REQUEST['aj']))
$_SESSION['return_url'] = App::$query_string;
$search_flags = "";
@@ -128,7 +128,9 @@ class Connections extends \Zotlabs\Web\Controller {
$unblocked = true;
}
- switch($_REQUEST['order']) {
+ $order = $_REQUEST['order'] ?? '';
+
+ switch($order) {
case 'name_desc':
$sql_order = 'xchan_name DESC';
break;
@@ -227,6 +229,8 @@ class Connections extends \Zotlabs\Web\Controller {
//$t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
$searching = false;
+ $search_hdr = '';
+
if($search) {
$search_hdr = $search;
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
@@ -234,7 +238,7 @@ class Connections extends \Zotlabs\Web\Controller {
}
$sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : "");
- if($_REQUEST['gid']) {
+ if(isset($_REQUEST['gid']) && $_REQUEST['gid']) {
$sql_extra .= " and xchan_hash in ( select xchan from pgrp_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_channel()) . " ) ";
}
@@ -272,14 +276,13 @@ class Connections extends \Zotlabs\Web\Controller {
foreach($r as $rr) {
if($rr['xchan_url']) {
- if(($rr['vcard']) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr'])
+ if((isset($rr['vcard'])) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr'])
$phone = $rr['vcard']['tels'][0]['nr'];
else
$phone = '';
$status_str = '';
$status = array(
- ((intval($rr['abook_active'])) ? t('Active') : ''),
((intval($rr['abook_pending'])) ? t('Pending approval') : ''),
((intval($rr['abook_archived'])) ? t('Archived') : ''),
((intval($rr['abook_hidden'])) ? t('Hidden') : ''),
@@ -356,7 +359,7 @@ class Connections extends \Zotlabs\Web\Controller {
'connect' => (intval($rr['abook_not_here']) ? t('Connect') : ''),
'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=0',
'connect_hover' => t('Connect at this location'),
- 'role' => $roles_dict[$rr['abook_role']],
+ 'role' => $roles_dict[$rr['abook_role']] ?? '',
'pending' => intval($rr['abook_pending'])
);
}
@@ -371,7 +374,7 @@ class Connections extends \Zotlabs\Web\Controller {
$abook_usage_message = '';
}
- if($_REQUEST['aj']) {
+ if(isset($_REQUEST['aj']) && $_REQUEST['aj']) {
if($contacts) {
$o = replace_macros(get_markup_template('contactsajax.tpl'),array(
'$contacts' => $contacts,
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 26d3b9fc2..29d592e19 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -36,7 +36,7 @@ class Display extends \Zotlabs\Web\Controller {
}
}
- if($_REQUEST['mid']) {
+ if(isset($_REQUEST['mid']) && $_REQUEST['mid']) {
$item_hash = $_REQUEST['mid'];
}
@@ -56,6 +56,8 @@ class Display extends \Zotlabs\Web\Controller {
$observer_is_owner = false;
+ $o = '';
+
if(local_channel() && (! $update)) {
$channel = App::get_channel();
@@ -87,7 +89,7 @@ class Display extends \Zotlabs\Web\Controller {
'reset' => t('Reset form')
);
- $o = '<div id="jot-popup">';
+ $o .= '<div id="jot-popup">';
$o .= status_editor($a,$x,false,'Display');
$o .= '</div>';
}
@@ -107,17 +109,21 @@ class Display extends \Zotlabs\Web\Controller {
dbesc($item_hash)
);
- if($r) {
- $target_item = $r[0];
+ if (!$r) {
+ notice( t('Item not found.') . EOL);
+ return '';
}
+ $target_item = $r[0];
+
+ /* not yet ready for prime time
$x = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($target_item['author_xchan'])
);
if($x) {
-// not yet ready for prime time
-// App::$poi = $x[0];
+ App::$poi = $x[0];
}
+ */
//if the item is to be moderated redirect to /moderate
if($target_item['item_blocked'] == ITEM_MODERATED) {
diff --git a/Zotlabs/Module/Sitelist.php b/Zotlabs/Module/Sitelist.php
index 2ac5ed1b8..9908aa651 100644
--- a/Zotlabs/Module/Sitelist.php
+++ b/Zotlabs/Module/Sitelist.php
@@ -5,63 +5,63 @@ namespace Zotlabs\Module; /** @file */
class Sitelist extends \Zotlabs\Web\Controller {
function init() {
-
- $start = (($_REQUEST['start']) ? intval($_REQUEST['start']) : 0);
- $limit = ((intval($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 30);
- $order = (($_REQUEST['order']) ? $_REQUEST['order'] : 'random');
- $open = (($_REQUEST['open']) ? intval($_REQUEST['open']) : false);
-
-
+
+ $start = ((isset($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0);
+ $limit = ((isset($_REQUEST['limit'])) ? intval($_REQUEST['limit']) : 30);
+ $order = ((isset($_REQUEST['order'])) ? $_REQUEST['order'] : 'random');
+ $open = ((isset($_REQUEST['open'])) ? intval($_REQUEST['open']) : false);
+
+
$sql_order = " order by site_url ";
$rand = db_getfunc('rand');
if($order == 'random')
$sql_order = " order by $rand ";
-
+
$sql_limit = " LIMIT $limit OFFSET $start ";
-
+
$sql_extra = "";
if($open)
$sql_extra = " and site_register = " . intval(REGISTER_OPEN) . " ";
-
+
$realm = get_directory_realm();
if($realm == DIRECTORY_REALM) {
$sql_extra .= " and ( site_realm = '" . dbesc($realm) . "' or site_realm = '') ";
}
else
$sql_extra .= " and site_realm = '" . dbesc($realm) . "' ";
-
+
$result = array('success' => false);
-
+
$r = q("select count(site_url) as total from site where site_type = %d and site_dead = 0 $sql_extra ",
intval(SITE_TYPE_ZOT)
);
-
+
if($r)
$result['total'] = intval($r[0]['total']);
-
+
$result['start'] = $start;
- $result['limit'] = $limit;
-
+ $result['limit'] = $limit;
+
$r = q("select * from site where site_type = %d and site_dead = 0 $sql_extra $sql_order $sql_limit",
intval(SITE_TYPE_ZOT)
);
-
+
$result['results'] = 0;
$result['entries'] = array();
-
+
if($r) {
- $result['success'] = true;
+ $result['success'] = true;
$result['results'] = count($r);
-
+
foreach($r as $rr) {
$result['entries'][] = array('url' => $rr['site_url']);
}
-
+
}
-
+
echo json_encode($result);
killme();
-
-
+
+
}
}