function ui_guest_default($template_file = NULL, $html_string = NULL) { $basepath = $_SESSION['basepath']; $template = new Template(); $logged_in = user_user_loggedin(); $template->logged_in = $logged_in; // Deteksi User Agent $template->basepath = $basepath; if ($logged_in) { header('Location: ' . $basepath . 'ui/user/avatar_editor_categorized'); exit; // definisikan content untuk header, footer, left, center dan right if (isset($template_file) && is_file($template_file)) { $middle = $template->render($template_file); } else { if (isset($html_string)) { $middle = $html_string; } else { // defaultnya tampilin apa bro? // $middle = $template->render("modules/000_user_interface/templates/ui_user_logged_in.php"); $middle = $template->render("modules/005_messaging/templates_popbloopdark/message_user_status.php"); } } $template->middle = $middle; $user_property = user_user_property(); $template->user_property = json_decode($user_property); $template->heartBeatInterval = 60000; // komponen2 template lain $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"); $return = $template->render("modules/000_user_interface/templates/ui_guest_default.php"); return $return; } else { // definisikan content untuk header, footer, left, center dan right // $middle = file_get_contents($basepath . "user/user/login_form"); // $middle = $template->render("modules/000_user_interface/templates/ui_guest_not_logged_in.php"); $middle = $template->render("modules/000_user_interface/templates/ui_guest_landing.php"); $template->top = NULL; $template->left = NULL; $template->right = NULL; $template->bottom = NULL; $template->middle = $middle; $return = $template->render("modules/000_user_interface/templates/ui_guest_default.php"); return $return; } }
function report_admin_achievement($op = NULL, $rettype = NULL, $achtype = NULL) { $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Game'); $lilo_mongo->selectCollection('Achievement'); $op = isset($op) ? $op : func_arg(0); $op = strtolower(trim($op)); // read, add, edit, delete switch ($op) { case 'get': case 'read': // report/admin/achievement/get/[rettype]/[achtype] // report/admin/achievement/get/json/all // report/admin/achievement/get/array/online_time $rettype = isset($rettype) ? $rettype : func_arg(1); $rettype = strtolower(trim($rettype)); $achtype = isset($achtype) ? $achtype : func_arg(2); $achtype = strtolower(trim($achtype)); $criteria = array(); if ($achtype != '' && $achtype != 'all') { $criteria = array('tipe' => $achtype); } $ach_cursor = $lilo_mongo->find($criteria); $ach_array = array(); while ($curr = $ach_cursor->getNext()) { $tipe = $curr['tipe']; // dari $curr['user_id'] dapatkan username $user_detail = user_user_property(array('lilo_id' => $curr['user_id']), 'array'); $ach_array[$tipe][] = array('lilo_id' => $curr['lilo_id'], 'user_id' => $curr['user_id'], 'tipe' => $curr['tipe'], 'value' => $curr['value'], 'username' => $user_detail['username'], 'fullname' => $user_detail['fullname'], 'email' => $user_detail['email']); } if (strtolower(trim($rettype)) == 'json') { $ach_array = json_encode($ach_array); } return $ach_array; break; case 'edit': break; case 'delete': break; } $html = ''; $template = new Template(); $template->basepath = $_SESSION['basepath']; $html = $template->render("modules/007_statistic_reporting_service/templates/report_admin_achievement.php"); $html = ui_admin_default(NULL, $html); return $html; }
function ui_admin_default($template_file = NULL, $html_string = NULL) { $basepath = $_SESSION['basepath']; $template = new Template(); $is_admin = user_admin_is_admin(); // Deteksi User Agent $template->basepath = $basepath; if ($is_admin) { // definisikan content untuk header, footer, left, center dan right if (isset($template_file) && is_file($template_file)) { $middle = $template->render($template_file); } else { if (isset($html_string)) { $middle = $html_string; } else { // defaultnya tampilin apa bro? $middle = $template->render("modules/000_user_interface/templates/ui_admin_logged_in.php"); } } } else { // definisikan content untuk header, footer, left, center dan right // $middle = file_get_contents($basepath . "user/user/login_form"); $middle = $template->render("modules/000_user_interface/templates/ui_admin_not_logged_in.php"); } $template->middle = $middle; $user_property = user_user_property(); $template->user_property = json_decode($user_property); $template->heartBeatInterval = 60000; // komponen2 template lain $template->is_admin = $is_admin; $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"); $return = $template->render("modules/000_user_interface/templates/ui_admin_default.php"); return $return; }
function ui_user_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; }
function friend_user_facebook_invite() { $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/ui_user_play.php"); // $template->middle = $template->render("modules/004_friends/templates/friend_user_people.php"); $template->middle = $template->render("modules/004_friends/templates/friend_user_facebook_invite.php"); $return = $template->render("modules/000_user_interface/templates/ui_user_default.php"); return $return; }
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; }
function message_guest_shouttest() { $basepath = $_SESSION['basepath']; $template = new Template(); $logged_in = user_user_loggedin(); $template->logged_in = $logged_in; // Deteksi User Agent $template->basepath = $basepath; $middle = $template->render("modules/005_messaging/templates/message_guest_shouttest.php"); $template->middle = $middle; $template->username = $_SESSION['username']; $user_property = user_user_property(); $template->user_property = json_decode($user_property); $template->heartBeatInterval = 60000; // komponen2 template lain $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"); $return = $template->render("modules/000_user_interface/templates/ui_user_default.php"); return $return; }
function message_user_status() { // return print_r($_REQUEST, true); $basepath = $_SESSION['basepath']; $template = new Template(); $logged_in = user_user_loggedin(); $template->logged_in = $logged_in; $template->basepath = $basepath; // dapatkan semua bagian avatar berdasar tipe $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Assets'); $lilo_mongo->selectCollection('Avatar'); $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_file = "modules/005_messaging/templates_popbloopdark/message_user_status.php"; $template->middle = $template->render($template_file); $return = $template->render("modules/000_user_interface/templates/ui_user_default.php"); return $return; }
function user_admin_wscurrentplayer() { // ambil data dari Game.Concurrent (user_id, room, datetime) $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Game'); $lilo_mongo->selectCollection('Concurrent'); $cc_cursor = $lilo_mongo->find(); $ccs = array(); while ($cc = $cc_cursor->getNext()) { $user_property = user_user_property(array('lilo_id' => $cc['user_id']), 'array'); $ccs[] = array_merge((array) $cc, (array) $user_property); } return json_encode($ccs); }
function quest_admin_wsquesttoplayer($type = NULL, $questid = NULL, $sort_by = NULL, $asc_desc = NULL) { // input: quest id // return: semua player yg selesaikan quest ini // Game.QuestJournal if (!isset($type)) { $type = func_arg(0); } if (!isset($questid)) { $questid = func_arg(1); } $questid = intval($questid); $lilo_mongo = new LiloMongo(); $lilo_mongo->selectDB('Game'); // Game: DialogStory, Dialog, DialogOption, Quest if (trim(strtolower($type)) == 'completed' || trim(strtolower($type)) == 'csv_completed') { $lilo_mongo->selectCollection('QuestJournal'); $criteria = array('questid' => $questid); $journal_cursor = $lilo_mongo->find($criteria); $result = array(); while ($journal = $journal_cursor->getNext()) { // dari $journal['userid'], dapatkan properti player $player_property = user_user_property(array('lilo_id' => $journal['userid'])); // dari $journal['start_date'] & $journal['end_date'] dapatkan durasi if (trim($journal['start_date']) != '' && trim($journal['end_date']) != '') { $duration = unitytounixtime(trim($journal['end_date'])) - unitytounixtime(trim($journal['start_date'])); // $duration = date("Y-m-d H:i:s", $duration); $journal['duration'] = sec2hms($duration); } $result[] = array_merge((array) json_decode($player_property), $journal); } // die('<pre>' . print_r($result, true) . '</pre>'); if (trim(strtolower($type)) == 'csv_completed') { // dari $result, generate csv header('Content-Type: application/csv'); header('Content-Disposition: attachment; filename=Quest.' . $questid . '.completed.player.' . time() . '.csv'); header('Pragma: no-cache'); //# Titlte of the CSV //$Content = "Name,Address,Age,Phone \n"; //# fill data in the CSV //$Content .= "\"John Doe\",\"New York, USA\",15,65465464 \n"; // //echo $Content; // User Name Full Name Handphone Email Twitter Start Date End Date Duration $csv_string = "User Name, Avatar Name, Full Name, Handphone, Email, Twitter, Start Date, End Date, Duration \n"; foreach ($result as $res) { $csv_string .= $res['username'] . ", " . $res['avatarname'] . ", " . $res['fullname'] . ", " . $res['handphone'] . ", " . $res['email'] . ", " . $res['twitter'] . ", " . $res['start_date'] . ", " . $res['end_date'] . ", " . $res['duration'] . " \n"; } echo $csv_string; exit; } return json_encode($result); } else { $lilo_mongo->selectCollection('QuestActive'); $criteria = array('questid' => $questid); $journal_cursor = $lilo_mongo->find($criteria); $result = array(); while ($journal = $journal_cursor->getNext()) { // dari $journal['userid'], dapatkan properti player // SAMPE SENEEE... $player_property = user_user_property(array('lilo_id' => $journal['userid'])); $result[] = array_merge((array) json_decode($player_property), $journal); } // die('<pre>' . print_r($result, true) . '</pre>'); return json_encode($result); } }
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; }