aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Chanview.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-12-23 10:09:46 +0100
committerMario Vavti <mario@mariovavti.com>2016-12-23 10:09:46 +0100
commit3b9b03cf86979b28e7fa249133176bed84b0105c (patch)
tree336dc8b8b9627e7f4a93e5c35fe3e98555274616 /Zotlabs/Module/Chanview.php
parent2e5a993f880d619aedf3693927e7b3e164fbfcc0 (diff)
parentef39c1e94b5149a3019d417d08dc7c16c8aef9c1 (diff)
downloadvolse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.tar.gz
volse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.tar.bz2
volse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.zip
Merge branch '2.0RC'
Diffstat (limited to 'Zotlabs/Module/Chanview.php')
-rw-r--r--Zotlabs/Module/Chanview.php76
1 files changed, 56 insertions, 20 deletions
diff --git a/Zotlabs/Module/Chanview.php b/Zotlabs/Module/Chanview.php
index c6dd07eb7..01ee74d5a 100644
--- a/Zotlabs/Module/Chanview.php
+++ b/Zotlabs/Module/Chanview.php
@@ -58,7 +58,9 @@ class Chanview extends \Zotlabs\Web\Controller {
}
logger('mod_chanview: constructed address ' . print_r($matches,true));
}
-
+
+ $r = null;
+
if($_REQUEST['address']) {
$j = \Zotlabs\Zot\Finger::run($_REQUEST['address'],null);
if($j['success']) {
@@ -66,40 +68,74 @@ class Chanview extends \Zotlabs\Web\Controller {
$r = q("select * from xchan where xchan_addr = '%s' limit 1",
dbesc($_REQUEST['address'])
);
- if($r)
+ if($r) {
\App::$poi = $r[0];
+ }
+ }
+ if(! $r) {
+ if(discover_by_webbie($_REQUEST['address'])) {
+ $r = q("select * from xchan where xchan_addr = '%s' limit 1",
+ dbesc($_REQUEST['address'])
+ );
+ if($r) {
+ \App::$poi = $r[0];
+ }
+ }
}
}
}
if(! \App::$poi) {
- // We don't know who this is, and we can't figure it out from the URL
- // On the plus side, there's a good chance we know somebody else at that
- // hub so sending them there with a Zid will probably work anyway.
+
+ // We don't know who this is, and we can't figure it out from the URL
+ // On the plus side, there's a good chance we know somebody else at that
+ // hub so sending them there with a Zid will probably work anyway.
+
$url = ($_REQUEST['url']);
+ if(! $url) {
+ notice( t('Channel not found.') . EOL);
+ return;
+ }
if($observer)
$url = zid($url);
+
}
+
+ $is_zot = false;
if (\App::$poi) {
- $url = \App::$poi['xchan_url'];
- if($observer)
- $url = zid($url);
+ $url = \App::$poi['xchan_url'];
+ if(\App::$poi['xchan_network'] === 'zot') {
+ $is_zot = true;
+ }
}
- // let somebody over-ride the iframed viewport presentation
- // or let's just declare this a failed experiment.
-
- // if((! local_channel()) || (get_pconfig(local_channel(),'system','chanview_full')))
-
- goaway($url);
-
- // $o = replace_macros(get_markup_template('chanview.tpl'),array(
- // '$url' => $url,
- // '$full' => t('toggle full screen mode')
- // ));
+
+ // We will load the chanview template if it's a foreign network,
+ // just so that we can provide a connect button along with a profile
+ // photo. Chances are we can't load the remote profile into an iframe
+ // because of cross-domain security headers. So provide a link to
+ // the remote profile.
+
+ // Zot channels will usually have a connect link.
+ // If it isn't zot, 'pro' members won't be able to use the connect
+ // button as it is a foreign network so just send them to the remote
+ // profile.
+
- // return $o;
+ if($is_zot || \Zotlabs\Lib\System::get_server_role() === 'pro') {
+ if($is_zot && $observer) {
+ $url = zid($url);
+ }
+ goaway($url);
+ }
+ else {
+ $o = replace_macros(get_markup_template('chanview.tpl'),array(
+ '$url' => $url,
+ '$full' => t('toggle full screen mode')
+ ));
+ return $o;
+ }
}
}