Exemple #1
0
function mobile_stream_count()
{
    $output['count'] = 0;
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Articles');
    $lilo_mongo->selectCollection('ContentNews');
    $output['count'] = $lilo_mongo->count(array("state_document" => "publish"));
    return json_encode($output);
}
Exemple #2
0
function mobile_banner_count()
{
    $output['count'] = 0;
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Banner');
    $output['count'] = $lilo_mongo->count();
    return json_encode($output);
}
Exemple #3
0
function server_admin_delete($server_to_delete = NULL)
{
    $server_id = isset($server_to_delete) ? $server_to_delete : func_arg(0);
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Servers');
    $lilo_mongo->selectCollection('GameServer');
    $lilo_mongo->remove(array('lilo_id' => $server_id));
    return '1';
}
Exemple #4
0
function mobile_avastream_count()
{
    $output['count'] = 0;
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('AvatarStream');
    $output['count'] = $lilo_mongo->count();
    return json_encode($output);
}
Exemple #5
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);
    }
}
Exemple #6
0
function asset_user_session_to_user_id($session_id = NULL)
{
    if (!isset($session_id)) {
        $session_id = func_arg(0);
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Session');
    $array_criteria = array('session_id' => $session_id);
    $result_array = $lilo_mongo->findOne($array_criteria);
    return $result_array['user_id'];
}
Exemple #7
0
function log_user_default()
{
    $log_type = $_REQUEST['log_type'];
    $log = $_REQUEST['log'];
    $stacktrace = $_REQUEST['stacktrace'];
    $ip_address = $_SERVER['REMOTE_ADDR'];
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Logs');
    $lilo_mongo->selectCollection('Error');
    $log_array = array('log_type' => $log_type, 'log' => $log, 'stacktrace' => $stacktrace, 'ip_address' => $ip_address);
    $lilo_mongo->insert($log_array);
    return "1";
}
Exemple #8
0
/**
 * examples:
 * -to get online time for user rully, use: http://localhost/popbloop/report/user/achievement/4df6e7192cbfd4e6c000fd9b/online_time/get
 * -to increase online time for user rully by 200ms, use: http://localhost/popbloop/report/user/achievement/4df6e7192cbfd4e6c000fd9b/online_time/dec/200
 */
function report_user_achievement($user_id = NULL, $achievement_type = NULL, $op = NULL, $value = NULL)
{
    $user_id = isset($user_id) ? $user_id : $_SESSION['user_id'];
    if (!isset($user_id)) {
        $user_id = func_arg(0);
    }
    if (!isset($achievement_type)) {
        $achievement_type = func_arg(1);
    }
    if (!isset($op)) {
        // inc, set, dec, * get
        // * = default
        $op = func_arg(2);
    }
    $op = strtolower(trim($op));
    if (!isset($value)) {
        $value = func_arg(3);
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Game');
    $lilo_mongo->selectCollection('Achievement');
    // jika ada, dapatkan dulu current value
    $criteria = array('tipe' => $achievement_type, 'userid' => $user_id);
    $curr_ach = $lilo_mongo->findOne($criteria);
    if (!($op == '' || $op == 'get') && count($curr_ach)) {
        $lilo_mongo->selectCollection('AchievementLog');
        // sebelum isi db diubah, backup dulu ke table AchievementLog
        $curr_ach_log = array_merge((array) $curr_ach, array('q' => $_REQUEST['q'], 'time' => time()));
        $lilo_mongo->insert($curr_ach_log);
    }
    $lilo_mongo->selectCollection('Achievement');
    switch ($op) {
        case '':
        case 'get':
            return $curr_ach['value'];
            break;
        case 'set':
            $lilo_mongo->update_set($criteria, array('value' => $value));
            break;
        case 'inc':
            $lilo_mongo->update_set($criteria, array('value' => (int) $curr_ach['value'] + (int) $value));
            break;
        case 'dec':
            $lilo_mongo->update_set($criteria, array('value' => (int) $curr_ach['value'] - (int) $value));
            break;
    }
    return "1";
}
Exemple #9
0
function check_session()
{
    //	return true;
    $session_id = $_SESSION['session_id'];
    $user_id = $_SESSION['user_id'];
    if (trim($user_id) != '' && trim($session_id) != '') {
        $lilo_mongo = new LiloMongo();
        $lilo_mongo->selectDB('Users');
        $lilo_mongo->selectCollection('Session');
        $exist = $lilo_mongo->findOne(array('session_id' => $session_id, 'user_id' => $user_id));
        if (!is_array($exist) || !count($exist)) {
            return false;
        }
        $cur_date = date("Y-m-d H:i:s");
        $lilo_mongo->update_set(array('session_id' => $session_id, 'user_id' => $user_id), array('time_end' => $cur_date));
    }
    return true;
}
Exemple #10
0
function log_guest_pageview($op, $var)
{
    // op: getall, var: ...
    // op: getbydate, var: 2012-03-28
    // op: inc, var: ...
    if (!isset($op)) {
        $op = func_arg(0);
    }
    if (!isset($var)) {
        $var = func_arg(1);
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Logs');
    $lilo_mongo->selectCollection('PageView');
    //
    // jika ada, dapatkan dulu current value
    $criteria = array('tipe' => $achievement_type, 'userid' => $user_id);
    $curr_ach = $lilo_mongo->findOne($criteria);
    if (!($op == '' || $op == 'get') && count($curr_ach)) {
        $lilo_mongo->selectCollection('AchievementLog');
        // sebelum isi db diubah, backup dulu ke table AchievementLog
        $curr_ach_log = array_merge((array) $curr_ach, array('q' => $_REQUEST['q'], 'time' => time()));
        $lilo_mongo->insert($curr_ach_log);
    }
    $lilo_mongo->selectCollection('Achievement');
    switch ($op) {
        case '':
        case 'get':
            return $curr_ach['value'];
            break;
        case 'set':
            $lilo_mongo->update_set($criteria, array('value' => $value));
            break;
        case 'inc':
            $lilo_mongo->update_set($criteria, array('value' => (int) $curr_ach['value'] + (int) $value));
            break;
        case 'dec':
            $lilo_mongo->update_set($criteria, array('value' => (int) $curr_ach['value'] - (int) $value));
            break;
    }
    return "1";
}
Exemple #11
0
function __getUserDetails($email)
{
    $mongo = new LiloMongo();
    $mongo->selectDB("Users");
    $mongo->selectCollection("Account");
    $id = "";
    $username = $email;
    $isValid = false;
    $gender = "male";
    $bodytype = "medium";
    $avatarname = "";
    $queryEmail = $mongo->findOne(array('email' => $email));
    if ($queryEmail) {
        $id = (string) $queryEmail['_id'];
        $username = $queryEmail['username'];
        $mongo->selectCollection("Properties");
        $queryProp = $mongo->findOne(array('lilo_id' => $id));
        if ($queryProp) {
            $gender = $queryProp['sex'];
            $bodytype = $queryProp['body_size'];
            $avatarname = $queryProp['avatarname'];
        } else {
            $datatinsert = array('lilo_id' => (string) $id, 'avatarname' => $username, 'fullname' => $username, 'sex' => $gender, 'body_size' => $bodytype, 'website' => '', 'link' => '', 'birthday' => '', 'birthday_dd' => '', 'birthday_mm' => '', 'birthday_yy' => '', 'state_mind' => '', 'about' => '', 'picture' => '', 'location' => '', 'handphone' => '', 'twitter' => '');
            $mongo->insert($datatinsert);
        }
        $isValid = true;
    }
    $output = array('id' => $id, 'username' => $username, 'avatarname' => $avatarname, 'gender' => $gender == "" || !isset($gender) ? "male" : $gender, 'bodytype' => $bodytype == "" || !isset($bodytype) ? "medium" : $bodytype);
    return $output;
}
Exemple #12
0
function __style_mix($email)
{
    $mongo = new LiloMongo();
    $userDetails = __getUserDetails($email);
    $id = $userDetails["id"];
    $gender = $userDetails['gender'];
    $bodytype = $userDetails['bodytype'];
    //echo $gender. " " . $bodytype;
    $mongo->selectDB("Users");
    $mongo->selectCollection("AvatarMix");
    $query = $mongo->find_pagging(array('gender' => $gender, 'bodytype' => $bodytype));
    $count = $mongo->count(array('gender' => $gender, 'bodytype' => $bodytype));
    $output = array();
    $output['count'] = $count;
    if ($query) {
        foreach ($query as $item) {
            $json = $item['configuration'];
            $output['data'][] = array('tipe' => 'Mix', 'title' => $item['name'], 'picture' => $item['picture'], 'action' => '/AvatarPreview?f=character' . '&id=' . (string) $item['_id'] . "&v=" . $json, 'value' => '');
        }
    }
    return $output;
}
Exemple #13
0
function asset_guest_get_lobby()
{
    // harusnya ini masuk di server management!!! pindahkan kesana!
    // dapatkan daftar Lobby dari table Assets.Level
    //$lilo_mongo = new LiloMongo();
    //$lilo_mongo->selectDB('Assets');
    //$lilo_mongo->selectCollection('Level');
    //
    //$lobby_cursor = $lilo_mongo->find(array('tags' => 'Lobby'));
    //
    //$lobby_name_list = '';
    //while($curr = $lobby_cursor->getNext()){
    //	$lobby_name_list .= $curr['name'];
    //}
    // dapatkan last room dari table Game.RoomHistory [userid, room]
    $userid = $_SESSION['user_id'];
    if (trim($userid) == '') {
        $session_id = $_REQUEST['token'];
        $userid = user_user_session_to_user_id($session_id);
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Game');
    $lilo_mongo->selectCollection('RoomHistory');
    $room_data = $lilo_mongo->findOne(array('userid' => $userid));
    // dapatkan IP dan Port dari table Game.LobbySetting
    $lilo_mongo->selectCollection('LobbySetting');
    $lobby_setting = $lilo_mongo->findOne(array());
    $room_data_ = '';
    if (is_array($lobby_setting) && count($lobby_setting)) {
        $ip = $lobby_setting['ip'];
        $port = $lobby_setting['port'];
        $room_history = $lobby_setting['room_history'];
        if (intval($room_history) == 1) {
            $room_data_ = $room_data['room'];
        }
    }
    return "{$ip}:{$port}," . $room_data_;
    // Contooh...
    //	return "124.66.160.109:5055," . $room_data['room'];	// sementara di disable
    return "124.66.160.109:5055,";
    // Contooh...
    //	return "124.66.160.109:5055," . $lobby_name_list;
    //	return "192.168.1.4:5055," . $lobby_name_list;
    //	return "192.168.1.6:5055," . $lobby_name_list;
    //	return "192.168.1.3:5055," . $lobby_name_list;
    //	return "192.168.1.106:5055," . $lobby_name_list;
}
Exemple #14
0
function visitor_count()
{
    require_once 'libraries/LiloMongo.php';
    $today = date("Y-m-d");
    if (!isset($_SESSION['pop_visitor_logged']) || $_SESSION['pop_visitor_logged'] != $today) {
        $lilo_mongo = new LiloMongo();
        $lilo_mongo->selectDB('Logs');
        $lilo_mongo->selectCollection('Visitor');
        $visitor_data = array('date' => $today, 'time' => date("H:i:s"), 'REMOTE_ADDR' => $_SERVER['REMOTE_ADDR'], 'HTTP_USER_AGENT' => $_SERVER['HTTP_USER_AGENT'], '_SERVER' => $_SERVER);
        $lilo_mongo->insert($visitor_data);
        $lilo_mongo->selectCollection('VisitorCounter');
        // date, count
        $criteria = array('date' => $today);
        $today_visitor_data = $lilo_mongo->findOne($criteria);
        $count = 0;
        if ($today_visitor_data) {
            $count = intval($today_visitor_data['count']);
        }
        $count++;
        $lilo_mongo->update_set(array('date' => $today), array('count' => $count), array("multiple" => true, 'upsert' => true));
        $_SESSION['pop_visitor_logged'] = $today;
    }
}
Exemple #15
0
function __features_part($email, $type, $start, $limit)
{
    $userData = __getUserDetails($email);
    $bodytype = $userData['bodytype'];
    $gender = $userData['gender'];
    $output = array();
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Avatar');
    $query1 = $lilo_mongo->find_pagging(array('tipe' => $type, 'gender' => $gender, 'size' => $bodytype), $start, $limit, array('last_update' => -1));
    $count1 = $lilo_mongo->count();
    $newType = str_replace("face_part_", "", $type);
    //echo "........... ". $newType . ".......";
    foreach ($query1 as $item) {
        if ($newType != $type) {
            $element = array('tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['material']));
        } else {
            $element = array('gender' => $gender, 'tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['element']), 'material' => str_replace(".unity3d", "", $item['material']));
        }
        $json = str_replace("\"", "'", json_encode($element));
        $output['data'][] = array('tipe' => $type, 'title' => $item['name'], 'picture' => $item['preview_image'], 'action' => '/AvatarPreview?f=' . $type . "&id=" . (string) $item['_id'] . "&v=" . $json, 'value' => '');
    }
    $query2 = $lilo_mongo->find_pagging(array('tipe' => $type, 'gender' => 'unisex'), $start, $limit, array('last_update' => -1));
    $count2 = $lilo_mongo->count();
    foreach ($query2 as $item) {
        if ($newType != $type) {
            $element = array('tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['material']));
        } else {
            $element = array('gender' => $gender, 'tipe' => $newType, 'element' => str_replace(".unity3d", "", $item['element']), 'material' => str_replace(".unity3d", "", $item['material']));
        }
        $json = str_replace("\"", "'", json_encode($element));
        $output['data'][] = array('tipe' => $type, 'title' => $item['name'], 'picture' => $item['preview_image'], 'action' => '/AvatarPreview?f=' . $type . "&id=" . (string) $item['_id'] . "&v=" . $json, 'value' => (string) $item['_id']);
    }
    $output['count'] = $count1 + $count2;
    return json_encode($output);
}
Exemple #16
0
function ui_user_new_avatar_name()
{
    $avatar_name = func_arg(0);
    $avatar_name = htmlspecialchars($avatar_name);
    // update properties avatarname utk lilo_id = $user_id
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Properties');
    $lilo_mongo->update_set(array('lilo_id' => $_SESSION['user_id']), array('avatarname' => $avatar_name));
    $_SESSION['avatarname'] = $avatar_name;
    header('Location: ' . $_SESSION['basepath']);
    exit;
}
Exemple #17
0
function mobile_query_setconfavatar()
{
    $user_email = func_arg(0);
    $id_user = _get_id_user($user_email);
    $get_type = func_arg(1);
    $get_field = func_arg(2);
    $get_field = $get_field == "all" ? "" : $get_field;
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Avatar');
    $filter = array("user_id" => $id_user);
    $data = $lilo_mongo->findOne($filter);
    $datareturn['isSuccsesUpdate'] = FALSE;
    if ($data) {
        $datatinsert = array();
        $datareturn['isSuccsesUpdate'] = TRUE;
        if ($get_type == "configurations") {
            $conf = json_decode(str_replace("'", '"', $data['configuration']));
            if ($get_field != "") {
                if (strtolower($get_field) == "all") {
                    $datanew = "";
                    $temp = isset($_GET['massage']) ? $_GET['massage'] : "";
                    $datatemparray = explode("|", $temp);
                    if ($datatemparray) {
                        foreach ($datatemparray as $jml_json) {
                            $datanew .= "{";
                            $datatemp = explode(",", $jml_json);
                            if ($datatemp) {
                                foreach ($datatemp as $dttemp) {
                                    $dtinsert = explode(":", $dttemp);
                                    $key = $dtinsert[0];
                                    $value = isset($dtinsert[1]) ? $dtinsert[1] : "";
                                    $datanew .= "'" . $key . "':'" . $value . "',";
                                }
                                $datanew = substr($datanew, 0, strlen($datanew) - 1);
                            }
                            $datanew .= "},";
                        }
                        $datanew = substr($datanew, 0, strlen($datanew) - 1);
                    }
                    $datatinsert = array("configuration" => "[" . $datanew . "]");
                } else {
                    foreach ($conf as $dt => $listtemp) {
                        if ($listtemp->tipe == $get_field) {
                            continue;
                        }
                        $datanew .= "{";
                        foreach ($listtemp as $dt_json => $value_key) {
                            $datanew .= "'" . $dt_json . "':'" . $value_key . "',";
                        }
                        $datanew = substr($datanew, 0, strlen($datanew) - 1);
                        $datanew .= "},";
                    }
                    $datanew .= "{";
                    $datamessage = isset($_GET['massage']) ? $_GET['massage'] : "";
                    $datajson = explode(",", $datamessage);
                    if ($datajson) {
                        foreach ($datajson as $dttemp) {
                            $dtinsert = explode(":", $dttemp);
                            $key = $dtinsert[0];
                            $value = isset($dtinsert[1]) ? $dtinsert[1] : "";
                            $datanew .= "'" . $key . "':'" . $value . "',";
                        }
                        $datanew = substr($datanew, 0, strlen($datanew) - 1);
                    }
                    $datanew .= "}";
                    $datatinsert = array("configuration" => "[" . $datanew . "]");
                }
            }
        } else {
            if ($get_type == "size") {
                $datasize = isset($_GET['massage']) ? $_GET['massage'] : "medium";
                $datatinsert = array("size" => $datasize);
            }
        }
        $lilo_mongo->update_set($filter, $datatinsert);
    } else {
        $size = "medium";
        $gender = "female";
        $lilo_mongo->selectDB("Assets");
        $lilo_mongo->selectCollection("DefaultAvatar");
        $data3 = $lilo_mongo->findOne(array('gender' => $gender, 'size' => $size));
        if ($data3) {
            $lilo_mongo->selectDB('Users');
            $lilo_mongo->selectCollection('Avatar');
            $lilo_mongo->update(array("size" => $size, "user_id" => $id_user), array('$set' => array("configuration" => $data3['configuration'])), array('upsert' => TRUE));
        }
    }
    return json_encode($datareturn);
}
Exemple #18
0
function unity_user_delstatus()
{
    $status_id = func_arg(0);
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('UserProfile');
    $cekada = $lilo_mongo->delete(array('_id' => $lilo_mongo->mongoid($status_id), 'lilo_id' => (string) $_SESSION['a_id']));
    $retData = array('success' => false, 'message' => "Status gagal dihapus");
    if ($cekada) {
        $retData = array('valid' => TRUE, 'status' => "Status berhasil dihapus");
    }
    return json_encode($retData);
}
Exemple #19
0
/**
 * return: array, detail user dari table Users.Account dan Users.Properties
 */
function friend_user_detailbyuserid($user_id = NULL)
{
    if (!isset($user_id)) {
        $user_id = func_arg(0);
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Account');
    $account_data = $lilo_mongo->findOne(array('lilo_id' => $user_id));
    $lilo_mongo->selectCollection('Properties');
    $property_data = $lilo_mongo->findOne(array('lilo_id' => $user_id));
    if (trim($property_data['foto']) == '') {
        $property_data['foto'] = 'default.png';
    }
    $property_data['foto_url'] = $_SESSION['basepath'] . 'user_generated_data/profile_picture/' . $property_data['foto'];
    $result = array_merge((array) $account_data, (array) $property_data);
    unset($result['lilo_id']);
    unset($result['_id']);
    unset($result['password']);
    return json_encode($result);
}
Exemple #20
0
function message_user_shout_reply()
{
    /*
    die(print_r($_REQUEST, true));
    
    Array
    (
        [q] => message/user/shout_reply
        [comment] => Reply to testsdfsdfsdfsdf
        [circle] => 
        [shout_id] => 4fa0897cc1b4ba341b000000
        [__utma] => 111872281.1470462402.1327380803.1336389708.1336418449.37
        [__utmz] => 111872281.1327380803.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
        [MANTIS_STRING_COOKIE] => d51124df32701606e74f6e86a7da46f7bfb7835038e6ea4748643db7e4c2f0c0
        [POSTNUKESID] => d365816dbaef684d8522d130c239fc29
        [PHPSESSID] => ibi020pgc7hiesda9dmih8gip1
        [__utmc] => 111872281
        [__utmb] => 111872281.0.10.1336418449
    )
    */
    extract($_REQUEST);
    if (!isset($shout_id)) {
        die("Error");
    }
    if (trim($comment) == '') {
        die('Error: empty comment');
    }
    $user_id = $_SESSION['user_id'];
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Social');
    $lilo_mongo->selectCollection('ShoutComment');
    $reply_data = array('shout_id' => $shout_id, 'datetime' => date("Y-m-d - H:i:s"), 'comment' => $comment, 'time' => time());
    $lilo_id = $lilo_mongo->insert($reply_data);
    $lilo_mongo->update($reply_data, array_merge($reply_data, array('lilo_id' => (string) $lilo_id)), array("multiple" => false));
    // delete all related comments
    print "OK";
    exit;
}
Exemple #21
0
function friend_user_isonline($user_id = null)
{
    $user_id = isset($user_id) ? $user_id : func_arg(0);
    //	$user_id = func_arg(0);
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Session');
    $session_data = $lilo_mongo->findOne(array('user_id' => $user_id));
    $online = 0;
    if (count($session_data)) {
        $idle_time = time() - strtotime($session_data['time_end']);
        $online = $idle_time < 5 * 60 ? 1 : 0;
    }
    return $online;
}
Exemple #22
0
function asset_admin_inventory()
{
    // CRUD for Assets.Inventory
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Inventory');
    // delete
    $delete = trim($_REQUEST['delete']);
    if ($delete != '') {
        $lilo_mongo->delete(array('lilo_id' => $delete));
        return "1";
    }
    // detail
    $detail = trim($_REQUEST['detail']);
    if ($detail != '') {
        $data = $lilo_mongo->findOne(array('lilo_id' => $detail));
        return json_encode($data);
    }
    // new_inventory
    $new_inventory = trim($_REQUEST['new_inventory']);
    if ($new_inventory == "1") {
        extract($_POST);
        // tipe, description, icon
        if (trim($tipe) != '') {
            $inventory_data = array('tipe' => $tipe, 'description' => $description, 'icon' => $icon);
            $lilo_id_ = $lilo_mongo->insert($inventory_data);
            $lilo_mongo->update($inventory_data, array_merge($inventory_data, array('lilo_id' => (string) $lilo_id_)), array("multiple" => false));
        }
    }
    // dapatkan data Assets.Inventory
    $inventory_array = $lilo_mongo->find();
    $html = '';
    $template = new Template();
    $template->basepath = $_SESSION['basepath'];
    $template->inventory_array = $inventory_array;
    $html = $template->render("modules/002_asset_management/templates/asset_admin_inventory.php");
    $html = ui_admin_default(NULL, $html);
    return $html;
}
Exemple #23
0
function quest_admin_dialogstorydetailbyid($lilo_id = NULL)
{
    if (!isset($lilo_id)) {
        $lilo_id = func_arg(0);
    }
    if (!isset($lilo_id)) {
        return false;
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Game');
    // Game: DialogStory, Dialog, DialogOption, Quest
    $lilo_mongo->selectCollection('DialogStory');
    $dialog_story = $lilo_mongo->findOne(array('lilo_id' => $lilo_id));
    $return = array();
    $data = $dialog_story['all_variable_2'];
    $return['Name'] = $data['dialog_story_name'];
    $return['Dialogs'] = array();
    // hitung jumlah dialog berdasar dialogid_x [x: 1, 2]
    $dialog_idx = 0;
    foreach ($data as $key => $val) {
        $pos = strpos($key, 'dialogid_');
        if ($pos !== false) {
            $key_expl = explode('_', $key);
            $return['Dialogs'][$dialog_idx]['ID'] = (int) $val;
            $return['Dialogs'][$dialog_idx]['Description'] = $data['description_' . $key_expl[1]];
            $return['Dialogs'][$dialog_idx]['Options'] = array();
            $option_idx = 0;
            foreach ($data as $key_ => $val_) {
                // dapatkan select_options_ $key_expl[1] _ xxx
                $pos_ = strpos($key_, 'select_options_' . $key_expl[1]);
                if ($pos_ !== false) {
                    $key_expl_ = explode('_', $key_);
                    $optidx = $key_expl_[3];
                    $return['Dialogs'][$dialog_idx]['Options'][$option_idx]['Tipe'] = (int) $val_;
                    $return['Dialogs'][$dialog_idx]['Options'][$option_idx]['Content'] = $data['option_content_choice_' . $key_expl[1] . '_' . $optidx];
                    $return['Dialogs'][$dialog_idx]['Options'][$option_idx]['Next'] = (int) $data['nextidoption_content_choice_' . $key_expl[1] . '_' . $optidx];
                    $option_idx++;
                }
            }
            $dialog_idx++;
        }
    }
    //	$return = json_encode($return);
    return $return;
    //	return str_replace('"', "'", $return);
}
Exemple #24
0
function user_user_properties_by_uid($user_id = NULL)
{
    if (!isset($user_id) || trim($user_id) == '') {
        return array();
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Properties');
    $criteria = array('lilo_id' => $user_id);
    $user_prop = $lilo_mongo->findOne($criteria);
    if (!isset($user_prop['profile_picture']) || trim($user_prop['profile_picture']) == '') {
        $user_prop['profile_picture'] = "default.png";
    }
    return $user_prop;
}
Exemple #25
0
function avatar_admin_preset($op = NULL)
{
    // CRUD
    // data selain op dikirim via post
    if (!isset($op)) {
        $op = func_arg(0);
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('DefaultAvatar');
    switch (strtolower(trim($op))) {
        case 'getall':
            $preset_cursor = $lilo_mongo->find();
            $result = array();
            while ($preset = $preset_cursor->getNext()) {
                $key = $preset['name'];
                $result[$key] = $preset;
            }
            $result_['default male thin'] = $result['default male thin'];
            $result_['default male medium'] = $result['default male medium'];
            $result_['default male fat'] = $result['default male fat'];
            $result_['default female thin'] = $result['default female thin'];
            $result_['default female medium'] = $result['default female medium'];
            $result_['default female fat'] = $result['default female fat'];
            return "<pre>" . print_r($result_, true) . "</pre>";
            return json_encode($result_);
            break;
    }
}
Exemple #26
0
function asset_admin_category()
{
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Category');
    $op = isset($op) ? $op : func_arg(0);
    $op = strtolower(trim($op));
    switch ($op) {
        case 'add':
            $data = array('name' => $_POST['name'], 'tipe' => $_POST['editor_div_type']);
            $anim_id = $lilo_mongo->insert($data);
            break;
        case 'delete':
            $lilo_mongo->remove(array('_id' => new MongoId($_POST['_id'])));
            break;
        case 'detail':
            $retval = $lilo_mongo->findOne(array('_id' => new MongoId($_POST['_id'])));
            $resultdetail = array('_id' => $_POST['_id'], 'name' => $retval['name'], 'tipe' => $retval['tipe']);
            echo json_encode($resultdetail);
            exit;
            break;
        case 'edit':
            $lilo_mongo->selectCollection('Category');
            $retval = $lilo_mongo->findOne(array('_id' => new MongoId($_POST['id'])));
            $lilo_mongo->selectCollection('Avatar');
            $lilo_mongo->update_set(array('category' => $retval['name']), array('category' => $_POST['name']));
            $lilo_mongo->selectCollection('Category');
            $lilo_mongo->update_set(array('_id' => new MongoId($_POST['id'])), array('name' => $_POST['name'], 'tipe' => $_POST['editor_div_type']));
            break;
    }
    $brand_data = $lilo_mongo->find(array(), 0, array("tipe" => 1));
    if ($_POST['showdt'] != '') {
        $brand_data = $lilo_mongo->find(array("tipe" => $_POST['showdt']), 0, array("tipe" => 1));
    }
    $returndt = array();
    foreach ($brand_data as $result) {
        $returndt[] = array('_id' => $result['_id'], 'name' => $result['name'], 'tipe' => $result['tipe']);
    }
    if (isset($_POST['json'])) {
        $listtabel = "";
        $listtabel .= "<table class='input_form' width='100%'>";
        $listtabel .= "<tr>";
        $listtabel .= "<th>Name</th>";
        $listtabel .= "<th>Avatar Body Part Type</th>";
        $listtabel .= "<th>Action</th>";
        $listtabel .= "</tr>";
        foreach ($brand_data as $dt) {
            $listtabel .= "<tr>";
            $listtabel .= "<td>" . $dt['name'] . "</td>";
            $listtabel .= "<td>" . $dt['tipe'] . "</td>";
            $listtabel .= "<td>";
            $listtabel .= "<button onclick='functionhapus(\"" . $dt['_id'] . "\");'>Delete</button>";
            $listtabel .= "<button onclick='functiongetdetail(\"" . $dt['_id'] . "\");'>Edit</button>";
            $listtabel .= "</td>";
            $listtabel .= "</tr>";
        }
        $listtabel .= "</table>";
        echo $listtabel;
        exit;
    }
    $html = '';
    $template = new Template();
    $template->basepath = $_SESSION['basepath'];
    $lilo_mongo->selectCollection('AvatarBodyPart');
    $listtipe = $lilo_mongo->find();
    $template->tipe_array = $listtipe;
    $template->category_array = $returndt;
    $html = $template->render("modules/002_asset_management/templates/asset_admin_category.php");
    $html = ui_admin_default(NULL, $html);
    return $html;
}
Exemple #27
0
function message_guest_allusernames()
{
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Account');
    $usernames = $lilo_mongo->command_values(array("distinct" => "Account", "key" => "username", "query" => array()));
    //return print_r($usernames, true);
    return $usernames;
}
Exemple #28
0
function unity_query_avatar_animation()
{
    $user_id = func_arg(0);
    $gender = "male";
    $lilo_mongo = new LiloMongo();
    /*
         //CODE BELOW COMMENTED, BECAUSE USERS DOESN'T HAVE SPECIFIC ANIMATIONS EMO ATM
    	
    	$lilo_mongo->selectDB('Users');
            $lilo_mongo->selectCollection('Animation');
            $data2 = $lilo_mongo->findOne(array("user_id" => $user_id));
            $output = "";
        if ($data2) 
        {
            $temp = array();
            foreach ($data2['configuration'] as $dt) {
                $temp[] = $dt;
            }
            $output = json_encode($temp);
        } 
        else 
        {*/
    $gender = __cek_gender($user_id);
    $lilo_mongo2 = new LiloMongo();
    $lilo_mongo2->selectDB('Assets');
    $lilo_mongo2->selectCollection('Animation');
    // Get the default animation
    $data4 = $lilo_mongo2->command_values(array("distinct" => "Animation", "key" => "animation_file", "query" => array("gender" => $gender, "permission" => "default")));
    // Sometimes the default animation is named Default, get that too
    $data5 = $lilo_mongo2->command_values(array("distinct" => "Animation", "key" => "animation_file", "query" => array("gender" => $gender, "permission" => "Default")));
    $list_temp = array($gender . '@bye', $gender . '@happy', $gender . '@idle1', $gender . '@idle2', $gender . '@jump', $gender . '@pickup', $gender . '@run', $gender . '@walk');
    if ($data4) {
        $temp = "";
        foreach ($data4['values'] as $dt2) {
            $temp = str_replace(".unity3d", "", $dt2);
            if (!in_array($temp, $list_temp)) {
                $list_temp[] = $temp;
            }
        }
        foreach ($data5['values'] as $dt2) {
            $temp = str_replace(".unity3d", "", $dt2);
            if (!in_array($temp, $list_temp)) {
                $list_temp[] = $temp;
            }
        }
        $output = json_encode($list_temp);
    }
    //}
    return $output;
}
Exemple #29
0
function mobile_mix_create()
{
    $email = func_arg(0);
    $mixName = func_arg(1);
    $configuration = $_POST["configuration"];
    $pathimages = PATH_IMAGE_UPLOAD;
    $allowedExts = array("jpg", "jpeg", "gif", "png");
    $success = FALSE;
    $message = "";
    $filename = $_FILES['file']['name'];
    if (isset($_FILES['file']["name"])) {
        if ($_FILES['file']['name'] != "") {
            $extension = end(explode(".", strtolower($_FILES['file']["name"])));
            //$filetype=$_FILES["file"]["type"];
            //$filesize=$_FILES["file"]["size"];
            if (in_array($extension, $allowedExts)) {
                if ($_FILES["file"]["error"] > 0) {
                    $message = "Invalid mix preview.";
                } else {
                    $path = $pathimages;
                    if (file_exists($path . $_FILES["file"]["name"])) {
                        $message = "Filename exists..";
                    } else {
                        //echo "File : " . $_FILES['file']['tmp_name'] . " => " .$path.$_FILES["file"]["name"];
                        if (@move_uploaded_file($_FILES["file"]["tmp_name"], $path . $_FILES["file"]["name"])) {
                            $message = "File berhasil terupload";
                            $success = TRUE;
                            $filename = $_FILES["file"]["name"];
                        } else {
                            $message = "File gagal terupload";
                        }
                    }
                }
            } else {
                $message = "Image type does not supported";
            }
        } else {
            $message = "Image data empty";
        }
    } else {
        $message = "Failed upload mix preview";
    }
    $userDetails = __getUserDetails($email);
    $mongo = new LiloMongo();
    $mongo->selectDB("Users");
    $mongo->selectCollection("AvatarMix");
    /*
    * 1. userid.
       2. authorname.
       3. Nama.
       4. Deskripsi
       5. tanggal dan jam pembuatan.
       6. konfigurasi
       7. gender.
       8. body type (medium, thin, fat)
       9. picture.(screenshot)
    */
    $data = array("userid" => $userDetails["id"], "author" => isset($userDetails["avatarname"]) ? $userDetails['avatarname'] : $userDetails['username'], "name" => $mixName, "description" => "", "date" => date('Y-m-d H:i:s'), "gender" => $userDetails["gender"], "bodytype" => $userDetails["bodytype"], "picture" => "mix/" . $filename, "configuration" => $configuration);
    $mongo->insert($data);
    $output = array('success' => $success, 'filename' => $filename, 'message' => $message);
    return json_encode($output);
}
Exemple #30
0
function article_guest_getslides()
{
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Articles');
    $lilo_mongo->selectCollection('Slideshow');
    $array_parameter = array();
    $limit = 0;
    $sort = array('no' => 1);
    $article_cursor = $lilo_mongo->find($array_parameter, $limit, $sort);
    $article_array = array();
    while ($curr = $article_cursor->getNext()) {
        $article_array[] = array('lilo_id' => $curr['lilo_id'], 'no' => $curr['no'], 'title' => $curr['title'], 'image' => $curr['image'], 'description' => $curr['description'], 'link' => $curr['link']);
    }
    return json_encode($article_array);
}