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; }
static function verify() { $app_id = addslashes($_POST['app_id']); $key = addslashes($_POST['key']); // echo $app_id; // echo $key; if ($app_id == "" || $key == "") { $json['status_code'] = 0; $json['status_message'] = "Key Missing"; die(json_encode($json)); } $app = new AppAccount(); $app->getByID($app_id); // pr($app); if ($app->app_token != $key) { $json['status_code'] = 0; $json['status_message'] = "Key Mismatched"; die(json_encode($json)); } return $app; }
static function kerjakan($psn) { $dev = new DeviceModel(); $arrDevs = $dev->getWhere("dev_app_id = '{$psn->camp_app_id}' AND dev_not_send = 0 "); //app details $app = new AppAccount(); $app->getByID($psn->camp_app_id); $array_id = array(); if (count($arrDevs) > 0) { foreach ($arrDevs as $dev) { if ($_GET['test']) { echo " acc_id : " . $dev->acc_id; echo "<br> dev_id : " . $dev->device_id; echo "<br> type : " . $dev->device_type; echo "<br>"; } $array_id[] = $dev->device_id; } $url2push = _BPATH . "WebViewer/messages/" . $psn->camp_id; $arrhasil = self::pushAfteriOS($array_id, $psn->camp_title, $url2push, $app); self::simpanHasilGCM($arrhasil, $psn, $array_id, $arrDevs, $app); } }
public function getSetting() { IMBAuth::checkOAuth(); $app_id = addslashes($_POST['app_id']); $app_token = addslashes($_POST['app_token']); $app = new AppAccount(); $app->getByID($app_id); if ($app_token != $app->app_token) { $json['status_code'] = 0; $json['status_message'] = "Token Mismatched"; echo json_encode($json); die; } $str = file_get_contents(_PHOTOPATH . "json/" . $app->app_keywords . ".json"); // pr($str); $json = json_decode($str); // pr($json); //ditambahi $json->powered_by_link = Efiwebsetting::getData("Powered_By_Link"); $json->status_code = 1; echo json_encode($json); die; }
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; } }
function saveTree($object, $webClass) { $tree = $_POST['tags']; $arr = json_decode($tree); $json = array(); //get active knoten $nrActive = $this->hitungAnakActive($arr[0][1]); // echo "<h1>".$nrActive."</h1>"; // pr($arr); //cek apakah paket sesuai dengan yg diperbolehkan $app = AppAccount::getActiveAppObject(); //category 1_7 $cat_id = $app->app_paket_id . "_7"; // $mm = new PaketMatrix(); $mm->getByID($cat_id); // $limit = (int) $mm->ps_isi; // // //get all campaign dengan app_id dan type yg diperbolehkan // $nr = $object->getJumlah("cat_parent_id != '-1' AND cat_app_id = '".$app->app_id."'"); // // // echo "nr = ".$nr." limit : ".$limit; if ($nrActive > $limit) { $json['bool'] = 0; $json['err'] = "<h1>Too Many Categories!! Limit is {$limit} </h1>"; echo json_encode($json); die; } //pr($arr); foreach ($arr as $n => $obj) { //cek apakah array if (is_array($obj)) { //if yes //get the first col as name and the res as children $id = $obj[0]; //echo "adalah array dengan element pertama adalah $id <br>"; //pr($obj); $this->saveTreeRecursive($obj[1], $id, $object, $webClass); } else { $id = $obj; //di skip aja krn tidak disave juga } } $json['bool'] = 1; $json['err'] = "<h1>Success</h1>"; echo json_encode($json); die; // exit(); }
function placeOrder() { //sementara semua credit card //$order = $_REQUEST['order']; //$order['payment_method'] == 'credit_card'; $json['paystate'] = 0; //langkah pertama daftarkan cc $creditCardId = $this->daftarkanCC(); $currency = 'USD'; $amount = addslashes($_POST['appprice']); $descr = addslashes($_POST['appdescr']); $app_id = addslashes($_POST['appid']); if ($creditCardId != NULL) { try { $paypal = new PaypalWrap(); $payment = $paypal->makePaymentUsingCC($creditCardId, $amount, $currency, $descr); // pr($payment); $order = new PaypalOrder(); $order->amount = $amount; $order->created_time = leap_mysqldate(); $order->currency = $currency; $order->description = $descr; $order->user_id = Account::getMyID(); $order->payment_id = $payment->getId(); $order->state = $payment->getState(); $orderId = $order->save(); $state = $order->state; if ($state == "approved") { $json['paystate'] = 1; //update paket active $app = new AppAccount(); $app->getByID($app_id); $app->app_active = 1; $app->app_contract_start = leap_mysqldate(); $app->app_pulsa = 1000; $app->app_contract_end = date('Y-m-d', strtotime('+1 year')); $app->load = 1; $app->save(); } $message = "Your order has been placed successfully. Your Order id is <b>{$orderId}</b>"; $messageType = 1; } catch (\PayPal\Exception\PPConnectionException $ex) { $message = parseApiError($ex->getData()); $messageType = 0; } catch (Exception $ex) { $message = $ex->getMessage(); $messageType = 0; } } else { $messageType = 0; $message = "credit card ID registration error"; } $json['bool'] = $messageType; $json['err'] = $message; echo json_encode($json); die; // if($_SERVER['REQUEST_METHOD'] == 'POST') { // // try { // if($order['payment_method'] == 'credit_card') { // // // Make a payment using credit card. // $user = getUser(getSignedInUser()); // $payment = makePaymentUsingCC($user['creditcard_id'], $order['amount'], 'USD', $order['description']); // $orderId = addOrder(getSignedInUser(), $payment->getId(), $payment->getState(), // $order['amount'], $order['description']); // $message = "Your order has been placed successfully. Your Order id is <b>$orderId</b>"; // $messageType = "success"; // // } else if($order['payment_method'] == 'paypal') { // // $orderId = addOrder(getSignedInUser(), NULL, NULL, $order['amount'], $order['description']); // // Create the payment and redirect buyer to paypal for payment approval. // $baseUrl = getBaseUrl() . "/order_completion.php?orderId=$orderId"; // $payment = makePaymentUsingPayPal($order['amount'], 'USD', $order['description'], // "$baseUrl&success=true", "$baseUrl&success=false"); // updateOrder($orderId, $payment->getState(), $payment->getId()); // header("Location: " . getLink($payment->getLinks(), "approval_url") ); // exit; // } // } catch (\PayPal\Exception\PPConnectionException $ex) { // $message = parseApiError($ex->getData()); // $messageType = "error"; // } catch (Exception $ex) { // $message = $ex->getMessage(); // $messageType = "error"; // } // } }
public function constraints() { //err id => err msg $err = array(); if (!isset($this->camp_pic)) { $err['camp_pic'] = Lang::t('Picture must be provided'); } else { $src = _PHOTOPATH . $this->camp_pic; list($iWidth, $iHeight, $type) = getimagesize($src); if (round($iWidth / $iHeight, 1) != round($this->ratio_weight / $this->ratio_height, 1)) { $err['camp_pic'] = Lang::t('Proportion is not right, please crop using our tool'); } } if (!isset($this->camp_name)) { $err['camp_name'] = Lang::t('Please provide carousel photo'); } if (!isset($this->camp_descr)) { $err['camp_descr'] = Lang::t('Description cannot be empty'); } if (!isset($this->camp_begin)) { $err['camp_begin'] = Lang::t('Validity cannot be empty'); } if (!isset($this->camp_end)) { $err['camp_end'] = Lang::t('Validity cannot be empty'); } $this->camp_app_id = AppAccount::getAppID(); $this->camp_updatedate = leap_mysqldate(); //cek apakah paket sesuai dengan yg diperbolehkan $app = AppAccount::getActiveAppObject(); //basic $type = $this->arrtype[$this->camp_type]; //carousel 1_5 $carousel_id = $app->app_paket_id . "_5"; $banner_id = $app->app_paket_id . "_6"; $mm = new PaketMatrix(); if ($type == "Carousel") { $mm->getByID($carousel_id); } if ($type == "Campaign") { $mm->getByID($banner_id); } $limit = $mm->ps_isi; //get all campaign dengan app_id dan type yg diperbolehkan $nr = $this->getJumlah("camp_app_id = '{$this->camp_app_id}' AND camp_active = 1 AND camp_type = '{$this->camp_type}'"); if ($this->camp_active) { if ($nr >= $limit) { $err['camp_active'] = Lang::t('Too many campaign active for ' . $type . ', please deactivate the others. Limit is ' . $limit); } } return $err; }
function doPushByDevIDwithFile() { /* * apa yang dibutuhkan */ // $client_id = addslashes($_POST['client_id']); $app_id = addslashes($_POST['app_id']); $key = addslashes($_POST['key']); $ipaddress = $_SERVER['REMOTE_ADDR']; // pr($_POST['devs']); $app = new AppAccount(); if ($app_id == "" || $key == "") { $json['status_code'] = 0; echo json_encode($json); die; } else { $app->getByID($app_id); // $acc = new Account(); // $acc->getByID($app->app_client_id); if ($app->app_token != $key) { $json['status_code'] = 0; $json['status_message'] = "wrong key"; echo json_encode($json); die; } if ($app->app_allowed_ip != "" && $app->app_allowed_ip != $ipaddress) { $json['status_code'] = 0; $json['status_message'] = "wrong ip, your ip is " . $ipaddress; echo json_encode($json); die; } } $start = addslashes($_POST['start']); $dest_url = addslashes($_POST['devs']); $devs = file_get_contents($dest_url); $client_camp_id = addslashes($_POST['camp_id']); $camp_name = addslashes($_POST['camp_name']); $camp_title = addslashes($_POST['camp_title']); //yg hrs ada cuman camp_title $camp_msg = addslashes($_POST['camp_msg']); $camp_url = addslashes($_POST['camp_url']); $camp_create_by = "API_" . $ipaddress; $camp_active = 1; $camp_status = 0; $camp_send_date = leap_mysqldate(); $array_ids = explode(",", $devs); $isTest = addslashes($_POST['isTest']); //check pulsa if (count($array_ids) > $app->app_pulsa) { $json['status_code'] = 0; $json['status_message'] = "Pulsa tidak cukup"; echo json_encode($json); die; } else { // check isTest , test max ke 2 devices if ($isTest != "") { if (count($array_ids) > 5) { $json['status_code'] = 0; $json['status_message'] = "Test can only use 5 IDS"; echo json_encode($json); die; } } //create local campaign $cm = new PushNotCamp(); $cm->camp_client_id = $client_camp_id; //ini buat id nya di client $cm->camp_app_id = $app_id; $cm->camp_start = leap_mysqldate(); $cm->camp_hour = 0; $cm->camp_name = $camp_name; $cm->camp_title = $camp_title; $cm->camp_msg = $camp_msg; $cm->camp_url = $camp_url; $cm->camp_create_by = $camp_create_by; $cm->camp_active = $camp_active; $cm->camp_status = $camp_status; $cm->camp_dev_ids = $devs; $camp_id = $cm->save(); $cm->camp_id = $camp_id; $res = self::push($app, $array_ids, $camp_title, $camp_url, $camp_id); $json = self::processGCM($res, $app_id, $cm, $array_ids, $app, $isTest); echo json_encode($json); die; } }
function getMatrix() { $cid = addslashes($_GET['cid']); //get campaign for owner verification $camms = new MCampaignModel(); $camms->getByID($cid); if ($camms->camp_app_id != AppAccount::getAppID()) { die("Not Allowed"); } $as = new MCampaignMatrix(); $arr = $as->getWhere("cm_camp_id = '{$cid}'"); $arrProd = $_SESSION['arrProd']; foreach ($arrProd as $pp) { $arrProds[$pp->prod_id] = $pp; } //pr($arrProds); //pr($arr); $t = time(); ?> <div class="col-md-6"> <?php foreach ($arr as $g) { $prod = $arrProds[$g->cm_prod_id]; $sudahAda[] = $g->cm_prod_id; ?> <div class="productcamp"> <div class="productcamp_title"> <div style="float:right;width: 20px;"> <i id="cm_<?php echo $g->cm_id; ?> " class="glyphicon glyphicon-arrow-right" style="cursor:pointer;"></i> </div> <?php echo $prod->prod_name; ?> </div> </div> <script> $("#cm_<?php echo $g->cm_id; ?> ").click(function(){ $.get("<?php echo _SPPATH; ?> MCampApp/delMatrix?cmid=<?php echo $g->cm_id; ?> ",function(data){ console.log(data); if(data.bool){ $("#camp_matrix").load("<?php echo _SPPATH; ?> MCampApp/getMatrix?cid=<?php echo $cid; ?> "); }else{ alert('<?php echo Lang::t('Delete Error'); ?> '); } },'json'); }); </script> <?php } ?> </div> <div class="col-md-6" > <div style="background-color: #AAA; margin: 5px; padding: 10px; "> <div class="input-group"> <span class="input-group-addon" id="basic-addon1">Select Product To Insert to Campaign</span> </div> <div class="input-group"> <span class="input-group-btn"> <button id="add_to_camp_<?php echo $t; ?> " class="btn btn-default" type="button"><i class="glyphicon glyphicon-arrow-left"></i></button> </span> <select id="sel_to_camp_<?php echo $t; ?> " class="form-control"> <?php foreach ($arrProds as $key => $prod) { if (in_array($key, $sudahAda)) { continue; } ?> <option value="<?php echo $prod->prod_id; ?> "><?php echo $prod->prod_name; ?> </option> <?php } ?> </select> </div><!-- /input-group --> </div> </div> <script> $("#add_to_camp_<?php echo $t; ?> ").click(function(){ var slc = $("#sel_to_camp_<?php echo $t; ?> ").val(); $.get("<?php echo _SPPATH; ?> MCampApp/insProd?cid=<?php echo $cid; ?> &pid="+slc,function(data){ console.log(data); if(data.bool){ $("#camp_matrix").load("<?php echo _SPPATH; ?> MCampApp/getMatrix?cid=<?php echo $cid; ?> "); }else{ alert('<?php echo Lang::t('Insert Error'); ?> '); } },'json'); }); </script> <?php exit; }
public function constraints() { //err id => err msg $err = array(); if (!isset($this->camp_pic)) { $err['camp_pic'] = Lang::t('Picture must be provided'); } else { $src = _PHOTOPATH . $this->camp_pic; list($iWidth, $iHeight, $type) = getimagesize($src); if (round($iWidth / $iHeight, 1) != round($this->ratio_weight / $this->ratio_height, 1)) { $err['camp_pic'] = Lang::t('Proportion is not right, please crop using our tool'); } } if (!isset($this->camp_name)) { $err['camp_name'] = Lang::t('Please provide carousel photo'); } if (!isset($this->camp_descr)) { $err['camp_descr'] = Lang::t('Description cannot be empty'); } if (!isset($this->camp_begin)) { $err['camp_begin'] = Lang::t('Validity cannot be empty'); } if (!isset($this->camp_end)) { $err['camp_end'] = Lang::t('Validity cannot be empty'); } $this->camp_app_id = AppAccount::getAppID(); return $err; }
public static function getActiveAppObject() { $app = new AppAccount(); $app->getByID(self::getAppID()); return $app; }
function appView() { $id = addslashes($_GET['id']); if (in_array("master_admin", Account::getMyRoles())) { // $acc = new AppAccount(); // $apps = $acc->getAll(); // $app = new AppAccount(); $app->getByID($id); } else { $acc = new App2Acc(); //AND app_active = 1 $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount")); // pr($apps); if (count($apps) < 1) { die("hacking attempt"); } else { $app = $apps[0]; } } $paket = new Paket(); $paket->getByID($app->app_paket_id); if (!$app->app_active) { header("Location:" . _SPPATH . "PaymentWeb/payfor?app_id=" . $app->app_id); die; } ?> <div class="container attop" > <div class="col-md-8 col-md-offset-2"> <small><a href="<?php echo _SPPATH; ?> mydashboard">back to dashboard</a> </small> <h1><?php echo $app->app_name; ?> <small><a href="">edit app</a></small></h1> <div class="paket">Paket : <b style="font-size: 18px;"><?php echo $paket->paket_name; ?> </b> <i>[<a href="">Edit Paket</a>]</i> </div> <div style="padding: 10px;"> <?php if (!$app->app_active) { ?> <a class="btn btn-success btn-lg" href="<?php echo _SPPATH; ?> PaymentWeb/payfor?app_id=<?php echo $app->app_id; ?> ">Payment</a> <?php } else { ?> <a class="btn btn-success btn-lg" href="<?php echo _SPPATH; ?> PushHome/setID?app_id=<?php echo $app->app_id; ?> ">Admin Panel</a> <?php } ?> </div> </div> </div> <?php // pr($app); }
function error() { $order_id = addslashes($_GET['order_id']); $status_code = addslashes($_GET['status_code']); $transaction_status = addslashes($_GET['transaction_status']); $vpt = new VpTransaction(); $vpt->getByID($order_id); $app = new AppAccount(); $app->getByID($vpt->order_app_id); AppAccount::checkOwnership($app); $vpt->order_status_from = $status_code; $vpt->save(); ?> <div class="container attop" > <div class="col-md-8 col-md-offset-2"> <div style="text-align: center; padding: 20px;"> <a href="<?php echo _SPPATH; ?> "> <img src="<?php echo _SPPATH; ?> images/appear-icontext.png" style="max-width: 300px;"> </a> </div> <?php ?> <h1>Error</h1> <p>Your Payment Error</p> <p> Please <a href="<?php echo _SPPATH; ?> contact">contact us</a> for more details. </p> <a class="btn btn-default" href="<?php echo _SPPATH; ?> myApps">back to my Apps</a> <?php ?> </div> </div> <?php /* * Array ( [url] => vp/error [order_id] => 70872981 [status_code] => 202 [transaction_status] => deny ) */ }
function mydashboard() { $acc = Account::getAccountObject(); ?> <style> #attratas{ text-align: right; } </style> <div class="container attop" > <div class="col-md-10 col-md-offset-1"> <h1>Dashboard</h1> <div id="attratas"> <button onclick="document.location='<?php echo _SPPATH; ?> MyApp/newApp';" class="btn btn-success" style="margin: 0px;">Create New Apps</button> <button onclick="document.location='<?php echo _SPPATH; ?> editAcc';" class="btn btn-info" style=" margin: 0px;">Edit Account</button> <button onclick="document.location='<?php echo _SPPATH; ?> myOrders';" class="btn btn-warning" style=" margin: 0px;">Order History</button> </div> <?php if (in_array("master_admin", Account::getMyRoles())) { $acc = new AppAccount(); $apps = $acc->getAll(); // } else { $acc = new App2Acc(); //AND app_active = 1 $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount")); } if (count($apps) > 0) { ?> <div class="table-responsive" style="margin-top: 20px;"> <table class="table table-striped table-bordered"> <thead> <tr> <th> No. </th> <th>App Name</th> <th>Package</th> <th>Status</th> <th>Expired Date</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach ($apps as $num => $ap) { $paket = new Paket(); $paket->getByID($ap->app_paket_id); ?> <tr> <td><?php echo $num + 1; ?> </td> <td><?php echo $ap->app_name; ?> </td> <td><?php echo $paket->paket_name; ?> </td> <td><?php echo $ap->app_active; ?> </td> <td><?php if ($ap->app_active == 1) { echo indonesian_date($ap->app_contract_end); } ?> </td> <td> <!-- <a href='--><?php //=_SPPATH; ?> <!--MyApp/appView?id=--><?php //=$ap->app_id; ?> <!--' class="btn btn-info">Edit</a>--> <?php if ($ap->app_active == 1) { ?> <a href='<?php echo _SPPATH; ?> PushHome/setID?app_id=<?php echo $ap->app_id; ?> ' class="btn btn-success">Admin</a> <?php } else { if ($ap->app_active == 0) { ?> <a href='<?php echo _SPPATH; ?> MyApp/appView?id=<?php echo $ap->app_id; ?> ' class="btn btn-danger">Payment</a> <?php } else { ?> <button class="btn btn-info">Waiting for Approval</button> <?php } } ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php } else { ?> <h5 class="hype">You do not have any App yet..</h5> <button onclick="document.location='<?php echo _SPPATH; ?> MyApp/newApp';" class="btn btn-success" style="width: 100%; margin: 5px;">Create My Own App </button> <?php } ?> </div> <div class="clearfix"></div> </div> <?php }
function selanjutnya() { $app_id = addslashes($_POST['app_id']); $key = addslashes($_POST['key']); $device_id = addslashes($_POST['device_id']); $type = addslashes($_POST['type']); $lat = addslashes($_POST['lat']); $lng = addslashes($_POST['long']); $acc = isset($_POST['acc_id']) ? addslashes($_POST['acc_id']) : 0; $log_page_id = addslashes($_POST['page_id']); if ($device_id == "" || $type == "") { $json['status_code'] = 0; echo json_encode($json); die; } if ($app_id == "" || $key == "") { $json['status_code'] = 0; echo json_encode($json); die; } else { $app = new AppAccount(); $app->getByID($app_id); // $acc = new Account(); // $acc->getByID($app->app_client_id); if ($app->app_token != $key) { $json['status_code'] = 0; $json['status_message'] = "wrong key"; echo json_encode($json); die; } } $logged = new DeviceLogger(); $logged->log_acc_id = $acc; $logged->log_date = leap_mysqldate(); $logged->log_dev_id = $device_id; $logged->log_dev_type = $type; $logged->log_app_id = $app_id; $logged->log_lat = $lat; $logged->log_lng = $lng; $logged->log_page_id = $log_page_id; $logged->save(); $json['status_code'] = 1; echo json_encode($json); die; }
function pusher() { IMBAuth::checkOAuth(); // pr($_POST); // if($_POST['ids'] == "")die("Please insert Customer ID"); if ($_POST['camp_id'] == "") { die("Please insert Campaign ID"); } // $ids = addslashes($_POST['ids']); $ps = new PushNotCamp(); $ps->getByID(addslashes($_POST['camp_id'])); $app = new AppAccount(); $app->getByID($ps->camp_client_id); $arrAcc = $ps->camp_client_id; //from acc get device ID Pusher::sendUsingArrayAcc($arrAcc, $ps, $app, 1); //1 for testing }
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; }
function actionfree() { $id = addslashes($_POST['app_id']); $action = addslashes($_POST['action']); $app = new AppAccount(); $app->getByID($id); $acc = new Account(); $acc->getByID($app->app_client_id); $agent = new Account(); if ($acc->admin_marketer != "") { $agent->getByUsername($acc->admin_marketer); } $dataemail = new DataEmail(); $json['bool'] = 0; if ($action == "accept") { //status = 1 tetap $app->app_type = 0; //type = 0 //contract start n end $app->app_contract_start = date("Y-m-d"); $app->app_contract_end = date('Y-m-d', strtotime(date("Y-m-d", mktime()) . " + 365 day")); $app->app_paket_id = 1; //free $succ = $app->save(); //spy masuk ke job queue //email ke marcel //komisi untuk agent nya... if ($succ) { //notify Admins kalau ada app active $dataemail->appBisaDibuat($app->app_name, $app->app_id, "Free App Accepted"); //notify User $dataemail->freeAppAccepted($acc->admin_email, $acc->admin_username, $app->app_name); $vpt = new VpTransaction(); $vpt->order_id = time(); //hitung komisi //ini belum bener //TODO 31 maret 2016 KomisiModel::log($app, $vpt); $json['bool'] = $succ; } } if ($action == "reject") { //status = 0 $app->app_active = 0; //type = 0 $app->app_type = 0; $app->app_paket_id = 0; $succ = $app->save(); //email ke client & agent if ($succ) { $dataemail->freeRequestRejected($acc->admin_email, $acc->admin_username, $app->app_name); if ($acc->admin_marketer != "") { $dataemail->freeRequestRejectedAgent($agent->admin_email, $acc->admin_username, $app->app_name, $agent->admin_username); } $json['bool'] = $succ; } } echo json_encode($json); die; }
/** * @return \yii\db\ActiveQuery */ public function getAccounts() { return $this->hasMany(AppAccount::className(), ['ID_Contract' => 'ID']); }
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; }
function testDate() { $date = new DateTime(); $date->setDate(2016, 31, 1); $ymd = $date->format('Y-m-d'); $ymd = "2016-01-31"; $prev_mon = date('Y-m-d', strtotime($ymd . " +1 month")); $prev_year = date('Y-m-d', strtotime($ymd . " +4 months")); echo " " . $prev_mon . " " . $prev_year; $curMonth = 7; $curYear = 2016; if ($curMonth == 12) { $firstDayNextMonth = mktime(0, 0, 0, 0, 0, $curYear + 1); } else { $firstDayNextMonth = mktime(0, 0, 0, $curMonth + 1, 1); } pr(date("Y-m-d", $firstDayNextMonth)); pr(getFirstDayOfNextMonth($curMonth, $curYear)); pr(getFirstDayOfNext4Month($curMonth, $curYear)); $app = new AppAccount(); $app->getByID(19); $vpt = new VpTransaction(); $vpt->getByID("14720056041915"); $vpt->order_id = 1122; // KomisiModel::log($app,$vpt); $nn = new AppFree(); $nn->printColumlistAsAttributes(); }
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"); } }
public function constraints_old() { //err id => err msg $err = array(); if (!isset($this->prod_pic)) { $err['prod_pic'] = Lang::t('Picture must be provided'); } else { // $src = _PHOTOPATH.$this->camp_pic; // list($iWidth,$iHeight,$type) = getimagesize($src); // if(round($iWidth/$iHeight,1) != round($this->ratio_weight/$this->ratio_height,1)){ // $err['camp_pic'] = Lang::t('Proportion is not right, please crop using our tool'); // } } if (!isset($this->prod_name)) { $err['prod_name'] = Lang::t('Please provide Name'); } if (!isset($this->prod_des)) { $err['prod_des'] = Lang::t('Description cannot be empty'); } if (!isset($this->prod_price)) { $err['prod_price'] = Lang::t('Price cannot be empty'); } if (!isset($this->prod_cat_id)) { $err['prod_cat_id'] = Lang::t('Category cannot be empty'); } if (!isset($this->prod_stock)) { $err['prod_stock'] = Lang::t('Stock cannot be empty'); } if (!isset($this->prod_attribute_array)) { $err['prod_attribute_array'] = Lang::t('Attribute cannot be empty'); } $this->prod_app_id = AppAccount::getAppID(); //cek apakah paket sesuai dengan yg diperbolehkan $app = AppAccount::getActiveAppObject(); //carousel 1_5 $carousel_id = $app->app_paket_id . "_8"; $mm = new PaketMatrix(); $mm->getByID($carousel_id); $limit = $mm->ps_isi; //get all campaign dengan app_id dan type yg diperbolehkan $nr = $this->getJumlah("prod_app_id = '{$this->prod_app_id}' AND prod_active = 1"); if ($this->prod_active) { if ($nr >= $limit) { $err['prod_active'] = Lang::t('Too many products active!! Please deactivate the others. Limit is ' . $limit); } } // $err['prod_active'] = Lang::t($nr.' Too many products active!! Please deactivate the others. Limit is '.$limit); // $this->camp_updatedate = leap_mysqldate(); return $err; }
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 function registerPushNotif() { IMBAuth::checkOAuth(); $app_id = addslashes($_POST['app_id']); $app_token = addslashes($_POST['app_token']); $app = new AppAccount(); $app->getByID($app_id); if ($app->app_token != $app_token) { $json['status_code'] = 0; $json['status_message'] = "Token Mismatched"; echo json_encode($json); die; } $acc_id = addslashes($_POST['acc_id']); $now = addslashes($_POST['now']); $ios = addslashes($_POST['ios']); $_GET['ios'] = $ios; $push_title = addslashes($_POST['push_title']); $push_msg = addslashes($_POST['push_msg']); $push_url = addslashes($_POST['push_url']); $push_img = addslashes($_POST['push_img']); $push_date = date("Y-m-d", strtotime(addslashes($_POST['push_date']))); $push_time = (int) addslashes($_POST['push_time']); $img = ''; if ($push_img != '') { $img = Crud::savePic($push_img); } $push = new PushNotCamp(); $push->camp_client_id = $app->app_client_id; $push->camp_img = $img; $push->camp_name = $push_title; $push->camp_title = $push_title; $push->camp_active = 1; $push->camp_start = $push_date; $push->camp_hour = $push_time; $push->camp_msg = $push_msg; $push->camp_url = $push_url; $push->camp_create_by = $acc_id; $push->camp_app_id = $app->app_id; $camp_id = $push->save(); if ($camp_id) { $json['status_code'] = 1; if ($now) { //langsung do push $succ = Pusher::pushbyID($camp_id); $json['status_message'] = "Push Notifications Pushed"; echo json_encode($json); die; } else { $json['status_message'] = "Push Notifications Registration Success"; echo json_encode($json); die; } } else { $json['status_code'] = 0; $json['status_message'] = "Push Notifications Registration Failed"; echo json_encode($json); die; } }
public static function payoutWS($acc) { $agent_id = $acc->admin_id; $mon = isset($_GET['mon']) ? addslashes($_GET['mon']) : date("n"); $y = isset($_GET['y']) ? addslashes($_GET['y']) : date("Y"); $json['acc_id'] = $acc->admin_id; $json['mon'] = $mon; $json['y'] = $y; $arr = AppearSales::getPayoutArray($acc->admin_id, $mon, $y); foreach ($arr['pertama'] as $tt) { $app = new AppAccount(); $app->getByID($tt->komisi_app_id); $acc = new Account(); $acc->getByID($tt->komisi_app_client_id); $paket = new Paket(); $paket->getByID($tt->komisi_paket_id); $earn = array(); $earn['order_id'] = $tt->komisi_order_id; $earn['komisi_app_date'] = $tt->komisi_app_date; $earn['app_name'] = $app->app_name; $earn['app_id'] = $app->app_id; $earn['client_name'] = $acc->admin_nama_depan; $earn['paket_id'] = $paket->paket_id; $earn['paket_name'] = $paket->paket_name; // $earn['komisi_tingtong'] = $tt->komisi_ting_tong; // $earn['komisi_tingtong_date'] = $tt->komisi_tingtong_date; $earn['komisi_bagi_pertama_value'] = $tt->komisi_bagi_pertama_value; $earn['komisi_bagi_pertama_date'] = date("F Y", strtotime($tt->komisi_bagi_pertama_date)); $earn['komisi_bagi_kedua_value'] = $tt->komisi_bagi_kedua_value; $earn['komisi_bagi_kedua_date'] = date("F Y", strtotime($tt->komisi_bagi_kedua_date)); $earn['total_komisi'] = $tt->komisi_value; $json['payout']['first'][] = $earn; } foreach ($arr['kedua'] as $tt) { $app = new AppAccount(); $app->getByID($tt->komisi_app_id); $acc = new Account(); $acc->getByID($tt->komisi_app_client_id); $paket = new Paket(); $paket->getByID($tt->komisi_paket_id); $earn = array(); $earn['order_id'] = $tt->komisi_order_id; $earn['komisi_app_date'] = $tt->komisi_app_date; $earn['app_name'] = $app->app_name; $earn['app_id'] = $app->app_id; $earn['client_name'] = $acc->admin_nama_depan; $earn['paket_id'] = $paket->paket_id; $earn['paket_name'] = $paket->paket_name; // $earn['komisi_tingtong'] = $tt->komisi_ting_tong; // $earn['komisi_tingtong_date'] = $tt->komisi_tingtong_date; $earn['komisi_bagi_pertama_value'] = $tt->komisi_bagi_pertama_value; $earn['komisi_bagi_pertama_date'] = date("F Y", strtotime($tt->komisi_bagi_pertama_date)); $earn['komisi_bagi_kedua_value'] = $tt->komisi_bagi_kedua_value; $earn['komisi_bagi_kedua_date'] = date("F Y", strtotime($tt->komisi_bagi_kedua_date)); $earn['total_komisi'] = $tt->komisi_value; $json['payout']['kedua'][] = $earn; } foreach ($arr['bonus'] as $tt) { $app = new BonusKomisi(); $app->getByID($tt->bagi_bk_id); $acc = new Account(); $acc->getByID($tt->bagi_acc_id); $earn = array(); $earn['bonus_name'] = "Bonus " . $tt->bagi_bk_id; $earn['bonus_date'] = $tt->bagi_date_acquire; $earn['bonus_value'] = $tt->bagi_value; $json['payout']['bonus'][] = $earn; } $json['payout_total'] = AppearSales::calculatePayout($agent_id, $mon, $y)['total']; $json['status_code'] = 1; $json['status_message'] = "Success"; echo json_encode($json); die; }
public function constraints() { //err id => err msg $err = array(); if (!isset($this->camp_start)) { $err['camp_start'] = Lang::t('Start cannot be empty'); } if (!isset($this->camp_hour)) { $err['camp_hour'] = Lang::t('Time cannot be empty'); } if (!isset($this->camp_msg) && !isset($this->camp_url)) { $err['camp_msg'] = Lang::t('Either Msg or URL must be filled'); $err['camp_url'] = Lang::t('Either Msg or URL must be filled'); } if (!isset($this->camp_name)) { $err['camp_name'] = Lang::t('Name cannot be empty'); } if (!isset($this->camp_title)) { $err['camp_title'] = Lang::t('Title cannot be empty'); } if (isset($this->camp_app_id)) { $app = new AppAccount(); $app->getByID($this->camp_app_id); $this->camp_client_id = $app->app_client_id; } return $err; }
public function __construct() { $this->tree_multi_user_constraint = array("cat_app_id" => AppAccount::getAppID()); }
public static function myorderspage() { $arrPaymentStatus = array("1" => array("settlement", "success"), "2" => array("success", "success"), "3" => array("challenge", "failed"), "4" => array("pending", "pending"), "5" => array("deny", "denied"), "6" => array("cancel", "canceled")); ?> <style> @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } } </style> <style> .heading_earning{ font-size: 17px; font-style: italic; } .heading_amount{ font-size: 40px; } .inside{ padding: 20px; } .selectMonth{ /*padding-left: 10px;*/ } .payout{ color: #95abc2; } .money{ font-size: 22px; color: #73879C; } .big{ font-size: 25px; color: #73879C; } .rev_item{ background-color: #ffffff; margin-top: 20px; margin-bottom: 20px; } .order_id{ font-size: 20px; color: #73879C; } .pdate{ color: #73879C; font-style: italic; } .heading_amount{ font-size: 30px; text-align: right; padding-bottom: 100px; } .heading_amount_Sales{ font-size: 18px; text-align: right; /*padding-bottom: 20px;*/ } @media (max-width: 768px) { .monly { display: initial; } .donly { display: none; } .selectMonth{ padding-left: 0px; padding-bottom: 20px; border-bottom: 1px solid #CCCCCC; } .rightborder{ border-bottom: 1px solid #CCCCCC; } .leftborder{ border-top: 1px solid #CCCCCC; } .inside{ padding: 10px; } .tarmob{ /*text-align: right;*/ } } @media (min-width: 768px) { .monly { display: none; } .donly { display: initial; } .leftborder{ border-left: 1px solid #CCCCCC; min-height: 120px; } .rightborder{ border-right: 1px solid #CCCCCC; } } </style> <div class="container attop" > <div class="col-md-12"> <div class="appear_logo_pages"> <a href="<?php echo _SPPATH; ?> "> <img src="<?php echo _SPPATH; ?> images/appear-order.png" > </a> </div> <?php $orders = new VpTransaction(); $arrOrder = $orders->getWhere("order_acc_id = '" . Account::getMyID() . "' ORDER BY order_date DESC"); if (count($arrOrder) > 0) { foreach ($arrOrder as $num => $orders) { $app = new AppAccount(); $app->getByID($orders->order_app_id); $paket = new Paket(); $paket->getByID($orders->order_paket_id); ?> <div class="rev_item col-md-12"> <div class="col-md-5 "> <div class="inside"> <div class="payout col-md-6 col-sm-6 col-xs-6"> <div class="rev_details2"> <small>Order ID</small> <div class="order_id"><?php echo $orders->order_id; ?> </div> </div> </div> <div class="payout col-md-6 col-sm-6 col-xs-6"> <div class="rev_details"> Date : <?php echo date("F j, Y, g:i a", strtotime($orders->order_date)); ?> </div> <div class="rev_details"> App : <?php echo $app->app_name; ?> </div> <div class="rev_details"> Paket : <?php echo $paket->paket_name; ?> </div> </div> <div class="clearfix"></div> </div> </div> <div class="col-md-3 payout leftborder rightborder"> <div class="inside"> <div class="komisi tarmob"> Order Value <div class="order_id"> IDR <?php echo idr($orders->order_value); ?> </div> </div> </div> </div> <div class="col-md-4 "> <div class="inside tarmob"> <small>Status</small> <div class="money big"><?php echo $arrPaymentStatus[$orders->order_status][1]; ?> </div> <?php if ($orders->order_status == "1" || $orders->order_status == "2") { ?> <a href="<?php echo _SPPATH; ?> PaymentWeb/receipt?order_id=<?php echo $orders->order_id; ?> ">receipt</a> <?php } ?> <?php if ($orders->order_status != "1" && $orders->order_status != "2" && $orders->order_status != "4") { if ($app->app_active == 0) { ?> <a href="<?php echo _SPPATH; ?> PaymentWeb/pay?app_id=<?php echo $app->app_id; ?> ">pay again using different method</a> <?php } } ?> </div> </div> <div class="clearfix"></div> </div> <?php } ?> <div class="clearfix"></div> <?php } else { ?> <h1>No orders has been made yet</h1> <?php } ?> </div> </div> <?php }