Пример #1
0
 public static function send_msg($_chats)
 {
     //require("opendb.php");
     require_once "function.php";
     require_once "user.php";
     ChatsManager::addNewChats($_chats);
     $_gcmid = array(UserManager::getGcmIdById($_chats->recipient));
     return send_push_notification($_gcmid, $message = array("price" => $_chats->msg));
     //else echo 0;
     //require("closedb.php");
 }
Пример #2
0
     $_hx = array("number");
     $_tbx = AccountManager::getAllAcounts();
     show2($_hx, $_tbx);
     break;
 case "f":
     echo "<h1 style='color:#09C'>FRIEND DATA</h1>";
     require_once "friend.php";
     $_hx = array("uid", "fid", "share");
     $_tbx = FriendManager::getAllFriendList();
     show($_hx, $_tbx);
     break;
 case "c":
     echo "<h1 style='color:#09C'>CHAT DATA</h1>";
     require_once "chats.php";
     $_hx = array("timest", "sender", "recipient", "msg");
     $_tbx = ChatsManager::getAllChats();
     show($_hx, $_tbx);
     break;
 case "h":
     echo "<h1 style='color:#09C'>HISTORY DATA</h1>";
     require_once "history.php";
     $_hx = array("timest", "lat", "lng");
     $_tbx = HistoryManager::getAllUserHistory();
     show($_hx, $_tbx);
     break;
 case "l":
     echo "<h1 style='color:#09C'>LOCATION DATA</h1>";
     require_once "location.php";
     $_hx = array("lat", "lng", "street", "sublocality", "locality", "adminstrative_area", "country", "fulladdr");
     $_tbx = LocationManager::getAllLocationData();
     show($_hx, $_tbx);
            break;
        case 'SEND_FRIEND_ACCEPT':
            echo ChatsManager::send_msg(new Chats(NULL, $_REQUEST['senderid'], $_REQUEST['recipientid'], $_REQUEST['msg']));
            FriendManager::setShare($_REQUEST['recipientid'], $_REQUEST['senderid'], 2);
            FriendManager::setShare($_REQUEST['senderid'], $_REQUEST['recipientid'], 2);
            break;
        case 'SEND_SHARE_REQUEST':
            echo ChatsManager::send_msg(new Chats(NULL, $_REQUEST['senderid'], $_REQUEST['recipientid'], $_REQUEST['msg']));
            FriendManager::setShare($_REQUEST['senderid'], $_REQUEST['recipientid'], 3);
            FriendManager::setShare($_REQUEST['recipientid'], $_REQUEST['senderid'], 4);
            break;
        case 'SEND_SHARE_NOT_ACCEPT':
            echo ChatsManager::send_msg(new Chats(NULL, $_REQUEST['senderid'], $_REQUEST['recipientid'], $_REQUEST['msg']));
            FriendManager::setShare($_REQUEST['recipientid'], $_REQUEST['senderid'], 2);
            FriendManager::setShare($_REQUEST['senderid'], $_REQUEST['recipientid'], 2);
            break;
        case 'SEND_SHARE_ACCEPT':
            echo ChatsManager::send_msg(new Chats(NULL, $_REQUEST['senderid'], $_REQUEST['recipientid'], $_REQUEST['msg']));
            FriendManager::setShare($_REQUEST['recipientid'], $_REQUEST['senderid'], 5);
            FriendManager::setShare($_REQUEST['senderid'], $_REQUEST['recipientid'], 5);
            break;
        case 'HELP_MSG':
            $_myfriends = FriendManager::getFriendIdsById($_REQUEST['senderid']);
            foreach ($_myfriends as $_fid) {
                ChatsManager::send_msg(new Chats(NULL, $_REQUEST['senderid'], $_fid, $_default_msg));
            }
            break;
        default:
            echo "Unknown type";
    }
}