bug fix in save settings in zero day

This commit is contained in:
Hesabix 2025-07-24 01:17:40 +00:00
parent 4b286c481e
commit 3047c62f5d
3 changed files with 56 additions and 56 deletions

View file

@ -371,64 +371,64 @@ class AdminController extends AbstractController
}
if (array_key_exists('username', $params))
$registryMGR->update('sms', 'username', $params['username']);
$registryMGR->update('sms', 'username', $params['username'] ?? '');
if (array_key_exists('password', $params))
$registryMGR->update('sms', 'password', $params['password']);
$registryMGR->update('sms', 'password', $params['password'] ?? '');
if (array_key_exists('token', $params))
$registryMGR->update('sms', 'token', $params['token']);
$registryMGR->update('sms', 'token', $params['token'] ?? '');
if (array_key_exists('walletpay', $params))
$registryMGR->update('sms', 'walletpay', $params['walletpay']);
$registryMGR->update('sms', 'walletpay', $params['walletpay'] ?? '');
if (array_key_exists('changePassword', $params))
$registryMGR->update('sms', 'changePassword', $params['changePassword']);
$registryMGR->update('sms', 'changePassword', $params['changePassword'] ?? '');
if (array_key_exists('recPassword', $params))
$registryMGR->update('sms', 'recPassword', $params['recPassword']);
$registryMGR->update('sms', 'recPassword', $params['recPassword'] ?? '');
if (array_key_exists('f2a', $params))
$registryMGR->update('sms', 'f2a', $params['f2a']);
$registryMGR->update('sms', 'f2a', $params['f2a'] ?? '');
if (array_key_exists('ticketReplay', $params))
$registryMGR->update('sms', 'ticketReplay', $params['ticketReplay']);
$registryMGR->update('sms', 'ticketReplay', $params['ticketReplay'] ?? '');
if (array_key_exists('ticketRec', $params))
$registryMGR->update('sms', 'ticketRec', $params['ticketRec']);
$registryMGR->update('sms', 'ticketRec', $params['ticketRec'] ?? '');
if (array_key_exists('fromNum', $params))
$registryMGR->update('sms', 'fromNum', $params['fromNum']);
$registryMGR->update('sms', 'fromNum', $params['fromNum'] ?? '');
if (array_key_exists('sharefaktor', $params))
$registryMGR->update('sms', 'sharefaktor', $params['sharefaktor']);
$registryMGR->update('sms', 'sharefaktor', $params['sharefaktor'] ?? '');
if (array_key_exists('plan', $params))
$registryMGR->update('sms', 'plan', $params['plan']);
$registryMGR->update('sms', 'plan', $params['plan'] ?? '');
if (array_key_exists('chequeInput', $params))
$registryMGR->update('sms', 'chequeInput', $params['chequeInput']);
$registryMGR->update('sms', 'chequeInput', $params['chequeInput'] ?? '');
if (array_key_exists('passChequeInput', $params))
$registryMGR->update('sms', 'passChequeInput', $params['passChequeInput']);
$registryMGR->update('sms', 'passChequeInput', $params['passChequeInput'] ?? '');
if (array_key_exists('rejectChequeInput', $params))
$registryMGR->update('sms', 'rejectChequeInput', $params['rejectChequeInput']);
$registryMGR->update('sms', 'rejectChequeInput', $params['rejectChequeInput'] ?? '');
if (array_key_exists('plugRepservice', $params)) {
if (array_key_exists('get', $params['plugRepservice']))
$registryMGR->update('sms', 'plugRepserviceStateGet', $params['plugRepservice']['get']);
$registryMGR->update('sms', 'plugRepserviceStateGet', $params['plugRepservice']['get'] ?? '');
if (array_key_exists('repaired', $params['plugRepservice']))
$registryMGR->update('sms', 'plugRepserviceStateRepaired', $params['plugRepservice']['repaired']);
$registryMGR->update('sms', 'plugRepserviceStateRepaired', $params['plugRepservice']['repaired'] ?? '');
if (array_key_exists('unrepaired', $params['plugRepservice']))
$registryMGR->update('sms', 'plugRepserviceStateUnrepired', $params['plugRepservice']['unrepaired']);
$registryMGR->update('sms', 'plugRepserviceStateUnrepired', $params['plugRepservice']['unrepaired'] ?? '');
if (array_key_exists('getback', $params['plugRepservice']))
$registryMGR->update('sms', 'plugRepserviceStateGetback', $params['plugRepservice']['getback']);
$registryMGR->update('sms', 'plugRepserviceStateGetback', $params['plugRepservice']['getback'] ?? '');
if (array_key_exists('creating', $params['plugRepservice']))
$registryMGR->update('sms', 'plugRepserviceStateCreating', $params['plugRepservice']['creating']);
$registryMGR->update('sms', 'plugRepserviceStateCreating', $params['plugRepservice']['creating'] ?? '');
if (array_key_exists('created', $params['plugRepservice']))
$registryMGR->update('sms', 'plugRepserviceStateCreated', $params['plugRepservice']['created']);
$registryMGR->update('sms', 'plugRepserviceStateCreated', $params['plugRepservice']['created'] ?? '');
}
if (array_key_exists('plugAccpro', $params)) {
if (array_key_exists('sharefaktor', $params['plugAccpro']))
$registryMGR->update('sms', 'plugAccproSharefaktor', $params['plugAccpro']['sharefaktor']);
$registryMGR->update('sms', 'plugAccproSharefaktor', $params['plugAccpro']['sharefaktor'] ?? '');
if (array_key_exists('storeroomSmsBarbari', $params['plugAccpro']))
$registryMGR->update('sms', 'plugAccproStoreroomSmsBarbari', $params['plugAccpro']['storeroomSmsBarbari']);
$registryMGR->update('sms', 'plugAccproStoreroomSmsBarbari', $params['plugAccpro']['storeroomSmsBarbari'] ?? '');
if (array_key_exists('storeroomSmsOther', $params['plugAccpro']))
$registryMGR->update('sms', 'plugAccproStoreroomSmsOther', $params['plugAccpro']['storeroomSmsOther']);
$registryMGR->update('sms', 'plugAccproStoreroomSmsOther', $params['plugAccpro']['storeroomSmsOther'] ?? '');
if (array_key_exists('chequeInput', $params['plugAccpro']))
$registryMGR->update('sms', 'plugAccproChequeInput', $params['plugAccpro']['chequeInput']);
$registryMGR->update('sms', 'plugAccproChequeInput', $params['plugAccpro']['chequeInput'] ?? '');
if (array_key_exists('passChequeInput', $params['plugAccpro']))
$registryMGR->update('sms', 'plugAccproPassChequeInput', $params['plugAccpro']['passChequeInput']);
$registryMGR->update('sms', 'plugAccproPassChequeInput', $params['plugAccpro']['passChequeInput'] ?? '');
if (array_key_exists('rejectChequeInput', $params['plugAccpro']))
$registryMGR->update('sms', 'plugAccproRejectChequeInput', $params['plugAccpro']['rejectChequeInput']);
$registryMGR->update('sms', 'plugAccproRejectChequeInput', $params['plugAccpro']['rejectChequeInput'] ?? '');
}
return $this->json(JsonResp::success());
@ -486,41 +486,41 @@ class AdminController extends AbstractController
$item->setSiteKeywords($params['keywords']);
$item->setDiscription($params['description']);
$item->setScripts($params['scripts']);
$registryMGR->update('system', 'zarinpalKey', $params['zarinpal']);
$registryMGR->update('system', 'zarinpalKey', $params['zarinpal'] ?? '');
$item->setFooterScripts($params['footerScripts']);
$item->setAppSite($params['appSite']);
$item->setFooter($params['footer']);
$registryMGR->update('system', 'activeGateway', $params['activeGateway']);
$registryMGR->update('system', 'parsianGatewayAPI', $params['parsianGatewayAPI']);
$registryMGR->update('system', 'paypingKey', $params['paypingKey']);
$registryMGR->update('system', 'bitpayKey', $params['bitpayKey']);
$registryMGR->update('system', 'inquiryPanel', $params['inquiryPanel']);
$registryMGR->update('system', 'inquiryZohalAPIKey', $params['inquiryZohalAPIKey']);
$registryMGR->update('system', 'enablePostalCodeToAddress', $params['enablePostalCodeToAddress']);
$registryMGR->update('system', 'inquiryPanelEnable', $params['inquiryPanelEnable']);
$registryMGR->update('system', 'postalCodeToAddressFee', $params['postalCodeToAddressFee']);
$registryMGR->update('system', 'enableCardToSheba', $params['enableCardToSheba']);
$registryMGR->update('system', 'cardToShebaFee', $params['cardToShebaFee']);
$registryMGR->update('system', 'enableAccountToSheba', $params['enableAccountToSheba']);
$registryMGR->update('system', 'accountToShebaFee', $params['accountToShebaFee']);
$registryMGR->update('system', 'activeGateway', $params['activeGateway'] ?? '');
$registryMGR->update('system', 'parsianGatewayAPI', $params['parsianGatewayAPI'] ?? '');
$registryMGR->update('system', 'paypingKey', $params['paypingKey'] ?? '');
$registryMGR->update('system', 'bitpayKey', $params['bitpayKey'] ?? '');
$registryMGR->update('system', 'inquiryPanel', $params['inquiryPanel'] ?? '');
$registryMGR->update('system', 'inquiryZohalAPIKey', $params['inquiryZohalAPIKey'] ?? '');
$registryMGR->update('system', 'enablePostalCodeToAddress', $params['enablePostalCodeToAddress'] ?? '');
$registryMGR->update('system', 'inquiryPanelEnable', $params['inquiryPanelEnable'] ?? '');
$registryMGR->update('system', 'postalCodeToAddressFee', $params['postalCodeToAddressFee'] ?? '');
$registryMGR->update('system', 'enableCardToSheba', $params['enableCardToSheba'] ?? '');
$registryMGR->update('system', 'cardToShebaFee', $params['cardToShebaFee'] ?? '');
$registryMGR->update('system', 'enableAccountToSheba', $params['enableAccountToSheba'] ?? '');
$registryMGR->update('system', 'accountToShebaFee', $params['accountToShebaFee'] ?? '');
// ذخیره تنظیمات جادوگر هوش مصنوعی
if (array_key_exists('aiEnabled', $params))
$registryMGR->update('system', 'aiEnabled', $params['aiEnabled']);
$registryMGR->update('system', 'aiEnabled', $params['aiEnabled'] ?? '');
if (array_key_exists('aiAgentSource', $params))
$registryMGR->update('system', 'aiAgentSource', $params['aiAgentSource']);
$registryMGR->update('system', 'aiAgentSource', $params['aiAgentSource'] ?? '');
if (array_key_exists('aiModel', $params))
$registryMGR->update('system', 'aiModel', $params['aiModel']);
$registryMGR->update('system', 'aiModel', $params['aiModel'] ?? '');
if (array_key_exists('aiApiKey', $params))
$registryMGR->update('system', 'aiApiKey', $params['aiApiKey']);
$registryMGR->update('system', 'aiApiKey', $params['aiApiKey'] ?? '');
if (array_key_exists('localModelAddress', $params))
$registryMGR->update('system', 'localModelAddress', $params['localModelAddress']);
$registryMGR->update('system', 'localModelAddress', $params['localModelAddress'] ?? '');
if (array_key_exists('inputTokenPrice', $params))
$registryMGR->update('system', 'inputTokenPrice', $params['inputTokenPrice']);
$registryMGR->update('system', 'inputTokenPrice', $params['inputTokenPrice'] ?? '');
if (array_key_exists('outputTokenPrice', $params))
$registryMGR->update('system', 'outputTokenPrice', $params['outputTokenPrice']);
$registryMGR->update('system', 'outputTokenPrice', $params['outputTokenPrice'] ?? '');
if (array_key_exists('aiPrompt', $params))
$registryMGR->update('system', 'aiPrompt', $params['aiPrompt']);
$registryMGR->update('system', 'aiPrompt', $params['aiPrompt'] ?? '');
$entityManager->persist($item);
$entityManager->flush();

