Sh3ll
OdayForums


Server : Apache
System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64
User : tradze ( 1001)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /opt/cpanel/ea-wappspector/src/Matchers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/cpanel/ea-wappspector/src/Matchers/Duda.php
<?php

declare(strict_types=1);

namespace Plesk\Wappspector\Matchers;

use League\Flysystem\Filesystem;
use Plesk\Wappspector\Helper\InspectorHelper;
use Plesk\Wappspector\MatchResult\Duda as MatchResult;
use Plesk\Wappspector\MatchResult\EmptyMatchResult;
use Plesk\Wappspector\MatchResult\MatchResultInterface;

class Duda implements MatcherInterface
{
    private const CSS_FILES = [
        '/Style/desktop.css',
        '/Style/mobile.css',
        '/Style/tablet.css',
    ];

    private const RUNTIME_JS_FILE = '/Scripts/runtime.js';

    public function match(Filesystem $fs, string $path): MatchResultInterface
    {
        $rTrimPath = rtrim($path, '/');

        $cssFile = $this->getCssFile($fs, $rTrimPath);

        $inspectorHelper = new InspectorHelper();

        if ($cssFile !== null) {
            $cssFileContent = $fs->read($rTrimPath . $cssFile);
            if (
                $inspectorHelper->fileContentContainsString($cssFileContent, 'dmDudaonePreviewBody') ||
                $inspectorHelper->fileContentContainsString($cssFileContent, 'dudaSnipcartProductGalleryId')
            ) {
                return new MatchResult($path);
            }
        }

        if (!$fs->fileExists($rTrimPath . self::RUNTIME_JS_FILE)) {
            return new EmptyMatchResult();
        }

        return $inspectorHelper->fileContainsString($fs, $rTrimPath . self::RUNTIME_JS_FILE, 'duda')
            ? new MatchResult($path)
            : new EmptyMatchResult();
    }

    private function getCssFile(Filesystem $fs, string $path): ?string
    {
        foreach (self::CSS_FILES as $cssFile) {
            if ($fs->fileExists($path . $cssFile)) {
                return $cssFile;
            }
        }

        return null;
    }
}

ZeroDay Forums Mini