Esempio n. 1
0
function unity_user_newuser()
{
    $email = func_arg(0);
    $password = urldecode(func_arg(1));
    $username = urldecode(func_arg(2));
    $gender = func_arg(3) != "" ? func_arg(3) : "male";
    $statemind = urldecode(func_arg(4));
    $tgl_lahir = func_arg(5) != "" ? urldecode(func_arg(5)) : date('Y-m-d');
    $fb_id = func_arg(6) != "" ? func_arg(6) : "";
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Account');
    $cekada = $lilo_mongo->findOne(array("email" => $email));
    $retValid = FALSE;
    $retMessage = "Duplicate email";
    if (!$cekada) {
        $key = get_random(25);
        $id = $key;
        $activkey = date('Y-m-d H:i:s');
        $datatinsert = array('email' => $email, 'password' => md5($password), 'username' => $email, 'join_date' => $lilo_mongo->time(strtotime(date("Y-m-d H:i:s"))), 'activation_key' => md5($activkey), 'token_key' => md5($key), 'fb_id' => $fb_id, 'access' => '');
        $lilo_mongo->insert($datatinsert);
        // Sync between _id and lilo_id, this is a pain in the ass, why do need lilo_id in the first f*****g place????????????????//
        $findQuery = $lilo_mongo->findOne(array("email" => $email));
        if ($findQuery) {
            $lilo_id = $findQuery["_id"];
            $lilo_mongo->update_set(array("email" => $email), array("lilo_id" => (string) $lilo_id));
            $lilo_mongo->selectCollection('Properties');
            $pecahtgllahir = explode("-", $tgl_lahir);
            $datatinsert = array('lilo_id' => (string) $lilo_id, 'avatarname' => $username, 'fullname' => $username, 'sex' => $gender, 'website' => '', 'link' => '', 'birthday' => $tgl_lahir, 'birthday_dd' => $pecahtgllahir[2], 'birthday_mm' => $pecahtgllahir[1], 'birthday_yy' => $pecahtgllahir[0], 'state_mind' => $statemind, 'about' => '', 'picture' => '', 'location' => '', 'handphone' => '', 'twitter' => '');
            $lilo_mongo->insert($datatinsert);
            $lilo_mongo->selectCollection('UserProfile');
            $generatetime = date("Y-m-d H:i:s");
            $time_start = strtotime($generatetime);
            $datatinsert = array('lilo_id' => (string) $lilo_id, 'StateMind' => $statemind, 'date' => $lilo_mongo->time($time_start));
            $lilo_mongo->insert($datatinsert);
            $retValid = TRUE;
            $retMessage = "Succesfully created user: " . $email;
            write_session($id, md5($activkey), md5($key));
        }
    } else {
        write_session($cekada['_id'], $cekada['activation_key'], $cekada['token_key']);
    }
    $ret = array('valid' => $retValid, 'message' => $retMessage);
    return json_encode($ret);
}
Esempio n. 2
0
function pm_sms_query()
{
    header("Content-Type: text/xml");
    echo "<?xml version='1.0' encoding='UTF-8' ?>";
    $msisdn = isset($_GET['msisdn']) ? $_GET['msisdn'] : "";
    $message = isset($_GET['message']) ? $_GET['message'] : "";
    $contentid = isset($_GET['contentid']) ? $_GET['contentid'] : "";
    $realmsisdn = isset($_GET['realmsisdn']) ? $_GET['realmsisdn'] : "";
    $parameter = explode(" ", $message);
    $jns = strtolower(isset($parameter[1]) ? $parameter[1] : "");
    $koderedeem = isset($parameter[1]) ? $parameter[1] : "";
    $kodeavatar = isset($parameter[3]) ? $parameter[3] : "";
    $notelepon = isset($parameter[4]) ? $parameter[4] : "";
    $dataxml = array('msisdn' => $msisdn, 'response' => "1", 'option' => "0", 'charge' => "0", 'appid' => "", 'partnerid' => "", 'mediaid' => "", 'trxid' => "", 'hptype' => "ALL", 'shortname' => "", 'contenttype' => "1", 'priority' => "1", 'contentid' => $contentid, 'desc' => "", 'mesage' => "Maaf, avatar item " . $koderedeem . " tidak valid, silakan coba lagi.");
    switch ($jns) {
        case "av":
            $lilo_mongo = new LiloMongo();
            $lilo_mongo->selectDB('Assets');
            $lilo_mongo->selectCollection('Avatar');
            $data = $lilo_mongo->find(array("code" => $koderedeem, "payment" => array('$in' => array('Unlock', 'Paid'))));
            if ($data) {
                $idavatar = $data['_id'];
                $count = 1;
                $kodegenerate = get_random(10);
                $lilo_mongo->selectCollection('Redeem');
                $datatinsert = array('code' => $kodegenerate, 'count' => $count, 'expire' => '', 'create' => $lilo_mongo->time(strtotime(date("Y-m-d H:i:s"))));
                $lilo_mongo->insert($datatinsert);
                $data2 = $lilo_mongo->findOne(array("code" => $kodegenerate));
                if ($data2) {
                    $idredeem = $data2['_id'];
                    $lilo_mongo->selectCollection('RedeemAvatar');
                    foreach ($data as $tampung) {
                        $datatinsert = array('avatar_id' => (string) $tampung['_id'], 'code_id' => (string) $idredeem);
                        $lilo_mongo->insert($datatinsert);
                    }
                    $dataxml['msisdn'] = $msisdn;
                    $dataxml['contentid'] = $contentid;
                    $dataxml['mesage'] = "Selamat, avatar item " . $koderedeem . " menjadi milik anda. Ini redeem codenya: " . $kodegenerate . ".";
                    echo return_xml($dataxml);
                } else {
                    $dataxml['msisdn'] = $msisdn;
                    $dataxml['contentid'] = $contentid;
                    $dataxml['mesage'] = "Maaf, avatar item " . $koderedeem . " Gagal tergenerate, silakan coba lagi.";
                    echo return_xml($dataxml);
                }
            } else {
                echo return_xml($dataxml);
            }
            break;
        default:
            echo return_xml($dataxml);
    }
}
Esempio n. 3
0
function generate_redeem_avatar($avatar_item_code, $count)
{
    $code = get_random(10);
    $lilo_mongo = new LiloMongo();
    $id = $lilo_mongo->mongoid($code . date('YmdHis'));
    $lilo_mongo->selectDB('Assets');
    // Create Redeem
    $lilo_mongo->selectCollection('Redeem');
    $generatetime = date("Y-m-d H:i:s");
    $time_start = strtotime($generatetime);
    $datatinsert = array('code' => $code, 'count' => $count, 'expire' => '', 'create' => $lilo_mongo->time($time_start), '_id' => $id);
    $result = $lilo_mongo->insert($datatinsert);
    $redeemId = (string) $id;
    // Create Mapping Avatar
    $lilo_mongo->selectCollection('Avatar');
    $data = $lilo_mongo->find(array("code" => $avatar_item_code));
    $datareturn = array();
    if ($data) {
        $lilo_mongo->selectCollection('RedeemAvatar');
        foreach ($data as $tampung) {
            $dataaddnew = array('avatar_id' => (string) $tampung['_id'], 'code_id' => $redeemId);
            $lilo_mongo->insert($dataaddnew);
            $datareturn[] = $dataaddnew;
        }
    }
    $ret = array('id' => $datareturn, 'code' => $code);
    return $ret;
}
Esempio n. 4
0
function mobile_social_addcommentnews()
{
    $user_email = func_arg(0);
    $user_id = _get_id_user($user_email);
    $news_id = func_arg(1);
    $comment = isset($_GET['comment']) ? $_GET['comment'] : "";
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Social');
    $lilo_mongo->selectCollection('NewsComments');
    $data = $lilo_mongo->insert(array("user_id" => $user_id, "news_id" => $news_id, "comment" => $comment, "datetime" => $lilo_mongo->time(strtotime(date("Y-m-d H:i:s")))));
    $output['count'] = $lilo_mongo->count(array("news_id" => $news_id));
    return json_encode($output);
}
Esempio n. 5
0
function mobile_avatar_addcollections()
{
    $user_id = func_arg(0);
    $subject = isset($_GET['subject']) ? $_GET['subject'] : "";
    $descriptions = isset($_GET['description']) ? $_GET['description'] : "";
    $skin = isset($_GET['skin']) ? $_GET['skin'] : "1";
    $gender = isset($_GET['gender']) ? $_GET['gender'] : "male";
    $eyebrows = isset($_GET['eyebrows']) ? $_GET['eyebrows'] : "";
    $eyes = isset($_GET['eyes']) ? $_GET['eyes'] : "";
    $lip = isset($_GET['lip']) ? $_GET['lip'] : "";
    $element_hair = isset($_GET['element_hair']) ? $_GET['element_hair'] : "";
    $hair = isset($_GET['hair']) ? $_GET['hair'] : "";
    $element_body = isset($_GET['element_body']) ? $_GET['element_body'] : "";
    $body = isset($_GET['body']) ? $_GET['body'] : "";
    $element_pants = isset($_GET['element_pants']) ? $_GET['element_pants'] : "";
    $pants = isset($_GET['pants']) ? $_GET['pants'] : "";
    $element_shoes = isset($_GET['element_shoes']) ? $_GET['element_shoes'] : "";
    $shoes = isset($_GET['shoes']) ? $_GET['shoes'] : "";
    $element_hat = isset($_GET['element_hat']) ? $_GET['element_hat'] : "";
    $hat = isset($_GET['hat']) ? $_GET['hat'] : "";
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('AvatarCollection');
    $configurations = "[{'tipe':'Skin','color':'" . $skin . "'},{'tipe':'Hand','element':'" . $gender . "_body_hand','material':'" . $gender . "_body'},{'tipe':'gender','element':'" . $gender . "_base'},{'tipe':'Face','element':'" . $gender . "_head','material':'' ,'eye_brows':'" . $eyebrows . "','eyes':'" . $eyes . "','lip':'" . $lip . "'},{'tipe':'Hair','element':'" . $element_hair . "','material':'" . $hair . "'},{'tipe':'Body','element':'" . $element_body . "','material':'" . $body . "'},{'tipe':'Pants','element':'" . $element_pants . "','material':'" . $pants . "'},{'tipe':'Shoes','element':'" . $element_shoes . "','material':'" . $shoes . "'},{'tipe':'Hat','element':'" . $element_hat . "','material':'" . $hat . "'}]";
    $datainsert = array("user_id" => $user_id, "configuration" => $configurations, "subject" => $subject, "descriptions" => $descriptions, "gender" => $gender, "date_add" => $lilo_mongo->time(strtotime(date("Y-m-d H:i:s"))));
    $lilo_mongo->insert($datainsert);
    $output['collectionsCount'] = $lilo_mongo->count(array("user_id" => $user_id));
    return json_encode($output);
}