cookie-0007-API-getRoom-show-real-rooms.patch

This commit is contained in:
Philip Häusler 2014-01-05 19:35:01 +01:00
parent 6664433fab
commit 27ff879f51
2 changed files with 8 additions and 4 deletions

View File

@ -45,7 +45,7 @@ getRoom
Parameters: Parameters:
id (integer) - Room ID id (integer) - Room ID
Return Example: 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"} {"RID":"1","Name":"Room Name","Man":null,"FromPentabarf":"","show":"Y","Number":"0"}
getAngelType getAngelType
@ -184,6 +184,10 @@ function api_controller() {
$DataJson = array ( $DataJson = array (
'status' => 'failed', 'status' => 'failed',
'error' => 'DataJson === false' ); 'error' => 'DataJson === false' );
} elseif( $DataJson == null) {
$DataJson = array (
'status' => 'failed',
'error' => 'DataJson == null' );
} }
echo json_encode($DataJson); echo json_encode($DataJson);

View File

@ -4,7 +4,7 @@
* Returns room id array * Returns room id array
*/ */
function mRoomList() { 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) if ($room_source === false)
return false; return false;
if (count($room_source) > 0) if (count($room_source) > 0)
@ -19,7 +19,7 @@ function mRoomList() {
* @param $id RID * @param $id RID
*/ */
function mRoom($id) { 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) if ($room_source === false)
return false; return false;
if (count($room_source) > 0) if (count($room_source) > 0)