• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ext_isFTPMode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ext_isFTPMode函数的典型用法代码示例。如果您正苦于以下问题:PHP ext_isFTPMode函数的具体用法?PHP ext_isFTPMode怎么用?PHP ext_isFTPMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ext_isFTPMode函数的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: show_about

/**
 * @version $Id: footer.php 107 2008-07-22 17:27:12Z 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."
 * 
 * Shows the About Box!
 */
function show_about()
{
    // footer for html-page
    echo "\n<div id=\"ext_footer\" style=\"text-align:center;\">\r\n\t<img src=\"" . _EXT_URL . "/images/MangosWeb_small.png\" align=\"middle\" alt=\"Mangosweb Enhanced Logo\" />\r\n\t<br />\r\n\t" . ext_Lang::msg('your_version') . ": <a href=\"" . $GLOBALS['ext_home'] . "\" target=\"_blank\">eXtplorer {$GLOBALS['ext_version']}</a>\r\n\t<br />\r\n (<a href=\"http://virtuemart.net/index2.php?option=com_versions&amp;catid=5&amp;myVersion=" . $GLOBALS['ext_version'] . "\" onclick=\"javascript:void window.open('http://virtuemart.net/index2.php?option=com_versions&catid=5&myVersion=" . $GLOBALS['ext_version'] . "', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=580,directories=no,location=no'); return false;\" title=\"" . $GLOBALS["messages"]["check_version"] . "\">" . $GLOBALS["messages"]["check_version"] . "</a>)\r\n\t\r\n\t";
    if (function_exists("disk_free_space")) {
        $size = disk_free_space($GLOBALS['home_dir'] . $GLOBALS['separator']);
        $free = parse_file_size($size);
    } elseif (function_exists("diskfreespace")) {
        $size = diskfreespace($GLOBALS['home_dir'] . $GLOBALS['separator']);
        $free = parse_file_size($size);
    } else {
        $free = "?";
    }
    echo '<br />' . $GLOBALS["messages"]["miscfree"] . ": " . $free . " \n";
    if (extension_loaded("posix")) {
        $owner_info = '<br /><br />' . ext_Lang::msg('current_user') . ' ';
        if (ext_isFTPMode()) {
            $my_user_info = posix_getpwnam($_SESSION['ftp_login']);
            $my_group_info = posix_getgrgid($my_user_info['gid']);
        } else {
            $my_user_info = posix_getpwuid(posix_geteuid());
            $my_group_info = posix_getgrgid(posix_getegid());
        }
        $owner_info .= $my_user_info['name'] . ' (' . $my_user_info['uid'] . '), ' . $my_group_info['name'] . ' (' . $my_group_info['gid'] . ')';
        echo $owner_info;
    }
    echo "\r\n\t</div>";
}
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:59,代码来源:footer.php


示例3: 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


示例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();
 }
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:52,代码来源:download.php


示例5: function

    		id: 'dirCtxMenu_remove',
    		icon: '<?php 
echo _EXT_URL;
?>
/images/_editdelete.png',
    		text: '<?php 