View file

@ -236,7 +236,7 @@ final class DatabaseController extends AbstractController
private function updateLastBackupInfo(string $type, string $filename): void
{
$key = $type === 'ftp' ? 'last_ftp_backup' : 'last_backup';
$this->registryMGR->update('system_settings', $key, $filename);
$this->registryMGR->update('system_settings', $key, $filename ?? '');
}
private function createFtpDirectory($ftp, $dir): void

View file

@ -82,12 +82,12 @@ final class RegistrySettingsController extends AbstractController
$registryMGR->update($rootSystem, 'can_register', $data['canRegister'] ? '1' : '0');
$registryMGR->update($rootSystem, 'can_free_accounting', $data['canFreeAccounting'] ? '1' : '0');
$registryMGR->update($rootSystem, 'sms_price', (string) $data['smsPrice']);
$registryMGR->update($rootSystem, 'cloud_price_per_gb', (string) $data['cloudPricePerGb']);
$registryMGR->update($rootSystem, 'unlimited_price', (string) $data['unlimitedPrice']);
$registryMGR->update($rootSystem, 'accounting_doc_price', (string) $data['accountingDocPrice']);
$registryMGR->update($rootSystem, 'gift_credit', (string) $data['giftCredit']); // ذخیره فیلد جدید
$registryMGR->update($rootSystem, 'unlimited_duration', json_encode($data['unlimitedDuration']));
$registryMGR->update($rootSystem, 'sms_price', (string) ($data['smsPrice'] ?? 0));
$registryMGR->update($rootSystem, 'cloud_price_per_gb', (string) ($data['cloudPricePerGb'] ?? 0));
$registryMGR->update($rootSystem, 'unlimited_price', (string) ($data['unlimitedPrice'] ?? 0));
$registryMGR->update($rootSystem, 'accounting_doc_price', (string) ($data['accountingDocPrice'] ?? 0));
$registryMGR->update($rootSystem, 'gift_credit', (string) ($data['giftCredit'] ?? 0)); // ذخیره فیلد جدید
$registryMGR->update($rootSystem, 'unlimited_duration', json_encode($data['unlimitedDuration'] ?? []));
$registryMGR->update($rootSystem, 'sms_alert_enabled', $data['smsAlertEnabled'] ? '1' : '0');
$registryMGR->update($rootTicket, 'managerMobile', $data['smsAlertMobile'] ?? '');
$registryMGR->update('system', 'sponsers', $data['sponsorMessage'] ?? '');