public function overwriteForm($return, $returnfull)
 {
     $return = parent::overwriteForm($return, $returnfull);
     $return['camp_client_id'] = new \Leap\View\InputTextArea("camp_client_id", "camp_client_id", $this->camp_client_id);
     $return['camp_start'] = new \Leap\View\InputText("date", "camp_start", "camp_start", $this->camp_start);
     for ($x = 0; $x < 24; $x++) {
         if ($x < 10) {
             $arrs[$x] = "0" . $x . ".00";
         } else {
             $arrs[$x] = $x . ".00";
         }
     }
     $return['camp_hour'] = new \Leap\View\InputSelect($arrs, "camp_hour", "camp_hour", $this->camp_hour);
     $return['camp_active'] = new \Leap\View\InputSelect($this->arrayYesNO, "camp_active", "camp_active", $this->camp_active);
     $return['camp_msg'] = new \Leap\View\InputTextRTE("camp_msg", "camp_msg", $this->camp_msg);
     $return['camp_msg'] = new \Leap\View\InputTextArea("camp_msg", "camp_msg", $this->camp_msg);
     $return['camp_url'] = new \Leap\View\InputText("text", "camp_url", "camp_url", $this->camp_url);
     $return['camp_img'] = new \Leap\View\InputFoto("camp_img", "camp_img", $this->camp_img);
     $return['camp_create_by'] = new \Leap\View\InputText("hidden", "camp_create_by", "camp_create_by", Account::getMyID());
     $return['camp_status'] = new \Leap\View\InputSelect($this->arrStatus, "camp_status", "camp_status", $this->camp_status);
     $return['spdivider']['camp_client_id'] = "Filter";
     $return['spdivider']['camp_start'] = "Campaign";
     $return['spdivider']['camp_client_id'] = "Accounts";
     return $return;
 }
 public function myAbsensiWidget()
 {
     $murid = new Murid();
     $murid->default_read_coloms = "*";
     $murid->getByAccountID(Account::getMyID());
     $mon = Absensi::getBulan();
     $year = Absensi::getTahun();
     $abs = new Absensi();
     $murid->absensi = $abs->getAbsensiEinzel($murid->murid_id, $mon, $year);
     $return['webClass'] = __CLASS__;
     $return['method'] = __FUNCTION__;
     $return['murid'] = $murid;
     $return['absensi'] = $murid->absensi;
     $return['mon'] = $mon;
     $return['year'] = $year;
     $return['ta'] = TahunAjaran::ta();
     //ambil kejadian dlm bulan
     //$cal = new Calendar();
     //$return['calendar'] = $cal->getCalinMonth(Absensi::getBulan());
     $return['refreshID'] = "myAbsensiWidget";
     // get number of day dlm sebulan
     //$num_of_days = cal_days_in_month(CAL_GREGORIAN, $mon, $year);
     //$return["numDays"] = $num_of_days;
     Mold::both("murid/absensi_widget", $return);
 }
 public static function moveStock($prod_id, $jumlah, $minus = 1, $note = "", $po_id = 0)
 {
     $prod = new ProdModel();
     $prod->getByID($prod_id);
     //isi log
     $ps = new ProdStok();
     $ps->stok_date = leap_mysqldate();
     $ps->stok_prev = $prod->prod_stock;
     $ps->stok_po_id = $po_id;
     $ps->stok_prod_id = $prod->prod_id;
     $ps->stok_userid = Account::getMyID();
     if ($minus) {
         //kurangi stok
         $prod->prod_stock -= $jumlah;
     } else {
         //kurangi stok
         $prod->prod_stock += $jumlah;
     }
     $prod->load = 1;
     $prod->save();
     if (Role::hasRole('admin')) {
         $ps->stock_admin = 1;
     }
     $ps->stock_note = $note;
     $ps->stok_actual = $prod->prod_stock;
     if ($ps->stok_prev > $ps->stok_actual) {
         $ps->stok_debit_credit = 1;
     } else {
         $ps->stok_debit_credit = 0;
     }
     return $ps->save();
 }
 public function overwriteForm($return, $returnfull)
 {
     $return = parent::overwriteForm($return, $returnfull);
     $return['topic_author'] = new Leap\View\InputText("hidden", "topic_author", "topic_author", Account::getMyID());
     if ($_GET['load']) {
         $return['topic_date'] = new Leap\View\InputText("hidden", "topic_date", "topic_date", $this->topic_date);
     } else {
         $return['topic_date'] = new Leap\View\InputText("hidden", "topic_date", "topic_date", leap_mysqldate());
     }
     $return['topic_msg'] = new Leap\View\InputTextRTE("topic_msg", "topic_msg", $this->topic_msg);
     $return['topic_status'] = new Leap\View\InputSelect(array("draft" => "Draft", "publish" => "Publish"), "topic_status", "topic_status", $this->topic_status);
     $return['topic_modified'] = new Leap\View\InputText("hidden", "topic_modified", "topic_modified", leap_mysqldate());
     $return['topic_image'] = new \Leap\View\InputFoto("topic_image", "topic_image", $this->topic_image);
     $return['topic_fb_og_image'] = new \Leap\View\InputFoto("topic_fb_og_image", "topic_fb_og_image", $this->topic_fb_og_image);
     $return['topic_category'] = new \Leap\View\InputTag("BlogBE/prefetchBlogCat", "topic_category", "topic_category", $this->topic_category);
     //        $return['spdivider']['post_image']  = "Content";
     $return['spdivider']['topic_meta_title'] = "SEO";
     $return['spdivider']['topic_fb_og_title'] = "FB OpenGraph";
     $return['spdivider']['topic_attachments'] = "Attachments";
     $return['topic_attachments'] = new Leap\View\InputPageAttachment("topic_attachments", "topic_attachments", $this->topic_attachments);
     if ($this->topic_attachment_order == "") {
         $this->topic_attachment_order = Efiwebsetting::getData('PageAttachment');
     }
     $return['topic_attachment_order'] = new Leap\View\InputOrdering("topic_attachment_order", "topic_attachment_order", $this->topic_attachment_order);
     return $return;
 }
 public static function checkOwnership($app)
 {
     //        echo Account::getMyID()."<br>";
     //        echo $app->app_client_id;
     if ($app->app_client_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) {
         die("Not your App");
     }
 }
 public function overwriteForm($return, $returnfull)
 {
     $return = parent::overwriteForm($return, $returnfull);
     $return['camp_acc_id'] = new \Leap\View\InputTextArea("camp_acc_id", "camp_acc_id", $this->camp_acc_id);
     $return['camp_start'] = new \Leap\View\InputText("date", "camp_start", "camp_start", $this->camp_start);
     for ($x = 0; $x < 24; $x++) {
         if ($x < 10) {
             $arrs[$x] = "0" . $x . ".00";
         } else {
             $arrs[$x] = $x . ".00";
         }
     }
     $return['camp_hour'] = new \Leap\View\InputSelect($arrs, "camp_hour", "camp_hour", $this->camp_hour);
     $return['camp_active'] = new \Leap\View\InputSelect($this->arrayYesNO, "camp_active", "camp_active", $this->camp_active);
     $return['camp_msg'] = new \Leap\View\InputTextRTE("camp_msg", "camp_msg", $this->camp_msg);
     $return['camp_url'] = new \Leap\View\InputText("text", "camp_url", "camp_url", $this->camp_url);
     //apps url
     //        $arrv = array("none"=>"None","offer"=>"Offer","news"=>"News");
     //        $return['camp_apps_menu'] = new \Leap\View\InputSelect($arrv,"camp_apps_menu", "camp_apps_menu", $this->camp_apps_menu);
     $return['camp_apps_menu'] = new \Leap\View\InputText("hidden", "camp_apps_menu", "camp_apps_menu", $this->camp_apps_menu);
     $return['camp_account_file'] = new \Leap\View\InputFile("camp_account_file", "camp_account_file", $this->camp_account_file);
     $return['camp_create_by'] = new \Leap\View\InputText("hidden", "camp_create_by", "camp_create_by", Account::getMyID());
     $return['camp_status'] = new \Leap\View\InputText("hidden", "camp_status", "camp_status", $this->camp_status);
     $return['camp_filter_age'] = new \Leap\View\InputFilter("camp_filter_age", "camp_filter_age", $this->camp_filter_age);
     $return['camp_filter_gender'] = new \Leap\View\InputSelect(array("0" => "All", "1" => "Female", "2" => "Male"), "camp_filter_gender", "camp_filter_gender", $this->camp_filter_gender);
     $return['camp_filter_tier'] = new \Leap\View\InputSelect(array("0" => "All", "1" => "Stampcard", "2" => "LYB Club", "3" => "LYB Fan", "4" => "All LYB"), "camp_filter_tier", "camp_filter_tier", $this->camp_filter_tier);
     $return['camp_filter_bday'] = new \Leap\View\InputSelect(array("0" => "All", "1" => "only whose birthday on sending date", "2" => "only whose birthday NOT on sending date"), "camp_filter_bday", "camp_filter_bday", $this->camp_filter_bday);
     $llacc = new LL_Account();
     global $db;
     $q = "SELECT DISTINCT macc_address_city FROM {$llacc->table_name}";
     $arrcity = $db->query($q, 2);
     //        pr($arrcity);
     $printcity["all"] = "All";
     foreach ($arrcity as $o) {
         if ($o->macc_address_city != "") {
             $printcity[$o->macc_address_city] = $o->macc_address_city;
         }
     }
     $return['camp_filter_city'] = new \Leap\View\InputSelect($printcity, "camp_filter_city", "camp_filter_city", $this->camp_filter_city);
     $return['spdivider']['camp_start'] = "Campaign";
     $return['spdivider']['camp_acc_id'] = "Accounts";
     $return['spdivider']['camp_filter_gender'] = "Filter";
     $return['camp_app_popup'] = new \Leap\View\InputText("hidden", "camp_app_popup", "camp_app_popup", $this->camp_app_popup);
     return $return;
 }
 public function overwriteForm($return, $returnfull)
 {
     $return['news_author'] = new Leap\View\InputText("hidden", "news_author", "news_author", Account::getMyID());
     $return['news_comment_allow'] = new Leap\View\InputSelect(array('0' => "No", '1' => "Yes"), "news_comment_allow", "news_comment_allow", $this->news_comment_allow);
     $return['news_commentcount'] = new Leap\View\InputText("hidden", "news_commentcount", "news_commentcount", $this->news_commentcount);
     $return['news_validity_begin'] = new Leap\View\InputText("date", "news_validity_begin", "news_validity_begin", $this->news_validity_begin);
     $return['news_validity_end'] = new Leap\View\InputText("date", "news_validity_end", "news_validity_end", $this->news_validity_end);
     if (isset($_GET['load']) && $_GET['load']) {
         $return['news_postdate'] = new Leap\View\InputText("hidden", "news_postdate", "news_postdate", $this->news_postdate);
     } else {
         $return['news_postdate'] = new Leap\View\InputText("hidden", "news_postdate", "news_postdate", leap_mysqldate());
     }
     $return['news_updatedate'] = new Leap\View\InputText("hidden", "news_updatedate", "news_updatedate", leap_mysqldate());
     $channel = new NewsChannel();
     $temp = $channel->getWhere("channel_active=1 AND channel_type = 'content'");
     foreach ($temp as $c) {
         $arrChannel[$c->channel_id] = $c->channel_name;
     }
     $return['news_channel_id'] = new Leap\View\InputSelect($arrChannel, "news_channel_id", "news_channel_id", $this->news_channel_id);
     return $return;
 }
 public function saveUnsaved()
 {
     $arrPoint = $_SESSION['game']['unsaved'];
     foreach ($arrPoint as $p) {
         $ps = new QuizPoints();
         $pid = $p[0] . "_" . Account::getMyID();
         $ps->getByID($pid);
         if ($ps->points_id == "") {
             $ps->load = 0;
         }
         $ps->points_id = $pid;
         $ps->points_ul_id = $p[0];
         $ps->points_acc_id = Account::getMyID();
         if ($ps->points_nilai < $p[1]) {
             $ps->points_nilai = $p[1];
         }
         //$ps->points_nilai = $p[1];
         $ps->points_update = leap_mysqldate();
         $ps->save();
     }
 }
 public static function save2log($full_url, $target = "")
 {
     $f = new PortalFileLogger();
     $path_parts = pathinfo($full_url);
     //echo $path_parts['dirname'], "\n";
     $f->file_filename = $path_parts['basename'];
     $f->file_extendsion = $path_parts['extension'];
     $arrImg = array("jpg", "jpeg", "bmp", "gif", "png", "tiff");
     if (in_array($f->file_extendsion, $arrImg)) {
         $f->file_description = "image";
     } else {
         $f->file_description = "file";
     }
     //$f->file_filename = $path_parts['filename'];
     $f->file_owner_id = Account::getMyID();
     $f->file_date = leap_mysqldate();
     $f->file_size = filesize($full_url);
     $f->file_url = $full_url;
     $f->file_target_id = $target;
     $f->save();
 }
 function pay()
 {
     $id = addslashes($_GET['app_id']);
     $acc = new App2Acc();
     $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
     if (count($apps) < 1) {
         die("hacking attempt");
     } else {
         $app = $apps[0];
     }
     $paket = new Paket();
     $paket->getByID($app->app_paket_id);
     $dibayarkan = $paket->paket_price * 12;
     //veritrans config
     Veritrans_Config::$serverKey = self::$serverKey;
     $transaction_details = array('order_id' => rand(), 'gross_amount' => $dibayarkan);
     $item1_details = array('id' => $app->app_id, 'price' => $dibayarkan, 'quantity' => 1, 'name' => "Payment for " . $app->app_name);
     $item_details = array($item1_details);
     $ac = Account::getAccountObject();
     $exp = explode(" ", Account::getMyName());
     $lastname = array_pop($exp);
     $billing_address = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'address' => "Mangga 20", 'city' => "Jakarta", 'postal_code' => "16602", 'phone' => "081122334455", 'country_code' => 'IDN');
     $customer_details = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'email' => $ac->admin_email, 'phone' => "081122334455", 'billing_address' => $billing_address);
     $transaction = array('transaction_details' => $transaction_details, 'customer_details' => $customer_details, 'item_details' => $item_details);
     try {
         // Redirect to Veritrans VTWeb page
         header('Location: ' . Veritrans_VtWeb::getRedirectionUrl($transaction));
     } catch (Exception $e) {
         echo $e->getMessage();
         if (strpos($e->getMessage(), "Access denied due to unauthorized")) {
             echo "<code>";
             echo "<h4>Please set real server key from sandbox</h4>";
             echo "In file: " . __FILE__;
             echo "<br>";
             echo "<br>";
             echo htmlspecialchars('Veritrans_Config::$serverKey = \'<your server key>\';');
             die;
         }
     }
 }
 public function overwriteForm($return, $returnfull)
 {
     $return = parent::overwriteForm($return, $returnfull);
     $appAccount = new AppAccount();
     $arrApp = $appAccount->getWhere("app_active = 2");
     $as = array();
     foreach ($arrApp as $app) {
         $as[$app->app_id] = $app->app_id . " " . $app->app_name;
     }
     $return['camp_app_id'] = new \Leap\View\InputSelect($as, "camp_app_id", "camp_app_id", $this->camp_app_id);
     $return['camp_client_id'] = new \Leap\View\InputText("hidden", "camp_client_id", "camp_client_id", $this->camp_client_id);
     //        $return['camp_acc_id'] = new \Leap\View\InputTextArea("camp_acc_id", "camp_acc_id", $this->camp_acc_id);
     $return['camp_start'] = new \Leap\View\InputText("date", "camp_start", "camp_start", $this->camp_start);
     for ($x = 0; $x < 24; $x++) {
         if ($x < 10) {
             $arrs[$x] = "0" . $x . ".00";
         } else {
             $arrs[$x] = $x . ".00";
         }
     }
     $return['camp_hour'] = new \Leap\View\InputSelect($arrs, "camp_hour", "camp_hour", $this->camp_hour);
     $return['camp_active'] = new \Leap\View\InputSelect($this->arrayYesNO, "camp_active", "camp_active", $this->camp_active);
     $return['camp_img'] = new \Leap\View\InputFoto("camp_img", "camp_img", $this->camp_img);
     $return['camp_msg'] = new \Leap\View\InputTextArea("camp_msg", "camp_msg", $this->camp_msg);
     $return['camp_url'] = new \Leap\View\InputText("text", "camp_url", "camp_url", $this->camp_url);
     //apps url
     //        $arrv = array("none"=>"None","offer"=>"Offer","news"=>"News");
     //        $return['camp_apps_menu'] = new \Leap\View\InputSelect($arrv,"camp_apps_menu", "camp_apps_menu", $this->camp_apps_menu);
     //        $return['camp_apps_menu'] = new \Leap\View\InputText("hidden","camp_apps_menu", "camp_apps_menu", $this->camp_apps_menu);
     //        $return['camp_account_file'] = new \Leap\View\InputFile("camp_account_file", "camp_account_file", $this->camp_account_file);
     $return['camp_create_by'] = new \Leap\View\InputText("text", "camp_create_by", "camp_create_by", Account::getMyID());
     $return['camp_status'] = new \Leap\View\InputSelect($this->arrStatus, "camp_status", "camp_status", $this->camp_status);
     $return['spdivider']['camp_app_id'] = "Applications";
     $return['spdivider']['camp_start'] = "Campaign";
     //        $return['spdivider']['camp_acc_id']  = "Accounts";
     //        $return['spdivider']['camp_filter_gender']  = "Filter";
     return $return;
 }
