accept ?forceopen=yes to force a conference open

This commit is contained in:
MaZderMind 2016-09-03 19:50:34 +02:00
parent 6ee36da3d9
commit 4e8fed0b77
7 changed files with 35 additions and 8 deletions

View file

@ -50,6 +50,8 @@ try {
$route = $pieces['path']; $route = $pieces['path'];
$route = rtrim($route, '/'); $route = rtrim($route, '/');
$GLOBALS['forceopen'] = isset($_GET['forceopen']);
// generic template // generic template
$tpl = new PhpTemplate('template/page.phtml'); $tpl = new PhpTemplate('template/page.phtml');
$tpl->set(array( $tpl->set(array(

View file

@ -100,3 +100,11 @@ function days_diff_readable($date)
return "in $days days"; return "in $days days";
} }
function url_params()
{
if($GLOBALS['forceopen'])
return '?forceopen=yess';
return '';
}

View file

@ -7,7 +7,13 @@ class Conference extends ModelBase
} }
public function isPreviewEnabled() { public function isPreviewEnabled() {
return $this->has('PREVIEW_DOMAIN') && ($this->get('PREVIEW_DOMAIN') == $_SERVER['SERVER_NAME']); if(isset($GLOBALS['forceopen']))
return true;
if($this->has('PREVIEW_DOMAIN') && ($this->get('PREVIEW_DOMAIN') == $_SERVER['SERVER_NAME']))
return true;
return false;
} }
public function isClosed() { public function isClosed() {
@ -94,12 +100,19 @@ class Conference extends ModelBase
return $this->get('CONFERENCE.RELEASES'); return $this->get('CONFERENCE.RELEASES');
} }
public function getLink() {
return url_params();
}
public function getAboutLink() {
return 'about/'.url_params();
}
public function hasRelive() { public function hasRelive() {
return $this->has('CONFERENCE.RELIVE_JSON'); return $this->has('CONFERENCE.RELIVE_JSON');
} }
public function getReliveUrl() { public function getReliveUrl() {
if($this->has('CONFERENCE.RELIVE_JSON')) if($this->has('CONFERENCE.RELIVE_JSON'))
return 'relive/'; return 'relive/'.url_params();
else else
return null; return null;

View file

@ -47,7 +47,7 @@ class Room extends ModelBase
} }
public function getLink() { public function getLink() {
return rawurlencode($this->getSlug()).'/'; return rawurlencode($this->getSlug()).'/'.url_params();
} }
public function getStream() { public function getStream() {

View file

@ -22,9 +22,9 @@ class RoomTab
{ {
$tabs = $this->getRoom()->getTabNames(); $tabs = $this->getRoom()->getTabNames();
if($tabs[0] == $this->getTab()) if($tabs[0] == $this->getTab())
return rawurlencode($this->getRoom()->getSlug()).'/'; return rawurlencode($this->getRoom()->getSlug()).'/'.url_params();
return rawurlencode($this->getRoom()->getSlug()).'/'.rawurlencode($this->getTab()).'/'; return rawurlencode($this->getRoom()->getSlug()).'/'.rawurlencode($this->getTab()).'/'.url_params();
} }
public function getDisplay() public function getDisplay()

View file

@ -1,7 +1,7 @@
<nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<a class="navbar-brand" href=""> <a class="navbar-brand" href="<?=$conference->getLink()?>">
<i class="icon"></i> <i class="icon"></i>
<?=h($conference->getTitle())?> Streaming <?=h($conference->getTitle())?> Streaming
</a> </a>
@ -25,7 +25,7 @@
<span class="fa fa-video-camera"></span> <span class="fa fa-video-camera"></span>
</a> </a>
<? endif ?> <? endif ?>
<a class="form-control btn btn-default about" title="About" href="about/"> <a class="form-control btn btn-default about" title="About" href="<?=$conference->getAboutLink()?>">
<span class="fa fa-info"></span> <span class="fa fa-info"></span>
</a> </a>
</div> </div>

View file

@ -16,7 +16,11 @@
<title><?=h($title)?> <?=h($conference->getTitle())?> Streaming</title> <title><?=h($title)?> <?=h($conference->getTitle())?> Streaming</title>
<meta name="robots" content="index,follow" /> <? if($conference->isPreviewEnabled()): ?>
<meta name="robots" content="noindex,nofollow" />
<? else: ?>
<meta name="robots" content="index,follow" />
<? endif ?>
<? if(isset($refresh)): ?> <? if(isset($refresh)): ?>
<meta http-equiv="refresh" content="<?=h($refresh)?>; URL=<?=h($canonicalurl)?>" /> <meta http-equiv="refresh" content="<?=h($refresh)?>; URL=<?=h($canonicalurl)?>" />