本文整理汇总了PHP中filelist函数的典型用法代码示例。如果您正苦于以下问题:PHP filelist函数的具体用法?PHP filelist怎么用?PHP filelist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filelist函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
* Load the list with available plugins and assign them in the correct category
*/
public function __construct(\phpbb\titania\controller\helper $controller_helper)
{
$this->controller_helper = $controller_helper;
$this->phpbb_root_path = \phpbb::$root_path;
$this->php_ext = \phpbb::$php_ext;
// Set the path
$this->tool_box_path = $this->phpbb_root_path . 'ext/phpbb/titania/includes/manage_tools/';
// Load functions_admin.php if required
if (!function_exists('filelist')) {
include $this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext;
}
// Create a list with tools
$filelist = filelist($this->tool_box_path, '', $this->php_ext);
// Need to do some sanitization on the result of filelist
foreach ($filelist as $tools) {
// Don't want the extension
foreach ($tools as $tool) {
if (in_array($tool, $this->ignore_tools)) {
continue;
}
$this->plugin_list[] = ($pos = strpos($tool, '.' . $this->php_ext)) !== false ? substr($tool, 0, $pos) : $tool;
}
}
// Get the requested cat and tool
$this->tool_id = phpbb::$request->variable('t', '');
// Check if they want to use a tool or not, make sure that the tool name is legal, and make sure the tool exists
if (!$this->tool_id || preg_match('#([^a-zA-Z0-9_])#', $this->tool_id) || !file_exists($this->tool_box_path . $this->tool_id . '.' . $this->php_ext)) {
$this->tool_id = '';
}
// Make sure the form_key is set
add_form_key($this->tool_id);
// Assign the two menus to the template
$this->gen_left_nav();
}
示例2: manage_plugin
/**
* Constructor
* Load the list with available plugins and assign them in the correct category
*/
function manage_plugin()
{
// Set the path
$this->tool_box_path = TITANIA_ROOT . 'includes/manage_tools/';
// Create a list with tools
$filelist = filelist($this->tool_box_path, '', PHP_EXT);
// Need to do some sanitization on the result of filelist
foreach ($filelist as $tools) {
// Don't want the extension
foreach ($tools as $tool) {
if (in_array($tool, $this->ignore_tools)) {
continue;
}
$this->plugin_list[] = ($pos = strpos($tool, '.' . PHP_EXT)) !== false ? substr($tool, 0, $pos) : $tool;
}
}
// Get the requested cat and tool
$this->tool_id = request_var('t', '');
// Check if they want to use a tool or not, make sure that the tool name is legal, and make sure the tool exists
if (!$this->tool_id || preg_match('#([^a-zA-Z0-9_])#', $this->tool_id) || !file_exists($this->tool_box_path . $this->tool_id . '.' . PHP_EXT)) {
$this->tool_id = '';
}
// Make sure the form_key is set
add_form_key($this->tool_id);
// Assign the two menus to the template
$this->gen_left_nav();
}
示例3: marker_image_select
protected function marker_image_select($marker, $path)
{
$path = $this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . $path;
if (!function_exists('filelist')) {
include $this->phpbb_root_path . '/includes/functions_admin.' . $this->php_ext;
}
$imglist = filelist($path);
$edit_img = $filename_list = '';
foreach ($imglist as $path => $img_ary) {
sort($img_ary);
foreach ($img_ary as $img) {
$img = $path . $img;
if ($img == $marker) {
$selected = ' selected="selected"';
$edit_img = $img;
} else {
$selected = '';
}
if (strlen($img) > 255) {
continue;
}
$filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
}
}
return '<option value=""' . ($edit_img == '' ? ' selected="selected"' : '') . '>----------</option>' . $filename_list;
}
示例4: add_file
/**
* Add file to archive
*/
function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '')
{
global $phpbb_root_path;
$skip_files = explode(',', $skip_files);
// Remove rm prefix from src path
$src_path = ($src_rm_prefix) ? preg_replace('#^(' . preg_quote($src_rm_prefix, '#') . ')#', '', $src) : $src;
// Add src prefix
$src_path = ($src_add_prefix) ? ($src_add_prefix . ((substr($src_add_prefix, -1) != '/') ? '/' : '') . $src_path) : $src_path;
// Remove initial "/" if present
$src_path = (substr($src_path, 0, 1) == '/') ? substr($src_path, 1) : $src_path;
if (is_file($phpbb_root_path . $src))
{
$this->data($src_path, file_get_contents("$phpbb_root_path$src"), false, stat("$phpbb_root_path$src"));
}
else if (is_dir($phpbb_root_path . $src))
{
// Clean up path, add closing / if not present
$src_path = ($src_path && substr($src_path, -1) != '/') ? $src_path . '/' : $src_path;
$filelist = array();
$filelist = filelist("$phpbb_root_path$src", '', '*');
krsort($filelist);
if ($src_path)
{
$this->data($src_path, '', true, stat("$phpbb_root_path$src"));
}
foreach ($filelist as $path => $file_ary)
{
if ($path)
{
// Same as for src_path
$path = (substr($path, 0, 1) == '/') ? substr($path, 1) : $path;
$path = ($path && substr($path, -1) != '/') ? $path . '/' : $path;
$this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path"));
}
foreach ($file_ary as $file)
{
if (in_array($path . $file, $skip_files))
{
continue;
}
$this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), false, stat("$phpbb_root_path$src$path$file"));
}
}
}
return true;
}
示例5: add_file
/**
* Add file to archive
*/
function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '')
{
global $phpbb_root_path;
$skip_files = explode(',', $skip_files);
// Remove rm prefix from src path
$src_path = $src_rm_prefix ? preg_replace('#^(' . preg_quote($src_rm_prefix, '#') . ')#', '', $src) : $src;
// Add src prefix
$src_path = $src_add_prefix ? $src_add_prefix . (substr($src_add_prefix, -1) != '/' ? '/' : '') . $src_path : $src_path;
// Remove initial "/" if present
$src_path = substr($src_path, 0, 1) == '/' ? substr($src_path, 1) : $src_path;
if (is_file($phpbb_root_path . $src)) {
$this->data($src_path, file_get_contents("{$phpbb_root_path}{$src}"), false, stat("{$phpbb_root_path}{$src}"));
} else {
if (is_dir($phpbb_root_path . $src)) {
// Clean up path, add closing / if not present
$src_path = $src_path && substr($src_path, -1) != '/' ? $src_path . '/' : $src_path;
$filelist = array();
$filelist = filelist("{$phpbb_root_path}{$src}", '', '*');
krsort($filelist);
/**
* Commented out, as adding the folders produces corrupted archives
if ($src_path)
{
$this->data($src_path, '', true, stat("$phpbb_root_path$src"));
}
*/
foreach ($filelist as $path => $file_ary) {
/**
* Commented out, as adding the folders produces corrupted archives
if ($path)
{
// Same as for src_path
$path = (substr($path, 0, 1) == '/') ? substr($path, 1) : $path;
$path = ($path && substr($path, -1) != '/') ? $path . '/' : $path;
$this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path"));
}
*/
foreach ($file_ary as $file) {
if (in_array($path . $file, $skip_files)) {
continue;
}
$this->data("{$src_path}{$path}{$file}", file_get_contents("{$phpbb_root_path}{$src}{$path}{$file}"), false, stat("{$phpbb_root_path}{$src}{$path}{$file}"));
}
}
} else {
// $src does not exist
return false;
}
}
return true;
}
示例6: repair
function repair()
{
global $db;
$stylelist = filelist(PHPBB_ROOT_PATH . 'styles/', '', 'cfg');
ksort($stylelist);
// Loop throught the files and try to find a style we can use.
// To be usable the directory name in the style.cfg is the same as the directory.
foreach (array_keys($stylelist) as $styledirname) {
if (!in_array('style.cfg', $stylelist[$styledirname])) {
continue;
}
// Read the cfg, should always be index 0
$items = parse_cfg_file(PHPBB_ROOT_PATH . 'styles/' . $styledirname . 'style.cfg');
// Unify the name in the cfg to something used as a directory
// Spaces -> '_'
// All lowercase
$stylename = utf8_clean_string(str_replace(' ', '_', $items['name']));
// Clean up the dirname
$dirname = substr($styledirname, -1) == '/' ? substr($styledirname, 0, -1) : $styledirname;
// If not the same switch to the next one
if ($dirname != $stylename) {
continue;
}
// If this style isn't installed we will install the style at this point.
$sql = 'SELECT style_id
FROM ' . STYLES_TABLE . "\n\t\t\t\tWHERE style_name = '" . $db->sql_escape($items['name']) . "'";
$result = $db->sql_query($sql);
$this->sid = $db->sql_fetchfield('style_id', false, $result);
$db->sql_freeresult($result);
if (empty($this->sid)) {
// Nasty, but the style installer fetches these in the method o_0
$GLOBALS['_REQUEST']['path'] = $stylename;
$GLOBALS['_POST']['update'] = true;
// Call the style installer
$this->ac->install('style');
// Fetch the id
$sql = 'SELECT style_id
FROM ' . STYLES_TABLE . "\n\t\t\t\t\tWHERE style_name = '" . $db->sql_escape($items['name']) . "'";
$result = $db->sql_query($sql);
$this->sid = $db->sql_fetchfield('style_id', false, $result);
$db->sql_freeresult($result);
}
// Set this style as the active style
set_config('default_style', $this->sid);
set_config('override_user_style', 1);
// Overriding the style should enable the board for everyone
return;
}
echo 'The support toolkit couldn\'t find an available style. Please seek further assistance in the support forums on <a href="http://www.phpbb.com/community/viewforum.php?f=46" title="phpBB.com Support forum">phpbb.com</a>';
garbage_collection();
exit_handler();
}
示例7: plugin
/**
* Constructor
* Load the list with available plugins and assign them in the correct category
*/
function plugin()
{
// Set the path
$this->tool_box_path = STK_ROOT_PATH . 'tools/';
// Create a list with tools
$filelist = filelist($this->tool_box_path, '', PHP_EXT);
// Need to do some sanitization on the result of filelist
foreach ($filelist as $cat => $tools) {
// Don't need those
if (empty($cat)) {
continue;
}
$cat = substr($cat, -1) == '/' ? substr($cat, 0, -1) : $cat;
if (!isset($this->plugin_list[$cat])) {
$this->plugin_list[$cat] = array();
}
// Don't want the extension
foreach ($tools as $key => $tool) {
$tools[$key] = ($pos = strpos($tool, '.' . PHP_EXT)) !== false ? substr($tool, 0, $pos) : $tool;
}
$this->plugin_list[$cat] = $tools;
}
// Get the requested cat and tool
$this->_parts['c'] = request_var('c', $this->_parts['c']);
$this->_parts['t'] = request_var('t', $this->_parts['t']);
// We shouldn't rely on the given category request, unless there really is a tool with that name in the given category
if ($this->_parts['t'] && (!isset($this->plugin_list[$this->_parts['c']]) || !in_array($this->_parts['t'], $this->plugin_list[$this->_parts['c']]))) {
foreach ($this->plugin_list as $cat => $tools) {
foreach ($tools as $tool) {
if ($tool == $this->_parts['t']) {
$this->_parts['c'] = $cat;
}
}
}
}
// Check if they want to use a tool or not, make sure that the tool name is legal, and make sure the tool exists
if (!$this->_parts['t'] || preg_match('#([^a-zA-Z0-9_])#', $this->_parts['t']) || !file_exists(STK_ROOT_PATH . 'tools/' . $this->_parts['c'] . '/' . $this->_parts['t'] . '.' . PHP_EXT)) {
$this->_parts['t'] = '';
}
// Make sure the form_key is set
add_form_key($this->_parts['t']);
// Assign the two menus to the template
$this->gen_top_nav();
$this->gen_left_nav();
}
示例8: filelist
function filelist($folderRoot, $folder = '')
{
$handle = opendir($folderRoot . '/' . $folder);
while ($file = readdir($handle)) {
if (is_dir($folderRoot . '/' . $folder . '/' . $file)) {
if ($file == '.' || $file == '..') {
} else {
$p = $file;
if ($folder > '') {
$p = $folder . '/' . $p;
}
filelist($folderRoot, $p);
}
} else {
$filehex = $folder . '/' . $file . "\t" . crc32_file3($folderRoot . '/' . $folder . '/' . $file);
$GLOBALS['filehexlist'] .= $filehex . "\r\n";
}
}
}
示例9: filelist
function filelist()
{
//返回主题文件路径
$dir = APP_ROOT . "/User/Home/View";
//主题目录
$list = scandir($dir);
foreach ($list as $file) {
//遍历
$path = $dir . "/" . $file;
if (is_dir($path) && $file != "." && $file != "..") {
//判断是否是路径
filelist($path);
} else {
if ($this->extend($file) == "html") {
$rs[] = array("file" => $file, "path" => $path);
}
}
}
return $rs;
}
示例10: filelist
function filelist($folderRoot,$folder=''){
$handle=opendir($folderRoot.'/'.$folder);
while($file=readdir($handle)){
//if($folder=='.'){
// $path=$file;
//}else{
$path=$folderRoot.'/'.$folder.'/'.$file;
//}
if(is_dir($path)){
if($file=='.'||$file=='..'){
}else{
filelist($folderRoot,$path);
}
}else{
$pathx=$folder.'/'.$file;
$filehex=$pathx."\t".crc32_file3($path);
$GLOBALS['filehexlist'].=$filehex."\r\n";
}
}
}
示例11: filelist
function filelist($startdir = "./", $searchSubdirs = 0, $directoriesonly = 1, $maxlevel = "1", $level = 1)
{
//list the directory/file names that you want to ignore
$ignoredDirectory[] = ".";
$ignoredDirectory[] = "..";
$ignoredDirectory[] = "_vti_cnf";
global $directorylist;
//initialize global array
if (is_dir($startdir)) {
if ($dh = opendir($startdir)) {
while (($file = readdir($dh)) !== false) {
if (!(array_search($file, $ignoredDirectory) > -1)) {
if (filetype($startdir . $file) == "dir") {
//build your directory array however you choose;
//add other file details that you want.
$directorylist[$startdir . $file]['level'] = $level;
$directorylist[$startdir . $file]['dir'] = 1;
$directorylist[$startdir . $file]['name'] = $file;
$directorylist[$startdir . $file]['path'] = $startdir;
if ($searchSubdirs) {
if ($maxlevel == "all" or $maxlevel > $level) {
filelist($startdir . $file . "/", $searchSubdirs, $directoriesonly, $maxlevel, $level + 1);
}
}
} else {
if (!$directoriesonly) {
//if you want to include files; build your file array
//however you choose; add other file details that you want.
$directorylist[$startdir . $file]['level'] = $level;
$directorylist[$startdir . $file]['dir'] = 0;
$directorylist[$startdir . $file]['name'] = $file;
$directorylist[$startdir . $file]['path'] = $startdir;
}
}
}
}
closedir($dh);
}
}
return $directorylist;
}
示例12: critical_repair
/**
* Construct critical repair.
* This method loads all critical repair tools
* @return void
*/
function critical_repair()
{
$this->tool_path = STK_ROOT_PATH . 'includes/critical_repair/';
$filelist = filelist($this->tool_path, '', PHP_EXT);
foreach ($filelist as $directory => $tools) {
if ($directory != 'autorun/') {
if (sizeof($tools)) {
foreach ($tools as $tool) {
$this->manual_tools[] = substr($tool, 0, strpos($tool, '.'));
}
}
} else {
if (sizeof($tools)) {
foreach ($tools as $tool) {
$this->autorun_tools[] = substr($tool, 0, strpos($tool, '.'));
}
}
}
}
return true;
}
示例13: _store_in_db
/**
* Moves a template set to the database
*
* @access private
* @param string $mode The component to move - only template is supported
* @param int $id The template id
* @param string $path TThe path to the template files
*/
function _store_in_db($mode, $id, $path)
{
global $phpbb_root_path, $db;
$filelist = filelist("{$phpbb_root_path}styles/{$path}/template", '', 'html');
$this->store_templates('insert', $id, $path, $filelist);
// Okay, we do the query here -shouldn't be triggered often.
$sql = 'UPDATE ' . STYLES_TEMPLATE_TABLE . '
SET template_storedb = 1
WHERE template_id = ' . $id;
$db->sql_query($sql);
}
示例14: foreach
if ($merken != DATABASE) {
$db->selectDB(DATABASE, "");
}
$where = "";
foreach ($array as $value) {
if ($where != "") {
$where .= " OR ";
}
$where .= "fid = '" . $value . "'";
}
$sql = "SELECT *\n FROM site_file\n WHERE " . $where . "\n ORDER BY ffname, funder";
$result = $db->query($sql);
if ($merken != DATABASE) {
$db->selectDB($merken, "");
}
filelist($result, "contented");
}
if (is_array($_SESSION["compilation_memo"])) {
foreach ($_SESSION["compilation_memo"] as $compid => $value) {
$pics = implode(":", $value);
$dataloop["selection"][] = array("id" => $compid, "pics" => $pics, "onclick" => "ebInsertSelNG(ebCanvas, '" . $compid . "', '" . $cfg["contented"]["sel_tag"][0] . "', '" . $cfg["contented"]["sel_tag"][1] . "', '" . $pics . "', '" . $cfg["contented"]["sel_tag"][2] . "', '" . $cfg["contented"]["sel_tag"][3] . "');");
}
if (count($dataloop["selection"]) > 0) {
$hidedata["selection"] = array();
}
}
// template version
$art = "";
}
// referer im form mit hidden element mitschleppen
if ($HTTP_GET_VARS["referer"] != "") {
示例15: run
/**
* Run the tool
* This tool will run through the files and all files that are new, or of
* which the last change date has been changed will be checked for invalid
* characters.
*/
function run()
{
global $critical_repair, $stk_config;
// Get all the files
$filelist = filelist(PHPBB_ROOT_PATH, '', PHP_EXT);
foreach ($filelist as $directory => $files) {
// As the install dir can be renamed, we need to check here whether this
// is an install directory
if (in_array('convert_phpbb20.' . PHP_EXT, $files) || in_array('new_normalizer.' . PHP_EXT, $files) || in_array('database_update.' . PHP_EXT, $files)) {
// It is and we're not forcing a full scan, skip it
if (!$stk_config['bom_sniffer_force_full_scan']) {
continue;
}
}
// Step into the files
if (!empty($files)) {
// Test whether we're sniffing a language directory (any)
$lang_test_dir = '';
$lang_matches = array();
if (preg_match('#language/([a-zA-Z\\-_]+)/#ise', $directory, $lang_matches)) {
$lang_test_dir = str_replace($lang_matches[1], '..', $directory);
}
foreach ($files as $file) {
// If this is inside a language directory we need to check whether this file is
// in the whitelist and adjust the whitelist to include it
$sniff_lang_file = false;
if (!empty($lang_test_dir)) {
$sniff_lang_file = in_array($lang_test_dir . $file, $this->whitelist) ? true : false;
}
// Test this file against the whitelist
if (!$stk_config['bom_sniffer_force_full_scan'] && (!in_array($directory . $file, $this->whitelist) && $sniff_lang_file === false)) {
continue;
} else {
if (!isset($this->cache->cache_data[$directory . $file]) || filectime(PHPBB_ROOT_PATH . $directory . $file) != $this->cache->cache_data[$directory . $file] || !$stk_config['bom_sniffer_force_full_scan']) {
$this->sniff($directory, $file);
}
}
}
}
}
// Once finished always write the new data back to the cache file
$this->cache->storedata();
// Inform the user what to do if we've created files
if (is_dir(PHPBB_ROOT_PATH . 'store/bom_sniffer')) {
$critical_repair->trigger_error($this->messages['issue_found']);
}
}