Beispiel #12
0
 function edit()
 {
     //cek ID
     if (isset($_GET['id'])) {
         $id = addslashes($_GET['id']);
         $appAcc = new AppAccount();
         $appAcc->getByID($id);
         if ($appAcc->app_client_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) {
             die("Owner's ID Mismatch");
         } else {
             //                ZAppFeature::clearSession();
             //load
             //                session_id($appAcc->app_keywords);
             FeatureSessionLayer::loadJSON($appAcc->app_keywords, $appAcc->app_id);
             //                sleep(1);
             //                pr($_SESSION);
             header("Location:" . _SPPATH . "apps/make?id=" . $id);
             die;
         }
     } else {
         header("Location:" . _SPPATH . "apps/makenew");
         die;
     }
 }
 public function overwriteForm($return, $returnfull)
 {
     $return = parent::overwriteForm($return, $returnfull);
     $return['camp_start'] = new \Leap\View\InputText("hidden", "camp_start", "camp_start", $this->camp_start);
     $return['camp_hour'] = new \Leap\View\InputText("hidden", "camp_hour", "camp_hour", $this->camp_hour);
     $return['camp_account_file'] = new \Leap\View\InputText("hidden", "camp_account_file", "camp_account_file", $this->camp_account_file);
     $return['camp_status'] = new \Leap\View\InputText("hidden", "camp_status", "camp_status", $this->camp_status);
     $return['camp_filter_age'] = new \Leap\View\InputText("hidden", "camp_filter_age", "camp_filter_age", $this->camp_filter_age);
     $return['camp_filter_gender'] = new \Leap\View\InputText("hidden", "camp_filter_gender", "camp_filter_gender", $this->camp_filter_gender);
     $return['camp_filter_tier'] = new \Leap\View\InputText("hidden", "camp_filter_tier", "camp_filter_tier", $this->camp_filter_tier);
     $return['camp_filter_bday'] = new \Leap\View\InputText("hidden", "camp_filter_bday", "camp_filter_bday", $this->camp_filter_bday);
     $return['camp_filter_city'] = new \Leap\View\InputText("hidden", "camp_filter_city", "camp_filter_city", $this->camp_filter_city);
     $return['camp_acc_id'] = new \Leap\View\InputText("hidden", "camp_acc_id", "camp_acc_id", $this->camp_acc_id);
     $return['camp_app_popup'] = new \Leap\View\InputText("hidden", "camp_app_popup", "camp_app_popup", 1);
     $return['camp_active'] = new \Leap\View\InputSelect($this->arrayYesNO, "camp_active", "camp_active", $this->camp_active);
     $return['camp_msg'] = new \Leap\View\InputTextRTE("camp_msg", "camp_msg", $this->camp_msg);
     $return['camp_url'] = new \Leap\View\InputText("text", "camp_url", "camp_url", $this->camp_url);
     $return['camp_apps_menu'] = new \Leap\View\InputText("hidden", "camp_apps_menu", "camp_apps_menu", $this->camp_apps_menu);
     $return['camp_create_by'] = new \Leap\View\InputText("hidden", "camp_create_by", "camp_create_by", Account::getMyID());
     //        $return['spdivider']['camp_start']  = "Campaign";
     //        $return['spdivider']['camp_acc_id']  = "Accounts";
     //        $return['spdivider']['camp_filter_gender']  = "Filter";
     return $return;
 }
 function addConfirm()
 {
     $err = array();
     $json['bool'] = 0;
     //       $json['err'] = array("apptitle"=>"harus diisi");
     $ttdate = addslashes($_POST['ttdate']);
     if ($ttdate == "") {
         $err['ttdate'] = "Date must be filled";
     }
     $ttname = addslashes($_POST['ttname']);
     if ($ttname == "") {
         $err['ttname'] = "Name must be filled";
     }
     $ttamount = addslashes($_POST['ttamount']);
     if ($ttamount == "") {
         $err['ttamount'] = "Amount must be filled";
     }
     $ttto = addslashes($_POST['ttto']);
     if ($ttto == "") {
         $err['ttto'] = "Bank Account must be filled";
     }
     if (count($err) > 0) {
         $json['bool'] = 0;
         $json['err'] = $err;
     } else {
         //save here
         $pc = new PaymentConfirm();
         $pc->confirm_app_id = addslashes($_POST['appid']);
         $pc->confirm_bank = $ttto;
         $pc->confirm_amount = $ttamount;
         $pc->confirm_create_date = leap_mysqldate();
         $pc->confirm_date = $ttdate;
         $pc->confirm_name = $ttname;
         $pc->confirm_receipt = addslashes($_POST['ttfile']);
         $pc->confirm_status = "not reviewed";
         $pc->confirm_user_id = Account::getMyID();
         $confirmID = $pc->save();
         if ($confirmID) {
             $app = new AppAccount();
             $app->getByID($pc->confirm_app_id);
             $app->app_active = 2;
             $app->load = 1;
             $app->app_pulsa = 1000;
             $app->save();
             $paket = new Paket();
             $paket->getByID($app->app_paket_id);
             //add pporder
             $ppo = new PaypalOrder();
             $ppo->payment_id = $confirmID;
             $ppo->payment_type = "banktt";
             $ppo->amount = $pc->confirm_amount;
             $ppo->currency = "IDR";
             $ppo->created_time = leap_mysqldate();
             $ppo->state = "pending";
             $ppo->user_id = Account::getMyID();
             $ppo->description = "Payment " . $app->app_name . " Paket " . $paket->paket_name . " ID : " . $app->app_id;
             $succ = $ppo->save();
             if ($succ) {
                 $json['bool'] = 1;
                 $json['order_id'] = $succ;
             } else {
                 $json['bool'] = 0;
                 $json['all'] = "Saving PPO Error";
             }
         } else {
             $json['bool'] = 0;
             $json['all'] = "Saving PConfirm Error";
         }
     }
     echo json_encode($json);
     die;
 }
 public function leaveGroup()
 {
     $gid = isset($_POST['inboxid']) ? addslashes($_POST['inboxid']) : die("NO GID");
     $g = new ChatGroup();
     $g->getByID($gid);
     //check apa dia owner
     if ($g->inbox_from == Account::getMyID()) {
         $json['bool'] = 0;
         $json['err'] = Lang::t("Cannot leave group");
     } else {
         $cg = new ChatMember();
         $json['bool'] = $cg->leaveMemberByGID(Account::getMyID(), $gid);
         //$g = new ChatGroup();
         //$g->removeNotifPortal($gid);
     }
     echo json_encode($json);
     die;
 }
