Files
crm.clientright.ru/formss/server_v4.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

128 lines
4.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
header('Access-Control-Allow-Origin: *');
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
$mail->CharSet = 'UTF-8';
$mail->isHTML(true);
try {/*
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->Host = 'smtp.fvkorobkov.ru';
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = 'ask@fvkorobkov.ru';
$mail->Password = 'G59UQwYaSl';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->setFrom('ask@fvkorobkov.ru', 'Робот-Клиентправ');
$mail->addAddress('help@clientright.ru', 'Заявка с сайта clientright.ru');
// $mail->addAddress('ftpl@yandex.ru', 'Заявка с сайта clientright.ru');
$mail->isHTML(true);
*/
$upload_urls=$_POST['upload_urls'];
$files_names = $_POST['files_names'];
$files_array = [];
$appends=$_POST['appends'];
$sub_dir = !empty($_POST['sub_dir']) ? $_POST['sub_dir'] : '';
$lastname = str_replace(' ', '',$_POST['lastname']);
$new_post = array(
'__vtrftk' => 'sid:ec649134ad232e44c3ad71bbd321cee986f05545,1688385374',
'publicid' => '3ddc71c2d79ef101c09b0d4e9c6bd08b',
'urlencodeenable' => '1',
'name' => 'websiteticket',
);
$files_array=array();
if($upload_urls) {
foreach($upload_urls as $index => $upload_url) {
if($upload_url) {
// $mail->addAttachment($upload_url);
$files_array = array_merge($files_array, array($files_names[$index] => new CURLFile(realpath($upload_url))));
$new_post[$files_names[$index]] = $upload_url;
}
}
}
foreach($appends as $key => $itemjson){
$item=json_decode($itemjson);
$new_post[$item->crm_name] = $item->field_val;
}
$final_post = array_merge($new_post, $files_array);
$curl_connection =curl_init('https://crm.clientright.ru/modules/Webforms/capture.php');
curl_setopt($curl_connection, CURLOPT_POST, 1);
curl_setopt($curl_connection, CURLOPT_HEADER, 0);
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
// Content-Type: multipart/form-data автоматически добавляется cURL с правильным boundary
// curl_setopt($curl_connection, CURLOPT_HTTPHEADER,array('Content-Type: multipart/form-data'));
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $final_post);
$result = curl_exec($curl_connection);
curl_close($curl_connection);
$mail->Subject = 'Заявкас с сайта clientright.ru ';
$mail->Body = 'Пользователь заполнил форму! <br>';
/* foreach($new_post as $key => $value) {
$mail->Body .= $key.' : '.$value.'<br>';
}
// $mail->send();
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
*/
// foreach($upload_urls as $index => $upload_url) {
// unlink("../".$upload_url);
// }
if($sub_dir) {
$files = glob('uploads/'.$sub_dir.'/*');
foreach($files as $file){
if(is_file($file)) {
unlink($file);
}
}
rmdir('uploads/'.$sub_dir);
}
//logi
error_reporting(E_ALL);
ini_set('display_errors', 0);
ini_set('log_errors','on');
ini_set('error_log', __DIR__ . '/logs/php-errors.log');
ob_start();
foreach (getallheaders() as $name => $value) {
echo "$name: $value\n";
}
$log = date('Y-m-d H:i:s') . PHP_EOL . ob_get_clean() . PHP_EOL;
file_put_contents(__DIR__ . '/log-headers.txt', $log, FILE_APPEND);
// logi end