banner.php
5 years ago
cp-feedback.php
5 years ago
cp_admin_int_edition.inc.php
5 years ago
cpabc_appointments_admin_addbk.inc.php
5 years ago
cpabc_appointments_admin_int.inc.php
5 years ago
cpabc_appointments_admin_int_bookings_list.inc.php
5 years ago
cpabc_appointments_admin_int_calendar_list.inc.php
5 years ago
cpabc_apps_go.inc.php
5 years ago
cpabc_apps_on.inc.php
5 years ago
cpabc_publish_wizzard.inc.php
5 years ago
cpabc_scheduler.inc.php
5 years ago
index.html
5 years ago
cpabc_apps_on.inc.php
713 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) |
| 5 | { |
| 6 | echo 'Direct access not allowed.'; |
| 7 | exit; |
| 8 | } |
| 9 | |
| 10 | |
| 11 | function _cpabc_appointments_install() { |
| 12 | global $wpdb; |
| 13 | |
| 14 | update_option('CP_ABC_JS', ''); // clean this option |
| 15 | |
| 16 | $charset_collate = $wpdb->get_charset_collate(); |
| 17 | |
| 18 | $table_name = $wpdb->prefix . CPABC_APPOINTMENTS_TABLE_NAME_NO_PREFIX; |
| 19 | |
| 20 | $sql = "CREATE TABLE ".$wpdb->prefix.CPABC_APPOINTMENTS_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX." ( |
| 21 | id mediumint(9) NOT NULL AUTO_INCREMENT, |
| 22 | cal_id mediumint(9) NOT NULL DEFAULT 1, |
| 23 | code VARCHAR(250) DEFAULT '' NOT NULL, |
| 24 | discount VARCHAR(250) DEFAULT '' NOT NULL, |
| 25 | expires datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, |
| 26 | availability int(10) unsigned NOT NULL DEFAULT 0, |
| 27 | used int(10) unsigned NOT NULL DEFAULT 0, |
| 28 | UNIQUE KEY id (id) |
| 29 | ) ".$charset_collate.";"; |
| 30 | $wpdb->query($sql); |
| 31 | |
| 32 | $sql = "CREATE TABLE $table_name ( |
| 33 | id int(10) NOT NULL AUTO_INCREMENT, |
| 34 | time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, |
| 35 | booked_time VARCHAR(250) DEFAULT '' NOT NULL, |
| 36 | booked_time_unformatted VARCHAR(250) DEFAULT '' NOT NULL, |
| 37 | name VARCHAR(250) DEFAULT '' NOT NULL, |
| 38 | email VARCHAR(250) DEFAULT '' NOT NULL, |
| 39 | phone VARCHAR(250) DEFAULT '' NOT NULL, |
| 40 | question mediumtext, |
| 41 | quantity VARCHAR(30) DEFAULT '1' NOT NULL, |
| 42 | buffered_date text, |
| 43 | UNIQUE KEY id (id) |
| 44 | ) ".$charset_collate.";"; |
| 45 | $wpdb->query($sql); |
| 46 | $sql = "ALTER TABLE $table_name ADD `calendar` INT NOT NULL AFTER `id`;"; |
| 47 | $wpdb->query($sql); |
| 48 | |
| 49 | $sql = "CREATE TABLE `".$wpdb->prefix.CPABC_APPOINTMENTS_CONFIG_TABLE_NAME."` (`".CPABC_TDEAPP_CONFIG_ID."` int(10) unsigned NOT NULL auto_increment, `".CPABC_TDEAPP_CONFIG_TITLE."` varchar(255) NOT NULL default '',`".CPABC_TDEAPP_CONFIG_USER."` varchar(100) default NULL,`".CPABC_TDEAPP_CONFIG_PASS."` varchar(100) default NULL,`".CPABC_TDEAPP_CONFIG_LANG."` varchar(5) default NULL,`".CPABC_TDEAPP_CONFIG_CPAGES."` tinyint(3) unsigned default NULL,`".CPABC_TDEAPP_CONFIG_TYPE."` tinyint(3) unsigned default NULL,`".CPABC_TDEAPP_CONFIG_MSG."` varchar(255) NOT NULL default '',`".CPABC_TDEAPP_CONFIG_WORKINGDATES."` varchar(255) NOT NULL default '',`".CPABC_TDEAPP_CONFIG_RESTRICTEDDATES."` text,`".CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES0."` text,`".CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES1."` text,`".CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES2."` text,`".CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES3."` text,`".CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES4."` text,`".CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES5."` text,`".CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES6."` text,`".CPABC_TDEAPP_CALDELETED_FIELD."` tinyint(3) unsigned default NULL,PRIMARY KEY (`".CPABC_TDEAPP_CONFIG_ID."`)) ".$charset_collate."; "; |
| 50 | $wpdb->query($sql); |
| 51 | $sql = "ALTER TABLE `".$wpdb->prefix.CPABC_APPOINTMENTS_CONFIG_TABLE_NAME."` ADD (". |
| 52 | "`conwer` INT NOT NULL, ". |
| 53 | "`form_structure` mediumtext, ". |
| 54 | "`specialDates` mediumtext, ". |
| 55 | "`vs_use_validation` VARCHAR(20) DEFAULT '' NOT NULL, ". |
| 56 | "`vs_text_is_required` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 57 | "`vs_text_is_email` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 58 | "`vs_text_datemmddyyyy` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 59 | "`vs_text_dateddmmyyyy` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 60 | "`vs_text_number` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 61 | "`vs_text_digits` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 62 | "`vs_text_max` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 63 | "`vs_text_min` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 64 | "`vs_text_submitbtn` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 65 | "`calendar_language` text, ". |
| 66 | "`calendar_dateformat` text, ". |
| 67 | "`calendar_pages` text, ". |
| 68 | "`calendar_militarytime` text, ". |
| 69 | "`calendar_weekday` text, ". |
| 70 | "`calendar_mindate` text, ". |
| 71 | "`calendar_maxdate` text, ". |
| 72 | "`calendar_startmonth` VARCHAR(20) DEFAULT '' NOT NULL, ". |
| 73 | "`calendar_startyear` VARCHAR(20) DEFAULT '' NOT NULL, ". |
| 74 | "`calendar_theme` text, ". |
| 75 | "`min_slots` VARCHAR(10) DEFAULT '' NOT NULL, ". |
| 76 | "`max_slots` VARCHAR(10) DEFAULT '' NOT NULL, ". |
| 77 | "`close_fpanel` VARCHAR(10) DEFAULT '' NOT NULL, ". |
| 78 | "`quantity_field` VARCHAR(10) DEFAULT '' NOT NULL, ". |
| 79 | "`paypal_mode` VARCHAR(20) DEFAULT '' NOT NULL, ". |
| 80 | "`enable_paypal` text, ". |
| 81 | "`paypal_email` text, ". |
| 82 | "`request_cost` text, ". |
| 83 | "`paypal_product_name` text, ". |
| 84 | "`currency` text, ". |
| 85 | "`url_ok` text, ". |
| 86 | "`url_cancel` text, ". |
| 87 | "`paypal_language` text, ". |
| 88 | "`cu_user_email_field` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 89 | "`notification_from_email` text, ". |
| 90 | "`notification_destination_email` text, ". |
| 91 | "`email_subject_confirmation_to_user` text, ". |
| 92 | "`email_confirmation_to_user` text, ". |
| 93 | "`email_subject_notification_to_admin` text, ". |
| 94 | "`email_notification_to_admin` text, ". |
| 95 | "`enable_reminder` text, ". |
| 96 | "`reminder_hours` text, ". |
| 97 | "`reminder_subject` text, ". |
| 98 | "`reminder_content` text, ". |
| 99 | "`dexcv_enable_captcha` text, ". |
| 100 | "`dexcv_width` text, ". |
| 101 | "`dexcv_height` text, ". |
| 102 | "`dexcv_chars` text, ". |
| 103 | "`dexcv_min_font_size` text, ". |
| 104 | "`dexcv_max_font_size` text, ". |
| 105 | "`dexcv_noise` text, ". |
| 106 | "`dexcv_noise_length` text, ". |
| 107 | "`dexcv_background` text, ". |
| 108 | "`dexcv_border` text, ". |
| 109 | "`dexcv_font` text, ". |
| 110 | "`cv_text_enter_valid_captcha` VARCHAR(250) DEFAULT '' NOT NULL, ". |
| 111 | "`cp_cal_checkboxes` text, ". |
| 112 | "`nuser_emailformat` text, ". |
| 113 | "`nadmin_emailformat` text, ". |
| 114 | "`nremind_emailformat` text". |
| 115 | ")"; |
| 116 | |
| 117 | $wpdb->query($sql); |
| 118 | |
| 119 | $sql = "CREATE TABLE `".$wpdb->prefix.CPABC_APPOINTMENTS_CALENDARS_TABLE_NAME_NO_PREFIX."` (`".CPABC_TDEAPP_DATA_ID."` int(10) unsigned NOT NULL auto_increment,`".CPABC_TDEAPP_DATA_IDCALENDAR."` int(10) unsigned default NULL,`".CPABC_TDEAPP_DATA_DATETIME."`datetime NOT NULL default '0000-00-00 00:00:00',`".CPABC_TDEAPP_DATA_TITLE."` varchar(250) default NULL,`".CPABC_TDEAPP_DATA_DESCRIPTION."` mediumtext,PRIMARY KEY (`".CPABC_TDEAPP_DATA_ID."`)) ".$charset_collate.";"; |
| 120 | $wpdb->query($sql); |
| 121 | |
| 122 | // code for updates |
| 123 | $sql = "ALTER TABLE `".$wpdb->prefix.CPABC_APPOINTMENTS_CALENDARS_TABLE_NAME_NO_PREFIX."` ADD `description_customer` text DEFAULT '' NOT NULL;"; $wpdb->query($sql); |
| 124 | $sql = "ALTER TABLE `".$wpdb->prefix.CPABC_APPOINTMENTS_CALENDARS_TABLE_NAME_NO_PREFIX."` ADD `reminder` VARCHAR(1) DEFAULT '' NOT NULL;"; $wpdb->query($sql); |
| 125 | $sql = "ALTER TABLE `".$wpdb->prefix.CPABC_APPOINTMENTS_CALENDARS_TABLE_NAME_NO_PREFIX."` ADD `reference` VARCHAR(20) DEFAULT '' NOT NULL;"; $wpdb->query($sql); |
| 126 | $sql = "ALTER TABLE `".$wpdb->prefix.CPABC_APPOINTMENTS_CALENDARS_TABLE_NAME_NO_PREFIX."` ADD `quantity` VARCHAR(25) DEFAULT '1' NOT NULL;"; $wpdb->query($sql); |
| 127 | |
| 128 | $sql = 'INSERT INTO `'.$wpdb->prefix.CPABC_APPOINTMENTS_CONFIG_TABLE_NAME.'` (conwer,calendar_theme,`form_structure`,`'.CPABC_TDEAPP_CONFIG_ID.'`,`'.CPABC_TDEAPP_CONFIG_TITLE.'`,`'.CPABC_TDEAPP_CONFIG_USER.'`,`'.CPABC_TDEAPP_CONFIG_PASS.'`,`'.CPABC_TDEAPP_CONFIG_LANG.'`,`'.CPABC_TDEAPP_CONFIG_CPAGES.'`,`'.CPABC_TDEAPP_CONFIG_TYPE.'`,`'.CPABC_TDEAPP_CONFIG_MSG.'`,`'.CPABC_TDEAPP_CONFIG_WORKINGDATES.'`,`'.CPABC_TDEAPP_CONFIG_RESTRICTEDDATES.'`,`'.CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES0.'`,`'.CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES1.'`,`'.CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES2.'`,`'.CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES3.'`,`'.CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES4.'`,`'.CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES5.'`,`'.CPABC_TDEAPP_CONFIG_TIMEWORKINGDATES6.'`,`'.CPABC_TDEAPP_CALDELETED_FIELD.'`) '. |
| 129 | ' VALUES(0,"modern/","'.esc_sql(CPABC_APPOINTMENTS_DEFAULT_form_structure).'","1","cal1","Calendar Item 1","","-","1","3","Please, select your appointment.","1,2,3,4,5","","","9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0","9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0","9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0","9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0","9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0","","0");'; |
| 130 | $wpdb->query($sql); |
| 131 | |
| 132 | $rcode = get_option('ABC_RCODE',''); |
| 133 | if ($rcode == '') |
| 134 | { |
| 135 | $rcode = wp_generate_uuid4(); |
| 136 | update_option( 'ABC_RCODE', $rcode); |
| 137 | } |
| 138 | |
| 139 | require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 140 | |
| 141 | } |
| 142 | |
| 143 | |
| 144 | function _cpabc_appointments_get_default_paypal_email() |
| 145 | { |
| 146 | return get_the_author_meta('user_email', get_current_user_id()); |
| 147 | } |
| 148 | |
| 149 | |
| 150 | function _cpabc_appointments_get_default_from_email() |
| 151 | { |
| 152 | $default_from = strtolower(get_the_author_meta('user_email', get_current_user_id())); |
| 153 | $domain = str_replace('www.','', strtolower($_SERVER["HTTP_HOST"])); |
| 154 | while (substr_count($domain,".") > 1) |
| 155 | $domain = substr($domain, strpos($domain, ".")+1); |
| 156 | $pos = strpos($default_from, $domain); |
| 157 | if (substr_count($domain,".") == 1 && $pos === false) |
| 158 | return 'admin@'.$domain; |
| 159 | else |
| 160 | return $default_from; |
| 161 | } |
| 162 | |
| 163 | |
| 164 | /* Filter for placing the maps into the contents */ |
| 165 | function cpabc_appointments_filter_content($atts) { |
| 166 | global $wpdb; |
| 167 | extract( shortcode_atts( array( |
| 168 | 'calendar' => '', |
| 169 | 'user' => '', |
| 170 | ), $atts ) ); |
| 171 | $calendar = 1; |
| 172 | if ($calendar != '') |
| 173 | define ('CPABC_CALENDAR_FIXED_ID',intval($calendar)); |
| 174 | else if ($user != '') |
| 175 | { |
| 176 | $users = $wpdb->get_results( "SELECT user_login,ID FROM ".$wpdb->users." WHERE user_login='".esc_sql($user)."'" ); |
| 177 | if (isset($users[0])) |
| 178 | define ('CPABC_CALENDAR_USER',$users[0]->ID); |
| 179 | else |
| 180 | define ('CPABC_CALENDAR_USER',0); |
| 181 | } |
| 182 | else |
| 183 | define ('CPABC_CALENDAR_USER',0); |
| 184 | ob_start(); |
| 185 | cpabc_appointments_get_public_form(); |
| 186 | $buffered_contents = ob_get_contents(); |
| 187 | ob_end_clean(); |
| 188 | return $buffered_contents; |
| 189 | } |
| 190 | |
| 191 | |
| 192 | function cpabc_appointments_filter_edit($atts) { |
| 193 | global $wpdb; |
| 194 | extract( shortcode_atts( array( |
| 195 | 'calendar' => '', |
| 196 | 'user' => '', |
| 197 | ), $atts ) ); |
| 198 | $buffered_contents = ''; |
| 199 | $current_user = wp_get_current_user(); |
| 200 | $myrows = $wpdb->get_results( "SELECT * FROM ".CPABC_APPOINTMENTS_CONFIG_TABLE_NAME." where conwer<>'' AND conwer='".esc_sql($current_user->ID )."'" ); |
| 201 | if (count($myrows)) |
| 202 | { |
| 203 | if (!defined('CP_CALENDAR_ID')) |
| 204 | define ('CP_CALENDAR_ID',$myrows[0]->id); |
| 205 | define ('CPABC_CALENDAR_ON_PUBLIC_WEBSITE',true); |
| 206 | ob_start(); |
| 207 | @include_once dirname( __FILE__ ) . '/cpabc_appointments_admin_int.inc.php'; |
| 208 | $buffered_contents = ob_get_contents(); |
| 209 | ob_end_clean(); |
| 210 | } |
| 211 | return $buffered_contents; |
| 212 | } |
| 213 | |
| 214 | |
| 215 | function cpabc_appointments_filter_list($atts) { |
| 216 | global $wpdb; |
| 217 | extract( shortcode_atts( array( |
| 218 | 'calendar' => '', |
| 219 | 'user' => '', |
| 220 | 'group' => 'no', |
| 221 | 'fields' => 'DATE,TIME,NAME', |
| 222 | 'from' => "today", |
| 223 | 'to' => "today +90 days", |
| 224 | ), $atts ) ); |
| 225 | |
| 226 | $from = date("Y-m-d 00:00:00", strtotime($from)); |
| 227 | $to = date("Y-m-d 23:59:59", strtotime($to)); |
| 228 | $group = strtolower($group); |
| 229 | |
| 230 | if ($calendar != '') |
| 231 | define ('CPABC_CALENDAR_FIXED_ID', intval($calendar)); |
| 232 | else if ($user != '') |
| 233 | { |
| 234 | $users = $wpdb->get_results( "SELECT user_login,ID FROM ".$wpdb->users." WHERE user_login='".esc_sql($user)."'" ); |
| 235 | if (isset($users[0])) |
| 236 | define ('CPABC_CALENDAR_USER',$users[0]->ID); |
| 237 | else |
| 238 | define ('CPABC_CALENDAR_USER',0); |
| 239 | } |
| 240 | else |
| 241 | define ('CPABC_CALENDAR_USER',0); |
| 242 | |
| 243 | if (defined('CPABC_CALENDAR_USER') && CPABC_CALENDAR_USER != 0) |
| 244 | $myrows = $wpdb->get_results( "SELECT * FROM ".CPABC_APPOINTMENTS_CONFIG_TABLE_NAME." WHERE conwer=".CPABC_CALENDAR_USER." AND caldeleted=0" ); |
| 245 | else if (defined('CPABC_CALENDAR_FIXED_ID')) |
| 246 | $myrows = $wpdb->get_results( "SELECT * FROM ".CPABC_APPOINTMENTS_CONFIG_TABLE_NAME." WHERE id=".CPABC_CALENDAR_FIXED_ID." AND caldeleted=0" ); |
| 247 | else |
| 248 | $myrows = $wpdb->get_results( "SELECT * FROM ".CPABC_APPOINTMENTS_CONFIG_TABLE_NAME." WHERE caldeleted=0" ); |
| 249 | |
| 250 | if (!defined('CP_CALENDAR_ID')) define ('CP_CALENDAR_ID',$myrows[0]->id); |
| 251 | |
| 252 | ob_start(); |
| 253 | echo '<link rel="stylesheet" type="text/css" href="'.plugins_url('../TDE_AppCalendar/'.cpabc_get_option('calendar_theme','modern/').'all-css.css', __FILE__).'" />'; |
| 254 | $fields = explode(",",$fields); |
| 255 | $last_date = ''; |
| 256 | $mycalendarrows = $wpdb->get_results( "SELECT * FROM ".CPABC_TDEAPP_CALENDAR_DATA_TABLE ." INNER JOIN ".CPABC_APPOINTMENTS_TABLE_NAME." on ".CPABC_APPOINTMENTS_TABLE_NAME.".id=".CPABC_TDEAPP_CALENDAR_DATA_TABLE.".reference WHERE datatime>='".$from."' AND datatime<='".$to."' AND appointment_calendar_id=".CP_CALENDAR_ID." ORDER BY datatime ASC"); |
| 257 | for($f=0; $f<count($mycalendarrows); $f++) { |
| 258 | $params = unserialize($mycalendarrows[$f]->buffered_date); |
| 259 | $params["CALENDAR"] = $mycalendarrows[$f]->appointment_calendar_id; |
| 260 | $newline = ($last_date != $mycalendarrows[$f]->booked_time_unformatted); |
| 261 | if ($group != 'yes' || $newline) |
| 262 | { |
| 263 | echo '<div class="cpabc_field_clear"></div>'; |
| 264 | } |
| 265 | for ($k=0; $k < count($fields); $k++) |
| 266 | { |
| 267 | $fieldname = trim($fields[$k]); |
| 268 | if ($group == 'yes') |
| 269 | { |
| 270 | if ($newline || ($fieldname != "DATE" && $fieldname != "TIME")) |
| 271 | { |
| 272 | echo '<div class="cpabc_field_'.$k.'">'; |
| 273 | echo (@$params[$fieldname]); |
| 274 | if ($fieldname != "DATE" && $fieldname != "TIME") |
| 275 | { |
| 276 | while ($f<count($mycalendarrows) && @$mycalendarrows[$f+1]->booked_time_unformatted == @$mycalendarrows[$f]->booked_time_unformatted) |
| 277 | { |
| 278 | $f++; |
| 279 | $params = unserialize($mycalendarrows[$f]->buffered_date); |
| 280 | echo ", ".@$params[$fieldname]; |
| 281 | } |
| 282 | $k = count($fields); |
| 283 | } |
| 284 | echo '</div>'; |
| 285 | } |
| 286 | } |
| 287 | else |
| 288 | echo '<div class="cpabc_field_'.$k.'">'.(@$params[$fieldname]).'</div>'; |
| 289 | } |
| 290 | $last_date = $mycalendarrows[$f]->booked_time_unformatted; |
| 291 | } |
| 292 | echo '<div class="cpabc_field_clear"></div>'; |
| 293 | $buffered_contents = ob_get_contents(); |
| 294 | ob_end_clean(); |
| 295 | return $buffered_contents; |
| 296 | } |
| 297 | |
| 298 | |
| 299 | |
| 300 | function cpabc_appointments_get_public_form() { |
| 301 | |
| 302 | global $wpdb; |
| 303 | |
| 304 | $myrows = $wpdb->get_results( "SELECT * FROM ".CPABC_APPOINTMENTS_CONFIG_TABLE_NAME." WHERE id=1" ); |
| 305 | |
| 306 | if (!defined('CP_CALENDAR_ID')) |
| 307 | define ('CP_CALENDAR_ID',1); |
| 308 | |
| 309 | $button_label = cpabc_get_option('vs_text_submitbtn', 'Continue'); |
| 310 | $button_label = ($button_label==''?'Continue':$button_label); |
| 311 | |
| 312 | $previous_label = __("Previous",'appointment-booking-calendar'); |
| 313 | $next_label = __("Next",'appointment-booking-calendar'); |
| 314 | |
| 315 | wp_enqueue_script( 'jquery' ); |
| 316 | if (!isset($_GET["fl_builder"])) |
| 317 | wp_enqueue_script( 'cpabc_calendarscript', plugins_url('../TDE_AppCalendar/all-scripts.min.js?nc=4', __FILE__)); |
| 318 | |
| 319 | $calendar_items = ''; |
| 320 | foreach ($myrows as $item) |
| 321 | $calendar_items .= '<option value='.$item->id.'>'.$item->uname.'</option>'; |
| 322 | |
| 323 | $cpabc_buffer = ""; |
| 324 | $services = array(); |
| 325 | |
| 326 | |
| 327 | $codes = $wpdb->get_results( 'SELECT * FROM '.CPABC_APPOINTMENTS_DISCOUNT_CODES_TABLE_NAME.' WHERE `cal_id`='.CP_CALENDAR_ID); |
| 328 | |
| 329 | $quant_buffer = ''; |
| 330 | if (CPABC_APPOINTMENTS_ENABLE_QUANTITY_FIELD) |
| 331 | { |
| 332 | $quant_buffer = __('Quantity','appointment-booking-calendar').':<br /><select id="abc_capacity" name="abc_capacity" onchange="apc_clear_date();">'; |
| 333 | for ($i=1; $i<=CPABC_APPOINTMENTS_ENABLE_QUANTITY_FIELD; $i++) |
| 334 | $quant_buffer .= '<option'.($i==1?' selected="selected"':'').'>'.$i.'</option>'; |
| 335 | $quant_buffer .= '</select><br />'; |
| 336 | } |
| 337 | |
| 338 | ?> |
| 339 | </p> <!-- this p tag fixes a IE bug --> |
| 340 | <link rel="stylesheet" type="text/css" href="<?php echo plugins_url('../TDE_AppCalendar/'.(is_admin()?'':cpabc_get_option('calendar_theme','modern/')).'all-css.css', __FILE__); ?>" /> |
| 341 | <script> |
| 342 | var pathCalendar = "<?php echo cpabc_appointment_get_site_url(); ?>"; |
| 343 | var cpabc_global_date_format = '<?php echo cpabc_get_option('calendar_dateformat', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_DATEFORMAT); ?>'; |
| 344 | var cpabc_global_military_time = '<?php echo cpabc_get_option('calendar_militarytime', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_MILITARYTIME); ?>'; |
| 345 | var cpabc_global_start_weekday = '<?php echo cpabc_get_option('calendar_weekday', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_WEEKDAY); ?>'; |
| 346 | var cpabc_global_mindate = '<?php $value = cpabc_get_option('calendar_mindate', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_MINDATE); if ($value != '') echo date("n/j/Y", strtotime($value)); ?>'; |
| 347 | var cpabc_global_maxdate = '<?php $value = cpabc_get_option('calendar_maxdate', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_MAXDATE); if ($value != '') echo date("n/j/Y",strtotime($value)); ?>'; |
| 348 | var cpabc_global_close_on_select = <?php $value = cpabc_get_option('close_fpanel', 'yes'); if ($value == '' || $value == 'yes') echo 'true'; else echo 'false'; ?>; |
| 349 | var cpabc_global_cancel_text = '<?php _e("Cancel",'appointment-booking-calendar'); ?>'; |
| 350 | var cpabc_global_pagedate = '<?php |
| 351 | $sm = cpabc_get_option('calendar_startmonth', date("n")); |
| 352 | $sy = cpabc_get_option('calendar_startyear', date("Y")); |
| 353 | if ($sm=='0' || $sm=='') $sm = date("n"); |
| 354 | if ($sy=='0' || $sy=='') $sy = date("Y"); |
| 355 | echo $sm."/".$sy; |
| 356 | ?>'; |
| 357 | </script> |
| 358 | <script type="text/javascript"> |
| 359 | var cpabc_current_calendar_item; |
| 360 | var cpabc_current_calendar_initialized = false; |
| 361 | function apc_clear_date() |
| 362 | { |
| 363 | document.getElementById("selDaycal"+cpabc_current_calendar_item ).value = ""; |
| 364 | cpabc_updateItem(); |
| 365 | } |
| 366 | function cpabc_updateItem() |
| 367 | { |
| 368 | document.getElementById("calarea_"+cpabc_current_calendar_item).style.display = "none"; |
| 369 | var i = document.FormEdit.cpabc_item.options.selectedIndex; |
| 370 | var selecteditem = document.FormEdit.cpabc_item.options[i].value; |
| 371 | cpabc_do_init(selecteditem); |
| 372 | } |
| 373 | function cpabc_do_init(id) |
| 374 | { |
| 375 | try { |
| 376 | cpabc_current_calendar_item = id; |
| 377 | document.getElementById("calarea_"+cpabc_current_calendar_item).style.display = ""; |
| 378 | <?php if (!isset($_GET["fl_builder"])) { ?>initAppCalendar("cal"+cpabc_current_calendar_item,<?php echo (is_admin()?'3':cpabc_get_option('calendar_pages', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_PAGES)); ?>,2,"<?php echo cpabc_auto_language(cpabc_get_option('calendar_language', CPABC_APPOINTMENTS_DEFAULT_CALENDAR_LANGUAGE)); ?>",{m1:"<?php _e('Please select the appointment time.','appointment-booking-calendar'); ?>"});<?php } ?> |
| 379 | cpabc_current_calendar_initialized = true; |
| 380 | } catch (e) {} |
| 381 | } |
| 382 | function updatedate() |
| 383 | { |
| 384 | if (document.getElementById("selDaycal"+cpabc_current_calendar_item ).value != '') |
| 385 | { |
| 386 | var timead = ""; |
| 387 | var hour = document.getElementById("selHourcal"+cpabc_current_calendar_item ).value; |
| 388 | if (cpabc_global_military_time == '0') |
| 389 | { |
| 390 | if (parseInt(hour) > 12) |
| 391 | { |
| 392 | timead = " pm"; |
| 393 | hour = parseInt(hour)-12; |
| 394 | } |
| 395 | else |
| 396 | timead = " am"; |
| 397 | } |
| 398 | var minute = document.getElementById("selMinutecal"+cpabc_current_calendar_item ).value; |
| 399 | if (minute.length == 1) |
| 400 | minute = "0"+minute; |
| 401 | minute = hour + ":" + minute + timead; |
| 402 | } |
| 403 | } |
| 404 | </script> |
| 405 | <?php |
| 406 | $current_user = wp_get_current_user(); |
| 407 | define('CPABC_AUTH_INCLUDE', true); |
| 408 | @include dirname( __FILE__ ) . '/cpabc_scheduler.inc.php'; |
| 409 | ?> |
| 410 | <script type="text/javascript"> |
| 411 | var cpabc_click_enabled = true; |
| 412 | var cpabc_max_slots = <?php $opt = cpabc_get_option('max_slots', '1'); if ($opt == '') $opt = '1'; echo $opt; ?>; |
| 413 | var cpabc_max_slots_text = '<?php echo str_replace("'","\'",__('Please select a maximum of %1 time-slots. Currently selected: %2 time-slots.','appointment-booking-calendar')); ?>'; |
| 414 | cpabc_max_slots_text = cpabc_max_slots_text.replace('%1',cpabc_max_slots); |
| 415 | cpabc_max_slots_text = cpabc_max_slots_text.replace('%2',cpabc_max_slots); |
| 416 | cpabc_current_calendar_item = <?php echo $myrows[0]->id; ?>; |
| 417 | cpabc_do_init(cpabc_current_calendar_item); |
| 418 | setInterval('updatedate()',200); |
| 419 | function doValidate(form) |
| 420 | { |
| 421 | if (!cpabc_click_enabled) return false; |
| 422 | var visitortime = new Date(); |
| 423 | form.cpabc_appointments_utime.value = "GMT " + -visitortime.getTimezoneOffset()/60; |
| 424 | if (form.phone.value == '') |
| 425 | { |
| 426 | alert('<?php echo str_replace("'","\'",__('Please enter a valid phone number','appointment-booking-calendar')); ?>.'); |
| 427 | return false; |
| 428 | } |
| 429 | if (form.email.value == '') |
| 430 | { |
| 431 | alert('<?php echo str_replace("'","\'",__('Please enter a valid email address','appointment-booking-calendar')); ?>.'); |
| 432 | return false; |
| 433 | } |
| 434 | if (form.name.value == '') |
| 435 | { |
| 436 | alert('<?php echo str_replace("'","\'",__('Please write your name','appointment-booking-calendar')); ?>.'); |
| 437 | return false; |
| 438 | } |
| 439 | var selst = ""+document.getElementById("selDaycal"+cpabc_current_calendar_item).value; |
| 440 | if (selst == '') |
| 441 | { |
| 442 | alert('<?php echo str_replace("'","\'",__('Please select date and time','appointment-booking-calendar')); ?>.'); |
| 443 | return false; |
| 444 | } |
| 445 | selst = selst.match(/;/g);selst = selst.length; |
| 446 | if (selst < <?php $opt = cpabc_get_option('min_slots', '1'); if ($opt == '') $opt = '1'; echo $opt; ?>) |
| 447 | { |
| 448 | var almsg = '<?php echo str_replace("'","\'",__('Please select at least %1 time-slots. Currently selected: %2 time-slots.','appointment-booking-calendar')); ?>'; |
| 449 | almsg = almsg.replace('%1','<?php echo $opt; ?>'); |
| 450 | almsg = almsg.replace('%2',selst); |
| 451 | alert(almsg); |
| 452 | return false; |
| 453 | } |
| 454 | if (selst > <?php $opt = cpabc_get_option('max_slots', '1'); if ($opt == '') $opt = '1'; echo $opt; ?>) |
| 455 | { |
| 456 | var almsg = '<?php echo str_replace("'","\'",__('Please select a maximum of %1 time-slots. Currently selected: %2 time-slots.','appointment-booking-calendar')); ?>'; |
| 457 | almsg = almsg.replace('%1','<?php echo $opt; ?>'); |
| 458 | almsg = almsg.replace('%2',selst); |
| 459 | alert(almsg); |
| 460 | return false; |
| 461 | } |
| 462 | <?php if (!is_admin() && cpabc_get_option('dexcv_enable_captcha', CPABC_TDEAPP_DEFAULT_dexcv_enable_captcha) != 'false') { ?> if (form.hdcaptcha.value == '') |
| 463 | { |
| 464 | alert('<?php echo str_replace("'","\'",__('Please enter the captcha verification code','appointment-booking-calendar')); ?>.'); |
| 465 | return false; |
| 466 | } |
| 467 | $dexQuery = jQuery.noConflict(); |
| 468 | var result = $dexQuery.ajax({ |
| 469 | type: "GET", |
| 470 | url: "<?php echo cpabc_appointment_get_site_url(); ?>?inAdmin=1"+String.fromCharCode(38)+"abcc=1"+String.fromCharCode(38)+"hdcaptcha="+form.hdcaptcha.value, |
| 471 | async: false |
| 472 | }).responseText; |
| 473 | if (result.indexOf("captchafailed") != -1) |
| 474 | { |
| 475 | $dexQuery("#captchaimg").attr('src', $dexQuery("#captchaimg").attr('src')+String.fromCharCode(38)+Math.floor((Math.random() * 99999) + 1)); |
| 476 | alert('<?php echo str_replace("'","\'",__('Incorrect captcha code. Please try again.','appointment-booking-calendar')); ?>'); |
| 477 | return false; |
| 478 | } |
| 479 | else <?php } ?> |
| 480 | { |
| 481 | cpabc_click_enabled = false; |
| 482 | cpabc_blink(".cp_subbtn"); |
| 483 | return true; |
| 484 | } |
| 485 | } |
| 486 | function cpabc_blink(selector){ |
| 487 | try |
| 488 | { |
| 489 | $dexQuery = jQuery.noConflict(); |
| 490 | $dexQuery(selector).fadeOut(1000, function(){ |
| 491 | $dexQuery(this).fadeIn(1000, function(){ |
| 492 | if (!cpabc_click_enabled) |
| 493 | cpabc_blink(this); |
| 494 | }); |
| 495 | }); |
| 496 | } catch (e) {} |
| 497 | } |
| 498 | </script> |
| 499 | <?php |
| 500 | } |
| 501 | |
| 502 | |
| 503 | function cpabc_appointments_show_booking_form($id = "") |
| 504 | { |
| 505 | if ($id != '') |
| 506 | define ('CPABC_CALENDAR_FIXED_ID',$id); |
| 507 | define('CPABC_AUTH_INCLUDE', true); |
| 508 | cpabc_appointments_get_public_form(); |
| 509 | } |
| 510 | |
| 511 | /* Code for the admin area */ |
| 512 | |
| 513 | function cpabc_settingsLink($links) { |
| 514 | $settings_link = '<a href="admin.php?page=cpabc_appointments.php">'.__('Settings','appointment-booking-calendar').'</a>'; |
| 515 | array_unshift($links, $settings_link); |
| 516 | return $links; |
| 517 | } |
| 518 | |
| 519 | |
| 520 | function cpabc_helpLink($links) { |
| 521 | $help_link = '<a href="https://abc.dwbooster.com/support">'.__('Help','appointment-booking-calendar').'</a>'; |
| 522 | array_unshift($links, $help_link); |
| 523 | return $links; |
| 524 | } |
| 525 | |
| 526 | function cpabc_customAdjustmentsLink($links) { |
| 527 | $customAdjustments_link = '<a href="https://abc.dwbooster.com/download">'.__('Upgrade To Premium','appointment-booking-calendar').'</a>'; |
| 528 | array_unshift($links, $customAdjustments_link); |
| 529 | return $links; |
| 530 | } |
| 531 | |
| 532 | function cpabc_appointments_html_post_page() { |
| 533 | global $wpdb; |
| 534 | if ((cpabc_get_get_param("cal") != '') || ( cpabc_get_get_param("cal") == '0' || cpabc_get_get_param("pwizard") == '1')) |
| 535 | { |
| 536 | $_GET["cal"] = intval(cpabc_get_get_param("cal")); |
| 537 | if (isset($_GET["edit"]) && $_GET["edit"] == '1') |
| 538 | @include_once dirname( __FILE__ ) . '/cp_admin_int_edition.inc.php'; |
| 539 | else if (isset($_GET["list"]) && $_GET["list"] == '1') |
| 540 | @include_once dirname( __FILE__ ) . '/cpabc_appointments_admin_int_bookings_list.inc.php'; |
| 541 | else if (isset($_GET["calschedule"]) && $_GET["calschedule"] == '1') |
| 542 | @include_once dirname( __FILE__ ) . '/../mv/calendar_schedule.inc.php'; |
| 543 | else if (cpabc_get_get_param("pwizard") == '1') |
| 544 | @include_once dirname( __FILE__ ) . '/cpabc_publish_wizzard.inc.php'; |
| 545 | else if (isset($_GET["addbk"]) && $_GET["addbk"] == '1') |
| 546 | @include_once dirname( __FILE__ ) . '/cpabc_appointments_admin_addbk.inc.php'; |
| 547 | else |
| 548 | @include_once dirname( __FILE__ ) . '/cpabc_appointments_admin_int.inc.php'; |
| 549 | } |
| 550 | else |
| 551 | { |
| 552 | if (isset($_GET["page"]) &&$_GET["page"] == 'cpabc_appointments_upgrade') |
| 553 | { |
| 554 | echo("Redirecting to upgrade page...<script type='text/javascript'>document.location='https://abc.dwbooster.com/download';</script>"); |
| 555 | exit; |
| 556 | } |
| 557 | else if (isset($_GET["page"]) &&$_GET["page"] == 'cpabc_appointments_support') |
| 558 | { |
| 559 | echo("Redirecting to support page...<script type='text/javascript'>document.location='https://wordpress.org/support/plugin/appointment-booking-calendar#new-post';</script>"); |
| 560 | exit; |
| 561 | } |
| 562 | else if (isset($_GET["page"]) &&$_GET["page"] == 'cpabc_appointments_demo') |
| 563 | { |
| 564 | echo("Redirecting to demo page...<script type='text/javascript'>document.location='https://abc.dwbooster.com/home#demos';</script>"); |
| 565 | exit; |
| 566 | } |
| 567 | else |
| 568 | @include_once dirname( __FILE__ ) . '/cpabc_appointments_admin_int_calendar_list.inc.php'; |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | |
| 573 | function set_cpabc_apps_insert_button() { |
| 574 | print '<a href="javascript:send_to_editor(\'[CPABC_APPOINTMENT_CALENDAR calendar="1"]\');" title="'.__('Insert Appointment Booking Calendar').'"><img hspace="5" src="'.plugins_url('../images/cpabc_apps.gif', __FILE__).'" alt="'.__('Insert Appointment Booking Calendar','appointment-booking-calendar').'" /></a>'; |
| 575 | } |
| 576 | |
| 577 | |
| 578 | function set_cpabc_apps_insert_adminScripts($hook) { |
| 579 | if (isset($_GET["cal"]) && $_GET["cal"] != '' && isset($_GET["page"]) && $_GET["page"] == 'cpabc_appointments.php') |
| 580 | { |
| 581 | wp_enqueue_script( 'jquery' ); |
| 582 | wp_enqueue_script( 'jquery-ui-core' ); |
| 583 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 584 | wp_enqueue_script( 'tinymce_js', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array( 'jquery' ), false, true ); |
| 585 | |
| 586 | if (isset($_GET["calschedule"]) && $_GET["calschedule"] == '1') |
| 587 | { |
| 588 | wp_enqueue_script( 'jquery-ui-dialog' ); |
| 589 | |
| 590 | wp_enqueue_script( 'cpabc_mvuscore', plugins_url('../mv/js/underscore.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 591 | wp_enqueue_script( 'cpabc_mvrrule', plugins_url('../mv/js/rrule.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 592 | wp_enqueue_script( 'cpabc_mvcommon', plugins_url('../mv/js/Common.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 593 | |
| 594 | if (file_exists(dirname( __FILE__ ).'../mv/language/multiview_lang_'.cpabc_mv_autodetect_language().'.js')) |
| 595 | $langscript = plugins_url('../mv/language/multiview_lang_'.cpabc_mv_autodetect_language().'.js', __FILE__); |
| 596 | else |
| 597 | $langscript = plugins_url('../mv/language/multiview_lang_en_GB.js', __FILE__); |
| 598 | wp_enqueue_script( 'cpabc_mvlanguage', $langscript, array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 599 | |
| 600 | wp_enqueue_script( 'cpabc_mvcalendar', plugins_url('../mv/js/jquery.calendar.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 601 | wp_enqueue_script( 'cpabc_mvjalert', plugins_url('../mv/js/jquery.alert.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 602 | wp_enqueue_script( 'cpabc_mvmsjs', plugins_url('../mv/js/multiview.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 603 | |
| 604 | wp_enqueue_style('cpabc-schedulecalendar', plugins_url('../mv/css/cupertino/calendar.css', __FILE__)); |
| 605 | wp_enqueue_style('cpabc-schedulemain', plugins_url('../mv/css/main.css', __FILE__)); |
| 606 | } |
| 607 | |
| 608 | if (isset($_GET["addbk"]) && $_GET["addbk"] == '1') |
| 609 | { |
| 610 | wp_enqueue_script( 'cpabc_repeat', plugins_url('../js/repeat.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' )); |
| 611 | wp_enqueue_script( 'cpabc_rrule', plugins_url('../js/rrule.js', __FILE__), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker' ) ); |
| 612 | } |
| 613 | wp_enqueue_style('jquery-ui-datepicker', plugins_url('../TDE_AppCalendar/cupertino/jquery-ui-1.8.20.custom.css', __FILE__)); |
| 614 | |
| 615 | if (!isset($_GET["addbk"])) |
| 616 | { |
| 617 | wp_enqueue_style('cpabc-allstyle', plugins_url('../TDE_AppCalendar/all-css.css', __FILE__)); |
| 618 | wp_enqueue_script( 'cpabc_alljs', plugins_url('../TDE_AppCalendar/all-scripts.min.js', __FILE__)); |
| 619 | wp_enqueue_script( 'cpabc_tabview', plugins_url('../TDE_AppCalendar/tabview.js', __FILE__), array('cpabc_alljs')); |
| 620 | wp_enqueue_script( 'cpabc_simpleeditor', plugins_url('../TDE_AppCalendar/simpleeditor-beta-min.js', __FILE__), array('cpabc_alljs')); |
| 621 | } |
| 622 | wp_enqueue_style('cpabc-sestyle', plugins_url('../TDE_AppCalendar/simpleeditor.css', __FILE__)); |
| 623 | wp_enqueue_style('cpabc-tbstyle', plugins_url('../TDE_AppCalendar/tabview.css', __FILE__)); |
| 624 | } |
| 625 | if( 'post.php' != $hook && 'post-new.php' != $hook ) |
| 626 | return; |
| 627 | } |
| 628 | |
| 629 | |
| 630 | function cpabc_export_iCal() { |
| 631 | global $wpdb; |
| 632 | header("Content-type: application/octet-stream"); |
| 633 | header("Content-Disposition: attachment; filename=events".date("Y-M-D_H.i.s").".ics"); |
| 634 | |
| 635 | define('CPABC_CAL_TIME_ZONE_MODIFY',get_option('CPABC_CAL_TIME_ZONE_MODIFY_SET'," +0 hours")); |
| 636 | define('CPABC_CAL_TIME_SLOT_SIZE'," +".get_option('CPABC_CAL_TIME_SLOT_SIZE_SET',"30")." minutes"); |
| 637 | |
| 638 | echo "BEGIN:VCALENDAR\n"; |
| 639 | echo "PRODID:-//Net-Factor CodePeople//Appointment Booking Calendar for WordPress//EN\n"; |
| 640 | echo "VERSION:2.0\n"; |
| 641 | echo "CALSCALE:GREGORIAN\n"; |
| 642 | echo "METHOD:PUBLISH\n"; |
| 643 | echo "X-WR-CALNAME:Bookings\n"; |
| 644 | echo "X-WR-TIMEZONE:Europe/London\n"; |
| 645 | echo "BEGIN:VTIMEZONE\n"; |
| 646 | echo "TZID:Europe/Stockholm\n"; |
| 647 | echo "X-LIC-LOCATION:Europe/London\n"; |
| 648 | echo "BEGIN:DAYLIGHT\n"; |
| 649 | echo "TZOFFSETFROM:+0000\n"; |
| 650 | echo "TZOFFSETTO:+0100\n"; |
| 651 | echo "TZNAME:CEST\n"; |
| 652 | echo "DTSTART:19700329T020000\n"; |
| 653 | echo "RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\n"; |
| 654 | echo "END:DAYLIGHT\n"; |
| 655 | echo "BEGIN:STANDARD\n"; |
| 656 | echo "TZOFFSETFROM:+0100\n"; |
| 657 | echo "TZOFFSETTO:+0000\n"; |
| 658 | echo "TZNAME:CET\n"; |
| 659 | echo "DTSTART:19701025T030000\n"; |
| 660 | echo "RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\n"; |
| 661 | echo "END:STANDARD\n"; |
| 662 | echo "END:VTIMEZONE\n"; |
| 663 | |
| 664 | $events = $wpdb->get_results( "SELECT * FROM ".CPABC_APPOINTMENTS_CALENDARS_TABLE_NAME." WHERE appointment_calendar_id=".intval($_GET["id"])." ORDER BY datatime ASC" ); |
| 665 | foreach ($events as $event) |
| 666 | { |
| 667 | echo "BEGIN:VEVENT\n"; |
| 668 | echo "DTSTART:".date("Ymd",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."T".date("His",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."Z\n"; |
| 669 | echo "DTEND:".date("Ymd",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."T".date("His",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY.CPABC_CAL_TIME_SLOT_SIZE))."Z\n"; |
| 670 | echo "DTSTAMP:".date("Ymd",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."T".date("His",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."Z\n"; |
| 671 | echo "UID:uid".$event->id."@".$_SERVER["SERVER_NAME"]."\n"; |
| 672 | echo "CREATED:".date("Ymd",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."T".date("His",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."Z\n"; |
| 673 | echo "DESCRIPTION:".str_replace("<br>",'\n',str_replace("<br />",'\n',str_replace("\r",'',str_replace("\n",'\n',$event->description)) ))."\n"; |
| 674 | echo "LAST-MODIFIED:".date("Ymd",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."T".date("His",strtotime($event->datatime.CPABC_CAL_TIME_ZONE_MODIFY))."Z\n"; |
| 675 | echo "LOCATION:\n"; |
| 676 | echo "SEQUENCE:0\n"; |
| 677 | echo "STATUS:CONFIRMED\n"; |
| 678 | echo "SUMMARY:Booking from ".str_replace("\n",'\n',$event->title)."\n"; |
| 679 | echo "TRANSP:OPAQUE\n"; |
| 680 | echo "END:VEVENT\n"; |
| 681 | |
| 682 | |
| 683 | } |
| 684 | echo 'END:VCALENDAR'; |
| 685 | exit; |
| 686 | } |
| 687 | |
| 688 | function cpabc_mv_autodetect_language() |
| 689 | { |
| 690 | $basename = '/language/multiview_lang_'; |
| 691 | |
| 692 | $binfo = str_replace('-','_',get_bloginfo('language')); |
| 693 | |
| 694 | $options = array ($binfo, |
| 695 | strtolower($binfo), |
| 696 | substr(strtolower($binfo),0,2)."_".substr(strtoupper($binfo),strlen(strtoupper($binfo))-2,2), |
| 697 | substr(strtolower($binfo),0,2), |
| 698 | substr(strtolower($binfo),strlen(strtolower($binfo))-2,2) |
| 699 | ); |
| 700 | foreach ($options as $option) |
| 701 | { |
| 702 | if (file_exists(dirname( __FILE__ ).$basename.$option.'.js')) |
| 703 | return $option; |
| 704 | $option = str_replace ("-","_", $option); |
| 705 | if (file_exists(dirname( __FILE__ ).$basename.$option.'.js')) |
| 706 | return $option; |
| 707 | } |
| 708 | return ''; |
| 709 | } |
| 710 | |
| 711 | require_once 'cpabc_apps_go.inc.php'; |
| 712 | |
| 713 | ?> |