0) { $row=mysqli_fetch_row($rslt); $non_latin = $row[0]; $SSoutbound_autodial_active = $row[1]; $slave_db_server = $row[2]; $reports_use_slave_db = $row[3]; $user_territories_active = $row[4]; $webroot_writable = $row[5]; $allow_emails = $row[6]; $SSlevel_8_disable_add = $row[7]; $SSenable_languages = $row[8]; $SSlanguage_method = $row[9]; $log_recording_access = $row[10]; $SSadmin_screen_colors = $row[11]; $SSmute_recordings = $row[12]; $sounds_web_server = $row[13]; $sounds_web_directory = $row[14]; $admin_web_dir = $row[15]; $SSallow_web_debug = $row[16]; } if (!preg_match('/^http/', $sounds_web_server)) {$http_prefix="http://";} else {$http_prefix="";} if ($SSallow_web_debug < 1) {$DB=0;} ##### END SETTINGS LOOKUP ##### ########################################### $DB=preg_replace("/[^0-9a-zA-Z]/","",$DB); $from_date = preg_replace('/[^\-0-9]/', '', $from_date); $from_hour = preg_replace('/[^0-9]/', '', $from_hour); $from_min = preg_replace('/[^0-9]/', '', $from_min); $to_date = preg_replace('/[^\-0-9]/', '', $to_date); $to_hour = preg_replace('/[^0-9]/', '', $to_hour); $to_min = preg_replace('/[^0-9]/', '', $to_min); $insert_flag = preg_replace('/[^0-9]/', '', $insert_flag); $interval_id = preg_replace('/[^0-9]/', '', $interval_id); if ($non_latin < 1) { $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW); $default_submit = preg_replace('/[^-_\s0-9a-zA-Z]/', '', $default_submit); $location = preg_replace('/[^-_0-9a-zA-Z]/', '', $location); $message_type = preg_replace('/[^a-zA-Z]/', '', $message_type); $audio_file = preg_replace('/[^-_0-9a-zA-Z]/', '', $audio_file); $meeting_field = preg_replace('/[^-_0-9a-zA-Z]/', '', $meeting_field); $closed_field = preg_replace('/[^-_0-9a-zA-Z]/', '', $closed_field); $weather_field = preg_replace('/[^-_0-9a-zA-Z]/', '', $weather_field); $holiday_field = preg_replace('/[^-_0-9a-zA-Z]/', '', $holiday_field); $custom_field = preg_replace('/[^-_0-9a-zA-Z]/', '', $custom_field); $holiday_id = preg_replace('/[^-_0-9a-zA-Z]/','',$holiday_id); $action = preg_replace('/[^-_0-9a-zA-Z]/', '', $action); $message = preg_replace('/[^-_0-9a-zA-Z]/', '', $message); } else { $PHP_AUTH_USER = preg_replace('/[^\-_0-9\p{L}]/u', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^\-_0-9\p{L}]/u', '', $PHP_AUTH_PW); $default_submit = preg_replace('/[^\-_\s0-9\p{L}]/u', '', $default_submit); $location = preg_replace('/[^\-_0-9\p{L}]/u', '', $location); $message_type = preg_replace('/[^\p{L}]/u', '', $message_type); $audio_file = preg_replace('/[^\-_0-9\p{L}]/u', '', $audio_file); $meeting_field = preg_replace('/[^\-_0-9\p{L}]/u', '', $meeting_field); $closed_field = preg_replace('/[^\-_0-9\p{L}]/u', '', $closed_field); $weather_field = preg_replace('/[^\-_0-9\p{L}]/u', '', $weather_field); $holiday_field = preg_replace('/[^-_0-9\p{L}]/', '', $holiday_field); $custom_field = preg_replace('/[^\-_\.0-9\p{L}]/u', '', $custom_field); $holiday_id = preg_replace('/[^\-_0-9\p{L}]/u','',$holiday_id); $action = preg_replace('/[^\-_0-9\p{L}]/u', '', $action); $message = preg_replace('/[^\-_0-9\p{L}]/u', '', $message); } $user_auth=0; $auth=0; $reports_auth=0; $qc_auth=0; $auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'QC',1,0); if ($auth_message == 'GOOD') {$user_auth=1;} if ($auth_message == 'GOOD') {$user_auth=1;} if ($user_auth > 0) { $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and api_only_user != '1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $auth=$row[0]; $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1' and api_only_user != '1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $reports_auth=$row[0]; $stmt="select user_level, user_group from vicidial_users where user='$PHP_AUTH_USER'"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $user_level=$row[0]; $reports_only_user=0; $qc_only_user=0; if ( ($reports_auth > 0) and ($auth < 1) ) { $ADD=999999; $reports_only_user=1; } if ( ($reports_auth < 1) and ($auth < 1) ) { if ( ($ADD != '881') and ($ADD != '100000000000000') ) { $ADD=100000000000000; } $qc_only_user=1; } if ( ($reports_auth < 1) and ($auth < 1) ) { $VDdisplayMESSAGE = _QXZ("You do not have permission to be here"); Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } if ( (strlen($VUuser_admin_redirect_url) > 5) and ($SSuser_admin_redirect > 0) ) { Header('Location: '.$VUuser_admin_redirect_url); echo""._QXZ("Admin Redirect")."\n"; echo"\n"; echo"\n"; echo"\n"; echo"\n"; echo""._QXZ("click here to continue").". . .\n"; exit; } } else { $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); if ($auth_message == 'LOCK') { $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } if ($auth_message == 'IPBLOCK') { $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); Header("HTTP/1.0 401 Unauthorized"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; exit; } $expected_files=array("meeting", "closed", "weather", "holiday", "custom"); $container_default_str="^".implode("\s|^", $expected_files)."\s"; $audio_file_str=implode("|", $expected_files); if ($default_submit=="Set as defaults") { $upd_container_text=""; $found_files=array(); $container_stmt="select container_entry from vicidial_settings_containers where container_id='INBOUND_LINE_CONTROLS'"; $container_rslt=mysql_to_mysqli($container_stmt, $link); $container_row=mysqli_fetch_row($container_rslt); # echo "\n"; $upd_stmt="UPDATE vicidial_settings_containers set container_entry='".mysqli_escape_string($link, $upd_container_text)."' where container_id='INBOUND_LINE_CONTROLS'"; $upd_rslt=mysql_to_mysqli($upd_stmt, $link); } $container_stmt="select container_entry from vicidial_settings_containers where container_id='INBOUND_LINE_CONTROLS'"; $container_rslt=mysql_to_mysqli($container_stmt, $link); $location_array=array(); $audio_array=array(); $locations_calltimes_array=array(); $completed_days=1; if (mysqli_num_rows($container_rslt)==0) { echo "ERROR: This feature requires a settings container named 'INBOUND_LINE_CONTROLS'"; echo ($user_level==9 ? "

