public static function log($str) { $n = new LangModel(); $n->lang_id = $str; $n->lang_ts = leap_mysqldate(); $n->save(); }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); $bank = new BankModel(); $arrBank = $bank->getAll(); foreach ($arrBank as $value) { $arrHelpBank[$value->id_bank] = $value->bank_name; } $return['id_bank'] = new Leap\View\InputSelect($arrHelpBank, "id_bank", "id_bank", $this->id_bank); if (!isset($this->start)) { $dt = leap_mysqldate(); } else { $dt = $this->start; } $return['start'] = new \Leap\View\InputText("date", "start", "start", $dt); if (!isset($this->end)) { $dt = leap_mysqldate(); } else { $dt = $this->end; } $return['end'] = new \Leap\View\InputText("date", "end", "end", $dt); return $return; }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); $bank = new BankModel(); $return['end_mr_fee'] = new \Leap\View\InputText("date", "end_mr_fee", "end_mr_fee", $dt); $return['fee'] = new Leap\View\InputTextRightAddOn("text", "fee", "fee", " % ", $this->fee); $return['mr_fee_select'] = new Leap\View\InputRadioButtonHideWhen(array(1 => "Yes", 0 => "No"), "mr_fee_select", "mr_fee_select", $this->mr_fee_select, array(1 => "formgroup_start_mr_fee,formgroup_end_mr_fee", 0 => "formgroup_start_mr_fee,formgroup_end_mr_fee")); if ($this->mr_fee_select == 0) { if (!isset($this->start_mr_fee)) { $dt = leap_mysqldate(); } else { $dt = $this->start_mr_fee; } $return['start_mr_fee'] = new \Leap\View\InputText("date", "start_mr_fee", "start_mr_fee", $dt); if (!isset($this->end_mr_fee)) { $dta = leap_mysqldate(); } else { $dta = $this->end_mr_fee; } $return['end_mr_fee'] = new \Leap\View\InputText("date", "end_mr_fee", "end_mr_fee", $dta); } else { } return $return; }
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; }
static function saveSLog($word) { $sl = new MSearchLog(); $sl->slog_keyword = $word; $sl->slog_date = leap_mysqldate(); $sl->save(); }
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(); }
static function simpan($varID, $type) { $mp = new MProdLog(); $mp->plog_date = leap_mysqldate(); $mp->plog_variantID = $varID; $mp->plog_type = $type; $mp->save(); }
function sendReplyMsg() { $json['bool'] = 0; $json['err'] = "ok"; //$accid = addslashes($_POST['acc_id']); $inboxid = addslashes($_POST['inboxid']); $isi = addslashes($_POST['isi']); // $emai = addslashes($_POST['emai']); /* if ($accid == "") { $json['err'] = Lang::t('lang_id_empty'); }*/ if ($inboxid == "") { $json['err'] = Lang::t('lang_inbox_id_empty'); } if ($isi == "") { $json['err'] = Lang::t('lang_isi_empty'); } if ($json['err'] == "ok") { $in = new ChatMsg(); //$tgl = date("Y-m-d H:i:s"); $in->chat_group_id = $inboxid; //$in->inbox_to = $accid; $in->inbox_from = Account::getMyID(); $in->inbox_msg = $isi; $in->inbox_createdate = leap_mysqldate(); if ($in->save()) { //update inbox $inbox = new ChatGroup(); $inbox->getByID($inboxid); $inbox->inbox_changedate = leap_mysqldate(); $inbox->inbox_anzahlreply++; $inbox->load = 1; //ini hrs di foreach untuk semua member $m = new ChatMember(); $arrMember = $m->getWhere("chat_group_id = '{$inboxid}'"); foreach ($arrMember as $mem) { $accid = $mem->chat_member_id; if ($accid == Account::getMyID()) { continue; } $inbox->addInboxNotifPortal($accid, $inboxid); //cek read didalamnya } if ($inbox->inbox_read) { //update Notif $inbox->inbox_read = 0; } //$inbox->inbox_giliran_read = $accid; $inbox->save(); $json['bool'] = 1; } else { $json['err'] = Lang::t('lang_failed'); } } echo json_encode($json); exit; }
static function savelog($camp_id, $device_id, $acc_id, $status, $log_text, $log_multicast_id) { $nl = new PushLogger(); $nl->log_camp_id = $camp_id; $nl->log_device_id = $device_id; $nl->log_macc_id = $acc_id; $nl->log_status = $status; $nl->log_text = $log_text; $nl->log_multicast_id = $log_multicast_id; $nl->log_date = leap_mysqldate(); return $nl->save(); }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); if (!isset($this->datetime_order)) { $dt = leap_mysqldate(); } else { $dt = $this->datetime_order; } $return['datetime_order'] = new \Leap\View\InputText("date", "datetime_order", "datetime_order", $dt); foreach ($return as $key => $val) { $return[$key]->setReadOnly(); } return $return; }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $return['carousel_photo'] = new \Leap\View\InputFoto("foto", "carousel_photo", $this->carousel_photo); $return['carousel_active'] = new Leap\View\InputSelect($this->arrayYesNO, "carousel_active", "carousel_active", $this->carousel_active); if (!isset($this->carousel_postdate)) { $dt = leap_mysqldate(); } else { $dt = $this->carousel_postdate; } $return['carousel_postdate'] = new \Leap\View\InputText("date", "carousel_postdate", "carousel_postdate", $dt); $return['carousel_start'] = new \Leap\View\InputText("date", "carousel_start", "carousel_start", $this->carousel_start); $return['carousel_end'] = new \Leap\View\InputText("date", "carousel_end", "carousel_end", $this->carousel_end); return $return; }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $return['prog_content'] = new \Leap\View\InputTextRTE("prog_content", "prog_content", $this->prog_content); $return['prog_pic'] = new \Leap\View\InputFoto("foto", "prog_pic", $this->prog_pic); $return['prog_active'] = new Leap\View\InputSelect($this->arrayYesNO, "prog_active", "prog_active", $this->prog_active); if (!isset($this->prog_date_created)) { $dt = leap_mysqldate(); } else { $dt = $this->prog_date_created; } $return['prog_date_created'] = new \Leap\View\InputText("date", "prog_date_created", "prog_date_created", $dt); $return['prog_date_start'] = new \Leap\View\InputText("date", "prog_date_start", "prog_date_start", $this->prog_date_start); $return['prog_date_end'] = new \Leap\View\InputText("date", "prog_date_end", "prog_date_end", $this->prog_date_end); return $return; }
public function sendEmail($to, $arrReplace) { $this->setVar($arrReplace); $this->addTable(); $lep = new Leapmail2(); $hasil = $lep->sendHTMLEmail($to, $this->email_subject, $this->email_template_text, $this->email_template_html); $suc = $hasil->success(); //should we log this ? $ml = new EmailLog(); $ml->log_date = leap_mysqldate(); $ml->log_email_id = $to; $ml->log_status = $suc; $ml->log_template = $this->email_id; $ml->save(); return $suc; }
public function constraints() { $err = array(); if (!isset($this->session_id)) { $err['session_id'] = Lang::t('session_id'); } if (!isset($this->variant_id)) { $err['variant_id'] = Lang::t('variant_id'); } if (!isset($this->qty)) { $err['qty'] = Lang::t('qty'); } $this->date_created = leap_mysqldate(); $this->status = 1; return $err; }
public function requestCashOut() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $idResto = Generic::mustCheck($_GET['id_restaurant'], "No ID Restaurant Found"); $amount = Generic::mustCheck($_GET['amount'], "No Amount Found"); if ($amount == "0") { Generic::errorMsg("Zero Amount not Allowed"); } $bankAcc = new RestoBankAccModel(); $arrBank = $bankAcc->getWhere("id_restaurant='{$idResto}'"); if (count($arrBank) <= 0) { Generic::errorMsg("You Have Not Set Your Cash Out Account"); } $req = new MasterCashOutRequestModel(); $arrReq = $req->getWhere("id_restaurant='{$idResto}' AND status='0'"); if (count($arrReq) > 0) { Generic::errorMsg("You Already Request Cash Out"); } $resto = new MasterRestaurantModel(); $resto->getByID($idResto); $cashOut = new MasterCashOutRequestModel(); $cashOut->id_restaurant = $idResto; $cashOut->datetime_request = leap_mysqldate(); $cashOut->amount = $amount; $cashOut->status = 0; $idNewRequest = $cashOut->save(); $tr = new MasterRestoTransactionModel(); $tr->id_request = $idNewRequest; $tr->id_restaurant = $idResto; $tr->gross_amount = (double) $amount * -1; $tr->net_amount = (double) $amount * -1; $tr->approved = "0"; $tr->type_transaction = "2"; $tr->datetime_transaction = leap_mysqldate(); $tr->mr_fee = 0; $tr->credit_card_fee = 0; $tr->other_fee = 0; $tr->bank_disc = 0; $tr->save(); $json['status_code'] = 1; $json['results']['messages'] = "success"; echo json_encode($json); die; }
function viewed() { $app_id = addslashes($_POST['app_id']); $key = addslashes($_POST['key']); $app = new AppAccount(); if ($app_id == "" || $key == "") { $json['status_code'] = 0; echo json_encode($json); die; } else { $app->getByID($app_id); if ($app->app_token != $key) { $json['status_code'] = 0; $json['status_message'] = "wrong key"; echo json_encode($json); die; } } $client_camp_id = addslashes($_POST['camp_id']); $device_id = addslashes($_POST['device_id']); $dl = new PushLogger(); global $db; $q = "UPDATE {$dl->table_name} SET log_seen = 1, log_seen_date = '" . leap_mysqldate() . "' WHERE log_app_id = '{$app_id}' AND log_device_id = '{$device_id}' AND log_client_id = '{$client_camp_id}' "; // echo $q; $db->query($q, 0); $gcm = new GCMResult(); $arr = $gcm->getWhere("client_camp_id = '{$client_camp_id}' AND app_id = '{$app_id}' LIMIT 0,1"); $total = 0; foreach ($arr as $up) { $q = "SELECT count(*) AS nr FROM {$dl->table_name} WHERE log_camp_id = '{$up->camp_id}' AND log_seen = 1"; $nr = $db->query($q, 1); $total += $nr->nr; //get GCM and Update $up->seen_by = $nr->nr; $up->load = 1; $up->save(); } $json['status_code'] = 1; $json['status_message'] = "Success"; $json['total_dilihat'] = $total; echo json_encode($json); die; }
public static function save_device() { $device_id = addslashes($_POST['device_id']); $type = addslashes($_POST['type']); //completion check if ($device_id == "" || $type == "") { $json['status_code'] = 0; $json['status_message'] = "Incomplete Request"; echo json_encode($json); die; } IMBAuth::checkOAuth(); //check account.. $acc = isset($_POST['acc_id']) ? addslashes($_POST['acc_id']) : 0; $dn = new DeviceModelAgentApp(); $dnquery = new DeviceModelAgentApp(); // langkah 1 , device ID ada device type ada $arrs = $dnquery->getWhere("device_id = '{$device_id}' AND device_type = '{$type}'"); $dn = $arrs[0]; if ($dn->did == "") { $dn = new DeviceModelAgentApp(); $dn->device_id = $device_id; $dn->device_type = $type; $dn->acc_id = $acc; $dn->firstlogin = leap_mysqldate(); } else { //kalau device id ada, acc di update $dn->load = 1; $dn->acc_id = $acc; } $dn->dev_lng = addslashes($_REQUEST['lng']); $dn->dev_lat = addslashes($_REQUEST['lat']); $dn->logindate = leap_mysqldate(); if ($dn->save()) { $json['save_status'] = 1; } else { $json['save_status'] = 0; } $json['status_code'] = 1; echo json_encode($json); die; }
public function constraints() { //err id => err msg $err = array(); if (!isset($this->testi_acc_id)) { $err['testi_acc_id'] = Lang::t('LL Account cannot be empty'); } if (!isset($this->testi_text)) { $err['testi_text'] = Lang::t('Please provide Text'); } if (!isset($this->testi_createdate)) { $this->testi_createdate = leap_mysqldate(); // $this->testi_date = leap_mysqldate(); } if (!isset($this->testi_date)) { // $this->testi_createdate = leap_mysqldate(); $this->testi_date = leap_mysqldate(); } return $err; }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $p = new BrandModel(); $arrPage = $p->getAll(); $arrNe = array(); foreach ($arrPage as $pp) { $arrNe[$pp->brand_id] = $pp->brand_id . " - " . $pp->brand_name; } $return['prod_diskon'] = new Leap\View\InputText("number", "prod_diskon", "prod_diskon", $this->prod_diskon); $return['prod_price'] = new Leap\View\InputText("number", "prod_price", "prod_price", $this->prod_price); $return['prod_stock'] = new Leap\View\InputText("hidden", "prod_stock", "prod_stock", $this->prod_stock); $return['prod_date'] = new Leap\View\InputText("hidden", "prod_date", "prod_date", leap_mysqldate()); $return['prod_pic'] = new Leap\View\InputGallery("prod_pic", "prod_pic", $this->prod_pic); $return['prod_active'] = new Leap\View\InputSelect($this->arrayYesNO, "prod_active", "prod_active", $this->prod_active); // $return['news_text'] = new Leap\View\InputTextArea("news_text", "news_text", $this->news_text); $return['prod_des'] = new Leap\View\InputTextRTE("prod_des", "prod_des", $this->prod_des); $return['prod_brand_id'] = new Leap\View\InputSelect($arrNe, "prod_brand_id", "prod_brand_id", $this->prod_brand_id); $return['prod_status'] = new Leap\View\InputText("hidden", "prod_status", "prod_status", $this->prod_status); $return['prod_story'] = new Leap\View\InputText("hidden", "prod_story", "prod_story", $this->prod_story); $p = new ProdCat(); $arrPage = $p->getAll(); $arrNe = array(); foreach ($arrPage as $pp) { $arrNe[$pp->cat_id] = $pp->cat_id . " - " . $pp->cat_name; } $return['prod_cat_id'] = new Leap\View\InputSelect($arrNe, "prod_cat_id", "prod_cat_id", $this->prod_cat_id); $return['prod_material'] = new Leap\View\InputText("hidden", "prod_material", "prod_material", $this->prod_material); $return['prod_size'] = new Leap\View\InputText("hidden", "prod_size", "prod_size", $this->prod_size); $return['prod_color'] = new Leap\View\InputText("hidden", "prod_color", "prod_color", $this->prod_color); $return['prod_collection_name'] = new Leap\View\InputText("hidden", "prod_collection_name", "prod_collection_name", $this->prod_collection_name); // return $return; // $return = parent::overwriteForm($return, $returnfull); $return['product_fb_og_image'] = new \Leap\View\InputFoto("product_fb_og_image", "product_fb_og_image", $this->product_fb_og_image); $return['spdivider']['prod_name'] = "Product Details"; $return['spdivider']['product_metatitle'] = "SEO"; $return['spdivider']['product_fb_og_title'] = "FB OpenGraph"; // $return['spdivider']['post_attachments'] = "Attachments"; // $return['post_attachments'] = new Leap\View\InputPageAttachment("post_attachments","post_attachments",$this->post_attachments); 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 register() { $fname = addslashes($_POST['fname']); $lname = addslashes($_POST['lname']); $emailadd = addslashes($_POST['emailadd']); $p1 = addslashes($_POST['p1']); $p2 = addslashes($_POST['p2']); $acc = new Account(); $acc->admin_nama_depan = $fname; $acc->admin_nama_belakang = $lname; $acc->admin_name = $fname . " " . $lname; $acc->admin_email = $emailadd; $acc->admin_password = $p1; $acc->admin_role = "normal_user"; $acc->admin_lastupdate = leap_mysqldate(); $acc->admin_createdate = leap_mysqldate(); $acc->admin_aktiv = 1; $succ = $acc->save(); RegisterMail::RegMail($acc); return $succ; }
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 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(); }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); $bank = new BankModel(); $arrBank = $bank->getAll(); foreach ($arrBank as $value) { $arrHelpBank[$value->id_bank] = $value->bank_name; } $return['id_bank'] = new Leap\View\InputSelect($arrHelpBank, "id_bank", "id_bank", $this->id_bank); $return['fee'] = new Leap\View\InputTextRightAddOn("text", "fee", "fee", '%', $this->fee); $return['fee_nominal'] = new Leap\View\InputTextLeftAddOn("text", "fee_nominal", "fee_nominal", 'Rp.', $this->fee_nominal); $return['last_changed'] = new Leap\View\InputText("hidden", "last_changed", "last_changed", leap_mysqldate()); if (!isset($this->start_fee)) { $dt = leap_mysqldate(); } else { $dt = $this->start_fee; } $return['start_fee'] = new \Leap\View\InputText("date", "start_fee", "start_fee", $dt); if (!isset($this->end_fee)) { $dt = leap_mysqldate(); } else { $dt = $this->end_fee; } $return['end_fee'] = new \Leap\View\InputText("date", "end_fee", "end_fee", $dt); ?> <!--<script> $('#formgroup_start_mr_fee').change(function(){ }); </script>--> <?php return $return; }
public function overwriteForm($return, $returnfull) { global $db; $q = "SELECT id_restaurant, name FROM menurevo__ms_restaurant WHERE aktiv='1'"; $res = $db->query($q, 2); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); if (!isset($this->start)) { $dt = leap_mysqldate(); } else { $dt = $this->start; } $return['start'] = new \Leap\View\InputText("date", "start", "start", $dt); if (!isset($this->end)) { $dt = leap_mysqldate(); } else { $dt = $this->end; } $return['end'] = new \Leap\View\InputText("date", "end", "end", $dt); return $return; }
public function insGroup() { $update = isset($_GET['update']) ? addslashes($_GET['update']) : 0; $gid = isset($_GET['gid']) ? addslashes($_GET['gid']) : 0; $gname = isset($_POST['gname']) ? addslashes($_POST['gname']) : die("no gname"); $arrMember = isset($_POST['arrMember']) ? addslashes($_POST['arrMember']) : die("no arrMember"); $exp = explode(",", $arrMember); if (count($exp) < 2) { //minimum of chat group = 2 $json['bool'] = 0; $json['err'] = Lang::t('Chat min 2 person'); echo json_encode($json); die; } //first insert group $g = new ChatGroup(); if ($update) { if ($gid > 0) { $g->getByID($gid); if ($g->inbox_from != Account::getMyID()) { die("hacking attempt"); } else { $g->load = 1; $cg = new ChatMember(); $cg->deleteMemberByGID($gid); } } else { die("hacking attempt 2"); } } $g->inbox_judul = $gname; $g->inbox_from = Account::getMyID(); if (!$update) { $g->inbox_createdate = leap_mysqldate(); } $g->inbox_changedate = leap_mysqldate(); $id = $g->save(); if ($id) { if ($update) { $id = $gid; } foreach ($exp as $mm) { if ($mm == "") { continue; } $m = new ChatMember(); $m->chat_member_id = $mm; $m->chat_group_id = $id; $m->save(); } } $json = array(); $json['bool'] = $id; echo json_encode($json); }
function isiCart() { $json['bool'] = 0; $totalplusdiskon = addslashes($_POST['totalplusdiskon']); $total = addslashes($_POST['total']); $diskon = addslashes($_POST['diskon']); $arr = CartWeb::myCart(); $mm = new MTranDetail(); $mm->detail_date = leap_mysqldate(); $mm->detail_diskon = $diskon; $mm->detail_price = $total; $mm->detail_price_total = $totalplusdiskon; if (MemberLogin::isLogged()) { $mm->detail_macc_id = MemberLogin::getID(); } $mm->detail_ses_id = session_id(); $mm->detail_qty = CartWeb::totalCart(); if ($mm->save()) { foreach ($arr as $obj) { $obj->status = 2; $obj->load = 1; $obj->save(); //update bought $mprod = new MProdModel(); $mprod->getByID($obj->variant_id); $mprod->updateBought(); } session_regenerate_id(); $json['bool'] = 1; } //if sukses echo json_encode($json); die; }
function save_old() { $device_id = addslashes($_POST['device_id']); $type = addslashes($_POST['type']); if ($device_id == "" || $type == "") { $json['status_code'] = 0; echo json_encode($json); die; } // $did = $device_id."_".$type; $acc = isset($_POST['acc_id']) ? addslashes($_POST['acc_id']) : 0; $dn = new DeviceModel(); $dnquery = new DeviceModel(); // $dn->getByID($did); // langkah 1 , device ID ada device type ada $arrs = $dnquery->getWhere("device_id = '{$device_id}' AND device_type = '{$type}'"); $dn = $arrs[0]; // pr($arrs); if ($dn->did == "") { // $dn = new DeviceModel(); //langkah 2 ambil account id yg actual if ($acc > 0) { // echo "in"; $arrs = $dnquery->getWhere("acc_id = '{$acc}' AND device_type = '{$type}' AND device_id = '{$device_id}' ORDER BY logindate DESC"); $dn = $arrs[0]; // pr($dn); if (is_object($dn)) { $did = $dn->did; } else { $did = 0; } if (!$did) { //create baru acc id isi $dn = new DeviceModel(); // $dn->did = $did; $dn->device_id = $device_id; $dn->device_type = $type; $dn->acc_id = $acc; $dn->firstlogin = leap_mysqldate(); } else { //hapus semua entry dari account lama // global $db; // $query = "DELETE FROM {$dnquery->table_name} WHERE acc_id = '$acc' AND did != '{$dn->did}'"; // echo $query; // $db->query($query,0); //insert new //kalau acc id ada device id di update $dn->device_id = $device_id; // $dn->acc_id = $acc; $dn->load = 1; } } else { //create baru acc id kosong $dn = new DeviceModel(); // $dn->did = $did; $dn->device_id = $device_id; $dn->device_type = $type; $dn->firstlogin = leap_mysqldate(); // $dn->acc_id = $acc; } } else { //kalau device id ada, acc di update $dn->load = 1; $dn->acc_id = $acc; //untuk hapus jikalau cuman boleh satu... // global $db; // $query = "DELETE FROM {$dnquery->table_name} WHERE acc_id = '$acc' AND did != '{$dn->did}'"; // echo $query; // $db->query($query,0); } $dn->logindate = leap_mysqldate(); // pr($dn); if ($dn->save()) { $json['save_status'] = 1; } else { $json['save_status'] = 0; } $json['status_code'] = 1; echo json_encode($json); die; }
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; }
public function saveFromJS() { $user = json_decode($_POST['user']); //pr($user); $json['user'] = $user; $json['bool'] = 0; $email = $user->email; $fbid = $user->id; $arr = $this->getWhere("admin_email = '{$email}' AND admin_fb_id='{$fbid}' AND admin_aktiv = 1 "); $json['aktiv'] = "admin_email = '{$email}' AND admin_fb_id='{$fbid}' AND admin_aktiv = 1 "; $json['arr'] = $arr; if (count($arr) > 0) { $json['bool'] = 1; $_SESSION['sementara']['admin_email'] = $email; $_SESSION['sementara']['admin_fb_id'] = $fbid; } else { if ($user->email == "" || $user->id == "" || !isset($user->id) || !isset($user->email)) { $json['bool'] = 0; } else { $fb = new SiteMember(); $fb->admin_email = $user->email; $fb->admin_nama_depan = $user->first_name; $fb->admin_nama_belakang = $user->last_name; $fb->admin_fb_id = $user->id; $fb->admin_createdate = leap_mysqldate(); $fb->admin_lastupdate = leap_mysqldate(); $fb->admin_role = "normal_user"; $fb->admin_aktiv = 1; $fb->admin_name = $user->name; //pr($fb); $json['bool'] = $fb->save(); $_SESSION['sementara']['admin_email'] = $fb->admin_email; $_SESSION['sementara']['admin_fb_id'] = $fb->admin_fb_id; $_SESSION['sementara']['firsttime'] = 1; } } echo json_encode($json); die; //kalau perlu saja }