Welcome to Geeklog, Anonymous Tuesday, December 24 2024 @ 09:07 am EST

Geeklog Forums

Easyfile - root folder


Status: offline

lasvegasgamer

Forum User
Newbie
Registered: 05/26/06
Posts: 2
Okay, so I am in love with Easyfile, it's really helped out on my site.

The problem is that whenever you load the root folder you see every file in the database, and thats really too much, is there anyway to turn that off?

Thanks for the help

-Z
 Quote

Turner

Anonymous
In the config.php file for easyfile, I think you have a variable $_EF_CONF['perpage'] = X.

Make X what you need and it should be fine.
 Quote

Benta

Anonymous
Quote by lasvegasgamer: Okay, so I am in love with Easyfile, it's really helped out on my site.

The problem is that whenever you load the root folder you see every file in the database, and thats really too much, is there anyway to turn that off?
-Z


I like that plugin a lot as well.

The index.php can be changed a little to get it like you want it. Example:

Text Formatted Code
<?php

// +---------------------------------------------------------------------------+
// | Easyfile Plugin 1.0 for Geeklog - The Ultimate Weblog                     |
// +---------------------------------------------------------------------------+
// | index.php                                                                 |
// |                                                                           |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2004, 2005 by the following authors:                        |
// |                                                                           |
// | Authors: Markus Berg        - markus@kelvin.nu                            |
// |                                                                           |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
//

require_once('../lib-common.php');
require_once($_CONF['path_html'] . 'easyfile/common.php');


// Set sane defaults for any input values
// $page -- what's the page of a large set
// $folder -- display only selected folder
$page = (empty($_GET['page']) ? 1 : $_GET['page']);
$sort = (empty($_GET['sort']) ? 'date' : $_GET['sort']);
$order = (empty($_GET['order']) ? 'DESC' : $_GET['order']);
$folder = (empty($_GET['folder']) ? 1 : $_GET['folder']);
$folder = (is_numeric($folder) ? $folder : 1);

$easyfile = new Template($_CONF['path'] . 'plugins/easyfile/templates/');
$easyfile->set_file ('page', 'index.thtml');
$easyfile->set_var('site_url', $_CONF['site_url']);


function easyfile_sortbar($folder, $sort, $order) {
    // This function displays the sortbar
    global $_CONF, $LANG_EF07;
    $base_url = $_CONF['site_url'] . '/easyfile/index.php?folder=' . $folder . '&';
    $img_dir = $_CONF['site_url'] . '/easyfile/images/';
    if ($order != 'ASC') {
        $order = 'DESC';
    }
    if ($sort != 'title' AND $sort != 'hits') {
        $sort = 'date';
    }
    $retval = $LANG_EF07['sort_by'] . ": ";
    foreach (array('title', 'date', 'hits') as $key) {
        $retval .= $LANG_EF07['sort_' . $key] . " ";
        foreach (array('DESC', 'ASC') as $dir) {
            if ($sort == $key AND $order == $dir) {
                $retval .= '<img src="' . $img_dir . $dir . '_on.gif" width="11" height="11">' . "\n";
            } else {
                $retval .= '<a href="' . $base_url . 'sort=' . $key . '&order=' . $dir . '">';
                $retval .= '<img src="' . $img_dir . $dir . '.gif" width="11" height="11" border="0">';
                $retval .= "</a>\n";
            }
        }
        $retval .= " ";
    }
    $retval = '<div class="pagenav">' . $retval . '</div>';
    return ($retval);
}

/***
*  Display a single folder or a summary of the most recent files
*/

if (!isset($EF_folders[$folder])) {
    $easyfile->set_var('header', $LANG_EF02['nofolder']);
    $easyfile->set_var('files', $LANG_EF02['nofolder_info']);
} elseif ($EF_folders[$folder]->access == 0) {
    $easyfile->set_var('header', $LANG_EF02["noaccess_folder"]);
    $easyfile->set_var('files', $LANG_EF02["noaccess_folder_info"]);
} else {
    $EF_folders[$folder]->select();
    $easyfile->set_var('upload_or_browse_toggle', $EF_folders[$folder]->htmlUploadButton());

    $files = $EF_folders[$folder]->getFiles($sort, $order);
    $numrows = count($files);

    if ($numrows == 0) {
        if ($folder == 1) {
            $easyfile->set_var('header', $LANG_EF02['emptydb']);
            $easyfile->set_var('files', $LANG_EF02['emptydb_info']);
        } else {
            $easyfile->set_var('header', $LANG_EF02['emptyfolder']);
            $easyfile->set_var('files', $LANG_EF02['emptyfolder_info']);
        }
    } else {
        $easyfile->set_var('header',
            sprintf(($folder == 1 ? $LANG_EF01['files_in_db'] : $LANG_EF01['files_in_folder']), $numrows));
               
        $base_url = $_CONF['site_url'] . '/easyfile/index.php?folder=' . $folder . '&sort=' . $sort . '&order=' . $order;
        $offset = ($page - 1) * $_EF_CONF['perpage'];
        $numpages = ceil($numrows / $_EF_CONF['perpage']);

        $filedisplay = '';

if  ($folder != 1) {
        foreach (array_slice($files, $offset, $_EF_CONF['perpage']) as $file) {
            $filedisplay .= $file->htmlPresentation('list');
        }
} else {
            $filedisplay = 'Please see folders to the left!';
}

        $easyfile->set_var('sortbar', easyfile_sortbar($folder, $sort, $order));
        $easyfile->set_var('navbar', COM_printPageNavigation($base_url, $page, $numpages));
        $easyfile->set_var('files', $filedisplay);
    }
}
$easyfile->set_var('folder_tree', easyfile_folderTree());

$display = '';
$display .= COM_siteHeader('menu');

if (!empty($_GET['msg'])) {
    $display .= COM_showMessage($LANG_EF05[$_GET['msg']], "easyfile");
}

$easyfile->parse ('output', 'page');
$display .= $easyfile->finish ($easyfile->get_var('output'));

$display .= COM_siteFooter(true);
echo $display;

?>

 
 Quote

All times are EST. The time is now 09:07 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content