Create a new settings container here" : ""); echo "

Go back to admin"; exit; } $location_restrictions=array(); $event_restrictions=array(); while ($container_row=mysqli_fetch_row($container_rslt)) { $inbound_instructions=explode("\n", $container_row[0]); for ($i=0; $i/', $inbound_instructions[$i])) { $instructions=explode("=>", $inbound_instructions[$i]); if (preg_match('/^minimum_required_level_locations/', $instructions[0])) { $instructions[1]=preg_replace("/\s/", "", $instructions[1]); $location_sets=explode("|", $instructions[1]); for ($j=0; $j $required_user_level) { if($user_level<$required_user_level) { if (($index = array_search($current_location, $location_array)) !== false) { unset($location_array[$index]); } } } $location_array=array_values($location_array); foreach ($locations_calltimes_array as $active_location => $array) { $locations_calltimes_array["$active_location"]=array_unique($array); } if ($action=="get_local_time") { echo date("Y-m-d-H-i"); exit; } if ($audio_file && $action=="move_audio_file") { $temp_filename = "../agc/polly/generated/".$audio_file; passthru("cp $temp_filename ../$sounds_web_directory/"); $success_msg="SUCCESS"."\n***"; echo trim($success_msg); $stmt="UPDATE servers SET sounds_update='Y';"; $rslt=mysql_to_mysqli($stmt, $link); ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt="INSERT INTO vicidial_admin_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='AUDIOSTORE', event_type='COPY', record_id='manualupload', event_code='$audio_file', event_sql=\"$SQL_log\", event_notes='NEW: $audio_file POLLY GENERATED';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); exit; } if ($action=="insert_interval" && $location && $message && $message_type && $from_date && $from_hour && $from_min && $to_date && $to_hour && $to_min) { $error_msg=""; $dup_stmt="select count(*) from inbound_disabled_entries where start_datetime='".$from_date." ".$from_hour.":".$from_min.":00' and end_datetime='".$to_date." ".$to_hour.":".$to_min.":00' and location in ('$location'".(preg_match('/\|/', $location) ? ", '".preg_replace('/\|/', "', '", $location)."'" : "").") and status in ('LIVE', 'ACTIVE')"; $dup_rslt=mysql_to_mysqli($dup_stmt, $link); $dup_row=mysqli_fetch_row($dup_rslt); if ($dup_row[0]>0) { $error_msg.="ERROR: This interval (".$from_date." ".$from_hour.":".$from_min.":00 to ".$to_date." ".$to_hour.":".$to_min.":00 for ".preg_replace('/\|/', ", ", $location).") is already scheduled for a live/upcoming downtime"; # $error_msg.="
$dup_stmt"; } $msg_array=CheckHolidayConflicts($location, $locations_calltimes_array, $from_date, $from_hour, $from_min, $to_date, $to_hour, $to_min, "", 1); $error_msg.=$msg_array[0]; $ok_msg=$msg_array[1]; $interval_time_array=$msg_array[2]; # echo "ERR: $error_msg

