- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
74 lines
2.9 KiB
PHP
74 lines
2.9 KiB
PHP
<?php
|
|
/*+***********************************************************************************
|
|
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
|
* ("License"); You may not use this file except in compliance with the License
|
|
* The Original Code is: vtiger CRM Open Source
|
|
* The Initial Developer of the Original Code is vtiger.
|
|
* Portions created by vtiger are Copyright (C) vtiger.
|
|
* All Rights Reserved.
|
|
*************************************************************************************/
|
|
|
|
class Vtiger_ShowFile_Helper {
|
|
|
|
/**
|
|
* Function to display images out side of CRM (with out authentication)
|
|
* @param type $fid - attachment id
|
|
* @param type $encFileName - md5(filename)
|
|
*/
|
|
static function handle($fid, $encFileName) {
|
|
global $upload_badext;
|
|
$db = PearDatabase::getInstance();
|
|
|
|
$query = "SELECT vtiger_attachments.* FROM vtiger_attachments
|
|
INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_attachments.attachmentsid
|
|
WHERE vtiger_attachments.attachmentsid=? AND vtiger_attachments.name=? LIMIT 1";
|
|
$result = $db->pquery($query, array($fid, $encFileName));
|
|
if ($result && $db->num_rows($result)) {
|
|
$resultData = $db->fetch_array($result);
|
|
$fileId = $resultData['attachmentsid'];
|
|
$filePath = $resultData['path'];
|
|
$fileName = $resultData['name'];
|
|
$storedFileName = $resultData['storedname'];
|
|
$fileType = $resultData['type'];
|
|
$sanitizedFileName = sanitizeUploadFileName($fileName, $upload_badext);
|
|
|
|
/**
|
|
* While saving the document applying decode_html to save in DB, but this is not happening for the images
|
|
* This save happens from mailroom, inbox, record save, document save etc..
|
|
*/
|
|
if (!empty($encFileName)) {
|
|
if(!empty($storedFileName)){
|
|
$finalFilePath = $filePath.$fileId.'_'.$storedFileName;
|
|
}else if(is_null($storedFileName)){
|
|
$finalFilePath = $filePath.$fileId.'_'.$encFileName;
|
|
}
|
|
$isFileExist = false;
|
|
if (file_exists($finalFilePath)) {
|
|
$isFileExist = true;
|
|
} else {
|
|
$finalFilePath = $filePath.$fileId.'_'.$sanitizedFileName;
|
|
if (file_exists($finalFilePath)) {
|
|
$isFileExist = true;
|
|
}
|
|
}
|
|
if ($isFileExist) {
|
|
Vtiger_ShowFile_Helper::show($finalFilePath,$fileType);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Function to show images out side of CRM
|
|
* @param type $finalFilePath - the proper image folder path
|
|
* @param type $fileType - image file type
|
|
*/
|
|
static function show($finalFilePath, $fileType) {
|
|
$handle = fopen($finalFilePath, "rb");
|
|
$contents = fread($handle, filesize($finalFilePath));
|
|
fclose($handle);
|
|
|
|
header("Content-Type: $fileType;charset=UTF-8");
|
|
echo $contents;
|
|
}
|
|
} |