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/cvetdv.ru/bitrix/modules/acrit.cleanmaster/admin/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/acrit.cleanmaster/admin/processor.php
<?php
use Acrit\Cleanmaster\ProfilesTable,
	Acrit\Cleanmaster\LastDiagTable,
	Acrit\Cleanmaster\DiagInterface,
	Acrit\Cleanmaster\Steps\BaseStep,
	Bitrix\Main\Web\Json,
	Bitrix\Main\Application,
	Bitrix\Main\Config\Option;

// tuning file cache buckets create
define('CACHED_b_file', 3600);
define("CACHED_b_file_bucket_size", 3);

// performance
define("STOP_STATISTICS",       true);
define("NO_KEEP_STATISTIC",     true);
define("NO_AGENT_STATISTIC",    "Y");
define("NOT_CHECK_PERMISSIONS", true);
define("DisableEventsCheck",    true);

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";

/**
 * @global $APPLICATION \CMain
 * @global $USER \CUser
 * @global $DB \CDatabase
 * @global $USER_FIELD_MANAGER \CUserTypeManager
 */

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
set_time_limit(300);

IncludeModuleLangFile(__FILE__);

$moduleId = 'acrit.cleanmaster';

if ($APPLICATION->GetUserRight($moduleId) <= 'D') {
	ob_start();
	CAdminMessage::ShowMessage([
		'MESSAGE' => GetMessage("ACRIT_CLEANMASTER_DOSTUP_K_MODULU_ZAPR"),
		'TYPE' => 'FAIL',
		'HTML' => true
	]);
	$processorResult = [
		'result' => 'FAIL',
		'message' => ob_get_clean()
	];
	echo CUtil::PhpToJSObject($processorResult);
	die();
}

CModule::IncludeModule($moduleId);

/* @var $delete_lost_files string */
/* @var $download_lost_files string */
/* @var $revert_tmp_dir string */
/* @var $clear_tmp_dir string */

// needed superglobals, omg, recreate to register
global $action, $funcName, $isDemo, $save_profile;

CCleanMain::includeAllNeedModules();

if ($save_profile == 'Y') {
	$request = \Bitrix\Main\Application::getInstance()->getContext()->getRequest()->toArray();
	$config = $request;
	unset($config['action'], $config['save_profile'], $config['analyse']);

	if (!defined('BX_UTF') && constant('BX_UTF') !== true) {
		$config = CCleanMain::convArray_r($config);
		if (!is_array($config)) {
			$config = [];
		}
	}

	ProfilesTable::clearAllByStep($action);
	$r = ProfilesTable::add([
		'STEP_ID' => $action,
		'PARAMS' => Json::encode($config)
	]);

	if ($r->isSuccess()) {
		$message = GetMessage('ACRIT_CLEANMASTER_PROFILE_ADDED', ['#PROFILE_ID#' => $r->getId()]);
	} else {
		$message = GetMessage('ACRIT_CLEANMASTER_PROFILE_ADDED_ERROR') . '<br><br>' . implode('<br>', $r->getErrorMessages());
	}
	echo Json::encode([
		'result' => 'OK',
		'action' => 'process',
		'DATA' => $message,
		'PROGRESS' => false
	]);
	exit;
}

if ($delete_lost_files == 'Y') {
	$funcName = 'clearAction5_LostFiles';
}
if ($download_lost_files == 'Y') {
	$funcName = 'clearAction5_DownloadLostFiles';
}
if ($revert_tmp_dir == 'Y') {
	$funcName = 'clearAction5_RevertTmpDir';
}
if ($clear_tmp_dir == 'Y') {
	$funcName = 'clearAction5_ClearTmpDir';
}

// runner
$funcName = !$funcName ? "clearAction$action" : $funcName;
$APPLICATION->RestartBuffer();
if (! function_exists($funcName) && !Application::getInstance()->getContext()->getRequest()->isAjaxRequest()) {
	die('Wrong request data');
}
echo $funcName();
die();

