diff options
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Acl.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Channel.php | 8 | ||||
-rw-r--r-- | Zotlabs/Module/Connections.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Display.php | 95 | ||||
-rw-r--r-- | Zotlabs/Module/Dreport.php | 6 | ||||
-rw-r--r-- | Zotlabs/Module/Fhublocs.php | 29 | ||||
-rw-r--r-- | Zotlabs/Module/Oep.php | 36 | ||||
-rw-r--r-- | Zotlabs/Module/Pconfig.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Register.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Update.php | 8 |
10 files changed, 99 insertions, 92 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index f8c6232c5..bcd79c873 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -304,7 +304,7 @@ class Acl extends \Zotlabs\Web\Controller { } elseif($type == 'a') { - $r = q("SELECT abook_id as id, xchan_name as name, xchan_network as net, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash + $r = q("SELECT abook_id as id, xchan_name as name, xchan_network as net, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url, xchan_addr as attag, abook_their_perms, abook_self FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and xchan_deleted = 0 $sql_extra3 diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 0874551d6..d3d72ca10 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -31,8 +31,10 @@ class Channel extends Controller { goaway(z_root() . '/search?f=&search=' . $_GET['search']); $which = null; - if (argc() > 1) + if (argc() > 1) { $which = argv(1); + } + if (!$which) { if (local_channel()) { $channel = App::get_channel(); @@ -40,9 +42,9 @@ class Channel extends Controller { $which = $channel['channel_address']; } } + if (!$which) { - notice(t('You must be logged in to see this page.') . EOL); - return; + http_status_exit(404, 'Not found'); } $profile = 0; diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php index 0101bf8a8..ea30b9b9e 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -357,7 +357,7 @@ class Connections extends \Zotlabs\Web\Controller { 'oneway' => $oneway, 'perminfo' => $perminfo, 'connect' => (intval($rr['abook_not_here']) ? t('Connect') : ''), - 'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=0', + 'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=1', 'connect_hover' => t('Connect at this location'), 'role' => $roles_dict[$rr['abook_role']] ?? '', 'pending' => intval($rr['abook_pending']) diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 4e7c1587c..0aac96f4a 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -90,6 +90,7 @@ class Display extends \Zotlabs\Web\Controller { ); $o .= '<div id="jot-popup">'; + $a = ''; $o .= status_editor($a,$x,false,'Display'); $o .= '</div>'; } @@ -307,71 +308,71 @@ class Display extends \Zotlabs\Web\Controller { $items = array(); } - switch($module_format) { - case 'html': + case 'html': - if ($update) { - $o .= conversation($items, 'display', $update, 'client'); - } - else { - $o .= '<noscript>'; - if($noscript_content) { - $o .= conversation($items, 'display', $update, 'traditional'); + if ($update) { + $o .= conversation($items, 'display', $update, 'client'); } else { - $o .= '<div class="section-content-warning-wrapper">' . t('You must enable javascript for your browser to be able to view this content.') . '</div>'; + $o .= '<noscript>'; + if($noscript_content) { + $o .= conversation($items, 'display', $update, 'traditional'); + } + else { + $o .= '<div class="section-content-warning-wrapper">' . t('You must enable javascript for your browser to be able to view this content.') . '</div>'; + } + $o .= '</noscript>'; + + if (isset($items[0]['title'])) { + App::$page['title'] = $items[0]['title'] . ' - ' . App::$page['title']; + } + + $o .= conversation($items, 'display', $update, 'client'); } - $o .= '</noscript>'; - App::$page['title'] = (($items[0]['title']) ? $items[0]['title'] . " - " . App::$page['title'] : App::$page['title']); + break; - $o .= conversation($items, 'display', $update, 'client'); - } + case 'atom': - break; + $atom = replace_macros(get_markup_template('atom_feed.tpl'), array( + '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()), + '$generator' => xmlify(\Zotlabs\Lib\System::get_platform_name()), + '$generator_uri' => 'https://hubzilla.org', + '$feed_id' => xmlify(App::$cmd), + '$feed_title' => xmlify(t('Article')), + '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), + '$author' => '', + '$owner' => '', + '$profile_page' => xmlify(z_root() . '/display/' . gen_link_id($target_item['mid'])), + )); - case 'atom': + $x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ]; + call_hooks('atom_feed_top',$x); - $atom = replace_macros(get_markup_template('atom_feed.tpl'), array( - '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()), - '$generator' => xmlify(\Zotlabs\Lib\System::get_platform_name()), - '$generator_uri' => 'https://hubzilla.org', - '$feed_id' => xmlify(App::$cmd), - '$feed_title' => xmlify(t('Article')), - '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), - '$author' => '', - '$owner' => '', - '$profile_page' => xmlify(z_root() . '/display/' . gen_link_id($target_item['mid'])), - )); + $atom = $x['xml']; - $x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ]; - call_hooks('atom_feed_top',$x); + // a much simpler interface + call_hooks('atom_feed', $atom); - $atom = $x['xml']; - // a much simpler interface - call_hooks('atom_feed', $atom); - - - if($items) { - $type = 'html'; - foreach($items as $item) { - if($item['item_private']) - continue; - $atom .= atom_entry($item, $type, null, '', true, '', false); + if($items) { + $type = 'html'; + foreach($items as $item) { + if($item['item_private']) + continue; + $atom .= atom_entry($item, $type, null, '', true, '', false); + } } - } - - call_hooks('atom_feed_end', $atom); - $atom .= '</feed>' . "\r\n"; + call_hooks('atom_feed_end', $atom); - header('Content-type: application/atom+xml'); - echo $atom; - killme(); + $atom .= '</feed>' . "\r\n"; + header('Content-type: application/atom+xml'); + echo $atom; + killme(); } $o .= '<div id="content-complete"></div>'; diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php index 759e1acb4..f5ad80eef 100644 --- a/Zotlabs/Module/Dreport.php +++ b/Zotlabs/Module/Dreport.php @@ -56,10 +56,12 @@ class Dreport extends \Zotlabs\Web\Controller { return; } - $r = q("select * from dreport where dreport_xchan = '%s' and (dreport_mid = '%s' or dreport_mid = '%s')", + $r = q("select * from dreport where dreport_xchan = '%s' and (dreport_mid = '%s' or dreport_mid = '%s' or dreport_mid = '%s' or dreport_mid = '%s')", dbesc($channel['channel_hash']), dbesc($mid), - dbesc(str_replace('/item/', '/activity/', $mid)) + dbesc($mid . '#sync'), + dbesc(str_replace('/item/', '/activity/', $mid)), + dbesc(str_replace('/item/', '/activity/', $mid) . '#sync') ); if(! $r) { diff --git a/Zotlabs/Module/Fhublocs.php b/Zotlabs/Module/Fhublocs.php index df847c835..a4d335a94 100644 --- a/Zotlabs/Module/Fhublocs.php +++ b/Zotlabs/Module/Fhublocs.php @@ -60,20 +60,21 @@ class Fhublocs extends \Zotlabs\Web\Controller { $h = hubloc_store_lowlevel( [ - 'hubloc_guid' => $rr['channel_guid'], - 'hubloc_guid_sig' => $rr['channel_guid_sig'], - 'hubloc_hash' => $rr['channel_hash'], - 'hubloc_id_url' => channel_url($rr), - 'hubloc_addr' => channel_reddress($rr), - 'hubloc_primary' => intval($primary), - 'hubloc_url' => z_root(), - 'hubloc_url_sig' => Libzot::sign(z_root(), $rr['channel_prvkey']), - 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(), $sitekey), - 'hubloc_host' => \App::get_hostname(), - 'hubloc_callback' => z_root() . '/zot', - 'hubloc_sitekey' => $sitekey, - 'hubloc_network' => 'zot6', - 'hubloc_updated' => datetime_convert() + 'hubloc_guid' => $rr['channel_guid'], + 'hubloc_guid_sig' => $rr['channel_guid_sig'], + 'hubloc_hash' => $rr['channel_hash'], + 'hubloc_id_url' => channel_url($rr), + 'hubloc_addr' => channel_reddress($rr), + 'hubloc_primary' => intval($primary), + 'hubloc_url' => z_root(), + 'hubloc_url_sig' => Libzot::sign(z_root(), $rr['channel_prvkey']), + 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(), $sitekey), + 'hubloc_host' => \App::get_hostname(), + 'hubloc_callback' => z_root() . '/zot', + 'hubloc_sitekey' => $sitekey, + 'hubloc_network' => 'zot6', + 'hubloc_updated' => datetime_convert(), + 'hubloc_connected' => datetime_convert() ] ); diff --git a/Zotlabs/Module/Oep.php b/Zotlabs/Module/Oep.php index 8e048a487..d3ef05e16 100644 --- a/Zotlabs/Module/Oep.php +++ b/Zotlabs/Module/Oep.php @@ -15,7 +15,7 @@ class Oep extends \Zotlabs\Web\Controller { logger('oep: ' . print_r($_REQUEST,true), LOGGER_DEBUG, LOG_INFO); $html = ((argc() > 1 && argv(1) === 'html') ? true : false); - if($_REQUEST['url']) { + if(isset($_REQUEST['url'])) { $_REQUEST['url'] = strip_zids($_REQUEST['url']); $url = $_REQUEST['url']; } @@ -23,9 +23,9 @@ class Oep extends \Zotlabs\Web\Controller { if(! $url) http_status_exit(404, 'Not found'); - $maxwidth = $_REQUEST['maxwidth']; - $maxheight = $_REQUEST['maxheight']; - $format = $_REQUEST['format']; + $maxwidth = $_REQUEST['maxwidth'] ?? 0; + $maxheight = $_REQUEST['maxheight'] ?? 0; + $format = $_REQUEST['format'] ?? ''; if($format && $format !== 'json') http_status_exit(501, 'Not implemented'); @@ -70,8 +70,8 @@ class Oep extends \Zotlabs\Web\Controller { $ret = array(); $url = $args['url']; - $maxwidth = intval($args['maxwidth']); - $maxheight = intval($args['maxheight']); + $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0); + $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0); if(preg_match('#//(.*?)/display/(.*?)(&|\?|$)#',$url,$matches)) { $res = $matches[2]; @@ -159,8 +159,8 @@ class Oep extends \Zotlabs\Web\Controller { $ret = []; $url = $args['url']; - $maxwidth = intval($args['maxwidth']); - $maxheight = intval($args['maxheight']); + $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0); + $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0); if(preg_match('#//(.*?)/cards/(.*?)/(.*?)(&|\?|$)#',$url,$matches)) { $nick = $matches[2]; @@ -246,8 +246,8 @@ class Oep extends \Zotlabs\Web\Controller { $ret = []; $url = $args['url']; - $maxwidth = intval($args['maxwidth']); - $maxheight = intval($args['maxheight']); + $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0); + $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0); if(preg_match('#//(.*?)/articles/(.*?)/(.*?)(&|\?|$)#',$url,$matches)) { $nick = $matches[2]; @@ -333,8 +333,8 @@ class Oep extends \Zotlabs\Web\Controller { $ret = array(); $url = $args['url']; - $maxwidth = intval($args['maxwidth']); - $maxheight = intval($args['maxheight']); + $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0); + $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0); if(preg_match('#//(.*?)/(.*?)/(.*?)/(.*?)mid\=(.*?)(&|$)#',$url,$matches)) { $chn = $matches[3]; @@ -454,8 +454,8 @@ class Oep extends \Zotlabs\Web\Controller { $ret = array(); $url = $args['url']; - $maxwidth = intval($args['maxwidth']); - $maxheight = intval($args['maxheight']); + $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0); + $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0); if(preg_match('|//(.*?)/(.*?)/(.*?)/album/|',$url,$matches)) { $chn = $matches[3]; @@ -519,8 +519,8 @@ class Oep extends \Zotlabs\Web\Controller { $ret = array(); $url = $args['url']; - $maxwidth = intval($args['maxwidth']); - $maxheight = intval($args['maxheight']); + $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0); + $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0); if(preg_match('|//(.*?)/(.*?)/(.*?)$|',$url,$matches)) { $chn = $matches[3]; @@ -582,8 +582,8 @@ class Oep extends \Zotlabs\Web\Controller { $ret = array(); $url = $args['url']; - $maxwidth = intval($args['maxwidth']); - $maxheight = intval($args['maxheight']); + $maxwidth = ((isset($args['maxwidth'])) ? $args['maxwidth'] : 0); + $maxheight = ((isset($args['maxheight'])) ? $args['maxheight'] : 0); if(preg_match('|//(.*?)/(.*?)/(.*?)/image/|',$url,$matches)) { $chn = $matches[3]; diff --git a/Zotlabs/Module/Pconfig.php b/Zotlabs/Module/Pconfig.php index 8a71ab974..106254050 100644 --- a/Zotlabs/Module/Pconfig.php +++ b/Zotlabs/Module/Pconfig.php @@ -13,8 +13,9 @@ class Pconfig extends \Zotlabs\Web\Controller { return; - if($_SESSION['delegate']) + if(isset($_SESSION['delegate'])) { return; + } check_form_security_token_redirectOnErr('/pconfig', 'pconfig'); diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 0d423e0cd..5a50b4de0 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -26,7 +26,7 @@ class Register extends Controller { // created a channel, we'll try to revive the connection request // and process it. - if($_REQUEST['connect']) + if(isset($_REQUEST['connect'])) $_SESSION['connect'] = $_REQUEST['connect']; switch($cmd) { diff --git a/Zotlabs/Module/Update.php b/Zotlabs/Module/Update.php index b3252f8b9..7a8db3469 100644 --- a/Zotlabs/Module/Update.php +++ b/Zotlabs/Module/Update.php @@ -5,8 +5,8 @@ namespace Zotlabs\Module; class Update extends \Zotlabs\Web\Controller { function get() { - - $profile_uid = intval($_GET['p']); + + $profile_uid = $_GET['p'] ?? 0; // it's probably safe to do this for all modules and not just a limited subset, // but it needs to be verified. @@ -23,7 +23,7 @@ class Update extends \Zotlabs\Web\Controller { if(in_array(strtolower(argv(1)),['articles','cards'])) killme(); - $module = "\\Zotlabs\\Module\\" . ucfirst(argv(1)); + $module = "\\Zotlabs\\Module\\" . ucfirst(argv(1)); $load = (((argc() > 2) && (argv(2) == 'load')) ? 1 : 0); $mod = new $module; @@ -38,6 +38,6 @@ class Update extends \Zotlabs\Web\Controller { echo "</section></body></html>\r\n"; killme(); - + } } |