Your IP : 216.73.217.68


Current Path : /home/wuectly/www/03cbe/
Upload File :
Current File : /home/wuectly/www/03cbe/browser.tar

index.html000060400000000054152456600430006541 0ustar00<html><body bgcolor="#FFFFFF"></body></html>config.php000060400000000577152456600430006534 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Editor
 *
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

class WFBrowserPluginConfig
{
    public static function getConfig(&$settings)
    {
        $settings['file_browser_callback'] = '';
    }
}
browser.php000060400000034564152456600430006755 0ustar00<?php

/**
 * @package     JCE
 * @subpackage  Editor
 *
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;

class WFBrowserPlugin extends WFMediaManager
{
    /*
     * @var string
     */
    protected $_filetypes = 'doc,docx,dot,dotx,ppt,pps,pptx,ppsx,xls,xlsx,gif,jpeg,jpg,png,webp,apng,avif,pdf,zip,tar,gz,swf,rar,mov,mp4,m4a,flv,mkv,webm,ogg,ogv,qt,wmv,asx,asf,avi,wav,mp3,aiff,oga,odt,odg,odp,ods,odf,rtf,txt,csv';

    private function isMediaField()
    {
        $app = Factory::getApplication();
        return $app->input->getInt('standalone') && $app->input->getString('mediatype') && $app->input->getCmd('fieldid', $app->input->getCmd('element', ''));
    }

    /**
     * Get a parameter by key.
     *
     * @param string $key        Parameter key eg: editor.width
     * @param mixed  $fallback   Fallback value
     * @param mixed  $default    Default value
     * @param string $type       Variable type eg: string, boolean, integer, array
     *
     * @return mixed
     */
    public function getParam($key, $fallback = '', $default = '', $type = 'string')
    {
        $wf = WFApplication::getInstance();

        $value = parent::getParam($key, $fallback, $default, $type);

        // get all keys
        $keys = explode('.', $key);

        // get caller if any
        $caller = $this->get('caller');

        // create new namespaced key
        if ($caller && ($keys[0] === $caller || count($keys) == 1)) {
            // create new key
            $key = $caller . '.' . 'browser' . '.' . array_pop($keys);
            // get namespaced value, fallback to base parameter
            $value = $wf->getParam($key, $value, $default, $type);
        }

        return $value;
    }

    public function __construct($config = array())
    {
        $app = Factory::getApplication();

        $config = array(
            'layout' => 'browser',
            'can_edit_images' => 1,
            'show_view_mode' => 1,
        );

        parent::__construct($config);

        $browser = $this->getFileBrowser();

        // get mediatype from xml
        $mediatypes = $app->input->getString('mediatype', $app->input->getString('filter', 'files'));

        if ($mediatypes) {
            // add upload event
            $browser->addEvent('onUpload', array($this, 'onUpload'));

            // clean and lowercase filter value
            $mediatypes = (string) preg_replace('/[^\w_,]/i', '', strtolower($mediatypes));

            // get filetypes from params
            $filetypes = $this->getParam('extensions', $this->get('_filetypes'));

            // map to comma seperated list
            $filetypes = $browser->getFileTypes('list', $filetypes);

            $accept = explode(',', $filetypes);

            $map = array(
                'images' => array('jpg', 'jpeg', 'png', 'apng', 'gif', 'webp', 'avif'),
                'media' => array('avi', 'wmv', 'wm', 'asf', 'asx', 'wmx', 'wvx', 'mov', 'qt', 'mpg', 'mpeg', 'm4a', 'm4v', 'swf', 'dcr', 'rm', 'ra', 'ram', 'divx', 'mp4', 'ogv', 'ogg', 'webm', 'flv', 'f4v', 'mp3', 'ogg', 'wav', 'xap'),
                'documents' => array('doc', 'docx', 'odg', 'odp', 'ods', 'odt', 'pdf', 'ppt', 'pptx', 'txt', 'xcf', 'xls', 'xlsx', 'csv'),
                'html' => array('html', 'htm', 'txt', 'md'),
                'files' => $accept, // “files” == everything allowed
            );

            // add svg support to images if it is allowed in filetypes
            if (in_array('svg', $accept)) {
                $map['images'][] = 'svg';
            }

            // explode the mediatypes
            $mediatypes = explode(',', $mediatypes);

            // selected filetypes
            $selected = array();

            foreach ($mediatypes as $mediatype) {
                // trim the value
                $mediatype = trim($mediatype);

                // strtolower the value
                $mediatype = strtolower($mediatype);
                
                // mediaypes contains a mapped type
                if (array_key_exists($mediatype, $map)) {
                    // process the map to filter permitted extensions
                    /*array_walk($map, function (&$items, $key) use ($accept) {
                        $values = array_intersect($items, $accept);
                        $items = empty($values) ? [] : $values;
                    });*/

                    //$selected = $map[$mediatype];

                    $selected = array_values(array_intersect($map[$mediatype], $accept));
                } else {
                    if (in_array($mediatype, $accept, true)) {
                        // add the mediatype to the selected filetypes
                        $selected[] = $mediatype;
                    }
                }
            }

            // remove duplicates
            $selected = array_values(array_unique($selected));

            // set updated filetypes
            $this->setFileTypes(implode(',', $selected));
        }

        $folder = $this->getMediaFolder();

        if ($folder) {
            // process any variables in the path
            $path = $browser->getFileSystem()->toRelative($folder, false);

            if ($browser->checkPathAccess($path)) {
                // set new path for browser
                $browser->set('source', $folder);
            }
        }
    }

    private function getMediaFolder()
    {
        $app = Factory::getApplication();

        $folder = $app->input->getString('mediafolder', '');

        if ($folder) {
            // trim the path of leading : if any
            $folder = trim($folder, ':');

            // trim the path of leading and trailing /
            $folder = trim($folder, '/');
        
            // clean
            $folder = WFUtility::cleanPath($folder);

            // split by / and each part "safe"
            $parts = explode('/', $folder);

            foreach ($parts as $key => $part) {
                $parts[$key] = WFUtility::makeSafe($part);
            }

            // rejoin parts
            $folder = implode('/', $parts);

            // clean path again
            $folder = WFUtility::cleanPath($folder);

            // still intact after clean?
            if ($folder) {
                $browser = $this->getFileBrowser();

                // check this path is within an existing store
                $store = $browser->getDirectoryStoreFromPath($folder);

                if (!empty($store)) {
                    // check path exists
                    if ($browser->getFileSystem()->is_dir($folder)) {
                        return $folder;
                    }
                }
            }
        }

        return '';
    }

    /**
     * Normalize a Joomla Media Field path
     *
     * @param  string   $folder
     *
     * @return string
     */
    private function normalizeLocalJoomlaFolder($folder)
    {
        if (empty($folder)) {
            return '';
        }

        $folder = rawurldecode($folder);

        // shouldn't be an absoute URL so return empty string
        if (strpos($folder, '://') !== false) {
            return '';
        }

        // default scheme and path
        $scheme = 'local-images';
        $path = $folder;

        $pos = strpos($folder, ':');

        if ($pos !== false) {
            $scheme = substr($folder, 0, $pos);
            $path = trim(substr($folder, $pos + 1), " \t\n\r\0\x0B/");
        }

        $map = array(
            'local-images' => 'images',
            'local-files' => 'files',
        );

        // map the scheme to a root folder
        $root = isset($map[$scheme]) ? $map[$scheme] : 'images';

        // trim to remove slashes
        $path = trim($path, '/');

        // concatenate the path with the mapped folder
        $folder = $root . '/' . $path;

        // trim to remove slashes
        $folder = trim($folder, '/');

        return $folder;
    }

    /**
     * Update the File Browser configuration with the current media folder.
     *
     * @param array $config Configuration array to update.
     * @return array $config Updated configuration array.
     */
    protected function getFileBrowserConfig($config = array())
    {
        $app = Factory::getApplication();

        $config = parent::getFileBrowserConfig($config);

        // update folder path if a value is passed from a mediafield url
        if ($this->isMediaField()) {
            // get the mediafolder value from a JCE Media Field if any
            $folder = $app->input->getString('mediafolder', '');

            $folder = trim(rawurldecode($folder));

            $prefix = '';

            // check if this is a root folder by looking for a : character at the start of the path value
            $isRootFolder = strpos($folder, ':') === 0;

            // trim the path of leading : if any
            $folder = trim($folder, ':');

            // trim the path of leading and trailing /
            $folder = trim($folder, '/');

            if (empty($config['dir'])) {
                $root = array('path' => '');
            } else {
                if ($isRootFolder) {
                    if (!empty($folder)) {
                        $tmpPath = $folder . '/';

                        foreach ($config['dir'] as $key => $store) {
                            $base = trim($store['path'], '/');

                            // strip any variable segments (eg: $usergroup) to get the comparable literal prefix
                            $literalBase = trim(preg_replace('/\/?\$.*$/', '', $base), '/');

                            // check if the folder is within this directory store path
                            if (!empty($literalBase) && ($folder === $literalBase || strpos($tmpPath, $literalBase . '/') === 0)) {
                                $hash = md5($folder);

                                $config['dir'] = array(
                                    $hash => array(
                                        'label' => '',
                                        'path'  => $folder,
                                    ),
                                );

                                return $config;
                            }
                        }
                    }

                    // no match found - fall through and treat as relative to dir value
                }

                // get the first directory store prefix
                $prefix = key($config['dir']);
                // get the first directory store
                $root = reset($config['dir']);
            }

            if ($app->input->getInt('converted', 0) === 1) {
                // get the path from a converted media field
                $folder = $app->input->getString('path', $app->input->getString('folder', '')); // include "folder" for Joomla 3

                // normalize the folder path of Joomla Media Field, creating a local path, eg: local-images:/folder/subfolder => images/folder/subfolder
                $folder = $this->normalizeLocalJoomlaFolder($folder);

                if ($folder) {
                    $tmpPath = $folder . '/';

                    foreach ($config['dir'] as $key => $store) {
                        $base = trim($store['path'], '/');

                        // check if the folder is within any directory store path
                        if ($tmpPath === $base || strpos($tmpPath, $base . '/') === 0) {
                            $root['path'] = $tmpPath;
                            break;
                        }
                    }

                    // reset folder
                    $folder = '';
                }
            }

            $path = WFUtility::makePath($root['path'], $folder);
            $path = trim($path, '/');

            if (empty($prefix)) {
                $hash = md5($path);
            } else {
                $hash = $prefix;
            }

            $config['dir'] = array(
                $hash => array(
                    'label' => '',
                    'path' => $path,
                ),
            );
        }

        return $config;
    }

    public function setFileTypes($filetypes = '')
    {
        // get file browser reference
        $browser = $this->getFileBrowser();

        // set updated filetypes
        $browser->setFileTypes($filetypes);
    }

    /**
     * Display the plugin.
     */
    public function display()
    {
        parent::display();

        $app = Factory::getApplication();

        $document = WFDocument::getInstance();
        $slot = $app->input->getCmd('slot', 'plugin');

        // update some document variables
        $document->setName('browser');
        $document->setTitle(Text::_('WF_BROWSER_TITLE'));

        if ($document->get('standalone') == 1) {
            if ($slot === 'plugin') {
                $document->addScript(array('window.min'));

                $callback = $app->input->getCmd('callback', '');
                $element = $app->input->getCmd('fieldid', 'field-media-id');

                // Joomla 4 field variable not converted
                if ($element == 'field-media-id') {
                    $element = $app->input->getCmd('element', '');
                }

                $settings = array(
                    'site_url' => Uri::base(true) . '/',
                    'document_base_url' => Uri::root(),
                    'language' => WFLanguage::getCode(),
                    'element' => $element,
                    'token' => Session::getFormToken(),
                );

                if ($callback) {
                    $settings['callback'] = $callback;
                }

                $document->addScriptDeclaration('tinymce.settings=' . json_encode($settings) . ';');
            }

            $document->addScript(array('popup.min'), 'plugins');
            $document->addStyleSheet(array('browser.min'), 'plugins');
        }

        if ($slot === 'plugin') {
            $document->addScript(array('browser'), 'plugins');
        }
    }

    public function onUpload($file, $relative = '')
    {
        $app = Factory::getApplication();

        parent::onUpload($file, $relative);

        // inline upload
        if ($app->input->getInt('inline', 0) === 1) {
            $result = array(
                'file' => $relative,
                'name' => basename($file),
            );

            return $result;
        }

        return array();
    }
}
browser.xml000060400000015104152456600430006753 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension version="3.4" type="plugin" group="jce" method="upgrade">
    <name>WF_BROWSER_TITLE</name>
    <version>2.9.99.2</version>
    <creationDate>22-04-2026</creationDate>
    <author>Ryan Demmer</author>
    <authorEmail>info@joomlacontenteditor.net</authorEmail>
    <authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
    <copyright>Ryan Demmer</copyright>
    <license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
    <description>WF_BROWSER_DESC</description>
    <icon></icon>
    <files></files>
    <fields name="browser">
        <fieldset name="config">
            <field name="dir" type="filesystempath" default="" size="50" label="WF_PARAM_DIRECTORY" description="WF_PARAM_DIRECTORY_DESC"/>
            <field name="max_size" class="input-small" hint="1024" max="" type="uploadmaxsize" step="128" label="WF_PARAM_UPLOAD_SIZE" description="WF_PARAM_UPLOAD_SIZE_DESC" placeholder="" />
            <field name="extensions" type="filetype" default="doc,docx,dot,dotx,ppt,pps,pptx,ppsx,xls,xlsx,gif,jpeg,jpg,png,apng,webp,avif,pdf,zip,tar,gz,swf,rar,mov,mp4,m4a,flv,mkv,webm,ogg,ogv,qt,wmv,asx,asf,avi,wav,mp3,aiff,oga,odt,odg,odp,ods,odf,rtf,txt,csv" label="WF_PARAM_EXTENSIONS" description="WF_PARAM_EXTENSIONS_DESC">
                <option value="doc">doc</option>
                <option value="docx">docx</option>
                <option value="dot">dot</option>
                <option value="dotx">dotx</option>
                <option value="ppt">ppt</option>
                <option value="pps">pps</option>
                <option value="pptx">pptx</option>
                <option value="ppsx">ppsx</option>
                <option value="xls">xls</option>
                <option value="xlsx">xlsx</option>
                <option value="gif">gif</option>
                <option value="jpeg">jpeg</option>
                <option value="jpg">jpg</option>
                <option value="png">png</option>
                <option value="apng">apng</option>
                <option value="webp">webp</option>
                <option value="avif">avif</option>
                <option value="pdf">pdf</option>
                <option value="zip">zip</option>
                <option value="tar">tar</option>
                <option value="gz">gz</option>
                <option value="swf">swf</option>
                <option value="rar">rar</option>
                <option value="mov">mov</option>
                <option value="mp4">mp4</option>
                <option value="m4a">m4a</option>
                <option value="flv">flv</option>
                <option value="mkv">mkv</option>
                <option value="webm">webm</option>
                <option value="ogg">ogg</option>
                <option value="ogv">ogv</option>
                <option value="qt">qt</option>
                <option value="wmv">wmv</option>
                <option value="asx">asx</option>
                <option value="asf">asf</option>
                <option value="avi">avi</option>
                <option value="wav">wav</option>
                <option value="mp3">mp3</option>
                <option value="aiff">aiff</option>
                <option value="oga">oga</option>
                <option value="odt">odt</option>
                <option value="odg">odg</option>
                <option value="odp">odp</option>
                <option value="ods">ods</option>
                <option value="odf">odf</option>
                <option value="rtf">rtf</option>
                <option value="txt">txt</option>
                <option value="csv">csv</option>
            </field>
            <field name="filesystem" type="filesystem" default="" label="WF_PARAM_FILESYSTEM" description="WF_PARAM_FILESYSTEM_DESC">
                <option value="">WF_OPTION_INHERIT</option>
            </field>

            <field type="heading" label="WF_PROFILES_PLUGINS_ACCESS" />

            <field name="help_button" type="yesno" default="1" label="WF_PARAM_HELP_BUTTON" description="WF_PARAM_HELP_BUTTON_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>

            <field name="upload" type="yesno" default="1" label="WF_PARAM_UPLOAD" description="WF_PARAM_UPLOAD_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
            <field name="folder_new" type="yesno" default="1" label="WF_PARAM_FOLDER_CREATE" description="WF_PARAM_FOLDER_CREATE_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
            <field name="folder_delete" type="yesno" default="1" label="WF_PARAM_FOLDER_DELETE" description="WF_PARAM_FOLDER_DELETE_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
            <field name="folder_rename" type="yesno" default="1" label="WF_PARAM_FOLDER_RENAME" description="WF_PARAM_FOLDER_RENAME_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
            <field name="folder_move" type="yesno" default="1" label="WF_PARAM_FOLDER_PASTE" description="WF_PARAM_FOLDER_PASTE_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
            <field name="file_delete" type="yesno" default="1" label="WF_PARAM_FILE_DELETE" description="WF_PARAM_FILE_DELETE_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
            <field name="file_rename" type="yesno" default="1" label="WF_PARAM_FILE_RENAME" description="WF_PARAM_FILE_RENAME_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
            <field name="file_move" type="yesno" default="1" label="WF_PARAM_FILE_PASTE" description="WF_PARAM_FILE_PASTE_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>

            <field name="allow_download" type="yesno" default="0" label="WF_BROWSER_ALLOW_DOWNLOAD" description="WF_BROWSER_ALLOW_DOWNLOAD_DESC">
                <option value="1">JYES</option>
                <option value="0">JNO</option>
            </field>
        </fieldset>
    </fields>
    <languages></languages>
    <help>
        <topic key="browser.about" title="WF_BROWSER_HELP_ABOUT" />
        <topic file="libraries/xml/help/manager.xml" />
    </help>
</extension>