Esempio n. 1
0
function sql_mutex_cleanup()
{
    global $sql_mutex_shutdown_registered, $sql_mutex_unlock_name, $mdb, $dbsys;
    if (!empty($sql_mutex_unlock_name)) {
        if ("mysql" == $dbsys) {
            sql_mutex_unlock($sql_mutex_unlock_name);
        } else {
            $mdb->rollback();
        }
        $sql_mutex_unlock_name = "";
    }
}
                 }
             }
             $sql .= implode(",", $assign_array) . " WHERE id={$room}";
             if (sql_command($sql) < 0) {
                 echo get_vocab("update_room_failed") . "<br>\n";
                 trigger_error(sql_error(), E_USER_WARNING);
                 fatal_error(FALSE, get_vocab("fatal_db_error"));
             }
             // if everything is OK, release the mutex and go back to
             // the admin page (for the new area)
             sql_mutex_unlock("{$tbl_area}");
             Header("Location: admin.php?day={$day}&month={$month}&year={$year}&area={$new_area}");
             exit;
         }
         // Release the mutex
         sql_mutex_unlock("{$tbl_area}");
     }
 }
 // PHASE 2 (AREA) - UPDATE THE DATABASE
 // ------------------------------------
 if (isset($change_area) && !empty($area)) {
     // clean up the address list replacing newlines by commas and removing duplicates
     $area_admin_email = clean_address_list($area_admin_email);
     // put a space after each comma so that the list displays better
     $area_admin_email = str_replace(',', ', ', $area_admin_email);
     // validate email addresses
     $valid_email = validate_email_list($area_admin_email);
     // Tidy up the input from the form
     if (isset($area_eveningends_t)) {
         // if we've been given a time in minutes rather than hours and minutes, convert it
         // (this will happen if JavaScript is enabled)
Esempio n. 3
0
    $description = substr($description, 0, $maxlength['room.description']);
    // Add SQL escaping
    $room_name_q = addslashes($name);
    $description_q = addslashes($description);
    if (empty($capacity)) {
        $capacity = 0;
    }
    // Acquire a mutex to lock out others who might be editing rooms
    if (!sql_mutex_lock("{$tbl_room}")) {
        fatal_error(TRUE, get_vocab("failed_to_acquire"));
    }
    // Check that the room name is unique within the area
    if (sql_query1("SELECT COUNT(*) FROM {$tbl_room} WHERE room_name='{$room_name_q}' AND area_id={$area} LIMIT 1") > 0) {
        $error = "invalid_room_name";
    } else {
        $sql = "INSERT INTO {$tbl_room} (room_name, sort_key, area_id, description, capacity)\n            VALUES ('{$room_name_q}', '{$room_name_q}', {$area}, '{$description_q}',{$capacity})";
        if (sql_command($sql) < 0) {
            trigger_error(sql_error(), E_USER_WARNING);
            fatal_error(TRUE, get_vocab("fatal_db_error"));
        }
    }
    // Release the mutex
    sql_mutex_unlock("{$tbl_room}");
}
if (!empty($error)) {
    $url = formatURLError($area, $error);
} else {
    $url = formatURLError($area, NULL);
}
$returl = "admin/{$url}";
header("Location: {$returl}");
Esempio n. 4
0
function sql_mutex_cleanup()
{
    global $sql_mutex_shutdown_registered, $sql_mutex_unlock_name;
    if (!empty($sql_mutex_unlock_name)) {
        sql_mutex_unlock($sql_mutex_unlock_name);
        $sql_mutex_unlock_name = "";
    }
}
Esempio n. 5
0
                }
            }
        }
    }
    # end foreach $rooms
    # Delete the original entry
    if (isset($id)) {
        mrbsDelEntry(getUserName(), $id, $edit_type == "series", 1);
    }
    sql_mutex_unlock("{$tbl_entry}");
    $area = mrbsGetRoomArea($room_id);
    # Now its all done go back to the day view
    Header("Location: day.php?year={$year}&amp;month={$month}&amp;day={$day}&amp;area={$area}");
    exit;
}
# The room was not free.
sql_mutex_unlock("{$tbl_entry}");
if (strlen($err)) {
    print_header($day, $month, $year, $area);
    echo "<H2>" . get_vocab("sched_conflict") . "</H2>";
    if (!isset($hide_title)) {
        echo get_vocab("conflict") . ":";
        echo "<UL>";
    }
    echo $err;
    if (!isset($hide_title)) {
        echo "</UL>";
    }
}
echo "<a href=\"{$returl}\">" . get_vocab("returncal") . "</a><p>";
include "trailer.inc";
Esempio n. 6
0
            # Create the entry:
            mrbsCreateSingleEntry($starttime, $endtime, $entry_type, $repeat_id, $room_id, $create_by, $name, $type, $description);
        }
    }
    # end foreach $rooms
    # Delete the original entry
    if (isset($id)) {
        mrbsDelEntry(getUserName(), $id, $edit_type == "series", 1);
    }
    sql_mutex_unlock('mrbs_entry');
    $area = mrbsGetRoomArea($room_id);
    # Now its all done go back to the day view
    Header("Location: day.php?year={$year}&month={$month}&day={$day}&area={$area}");
    exit;
}
# The room was not free.
sql_mutex_unlock('mrbs_entry');
if (strlen($err)) {
    print_header($day, $month, $year, $area);
    echo "<H2>" . $vocab["sched_conflict"] . "</H2>";
    if (!isset($hide_title)) {
        echo $vocab["conflict"];
        echo "<UL>";
    }
    echo $err;
    if (!isset($hide_title)) {
        echo "</UL>";
    }
}
echo "<a href=\"{$returl}\">{$vocab['returncal']}</a><p>";
include "trailer.inc";
Esempio n. 7
0
    //$area = mrbsAddArea($name, $error);
    $sql = "INSERT INTO users (name, code, team, role, disabled)\n          VALUES ('{$name}', '{$code}', '{$team}', '{$role}', 0)";
    if (!sql_mutex_lock("users")) {
        fatal_error(TRUE, get_vocab("failed_to_acquire"));
    }
    if (sql_command($sql) < 0) {
        trigger_error(sql_error(), E_USER_WARNING);
        fatal_error(TRUE, get_vocab("fatal_db_error"));
    }
    $area = sql_insert_id('users', 'id');
    sql_mutex_unlock("users");
} elseif ($type == "room") {
    //$room = mrbsAddRoom($name, $area, $error, $description, $capacity);
    $f2f = $_POST['f2f'];
    $available = $_POST['available'];
    $dnka = $_POST['dnka'];
    $outreach = $_POST['outreach'];
    $nocount = $_POST['nocount'];
    $sql = "INSERT INTO codes (code, description, f2f, available, dnka, outreach, nocount, disabled)\n          VALUES ('{$code}', '{$description}', {$f2f}, {$available}, {$dnka}, {$outreach}, {$nocount}, 0)";
    if (!sql_mutex_lock("users")) {
        fatal_error(TRUE, get_vocab("failed_to_acquire"));
    }
    if (sql_command($sql) < 0) {
        trigger_error(sql_error(), E_USER_WARNING);
        fatal_error(TRUE, get_vocab("fatal_db_error"));
    }
    $area = sql_insert_id('users', 'id');
    sql_mutex_unlock("users");
}
$returl = "admin.php?success=" . (isset($area) ? 1 : 0) . (!empty($error) ? "&error={$error}" : "");
header("Location: {$returl}");
Esempio n. 8
0
    # Delete the original entry
    if(isset($id))
        mrbsDelEntry(getUserName(), $id, ($edit_type == "series"), 1);

    sql_mutex_unlock("$tbl_entry");
    
    $area = mrbsGetRoomArea($room_id);
    
    # Now its all done go back to the day view
    Header("Location: day.php?year=$year&month=$month&day=$day&area=$area");
    exit;
}

