Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
filetypes
:
get.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /*************************************************************** * Copyright notice * * (c) 2003-2004 Tobias Bender (tobias@phpXplorer.org) * All rights reserved * * This script is part of the phpXplorer project. The phpXplorer project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * A copy is found in the textfile GPL.txt distributed with these scripts. * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ require(dirname(__FILE__) . "/defaultActionHead.php"); $submitAction = getRequestVar("submitAction"); $submitOverwrite = getRequestVar("submitOverwrite"); $sourceURL = getRequestVar("sourceURL"); $fileName = basename($sourceURL); # check for url manipulation if(!(strpos($fileName, "..") === FALSE)) die($PXP_languages[$PXP_language]['accessDenied'] . " (804)"); $pInfo = checkFilePermissions($fileName); if(!$pInfo["allowOpen"] or !$pInfo["allowEdit"]) die($PXP_languages[$PXP_language]["accessDenied"] . " (809)"); if($submitAction != ""){ $bCreateFile = false; if($handleInput = @fopen($sourceURL, "rb")){ if(file_exists($currentDir . "/" . $fileName)){ if($submitOverwrite == ""){ $submitOverwrite = "overwrite"; }else{ if($submitOverwrite == "overwriteConfirm") $bCreateFile = true; } }else{ $bCreateFile = true; } if($bCreateFile){ $handleOutput = fopen($currentDir . "/" . $fileName, "wb"); while(!feof($handleInput)) fwrite($handleOutput, fgets($handleInput, 4096)); fclose($handleOutput); } fclose($handleInput); }else{ $error = $PXP_languages[$PXP_language]["canNotOpenFile"] . "!"; } } ?> <html> <head> <title><?php echo $PXP_languages[$PXP_language]['getFile'] ?></title> <style type="text/css"> <!-- --> </style> <link rel="stylesheet" type="text/css" href="<?php echo $PXP_url ?>/styles/<?php echo $PXP_style ?>/main.css"/> <script language="JavaScript" type="text/javascript"> <!-- function validate(){ var f = document.frm1 if(f.sourceURL.value == "" || f.sourceURL.value == "http://"){ alert("<?php echo $PXP_languages[$PXP_language]['pleaseInsertValue'] ?>") f.sourceURL.focus() return false } return true } function send(a, overwrite){ if(!validate()) return false switchButton() var f = document.frm1 f.submitAction.value = a if(overwrite) f.submitOverwrite.value = "overwriteConfirm" f.submit() } function switchButton(){ var f = document.frm1 f.btnGet.disabled = !f.btnGet.disabled f.btnGetAndExit.disabled = !f.btnGetAndExit.disabled f.btnCancel.disabled = !f.btnCancel.disabled } function init(){ document.body.style.overflow = 'hidden' <?php if($submitOverwrite == "overwrite"){ echo "if(confirm('" . $PXP_languages[$PXP_language]["allowOverwrite"] . "?')){\r\n"; echo " send('" . $submitAction . "', true)\r\n"; echo "}else{\r\n"; echo " document.frm1.sourceURL.focus()\r\n"; echo " document.frm1.sourceURL.select()\r\n"; echo "}\r\n"; }else{ switch($submitAction){ case "get": if(!isset($error)) echo "opener.refreshDir()\r\n"; break; case "getAndExit": if(!isset($error)){ echo "opener.refreshDir()\r\n"; echo "window.close()\r\n"; } break; } } echo "window.resizeTo(445,190)\r\n"; echo "document.frm1.sourceURL.focus()\r\n"; ?> } //--> </script> </head> <body onLoad="init()"> <form name="frm1" action="./get.php" method="post"> <?php if($error != "")echo "<span class=\"error\">$error</span><br><br>" ?> <input type="hidden" name="currentDir" value="<?php echo $currentDir ?>"> <input type="hidden" name="shareId" value="<?php echo $shareId ?>"> <input type="hidden" name="submitAction" value="<?php echo $submitAction ?>"> <input type="hidden" name="submitOverwrite" value="<?php echo $submitOverwrite ?>"> <table style="width:100%"> <tr> <td> <table border="1" rules="none" cellspacing="0" bordercolor="#EEEEEE" style="width:100%"> <tr> <td class="caption"><?php echo $PXP_languages[$PXP_language]['getFile'] ?></td> </tr> <tr> <td> <table style="width:100%"> <tr> <td> <?php echo $PXP_languages[$PXP_language]['file'] ?> </td> <td> <input type="text" name="sourceURL" size="50" value="<?php echo ($sourceURL != "") ? $sourceURL : 'http://' ?>"> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td align="right"> <br> <input type="button" name="btnGet" onClick="send('get')" value="<?php echo $PXP_languages[$PXP_language]['get'] ?>"> <input type="button" name="btnGetAndExit" onClick="send('getAndExit')" value="<?php echo $PXP_languages[$PXP_language]['getAndExit'] ?>"> <input type="button" name="btnCancel" onClick="window.close()" value="<?php echo $PXP_languages[$PXP_language]['cancel'] ?>"> </td> </tr> </table> </form> </body> </html>