14 $filterOptions = new \Bitrix\Main\UI\Filter\Options(
'xscan_report_filter');
18 foreach ($filters as
$k => $v)
49 $filter[] = [
'%SRC' =>
'/bitrix/admin'];
52 $filter[] = [
'%SRC' =>
'/bitrix/modules'];
55 $filter[] = [
'%SRC' =>
'/bitrix/components'];
58 $filter[] = [
'!%SRC' =>
'/bitrix/modules'];
62 [
'%SRC' =>
'/prolog_after.php'], [
'%SRC' =>
'/index.php'],
63 [
'%SRC' =>
'/content.php'], [
'%SRC' =>
'/main.php'], [
'%SRC' =>
'/spread.php'],
64 [
'%SRC' =>
'/bx_root.php'], [
'%SRC' =>
'/.access.php'], [
'%SRC' =>
'/radio.php']
71 if (strpos($v,
'!') === 0)
74 $filter[] = [
'LOGIC' =>
'AND', [
'!%SRC' => $v], [
'!%MESSAGE' => $v]];
78 $filter[] = [
'LOGIC' =>
'OR', [
'%SRC' => $v], [
'%MESSAGE' => $v]];
91 ini_set(
'display_errors',
'0');
92 Loc::loadMessages(__FILE__);
94 if (!Controller::getCurrentUser()->isAdmin())
99 return parent::processBeforeAction(
$action);
104 $file =
'/' . trim($file,
'/');
106 if (!$file || !file_exists($file))
108 $msg = \CBitrixXscan::ShowMsg(Loc::getMessage(
"BITRIX_XSCAN_FILE_NOT_FOUND") .
htmlspecialcharsbx($file),
'red');
112 $new_f = preg_replace(
'#\.php[578]?$#i',
'.ph_', $file);
113 if (rename($file, $new_f))
115 $msg = \CBitrixXscan::ShowMsg(Loc::getMessage(
"BITRIX_XSCAN_RENAMED") .
htmlspecialcharsbx($new_f));
119 $msg = \CBitrixXscan::ShowMsg(Loc::getMessage(
"BITRIX_XSCAN_ERR_RENAME") .
htmlspecialcharsbx($file),
'red');
128 $file =
'/' . trim($file,
'/');
130 if (!$file || !file_exists($file))
132 $msg = \CBitrixXscan::ShowMsg(Loc::getMessage(
"BITRIX_XSCAN_FILE_NOT_FOUND") .
htmlspecialcharsbx($file),
'red');
136 $new_f = preg_replace(
'#\.ph_$#',
'.php', $file);
137 if (rename($file, $new_f))
139 $msg = \CBitrixXscan::ShowMsg(Loc::getMessage(
"BITRIX_XSCAN_RENAMED") .
htmlspecialcharsbx($new_f));
143 $msg = \CBitrixXscan::ShowMsg(Loc::getMessage(
"BITRIX_XSCAN_ERR_RENAME") .
htmlspecialcharsbx($file),
'red');
152 $file =
'/' . trim($file,
'/');
155 $ent = XScanResultTable::getList([
'select' => [
'ID'],
'filter' => [
'SRC' => $file]])->fetch();
160 $msg = \CBitrixXscan::ShowMsg(Loc::getMessage(
"BITRIX_XSCAN_HIDED") .
htmlspecialcharsbx($file));
179 $file =
'/' . trim($file,
'/');
183 XScanResultTable::add([
'TYPE' =>
'file',
'SRC' => $file,
'MESSAGE' =>
'error',
'SCORE' => 0.5]);
189 public function scanAction(
string $start_path,
string $break_point =
'',
string $clean =
'N',
int $progress = 0,
int $total = 0)
191 $start_path = $start_path ? $start_path :
$_SERVER[
'DOCUMENT_ROOT'];
192 $start_path = rtrim($start_path,
'/');
194 $scaner = new \CBitrixXscan($progress, $total, $start_path);
195 $scaner->skip_path = $break_point;
199 if (!is_dir($start_path))
201 $msg = Loc::getMessage(
"BITRIX_XSCAN_NACALQNYY_PUTQ_NE_NA");
202 return [
'error' => $msg];
207 $session[
'xscan_page'] = 1;
210 $scaner->start($start_path);
217 $scaner->Search($start_path);
221 $prc = $scaner->total == 0 ? min(75, (
int)($scaner->progress / 1000)) : (int)($scaner->progress * 100 / $scaner->total);
224 'progress' => $scaner->progress,
225 'total' => $scaner->total,
226 'break_point' => $scaner->break_point,
237 $localStorage->clear();
238 $localStorage->set(
'timestamp', time());
239 $localStorage->set(
'status',
'pending');
244 $searcher = new \CBitrixXscanHtaccess();
245 $searcher->skip_path = $break_point;
246 $searcher->Search(
$path);
248 $files = $localStorage[
'files'] ?? [];
250 if($searcher->result)
253 $localStorage->set(
'files',
$files);
256 if (!$searcher->break_point)
258 $localStorage->set(
'status',
'done');
264 'break_point' => $searcher->break_point
static normalizeArrayValuesByInt(&$map, $sorted=true)
findHtaccessAction(string $break_point='')
prisonAction(string $file)
processBeforeAction(Action $action)
addErrorAction(string $file)
scanAction(string $start_path, string $break_point='', string $clean='N', int $progress=0, int $total=0)
hideFilesAction(array $files, string $all='false')
releaseAction(string $file)
static deleteList(array $filter)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"