diff options
author | MaZderMind | 2016-09-03 19:50:34 +0200 |
---|---|---|
committer | MaZderMind | 2016-09-03 19:55:40 +0200 |
commit | 4e8fed0b773ad33e50017f498d40440592b7c4ef (patch) | |
tree | 256c9ac062e565933e85a7ccd212dca5f8852a84 | |
parent | 6ee36da3d945b9b412eddf97aba90c65b5664afa (diff) |
accept ?forceopen=yes to force a conference open
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | lib/helper.php | 8 | ||||
-rw-r--r-- | model/Conference.php | 17 | ||||
-rw-r--r-- | model/Room.php | 2 | ||||
-rw-r--r-- | model/RoomTab.php | 4 | ||||
-rw-r--r-- | template/assemblies/header.phtml | 4 | ||||
-rw-r--r-- | template/page.phtml | 6 |
7 files changed, 35 insertions, 8 deletions
@@ -50,6 +50,8 @@ try { $route = $pieces['path']; $route = rtrim($route, '/'); + $GLOBALS['forceopen'] = isset($_GET['forceopen']); + // generic template $tpl = new PhpTemplate('template/page.phtml'); $tpl->set(array( diff --git a/lib/helper.php b/lib/helper.php index 170d224..4fce91e 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -100,3 +100,11 @@ function days_diff_readable($date) return "in $days days"; } + +function url_params() +{ + if($GLOBALS['forceopen']) + return '?forceopen=yess'; + + return ''; +} diff --git a/model/Conference.php b/model/Conference.php index 4d08791..9cb62d3 100644 --- a/model/Conference.php +++ b/model/Conference.php @@ -7,7 +7,13 @@ class Conference extends ModelBase } 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() { @@ -94,12 +100,19 @@ class Conference extends ModelBase return $this->get('CONFERENCE.RELEASES'); } + public function getLink() { + return url_params(); + } + public function getAboutLink() { + return 'about/'.url_params(); + } + public function hasRelive() { return $this->has('CONFERENCE.RELIVE_JSON'); } public function getReliveUrl() { if($this->has('CONFERENCE.RELIVE_JSON')) - return 'relive/'; + return 'relive/'.url_params(); else return null; diff --git a/model/Room.php b/model/Room.php index 7386c1d..df3d92c 100644 --- a/model/Room.php +++ b/model/Room.php @@ -47,7 +47,7 @@ class Room extends ModelBase } public function getLink() { - return rawurlencode($this->getSlug()).'/'; + return rawurlencode($this->getSlug()).'/'.url_params(); } public function getStream() { diff --git a/model/RoomTab.php b/model/RoomTab.php index f0338d2..16a8359 100644 --- a/model/RoomTab.php +++ b/model/RoomTab.php @@ -22,9 +22,9 @@ class RoomTab { $tabs = $this->getRoom()->getTabNames(); 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() diff --git a/template/assemblies/header.phtml b/template/assemblies/header.phtml index b2d4215..c4d92e7 100644 --- a/template/assemblies/header.phtml +++ b/template/assemblies/header.phtml @@ -1,7 +1,7 @@ <nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> - <a class="navbar-brand" href=""> + <a class="navbar-brand" href="<?=$conference->getLink()?>"> <i class="icon"></i> <?=h($conference->getTitle())?> Streaming </a> @@ -25,7 +25,7 @@ <span class="fa fa-video-camera"></span> </a> <? 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> </a> </div> diff --git a/template/page.phtml b/template/page.phtml index 3969c12..b62f372 100644 --- a/template/page.phtml +++ b/template/page.phtml @@ -16,7 +16,11 @@ <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)): ?> <meta http-equiv="refresh" content="<?=h($refresh)?>; URL=<?=h($canonicalurl)?>" /> |