• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_abs_dir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_abs_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP get_abs_dir函数的具体用法?PHP get_abs_dir怎么用?PHP get_abs_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_abs_dir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: find_item

function find_item($dir, $pat, &$list, $recur)
{
    // find items
    $handle = @opendir(get_abs_dir($dir));
    if ($handle === false) {
        return;
    }
    // unable to open dir
    while (($new_item = readdir($handle)) !== false) {
        if (!@file_exists(get_abs_item($dir, $new_item))) {
            continue;
        }
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        // match?
        if (@eregi($pat, $new_item)) {
            $list[] = array($dir, $new_item);
        }
        // search sub-directories
        if (get_is_dir($dir, $new_item) && $recur) {
            find_item(get_rel_item($dir, $new_item), $pat, $list, $recur);
        }
    }
    closedir($handle);
}
开发者ID:morovan,项目名称:granitpiestany.sk,代码行数:26,代码来源:fun_search.php


示例2: find_item

/**
 * @version $Id: search.php 98 2008-02-11 17:56:04Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007
 * @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
 * @author The  The QuiX project (http://quixplorer.sourceforge.net)
 * 
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 * 
 * File-Search Functions
 */
function find_item($dir, $pat, &$list, $recur)
{
    // find items
    $homedir = realpath($GLOBALS['home_dir']);
    $handle = @$GLOBALS['ext_File']->opendir(get_abs_dir($dir));
    if ($handle === false && $dir == "") {
        $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
    }
    if ($handle === false) {
        ext_Result::sendResult('search', false, $dir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    while (($new_item = $GLOBALS['ext_File']->readdir($handle)) !== false) {
        if (is_array($new_item)) {
            $abs_new_item = $new_item;
        } else {
            $abs_new_item = get_abs_item($dir, $new_item);
        }
        if (!$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            continue;
        }
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        // match?
        if (@eregi($pat, $new_item)) {
            $list[] = array($dir, $new_item);
        }
        // search sub-directories
        if (get_is_dir($abs_new_item) && $recur) {
            find_item(get_rel_item($dir, $new_item), $pat, $list, $recur);
        }
    }
    $GLOBALS['ext_File']->closedir($handle);
}
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:65,代码来源:search.php


示例3: download_selected

/**
 * download_selected
 * @return void
 **/
function download_selected($dir)
{
    $dir = get_abs_dir($dir);
    global $site_name;
    require_once "_include/archive.php";
    $items = qxpage_selected_items();
    if (count($items) == 1 && is_file($items[0])) {
        download_item($dir, $items[0]);
    } else {
        zip_download($dir, $items);
    }
}
开发者ID:rterbush,项目名称:nas4free,代码行数:16,代码来源:down.php


示例4: zip_items

function zip_items($dir, $name)
{
    $cnt = count($GLOBALS['__POST']["selitems"]);
    $abs_dir = get_abs_dir($dir);
    $zipfile = new ZipFile();
    for ($i = 0; $i < $cnt; ++$i) {
        $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
        if (!$zipfile->add($abs_dir, $selitem)) {
            show_error($selitem . ": Failed adding item.");
        }
    }
    if (!$zipfile->save(get_abs_item($dir, $name))) {
        show_error($name . ": Failed saving zipfile.");
    }
    header("Location: " . make_link("list", $dir, NULL));
}
开发者ID:Zhi2014,项目名称:cogs,代码行数:16,代码来源:fun_archive.php


示例5: find_item

/**
 * @version $Id: search.php 201 2011-06-27 09:45:09Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007-2013
 * @author The eXtplorer project (http://extplorer.net)
 * @author The	The QuiX project (http://quixplorer.sourceforge.net)
 *
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 *
 * File-Search Functions
 */
function find_item($dir, $pat, &$list, $recur, $content)
{
    // find items
    $homedir = realpath($GLOBALS['home_dir']);
    $opendir = $dir;
    if (!is_dir($dir)) {
        $opendir = get_abs_dir($dir);
    }
    $handle = @$GLOBALS['ext_File']->opendir($opendir);
    if ($handle === false && $dir == "") {
        $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
    }
    if ($handle === false) {
        ext_Result::sendResult('search', false, $opendir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    while (($new_item = $GLOBALS['ext_File']->readdir($handle)) !== false) {
        if (is_array($new_item)) {
            $abs_new_item = $new_item;
        } else {
            $abs_new_item = get_abs_item($dir, $new_item);
        }
        //if(!$GLOBALS['ext_File']->file_exists($abs_new_item)) continue;
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        $isDir = get_is_dir($abs_new_item);
        // match?
        if (@preg_match('@' . $pat . '@is', $new_item) > 0) {
            $list[] = array($dir, $new_item);
        } else {
            if (!$isDir) {
                if ($content && $GLOBALS['ext_File']->filesize($abs_new_item) < 524288) {
                    $data = $GLOBALS['ext_File']->file_get_contents($abs_new_item);
                    //$data = fread($handle, 524288); // Only read first 512kb
                    if (preg_match('@' . $pat . '@is', $data) > 0) {
                        $list[] = array($dir, $new_item);
                    }
                }
            }
        }
        // search sub-directories
        if ($isDir && $recur) {
            find_item($abs_new_item, $pat, $list, $recur, $content);
        }
    }
    $GLOBALS['ext_File']->closedir($handle);
}
开发者ID:eldersxavier,项目名称:online_editor_code,代码行数:78,代码来源:search.php


示例6: _download_items

function _download_items($dir, $items)
{
    // check if user selected any items to download
    _debug("count items: '{$items['0']}'");
    if (count($items) == 0) {
        show_error($GLOBALS["error_msg"]["miscselitems"]);
    }
    // check if user has permissions to download
    // this file
    if (!_is_download_allowed($dir, $items)) {
        show_error($GLOBALS["error_msg"]["accessitem"]);
    }
    // if we have exactly one file and this is a real
    // file we directly download it
    if (count($items) == 1 && get_is_file($dir, $items[0])) {
        $abs_item = get_abs_item($dir, $items[0]);
        _download($abs_item, $items[0]);
    }
    // otherwise we do the zip download
    zip_download(get_abs_dir($dir), $items);
}
开发者ID:gilshwartz,项目名称:quixplorer,代码行数:21,代码来源:fun_down.php


示例7: extGetParam

    $GLOBALS["separator"] = "\\";
}
// Get Sort
$GLOBALS["order"] = extGetParam($_REQUEST, 'order', 'name');
// Get Sortorder
$GLOBALS["direction"] = extGetParam($_REQUEST, 'direction', 'ASC');
// show hidden files in QuiXplorer: (hide files starting with '.', as in Linux/UNIX)
$GLOBALS["show_hidden"] = true;
// filenames not allowed to access: (uses PCRE regex syntax)
$GLOBALS["no_access"] = "^\\.ht";
// user permissions bitfield: (1=modify, 2=password, 4=admin, add the numbers)
$GLOBALS["permissions"] = 1;
$GLOBALS['file_mode'] = 'file';
//------------------------------------------------------------------------------
$GLOBALS['ext_File'] = new ext_File();
$abs_dir = get_abs_dir($GLOBALS["dir"]);
if (!file_exists($GLOBALS["home_dir"])) {
    if (!file_exists($GLOBALS["home_dir"] . $GLOBALS["separator"])) {
        if (!empty($GLOBALS["require_login"])) {
            $extra = "<a href=\"" . ext_make_link("logout", NULL, NULL) . "\">" . $GLOBALS["messages"]["btnlogout"] . "</A>";
        } else {
            $extra = NULL;
        }
        $GLOBALS['ERROR'] = $GLOBALS["error_msg"]["home"];
    }
}
if (!down_home($abs_dir)) {
    ext_Result::sendResult('', false, $GLOBALS["dir"] . " : " . $GLOBALS["error_msg"]["abovehome"]);
    $dir = $GLOBALS['dir'] = $_SESSION['ext_dir'] = '';
    return false;
}
开发者ID:kostya1017,项目名称:our,代码行数:31,代码来源:extplorer.init.php


示例8: copy_move_items

/**
 * File/Directory Copy & Move Functions
 */
function copy_move_items($dir)
{
    // copy/move file/dir
    $action = extGetParam($_REQUEST, 'action');
    if (($GLOBALS["permissions"] & 01) != 01) {
        ext_Result::sendResult($action, false, $GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    $first = extGetParam($GLOBALS['__POST'], 'first');
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    // DO COPY/MOVE
    // ALL OK?
    if (!@$GLOBALS['ext_File']->file_exists(get_abs_dir($new_dir))) {
        ext_Result::sendResult($action, false, get_abs_dir($new_dir) . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    for ($i = 0; $i < $cnt; ++$i) {
        $tmp = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        $new = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        if (ext_isFTPMode()) {
            $abs_item = get_item_info($dir, $tmp);
            $abs_new_item = get_item_info('/' . $new_dir, $new);
        } else {
            $abs_item = get_abs_item($dir, $tmp);
            $abs_new_item = get_abs_item($new_dir, $new);
        }
        $items[$i] = $tmp;
        // Check
        if ($new == "") {
            $error[$i] = $GLOBALS["error_msg"]["miscnoname"];
            $err = true;
            continue;
        }
        if (!@$GLOBALS['ext_File']->file_exists($abs_item)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $tmp)) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        if (@$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            $error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
            $err = true;
            continue;
        }
        // Copy / Move
        if ($action == "copy") {
            if (@is_link($abs_item) || get_is_file($abs_item)) {
                // check file-exists to avoid error with 0-size files (PHP 4.3.0)
                if (ext_isFTPMode()) {
                    $abs_item = '/' . $dir . '/' . $abs_item['name'];
                }
                $ok = @$GLOBALS['ext_File']->copy($abs_item, $abs_new_item);
                //||@file_exists($abs_new_item);
            } elseif (@get_is_dir($abs_item)) {
                $copy_dir = ext_isFTPMode() ? '/' . $dir . '/' . $abs_item['name'] . '/' : $abs_item;
                if (ext_isFTPMode()) {
                    $abs_new_item .= '/';
                }
                $ok = $GLOBALS['ext_File']->copy_dir($copy_dir, $abs_new_item);
            }
        } else {
            $ok = $GLOBALS['ext_File']->rename($abs_item, $abs_new_item);
        }
        if ($ok === false || PEAR::isError($ok)) {
            $error[$i] = $action == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
            if (PEAR::isError($ok)) {
                $error[$i] .= ' [' . $ok->getMessage() . ']';
            }
            $err = true;
            continue;
        }
        $error[$i] = NULL;
    }
    if ($err) {
        // there were errors
        $err_msg = "";
        for ($i = 0; $i < $cnt; ++$i) {
            if ($error[$i] == NULL) {
//.........这里部分代码省略.........
开发者ID:shamblett,项目名称:janitor,代码行数:101,代码来源:copy_move.php


示例9: execAction

    function execAction($dir)
    {
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["accessfunc"]);
        }
        if (!$GLOBALS["zip"] && !$GLOBALS["tgz"]) {
            ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnofunc"]);
        }
        $allowed_types = array('zip', 'tgz', 'tbz', 'tar');
        // If we have something to archive, let's do it now
        if (extGetParam($_POST, 'confirm') == 'true') {
            $saveToDir = utf8_decode($GLOBALS['__POST']['saveToDir']);
            if (!file_exists(get_abs_dir($saveToDir))) {
                ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_notexists'));
            }
            if (!is_writable(get_abs_dir($saveToDir))) {
                ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_unwritable'));
            }
            require_once _EXT_PATH . '/libraries/Archive/archive.php';
            if (!in_array(strtolower($GLOBALS['__POST']["type"]), $allowed_types)) {
                ext_Result::sendResult('archive', false, ext_Lang::err('extract_unknowntype') . ': ' . htmlspecialchars($GLOBALS['__POST']["type"]));
            }
            // This controls how many files are processed per Step (it's split up into steps to prevent time-outs)
            $files_per_step = 2000;
            $cnt = count($GLOBALS['__POST']["selitems"]);
            $abs_dir = get_abs_dir($dir);
            $name = basename(stripslashes($GLOBALS['__POST']["name"]));
            if ($name == "") {
                ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnoname"]);
            }
            $startfrom = extGetParam($_REQUEST, 'startfrom', 0);
            $dir_contents_cache_name = 'ext_' . md5(implode(null, $GLOBALS['__POST']["selitems"]));
            $dir_contents_cache_file = _EXT_FTPTMP_PATH . '/' . $dir_contents_cache_name . '.txt';
            $archive_name = get_abs_item($saveToDir, $name);
            $fileinfo = pathinfo($archive_name);
            if (empty($fileinfo['extension'])) {
                $archive_name .= "." . $GLOBALS['__POST']["type"];
                $fileinfo['extension'] = $GLOBALS['__POST']["type"];
                foreach ($allowed_types as $ext) {
                    if ($GLOBALS['__POST']["type"] == $ext && @$fileinfo['extension'] != $ext) {
                        $archive_name .= "." . $ext;
                    }
                }
            }
            if ($startfrom == 0) {
                for ($i = 0; $i < $cnt; $i++) {
                    $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
                    if ($selitem == 'ext_root') {
                        $selitem = '';
                    }
                    if (is_dir(utf8_decode($abs_dir . "/" . $selitem))) {
                        $items = extReadDirectory(utf8_decode($abs_dir . "/" . $selitem), '.', true, true);
                        foreach ($items as $item) {
                            if (is_dir($item) || !is_readable($item) || $item == $archive_name) {
                                continue;
                            }
                            $v_list[] = str_replace('\\', '/', $item);
                        }
                    } else {
                        $v_list[] = utf8_decode(str_replace('\\', '/', $abs_dir . "/" . $selitem));
                    }
                }
                if (count($v_list) > $files_per_step) {
                    if (file_put_contents($dir_contents_cache_file, implode("\n", $v_list)) == false) {
                        ext_Result::sendResult('archive', false, 'Failed to create a temporary list of the directory contents');
                    }
                }
            } else {
                $file_list_string = file_get_contents($dir_contents_cache_file);
                if (empty($file_list_string)) {
                    ext_Result::sendResult('archive', false, 'Failed to retrieve the temporary list of the directory contents');
                }
                $v_list = explode("\n", $file_list_string);
            }
            $cnt_filelist = count($v_list);
            // Now we go to the right range of files and "slice" the array
            $v_list = array_slice($v_list, $startfrom, $files_per_step - 1);
            $remove_path = $GLOBALS["home_dir"];
            if ($dir) {
                $remove_path .= $dir;
            }
            $remove_path = str_replace('\\', '/', realpath($remove_path)) . '/';
            $debug = 'Starting from: ' . $startfrom . "\n";
            $debug .= 'Files to process: ' . $cnt_filelist . "\n";
            $debug .= implode("\n", $v_list);
            //file_put_contents( 'log.txt', $debug, FILE_APPEND );
            // Do some setup stuff
            ini_set('memory_limit', '128M');
            @set_time_limit(0);
            //error_reporting( E_ERROR | E_PARSE );
            $result = extArchive::create($archive_name, $v_list, $GLOBALS['__POST']["type"], '', $remove_path);
            if (PEAR::isError($result)) {
                ext_Result::sendResult('archive', false, $name . ': ' . ext_Lang::err('archive_creation_failed') . ' (' . $result->getMessage() . $archive_name . ')');
            }
            $classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON';
            $json = new $classname();
            if ($cnt_filelist > $startfrom + $files_per_step) {
                $response = array('startfrom' => $startfrom + $files_per_step, 'totalitems' => $cnt_filelist, 'success' => true, 'action' => 'archive', 'message' => sprintf(ext_Lang::msg('processed_x_files'), $startfrom + $files_per_step, $cnt_filelist));
            } else {
                @unlink($dir_contents_cache_file);
//.........这里部分代码省略.........
开发者ID:chajianku,项目名称:admin_eXtplorer,代码行数:101,代码来源:archive.php


示例10: get_dircontents

function get_dircontents($dir, &$dir_list, &$file_list, &$tot_file_size, &$num_items)
{
    $search = @$_POST['searchword'];
    $pattern = '';
    if (!empty($search)) {
        $pattern = preg_quote($search, '/');
        // finalise the regular expression, matching the whole line
        $pattern = "/^.*{$pattern}.*\$/m";
        // search, and store all matching occurrences in $matches
    }
    if (!empty($_POST['mdate_start'])) {
        $mdate_start = strtotime($_POST['mdate_start']);
        if (empty($_POST['mdate_end'])) {
            $mdate_end = time();
        } else {
            $mdate_end = strtotime($_POST['mdate_end']);
        }
    }
    $homedir = realpath($GLOBALS['home_dir']);
    $tot_file_size = $num_items = 0;
    // Open directory
    $handle = @$GLOBALS['ext_File']->opendir(get_abs_dir($dir));
    if ($handle === false && $dir == "") {
        $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
    }
    if ($handle === false) {
        ext_Result::sendResult('list', false, $dir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    $file_list = array();
    $dir_list = array();
    // Read directory
    while (($new_item = @$GLOBALS['ext_File']->readdir($handle)) !== false) {
        if (is_array($new_item)) {
            $abs_new_item = $new_item;
        } else {
            $abs_new_item = get_abs_item($dir, $new_item);
        }
        /*if (get_is_dir($abs_new_item)) {
        			continue;
        		}*/
        if ($new_item == "." || $new_item == "..") {
            continue;
        }
        if (!@$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            //ext_Result::sendResult('list', false, $dir."/$abs_new_item: ".$GLOBALS["error_msg"]["readdir"]);
        }
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        if (!empty($pattern) && !preg_match_all($pattern, $new_item, $matches)) {
            continue;
        }
        if ($mdate_start && $mdate_end) {
            $filemtime = @$GLOBALS['ext_File']->filemtime($abs_new_item);
            if ($filemtime < $mdate_start || $filemtime > $mdate_end) {
                continue;
            }
        }
        $new_file_size = @$GLOBALS['ext_File']->filesize($abs_new_item);
        $tot_file_size += $new_file_size;
        $num_items++;
        $new_item_name = $new_item;
        if (ext_isFTPMode()) {
            $new_item_name = $new_item['name'];
        }
        if (get_is_dir($abs_new_item)) {
            if ($GLOBALS["order"] == "modified") {
                $dir_list[$new_item_name] = @$GLOBALS['ext_File']->filemtime($abs_new_item);
            } else {
                // order == "size", "type" or "name"
                $dir_list[$new_item_name] = $new_item;
            }
        } else {
            if ($GLOBALS["order"] == "size") {
                $file_list[$new_item_name] = $new_file_size;
            } elseif ($GLOBALS["order"] == "modified") {
                $file_list[$new_item_name] = @$GLOBALS['ext_File']->filemtime($abs_new_item);
            } elseif ($GLOBALS["order"] == "type") {
                $file_list[$new_item_name] = get_mime_type($abs_new_item, "type");
            } else {
                // order == "name"
                $file_list[$new_item_name] = $new_item;
            }
        }
    }
    @$GLOBALS['ext_File']->closedir($handle);
    // sort
    if (is_array($dir_list)) {
        if ($GLOBALS["order"] == "modified") {
            if ($GLOBALS["direction"] == "ASC") {
                arsort($dir_list);
            } else {
                asort($dir_list);
            }
        } else {
            // order == "size", "type" or "name"
            if ($GLOBALS["direction"] == "ASC") {
                ksort($dir_list);
            } else {
                krsort($dir_list);
//.........这里部分代码省略.........
开发者ID:kostya1017,项目名称:our,代码行数:101,代码来源:list.php


示例11: get_dircontents

/**
 * make tables & place results in reference-variables passed to function
 * also 'return' total filesize & total number of items
 *
 * @param string $dir
 * @param array $dir_list
 * @param array $file_list
 * @param int $tot_file_size
 * @param int $num_items
 */
function get_dircontents($dir, &$dir_list, &$file_list, &$tot_file_size, &$num_items)
{
    // make table of files in dir
    $homedir = realpath($GLOBALS['home_dir']);
    $tot_file_size = $num_items = 0;
    // Open directory
    $handle = @$GLOBALS['ext_File']->opendir(get_abs_dir($dir));
    if ($handle === false && $dir == "") {
        $handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
    }
    if ($handle === false) {
        ext_Result::sendResult('list', false, $dir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    $file_list = array();
    $dir_list = array();
    // Read directory
    while (($new_item = @$GLOBALS['ext_File']->readdir($handle)) !== false) {
        if (is_array($new_item)) {
            $abs_new_item = $new_item;
        } else {
            $abs_new_item = get_abs_item($dir, $new_item);
        }
        /*if(get_is_dir( $abs_new_item)) {
        			continue;
        		}*/
        if ($new_item == "." || $new_item == "..") {
            continue;
        }
        if (!@$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            //ext_Result::sendResult( 'list', false, $dir."/$abs_new_item: ".$GLOBALS["error_msg"]["readdir"]);
        }
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        $new_file_size = @$GLOBALS['ext_File']->filesize($abs_new_item);
        $tot_file_size += $new_file_size;
        $num_items++;
        $new_item_name = $new_item;
        if (ext_isFTPMode()) {
            $new_item_name = $new_item['name'];
        }
        if (get_is_dir($abs_new_item)) {
            if ($GLOBALS["order"] == "modified") {
                $dir_list[$new_item_name] = @$GLOBALS['ext_File']->filemtime($abs_new_item);
            } else {
                // order == "size", "type" or "name"
                $dir_list[$new_item_name] = $new_item;
            }
        } else {
            if ($GLOBALS["order"] == "size") {
                $file_list[$new_item_name] = $new_file_size;
            } elseif ($GLOBALS["order"] == "modified") {
                $file_list[$new_item_name] = @$GLOBALS['ext_File']->filemtime($abs_new_item);
            } elseif ($GLOBALS["order"] == "type") {
                $file_list[$new_item_name] = get_mime_type($abs_new_item, "type");
            } else {
                // order == "name"
                $file_list[$new_item_name] = $new_item;
            }
        }
    }
    @$GLOBALS['ext_File']->closedir($handle);
    // sort
    if (is_array($dir_list)) {
        if ($GLOBALS["order"] == "modified") {
            if ($GLOBALS["direction"] == "ASC") {
                arsort($dir_list);
            } else {
                asort($dir_list);
            }
        } else {
            // order == "size", "type" or "name"
            if ($GLOBALS["direction"] == "ASC") {
                ksort($dir_list);
            } else {
                krsort($dir_list);
            }
        }
    }
    // sort
    if (is_array($file_list)) {
        if ($GLOBALS["order"] == "modified") {
            if ($GLOBALS["direction"] == "ASC") {
                arsort($file_list);
            } else {
                asort($file_list);
            }
        } elseif ($GLOBALS["order"] == "size" || $GLOBALS["order"] == "type") {
            if ($GLOBALS["direction"] == "ASC") {
                asort($file_list);
//.........这里部分代码省略.........
开发者ID:shamblett,项目名称:janitor,代码行数:101,代码来源:list.php


示例12: make_tables

/**
 make table of files in dir
 make tables & place results in reference-variables passed to function
 also 'return' total filesize & total number of items
*/
function make_tables($dir, &$dir_list, &$file_list, &$tot_file_size, &$num_items)
{
    $tot_file_size = $num_items = 0;
    // Open directory
    $handle = @opendir(get_abs_dir($dir));
    if ($handle === false) {
        show_error($dir . ": " . $GLOBALS["error_msg"]["opendir"]);
    }
    // Read directory
    while (($new_item = readdir($handle)) !== false) {
        $abs_new_item = get_abs_item($dir, $new_item);
        if (!get_show_item($dir, $new_item)) {
            continue;
        }
        $new_file_size = is_link($abs_new_item) ? 0 : @filesize($abs_new_item);
        $tot_file_size += $new_file_size;
        $num_items++;
        if (is_dir($dir . DIRECTORY_SEPARATOR . $new_item)) {
            if ($GLOBALS["order"] == "mod") {
                $dir_list[$new_item] = @filemtime($abs_new_item);
            } else {
                // order == "size", "type" or "name"
                $dir_list[$new_item] = $new_item;
            }
        } else {
            if ($GLOBALS["order"] == "size") {
                $file_list[$new_item] = $new_file_size;
            } elseif ($GLOBALS["order"] == "mod") {
                $file_list[$new_item] = @filemtime($abs_new_item);
            } elseif ($GLOBALS["order"] == "type") {
                $file_list[$new_item] = get_mime_type($dir, $new_item, "type");
            } else {
                // order == "name"
                $file_list[$new_item] = $new_item;
            }
        }
    }
    closedir($handle);
    // sort
    if (is_array($dir_list)) {
        if ($GLOBALS["order"] == "mod") {
            if ($GLOBALS["srt"] == "yes") {
                arsort($dir_list);
            } else {
                asort($dir_list);
            }
        } else {
            // order == "size", "type" or "name"
            if ($GLOBALS["srt"] == "yes") {
                ksort($dir_list);
            } else {
                krsort($dir_list);
            }
        }
    }
    // sort
    if (is_array($file_list)) {
        if ($GLOBALS["order"] == "mod") {
            if ($GLOBALS["srt"] == "yes") {
                arsort($file_list);
            } else {
                asort($file_list);
            }
        } elseif ($GLOBALS["order"] == "size" || $GLOBALS["order"] == "type") {
            if ($GLOBALS["srt"] == "yes") {
                asort($file_list);
            } else {
                arsort($file_list);
            }
        } else {
            // order == "name"
            if ($GLOBALS["srt"] == "yes") {
                ksort($file_list);
            } else {
                krsort($file_list);
            }
        }
    }
}
开发者ID:realtimeprojects,项目名称:quixplorer,代码行数:84,代码来源:fun_list.php


示例13: get_abs_item

function get_abs_item($dir, $item)
{
    // get absolute file+path
    if (is_array($item)) {
        // FTP Mode
        $abs_item = '/' . get_abs_dir($dir)."/".$item['name'];
        if (get_is_dir($item)) {
            $abs_item.='/';
        }
        return extPathName($abs_item);
    }
    return extPathName(get_abs_dir($dir)."/".$item);
}
开发者ID:rrsc,项目名称:processmaker,代码行数:13,代码来源:appFolderAjax.php


示例14: archive_items

/**
 * Zip & TarGzip Functions
 */
function archive_items($dir)
{
    if (($GLOBALS["permissions"] & 01) != 01) {
        show_error($GLOBALS["error_msg"]["accessfunc"]);
    }
    if (!$GLOBALS["zip"] && !$GLOBALS["tgz"]) {
        show_error($GLOBALS["error_msg"]["miscnofunc"]);
    }
    $allowed_types = array('zip', 'tgz', 'tbz', 'tar');
    $actionURL = str_replace("index2.php", "index3.php", make_link("arch", $dir, NULL));
    // If we have something to archive, let's do it now
    if (isset($GLOBALS['__POST']["name"])) {
        $saveToDir = $GLOBALS['__POST']['saveToDir'];
        if (!file_exists(get_abs_dir($saveToDir))) {
            echo nx_scriptTag('', '$(\'loadingindicator\').style.display=\'none\';');
            echo nx_alertBox('The Save-To Directory you have specified does not exist.');
            die('The Save-To Directory you have specified does not exist.');
        }
        if (!is_writable(get_abs_dir($saveToDir))) {
            echo nx_scriptTag('', '$(\'loadingindicator\').style.display=\'none\';');
            echo nx_alertBox('Please specify a writable directory to save the archive to.');
            die('Please specify a writable directory to save the archive to.');
        }
        require_once _QUIXPLORER_PATH . '/libraries/Archive.php';
        if (!in_array(strtolower($GLOBALS['__POST']["type"]), $allowed_types)) {
            echo 'Unknown Archive Format: ' . htmlspecialchars($GLOBALS['__POST']["type"]);
            nx_exit();
        }
        while (@ob_end_clean()) {
        }
        header('Status: 200 OK');
        echo '<?xml version="1.0" ?>' . "\n";
        $files_per_step = 2500;
        $cnt = count($GLOBALS['__POST']["selitems"]);
        $abs_dir = get_abs_dir($dir);
        $name = basename(stripslashes($GLOBALS['__POST']["name"]));
        if ($name == "") {
            show_error($GLOBALS["error_msg"]["miscnoname"]);
        }
        $download = JArrayHelper::getValue($_REQUEST, 'download', "n");
        $startfrom = JArrayHelper::getValue($_REQUEST, 'startfrom', 0);
        $archive_name = get_abs_item($saveToDir, $name);
        $fileinfo = pathinfo($archive_name);
        if (empty($fileinfo['extension'])) {
            $archive_name .= "." . $GLOBALS['__POST']["type"];
            $fileinfo['extension'] = $GLOBALS['__POST']["type"];
        }
        foreach ($allowed_types as $ext) {
            if ($GLOBALS['__POST']["type"] == $ext && @$fileinfo['extension'] != $ext) {
                $archive_name .= "." . $ext;
            }
        }
        for ($i = 0; $i < $cnt; $i++) {
            $selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
            if (is_dir($abs_dir . "/" . $selitem)) {
                $items = JFolder::files($abs_dir . "/" . $selitem, '.', true, true);
                foreach ($items as $item) {
                    if (is_dir($item) || !is_readable($item) || $item == $archive_name) {
                        continue;
                    }
                    $v_list[] = $item;
                }
            } else {
                $v_list[] = $abs_dir . "/" . $selitem;
            }
        }
        $cnt_filelist = count($v_list);
        $remove_path = $GLOBALS["home_dir"];
        if ($dir) {
            $remove_path .= $dir . $GLOBALS['separator'];
        }
        for ($i = $startfrom; $i < $cnt_filelist && $i < $startfrom + $files_per_step; $i++) {
            $filelist[] = File_Archive::read($v_list[$i], str_replace($remove_path, '', $v_list[$i]));
        }
        //echo '<strong>Starting from: '.$startfrom.'</strong><br />';
        //echo '<strong>Files to process: '.$cnt_filelist.'</strong><br />';
        //print_r( $filelist );exit;
        // Do some setup stuff
        ini_set('memory_limit', '128M');
        @set_time_limit(0);
        error_reporting(E_ERROR | E_PARSE);
        $result = File_Archive::extract($filelist, $archive_name);
        if (PEAR::isError($result)) {
            echo $name . ": Failed saving Archive File. Error: " . $result->getMessage();
            nx_exit();
        }
        if ($cnt_filelist > $startfrom + $files_per_step) {
            echo "\n <script type=\"text/javascript\">document.archform.startfrom.value = '" . ($startfrom + $files_per_step) . "';</script>\n";
            echo '<script type="text/javascript"> doArchiving( \'' . $actionURL . '\' );</script>';
            printf($GLOBALS['messages']['processed_x_files'], $startfrom + $files_per_step, $cnt_filelist);
        } else {
            if ($GLOBALS['__POST']["type"] == 'tgz' || $GLOBALS['__POST']["type"] == 'tbz') {
                chmod($archive_name, 0644);
            }
            if ($download == "y") {
                echo '<script type="text/javascript">document.location=\'' . make_link('download', dirname($archive_name), basename($archive_name)) . '\';</script>';
            } else {
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:fun_archive.php


示例15: list_dir


//.........这里部分代码省略.........
        // ADMIN
        _print_link("admin", permissions_grant(NULL, NULL, "admin") || permissions_grant(NULL, NULL, "password"), $dir, NULL);
        // LOGOUT
        _print_link("logout", true, $dir, NULL);
    }
    echo "</TR></TABLE></TD>\n";
    // Create File / Dir
    if (permissions_grant($dir, NULL, "create")) {
        echo "<TD align=\"right\"><TABLE><FORM action=\"" . make_link("mkitem", $dir, NULL) . "\" method=\"post\">\n<TR><TD>";
        echo "<SELECT name=\"mktype\"><option value=\"file\">" . $GLOBALS["mimes"]["file"] . "</option>";
        echo "<option value=\"dir\">" . $GLOBALS["mimes"]["dir"] . "</option></SELECT>\n";
        echo "<INPUT name=\"mkname\" type=\"text\" size=\"15\">";
        echo "<INPUT type=\"submit\" value=\"" . $GLOBALS["messages"]["btncreate"];
        echo "\"></TD></TR></FORM></TABLE></TD>\n";
    }
    echo "</TR></TABLE>\n";
    // End Toolbar
    // Begin Table + Form for checkboxes
    echo "<TABLE WIDTH=\"95%\"><FORM name=\"selform\" method=\"POST\" action=\"" . make_link("post", $dir, NULL) . "\">\n";
    echo "<INPUT type=\"hidden\" name=\"do_action\"><INPUT type=\"hidden\" name=\"first\" value=\"y\">\n";
    // Table Header
    echo "<TR><TD colspan=\"7\"><HR></TD></TR><TR><TD WIDTH=\"2%\" class=\"header\">\n";
    echo "<INPUT TYPE=\"checkbox\" name=\"toggleAllC\" onclick=\"javascript:ToggleAll(this);\"></TD>\n";
    echo "<TD WIDTH=\"44%\" class=\"header\"><B>\n";
    if ($GLOBALS["order"] == "name") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "name", $new_srt) . "\">" . $GLOBALS["messages"]["nameheader"];
    if ($GLOBALS["order"] == "name") {
        echo $_img;
    }
    echo "</A></B></TD>\n<TD WIDTH=\"10%\" class=\"header\"><B>";
    if ($GLOBALS["order"] == "size") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "size", $new_srt) . "\">" . $GLOBALS["messages"]["sizeheader"];
    if ($GLOBALS["order"] == "size") {
        echo $_img;
    }
    echo "</A></B></TD>\n<TD WIDTH=\"16%\" class=\"header\"><B>";
    if ($GLOBALS["order"] == "type") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "type", $new_srt) . "\">" . $GLOBALS["messages"]["typeheader"];
    if ($GLOBALS["order"] == "type") {
        echo $_img;
    }
    echo "</A></B></TD>\n<TD WIDTH=\"14%\" class=\"header\"><B>";
    if ($GLOBALS["order"] == "mod") {
        $new_srt = $_srt;
    } else {
        $new_srt = "yes";
    }
    echo "<A href=\"" . make_link("list", $dir, NULL, "mod", $new_srt) . "\">" . $GLOBALS["messages"]["modifheader"];
    if ($GLOBALS["order"] == "mod") {
        echo $_img;
    }
    echo "</A></B></TD><TD WIDTH=\"8%\" class=\"header\"><B>" . $GLOBALS["messages"]["permheader"] . "</B>\n";
    echo "</TD><TD WIDTH=\"6%\" class=\"header\"><B>" . $GLOBALS["messages"]["actionheader"] . "</B></TD></TR>\n";
    echo "<TR><TD colspan=\"7\"><HR></TD></TR>\n";
    // make & print Table using lists
    print_table($dir, make_list($dir_list, $file_list));
    // print number of items & total filesize
    echo "<TR><TD colspan=\"7\"><HR></TD></TR><TR>\n<TD class=\"header\"></TD>";
    echo "<TD class=\"header\">" . $num_items . " " . $GLOBALS["messages"]["miscitems"] . " (";
    if (function_exists(" 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_abs_img_root函数代码示例发布时间:2022-05-15
下一篇:
PHP get_UserCache函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap