本文整理汇总了PHP中get_chmod函数的典型用法代码示例。如果您正苦于以下问题:PHP get_chmod函数的具体用法?PHP get_chmod怎么用?PHP get_chmod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_chmod函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: set_chmod
function set_chmod($dir, $chmod, $type = 'is_file')
{
global $filesystem;
if (file_exists($dir) && $type($dir)) {
if (!check_chmod(decoct($chmod), get_chmod($dir))) {
$filesystem->chmod($dir, $chmod);
}
} else {
$filesystem->mkdir($dir, $chmod);
set_chmod($dir, $chmod, CHMOD_DIR);
}
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:12,代码来源:function.chmod.php
示例2: set_chmod
function set_chmod($dir, $chmod, $type = CHMOD_FILE, $stop = false)
{
global $filesystem;
if (file_exists($dir) && $type($dir)) {
if (!check_chmod(decoct($chmod), get_chmod($dir))) {
$filesystem->chmod($dir, $chmod);
}
} else {
if ($type == CHMOD_DIR && !$stop) {
$filesystem->mkdir($dir, $chmod);
set_chmod($dir, $chmod, CHMOD_DIR, true);
} elseif (!$stop) {
$filesystem->file_put_contents($dir, '');
set_chmod($dir, $chmod, CHMOD_FILE, true);
}
}
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:17,代码来源:function.chmod.php
示例3: foreach
foreach ($filenames as $f) {
$files[] = array('path' => $f, 'chmod' => $dat['chmod'], 'recursive' => false, 'req' => $dat['req']);
}
} else {
if ($dat['chmod'] == CHMOD_EX) {
set_chmod($dat['path'], 0777, CHMOD_DIR);
} elseif ($dat['chmod'] == CHMOD_WR) {
set_chmod($dat['path'], 0666, CHMOD_FILE);
}
$files[] = $dat;
}
}
@clearstatcache();
sort($files);
foreach ($files as $arr) {
$chmod = get_chmod($arr['path']);
if (check_chmod($arr['chmod'], $chmod)) {
$status = '<strong style="color: #008000;">' . $lang->phrase('admin_explorer_chmod_status_ok') . '</strong>';
} elseif ($arr['req'] == false) {
$status = '<strong style="color: #ffaa00;">' . $lang->phrase('admin_explorer_chmod_status_failure_x') . '</strong>';
} else {
$status = '<strong style="color: #ff0000;">' . $lang->phrase('admin_explorer_chmod_status_failure') . '</strong>';
}
?>
<tr class="mbox">
<td><?php
echo $arr['path'];
?>
</td>
<td><?php
echo $arr['chmod'];
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:explorer.php
示例4: showContent
function showContent($print = true)
{
global $lang;
$dir_list = $file_list = $subdir_size_list = array();
$total_dir_size = 0;
if (($dir_handle = opendir($this->path)) === false) {
error('admin.php?action=explorer', $lang->phrase('admin_explorer_could_not_open_dir') . realpath($this->path));
}
while (($file = @readdir($dir_handle)) !== false) {
if ($file == '.' || $file == '..') {
continue;
}
if (is_dir($this->path . $file)) {
$dir_list[] = $file;
if ($this->show_subfolders_size) {
$stack = array($this->path . $file . '/');
$size = 0;
while (count($stack) > 0) {
$subdir = array_shift($stack);
$subdir_handle = @opendir($subdir);
while (($subdir_file = @readdir($subdir_handle)) !== false) {
if ($subdir_file == '.' || $subdir_file == '..') {
continue;
}
if ($this->show_subfolders_size) {
if (is_dir($subdir . $subdir_file)) {
array_push($stack, $subdir . $subdir_file . '/');
}
}
$size += @filesize($subdir . $subdir_file);
}
@closedir($subdir_handle);
}
$subdir_size_list[$file] = $size;
$total_dir_size += $size;
}
} else {
$file_list[] = $file;
$total_dir_size += @filesize($this->path . $file);
}
}
@closedir($dir_handle);
natcasesort($dir_list);
natcasesort($file_list);
$total_files = count($dir_list) + count($file_list);
$total_size = $this->formatSize($total_dir_size);
$print_spacer = count($file_list) > 0 && count($dir_list) > 0 ? true : false;
$page_link = $this->realPath(dirname($this->script_file) . '/' . $this->path);
$rp = realpath($this->path);
$root = extract_dir($this->root);
$rp = str_replace($root, '', $rp);
$heading_path = $this->realPath($rp);
$heading_path_parts = explode("/", $heading_path);
$levels = count($heading_path_parts) - 2;
for ($heading_path = ""; $levels > -1; $levels--) {
for ($i = 0, $path = ""; $i < $levels; $i++) {
$path .= "../";
}
$link = '&path=' . urlencode($this->realPath($this->path . $path));
$heading_path .= '<a href="' . $this->script_file . $link . '">' . array_shift($heading_path_parts) . '</a>' . DIRECTORY_SEPARATOR;
}
$newdir = $this->script_file . '&path=' . urlencode(str_replace('/\\', '/', $this->path));
$newdir_html = '<span style="float: right;"><a class="button" href="' . $newdir . '&job=newdir">' . $lang->phrase('admin_explorer_create_new_directory') . '</a></span>';
$html = ' <table cellpadding="4" cellspacing="0" class="border">';
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="obox"><span style="float: right;"><a class="button" href="admin.php?action=explorer&job=all_chmod">' . $lang->phrase('admin_explorer_check_chmod') . '</a></span>' . iif(count($dir_list) == 0, $newdir_html) . $lang->phrase('admin_explorer_filemanager') . '</td>';
$html .= "\n" . ' </tr>';
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="ubox">' . $lang->phrase('admin_explorer_directory_x') . extract_dir($this->root) . $heading_path . '</td>';
$html .= "\n" . ' </tr>';
$html .= "\n" . ' </table><br />';
$html .= "\n" . ' <table cellpadding="4" cellspacing="0" class="border">';
if (count($dir_list) > 0) {
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="obox" colspan="5">' . $newdir_html . $lang->phrase('admin_explorer_directories') . '</td>';
$html .= "\n" . ' </tr>';
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="ubox" width="30%">' . $lang->phrase('admin_explorer_directory') . '</td>';
$html .= "\n" . ' <td class="ubox" width="9%">' . $lang->phrase('admin_explorer_size') . '</td>';
$html .= "\n" . ' <td class="ubox" width="20%">' . $lang->phrase('admin_explorer_created_on') . '</td>';
$html .= "\n" . ' <td class="ubox" width="8%">' . $lang->phrase('admin_explorer_chmod') . '</td>';
$html .= "\n" . ' <td class="ubox" width="33%">' . $lang->phrase('admin_explorer_action') . '</td>';
$html .= "\n" . ' </tr>';
}
while (($dir = array_shift($dir_list)) !== NULL) {
$path_url = '&path=' . urlencode(str_replace('/\\', '/', $this->path) . $dir . '/');
$link = $this->script_file . $path_url;
$size = $this->show_subfolders_size ? $this->formatSize($subdir_size_list[$dir]) : " ";
$chmod = get_chmod($this->path . $dir);
$icon = $this->icons('directory');
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="mbox">';
$html .= "\n" . ' <a href="' . $link . '" target="Main">' . $icon . $dir . '</a>';
$html .= "\n" . ' </td>';
$html .= "\n" . ' <td class="mbox" align="right">';
$html .= "\n" . ' ' . $size;
$html .= "\n" . ' </td>';
$html .= "\n" . ' <td class="mbox">';
$html .= "\n" . ' ' . gmdate("d.m.y, H:i", times(filectime($this->path . $dir)));
$html .= "\n" . ' </td>';
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:101,代码来源:class.servernavigator.php
示例5: elseif
} elseif ($dat['chmod'] == CHWR) {
set_chmod($path, 0666, CHMOD_FILE);
}
$files[] = $dat;
}
}
@clearstatcache();
sort($files);
$failure = false;
foreach ($files as $arr) {
$filesys_path = '../' . $arr['path'];
$path = realpath($filesys_path);
if (empty($path)) {
$path = $arr['path'];
}
$chmod = get_chmod($filesys_path);
if (check_chmod($arr['chmod'], $chmod)) {
$status = '<strong class="hl_true">OK</strong>';
$int_status = true;
} elseif ($arr['req'] == false) {
$status = '<strong class="hl_null">Failure*</strong>';
$int_status = null;
} else {
$status = '<strong class="hl_false">Failure</strong>';
$int_status = false;
$failure = true;
}
if ($arr['req'] == true || $int_status != true) {
?>
<tr>
<td><?php
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:4.php
示例6: extract_files
function extract_files($to_dir, $files = null)
{
global $filesystem;
$this->error = "";
// Make sure the $to_dir is pointing to a valid dir, or we error and return
if (!is_dir($to_dir)) {
$this->error = "Extract files error: Destination directory ({$to_dir}) does not exist";
return false;
}
$to_dir = realpath($to_dir) . DIRECTORY_SEPARATOR;
//+------------------------------
// Get the file info from the tar
//+------------------------------
$in_files = $this->read_tar();
if (!empty($this->error)) {
return false;
}
$error_files = array();
foreach ($in_files as $k => $file) {
//-----------------------------------------
// Stop any potential file traversal issues
//-----------------------------------------
$file['name'] = str_replace('..', '', $file['name']);
$error_files[$k] = $file['name'];
//---------------------------------------------
// Are we choosing which files to extract?
//---------------------------------------------
if (is_array($files) && !in_array($file['name'], $files)) {
continue;
}
//---------------------------------------------
// GNU TAR format dictates that all paths *must* be in the *nix
// format - if this is not the case, blame the tar vendor, not me!
//---------------------------------------------
if (preg_match("#/#", $file['name'])) {
$path_info = explode("/", $file['name']);
$file_name = array_pop($path_info);
} else {
$path_info = array();
$file_name = $file['name'];
}
//---------------------------------------------
// If we have a path, then we must build the directory tree
//---------------------------------------------
$cur_dir = $to_dir;
if (count($path_info) > 0) {
foreach ($path_info as $dir_component) {
if (empty($dir_component)) {
continue;
}
$cur_dir .= $dir_component . '/';
if (file_exists($cur_dir) && !is_dir($cur_dir)) {
$this->warnings[] = "{$cur_dir} exists, but is not a directory";
continue;
}
if (!is_dir($cur_dir)) {
$filesystem->mkdir($cur_dir, 0777);
} else {
$filesystem->chmod($cur_dir, 0777);
}
}
}
//---------------------------------------------
// check the typeflags, and work accordingly
//---------------------------------------------
if (empty($file['typeflag'])) {
$chmod_changed = false;
if (file_exists($cur_dir . $file_name)) {
$chmod = get_chmod($cur_dir . $file_name, true);
$filesystem->chmod($cur_dir . $file_name, 0666);
$chmod_changed = true;
}
if ($filesystem->file_put_contents($cur_dir . $file_name, $file['data'], true)) {
unset($error_files[$k]);
} else {
$this->warnings[] = "Could not write data to {$cur_dir}{$file_name}";
}
if ($chmod_changed == true) {
$filesystem->chmod($cur_dir . $file_name, $chmod);
}
} else {
if ($file['typeflag'] == 5) {
if (file_exists($cur_dir . $file_name) && !is_dir($cur_dir . $file_name)) {
$this->warnings[] = "{$cur_dir}{$file_name} exists, but is not a directory";
continue;
}
if (!is_dir($cur_dir . $file_name)) {
if ($filesystem->mkdir($cur_dir . $file_name, 0777)) {
unset($error_files[$k]);
}
} else {
$filesystem->chmod($cur_dir . $file_name, 0777);
unset($error_files[$k]);
}
} else {
if ($file['typeflag'] == 6) {
$this->warnings[] = "Cannot handle named pipes";
continue;
} else {
if ($file['typeflag'] == 1) {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:101,代码来源:class.tar.php
示例7: foot
<?php
echo foot();
} elseif ($job == "newdir2") {
$chmod = $gpc->get('chmod', int);
$name = $gpc->get('name', str, 'New Directory');
$path = urldecode($gpc->get('path', none));
$new = $path . $name . '/';
echo head();
if ($filesystem->mkdir($new, chmod_str2oct($chmod))) {
ok('admin.php?action=explorer&path=' . urlencode($new));
} else {
error('admin.php?action=explorer&path=' . urlencode($path));
}
} elseif ($job == "chmod") {
$path = $gpc->get('path', none);
$chmod = get_chmod($path);
echo head(' onload="octalchange()"');
?>
<form name="form" method="post" action="admin.php?action=explorer&job=chmod2">
<input type="hidden" name="path" value="<?php
echo $path;
?>
">
<table class="border">
<tr>
<td class="obox" colspan="2">Set CHMOD</td>
</tr>
<tr>
<td class="mbox">New CHMOD:</td>
<td class="mbox"><input type="text" name="chmod" id="chmod" value="<?php
echo $chmod;
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:explorer.php
示例8: showContent
function showContent($print = true)
{
$dir_list = $file_list = $subdir_size_list = array();
$total_dir_size = 0;
if (($dir_handle = opendir($this->path)) === false) {
$this->error("Could NOT open dir: " . realpath($this->path));
return false;
}
while (($file = @readdir($dir_handle)) !== false) {
if ($file == '.' || $file == '..') {
continue;
}
if (is_dir($this->path . $file)) {
$dir_list[] = $file;
if ($this->show_subfolders_size) {
$stack = array($this->path . $file . '/');
$size = 0;
while (count($stack) > 0) {
$subdir = array_shift($stack);
$subdir_handle = @opendir($subdir);
while (($subdir_file = @readdir($subdir_handle)) !== false) {
if ($subdir_file == '.' || $subdir_file == '..') {
continue;
}
if ($this->show_subfolders_size) {
if (is_dir($subdir . $subdir_file)) {
array_push($stack, $subdir . $subdir_file . '/');
}
}
$size += @filesize($subdir . $subdir_file);
}
@closedir($subdir_handle);
}
$subdir_size_list[$file] = $size;
$total_dir_size += $size;
}
} else {
$file_list[] = $file;
$total_dir_size += @filesize($this->path . $file);
}
}
@closedir($dir_handle);
natcasesort($dir_list);
natcasesort($file_list);
$total_files = count($dir_list) + count($file_list);
$total_size = $this->formatSize($total_dir_size);
$print_spacer = count($file_list) > 0 && count($dir_list) > 0 ? true : false;
$page_link = $this->realPath(viscacha_dirname($this->script_file) . '/' . $this->path);
$rp = realpath($this->path);
$root = realpath('../' . $this->root);
$rp = str_replace($root, '', $rp);
$heading_path = $this->realPath($rp);
$heading_path_parts = explode("/", $heading_path);
$levels = count($heading_path_parts) - 2;
for ($heading_path = ""; $levels > -1; $levels--) {
for ($i = 0, $path = ""; $i < $levels; $i++) {
$path .= "../";
}
$link = '&path=' . urlencode($this->realPath($this->path . $path));
$heading_path .= '<a href="' . $this->script_file . $link . '">' . array_shift($heading_path_parts) . '</a>' . DIRECTORY_SEPARATOR;
}
$newdir = $this->script_file . '&path=' . urlencode(str_replace('/\\', '/', $this->path));
$newdir_html = '<span style="float: right;">[<a href="' . $newdir . '&job=newdir">Create new directory</a>]</span>';
$html = ' <table cellpadding="4" cellspacing="0" class="border">';
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="obox">Filemanager</td>';
$html .= "\n" . ' </tr>';
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="ubox">Directory: ' . realpath('../' . $this->root) . $heading_path . '</td>';
$html .= "\n" . ' </tr>';
$html .= "\n" . ' </table><br />';
$html .= "\n" . ' <table cellpadding="4" cellspacing="0" class="border">';
if (count($dir_list) > 0) {
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="obox" colspan="5">' . $newdir_html . ' Directories</td>';
$html .= "\n" . ' </tr>';
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="ubox" width="30%">Directory</td>';
$html .= "\n" . ' <td class="ubox" width="9%">Size</td>';
$html .= "\n" . ' <td class="ubox" width="20%">Created on</td>';
$html .= "\n" . ' <td class="ubox" width="8%">CHMOD</td>';
$html .= "\n" . ' <td class="ubox" width="33%">Action</td>';
$html .= "\n" . ' </tr>';
}
while (($dir = array_shift($dir_list)) !== NULL) {
$path_url = '&path=' . urlencode(str_replace('/\\', '/', $this->path) . $dir . '/');
$link = $this->script_file . $path_url;
$size = $this->show_subfolders_size ? $this->formatSize($subdir_size_list[$dir]) : " ";
$chmod = get_chmod($this->path . $dir);
$icon = $this->icons('directory');
$html .= "\n" . ' <tr>';
$html .= "\n" . ' <td class="mbox">';
$html .= "\n" . ' <a href="' . $link . '" target="Main">' . $icon . $dir . '</a>';
$html .= "\n" . ' </td>';
$html .= "\n" . ' <td class="mbox" align="right">';
$html .= "\n" . ' ' . $size;
$html .= "\n" . ' </td>';
$html .= "\n" . ' <td class="mbox">';
$html .= "\n" . ' ' . date("d.m.y, H:i", @filectime($this->path . $dir));
$html .= "\n" . ' </td>';
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:101,代码来源:class.servernavigator.php
示例9: define
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('EQDKP_INC', true);
$eqdkp_root_path = './../../../';
include_once $eqdkp_root_path . 'common.php';
if (!register('user')->is_signedin()) {
echo 'You have no permission to see this page as you are not logged in';
exit;
}
include_once $eqdkp_root_path . 'libraries/elfinder/php/elFinderConnector.class.php';
include_once $eqdkp_root_path . 'libraries/elfinder/php/elFinder.class.php';
include_once $eqdkp_root_path . 'libraries/elfinder/php/elFinderVolumeDriver.class.php';
include_once $eqdkp_root_path . 'libraries/elfinder/php/elFinderVolumeLocalFileSystem.class.php';
/**
* Simple function to demonstrate how to control file access using "accessControl" callback.
* This method will disable accessing files/folders starting from '.' (dot)
*
* @param string $attr attribute name (read|write|locked|hidden)
* @param string $path file path relative to volume root directory started with directory separator
* @return bool|null
**/
function access($attr, $path, $data, $volume)
{
return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null;
// else elFinder decide it itself
}
$opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => register('pfh')->FolderPath('users/' . register('user')->id, 'files'), 'URL' => register('pfh')->FileLink('users/' . register('user')->id . '/', 'files', 'absolute'), 'accessControl' => 'access', 'uploadAllow' => array('image/jpeg', 'image/png', 'image/gif'), 'uploadDeny' => array('all'), 'disabled' => array('extract', 'archive', 'mkdir', 'mkfile', 'help', 'rename', 'download', 'edit'), 'maxFilesInDir' => MAX_FILES_USERFOLDER, 'tmbPathMode' => get_chmod(true))));
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
开发者ID:rswiders,项目名称:core,代码行数:31,代码来源:connector.useravatars.php
示例10: access
* This method will disable accessing files/folders starting from '.' (dot)
*
* @param string $attr attribute name (read|write|locked|hidden)
* @param string $path file path relative to volume root directory started with directory separator
* @return bool|null
**/
function access($attr, $path, $data, $volume)
{
if (basename($path) == "index.html") {
return !($attr == 'read' || $attr == 'locked');
}
return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null;
// else elFinder decide it itself
}
if ($blnIsAdmin) {
$opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => register('pfh')->FolderPath('', 'files'), 'startPath' => register('pfh')->FolderPath('system', 'files'), 'URL' => register('pfh')->FileLink('', 'files', 'absolute'), 'accessControl' => 'access', 'uploadAllow' => array('all'), 'uploadDeny' => array('application/x-php', 'application/x-perl', 'application/x-python-bytecode', 'application/x-ruby', 'text/x-php', 'text/x-perl', 'text/x-python-bytecode', 'text/x-ruby', 'text/x-c++'), 'uploadOrder' => array('allow', 'deny'), 'disabled' => array('extract', 'archive', 'mkfile', 'help', 'edit'), 'tmbPathMode' => get_chmod(true))));
} elseif ($blnIsUser) {
$opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => register('pfh')->FolderPath('system', 'files'), 'startPath' => register('pfh')->FolderPath('system', 'files'), 'URL' => register('pfh')->FileLink('', 'files', 'absolute'), 'accessControl' => 'access', 'uploadAllow' => array('image/jpeg', 'image/png', 'image/gif', 'application/x-zip-compressed', 'application/zip', 'application/x-zip'), 'uploadDeny' => array('all'), 'disabled' => array('extract', 'archive', 'mkdir', 'mkfile', 'help', 'rename', 'download', 'edit'))));
}
if (register('input')->get('sf') != "") {
$path = register('encrypt')->decrypt(str_replace(" ", "+", register('input')->get('sf')));
$rel_path = str_replace(register('environment')->link, registry::get_const('root_path'), $path);
$opts['roots'][0]['path'] = $opts['roots'][0]['startPath'] = $rel_path;
$opts['roots'][0]['URL'] = $path;
register('pfh')->FolderPath($rel_path);
}
//Create system folder
register('pfh')->FolderPath('system', 'files');
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
开发者ID:rswiders,项目名称:core,代码行数:31,代码来源:connector.php
注:本文中的get_chmod函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论