403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/sproduction.datasync/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/sproduction.datasync/lib/remotediag.php
<?php
/**
 * Remote diagnostics page
 *
 * @mail support@s-production.online
 * @link s-production.online
 */

namespace SProduction\Datasync;

use Bitrix\Main\Localization\Loc;

class RemoteDiag
{
	public static function getMainInfo() {
		$result = [];
		// Engine info
		$info = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO'),
			'list' => [],
		];
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_VERSION'),
			'value' => self::formatValue(SM_VERSION),
		];
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_CHARSET'),
			'value' => self::formatValue(SITE_CHARSET),
		];
		$module_info = \SProdDatasync::getModuleInfo();
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_MODVERS'),
			'value' => self::formatValue($module_info['version']),
		];
		$incl_res = \Bitrix\Main\Loader::includeSharewareModule('sproduction.datasync');
		$demo_modes = [
			\Bitrix\Main\Loader::MODULE_NOT_FOUND => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_MODE_1'),
			\Bitrix\Main\Loader::MODULE_INSTALLED => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_MODE_2'),
			\Bitrix\Main\Loader::MODULE_DEMO => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_MODE_3'),
			\Bitrix\Main\Loader::MODULE_DEMO_EXPIRED => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_MODE_4')
		];
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_MODE'),
			'value' => self::formatValue($demo_modes[$incl_res]),
		];
		$module_const = 'sproduction_datasync_OLDSITEEXPIREDATE';
		$expire_date_f = '';
		if (defined($module_const)) {
			$expire_info = getdate(constant($module_const));
			$expire_ts = gmmktime($expire_info['hours'], $expire_info['minutes'], $expire_info['seconds'], $expire_info['mon'], $expire_info['mday'], $expire_info['year']);
			$expire_date = date('d.m.Y H:i:s', $expire_ts);
			$expire_date_f = self::formatValue($expire_date);
		}
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_EXPIRE_DEMO'),
			'value' => $expire_date_f,
		];
		$module_upd_info = \SProdDatasync::getUpdateInfo();
		if ($module_upd_info) {
			$info['list'][] = [
				'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_EXPIRE_LICENSE'),
				'value' => self::formatValue($module_upd_info['DATE_TO']),
			];
		}
		// PHP log
		$settings = include($_SERVER['DOCUMENT_ROOT'] . '/bitrix/.settings.php');
		if (isset($settings['exception_handling']['value']['log']['settings']['file'])) {
			$link = $settings['exception_handling']['value']['log']['settings']['file'];
			$info['list'][] = [
				'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_INFO_PHP_LOG'),
				'value' => $link,
			];
		}
		$result[] = $info;
		// Diagnostics
		$info = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_MAININFO_DIAG'),
			'list' => [],
		];
		$list = CheckState::checkList();
		if (is_array($list) && !empty($list)) {
			foreach ($list as $k => $value) {
				$info['list'][] = [
					'title' => $k,
					'value' => $value,
				];
			}
		}
		$result[] = $info;
		return $result;
	}

	public static function getOptions() {
		$result = [];
		$info = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_OPTIONS_GENERAL'),
			'list' => [],
		];
		global $DB;
		$sql_query = "SELECT * FROM `b_option` WHERE `MODULE_ID` = 'sproduction.datasync';";
		$db_res = $DB->Query($sql_query);
		$excludes = [
			'~bsm_stop_date',
		];
		while ($row = $db_res->Fetch()) {
			if ($row['NAME'] && !in_array($row['NAME'], $excludes)) {
				$info['list'][] = [
					'title' => $row['NAME'],
					'value' => self::formatValue($row['VALUE'], false),
				];
			}
		}
		$result[] = $info;
		return $result;
	}

	public static function getProfiles() {
		$result = [];
		$list = IblocksProfilesTable::getList([
			'order'  => ['id' => 'asc'],
		]);
		foreach ($list as $item) {
			$info = [
				'title' => Loc::getMessage('SP_DS_REMOTEDIAG_PROFILES_PROFILE') . ' "' . $item['name'] . '"',
				'list' => [],
			];
			foreach ($item as $item_k => $item_value) {
				$info['list'][] = [
					'title' => $item_k,
					'value' => self::formatValue($item_value),
				];
			}
			$result[] = $info;
		}
		return $result;
	}

	public static function getStoreData() {
		$result = [];
		$info = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_FIELDS_TITLE'),
			'list' => [],
		];
		$store_iblocks_list = StoreProducts::getIblocks(true);
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_IBLOCKS'),
			'value' => self::formatValue($store_iblocks_list),
		];
		foreach ($store_iblocks_list as $item) {
			$info['list'][] = [
				'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_PROPS') . $item['NAME'] . ' [' . $item['ID'] . ']',
				'value' => self::formatValue(StoreProducts::getIblockProps($item['ID'], true)),
			];
		}