<?php

$t = time();
$id = isset($_GET['id']) ? addslashes($_GET['id']) : 0;
if ($id) {
    $load = 1;
} else {
    $load = 0;
}
//pr($obj);
if ($obj->post_author == "") {
    $aut = Account::getMyID();
} else {
    $aut = $obj->post_author;
}
?>
<div id="PageAddPage_content" class="row">
    <div id="PageAddPage_contentdlm" class="col-md-12">    
     <div id="resultme"></div>
     <!--
     <div id="formgroup_post_title" class="form-group">
        <label for="post_feat_image" class="col-sm-2 control-label"><?php 
echo Lang::t('post_featured_image');
?>
</label>
        <div class="col-sm-10">
        <input id="fileupload_post_feat_image" type="file" name="files[]" data-url="<?php 
echo _SPPATH;
?>
plugins/jQuery_File_Upload/server/php/index.php" multiple>
        <span class="help-block" id="warning_post_feat_image"></span>    
    public function searchMemberBaru()
    {
        $qi = isset($_GET['qi']) ? addslashes($_GET['qi']) : "";
        $t = isset($_GET['t']) ? addslashes($_GET['t']) : "";
        $gid = isset($_GET['gid']) ? addslashes($_GET['gid']) : die("NO GID");
        $acc = new Account();
        $myid = Account::getMyID();
        $cg = new ChatMember();
        $arrMember = $cg->getMemberFromGID($gid);
        foreach ($arrMember as $mm) {
            $arrz[] = "admin_id != '" . $mm->admin_id . "'";
        }
        $imp = implode(" AND ", $arrz);
        $arr = $acc->getWhere("admin_aktiv = 1 AND {$imp} AND (admin_nama_depan LIKE '%{$qi}%' OR admin_username LIKE '%{$qi}%') ORDER BY admin_nama_depan ASC LIMIT 0,15");
        foreach ($arr as $ac) {
            ?>
            <div class="usercheckbox" style="padding: 5px;">
                <input type="checkbox" onclick="addToMemberArr('<?php 
            echo $ac->admin_id;
            ?>
','<?php 
            echo $ac->admin_nama_depan;
            ?>
','<?php 
            echo $t;
            ?>
');" value="<?php 
            echo $ac->admin_id;
            ?>
"> <?php 
            echo $ac->admin_nama_depan;
            ?>
            </div>
        <?php 
        }
        //pr($arr);
    }
 static function processGCM($arrhasil, $app_id, $psn, $array_ids, $app, $isTest = 0)
 {
     $json['status_code'] = 1;
     $json['status_message'] = "Success";
     $json['result'] = $arrhasil;
     foreach ($arrhasil as $numw => $hasil) {
         //simpan hasil
         $gcm = new GCMResult();
         $gcm->multicast_id = $hasil->multicast_id;
         $gcm->success = $hasil->success;
         $gcm->failure = $hasil->failure;
         $gcm->results = serialize($hasil->results);
         $gcm->canonical_ids = $hasil->canonical_ids;
         $gcm->camp_id = $psn->camp_id;
         $gcm->gcm_date = leap_mysqldate();
         $gcm->gcm_test = $isTest;
         $gcm->app_id = $app_id;
         $gcm->client_camp_id = $psn->camp_client_id;
         $gcm->client_id = $app->app_client_id;
         $gcm->save();
         if (!$isTest) {
             //kurangin pulsa ...
             $old = $app->app_pulsa;
             $app->app_pulsa = $app->app_pulsa - $hasil->success;
             $app->load = 1;
             $app->save();
             //save transactions
             $tt = new AppPulsa();
             $tt->pulsa_acc_id = Account::getMyID();
             $tt->pulsa_action = "debit";
             $tt->pulsa_app_id = $app_id;
             $tt->pulsa_date = leap_mysqldate();
             $tt->pulsa_jumlah = $hasil->success;
             $tt->pulsa_new = $app->app_pulsa;
             $tt->pulsa_old = $old;
             $tt->pulsa_camp_id = $psn->camp_id;
             $tt->save();
             //
         }
         //            echo "ID : ".$hasil->multicast_id."<br>";
         //            echo "Success : ".$hasil->success."<br>";
         //            echo "Failure : ".$hasil->failure."<br>";
         //            echo "<a target='_blank' href='"._SPPATH."PushNotResults/res?id={$psn->camp_id}&token=".IMBAuth::createOAuth()."' class='btn btn primary'>Complete Results</a><br><br>";
         $page = 999 * $numw;
         foreach ($hasil->results as $num => $res) {
             if (isset($res->error)) {
                 //error
                 $status = 0;
                 $log_text = $res->error;
                 //delete device_id from table
                 $dv = new DeviceModel();
                 global $db;
                 //repaired using update
                 $q = "UPDATE  {$dv->table_name} SET dev_not_send = 1 WHERE device_id = '" . $array_ids[$page + $num] . "'";
                 if ($_GET['test']) {
                     echo "<br>query : " . $q . "<br>";
                     echo "delete succ :" . $db->query($q, 0);
                     echo "<br>";
                 }
             } else {
                 //success
                 $status = 1;
                 $log_text = $res->message_id;
             }
             // repaired macc id cannot get
             PushLogger::savelog($psn->camp_id, $array_ids[$num], $app->app_client_id, $status, $log_text, $hasil->multicast_id, $app_id, $psn->camp_client_id);
         }
     }
     $psn->camp_status = 1;
     $psn->camp_send_date = leap_mysqldate();
     $psn->load = 1;
     $psn->save();
     return $json;
 }
    function receipt()
    {
        $order_id = addslashes($_GET['order_id']);
        $order = new VpTransaction();
        $order->getByID($order_id);
        //        pr($order);
        //TODO : harus dibikin
        if ($order->order_acc_id != Account::getMyID() && !in_array("master_admin", Account::getMyRoles())) {
            die("hacking attempt");
        }
        $app = new AppAccount();
        $app->getByID($order->order_app_id);
        if ($app->app_active == 0) {
            die("App not active");
        }
        $acc = new Account();
        $acc->getByID($app->app_client_id);
        $paket = new Paket();
        $paket->getByID($order->order_paket_id);
        $vpData = new VpData();
        $arr = $vpData->getWhere("order_id = '{$order_id}' LIMIT 0,1");
        if (count($arr) > 0) {
            $data = $arr[0];
        } else {
            $data = new VpData();
        }
        if ($acc->admin_marketer != "") {
            $arrAg = $acc->getWhere("admin_username = '******' LIMIT 0,1");
            if (count($arrAg) > 0) {
                $agent = $arrAg[0];
            }
        }
        //        pr($arr);
        ?>
        <style>
            h1{
                font-size: 25px;
                padding-top: 30px;
            }
            h3{
                font-size: 20px;
                font-style: italic;
            }
            h4{
                font-size: 17px;
                margin-top: 20px;
                margin-bottom: 30px;
            }
            .billings td{
                padding-right: 20px;
                padding-bottom: 10px;
            }
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                h1{
                    font-size: 20px;
                }
                h3{
                    font-size: 17px;
                    font-style: italic;
                }
                h4{
                    font-size: 14px;
                    margin-bottom: 30px;
                }
                .billings td{
                    padding-bottom: 10px;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }



            }
            @media print {
                .pure-toggle-label[data-toggle-label='left']{
                    display: none;
                }
                #printme{
                    display: none;
                }
                body{
                    background-color: #ffffff;
                }
            }
        </style>
        <div class="container attop"  >
                <div class="col-md-8 col-md-offset-2">


                    <div style="text-align: center; background-color: #ffffff; padding: 20px; min-height: 800px;  margin-top: 20px; padding-top: 20px; padding-bottom: 20px; ">
                        <img src="<?php 
        echo _SPPATH;
        ?>
