From 27ff879f511117587c7633b109974b6ff205eaa0 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Sun, 5 Jan 2014 19:35:01 +0100 Subject: cookie-0007-API-getRoom-show-real-rooms.patch --- includes/controller/api.php | 8 ++++++-- includes/model/Room_model.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'includes') 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) -- cgit v1.2.3-70-g09d2