本文整理汇总了PHP中get_abs_item函数的典型用法代码示例。如果您正苦于以下问题:PHP get_abs_item函数的具体用法?PHP get_abs_item怎么用?PHP get_abs_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_abs_item函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execAction
function execAction($dir)
{
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('upload', false, $GLOBALS["error_msg"]["accessfunc"]);
}
$this->_downloadMethods = array(new CurlDownloader(), new WgetDownloader(), new FopenDownloader(), new FsockopenDownloader());
//DEBUG ext_Result::sendResult('transfer', false, $dir );
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
// CSRF Security Check
if (!ext_checkToken($GLOBALS['__POST']["token"])) {
ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.');
}
$cnt = count($GLOBALS['__POST']['userfile']);
$err = false;
foreach ($this->_downloadMethods as $method) {
if ($method->isSupported()) {
$downloader =& $method;
break;
}
}
// upload files & check for errors
for ($i = 0; $i < $cnt; $i++) {
$errors[$i] = NULL;
$items[$i] = stripslashes(basename($GLOBALS['__POST']['userfile'][$i]));
$abs = get_abs_item($dir, $items[$i]);
if ($items[$i] == "") {
continue;
}
if (@file_exists($abs) && empty($_REQUEST['overwrite_files'])) {
$errors[$i] = $GLOBALS["error_msg"]["itemdoesexist"];
$err = true;
continue;
}
// Upload
$ok = $downloader->download($GLOBALS['__POST']['userfile'][$i], $abs);
if ($ok === true) {
$mode = ext_isFTPMode() ? 644 : 0644;
@$GLOBALS['ext_File']->chmod($abs, $mode);
} else {
$errors[$i] = $ok;
$err = true;
continue;
}
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; $i++) {
if ($errors[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $errors[$i] . "\n";
}
ext_Result::sendResult('transfer', false, $err_msg);
}
ext_Result::sendResult('transfer', true, ext_Lang::msg('transfer_completed'));
return;
}
}
开发者ID:naka211,项目名称:myloyal,代码行数:60,代码来源:transfer.php
示例2: execAction
function execAction($dir, $item)
{
if (!ext_isArchive($item)) {
ext_Result::sendResult('archive', false, $item . ': ' . ext_Lang::err('extract_noarchive'));
} else {
// CSRF Security Check
if (!ext_checkToken($GLOBALS['__POST']["token"])) {
ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.');
}
$archive_name = realpath(get_abs_item($dir, $item));
if (empty($dir)) {
$extract_dir = realpath($GLOBALS['home_dir']);
} else {
$extract_dir = realpath($GLOBALS['home_dir'] . "/" . $dir);
}
require_once _EXT_PATH . '/libraries/Archive/archive.php';
$res = extArchive::extract($archive_name, $extract_dir);
if (PEAR::isError($res)) {
ext_Result::sendResult('extract', false, ext_Lang::err('extract_failure') . ' - ' . $res->getMessage());
}
if ($res === false) {
ext_Result::sendResult('extract', false, ext_Lang::err('extract_failure'));
} else {
ext_Result::sendResult('extract', true, ext_Lang::msg('extract_success'));
}
ext_Result::sendResult('extract', true, ext_Lang::msg('extract_success'));
}
}
开发者ID:naka211,项目名称:myloyal,代码行数:28,代码来源:extract.php
示例3: make_item
function make_item($dir)
{
if (!permissions_grant($dir, NULL, "create")) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
$mkname = $GLOBALS['__POST']["mkname"];
$mktype = $GLOBALS['__POST']["mktype"];
$mkname = basename(stripslashes($mkname));
if ($mkname == "") {
show_error($GLOBALS["error_msg"]["miscnoname"]);
}
$new = get_abs_item($dir, $mkname);
if (@file_exists($new)) {
show_error($mkname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
if ($mktype != "file") {
$ok = @mkdir($new, 0777);
$err = $GLOBALS["error_msg"]["createdir"];
} else {
$ok = @touch($new);
$err = $GLOBALS["error_msg"]["createfile"];
}
if ($ok === false) {
show_error($err);
}
header("Location: " . make_link("list", $dir, NULL));
}
开发者ID:sdoney,项目名称:nas4free,代码行数:27,代码来源:mkitem.php
示例4: download_item
function download_item($dir, $item)
{
// Security Fix:
$item = basename($item);
while (@ob_end_clean()) {
}
ob_start();
if (!get_is_file($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
$abs_item = get_abs_item($dir, $item);
$browser = id_browser();
header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize(realpath($abs_item)));
//header("Content-Encoding: none");
if ($browser == 'IE') {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
}
@set_time_limit(0);
@readfile($abs_item);
ob_end_flush();
exit;
}
开发者ID:morovan,项目名称:granitpiestany.sk,代码行数:34,代码来源:fun_down.php
示例5: find_item
function find_item($dir, $pat, &$list, $recur)
{
// find items
$handle = @opendir(get_abs_dir($dir));
if ($handle === false) {
return;
}
// unable to open dir
while (($new_item = readdir($handle)) !== false) {
if (!@file_exists(get_abs_item($dir, $new_item))) {
continue;
}
if (!get_show_item($dir, $new_item)) {
continue;
}
// match?
if (@eregi($pat, $new_item)) {
$list[] = array($dir, $new_item);
}
// search sub-directories
if (get_is_dir($dir, $new_item) && $recur) {
find_item(get_rel_item($dir, $new_item), $pat, $list, $recur);
}
}
closedir($handle);
}
开发者ID:morovan,项目名称:granitpiestany.sk,代码行数:26,代码来源:fun_search.php
示例6: find_item
/**
* @version $Id: search.php 98 2008-02-11 17:56:04Z soeren $
* @package eXtplorer
* @copyright soeren 2007
* @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
* @author The The QuiX project (http://quixplorer.sourceforge.net)
*
* @license
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU General Public License Version 2 or later (the "GPL"), in
* which case the provisions of the GPL are applicable instead of
* those above. If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this file
* under either the MPL or the GPL."
*
* File-Search Functions
*/
function find_item($dir, $pat, &$list, $recur)
{
// find items
$homedir = realpath($GLOBALS['home_dir']);
$handle = @$GLOBALS['ext_File']->opendir(get_abs_dir($dir));
if ($handle === false && $dir == "") {
$handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
}
if ($handle === false) {
ext_Result::sendResult('search', false, $dir . ": " . $GLOBALS["error_msg"]["opendir"]);
}
while (($new_item = $GLOBALS['ext_File']->readdir($handle)) !== false) {
if (is_array($new_item)) {
$abs_new_item = $new_item;
} else {
$abs_new_item = get_abs_item($dir, $new_item);
}
if (!$GLOBALS['ext_File']->file_exists($abs_new_item)) {
continue;
}
if (!get_show_item($dir, $new_item)) {
continue;
}
// match?
if (@eregi($pat, $new_item)) {
$list[] = array($dir, $new_item);
}
// search sub-directories
if (get_is_dir($abs_new_item) && $recur) {
find_item(get_rel_item($dir, $new_item), $pat, $list, $recur);
}
}
$GLOBALS['ext_File']->closedir($handle);
}
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:65,代码来源:search.php
示例7: download_item
function download_item($dir, $item)
{
// download file
// Security Fix:
$item = basename($item);
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (!get_is_file($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
$abs_item = get_abs_item($dir, $item);
$browser = id_browser();
header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($abs_item));
if ($browser == 'IE') {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
}
@readfile($abs_item);
exit;
}
开发者ID:BackupTheBerlios,项目名称:redaxo-addons,代码行数:32,代码来源:fun_down.php
示例8: execAction
function execAction($dir)
{
// delete files/dirs
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('delete', false, $GLOBALS["error_msg"]["accessfunc"]);
}
// CSRF Security Check
if (!ext_checkToken($GLOBALS['__POST']["token"])) {
ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.');
}
$cnt = count($GLOBALS['__POST']["selitems"]);
$err = false;
// delete files & check for errors
for ($i = 0; $i < $cnt; ++$i) {
$items[$i] = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
if (ext_isFTPMode()) {
$abs = get_item_info($dir, $items[$i]);
} else {
$abs = get_abs_item($dir, $items[$i]);
}
if (!@$GLOBALS['ext_File']->file_exists($abs)) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $items[$i])) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
// Delete
if (ext_isFTPMode()) {
$abs = str_replace('\\', '/', get_abs_item($dir, $abs));
}
$ok = $GLOBALS['ext_File']->remove($abs);
if ($ok === false || PEAR::isError($ok)) {
$error[$i] = $GLOBALS["error_msg"]["delitem"];
if (PEAR::isError($ok)) {
$error[$i] .= ' [' . $ok->getMessage() . ']';
}
$err = true;
continue;
}
$error[$i] = NULL;
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; ++$i) {
if ($error[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $error[$i] . ".\n";
}
ext_Result::sendResult('delete', false, $err_msg);
}
ext_Result::sendResult('delete', true, $GLOBALS['messages']['success_delete_file']);
}
开发者ID:ejailesb,项目名称:repo_empr,代码行数:58,代码来源:delete.php
示例9: zip_items
function zip_items($dir, $name)
{
$items = qxpage_selected_items();
if (!preg_match("/\\.zip\$/", $name)) {
$name .= ".zip";
}
zip_selected_items(get_abs_item($dir, $name), $dir, $items);
header("Location: " . make_link("list", $dir, NULL));
}
开发者ID:gilshwartz,项目名称:quixplorer,代码行数:9,代码来源:fun_archive.php
示例10: del_items
function del_items($dir)
{
$mainframe =& JFactory::getApplication();
// delete files/dirs
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
$cnt = count($GLOBALS['__POST']["selitems"]);
$err = false;
// delete files & check for errors
for ($i = 0; $i < $cnt; ++$i) {
$items[$i] = stripslashes($GLOBALS['__POST']["selitems"][$i]);
if (nx_isFTPMode()) {
$abs = get_item_info($dir, $items[$i]);
} else {
$abs = get_abs_item($dir, $items[$i]);
}
if (!@$GLOBALS['nx_File']->file_exists($abs)) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $items[$i])) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
// Delete
if (nx_isFTPMode()) {
$abs = get_abs_item($dir, $abs);
}
$ok = $GLOBALS['nx_File']->remove($abs);
if ($ok === false || PEAR::isError($ok)) {
$error[$i] = $GLOBALS["error_msg"]["delitem"];
if (PEAR::isError($ok)) {
$error[$i] .= ' [' . $ok->getMessage() . ']';
}
$err = true;
continue;
}
$error[$i] = NULL;
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; ++$i) {
if ($error[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $error[$i] . "<br/>\n";
}
show_error($err_msg);
}
$mainframe->redirect(make_link("list", $dir, null), $GLOBALS['messages']['success_delete_file']);
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:55,代码来源:fun_del.php
示例11: download_item
function download_item($dir, $item, $unlink = false)
{
// download file
global $action, $mosConfig_cache_path;
// Security Fix:
$item = basename($item);
while (@ob_end_clean()) {
}
ob_start();
if (jx_isFTPMode()) {
$abs_item = $dir . '/' . $item;
} else {
$abs_item = get_abs_item($dir, $item);
if (!strstr($abs_item, realpath($GLOBALS['home_dir']))) {
$abs_item = realpath($GLOBALS['home_dir']) . $abs_item;
}
}
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (!$GLOBALS['jx_File']->file_exists($abs_item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
if (jx_isFTPMode()) {
$abs_item = jx_ftp_make_local_copy($abs_item);
$unlink = true;
}
$browser = id_browser();
header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize(realpath($abs_item)));
//header("Content-Encoding: none");
if ($browser == 'IE') {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
}
@set_time_limit(0);
@readFileChunked($abs_item);
if ($unlink == true) {
unlink($abs_item);
}
ob_end_flush();
jx_exit();
}
开发者ID:Caojunkai,项目名称:arcticfox,代码行数:53,代码来源:fun_down.php
示例12: _is_download_allowed
function _is_download_allowed($dir, $items)
{
foreach ($items as $file) {
if (!permissions_grant($dir, $file, "read")) {
return false;
}
if (!get_show_item($dir, $file)) {
return false;
}
if (!file_exists(get_abs_item($dir, $file))) {
return false;
}
}
return true;
}
开发者ID:gilshwartz,项目名称:quixplorer,代码行数:15,代码来源:fun_down.php
示例13: rename_item
function rename_item($dir, $item)
{
// rename directory or file
$mainframe =& JFactory::getApplication();
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$newitemname = $GLOBALS['__POST']["newitemname"];
$newitemname = trim(basename(stripslashes($newitemname)));
if ($newitemname == '') {
show_error($GLOBALS["error_msg"]["miscnoname"]);
}
if (!nx_isFTPMode()) {
$abs_old = get_abs_item($dir, $item);
$abs_new = get_abs_item($dir, $newitemname);
} else {
$abs_old = get_item_info($dir, $item);
$abs_new = get_item_info($dir, $newitemname);
}
if (@$GLOBALS['nx_File']->file_exists($abs_new)) {
show_error($newitemname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
$perms_old = $GLOBALS['nx_File']->fileperms($abs_old);
$ok = $GLOBALS['nx_File']->rename(get_abs_item($dir, $item), get_abs_item($dir, $newitemname));
if (nx_isFTPMode()) {
$abs_new = get_item_info($dir, $newitemname);
}
$GLOBALS['nx_File']->chmod($abs_new, $perms_old);
if ($ok === false || PEAR::isError($ok)) {
show_error('Could not rename ' . $item . ' to ' . $newitemname);
}
$msg = sprintf($GLOBALS['messages']['success_rename_file'], $item, $newitemname);
$mainframe->redirect(make_link("list", $dir, null), $msg);
}
show_header($GLOBALS['messages']['rename_file']);
// Form
echo '<br /><form method="post" action="';
echo make_link("rename", $dir, $item) . "\">\n";
echo "<input type=\"hidden\" name=\"confirm\" value=\"true\" />\n";
echo "<input type=\"hidden\" name=\"item\" value=\"" . stripslashes($GLOBALS['__GET']["item"]) . "\" />\n";
// Submit / Cancel
echo "<table>\n<tr><tr><td colspan=\"2\">\n";
echo "<label for=\"newitemname\">" . $GLOBALS["messages"]["newname"] . ":</label> <input name=\"newitemname\" id=\"newitemname\" type=\"text\" size=\"60\" value=\"" . stripslashes($_GET['item']) . "\" /><br /><br /><br /></td></tr>\n";
echo "<tr><tr><td>\n<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnchange"];
echo "\"></td>\n<td><input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
echo "\" onclick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\">\n</td></tr></form></table><br />\n";
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:48,代码来源:fun_rename.php
示例14: zip_items
function zip_items($dir, $name)
{
$cnt = count($GLOBALS['__POST']["selitems"]);
$abs_dir = get_abs_dir($dir);
$zipfile = new ZipFile();
for ($i = 0; $i < $cnt; ++$i) {
$selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
if (!$zipfile->add($abs_dir, $selitem)) {
show_error($selitem . ": Failed adding item.");
}
}
if (!$zipfile->save(get_abs_item($dir, $name))) {
show_error($name . ": Failed saving zipfile.");
}
header("Location: " . make_link("list", $dir, NULL));
}
开发者ID:Zhi2014,项目名称:cogs,代码行数:16,代码来源:fun_archive.php
示例15: download_item
function download_item($dir, $item)
{
// Security Fix:
$item = basename($item);
if (!permissions_grant($dir, $item, "read")) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (!get_is_file($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
$abs_item = get_abs_item($dir, $item);
_download($abs_item, $item);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:16,代码来源:down.php
示例16: find_item
/**
* @version $Id: search.php 201 2011-06-27 09:45:09Z soeren $
* @package eXtplorer
* @copyright soeren 2007-2013
* @author The eXtplorer project (http://extplorer.net)
* @author The The QuiX project (http://quixplorer.sourceforge.net)
*
* @license
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU General Public License Version 2 or later (the "GPL"), in
* which case the provisions of the GPL are applicable instead of
* those above. If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this file
* under either the MPL or the GPL."
*
* File-Search Functions
*/
function find_item($dir, $pat, &$list, $recur, $content)
{
// find items
$homedir = realpath($GLOBALS['home_dir']);
$opendir = $dir;
if (!is_dir($dir)) {
$opendir = get_abs_dir($dir);
}
$handle = @$GLOBALS['ext_File']->opendir($opendir);
if ($handle === false && $dir == "") {
$handle = @$GLOBALS['ext_File']->opendir($homedir . $GLOBALS['separator']);
}
if ($handle === false) {
ext_Result::sendResult('search', false, $opendir . ": " . $GLOBALS["error_msg"]["opendir"]);
}
while (($new_item = $GLOBALS['ext_File']->readdir($handle)) !== false) {
if (is_array($new_item)) {
$abs_new_item = $new_item;
} else {
$abs_new_item = get_abs_item($dir, $new_item);
}
//if(!$GLOBALS['ext_File']->file_exists($abs_new_item)) continue;
if (!get_show_item($dir, $new_item)) {
continue;
}
$isDir = get_is_dir($abs_new_item);
// match?
if (@preg_match('@' . $pat . '@is', $new_item) > 0) {
$list[] = array($dir, $new_item);
} else {
if (!$isDir) {
if ($content && $GLOBALS['ext_File']->filesize($abs_new_item) < 524288) {
$data = $GLOBALS['ext_File']->file_get_contents($abs_new_item);
//$data = fread($handle, 524288); // Only read first 512kb
if (preg_match('@' . $pat . '@is', $data) > 0) {
$list[] = array($dir, $new_item);
}
}
}
}
// search sub-directories
if ($isDir && $recur) {
find_item($abs_new_item, $pat, $list, $recur, $content);
}
}
$GLOBALS['ext_File']->closedir($handle);
}
开发者ID:eldersxavier,项目名称:online_editor_code,代码行数:78,代码来源:search.php
示例17: del_items
function del_items($dir)
{
// check if user is allowed to delete files
if (!permissions_grant($dir, NULL, "delete")) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
$cnt = count($GLOBALS['__POST']["selitems"]);
$err = false;
// delete files & check for errors
for ($i = 0; $i < $cnt; ++$i) {
$items[$i] = stripslashes($GLOBALS['__POST']["selitems"][$i]);
$abs = get_abs_item($dir, $items[$i]);
if (!@file_exists(get_abs_item($dir, $items[$i]))) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $items[$i])) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
// Delete
$ok = remove(get_abs_item($dir, $items[$i]));
if ($ok === false) {
$error[$i] = $GLOBALS["error_msg"]["delitem"];
$err = true;
continue;
}
$error[$i] = NULL;
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; ++$i) {
if ($error[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
}
show_error($err_msg);
}
miwoftp_redirect(make_link("list", $dir, NULL));
}
开发者ID:morovan,项目名称:granitpiestany.sk,代码行数:44,代码来源:fun_del.php
示例18: del_items
function del_items($dir)
{
// delete files/dirs
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
$cnt = count($GLOBALS['__POST']["selitems"]);
$err = false;
// delete files & check for errors
for ($i = 0; $i < $cnt; ++$i) {
$items[$i] = stripslashes($GLOBALS['__POST']["selitems"][$i]);
$abs = get_abs_item($dir, $items[$i]);
if (!@file_exists(get_abs_item($dir, $items[$i]))) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $items[$i])) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
// Delete
$ok = remove(get_abs_item($dir, $items[$i]));
if ($ok === false) {
$error[$i] = $GLOBALS["error_msg"]["delitem"];
$err = true;
continue;
}
$error[$i] = NULL;
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; ++$i) {
if ($error[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $error[$i] . "<BR>\n";
}
show_error($err_msg);
}
header("Location: " . make_link("list", $dir, NULL));
}
开发者ID:Zhi2014,项目名称:cogs,代码行数:44,代码来源:fun_del.php
示例19: download_item
function download_item($dir, $item)
{
// download file
// Security Fix:
$item = base_name($item);
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (!get_is_file($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
$abs_item = get_abs_item($dir, $item);
$browser = id_browser();
header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream'));
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . get_file_size($dir, $item));
header('Content-Description: File Download');
if ($browser == 'IE') {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Disposition: attachment; filename="' . $item . '"');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
}
//@readfile($abs_item);
flush();
$fp = popen("tail -c " . get_file_size($dir, $item) . " {$abs_item} 2>&1", "r");
while (!feof($fp)) {
// Send the current file part to the browser.
print fread($fp, 1024);
// Flush the content to the browser.
flush();
}
fclose($fp);
exit;
}
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:42,代码来源:fun_down.php
示例20: make_item
function make_item($dir)
{
// make new directory or file
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
$mkname = $GLOBALS['__POST']["mkname"];
$mktype = $GLOBALS['__POST']["mktype"];
$symlink_target = $GLOBALS['__POST']['symlink_target'];
$mkname = basename(stripslashes($mkname));
if ($mkname == "") {
show_error($GLOBALS["error_msg"]["miscnoname"]);
}
$new = get_abs_item($dir, $mkname);
if (@$GLOBALS['jx_File']->file_exists($new)) {
show_error($mkname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
if ($mktype == "dir") {
$ok = @$GLOBALS['jx_File']->mkdir($new, 0777);
$err = $GLOBALS["error_msg"]["createdir"];
} elseif ($mktype == 'file') {
$ok = @$GLOBALS['jx_File']->mkfile($new);
$err = $GLOBALS["error_msg"]["createfile"];
} elseif ($mktype == 'symlink') {
if (empty($symlink_target)) {
show_error('Please provide a valid <strong>target</strong> for the symbolic link.');
}
if (!file_exists($symlink_target) || !is_readable($symlink_target)) {
show_error('The file you wanted to make a symbolic link to does not exist or is not accessible by PHP.');
}
$ok = symlink($symlink_target, $new);
$err = 'The symbolic link could not be created.';
}
if ($ok === false || PEAR::isError($ok)) {
if (PEAR::isError($ok)) {
$err .= $ok->getMessage();
}
show_error($err);
}
header("Location: " . make_link("list", $dir, NULL));
}
开发者ID:Caojunkai,项目名称:arcticfox,代码行数:41,代码来源:fun_mkitem.php
注:本文中的get_abs_item函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论