- 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.
136 lines
4.8 KiB
PHP
136 lines
4.8 KiB
PHP
<?php
|
|
/* ********************************************************************************
|
|
* The content of this file is subject to the Mobile App 4 You license.
|
|
* ("License"); You may not use this file except in compliance with the License
|
|
* The Initial Developer of the Original Code is IT-Solutions4You s.r.o.
|
|
* Portions created by IT-Solutions4You s.r.o. are Copyright(C) IT-Solutions4You s.r.o.
|
|
* All Rights Reserved.
|
|
* ****************************************************************************** */
|
|
|
|
require_once 'modules/Webforms/model/WebformsModel.php';
|
|
require_once 'include/Webservices/DescribeObject.php';
|
|
|
|
class ITS4YouMobileApp
|
|
{
|
|
public $moduleLabel = 'Mobile App 4 You';
|
|
public $moduleInstance;
|
|
public $moduleName = 'ITS4YouMobileApp';
|
|
public $list_fields_name = [];
|
|
public $list_fields = [];
|
|
|
|
function __construct()
|
|
{
|
|
global $log;
|
|
|
|
$this->db = PearDatabase::getInstance();
|
|
$this->log = $log;
|
|
}
|
|
|
|
/**
|
|
* Invoked when special actions are performed on the module.
|
|
*
|
|
* @param $moduleName
|
|
* @param $eventType
|
|
*
|
|
* @throws Exception
|
|
*/
|
|
function vtlib_handler($moduleName, $eventType)
|
|
{
|
|
switch ($eventType) {
|
|
case 'module.postinstall':
|
|
case 'module.enabled':
|
|
case 'module.postupdate':
|
|
$this->createTable();
|
|
$this->updateSettings();
|
|
$this->copyAndOverwriteFile();
|
|
$this->downloadLibraries();
|
|
break;
|
|
case 'module.disabled':
|
|
case 'module.preuninstall':
|
|
case 'module.preupdate':
|
|
$this->updateSettings(false);
|
|
break;
|
|
}
|
|
}
|
|
|
|
protected function downloadLibraries()
|
|
{
|
|
$fileName = 'limonade-master';
|
|
$srcZip = 'https://its4you.sk/images/extensions/MobileApp/src/' . $fileName . '.zip';
|
|
|
|
if (!file_exists('modules/ITS4YouLibrary')) {
|
|
mkdir('modules/ITS4YouLibrary', 0777, true);
|
|
}
|
|
|
|
$trgZip = 'modules/ITS4YouLibrary/' . $fileName . '.zip';
|
|
$unZip = getcwd() . '/modules/ITS4YouLibrary/';
|
|
|
|
if (copy($srcZip, $trgZip)) {
|
|
if (is_file($trgZip)) {
|
|
require_once('vtlib/thirdparty/dUnzip2.inc.php');
|
|
$unzip = new dUnzip2($trgZip);
|
|
$unzip->unzipAll($unZip);
|
|
|
|
if ($unzip) {
|
|
$unzip->close();
|
|
}
|
|
|
|
unlink($trgZip);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected function createTable()
|
|
{
|
|
$db = PearDatabase::getInstance();
|
|
$db->query('CREATE TABLE IF NOT EXISTS its4you_mobileappuser_license(
|
|
userid INT(10),
|
|
activated_time datetime)
|
|
ENGINE=InnoDB');
|
|
}
|
|
|
|
protected function copyAndOverwriteFile()
|
|
{
|
|
if (!file_exists('modules/ITS4YouMobileApp/bcrewrite')) {
|
|
mkdir('modules/ITS4YouMobileApp/bcrewrite', 0777, true);
|
|
}
|
|
|
|
if (!file_exists('modules/ITS4YouMobileApp/torewrite')) {
|
|
mkdir('modules/ITS4YouMobileApp/torewrite', 0777, true);
|
|
}
|
|
|
|
copy('modules/Users/Users.php', 'modules/ITS4YouMobileApp/bcrewrite/Users.php');
|
|
|
|
$fileContent = file_get_contents('modules/ITS4YouMobileApp/bcrewrite/Users.php');
|
|
$newFileContent = str_replace('$result = $this->db->requireSingleResult($query, array($usr_name), false);', '$result = $this->db->requirePsSingleResult($query, array($usr_name), false);', $fileContent);
|
|
|
|
file_put_contents('modules/ITS4YouMobileApp/torewrite/Users.php', $newFileContent);
|
|
|
|
copy('modules/ITS4YouMobileApp/torewrite/Users.php', 'modules/Users/Users.php');
|
|
}
|
|
|
|
public function updateSettings($register = true)
|
|
{
|
|
$name = $this->moduleLabel;
|
|
$blockName = 'LBL_INTEGRATION';
|
|
$linkTo = 'index.php?module=ITS4YouMobileApp&parent=Settings&view=List';
|
|
$this->db->pquery('DELETE FROM vtiger_settings_field WHERE name=?', array($name));
|
|
|
|
if ($register) {
|
|
$fieldId = $this->db->getUniqueID('vtiger_settings_field');
|
|
$blockId = getSettingsBlockId($blockName);
|
|
|
|
$sequenceResult = $this->db->pquery(
|
|
'SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid=?',
|
|
array($blockId)
|
|
);
|
|
$sequence = intval($this->db->query_result($sequenceResult, 0, 'max_seq')) + 1;
|
|
|
|
$this->db->pquery(
|
|
'INSERT INTO vtiger_settings_field(fieldid, blockid, name, linkto, sequence) VALUES (?,?,?,?,?)',
|
|
array($fieldId, $blockId, $name, $linkTo, $sequence)
|
|
);
|
|
}
|
|
}
|
|
}
|