echo ext_Lang::msg('btnremove', true);
?>
',
    		handler: function() { dirCtxMenu.hide();var num = 1; Ext.Msg.confirm('Confirm', String.format("<?php 
echo $GLOBALS['error_msg']['miscdelitems'];
?>
", num ), function(btn) { deleteDir( btn, dirCtxMenu.node ) }); }
    	},'-',
    	<?php 
if (($GLOBALS["zip"] || $GLOBALS["tar"] || $GLOBALS["tgz"]) && !ext_isFTPMode()) {
    ?>
	    	{
    			id: 'dirCtxMenu_archive',
	    		icon: '<?php 
    echo _EXT_URL;
    ?>
/images/_archive.png',
	    		text: '<?php 
    echo ext_Lang::msg('comprlink', true);
    ?>
',
	    		handler: function() { openActionDialog(this, 'archive'); }
	    	},
    	<?php 
}
开发者ID:ejailesb,项目名称:repo_empr,代码行数:31,代码来源:application.js.php


示例6: execAction

    function execAction($dir, $item)
    {
        // rename directory or file
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["accessfunc"]);
        }
        if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
            $newitemname = $GLOBALS['__POST']["newitemname"];
            $newitemname = trim(basename(stripslashes($newitemname)));
            if ($newitemname == '') {
                ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["miscnoname"]);
            }
            if (!ext_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['ext_File']->file_exists($abs_new)) {
                ext_Result::sendResult('rename', false, $newitemname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
            }
            $perms_old = $GLOBALS['ext_File']->fileperms($abs_old);
            $ok = $GLOBALS['ext_File']->rename(get_abs_item($dir, $item), get_abs_item($dir, $newitemname));
            if (ext_isFTPMode()) {
                $abs_new = get_item_info($dir, $newitemname);
            }
            $GLOBALS['ext_File']->chmod($abs_new, $perms_old);
            if ($ok === false || PEAR::isError($ok)) {
                ext_Result::sendResult('rename', false, 'Could not rename ' . $dir . '/' . $item . ' to ' . $newitemname);
            }
            $msg = sprintf($GLOBALS['messages']['success_rename_file'], $item, $newitemname);
            ext_Result::sendResult('rename', true, $msg);
        }
        $is_dir = get_is_dir(ext_isFTPMode() ? get_item_info($dir, $item) : get_abs_item($dir, $item));
        ?>
	<div style="width:auto;">
	    <div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
	    <div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
	
	        <h3 style="margin-bottom:5px;"><?php 
        echo $GLOBALS['messages']['rename_file'];
        ?>