//		$info['list'][]     = [
//			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_STATUSES'),
//			'value' => self::formatValue(ProfileInfo::getSiteStatuses([])),
//		];
//		$info['list'][]     = [
//			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_PERSON_TYPES'),
//			'value' => self::formatValue(ProfileInfo::getSitePersonTypes([])),
//		];
//		$info['list'][]     = [
//			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_PROPS'),
//			'value' => self::formatValue(ProfileInfo::getSiteProps([])),
//		];
//		$info['list'][]     = [
//			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_OTHER_PROPS'),
//			'value' => self::formatValue(ProfileInfo::getSiteOtherProps([])),
//		];
//		$info['list'][]     = [
//			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_CONTACT_FIELDS'),
//			'value' => self::formatValue(ProfileInfo::getSiteContactFields([])),
//		];
//		$info['list'][]     = [
//			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_STORE_USER_GROUPS'),
//			'value' => self::formatValue(ProfileInfo::getSiteUGroups([])),
//		];
		$result[] = $info;
		return $result;
	}

	public static function getCRMData() {
		$result = [];
		$info = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_CRM_FIELDS_TITLE'),
			'list' => [],
		];
		if (CheckState::checkConnection()) {
			$crm_iblocks_list = SettingsIblocksProfilesInfo::getCrmIblockList();
			$info['list'][] = [
				'title' => Loc::getMessage('SP_DS_REMOTEDIAG_CRM_IBLOCKS'),
				'value' => self::formatValue($crm_iblocks_list),
			];
			foreach ($crm_iblocks_list as $item) {
				$info['list'][] = [
					'title' => Loc::getMessage('SP_DS_REMOTEDIAG_CRM_FIELDS') . $item['name'] . ' [' . $item['id'] . ']',
					'value' => self::formatValue(PortalProducts::getFields($item['id'], true)),
				];
			}
		}
		$result[] = $info;
		return $result;
	}

	public static function getHandlers() {
		$result = [];
		$info = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_HANDLERS_TITLE'),
			'list' => [],
		];
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_HANDLERS_STORE'),
			'value' => self::formatValue(StoreHandlers::getList()),
		];
		$info['list'][] = [
			'title' => Loc::getMessage('SP_DS_REMOTEDIAG_HANDLERS_CRM'),
			'value' => self::formatValue(PortalHandlers::getList()),
		];
		$result[] = $info;
		return $result;
	}

	public static function getFilelog() {
		$result = [];
		$result['active'] = (Settings::get("filelog") == 'Y');
		$result['link'] = SettingsFileLog::getLink();
		$result['info'] = SettingsFileLog::get();
		return $result;
	}

	public static function formatValue($value, $simple=true) {
		$result = $value;
		if (!$simple) {
			$result = @unserialize($result);
			if ($result === false) {
				$result = $value;
			}
		}
		$result = print_r($result, true);
		$result = '<pre>' . $result . '</pre>';
		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit