Ejemplo n.º 1
0
        if (!$rslt) {
            die('Could not execute: ' . mysqli_error());
        }
        $stmtC = "INSERT INTO vtiger_users2group SET userid='{$userid}',groupid='{$groupid}';";
        if ($DB) {
            echo "|{$stmtC}|\n";
        }
        $rslt = mysql_to_mysqli($stmtC, $linkV);
        if (!$rslt) {
            die('Could not execute: ' . mysqli_error());
        }
        $stmtD = "UPDATE vtiger_users_seq SET id='{$userid}';";
        if ($DB) {
            echo "|{$stmtD}|\n";
        }
        $rslt = mysql_to_mysqli($stmtD, $linkV);
        if (!$rslt) {
            die('Could not execute: ' . mysqli_error());
        }
        echo "{$user_name}:<BR>\n";
        echo "{$stmtA}<BR>\n";
        echo "{$stmtB}<BR>\n";
        echo "{$stmtC}<BR>\n";
        echo "{$stmtD}<BR>\n";
        echo "<BR>\n";
        #### END CREATE NEW USER RECORD IN VTIGER
    }
}
### END User export
##########################
echo "DONE\n";
function is_user_logged_in($user)
{
    global $link;
    $stmt = "select status from vicidial_live_agents where user='******'";
    if ($DB) {
        echo "|{$stmt}|\n";
    }
    $rslt = mysql_to_mysqli($stmt, $link);
    $live_agent_count = mysqli_num_rows($rslt);
    if ($live_agent_count != '1') {
        if ($live_agent_count == '0') {
            return _QXZ("Cannot call prospect. You are not logged in as") . " {$user}.";
        } else {
            return _QXZ("Cannot call prospect") . ". {$live_agent_count} " . _QXZ("agents logged in as") . " {$user}.";
        }
    }
    $row = mysqli_fetch_row($rslt);
    $status = $row[0];
    if ($status != 'PAUSED') {
        return _QXZ("Status must be paused to call lead") . ". {$user} " . _QXZ("is presently in") . " {$status} " . _QXZ("status") . ".";
    }
    //@TODO: check user is in the correct CAMPAIGN for this lead.
    return true;
}
Ejemplo n.º 3
0
     $row = mysqli_fetch_row($rslt);
     $Lterritory_count[$i] = $row[0];
 }
 $stmt = "SELECT count(*) FROM vicidial_list where owner='{$Lterritory[$i]}';";
 $rslt = mysql_to_mysqli($stmt, $link);
 if ($DB) {
     echo "{$stmt}\n";
 }
 $VLo_ct = mysqli_num_rows($rslt);
 if ($VLo_ct > 0) {
     $row = mysqli_fetch_row($rslt);
     $Lterritory_owner_count[$i] = $row[0];
 }
 if ($enable_vtiger_integration > 0) {
     $stmtV = "SELECT count(*) FROM vtiger_account where tickersymbol='{$Lterritory[$i]}';";
     $rsltV = mysql_to_mysqli($stmtV, $linkV);
     if ($DB) {
         echo "{$stmtV}\n";
     }
     $va_ct = mysqli_num_rows($rsltV);
     if ($va_ct > 0) {
         $row = mysqli_fetch_row($rsltV);
         $Lvtiger_count[$i] = $row[0];
     }
 }
 if (preg_match("/1\$|3\$|5\$|7\$|9\$/i", $i)) {
     $bgcolor = 'bgcolor="#B9CBFD"';
 } else {
     $bgcolor = 'bgcolor="#9BB9FB"';
 }
 echo "<tr {$bgcolor}><td><font size=1>{$i}</td>";
Ejemplo n.º 4
0
function get_audited_comments($lead_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log)
{
    global $ACcount;
    global $ACcomments;
    $stmt = "SELECT user_id,comment,timestamp from vicidial_comments where lead_id='{$lead_id}' order by timestamp desc;";
    $rslt = mysql_to_mysqli($stmt, $link);
    if ($mel > 0) {
        mysql_error_logging($NOW_TIME, $link, $mel, $stmt, '00142-69-AuditComments', $user, $server_ip, $session_name, $one_mysql_log);
    }
    $ACcount = mysqli_num_rows($rslt);
    if ($ACcount > 0) {
        $i = 0;
        while ($i < $ACcount) {
            $row = mysqli_fetch_row($rslt);
            $C_user[$i] = $row[0];
            $C_comment[$i] = $row[1];
            $C_date[$i] = $row[2];
            $i++;
        }
        $i = 0;
        while ($i < $ACcount) {
            $C_name[$i] = 'Unknown';
            $C_level[$i] = '1';
            $FCS = '';
            $FCE = '';
            $stmt = "SELECT full_name,user_level from vicidial_users where user='******';";
            $rslt = mysql_to_mysqli($stmt, $link);
            if ($mel > 0) {
                mysql_error_logging($NOW_TIME, $link, $mel, $stmt, '00142-70-AuditCommentsUser', $user, $server_ip, $session_name, $one_mysql_log);
            }
            $Ucount = mysqli_num_rows($rslt);
            if ($Ucount > 0) {
                $row = mysqli_fetch_row($rslt);
                $C_name[$i] = $row[0];
                $C_level[$i] = $row[1];
            }
            if ($C_level[$i] > 7) {
                $FCS = '--------ADMINFONTBEGIN--------';
                $FCE = '--------ADMINFONTEND--------';
            }
            $ACcomments .= _QXZ("UserID: {$FCS}%1s - %2s{$FCE},  Date: %3s", 0, '', $C_user[$i], $C_name[$i], $C_date[$i]) . "\n";
            $ACcomments .= $C_comment[$i];
            $ACcomments .= "\n----------------------------------\n";
            $i++;
        }
        return true;
    } else {
        return false;
    }
}
function delete_field_function($DB, $link, $linkCUSTOM, $ip, $user, $table_exists, $field_id, $list_id, $field_label, $field_name, $field_description, $field_rank, $field_help, $field_type, $field_options, $field_size, $field_max, $field_default, $field_required, $field_cost, $multi_position, $name_position, $field_order, $vicidial_list_fields)
{
    $SQLexecuted = 0;
    if ($field_type == 'DISPLAY' or $field_type == 'SCRIPT' or preg_match("/\\|{$field_label}\\|/i", $vicidial_list_fields)) {
        if ($DB) {
            echo "Non-DB {$field_type} field type, {$field_label}\n";
        }
        $SQLexecuted++;
    } else {
        $stmtCUSTOM = "ALTER TABLE custom_{$list_id} DROP {$field_label};";
        $rsltCUSTOM = mysql_to_mysqli($stmtCUSTOM, $linkCUSTOM);
        $table_update = mysqli_affected_rows($linkCUSTOM);
        if ($DB) {
            echo "{$table_update}|{$stmtCUSTOM}\n";
        }
        if (!$rsltCUSTOM) {
            echo _QXZ("Could not execute") . ': ' . mysqli_error() . "|{$stmtCUSTOM}|<BR><B>" . _QXZ("FIELD NOT DELETED, PLEASE GO BACK AND TRY AGAIN") . "</b>";
            ### LOG INSERTION Admin Log Table ###
            $SQL_log = "{$stmt}|{$stmtCUSTOM}";
            $SQL_log = preg_replace('/;/', '', $SQL_log);
            $SQL_log = addslashes($SQL_log);
            $stmt = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='******', ip_address='{$ip}', event_section='CUSTOM_FIELDS', event_type='OTHER', record_id='{$list_id}', event_code='ADMIN DELETE CUSTOM LIST FIELD ERROR', event_sql=\"{$SQL_log}\", event_notes='DELETE ERROR:" . mysqli_error() . "';";
            if ($DB) {
                echo "|{$stmt}|\n";
            }
            $rslt = mysql_to_mysqli($stmt, $link);
        } else {
            $SQLexecuted++;
        }
    }
    if ($SQLexecuted > 0) {
        $stmt = "DELETE FROM vicidial_lists_fields WHERE field_label='{$field_label}' and field_id='{$field_id}' and list_id='{$list_id}' LIMIT 1;";
        $rslt = mysql_to_mysqli($stmt, $link);
        $field_update = mysqli_affected_rows($link);
        if ($DB) {
            echo "{$field_update}|{$stmt}\n";
        }
        if (!$rslt) {
            echo _QXZ("Could not execute") . ': ' . mysqli_error() . "|{$stmt}|";
        }
        ### LOG INSERTION Admin Log Table ###
        $SQL_log = "{$stmt}|{$stmtCUSTOM}";
        $SQL_log = preg_replace('/;/', '', $SQL_log);
        $SQL_log = addslashes($SQL_log);
        $stmt = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='******', ip_address='{$ip}', event_section='CUSTOM_FIELDS', event_type='DELETE', record_id='{$list_id}', event_code='ADMIN DELETE CUSTOM LIST FIELD', event_sql=\"{$SQL_log}\", event_notes='';";
        if ($DB) {
            echo "|{$stmt}|\n";
        }
        $rslt = mysql_to_mysqli($stmt, $link);
    }
    return $SQLexecuted;
}
Ejemplo n.º 6
0
function _QXZ($English_text, $sprintf = 0, $align = "l", $v_one = '', $v_two = '', $v_three = '', $v_four = '', $v_five = '', $v_six = '', $v_seven = '', $v_eight = '', $v_nine = '')
{
    global $SSenable_languages, $SSlanguage_method, $VUselected_language, $link;
    if ($SSenable_languages == '1') {
        if ($SSlanguage_method != 'DISABLED') {
            if (strlen($VUselected_language) > 0 and $VUselected_language != 'default English') {
                if ($SSlanguage_method == 'MYSQL') {
                    $stmt = "SELECT translated_text from vicidial_language_phrases where english_text='{$English_text}' and language_id='{$VUselected_language}';";
                    $rslt = mysql_to_mysqli($stmt, $link);
                    $sl_ct = mysqli_num_rows($rslt);
                    if ($sl_ct > 0) {
                        $row = mysqli_fetch_row($rslt);
                        $English_text = $row[0];
                    }
                }
            }
        }
    }
    if (preg_match("/%\\ds/", $English_text)) {
        $English_text = preg_replace("/%1s/", $v_one, $English_text);
        $English_text = preg_replace("/%2s/", $v_two, $English_text);
        $English_text = preg_replace("/%3s/", $v_three, $English_text);
        $English_text = preg_replace("/%4s/", $v_four, $English_text);
        $English_text = preg_replace("/%5s/", $v_five, $English_text);
        $English_text = preg_replace("/%6s/", $v_six, $English_text);
        $English_text = preg_replace("/%7s/", $v_seven, $English_text);
        $English_text = preg_replace("/%8s/", $v_eight, $English_text);
        $English_text = preg_replace("/%9s/", $v_nine, $English_text);
    }
    ### uncomment to test output
    #	$English_text = str_repeat('*', strlen($English_text));
    #	$fp = fopen ("./QXZdebug.txt", "a");
    #	fwrite ($fp, "|$English_text\n");
    #	fclose($fp);
    if ($sprintf > 0) {
        if ($align == "r") {
            $fmt = "%" . $sprintf . "s";
        } else {
            $fmt = "%-" . $sprintf . "s";
        }
        $English_text = sprintf($fmt, $English_text);
    }
    return $English_text;
}
Ejemplo n.º 7
0
function api_log($link, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data)
{
    if ($api_logging > 0) {
        global $startMS;
        $CL = ':';
        $script_name = getenv("SCRIPT_NAME");
        $server_name = getenv("SERVER_NAME");
        $server_port = getenv("SERVER_PORT");
        if (preg_match("/443/i", $server_port)) {
            $HTTPprotocol = 'https://';
        } else {
            $HTTPprotocol = 'http://';
        }
        if ($server_port == '80' or $server_port == '443') {
            $server_port = '';
        } else {
            $server_port = "{$CL}{$server_port}";
        }
        $apiPAGE = "{$HTTPprotocol}{$server_name}{$server_port}{$script_name}";
        $endMS = microtime();
        $startMSary = explode(" ", $startMS);
        $endMSary = explode(" ", $endMS);
        $runS = $endMSary[0] - $startMSary[0];
        $runM = $endMSary[1] - $startMSary[1];
        $TOTALrun = $runS + $runM;
        $VULhostname = php_uname('n');
        $VULservername = $_SERVER['SERVER_NAME'];
        if (strlen($VULhostname) < 1) {
            $VULhostname = 'X';
        }
        if (strlen($VULservername) < 1) {
            $VULservername = 'X';
        }
        $stmt = "SELECT webserver_id FROM vicidial_webservers where webserver='{$VULservername}' and hostname='{$VULhostname}' LIMIT 1;";
        $rslt = mysql_to_mysqli($stmt, $link);
        if ($DB) {
            echo "{$stmt}\n";
        }
        $webserver_id_ct = mysqli_num_rows($rslt);
        if ($webserver_id_ct > 0) {
            $row = mysqli_fetch_row($rslt);
            $webserver_id = $row[0];
        } else {
            ##### insert webserver entry
            $stmt = "INSERT INTO vicidial_webservers (webserver,hostname) values('{$VULservername}','{$VULhostname}');";
            if ($DB) {
                echo "{$stmt}\n";
            }
            $rslt = mysql_to_mysqli($stmt, $link);
            $affected_rows = mysqli_affected_rows($link);
            $webserver_id = mysqli_insert_id($link);
        }
        $stmt = "SELECT url_id FROM vicidial_urls where url='{$apiPAGE}' LIMIT 1;";
        $rslt = mysql_to_mysqli($stmt, $link);
        if ($DB) {
            echo "{$stmt}\n";
        }
        $url_id_ct = mysqli_num_rows($rslt);
        if ($url_id_ct > 0) {
            $row = mysqli_fetch_row($rslt);
            $url_id = $row[0];
        } else {
            ##### insert url entry
            $stmt = "INSERT INTO vicidial_urls (url) values('{$apiPAGE}');";
            if ($DB) {
                echo "{$stmt}\n";
            }
            $rslt = mysql_to_mysqli($stmt, $link);
            $affected_rows = mysqli_affected_rows($link);
            $url_id = mysqli_insert_id($link);
        }
        $NOW_TIME = date("Y-m-d H:i:s");
        $stmt = "INSERT INTO vicidial_api_log set user='******',agent_user='******',function='{$function}',value='{$value}',result='{$result}',result_reason='{$result_reason}',source='{$source}',data='{$data}',api_date='{$NOW_TIME}',api_script='{$api_script}',run_time='{$TOTALrun}',webserver='{$webserver_id}',api_url='{$url_id}';";
        $rslt = mysql_to_mysqli($stmt, $link);
    }
    return 1;
}
Ejemplo n.º 8
0
function status_group_gather($status_group_id, $record_type)
{
    global $NOW_TIME, $link, $mel, $user, $server_ip, $session_name, $one_mysql_log;
    $status_group_statuses = '';
    $cs_ct = 0;
    if (strlen($status_group_id) > 0 and $status_group_id != 'NONE') {
        $stmt = "SELECT status,status_name,scheduled_callback,min_sec,max_sec from vicidial_campaign_statuses where campaign_id='{$status_group_id}' and selectable='Y';";
        if ($DB) {
            echo "{$stmt}\n";
        }
        $rslt = mysql_to_mysqli($stmt, $link);
        if ($mel > 0) {
            mysql_error_logging($NOW_TIME, $link, $mel, $stmt, '00654', $user, $server_ip, $session_name, $one_mysql_log);
        }
        if ($rslt) {
            $cs_ct = mysqli_num_rows($rslt);
        }
        $i = 0;
        while ($cs_ct > $i) {
            $row = mysqli_fetch_row($rslt);
            $status = $row[0];
            $status_name = $row[1];
            $scheduled_callback = $row[2];
            $min_sec = $row[3];
            $max_sec = $row[4];
            $status_group_statuses .= "{$status}|{$status_name}|{$scheduled_callback}|{$min_sec}|{$max_sec},";
            $i++;
        }
        if (strlen($status_group_statuses) > 0) {
            $status_group_statuses = substr("{$status_group_statuses}", 0, -1);
        }
    }
    return $status_group_statuses;
}
 echo "<TD><font size=1 color=white>" . _QXZ("REPLY-TO ADDRESS") . "</TD>\n";
 echo "<TD><font size=1 color=white>" . _QXZ("PROTOCOL") . "</TD>\n";
 echo "<TD><font size=1 color=white>" . _QXZ("SERVER") . "</TD>\n";
 echo "<TD><font size=1 color=white>" . _QXZ("FREQUENCY") . "</TD>\n";
 echo "<TD><font size=1 color=white>" . _QXZ("ACTIVE") . "</TD>\n";
 echo "<TD><font size=1 color=white>" . _QXZ("UNREAD EMAILS") . "</TD>\n";
 echo "<TD><font size=1 color=white>" . _QXZ("MODIFY") . "</TD></tr>\n";
 $stmt = "SELECT email_account_id, email_account_name, email_account_description, email_replyto_address, protocol, email_account_server, email_frequency_check_mins, active from vicidial_email_accounts {$whereLOGadmin_viewable_groupsSQL} order by email_account_id;";
 $rslt = mysql_to_mysqli($stmt, $link);
 $accounts_to_print = mysqli_num_rows($rslt);
 $o = 0;
 while ($accounts_to_print > $o) {
     $row = mysqli_fetch_array($rslt);
     ## Get unhandled count
     $ct_stmt = "select count(*) From vicidial_email_list where status='NEW' and email_account_id='{$row['email_account_id']}'";
     $ct_rslt = mysql_to_mysqli($ct_stmt, $link);
     $ct_row = mysqli_fetch_row($ct_rslt);
     $unhandled_emails = $ct_row[0];
     if (preg_match("/1\$|3\$|5\$|7\$|9\$/i", $o)) {
         $bgcolor = 'bgcolor="#B9CBFD"';
     } else {
         $bgcolor = 'bgcolor="#9BB9FB"';
     }
     echo "<tr {$bgcolor}><td><font size=1><a href=\"{$PHP_SELF}?eact=UPDATE&email_account_id={$row['email_account_id']}\">{$row['email_account_id']}</a></font></td>";
     echo "<td><font size=1> {$row['email_account_name']}</font></td>";
     echo "<td><font size=1> {$row['email_account_description']}</font></td>";
     echo "<td><font size=1> {$row['email_replyto_address']}</font></td>";
     echo "<td><font size=1> {$row['protocol']}</font></td>";
     echo "<td><font size=1> {$row['email_account_server']}</font></td>";
     echo "<td><font size=1> {$row['email_frequency_check_mins']} mins</font></td>";
     echo "<td><font size=1> {$row['active']}</font></td>";
function GetListCount($list_id, $inventory_ptnstr)
{
    global $list_start_inv;
    global $new_count;
    global $link;
    global $total_calls;
    $ct_stmt = "SELECT status, called_count, count(*) From vicidial_list where list_id='{$list_id}' group by status, called_count order by status, called_count;";
    if ($DBX > 0) {
        $HTML_header .= "|{$ct_stmt}|\n";
    }
    $ct_rslt = mysql_to_mysqli($ct_stmt, $link);
    $new_count = 0;
    $total_calls = 0;
    while ($ct_row = mysqli_fetch_row($ct_rslt)) {
        $list_start_inv += $ct_row[2];
        $total_calls += $ct_row[1] * $ct_row[2];
        if (preg_match('/|$ct_row[0]|/', $inventory_ptnstr) && $ct_row[1] == "0") {
            $new_count += $ct_row[2];
        }
    }
}
Ejemplo n.º 11
0
     $stmt = "select vlc.chat_id, vcp.chat_member, vcp.chat_member_name, vlc.chat_creator, vcp.vd_agent from vicidial_live_chats vlc, vicidial_chat_participants vcp where vlc.chat_id=vcp.chat_id order by vlc.chat_id asc, vcp.chat_member_name asc";
     $rslt = mysql_to_mysqli($stmt, $link);
     while ($row = mysqli_fetch_row($rslt)) {
         $chat_id = $row[0];
         $chat_member = $row[1];
         $chat_member_name = $row[2];
         $chat_creator = $row[3];
         $vd_agent = $row[4];
         $active_chats[$chat_id][] = array("{$chat_member}", "{$chat_member_name}", "in chat");
         if ($vd_agent == "Y") {
             array_push($agents_in_chat, "{$chat_member}");
         }
     }
     # If an agent is the owner of a live chat but not a participant, they need their name displayed there.
     $empty_live_chat_stmt = "select chat_id, '{$user}' as chat_member, '{$full_name}' as chat_member, chat_creator from vicidial_live_chats where status='LIVE' and chat_creator='{$user}'";
     $empty_live_chat_rslt = mysql_to_mysqli($empty_live_chat_stmt, $link);
     while ($row = mysqli_fetch_row($empty_live_chat_rslt)) {
         $chat_id = $row[0];
         $chat_member = $row[1];
         $chat_member_name = $row[2];
         if (!$active_chats[$chat_id]) {
             $active_chats[$chat_id][] = array("{$chat_member}", "{$chat_member_name}", "absent");
         }
     }
 }
 if ($active_chats) {
     echo "<font class='chat_title bold'>" . _QXZ("Available Chats") . ":</font><BR><BR>";
     while (list($key, $val) = each($active_chats)) {
         echo "<li class='submenu' onClick=\"JoinChat('{$key}', '{$chat_creator}');\"><font class='chat_message bold'>" . _QXZ("Chat ID") . " #{$key}</font>\n";
         echo "\t<ul id=\"chat_members_{$key}\">\n";
         while (list($subkey, $subval) = each($val)) {
 print "\t<th><font class='standard_bold' color='white'>" . _QXZ("Sales Rep(s)") . "</font></th>\n";
 print "\t<th><font class='standard_bold' color='white'>" . _QXZ("Customer Name") . "</font></th>\n";
 print "\t<th><font class='standard_bold' color='white'>" . _QXZ("Phone") . "</font></th>\n";
 print "\t<th><font class='standard_bold' color='white'>" . _QXZ("Recording ID") . "</font></th>\n";
 print "\t<th><font class='standard_bold' color='white'>" . _QXZ("Timestamp") . "</font></th>\n";
 print "</tr>\n";
 while ($row = mysqli_fetch_row($rslt)) {
     $rec_stmt = "select max(recording_id) from recording_log where lead_id='{$row['4']}'";
     $rec_rslt = mysql_to_mysqli($rec_stmt, $link);
     $rec_row = mysqli_fetch_row($rec_rslt);
     if ($forc == "F") {
         $rep_stmt = "select full_name from vicidial_users where user='******'5']}'";
         $rep_rslt = mysql_to_mysqli($rep_stmt, $link);
         $fr_row = mysqli_fetch_array($rep_rslt);
         $rep_stmt = "select full_name from vicidial_users where user='******'6']}'";
         $rep_rslt = mysql_to_mysqli($rep_stmt, $link);
         $cl_row = mysqli_fetch_array($rep_rslt);
         $rep_name = "{$fr_row['full_name']}/{$cl_row['full_name']}";
     } else {
         $rep_name = $row[5];
     }
     if ($i % 2 == 0) {
         $bgcolor = "#999999";
     } else {
         $bgcolor = "#CCCCCC";
     }
     print "<tr bgcolor='{$bgcolor}'>\n";
     print "\t<th><font class='standard_bold'>{$rep_name}</font></th>\n";
     print "\t<th><font class='standard_bold'>{$row['0']} {$row['1']}</font></th>\n";
     print "\t<th><font class='standard_bold'>{$row['2']}</font></th>\n";
     print "\t<th><font class='standard_bold'>{$rec_row['0']}</font></th>\n";
$url_str = "";
for ($i = 0; $i < $oc_ct; $i++) {
    $oc_SQL .= "'{$output_codes_to_display[$i]}',";
    $url_str .= "output_codes_to_display[]=" . $output_codes_to_display[$i];
}
$oc_SQL = substr($oc_SQL, 0, -1);
if (!$show_history) {
    $process_stmt = "SELECT output_code,status,server_ip,list_id,start_time,update_time,user,leads_count,filter_count,status_line,script_output from vicidial_nanpa_filter_log where output_code in ({$oc_SQL}) and status!='COMPLETED'";
    $process_rslt = mysql_to_mysqli($process_stmt, $link);
    $report_title = _QXZ("Currently running NANPA scrubs");
} else {
    if (!$process_limit) {
        $process_limit = 10;
    }
    $process_stmt = "SELECT output_code,status,server_ip,list_id,start_time,update_time,user,leads_count,filter_count,status_line,script_output from vicidial_nanpa_filter_log where user='******' and status='COMPLETED' order by start_time desc limit {$process_limit}";
    $process_rslt = mysql_to_mysqli($process_stmt, $link);
    $report_title = _QXZ("Past NANPA scrubs for user") . " {$PHP_AUTH_USER}";
    $past_process_ct = mysqli_num_rows($process_rslt);
    if ($process_limit <= $past_process_ct) {
        $upper_limit = $process_limit + 10;
        $more_history_link = "<BR><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=1><a name='past_scrubs' href='#past_scrubs' onClick='ShowPastProcesses({$upper_limit})'>" . _QXZ("Show more processes") . "</a></font>";
    } else {
        $more_history_link = "";
    }
}
if (mysqli_num_rows($process_rslt) > 0) {
    echo "<table width='770' cellpadding=5 cellspacing=0>";
    echo "<tr><th colspan='7' bgcolor='#015B91'><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE SIZE=2>{$report_title}</th></tr>";
    echo "<tr>";
    echo "<td align='left' bgcolor='#015B91' width='80'><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE SIZE=2>" . _QXZ("Start time") . "</th>";
    echo "<td align='left' bgcolor='#015B91' width='80'><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE SIZE=2>" . _QXZ("Status") . "</th>";
Ejemplo n.º 14
0
     $list_ary[$allowed_lists_count] = $lists_row[0];
     $list_name_ary[$allowed_lists_count] = $lists_row[1];
     $list_lead_count_ary[$allowed_lists_count] = $lead_count_row[0];
     if ($allowed_lists_count == 0) {
         $allowed_lists_sql = "'{$lists_row['0']}'";
     } else {
         $allowed_lists_sql = "{$allowed_lists_sql}, '{$lists_row['0']}'";
     }
     $allowed_lists_count++;
 }
 # figure out the highest list id in the system
 $max_id_stmt = "SELECT MAX(list_id) FROM vicidial_lists;";
 if ($DB) {
     echo "|{$max_id_stmt}|\n";
 }
 $max_id_rslt = mysql_to_mysqli($max_id_stmt, $link);
 if (mysqli_num_rows($max_id_rslt) > 0) {
     $max_id_row = mysqli_fetch_row($max_id_rslt);
     $max_list_id = $max_id_row[0] + 1;
 }
 echo "<p>" . _QXZ("This is the list split tool.  It will only work on inactive lists. It will split an existing list into several new lists with the same options as the original list. This includes copying the customer fields from the original.") . "</p>";
 echo "<form action={$PHP_SELF} method=POST>\n";
 echo "<center><table width={$section_width} cellspacing=3>\n";
 echo "<tr bgcolor=#015B91><td colspan=2 align=center><font color=white><b>" . _QXZ("List Split") . "</b></font></td></tr>\n";
 # Orginal Lists
 echo "<tr bgcolor=#B6D3FC><td align=right>" . _QXZ("Original List") . "</td><td align=left>\n";
 echo "<select size=1 name=orig_list>\n";
 echo "<option value='-'>" . _QXZ("Select A List") . "</option>\n";
 $i = 0;
 while ($i < $allowed_lists_count) {
     echo "<option value='{$list_ary[$i]}'>{$list_ary[$i]} - {$list_name_ary[$i]} ({$list_lead_count_ary[$i]} " . _QXZ("leads") . ")</option>\n";
Ejemplo n.º 15
0
     echo "|{$status_stmt}|\n";
 }
 $status_rslt = mysql_to_mysqli($status_stmt, $link);
 $status_count = mysqli_num_rows($status_rslt);
 $i = 0;
 while ($i < $status_count) {
     $status_row = mysqli_fetch_row($status_rslt);
     $statuses[$i] = $status_row[0];
     $i++;
 }
 # figure out which statuses are in the lists they are allowed to look at
 $sys_status_stmt = "SELECT status FROM vicidial_statuses ORDER BY status";
 if ($DB) {
     echo "|{$sys_status_stmt}|\n";
 }
 $sys_status_rslt = mysql_to_mysqli($sys_status_stmt, $link);
 $sys_status_count = mysqli_num_rows($sys_status_rslt);
 $i = 0;
 while ($i < $sys_status_count) {
     $sys_status_row = mysqli_fetch_row($sys_status_rslt);
     $sys_statuses[$i] = $sys_status_row[0];
     $i++;
 }
 echo "<p>" . _QXZ("The following are basic lead management tools.  They will only work on inactive lists with less than") . " {$list_lead_limit} " . _QXZ("leads in them") . ". " . _QXZ("This is to avoid data inconsistencies") . ".</p>";
 echo "<form action={$PHP_SELF} method=POST>\n";
 echo "<center><table width={$section_width} cellspacing=3>\n";
 # BEGIN lead move
 echo "<tr bgcolor=#015B91><td colspan=2 align=center><font color=white><b>" . _QXZ("Move Leads") . "</b></font></td></tr>\n";
 echo "<tr bgcolor=#B6D3FC><td align=right>" . _QXZ("From List") . "</td><td align=left>\n";
 echo "<select size=1 name=move_from_list>\n";
 echo "<option value='-'>" . _QXZ("Select A List") . "</option>\n";
        $location = $rec_row["location"];
        if (strlen($location) > 2) {
            $URLserver_ip = $location;
            $URLserver_ip = preg_replace('/http:\\/\\//i', '', $URLserver_ip);
            $URLserver_ip = preg_replace('/https:\\/\\//i', '', $URLserver_ip);
            $URLserver_ip = preg_replace('/\\/.*/i', '', $URLserver_ip);
            $stmt = "SELECT count(*) from servers where server_ip='{$URLserver_ip}';";
            $rsltx = mysql_to_mysqli($stmt, $link);
            $rowx = mysqli_fetch_row($rsltx);
            if ($rowx[0] > 0) {
                $stmt = "SELECT recording_web_link,alt_server_ip,external_server_ip from servers where server_ip='{$URLserver_ip}';";
                $rsltx = mysql_to_mysqli($stmt, $link);
                $rowx = mysqli_fetch_row($rsltx);
                if (preg_match("/ALT_IP/i", $rowx[0])) {
                    $location = preg_replace("/{$URLserver_ip}/i", "{$rowx['1']}", $location);
                }
                if (preg_match("/EXTERNAL_IP/i", $rowx[0])) {
                    $location = preg_replace("/{$URLserver_ip}/i", "{$rowx['2']}", $location);
                }
            }
        } else {
            $log_stmt = "insert into vicidial_recording_access_log(recording_id, lead_id, user, access_datetime, access_result, ip) VALUES ('{$recording_id}', '{$lead_id}', '{$PHP_AUTH_USER}', now(), 'RECORDING UNAVAILABLE', '{$ip}');";
            $log_rslt = mysql_to_mysqli($log_stmt, $link);
            echo _QXZ("Recording is not available yet.  Try again later.") . "\n";
            exit;
        }
    }
}
$log_stmt = "insert into vicidial_recording_access_log(recording_id, lead_id, user, access_datetime, access_result, ip) VALUES('{$recording_id}', '{$lead_id}', '{$PHP_AUTH_USER}', now(), 'ACCESSED', '{$ip}')";
$log_rslt = mysql_to_mysqli($log_stmt, $link);
header("Location: {$location}");
     }
 }
 ##### END custom fields columns list ###
 ##### Same code from the listloader page.  Since this is a custom template, it's assumed the layout is "custom" instead of "standard" and follows the coding as such
 #if (($sample_template_file) && ($LF_path))
 if ($delimiter && $buffer) {
     $total = 0;
     $good = 0;
     $bad = 0;
     $dup = 0;
     $post = 0;
     $phone_list = '';
     $row = explode($delimiter, preg_replace('/[\'\\"]/i', '', $buffer));
 }
 echo "<table border=0 width='100%' cellpadding=0 cellspacing=0>";
 $rslt = mysql_to_mysqli("{$fields_stmt}", $link);
 $custom_fields_count = mysqli_num_fields($rslt) - $vl_fields_count;
 while ($fieldinfo = mysqli_fetch_field($rslt)) {
     $rslt_field_name = $fieldinfo->name;
     if (preg_match("/{$rslt_field_name}/", $vicidial_list_fields)) {
         $bgcolor = "#D9E6FE";
     } else {
         $bgcolor = "#FED9D9";
     }
     echo "  <tr bgcolor='{$bgcolor}'>\r\n";
     echo "    <td align=right nowrap><font class=standard>" . strtoupper(preg_replace('/_/i', ' ', $rslt_field_name)) . ": </font></td>\r\n";
     if ($rslt_field_name != "list_id") {
         echo "    <td align=left><select name='{$field_prefix}" . $rslt_field_name . "_field' onChange='DrawTemplateStrings()'>\r\n";
         echo "     <option value='-1'>(" . _QXZ("none") . ")</option>\r\n";
         for ($j = 0; $j < count($row); $j++) {
             preg_replace('/\\"/i', '', $row[$j]);
				<input type='text' class="cust_form" name='first_name' id='first_name' size='10' maxlength='30'>&nbsp;<input class="cust_form" type='text' name='last_name' id='last_name' size='15' maxlength='30'>
				</td>
			</tr>
			<?php 
    if ($group_id == '') {
        ?>
			<tr>
				<td align='right' class='body_small'><?php 
        echo _QXZ("Select the department you wish to chat with");
        ?>
:</td>
				<td align='left'>
				<select name='group_id' id='group_id' class="cust_form">
				<?php 
        $group_stmt = "select group_id, group_name from vicidial_inbound_groups where active='Y' and group_handling='CHAT' order by group_name asc";
        $group_rslt = mysql_to_mysqli($group_stmt, $link);
        while ($row = mysqli_fetch_row($group_rslt)) {
            echo "<option value='{$row['0']}'>{$row['1']}</option>\n";
        }
        ?>
				</select>
				</td>
			</tr>
			<?php 
    } else {
        echo "<tr><td><input type=hidden name=group_id value=\"{$group_id}\"></td></tr>\n";
    }
    if ($show_email == '' or $show_email == 'N' or $show_email == 'Y_WITH_PHONE') {
        ?>
			<tr>
				<td align='right' class='body_small'><?php 
function listen_call($ServerID, $AsteriskID, $Agent, $QMUserID, $QMUserName)
{
    global $CALL_FOUND;
    global $CALL_LISTEN_URL;
    global $CALL_POPUP_WIDTH;
    global $CALL_POPUP_HEIGHT;
    require "dbconnect_mysqli.php";
    require "functions.php";
    $CALL_POPUP_WIDTH = "250";
    $CALL_POPUP_HEIGHT = "250";
    #############################################
    ##### START QUEUEMETRICS LOGGING LOOKUP #####
    $stmt = "SELECT enable_queuemetrics_logging FROM system_settings;";
    $rslt = mysql_to_mysqli($stmt, $link);
    if ($DB) {
        echo "{$stmt}\n";
    }
    $qm_conf_ct = mysqli_num_rows($rslt);
    if ($qm_conf_ct > 0) {
        $row = mysqli_fetch_row($rslt);
        $enable_queuemetrics_logging = $row[0];
    }
    ##### END QUEUEMETRICS LOGGING LOOKUP #####
    ###########################################
    if ($enable_queuemetrics_logging > 0) {
        $AsteriskID = preg_replace('/[^0-9a-zA-Z]/', '', $AsteriskID);
        $stmt = "SELECT user,server_ip,conf_exten,comments FROM vicidial_live_agents where callerid='{$AsteriskID}';";
        $rslt = mysql_to_mysqli($stmt, $link);
        if ($DB) {
            echo "{$stmt}\n";
        }
        $vla_conf_ct = mysqli_num_rows($rslt);
        if ($vla_conf_ct > 0) {
            $row = mysqli_fetch_row($rslt);
            $VLAuser = $row[0];
            $VLAserver_ip = $row[1];
            $VLAconf_exten = $row[2];
            $stmt = "SELECT campaign_id,phone_number,call_type FROM vicidial_auto_calls where callerid='{$AsteriskID}';";
            $rslt = mysql_to_mysqli($stmt, $link);
            if ($DB) {
                echo "{$stmt}\n";
            }
            $vla_conf_ct = mysqli_num_rows($rslt);
            if ($vla_conf_ct > 0) {
                $row = mysqli_fetch_row($rslt);
                $VACcampaign = $row[0];
                $VACphone = $row[1];
                $VACtype = $row[2];
                $script_name = getenv("SCRIPT_NAME");
                $server_name = getenv("SERVER_NAME");
                $server_port = getenv("SERVER_PORT");
                if (preg_match("/443/i", $server_port)) {
                    $HTTPprotocol = 'https://';
                } else {
                    $HTTPprotocol = 'http://';
                }
                $admDIR = "{$HTTPprotocol}{$server_name}{$script_name}";
                $admDIR = preg_replace('/xml_rpc_audio_server_vicidial\\.php/i', '', $admDIR);
                $monitor_script = 'QM_live_monitor.php';
                $CALL_FOUND = true;
                $CALL_LISTEN_URL = "{$admDIR}{$monitor_script}?campaign={$VACcampaign}&user={$VLAuser}&server_ip={$VLAserver_ip}&session={$VLAconf_exten}&phone={$VACphone}&type={$VACtype}&call={$AsteriskID}&QMuser={$QMUserID}";
            } else {
                $CALL_FOUND = false;
                $CALL_LISTEN_URL = "";
            }
        } else {
            $CALL_FOUND = false;
            $CALL_LISTEN_URL = "";
        }
    }
    #	$CALL_FOUND      = true;
    #	$CALL_LISTEN_URL = "http://listennow.server/$ServerID/$AsteriskID/$QMUserID/$QMUserName/$Agent";
}
Ejemplo n.º 20
0
function api_log($link, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data)
{
    if ($api_logging > 0) {
        $NOW_TIME = date("Y-m-d H:i:s");
        $stmt = "INSERT INTO vicidial_api_log set user='******',agent_user='******',function='{$function}',value='{$value}',result='{$result}',result_reason='{$result_reason}',source='{$source}',data='{$data}',api_date='{$NOW_TIME}',api_script='{$api_script}';";
        $rslt = mysql_to_mysqli($stmt, $link);
    }
    return 1;
}
     echo "<TABLE WIDTH=120 BGCOLOR={$bgcolor} cellpadding=0 cellspacing=0>\n";
 }
 if ($format == 'menu') {
     echo "<SELECT SIZE=1 name=\"{$field_name}\">\n";
 }
 if ($format == 'selectlist') {
     echo "<SELECT SIZE={$selectsize} name=\"{$field_name}\" STYLE=\"font-family : sans-serif; font-size : {$selectfontsize}{$pt}\">\n";
 }
 if ($format == 'textarea') {
     echo "<TEXTAREA ROWS={$textareaheight} COLS={$textareawidth} NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : {$selectfontsize}{$pt}\">";
 }
 $stmt = "SELECT conf_exten,extension FROM conferences where server_ip = '{$server_ip}' order by conf_exten {$order}";
 if ($format == 'table') {
     echo "\n<!-- {$stmt} -->";
 }
 $rslt = mysql_to_mysqli($stmt, $link);
 if ($rslt) {
     $phones_to_print = mysqli_num_rows($rslt);
 }
 $o = 0;
 while ($phones_to_print > $o) {
     $row = mysqli_fetch_row($rslt);
     if ($format == 'table') {
         echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR={$txtcolor} SIZE={$txtsize}>";
         echo "{$row['0']} - {$row['1']}";
         echo "</TD></TR>\n";
     }
     if ($format == 'text' or $format == 'textarea') {
         echo "{$row['0']} - {$row['1']}\n";
     }
     if ($format == 'menu' or $format == 'selectlist') {
     $ALLclosecallid[$g] = $row[11];
     $ALLuser[$g] = $row[12];
     $ALLalt_dial[$g] = "MAIN";
     $ALLin_out[$g] = "IN";
     $stmtA = "SELECT call_notes FROM vicidial_call_notes WHERE lead_id='{$ALLlead_id[$g]}' and vicidial_id='{$ALLclosecallid[$g]}';";
     $rsltA = mysql_to_mysqli($stmtA, $link);
     $in_notes_to_print = mysqli_num_rows($rslt);
     if ($in_notes_to_print > 0) {
         $rowA = mysqli_fetch_row($rsltA);
         $Allcall_notes[$g] = $rowA[0];
         if (strlen($Allcall_notes[$g]) > 0) {
             $Allcall_notes[$g] = "<b>" . _QXZ("NOTES:") . " </b> {$Allcall_notes[$g]}";
         }
     }
     $stmtA = "SELECT full_name FROM vicidial_users WHERE user='******';";
     $rsltA = mysql_to_mysqli($stmtA, $link);
     $users_to_print = mysqli_num_rows($rslt);
     if ($users_to_print > 0) {
         $rowA = mysqli_fetch_row($rsltA);
         $ALLuser[$g] .= " - {$rowA['0']}";
     }
     $Allcounter[$g] = $g;
     $g++;
     $u++;
 }
 if ($g > 0) {
     sort($ALLsort, SORT_NUMERIC);
 } else {
     $NOTESout .= "<tr bgcolor=white><td colspan=11 align=center>" . _QXZ("No calls found") . "</td></tr>";
 }
 $u = 0;