Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID Sign In with Google

Sign In Apply for Membership

Changing uploading available to normal user
  • Perditus February 2011
    Hi!

    Thanks for this great code.

    I was wondering that is there any easy way to make file uploading available to normal users without giving root privileges?
    Some change of the code on some of the files or something?

    Would be great feature for my use. I'm using site to share documents with my classmates.
  • betso February 2011
    Hi and welcome here! :)

    The way to do this might not seem to be easy but you can try it:
    Open the file "index.php" and change the following line:
    "} else if (isset ($_REQUEST['upload_to'])) { xd_check_root (true); ?>"
    to
    "} else if (isset ($_REQUEST['upload_to'])) { xd_check_root (); ?>"

    Then find the following line:
    "} else if (isset ($_REQUEST['upload'])) { xd_check_root (true);"
    and change it to
    "} else if (isset ($_REQUEST['upload'])) { xd_check_root ();"

    Find the following lines:
    "<?php if ($_SESSION['root'] && ! (SEARCH && isset ($_SESSION['search'])) && (! FILTERS || ! isset ($_REQUEST['filter']) || ! isset ($_SESSION['filters'][$_REQUEST['filter']]))) { ?>
    <a href="<?php echo PHPSELF;?>?upload_to=<?php echo xd_pwd ($subdir);?>" title="Upload file(s) to this directory" rel="ibox&amp;width=270&amp;height=120"><span class="tab">Upload</span></a>"
    and replace them by
    "<?php if (! (SEARCH && isset ($_SESSION['search'])) && (! FILTERS || ! isset ($_REQUEST['filter']) || ! isset ($_SESSION['filters'][$_REQUEST['filter']]))) { ?>
    <a href="<?php echo PHPSELF;?>?upload_to=<?php echo xd_pwd ($subdir);?>" title="Upload file(s) to this directory" rel="ibox&amp;width=270&amp;height=120"><span class="tab">Upload</span></a>
    <?php } ?>
    <?php if ($_SESSION['root'] && ! (SEARCH && isset ($_SESSION['search'])) && (! FILTERS || ! isset ($_REQUEST['filter']) || ! isset ($_SESSION['filters'][$_REQUEST['filter']]))) { ?>"

    This should do the trick.
    Please note that I didn't test it by myself. I would appreciate if you would share with us how this works for you.

    Thank you (also for registering here) and enjoy! :)
  • Francois_Harvey February 2011
    I have begin to change xd_check_root with xd_check_security, and to add a "upload" security level (allowing, a user to upload stuff, without user management).  I intend to merge the change next weekend, so source code hacking will not be needed anymore.
  • rleuthold June 2011
    Hi,

    Thank you for this wonderful project.

    Is there a simple way to enable uploads and create options for normal users, within their home directory, with version 0.3.0.

    I couldn't find the multiple line replacement in the index.php of version 0.3.0.

    - rico
  • betso June 2011
    Hi Rico,
    this issue was discussed just yesterday --> http://forum.xoda.org/discussion/5/per-user-root-dir.
    Thank you!