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; } }