OK: $ok_msg"; # exit; if (strlen($error_msg)==0) { $holiday_id="AG_".date("YmdHis")."_".$message_type; $ins_stmt="INSERT INTO inbound_disabled_entries(start_datetime, end_datetime, location, message, message_type, user, holiday_id) VALUES('".$from_date." ".$from_hour.":".$from_min.":00', '".$to_date." ".$to_hour.":".$to_min.":00', '$location', '$message', '$message_type', '$PHP_AUTH_USER', '$holiday_id')"; $ins_rslt=mysql_to_mysqli($ins_stmt, $link); if (mysqli_affected_rows($link)>0) { $h=1; foreach ($interval_time_array as $date => $times) { $VD_holiday_id=$holiday_id."_".$h; $holiday_stmt="insert into vicidial_call_time_holidays VALUES('$VD_holiday_id', 'Play $message_type $message message', 'Created by $PHP_AUTH_USER on ".date("Y-m-d H:i:s")." to be played $date', '$date', 'ACTIVE', '".$times["start"]."', '".$times["end"]."', '$message', 'LOCKED_HOLIDAY', 'ADDITION_REVERSE')"; # echo $holiday_stmt."
"; $holiday_rslt=mysql_to_mysqli($holiday_stmt, $link); $selected_locations=explode("|", $location); for ($n=0; $n0) { $row=mysqli_fetch_row($rslt); $ct_holidays = $row[0]; if (preg_match('/\|$/i',$ct_holidays)) {$ct_holidays = "$ct_holidays$VD_holiday_id\|";} else {$ct_holidays = "$ct_holidays\|$VD_holiday_id\|";} $stmt="UPDATE vicidial_call_times set ct_holidays='$ct_holidays' where call_time_id='".$call_time."';"; $rslt=mysql_to_mysqli($stmt, $link); ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt="INSERT INTO vicidial_admin_log set event_date=now(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='CALLTIMES', event_type='MODIFY', record_id='".$call_time."', event_code='ADMIN MODIFY CALL TIME ADD HOLIDAY RULE', event_sql=\"$SQL_log\", event_notes='Holiday Rule Added: $VD_holiday_id';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); } } } } $h++; } } header("Location: $PHP_SELF"); } else { # echo "ERROR: $error_msg"; } } if ($action=="update_interval" && $interval_id && $holiday_id && $from_date && $from_hour && $from_min && $to_date && $to_hour && $to_min) { $msg_array=CheckHolidayConflicts($location, $locations_calltimes_array, $from_date, $from_hour, $from_min, $to_date, $to_hour, $to_min, $holiday_id, 0); $error_msg=$msg_array[0]; $ok_msg=$msg_array[1]; $interval_time_array=$msg_array[2]; # echo "ERR: $error_msg

OK: $ok_msg"; if (strlen($error_msg)==0) { $upd_stmt="UPDATE inbound_disabled_entries set start_datetime='".$from_date." ".$from_hour.":".$from_min.":00', end_datetime='".$to_date." ".$to_hour.":".$to_min.":00', modified_by='$PHP_AUTH_USER' where interval_id='$interval_id' "; $upd_rslt=mysql_to_mysqli($upd_stmt, $link); if (mysqli_affected_rows($link)>0) { echo "SUCCESS\n"; # Get interval info in case more inserts need to be done $int_stmt="select * from inbound_disabled_entries where interval_id='$interval_id'"; $int_rslt=mysql_to_mysqli($int_stmt, $link); while($int_row=mysqli_fetch_array($int_rslt)) { $message=$int_row["message"]; $message_type=$int_row["message_type"]; $upd_location=$int_row["location"]; } $ct_stmt=""; # Update holidays table anything that is now not in the date range # $holiday_stmt="UPDATE vicidial_call_time_holidays set holiday_status='INACTIVE' where holiday_id like '$holiday_id%' and holiday_date not in ('".implode("', '", array_keys($interval_time_array))."')"; $holiday_stmt="DELETE from vicidial_call_time_holidays where holiday_id like '$holiday_id%'"; $holiday_rslt=mysql_to_mysqli($holiday_stmt, $link); $ct_stmt.="$holiday_stmt|"; # Remove old holidays $selected_locations=explode("|", $upd_location); for ($n=0; $n0) { $row=mysqli_fetch_row($rslt); $ct_holidays = $row[0]; $holiday_pattern=$holiday_id."\_[0-9]+"; $ct_holidays = preg_replace("/$holiday_pattern/i", '', $ct_holidays); $ct_holidays = preg_replace("/\|+/", '|', $ct_holidays); $stmt="UPDATE vicidial_call_times set ct_holidays='$ct_holidays' where call_time_id='".$call_time."';"; $rslt=mysql_to_mysqli($stmt, $link); } } } } /* Unnecessary with above switching to 'DELETE # Get latest ID in case update adds a new day to the range necessitating a new holiday $latest_stmt="select holiday_id from vicidial_call_time_holidays where holiday_id like '$holiday_id%' order by holiday_id desc limit 1"; $latest_rslt=mysql_to_mysqli($latest_stmt, $link); while($latest_row=mysqli_fetch_row($latest_rslt)) { $h=$latest_row[0]; $h=preg_replace("/$holiday_id/", "", $h); $h=preg_replace("/[^0-9]/", "", $h); } */ $h=1; foreach ($interval_time_array as $date => $times) { /* Unnecessary with above switching to 'DELETE #$holiday_stmt="select count(*) From vicidial_call_time_holidays where holiday_id like '$holiday_id%' and holiday_date='$date'"; #$holiday_rslt=mysql_to_mysqli($holiday_stmt, $link); #$holiday_ct=mysqli_fetch_row($holiday_rslt); #if ($holiday_ct[0]==0) # { */ $VD_holiday_id=$holiday_id."_".$h; $holiday_stmt_ins="INSERT into vicidial_call_time_holidays VALUES('$VD_holiday_id', 'Play $message_type $message message', 'Added by $PHP_AUTH_USER on ".date("Y-m-d H:i:s")." to be played $date', '$date', 'ACTIVE', '".$times["start"]."', '".$times["end"]."', '$message', 'LOCKED_HOLIDAY', 'ADDITION_REVERSE')"; $holiday_rslt_ins=mysql_to_mysqli($holiday_stmt_ins, $link); $ct_stmt.="$holiday_stmt_ins|"; $selected_locations=explode("|", $upd_location); for ($n=0; $n0) { $row=mysqli_fetch_row($rslt); $ct_holidays = $row[0]; if (preg_match('/\|$/i',$ct_holidays)) {$ct_holidays = "$ct_holidays$VD_holiday_id\|";} else {$ct_holidays = "$ct_holidays\|$VD_holiday_id\|";} $stmt="UPDATE vicidial_call_times set ct_holidays='$ct_holidays' where call_time_id='".$call_time."';"; $rslt=mysql_to_mysqli($stmt, $link); ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt="INSERT INTO vicidial_admin_log set event_date=now(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='CALLTIMES', event_type='MODIFY', record_id='".$call_time."', event_code='ADMIN MODIFY CALL TIME MODIFY HOLIDAY RULE', event_sql=\"$SQL_log\", event_notes='Holiday Rule Added: $VD_holiday_id';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); } } } } $h++; /* Unnecessary with above switching to 'DELETE } else { $holiday_stmt_upd="UPDATE vicidial_call_time_holidays set holiday_status='ACTIVE', ct_default_start='".$times["start"]."', ct_default_stop='".$times["end"]."' where holiday_id like '$holiday_id%' and holiday_date='$date'"; $holiday_rslt_upd=mysql_to_mysqli($holiday_stmt_upd, $link); $ct_stmt.="$holiday_stmt_upd|"; } */ $upd_stmt="update inbound_disabled_entries set status='LIVE' where status='ACTIVE' and start_datetime<=now() and end_datetime>=now()"; $upd_rslt=mysql_to_mysqli($upd_stmt, $link); } $inb_stmt="select * from inbound_disabled_entries where interval_id='$interval_id'"; $inb_rslt=mysql_to_mysqli($inb_stmt, $link); if (mysqli_num_rows($inb_rslt)>0) { $row=mysqli_fetch_array($inb_rslt); $location=preg_replace('/\|/', ', ', $row["location"]); $full_name=""; $fn_stmt="select full_name from vicidial_users where user='$row[user]'"; $fn_rslt=mysql_to_mysqli($fn_stmt, $link); if(mysqli_num_rows($fn_rslt)>0) { $fn_row=mysqli_fetch_row($fn_rslt); $full_name=", $fn_row[0]"; } ### LOG INSERTION Admin Log Table ### $SQL_log = "$ct_stmt"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt="INSERT INTO vicidial_admin_log set event_date=now(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='CALLTIMES', event_type='MODIFY', record_id='$holiday_id', event_code='ADMIN MODIFY CALL TIME CHANGE HOLIDAY RULE', event_sql=\"$SQL_log\", event_notes='".$call_time."';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); echo "UPDATED: Inbound $location lines are currently down from $row[start_datetime] to $row[end_datetime], requested by $row[user]$full_name\n"; echo "$row[start_datetime]|$row[end_datetime]|".date("Y-m-d H:i:s")."|$row[user]$full_name\n"; } $current_time=date("YmdHi"); $upd_from_time=preg_replace('/[^0-9]/', '', $from_date.$from_hour.$from_min); if ($current_time>=$upd_from_time) {echo "RELOAD_IMMEDIATELY";} exit; } else { echo "FAILED"; exit; } } else { echo "FAILED\n$error_msg"; exit; } } if ($action=="delete_interval" && $interval_id && $holiday_id) { $del_stmt="UPDATE inbound_disabled_entries set status='CANCELLED', modified_by='$PHP_AUTH_USER' where status in ('ACTIVE', 'LIVE') and interval_id='$interval_id'"; $del_rslt=mysql_to_mysqli($del_stmt, $link); if (mysqli_affected_rows($link)>0) { $data_stmt="select * from inbound_disabled_entries where interval_id='$interval_id'"; $data_rslt=mysql_to_mysqli($data_stmt, $link); $data_row=mysqli_fetch_array($data_rslt); $location=$data_row["location"]; $location_array_delete=explode("|", $location); for ($n=0; $n"; $rslt=mysql_to_mysqli($stmt, $link); ### LOG INSERTION Admin Log Table ### $SQL_log = "$stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt="INSERT INTO vicidial_admin_log set event_date=now(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='CALLTIMES', event_type='MODIFY', record_id='$call_time_id', event_code='ADMIN MODIFY CALL TIME REMOVE HOLIDAY RULE', event_sql=\"$SQL_log\", event_notes='".$call_time."';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); } } } # echo _QXZ("Holiday Rule Removed").": $holiday_rule
\n"; $ct_stmt="UPDATE vicidial_call_time_holidays set holiday_status='INACTIVE' where holiday_id like '$holiday_id%'"; $ct_rslt=mysql_to_mysqli($ct_stmt, $link); header("Location: $PHP_SELF"); } } function CheckHolidayConflicts($locale, $locale_calltimes_array, $fdate, $fhour, $fmin, $tdate, $thour, $tmin, $holiday_id, $DB) { global $link; $error_msg=""; $ok_msg=""; $start_period=strtotime($fdate); $end_period=strtotime($tdate); $interval_time_array=array(); for ($period=$start_period; $period<=$end_period; $period+=86400) { $key=date('Y-m-d', $period); $start_time="0000"; $end_time="2359"; if ($key==$fdate) {$start_time=$fhour.$fmin;} if ($key==$tdate) {$end_time=$thour.$tmin;} $interval_time_array["$key"]["start"]=$start_time; $interval_time_array["$key"]["end"]=$end_time; } /* Skip ALL this, as duplicate entries are fine if ($DB) {print_r($interval_time_array);} if ($DB) {"

".print_r($interval_holiday_array);} $location_array=explode("|", $locale); for ($n=0; $nLocation: ".$locale."
";} $all_ct_holidays=array(); $dup_check_stmt="select ct_holidays From vicidial_call_times where call_time_id in ('".implode("', '", $call_times_array)."') and ct_holidays is not null and length(ct_holidays)>=2"; $dup_check_rslt=mysql_to_mysqli($dup_check_stmt, $link); if ($DB) {echo $dup_check_stmt."
";} while($dc_row=mysqli_fetch_row($dup_check_rslt)) { $ct_array=explode("|", $dc_row[0]); $ct_array=array_filter($ct_array); $all_ct_holidays=array_merge($all_ct_holidays, $ct_array); } $all_ct_holidays=array_unique($all_ct_holidays); print_r($all_ct_holidays); $active_holidays=array(); $holiday_stmt="select holiday_id, holiday_date, ct_default_start, ct_default_stop from vicidial_call_time_holidays where holiday_id in ('".implode("', '", $all_ct_holidays)."') and holiday_date in ('".implode("', '", array_keys($interval_time_array))."') and holiday_status='ACTIVE'"; if ($holiday_id) {$holiday_stmt.=" and holiday_id not like '".$holiday_id."%'";} $holiday_rslt=mysql_to_mysqli($holiday_stmt, $link); # if ($DB) {echo $holiday_stmt."
"; print_r($holiday_rslt); exit;} while ($holiday_row=mysqli_fetch_array($holiday_rslt)) { $holiday_id=$holiday_row["holiday_id"]; $holiday_date=$holiday_row["holiday_date"]; $ct_default_start=$holiday_row["ct_default_start"]; $ct_default_stop=$holiday_row["ct_default_stop"]; foreach ($interval_time_array as $date => $times) { $date=preg_replace('/X/', '', $date); if ($holiday_date==$date) { if (($times["start"]<$ct_default_start && $ct_default_start<$times["end"]) || ($times["start"]<$ct_default_stop && $ct_default_stop<$times["end"])) { $error_msg.="ERROR: New interval conflicts with holiday $holiday_id on $holiday_date. Interval covers $times[start] to $times[end] - Holiday covers $ct_default_start to $ct_default_stop
"; } else { $ok_msg.="OK - Interval shares date with holiday $holiday_id on $holiday_date. Interval covers $times[start] to $times[end] - Holiday covers $ct_default_start to $ct_default_stop
"; } } } } } */ return array($error_msg, $ok_msg, $interval_time_array); } ### UPDATE INTERVAL STATUSES $upd_stmt="update inbound_disabled_entries set status='LIVE' where status='ACTIVE' and start_datetime<=now() and end_datetime>=now()"; $upd_rslt=mysql_to_mysqli($upd_stmt, $link); $upd_stmt="update inbound_disabled_entries set status='COMPLETED' where status in ('LIVE', 'ACTIVE') and end_datetime<=now()"; $upd_rslt=mysql_to_mysqli($upd_stmt, $link); $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="VOX inbound line controls\n"; header ("Content-type: text/html; charset=utf-8"); echo $HEADER; require("admin_header.php"); echo "
"; echo "\n"; ?> 0) { echo ""; echo ""; echo ""; } ?> =now(), 0, 1) as live, if(status='LIVE', 0, if(status='ACTIVE', 1, 2)) as dispo_rank from inbound_disabled_entries where status in ('ACTIVE', 'LIVE') order by dispo_rank asc, location desc, live asc, start_datetime asc"; $rslt=mysql_to_mysqli($stmt, $link); if (mysqli_num_rows($rslt)>0) { echo "\n"; echo "\t
\n"; # echo $holiday_stmt."
"; echo "Inbound line controls:"; echo "
 
These settings will disable the inbound lines for the selected locations:
1) Please select the locations that you wish to disable Inbound calling:
".trim($location_array[$l])."
\n"; } $k++; echo "All locations"; ?>
2)  \n"; $event_cols=5; foreach ($event_restrictions as $current_event => $required_user_level) { if(in_array($current_event, $expected_files) && $user_level<$required_user_level) { $event_cols--; } } for ($i=0; $i=$event_restrictions["$event"]) { echo "\t\t\t\n"; } } ?> ".($user_level==9 ? "==>>" : "")."\n"; for ($i=0; $i=$event_restrictions["$event"]) { echo ""; } } /* echo ""; echo ""; echo "
While the inbound lines are down, please play the following turn-away message:   (edit default messages)" : ""); ?>
\n"; echo "\t\t\t\t".ucfirst($event)." "; echo ($user_level>=$mand_lvl ? "change" : ""); echo "\n\t\t\t
"; echo ""; echo ""; echo ($audio_array["$event"] ? "".$audio_array["$event"]."" : "(none set)"); echo ""; echo ""; echo ""; echo ""; echo ($audio_array["closed"] ? "".$audio_array["closed"]."" : "(none set)"); echo ""; echo ""; echo ""; echo ""; echo ($audio_array["weather"] ? "".$audio_array["weather"]."" : "(none set)"); echo ""; echo ""; echo ""; echo ""; echo ($audio_array["holiday"] ? "".$audio_array["holiday"]."" : "(none set)"); echo ""; echo ""; echo ""; echo ""; echo ($audio_array["custom"] ? "".$audio_array["custom"]."" : "(none set)"); echo ""; */ ?>
  "; echo ""; } else { echo " "; } ?>
3) Select the dates and times that the inbound lines should be down:
 
