public function recommendationRestoWS() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $lat = isset($_GET['latitude']) ? addslashes($_GET['latitude']) : ""; if ($lat == "" or !$lat) { $lat = MenuRevoConstants::$latitude; } if (!Generic::checkLatitude($lat)) { Generic::errorMsg("Latitude must be Numeric!"); } $long = isset($_GET['longitude']) ? addslashes($_GET['longitude']) : ""; if ($long == "" or !$long) { $long = MenuRevoConstants::$longitude; } if (!Generic::checklongitude($long)) { Generic::errorMsg("Longitude must be Numeric!"); } $distance = isset($_GET['distance']) ? addslashes($_GET['distance']) : 20; if ($distance == '') { $distance = 20; } $page = addslashes($_GET['page']); if ($page == "" || $page < 1) { $json['status_code'] = 0; $json['status_message'] = "No Page Found"; echo json_encode($json); die; } $limit = addslashes($_GET['limit']); if ($limit == "" || $limit < 1) { $json['status_code'] = 0; $json['status_message'] = "Limit Error"; echo json_encode($json); die; } $begin = ($page - 1) * $limit; $json = array(); $json['status_code'] = 1; global $db; $objRecommendation = new RecommendationModel(); $objRestaurant = new MasterRestaurantModel(); $qdish = "SELECT recom.*, SQRT(POW(69.1 * (resto.latitude - {$lat}), 2) + POW(69.1 * ({$long} - resto.longitude) * COS(resto.latitude / 57.3), 2)) AS distance FROM {$objRecommendation->table_name} recom LEFT JOIN {$objRestaurant->table_name} resto ON resto.id_restaurant= recom.id_restaurant AND DATE(recom.end) >= DATE(NOW()) AND DATE(recom.start)<= DATE(NOW())HAVING distance < {$distance} ORDER BY distance LIMIT {$begin},{$limit}"; $arrRecom = $db->query($qdish, 2); // if (count($arrRecom) == 0) { // $json['status_code'] = 0; // $json['status_message'] = "No ID Found"; // echo json_encode($json); // die(); // } $json['results']['restaurant'] = array(); foreach ($arrRecom as $recom) { $resto = Generic::getRestaurant($recom->id_restaurant); $resto['distance'] = $recom->distance; $json['results']['restaurant'][] = $resto; } echo json_encode($json); die; }
public function changeStatusProgress() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $id_order_detail = isset($_GET['id_order_detail']) ? addslashes($_GET['id_order_detail']) : ""; if (!$id_order_detail) { Generic::errorMsg("id order detail not found!"); } $objOrderDetail = new OrderDetailModel(); $objOrderDetail->getByID($id_order_detail); if ($objOrderDetail->id_order == "") { Generic::errorMsg("id order detail not found!"); } $statusProgress = intval($objOrderDetail->status_progress); if ($statusProgress == 2) { Generic::errorMsg("Status is " . $statusProgress); } $statusProgress = $statusProgress + 1; $objOrderDetail->status_progress = strval($statusProgress); $objOrderDetail->load = 1; $objOrderDetail->save(); $json['results'] = $statusProgress; echo json_encode($json); die; }
public function getCashOutHistoryTransaction() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $idResto = Generic::mustCheck($_GET['id_restaurant'], "No ID Restaurant Found"); $rt = new MasterRestoTransactionModel(); $arrTrans = $rt->getWhere("id_restaurant='{$idResto}' AND type_transaction='2' ORDER BY datetime_transaction DESC "); $result['transactions'] = array(); foreach ($arrTrans as $trans) { unset($b); $b['id_transaction'] = $trans->id_transaction; $b['id_restaurant'] = $trans->id_restaurant; $b['gross_amount'] = (double) $trans->gross_amount; $b['net_amount'] = (double) $trans->net_amount; $b['type_transaction'] = $trans->type_transaction; $b['datetime_transaction'] = $trans->datetime_transaction; $b['approved'] = $trans->approved == "1"; $result['transactions'][] = $b; } $json['status_code'] = 1; $json['results'] = $result; echo json_encode($json); die; }
public static function getCategory() { $token = IMBAuth::createOAuth(); $url = "http://localhost:8888/tbsecom/LLProdWeb/getCategory?token=" . $token; $url = "http://www.hulx.net/hulx/LLProdWeb/getCategory?token=" . $token; $contents = file_get_contents($url); $obj = json_decode($contents); return $obj; }
public function get() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json['status_code'] = 1; $prod_id = addslashes($_GET['prod_id']); if (!$prod_id) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $llTesti = new LL_Testimonial(); $arrW = $llTesti->getWhereFromMultipleTable("testi_product_id = '{$prod_id}' AND testi_acc_id = macc_id AND testi_status = '1' ORDER BY testi_date DESC LIMIT 0,30", array("LL_Account")); //pr($arrW); $llacc = new LL_Account(); $exp2 = explode(",", $llacc->crud_webservice_allowed); $arrPicsToAddPhotoUrl2 = $llacc->crud_add_photourl; $obj = $llTesti; $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $json = array(); $json['status_code'] = 1; //$json['results_number'] = $obj->getJumlah($query); //filter foreach ($arrW as $o) { $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = $o->{$attr}; } } foreach ($exp2 as $attr) { if ($attr == "macc_ll_customer_id") { break; } if (in_array($attr, $arrPicsToAddPhotoUrl2)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = $o->{$attr}; } } $json["results"][] = $sem; } if (count($arrW) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; }
public function langsung() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $url = Efiwebsetting::getData("Portal_IP") . "PortalWeb/StorePortal?cmd=ws&mws=getall"; $data = file_get_contents($url); echo $data; exit; }
function loginWAnything() { $cred1 = addslashes($_POST['cred1']); $cred2 = date('Y-m-d', strtotime(addslashes($_POST['cred2']))); $rememberme = addslashes($_POST['rememberme']); $token = IMBAuth::createOAuth(); // pr($_POST); // echo "1"; //Cek di LL $url = _LOKASI . "LL_AccWeb/signInWCardnBday?token=" . $token; //extract data from the post //set POST variables $fields = array('card' => urlencode($cred1), 'dob' => urlencode($cred2)); //url-ify the data for the POST foreach ($fields as $key => $value) { $fields_string .= $key . '=' . $value . '&'; } rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // echo 1; //execute post $result = curl_exec($ch); // echo 2; // pr($result); //close connection curl_close($ch); // echo "2"; // pr($result); //kalau suksess update session dan tampilan web di header... $memberobj = json_decode($result); // pr($memberobj); $json['memberobj'] = $memberobj; if ($memberobj->status_code == '1') { $json['bool'] = 1; $json['results'] = MemberLogin::setSession($memberobj->results, $rememberme); } else { $json['bool'] = 0; $json['status_message'] = $memberobj->status_message; } echo json_encode($json); die; }
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; }
public function extraMenu() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $objHS = new HomeSettingModel(); $json = array(); $json['status_code'] = 1; $search_type = isset($_GET['search_type']) ? addslashes($_GET['search_type']) : ""; if (!$search_type) { Generic::errorMsg("Search Type is blank!"); } $search_term = isset($_GET['search_term']) ? addslashes($_GET['search_term']) : ""; if (!search_term) { Generic::errorMsg("Search Term is blank!"); } }
function coba() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $m = new MasterRestaurantModel(); $n = new MasterMenuModel(); $arr = $n->getWhereFromMultipleTable("{$m->table_name}.id_restaurant = {$n->table_name}.id_restaurant", array("MasterRestaurantModel")); echo count($arr); foreach ($arr as $c) { echo $c->id_menu . " " . $c->name; echo "<br>"; } echo json_encode($arr); //`menurevo__ms_restaurant` //INSERT INTO `c1nt466_menurevo`.`menurevo__ms_menu` (`id_menu`, `category_ids`, `status`, `id_restaurant`, `layout_type`) VALUES ('1', 'Food', 'Aktiv', '1', ''); die; }
public function setInvitation() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $id_order = Generic::mustCheck($_GET['id_order'], "NO ID Order found!"); $result = $this->setInvitationStatus("1", $id_order); if ($result) { $json['status_code'] = 1; $json['status_message'] = "Success!"; } else { $json['status_code'] = 0; $json['status_message'] = "Failed!"; } 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 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 getNews() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $m = addslashes($_GET['mode']); if ($m == "news") { $news = new LL_News(); $start = "news_start"; $end = "news_end"; $active = "news_active"; $url = "news_url"; $webview = "news"; $order = "news_order DESC,news_start DESC"; } elseif ($m == "offer") { $news = new LL_Program(); $start = "prog_date_start"; $end = "prog_date_end"; $active = "prog_active"; $url = "prog_url"; $webview = "offers"; $order = "prog_date_start DESC"; } else { $news = new CarouselMobile(); $start = "carousel_start"; $end = "carousel_end"; $active = "carousel_active"; $url = "carousel_url"; $webview = "carousel"; $order = "carousel_start DESC"; } $json['status_code'] = 1; $obj = $news; // $arrn = $news->getWhere('news_active = 1 AND CURDATE() between news_start and news_end ORDER BY news_start DESC'); // pr($arrn); $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; // echo $active.' = 1 AND CURDATE() between '.$start.' and '.$end.' ORDER BY '.$start.' DESC'; $arr = $obj->getWhere($active . ' = 1 AND CURDATE() between ' . $start . ' and ' . $end . ' ORDER BY ' . $order); $json = array(); $json['status_code'] = 1; //filter foreach ($arr as $o) { $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { if ($url != "carousel_url" && $attr == $url && $o->{$attr} == "") { $sem[$attr] = _BPATH . "WebViewer/" . $webview . "/" . $o->{$main_id}; } else { $sem[$attr] = stripslashes($o->{$attr}); } } } $json["results"][] = $sem; } if (count($arr) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; }
public function repositionTables() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $id_restaurant = isset($_POST['id_restaurant']) ? addslashes($_POST['id_restaurant']) : ""; if (!$id_restaurant) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $jsonTables = isset($_POST['tables']) ? $_POST['tables'] : ""; if (!$jsonTables) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $jsonArrayTables = json_decode($jsonTables); // pr($jsonArrayTables); $countjsonArrayTables = count($jsonArrayTables); // pr($countTables); $objResto = new MasterRestaurantModel(); $arrResto = $objResto->getWhere("id_restaurant='{$id_restaurant}'"); MasterDish::checkCount($arrResto); $countTablesinResto = $arrResto[0]->table_quantity; // pr($arrResto); $objTable = new MasterTableModel(); $arrTable = $objTable->getWhere("id_restaurant='{$id_restaurant}'"); if ($countTablesinResto != $countjsonArrayTables) { Generic::errorMsg("Wrong Quantity"); } // $break = false; // foreach ($jsonArrayTables as $key => $objTables) { //// // $arrReposTable = $objTable->getWhere("id_restaurant='$id_restaurant' AND id_table='$objTables->table_id' "); // if (count($arrReposTable) == 0) { // $break = true; // $msg = $msg . " $objTables->table_id can't find in database."; // } // } // if ($break == false) { // foreach ($jsonArrayTables as $key => $objTables) { // $arrReposTable = $objTable->getWhere("id_restaurant='$id_restaurant' AND id_table='$objTables->table_id' "); //// $arrReposTable[0]->table_position = $key + 1; // $arrReposTable[0]->load = 1; // $arrReposTable[0]->save(); // } // } $counter = 1; foreach ($jsonArrayTables as $jsonObjTable) { $table = new MasterTableModel(); $table->getByID($jsonObjTable->table_id); $table->table_position = $counter; $table->save(); $counter++; } $json['status_code'] = 1; $json['results']['message'] = "success"; echo json_encode($json); die; }
public function sendwithreturn() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $idOrder = $_GET['id_order']; $toEmail = $_GET['email']; $order = new MasterOrderModel(); $order->getByID($idOrder); $resto = new MasterRestaurantModel(); $resto->getByID($order->id_restaurant); $subject = "Your receipt from " . $restoName . " , Receipt#" . $idOrder; $od = new OrderDetailModel(); $d = new MasterDishModel(); // $dompdf = new Dompdf\Dompdf(); global $db; $q = "SELECT {$od->table_name}.id_dish, {$d->table_name}.name, SUM(quantity) AS sum_qty, {$d->table_name}.price,\nSUM({$od->table_name}.price) AS sum_price, status_progress FROM `{$od->table_name}`\nRIGHT JOIN {$d->table_name} ON {$od->table_name}.id_dish = {$d->table_name}.id_dish WHERE id_order='{$idOrder}' GROUP BY id_dish"; $arrDetails = $db->query($q, 2); $css_boot = _BPATH . "themes/tbstheme_ori/css/bootstrap.min.css"; $image1 = _BPATH . _PHOTOURL . $resto->image_logo; if ($image1 == "") { $image1 = _BPATH . _PHOTOURL . "noimage.jpg"; } $head = "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; $head = "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Notification email</title>"; $head = $head . "<link href=" . $css_boot . " rel=\"stylesheet\">"; $head = $head . "<link href=\"https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700&subset=latin,latin-ext\" rel=\"stylesheet\" type=\"text/css\">"; $head = $head . "</head>"; $html = "<div style=\"max-width: 800px; box-shadow: 0 0 10px rgba(0, 0, 0, .15); font-size: 16px; line-height: 24px; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #555; margin: auto; padding: 30px; border: 1px solid #eee;\">\n<table style=\"width: 100%; line-height: inherit; text-align: left;\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top; padding: 5px;\" colspan=\"2\">\n<table style=\"width: 100%; line-height: inherit; text-align: left;\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top; font-size: 45px; line-height: 45px; color: #333; width: 50%; display: block; text-align: left; padding: 5px 5px 20px;\" align=\"left\" valign=\"top\"><img style=\"width: 50%; max-width: 300px;\" src=" . $image1 . " alt=\"\" /></td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; width: 100%; display: block; text-align: left; padding: 5px 5px 40px;\" align=\"center\" valign=\"top\">"; $html = $html . "<strong>" . $resto->name . "</strong><br />"; $html = $html . $resto->district . " - " . $resto->city . " <br>"; $html = $html . "Phone : " . $resto->phone_no . "</td>"; $html = $html . "</tr>\n</tbody>\n</table>\n</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; padding: 5px;\" colspan=\"2\" valign=\"top\">\n<table style=\"width: 100%; line-height: inherit; text-align: left;\">\n<tbody>\n<tr>\n<td style=\"vertical-align: top; text-align: left; t width: 50%; display: block; padding: 5px 5px 20px;\" align=\"left\" valign=\"top\">"; $html = $html . "</tr>"; $html = $html . "Receipt #: " . $idOrder; $html = $html . "<br/>"; $html = $html . " Server : "; if ($order->type_order == "1" || $order->type_order == "3") { $html = $html . "Apps Order"; } else { $html = $html . $order->server_name; } $html = $html . "<br/>"; $html = $html . " Time Order : " . date("d M, Y H:m", strtotime($order->datetime_order)); $html = $html . "<br/>"; $html = $html . " Payment Method : " . Generic::selectPaymentMethod($order->status_payment); $html = $html . "<br/>"; if ($order->type_order == "1" || $order->type_order == "3") { $html = $html . "Apps Order"; } else { $html = $html . "Manual Order"; } $html = $html . "<br/>"; $html = $html . "</td>"; $html = $html . "</tr> \n</tbody>\n</table>\n</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" valign=\"top\" bgcolor=\"#eee\">Item</td>\n<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" align=\"center\" valign=\"top\" bgcolor=\"#eee\">#</td>\n<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" align=\"right\" valign=\"top\" bgcolor=\"#eee\">Price</td>\n <td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #ddd; font-weight: bold; background-color: #eee; padding: 5px;\" align=\"right\" valign=\"top\" bgcolor=\"#eee\">Total</td>\n</tr>"; foreach ($arrDetails as $details) { $void = ""; if ($details->status_progress == "9") { $void = "<strong> Voided </strong>"; $details->price = 0; $details->sum_price = 0; } $html = $html . "<tr><td style=\"vertical-align: top; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" valign=\"top\">" . $details->name . $void . "</td>"; $html = $html . "<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" align=\"right\" valign=\"top\">" . $details->sum_qty . "</td>"; $html = $html . "<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($details->price) . "</td>"; $html = $html . "<td style=\"vertical-align: top; text-align: right; border-bottom-width: 1px; border-bottom-color: #eee; border-bottom-style: solid; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($details->sum_price) . "</td></tr>"; } $html = $html . "<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Total : </td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->total_cost) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Disc Resto : </td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->disc_resto) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Disc Credit Card : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->disc_bank) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Disc MR : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->disc_mr) . "</td>\n</tr>\n\n<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Tax PB1 : </td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->tax_pb1) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Service Charge : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->tax_pb1) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Other Charge : </td>\n<td style=\"vertical-align: top; text-align: right; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->tax_pb1) . "</td>\n</tr>\n<tr>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\"></td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">Grand Total :</td>\n<td style=\"vertical-align: top; text-align: right; border-top-style: solid; border-top-width: 2px; border-top-color: #eee; font-weight: bold; padding: 5px;\" align=\"right\" valign=\"top\">" . Generic::formatRupiah($order->grand_total) . "</td>\n</tr>\n\n</tbody>\n</table>\n</div></html>"; $html = $head . $html; $mail = new Leapmail(); $res = $mail->sendEmailHTML($toEmail, $subject, $html); return $res; }
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'])); $exp = explode(",", $ids); $arrAcc = array(); foreach ($exp as $ac) { $arrAcc[] = trim(rtrim($ac)); } //from acc get device ID Pusher::sendUsingAccountArray($arrAcc, $ps, 1); //1 for testing }
public function restoUserLogin() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $id_restaurant = isset($_POST['id_restaurant']) ? addslashes($_POST['id_restaurant']) : ""; if (!$id_restaurant) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $pin = isset($_POST['pin']) ? addslashes($_POST['pin']) : ""; if (!$pin) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $json = array(); $json['status_code'] = 1; $objRestoUsers = new RestaurantUserModel(); $arrRestoUsers = $objRestoUsers->getWhere("id_restaurant = '{$id_restaurant}' AND pin_password='******' AND status='1'"); MasterDish::checkCount($arrRestoUsers); $sem = array(); foreach ($arrRestoUsers as $val) { $sem['user'] = RestaurantUser::getRestaurantUser($val->id_user); } $json['results'] = $sem; echo json_encode($json); die; }
function deleteByLogID() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $macc_id = addslashes($_POST['macc_id']); $lid = addslashes($_POST['lid']); $psl = new PushLogger(); $psl->getByID($lid); $json['status_code'] = 0; if ($psl->log_macc_id = $macc_id) { //tidak active lagi $psl->log_active = 0; $psl->load = 1; if ($psl->save()) { $json['status_code'] = 1; } } echo json_encode($json); die; }
public function getUserDWBalance() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } if (Generic::IsNullOrEmptyString($_GET['id_user'])) { $results['balance'] = doubleval(0); Generic::finish($results); } $idUser = addslashes($_GET['id_user']); $user = new UserModel(); $user->getByID($idUser); $results["pic"] = Generic::insertImageUrl($user->pic); $allowDokuWallet = Efiwebsetting::getData('App_Allow_Doku_Wallet') == 'yes'; if (Generic::IsNullOrEmptyString($user->payment_id) || $user->payment_id == 0) { $results['balance'] = doubleval(0); } else { if ($allowDokuWallet) { $doku = new PaymentDoku(); $results['balance'] = $doku->checkBalance($user->payment_id); } else { $results['balance'] = doubleval(0); } } Generic::finish($results); }
static function simpanHasilGCM($arrhasil, $psn, $array_id, $arrDevs, $isTest = 0) { if ($_GET['test']) { pr($arrhasil); } echo "<h1>Results</h1>"; foreach ($arrhasil as $numw => $hasil) { //simpan hasil $gcm = new GCMResultCaps(); $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->save(); echo "ID : " . $hasil->multicast_id . "<br>"; echo "Success : " . $hasil->success . "<br>"; echo "Failure : " . $hasil->failure . "<br>"; echo "<a target='_blank' href='" . _SPPATH . "PushNotResultsCaps/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 DeviceModelCapsule(); global $db; // $q = "DELETE FROM {$dv->table_name} WHERE device_id = '".$array_id[$page+$num]."'"; $q = "UPDATE {$dv->table_name} SET dev_not_send = 1 WHERE device_id = '" . $array_id[$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; } PushLoggerCaps::savelog($psn->camp_id, $array_id[$page + $num], $arrDevs[$page + $num]->acc_id, $status, $log_text, $hasil->multicast_id); // PushLogger::savelog($psn->camp_id,$array_id[$page+$num],$arrDevs[$page+$num]->acc_id,$status,$log_text,$hasil->multicast_id); } } }
function sync_articletagging() { $token = IMBAuth::createOAuth(); $url = "http://localhost:8888/tbsecom/LLProdWeb/LL_ArticleTagging_wbase?cmd=ws&mws=getall&token=" . $token; // echo $url; // pr($_POST); $contents = file_get_contents($url); // pr($contents); $obj = json_decode($contents); // pr($obj); // $nn = new MProdModel(); // global $db; // $db->query("UPDATE {$nn->table_name} SET prod_active = 0",1); if ($_POST['radio'] == "truncate") { $nn = new MArticleTagging(); $nn->truncate(); } // pr($obj); $num = 0; $gagal = 0; $gagalArr = array(); foreach ($obj->results as $new) { $nn = new MArticleTagging(); $nn->fill(toRow($new)); // $nn->prod_active = 1; if ($nn->save(1)) { $num++; } else { $gagal++; $gagalArr = $new->rel_id; } } $json['success'] = $num; $json['failed'] = $gagal; $json['failed_arr'] = $gagalArr; echo json_encode($json); die; }
public function getCategoriesByResto() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $idRestaurant = Generic::mustCheck($_GET['id_restaurant'], Keys::$ERR_NOT_FOUND_ID_RESTAURANT); $objResto = new MasterRestaurantModel(); $objResto->getByID($idRestaurant); if (!Generic::IsNullOrEmptyString($objResto->id_categories)) { $arrCategories = explode(",", $objResto->id_categories); } else { $arrCategories = array(); } $categories = array(); foreach ($arrCategories as $idCat) { $c = new MasterCategoryModel(); $c->getByID($idCat); if ($c->id_category) { $categories[] = $c->name; } } // pr($arrCategories); // pr($categories); $results['categories'] = $categories; $rawTags = array(); $id_dish = isset($_GET['id_dish']) ? addslashes($_GET['id_dish']) : ""; if ($id_dish) { $dish = new MasterDishModel(); $dish->getByID($id_dish); $tagsIds = explode(",", $dish->dish_tags); if (count($tagsIds) != 0) { foreach ($tagsIds as $tagsId) { if ($tagsId == null || $tagsId == "") { continue; } $dishTag = new MasterDishTagModel(); $dishTag->getByID($tagsId); $b["id_tag"] = $dishTag->id_tag; $b["name"] = $dishTag->name; $rawTags[] = $b; } } } $results['raw_tags'] = $rawTags; Generic::finish($results); }
public static function workWebService($obj, $webClass) { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $mws = $_GET['mws']; if ($mws == "getall") { $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $arr = $obj->getAll(); $json = array(); $json['status_code'] = 1; //filter foreach ($arr as $o) { $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = stripslashes($o->{$attr}); } } $json["results"][] = $sem; } if (count($arr) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; } if ($mws == "getByPage") { $page = addslashes($_GET['page']); if ($page == "" || $page < 1) { $json['status_code'] = 0; $json['status_message'] = "No Page Found"; echo json_encode($json); die; } $limit = addslashes($_GET['limit']); if ($limit == "" || $limit < 1 || $limit > $obj->webservice_read_limit) { $json['status_code'] = 0; $json['status_message'] = "Limit Error"; echo json_encode($json); die; } $begin = ($page - 1) * $limit; //begin $obj->default_read_coloms = $obj->crud_webservice_allowed; //tmbh untuk add photo url $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $arr = $obj->getWhere("{$main_id} != '' LIMIT {$begin},{$limit}"); $json = array(); $json['status_code'] = 1; //filter foreach ($arr as $o) { $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = stripslashes($o->{$attr}); } } $json["results"][] = $sem; } if (count($arr) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; } //tambahan pakai tupel /* * tupel format : nama_colom,value,rule;nama_colom2,value2,rule2 * rule ada : exact, anywhere, start, end */ if ($mws == "getPair") { //begin $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); //tmbh untuk add photo url $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $page = addslashes($_GET['page']); if ($page == "" || $page < 1) { $json['status_code'] = 0; $json['status_message'] = "No Page Found"; echo json_encode($json); die; } $limit = addslashes($_GET['limit']); if ($limit == "" || $limit < 1 || $limit > $obj->webservice_read_limit) { $json['status_code'] = 0; $json['status_message'] = "Limit Error"; echo json_encode($json); die; } $orderby = addslashes($_GET['orderby']); if ($orderby == "") { $orderby_text = " ORDER BY {$main_id} ASC"; } else { $orderby_text = " ORDER BY {$orderby} "; } $search = addslashes($_GET['search']); if ($search != "") { $exp2 = explode(";", $search); //pr($exp2); if (count($exp2) > 0) { foreach ($exp as $field) { //pr($field); foreach ($exp2 as $tupel) { //pr($tupel); $exp3 = explode(",", $tupel); //pecah jadi satuan //pr($exp3); $nama_colom = $exp3[0]; $value = $exp3[1]; $rule = $exp3[2]; if ($nama_colom == $field) { if ($rule == "anywhere") { $snn[] = "({$field} LIKE '%{$value}%')"; } elseif ($rule == "exact") { $snn[] = "({$field} LIKE '{$value}')"; } elseif ($rule == "start") { $snn[] = "({$field} LIKE '{$value}%')"; } elseif ($rule == "end") { $snn[] = "({$field} LIKE '%{$value}')"; } } } } //pr($snn); $where_text = implode(" AND ", $snn); //echo $where_text; } else { //$where_text = "$main_id != ''"; $json['status_code'] = 0; $json['status_message'] = "No Pair Details Found"; echo json_encode($json); die; } } else { //$where_text = "$main_id != ''"; $json['status_code'] = 0; $json['status_message'] = "No Search Details Found"; echo json_encode($json); die; } $begin = ($page - 1) * $limit; //echo "$where_text $orderby_text LIMIT $begin,$limit"; $query = "{$where_text} {$orderby_text} "; $arr = $obj->getWhere($query . " LIMIT {$begin},{$limit}"); $json = array(); $json['status_code'] = 1; $json['results_number'] = $obj->getJumlah($query); //filter foreach ($arr as $o) { $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = stripslashes($o->{$attr}); } } $json["results"][] = $sem; } if (count($arr) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; } if ($mws == "getByPageWhere") { //begin $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); //tmbh untuk add photo url $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $page = addslashes($_GET['page']); if ($page == "" || $page < 1) { $json['status_code'] = 0; $json['status_message'] = "No Page Found"; echo json_encode($json); die; } $limit = addslashes($_GET['limit']); if ($limit == "" || $limit < 1 || $limit > $obj->webservice_read_limit) { $json['status_code'] = 0; $json['status_message'] = "Limit Error"; echo json_encode($json); die; } $orderby = addslashes($_GET['orderby']); if ($orderby == "") { $orderby_text = " ORDER BY {$main_id} ASC"; } else { $orderby_text = " ORDER BY {$orderby} "; } $search = addslashes($_GET['search']); if ($search != "") { foreach ($exp as $field) { $snn[] = "({$field} LIKE '%{$search}%')"; } $where_text = implode(" OR ", $snn); } else { $where_text = "{$main_id} != ''"; } $begin = ($page - 1) * $limit; //echo "$where_text $orderby_text LIMIT $begin,$limit"; $query = "{$where_text} {$orderby_text} "; $arr = $obj->getWhere($query . " LIMIT {$begin},{$limit}"); $json = array(); $json['status_code'] = 1; $json['results_number'] = $obj->getJumlah($query); //filter foreach ($arr as $o) { $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = stripslashes($o->{$attr}); } } $json["results"][] = $sem; } if (count($arr) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; } if ($mws == "getbyid") { $id = addslashes($_GET['id']); if ($id == "" || $id < 1) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } //tmbh untuk add photo url $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $obj->getById($id); $json = array(); $json['status_code'] = 1; //filter $sem = array(); foreach ($exp as $attr) { //if(updates) $updates = addslashes($_GET['updates']); if ($updates) { if ($_POST[$attr] != "") { if (in_array($attr, $obj->crud_webservice_images)) { $picname = self::savePic($_POST[$attr]); $_POST[$attr] = $picname; // if($_GET['ios'] == "1") { // $_POST[$attr] = $_POST[$attr]; // } } $obj->{$attr} = $_POST[$attr]; } } if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $obj->{$attr}; } else { $sem[$attr] = stripslashes($obj->{$attr}); } } if ($updates) { $obj->load = 1; $succ = $obj->save(); if ($succ) { $json['status_code'] = 1; } else { $json['status_code'] = 0; } } $json["results"] = $sem; if ($obj->{$main_id} < 1 || $obj->{$main_id} == "") { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; } if ($mws == "addnew") { //tmbh untuk add photo url $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", str_replace(" ", "", $obj->crud_webservice_allowed)); $json = array(); $json['status_code'] = 1; //filter $sem = array(); $onlyUpdates = array(); foreach ($exp as $attr) { //if(updates) $updates = addslashes($_GET['updates']); if ($updates) { if ($_POST[$attr] != "") { if (in_array($attr, $obj->crud_webservice_images)) { $picname = self::savePic($_POST[$attr]); $_POST[$attr] = $picname; } $obj->{$attr} = $_POST[$attr]; $onlyUpdates[$attr] = $obj->{$attr}; } } $sem[$attr] = $obj->{$attr}; } if ($updates) { //diberi constraints $json['err'] = $obj->constraints(); if (count($json['err']) > 0) { $json['status_code'] = 0; } else { if ($_POST[$main_id] != "") { // $objsem = $obj; $obj->getById($_POST[$main_id]); $obj->fill($onlyUpdates); $obj->load = 1; $obj->save(); $id = $_POST[$main_id]; } else { $id = $obj->save(); } if (!$id) { $json['err'] = array("all" => Lang::t('save failed')); } } } //load $obj->getById($id); //pr($obj); //di isi ke sem foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = $obj->{$attr}; } } //$sem[$main_id] = $id; $json["results"] = $sem; if ($obj->{$main_id} < 1 || $obj->{$main_id} == "") { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; } if ($mws == "dodelete") { $id = addslashes($_GET['id']); if ($id == "" || $id < 1) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $updates = addslashes($_POST['updates']); if ($updates) { $succ = $obj->delete($id); if ($succ) { $json['status_code'] = 1; $json['status_message'] = "Success"; } else { $json['status_code'] = 0; $json['status_message'] = "Delete Error"; } } else { $json['status_code'] = 0; $json['status_message'] = "No Update Found"; } echo json_encode($json); die; } }
static function sendUsingAccountArray($arrAcc, $psn, $isTest = 0) { if ($_GET['test']) { pr($arrAcc); } if ($_GET['test']) { echo "<h1>Push Complete Results</h1>"; } foreach ($arrAcc as $to) { $dev = new DeviceModel(); // $arrD = $dev->getWhere("acc_id = '$to' AND device_type = 'android' ORDER BY logindate DESC"); //kalau dijaddin ga aktif 16 dec 2015 // $arrD = $dev->getWhere("acc_id = '$to' ORDER BY logindate DESC"); $arrD = $dev->getWhere("acc_id = '{$to}' AND dev_active = 1 ORDER BY logindate DESC"); // $json['arrD'] = $arrD; // foreach ($arrD as $d) { // $json['dev'] = $d->device_id; //// if($d->device_id == "")continue; // $hasil = self::push($d->device_id, $msg, $website); // $json['hasil'] = $hasil; // if ($hasil->success > 0) { // $json['bool'] = 1; //// $json['hasil'] = $hasil; // } // } if (count($arrD) > 0) { foreach ($arrD as $ddd) { $devices[] = $ddd; } } else { if ($_GET['test']) { echo "no device id : " . $to . " <br>"; } } } $action = self::getAction($psn); if ($_GET['test']) { echo "action = " . $action . "<br>"; } $array_id = array(); if ($_GET['test']) { echo "<h3>Devices</h3>"; } foreach ($devices 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 = Efiwebsetting::getData('PUBLIC_IP') . "WebViewer/messages/" . $psn->camp_id; //penambahan atas permintaan tbs 10 sept 2015, bisa push url if ($psn->camp_url != "") { $url2push = $psn->camp_url; } /* * * PILIHAN antara server luar dan dalam * 27 Nov 2015 * */ $pss = new Pusher(); if ($pss->pakai_server_luar == '1') { $app_id = 1; $app_key = "1qay2wsx"; $push_api_url = "http://push.indomegabyte.com/PushAPI/doPushByDevID"; $devs = implode(",", $array_id); $fields = array('devs' => $devs, 'app_id' => $app_id, 'key' => $app_key, 'camp_id' => $psn->camp_id, 'camp_name' => $psn->camp_name, 'camp_title' => $psn->camp_title, 'camp_url' => $url2push, 'isTest' => $isTest); $headers = array('Content-Type: application/json'); // pr($fields); //"postvar1=value1&postvar2=value2&postvar3=value3" foreach ($fields as $k => $val) { $jadi[] = $k . "=" . $val; } $imp = implode("&", $jadi); // echo http_build_query($fields); // $ch = curl_init(); // curl_setopt($ch, CURLOPT_URL, $push_api_url); // curl_setopt($ch, CURLOPT_POST, true); // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt($ch, CURLOPT_POSTFIELDS, $imp); // $result = json_decode(curl_exec($ch)); // curl_close($ch); // // pr($result); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $push_api_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields)); // in real life you should use something like: // curl_setopt($ch, CURLOPT_POSTFIELDS, // http_build_query(array('postvar1' => 'value1'))); // receive server response ... curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); curl_close($ch); // pr($server_output); $ress = json_decode($server_output); if (!isset($_POST['no_echo'])) { echo "<h1>" . $ress->status_message . " Status Code [" . $ress->status_code . "]</h1>"; } $arrhasil = $ress->result; // pr($arrhasil); } elseif ($pss->pakai_server_luar == '2') { //create temporary files to read from $myfile = fopen(_PHOTOPATH . "campaign.txt", "w") or die("Unable to create file!"); $txt = implode(",", $array_id); if (fwrite($myfile, $txt)) { fclose($myfile); $app_id = 1; $app_key = "1qay2wsx"; $push_api_url = "http://push.indomegabyte.com/PushAPI/doPushByDevIDwithFile"; // $push_api_url = "http://localhost:8888/push/PushAPI/doPushByDevIDwithFile"; $devs = Efiwebsetting::getData('PUBLIC_IP') . "uploads/campaign.txt"; // pr($devs); // pr($push_api_url); $fields = array('devs' => $devs, 'app_id' => $app_id, 'key' => $app_key, 'camp_id' => $psn->camp_id, 'camp_name' => $psn->camp_name, 'camp_title' => $psn->camp_title, 'camp_url' => $url2push, 'isTest' => $isTest); $headers = array('Content-Type: application/json'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $push_api_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); curl_close($ch); $ress = json_decode($server_output); if (!isset($_POST['no_echo'])) { echo "<h1>" . $ress->status_message . " Status Code [" . $ress->status_code . "]</h1>"; } $arrhasil = $ress->result; // pr($fields); // pr($arrhasil); // pr($server_output); } else { die("Unable to write"); } } else { //after we collected the device ids in an array, kita push $arrhasil = self::push($array_id, $psn->camp_title, $url2push, $action); } if ($_GET['test']) { pr($arrhasil); } if (!isset($_POST['no_echo'])) { echo "<h1>Results</h1>"; } 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->save(); if (!isset($_POST['no_echo'])) { 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; $q = "DELETE FROM {$dv->table_name} WHERE device_id = '" . $array_id[$page + $num] . "'"; $q = "UPDATE {$dv->table_name} SET dev_active = 0 WHERE device_id = '" . $array_id[$page + $num] . "'"; //coba test.. // echo $q; $del = $db->query($q, 0); if ($_GET['test']) { echo "<br>query : " . $q . "<br>"; echo "delete succ :" . $del; echo "<br>"; } } else { //success $status = 1; $log_text = $res->message_id; } PushLogger::savelog($psn->camp_id, $array_id[$num], $devices[$num]->acc_id, $status, $log_text, $hasil->multicast_id); //disini save camp_id ke device_id dan date //pakai PushLogger Bisa !!! 11 January 2016 } } // foreach($hasil->results as $ // foreach($devices as $dev) { // PushLogger::savelog($psn->camp_id,) // } // echo json_encode($json); // die(); }
} return $this; } }(jQuery)); // $('.wrapper').hide(); </script> <div id="allprod" style="display: none; overflow: auto; background-color: #FFFFFF; position: fixed; z-index: 100000; top:0px; left: 0px; width: 100%; height: 100%;"> <div style="cursor:pointer;float: right; width: 20px; height: 20px;" onclick="$('.wrapper').show();$('#allprod').hide();">x</div> <?php $action = "2"; if ($action == "1") { $token = IMBAuth::createOAuth(); $url = "http://localhost:8888/tbsecom/LLProdWeb/getItems?token=" . $token; $contents = file_get_contents($url); $obj = json_decode($contents); $arrN = $obj->results; foreach ($arrN as $ss) { if (!in_array($ss->VariantID, $sudah)) { $sudah[] = $ss->VariantID; $sem[$ss->VariantID] = $ss; } else { $sem[$ss->VariantID]->TaggingLevel3ID .= " " . $ss->TaggingLevel3ID; } } \Leap\View\InputConditionTBS::printer($sem); } if ($action == "2") {
public function sendAgentForm() { //ktp image //npwp image *optional //bank_name //account_nr //account_name //branch_name IMBAuth::checkOAuth(); AppearForm::processAgent("app"); }
public function searchDish() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $resto = "resto"; $json = array(); $json['status_code'] = 1; $search = isset($_GET['name']) ? addslashes($_GET['name']) : ""; $lat = isset($_GET['latitude']) ? addslashes($_GET['latitude']) : ""; if ($lat == "" or !$lat) { $lat = MenuRevoConstants::$latitude; } if (!Generic::checkLatitude($lat)) { Generic::errorMsg("Latitude must be Numeric!"); } $long = isset($_GET['longitude']) ? addslashes($_GET['longitude']) : ""; if ($long == "" or !$long) { $long = MenuRevoConstants::$longitude; } if (!Generic::checklongitude($long)) { Generic::errorMsg("Longitude must be Numeric!"); } $nearby = isset($_GET['nearby']) ? addslashes($_GET['nearby']) : 20; if ($nearby == '1') { $nearby = 20; } else { $nearby = 100000; } $arrSort['distance'] = 1; $nearby = " HAVING distance < " . $nearby; $favorite = isset($_GET['fav']) ? addslashes($_GET['fav']) : "0"; if ($favorite == '1') { $arrSort['fav'] = $favorite; } $houropen = isset($_GET['houropen']) ? addslashes($_GET['houropen']) : "0"; if ($houropen == '1') { $whereOption = " CONVERT_TZ(NOW(),@@session.time_zone, '+00:00') >= (CONVERT_TZ(concat(CURRENT_DATE,' ',resto.time_open),@@session.time_zone, '+00:00' )) AND CONVERT_TZ(NOW(),@@session.time_zone, '+00:00') < (CONVERT_TZ(concat(CURRENT_DATE,' ',resto.time_close),@@session.time_zone, '+00:00' ))"; } $cuisine = isset($_GET['id_cuisine']) ? addslashes($_GET['id_cuisine']) : "None"; if (Cuisine::checkCuisineID($cuisine) != 0) { $arrWhere['id_cuisine'] = $cuisine; } $restotype = isset($_GET['id_restotype']) ? addslashes($_GET['id_restotype']) : "None"; if (MasterRestaurantType::isRestoTypeByIDAvailable($restotype) != 0) { $arrWhere['restaurant_type'] = $restotype; } $disc_mr = isset($_GET['disc_mr']) ? addslashes($_GET['disc_mr']) : "None"; if ($disc_mr == 1) { $arrWhereOr['disc_mr'] = $disc_mr; } $disc_cc = isset($_GET['disc_cc']) ? addslashes($_GET['disc_cc']) : "None"; if ($disc_cc == 1) { $arrWhereOr['disc_cc'] = $disc_cc; } $disc_resto = isset($_GET['disc_resto']) ? addslashes($_GET['disc_resto']) : "None"; if ($disc_resto == 1) { $arrWhereOr['disc_resto'] = $disc_resto; } $where = " WHERE dish.name LIKE '%{$search}%' "; if ($whereOption != "") { $where = $where . " AND " . $whereOption; } foreach ($arrWhere as $key => $val) { $where = $where . " AND {$resto}" . ".{$key}= '{$val}'"; } foreach ($arrWhereOr as $key => $val) { $where = $where . " AND {$resto}" . ".{$key} != '0'"; } $sort = $nearby . " ORDER BY "; foreach ($arrSort as $key => $val) { if ($key == "distance") { $sort = $sort . " {$key} ASC,"; } elseif ($key == "fav") { $sort = $sort . " {$resto}" . ".{$key} DESC,"; } elseif ($key == "houropen") { $sort = $sort . " {$resto}" . ".{$key} ASC,"; } } $sort = substr($sort, 0, -1); $page = addslashes($_GET['page']); if ($page == "" || $page < 1) { $json['status_code'] = 0; $json['status_message'] = "No Page Found"; echo json_encode($json); die; } $limit = addslashes($_GET['limit']); if ($limit == "" || $limit < 1) { $json['status_code'] = 0; $json['status_message'] = "Limit Error"; echo json_encode($json); die; } $begin = ($page - 1) * $limit; global $db; $objRestaurant = new MasterRestaurantModel(); $objDish = new MasterDishModel(); $qdish = "SELECT dish.*, resto.name as nama_restaurant, SQRT(POW(69.1 * (resto.latitude - {$lat}), 2) + POW(69.1 * ({$long} - resto.longitude) * COS(resto.latitude / 57.3), 2)) AS distance" . " FROM {$objDish->table_name} dish LEFT JOIN {$objRestaurant->table_name} resto ON dish.id_restaurant=resto.id_restaurant " . $where . $sort . " LIMIT {$begin},{$limit}"; // echo $qdish. "<br>"; $arrDish = $db->query($qdish, 2); if (count($arrDish) == 0) { Generic::errorMsg("No Food found!"); } $arrDishHelp = array(); foreach ($arrDish as $dish) { $dishhlp = MasterDish::getDish($dish->id_dish); $dishhlp['distance'] = $dish->distance; $dishhlp['nama_restaurant'] = $dish->nama_restaurant; $arrDishHelp[] = $dishhlp; } // // // $qResto = "SELECT *, SQRT(POW(69.1 * (latitude - $lat), 2) + POW(69.1 * ($long - longitude) * COS(latitude / 57.3), 2)) AS distance FROM {$objRestaurant->table_name} " . $where . $sort ; //// echo $qResto; // $arrResto = $db->query($qResto, 2); // $checkCountResto = false; // $arrDishHelp = array(); // foreach ($arrResto as $restoID) { // // $arrSearchDish = $objDish->getWhere("name LIKE '%$search%' AND availability='1' AND id_restaurant='$restoID->id_restaurant' LIMIT $begin,$limit"); // // if (count($arrSearchDish) > 0) { // $checkCountResto = true; // $jarak = $restoID->distance; // // foreach ($arrSearchDish as $dish) { // $dish = MasterDish::getDish($dish->id_dish); // $dish['distance'] = $jarak; // $dish['nama_restaurant'] = MasterRestaurant::getRestoNameByIDResto($dish['id_restaurant']); // $arrDishHelp[] = $dish; // } // // } // // } // // if (!$checkCountResto) { // Generic::errorMsg("No Food found!"); // } $json['results']['Dish'] = $arrDishHelp; echo json_encode($json); die; }
public function overwriteRead($return) { $return = parent::overwriteRead($return); $oauth = IMBAuth::createOAuth(); $objs = $return['objs']; foreach ($objs as $obj) { $obj->removeAutoCrudClick = array("Action"); // if (isset($obj->carousel_photo)) { // $obj->carousel_photo = \Leap\View\InputFoto::getAndMakeFoto($obj->carousel_photo, "car_image_" . $obj->carousel_id); // } // if (isset($obj->camp_active)) { $obj->camp_active = $this->arrayYesNO[$obj->camp_active]; } if (isset($obj->camp_status)) { $obj->camp_status = $this->arrStatus[$obj->camp_status]; } $obj->Action = "<a class='btn btn-default' href='" . _SPPATH . "PushNotResultsCaps/res?id=" . $obj->camp_id . "&token={$oauth}' target='_blank'>Results</a>\n <a class='btn btn-default' href='" . _SPPATH . "PushNotResultsCaps/test?id=" . $obj->camp_id . "&token={$oauth}' target='_blank'>Test</a>"; } return $return; }
public function get() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json['status_code'] = 1; $macc_id = addslashes($_GET['macc_id']); if (!$macc_id) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $llTesti = new LL_Wishlist(); $arrW = $llTesti->getWhereFromMultipleTable("wl_acc_id = '{$macc_id}' AND wl_articlenr = VariantID ORDER BY VariantNameINA ASC", array("LL_Article_WImage")); //pr($arrW); $llacc = new LL_Article_WImage(); //$llacc->VariantID $exp2 = explode(",", $llacc->crud_webservice_allowed); $arrPicsToAddPhotoUrl2 = $llacc->crud_add_photourl; $obj = $llTesti; $obj->default_read_coloms = $obj->crud_webservice_allowed; $main_id = $obj->main_id; $exp = explode(",", $obj->crud_webservice_allowed); $arrPicsToAddPhotoUrl = $obj->crud_add_photourl; $json = array(); $json['status_code'] = 1; //$json['results_number'] = $obj->getJumlah($query); // $sudah = array(); //filter foreach ($arrW as $o) { if (in_array($o->VariantID, $sudah)) { continue; } $sudah[] = $o->VariantID; $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = $o->{$attr}; } } foreach ($exp2 as $attr) { //if($attr == "macc_ll_customer_id")break; if (in_array($attr, $arrPicsToAddPhotoUrl2)) { $sem[$attr] = _PHOTOURL . $o->{$attr}; } else { $sem[$attr] = $o->{$attr}; } } //wImage //kalau base if ($o->ArticleType == 'Base') { $sem['base'] = $sem; } else { $arrID = $o->BaseArticleID; $arr2 = $llacc->getWhere("BaseArticleID = '{$arrID}' AND ArticleType = 'Base' LIMIT 0,1"); $base = $arr2[0]; $sem2 = array(); foreach ($exp2 as $attr2) { $sem2[$attr2] = $base->{$attr2}; } $sem['base'] = $sem2; } $json["results"][] = $sem; } if (count($arrW) < 1) { $json['status_code'] = 0; $json['status_message'] = "No Details Found"; } echo json_encode($json); die; }