本文整理汇总了PHP中ext_Result类的典型用法代码示例。如果您正苦于以下问题:PHP ext_Result类的具体用法?PHP ext_Result怎么用?PHP ext_Result使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ext_Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAuthenticate
function onAuthenticate($credentials, $options = null)
{
$ftp_login = $credentials['username'];
$ftp_pass = $credentials['password'];
if ($ftp_login != '' || $ftp_pass != '') {
$ftp_host = empty($_SESSION['ftp_host']) ? extGetParam($_POST, 'ftp_host', 'localhost:21') : $_SESSION['ftp_host'];
$url = @parse_url('ftp://' . $ftp_host);
if (empty($url)) {
ext_Result::sendResult('ftp_authentication', false, 'Unable to parse the specified Host Name. Please use a hostname in this format: hostname:21');
}
$port = empty($url['port']) ? 21 : $url['port'];
$GLOBALS['FTPCONNECTION'] = new Net_FTP($url['host'], $port, 20);
$res = $GLOBALS['FTPCONNECTION']->connect();
if (PEAR::isError($res)) {
ext_Result::sendResult('ftp_authentication', false, ext_Lang::msg('ftp_connection_failed') . ' (' . $url['host'] . ')');
} else {
$res = $GLOBALS['FTPCONNECTION']->login($ftp_login, $ftp_pass);
if (PEAR::isError($res)) {
ext_Result::sendResult('ftp_authentication', false, ext_Lang::msg('ftp_login_failed'));
}
$_SESSION['credentials_ftp']['username'] = $ftp_login;
$_SESSION['credentials_ftp']['password'] = $ftp_pass;
$_SESSION['ftp_host'] = $ftp_host;
$_SESSION['file_mode'] = 'ftp';
$_SESSION['ftp_login'] = $ftp_login;
return true;
}
}
return false;
}
示例2: onAuthenticate
function onAuthenticate($credentials, $options = null)
{
$ssh2_user = $credentials['username'];
$ssh2_pass = $credentials['password'];
if ($ssh2_user != '' || $ssh2_pass != '') {
$ssh2_host = empty($_SESSION['ssh2_host']) ? extGetParam($_POST, 'ssh2_host', 'localhost:22') : $_SESSION['ssh2_host'];
$url = @parse_url('ssh2.sftp://' . $ssh2_host);
if (empty($url)) {
ext_Result::sendResult('ssh2_authentication', false, 'Unable to parse the specified Host Name. Please use a hostname in this format: hostname:22');
}
$port = empty($url['port']) ? 22 : $url['port'];
$GLOBALS['FTPCONNECTION'] = new SFTPConnection();
$res = $GLOBALS['FTPCONNECTION']->connect($url['host'], $port);
if (PEAR::isError($res)) {
return $res;
}
$res = $GLOBALS['FTPCONNECTION']->login($ssh2_user, $ssh2_pass);
if (PEAR::isError($res)) {
return $res;
}
$_SESSION['credentials_ssh2']['username'] = $ssh2_user;
$_SESSION['credentials_ssh2']['password'] = $ssh2_pass;
$_SESSION['ssh2_host'] = $ssh2_host;
$_SESSION['file_mode'] = 'ssh2';
return true;
}
return false;
}
示例3: 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'));
}
}
示例4: execAction
function execAction($dir, $item, $unlink = false)
{
// download file
global $action, $mosConfig_cache_path;
// Security Fix:
$item = basename($item);
while (@ob_end_clean()) {
}
ob_start();
if (ext_isFTPMode()) {
$abs_item = $dir . '/' . $item;
} else {
$abs_item = get_abs_item($dir, $item);
//if( !strstr( $abs_item, $GLOBALS['home_dir']) )
// $abs_item = realpath($GLOBALS['home_dir']).$abs_item;
}
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('download', false, $GLOBALS["error_msg"]["accessfunc"]);
}
if (!$GLOBALS['ext_File']->file_exists($abs_item)) {
ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
if (ext_isFTPMode()) {
$abs_item = ext_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(utf8_decode($abs_item));
if ($unlink == true) {
unlink(utf8_decode($abs_item));
}
ob_end_flush();
ext_exit();
}
示例5: 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);
}
示例6: array
function &getAdapter($type)
{
static $adapters;
if (!isset($adapters)) {
$adapters = array();
}
if (!isset($adapters[$type])) {
// Try to load the adapter object
$class = 'xfileArchive' . ucfirst($type);
if (!class_exists($class)) {
$path = dirname(__FILE__) . '/adapter/' . strtolower($type) . '.php';
if (file_exists($path)) {
require_once $path;
} else {
echo 'Unknown Archive Type: ' . $class;
ext_Result::sendResult('archive', false, 'Unable to load archive');
}
}
$adapters[$type] = new $class();
}
return $adapters[$type];
}
示例7: execAction
function execAction($dir, $item)
{
if (!ext_isArchive($item)) {
ext_Result::sendResult('archive', false, $item . ': ' . ext_Lang::err('extract_noarchive'));
} else {
$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'));
}
}
示例8: execAction
function execAction($dir, $item, $unlink = false)
{
// Security Fix:
$item = basename($item);
while (@ob_end_clean()) {
}
ob_start();
if (ext_isFTPMode()) {
$abs_item = $dir . '/' . $item;
} else {
$abs_item = get_abs_item($dir, $item);
//if( !strstr( $abs_item, $GLOBALS['home_dir']) )
// $abs_item = realpath($GLOBALS['home_dir']).$abs_item;
}
if (!$GLOBALS['ext_File']->file_exists($abs_item)) {
ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]);
return false;
}
if (!get_show_item($dir, $item)) {
ext_Result::sendResult('download', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]);
return false;
}
@set_time_limit(0);
if (ext_isFTPMode()) {
$abs_item = ext_ftp_make_local_copy($abs_item);
$unlink = true;
}
$browser = id_browser();
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 (isset($_GET['action2']) && $_GET['action2'] == 'view') {
$content_disposition = 'inline';
include_once _EXT_PATH . '/libraries/Archive/file.php';
$extension = extFile::getExt($item);
switch (strtolower($extension)) {
case 'doc':
case 'dot':
$extension = 'msword';
break;
case 'docx':
case 'dotx':
$extension = 'vnd.openxmlformats-officedocument.wordprocessingml.template';
break;
case 'docm':
$extension = 'vnd.ms-word.document.macroEnabled.12';
break;
case 'docm':
$extension = 'vnd.ms-word.template.macroEnabled.12';
break;
case 'xls':
case 'xlt':
case 'xla':
$extension = 'vnd.ms-excel';
break;
case 'xlsx':
$extension = 'vnd.openxmlformats-officedocument.spreadsheetml.sheet';
break;
case 'xltx':
$extension = 'vnd.openxmlformats-officedocument.spreadsheetml.template';
break;
case 'xlsm':
$extension = 'vnd.ms-excel.sheet.macroEnabled.12';
break;
case 'xltm':
$extension = 'vnd.ms-excel.template.macroEnabled.12';
break;
case 'xlam':
$extension = 'vnd.ms-excel.addin.macroEnabled.12';
break;
case 'xlsb':
$extension = 'vnd.ms-excel.sheet.binary.macroEnabled.12';
break;
case 'ppt':
case 'pot':
case 'pps':
case 'ppa':
$extension = 'vnd.ms-powerpoint';
break;
case 'pptx':
$extension = 'vnd.openxmlformats-officedocument.presentationml.presentation';
break;
case 'potx':
$extension = 'vnd.openxmlformats-officedocument.presentationml.template';
break;
case 'ppsx':
$extension = 'vnd.openxmlformats-officedocument.presentationml.slideshow';
break;
case 'ppam':
$extension = 'vnd.ms-powerpoint.addin.macroEnabled.12';
break;
case 'pptm':
$extension = 'vnd.ms-powerpoint.presentation.macroEnabled.12';
break;
case 'potm':
$extension = 'vnd.ms-powerpoint.template.macroEnabled.12';
break;
case 'ppsm':
$extension = 'vnd.ms-powerpoint.slideshow.macroEnabled.12';
//.........这里部分代码省略.........
示例9: savefile
function savefile($file_name)
{
// save edited file
if (get_magic_quotes_gpc()) {
$code = stripslashes($GLOBALS['__POST']["code"]);
} else {
$code = $GLOBALS['__POST']["code"];
}
$langs = $GLOBALS["language"];
if ($langs == "japanese") {
$_encoding = $GLOBALS['__POST']["file_encoding"];
if ($_encoding != "UTF-8") {
$code = mb_convert_encoding($code, $_encoding, "UTF-8");
}
}
$res = $GLOBALS['ext_File']->file_put_contents($file_name, $code);
if ($res == false || PEAR::isError($res)) {
$err = basename($file_name) . ": " . ext_Lang::err('savefile');
if (PEAR::isError($res)) {
$err .= $res->getMessage();
}
ext_Result::sendResult('edit', false, $err);
}
}
示例10: execAction
function execAction($dir)
{
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["accessfunc"]);
}
if (!$GLOBALS["zip"] && !$GLOBALS["tgz"]) {
ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnofunc"]);
}
$allowed_types = array('zip', 'tgz', 'tbz', 'tar');
// If we have something to archive, let's do it now
if (extGetParam($_POST, 'confirm') == 'true') {
$saveToDir = utf8_decode($GLOBALS['__POST']['saveToDir']);
if (!file_exists(get_abs_dir($saveToDir))) {
ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_notexists'));
}
if (!is_writable(get_abs_dir($saveToDir))) {
ext_Result::sendResult('archive', false, ext_Lang::err('archive_dir_unwritable'));
}
require_once _EXT_PATH . '/libraries/Archive/archive.php';
if (!in_array(strtolower($GLOBALS['__POST']["type"]), $allowed_types)) {
ext_Result::sendResult('archive', false, ext_Lang::err('extract_unknowntype') . ': ' . htmlspecialchars($GLOBALS['__POST']["type"]));
}
// This controls how many files are processed per Step (it's split up into steps to prevent time-outs)
$files_per_step = 2000;
$cnt = count($GLOBALS['__POST']["selitems"]);
$abs_dir = get_abs_dir($dir);
$name = basename(stripslashes($GLOBALS['__POST']["name"]));
if ($name == "") {
ext_Result::sendResult('archive', false, $GLOBALS["error_msg"]["miscnoname"]);
}
$startfrom = extGetParam($_REQUEST, 'startfrom', 0);
$dir_contents_cache_name = 'ext_' . md5(implode(null, $GLOBALS['__POST']["selitems"]));
$dir_contents_cache_file = _EXT_FTPTMP_PATH . '/' . $dir_contents_cache_name . '.txt';
$archive_name = get_abs_item($saveToDir, $name);
$fileinfo = pathinfo($archive_name);
if (empty($fileinfo['extension'])) {
$archive_name .= "." . $GLOBALS['__POST']["type"];
$fileinfo['extension'] = $GLOBALS['__POST']["type"];
foreach ($allowed_types as $ext) {
if ($GLOBALS['__POST']["type"] == $ext && @$fileinfo['extension'] != $ext) {
$archive_name .= "." . $ext;
}
}
}
if ($startfrom == 0) {
for ($i = 0; $i < $cnt; $i++) {
$selitem = stripslashes($GLOBALS['__POST']["selitems"][$i]);
if ($selitem == 'ext_root') {
$selitem = '';
}
if (is_dir(utf8_decode($abs_dir . "/" . $selitem))) {
$items = extReadDirectory(utf8_decode($abs_dir . "/" . $selitem), '.', true, true);
foreach ($items as $item) {
if (is_dir($item) || !is_readable($item) || $item == $archive_name) {
continue;
}
$v_list[] = str_replace('\\', '/', $item);
}
} else {
$v_list[] = utf8_decode(str_replace('\\', '/', $abs_dir . "/" . $selitem));
}
}
if (count($v_list) > $files_per_step) {
if (file_put_contents($dir_contents_cache_file, implode("\n", $v_list)) == false) {
ext_Result::sendResult('archive', false, 'Failed to create a temporary list of the directory contents');
}
}
} else {
$file_list_string = file_get_contents($dir_contents_cache_file);
if (empty($file_list_string)) {
ext_Result::sendResult('archive', false, 'Failed to retrieve the temporary list of the directory contents');
}
$v_list = explode("\n", $file_list_string);
}
$cnt_filelist = count($v_list);
// Now we go to the right range of files and "slice" the array
$v_list = array_slice($v_list, $startfrom, $files_per_step - 1);
$remove_path = $GLOBALS["home_dir"];
if ($dir) {
$remove_path .= $dir;
}
$remove_path = str_replace('\\', '/', realpath($remove_path)) . '/';
$debug = 'Starting from: ' . $startfrom . "\n";
$debug .= 'Files to process: ' . $cnt_filelist . "\n";
$debug .= implode("\n", $v_list);
//file_put_contents( 'log.txt', $debug, FILE_APPEND );
// Do some setup stuff
ini_set('memory_limit', '128M');
@set_time_limit(0);
//error_reporting( E_ERROR | E_PARSE );
$result = extArchive::create($archive_name, $v_list, $GLOBALS['__POST']["type"], '', $remove_path);
if (PEAR::isError($result)) {
ext_Result::sendResult('archive', false, $name . ': ' . ext_Lang::err('archive_creation_failed') . ' (' . $result->getMessage() . $archive_name . ')');
}
$classname = class_exists('ext_Json') ? 'ext_Json' : 'Services_JSON';
$json = new $classname();
if ($cnt_filelist > $startfrom + $files_per_step) {
$response = array('startfrom' => $startfrom + $files_per_step, 'totalitems' => $cnt_filelist, 'success' => true, 'action' => 'archive', 'message' => sprintf(ext_Lang::msg('processed_x_files'), $startfrom + $files_per_step, $cnt_filelist));
} else {
@unlink($dir_contents_cache_file);
//.........这里部分代码省略.........
示例11: urldecode
$GLOBALS["dir"] = $dir = urldecode(stripslashes(extGetParam($_REQUEST, "dir")));
}
if ($dir == 'ext_root') {
$GLOBALS["dir"] = $dir = '';
}
if (ext_isFTPMode() && $dir != '') {
$GLOBALS['FTPCONNECTION']->cd($dir);
}
$abs_dir = get_abs_dir($GLOBALS["dir"]);
if (!file_exists($GLOBALS["home_dir"])) {
if (!file_exists($GLOBALS["home_dir"] . $GLOBALS["separator"])) {
if ($GLOBALS["require_login"]) {
$extra = "<a href=\"" . make_link("logout", NULL, NULL) . "\">" . $GLOBALS["messages"]["btnlogout"] . "</a>";
} else {
$extra = NULL;
}
ext_Result::sendResult('', false, $GLOBALS["error_msg"]["home"] . " (" . $GLOBALS["home_dir"] . ")", $extra);
}
}
if (!$GLOBALS['ext_conf']['symlink_allow_abovehome']) {
if (!down_home($abs_dir)) {
ext_Result::sendResult('', false, $GLOBALS["dir"] . " : " . $GLOBALS["error_msg"]["abovehome"]);
$dir = '';
}
}
if (!get_is_dir(utf8_decode($abs_dir)) && !get_is_dir($abs_dir . $GLOBALS["separator"])) {
ext_Result::sendResult('', false, '"' . $abs_dir . '" - ' . $GLOBALS["error_msg"]["direxist"]);
$dir = '';
}
$_SESSION['ext_' . $GLOBALS['file_mode'] . 'dir'] = $dir;
//------------------------------------------------------------------------------
示例12: show_admin
require_once _EXT_PATH . "/include/admin.php";
show_admin($dir);
break;
//------------------------------------------------------------------------------
// BOOKMARKS
//------------------------------------------------------------------------------
// BOOKMARKS
case 'modify_bookmark':
$task = extGetParam($_REQUEST, 'task');
require_once _EXT_PATH . '/include/bookmarks.php';
modify_bookmark($task, $dir);
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case 'show_error':
ext_Result::sendResult('', false, '');
break;
case 'get_about':
require_once _EXT_PATH . "/include/system_info.php";
system_info();
break;
//------------------------------------------------------------------------------
// DEFAULT: LIST FILES & DIRS
//------------------------------------------------------------------------------
// DEFAULT: LIST FILES & DIRS
case "getdircontents":
require_once _EXT_PATH . "/include/list.php";
$requestedDir = stripslashes(str_replace('_RRR_', '/', extGetParam($_REQUEST, 'node')));
if (empty($requestedDir) || $requestedDir == 'ext_root') {
$requestedDir = $dir;
}
示例13: execAction
function execAction($dir)
{
// make new directory or file
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('mkitem', false, $GLOBALS["error_msg"]["accessfunc"]);
}
if (extGetParam($_POST, 'confirm') == 'true') {
// CSRF Security Check
if (!ext_checkToken($GLOBALS['__POST']["token"])) {
ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.');
}
$mkname = $GLOBALS['__POST']["mkname"];
$mktype = $GLOBALS['__POST']["mktype"];
$symlink_target = $GLOBALS['__POST']['symlink_target'];
$mkname = basename(stripslashes($mkname));
if ($mkname == "") {
ext_Result::sendResult('mkitem', false, $GLOBALS["error_msg"]["miscnoname"]);
}
$new = get_abs_item($dir, $mkname);
if (@$GLOBALS['ext_File']->file_exists($new)) {
ext_Result::sendResult('mkitem', false, $mkname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
$err = print_r($_POST, true);
if ($mktype == "dir") {
$ok = @$GLOBALS['ext_File']->mkdir($new, 0777);
$err = $GLOBALS["error_msg"]["createdir"];
} elseif ($mktype == 'file') {
$ok = @$GLOBALS['ext_File']->mkfile($new);
$err = $GLOBALS["error_msg"]["createfile"];
} elseif ($mktype == 'symlink') {
if (empty($symlink_target)) {
ext_Result::sendResult('mkitem', false, 'Please provide a valid <strong>target</strong> for the symbolic link.');
}
if (!file_exists($symlink_target) || !is_readable($symlink_target)) {
ext_Result::sendResult('mkitem', false, '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();
}
ext_Result::sendResult('mkitem', false, $err);
}
ext_Result::sendResult('mkitem', true, 'The item ' . $new . ' was created');
return;
}
?>
{
"xtype": "form",
"id": "simpleform",
"labelWidth": 125,
"url":"<?php
echo basename($GLOBALS['script_name']);
?>
",
"dialogtitle": "Create New File/Directory",
"frame": true,
"items": [{
"xtype": "textfield",
"fieldLabel": "<?php
echo ext_Lang::msg("nameheader", true);
?>
",
"name": "mkname",
"width":175,
"allowBlank":false
},{
"xtype": "combo",
"fieldLabel": "Type",
"store": [["file", "<?php
echo ext_Lang::mime('file', true);
?>
"],
["dir", "<?php
echo ext_Lang::mime('dir', true);
?>
"]
<?php
if (!ext_isFTPMode() && !$GLOBALS['isWindows']) {
?>
,["symlink", "<?php
echo ext_Lang::mime('symlink', true);
?>
"]
<?php
}
?>
],
displayField:"type",
valueField: "mktype",
value: "file",
hiddenName: "mktype",
disableKeyFilter: true,
editable: false,
triggerAction: "all",
mode: "local",
allowBlank: false,
selectOnFocus:true
//.........这里部分代码省略.........
示例14: list_dir
function list_dir($dir)
{
// list directory contents
global $dir_up, $mosConfig_live_site, $_VERSION;
$allow = ($GLOBALS["permissions"] & 01) == 01;
$admin = ($GLOBALS["permissions"] & 04) == 04 || ($GLOBALS["permissions"] & 02) == 02;
$dir_up = dirname($dir);
if ($dir_up == ".") {
$dir_up = "";
}
if (!get_show_item($dir_up, basename($dir))) {
ext_Result::sendResult('', false, $dir . " : " . $GLOBALS["error_msg"]["accessdir"]);
}
// make file & dir tables, & get total filesize & number of items
make_tables($dir, $dir_list, $file_list, $tot_file_size, $num_items);
$dirs = explode("/", $dir);
$implode = "";
$dir_links = "<a href=\"" . make_link("list", "", null) . "\">..</a> / ";
foreach ($dirs as $directory) {
if ($directory != "") {
$implode .= $directory . "/";
$dir_links .= "<a href=\"" . make_link("list", $implode, null) . "\">{$directory}</a> / ";
}
}
echo '<div class="componentheading">' . $GLOBALS["messages"]["actdir"] . ": " . $dir_links . '</div>';
// Sorting of items
$images = " <img width=\"10\" height=\"10\" border=\"0\" align=\"absmiddle\" src=\"" . _EXT_URL . "/images/";
if ($GLOBALS["direction"] == "ASC") {
$_srt = "DESC";
$images .= "_arrowup.gif\" alt=\"^\">";
} else {
$_srt = "ASC";
$images .= "_arrowdown.gif\" alt=\"v\">";
}
// Toolbar
/*echo "<br><table width=\"95%\"><tr><td><table><tr>\n";
// PARENT DIR
echo "<td>";
if( $dir != "" ) {
echo "<a href=\"".make_link("list",$dir_up,NULL)."\">";
echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/_up.png\" ";
echo "alt=\"".$GLOBALS["messages"]["uplink"]."\" title=\"".$GLOBALS["messages"]["uplink"]."\"></a>";
}
echo "</td>\n";
// HOME DIR
echo "<td><a href=\"".make_link("list",NULL,NULL)."\">";
echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/_home.gif\" ";
echo "alt=\"".$GLOBALS["messages"]["homelink"]."\" title=\"".$GLOBALS["messages"]["homelink"]."\"></a></td>\n";
// RELOAD
echo "<td><a href=\"javascript:location.reload();\"><img border=\"0\" width=\"22\" height=\"22\" ";
echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_refresh.gif\" alt=\"".$GLOBALS["messages"]["reloadlink"];
echo "\" title=\"".$GLOBALS["messages"]["reloadlink"]."\"></A></td>\n";
// SEARCH
echo "<td><a href=\"".make_link("search",$dir,NULL)."\">";
echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/_search.gif\" ";
echo "alt=\"".$GLOBALS["messages"]["searchlink"]."\" title=\"".$GLOBALS["messages"]["searchlink"];
echo "\"></a></td>\n";
echo "<td><img src=\"images/menu_divider.png\" height=\"22\" width=\"2\" border=\"0\" alt=\"|\" /></td>";
// Joomla Sysinfo
echo "<td><a href=\"".make_link("sysinfo",$dir,NULL)."\">";
echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\""._EXT_URL."/images/systeminfo.gif\" ";
echo "alt=\"" . $GLOBALS['messages']['mossysinfolink'] . "\" title=\"" .$GLOBALS['messages']['mossysinfolink'] . "\"></a></td>\n";
echo "<td><img src=\"images/menu_divider.png\" height=\"22\" width=\"2\" border=\"0\" alt=\"|\" /></td>";
if($allow) {
// COPY
echo "<td><a href=\"javascript:Copy();\"><img border=\"0\" width=\"22\" height=\"22\" ";
echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_copy.gif\" alt=\"".$GLOBALS["messages"]["copylink"];
echo "\" title=\"".$GLOBALS["messages"]["copylink"]."\"></a></td>\n";
// MOVE
echo "<td><a href=\"javascript:Move();\"><img border=\"0\" width=\"22\" height=\"22\" ";
echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_move.gif\" alt=\"".$GLOBALS["messages"]["movelink"];
echo "\" title=\"".$GLOBALS["messages"]["movelink"]."\"></A></td>\n";
// DELETE
echo "<td><a href=\"javascript:Delete();\"><img border=\"0\" width=\"22\" height=\"22\" ";
echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_delete.gif\" alt=\"".$GLOBALS["messages"]["dellink"];
echo "\" title=\"".$GLOBALS["messages"]["dellink"]."\"></A></td>\n";
// CHMOD
echo "<td><a href=\"javascript:Chmod();\"><img border=\"0\" width=\"22\" height=\"22\" ";
echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_chmod.gif\" alt=\"chmod\" title=\"" . $GLOBALS['messages']['chmodlink'] . "\"></a></td>\n";
// UPLOAD
if(ini_get("file_uploads")) {
echo "<td><a href=\"".make_link("upload",$dir,NULL)."\">";
echo "<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
echo "src=\""._EXT_URL."/images/_upload.gif\" alt=\"".$GLOBALS["messages"]["uploadlink"];
echo "\" title=\"".$GLOBALS["messages"]["uploadlink"]."\"></A></td>\n";
} else {
echo "<td><img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" ";
echo "src=\""._EXT_URL."/images/_upload_.gif\" alt=\"".$GLOBALS["messages"]["uploadlink"];
echo "\" title=\"".$GLOBALS["messages"]["uploadlink"]."\"></td>\n";
}
// ARCHIVE
if($GLOBALS["zip"] || $GLOBALS["tar"] || $GLOBALS["tgz"]) {
echo "<td><a href=\"javascript:Archive();\"><img border=\"0\" width=\"22\" height=\"22\" ";
echo "align=\"absmiddle\" src=\""._EXT_URL."/images/_archive.gif\" alt=\"".$GLOBALS["messages"]["comprlink"];
echo "\" title=\"".$GLOBALS["messages"]["comprlink"]."\"></A></td>\n";
//.........这里部分代码省略.........
示例15: find_item
function find_item($dir, $pat, &$files, $subdir, $content)
{
if (!is_dir($dir)) {
$dir = get_abs_dir($dir);
}
if (!$subdir) {
$files = glob($dir . '/' . $pat);
} else {
$files = glob_recursive($dir . '/' . $pat);
}
if ($files === false) {
ext_Result::sendResult('search', false, $dir . ": " . $GLOBALS["error_msg"]["opendir"]);
}
if ($content) {
$newList = array();
foreach ($files as $file) {
$contents = file_get_contents($file);
$pattern = preg_quote($content, '/');
// finalise the regular expression, matching the whole line
$pattern = "/^.*{$pattern}.*\$/m";
// search, and store all matching occurences in $matches
if (preg_match_all($pattern, $contents, $matches)) {
$newList[] = $file;
}
}
$files = $newList;
}
if (!empty($_POST['mdate_start'])) {
$mdate_start = strtotime($_POST['mdate_start']);
if (empty($_POST['mdate_end'])) {
$mdate_end = time();
} else {
$mdate_end = strtotime($_POST['mdate_end']);
}
if ($mdate_start && $mdate_end) {
$newList = array();
foreach ($files as $file) {
$filemtime = filemtime($file);
if ($filemtime > $mdate_start && $filemtime < $mdate_end) {
$newList[] = $file;
}
}
$files = $newList;
}
}
if (!empty($_POST['age_value'])) {
$age_value = (int) $_POST['age_value'];
$age_units = array("minutes", "hours", "days", "weeks", "months", "years");
if (in_array($_POST['age_unit'], $age_units)) {
$age_unit = $_POST['age_unit'];
} else {
$age_unit = "days";
}
$age_time = strtotime("-" . $age_value . " " . $age_unit);
if ($age_time) {
$newList = array();
foreach ($files as $file) {
$filemtime = filemtime($file);
if ($filemtime > $age_time) {
$newList[] = $file;
}
}
$files = $newList;
}
}
$newList = array();
foreach ($files as $file) {
$newList[] = array(dirname($file), basename($file));
}
$files = $newList;
}