]> git.mxchange.org Git - friendica.git/blobdiff - mod/cal.php
Move mod/home to src/Module/Home
[friendica.git] / mod / cal.php
index 526e33c00cd796b09a29591192b33db7a317346f..e93341583a53df4ab42e75b4f4f282e4958ab13b 100644 (file)
@@ -23,7 +23,6 @@ use Friendica\Model\Profile;
 use Friendica\Protocol\DFRN;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Temporal;
-use Friendica\Util\Security;
 
 function cal_init(App $a)
 {
@@ -32,11 +31,11 @@ function cal_init(App $a)
        }
 
        if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
-               System::httpExit(403, ['title' => L10n::t('Access denied.')]);
+               throw new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Access denied.'));
        }
 
        if ($a->argc < 2) {
-               System::httpExit(403, ['title' => L10n::t('Access denied.')]);
+               throw new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Access denied.'));
        }
 
        Nav::setSelected('events');
@@ -44,7 +43,7 @@ function cal_init(App $a)
        $nick = $a->argv[1];
        $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
        if (!DBA::isResult($user)) {
-               System::httpExit(404, ['title' => L10n::t('Page not found.')]);
+               throw new \Slim\Exception\NotFoundException();
        }
 
        $a->data['user'] = $user;
@@ -91,7 +90,6 @@ function cal_content(App $a)
 
        $htpl = Renderer::getMarkupTemplate('event_head.tpl');
        $a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [
-               '$baseurl' => System::baseUrl(),
                '$module_url' => '/cal/' . $a->data['user']['nickname'],
                '$modparams' => 2,
                '$i18n' => $i18n,
@@ -244,7 +242,7 @@ function cal_content(App $a)
 
                if (!empty($a->argv[2]) && ($a->argv[2] === 'json')) {
                        echo json_encode($events);
-                       killme();
+                       exit();
                }
 
                // links: array('href', 'text', 'extra css classes', 'title')
@@ -269,7 +267,6 @@ function cal_content(App $a)
                }
 
                $o = Renderer::replaceMacros($tpl, [
-                       '$baseurl' => System::baseUrl(),
                        '$tabs' => $tabs,
                        '$title' => L10n::t('Events'),
                        '$view' => L10n::t('View'),
@@ -286,7 +283,7 @@ function cal_content(App $a)
 
                if (!empty($_GET['id'])) {
                        echo $o;
-                       killme();
+                       exit();
                }
 
                return $o;
@@ -331,7 +328,7 @@ function cal_content(App $a)
                        header('Content-type: text/calendar');
                        header('content-disposition: attachment; filename="' . L10n::t('calendar') . '-' . $nick . '.' . $evexport["extension"] . '"');
                        echo $evexport["content"];
-                       killme();
+                       exit();
                }
 
                return;