Пример #1
0
function mobile_banner_list()
{
    $start_from = (int) func_arg(0);
    $limit = (int) func_arg(1);
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Banner');
    $temp_data = $lilo_mongo->find_pagging(array(), $start_from, $limit, array('dateAdd' => -1));
    $count = $lilo_mongo->count();
    $data = array();
    if ($temp_data) {
        foreach ($temp_data as $dt) {
            $_id = !isset($dt['_id']) ? "" : (string) $dt['_id'];
            $ID = !isset($dt['ID']) ? "" : $dt['ID'];
            $name = !isset($dt['name']) ? "" : $dt['name'];
            $Descriptions = !isset($dt['Descriptions']) ? "" : $dt['Descriptions'];
            $type = !isset($dt['type']) ? "" : $dt['type'];
            $urlPicture = !isset($dt['urlPicture']) ? "" : $dt['urlPicture'];
            $dataValue = !isset($dt['dataValue']) ? "" : $dt['dataValue'];
            $picture = !isset($dt['picture']) ? "" : $dt['picture'];
            $path_upload = URL_ASSET_IMAGE . "images/";
            $data[] = array('_id' => $_id, 'ID' => $ID, 'name' => $name, 'descriptions' => $Descriptions, 'type' => $type, 'urlPicture' => $urlPicture, 'dataValue' => $dataValue, 'picture' => $picture);
        }
    }
    $output = array('count' => $count, 'data' => $data);
    return json_encode($output);
}
Пример #2
0
function mobile_feature_list()
{
    $output = array();
    $email = func_arg(0);
    $func = func_arg(1);
    $start = func_arg(2);
    $limit = func_arg(3);
    if ($func == "root") {
        $output = __features_root();
    } else {
        if ($func == "allcolors") {
            $output['data'][] = array('tipe' => 'skincolor', 'title' => 'Skin Color', 'picture' => 'skincolor.png', 'action' => '/ItemFeature?f=skincolors', 'value' => '');
            $output = json_encode($output);
        } else {
            if ($func == "skincolors") {
                $output['count'] = 19;
                for ($i = 1; $i <= 19; $i++) {
                    $output['data'][] = array('tipe' => 'color' . $i, 'title' => 'Color #' . $i, 'picture' => $i . '.png', 'action' => '/AvatarPreview?f=color&v=' . $i, 'value' => '');
                }
                $output = json_encode($output);
            } else {
                $output = __features_part($email, $func, $start, $limit);
            }
        }
    }
    return $output;
}
Пример #3
0
function article_guest_get($alias = NULL)
{
    if (!isset($alias)) {
        $alias = func_arg(0);
    }
    $basepath = $_SESSION['basepath'];
    $template = new Template();
    $logged_in = user_user_loggedin();
    $template->logged_in = $logged_in;
    $template->basepath = $basepath;
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Articles');
    $lilo_mongo->selectCollection('Article');
    $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");
    //	$article_id = func_arg(0);
    //	$template_file = "modules/011_articles/templates_popbloopdark/article_guest_read_".$article_id.".php";
    //	$template->middle = $template->render($template_file);
    $article = $lilo_mongo->findOne(array('alias' => $alias));
    $template->middle = $article['text'];
    $return = $template->render("modules/000_user_interface/templates/ui_user_default.php");
    return $return;
}
Пример #4
0
function mobile_avastream_list()
{
    $start_from = (int) func_arg(0);
    $limit = (int) func_arg(1);
    $output = array();
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('AvatarStream');
    $temp_data = $lilo_mongo->find_pagging(array(), $start_from, $limit, array('dateAdd' => -1));
    $output['count'] = $lilo_mongo->count();
    if ($temp_data) {
        foreach ($temp_data as $dt) {
            $_id = !isset($dt['_id']) ? "" : (string) $dt['_id'];
            $ID = !isset($dt['ID']) ? "" : $dt['ID'];
            $name = !isset($dt['name']) ? "" : $dt['name'];
            $brand_id = !isset($dt['brand_id']) ? "" : $dt['brand_id'];
            $type = !isset($dt['type']) ? "" : $dt['type'];
            $urlPicture = !isset($dt['urlPicture']) ? "" : $dt['urlPicture'];
            $dataValue = !isset($dt['dataValue']) ? "" : $dt['dataValue'];
            $picture = !isset($dt['picture']) ? "" : $dt['picture'];
            $output['data'][] = array('_id' => $_id, 'ID' => $ID, 'name' => $name, 'brand_id' => $brand_id, 'type' => $type, 'dataValue' => $dataValue);
        }
    }
    return json_encode($output);
}
Пример #5
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';
}
Пример #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'];
}
Пример #7
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";
}
Пример #8
0
function ui_admin_avatar_editor()
{
    $ajax = func_arg(0);
    if ($ajax == 'ajax') {
        $basepath = $_SESSION['basepath'];
        $template = new Template();
        $logged_in = user_user_loggedin();
        // Deteksi User Agent
        $template->logged_in = $logged_in;
        $template->basepath = $basepath;
        $return = $template->render("modules/000_user_interface/templates/ui_admin_avatar_editor.php");
        return $return;
    } else {
        $template_file = "modules/000_user_interface/templates/ui_admin_avatar_editor.php";
        return ui_admin_default($template_file);
    }
}
Пример #9
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";
}
Пример #10
0
function mobile_content_detail()
{
    $_id = func_arg(0) != "" ? func_arg(0) : "";
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Articles');
    $lilo_mongo->selectCollection('ContentPage');
    $dt = $lilo_mongo->findOne(array("_id" => $lilo_mongo->mongoid($_id)));
    $output = array('title' => "No Title", 'text' => "no Text", 'alias' => "no alias", 'document_update' => date("Y-m-d H:i:s"), 'state_document' => "");
    if ($dt) {
        $tgl = "";
        if ($dt['document_update'] != "") {
            $tgl = date('Y-m-d H:i:s', $dt['document_update']->sec);
        }
        $title = !isset($dt['title']) ? "" : $dt['title'];
        $text = !isset($dt['text']) ? "" : $dt['text'];
        $alias = !isset($dt['alias']) ? "" : $dt['alias'];
        $state_document = !isset($dt['state_document']) ? "" : $dt['state_document'];
        $output = array('title' => $title, 'alias' => $alias, 'text' => replace_text_content(filter_text($text)), 'document_update' => $tgl, 'state_document' => $state_document);
    }
    return json_encode($output);
}
Пример #11
0
function mobile_stream_news()
{
    $_id = func_arg(0) != "" ? func_arg(0) : "";
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Articles');
    $lilo_mongo->selectCollection('ContentNews');
    $dt = $lilo_mongo->findOne(array("_id" => $lilo_mongo->mongoid($_id)));
    $output = array('title' => "No Title", 'text' => "no Text", 'update' => date("Y-m-d H:i:s"), 'state_document' => "");
    if ($dt) {
        $tgl = "";
        if ($dt['update'] != "") {
            $tgl = date('Y-m-d H:i:s', $dt['update']->sec);
        }
        $path_upload = URL_ASSET_IMAGE . "images/";
        $title = !isset($dt['title']) ? "" : $dt['title'];
        $text = !isset($dt['text']) ? "" : $dt['text'];
        $state_document = !isset($dt['state_document']) ? "" : $dt['state_document'];
        $picture = !isset($dt['picture']) ? "" : $dt['picture'];
        $output = array('title' => $title, 'text' => replace_text_content(filter_text($text)), 'update' => $tgl, 'imageName' => $picture, 'pathImage' => $path_upload, 'state_document' => $state_document);
    }
    return json_encode($output);
}
Пример #12
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);
}
Пример #13
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);
}
Пример #14
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);
}
Пример #15
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;
}
Пример #16
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;
}
Пример #17
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);
}
Пример #18
0
function message_guest_testusernameregex($string = NULL)
{
    if (!isset($string)) {
        $string = func_arg(0);
    }
    if (!isset($string)) {
        $string = 'RT @username: lorem ipsum @cjoudrey etc...';
    }
    preg_match_all('/@([A-Za-z0-9_]+)/', $string, $usernames);
    print_r($usernames[1]);
}
Пример #19
0
function message_user_shout_delete($lilo_id = NULL)
{
    if (!isset($lilo_id)) {
        $lilo_id = func_arg(0);
    }
    $user_id = $_SESSION['user_id'];
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Social');
    $lilo_mongo->selectCollection('Shout');
    $criteria = array('lilo_id' => $lilo_id, 'user_id' => $user_id);
    //die(print_r($criteria, true));
    $lilo_mongo->remove($criteria);
    // delete all related comments
    print "1";
    exit;
}
Пример #20
0
<?php

