Example #1
0
<?php

// $Id$
require "defaultincludes.inc";
require_once "mrbs_sql.inc";
// Get non-standard form variables
$name = get_form_var('name', 'string');
$description = get_form_var('description', 'string');
$capacity = get_form_var('capacity', 'int');
$type = get_form_var('type', 'string');
// Check the user is authorised for this page
checkAuthorised();
// This file is for adding new areas/rooms
$error = '';
// First of all check that we've got an area or room name
if (!isset($name) || $name === '') {
    $error = "empty_name";
} elseif ($type == "area") {
    $area = mrbsAddArea($name, $error);
} elseif ($type == "room") {
    $room = mrbsAddRoom($name, $area, $error, $description, $capacity);
}
$returl = "admin.php?area={$area}" . (!empty($error) ? "&error={$error}" : "");
header("Location: {$returl}");
Example #2
0
// $Id$
require "defaultincludes.inc";
require_once "mrbs_sql.inc";
require_once "functions_ical.inc";
function invalid_booking($message)
{
    global $day, $month, $year, $area, $room;
    print_header($day, $month, $year, $area, isset($room) ? $room : "");
    echo "<h1>" . get_vocab('invalid_booking') . "</h1>\n";
    echo "<p>{$message}</p>\n";
    // Print footer and exit
    print_footer(TRUE);
}
$ajax = get_form_var('ajax', 'int');
if ($ajax && !checkAuthorised(TRUE)) {
    exit;
}
// (1) Check the user is authorised for this page
//  ---------------------------------------------
//checkAuthorised();
// Also need to know whether they have admin rights
//$user = getUserName();
//$is_admin = (authGetUserLevel($user) >= 2);
// (2) Get the form variables
// --------------------------
// NOTE:  the code on this page assumes that array form variables are passed
// as an array of values, rather than an array indexed by value.   This is
// particularly important for checkbox arrays whicgh should be formed like this:
//
//    <input type="checkbox" name="foo[]" value="n">