Use Login module

- Simplify goaway calls
This commit is contained in:
Hypolite Petovan 2017-12-31 21:04:02 -05:00
parent 4ceec855d2
commit 575a285951
7 changed files with 28 additions and 28 deletions

View file

@ -80,7 +80,7 @@ function wdcal_import_user_ics($calendar_id) {
$server = dav_create_server(true, true, false);
$calendar = dav_get_current_user_calendar_by_id($server, $calendar_id, DAV_ACL_WRITE);
if (!$calendar) goaway($a->get_baseurl() . "/dav/wdcal/");
if (!$calendar) goaway('dav/wdcal/');
if (isset($_REQUEST["save"])) {
check_form_security_token_redirectOnErr('/dav/settings/', 'icsimport');
@ -308,12 +308,12 @@ function wdcal_getDetailPage($calendar_id, $calendarobject_id)
$calbackend = wdcal_calendar_factory_by_id($calendar_id);
$redirect = $calbackend->getItemDetailRedirect($calendar_id, $calendarobject_id);
if ($redirect !== null) goaway($a->get_baseurl() . $redirect);
if ($redirect !== null) goaway($redirect);
$details = $obj;
} catch (Exception $e) {
info(t("Error") . ": " . $e);
goaway($a->get_baseurl() . "/dav/wdcal/");
goaway('dav/wdcal/');
}
return print_r($details, true);

View file

@ -1,4 +1,6 @@
<?php
use Friendica\Module\Login;
use Friendica\Util\Emailer;
require_once('include/security.php');
@ -148,7 +150,7 @@ function dav_content()
{
$a = get_app();
if (!isset($a->user["uid"]) || $a->user["uid"] == 0) {
return login();
return Login::form();
}
$x = "";
@ -164,7 +166,7 @@ function dav_content()
$ret = wdcal_postEditPage("new", "", $a->user["uid"], $a->timezone, $a->get_baseurl() . "/dav/wdcal/");
if ($ret["ok"]) notice($ret["msg"]);
else info($ret["msg"]);
goaway($a->get_baseurl() . "/dav/wdcal/");
goaway('dav/wdcal/');
}
$o .= wdcal_getNewPage();
return $o;
@ -182,7 +184,7 @@ function dav_content()
$ret = wdcal_postEditPage($a->argv[3], $a->user["uid"], $a->timezone, $a->get_baseurl() . "/dav/wdcal/");
if ($ret["ok"]) notice($ret["msg"]);
else info($ret["msg"]);
goaway($a->get_baseurl() . "/dav/wdcal/");
goaway('dav/wdcal/');
}
$o .= wdcal_getEditPage($calendar_id, $a->argv[3]);
return $o;