Menu

Limit Manager to top directory it's in

studmuffin
2014-12-30
2019-02-08
  • studmuffin

    studmuffin - 2014-12-30

    I'm working on this now, but I figured someone else might have some input, especially since this is my first experience with this tool. FANTASTIC tool btw...

    I want the manager to be limited to the top directory it's in.

    EXAMPLE
    /root
    /root/files/manager.php
    /root/files/doc.zip
    /root/files/archive/old.zip
    /root/images/
    /root/index.php
    /root/faq.php

    since the "manager" is in the 'files' folder, I want it to only be allow to navigate that folder. I don't want it to be able to navigate the root folder, or the index.php file. It can still navigate the 'file/archive' folder, because it's in the same directory...

    This would be a nice feature.

    I'm sifting through the code to see what I have to modify to make this happen. I'll post my results here.

    I want it to only be allowed to browse and work in the files folder

     
  • studmuffin

    studmuffin - 2014-12-30

    Oh! And if the file begins with a '.' (like .htaccess) then I don't want it to be displayed at all.. Not in this implementation anyway. This part should be easy.

     
  • studmuffin

    studmuffin - 2014-12-30

    Simple part done

    find "function dir_list_form() {"
    then change
    if (($file != ".")&&($file != "..")){
    to
    if (($file != ".")&&($file != "..")&&(substr($file, 0, 1)!=".")){
    or
    if (($file != ".")&&($file != "..")&&$file[0]!=".")){

    the $file[0] is a new one I just learned.. I didn't realize PHP could process a string as a character array. Nifty to know. Works more efficiently than substr.

    The only difference between the two from what I've read:
    substr will process $file as a string. if $file is an array it will fail.

    $file[0] will process [0] as an array value. If $file = index.php, 0 => i. If $file is an array, and $file[0] = index.php, then of course 0 => index.php

    In the case i'm using it, this is just fine. This script doesn't make $file an array, so it will always be a single string, and 0 will always return the first character in the string variable. In this case, if it doesn't equal '.' then it will continue to get information about the file in the directory, and prep it for display in the web page

     
  • studmuffin

    studmuffin - 2014-12-30

    Hey look at that! There is a default folder option built in by using the Config button in the script. ha!

    Man I love this thing.. Now to make it visually more beautiful. Starting with viewing images via jquery rather than a new window.

     
  • studmuffin

    studmuffin - 2014-12-30

    I wish this were a github project. I'd love to contribute

     
    • Fabrício Seger Kolling

      Hi. It it now on github and this option was added on the config window.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.