</h3>
	        <div id="adminForm">
	
	        </div>
	    </div></div></div>
	    <div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
	</div>
	<script type="text/javascript">
	var simple = new Ext.form.Form({
	    labelWidth: 75, // label settings here cascade unless overridden
	    url:'<?php 
        echo basename($GLOBALS['script_name']);
        ?>
'
	});
	simple.add(
	    new Ext.form.TextField({
	        fieldLabel: '<?php 
        echo ext_Lang::msg('newname', true);
        ?>
',
	        name: 'newitemname',
	        value: '<?php 
        echo str_replace("'", "\\'", stripslashes($item));
        ?>
',
	        width:175,
	        allowBlank:false
	    })
	    );
	
	simple.addButton('<?php 
        echo ext_Lang::msg('btnsave', true);
        ?>
', function() {
		statusBarMessage( 'Please wait...', true );
	    simple.submit({
	        //reset: true,
	        reset: false,
	        success: function(form, action) {
	        	<?php 
        if ($is_dir) {
            ?>
	        		parentDir = dirTree.getSelectionModel().getSelectedNode().parentNode;
	        		parentDir.reload();
	        		parentDir.select();
	    		<?php 
        } else {
            ?>
		    		datastore.reload();
		        	<?php 
        }
        ?>
	    		statusBarMessage( action.result.message, false, true );
	        	dialog.destroy();
	        },
	        failure: function(form, action) {	        	
//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:101,代码来源:rename.php


示例7: get_result_array

function get_result_array($list)
{
    // print table of found items
    if (!is_array($list)) {
        return;
    }
    $cnt = count($list);
    $array = array();
    for ($i = 0; $i < $cnt; ++$i) {
        $dir = $list[$i][0];
        $item = $list[$i][1];
        $s_dir = str_replace($GLOBALS['home_dir'], '', $dir);
        if (strlen($s_dir) > 65) {
            $s_dir = substr($s_dir, 0, 62) . "...";
        }
        $s_item = $item;
        if (strlen($s_item) > 45) {
            $s_item = substr($s_item, 0, 42) . "...";
        }
        $link = "";
        $target = "";
        if (get_is_dir($dir, $item)) {
            $img = "dir.png";
            $link = ext_make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            $img = get_mime_type($item, "img");
            //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) {
            $link = $GLOBALS["home_url"] . "/" . get_rel_item($dir, $item);
            $target = "_blank";
            //}
        }
        $array[$i]['last_mtime'] = ext_isFTPMode() ? $GLOBALS['ext_File']->filemtime($GLOBALS['home_dir'] . '/' . $dir . '/' . $item) : filemtime($dir . '/' . $item);
        $array[$i]['file_id'] = md5($s_dir . $s_item);
        $array[$i]['dir'] = str_replace($GLOBALS['home_dir'], '', $dir);
        $array[$i]['s_dir'] = empty($s_dir) ? '' : $s_dir;
        $array[$i]['file'] = $s_item;
        $array[$i]['link'] = $link;
        $array[$i]['icon'] = _EXT_URL . "/images/{$img}";
    }
    return $array;
}
开发者ID:ejailesb,项目名称:repo_empr,代码行数:41,代码来源:search.php


示例8: handleFTPLogin

    });
    
    layout.beginUpdate();
    layout.add('north', new Ext.ContentPanel('ext_header', {closable: false}));
    layout.add('west', new Ext.ContentPanel('dirtree', {title: '<?php 
echo ext_Lang::msg('directory_tree', true);
?>
 <img src="<?php 
echo _EXT_URL;
?>
/images/reload.png" hspace="20" style="cursor:pointer;" title="reload" onclick="dirTree.getRootNode().reload();" alt="Reload" align="middle" />', closable: false}));
    layout.add('center', new Ext.GridPanel(ext_itemgrid, {}));    
    
    layout.endUpdate();
	<?php 
if (!ext_isFTPMode() && empty($_SESSION['ftp_login'])) {
    ?>
		Ext.get('switch_file_mode').on('click', handleFTPLogin );
		function handleFTPLogin( e ) {
			e.preventDefault();
			openActionDialog( 'switch_file_mode', 'ftp_authentication' );
		}
		<?php 
}
?>
	/**
	* This function is for changing into a specified directory
	* It updates the tree, the grid and the ContentPanel title
	*/
    chDir = function( directory ) {
   
开发者ID:BACKUPLIB,项目名称:mwenhanced,代码行数:30,代码来源:application.js.php


示例9: execAction

    function execAction($dir, $item)
    {
        // show file contents
        global $action;
        if (@eregi($GLOBALS["images_ext"], $item)) {
            $html = '<img src="' . make_link('get_image', $dir, rawurlencode($item)) . '" alt="' . $GLOBALS["messages"]["actview"] . ": " . $item . '" /><br /><br />';
        } elseif (@eregi($GLOBALS["editable_ext"], $item)) {
            $geshiFile = _EXT_PATH . '/libraries/geshi/geshi.php';
            ext_RaiseMemoryLimit('32M');
            // GeSHi 1.0.7 is very memory-intensive
            include_once $geshiFile;
            // Create the GeSHi object that renders our source beautiful
            $geshi = new GeSHi('', '', dirname($geshiFile) . '/geshi');
            $file = get_abs_item($dir, $item);
            $pathinfo = pathinfo($file);
            if (ext_isFTPMode()) {
                $file = ext_ftp_make_local_copy($file);
            }
            if (is_callable(array($geshi, 'load_from_file'))) {
                $geshi->load_from_file($file);
            } else {
                $geshi->set_source(file_get_contents($file));
            }
            if (is_callable(array($geshi, 'get_language_name_from_extension'))) {
                $lang = $geshi->get_language_name_from_extension($pathinfo['extension']);
            } else {
                $pathinfo = pathinfo($item);
                $lang = $pathinfo['extension'];
            }
            $geshi->set_language($lang);
            $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
            $langs = $GLOBALS["language"];
            if ($langs == "japanese") {
                $enc_list = array("ASCII", "ISO-2022-JP", "UTF-8", "EUCJP-WIN", "SJIS-WIN");
                $_e0 = strtoupper(mb_detect_encoding($geshi->source, $enc_list, true));
                if ($_e0 == "SJIS-WIN") {
                    $_encoding = "Shift_JIS";
                } elseif ($_e0 == "EUCJP-WIN") {
                    $_e0 = "EUC-JP";
                } elseif ($_e0 == "ASCII") {
                    $_e0 = "UTF-8";
                } else {
                    $_encoding = $_e0;
                }
                $geshi->set_encoding($_encoding);
            }
            $html = $geshi->parse_code();
            if ($langs == "japanese") {
                if (empty($lang) || strtoupper(mb_detect_encoding($html, $enc_list)) != "UTF-8") {
                    $html = mb_convert_encoding($html, "UTF-8", $_e0);
                }
            }
            if (ext_isFTPMode()) {
                unlink($file);
            }
            $html .= '<hr /><div style="line-height:25px;vertical-align:middle;text-align:center;" class="small">Rendering Time: <strong>' . $geshi->get_time() . ' Sec.</strong></div>';
        } else {
            $html = '
			<iframe src="' . make_link('download', $dir, $item, null, null, null, '&action2=view') . '" id="iframe1" width="100%" height="100%" frameborder="0"></iframe>';
        }
        $html = str_replace(array("\r", "\n"), array('\\r', '\\n'), addslashes($html));
        ?>
		{

	"dialogtitle": "<?php 
        echo $GLOBALS['messages']['actview'] . ": " . $item;
        ?>
",
	"height": 500,
	"autoScroll": true,
	"html": "<?php 
        echo $html;
        ?>
"

}
		<?php 
    }
开发者ID:elevenfox,项目名称:VTree,代码行数:78,代码来源:view.php


示例10: copy_move_items

/**
 * File/Directory Copy & Move Functions
 */
function copy_move_items($dir)
{
    // copy/move file/dir
    $action = extGetParam($_REQUEST, 'action');
    if (($GLOBALS["permissions"] & 01) != 01) {
        ext_Result::sendResult($action, false, $GLOBALS["error_msg"]["accessfunc"]);
    }
    // Vars
    $first = extGetParam($GLOBALS['__POST'], 'first');
    if ($first == "y") {
        $new_dir = $dir;
    } else {
        $new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
    }
    if ($new_dir == ".") {
        $new_dir = "";
    }
    $cnt = count($GLOBALS['__POST']["selitems"]);
    // DO COPY/MOVE
    // ALL OK?
    if (!@$GLOBALS['ext_File']->file_exists(get_abs_dir($new_dir))) {
        ext_Result::sendResult($action, false, get_abs_dir($new_dir) . ": " . $GLOBALS["error_msg"]["targetexist"]);
    }
    if (!get_show_item($new_dir, "")) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
    }
    if (!down_home(get_abs_dir($new_dir))) {
        ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
    }
    // copy / move files
    $err = false;
    for ($i = 0; $i < $cnt; ++$i) {
        $tmp = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        $new = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
        if (ext_isFTPMode()) {
            $abs_item = get_item_info($dir, $tmp);
            $abs_new_item = get_item_info('/' . $new_dir, $new);
        } else {
            $abs_item = get_abs_item($dir, $tmp);
            $abs_new_item = get_abs_item($new_dir, $new);
        }
        $items[$i] = $tmp;
        // Check
        if ($new == "") {
            $error[$i] = $GLOBALS["error_msg"]["miscnoname"];
            $err = true;
            continue;
        }
        if (!@$GLOBALS['ext_File']->file_exists($abs_item)) {
            $error[$i] = $GLOBALS["error_msg"]["itemexist"];
            $err = true;
            continue;
        }
        if (!get_show_item($dir, $tmp)) {
            $error[$i] = $GLOBALS["error_msg"]["accessitem"];
            $err = true;
            continue;
        }
        if (@$GLOBALS['ext_File']->file_exists($abs_new_item)) {
            $error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
            $err = true;
            continue;
        }
        // Copy / Move
        if ($action == "copy") {
            if (@is_link($abs_item) || get_is_file($abs_item)) {
                // check file-exists to avoid error with 0-size files (PHP 4.3.0)
                if (ext_isFTPMode()) {
                    $abs_item = '/' . $dir . '/' . $abs_item['name'];
                }
                $ok = @$GLOBALS['ext_File']->copy($abs_item, $abs_new_item);
                //||@file_exists($abs_new_item);
            } elseif (@get_is_dir($abs_item)) {
                $copy_dir = ext_isFTPMode() ? '/' . $dir . '/' . $abs_item['name'] . '/' : $abs_item;
                if (ext_isFTPMode()) {
                    $abs_new_item .= '/';
                }
                $ok = $GLOBALS['ext_File']->copy_dir($copy_dir, $abs_new_item);
            }
        } else {
            $ok = $GLOBALS['ext_File']->rename($abs_item, $abs_new_item);
        }
        if ($ok === false || PEAR::isError($ok)) {
            $error[$i] = $action == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
            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) {
//.........这里部分代码省略.........
开发者ID:shamblett,项目名称:janitor,代码行数:101,代码来源:copy_move.php


示例11: 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
//.........这里部分代码省略.........
开发者ID:naka211,项目名称:myloyal,代码行数:101,代码来源:mkitem.php


示例12: send_dircontents

/**
 * This function assembles an array (list) of files or directories in the directory specified by $dir
 * The result array is send using JSON
 *
 * @param string $dir
 * @param string $sendWhat Can be "files" or "dirs"
 */
function send_dircontents($dir, $sendWhat = 'files')
{
    // print table of files
    global $dir_up, $mainframe;
    // make file & dir tables, & get total filesize & number of items
    get_dircontents($dir, $dir_list, $file_list, $tot_file_size, $num_items);
    if ($sendWhat == 'files') {
        $list = $file_list;
    } elseif ($sendWhat == 'dirs') {
        $list = $dir_list;
    } else {
        $list = make_list($dir_list, $file_list);
    }
    $i = 0;
    $items['totalCount'] = count($list);
    $items['items'] = array();
    $dirlist = array();
    if ($sendWhat != 'dirs') {
        // Replaced array_splice, because it resets numeric indexes (like files or dirs with a numeric name)
        // Here we reduce the list to the range of $limit beginning at $start
        $a = 0;
        $output_array = array();
        foreach ($list as $key => $value) {
            if ($a >= $GLOBALS['start'] && $a - $GLOBALS['start'] < $GLOBALS['limit']) {
                $output_array[$key] = $value;
            }
            $a++;
        }
        $list = $output_array;
    }
    while (list($item, $info) = each($list)) {
        // link to dir / file
        if (is_array($info)) {
            $abs_item = $info;
            if (extension_loaded('posix')) {
                $user_info = posix_getpwnam($info['user']);
                $file_info['uid'] = $user_info['uid'];
                $file_info['gid'] = $user_info['gid'];
            }
        } else {
            $abs_item = get_abs_item(ext_TextEncoding::fromUTF8($dir), $item);
            $file_info = @stat($abs_item);
        }
        $is_dir = get_is_dir($abs_item);
        if ($GLOBALS['use_mb']) {
            if (ext_isFTPMode()) {
                $items['items'][$i]['name'] = $item;
            } else {
                if (mb_detect_encoding($item) == 'ASCII') {
                    $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item);
                } else {
                    $items['items'][$i]['name'] = ext_TextEncoding::toUTF8($item);
                }
            }
        } else {
            $items['items'][$i]['name'] = ext_isFTPMode() ? $item : ext_TextEncoding::toUTF8($item);
        }
        $items['items'][$i]['is_file'] = get_is_file($abs_item);
        $items['items'][$i]['is_archive'] = ext_isArchive($item) && !ext_isFTPMode();
        $items['items'][$i]['is_writable'] = $is_writable = @$GLOBALS['ext_File']->is_writable($abs_item);
        $items['items'][$i]['is_chmodable'] = $is_chmodable = @$GLOBALS['ext_File']->is_chmodable($abs_item);
        $items['items'][$i]['is_readable'] = $is_readable = @$GLOBALS['ext_File']->is_readable($abs_item);
        $items['items'][$i]['is_deletable'] = $is_deletable = @$GLOBALS['ext_File']->is_deletable($abs_item);
        $items['items'][$i]['is_editable'] = get_is_editable($abs_item);
        $items['items'][$i]['icon'] = _EXT_URL . "/images/" . get_mime_type($abs_item, "img");
        $items['items'][$i]['size'] = parse_file_size(get_file_size($abs_item));
        // type
        $items['items'][$i]['type'] = get_mime_type($abs_item, "type");
        // modified
        $items['items'][$i]['modified'] = parse_file_date(get_file_date($abs_item));
        // permissions
        $perms = get_file_perms($abs_item);
        if ($perms) {
            if (strlen($perms) > 3) {
                $perms = substr($perms, 2);
            }
            $items['items'][$i]['perms'] = $perms . ' (' . parse_file_perms($perms) . ')';
        } else {
            $items['items'][$i]['perms'] = ' (unknown) ';
        }
        $items['items'][$i]['perms'] = $perms . ' (' . parse_file_perms($perms) . ')';
        if (extension_loaded("posix")) {
            if ($file_info["uid"]) {
                $user_info = posix_getpwuid($file_info["uid"]);
                //$group_info = posix_getgrgid($file_info["gid"]);
                $items['items'][$i]['owner'] = $user_info["name"] . " (" . $file_info["uid"] . ")";
            } else {
                $items['items'][$i]['owner'] = " (unknown) ";
            }
        } else {
            $items['items'][$i]['owner'] = 'n/a';
        }
        if ($is_dir && $sendWhat != 'files') {
//.........这里部分代码省略.........
开发者ID:kostya1017,项目名称:our,代码行数:101,代码来源:list.php


示例13: down_home

function down_home($abs_dir)
{
    // dir deeper than home?
    if (ext_isFTPMode()) {
        return true;
    }
    $real_home = @realpath($GLOBALS["home_dir"]);
    $real_dir = @realpath($abs_dir);
    if ($real_home === false || $real_dir === false) {
        if (@eregi("\\.\\.", $abs_dir)) {
            return false;
        }
    } else {
        if (strcmp($real_home, @substr($real_dir, 0, strlen($real_home)))) {
            return false;
        }
    }
    return true;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:19,代码来源:functions.php


示例14: execAction

    function execAction($dir, $item)
    {
        // show file contents
        echo '<div>
    <div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
    <div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
	<h3 style="margin-bottom:5px;">' . $GLOBALS["messages"]["actview"] . ": " . $item . '</h3>';
        echo '</div></div></div>
	    <div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
	</div><hr />';
        /*$index2_edit_link = str_replace('/index3.php', '/index2.php', make_link('edit', $dir, $item ));
        		echo '<a name="top" class="componentheading" href="javascript:window.close();">[ '._PROMPT_CLOSE.' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        		$abs_item = get_abs_item($dir, $item);
        		if( get_is_editable( $abs_item) && $GLOBALS['ext_File']->is_writable( $abs_item )) {
        			// Edit the file in the PopUp
        			echo '<a class="componentheading" href="'.make_link('edit', $dir, $item ).'&amp;return_to='.urlencode($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] ).'">[ '.$GLOBALS["messages"]["editlink"].' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        			// Edit the file in the parent window
        			//echo '<a class="componentheading" href="javascript:opener.location=\''.$index2_edit_link.'\'; window.close();">[ '.$GLOBALS["messages"]["editlink"].' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        		}
        		echo '<a class="componentheading" href="#bottom">[ '._CMN_BOTTOM.' ]</a>';
        		
        		echo '<br /><br />';
        		*/
        if (@eregi($GLOBALS["images_ext"], $item)) {
            echo '<img src="' . make_link('get_image', $dir, rawurlencode($item)) . '" alt="' . $GLOBALS["messages"]["actview"] . ": " . $item . '" /><br /><br />';
        } else {
            $geshiFile = _EXT_PATH . '/libraries/geshi/geshi.php';
            if (file_exists($geshiFile)) {
                ext_RaiseMemoryLimit('32M');
                // GeSHi 1.0.7 is very memory-intensive
                include_once $geshiFile;
                // Create the GeSHi object that renders our source beautiful
                $geshi = new GeSHi('', '', dirname($geshiFile) . '/geshi');
                $file = get_abs_item($dir, $item);
                $pathinfo = pathinfo($file);
                if (ext_isFTPMode()) {
                    $file = ext_ftp_make_local_copy($file);
                }
                if (is_callable(array($geshi, 'load_from_file'))) {
                    $geshi->load_from_file($file);
                } else {
                    $geshi->set_source(file_get_contents($file));
                }
                if (is_callable(array($geshi, 'getlanguagesuage_name_from_extension'))) {
                    $lang = $geshi->getlanguagesuage_name_from_extension($pathinfo['extension']);
                } else {
                    $pathinfo = pathinfo($item);
                    $lang = $pathinfo['extension'];
                }
                $geshi->set_language($lang);
                $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
                $text = $geshi->parse_code();
                if (ext_isFTPMode()) {
                    unlink($file);
                }
                echo $text;
                echo '<hr /><div style="line-height:25px;vertical-align:middle;text-align:center;" class="small">Rendering Time: <strong>' . $geshi->get_time() . ' Sec.</strong></div>';
            } else {
                // When GeSHi is not available, just display the plain file contents
                echo '<div class="quote" style="text-align:left;">' . nl2br(htmlentities($GLOBALS['ext_File']->file_get_contents(get_abs_item($dir, $item)))) . '</div>';
            }
        }
        //echo '<a href="#top" name="bottom" class="componentheading">[ '._CMN_TOP.' ]</a><br /><br />';
    }
开发者ID:shamblett,项目名称:janitor,代码行数:64,代码来源:view.php


示例15: execAction

    function execAction($dir, $item)
    {
        // rename directory or file
        if (($GLOBALS["permissions"] & 01) != 01) {
            ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["accessfunc"]);
        }
        if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
            $newitemname = $GLOBALS['__POST']["newitemname"];
            $newitemname = trim(basename(stripslashes($newitemname)));
            if ($newitemname == '') {
                ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["miscnoname"]);
            }
            if (!ext_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['ext_File']->file_exists($abs_new)) {
                ext_Result::sendResult('rename', false, ext_TextEncoding::toUTF8($newitemname) . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
            }
            $perms_old = $GLOBALS['ext_File']->fileperms($abs_old);
            $ok = $GLOBALS['ext_File']->rename(get_abs_item($dir, $item), get_abs_item($dir, $newitemname));
            if (ext_isFTPMode()) {
                $abs_new = get_item_info($dir, $newitemname);
            }
            $GLOBALS['ext_File']->chmod($abs_new, $perms_old);
            if ($ok === false || PEAR::isError($ok)) {
                ext_Result::sendResult('rename', false, 'Could not rename ' . $dir . '/' . $item . ' to ' . $newitemname);
            }
            $msg = sprintf($GLOBALS['messages']['success_rename_file'], $item, $newitemname);
            ext_Result::sendResult('rename', true, $msg);
        }
        $is_dir = get_is_dir(ext_isFTPMode() ? get_item_info($dir, $item) : get_abs_item($dir, $item));
        ?>
{
	"xtype": "form",
	"width": "350",
	"height": "150",
	"id": "simpleform",
	"labelWidth": 125,
	"url":"<?php 
        echo basename($GLOBALS['script_name']);
        ?>
",
	"dialogtitle": "<?php 
        echo $GLOBALS['messages']['rename_file'];
        ?>
",
	"frame": true,
	"items": [{
	
		"xtype": "textfield",
		"fieldLabel": "<?php 
        echo ext_Lang::msg('newname', true);
        ?>
&quo 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ext_isXHR函数代码示例发布时间:2022-05-15
下一篇:
PHP ext_exit函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap