$sql = "";
            foreach ($mimedecoder->_attachments as $objattach) {
                if (validateAttachments($objattach->_attachmentname, $objattach->_attachmenttype) == true && getDataSize($objattach->_attachmentcontent) < $var_valid_size) {
                    $var_act_filename = uniqid("fl", true) . "." . getExtension($objattach->_attachmentname);
                    $sql .= ",('" . $var_insert_id . "','" . $objattach->_attachmentname . "','" . addslashes($var_act_filename) . "')";
                    $fp = fopen("{$dotdotreal}/attachments/" . $var_act_filename, "w");
                    fwrite($fp, $objattach->_attachmentcontent);
                    fclose($fp);
                }
            }
            $sql != "" ? executeQuery($sql1 . substr($sql, 1), $conn) : "";
            // to get the SMTPSettings
            $var_smtp_status = $arr_lookupvalues['SMTPSettings'];
            mailUserOnTicketCreation($val, $total_count, $var_refno, $var_tmp_userid, $mimedecoder->_mailheader->_headersubject, $var_smtp_status);
            mailAllStaff($val, $var_refno, $var_smtp_status);
            mailWatcher($val, $var_refno, $var_smtp_status);
            if ($arr_lookupvalues['MessageRule'] == "1") {
                applyMessagerule($var_ticket_id);
            }
        }
        //mailAllStaff($arr_new);
    }
}
//end if mail received to a valid department
function getUserLogin($var_mailbox, $val, &$var_username, &$var_userlogin)
{
    $var_mailbox = preg_replace("/[^a-z0-9]/i", "", $var_mailbox);
    $var_mailbox = strlen($var_mailbox) > 50 ? substr($var_mailbox, 0, 50) : $var_mailbox;
    $var_username = $var_mailbox;
    $sql = "Select nUserId from sptbl_users where vLogin='******'";
    while (mysql_num_rows(mysql_query($sql)) > 0) {
Exemplo n.º 2
0
                }
            }
            $var_refno = $var_tmp_compid . $val_dept_id . $var_tmp_userid . $var_insert_id;
            $sql_update_ticket = "update sptbl_tickets set vRefNo='" . $var_refno . "' where nTicketId='" . $var_ticket_id . "'";
            executeQuery($sql_update_ticket, $conn);
            $sql1 = "insert into sptbl_attachments(nTicketId,vAttachReference,vAttachUrl) values";
            $sql = "";
            foreach ($mimedecoder->_attachments as $objattach) {
                if (validateAttachments($objattach->_attachmentname, $objattach->_attachmenttype) == true && getDataSize($objattach->_attachmentcontent) < $var_valid_size) {
                    $var_act_filename = uniqid("fl", true) . "." . getExtension($objattach->_attachmentname);
                    $sql .= ",('" . $var_ticket_id . "','" . $objattach->_attachmentname . "','" . addslashes($var_act_filename) . "')";
                    $fp = fopen("{$dotdotreal}/attachments/" . $var_act_filename, "w");
                    fwrite($fp, $objattach->_attachmentcontent);
                    fclose($fp);
                }
            }
            $sql != "" ? executeQuery($sql1 . substr($sql, 1), $conn) : "";
            /// check admin auto return mail status
            if (isAutoReturnMailNeeded()) {
                mailUserOnTicketCreationPop3($val, $total_count, $var_refno, $var_tmp_userid, $mimedecoder->_mailheader->_headersubject);
            }
            //
            mailAllStaff($val, $var_refno);
            mailWatcher($val, $var_refno);
            if ($arr_lookupvalues['MessageRule'] == "1") {
                applyMessagerule($var_ticket_id);
            }
        }
    }
}
//end if mail received to a valid department