Files
crm.clientright.ru/modules/Workflow2/autoloader.php
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

112 lines
3.2 KiB
PHP

<?php
/**
* Created by JetBrains PhpStorm.
* User: Stefan Warnat <support@stefanwarnat.de>
* Date: 19.12.13 12:27
* You must not use this file without permission.
*/
namespace Workflow2;
/**
* Class Autoload
* @package TimeControl
*
* 2017-04-02 added registerNamespaceAlias
*/
class Autoload {
protected static $_Registered = array();
protected static $_NamespaceAliase = array();
public static function autoload($classname) {
if(!empty(self::$_NamespaceAliase)) {
$classname = str_replace(array_keys(self::$_NamespaceAliase), array_values(self::$_NamespaceAliase), $classname);
}
if(strpos($classname, "_")) {
$prefix = explode("_", $classname);
} else {
$prefix = explode("\\", $classname);
}
if(!isset(self::$_Registered[$prefix[0]])) {
return false;
}
if($prefix[1] == "SWExtension") {
if(count($prefix) == 3 && $prefix[2] == 'c'.sha1($prefix[0]."-GenKey")) {
$origClass = $classname;
$doAlias = true;
$classname = str_replace("\\".$prefix[2], "\\GenKey", $classname);
} else {
$doAlias = false;
}
}
$path = self::$_Registered[$prefix[0]]."/";
$classNamePath = str_replace(array("_", "\\"), "/", $classname);
if(file_exists($path.$classNamePath.".php")) {
require_once($path.$classNamePath.".php");
} else {
if(strpos($classNamePath, 'Workflow/Plugins/ConnectionProvider') === 0) {
\Workflow\ConnectionProvider::getKeyByClassname($classNamePath);
}
if(strpos($classNamePath, 'Workflow/OAuthHandler') === 0) {
\Workflow\OAuth::loadHandler();
}
}
if($prefix[1] == "SWExtension" && $doAlias) {
class_alias(ltrim($classname, "\\"), ltrim($origClass, "\\"));
}
}
public static function registerDirectory($directory) {
if(substr($directory, 0, 1) == "~") {
global $root_directory;
$directory = $root_directory."/".substr($directory, 2);
}
$directory = realpath($directory);
if(is_dir($directory)) {
$alle = glob($directory.'/*');
foreach($alle as $datei) {
if(is_dir($datei)) {
self::register(basename($datei), $directory);
}
}
}
}
public static function register($prefix, $directory) {
if(substr($directory, 0, 1) == "~") {
global $root_directory;
$directory = $root_directory."/".substr($directory, 2);
}
if(file_exists($directory)) {
self::$_Registered[$prefix] = $directory;
}
}
public function registerNamespaceAlias($Alias, $ExistingNamespace) {
self::$_NamespaceAliase[$Alias] = $ExistingNamespace;
}
}
spl_autoload_register(__NAMESPACE__ .'\Autoload::autoload');
if(!function_exists('sw_autoload_register')) {
function sw_autoload_register($prefix, $path)
{
Autoload::register($prefix, $path);
}
}
if(file_exists(dirname(__FILE__)."/constants.php")) {
require_once(dirname(__FILE__)."/constants.php");
}