blob: 6d8a205eec82981717cd2204436f2017f3c3fc28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
/**
* Delete a room
* @param int $room_id
*/
function Room_delete($room_id) {
return sql_query("DELETE FROM `Room` WHERE `RID`=" . sql_escape($room_id));
}
/**
* Create a new room
*
* @param string $name
* Name of the room
* @param boolean $from_frab
* Is this a frab imported room?
* @param boolean $public
* Is the room visible for angels?
*/
function Room_create($name, $from_frab, $public) {
$result = sql_query("
INSERT INTO `Room` SET
`Name`='" . sql_escape($name) . "',
`FromPentabarf`='" . sql_escape($from_frab ? 'Y' : '') . "',
`show`='" . sql_escape($public ? 'Y' : '') . "',
`Number`=0");
if ($result === false)
return false;
return sql_id();
}
/**
* Returns room by id.
*
* @param $id RID
*/
function Room($id) {
$room_source = sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($id) . "' AND `show` = 'Y'");
if ($room_source === false)
return false;
if (count($room_source) > 0)
return $room_source[0];
return null;
}
?>
|