diff options
author | Philip Häusler <msquare@notrademark.de> | 2014-01-05 19:35:01 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2014-01-05 19:35:01 +0100 |
commit | 27ff879f511117587c7633b109974b6ff205eaa0 (patch) | |
tree | 3a29781336ed7c747bd682b1e87fc6a3aed13273 | |
parent | 6664433fabc8d2173c74c74bc30f569e68228fa2 (diff) |
cookie-0007-API-getRoom-show-real-rooms.patch
-rw-r--r-- | includes/controller/api.php | 8 | ||||
-rw-r--r-- | includes/model/Room_model.php | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/includes/controller/api.php b/includes/controller/api.php index 35c23cb5..3c87e5b4 100644 --- a/includes/controller/api.php +++ b/includes/controller/api.php @@ -45,7 +45,7 @@ getRoom Parameters: id (integer) - Room ID Return Example: - [{"RID":"1"},{"RID":"2"},{"RID":"3"},{"RID":"4"}] + [{"RID":"1"},{"RID":"23"},{"RID":"42"}] {"RID":"1","Name":"Room Name","Man":null,"FromPentabarf":"","show":"Y","Number":"0"} getAngelType @@ -184,6 +184,10 @@ function api_controller() { $DataJson = array ( 'status' => 'failed', 'error' => 'DataJson === false' ); + } elseif( $DataJson == null) { + $DataJson = array ( + 'status' => 'failed', + 'error' => 'DataJson == null' ); } echo json_encode($DataJson); @@ -334,4 +338,4 @@ function sendMessage(){ } } -?>
\ No newline at end of file +?> diff --git a/includes/model/Room_model.php b/includes/model/Room_model.php index fea241a6..5b9c7a2a 100644 --- a/includes/model/Room_model.php +++ b/includes/model/Room_model.php @@ -4,7 +4,7 @@ * Returns room id array */ function mRoomList() { - $room_source = sql_select("SELECT `RID` FROM `Room`"); + $room_source = sql_select("SELECT `RID` FROM `Room` WHERE `show` = 'Y'"); if ($room_source === false) return false; if (count($room_source) > 0) @@ -19,7 +19,7 @@ function mRoomList() { * @param $id RID */ function mRoom($id) { - $room_source = sql_select("SELECT * FROM `Room` WHERE `RID`=" . sql_escape($id) . " LIMIT 1"); + $room_source = sql_select("SELECT * FROM `Room` WHERE `RID`=" . sql_escape($id) . " AND `show` = 'Y' LIMIT 1"); if ($room_source === false) return false; if (count($room_source) > 0) |