images/header_appear.jpg" width="100%">

                        <h1>PAYMENT RECEIPT</h1>
                        <h3>Your payment has been completed successfully</h3>
                        <div class="receipt" style=" margin-top: 30px;">
                        <h4>TRANSACTION DETAILS</h4>
                        <table class="billings" align="center" style="text-align: left;">
                            <tr>
                                <td>ORDER ID</td>
                                <td><?php 
        echo $order_id;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PAYMENT DATE / TIME</td>
                                <td><?php 
        echo date("F j, Y, g:i a", strtotime($order->order_date));
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PACKAGE NAME</td>
                                <td><?php 
        echo $paket->paket_name;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>APP ID</td>
                                <td><?php 
        echo $app->app_id;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>ACCOUNT ID</td>
                                <td><?php 
        echo $acc->admin_nama_depan;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>AMOUNT</td>
                                <td>IDR <?php 
        echo idr($paket->paket_price);
        ?>
</td>
                            </tr>
                            <tr>
                                <td>STATUS</td>
                                <td><?php 
        echo $data->transaction_status;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>PAYMENT TYPE</td>
                                <td><?php 
        echo $data->payment_type;
        ?>
</td>
                            </tr>
                            <tr>
                                <td>BANK NAME</td>
                                <td><?php 
        echo $data->bank;
        ?>
