diff options
Diffstat (limited to 'app/controllers/terms.php')
| -rw-r--r-- | app/controllers/terms.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/app/controllers/terms.php b/app/controllers/terms.php index d3a829e..528859a 100644 --- a/app/controllers/terms.php +++ b/app/controllers/terms.php @@ -26,6 +26,9 @@ class TermsController extends AuthenticatedController $this->compulsory = Config::get()->TERMS_CONFIG['compulsory']; $this->denial_message = ''; + + $this->terms_of_use = $this->getTermsOfUse(); + if (Request::isPost()) { CSRFProtection::verifyUnsafeRequest(); if (Request::submitted('accept')) { @@ -59,4 +62,34 @@ class TermsController extends AuthenticatedController } $this->redirect(URLHelper::getURL($target)); } + + + /** + * @return array|null + */ + private function getTermsOfUse() + { + $url = Config::get()->TERMS_OF_USE_URL; + + if (is_internal_url($url)) { + $url_parts = explode('/', $url); + $detail_id = $url_parts[4]; + $si = new Siteinfo(); + $detail = $si->get_detail($detail_id); + if (empty($detail) || !empty($detail['draft_status']) || !empty($detail['page_disabled_nobody'])) { + return null; + } + + return [ + 'type' => 'internal_url', + 'content' => $si->get_detail_content_processed($detail_id) + ]; + + } + + return [ + 'type' => 'external_url', + 'url' => $url + ]; + } } |