$str = 'aaa';
addWorld($str);
print $str . "\n";
function addWorld(&$str)
{
    $str .= ' world';
}
func_arg('aaa', 'bbb');
function func_arg()
{
    $list = func_get_args();
    var_dump($list);
    print 'arg_list ' . (is_array($list) ? 'is' : 'is not') . ' array' . "\n";
    print $list[0] . "\n";
    print $list[1] . "\n";
}
Пример #21
0
function mobile_store_brandlist()
{
    $start_from = (int) func_arg(0);
    $limit = (int) func_arg(1);
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Assets');
    $lilo_mongo->selectCollection('Brand');
    $temp_data = $lilo_mongo->find_pagging(array(), $start_from, $limit, array());
    $count = $lilo_mongo->count();
    $data = array();
    if ($temp_data) {
        foreach ($temp_data as $dt) {
            $brand_id = !isset($dt['brand_id']) ? "" : $dt['brand_id'];
            $website = !isset($dt['website']) ? "" : $dt['website'];
            $picture = !isset($dt['picture']) ? "" : $dt['picture'];
            $data[] = array('brand_id' => $brand_id, 'website' => $website, 'title' => $dt['name'], 'picture' => $picture, 'action' => '/Store?f=home', 'value' => '');
        }
    }
    $output = array('count' => $count, 'data' => $data);
    return json_encode($output);
}
Пример #22
0
function quest_admin_undoneplayerquest($questid = NULL, $userid = NULL)
{
    // hapus data dari QuestJournal
    $questid = isset($questid) ? $questid : func_arg(0);
    $userid = isset($userid) ? $userid : func_arg(1);
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Game');
    // Game: DialogStory, Dialog, DialogOption, Quest
    $lilo_mongo->selectCollection('QuestJournal');
    $criteria = array('questid' => intval($questid), 'userid' => $userid);
    // die(print_r($criteria, true));
    $lilo_mongo->remove($criteria);
    return "OK";
    //	die("questid: $questid, userid: $userid");
}
Пример #23
0
function user_admin_wsplayerstat($date = NULL)
{
    // $date dalam format "n/j/Y", "7/9/2012"
    // dipanggil oleh user_admin_roomplayerstat
    // menampilkan data dari Game.PlayerStats berdasar tanggal yg dipilih user
    if (!isset($date)) {
        $date = func_arg(0);
    }
    if (trim($date) == '') {
        $date = date("n/j/Y");
    }
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Game');
    $lilo_mongo->selectCollection('PlayerStats');
    // date, userid, room, visit
    $room_cursor = $lilo_mongo->find(array("date" => $date));
    $result = array();
    $no = 1;
    while ($room = $room_cursor->getNext()) {
        // dari $room['userid'] dapatkan data di Users.Account dan Users.Properties
        $lilo_mongo = new LiloMongo();
        $lilo_mongo->selectDB('Users');
        $lilo_mongo->selectCollection('Account');
        // email, username, join_date, lilo_id
        $criteria = array('lilo_id' => $room['userid']);
        $account = $lilo_mongo->findOne($criteria);
        $lilo_mongo->selectCollection('Properties');
        // lilo_id, fullname, avatarname, handphone, twitter, sex, birthday, location
        $criteria = array('lilo_id' => $room['userid']);
        $properties = $lilo_mongo->findOne($criteria);
        $result[] = array_merge(array('no' => $no), (array) $room, (array) $account, (array) $properties);
        $no++;
    }
    return json_encode($result);
}
Пример #24
0
function quest_admin_editdialogstory($lilo_id = NULL)
{
    if (!isset($lilo_id)) {
        $lilo_id = func_arg(0);
    }
    if (!isset($lilo_id)) {
        return false;
    }
    $dialog_story_detail = quest_admin_dialogstorydetailbyid($lilo_id);
}
Пример #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;
    }
}
Пример #26
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;
}
Пример #27
0
function ui_guest_microsite($file_to_load = NULL)
{
    if (!isset($file_to_load)) {
        $file_to_load = func_arg(0);
    }
    $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();
    $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("modules/000_user_interface/templates_microsite/" . $file_to_load . ".php");
    $return = $template->render("modules/000_user_interface/templates/ui_user_default.php");
    return $return;
}
Пример #28
0
function asset_admin_proto_to_class($proto_file = NULL)
{
    require_once 'libraries/protocolbuf/parser/pb_parser.php';
    if (!isset($proto_file)) {
        $proto_file = func_arg(0);
    }
    $proto_file = "user_generated_data/proto/" . $proto_file;
    $test = new PBParser();
    if (file_exists($proto_file)) {
        $test->parse($proto_file, 'user_generated_data/proto/');
        echo 'File parsing done!';
    } else {
        echo 'Stupid';
    }
}
Пример #29
0
function mobile_style_list()
{
    $email = func_arg(0);
    $func = func_arg(1);
    $output = array();
    if ($func == "root") {
        $output = __style_root();
    } else {
        if ($func == "accessories") {
            $output = __style_prop();
        } else {
            if ($func == "mix") {
                $output = __style_mix($email, 0, 0);
            } else {
                $output = __style_bodypart($email, $func, 0, 0);
            }
        }
    }
    return json_encode($output);
}
Пример #30
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;
}