</td>
                            </tr>
                            <?php 
        if (count($arrAg) > 0) {
            ?>
                            <tr>
                                <td>AGENT ID</td>
                                <td><?php 
            echo $agent->admin_username;
            ?>
</td>
                            </tr>
                            <?php 
        }
        ?>
                        </table>
                        </div>


                    </div>
                    <div id="printme" style="text-align: right; margin-top: 5px; margin-bottom: 100px;" >
                         <a href="#" onclick="window.print();"><i class="glyphicon glyphicon-print"></i> print</a> |
                        <a href="<?php 
        echo _SPPATH;
        ?>
myOrders">back to my transactions</a>
                    </div>
                </div>
            </div>
        <?php 
    }
 public static function addLogAdmin($ket = "", $action = 'browse_admin')
 {
     $bl = new BLogger();
     $bl->b_log_ip = $_SERVER['REMOTE_ADDR'];
     $bl->b_log_userid = Account::getMyID();
     $bl->b_log_time = leap_mysqldate();
     $uri = $_SERVER['REQUEST_URI'];
     $pos = strpos($uri, 'DMWeb');
     if ($pos !== false) {
         $uri = 'DMWeb';
     }
     $bl->b_log_url = $uri;
     $bl->b_log_action = $action;
     $bl->b_log_username = Account::getMyUsername();
     $bl->b_log_keterangan = $ket;
     $bl->b_timestamp = time();
     $md = new \Leap\Utility\MobileDetect();
     $isMobile = $md->isMobile();
     $isTablet = $md->isTablet();
     $userAgent = $md->getUserAgent();
     $txt = "";
     if ($isMobile) {
         $txt .= "Mobile";
     } elseif ($isTablet) {
         $txt .= "Tablet";
     } else {
         $txt .= "Desktop";
     }
     $bl->b_log_user_agent = $txt . " | userAgent = {$userAgent}";
     $bl->log_user_org = PortalHierarchy::getMyOrganization();
     $bl->log_user_level = PortalHierarchy::getMyLevel();
     $bl->save();
 }
 public function uploadfiles()
 {
     //apakah ada file
     $adafile = isset($_GET['adafile']) ? $_GET['adafile'] : '';
     //cek if ada file
     if ($adafile) {
         $if = new InputFileModel();
         $uploadpath = $if->upload_location;
         if (file_exists($uploadpath . $adafile)) {
             //delete old file
             if (unlink($uploadpath . $adafile)) {
                 $arrf = $if->getWhere("file_filename = '{$adafile}' LIMIT 0,1");
                 if (count($arrf) > 0) {
                     $if->delete($arrf[0]->file_id);
                 }
                 //delete from log
                 PortalFileLogger::deleteFileLog($uploadpath . $adafile);
                 /*if(file_exists(_PHOTOPATH.'thumbnail/' . $adafile))
                   {
                       //delete old thumb file
                       unlink(_PHOTOPATH.'thumbnail/' . $adafile);
                   }*/
             }
         }
     }
     $data = array();
     //$tid = (isset($_GET['tid'])?addslashes($_GET['tid']):die('no ID'));
     $t = isset($_GET['t']) ? addslashes($_GET['t']) : die('no t');
     $data['files'] = $_GET['files'];
     $data['bool'] = 0;
     $dc = new InputFileModel();
     if (isset($_GET['files'])) {
         $error = false;
         $files = array();
         $uploaddir = $dc->upload_location;
         foreach ($_FILES as $file) {
             $f = new InputFileModel();
             $q = "INSERT INTO {$f->table_name} SET file_folder_id = '0',file_author = '" . Account::getMyID() . "'";
             global $db;
             $fid = $db->qid($q);
             $f->getByID($fid);
             if ($fid) {
                 $newname = $fid;
                 $f->file_url = basename($file['name']);
                 $ext = end(explode(".", $file['name']));
                 $f->file_ext = $ext;
                 $f->file_filename = $fid . "." . $ext;
                 $f->file_date = leap_mysqldate();
                 // if pdf
                 if (move_uploaded_file($file['tmp_name'], $uploaddir . $f->file_filename)) {
                     $files[] = $uploaddir . $file['name'];
                     $f->file_size = filesize($uploaddir . $f->file_filename);
                     if ($f->file_ext == "pdf") {
                         $a = new PDF2Text();
                         $a->setFilename($uploaddir . $f->file_filename);
                         $a->decodePDF();
                         $f->file_isi = preg_replace("/\r|\n/", " ", $a->output());
                         //the path to the PDF file
                         $strPDF = $uploaddir . $f->file_filename;
                         $thumb = $uploaddir . "thumbs/" . $fid . ".jpg";
                         exec("convert \"{$strPDF}[0]\" \"{$thumb}\"");
                     }
                     $f->load = 1;
                     $data['bool'] = $f->save();
                     $data['isImage'] = Leap\View\InputFile::isImage($f->file_filename);
                     $data['filename'] = $f->file_filename;
                     if (isset($_SESSION['target_id']['obj'])) {
                         $target = get_class($_SESSION['target_id']['obj']);
                     } else {
                         $target = "inputfile_unknown";
                     }
                     PortalFileLogger::save2log($uploaddir . $f->file_filename, $target, $f->file_url);
                     die(json_encode($data));
                 } else {
                     $error = true;
                 }
             }
         }
         $data = $error ? array('error' => 'There was an error uploading your files') : array('files' => $files);
     } else {
         $data = array('success' => 'Form was submitted', 'formData' => $_POST);
     }
     echo json_encode($data);
 }
