$res = sql_query("SELECT * FROM codes ORDER BY code"); if (!$res) { trigger_error(sql_error(), E_USER_WARNING); fatal_error(FALSE, get_vocab("fatal_db_error")); } if (sql_count($res) == 0) { echo "<p>" . get_vocab("norooms") . "</p>\n"; } else { // Get the information about the fields in the room table $fields = sql_field_info('codes'); // Build an array with the room info and also see if there are going // to be any rooms to display (in other words rooms if you are not an // admin whether any rooms are enabled) $rooms = array(); $n_displayable_rooms = 0; for ($i = 0; $row = sql_mysqli_row_keyed($res, $i); $i++) { $rooms[] = $row; if ($is_admin || !$row['disabled']) { $n_displayable_rooms++; } } if ($n_displayable_rooms == 0) { echo "<p>" . get_vocab("norooms_enabled") . "</p>\n"; } else { echo "<div id=\"room_info\" class=\"datatable_container\">\n"; // Build the table. We deal with the name and disabled columns // first because they are not necessarily the first two columns in // the table (eg if you are running PostgreSQL and have upgraded your // database) echo "<table id=\"rooms_table\" class=\"admin_table display\">\n"; // The header
echo !empty($row['custom_html']) ? $row['custom_html'] . "\n" : ""; echo "</div>\n"; } // THE AREA FORM if (isset($change_area) && !empty($user)) { // Only admins can see this form if (!$is_admin) { showAccessDenied($day, $month, $year, $area, ""); exit; } // Get the details for this area $res = sql_query("SELECT TOP 1 * FROM [users] WHERE id={$user}"); if (!$res) { fatal_error(0, get_vocab("error_area") . $area . get_vocab("not_found")); } $row = sql_mysqli_row_keyed($res, 0); sqlsrv_free_stmt($res); // Get the settings for this area, from the database if they are there, otherwise from // the config file. A little bit inefficient repeating the SQL query // we've just done, but it makes the code simpler and this page is not used very often. //get_area_settings($area); echo "<form class=\"form_general\" id=\"edit_area\" action=\"edit_area_room.php\" method=\"post\">\n"; echo "<fieldset class=\"admin\">\n"; echo "<legend>" . get_vocab("editarea") . "</legend>\n"; // Any error messages echo "<fieldset>\n"; echo "<legend></legend>\n"; if (FALSE == $valid_email) { echo "<p class=\"error\">" . get_vocab('invalid_email') . "</p>\n"; } if (FALSE == $valid_resolution) {