Exemplo n.º 1
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;
}
Exemplo n.º 2
0
function ui_user_avatar_editor_branditems()
{
    $ajax = func_arg(0);
    $template_file = "modules/000_user_interface/templates/ui_user_avatar_editor_branditems.php";
    $basepath = $_SESSION['basepath'];
    $template = new Template();
    $logged_in = user_user_loggedin();
    // Deteksi User Agent
    // cek apakah user ini admin
    $is_admin = ui_user_is_admin();
    $template->logged_in = $logged_in;
    $template->is_admin = $is_admin;
    $template->basepath = $basepath;
    // dapatkan semua bagian avatar berdasar tipe
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Avatar');
    $avatar_array = array();
    // $tipe_array = array('face', 'face_part_eye_brows', 'face_part_eyes', 'face_part_lip', 'hair', 'pants', 'shoes', 'body', 'top', 'hand', 'hat');
    // face, hand tdk perlu diproses, karena tidak ditampilkan ke user
    $color_palette = array('face_part_eye_brows', 'face_part_eyes', 'face_part_lip', 'hair');
    $texture = array('pants', 'shoes', 'body', 'top', 'hat');
    $type_array = array_merge($color_palette, $texture);
    foreach ($type_array as $tipe_) {
        $var_name = $tipe_ . "_array";
        ${$var_name} = array();
        $lilo_mongo->selectCollection('Avatar');
        $avatar_ = $lilo_mongo->command_values(array("distinct" => "Avatar", "key" => "category", "query" => array('tipe' => $tipe_)));
        foreach ($avatar_ as $a_) {
            // dapatkan semua category + preview_picture + gender apa saja yg menggunakan category ini
            $gender_ = $lilo_mongo->command_values(array("distinct" => "Avatar", "key" => "gender", "query" => array('category' => $a_, 'tipe' => $tipe_)));
            foreach ($gender_ as $g_) {
                $size_ = $lilo_mongo->command_values(array("distinct" => "Avatar", "key" => "size", "query" => array('category' => $a_, 'tipe' => $tipe_, 'gender' => $g_)));
                foreach ($size_ as $s_) {
                    $prev_img_ = $lilo_mongo->findOne(array('preview_image' => array('$nin' => array('', false, 0)), 'gender' => $g_, 'category' => $a_, 'tipe' => $tipe_, 'gender' => $g_), array('preview_image'));
                    ${$var_name}[] = array('category' => $a_, 'preview_image' => $prev_img_['preview_image'], 'tipe' => $tipe_, 'gender' => $g_, 'size' => $s_, 'name' => $a_);
                }
            }
        }
        $avatar_array[$tipe_] = ${$var_name};
    }
    // dapatkan default avatar configuration utk [male x female] x [big x medium x small]
    require_once 'modules/003_avatar_editor/admin.php';
    $gender_array = array('male', 'female');
    $size_array = array('big', 'medium', 'small');
    foreach ($gender_array as $gender) {
        foreach ($size_array as $size) {
            ${'avatar_config_' . $gender . '_' . $size} = avatar_admin_get_default_configuration($gender, $size);
            $template->{'avatar_config_' . $gender . '_' . $size} = ${'avatar_config_' . $gender . '_' . $size};
        }
    }
    $template->session_id = $_SESSION['session_id'];
    $template->avatar_array = $avatar_array;
    $template->element_dir = $_SESSION['element_dir'];
    $template->material_dir = $_SESSION['material_dir'];
    $template->preview_dir = $_SESSION['preview_dir'];
    $user_property = user_user_property();
    $template->user_property = json_decode($user_property);
    $template->heartBeatInterval = 60000;
    $template->top = $template->render("modules/000_user_interface/templates/top.php");
    $template->left = $template->render("modules/000_user_interface/templates/left.php");
    $template->right = $template->render("modules/000_user_interface/templates/right.php");
    $template->bottom = $template->render("modules/000_user_interface/templates/bottom.php");
    $template->middle = $template->render($template_file);
    $return = $template->render("modules/000_user_interface/templates/ui_user_default.php");
    return $return;
}
Exemplo n.º 3
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;
}
Exemplo n.º 4
0
function friend_user_chatalert()
{
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Social');
    $lilo_mongo->selectCollection("ChatAlert");
    $user_id = $_SESSION['user_id'];
    $sender = $lilo_mongo->command_values(array("distinct" => "ChatAlert", "key" => "sender", "query" => array('receiver' => $user_id)));
    $count_sender = count($sender);
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection("Properties");
    for ($idx = 0; $idx < $count_sender; $idx++) {
        $fullname_idx = $count_sender + $idx;
        $sender_data = $lilo_mongo->findOne(array('lilo_id' => $sender[$idx]));
        $sender[$fullname_idx] = $sender_data['fullname'];
    }
    $lilo_mongo->selectDB('Social');
    $lilo_mongo->selectCollection("ChatAlert");
    $lilo_mongo->remove(array('receiver' => $user_id));
    return json_encode($sender);
}
Exemplo n.º 5
0
function message_user_loadmessages()
{
    // me-return 3 array: Home, Me, Inbox
    // - Home: status dari semua friends
    //		- dapatkan semua friendlist (friend_user_ws_friendlist)
    //		-
    //	$friendlist = friend_user_ws_friendlist();
    //	return print_r($friendlist, true);
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Social');
    $lilo_mongo->selectCollection('Friends');
    $user_id = $_SESSION['user_id'];
    $friends = $lilo_mongo->command_values(array("distinct" => "Friends", "key" => "friend_id", "query" => array('user_id' => $user_id)));
    $lilo_mongo->selectCollection('Shout');
    $array_parameter = array('user_id' => array('$in' => $friends));
    $limit = 100;
    $sort = array('time' => -1);
    $msg_home = array();
    $msg_home_cur = $lilo_mongo->find($array_parameter, $limit, $sort);
    while ($curr = $msg_home_cur->getNext()) {
        $user_properties = user_user_properties_by_uid($curr['user_id']);
        $msg_home[] = array("user_id" => $curr['user_id'], "shout_time" => $curr['shout_time'], "shout" => $curr['shout'], "circle" => $curr['circle'], "mentioned_friends" => $curr['mentioned_friends'], "mentioned_friends_notified" => $curr['mentioned_friends_notified'], "time" => $curr['time'], "lilo_id" => $curr['lilo_id'], "birthday" => $user_properties['birthday'], "fullname" => $user_properties['fullname'], "sender_id" => $user_properties['lilo_id'], "profile_picture" => $user_properties['profile_picture'], "sex" => $user_properties['sex'], "description" => $user_properties['description'], "time_word" => message_user_timetoword($curr['time']));
    }
    // - Me: status gw sendiri + status orang yg mention gw
    $array_parameter = array('user_id' => $user_id);
    $limit = 100;
    $sort = array('time' => -1);
    $msg_me = array();
    $msg_me_cur = $lilo_mongo->find($array_parameter, $limit, $sort);
    while ($curr = $msg_me_cur->getNext()) {
        $user_properties = user_user_properties_by_uid($curr['user_id']);
        $msg_me[] = array("user_id" => $curr['user_id'], "shout_time" => $curr['shout_time'], "shout" => $curr['shout'], "circle" => $curr['circle'], "mentioned_friends" => $curr['mentioned_friends'], "mentioned_friends_notified" => $curr['mentioned_friends_notified'], "time" => $curr['time'], "lilo_id" => $curr['lilo_id'], "birthday" => $user_properties['birthday'], "fullname" => $user_properties['fullname'], "sender_id" => $user_properties['lilo_id'], "profile_picture" => $user_properties['profile_picture'], "sex" => $user_properties['sex'], "description" => $user_properties['description'], "time_word" => message_user_timetoword($curr['time']));
    }
    // - Inbox: direct message, offline chat
    //		revisi: direct message hanya dari table DirectMessage, offline chat langsung masuk window chat saat user login
    $msg_inbox = array();
    $lilo_mongo->selectCollection('DirectMessage');
    $user_id = $_SESSION['user_id'];
    $array_parameter = array('to' => $user_id);
    $limit = 0;
    $sort = array('time' => -1);
    $msg_inbox_cur = $lilo_mongo->find($array_parameter, $limit, $sort);
    while ($curr = $msg_inbox_cur->getNext()) {
        $user_properties = user_user_properties_by_uid($curr['from']);
        $msg_inbox[] = array("from" => $curr['from'], "to" => $curr['to'], "datetime" => $curr['datetime'], "dm" => $curr['dm'], "time" => $curr['time'], "lilo_id" => $curr['lilo_id'], "birthday" => $user_properties['birthday'], "fullname" => $user_properties['fullname'], "sender_id" => $user_properties['lilo_id'], "profile_picture" => $user_properties['profile_picture'], "sex" => $user_properties['sex'], "description" => $user_properties['description'], "time_word" => message_user_timetoword($curr['time']));
    }
    // all messages
    $all_messages = array('msg_home' => $msg_home, 'msg_me' => $msg_me, 'msg_inbox' => $msg_inbox);
    return json_encode($all_messages);
}
Exemplo n.º 6
0
function user_admin_wsroomstatrangedate($date_start = NULL, $date_end = NULL, $room = NULL)
{
    // $date dalam format "n/j/Y", "7/9/2012"
    // dipanggil oleh user_admin_roomplayerstat
    // menampilkan data dari Game.RoomStats berdasar range tanggal yg dipilih user
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Game');
    $lilo_mongo->selectCollection('RoomStats');
    if (!isset($date_start)) {
        // $date_start = func_arg(0);
        // ga boleh lewat func_arg, soalnya: date ada tanda garis miring (/)
        $date_end = $_POST['date_start'];
    }
    if (!isset($date_end)) {
        // $date_end = func_arg(1);
        // ga boleh lewat func_arg, soalnya: date ada tanda garis miring (/)
        $date_end = $_POST['date_end'];
    }
    if (trim($date_end) == '') {
        $date_end = date("n/j/Y");
    }
    if (trim($date_start) == '') {
        // jika date_start kosong, set date_start dengan date_end - 10
        // int mktime ([ int $hour = date("H") [, int $minute = date("i") [, int $second = date("s") [, int $month = date("n") [, int $day = date("j") [, int $year = date("Y") [, int $is_dst = -1 ]]]]]]] )
        $date_end_expl = explode('/', $date_end);
        $date_end_m = $date_end_expl[0];
        $date_end_d = $date_end_expl[1];
        $date_end_y = $date_end_expl[2];
        $date_end_mktime = mktime(0, 0, 0, $date_end_m, $date_end_d, $date_end_y);
        $ten_days = 10 * 24 * 3600;
        $date_end_mktime -= $ten_days;
        $date_start = date("n/j/Y", $date_end_mktime);
    }
    if (!isset($room)) {
        $room = func_arg(2);
    }
    if (trim($room) == '') {
        // dapatkan semua room di table Game.RoomStats
        $rooms = $lilo_mongo->command_values(array('distinct' => 'RoomStats', 'key' => 'room'));
    } else {
        $rooms = array(0 => $room);
    }
    // die("<pre>" . print_r($rooms, true) . "</pre>");
    $result = array();
    foreach ($rooms as $r) {
        // dapatkan data di Game.RoomStats untuk room = $r dan date mulai dari date_start s.d. date_end
        // date sebagai key
        $date_start_expl = explode('/', $date_start);
        $date_start_m = $date_start_expl[0];
        $date_start_d = $date_start_expl[1];
        $date_start_y = $date_start_expl[2];
        $date_start_mktime = mktime(0, 0, 0, $date_start_m, $date_start_d, $date_start_y);
        $date_end_expl = explode('/', $date_end);
        $date_end_m = $date_end_expl[0];
        $date_end_d = $date_end_expl[1];
        $date_end_y = $date_end_expl[2];
        $date_end_mktime = mktime(0, 0, 0, $date_end_m, $date_end_d, $date_end_y);
        $one_day = 24 * 3600;
        for ($cur_date = $date_start_mktime; $cur_date <= $date_end_mktime; $cur_date += $one_day) {
            $cur_date_ = date("n/j/Y", $cur_date);
            $cur_date__ = date("n_j_Y", $cur_date);
            $r__ = str_replace(' ', '__space__', $r);
            $result[$r__][$cur_date__] = $lilo_mongo->findOne(array('date' => $cur_date_, 'room' => $r));
        }
    }
    return json_encode($result);
    // die("<pre>" . print_r($result, true) . "</pre>");
}
Exemplo n.º 7
0
function user_guest_property()
{
    $user_id = $_SESSION['user_id'];
    if (!isset($user_id)) {
        header("Location: " . $_SESSION['basepath']);
        exit;
    }
    $username = func_arg(0);
    if (!isset($username)) {
        $username = $_SESSION['username'];
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Account');
    $usernames = $lilo_mongo->command_values(array("distinct" => "Account", "key" => "username", "query" => array()));
    if (!in_array($username, $usernames)) {
        return "HTTP/1.0 404 Not Found";
    }
    $basepath = $_SESSION['basepath'];
    $template = new Template();
    $logged_in = user_user_loggedin();
    $template->logged_in = $logged_in;
    $template->basepath = $basepath;
    $template->session_id = user_user_sessionid();
    $template->element_dir = $_SESSION['element_dir'];
    $template->material_dir = $_SESSION['material_dir'];
    $template->preview_dir = $_SESSION['preview_dir'];
    //	$return = $template->render($template_file);
    //	return $return;
    $user_property = user_user_property();
    $user_property = json_decode($user_property);
    // dapatkan umur dan gender
    $user_property->age = date("Y") - $user_property->birthday_yy;
    $user_property->sex = ucfirst($user_property->sex);
    $template->user_property = $user_property;
    $template->heartBeatInterval = 60000;
    $template->top = $template->render("modules/000_user_interface/templates/top.php");
    $template->left = $template->render("modules/000_user_interface/templates/left.php");
    $template->right = $template->render("modules/000_user_interface/templates/right.php");
    $template->bottom = $template->render("modules/000_user_interface/templates/bottom.php");
    if ($username == $_SESSION['username']) {
        $template->middle = $template->render("modules/001_user_management/templates/user_guest_property.php");
    } else {
        $acc_prop = user_guest_accountproperties($username);
        $acc_prop['properties']['sex'] = ucfirst($acc_prop['properties']['sex']);
        $birthday_expl = explode('-', $acc_prop['properties']['birthday']);
        $acc_prop['properties']['age'] = date("Y") - (int) $birthday_expl[2];
        $template->account_properties = $acc_prop;
        $template->username = $username;
        $template->middle = $template->render("modules/001_user_management/templates/user_guest_property_other.php");
    }
    $return = $template->render("modules/000_user_interface/templates/ui_user_default.php");
    return $return;
}
Exemplo n.º 8
0
function report_admin_wsusercountquest()
{
    //Data Quest:
    //1a. Jumlah users yang mengaktifkan 1 Quest
    //1b. Jumlah users yang menyelesaikan 1 Quest
    //
    //2a. Jumlah users yang mengaktifkan 2 Quest
    //2b. Jumlah users yang menyelesaikan 2 Quest
    //
    //3a. Jumlah users yang mengaktifkan 3 Quest
    //3b. Jumlah users yang menyelesaikan 3 Quest
    //
    //4a. Jumlah users yang mengaktifkan 4 Quest
    //4b Jumlah users yang menyelesaikan 4 Quest
    // DB: Game.QuestJournal, Game.QuestActive
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Game');
    $lilo_mongo->selectCollection('QuestJournal');
    $all_users = $lilo_mongo->command_values(array('distinct' => "QuestJournal", 'key' => "userid"));
    $c_1 = array();
    $c_2 = array();
    $c_3 = array();
    $c_4 = array();
    foreach ($all_users as $u) {
        $criteria = array('userid' => $u);
        $count = $lilo_mongo->count($criteria);
        $user_acc_prop = report_admin_useraccountproperties($u);
        ${"c_" . $count}[] = $user_acc_prop;
    }
    $lilo_mongo->selectCollection('QuestActive');
    $all_users = $lilo_mongo->command_values(array('distinct' => "QuestActive", 'key' => "userid"));
    $cur_1 = array();
    $cur_2 = array();
    $cur_3 = array();
    $cur_4 = array();
    foreach ($all_users as $u) {
        $criteria = array('userid' => $u);
        $count = $lilo_mongo->count($criteria);
        $user_acc_prop = report_admin_useraccountproperties($u);
        ${"cur_" . $count}[] = $user_acc_prop;
    }
    $result = array('c_1' => $c_1, 'c_2' => $c_2, 'c_3' => $c_3, 'c_4' => $c_4, 'cur_1' => $cur_1, 'cur_2' => $cur_2, 'cur_3' => $cur_3, 'cur_4' => $cur_4);
    return json_encode($result);
}
Exemplo n.º 9
0
function avatar_guest_get_animation($user_id = NULL, $option = NULL)
{
    // dummy
    //	$anim_array = array('item_pants', 'walkin', 'idle1', 'walk');
    //
    //	if($option == 'json'){
    //		return json_encode($anim_array);
    //	}
    //
    //	return str_replace('"', "'", json_encode($anim_array));
    // dummy
    // revisi 111011: animation disesuaikan dgn gender yg dipilih user di avatar editor
    //	atau...
    //	saat ubah gender di avatar editor, langsung ubah Users.Animation?
    if (!isset($user_id)) {
        $user_id = func_arg(0);
    }
    if (!isset($user_id)) {
        $session_id = $_SESSION['session_id'];
        $user_id = avatar_guest_session_to_user_id($session_id);
    }
    // berdasar $user_id, dapatkan gender. defaultnya 'male'
    $gender = avatar_guest_get_gender($user_id);
    // dapatkan konfigurasi animation utk current user
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    $lilo_mongo->selectCollection('Animation');
    $conf = $lilo_mongo->findOne(array('user_id' => $user_id));
    if (is_array($conf)) {
        $config = array();
        $log = '';
        // cek dulu, apakah $conf['configuration'] sesuai gender di avatar dan sesuai asset di bundles/animations/
        for ($idx = 0; $idx < count($conf['configuration']); $idx++) {
            // format: [gender] [@] [animation_name]
            $anim_expl = explode('@', $conf['configuration'][$idx]);
            $conf['configuration'][$idx] = $gender . '@' . $anim_expl[1];
            $anim_file_exists = file_exists($_SESSION['basedir'] . '/bundles/animations/' . $conf['configuration'][$idx] . '.unity3d');
            $log .= '<br />' . $conf['configuration'][$idx] . '.unity3d' . ($anim_file_exists ? ' ada' : ' <b>ga</b> ada');
            if ($anim_file_exists) {
                $config[] = $conf['configuration'][$idx];
            }
        }
    } else {
        $config = array($gender . '@bye', $gender . '@happy', $gender . '@idle1', $gender . '@idle2', $gender . '@jump', $gender . '@pickup', $gender . '@run', $gender . '@walk');
    }
    // dapatkan semua di Assets.Animation yg permission-nya 'default'
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Animation');
    $anim_ = $lilo_mongo->command_values(array("distinct" => "Animation", "key" => "animation_file", "query" => array("gender" => $gender, "permission" => "default")));
    $default_anims = array();
    foreach ($anim_ as $a) {
        $a = str_replace(".unity3d", "", $a);
        if (!in_array($a, $config)) {
            $config[] = $a;
        }
    }
    return json_encode($config);
    //	if($option == 'json'){
    //return json_encode($conf['configuration']);
    //	}
    //	return print_r($conf['configuration'], true);
}