Beispiel #1
0
 public function filter_dashboard_dates()
 {
     $data = $_POST;
     $dash = new Dashboard();
     $resp = new ajax_response($data['action'], true);
     if ($data['dashboard_date_count'] != '') {
         $resp->set_status(true);
         $resp->set_data(array('dashboard_dates' => $dash->get_dashboard_data((int) $data['dashboard_date_count'])));
     }
     echo $resp->encode_response();
     die;
 }
Beispiel #2
0
 public function update_rates()
 {
     $data = $_POST;
     $resp = new ajax_response($data['action'], true);
     if ($data['hotel_id'] != null) {
         $hotel = new Hotel((int) $data['hotel_id']);
         if ($hotel instanceof Hotel) {
             $result = $hotel->save_rate_data($data);
             $result ? $resp->set_status(true) : '';
         }
     }
     echo $resp->encode_response();
     die;
 }
 public function user_register()
 {
     global $wpdb;
     $data = $_POST;
     $login_data = array();
     $resp = new ajax_response($data['action'], true);
     $code_data = $wpdb->get_results('SELECT * FROM ' . $wpdb->register_codes . ' WHERE 1=1 AND register_code == ' . $wpdb->escape($data['sec_code']));
     if ($code_data->register_code_used == 0) {
         $username = $wpdb->escape($data['user_name']);
         $exists = username_exists($username);
         if (!$exists) {
             $user_id = wp_create_user($username, wp_generate_password($length = 12, $include_standard_special_chars = false), $username);
             wp_new_user_notification($user_id, null, true);
             if (!is_wp_error($user_id)) {
                 $user = get_user_by('id', $user_id);
                 $wpdb->update($wpdb->register_codes, array('register_code_used' => 1, 'register_code_used_by' => $user->data->user_login), array('register_code' => $wpdb->escape($data['sec_code'])));
                 $resp->set_status(true);
                 $resp->set_message($user->data->user_login . ' is successfully registered. Please switch to the login tab to login.');
             } else {
                 foreach ($user_id->errors as $k => $error) {
                     $resp->set_message(array($error[0]));
                 }
             }
         } else {
             $resp->set_message('User already exists. Please use a different email address.');
         }
     } else {
         $resp->set_message('Security token not recognized. Could not register you without a valid security token.');
     }
     echo $resp->encode_response();
     die;
 }
Beispiel #4
0
 public function load_hotels_async()
 {
     $data = $_POST;
     $hotel = new Hotel();
     $resp = new ajax_response($data['action'], true);
     $resp->set_status(true);
     $resp->set_data(array('loadable_content' => $hotel->get_all_hotels($args)));
     echo $resp->encode_response();
     die;
 }
 public function delete_reservation()
 {
     $data = $_POST;
     $resp = new ajax_response($data['action']);
     check_ajax_referer('delete_reservation');
     echo $resp->encode_response();
     die;
 }