aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Appman.php58
-rw-r--r--Zotlabs/Module/Apps.php3
-rw-r--r--Zotlabs/Module/Blocks.php80
-rw-r--r--Zotlabs/Module/Chat.php3
-rw-r--r--Zotlabs/Module/Chatsvc.php90
-rw-r--r--Zotlabs/Module/Layouts.php24
-rw-r--r--Zotlabs/Module/Menu.php66
-rw-r--r--Zotlabs/Module/Mood.php2
-rw-r--r--Zotlabs/Module/Poke.php4
-rw-r--r--Zotlabs/Module/Pubstream.php7
-rw-r--r--Zotlabs/Module/Rpost.php7
-rw-r--r--Zotlabs/Module/Webpages.php14
-rw-r--r--Zotlabs/Module/Zot_probe.php10
13 files changed, 182 insertions, 186 deletions
diff --git a/Zotlabs/Module/Appman.php b/Zotlabs/Module/Appman.php
index 2ada83c3e..34f5f453d 100644
--- a/Zotlabs/Module/Appman.php
+++ b/Zotlabs/Module/Appman.php
@@ -65,15 +65,15 @@ class Appman extends \Zotlabs\Web\Controller {
}
if (intval($sync[0]['app_system'])) {
- Libsync::build_sync_packet($uid, ['sysapp' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['sysapp' => $sync]);
}
else {
- Libsync::build_sync_packet($uid, ['app' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['app' => $sync]);
}
}
- if(isset($_POST['deleted']) && $_POST['deleted']) {
+ if(isset($_POST['delete']) && $_POST['delete']) {
// Fetch the app for sync before it is deleted (if it is deletable))
$sync = q("SELECT * FROM app WHERE app_channel = %d AND app_id = '%s' LIMIT 1",
@@ -91,18 +91,18 @@ class Appman extends \Zotlabs\Web\Controller {
$sync[0]['app_deleted'] = 1;
if (intval($sync[0]['app_system'])) {
- Libsync::build_sync_packet($uid, ['sysapp' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['sysapp' => $sync]);
}
else {
- Libsync::build_sync_packet($uid, ['app' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['app' => $sync]);
}
}
- if($_POST['edit']) {
+ if(isset($_POST['edit']) && $_POST['edit']) {
return;
}
- if($_POST['feature']) {
+ if(isset($_POST['feature']) && $_POST['feature']) {
Apps::app_feature(local_channel(), $papp, $_POST['feature']);
$sync = q("SELECT * FROM app WHERE app_channel = %d AND app_id = '%s' LIMIT 1",
@@ -111,14 +111,14 @@ class Appman extends \Zotlabs\Web\Controller {
);
if (intval($sync[0]['app_system'])) {
- Libsync::build_sync_packet($uid, ['sysapp' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['sysapp' => $sync]);
}
else {
- Libsync::build_sync_packet($uid, ['app' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['app' => $sync]);
}
}
- if($_POST['pin']) {
+ if(isset($_POST['pin']) && $_POST['pin']) {
Apps::app_feature(local_channel(), $papp, $_POST['pin']);
$sync = q("SELECT * FROM app WHERE app_channel = %d AND app_id = '%s' LIMIT 1",
@@ -127,14 +127,14 @@ class Appman extends \Zotlabs\Web\Controller {
);
if (intval($sync[0]['app_system'])) {
- Libsync::build_sync_packet($uid, ['sysapp' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['sysapp' => $sync]);
}
else {
- Libsync::build_sync_packet($uid, ['app' => $sync]);
+ Libsync::build_sync_packet(local_channel(), ['app' => $sync]);
}
}
- if($_POST['aj']) {
+ if(isset($_POST['aj']) && $_POST['aj']) {
killme();
}
@@ -171,7 +171,7 @@ class Appman extends \Zotlabs\Web\Controller {
$app = null;
$embed = null;
- if($_REQUEST['appid']) {
+ if(isset($_REQUEST['appid']) && $_REQUEST['appid']) {
$r = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
dbesc($_REQUEST['appid']),
dbesc(local_channel())
@@ -200,27 +200,25 @@ class Appman extends \Zotlabs\Web\Controller {
}
return replace_macros(get_markup_template('app_create.tpl'), array(
-
'$banner' => (($app) ? t('Edit App') : t('Create App')),
'$app' => $app,
- '$guid' => (($app) ? $app['app_id'] : ''),
- '$author' => (($app) ? $app['app_author'] : $channel['channel_hash']),
- '$addr' => (($app) ? $app['app_addr'] : $channel['xchan_addr']),
- '$name' => array('name', t('Name of app'),(($app) ? $app['app_name'] : ''), t('Required')),
- '$url' => array('url', t('Location (URL) of app'),(($app) ? $app['app_url'] : ''), t('Required')),
- '$desc' => array('desc', t('Description'),(($app) ? $app['app_desc'] : ''), ''),
- '$photo' => array('photo', t('Photo icon URL'),(($app) ? $app['app_photo'] : ''), t('80 x 80 pixels - optional')),
- '$categories' => array('categories',t('Categories (optional, comma separated list)'),(($app) ? $app['categories'] : ''),''),
- '$version' => array('version', t('Version ID'),(($app) ? $app['app_version'] : ''), ''),
- '$price' => array('price', t('Price of app'),(($app) ? $app['app_price'] : ''), ''),
- '$page' => array('page', t('Location (URL) to purchase app'),(($app) ? $app['app_page'] : ''), ''),
- '$system' => (($app) ? intval($app['app_system']) : 0),
- '$plugin' => (($app) ? $app['app_plugin'] : ''),
- '$requires' => (($app) ? $app['app_requires'] : ''),
+ '$guid' => $app['app_id'] ?? '',
+ '$author' => $app['app_author'] ?? $channel['channel_hash'],
+ '$addr' => $app['app_addr'] ?? $channel['xchan_addr'],
+ '$name' => array('name', t('Name of app'), $app['app_name'] ?? '', t('Required')),
+ '$url' => array('url', t('Location (URL) of app'), $app['app_url'] ?? '', t('Required')),
+ '$desc' => array('desc', t('Description'), $app['app_desc'] ?? '', ''),
+ '$photo' => array('photo', t('Photo icon URL'),$app['app_photo'] ?? '', t('80 x 80 pixels - optional')),
+ '$categories' => array('categories',t('Categories (optional, comma separated list)'), $app['categories'] ?? '',''),
+ '$version' => array('version', t('Version ID'), $app['app_version'] ?? '', ''),
+ '$price' => array('price', t('Price of app'), $app['app_price'] ?? '', ''),
+ '$page' => array('page', t('Location (URL) to purchase app'), $app['app_page'] ?? '', ''),
+ '$system' => $app['app_system'] ?? 0,
+ '$plugin' => $app['app_plugin'] ?? '',
+ '$requires' => $app['app_requires'] ?? '',
'$embed' => $embed,
'$submit' => t('Submit')
));
-
}
}
diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php
index 77d1f2aec..a955d572a 100644
--- a/Zotlabs/Module/Apps.php
+++ b/Zotlabs/Module/Apps.php
@@ -19,7 +19,8 @@ class Apps extends \Zotlabs\Web\Controller {
$_SESSION['return_url'] = \App::$query_string;
- $apps = array();
+ $apps = [];
+ $cat = [];
if(local_channel()) {
Zlib\Apps::import_system_apps();
diff --git a/Zotlabs/Module/Blocks.php b/Zotlabs/Module/Blocks.php
index fde30a6dd..e0de23fdb 100644
--- a/Zotlabs/Module/Blocks.php
+++ b/Zotlabs/Module/Blocks.php
@@ -9,43 +9,43 @@ require_once('include/acl_selectors.php');
class Blocks extends \Zotlabs\Web\Controller {
function init() {
-
+
if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
if($sys && intval($sys['channel_id'])) {
\App::$is_sys = true;
}
}
-
+
if(argc() > 1)
$which = argv(1);
else
return;
-
+
profile_load($which);
-
+
}
-
-
+
+
function get() {
-
+
if(! \App::$profile) {
notice( t('Requested profile is not available.') . EOL );
\App::$error = 404;
return;
}
-
+
$which = argv(1);
-
+
$_SESSION['return_url'] = \App::$query_string;
-
+
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = \App::get_observer();
-
+
$channel = \App::get_channel();
-
+
if(\App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
if($sys && intval($sys['channel_id'])) {
@@ -54,7 +54,7 @@ class Blocks extends \Zotlabs\Web\Controller {
$observer = $sys;
}
}
-
+
if(! $owner) {
// Figure out who the page owner is.
$r = q("select channel_id from channel where channel_address = '%s'",
@@ -64,24 +64,24 @@ class Blocks extends \Zotlabs\Web\Controller {
$owner = intval($r[0]['channel_id']);
}
}
-
+
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
-
+
$perms = get_all_perms($owner,$ob_hash);
-
+
if(! $perms['write_pages']) {
notice( t('Permission denied.') . EOL);
return;
}
-
- // Block design features from visitors
-
+
+ // Block design features from visitors
+
if((! $uid) || ($uid != $owner)) {
notice( t('Permission denied.') . EOL);
return;
}
-
- $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
+
+ $mimetype = ((isset($_REQUEST['mimetype']) && $_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
$x = array(
'webpage' => ITEM_TYPE_BLOCK,
@@ -101,27 +101,25 @@ class Blocks extends \Zotlabs\Web\Controller {
'bbco_autocomplete' => 'bbcode',
'bbcode' => true
);
-
- if($_REQUEST['title'])
- $x['title'] = $_REQUEST['title'];
- if($_REQUEST['body'])
- $x['body'] = $_REQUEST['body'];
- if($_REQUEST['pagetitle'])
- $x['pagetitle'] = $_REQUEST['pagetitle'];
-
+
+ $x['title'] = $_REQUEST['title'] ?? '';
+ $x['body'] = $_REQUEST['body'] ?? '';
+ $x['pagetitle'] = $_REQUEST['pagetitle'] ?? '';
+
+ $a = '';
$editor = status_editor($a,$x,false,'Blocks');
-
- $r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig
+
+ $r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig
left join item on iconfig.iid = item.id
- where uid = %d and iconfig.cat = 'system' and iconfig.k = 'BUILDBLOCK'
+ where uid = %d and iconfig.cat = 'system' and iconfig.k = 'BUILDBLOCK'
and item_type = %d order by item.created desc",
intval($owner),
intval(ITEM_TYPE_BLOCK)
);
-
+
$pages = null;
-
+
if($r) {
$pages = array();
foreach($r as $rr) {
@@ -143,13 +141,13 @@ class Blocks extends \Zotlabs\Web\Controller {
'edited' => $rr['edited'],
'bb_element' => '[element]' . base64url_encode(json_encode($element_arr)) . '[/element]'
);
- }
+ }
}
-
+
//Build the base URL for edit links
- $url = z_root() . '/editblock/' . $which;
-
- $o .= replace_macros(get_markup_template('blocklist.tpl'), array(
+ $url = z_root() . '/editblock/' . $which;
+
+ $o = replace_macros(get_markup_template('blocklist.tpl'), array(
'$baseurl' => $url,
'$title' => t('Blocks'),
'$name' => t('Block Name'),
@@ -166,8 +164,8 @@ class Blocks extends \Zotlabs\Web\Controller {
'$view' => t('View'),
'$preview' => '1',
));
-
+
return $o;
}
-
+
}
diff --git a/Zotlabs/Module/Chat.php b/Zotlabs/Module/Chat.php
index 323471161..efe098739 100644
--- a/Zotlabs/Module/Chat.php
+++ b/Zotlabs/Module/Chat.php
@@ -174,7 +174,8 @@ class Chat extends Controller {
$x = Chatroom::enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']);
if(! $x)
return;
- $x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1",
+
+ $x = q("select * from chatroom where cr_id = %d and cr_uid = %d limit 1",
intval($room_id),
intval(App::$profile['profile_uid'])
);
diff --git a/Zotlabs/Module/Chatsvc.php b/Zotlabs/Module/Chatsvc.php
index d6708d95c..2f2784fc4 100644
--- a/Zotlabs/Module/Chatsvc.php
+++ b/Zotlabs/Module/Chatsvc.php
@@ -1,6 +1,6 @@
<?php /** @file */
-namespace Zotlabs\Module;
+namespace Zotlabs\Module;
require_once('include/security.php');
@@ -9,76 +9,76 @@ use \Zotlabs\Lib as Zlib;
class Chatsvc extends \Zotlabs\Web\Controller {
function init() {
-
+
//logger('chatsvc');
-
+
$ret = array('success' => false);
-
+
\App::$data['chat']['room_id'] = intval($_REQUEST['room_id']);
$x = q("select cr_uid from chatroom where cr_id = %d and cr_id != 0 limit 1",
intval(\App::$data['chat']['room_id'])
);
if(! $x)
json_return_and_die($ret);
-
+
\App::$data['chat']['uid'] = $x[0]['cr_uid'];
-
+
if(! perm_is_allowed(\App::$data['chat']['uid'],get_observer_hash(),'chat')) {
json_return_and_die($ret);
}
-
+
}
-
+
function post() {
-
+
$ret = array('success' => false);
-
+
$room_id = \App::$data['chat']['room_id'];
$text = escape_tags($_REQUEST['chat_text']);
if(! $text)
return;
-
+
$sql_extra = permissions_sql(\App::$data['chat']['uid']);
-
+
$r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra",
intval(\App::$data['chat']['uid']),
intval(\App::$data['chat']['room_id'])
);
if(! $r)
json_return_and_die($ret);
-
+
$arr = array(
'chat_room' => \App::$data['chat']['room_id'],
'chat_xchan' => get_observer_hash(),
'chat_text' => $text
);
-
+
call_hooks('chat_post',$arr);
-
+
$x = q("insert into chat ( chat_room, chat_xchan, created, chat_text )
values( %d, '%s', '%s', '%s' )",
intval(\App::$data['chat']['room_id']),
dbesc(get_observer_hash()),
dbesc(datetime_convert()),
- dbesc(str_rot47(base64url_encode($arr['chat_text'])))
+ dbesc(str_rot47(base64url_encode($arr['chat_text'])))
);
-
+
$ret['success'] = true;
json_return_and_die($ret);
}
-
+
function get() {
-
- $status = strip_tags($_REQUEST['status']);
+
+ $status = ((isset($_REQUEST['status'])) ? strip_tags($_REQUEST['status']) : '');
$room_id = intval(\App::$data['chat']['room_id']);
$stopped = ((x($_REQUEST,'stopped') && intval($_REQUEST['stopped'])) ? true : false);
-
+
if($status && $room_id) {
-
+
$x = q("select channel_address from channel where channel_id = %d limit 1",
intval(\App::$data['chat']['uid'])
- );
-
+ );
+
$r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'",
dbesc($status),
dbesc(datetime_convert()),
@@ -86,27 +86,27 @@ class Chatsvc extends \Zotlabs\Web\Controller {
dbesc(get_observer_hash()),
dbesc($_SERVER['REMOTE_ADDR'])
);
-
- goaway(z_root() . '/chat/' . $x[0]['channel_address'] . '/' . $room_id);
+
+ goaway(z_root() . '/chat/' . $x[0]['channel_address'] . '/' . $room_id);
}
-
+
if(! $stopped) {
-
+
$lastseen = intval($_REQUEST['last']);
-
+
$ret = array('success' => false);
-
+
$sql_extra = permissions_sql(\App::$data['chat']['uid']);
-
+
$r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra",
intval(\App::$data['chat']['uid']),
intval(\App::$data['chat']['room_id'])
);
if(! $r)
json_return_and_die($ret);
-
+
$inroom = array();
-
+
$r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name",
intval(\App::$data['chat']['room_id'])
);
@@ -120,9 +120,9 @@ class Chatsvc extends \Zotlabs\Web\Controller {
$rv['xchan_url'] = z_root();
$rv['xchan_hidden'] = 1;
$rv['xchan_photo_mimetype'] = 'image/png';
- $rv['xchan_photo_l'] = z_root() . '/' . get_default_profile_photo(300);
- $rv['xchan_photo_m'] = z_root() . '/' . get_default_profile_photo(80);
- $rv['xchan_photo_s'] = z_root() . '/' . get_default_profile_photo(48);
+ $rv['xchan_photo_l'] = z_root() . '/' . get_default_profile_photo(300);
+ $rv['xchan_photo_m'] = z_root() . '/' . get_default_profile_photo(80);
+ $rv['xchan_photo_s'] = z_root() . '/' . get_default_profile_photo(48);
}
@@ -137,13 +137,13 @@ class Chatsvc extends \Zotlabs\Web\Controller {
$status_class = 'online';
break;
}
-
+
$inroom[] = array('img' => zid($rv['xchan_photo_m']), 'img_type' => $rv['xchan_photo_mimetype'],'name' => $rv['xchan_name'], 'status' => $status, 'status_class' => $status_class);
}
}
-
+
$chats = array();
-
+
$r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created",
intval(\App::$data['chat']['room_id']),
intval($lastseen)
@@ -152,7 +152,7 @@ class Chatsvc extends \Zotlabs\Web\Controller {
foreach($r as $rr) {
$chats[] = array(
'id' => $rr['chat_id'],
- 'img' => zid($rr['xchan_photo_m']),
+ 'img' => zid($rr['xchan_photo_m']),
'img_type' => $rr['xchan_photo_mimetype'],
'name' => $rr['xchan_name'],
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'),
@@ -163,22 +163,22 @@ class Chatsvc extends \Zotlabs\Web\Controller {
}
}
}
-
+
$r = q("update chatpresence set cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'",
dbesc(datetime_convert()),
intval(\App::$data['chat']['room_id']),
dbesc(get_observer_hash()),
dbesc($_SERVER['REMOTE_ADDR'])
);
-
+
$ret['success'] = true;
if(! $stopped) {
$ret['inroom'] = $inroom;
$ret['chats'] = $chats;
}
json_return_and_die($ret);
-
+
}
-
-
+
+
}
diff --git a/Zotlabs/Module/Layouts.php b/Zotlabs/Module/Layouts.php
index 25e27d226..949f8e8ec 100644
--- a/Zotlabs/Module/Layouts.php
+++ b/Zotlabs/Module/Layouts.php
@@ -72,7 +72,7 @@ class Layouts extends \Zotlabs\Web\Controller {
return;
}
- // Block design features from visitors
+ // Block design features from visitors
if((! $uid) || ($uid != $owner)) {
notice( t('Permission denied.') . EOL);
@@ -95,8 +95,8 @@ class Layouts extends \Zotlabs\Web\Controller {
// Use the buildin share/install feature instead.
if((argc() > 3) && (argv(2) === 'share') && (argv(3))) {
- $r = q("select iconfig.v, iconfig.k, mimetype, title, body from iconfig
- left join item on item.id = iconfig.iid
+ $r = q("select iconfig.v, iconfig.k, mimetype, title, body from iconfig
+ left join item on item.id = iconfig.iid
where uid = %d and mid = '%s' and iconfig.cat = 'system' and iconfig.k = 'PDL' order by iconfig.v asc",
intval($owner),
dbesc(argv(3))
@@ -110,7 +110,7 @@ class Layouts extends \Zotlabs\Web\Controller {
}
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
- // Nickname is set to the observers xchan, and profile_uid to the owners.
+ // Nickname is set to the observers xchan, and profile_uid to the owners.
// This lets you post pages at other people's channels.
$x = array(
@@ -134,16 +134,14 @@ class Layouts extends \Zotlabs\Web\Controller {
'bbco_autocomplete' => 'comanche'
);
- if($_REQUEST['title'])
- $x['title'] = $_REQUEST['title'];
- if($_REQUEST['body'])
- $x['body'] = $_REQUEST['body'];
- if($_REQUEST['pagetitle'])
- $x['pagetitle'] = $_REQUEST['pagetitle'];
+ $x['title'] = $_REQUEST['title'] ?? '';
+ $x['body'] = $_REQUEST['body'] ?? '';
+ $x['pagetitle'] = $_REQUEST['pagetitle'] ?? '';
+ $a = '';
$editor = status_editor($a,$x,false,'Layouts');
- $r = q("select iconfig.iid, iconfig.v, mid, title, body, mimetype, created, edited, item_type from iconfig
+ $r = q("select iconfig.iid, iconfig.v, mid, title, body, mimetype, created, edited, item_type from iconfig
left join item on iconfig.iid = item.id
where uid = %d and iconfig.cat = 'system' and iconfig.k = 'PDL' and item_type = %d order by item.created desc",
intval($owner),
@@ -178,9 +176,9 @@ class Layouts extends \Zotlabs\Web\Controller {
}
//Build the base URL for edit links
- $url = z_root() . '/editlayout/' . $which;
+ $url = z_root() . '/editlayout/' . $which;
- $o .= replace_macros(get_markup_template('layoutlist.tpl'), array(
+ $o = replace_macros(get_markup_template('layoutlist.tpl'), array(
'$title' => t('Layouts'),
'$create' => t('Create'),
'$help' => array('text' => t('Help'), 'url' => 'help/comanche', 'title' => t('Comanche page description language help')),
diff --git a/Zotlabs/Module/Menu.php b/Zotlabs/Module/Menu.php
index 836f6a1d5..4f79b66d1 100644
--- a/Zotlabs/Module/Menu.php
+++ b/Zotlabs/Module/Menu.php
@@ -26,9 +26,9 @@ class Menu extends \Zotlabs\Web\Controller {
}
-
+
function post() {
-
+
if(! \App::$profile) {
return;
}
@@ -37,23 +37,23 @@ class Menu extends \Zotlabs\Web\Controller {
$uid = \App::$profile['channel_id'];
-
+
if(array_key_exists('sys', $_REQUEST) && $_REQUEST['sys'] && is_site_admin()) {
$sys = get_sys_channel();
$uid = intval($sys['channel_id']);
\App::$is_sys = true;
}
-
+
if(! $uid)
return;
-
+
$_REQUEST['menu_channel_id'] = $uid;
-
+
if($_REQUEST['menu_bookmark'])
$_REQUEST['menu_flags'] |= MENU_BOOKMARK;
if($_REQUEST['menu_system'])
$_REQUEST['menu_flags'] |= MENU_SYSTEM;
-
+
$menu_id = ((argc() > 2) ? intval(argv(2)) : 0);
if($menu_id) {
@@ -62,7 +62,7 @@ class Menu extends \Zotlabs\Web\Controller {
if($r) {
menu_sync_packet($uid,get_observer_hash(),$menu_id);
//info( t('Menu updated.') . EOL);
- goaway(z_root() . '/mitem/' . $which . '/' . $menu_id . ((\App::$is_sys) ? '?f=&sys=1' : ''));
+ goaway(z_root() . '/mitem/' . $which . '/' . $menu_id . ((\App::$is_sys) ? '?f=&sys=1' : ''));
}
else
notice( t('Unable to update menu.'). EOL);
@@ -71,21 +71,21 @@ class Menu extends \Zotlabs\Web\Controller {
$r = menu_create($_REQUEST);
if($r) {
menu_sync_packet($uid,get_observer_hash(),$r);
-
+
//info( t('Menu created.') . EOL);
- goaway(z_root() . '/mitem/' . $which . '/' . $r . ((\App::$is_sys) ? '?f=&sys=1' : ''));
+ goaway(z_root() . '/mitem/' . $which . '/' . $r . ((\App::$is_sys) ? '?f=&sys=1' : ''));
}
else
notice( t('Unable to create menu.'). EOL);
-
+
}
}
-
-
-
-
+
+
+
+
function get() {
-
+
if(! \App::$profile) {
@@ -101,8 +101,8 @@ class Menu extends \Zotlabs\Web\Controller {
$uid = local_channel();
$owner = 0;
$channel = null;
+ $sys = [];
$observer = \App::get_observer();
-
$channel = \App::get_channel();
if(\App::$is_sys && is_site_admin()) {
@@ -143,9 +143,9 @@ class Menu extends \Zotlabs\Web\Controller {
}
if(argc() == 2) {
-
+
$channel = (($sys) ? $sys : channelx_by_n($owner));
-
+
// list menus
$x = menu_list($owner);
if($x) {
@@ -156,7 +156,7 @@ class Menu extends \Zotlabs\Web\Controller {
$x[$y]['bookmark'] = (($x[$y]['menu_flags'] & MENU_BOOKMARK) ? true : false);
}
}
-
+
$create = replace_macros(get_markup_template('menuedit.tpl'), array(
'$menu_name' => array('menu_name', t('Menu Name'), '', t('Unique name (not visible on webpage) - required'), '*'),
'$menu_desc' => array('menu_desc', t('Menu Title'), '', t('Visible on webpage - leave empty for no title'), ''),
@@ -166,7 +166,7 @@ class Menu extends \Zotlabs\Web\Controller {
'$nick' => $which,
'$display' => 'none'
));
-
+
$o = replace_macros(get_markup_template('menulist.tpl'),array(
'$title' => t('Menus'),
'$create' => $create,
@@ -186,30 +186,30 @@ class Menu extends \Zotlabs\Web\Controller {
'$nick' => $which,
'$sys' => \App::$is_sys
));
-
+
return $o;
-
+
}
-
+
if(argc() > 2) {
if(intval(argv(2))) {
-
+
if(argc() == 4 && argv(3) == 'drop') {
menu_sync_packet($owner,get_observer_hash(),intval(argv(1)),true);
$r = menu_delete_id(intval(argv(2)),$owner);
if(!$r)
notice( t('Menu could not be deleted.'). EOL);
-
+
goaway(z_root() . '/menu/' . $which . ((\App::$is_sys) ? '?f=&sys=1' : ''));
}
-
+
$m = menu_fetch_id(intval(argv(2)),$owner);
-
+
if(! $m) {
notice( t('Menu not found.') . EOL);
return '';
}
-
+
$o = replace_macros(get_markup_template('menuedit.tpl'), array(
'$header' => t('Edit Menu'),
'$sys' => \App::$is_sys,
@@ -224,16 +224,16 @@ class Menu extends \Zotlabs\Web\Controller {
'$nick' => $which,
'$submit' => t('Submit and proceed')
));
-
+
return $o;
-
+
}
else {
notice( t('Not found.') . EOL);
return;
}
}
-
+
}
-
+
}
diff --git a/Zotlabs/Module/Mood.php b/Zotlabs/Module/Mood.php
index cb2ca566b..edd3f0e1a 100644
--- a/Zotlabs/Module/Mood.php
+++ b/Zotlabs/Module/Mood.php
@@ -24,7 +24,7 @@ class Mood extends Controller {
$uid = local_channel();
$channel = App::get_channel();
- $verb = notags(trim($_GET['verb']));
+ $verb = ((isset($_GET['verb'])) ? notags(trim($_GET['verb'])) : '');
if(! $verb)
return;
diff --git a/Zotlabs/Module/Poke.php b/Zotlabs/Module/Poke.php
index c46896e52..30585bf3d 100644
--- a/Zotlabs/Module/Poke.php
+++ b/Zotlabs/Module/Poke.php
@@ -37,7 +37,7 @@ class Poke extends Controller {
$uid = local_channel();
$channel = App::get_channel();
- $verb = notags(trim($_REQUEST['verb']));
+ $verb = ((isset($_GET['verb'])) ? notags(trim($_GET['verb'])) : '');
if(! $verb)
return;
@@ -154,7 +154,7 @@ class Poke extends Controller {
$name = '';
$id = '';
- if(intval($_REQUEST['c'])) {
+ if(isset($_REQUEST['c']) && intval($_REQUEST['c'])) {
$r = q("select abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash
where abook_id = %d and abook_channel = %d limit 1",
intval($_REQUEST['c']),
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 1eb0e2142..3c8dfa0a5 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -159,11 +159,13 @@ class Pubstream extends \Zotlabs\Web\Controller {
require_once('include/channel.php');
require_once('include/security.php');
+ $sys = get_sys_channel();
+ $abook_uids = " and abook.abook_channel = " . intval($sys['channel_id']) . " ";
+
if($site_firehose) {
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
}
else {
- $sys = get_sys_channel();
$uids = " and item.uid = " . intval($sys['channel_id']) . " ";
$sql_extra = item_permissions_sql($sys['channel_id']);
\App::$data['firehose'] = intval($sys['channel_id']);
@@ -182,7 +184,6 @@ class Pubstream 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)) . "' " : '');
- $simple_update = '';
if($update && $_SESSION['loadtime'])
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
@@ -208,7 +209,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
else {
// Fetch a page full of parent items for this page
$r = dbq("SELECT item.id AS item_id FROM item
- left join abook on ( item.author_xchan = abook.abook_xchan )
+ left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
$net_query
WHERE true $uids and item.item_thread_top = 1 $item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php
index 534f29b7b..7b84339b1 100644
--- a/Zotlabs/Module/Rpost.php
+++ b/Zotlabs/Module/Rpost.php
@@ -201,9 +201,9 @@ class Rpost extends \Zotlabs\Web\Controller {
'bang' => '',
'visitor' => true,
'profile_uid' => local_channel(),
- 'title' => $_REQUEST['title'],
- 'body' => $_REQUEST['body'],
- 'attachment' => $_REQUEST['attachment'],
+ 'title' => $_REQUEST['title'] ?? '',
+ 'body' => $_REQUEST['body'] ?? '',
+ 'attachment' => $_REQUEST['attachment'] ?? '',
'source' => ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : ''),
'return_path' => 'rpost/return',
'bbco_autocomplete' => 'bbcode',
@@ -212,6 +212,7 @@ class Rpost extends \Zotlabs\Web\Controller {
'jotnets' => true
);
+ $a = '';
$editor = status_editor($a,$x,false,'Rpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index bc47484be..b58c23b34 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -132,9 +132,9 @@ class Webpages extends Controller {
return;
}
- $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
+ $mimetype = ((isset($_REQUEST['mimetype']) && $_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
- $layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout'));
+ $layout = ((isset($_REQUEST['layout']) && $_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout'));
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
// Nickname is set to the observers xchan, and profile_uid to the owner's.
@@ -182,12 +182,9 @@ class Webpages extends Controller {
'bbcode' => true
);
- if($_REQUEST['title'])
- $x['title'] = $_REQUEST['title'];
- if($_REQUEST['body'])
- $x['body'] = $_REQUEST['body'];
- if($_REQUEST['pagetitle'])
- $x['pagetitle'] = $_REQUEST['pagetitle'];
+ $x['title'] = $_REQUEST['title'] ?? '';
+ $x['body'] = $_REQUEST['body'] ?? '';
+ $x['pagetitle'] = $_REQUEST['pagetitle'] ?? '';
// Get a list of webpages. We can't display all them because endless scroll makes that unusable,
@@ -206,6 +203,7 @@ class Webpages extends Controller {
if(! $r)
$x['pagetitle'] = 'home';
+ $a = '';
$editor = status_editor($a,$x,false,'Webpages');
$pages = null;
diff --git a/Zotlabs/Module/Zot_probe.php b/Zotlabs/Module/Zot_probe.php
index bdd9506eb..3eaabdd92 100644
--- a/Zotlabs/Module/Zot_probe.php
+++ b/Zotlabs/Module/Zot_probe.php
@@ -9,17 +9,17 @@ class Zot_probe extends \Zotlabs\Web\Controller {
function get() {
- $o .= '<h3>Zot6 Probe Diagnostic</h3>';
+ $addr = $_GET['addr'] ?? '';
+
+ $o = '<h3>Zot6 Probe Diagnostic</h3>';
$o .= '<form action="zot_probe" method="get">';
- $o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" /><br>';
+ $o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $addr .'" /><br>';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />';
- if(x($_GET,'addr')) {
- $addr = $_GET['addr'];
-
+ if($addr) {
$x = Zotfinger::exec($addr);