function diagnostic()
{
	global $diagnosticStep, $steps, $stepParams, $showFinded, $isDemo, $APPLICATION;

	$obLastDiag = new LastDiagTable();

	if (strpos($steps, '|') !== false) {
		$steps = explode('|', $steps);
		$steps = array_filter($steps);
	} else if (is_numeric($steps)) {
		$steps = [$steps];
	} else {
		$steps = false;
	}

	if ($diagnosticStep == 1 || $showFinded == 1) {
		$_SESSION['cleanmaster']['diagnostic'] = [
			'file_index' => ['complete' => false, 'step' => 0, 'class' => 'CCleanUpload', 'method' => 'fillBfileIndex', 'method_cnt_steps' => 'getCountStepsBfileIndex', 'id' => 5],
			'upload' => ['complete' => false, 'step' => 0, 'class' => 'CCleanUpload', 'method' => 'GetDiagnosticData', 'id' => 5],
			'cache' => ['complete' => false, 'step' => 1, 'class' => 'CCleanCache', 'method' => 'GetDiagnosticData', 'id' => 8],
			'site' => ['complete' => false, 'step' => 1, 'class' => 'CCleanSite', 'method' => 'GetDiagnosticData', 'id' => 1],
			'templates' => ['complete' => false, 'step' => 1, 'class' => 'CCleanTemplate', 'method' => 'GetDiagnosticData', 'id' => 2],
			'ibelement' => ['complete' => false, 'step' => 1, 'class' => 'CCleanIBlock', 'method' => 'GetDiagnosticData', 'id' => 3],
			'mailtemplate' => ['complete' => false, 'step' => 1, 'class' => 'CCleanMailTemplate', 'method' => 'GetDiagnosticData', 'id' => 4],
			'user' => ['complete' => false, 'step' => 1, 'class' => 'CCleanUser', 'method' => 'GetDiagnosticData', 'id' => 6],
			'stathistory' => ['complete' => false, 'step' => 1, 'class' => 'CCleanSubscribe', 'method' => 'GetDiagnosticDataHistory', 'id' => 13],
			'webform' => ['complete' => false, 'step' => 1, 'class' => 'CCleanWebForm', 'method' => 'GetDiagnosticData', 'id' => 14],
			'lang' => ['complete' => false, 'step' => 1, 'class' => 'CCleanLanguage', 'method' => 'GetDiagnosticData', 'id' => 16],
			'module' => ['complete' => false, 'step' => 1, 'class' => 'CCleanModule', 'method' => 'GetDiagnosticData', 'id' => 17],
			'component' => ['complete' => false, 'step' => 1, 'class' => 'CCleanComponent', 'method' => 'GetDiagnosticData', 'id' => 20],
		];

		if (Option::get(\CCleanMain::MODULE_ID, 'CCleanUpload_CALC_CNT_CTEPS', 'N') === 'Y') {
			$_SESSION['cleanmaster']['diagnostic']['upload']['method_cnt_steps'] = 'getCountStepsDiagnosticData';
		}

		if (CModule::IncludeModule('sale')) {
			$_SESSION['cleanmaster']['diagnostic']['orderstat'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanOrderStat', 'method' => 'GetDiagnosticData', 'id' => 7];
			$_SESSION['cleanmaster']['diagnostic']['dropbasket'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanDropedBasket', 'method' => 'GetDiagnosticData', 'id' => 11];
			$_SESSION['cleanmaster']['diagnostic']['saleviewed'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanSaleViewed', 'method' => 'GetDiagnosticData', 'id' => 23];
		}
		$_SESSION['cleanmaster']['diagnostic']['attackevent'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanAttackEvent', 'method' => 'GetDiagnosticData', 'id' => 9];
		if (CModule::IncludeModule('statistic')) {
			$_SESSION['cleanmaster']['diagnostic']['webhist'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanWebHistory', 'method' => 'GetDiagnosticData', 'id' => 10];
		}
		if (CModule::IncludeModule('subscribe')) {
			$_SESSION['cleanmaster']['diagnostic']['rubric'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanSubscribe', 'method' => 'GetDiagnosticDataRubric', 'id' => 21];
			$_SESSION['cleanmaster']['diagnostic']['unconfirmed'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanSubscribe', 'method' => 'GetDiagnosticDataUnconfirmed', 'id' => 12];
		}
		if (CModule::IncludeModule('perfmon')) {
			$_SESSION['cleanmaster']['diagnostic']['perfmon'] = ['complete' => false, 'step' => 1, 'class' => 'CCleanPerfmon', 'method' => 'GetDiagnosticData', 'id' => 22];
		}

		$_SESSION['cleanmaster']['diagnostic']['demo_data']	= ['complete' => false, 'step' => 1, 'class' => '\\Acrit\\Cleanmaster\\Steps\\Step30', 'method' => 'GetDiagnosticData', 'id' => 30];

		for ($i = 33; $i < 50; $i++) {
			$className = 'Acrit\Cleanmaster\Steps\Step'.$i;
			/** @var Acrit\Cleanmaster\Steps\BaseStep $className */

			if (! class_exists($className) || !is_callable($className, 'getDiagnosticSteps')) {
				continue;
			}

			$diagCodesConfig = $className::getDiagnosticSteps();
			foreach ($diagCodesConfig as $code => $conf) {
				$_SESSION['cleanmaster']['diagnostic'][$code]	= [
					'complete' => false, 'step' => 0, 'class' => $conf['class'], 'method' => $conf['method'],
					'method_cnt_steps' => $conf['method_cnt_steps'],
					'id' => $className::getId(),
				];
			}
		}

		// rewrite test
		/*$_SESSION['cleanmaster']['diagnostic'] = array(
			'demo_data'		=> ['complete' => false, 'step' => 1, 'class' => '\\Acrit\\Cleanmaster\\Steps\\Step30', 'method' => 'GetDiagnosticData', 'id' => 30]
		);*/

		if (is_array($steps) && count($steps) > 0) {
			$needSteps = [];
			foreach ($steps as $st) {
				/** @noinspection SlowArrayOperationsInLoopInspection */
				$needSteps = array_merge($needSteps, (array)CCleanMain::getDiagnosticStepCodesByStep($st));
			}
			foreach ($_SESSION['cleanmaster']['diagnostic'] as $diagStepCode => $data) {
				if (!in_array($diagStepCode, $needSteps)) {
					unset($_SESSION['cleanmaster']['diagnostic'][$diagStepCode]);
				}
			}
		}
	}

	// restore params from first step
	if ($diagnosticStep == 1) {
		foreach ($_SESSION['cleanmaster']['diagnostic'] as $key => &$proc) {
			// back from $('form', _actionContainer).serialize()
			parse_str($stepParams[ $proc['id'] ], $v);
			if (is_array($v['stepParams']) && count($v['stepParams']) > 0) {
				$proc['stepParams'] = $v['stepParams'];
			} else {
				$proc['stepParams'] = [];
			}
		}
		unset($proc);
	}

	if ($diagnosticStep == 1 && $showFinded != 1) {
		$obLastDiag->clearAll();
	}

	// restore session from DB
	foreach ($_SESSION['cleanmaster']['diagnostic'] as $key => &$proc) {
		$procDb = $obLastDiag->returnSavedStep($key);
		if ($procDb['PARAMS']['complete']) {
			$proc = $procDb['PARAMS'];
		}

		if ($showFinded == 1 && !$proc['complete']) {
			unset($_SESSION['cleanmaster']['diagnostic'][$key]);
		}
	}
	unset($proc);

	$continue = false;
	$progressBar = '';
	$message = '';
	$stepCnt = 0;
	foreach ($_SESSION['cleanmaster']['diagnostic'] as $key => $proc) {
		$stepCnt++;
		if ($proc['complete'] === false) {
			if (is_subclass_of($proc['class'], BaseStep::class)) {
				$obj = new $proc['class']( (array)$proc['stepParams'] );
			} else {
				$obj = new $proc['class']();
			}

			if (!isset($proc['cnt_steps']) && is_callable([$obj, $proc['method_cnt_steps']])) {
				$_SESSION['cleanmaster']['diagnostic'][$key]['cnt_steps'] = $proc['cnt_steps'] = $obj->{$proc['method_cnt_steps']}();
			}

			$barName = trim(GetMessage($key . '_analize')) != '' ? GetMessage($key . '_analize') : GetMessage('default_analize');
			if ($proc['step'] > 1) {
				$barName .= GetMessage('ACRIT_CLEANMASTER_DIAGNOSTIC_STEP', ['#STEP#' => $proc['step']]);
				if ($proc['cnt_steps'] > 0) {
					$barName .= GetMessage('ACRIT_CLEANMASTER_DIAGNOSTIC_STEP_CNT', ['#CNT_STEPS#' => $proc['cnt_steps']]);
				}
			}

			$progressBar = GetMessage('progress', [
				'#NAME#' => $barName,
				'#PERSENT_VALUE#' => (int)($stepCnt / count($_SESSION['cleanmaster']['diagnostic']) * 500),
				'#PERSENT#' => (int)($stepCnt / count($_SESSION['cleanmaster']['diagnostic']) * 100),
			]);

			if (($freeSpace = $obj->{$proc['method']}($proc['step'])) !== false) {
				$_SESSION['cleanmaster']['diagnostic'][$key]['step']++;
			} else {
				$_SESSION['cleanmaster']['diagnostic'][$key]['complete'] = true;
			}
			$continue = true;
			break;
		} else {
			$procDb = $obLastDiag->returnSavedStep($key);
			if (! $procDb['PARAMS']['complete']) {
				$obLastDiag->addFinishedStep($key, $proc);
			}
		}
	}

	if ($continue) {
		ob_start();
		?>
		<script>
			$.ajax({
				method: 'POST',
				url: '/bitrix/admin/acrit_cleanmaster_processor.php',
				data: 'funcName=diagnostic&steps=<?=implode('|', (array)$steps)?>',
				success: function (data) {
					try {
						var obj = JSON.parse(data);
						if (obj.result == 'OK' && obj.action == 'process') {

							<?if (count( array_filter((array)$steps) ) <= 0) {?>
								$('.cleanmaster-area form').first().html(obj.DATA);
							<?} else {?>
								$('.cleanmaster-area .diagnostic-steps').html(obj.DATA);
							<?}?>

							$('.progress-bar').html(obj.PROGRESS);
						}
					} catch (e) {
						alert("<?=GetMessage("ACRIT_CLEANMASTER_DIAGNOSTIC_JS_ERROR")?>\n" + e.toString() + "\n\n" + data);
						console.log(e);
						console.log(data);
					}
				},
				error: function (jqXHR, textStatus, errorThrown) {
					alert("<?=GetMessage("ACRIT_CLEANMASTER_DIAGNOSTIC_JS_ERROR")?>\n" + textStatus +  "\n\n" + errorThrown);
					console.log(textStatus);
					console.log(errorThrown);
				}
			});
		</script>
		<?
		$message .= ob_get_clean();
	} else {
		$message .= '<div class="adm-list-table-wrap" id="bx_admin_prefix"><table class="adm-list-table">';

		if ($isDemo == 1 /*&& count($steps) <= 0*/) {
			$message .= GetMessage('ACRIT_CLEANMASTER_DIAGNOSTIC_TABLE_HEAD');
		} else {
			$message .= GetMessage('ACRIT_CLEANMASTER_DIAGNOSTIC_TABLE_HEAD_DEMO');
		}

		$fullDiagHtml = DiagInterface::showHtmlFromDiag($_SESSION['cleanmaster']['diagnostic'], $isDemo, $steps);

		$summ = (float)$fullDiagHtml['summ'];
		$message .= $fullDiagHtml['html'];
		unset($fullDiagHtml);

		if ($isDemo == 1 /*&& count($steps) <= 0*/) {
			$message .= GetMessage('ACRIT_CLEANMASTER_DIAGNOSTIC_TABLE_FOOT', ["#SUM#" => $summ]);
		} else {
			$message .= GetMessage('ACRIT_CLEANMASTER_DIAGNOSTIC_TABLE_FOOT_DEMO', ["#SUM#" => $summ]);
		}

		$message .= '</table></div>';

		/*if ($isDemo == 1 && count($steps) <= 0) {
			$message .= '<input type="hidden" name="action_start" value="Y">'
				. '<input class="adm-btn adm-btn-save" type="submit" name="select_action" value="' . GetMessage('CLEANMASTER_ACTION_CLEANSTART')
				. '" style="float: right; margin-top: 20px"/>';
		}*/

		$message .= '<br clear="all"><br>';

		/*$message .= '<pre>'.print_r($_SESSION['cleanmaster']['diagnostic'], true).'</pre><br>';
		$message .= '<pre>'.print_r($proc, true).'</pre><br>';*/
	}


	$APPLICATION->RestartBuffer();
	return Json::encode([
		'result' => 'OK',
		'action' => 'process',
		'DATA' => $message,
		'PROGRESS' => $progressBar,
	]);
}


Youez - 2016 - github.com/yon3zu
LinuXploit