break;
            case 0:
                $error[$num_errors++] = "The capacity must be filled";
                break;
            case -2:
                $error[$num_errors++] = "There are invalid characteres at the location";
                break;
        }
        if (empty($error)) {
            Update_Room($rooms[0][0], $rooms[0][1], $rooms[0][2], $rooms[0][3], $rooms[0][4], $rooms[0][5], $rooms[0][6], $bd);
            $alert[$num_alerts++] = "Room Updated Successfully";
            include "adm_acc_rooms.php";
            exit;
        }
    } else {
        $rooms = List_Rooms($_GET['account_id'], '', '', '', '', $bd);
    }
    $result_xsl = "xsl/" . $default_xsl . "/adm_acc_rooms_modify.xsl";
} else {
    $error[$num_errors++] = "Invalid Session ID";
    include "logout.php";
    exit;
}
$smarty->assign("nrpTransform", $result_xsl);
$smarty->assign("nrpSchErrors", $error);
$smarty->assign("nrpSchAlerts", $alert);
$smarty->assign("nrpSessId", $complete_sess_id);
$smarty->assign("nrpUserId", $account_id);
$smarty->assign("nrpRooms", $rooms);
$result_xml = $smarty->fetch("xml/adm_acc_rooms.xml");
require "./inc/proc_transform.php";
Beispiel #2
0
function List_Rooms_Permission($account_id, $bd)
{
    $rooms = array();
    // Includes the permissions related to the user
    $result_user = $bd->Query("SELECT * FROM relationships WHERE master_id = '{$account_id}' AND\n\t\trel_type = 'room'");
    for ($i = 0; $i < $bd->NumberOfRows($result_user); $i++) {
        $room_id = $bd->FetchResult($result_user, $i, 'slave_id');
        $room = List_Rooms($room_id, '', '', '', '', $bd);
        $rooms[] = $room[0];
    }
    // Include the permissions related to the groups which the user is member of
    $query_groups = "SELECT * FROM group_members WHERE account_id = '{$account_id}'";
    $result_groups = $bd->Query($query_groups);
    for ($i = 0; $i < $bd->NumberOfRows($result_groups); $i++) {
        $group_id = $bd->FetchResult($result_groups, $i, 'group_id');
        $query_perm_group = "SELECT * FROM relationships WHERE master_group = '{$group_id}' AND\n\t\t\trel_type = 'room'";
        $result_group = $bd->Query($query_perm_group);
        for ($j = 0; $j < $bd->NumberOfRows($result_group); $j++) {
            $room_id = $bd->FetchResult($result_group, $j, 'slave_id');
            $room = List_Rooms($room_id, '', '', '', '', $bd);
            $rooms[] = $room[0];
        }
    }
    // Include the permissions related to the user's category
    $query_cat = "SELECT * FROM people WHERE account_id = '{$account_id}'";
    $result_cat = $bd->Query($query_cat);
    $cat_id = $bd->FetchResult($result_cat, 0, 'category');
    $query_perm_cat = "SELECT * FROM relationships WHERE master_category = '{$cat_id}' AND\n\t\t\trel_type = 'room'";
    $result_category = $bd->Query($query_perm_cat);
    for ($j = 0; $j < $bd->NumberOfRows($result_category); $j++) {
        $room_id = $bd->FetchResult($result_category, $j, 'slave_id');
        $room = List_Rooms($room_id, '', '', '', '', $bd);
        $rooms[] = $room[0];
    }
    return $rooms;
}
    require "./inc/script_inicialization.php";
    require "./inc/nrp_api.php";
}
if (!isset($num_errors)) {
    $num_errors = 0;
}
if (!isset($num_alerts)) {
    $num_alerts = 0;
}
if (Validate_Session($complete_sess_id, $_SERVER['REMOTE_ADDR'], $bd)) {
    Get_Account_Id($sess_id, $account_id, $bd);
    if ($account_id != 'admin') {
        $error[$num_errors++] = "You are not the administrator";
        include "logout.php";
        exit;
    }
    $rooms = List_Rooms('', '', '', '', '', $bd);
} else {
    $error[$num_errors++] = "Invalid Session ID";
    include "logout.php";
    exit;
}
$result_xsl = "xsl/" . $default_xsl . "/adm_acc_rooms.xsl";
$smarty->assign("nrpTransform", $result_xsl);
$smarty->assign("nrpSchErrors", $error);
$smarty->assign("nrpSchAlerts", $alert);
$smarty->assign("nrpSessId", $complete_sess_id);
$smarty->assign("nrpRooms", $rooms);
$result_xml = $smarty->fetch("xml/adm_acc_rooms.xml");
require "./inc/proc_transform.php";
// Calls the commands do procede the XSLT transformation