').val(), 'fade');
                                            }
                                        });
                                    </script>
                                </div>

                            </div>
                        </div>
                        <!-- /.row -->

                        <div class="table-responsive">
                            <!-- THE MESSAGES -->

                            <table class="table table-mailbox">
                                <?php 
$myID = Account::getMyID();
foreach ($arrMsg as $msg) {
    $idlawan = $msg->inbox_from;
    if ($myID == $msg->inbox_from) {
        $idlawan = $msg->inbox_to;
    }
    $acc = new Account();
    $acc->getByID($idlawan);
    $cssclass = $msg->inbox_type;
    if ($msg->inbox_giliran_read == $myID) {
        if (!$msg->inbox_read) {
            $cssclass .= " unread";
        }
    }
    $isDelivered = '';
    if ($msg->inbox_giliran_read != $myID) {
 function setID()
 {
     if (in_array("master_admin", Account::getMyRoles())) {
         $acc = new AppAccount();
         $apps = $acc->getAll();
         //
     } else {
         $acc = new App2Acc();
         $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND app_active = 1", array("AppAccount"));
     }
     $arrApp = array();
     foreach ($apps as $ap) {
         $semua[] = $ap->app_id;
         $arrApp[$ap->app_id] = $ap;
     }
     if (in_array($_GET['app_id'], $semua)) {
         //ok
         $_SESSION['app_active'] = $arrApp[$_GET['app_id']];
         $_SESSION['app_id'] = addslashes($_GET['app_id']);
         header("Location:" . _SPPATH . "PushHome/home?st=Balance");
         die;
     } else {
         //not ok
         die("hacking attempt");
     }
 }
 function saveIntoApp()
 {
     $app = new AppAccount();
     if (isset($_GET['id']) && $_GET['id'] > 0) {
         $id = addslashes($_GET['id']);
         $app->getByID($id);
         $app->load = 1;
         if ($app->app_client_id != Account::getMyID()) {
             die("Owner's ID Mismatch");
         }
     }
     $detail = ZAppFeature::loadDetails();
     $app->app_client_id = Account::getMyID();
     $app->app_name = $detail['app_name'];
     $app->app_create_date = leap_mysqldate();
     $app->app_api_access_key = Efiwebsetting::getData('GCM_ACCESS_KEY');
     $app->app_token = md5(leap_mysqldate());
     $app->app_icon = $detail['app_icon'];
     $app->app_shortdes = $detail['app_des_short'];
     $app->app_feat = $detail['app_feature_img'];
     $app->app_fulldes = $detail['app_des_long'];
     if (isset($_GET['id']) && $_GET['id'] > 0) {
         $app->save();
         $appID = $app->app_id;
     } else {
         $app->app_keywords = session_id();
         $app->app_active = 0;
         $appID = $app->save();
         if ($appID) {
             $app2acc = new App2Acc();
             $app2acc->ac_admin_id = Account::getMyID();
             $app2acc->ac_app_id = $appID;
             $appID2 = $app2acc->save();
         }
     }
     $json['id'] = $appID;
     echo json_encode($json);
     //        echo $appID;
     die;
 }
 public function changePic()
 {
     $id = isset($_GET['uid']) ? addslashes($_GET['uid']) : 'no';
     $file = isset($_GET['file']) ? addslashes($_GET['file']) : 'foto';
     if ($id == "no") {
         die("No UID");
     }
     if (Account::getMyID() == $id) {
         //punya sendiri
         $_SESSION['account']->admin_foto = $file;
     }
     $acc = new Account();
     $acc->getByID($id);
     $acc->admin_foto = $file;
     $acc->load = 1;
     $acc->save();
 }
 public static function kurangiStok($po_id, $minus = 1, $session = 1)
 {
     if ($session) {
         $arrObjBulk = isset($_SESSION['cartqty_bulk']) ? $_SESSION['cartqty_bulk'] : array();
         $arrObjRetail = isset($_SESSION['cartqty']) ? $_SESSION['cartqty'] : array();
     } else {
         $cm = new CartModel();
         $cm->getByID($po_id);
         $arrObjBulk = json_decode($cm->po_pesanan_bulk);
         $arrObjRetail = json_decode($cm->po_pesanan_retail);
     }
     $out_of_stock_ID = array();
     //kebutuhan
     $kebutuhan = array();
     //get all product
     $arrProd = array();
     //bulk
     foreach ($arrObjBulk as $numb => $objb) {
         if ($session) {
             $pid = $objb['id'];
             $qty = $objb['qty'];
         } else {
             $pid = $objb->id;
             $qty = $objb->qty;
         }
         if ($pid == "" || $pid < 1) {
             continue;
         }
         $exp = explode(",", $pid);
         foreach ($exp as $numc => $obj_real) {
             $p = new ProdModel();
             $p->getByID($obj_real);
             $arrProd[$obj_real] = $p;
             //cek apakah outof stok
             $kebutuhan[$obj_real]++;
         }
         foreach ($kebutuhan as $obj_real => $jumlah) {
             $kebutuhan[$obj_real] = $jumlah * $qty;
         }
     }
     //satuan
     foreach ($arrObjRetail as $num => $obj) {
         if ($session) {
             $pid = $obj['id'];
             $qty = $obj['qty'];
         } else {
             $pid = $obj->id;
             $qty = $obj->qty;
         }
         if ($pid == "" || $pid < 1) {
             continue;
         }
         $p = new ProdModel();
         $p->getByID($pid);
         $arrProd[$pid] = $p;
         $kebutuhan[$pid] += $qty;
     }
     //pr($kebutuhan);
     foreach ($kebutuhan as $pid => $jumlah) {
         $prod = $arrProd[$pid];
         //kalau session ga bisa out of stock
         if ($prod->prod_stock < $jumlah && $session) {
             continue;
         }
         //isi log
         $ps = new ProdStok();
         $ps->stok_date = leap_mysqldate();
         $ps->stok_prev = $prod->prod_stock;
         $ps->stok_po_id = $po_id;
         $ps->stok_prod_id = $prod->prod_id;
         $ps->stok_userid = Account::getMyID();
         if ($minus) {
             //kurangi stok
             $prod->prod_stock -= $jumlah;
         } else {
             $prod->prod_stock += $jumlah;
         }
         $prod->load = 1;
         $prod->save();
         $ps->stock_note = "Pemesanan Customer";
         if (!$session) {
             $ps->stock_admin = 1;
             $ps->stock_note = "Admin Update {$minus}";
         }
         $ps->stok_actual = $prod->prod_stock;
         if ($ps->stok_prev > $ps->stok_actual) {
             $ps->stok_debit_credit = 1;
         } else {
             $ps->stok_debit_credit = 0;
         }
         $ps->save();
     }
 }
    public static function printMenuMobile()
    {
        ?>
        <style>
            .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus{
                color:#fff;
            }
            .navbar-default .navbar-nav .open .dropdown-menu > li > a{
                color:#fff;
            }
        </style>    
        <?php 
        $menu = self::$menus;
        //pr($menu);
        $menu2 = array_reverse($menu);
        foreach ($menu as $text => $m) {
            if ($m != "tools") {
                ?>
            <li>
                <a href="<?php 
                echo _SPPATH . $m;
                ?>
"><?php 
                echo $text;
                ?>
</a>
            </li>
            <?php 
            } else {
                ?>
            <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php 
                echo $text;
                ?>
 <span class="caret"></span></a>
            <ul class="dropdown-menu" role="menu">
              <li><a href="<?php 
                echo _SPPATH;
                ?>
tools?mode=email">TBS Email</a></li>
              <li><a href="<?php 
                echo _SPPATH;
                ?>
tools?mode=wikipedia">TBS Wikipedia</a></li>
              <li><a href="<?php 
                echo _SPPATH;
                ?>
km">TBS Knowledge</a></li>
              <li><a href="<?php 
                echo _SPPATH;
                ?>
webapps">TBS Apps</a></li>
            </ul>
          </li>
            <?php 
            }
            ?>
        <?php 
        }
        if (Auth::isLogged()) {
            ?>
            <hr>
           <?php 
            /* <li>
                   <a class="admin-button-mobile" href="<?= _SPPATH; ?>order"><?= Lang::t('cart'); ?></a>
               </li>
               <li>
                   <a class="admin-button-mobile" href="<?= _SPPATH; ?>myorder"><?= Lang::t('order history'); ?></a>
               </li>*/
            ?>
            <li>
                <a class="admin-button-mobile" href="<?php 
            echo _SPPATH;
            ?>
p/user/<?php 
            echo Account::getMyID();
            ?>
"><?php 
            echo Lang::t('profil');
            ?>
</a>
            </li>
            <li>
                <a class="admin-button-mobile" href="<?php 
            echo _SPPATH;
            ?>
logout"><?php 
            echo Lang::t('keluar');
            ?>
</a>
            </li>
         <?php 
        } else {
            ?>
            <hr>
            <li>
                <a class="admin-button-mobile" href="<?php 
            echo _SPPATH;
            ?>
register"><?php 
            echo Lang::t('masuk');
            ?>
</a>
            </li>
            
            <?php 
        }
        //echo Role::hasRole("admin");
        if (Role::hasRole("admin")) {
            ?>
            <hr>
            <li>
                <a class="admin-button-mobile" href="<?php 
            echo _SPPATH;
            ?>
EfiHome/home"><?php 
            echo Lang::t('Admin');
            ?>
</a>
            </li>
        <?php 
        }
    }
 public function uploadfiles_gallery()
 {
     $data = array();
     //$tid = (isset($_GET['tid'])?addslashes($_GET['tid']):die('no ID'));
     $t = isset($_GET['t']) ? addslashes($_GET['t']) : die('no t');
     $dc = new InputFileModel();
     if (isset($_GET['files'])) {
         $error = false;
         $files = array();
         $uploaddir = $dc->upload_location;
         $arrSuc = array();
         $arrSucAsli = array();
         foreach ($_FILES as $file) {
             $f = new InputFileModel();
             $q = "INSERT INTO {$f->table_name} SET file_folder_id = '0',file_author = '" . Account::getMyID() . "'";
             global $db;
             $fid = $db->qid($q);
             $f->getByID($fid);
             if ($fid) {
                 $newname = $fid;
                 $f->file_url = basename($file['name']);
                 $ext = end(explode(".", $file['name']));
                 $f->file_ext = $ext;
                 $f->file_filename = $fid . "." . $ext;
                 $f->file_date = leap_mysqldate();
                 $ifn = new \Leap\View\InputFile();
                 if (in_array($ext, $ifn->arrImgExt)) {
                     $isImage = 1;
                 } else {
                     $isImage = 0;
                     $error = true;
                 }
                 if ($isImage) {
                     if (move_uploaded_file($file['tmp_name'], $uploaddir . $f->file_filename)) {
                         $files[] = $uploaddir . $file['name'];
                         $f->file_size = filesize($uploaddir . $f->file_filename);
                         /*
                          * thumbnail
                          */
                         $src = $uploaddir . $f->file_filename;
                         $dest = $uploaddir . 'thumbnail/' . $f->file_filename;
                         //                                $this->make_thumb($src, $dest, 570);
                         $up = new Uploader();
                         //                                        $up->make_thumb_new()
                         $up->make_thumb_new($src, $dest, 570);
                         $f->load = 1;
                         $f->save();
                         $arrSuc[] = $f->file_filename;
                         $fil = trim(rtrim($f->file_filename));
                         $fil2 = explode(".", $fil);
                         $fil3 = $fil2[0];
                         $arrSucAsli[] = "<div id='file_" . $fid . "_{$t}' class='mlt_item_gal'><div id='gal_{$fil3}' class='foto100gal'><span class='helper'></span><img ondblclick='makeasmainpic_" . $t . "(\"{$fil}\");' src='" . _SPPATH . $f->upload_url . $f->file_filename . "'></div>" . $f->file_url . " <i onclick=\"deleteFromList_{$t}('" . $f->file_filename . "');\" class='glyphicon glyphicon-remove'></i></div>";
                         if (isset($_SESSION['target_id']['obj'])) {
                             $target = get_class($_SESSION['target_id']['obj']);
                         } else {
                             $target = "inputfile_unknown";
                         }
                         PortalFileLogger::save2log($uploaddir . $f->file_filename, $target, $f->file_url);
                     } else {
                         $error = true;
                     }
                 }
             }
         }
         $data = $error ? array('error' => 'There was an error uploading your files, make sure your file is an image file') : array('files' => $files, 'ftext' => implode(",", $arrSuc), 'ftextAsli' => implode(" ", $arrSucAsli));
     } else {
         $data = array('success' => 'Form was submitted', 'formData' => $_POST);
     }
     echo json_encode($data);
 }
                                                //$('loadingtop').fade();
                                                //$('oktop').fade().fade();
                                                console.log('Image uploaded: ' + xhr.responseText);
                                                /*$('close_button_pop1').onClick(function(){
                                                 $('content_utama').load('
                                                <?php 
echo _SPPATH;
?>
datamurid/harmonica_widget?aj=1',{spinner:"loadingtop"});
                                                 $('pop1').hide();
                                                 });*/
                                                 $.get("<?php 
echo _SPPATH;
?>
Account/changePic?uid=<?php 
echo Account::getMyID();
?>
&file="+xhr.responseText);   
                                            } else {
                                                //imageElement.parentNode.removeChild(imageElement);
                                            }
                                        }
                                    }

                                    // Start upload
                                    xhr.open('post', '<?php 
echo _SPPATH;
?>
uploader/uploadres?adafile=<?php 
echo $roleObj->admin_foto;
?>
    function fileInsert()
    {
        $car = new DocFile();
        $img = isset($_GET['img']) ? addslashes($_GET['img']) : 0;
        if ($img) {
            $car->file_filename = $img;
            $car->file_date = leap_mysqldate();
            $car->file_owner_id = Account::getMyID();
            $car->save();
        }
        $arrCar = $car->getWhere("file_filename !='' ORDER BY file_id DESC ");
        //pr($arrCar);
        $gw = new GalleryWeb();
        foreach ($arrCar as $num => $pic) {
            ?>
            <div class="file_thumb thumbnail col-md-2">
                <div class="file_filename">
                    <a target="_blank"
                       href="<?php 
            echo _SPPATH . $gw->uploadURL . $pic->file_filename;
            ?>
"><?php 
            echo $pic->file_filename;
            ?>
</a>
                </div>

                <div class="file_menu">
                    <button type="button"
                            onclick="if(confirm('<?php 
            echo Lang::t("Are You Sure?");
            ?>
'))files_delete(<?php 
            echo $pic->file_id;
            ?>
);"
                            class="btn btn-default"><?php 
            echo Lang::t('delete');
            ?>
</button>
                </div>
            </div>

        <?php 
        }
    }