Plugin Directory

Changeset 1801340


Ignore:
Timestamp:
01/11/2018 06:36:11 PM (8 years ago)
Author:
Daschmi
Message:
  • Layout Changes
  • IIS Kompatibilität
Location:
dsdownloadlist
Files:
14 added
8 edited

Legend:

Unmodified
Added
Removed
  • dsdownloadlist/trunk/classes/Action.class.php

    r1733921 r1801340  
    2424            $atts = @unserialize(base64_decode($_REQUEST['atts']));
    2525
    26             $path = DownloadList::clearPath(WP_CONTENT_DIR.'/'.$atts['root'].'/'.$_REQUEST['path']);
     26            $arPath = array_merge(DownloadList::explodePath(WP_CONTENT_DIR.'/'.@$atts['root']), DownloadList::explodePath($_REQUEST['path']));
     27            $PrePath = implode('/', array_slice($arPath, 0, sizeof($arPath) - 1));
     28            $RootPath = implode('/', DownloadList::explodePath(WP_CONTENT_DIR.'/'.$atts['root']));
    2729
    28             if (substr($path, 0, strlen(WP_CONTENT_DIR)) != WP_CONTENT_DIR) die(__('Access denied!', 'dsdl'));
    29 
     30            $PrePath = substr($PrePath, strlen($RootPath));
     31            if ($PrePath === "") $PrePath = '/';
     32           
     33            $path = implode(DIRECTORY_SEPARATOR, $arPath);
     34           
    3035            $arFiles = downloadlist::getFiles($path, $atts);
    3136
     
    3439            $oRenderer->view['arFiles'] = $arFiles;
    3540            $oRenderer->view['isRoot'] = ((DownloadList::clearPath($atts['root'].'/'.$_REQUEST['path']) != DownloadList::clearPath($atts['root']))?false:true);
    36             $oRenderer->view['PrePath'] = DownloadList::clearPath($_REQUEST['path'].'../');
     41            $oRenderer->view['PrePath'] = $PrePath;
    3742            $oRenderer->view['path'] = DownloadList::clearPath($_REQUEST['path']);
    3843            $oRenderer->view['atts'] = $atts;
  • dsdownloadlist/trunk/classes/DownloadList.class.php

    r1730034 r1801340  
    1212    {
    1313
     14        public static function explodePath($path)
     15        {
     16           
     17            $path = \wp_normalize_path($path);
     18           
     19            $arPath = explode('/', $path);
     20           
     21            foreach ($arPath as $k => $v) if (trim($v) === '') unset($arPath[$k]);
     22           
     23            return $arPath;
     24           
     25        }
     26       
    1427        public static function clearPath($path)
    1528        {
    16 
     29 
     30            $path = \wp_normalize_path($path);
     31             
    1732            $path = preg_replace("/\/+/", "/", '/'.$path.'/');
    1833
     
    4358        public static function getFiles($path, $atts)
    4459        {
    45 
    46             $root = DownloadList::clearPath(WP_CONTENT_DIR.'/'.$atts['root']);
    47            
    48             $arFiles = scandir($path);
     60             
     61            $arFiles = scandir(DownloadList::clearPath($path).'/');
    4962            $arReturn = array();
    50 
     63             
    5164            foreach ($arFiles as $f)
    5265            {
    5366
    5467                if (!in_array($f, array('.', '..')))
    55                 {
    56 
    57                     $file_path = DownloadList::clearPath($path.'/'.$f);
    58 
     68                {
     69                     
     70                    // Real Path
     71                    $real_path = implode('/', DownloadList::explodePath($path.'/'.$f));
     72                    $root_path = implode('/', DownloadList::explodePath(WP_CONTENT_DIR.'/'.$atts['root']));
     73                     
    5974                    $arReturn[] = array(
    6075                        'filename' => $f,
    6176                        'abspath' => $path.'/'.$f,
    62                         'path' => substr($file_path, strlen($root)),
     77                        'path' => substr($real_path, strlen($root_path)),
    6378                        'filesize' => ((is_file($path.'/'.$f))?filesize($path.'/'.$f):0),
    6479                        'type' => ((is_file($path.'/'.$f))?'file':'dir')
  • dsdownloadlist/trunk/classes/Shortcode.class.php

    r1733921 r1801340  
    1515        {
    1616
     17            if (!is_array($atts)) $atts = array();
     18           
    1719            $atts = array_merge(array(
    18                 'root' => '/',
     20                'root' => '',
    1921                'dateformat' => 'Y-m-d H:i:s'
    2022            ), $atts);
    21 
    22             $root = DownloadList::clearPath(WP_CONTENT_DIR.$atts['root']);
    23 
    24             if (substr($root, 0, strlen(WP_CONTENT_DIR)) == WP_CONTENT_DIR)
    25             {
    26 
    27                 $arFiles = downloadlist::getFiles($root, $atts);
    28 
    29             }
    30             else
    31             {
    32 
    33                 return __('DsDownloadList: Ungültiges Wurzelverzeichnis gesetzt.', 'dsdl');
    34 
    35             }
     23           
     24            $arPath = downloadList::explodePath(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$atts['root']);       
     25            $arFiles = downloadlist::getFiles(implode(DIRECTORY_SEPARATOR, $arPath), $atts);
    3626
    3727            $oRenderer = new Renderer();
     28           
    3829            $oRenderer->view['arFiles'] = $arFiles;
    3930            $oRenderer->view['isRoot'] = true;
  • dsdownloadlist/trunk/dsdownloadlist.php

    r1733921 r1801340  
    99     * Plugin URI: https://daschmi.de/dsdownloadlist/
    1010     * Description: Downloadlist from Shortcode
    11      * Version: 1.2
     11     * Version: 1.3
    1212     * Author: Daniel Schmitzer
    1313     * Author URI: https://daschmi.de/
  • dsdownloadlist/trunk/readme.txt

    r1733921 r1801340  
    55Requires at least: 3.0.1
    66Tested up to: 4.9
    7 Stable tag: 1.2
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3939= 1.2 =
    4040* Added rootline path
     41
     42= 1.3 =
     43* Layout changes
  • dsdownloadlist/trunk/views/css/dsdownloadlist.css

    r1730034 r1801340  
    11.dsdownloadlist { width:100%; font-family:monospace; margin-bottom:30px; }
    22.dsdownloadlist .head { background-color:#F6F6F6; font-size:1rem; padding:5px 15px; }
     3.dsdownloadlist .head .separator:before { content:'/'; margin-left:2px; margin-right:2px; }
    34.dsdownloadlist table { table-layout:auto; width:100%; border-collapse:collapse; border:0px; border-spacing:0px; margin:0px; }
    45.dsdownloadlist table tr > * { padding-left:15px; }
    5 .dsdownloadlist table tr > *.icon { width:35px; padding-right:0px; }
    6 .dsdownloadlist table tr > *.icon img { max-width:100%; height:auto; }
     6.dsdownloadlist table tr > *.td_icon { width:35px; padding-right:0px; }
     7.dsdownloadlist table tr > *.td_icon img { max-width:100%; height:auto; }
    78.dsdownloadlist table tr > *.size { width:125px; }
    89.dsdownloadlist table tr > *.mtime { width:100px; text-align:left; white-space: nowrap; }
     
    1112.dsdownloadlist .dsdl_loading { margin:-15px; box-sizing:content-box; padding:15px; position:absolute; width:100%; height:100%; left:0px; top:0px; background-color:rgba(0, 0, 0, 0.5); }
    1213.dsdownloadlist .dsdl_loading img {
    13     max-width:100px; height:auto; position:absolute; left:50%; top:50%; margin-left:-50px; margin-top:-50px;
     14    max-width:50px !important; height:auto; position:absolute; left:50%; top:50%; margin-left:-50px; margin-top:-50px;
    1415    -webkit-animation:spin 1s linear infinite;
    1516    -moz-animation:spin 1s linear infinite;
  • dsdownloadlist/trunk/views/js/dsdownloadlist.js

    r1730034 r1801340  
    1616function dsdl_finishloading(jqSel, data)
    1717{
    18 
     18   
    1919    jqSel.find('.dsdl_loading').remove();
    2020    jqSel.attr("style", "");
  • dsdownloadlist/trunk/views/list.phtml

    r1733921 r1801340  
    1515    <div class="head"><?php
    1616
    17         $arPath = explode(DIRECTORY_SEPARATOR, DownloadList::clearPath($this->view['path']));
    18         $arCurrentPath = array();
    19 
    20         foreach ($arPath as $k => $v) if (trim($v) === '') unset($arPath[$k]);
    21 
     17        $arPath = DownloadList::explodePath($this->view['path'])
     18         
    2219        ?><a href="#" data-atts="<?php echo base64_encode(serialize($this->view['atts'])); ?>" onclick="return dsdl_changeDir(jQuery(this), '<?php echo DownloadList::clearPath(implode(DIRECTORY_SEPARATOR, $arCurrentPath)); ?>');"><?php echo preg_replace('/^\/|\/$/', '', $this->view['atts']['root']); ?></a><?php
    2320
    24         echo DIRECTORY_SEPARATOR;
     21        echo '<span class="separator"></span>';
    2522
    2623        $i = 0; foreach ($arPath as $p)
    2724        {
    2825
    29             $arCurrentPath[] = $p;
    30 
    3126            ?><a href="#" data-atts="<?php echo base64_encode(serialize($this->view['atts'])); ?>" onclick="return dsdl_changeDir(jQuery(this), '<?php echo DownloadList::clearPath(implode(DIRECTORY_SEPARATOR, $arCurrentPath)); ?>');"><?php echo $p; ?></a><?php
    3227
    33             echo DIRECTORY_SEPARATOR;
     28            echo '<span class="separator"></span>';
    3429
    3530            $i ++;
     
    4540            <thead>
    4641                <tr>
    47                     <th class="icon"></th>
     42                    <th class="td_icon"></th>
    4843                    <th class="filename"><?php echo __('Filename', 'dsdl'); ?></th>
    4944                    <th class="size"><?php echo __('Size', 'dsdl'); ?></th>
     
    5651                <?php if ($this->view['isRoot'] != true) { ?>
    5752                <tr>
    58                     <td class="icon">
     53                    <td class="td_icon">
    5954                        <img src="data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDYwIDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA2MCA2MDsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSI1MTJweCIgaGVpZ2h0PSI1MTJweCI+CjxwYXRoIGQ9Ik01Ny40OSwyMS41SDU0di02LjI2OGMwLTEuNTA3LTEuMjI2LTIuNzMyLTIuNzMyLTIuNzMySDI2LjUxNWwtNS03SDIuNzMyQzEuMjI2LDUuNSwwLDYuNzI2LDAsOC4yMzJ2NDMuNjg3bDAuMDA2LDAgIGMtMC4wMDUsMC41NjMsMC4xNywxLjExNCwwLjUyMiwxLjU3NUMxLjAxOCw1NC4xMzQsMS43Niw1NC41LDIuNTY1LDU0LjVoNDQuNzU5YzEuMTU2LDAsMi4xNzQtMC43NzksMi40NS0xLjgxM0w2MCwyNC42NDl2LTAuMTc3ICBDNjAsMjIuNzUsNTguOTQ0LDIxLjUsNTcuNDksMjEuNXogTTIsOC4yMzJDMiw3LjgyOCwyLjMyOSw3LjUsMi43MzIsNy41aDE3Ljc1M2w1LDdoMjUuNzgyYzAuNDA0LDAsMC43MzIsMC4zMjgsMC43MzIsMC43MzJWMjEuNSAgSDEyLjczMWMtMC4xNDQsMC0wLjI4NywwLjAxMi0wLjQyNiwwLjAzNmMtMC45NzMsMC4xNjMtMS43ODIsMC44NzMtMi4wMjMsMS43NzZMMiw0NS44OTlWOC4yMzJ6IE00Ny44NjksNTIuMDgzICBjLTAuMDY2LDAuMjQ1LTAuMjkxLDAuNDE3LTAuNTQ1LDAuNDE3SDIuNTY1Yy0wLjI0MywwLTAuMzg1LTAuMTM5LTAuNDQ4LTAuMjIyYy0wLjA2My0wLjA4Mi0wLjE2LTAuMjU2LTAuMTIzLTAuNDA4bDEwLjE5MS0yNy45NTMgIGMwLjA2Ni0wLjI0NSwwLjI5MS0wLjQxNywwLjU0NS0wLjQxN0g1NGgzLjQ5YzAuMzgsMCwwLjQ3NywwLjU0NiwwLjUwMiwwLjgxOUw0Ny44NjksNTIuMDgzeiIgZmlsbD0iIzAwMDAwMCIvPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K" />
    6055                    </td>
     
    6964                <?php foreach ($this->view['arFiles'] as $f) { ?>
    7065                <tr>
    71                     <td class="icon">
     66                    <td class="td_icon">
    7267
    7368                        <?php if ($f['type'] === 'dir') { ?>
Note: See TracChangeset for help on using the changeset viewer.