Booking Calendar - Version 4.1.6

Version Description

  • Security and maintenance fix. Its important to update your version to this update.
Download this release

Release Info

Developer wpdevelop
Plugin Icon 128x128 Booking Calendar
Version 4.1.6
Comparing to
See all releases

Code changes from version 4.1.5 to 4.1.6

css/client.css CHANGED
@@ -462,4 +462,36 @@ td.timespartly.check_in_time div{
462
  td.timespartly.check_out_time div{
463
  border-right-color: #778899;
464
  }
465
- /* End Check In/Out Times styles */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  td.timespartly.check_out_time div{
463
  border-right-color: #778899;
464
  }
465
+ /* End Check In/Out Times styles */
466
+
467
+ .wpdevbk .alert {
468
+ background-color: #FCF8E3;
469
+ border: 1px solid #FBEED5;
470
+ border-radius: 4px 4px 4px 4px;
471
+ margin-bottom: 18px;
472
+ padding: 8px 35px 8px 14px;
473
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
474
+ }
475
+ .wpdevbk .alert, .wpdevbk .alert-heading {
476
+ color: #C09853;
477
+ }
478
+ .wpdevbk .alert .close {
479
+ line-height: 18px;
480
+ position: relative;
481
+ right: -21px;
482
+ top: -2px;
483
+ }
484
+ .wpdevbk .alert-success {
485
+ background-color: #DFF0D8;
486
+ border-color: #D6E9C6;
487
+ }
488
+ .wpdevbk .alert-success, .wpdevbk .alert-success .alert-heading {
489
+ color: #468847;
490
+ }
491
+ .wpdevbk .alert-danger, .wpdevbk .alert-error {
492
+ background-color: #F2DEDE;
493
+ border-color: #EED3D7;
494
+ }
495
+ .wpdevbk .alert-danger, .wpdevbk .alert-error, .wpdevbk .alert-danger .alert-heading, .wpdevbk .alert-error .alert-heading {
496
+ color: #B94A48;
497
+ }
js/wpdev.bk.js CHANGED
@@ -1,1090 +1,1068 @@
1
- var is_booking_without_payment = false;
2
- var date_approved = [];
3
- var date2approve = [];
4
- var date_admin_blank = [];
5
- var dates_additional_info = [];
6
- var is_all_days_available = [];
7
- var avalaibility_filters = [];
8
- var is_show_cost_in_tooltips = false;
9
- var is_show_availability_in_tooltips = false;
10
- var global_avalaibility_times = [];
11
- var wpdev_bk_calendarViewMode = '';
12
- var numbb = 0;
13
- var is_use_visitors_number_for_availability ;
14
- var timeoutID_of_thank_you_page = null;
15
-
16
- // Initialisation
17
- function init_datepick_cal(bk_type, date_approved_par, my_num_month, start_day_of_week, start_bk_month ){
18
-
19
- if ( jQuery('#calendar_booking'+ bk_type).hasClass('hasDatepick') == true ) { // If the calendar with the same Booking resource is activated already, then exist.
20
- return false;
21
- }
22
-
23
- var cl = document.getElementById('calendar_booking'+ bk_type);if (cl == null) return; // Get calendar instance and exit if its not exist
24
-
25
- date_approved[ bk_type ] = date_approved_par;
26
-
27
- function click_on_cal_td(){
28
- if(typeof( selectDayPro ) == 'function') {selectDayPro( bk_type);}
29
- }
30
-
31
- function selectDay(date) {
32
-
33
- if(typeof( selectDayPro_rangeSelection ) == 'function') { // Check if this minimum BS version, and then proced
34
- jQuery('.datepick-days-cell' ).popover('hide');
35
- }
36
- jQuery('#date_booking' + bk_type).val(date);
37
- if(typeof( selectDayPro ) == 'function') {selectDayPro( date, bk_type);}
38
- }
39
-
40
- function hoverDay(value, date){
41
-
42
- if(typeof( hoverDayTime ) == 'function') {hoverDayTime(value, date, bk_type);}
43
-
44
- if ( (location.href.indexOf('admin.php?page=booking/wpdev-booking.phpwpdev-booking')==-1) ||
45
- (location.href.indexOf('admin.php?page=booking/wpdev-booking.phpwpdev-booking-reservation')>0) )
46
- { // Do not show it (range) at the main admin page
47
- if(typeof( hoverDayPro ) == 'function') {hoverDayPro(value, date, bk_type);}
48
- }
49
- //if(typeof( hoverAdminDay ) == 'function') { hoverAdminDay(value, date, bk_type); }
50
- }
51
-
52
- function applyCSStoDays(date ){
53
- var class_day = (date.getMonth()+1) + '-' + date.getDate() + '-' + date.getFullYear();
54
- var additional_class = ' ';
55
-
56
- if(typeof( prices_per_day ) !== 'undefined')
57
- if(typeof( prices_per_day[bk_type] ) !== 'undefined')
58
- if(typeof( prices_per_day[bk_type][class_day] ) !== 'undefined') {
59
- additional_class += ' rate_'+prices_per_day[bk_type][class_day];
60
- }
61
-
62
-
63
- var my_test_date = new Date(); //Anxo customizarion
64
- my_test_date.setFullYear(wpdev_bk_today[0],(wpdev_bk_today[1]-1), wpdev_bk_today[2] ,0,0,0); //Get today //Anxo customizarion
65
- if ( (days_between( date, my_test_date)+1) < block_some_dates_from_today ) return [false, 'cal4date-' + class_day +' date_user_unavailable']; //Anxo customizarion
66
- /**/
67
- if (typeof( is_this_day_available ) == 'function') {
68
- var is_day_available = is_this_day_available( date, bk_type);
69
- if (! is_day_available) {return [false, 'cal4date-' + class_day +' date_user_unavailable'];}
70
- }
71
-
72
- // Time availability
73
- if (typeof( check_global_time_availability ) == 'function') {check_global_time_availability( date, bk_type );}
74
-
75
-
76
- // Check availability per day for H.E.
77
- var reserved_days_count = 1;
78
- if(typeof(availability_per_day) !== 'undefined')
79
- if(typeof(availability_per_day[ bk_type ]) !== 'undefined')
80
- if(typeof(availability_per_day[ bk_type ][ class_day ]) !== 'undefined') {
81
- reserved_days_count = parseInt( availability_per_day[ bk_type ][ class_day ] );}
82
-
83
- // we have 0 available at this day - Only for resources, which have childs
84
- if ( wpdev_in_array( parent_booking_resources, bk_type ) )
85
- if (reserved_days_count <= 0) {
86
- if(typeof(date2approve[ bk_type ]) !== 'undefined')
87
- if(typeof(date2approve[ bk_type ][ class_day ]) !== 'undefined')
88
- return [false, 'cal4date-' + class_day +' date2approve date_unavailable_for_all_childs ' + blank_admin_class_day];
89
- return [false, 'cal4date-' + class_day +' date_approved date_unavailable_for_all_childs ' + blank_admin_class_day];
90
- }
91
-
92
- //var class_day_previos = (date.getMonth()+1) + '-' + (date.getDate()-1) + '-' + date.getFullYear();
93
- var blank_admin_class_day = '';
94
- if(typeof(date_admin_blank[ bk_type ]) !== 'undefined')
95
- if(typeof(date_admin_blank[ bk_type ][ class_day ]) !== 'undefined') {
96
- blank_admin_class_day = ' date_admin_blank ';
97
- }
98
- var th=0;
99
- var tm=0;
100
- var ts=0;
101
- var time_return_value = false;
102
- // Select dates which need to approve, its exist only in Admin
103
- if(typeof(date2approve[ bk_type ]) !== 'undefined')
104
- if(typeof(date2approve[ bk_type ][ class_day ]) !== 'undefined') {
105
-
106
- for (var ia=0;ia<date2approve[ bk_type ][ class_day ].length;ia++) {
107
-
108
-
109
- th = date2approve[ bk_type ][ class_day ][ia][3];
110
- tm = date2approve[ bk_type ][ class_day ][ia][4];
111
- ts = date2approve[ bk_type ][ class_day ][ia][5];
112
- if ( ( th == 0 ) && ( tm == 0 ) && ( ts == 0 ) )
113
- return [false, 'cal4date-' + class_day +' date2approve' + blank_admin_class_day]; // Orange
114
- else {
115
- if ( is_booking_used_check_in_out_time === true ) {
116
- if (ts == '1') additional_class += ' check_in_time';
117
- if (ts == '2') additional_class += ' check_out_time';
118
- }
119
- time_return_value = [true, 'cal4date-' + class_day +' date2approve timespartly' + additional_class]; // Times
120
- if(typeof( isDayFullByTime ) == 'function') {
121
- if ( isDayFullByTime(bk_type, class_day ) ) return [false, 'cal4date-' + class_day +' date2approve' + blank_admin_class_day]; // Orange
122
- }
123
- }
124
-
125
- }
126
-
127
- }
128
-
129
- //select Approved dates
130
- if(typeof(date_approved[ bk_type ]) !== 'undefined')
131
- if(typeof(date_approved[ bk_type ][ class_day ]) !== 'undefined') {
132
-
133
- for (var ia=0;ia<date_approved[ bk_type ][ class_day ].length;ia++) {
134
-
135
- th = date_approved[ bk_type ][ class_day ][ia][3];
136
- tm = date_approved[ bk_type ][ class_day ][ia][4];
137
- ts = date_approved[ bk_type ][ class_day ][ia][5];
138
- if ( ( th == 0 ) && ( tm == 0 ) && ( ts == 0 ) )
139
- return [false, 'cal4date-' + class_day +' date_approved' + blank_admin_class_day]; //Blue or Grey in client
140
- else {
141
- if ( is_booking_used_check_in_out_time === true ) {
142
- if (ts == '1') additional_class += ' check_in_time';
143
- if (ts == '2') additional_class += ' check_out_time';
144
- }
145
- time_return_value = [true, 'cal4date-' + class_day +' date_approved timespartly' + additional_class]; // Times
146
- if(typeof( isDayFullByTime ) == 'function') {
147
- if ( isDayFullByTime(bk_type, class_day ) ) return [false, 'cal4date-' + class_day +' date_approved' + blank_admin_class_day]; // Blue or Grey in client
148
- }
149
- }
150
-
151
- }
152
- }
153
-
154
-
155
- for (var i=0; i<user_unavilable_days.length;i++) {
156
- if (date.getDay()==user_unavilable_days[i]) return [false, 'cal4date-' + class_day +' date_user_unavailable' ];
157
- }
158
-
159
- var is_datepick_unselectable = '';
160
- var is_calendar_booking_unselectable= jQuery('#calendar_booking_unselectable' + bk_type);
161
- if (is_calendar_booking_unselectable.length != 0 ) {
162
- is_datepick_unselectable = 'datepick-unselectable'; // //datepick-unselectable
163
- }
164
-
165
- if ( time_return_value !== false ) return time_return_value;
166
- else return [true, 'cal4date-' + class_day +' reserved_days_count' + reserved_days_count + ' ' + is_datepick_unselectable + additional_class+ ' '];
167
- }
168
-
169
- function changeMonthYear(year, month){
170
- if(typeof( selectDayPro_rangeSelection ) == 'function') { // Check if this minimum BS version, and then proced
171
- if(typeof( prepare_tooltip ) == 'function') {
172
- setTimeout("prepare_tooltip("+bk_type+");",1000);
173
- }
174
- }
175
- if(typeof( prepare_highlight ) == 'function') {
176
- setTimeout("prepare_highlight();",1000);
177
- }
178
- }
179
- // Configure and show calendar
180
- jQuery('#calendar_booking'+ bk_type).text('');
181
- jQuery('#calendar_booking'+ bk_type).datepick(
182
- {beforeShowDay: applyCSStoDays,
183
- onSelect: selectDay,
184
- onHover:hoverDay,
185
- onChangeMonthYear:changeMonthYear,
186
- showOn: 'both',
187
- multiSelect: multiple_day_selections,
188
- numberOfMonths: my_num_month,
189
- stepMonths: 1,
190
- prevText: '<<',
191
- nextText: '>>',
192
- dateFormat: 'dd.mm.yy',
193
- changeMonth: false,
194
- changeYear: false,
195
- minDate: 0, maxDate: booking_max_monthes_in_calendar, //'1Y',
196
- showStatus: false,
197
- multiSeparator: ', ',
198
- closeAtTop: false,
199
- firstDay:start_day_of_week,
200
- gotoCurrent: false,
201
- hideIfNoPrevNext:true,
202
- rangeSelect:wpdev_bk_is_dynamic_range_selection,
203
- calendarViewMode:wpdev_bk_calendarViewMode,
204
- useThemeRoller :false // ui-cupertino.datepick.css
205
- }
206
- );
207
-
208
-
209
- if ( start_bk_month != false ) {
210
- var inst = jQuery.datepick._getInst(document.getElementById('calendar_booking'+bk_type));
211
- inst.cursorDate = new Date();
212
- inst.cursorDate.setFullYear( start_bk_month[0], (start_bk_month[1]-1) , 1 );
213
- inst.drawMonth = inst.cursorDate.getMonth();
214
- inst.drawYear = inst.cursorDate.getFullYear();
215
-
216
- jQuery.datepick._notifyChange(inst);
217
- jQuery.datepick._adjustInstDate(inst);
218
- jQuery.datepick._showDate(inst);
219
- jQuery.datepick._updateDatepick(inst);
220
- }
221
-
222
-
223
-
224
-
225
- //jQuery('td.datepick-days-cell').bind('click', 'selectDayPro');
226
- if(typeof( selectDayPro_rangeSelection ) == 'function') { // Check if this minimum BS version, and then proced
227
- if(typeof( prepare_tooltip ) == 'function') {setTimeout("prepare_tooltip("+bk_type+");",1000);}
228
- }
229
- }
230
-
231
- // Show Yes/No dialog
232
- function bk_are_you_sure( message_question ){
233
- var answer = confirm( message_question );
234
- if ( answer) { return true; }
235
- else { return false;}
236
- }
237
-
238
-
239
- // Set Booking listing row as R e a d
240
- function set_booking_row_read(booking_id){
241
- jQuery('#booking_mark_'+booking_id + '').addClass('hidden_items');
242
- decrese_new_counter();
243
- }
244
-
245
- // Set Booking listing row as U n R e a d
246
- function set_booking_row_unread(booking_id){
247
- jQuery('#booking_mark_'+booking_id + '').removeClass('hidden_items');
248
- increase_new_counter();
249
- }
250
-
251
- function increase_new_counter () {
252
- var my_num = parseInt(jQuery('.bk-update-count').html());
253
- my_num = my_num + 1;
254
- jQuery('.bk-update-count').html(my_num);
255
- }
256
-
257
- function decrese_new_counter () {
258
- var my_num = parseInt(jQuery('.bk-update-count').html());
259
- if (my_num>0){
260
- my_num = my_num - 1;
261
- jQuery('.bk-update-count').html(my_num);
262
- }
263
- }
264
-
265
- // Set Booking listing R O W Approved
266
- function set_booking_row_approved(booking_id){
267
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-approved').removeClass('hidden_items');
268
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-pending').addClass('hidden_items');
269
-
270
- jQuery('#booking_row_'+booking_id + ' .booking-dates .field-booking-date').addClass('approved');
271
-
272
- jQuery('#booking_row_'+booking_id + ' .booking-actions .approve_bk_link').addClass('hidden_items');
273
- jQuery('#booking_row_'+booking_id + ' .booking-actions .pending_bk_link').removeClass('hidden_items');
274
-
275
- }
276
-
277
- // Set Booking listing R O W Pending
278
- function set_booking_row_pending(booking_id){
279
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-approved').addClass('hidden_items');
280
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-pending').removeClass('hidden_items');
281
-
282
- jQuery('#booking_row_'+booking_id + ' .booking-dates .field-booking-date').removeClass('approved');
283
-
284
- jQuery('#booking_row_'+booking_id + ' .booking-actions .approve_bk_link').removeClass('hidden_items');
285
- jQuery('#booking_row_'+booking_id + ' .booking-actions .pending_bk_link').addClass('hidden_items');
286
-
287
- }
288
-
289
- // Remove Booking listing R O W
290
- function set_booking_row_deleted(booking_id){
291
- jQuery('#booking_row_'+booking_id).fadeOut(1000);
292
- }
293
-
294
- // Set in Booking listing R O W Resource title
295
- function set_booking_row_resource_name(booking_id, resourcename){
296
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-resource').html(resourcename);
297
- }
298
-
299
-
300
- // Set in Booking listing R O W new Remark in hint
301
- function set_booking_row_remark_in_hint(booking_id, new_remark){
302
- jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link').attr('data-original-title', new_remark);
303
-
304
- var my_img = jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link img').attr('src');
305
- var check_my_img = my_img.substr( my_img.length - 7);
306
- if (check_my_img !== '_rd.png') {
307
- my_img = my_img.substr(0, my_img.length - 4);
308
- jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link img').attr('src', my_img+'_rd.png');
309
- } else {
310
- my_img = my_img.substr(0, my_img.length - 7);
311
- jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link img').attr('src', my_img+'.png');
312
- }
313
-
314
-
315
- }
316
-
317
- // Set in Booking listing R O W new Remark in hint
318
- function set_booking_row_payment_status(booking_id, payment_status, payment_status_show){
319
-
320
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').removeClass('label-important');
321
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').removeClass('label-success');
322
-
323
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').html(payment_status_show)
324
-
325
- if (payment_status == 'OK') {
326
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').addClass('label-success');
327
- } else if (payment_status == '') {
328
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').addClass('label-important');
329
- } else {
330
- jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').addClass('label-important');
331
- }
332
- }
333
-
334
-
335
-
336
- // Approve or set Pending booking
337
- function approve_unapprove_booking(booking_id, is_approve_or_pending, user_id, wpdev_active_locale, is_send_emeils ) {
338
-
339
- if ( booking_id !='' ) {
340
-
341
- var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
342
- var ajax_type_action = 'UPDATE_APPROVE';
343
- var ajax_bk_message = 'Updating...';
344
- //var is_send_emeils = 1;
345
- var denyreason = '';
346
- if (is_send_emeils == 1) {
347
- is_send_emeils = jQuery('#is_send_email_for_pending').attr('checked');
348
- if (is_send_emeils == undefined) {is_send_emeils = 0 ;}
349
- else {is_send_emeils = 1 ;}
350
- denyreason = jQuery('#denyreason').val();
351
- } else {
352
- is_send_emeils = 0;
353
- }
354
-
355
-
356
- document.getElementById('ajax_working').innerHTML =
357
- '<div class="info_message ajax_message" id="ajax_message">\n\
358
- <div style="float:left;">'+ajax_bk_message+'</div> \n\
359
- <div style="float:left;width:80px;margin-top:-3px;">\n\
360
- <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
361
- </div>\n\
362
- </div>';
363
-
364
- jQuery.ajax({ // Start Ajax Sending
365
- url: wpdev_ajax_path,
366
- type:'POST',
367
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
368
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
369
- // beforeSend: someFunction,
370
- data:{
371
- ajax_action : ajax_type_action, // Action
372
- booking_id : booking_id, // ID of Booking - separator |
373
- is_approve_or_pending : is_approve_or_pending, // Approve: 1, Reject: 0
374
- is_send_emeils : is_send_emeils,
375
- denyreason: denyreason,
376
- user_id: user_id,
377
- wpdev_active_locale:wpdev_active_locale
378
- }
379
- });
380
- return false;
381
- }
382
-
383
- return true;
384
- }
385
-
386
- // Delete booking
387
- function delete_booking(booking_id, user_id, wpdev_active_locale, is_send_emeils ) {
388
-
389
- if ( booking_id !='' ) {
390
-
391
- var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
392
- var ajax_type_action = 'DELETE_APPROVE';
393
- var ajax_bk_message = 'Updating...';
394
- //var is_send_emeils = 1;
395
- var denyreason = '';
396
- if (is_send_emeils == 1) {
397
- is_send_emeils = jQuery('#is_send_email_for_pending').attr('checked');
398
- if (is_send_emeils == undefined) {is_send_emeils = 0 ;}
399
- else {is_send_emeils = 1 ;}
400
- denyreason = jQuery('#denyreason').val();
401
- } else {
402
- is_send_emeils = 0;
403
- }
404
-
405
- document.getElementById('ajax_working').innerHTML =
406
- '<div class="info_message ajax_message" id="ajax_message">\n\
407
- <div style="float:left;">'+ajax_bk_message+'</div> \n\
408
- <div style="float:left;width:80px;margin-top:-3px;">\n\
409
- <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
410
- </div>\n\
411
- </div>';
412
-
413
- jQuery.ajax({ // Start Ajax Sending
414
- url: wpdev_ajax_path,
415
- type:'POST',
416
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
417
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
418
- // beforeSend: someFunction,
419
- data:{
420
- ajax_action : ajax_type_action, // Action
421
- booking_id : booking_id, // ID of Booking - separator |
422
- is_send_emeils : is_send_emeils,
423
- denyreason: denyreason,
424
- user_id: user_id,
425
- wpdev_active_locale:wpdev_active_locale
426
- }
427
- });
428
- return false;
429
- }
430
-
431
- return true;
432
- }
433
-
434
-
435
- // Mark as Read or Unread selected bookings
436
- function mark_read_booking(booking_id, is_read_or_unread, user_id, wpdev_active_locale ) {
437
-
438
- if ( booking_id !='' ) {
439
-
440
- var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
441
- var ajax_type_action = 'UPDATE_READ_UNREAD';
442
- var ajax_bk_message = 'Updating...';
443
-
444
- document.getElementById('ajax_working').innerHTML =
445
- '<div class="info_message ajax_message" id="ajax_message">\n\
446
- <div style="float:left;">'+ajax_bk_message+'</div> \n\
447
- <div style="float:left;width:80px;margin-top:-3px;">\n\
448
- <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
449
- </div>\n\
450
- </div>';
451
-
452
- jQuery.ajax({ // Start Ajax Sending
453
- url: wpdev_ajax_path,
454
- type:'POST',
455
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
456
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
457
- // beforeSend: someFunction,
458
- data:{
459
- ajax_action : ajax_type_action, // Action
460
- booking_id : booking_id, // ID of Booking - separator |
461
- is_read_or_unread : is_read_or_unread, // Read: 1, Unread: 0
462
- user_id: user_id,
463
- wpdev_active_locale:wpdev_active_locale
464
- }
465
- });
466
- return false;
467
- }
468
-
469
- return true;
470
- }
471
-
472
-
473
- // Get the list of ID in selected bookings from booking listing
474
- function get_selected_bookings_id_in_booking_listing(){
475
-
476
- var checkedd = jQuery(".booking_list_item_checkbox:checked");
477
- var id_for_approve = "";
478
-
479
- // get all IDs
480
- checkedd.each(function(){
481
- var id_c = jQuery(this).attr('id');
482
- id_c = id_c.substr(20,id_c.length-20)
483
- id_for_approve += id_c + "|";
484
- });
485
-
486
- if ( id_for_approve.length > 1 )
487
- id_for_approve = id_for_approve.substr(0,id_for_approve.length-1); //delete last "|"
488
-
489
- return id_for_approve ;
490
- }
491
-
492
-
493
- // Send booking Cacel by visitor
494
- function bookingCancelByVisitor(booking_hash, bk_type, wpdev_active_locale){
495
-
496
-
497
- if (booking_hash!='') {
498
-
499
-
500
- document.getElementById('submiting' + bk_type).innerHTML =
501
- '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif"><//div>';
502
-
503
- var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
504
- var ajax_type_action='DELETE_BY_VISITOR';
505
-
506
- jQuery.ajax({ // Start Ajax Sending
507
- url: wpdev_ajax_path,
508
- type:'POST',
509
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond_insert' + bk_type).html( data ) ;},
510
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
511
- // beforeSend: someFunction,
512
- data:{
513
- ajax_action : ajax_type_action,
514
- booking_hash : booking_hash,
515
- bk_type : bk_type,
516
- wpdev_active_locale:wpdev_active_locale
517
- }
518
- });
519
- return false;
520
- }
521
- return true;
522
- }
523
-
524
-
525
- // Scroll to script
526
- function makeScroll(object_name) {
527
- var targetOffset = jQuery( object_name ).offset().top;
528
- targetOffset = targetOffset - 50;
529
- if (targetOffset<0) targetOffset = 0;
530
- jQuery('html,body').animate({scrollTop: targetOffset}, 1000)
531
-
532
- }
533
-
534
- //Admin function s for checking all checkbos in one time
535
- function setCheckBoxInTable(el_stutus, el_class){
536
- jQuery('.'+el_class).attr('checked', el_stutus);
537
-
538
- if ( el_stutus ) {
539
- jQuery('.'+el_class).parent().parent().addClass('row_selected_color');
540
- } else {
541
- jQuery('.'+el_class).parent().parent().removeClass('row_selected_color');
542
- }
543
- }
544
-
545
-
546
- // Set selected days at calendar as UnAvailable
547
- function setUnavailableSelectedDays( bk_type ){
548
- var sel_dates = jQuery('#calendar_booking'+bk_type).datepick('getDate');
549
- var class_day2;
550
- for( var i =0; i <sel_dates.length; i++) {
551
- class_day2 = (sel_dates[i].getMonth()+1) + '-' + sel_dates[i].getDate() + '-' + sel_dates[i].getFullYear();
552
- date_approved[ bk_type ][ class_day2 ] = [ (sel_dates[i].getMonth()+1) , sel_dates[i].getDate(), sel_dates[i].getFullYear(),0,0,0];
553
- jQuery('#calendar_booking'+bk_type+' td.cal4date-'+class_day2).html(sel_dates[i].getDate());
554
- // jQuery('#calendar_booking'+bk_type).datepick('refresh');
555
- }
556
- }
557
-
558
-
559
- // Aftre reservation action is done
560
- function setReservedSelectedDates( bk_type ){
561
-
562
- if (document.getElementById('calendar_booking'+bk_type) === null ) {
563
- document.getElementById('submiting' + bk_type).innerHTML = '';
564
- document.getElementById("booking_form_div"+bk_type).style.display="none";
565
- makeScroll('#booking_form'+bk_type);
566
- if (type_of_thank_you_message == 'page') { // Page
567
- //location.href= thank_you_page_URL;
568
- timeoutID_of_thank_you_page = setTimeout(function ( ) {location.href= thank_you_page_URL;} ,1000);
569
- } else { // Message
570
- document.getElementById('submiting'+bk_type).innerHTML = '<div class=\"submiting_content\" >'+new_booking_title+'</div>';
571
- jQuery('.submiting_content').fadeOut( new_booking_title_time );
572
- }
573
- } else {
574
-
575
- setUnavailableSelectedDays(bk_type); // Set days as unavailable
576
- document.getElementById('date_booking'+bk_type).value = ''; // Set textarea date booking to ''
577
- document.getElementById('calendar_booking'+bk_type).style.display= 'none';
578
- jQuery('.block_hints').css( {'display' : 'none'} );
579
-
580
- var is_admin = 0;
581
- if (location.href.indexOf('booking.php') != -1 ) {is_admin = 1;}
582
- if (is_admin == 0) {
583
- // Get calendar from the html and insert it before form div, which will hide after btn click
584
- jQuery('#calendar_booking'+bk_type).insertBefore("#booking_form_div"+bk_type);
585
- document.getElementById("booking_form_div"+bk_type).style.display="none";
586
- makeScroll('#calendar_booking'+bk_type);
587
-
588
- var is_pay_now = false;
589
-
590
- if ( document.getElementById('paypalbooking_form'+bk_type) != null )
591
- if ( document.getElementById('paypalbooking_form'+bk_type).innerHTML != '' ) is_pay_now = true;
592
-
593
- if ( (! is_pay_now) || ( is_booking_without_payment == true ) ) {
594
- if (type_of_thank_you_message == 'page') { // Page
595
- // thank_you_page_URL
596
- // location.href= thank_you_page_URL;
597
- timeoutID_of_thank_you_page = setTimeout(function ( ) {location.href= thank_you_page_URL;} ,1000);
598
- } else { // Message
599
- //new_booking_title;
600
- //new_booking_title_time;
601
- document.getElementById('submiting'+bk_type).innerHTML = '<div class=\"submiting_content\" >'+new_booking_title+'</div>';
602
- jQuery('.submiting_content').fadeOut( new_booking_title_time );
603
- //setTimeout(function ( ) {location.reload(true);} ,new_booking_title_time);
604
- }
605
- }
606
-
607
- } else {
608
- setTimeout(function ( ) {location.reload(true);} ,1000);
609
- }
610
- }
611
- }
612
-
613
-
614
- function showErrorMessage( element , errorMessage) {
615
-
616
- jQuery("[name='"+ element.name +"']")
617
- .fadeOut( 350 ).fadeIn( 300 )
618
- .fadeOut( 350 ).fadeIn( 400 )
619
- .animate( {opacity: 1}, 4000 )
620
- ; // mark red border
621
- jQuery("[name='"+ element.name +"']")
622
- .after('<div class="wpdev-help-message">'+ errorMessage +'</div>'); // Show message
623
- jQuery(".wpdev-help-message")
624
- .css( {'color' : 'red'} )
625
- .animate( {opacity: 1}, 10000 )
626
- .fadeOut( 2000 ); // hide message
627
- element.focus(); // make focus to elemnt
628
- return;
629
-
630
- }
631
-
632
- // Check fields at form and then send request
633
- function mybooking_submit( submit_form , bk_type, wpdev_active_locale){
634
-
635
-
636
- var count = submit_form.elements.length;
637
- var formdata = '';
638
- var inp_value;
639
- var element;
640
- var el_type;
641
-
642
-
643
- // Serialize form here
644
- for (i=0; i<count; i++) {
645
- element = submit_form.elements[i];
646
-
647
- if ( (element.type !=='button') && (element.type !=='hidden') && ( element.name !== ('date_booking' + bk_type) ) ) { // Skip buttons and hidden element - type
648
-
649
-
650
- // Get Element Value
651
- if (element.type !=='checkbox') {inp_value = element.value;}
652
- else {
653
- if (element.value == '') inp_value = element.checked; // if checkbox so then just check checked
654
- else {
655
- if (element.checked) inp_value = element.value;
656
- else inp_value = '';
657
- }
658
- }
659
-
660
-
661
- // Recheck for max num. available visitors selection
662
- if ( element.name == ('visitors'+bk_type) )
663
- if( typeof( is_max_visitors_selection_more_than_available ) == 'function' )
664
- if ( is_max_visitors_selection_more_than_available( bk_type, inp_value, element ) )
665
- return;
666
-
667
-
668
-
669
- // Validation Check --- Requred fields
670
- if ( element.className.indexOf('wpdev-validates-as-required') !== -1 ){
671
- if ((element.type =='checkbox') && ( inp_value === false)) {showErrorMessage( element , message_verif_requred_for_check_box);return;}
672
- if ( inp_value === '') {showErrorMessage( element , message_verif_requred);return;}
673
- }
674
-
675
- // Validation Check --- Email correct filling field
676
- if ( element.className.indexOf('wpdev-validates-as-email') !== -1 ){
677
- var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
678
- if(reg.test(inp_value) == false) {showErrorMessage( element , message_verif_emeil);return;}
679
- }
680
-
681
-
682
- // Get Form Data
683
- if ( element.name !== ('captcha_input' + bk_type) ) {
684
- if (formdata !=='') formdata += '~'; // next field element
685
-
686
- el_type = element.type
687
- if ( element.className.indexOf('wpdev-validates-as-email') !== -1 ) el_type='email';
688
- if ( element.className.indexOf('wpdev-validates-as-coupon') !== -1 ) el_type='coupon';
689
-
690
- inp_value = inp_value + '';
691
- inp_value = inp_value.replace(new RegExp("\\^",'g'), '&#94;'); // replace registered characters
692
- inp_value = inp_value.replace(new RegExp("~",'g'), '&#126;'); // replace registered characters
693
-
694
- inp_value = inp_value.replace(/"/g, '&#34;'); // replace double quot
695
- inp_value = inp_value.replace(/'/g, '&#39;'); // replace single quot
696
-
697
- formdata += el_type + '^' + element.name + '^' + inp_value ; // element attr
698
- }
699
- }
700
-
701
- } // End Fields Loop
702
-
703
- // Recheck Times
704
- if( typeof( is_this_time_selections_not_available ) == 'function' )
705
- if ( is_this_time_selections_not_available( bk_type, submit_form.elements ) )
706
- return;
707
-
708
- if (document.getElementById('calendar_booking'+bk_type) != null ) {
709
- var inst = jQuery.datepick._getInst(document.getElementById('calendar_booking'+bk_type));
710
- if (wpdev_bk_is_dynamic_range_selection != undefined)
711
- if ( wpdev_bk_is_dynamic_range_selection )
712
- if (days_select_count_dynamic != undefined)
713
- if (inst.dates.length < days_select_count_dynamic ) {
714
- alert(message_verif_selectdts);
715
- return;
716
- }
717
- }
718
- //Show message if no selected days
719
- if (document.getElementById('date_booking' + bk_type).value == '') {
720
-
721
-
722
-
723
- if ( document.getElementById('additional_calendars' + bk_type) != null ) { // Checking according additional calendars.
724
-
725
- var id_additional_str = document.getElementById('additional_calendars' + bk_type).value; //Loop have to be here based on , sign
726
- var id_additional_arr = id_additional_str.split(',');
727
- var is_all_additional_days_unselected = true;
728
- for (var ia=0;ia<id_additional_arr.length;ia++) {
729
- if (document.getElementById('date_booking' + id_additional_arr[ia] ).value != '' ) {
730
- is_all_additional_days_unselected = false;
731
- }
732
- }
733
-
734
- if (is_all_additional_days_unselected) {
735
- alert(message_verif_selectdts);
736
- return;
737
- }
738
-
739
- } else {
740
- alert(message_verif_selectdts);
741
- return;
742
- }
743
- }
744
-
745
-
746
- // Cpatch verify
747
- var captcha = document.getElementById('wpdev_captcha_challenge_' + bk_type);
748
- if (captcha != null) form_submit_send( bk_type, formdata, captcha.value, document.getElementById('captcha_input' + bk_type).value ,wpdev_active_locale);
749
- else form_submit_send( bk_type, formdata, '', '' , wpdev_active_locale);
750
- return;
751
- }
752
-
753
- // Gathering params for sending Ajax request and then send it
754
- function form_submit_send( bk_type, formdata, captcha_chalange, user_captcha ,wpdev_active_locale){
755
-
756
- document.getElementById('submiting' + bk_type).innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif"><//div>';
757
-
758
- var my_booking_form = '';
759
- var my_booking_hash = '';
760
- if (document.getElementById('booking_form_type' + bk_type) != undefined)
761
- my_booking_form =document.getElementById('booking_form_type' + bk_type).value;
762
-
763
- if (wpdev_bk_edit_id_hash != '') my_booking_hash = wpdev_bk_edit_id_hash;
764
-
765
- var is_send_emeils= jQuery('#is_send_email_for_new_booking')
766
- if (is_send_emeils.length == 0 ) {
767
- is_send_emeils = 1;
768
- } else {
769
- is_send_emeils = is_send_emeils.attr('checked' );
770
- if (is_send_emeils == undefined) {is_send_emeils = 0 ;}
771
- if (is_send_emeils) is_send_emeils = 1;
772
- else is_send_emeils = 0;
773
- }
774
- send_ajax_submit(bk_type,formdata,captcha_chalange,user_captcha,is_send_emeils,my_booking_hash,my_booking_form,wpdev_active_locale ); // Ajax sending request
775
-
776
- var formdata_additional_arr;
777
- var formdata_additional;
778
- var my_form_field;
779
- var id_additional;
780
- var id_additional_str;
781
- var id_additional_arr;
782
- if (document.getElementById('additional_calendars' + bk_type) != null ) {
783
-
784
- id_additional_str = document.getElementById('additional_calendars' + bk_type).value; //Loop have to be here based on , sign
785
- id_additional_arr = id_additional_str.split(',');
786
-
787
- for (var ia=0;ia<id_additional_arr.length;ia++) {
788
- formdata_additional_arr = formdata;
789
- formdata_additional = '';
790
- id_additional = id_additional_arr[ia];
791
-
792
-
793
- formdata_additional_arr = formdata_additional_arr.split('~');
794
- for (var j=0;j<formdata_additional_arr.length;j++) {
795
- my_form_field = formdata_additional_arr[j].split('^');
796
- if (formdata_additional !=='') formdata_additional += '~';
797
-
798
- if (my_form_field[1].substr( (my_form_field[1].length -2),2)=='[]')
799
- my_form_field[1] = my_form_field[1].substr(0, (my_form_field[1].length - (''+bk_type).length ) - 2 ) + id_additional + '[]';
800
- else
801
- my_form_field[1] = my_form_field[1].substr(0, (my_form_field[1].length - (''+bk_type).length ) ) + id_additional ;
802
-
803
-
804
- formdata_additional += my_form_field[0] + '^' + my_form_field[1] + '^' + my_form_field[2];
805
- }
806
-
807
-
808
- if (document.getElementById('date_booking' + id_additional).value != '' ) {
809
- setUnavailableSelectedDays(id_additional); // Set selected days unavailable in this calendar
810
- jQuery('#calendar_booking'+id_additional).insertBefore("#booking_form_div"+bk_type); // Insert calendar before form to do not hide it
811
- if (document.getElementById('paypalbooking_form'+id_additional) != null)
812
- jQuery('#paypalbooking_form'+id_additional).insertBefore("#booking_form_div"+bk_type); // Insert payment form to do not hide it
813
- else {
814
- jQuery("#booking_form_div"+bk_type).append('<div id="paypalbooking_form'+id_additional+'" ></div>')
815
- jQuery("#booking_form_div"+bk_type).append('<div id="ajax_respond_insert'+id_additional+'" ></div>')
816
- }
817
- send_ajax_submit( id_additional ,formdata_additional,captcha_chalange,user_captcha,is_send_emeils,my_booking_hash,my_booking_form ,wpdev_active_locale );
818
- }
819
- }
820
- }
821
- }
822
-
823
- //<![CDATA[
824
- function send_ajax_submit(bk_type,formdata,captcha_chalange,user_captcha,is_send_emeils,my_booking_hash,my_booking_form ,wpdev_active_locale ) {
825
- // Ajax POST here
826
-
827
- var my_bk_res = bk_type;
828
- if ( document.getElementById('bk_type' + bk_type) != null ) my_bk_res = document.getElementById('bk_type' + bk_type).value;
829
-
830
- jQuery.ajax({ // Start Ajax Sending
831
- url: wpdev_bk_plugin_url+ '/' + wpdev_bk_plugin_filename,
832
- type:'POST',
833
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond_insert' + bk_type).html( data ) ;},
834
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
835
- // beforeSend: someFunction,
836
- data:{
837
- ajax_action : 'INSERT_INTO_TABLE',
838
- bktype: my_bk_res ,
839
- dates: document.getElementById('date_booking' + bk_type).value ,
840
- form: formdata,
841
- captcha_chalange:captcha_chalange,
842
- captcha_user_input: user_captcha,
843
- is_send_emeils : is_send_emeils,
844
- my_booking_hash:my_booking_hash,
845
- booking_form_type:my_booking_form,
846
- wpdev_active_locale:wpdev_active_locale
847
- }
848
- });
849
- }
850
- //]]>
851
-
852
-
853
-
854
- // Prepare to show tooltips
855
- function prepare_tooltip(myParam){
856
- var tooltip_day_class_4_show = " .timespartly";
857
- if (is_show_availability_in_tooltips) {
858
- if ( wpdev_in_array( parent_booking_resources , myParam ) )
859
- tooltip_day_class_4_show = " .datepick-days-cell";//" .datepick-days-cell a"; // each day
860
- }
861
- if (is_show_cost_in_tooltips) {
862
- tooltip_day_class_4_show = " .datepick-days-cell";//" .datepick-days-cell a"; // each day
863
- }
864
-
865
- // Show tooltip at each day if time availability filter is set
866
- if(typeof( global_avalaibility_times[myParam]) != "undefined") {
867
- if (global_avalaibility_times[myParam].length>0) tooltip_day_class_4_show = " .datepick-days-cell"; // each day
868
- }
869
-
870
-
871
- jQuery("#calendar_booking" + myParam + tooltip_day_class_4_show ).popover( {
872
- placement: 'top'
873
- , delay: { show: 500, hide: 1 }
874
- , content: ''
875
- , template: '<div class="wpdevbk popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
876
- });
877
-
878
- }
879
-
880
- // Hint labels inside of input boxes
881
- jQuery(document).ready( function(){
882
-
883
- jQuery('div.inside_hint').click(function(){
884
- jQuery(this).css('visibility', 'hidden').siblings('.has-inside-hint').focus();
885
- });
886
-
887
- jQuery('input.has-inside-hint').blur(function() {
888
- if ( this.value == '' )
889
- jQuery(this).siblings('.inside_hint').css('visibility', '');
890
- }).focus(function(){
891
- jQuery(this).siblings('.inside_hint').css('visibility', 'hidden');
892
- });
893
- });
894
-
895
-
896
-
897
- function openModalWindow(content_ID){
898
- //alert('!!!' + content);
899
- jQuery('.modal_content_text').attr('style','display:none;');
900
- document.getElementById( content_ID ).style.display = 'block';
901
- var buttons = {};//{ "Ok": wpdev_bk_dialog_close };
902
- jQuery("#wpdev-bk-dialog").dialog( {
903
- autoOpen: false,
904
- width: 700,
905
- height: 330,
906
- buttons:buttons,
907
- draggable:false,
908
- hide: 'slide',
909
- resizable: false,
910
- modal: true,
911
- title: '<img src="'+wpdev_bk_plugin_url+ '/img/calendar-16x16.png" align="middle" style="margin-top:1px;"> Booking Calendar'
912
- });
913
- jQuery("#wpdev-bk-dialog").dialog("open");
914
- }
915
-
916
- function wpdev_bk_dialog_close(){
917
- jQuery("#wpdev-bk-dialog").dialog("close");
918
- }
919
-
920
- function wpdev_togle_box(boxid){
921
- if ( jQuery( '#' + boxid ).hasClass('closed') ) jQuery('#' + boxid).removeClass('closed');
922
- else jQuery('#' + boxid).addClass('closed');
923
- }
924
-
925
-
926
- //<![CDATA[
927
- function setNumerOfCalendarsAtAdminSide(us_id, cal_count) {
928
-
929
- var ajax_bk_message = 'Updating...';
930
-
931
- document.getElementById('ajax_working').innerHTML =
932
- '<div class="info_message ajax_message" id="ajax_message">\n\
933
- <div style="float:left;">'+ajax_bk_message+'</div> \n\
934
- <div style="float:left;width:80px;margin-top:-3px;">\n\
935
- <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
936
- </div>\n\
937
- </div>';
938
-
939
- jQuery.ajax({ // Start Ajax Sending
940
- url: wpdev_bk_plugin_url+ '/' + wpdev_bk_plugin_filename,
941
- type:'POST',
942
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
943
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
944
- // beforeSend: someFunction,
945
- data:{
946
- ajax_action : 'USER_SAVE_OPTION',
947
- user_id: us_id ,
948
- option: 'ADMIN_CALENDAR_COUNT',
949
- count: cal_count,
950
- is_reload:1
951
- }
952
- });
953
- }
954
- //]]>
955
-
956
-
957
- //<![CDATA[
958
- function verify_window_opening(us_id, window_id ){
959
-
960
- var is_closed = 0;
961
-
962
- if (jQuery('#' + window_id ).hasClass('closed') == true){
963
- jQuery('#' + window_id ).removeClass('closed');
964
- } else {
965
- jQuery('#' + window_id ).addClass('closed');
966
- is_closed = 1;
967
- }
968
-
969
-
970
- jQuery.ajax({ // Start Ajax Sending
971
- url: wpdev_bk_plugin_url+ '/' + wpdev_bk_plugin_filename,
972
- type:'POST',
973
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
974
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
975
- // beforeSend: someFunction,
976
- data:{
977
- ajax_action : 'USER_SAVE_WINDOW_STATE',
978
- user_id: us_id ,
979
- window: window_id,
980
- is_closed: is_closed
981
- }
982
- });
983
-
984
- }
985
- //]]>
986
-
987
- function wpdev_in_array (array_here, p_val) {
988
- for(var i = 0, l = array_here.length; i < l; i++) {
989
- if(array_here[i] == p_val) {
990
- return true;
991
- }
992
- }
993
- return false;
994
- }
995
-
996
-
997
- function days_between(date1, date2) {
998
-
999
- // The number of milliseconds in one day
1000
- var ONE_DAY = 1000 * 60 * 60 * 24
1001
-
1002
- // Convert both dates to milliseconds
1003
- var date1_ms = date1.getTime()
1004
- var date2_ms = date2.getTime()
1005
-
1006
- // Calculate the difference in milliseconds
1007
- var difference_ms = date1_ms - date2_ms;
1008
-
1009
- // Convert back to days and return
1010
- return Math.round(difference_ms/ONE_DAY)
1011
-
1012
- }
1013
-
1014
- function showwidedates_at_admin_side(){
1015
- jQuery('.short_dates_view').addClass('hide_dates_view');
1016
- jQuery('.short_dates_view').removeClass('show_dates_view');
1017
- jQuery('.wide_dates_view').addClass('show_dates_view');
1018
- jQuery('.wide_dates_view').removeClass('hide_dates_view');
1019
- jQuery('#showwidedates').addClass('hide_dates_view');
1020
-
1021
- jQuery('.showwidedates').addClass('hide_dates_view');
1022
- jQuery('.showshortdates').addClass('show_dates_view');
1023
- jQuery('.showshortdates').removeClass('hide_dates_view');
1024
- jQuery('.showwidedates').removeClass('show_dates_view');
1025
- }
1026
-
1027
- function showshortdates_at_admin_side(){
1028
- jQuery('.wide_dates_view').addClass('hide_dates_view');
1029
- jQuery('.wide_dates_view').removeClass('show_dates_view');
1030
- jQuery('.short_dates_view').addClass('show_dates_view');
1031
- jQuery('.short_dates_view').removeClass('hide_dates_view');
1032
-
1033
- jQuery('.showshortdates').addClass('hide_dates_view');
1034
- jQuery('.showwidedates').addClass('show_dates_view');
1035
- jQuery('.showwidedates').removeClass('hide_dates_view');
1036
- jQuery('.showshortdates').removeClass('show_dates_view');
1037
-
1038
- }
1039
-
1040
-
1041
-
1042
- function daysInMonth(month,year) {
1043
- var m = [31,28,31,30,31,30,31,31,30,31,30,31];
1044
- if (month != 2) return m[month - 1];
1045
- if (year%4 != 0) return m[1];
1046
- if (year%100 == 0 && year%400 != 0) return m[1];
1047
- return m[1] + 1;
1048
- }
1049
-
1050
-
1051
- function setSelectBoxByValue(el_id, el_value) {
1052
-
1053
- for (var i=0; i < document.getElementById(el_id).length; i++) {
1054
- if (document.getElementById(el_id)[i].value == el_value) {
1055
- document.getElementById(el_id)[i].selected = true;
1056
- }
1057
- }
1058
- }
1059
-
1060
-
1061
- //<![CDATA[
1062
- function save_bk_listing_filter(us_id, filter_name, filter_value ){
1063
-
1064
- var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
1065
- var ajax_type_action = 'SAVE_BK_LISTING_FILTER';
1066
- var ajax_bk_message = 'Saving...';
1067
-
1068
- document.getElementById('ajax_working').innerHTML =
1069
- '<div class="info_message ajax_message" id="ajax_message">\n\
1070
- <div style="float:left;">'+ajax_bk_message+'</div> \n\
1071
- <div style="float:left;width:80px;margin-top:-3px;">\n\
1072
- <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
1073
- </div>\n\
1074
- </div>';
1075
-
1076
- jQuery.ajax({
1077
- url: wpdev_ajax_path,
1078
- type:'POST',
1079
- success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
1080
- error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
1081
- data:{
1082
- ajax_action : ajax_type_action,
1083
- user_id: us_id ,
1084
- filter_name: filter_name ,
1085
- filter_value: filter_value
1086
-
1087
- }
1088
- });
1089
- }
1090
  //]]>
1
+ var is_booking_without_payment = false;
2
+ var date_approved = [];
3
+ var date2approve = [];
4
+ var date_admin_blank = [];
5
+ var dates_additional_info = [];
6
+ var is_all_days_available = [];
7
+ var avalaibility_filters = [];
8
+ var is_show_cost_in_tooltips = false;
9
+ var is_show_availability_in_tooltips = false;
10
+ var global_avalaibility_times = [];
11
+ var wpdev_bk_calendarViewMode = '';
12
+ var numbb = 0;
13
+ var is_use_visitors_number_for_availability ;
14
+ var timeoutID_of_thank_you_page = null;
15
+
16
+ // Initialisation
17
+ function init_datepick_cal(bk_type, date_approved_par, my_num_month, start_day_of_week, start_bk_month ){
18
+
19
+ if ( jQuery('#calendar_booking'+ bk_type).hasClass('hasDatepick') == true ) { // If the calendar with the same Booking resource is activated already, then exist.
20
+ return false;
21
+ }
22
+
23
+ var cl = document.getElementById('calendar_booking'+ bk_type);if (cl == null) return; // Get calendar instance and exit if its not exist
24
+
25
+ date_approved[ bk_type ] = date_approved_par;
26
+
27
+ function click_on_cal_td(){
28
+ if(typeof( selectDayPro ) == 'function') {selectDayPro( bk_type);}
29
+ }
30
+
31
+ function selectDay(date) {
32
+
33
+ if(typeof( selectDayPro_rangeSelection ) == 'function') { // Check if this minimum BS version, and then proced
34
+ jQuery('.datepick-days-cell' ).popover('hide');
35
+ }
36
+ jQuery('#date_booking' + bk_type).val(date);
37
+ if(typeof( selectDayPro ) == 'function') {selectDayPro( date, bk_type);}
38
+ }
39
+
40
+ function hoverDay(value, date){
41
+
42
+ if(typeof( hoverDayTime ) == 'function') {hoverDayTime(value, date, bk_type);}
43
+
44
+ if ( (location.href.indexOf('admin.php?page=booking/wpdev-booking.phpwpdev-booking')==-1) ||
45
+ (location.href.indexOf('admin.php?page=booking/wpdev-booking.phpwpdev-booking-reservation')>0) )
46
+ { // Do not show it (range) at the main admin page
47
+ if(typeof( hoverDayPro ) == 'function') {hoverDayPro(value, date, bk_type);}
48
+ }
49
+ //if(typeof( hoverAdminDay ) == 'function') { hoverAdminDay(value, date, bk_type); }
50
+ }
51
+
52
+ function applyCSStoDays(date ){
53
+ var class_day = (date.getMonth()+1) + '-' + date.getDate() + '-' + date.getFullYear();
54
+ var additional_class = ' ';
55
+
56
+ if(typeof( prices_per_day ) !== 'undefined')
57
+ if(typeof( prices_per_day[bk_type] ) !== 'undefined')
58
+ if(typeof( prices_per_day[bk_type][class_day] ) !== 'undefined') {
59
+ additional_class += ' rate_'+prices_per_day[bk_type][class_day];
60
+ }
61
+
62
+
63
+ var my_test_date = new Date(); //Anxo customizarion
64
+ my_test_date.setFullYear(wpdev_bk_today[0],(wpdev_bk_today[1]-1), wpdev_bk_today[2] ,0,0,0); //Get today //Anxo customizarion
65
+ if ( (days_between( date, my_test_date)+1) < block_some_dates_from_today ) return [false, 'cal4date-' + class_day +' date_user_unavailable']; //Anxo customizarion
66
+ /**/
67
+ if (typeof( is_this_day_available ) == 'function') {
68
+ var is_day_available = is_this_day_available( date, bk_type);
69
+ if (! is_day_available) {return [false, 'cal4date-' + class_day +' date_user_unavailable'];}
70
+ }
71
+
72
+ // Time availability
73
+ if (typeof( check_global_time_availability ) == 'function') {check_global_time_availability( date, bk_type );}
74
+
75
+
76
+ // Check availability per day for H.E.
77
+ var reserved_days_count = 1;
78
+ if(typeof(availability_per_day) !== 'undefined')
79
+ if(typeof(availability_per_day[ bk_type ]) !== 'undefined')
80
+ if(typeof(availability_per_day[ bk_type ][ class_day ]) !== 'undefined') {
81
+ reserved_days_count = parseInt( availability_per_day[ bk_type ][ class_day ] );}
82
+
83
+ // we have 0 available at this day - Only for resources, which have childs
84
+ if ( wpdev_in_array( parent_booking_resources, bk_type ) )
85
+ if (reserved_days_count <= 0) {
86
+ if(typeof(date2approve[ bk_type ]) !== 'undefined')
87
+ if(typeof(date2approve[ bk_type ][ class_day ]) !== 'undefined')
88
+ return [false, 'cal4date-' + class_day +' date2approve date_unavailable_for_all_childs ' + blank_admin_class_day];
89
+ return [false, 'cal4date-' + class_day +' date_approved date_unavailable_for_all_childs ' + blank_admin_class_day];
90
+ }
91
+
92
+ //var class_day_previos = (date.getMonth()+1) + '-' + (date.getDate()-1) + '-' + date.getFullYear();
93
+ var blank_admin_class_day = '';
94
+ if(typeof(date_admin_blank[ bk_type ]) !== 'undefined')
95
+ if(typeof(date_admin_blank[ bk_type ][ class_day ]) !== 'undefined') {
96
+ blank_admin_class_day = ' date_admin_blank ';
97
+ }
98
+ var th=0;
99
+ var tm=0;
100
+ var ts=0;
101
+ var time_return_value = false;
102
+ // Select dates which need to approve, its exist only in Admin
103
+ if(typeof(date2approve[ bk_type ]) !== 'undefined')
104
+ if(typeof(date2approve[ bk_type ][ class_day ]) !== 'undefined') {
105
+
106
+ for (var ia=0;ia<date2approve[ bk_type ][ class_day ].length;ia++) {
107
+
108
+
109
+ th = date2approve[ bk_type ][ class_day ][ia][3];
110
+ tm = date2approve[ bk_type ][ class_day ][ia][4];
111
+ ts = date2approve[ bk_type ][ class_day ][ia][5];
112
+ if ( ( th == 0 ) && ( tm == 0 ) && ( ts == 0 ) )
113
+ return [false, 'cal4date-' + class_day +' date2approve' + blank_admin_class_day]; // Orange
114
+ else {
115
+ if ( is_booking_used_check_in_out_time === true ) {
116
+ if (ts == '1') additional_class += ' check_in_time';
117
+ if (ts == '2') additional_class += ' check_out_time';
118
+ }
119
+ time_return_value = [true, 'cal4date-' + class_day +' date2approve timespartly' + additional_class]; // Times
120
+ if(typeof( isDayFullByTime ) == 'function') {
121
+ if ( isDayFullByTime(bk_type, class_day ) ) return [false, 'cal4date-' + class_day +' date2approve' + blank_admin_class_day]; // Orange
122
+ }
123
+ }
124
+
125
+ }
126
+
127
+ }
128
+
129
+ //select Approved dates
130
+ if(typeof(date_approved[ bk_type ]) !== 'undefined')
131
+ if(typeof(date_approved[ bk_type ][ class_day ]) !== 'undefined') {
132
+
133
+ for (var ia=0;ia<date_approved[ bk_type ][ class_day ].length;ia++) {
134
+
135
+ th = date_approved[ bk_type ][ class_day ][ia][3];
136
+ tm = date_approved[ bk_type ][ class_day ][ia][4];
137
+ ts = date_approved[ bk_type ][ class_day ][ia][5];
138
+ if ( ( th == 0 ) && ( tm == 0 ) && ( ts == 0 ) )
139
+ return [false, 'cal4date-' + class_day +' date_approved' + blank_admin_class_day]; //Blue or Grey in client
140
+ else {
141
+ if ( is_booking_used_check_in_out_time === true ) {
142
+ if (ts == '1') additional_class += ' check_in_time';
143
+ if (ts == '2') additional_class += ' check_out_time';
144
+ }
145
+ time_return_value = [true, 'cal4date-' + class_day +' date_approved timespartly' + additional_class]; // Times
146
+ if(typeof( isDayFullByTime ) == 'function') {
147
+ if ( isDayFullByTime(bk_type, class_day ) ) return [false, 'cal4date-' + class_day +' date_approved' + blank_admin_class_day]; // Blue or Grey in client
148
+ }
149
+ }
150
+
151
+ }
152
+ }
153
+
154
+
155
+ for (var i=0; i<user_unavilable_days.length;i++) {
156
+ if (date.getDay()==user_unavilable_days[i]) return [false, 'cal4date-' + class_day +' date_user_unavailable' ];
157
+ }
158
+
159
+ var is_datepick_unselectable = '';
160
+ var is_calendar_booking_unselectable= jQuery('#calendar_booking_unselectable' + bk_type);
161
+ if (is_calendar_booking_unselectable.length != 0 ) {
162
+ is_datepick_unselectable = 'datepick-unselectable'; // //datepick-unselectable
163
+ }
164
+
165
+ if ( time_return_value !== false ) return time_return_value;
166
+ else return [true, 'cal4date-' + class_day +' reserved_days_count' + reserved_days_count + ' ' + is_datepick_unselectable + additional_class+ ' '];
167
+ }
168
+
169
+ function changeMonthYear(year, month){
170
+ if(typeof( selectDayPro_rangeSelection ) == 'function') { // Check if this minimum BS version, and then proced
171
+ if(typeof( prepare_tooltip ) == 'function') {
172
+ setTimeout("prepare_tooltip("+bk_type+");",1000);
173
+ }
174
+ }
175
+ if(typeof( prepare_highlight ) == 'function') {
176
+ setTimeout("prepare_highlight();",1000);
177
+ }
178
+ }
179
+ // Configure and show calendar
180
+ jQuery('#calendar_booking'+ bk_type).text('');
181
+ jQuery('#calendar_booking'+ bk_type).datepick(
182
+ {beforeShowDay: applyCSStoDays,
183
+ onSelect: selectDay,
184
+ onHover:hoverDay,
185
+ onChangeMonthYear:changeMonthYear,
186
+ showOn: 'both',
187
+ multiSelect: multiple_day_selections,
188
+ numberOfMonths: my_num_month,
189
+ stepMonths: 1,
190
+ prevText: '<<',
191
+ nextText: '>>',
192
+ dateFormat: 'dd.mm.yy',
193
+ changeMonth: false,
194
+ changeYear: false,
195
+ minDate: 0, maxDate: booking_max_monthes_in_calendar, //'1Y',
196
+ showStatus: false,
197
+ multiSeparator: ', ',
198
+ closeAtTop: false,
199
+ firstDay:start_day_of_week,
200
+ gotoCurrent: false,
201
+ hideIfNoPrevNext:true,
202
+ rangeSelect:wpdev_bk_is_dynamic_range_selection,
203
+ calendarViewMode:wpdev_bk_calendarViewMode,
204
+ useThemeRoller :false // ui-cupertino.datepick.css
205
+ }
206
+ );
207
+
208
+
209
+ if ( start_bk_month != false ) {
210
+ var inst = jQuery.datepick._getInst(document.getElementById('calendar_booking'+bk_type));
211
+ inst.cursorDate = new Date();
212
+ inst.cursorDate.setFullYear( start_bk_month[0], (start_bk_month[1]-1) , 1 );
213
+ inst.drawMonth = inst.cursorDate.getMonth();
214
+ inst.drawYear = inst.cursorDate.getFullYear();
215
+
216
+ jQuery.datepick._notifyChange(inst);
217
+ jQuery.datepick._adjustInstDate(inst);
218
+ jQuery.datepick._showDate(inst);
219
+ jQuery.datepick._updateDatepick(inst);
220
+ }
221
+
222
+
223
+
224
+
225
+ //jQuery('td.datepick-days-cell').bind('click', 'selectDayPro');
226
+ if(typeof( selectDayPro_rangeSelection ) == 'function') { // Check if this minimum BS version, and then proced
227
+ if(typeof( prepare_tooltip ) == 'function') {setTimeout("prepare_tooltip("+bk_type+");",1000);}
228
+ }
229
+ }
230
+
231
+ // Show Yes/No dialog
232
+ function bk_are_you_sure( message_question ){
233
+ var answer = confirm( message_question );
234
+ if ( answer) { return true; }
235
+ else { return false;}
236
+ }
237
+
238
+
239
+ // Set Booking listing row as R e a d
240
+ function set_booking_row_read(booking_id){
241
+ jQuery('#booking_mark_'+booking_id + '').addClass('hidden_items');
242
+ decrese_new_counter();
243
+ }
244
+
245
+ // Set Booking listing row as U n R e a d
246
+ function set_booking_row_unread(booking_id){
247
+ jQuery('#booking_mark_'+booking_id + '').removeClass('hidden_items');
248
+ increase_new_counter();
249
+ }
250
+
251
+ function increase_new_counter () {
252
+ var my_num = parseInt(jQuery('.bk-update-count').html());
253
+ my_num = my_num + 1;
254
+ jQuery('.bk-update-count').html(my_num);
255
+ }
256
+
257
+ function decrese_new_counter () {
258
+ var my_num = parseInt(jQuery('.bk-update-count').html());
259
+ if (my_num>0){
260
+ my_num = my_num - 1;
261
+ jQuery('.bk-update-count').html(my_num);
262
+ }
263
+ }
264
+
265
+ // Set Booking listing R O W Approved
266
+ function set_booking_row_approved(booking_id){
267
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-approved').removeClass('hidden_items');
268
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-pending').addClass('hidden_items');
269
+
270
+ jQuery('#booking_row_'+booking_id + ' .booking-dates .field-booking-date').addClass('approved');
271
+
272
+ jQuery('#booking_row_'+booking_id + ' .booking-actions .approve_bk_link').addClass('hidden_items');
273
+ jQuery('#booking_row_'+booking_id + ' .booking-actions .pending_bk_link').removeClass('hidden_items');
274
+
275
+ }
276
+
277
+ // Set Booking listing R O W Pending
278
+ function set_booking_row_pending(booking_id){
279
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-approved').addClass('hidden_items');
280
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-pending').removeClass('hidden_items');
281
+
282
+ jQuery('#booking_row_'+booking_id + ' .booking-dates .field-booking-date').removeClass('approved');
283
+
284
+ jQuery('#booking_row_'+booking_id + ' .booking-actions .approve_bk_link').removeClass('hidden_items');
285
+ jQuery('#booking_row_'+booking_id + ' .booking-actions .pending_bk_link').addClass('hidden_items');
286
+
287
+ }
288
+
289
+ // Remove Booking listing R O W
290
+ function set_booking_row_deleted(booking_id){
291
+ jQuery('#booking_row_'+booking_id).fadeOut(1000);
292
+ }
293
+
294
+ // Set in Booking listing R O W Resource title
295
+ function set_booking_row_resource_name(booking_id, resourcename){
296
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-resource').html(resourcename);
297
+ }
298
+
299
+
300
+ // Set in Booking listing R O W new Remark in hint
301
+ function set_booking_row_remark_in_hint(booking_id, new_remark){
302
+ jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link').attr('data-original-title', new_remark);
303
+
304
+ var my_img = jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link img').attr('src');
305
+ var check_my_img = my_img.substr( my_img.length - 7);
306
+ if (check_my_img !== '_rd.png') {
307
+ my_img = my_img.substr(0, my_img.length - 4);
308
+ jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link img').attr('src', my_img+'_rd.png');
309
+ } else {
310
+ my_img = my_img.substr(0, my_img.length - 7);
311
+ jQuery('#booking_row_'+booking_id + ' .booking-actions .remark_bk_link img').attr('src', my_img+'.png');
312
+ }
313
+
314
+
315
+ }
316
+
317
+ // Set in Booking listing R O W new Remark in hint
318
+ function set_booking_row_payment_status(booking_id, payment_status, payment_status_show){
319
+
320
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').removeClass('label-important');
321
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').removeClass('label-success');
322
+
323
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').html(payment_status_show)
324
+
325
+ if (payment_status == 'OK') {
326
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').addClass('label-success');
327
+ } else if (payment_status == '') {
328
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').addClass('label-important');
329
+ } else {
330
+ jQuery('#booking_row_'+booking_id + ' .booking-labels .label-payment-status').addClass('label-important');
331
+ }
332
+ }
333
+
334
+
335
+
336
+ // Approve or set Pending booking
337
+ function approve_unapprove_booking(booking_id, is_approve_or_pending, user_id, wpdev_active_locale, is_send_emeils ) {
338
+
339
+ if ( booking_id !='' ) {
340
+
341
+ var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
342
+ var ajax_type_action = 'UPDATE_APPROVE';
343
+ var ajax_bk_message = 'Updating...';
344
+ //var is_send_emeils = 1;
345
+ var denyreason = '';
346
+ if (is_send_emeils == 1) {
347
+ is_send_emeils = jQuery('#is_send_email_for_pending').attr('checked');
348
+ if (is_send_emeils == undefined) {is_send_emeils = 0 ;}
349
+ else {is_send_emeils = 1 ;}
350
+ denyreason = jQuery('#denyreason').val();
351
+ } else {
352
+ is_send_emeils = 0;
353
+ }
354
+
355
+
356
+ document.getElementById('ajax_working').innerHTML =
357
+ '<div class="info_message ajax_message" id="ajax_message">\n\
358
+ <div style="float:left;">'+ajax_bk_message+'</div> \n\
359
+ <div style="float:left;width:80px;margin-top:-3px;">\n\
360
+ <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
361
+ </div>\n\
362
+ </div>';
363
+
364
+ jQuery.ajax({ // Start Ajax Sending
365
+ url: wpdev_ajax_path,
366
+ type:'POST',
367
+ success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
368
+ error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
369
+ // beforeSend: someFunction,
370
+ data:{
371
+ ajax_action : ajax_type_action, // Action
372
+ booking_id : booking_id, // ID of Booking - separator |
373
+ is_approve_or_pending : is_approve_or_pending, // Approve: 1, Reject: 0
374
+ is_send_emeils : is_send_emeils,
375
+ denyreason: denyreason,
376
+ user_id: user_id,
377
+ wpdev_active_locale:wpdev_active_locale,
378
+ wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce').value
379
+ }
380
+ });
381
+ return false;
382
+ }
383
+
384
+ return true;
385
+ }
386
+
387
+ // Delete booking
388
+ function delete_booking(booking_id, user_id, wpdev_active_locale, is_send_emeils ) {
389
+
390
+ if ( booking_id !='' ) {
391
+
392
+ var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
393
+ var ajax_type_action = 'DELETE_APPROVE';
394
+ var ajax_bk_message = 'Updating...';
395
+ //var is_send_emeils = 1;
396
+ var denyreason = '';
397
+ if (is_send_emeils == 1) {
398
+ is_send_emeils = jQuery('#is_send_email_for_pending').attr('checked');
399
+ if (is_send_emeils == undefined) {is_send_emeils = 0 ;}
400
+ else {is_send_emeils = 1 ;}
401
+ denyreason = jQuery('#denyreason').val();
402
+ } else {
403
+ is_send_emeils = 0;
404
+ }
405
+
406
+ document.getElementById('ajax_working').innerHTML =
407
+ '<div class="info_message ajax_message" id="ajax_message">\n\
408
+ <div style="float:left;">'+ajax_bk_message+'</div> \n\
409
+ <div style="float:left;width:80px;margin-top:-3px;">\n\
410
+ <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
411
+ </div>\n\
412
+ </div>';
413
+
414
+ jQuery.ajax({ // Start Ajax Sending
415
+ url: wpdev_ajax_path,
416
+ type:'POST',
417
+ success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
418
+ error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
419
+ // beforeSend: someFunction,
420
+ data:{
421
+ ajax_action : ajax_type_action, // Action
422
+ booking_id : booking_id, // ID of Booking - separator |
423
+ is_send_emeils : is_send_emeils,
424
+ denyreason: denyreason,
425
+ user_id: user_id,
426
+ wpdev_active_locale:wpdev_active_locale,
427
+ wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce').value
428
+ }
429
+ });
430
+ return false;
431
+ }
432
+
433
+ return true;
434
+ }
435
+
436
+
437
+ // Mark as Read or Unread selected bookings
438
+ function mark_read_booking(booking_id, is_read_or_unread, user_id, wpdev_active_locale ) {
439
+
440
+ if ( booking_id !='' ) {
441
+
442
+ var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
443
+ var ajax_type_action = 'UPDATE_READ_UNREAD';
444
+ var ajax_bk_message = 'Updating...';
445
+
446
+ document.getElementById('ajax_working').innerHTML =
447
+ '<div class="info_message ajax_message" id="ajax_message">\n\
448
+ <div style="float:left;">'+ajax_bk_message+'</div> \n\
449
+ <div style="float:left;width:80px;margin-top:-3px;">\n\
450
+ <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
451
+ </div>\n\
452
+ </div>';
453
+
454
+ jQuery.ajax({ // Start Ajax Sending
455
+ url: wpdev_ajax_path,
456
+ type:'POST',
457
+ success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
458
+ error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
459
+ // beforeSend: someFunction,
460
+ data:{
461
+ ajax_action : ajax_type_action, // Action
462
+ booking_id : booking_id, // ID of Booking - separator |
463
+ is_read_or_unread : is_read_or_unread, // Read: 1, Unread: 0
464
+ user_id: user_id,
465
+ wpdev_active_locale:wpdev_active_locale,
466
+ wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce').value
467
+ }
468
+ });
469
+ return false;
470
+ }
471
+
472
+ return true;
473
+ }
474
+
475
+
476
+ // Get the list of ID in selected bookings from booking listing
477
+ function get_selected_bookings_id_in_booking_listing(){
478
+
479
+ var checkedd = jQuery(".booking_list_item_checkbox:checked");
480
+ var id_for_approve = "";
481
+
482
+ // get all IDs
483
+ checkedd.each(function(){
484
+ var id_c = jQuery(this).attr('id');
485
+ id_c = id_c.substr(20,id_c.length-20)
486
+ id_for_approve += id_c + "|";
487
+ });
488
+
489
+ if ( id_for_approve.length > 1 )
490
+ id_for_approve = id_for_approve.substr(0,id_for_approve.length-1); //delete last "|"
491
+
492
+ return id_for_approve ;
493
+ }
494
+
495
+
496
+ // Send booking Cacel by visitor
497
+ function bookingCancelByVisitor(booking_hash, bk_type, wpdev_active_locale){
498
+
499
+
500
+ if (booking_hash!='') {
501
+
502
+
503
+ document.getElementById('submiting' + bk_type).innerHTML =
504
+ '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif"><//div>';
505
+
506
+ var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
507
+ var ajax_type_action='DELETE_BY_VISITOR';
508
+
509
+ jQuery.ajax({ // Start Ajax Sending
510
+ url: wpdev_ajax_path,
511
+ type:'POST',
512
+ success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond_insert' + bk_type).html( data ) ;},
513
+ error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
514
+ // beforeSend: someFunction,
515
+ data:{
516
+ ajax_action : ajax_type_action,
517
+ booking_hash : booking_hash,
518
+ bk_type : bk_type,
519
+ wpdev_active_locale:wpdev_active_locale,
520
+ wpbc_nonce: document.getElementById('wpbc_nonce_delete'+bk_type).value
521
+ }
522
+ });
523
+ return false;
524
+ }
525
+ return true;
526
+ }
527
+
528
+
529
+ // Scroll to script
530
+ function makeScroll(object_name) {
531
+ var targetOffset = jQuery( object_name ).offset().top;
532
+ targetOffset = targetOffset - 50;
533
+ if (targetOffset<0) targetOffset = 0;
534
+ jQuery('html,body').animate({scrollTop: targetOffset}, 1000)
535
+
536
+ }
537
+
538
+ //Admin function s for checking all checkbos in one time
539
+ function setCheckBoxInTable(el_stutus, el_class){
540
+ jQuery('.'+el_class).attr('checked', el_stutus);
541
+
542
+ if ( el_stutus ) {
543
+ jQuery('.'+el_class).parent().parent().addClass('row_selected_color');
544
+ } else {
545
+ jQuery('.'+el_class).parent().parent().removeClass('row_selected_color');
546
+ }
547
+ }
548
+
549
+
550
+ // Set selected days at calendar as UnAvailable
551
+ function setUnavailableSelectedDays( bk_type ){
552
+ var sel_dates = jQuery('#calendar_booking'+bk_type).datepick('getDate');
553
+ var class_day2;
554
+ for( var i =0; i <sel_dates.length; i++) {
555
+ class_day2 = (sel_dates[i].getMonth()+1) + '-' + sel_dates[i].getDate() + '-' + sel_dates[i].getFullYear();
556
+ date_approved[ bk_type ][ class_day2 ] = [ (sel_dates[i].getMonth()+1) , sel_dates[i].getDate(), sel_dates[i].getFullYear(),0,0,0];
557
+ jQuery('#calendar_booking'+bk_type+' td.cal4date-'+class_day2).html(sel_dates[i].getDate());
558
+ // jQuery('#calendar_booking'+bk_type).datepick('refresh');
559
+ }
560
+ }
561
+
562
+
563
+ // Aftre reservation action is done
564
+ function setReservedSelectedDates( bk_type ){
565
+
566
+ if (document.getElementById('calendar_booking'+bk_type) === null ) {
567
+ document.getElementById('submiting' + bk_type).innerHTML = '';
568
+ document.getElementById("booking_form_div"+bk_type).style.display="none";
569
+ makeScroll('#booking_form'+bk_type);
570
+ if (type_of_thank_you_message == 'page') { // Page
571
+ //location.href= thank_you_page_URL;
572
+ timeoutID_of_thank_you_page = setTimeout(function ( ) {location.href= thank_you_page_URL;} ,1000);
573
+ } else { // Message
574
+ document.getElementById('submiting'+bk_type).innerHTML = '<div class=\"submiting_content\" >'+new_booking_title+'</div>';
575
+ jQuery('.submiting_content').fadeOut( new_booking_title_time );
576
+ }
577
+ } else {
578
+
579
+ setUnavailableSelectedDays(bk_type); // Set days as unavailable
580
+ document.getElementById('date_booking'+bk_type).value = ''; // Set textarea date booking to ''
581
+ document.getElementById('calendar_booking'+bk_type).style.display= 'none';
582
+ jQuery('.block_hints').css( {'display' : 'none'} );
583
+
584
+ var is_admin = 0;
585
+ if (location.href.indexOf('booking.php') != -1 ) {is_admin = 1;}
586
+ if (is_admin == 0) {
587
+ // Get calendar from the html and insert it before form div, which will hide after btn click
588
+ jQuery('#calendar_booking'+bk_type).insertBefore("#booking_form_div"+bk_type);
589
+ document.getElementById("booking_form_div"+bk_type).style.display="none";
590
+ makeScroll('#calendar_booking'+bk_type);
591
+
592
+ var is_pay_now = false;
593
+
594
+ if ( document.getElementById('paypalbooking_form'+bk_type) != null )
595
+ if ( document.getElementById('paypalbooking_form'+bk_type).innerHTML != '' ) is_pay_now = true;
596
+
597
+ if ( (! is_pay_now) || ( is_booking_without_payment == true ) ) {
598
+ if (type_of_thank_you_message == 'page') { // Page
599
+ // thank_you_page_URL
600
+ // location.href= thank_you_page_URL;
601
+ timeoutID_of_thank_you_page = setTimeout(function ( ) {location.href= thank_you_page_URL;} ,1000);
602
+ } else { // Message
603
+ //new_booking_title;
604
+ //new_booking_title_time;
605
+ document.getElementById('submiting'+bk_type).innerHTML = '<div class=\"submiting_content\" >'+new_booking_title+'</div>';
606
+ jQuery('.submiting_content').fadeOut( new_booking_title_time );
607
+ //setTimeout(function ( ) {location.reload(true);} ,new_booking_title_time);
608
+ }
609
+ }
610
+
611
+ } else {
612
+ setTimeout(function ( ) {location.reload(true);} ,1000);
613
+ }
614
+ }
615
+ }
616
+
617
+
618
+ function showErrorMessage( element , errorMessage) {
619
+
620
+ jQuery("[name='"+ element.name +"']")
621
+ .fadeOut( 350 ).fadeIn( 300 )
622
+ .fadeOut( 350 ).fadeIn( 400 )
623
+ .animate( {opacity: 1}, 4000 )
624
+ ; // mark red border
625
+ jQuery("[name='"+ element.name +"']")
626
+ .after('<div class="wpdev-help-message">'+ errorMessage +'</div>'); // Show message
627
+ jQuery(".wpdev-help-message")
628
+ .css( {'color' : 'red'} )
629
+ .animate( {opacity: 1}, 10000 )
630
+ .fadeOut( 2000 ); // hide message
631
+ element.focus(); // make focus to elemnt
632
+ return;
633
+
634
+ }
635
+
636
+ // Check fields at form and then send request
637
+ function mybooking_submit( submit_form , bk_type, wpdev_active_locale){
638
+
639
+
640
+ var count = submit_form.elements.length;
641
+ var formdata = '';
642
+ var inp_value;
643
+ var element;
644
+ var el_type;
645
+
646
+
647
+ // Serialize form here
648
+ for (i=0; i<count; i++) {
649
+ element = submit_form.elements[i];
650
+
651
+ if ( (element.type !=='button') && (element.type !=='hidden') && ( element.name !== ('date_booking' + bk_type) ) ) { // Skip buttons and hidden element - type
652
+
653
+
654
+ // Get Element Value
655
+ if (element.type !=='checkbox') {inp_value = element.value;}
656
+ else {
657
+ if (element.value == '') inp_value = element.checked; // if checkbox so then just check checked
658
+ else {
659
+ if (element.checked) inp_value = element.value;
660
+ else inp_value = '';
661
+ }
662
+ }
663
+
664
+
665
+ // Recheck for max num. available visitors selection
666
+ if ( element.name == ('visitors'+bk_type) )
667
+ if( typeof( is_max_visitors_selection_more_than_available ) == 'function' )
668
+ if ( is_max_visitors_selection_more_than_available( bk_type, inp_value, element ) )
669
+ return;
670
+
671
+
672
+
673
+ // Validation Check --- Requred fields
674
+ if ( element.className.indexOf('wpdev-validates-as-required') !== -1 ){
675
+ if ((element.type =='checkbox') && ( inp_value === false)) {showErrorMessage( element , message_verif_requred_for_check_box);return;}
676
+ if ( inp_value === '') {showErrorMessage( element , message_verif_requred);return;}
677
+ }
678
+
679
+ // Validation Check --- Email correct filling field
680
+ if ( element.className.indexOf('wpdev-validates-as-email') !== -1 ){
681
+ var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
682
+ if(reg.test(inp_value) == false) {showErrorMessage( element , message_verif_emeil);return;}
683
+ }
684
+
685
+
686
+ // Get Form Data
687
+ if ( element.name !== ('captcha_input' + bk_type) ) {
688
+ if (formdata !=='') formdata += '~'; // next field element
689
+
690
+ el_type = element.type
691
+ if ( element.className.indexOf('wpdev-validates-as-email') !== -1 ) el_type='email';
692
+ if ( element.className.indexOf('wpdev-validates-as-coupon') !== -1 ) el_type='coupon';
693
+
694
+ inp_value = inp_value + '';
695
+ inp_value = inp_value.replace(new RegExp("\\^",'g'), '&#94;'); // replace registered characters
696
+ inp_value = inp_value.replace(new RegExp("~",'g'), '&#126;'); // replace registered characters
697
+
698
+ inp_value = inp_value.replace(/"/g, '&#34;'); // replace double quot
699
+ inp_value = inp_value.replace(/'/g, '&#39;'); // replace single quot
700
+
701
+ formdata += el_type + '^' + element.name + '^' + inp_value ; // element attr
702
+ }
703
+ }
704
+
705
+ } // End Fields Loop
706
+
707
+ // Recheck Times
708
+ if( typeof( is_this_time_selections_not_available ) == 'function' )
709
+ if ( is_this_time_selections_not_available( bk_type, submit_form.elements ) )
710
+ return;
711
+
712
+ if (document.getElementById('calendar_booking'+bk_type) != null ) {
713
+ var inst = jQuery.datepick._getInst(document.getElementById('calendar_booking'+bk_type));
714
+ if (wpdev_bk_is_dynamic_range_selection != undefined)
715
+ if ( wpdev_bk_is_dynamic_range_selection )
716
+ if (days_select_count_dynamic != undefined)
717
+ if (inst.dates.length < days_select_count_dynamic ) {
718
+ alert(message_verif_selectdts);
719
+ return;
720
+ }
721
+ }
722
+ //Show message if no selected days
723
+ if (document.getElementById('date_booking' + bk_type).value == '') {
724
+
725
+
726
+
727
+ if ( document.getElementById('additional_calendars' + bk_type) != null ) { // Checking according additional calendars.
728
+
729
+ var id_additional_str = document.getElementById('additional_calendars' + bk_type).value; //Loop have to be here based on , sign
730
+ var id_additional_arr = id_additional_str.split(',');
731
+ var is_all_additional_days_unselected = true;
732
+ for (var ia=0;ia<id_additional_arr.length;ia++) {
733
+ if (document.getElementById('date_booking' + id_additional_arr[ia] ).value != '' ) {
734
+ is_all_additional_days_unselected = false;
735
+ }
736
+ }
737
+
738
+ if (is_all_additional_days_unselected) {
739
+ alert(message_verif_selectdts);
740
+ return;
741
+ }
742
+
743
+ } else {
744
+ alert(message_verif_selectdts);
745
+ return;
746
+ }
747
+ }
748
+
749
+
750
+ // Cpatch verify
751
+ var captcha = document.getElementById('wpdev_captcha_challenge_' + bk_type);
752
+ if (captcha != null) form_submit_send( bk_type, formdata, captcha.value, document.getElementById('captcha_input' + bk_type).value ,wpdev_active_locale);
753
+ else form_submit_send( bk_type, formdata, '', '' , wpdev_active_locale);
754
+ return;
755
+ }
756
+
757
+ // Gathering params for sending Ajax request and then send it
758
+ function form_submit_send( bk_type, formdata, captcha_chalange, user_captcha ,wpdev_active_locale){
759
+
760
+ document.getElementById('submiting' + bk_type).innerHTML = '<div style="height:20px;width:100%;text-align:center;margin:15px auto;"><img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif"><//div>';
761
+
762
+ var my_booking_form = '';
763
+ var my_booking_hash = '';
764
+ if (document.getElementById('booking_form_type' + bk_type) != undefined)
765
+ my_booking_form =document.getElementById('booking_form_type' + bk_type).value;
766
+
767
+ if (wpdev_bk_edit_id_hash != '') my_booking_hash = wpdev_bk_edit_id_hash;
768
+
769
+ var is_send_emeils= jQuery('#is_send_email_for_new_booking')
770
+ if (is_send_emeils.length == 0 ) {
771
+ is_send_emeils = 1;
772
+ } else {
773
+ is_send_emeils = is_send_emeils.attr('checked' );
774
+ if (is_send_emeils == undefined) {is_send_emeils = 0 ;}
775
+ if (is_send_emeils) is_send_emeils = 1;
776
+ else is_send_emeils = 0;
777
+ }
778
+ send_ajax_submit(bk_type,formdata,captcha_chalange,user_captcha,is_send_emeils,my_booking_hash,my_booking_form,wpdev_active_locale ); // Ajax sending request
779
+
780
+ var formdata_additional_arr;
781
+ var formdata_additional;
782
+ var my_form_field;
783
+ var id_additional;
784
+ var id_additional_str;
785
+ var id_additional_arr;
786
+ if (document.getElementById('additional_calendars' + bk_type) != null ) {
787
+
788
+ id_additional_str = document.getElementById('additional_calendars' + bk_type).value; //Loop have to be here based on , sign
789
+ id_additional_arr = id_additional_str.split(',');
790
+
791
+ for (var ia=0;ia<id_additional_arr.length;ia++) {
792
+ formdata_additional_arr = formdata;
793
+ formdata_additional = '';
794
+ id_additional = id_additional_arr[ia];
795
+
796
+
797
+ formdata_additional_arr = formdata_additional_arr.split('~');
798
+ for (var j=0;j<formdata_additional_arr.length;j++) {
799
+ my_form_field = formdata_additional_arr[j].split('^');
800
+ if (formdata_additional !=='') formdata_additional += '~';
801
+
802
+ if (my_form_field[1].substr( (my_form_field[1].length -2),2)=='[]')
803
+ my_form_field[1] = my_form_field[1].substr(0, (my_form_field[1].length - (''+bk_type).length ) - 2 ) + id_additional + '[]';
804
+ else
805
+ my_form_field[1] = my_form_field[1].substr(0, (my_form_field[1].length - (''+bk_type).length ) ) + id_additional ;
806
+
807
+
808
+ formdata_additional += my_form_field[0] + '^' + my_form_field[1] + '^' + my_form_field[2];
809
+ }
810
+
811
+
812
+ if (document.getElementById('date_booking' + id_additional).value != '' ) {
813
+ setUnavailableSelectedDays(id_additional); // Set selected days unavailable in this calendar
814
+ jQuery('#calendar_booking'+id_additional).insertBefore("#booking_form_div"+bk_type); // Insert calendar before form to do not hide it
815
+ if (document.getElementById('paypalbooking_form'+id_additional) != null)
816
+ jQuery('#paypalbooking_form'+id_additional).insertBefore("#booking_form_div"+bk_type); // Insert payment form to do not hide it
817
+ else {
818
+ jQuery("#booking_form_div"+bk_type).append('<div id="paypalbooking_form'+id_additional+'" ></div>')
819
+ jQuery("#booking_form_div"+bk_type).append('<div id="ajax_respond_insert'+id_additional+'" ></div>')
820
+ }
821
+ send_ajax_submit( id_additional ,formdata_additional,captcha_chalange,user_captcha,is_send_emeils,my_booking_hash,my_booking_form ,wpdev_active_locale );
822
+ }
823
+ }
824
+ }
825
+ }
826
+
827
+ //<![CDATA[
828
+ function send_ajax_submit(bk_type,formdata,captcha_chalange,user_captcha,is_send_emeils,my_booking_hash,my_booking_form ,wpdev_active_locale ) {
829
+ // Ajax POST here
830
+
831
+ var my_bk_res = bk_type;
832
+ if ( document.getElementById('bk_type' + bk_type) != null ) my_bk_res = document.getElementById('bk_type' + bk_type).value;
833
+
834
+ jQuery.ajax({ // Start Ajax Sending
835
+ url: wpdev_bk_plugin_url+ '/' + wpdev_bk_plugin_filename,
836
+ type:'POST',
837
+ success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond_insert' + bk_type).html( data ) ;},
838
+ error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
839
+ // beforeSend: someFunction,
840
+ data:{
841
+ ajax_action : 'INSERT_INTO_TABLE',
842
+ bktype: my_bk_res ,
843
+ dates: document.getElementById('date_booking' + bk_type).value ,
844
+ form: formdata,
845
+ captcha_chalange:captcha_chalange,
846
+ captcha_user_input: user_captcha,
847
+ is_send_emeils : is_send_emeils,
848
+ my_booking_hash:my_booking_hash,
849
+ booking_form_type:my_booking_form,
850
+ wpdev_active_locale:wpdev_active_locale,
851
+ wpbc_nonce: document.getElementById('wpbc_nonce' + bk_type).value
852
+ }
853
+ });
854
+ }
855
+ //]]>
856
+
857
+
858
+
859
+ // Prepare to show tooltips
860
+ function prepare_tooltip(myParam){
861
+ var tooltip_day_class_4_show = " .timespartly";
862
+ if (is_show_availability_in_tooltips) {
863
+ if ( wpdev_in_array( parent_booking_resources , myParam ) )
864
+ tooltip_day_class_4_show = " .datepick-days-cell";//" .datepick-days-cell a"; // each day
865
+ }
866
+ if (is_show_cost_in_tooltips) {
867
+ tooltip_day_class_4_show = " .datepick-days-cell";//" .datepick-days-cell a"; // each day
868
+ }
869
+
870
+ // Show tooltip at each day if time availability filter is set
871
+ if(typeof( global_avalaibility_times[myParam]) != "undefined") {
872
+ if (global_avalaibility_times[myParam].length>0) tooltip_day_class_4_show = " .datepick-days-cell"; // each day
873
+ }
874
+
875
+
876
+ jQuery("#calendar_booking" + myParam + tooltip_day_class_4_show ).popover( {
877
+ placement: 'top'
878
+ , delay: { show: 500, hide: 1 }
879
+ , content: ''
880
+ , template: '<div class="wpdevbk popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
881
+ });
882
+
883
+ }
884
+
885
+ // Hint labels inside of input boxes
886
+ jQuery(document).ready( function(){
887
+
888
+ jQuery('div.inside_hint').click(function(){
889
+ jQuery(this).css('visibility', 'hidden').siblings('.has-inside-hint').focus();
890
+ });
891
+
892
+ jQuery('input.has-inside-hint').blur(function() {
893
+ if ( this.value == '' )
894
+ jQuery(this).siblings('.inside_hint').css('visibility', '');
895
+ }).focus(function(){
896
+ jQuery(this).siblings('.inside_hint').css('visibility', 'hidden');
897
+ });
898
+ });
899
+
900
+
901
+
902
+ function openModalWindow(content_ID){
903
+ //alert('!!!' + content);
904
+ jQuery('.modal_content_text').attr('style','display:none;');
905
+ document.getElementById( content_ID ).style.display = 'block';
906
+ var buttons = {};//{ "Ok": wpdev_bk_dialog_close };
907
+ jQuery("#wpdev-bk-dialog").dialog( {
908
+ autoOpen: false,
909
+ width: 700,
910
+ height: 330,
911
+ buttons:buttons,
912
+ draggable:false,
913
+ hide: 'slide',
914
+ resizable: false,
915
+ modal: true,
916
+ title: '<img src="'+wpdev_bk_plugin_url+ '/img/calendar-16x16.png" align="middle" style="margin-top:1px;"> Booking Calendar'
917
+ });
918
+ jQuery("#wpdev-bk-dialog").dialog("open");
919
+ }
920
+
921
+ function wpdev_bk_dialog_close(){
922
+ jQuery("#wpdev-bk-dialog").dialog("close");
923
+ }
924
+
925
+ function wpdev_togle_box(boxid){
926
+ if ( jQuery( '#' + boxid ).hasClass('closed') ) jQuery('#' + boxid).removeClass('closed');
927
+ else jQuery('#' + boxid).addClass('closed');
928
+ }
929
+
930
+
931
+
932
+
933
+ //<![CDATA[
934
+ function verify_window_opening(us_id, window_id ){
935
+
936
+ var is_closed = 0;
937
+
938
+ if (jQuery('#' + window_id ).hasClass('closed') == true){
939
+ jQuery('#' + window_id ).removeClass('closed');
940
+ } else {
941
+ jQuery('#' + window_id ).addClass('closed');
942
+ is_closed = 1;
943
+ }
944
+
945
+
946
+ jQuery.ajax({ // Start Ajax Sending
947
+ url: wpdev_bk_plugin_url+ '/' + wpdev_bk_plugin_filename,
948
+ type:'POST',
949
+ success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
950
+ error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
951
+ // beforeSend: someFunction,
952
+ data:{
953
+ ajax_action : 'USER_SAVE_WINDOW_STATE',
954
+ user_id: us_id ,
955
+ window: window_id,
956
+ is_closed: is_closed,
957
+ wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce').value
958
+ }
959
+ });
960
+
961
+ }
962
+ //]]>
963
+
964
+ function wpdev_in_array (array_here, p_val) {
965
+ for(var i = 0, l = array_here.length; i < l; i++) {
966
+ if(array_here[i] == p_val) {
967
+ return true;
968
+ }
969
+ }
970
+ return false;
971
+ }
972
+
973
+
974
+ function days_between(date1, date2) {
975
+
976
+ // The number of milliseconds in one day
977
+ var ONE_DAY = 1000 * 60 * 60 * 24
978
+
979
+ // Convert both dates to milliseconds
980
+ var date1_ms = date1.getTime()
981
+ var date2_ms = date2.getTime()
982
+
983
+ // Calculate the difference in milliseconds
984
+ var difference_ms = date1_ms - date2_ms;
985
+
986
+ // Convert back to days and return
987
+ return Math.round(difference_ms/ONE_DAY)
988
+
989
+ }
990
+
991
+ function showwidedates_at_admin_side(){
992
+ jQuery('.short_dates_view').addClass('hide_dates_view');
993
+ jQuery('.short_dates_view').removeClass('show_dates_view');
994
+ jQuery('.wide_dates_view').addClass('show_dates_view');
995
+ jQuery('.wide_dates_view').removeClass('hide_dates_view');
996
+ jQuery('#showwidedates').addClass('hide_dates_view');
997
+
998
+ jQuery('.showwidedates').addClass('hide_dates_view');
999
+ jQuery('.showshortdates').addClass('show_dates_view');
1000
+ jQuery('.showshortdates').removeClass('hide_dates_view');
1001
+ jQuery('.showwidedates').removeClass('show_dates_view');
1002
+ }
1003
+
1004
+ function showshortdates_at_admin_side(){
1005
+ jQuery('.wide_dates_view').addClass('hide_dates_view');
1006
+ jQuery('.wide_dates_view').removeClass('show_dates_view');
1007
+ jQuery('.short_dates_view').addClass('show_dates_view');
1008
+ jQuery('.short_dates_view').removeClass('hide_dates_view');
1009
+
1010
+ jQuery('.showshortdates').addClass('hide_dates_view');
1011
+ jQuery('.showwidedates').addClass('show_dates_view');
1012
+ jQuery('.showwidedates').removeClass('hide_dates_view');
1013
+ jQuery('.showshortdates').removeClass('show_dates_view');
1014
+
1015
+ }
1016
+
1017
+
1018
+
1019
+ function daysInMonth(month,year) {
1020
+ var m = [31,28,31,30,31,30,31,31,30,31,30,31];
1021
+ if (month != 2) return m[month - 1];
1022
+ if (year%4 != 0) return m[1];
1023
+ if (year%100 == 0 && year%400 != 0) return m[1];
1024
+ return m[1] + 1;
1025
+ }
1026
+
1027
+
1028
+ function setSelectBoxByValue(el_id, el_value) {
1029
+
1030
+ for (var i=0; i < document.getElementById(el_id).length; i++) {
1031
+ if (document.getElementById(el_id)[i].value == el_value) {
1032
+ document.getElementById(el_id)[i].selected = true;
1033
+ }
1034
+ }
1035
+ }
1036
+
1037
+
1038
+ //<![CDATA[
1039
+ function save_bk_listing_filter(us_id, filter_name, filter_value ){
1040
+
1041
+ var wpdev_ajax_path = wpdev_bk_plugin_url+'/' + wpdev_bk_plugin_filename ;
1042
+ var ajax_type_action = 'SAVE_BK_LISTING_FILTER';
1043
+ var ajax_bk_message = 'Saving...';
1044
+
1045
+ document.getElementById('ajax_working').innerHTML =
1046
+ '<div class="info_message ajax_message" id="ajax_message">\n\
1047
+ <div style="float:left;">'+ajax_bk_message+'</div> \n\
1048
+ <div style="float:left;width:80px;margin-top:-3px;">\n\
1049
+ <img src="'+wpdev_bk_plugin_url+'/img/ajax-loader.gif">\n\
1050
+ </div>\n\
1051
+ </div>';
1052
+
1053
+ jQuery.ajax({
1054
+ url: wpdev_ajax_path,
1055
+ type:'POST',
1056
+ success: function (data, textStatus){if( textStatus == 'success') jQuery('#ajax_respond').html( data );},
1057
+ error:function (XMLHttpRequest, textStatus, errorThrown){window.status = 'Ajax sending Error status:'+ textStatus;alert(XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);if (XMLHttpRequest.status == 500) {alert('Please check at this page according this error:' + ' http://wpbookingcalendar.com/faq/#ajax-sending-error');}},
1058
+ data:{
1059
+ ajax_action : ajax_type_action,
1060
+ user_id: us_id ,
1061
+ filter_name: filter_name ,
1062
+ filter_value: filter_value,
1063
+ wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce').value
1064
+
1065
+ }
1066
+ });
1067
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1068
  //]]>
lib/wpdev-booking-ajax.php CHANGED
@@ -28,8 +28,21 @@ if ( ( isset( $_GET['payed_booking'] ) ) || ( isset( $_GET['merchant_return_li
28
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
29
  // A J A X R e s p o n d e r Real Ajax with jQuery sender ///////////////////////////////////////////////////////////////////////
30
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
 
31
  function wpdev_bk_ajax_responder() {
32
 
 
 
 
33
  global $wpdb;
34
  $action = $_POST['ajax_action'];
35
 
@@ -44,13 +57,21 @@ function wpdev_bk_ajax_responder() {
44
 
45
  switch ( $action ) :
46
 
47
- case 'INSERT_INTO_TABLE':
 
 
 
 
 
 
 
48
  wpdev_bk_insert_new_booking();
49
  die();
50
  break;
51
 
52
  case 'UPDATE_READ_UNREAD':
53
-
 
54
  make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id'] );
55
 
56
  $is_read_or_unread = $_POST[ "is_read_or_unread" ];
@@ -85,6 +106,7 @@ function wpdev_bk_ajax_responder() {
85
  break;
86
 
87
  case 'UPDATE_APPROVE' :
 
88
 
89
  make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id'] );
90
 
@@ -132,6 +154,8 @@ function wpdev_bk_ajax_responder() {
132
  break;
133
 
134
  case 'DELETE_APPROVE' :
 
 
135
  make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id'] );
136
 
137
  $booking_id = $_POST[ "booking_id" ]; // Booking ID
@@ -171,81 +195,102 @@ function wpdev_bk_ajax_responder() {
171
  break;
172
 
173
  case 'DELETE_BY_VISITOR':
 
 
 
 
 
 
 
174
  make_bk_action('wpdev_delete_booking_by_visitor');
175
  break;
176
 
177
  case 'SAVE_BK_COST':
 
 
178
  make_bk_action('wpdev_save_bk_cost');
179
  break;
180
 
181
  case 'SEND_PAYMENT_REQUEST':
 
 
182
  make_bk_action('wpdev_send_payment_request');
183
  break;
184
 
185
 
186
  case 'CHANGE_PAYMENT_STATUS':
 
187
  make_bk_action('wpdev_change_payment_status');
188
  break;
189
 
190
  case 'UPDATE_BK_RESOURCE_4_BOOKING':
 
191
  make_bk_action('wpdev_updating_bk_resource_of_booking');
192
  break;
193
 
194
 
195
  case 'UPDATE_REMARK':
 
196
  make_bk_action('wpdev_updating_remark');
197
  break;
198
 
199
  case 'DELETE_BK_FORM':
 
200
  make_bk_action('wpdev_delete_booking_form');
201
  break;
202
 
203
- case 'USER_SAVE_OPTION':
204
-
205
- if ($_POST['option'] == 'ADMIN_CALENDAR_COUNT') {
206
- update_user_option($_POST['user_id'],'booking_admin_calendar_count',$_POST['count']);
207
- }
208
- ?> <script type="text/javascript">
209
- document.getElementById('ajax_message').innerHTML = '<?php echo __('Done', 'wpdev-booking'); ?>';
210
- jQuery('#ajax_message').fadeOut(1000);
211
- <?php if ( $_POST['is_reload'] == 1 ) { ?> location.reload(true); <?php } ?>
212
- </script> <?php
213
- die();
214
- break;
215
 
216
  case 'USER_SAVE_WINDOW_STATE':
 
217
  update_user_option($_POST['user_id'],'booking_win_' . $_POST['window'] ,$_POST['is_closed']);
218
  die();
219
  break;
220
 
221
- case 'CALCULATE_THE_COST':
 
 
 
 
 
 
222
  make_bk_action('wpdev_ajax_show_cost');
223
  die();
224
  break;
225
 
226
  case 'BOOKING_SEARCH':
 
 
 
 
 
 
227
  make_bk_action('wpdev_ajax_booking_search');
228
  die();
229
  break;
230
 
231
  case 'CHECK_BK_NEWS':
 
232
  wpdev_ajax_check_bk_news();
233
  die();
234
  break;
235
  case 'CHECK_BK_VERSION':
 
236
  wpdev_ajax_check_bk_version();
237
  die();
238
  break;
239
 
240
  case 'SAVE_BK_LISTING_FILTER':
 
241
  make_bk_action('wpdev_ajax_save_bk_listing_filter');
242
  die();
243
  break;
244
  case 'EXPORT_BOOKINGS_TO_CSV' :
 
245
  make_bk_action('wpdev_ajax_export_bookings_to_csv');
246
  die();
247
 
248
  default:
 
249
  if (function_exists ('wpdev_pro_bk_ajax')) wpdev_pro_bk_ajax();
250
  die();
251
 
28
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
29
  // A J A X R e s p o n d e r Real Ajax with jQuery sender ///////////////////////////////////////////////////////////////////////
30
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
31
+
32
+ function wpdev_check_nonce_in_admin_panel(){
33
+ $nonce = ( isset($_REQUEST['wpbc_nonce']) ) ? $_REQUEST['wpbc_nonce'] : '';
34
+ if ( ! wp_verify_nonce( $nonce, 'wpbc_ajax_admin_nonce' ) ) { // Verify the nonce.
35
+ // This nonce is not valid.
36
+ echo "<div class='wpdevbk'><div class='alert alert-danger'>" .sprintf(__('%sError!%s Request do not pass security check! Please refresh the page and try one more time.'),'<strong>','</strong>') . "</div></div>";
37
+ die;
38
+ }
39
+ }
40
+
41
  function wpdev_bk_ajax_responder() {
42
 
43
+
44
+
45
+
46
  global $wpdb;
47
  $action = $_POST['ajax_action'];
48
 
57
 
58
  switch ( $action ) :
59
 
60
+ case 'INSERT_INTO_TABLE':
61
+ $nonce = ( isset($_REQUEST['wpbc_nonce']) ) ? $_REQUEST['wpbc_nonce'] : '';
62
+ if ( ! wp_verify_nonce( $nonce, $action ) ) { // Verify the nonce.
63
+ // This nonce is not valid.
64
+ echo "<div class='wpdevbk'><div class='alert alert-danger'>" .sprintf(__('%sError!%s Request do not pass security check! Please refresh the page and try one more time.'),'<strong>','</strong>') . "</div></div>";
65
+ die;
66
+ }
67
+
68
  wpdev_bk_insert_new_booking();
69
  die();
70
  break;
71
 
72
  case 'UPDATE_READ_UNREAD':
73
+ wpdev_check_nonce_in_admin_panel();
74
+
75
  make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id'] );
76
 
77
  $is_read_or_unread = $_POST[ "is_read_or_unread" ];
106
  break;
107
 
108
  case 'UPDATE_APPROVE' :
109
+ wpdev_check_nonce_in_admin_panel();
110
 
111
  make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id'] );
112
 
154
  break;
155
 
156
  case 'DELETE_APPROVE' :
157
+ wpdev_check_nonce_in_admin_panel();
158
+
159
  make_bk_action('check_multiuser_params_for_client_side_by_user_id', $_POST['user_id'] );
160
 
161
  $booking_id = $_POST[ "booking_id" ]; // Booking ID
195
  break;
196
 
197
  case 'DELETE_BY_VISITOR':
198
+ $nonce = ( isset($_REQUEST['wpbc_nonce']) ) ? $_REQUEST['wpbc_nonce'] : '';
199
+ if ( ! wp_verify_nonce( $nonce, 'DELETE_BY_VISITOR' ) ) { // Verify the nonce.
200
+ // This nonce is not valid.
201
+ echo "<div class='wpdevbk'><div class='alert alert-danger'>" .sprintf(__('%sError!%s Request do not pass security check! Please refresh the page and try one more time.'),'<strong>','</strong>') . "</div></div>";
202
+ die;
203
+ }
204
+
205
  make_bk_action('wpdev_delete_booking_by_visitor');
206
  break;
207
 
208
  case 'SAVE_BK_COST':
209
+ wpdev_check_nonce_in_admin_panel();
210
+
211
  make_bk_action('wpdev_save_bk_cost');
212
  break;
213
 
214
  case 'SEND_PAYMENT_REQUEST':
215
+ wpdev_check_nonce_in_admin_panel();
216
+
217
  make_bk_action('wpdev_send_payment_request');
218
  break;
219
 
220
 
221
  case 'CHANGE_PAYMENT_STATUS':
222
+ wpdev_check_nonce_in_admin_panel();
223
  make_bk_action('wpdev_change_payment_status');
224
  break;
225
 
226
  case 'UPDATE_BK_RESOURCE_4_BOOKING':
227
+ wpdev_check_nonce_in_admin_panel();
228
  make_bk_action('wpdev_updating_bk_resource_of_booking');
229
  break;
230
 
231
 
232
  case 'UPDATE_REMARK':
233
+ wpdev_check_nonce_in_admin_panel();
234
  make_bk_action('wpdev_updating_remark');
235
  break;
236
 
237
  case 'DELETE_BK_FORM':
238
+ wpdev_check_nonce_in_admin_panel();
239
  make_bk_action('wpdev_delete_booking_form');
240
  break;
241
 
 
 
 
 
 
 
 
 
 
 
 
 
242
 
243
  case 'USER_SAVE_WINDOW_STATE':
244
+ wpdev_check_nonce_in_admin_panel();
245
  update_user_option($_POST['user_id'],'booking_win_' . $_POST['window'] ,$_POST['is_closed']);
246
  die();
247
  break;
248
 
249
+ case 'CALCULATE_THE_COST':
250
+ $nonce = ( isset($_REQUEST['wpbc_nonce']) ) ? $_REQUEST['wpbc_nonce'] : '';
251
+ if ( ! wp_verify_nonce( $nonce, $action ) ) { // Verify the nonce.
252
+ // This nonce is not valid.
253
+ echo "<div class='wpdevbk'><div class='alert alert-danger'>" .sprintf(__('%sError!%s Request do not pass security check! Please refresh the page and try one more time.'),'<strong>','</strong>') . "</div></div>";
254
+ die;
255
+ }
256
  make_bk_action('wpdev_ajax_show_cost');
257
  die();
258
  break;
259
 
260
  case 'BOOKING_SEARCH':
261
+ $nonce = ( isset($_REQUEST['wpbc_nonce']) ) ? $_REQUEST['wpbc_nonce'] : '';
262
+ if ( ! wp_verify_nonce( $nonce, $action ) ) { // Verify the nonce.
263
+ // This nonce is not valid.
264
+ echo "<div class='wpdevbk'><div class='alert alert-danger'>" .sprintf(__('%sError!%s Request do not pass security check! Please refresh the page and try one more time.'),'<strong>','</strong>') . "</div></div>";
265
+ die;
266
+ }
267
  make_bk_action('wpdev_ajax_booking_search');
268
  die();
269
  break;
270
 
271
  case 'CHECK_BK_NEWS':
272
+ wpdev_check_nonce_in_admin_panel();
273
  wpdev_ajax_check_bk_news();
274
  die();
275
  break;
276
  case 'CHECK_BK_VERSION':
277
+ wpdev_check_nonce_in_admin_panel();
278
  wpdev_ajax_check_bk_version();
279
  die();
280
  break;
281
 
282
  case 'SAVE_BK_LISTING_FILTER':
283
+ wpdev_check_nonce_in_admin_panel();
284
  make_bk_action('wpdev_ajax_save_bk_listing_filter');
285
  die();
286
  break;
287
  case 'EXPORT_BOOKINGS_TO_CSV' :
288
+ wpdev_check_nonce_in_admin_panel();
289
  make_bk_action('wpdev_ajax_export_bookings_to_csv');
290
  die();
291
 
292
  default:
293
+ wpdev_check_nonce_in_admin_panel();
294
  if (function_exists ('wpdev_pro_bk_ajax')) wpdev_pro_bk_ajax();
295
  die();
296
 
lib/wpdev-booking-class.php CHANGED
@@ -183,7 +183,7 @@ class wpdev_booking {
183
 
184
  // Show Booking Dashboard Widget content
185
  function dashboard_bk_widget_show() {
186
-
187
  global $wpdb;
188
  $bk_admin_url = 'admin.php?page='. WPDEV_BK_PLUGIN_DIRNAME . '/'. WPDEV_BK_PLUGIN_FILENAME. 'wpdev-booking&wh_approved=' ;
189
 
@@ -491,7 +491,8 @@ class wpdev_booking {
491
  },
492
  // beforeSend: someFunction,
493
  data:{
494
- ajax_action : 'CHECK_BK_NEWS'
 
495
  }
496
  });
497
 
@@ -1457,6 +1458,9 @@ class wpdev_booking {
1457
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1458
  function content_of_booking_page() {
1459
 
 
 
 
1460
  // Check if this user ACTIVE and can be at this page in MultiUser version
1461
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1462
  if (! $is_can) return false;
@@ -1497,7 +1501,7 @@ class wpdev_booking {
1497
 
1498
  //Content of the Add reservation page
1499
  function content_of_reservation_page() {
1500
-
1501
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1502
 
1503
  if (! $is_can) return false;
@@ -1556,7 +1560,7 @@ class wpdev_booking {
1556
 
1557
  //content of S E T T I N G S page - actions runs
1558
  function content_of_settings_page () {
1559
-
1560
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1561
  if (! $is_can) return false;
1562
 
@@ -1574,7 +1578,7 @@ class wpdev_booking {
1574
 
1575
  //content of resources management page
1576
  function content_of_resource_page(){
1577
-
1578
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1579
  if (! $is_can) return false;
1580
 
@@ -3528,8 +3532,12 @@ if ( jQuery('#togle_settings_range_times').length > 0 ) { jQuery('#togle_set
3528
  // Add booking type field
3529
  $form .= '<input id="bk_type'.$my_boook_type.'" name="bk_type'.$my_boook_type.'" class="" type="hidden" value="'.$my_boook_type.'" /></div>';
3530
  $submitting = '<div id="submiting'.$my_boook_type.'"></div><div class="form_bk_messages" id="form_bk_messages'.$my_boook_type.'" ></div>';
3531
-
3532
- $res = $form . $submitting;
 
 
 
 
3533
 
3534
  $my_random_id = time() * rand(0,1000);
3535
  $my_random_id = 'form_id'. $my_random_id;
183
 
184
  // Show Booking Dashboard Widget content
185
  function dashboard_bk_widget_show() {
186
+ wp_nonce_field('wpbc_ajax_admin_nonce', "wpbc_admin_panel_nonce_dashboard" , true , true );
187
  global $wpdb;
188
  $bk_admin_url = 'admin.php?page='. WPDEV_BK_PLUGIN_DIRNAME . '/'. WPDEV_BK_PLUGIN_FILENAME. 'wpdev-booking&wh_approved=' ;
189
 
491
  },
492
  // beforeSend: someFunction,
493
  data:{
494
+ ajax_action : 'CHECK_BK_NEWS',
495
+ wpbc_nonce: document.getElementById('wpbc_admin_panel_nonce_dashboard').value
496
  }
497
  });
498
 
1458
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1459
  function content_of_booking_page() {
1460
 
1461
+ wp_nonce_field('wpbc_ajax_admin_nonce', "wpbc_admin_panel_nonce" , true , true );
1462
+
1463
+
1464
  // Check if this user ACTIVE and can be at this page in MultiUser version
1465
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1466
  if (! $is_can) return false;
1501
 
1502
  //Content of the Add reservation page
1503
  function content_of_reservation_page() {
1504
+ wp_nonce_field('wpbc_ajax_admin_nonce', "wpbc_admin_panel_nonce" , true , true );
1505
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1506
 
1507
  if (! $is_can) return false;
1560
 
1561
  //content of S E T T I N G S page - actions runs
1562
  function content_of_settings_page () {
1563
+ wp_nonce_field('wpbc_ajax_admin_nonce', "wpbc_admin_panel_nonce" , true , true );
1564
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1565
  if (! $is_can) return false;
1566
 
1578
 
1579
  //content of resources management page
1580
  function content_of_resource_page(){
1581
+ wp_nonce_field('wpbc_ajax_admin_nonce', "wpbc_admin_panel_nonce" , true , true );
1582
  $is_can = apply_bk_filter('multiuser_is_user_can_be_here', true, 'check_for_active_users');
1583
  if (! $is_can) return false;
1584
 
3532
  // Add booking type field
3533
  $form .= '<input id="bk_type'.$my_boook_type.'" name="bk_type'.$my_boook_type.'" class="" type="hidden" value="'.$my_boook_type.'" /></div>';
3534
  $submitting = '<div id="submiting'.$my_boook_type.'"></div><div class="form_bk_messages" id="form_bk_messages'.$my_boook_type.'" ></div>';
3535
+
3536
+ //Params: $action = -1, $name = "_wpnonce", $referer = true , $echo = true
3537
+ $wpbc_nonce = wp_nonce_field('INSERT_INTO_TABLE', ("wpbc_nonce" . $my_boook_type) , true , false );
3538
+ $wpbc_nonce .= wp_nonce_field('CALCULATE_THE_COST', ("wpbc_nonceCALCULATE_THE_COST" . $my_boook_type) , true , false );
3539
+
3540
+ $res = $form . $submitting . $wpbc_nonce;
3541
 
3542
  $my_random_id = time() * rand(0,1000);
3543
  $my_random_id = 'form_id'. $my_random_id;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wpbookingcalendar.com/buy/
4
  Tags: booking calendar, booking, bookings, to book, calendar, reservation, calendar, hotel, rooms, rent, appointment, scheduling, availability, availability calendar, event, events, event calendar, resource scheduling, rental, meeting scheduling, reservation plugin, accommodations, bookable, bookable events
5
  Requires at least: 3.2
6
  Tested up to: 3.6
7
- Stable tag: 4.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,6 +66,8 @@ If you have any further questions, please fill free to <a href="mailto:info@wpbo
66
  9. General Booking Settings page.
67
  10. Booking Listing (Filters tab) admin panel. Apply filter, for looking of your required bookings.
68
  == Changelog ==
 
 
69
  = 4.1.5 =
70
  * Support WordPress 3.6
71
  = 4.1.4 =
@@ -143,8 +145,8 @@ If you have any further questions, please fill free to <a href="mailto:info@wpbo
143
  <br /><br />See full change logs at this <a href="http://wpbookingcalendar.com/changelog/" title="changelog">page</a>.
144
 
145
  == Upgrade Notice ==
146
- = 4.1 =
147
- New stylish booking timeline admin interface. Check-in/out days, mark half of day in calendar. Booking Sort by dates. Show search results in a new seperate page. Form Fields, define for the each CUSTOM FORM the CUSTOM CONTENT. Many other new features and fixes...
148
 
149
  == Languages ==
150
 
4
  Tags: booking calendar, booking, bookings, to book, calendar, reservation, calendar, hotel, rooms, rent, appointment, scheduling, availability, availability calendar, event, events, event calendar, resource scheduling, rental, meeting scheduling, reservation plugin, accommodations, bookable, bookable events
5
  Requires at least: 3.2
6
  Tested up to: 3.6
7
+ Stable tag: 4.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
66
  9. General Booking Settings page.
67
  10. Booking Listing (Filters tab) admin panel. Apply filter, for looking of your required bookings.
68
  == Changelog ==
69
+ = 4.1.6 =
70
+ * Security and maintenance fix. Its important to update your version to this update.
71
  = 4.1.5 =
72
  * Support WordPress 3.6
73
  = 4.1.4 =
145
  <br /><br />See full change logs at this <a href="http://wpbookingcalendar.com/changelog/" title="changelog">page</a>.
146
 
147
  == Upgrade Notice ==
148
+ = 4.1.6 =
149
+ * Security and maintenance fix.
150
 
151
  == Languages ==
152
 
wpdev-booking.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Booking Calendar
4
  Plugin URI: http://wpbookingcalendar.com/demo/
5
  Description: Online reservation and availability checking service for your site.
6
- Version: 4.1.5
7
  Author: wpdevelop
8
  Author URI: http://wpbookingcalendar.com/
9
  Tested WordPress Versions: 3.2 - 3.6
3
  Plugin Name: Booking Calendar
4
  Plugin URI: http://wpbookingcalendar.com/demo/
5
  Description: Online reservation and availability checking service for your site.
6
+ Version: 4.1.6
7
  Author: wpdevelop
8
  Author URI: http://wpbookingcalendar.com/
9
  Tested WordPress Versions: 3.2 - 3.6