" size=10 maxsize=10>

:
to " size=10 maxsize=10>

:
** All times for inbound disable are in time, using 24-hour military time **
 
4) Hit Submit to Execute :   $insert_flag|$action|$location|$message|$message_type|$from_date|$from_hour|$from_min|$to_date|$to_hour|$to_min"; ?>
"; echo "$error_msg"; echo "
\n"; $starttime_str=""; $endtime_str=""; $array_str=""; echo "\n"; # echo "\t\n"; # echo "\n"; $i=0; while ($row=mysqli_fetch_array($rslt)) { if($row["dispo_rank"]==0 && !$live_header) { $live_header="\n\t\n\n"; echo $live_header; echo "\n"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; } else if($row["dispo_rank"]==1 && !$active_header) { $active_header="\n\t\n\n"; echo $active_header; # echo "

"; # echo "\n"; # echo "\t\n\n"; } $stmt="select * from inbound_disabled_entries where status in ('COMPLETED', 'CANCELLED') and end_datetime>=now()-INTERVAL $completed_days DAY order by status asc, end_datetime desc, start_datetime desc"; $rslt=mysql_to_mysqli($stmt, $link); if (mysqli_num_rows($rslt)>0) { echo "\n\t\n\n"; echo "\n"; } ?>



Currently Active Inbound Disable Status:

