function getdirentry($directory) { global $entryarray; if (!file_exists(DISCUZ_ROOT . './' . $directory)) { return; } $dir = dir(DISCUZ_ROOT . './' . $directory); while ($entry = $dir->read()) { if (!in_array($entry, array('.', '..', 'index.htm'))) { if (is_dir(DISCUZ_ROOT . './' . $directory . '/' . $entry)) { getdirentry($directory . "/" . $entry); } $entryarray[] = $directory . '/' . $entry; } } $dir->close(); }
function getdirentry($directory) { global $entryarray; $dir = dir(DISCUZ_ROOT . './' . $directory); while ($entry = $dir->read()) { if ($entry != '.' && $entry != '..') { if (is_dir(DISCUZ_ROOT . './' . $directory . '/' . $entry)) { $entryarray[] = $directory . '/' . $entry; getdirentry($directory . "/" . $entry); } else { $entryarray[] = $directory . '/' . $entry; } } } $dir->close(); }
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: file_search.inc.php 79 2012-04-16 10:06:12Z wangbin $ */ (!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) && exit('Access Denied'); if (!submitcheck('search')) { showformheader("plugins&cp=file_search&pmod=safe&operation={$operation}&do={$do}&identifier={$identifier}"); showtableheaders($toolslang['file_search']); $dirlist[] = array('.', './'); getdirentry('./'); $showlist = array('sdir[]', $dirlist); showsetting($toolslang['file_keyword'], 'keyword', '', 'text', '', 0, $toolslang['file_keywordtip']); showsetting($toolslang['file_searchdir'], $showlist, '', 'mselect', '', 0, $toolslang['file_searchdirtip']); showsubmit('search'); showtablefooter(); } else { if (empty($_GET['keyword'])) { cpmsg($toolslang['file_nokeyword'], "action=plugins&cp=file_search&pmod=safe&operation={$operation}&do={$do}&identifier={$identifier}", 'error'); exit; } if (empty($_GET['sdir'])) { cpmsg($toolslang['file_nodir'], "action=plugins&cp=file_search&pmod=safe&operation={$operation}&do={$do}&identifier={$identifier}", 'error'); exit; } $_GET['keyword'] = str_replace('*', '(.*)', $_GET['keyword']); $keyword = strtolower(dstripslashes($_GET['keyword'])); $dir = $_GET['sdir'];