Files
Fedor ac7467f0b4 Major CRM updates: AI Assistant, Court Status API, S3 integration improvements, and extensive file storage system
- 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.
2025-10-16 11:17:21 +03:00

117 lines
2.8 KiB
PHP

<?php
class PDFMaker_Fonts_Model extends Vtiger_Base_Model {
public $fontdata;
public static function getInstance()
{
$self = new self();
$self->retrieveFonts();
return $self;
}
public function retrieveFonts()
{
require_once 'modules/PDFMaker/resources/mpdf/config_fonts.php';
}
public function getFonts()
{
return array_keys($this->fontdata);
}
public function getFontsString()
{
return implode(';', $this->getFonts());
}
public function getFontFaces()
{
require_once 'modules/PDFMaker/resources/mpdf/config_fonts.php';
$fontFace = '';
$url = 'modules/PDFMaker/resources/mpdf/ttfonts/';
foreach ($this->fontdata as $name => $value) {
if (isset($value['R'])) {
$file = $url . $value['R'];
$fontFace .= $this->getFontFace($name, $file);
}
if (isset($value['B'])) {
$file = $url . $value['B'];
$fontFace .= $this->getFontFace($name, $file, 'bold');
}
if (isset($value['I'])) {
$file = $url . $value['I'];
$fontFace .= $this->getFontFace($name, $file, 'normal', 'italic');
}
if (isset($value['BI'])) {
$file = $url . $value['BI'];
$fontFace .= $this->getFontFace($name, $file, 'bold', 'italic');
}
}
return $fontFace;
}
public function isUrlExists($file)
{
$file_headers = get_headers($file);
if (!$file_headers || 'HTTP/1.1 404 Not Found' === $file_headers[0]) {
return false;
}
return true;
}
/**
* @param string $name
* @param string $file
* @param string $weight
* @param string $style
* @return string
*/
public function getFontFace($name, $file, $weight = 'normal', $style = 'normal')
{
if (!file_exists($file)) {
return '';
}
return sprintf(
'
@font-face {
font-family: "%s";
src: url("%s") format("%s");
font-weight: %s;
font-style: %s;
}',
$name, $file, $this->getFileExtension($file), $weight, $style
);
}
/**
* @param string $file
* @return string
*/
public function getFileExtension($file)
{
$extension = strtolower(pathinfo($file)['extension']);
$types = array(
'ttf' => 'truetype',
'otf' => 'opentype',
'eot' => 'embedded-opentype',
);
if (isset($types[$extension])) {
$extension = $types[$extension];
}
return $extension;
}
}