CURRENTLY LIVE DOWNTIMES:

 Created ByInterval Start Date/TimeInterval End Date/TimeLocationMessageStatusLast ModifiedLast Modified By

UPCOMING SCHEDULED DOWNTIMES:

\n"; echo "\n"; echo "\n"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; $i=0; } if ($i%2==0) {$bgcolor="FFFFFF";} else {$bgcolor="E6E6E6";} $full_name=""; $fn_stmt="select full_name from vicidial_users where user='$row[user]'"; $fn_rslt=mysql_to_mysqli($fn_stmt, $link); if(mysqli_num_rows($fn_rslt)>0) { $fn_row=mysqli_fetch_row($fn_rslt); $full_name="
$fn_row[0]"; } $modify_name=""; $fn_stmt="select full_name from vicidial_users where user='$row[modified_by]'"; $fn_rslt=mysql_to_mysqli($fn_stmt, $link); if(mysqli_num_rows($fn_rslt)>0) { $fn_row=mysqli_fetch_row($fn_rslt); $modify_name="
$fn_row[0]"; } $font_class=($row["status"]=="LIVE" ? "blink" : "small_standard"); $location=preg_replace('/\|/', ', ', $row["location"]); # echo ""; # echo ""; # echo ""; echo "\n"; echo "\n"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; echo "\n"; echo "\t"; echo "\n"; # echo "\n"; # echo ""; # echo "\n"; $i++; } $starttime_str=preg_replace('/, $/', '', $starttime_str); $endtime_str=preg_replace('/, $/', '', $endtime_str); $array_str=preg_replace('/,$/', '', $array_str); echo "\t
 Created ByInterval Start Date/TimeInterval End Date/TimeLocationMessageStatusLast ModifiedLast Modified By

