Example #1
0
    exit;
}
if (isset($_GET["infra-section"])) {
    infra_section();
    exit;
}
if (isset($_GET["control-section"])) {
    control_section();
    exit;
}
if (isset($_GET["monitor-section"])) {
    monitor_section();
    exit;
}
if (isset($_GET["update-section"])) {
    update_section();
    exit;
}
if (isset($_GET["debug-section"])) {
    debug_section();
    exit;
}
page();
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $js_infrasection = "LoadAjaxRound('infra-section','{$page}?infra-section=yes');";
    $js_filtersection = "LoadAjaxRound('filter2-section','{$page}?filter2-section=yes');";
    $js_controlsection = "LoadAjaxRound('control-section','{$page}?control-section=yes');";
    $js_monitorsection = "LoadAjaxRound('monitor-section','{$page}?monitor-section=yes');";
function save_section($connection)
{
    $id = $_REQUEST['id'];
    $title = $_REQUEST['title'];
    $type = $_REQUEST['type'];
    $connection->begin_transaction();
    if ($type == "TEXT" || $type == "JOIN" || $type == "MODS" || $type == "INTRO") {
        $text = $_REQUEST['text'];
        $insert_update_section_text_stmt = insert_update_section_text_stmt($connection);
        $insert_update_section_text_stmt->bind_param("iss", $id, $text, $text);
        catch_execution_error($insert_update_section_text_stmt->execute(), $connection);
        if ($type == "JOIN" || $type == "MODS") {
            $button_text = $_REQUEST['buttonText'];
            $insert_update_section_button_text_stmt = insert_update_section_button_text_stmt($connection);
            $insert_update_section_button_text_stmt->bind_param("iss", $id, $button_text, $button_text);
            catch_execution_error($insert_update_section_button_text_stmt->execute(), $connection);
        }
        update_section($connection, $id, $type, $title);
        if ($type != "JOIN" && $type != "MODS") {
            remove_section_button_text($connection, $id);
        }
        remove_section_images($connection, $id);
        remove_section_youtubes($connection, $id);
    } else {
        update_section($connection, $id, $type, $title);
        remove_section_text($connection, $id);
        remove_section_button_text($connection, $id);
    }
    $connection->commit();
    print '[["SUCCESS"],["Section saved successfully"]]';
}