# The room was not free.
sql_mutex_unlock("$tbl_entry");

if(strlen($err))
{
    print_header($day, $month, $year, $area);
    
    echo "<H2>" . get_vocab("sched_conflict") . "</H2>";
    if(!isset($hide_title))
    {
        echo get_vocab("conflict");
        echo "<UL>";
    }
    
    echo $err;
    
    if(!isset($hide_title))
Esempio n. 9
0
                     
                     $sql .= implode(",", $assign_array) . " WHERE id=$room";*/
             $sql = "UPDATE codes\n                SET code = '{$code}', description = '{$description}', f2f= '{$f2f}', disabled = '{$disabled}', outreach='{$outreach}', available = '{$available}', dnka = '{$dnka}'\n                WHERE id = {$id}";
             if (sql_command($sql) < 0) {
                 echo get_vocab("update_room_failed") . "<br>\n";
                 trigger_error(sql_error(), E_USER_WARNING);
                 fatal_error(FALSE, get_vocab("fatal_db_error"));
             }
             // if everything is OK, release the mutex and go back to
             // the admin page (for the new area)
             sql_mutex_unlock("codes");
             Header("Location: admin.php?day={$day}&month={$month}&year={$year}&success=1");
             exit;
         }
         // Release the mutex
         sql_mutex_unlock("codes");
     }
 }
 // PHASE 2 (AREA) - UPDATE THE DATABASE
 // ------------------------------------
 $user = $_POST['user'];
 $name = $_POST['name'];
 $code = $_POST['code'];
 $team = $_POST['team'];
 $role = $_POST['role'];
 $disabled = $_POST['disabled'];
 $id = $_POST['id'];
 if (isset($change_area) && !empty($user)) {
     /* // clean up the address list replacing newlines by commas and removing duplicates
         $area_admin_email = clean_address_list($area_admin_email);
         // put a space after each comma so that the list displays better