$row[status]

Inbound $location lines are scheduled to be down from ".substr($row["start_datetime"], 0, -3)." to ".substr($row["end_datetime"], 0, -3).", requested by $row[user]$full_name
Message being played: ".$row["message"]."

\n"; echo " "; if ($row["status"]!="LIVE") { $starttime_str.="'".preg_replace('/[^0-9]/', '', $row["start_datetime"])."', "; $button_value="CANCEL"; } else { $endtime_str.="'".preg_replace('/[^0-9]/', '', $row["end_datetime"])."', "; $button_value="RESUME"; } $array_str.="\n['$row[interval_id]', '".preg_replace('/[^0-9]/', '', $row["start_datetime"])."', '".preg_replace('/[^0-9]/', '', $row["end_datetime"])."', '".$row["status"]."'],"; echo ""; echo "$row[user]$full_name".substr($row["start_datetime"], 0, -3)."".substr($row["end_datetime"], 0, -3)."$location$row[message_type]
Play message
".($row["status"]!="LIVE" ? "SCHEDULED" : "LIVE")."$row[modify_date]$row[modified_by]$modify_name
\n"; echo ""; echo "
 "; # echo "
\n\t



Recent Completed/Cancelled Disabled Inbound - past $completed_days days:
"; echo "\n"; echo "\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\n"; $i=0; while($row=mysqli_fetch_array($rslt)) { if ($i%2==0) {$bgcolor="FFFFFF";} else {$bgcolor="E6E6E6";} $location=preg_replace('/\|/', ', ', $row["location"]); $full_name=""; $fn_stmt="select full_name from vicidial_users where user='$row[user]'"; $fn_rslt=mysql_to_mysqli($fn_stmt, $link); if(mysqli_num_rows($fn_rslt)>0) { $fn_row=mysqli_fetch_row($fn_rslt); $full_name=", $fn_row[0]"; } echo "\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\n"; $i++; } echo "
Created byInterval start date/timeInterval end date/timeLocationMessageStatusLast ModifiedModified By
".$row["user"].$full_name."".substr($row["start_datetime"], 0, -3)."".substr($row["end_datetime"], 0, -3)."".$location."".$row["message_type"]." - ".$row["message"]."".$row["status"]."".$row["modify_date"]."".$row["modified_by"]."
\n"; echo "


\n\n"; echo "\n\n\n


\n"._QXZ("script runtime").": $RUNtime "._QXZ("seconds")."|$db_source
"; # print_r($location_array); echo "
"; echo ""; echo ""; # header ("Content-type: text/html; charset=utf-8"); # echo $HEADER; # require("admin_header.php"); # echo $MAIN; ?>