/**
 * This function will take the $_GET array and run functions 
 * based on it. The key parameter is our operation, which will determine which 
 * functions we do. Machines that need to made available are always made available
 * anytime the web service is accessed. 
*/
function main()
{
    $timeStamp = floatval(date("H")) * 3600 + floatval(date("i")) * 60 + floatval(date("s"));
    // make available all machines that need to be
    $sqlToAvail = makeAvailable($timeStamp);
    $operation = $_GET['operation'];
    if ($operation == 'makeUpdate') {
        $sqlUpdate = makeUpdate($_GET['netID'], $_GET['machineID'], floatval($_GET['duration']), $timeStamp, $_GET['status']);
    } elseif ($operation == 'moveThroughApp') {
        $sqlQuery = moveThroughApp($_GET['campus'], $_GET['dorm']);
    } elseif ($operation == 'viewMachines') {
        $sqlQuery = viewMachines($_GET['campus'], $_GET['dorm'], $_GET['room'], $_GET['status']);
    } elseif ($operation == 'nearBy') {
        $sqlQuery = nearBy($_GET['netID']);
    } else {
        echo "Please enter a valid operation";
    }
    runQueries($sqlToAvail, $sqlUpdate, $sqlQuery);
}
示例#2
0
function update()
{
    $head = "";
    $html = "";
    $update_submit = "";
    $update_pages = "";
    if (!isset($_POST['update_cms'])) {
        $updates = testUpdate();
        if ($updates['conf'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_conf_help"), $updates['conf']);
        }
        if ($updates['kategorien'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_kategorien_help"), $updates['kategorien']);
        }
        if ($updates['galerien'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_galerien_help"), $updates['galerien']);
        }
        if ($updates['plugins'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_plugins_help"), $updates['plugins']);
        }
        if ($updates['layouts'] !== "empty") {
            $html .= contend_template(getLanguageValue("install_update_layouts_help"), $updates['layouts']);
        }
        if (strlen($html) > 1) {
            $head = contend_template(installHelp("install_update_help"), "");
            $update_button = false;
            foreach ($updates as $status) {
                if ($status === false) {
                    $update_button = false;
                    $head = contend_template(getLanguageValue("install_update_error"), false) . $head;
                    break;
                }
                if ($status === true) {
                    $update_button = true;
                }
            }
            if ($update_button === true) {
                if ($updates['kategorien'] === true) {
                    $update_pages = '<input type="checkbox" value="true" name="update_pages" id="update_pages"><label for="update_pages">' . getLanguageValue("install_update_files_in_pages") . '</label><br /><br />';
                }
                $update_submit = $update_pages . '<input type="submit" name="update_cms" value="' . getLanguageValue("install_update_buttom") . '" />';
                $update_submit = contend_template($update_submit, "");
            }
        } else {
            $head = contend_template(installHelp("install_update_no_help"), "");
        }
    } elseif (isset($_POST['update_cms'])) {
        makeUpdate();
        $head = contend_template(installHelp("install_update_successful"), true);
    }
    return array(true, $head . $html . $update_submit, true);
}