WebAppTemplate/action.php

37 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2017-04-24 17:13:08 -06:00
<?php
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2017-04-24 17:13:08 -06:00
/**
* Make things happen when buttons are pressed and forms submitted.
*/
require_once __DIR__ . "/required.php";
if ($VARS['action'] !== "signout") {
dieifnotloggedin();
}
2017-04-24 17:13:08 -06:00
2017-05-07 00:30:25 -06:00
/**
* Redirects back to the page ID in $_POST/$_GET['source'] with the given message ID.
* The message will be displayed by the app.
* @param string $msg message ID (see lang/messages.php)
* @param string $arg If set, replaces "{arg}" in the message string when displayed to the user.
*/
2017-04-24 17:13:08 -06:00
function returnToSender($msg, $arg = "") {
global $VARS;
2019-03-01 23:37:06 -07:00
$header = "Location: app.php?page=" . urlencode($VARS['source']) . "&msg=$msg";
if ($arg != "") {
$header .= "&arg=$arg";
2017-04-24 17:13:08 -06:00
}
2019-03-01 23:37:06 -07:00
header($header);
2017-04-24 17:13:08 -06:00
die();
}
switch ($VARS['action']) {
case "signout":
session_destroy();
2018-12-22 16:57:45 -07:00
header('Location: index.php?logout=1');
2017-04-24 17:13:08 -06:00
die("Logged out.");
}