Example #1
0
#$data = '{"action":"msgbychatkey","chatkey":"23470661921002348105364269"}'
# $data = '{"action": "update", "authkey": "770073e57a7fcf79760c1555bdc5a908","fname":"Jo","lname":"Ogbimi","email":"*****@*****.**","photo":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCABkAGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19"}';
#$data = 'http://83.138.190.170/fuse/chat.php?json={%22action%22:%22sendmessage%22,%22msgid%22:%222347%22,%22chatkey%22:%2223470661921002348105364269%22,%22authkey%22:%22770073e57a7fcf79760c1555bdc5a908%22,%22sender%22:%222347066192100%22,%22receiver%22:%222348105364269%22,%22msgtype%22:%22text%22,%22msg%22:%22hello%20there%22,%22status%22:%22w%22}';
#exit;
$groupchat = new GroupChat();
switch ($action) {
    case 'creategroup':
        App::setJSONResponse($groupchat->createGroup($request['owner'], $request['groupname'], $request['members']));
        #App::setJSONResponse($groupchat->sendMessage($request['msgid']));
        break;
    case 'addtogroup':
        App::setJSONResponse($groupchat->addToGroup($request['owner'], $request['groupid'], $request['members']));
        #App::setJSONResponse($groupchat->getMessage());
        break;
    case 'exitgroup':
        App::setJSONResponse($groupchat->exitGroup($request['groupid'], $request['member']));
        break;
    case 'adminexit':
        App::setJSONResponse($groupchat->adminDeleteExit($request['groupid'], $request['owner']));
        break;
    case 'receiverstatusmsg':
        App::setJSONResponse($groupchat->getReceiverMsgByStatus($request['receiver'], $request['status']));
        break;
    case 'msgbychatkey':
        App::setJSONResponse($groupchat->getMsgByChatKey($request['chatkey']));
        break;
    case 'msgbyauthkey':
        App::setJSONResponse($groupchat->getMessageByAuthKey($request['chatkey']));
        break;
    default:
        App::setJSONResponse(array('Status' => App::getActionResponse('Unknown')));