function pushnot()
 {
     echo "Searching for campaign ...<br><br>";
     $mode = addslashes($_GET['mode']);
     $hour = " AND camp_hour = " . date("G");
     if ($mode == "all") {
         $hour = "";
         echo "getting all campaign for today..<br><br>";
     } else {
         echo "getting campaign for " . date("G") . " o'clock.. <br><br>";
     }
     $psn = new PushNotCamp();
     //echo "camp_start = CURDATE() AND camp_active = 1 AND camp_status = 0 $hour";
     $arrPSN = $psn->getWhere("camp_start = CURDATE() AND camp_active = 1 AND camp_status = 0 {$hour}");
     //        pr($arrPSN);
     //action
     $action = addslashes($_GET['act']);
     if ($action == "push") {
         if (count($arrPSN) > 0) {
             //translate psn
             foreach ($arrPSN as $psn) {
                 self::kerjakan($psn);
                 $psn->camp_status = 1;
                 $psn->load = 1;
                 //TBD uncomment line dibawah kalau production
                 $psn->save();
                 echo "<hr>";
             }
         } else {
             echo "no campaign was found ..<br><br>";
         }
     } else {
         echo "no action is defined <br><br>";
     }
 }
 public function getMyPushes()
 {
     IMBAuth::checkOAuth();
     $acc_id = addslashes($_POST['acc_id']);
     $user_token = addslashes($_POST['user_token']);
     $acc = new Account();
     $acc->getByID($acc_id);
     //        echo md5($acc->admin_email.$acc->admin_password);
     if (md5($acc->admin_email . $acc->admin_password) != $user_token) {
         $json['status_code'] = 0;
         $json['status_message'] = "Token Mismatched";
         echo json_encode($json);
         die;
     }
     $push = new PushNotCamp();
     $arrPush = $push->getWhere("camp_client_id = '{$acc_id}' AND camp_status = 0 ORDER BY camp_start ASC,camp_hour ASC");
     if (count($arrPush) > 0) {
         foreach ($arrPush as $pus) {
             $rr = array();
             $rr['push_title'] = $pus->camp_name;
             $rr['push_msg'] = $pus->camp_msg;
             $rr['push_img'] = $pus->camp_img;
             $rr['push_url'] = $pus->camp_url;
             $rr['push_date'] = $pus->camp_start;
             $rr['push_time'] = $pus->camp_hour;
             $rr['push_id'] = $pus->camp_id;
             $json['pushes'][] = $rr;
         }
         $json['status_code'] = 1;
         $json['status_message'] = "Success";
         echo json_encode($json);
         die;
     } else {
         $json['status_code'] = 1;
         $json['status_message'] = "No Push Found";
         echo json_encode($json);
         die;
     }
 }