$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'; // Portuguese $pt['Version'] = 'Versão'; $pt['DocRoot'] = 'Document Root'; $pt['FLRoot'] = 'File Manager Root'; $pt['Name'] = 'Nome'; $pt['And'] = 'e'; $pt['Enter'] = 'Entrar'; $pt['Send'] = 'Enviar'; $pt['Refresh'] = 'Atualizar'; $pt['SaveConfig'] = 'Salvar Configurações'; $pt['SavePass'] = 'Salvar Senha'; $pt['SaveFile'] = 'Salvar Arquivo'; $pt['Save'] = 'Salvar'; $pt['Leave'] = 'Sair'; $pt['Edit'] = 'Editar'; $pt['View'] = 'Visualizar'; $pt['Config'] = 'Config'; $pt['Ren'] = 'Renomear'; $pt['Rem'] = 'Apagar'; $pt['Compress'] = 'Compactar'; $pt['Decompress'] = 'Descompactar'; $pt['ResolveIDs'] = 'Resolver IDs'; $pt['Move'] = 'Mover'; $pt['Copy'] = 'Copiar'; $pt['ServerInfo'] = 'Server Info'; $pt['CreateDir'] = 'Criar Diretório'; $pt['CreateArq'] = 'Criar Arquivo'; $pt['ExecCmd'] = 'Executar Comando'; $pt['Upload'] = 'Upload'; $pt['UploadEnd'] = 'Upload Terminado'; $pt['Perms'] = 'Permissões'; $pt['Owner'] = 'Dono'; $pt['Group'] = 'Grupo'; $pt['Other'] = 'Outros'; $pt['Size'] = 'Tamanho'; $pt['Date'] = 'Data'; $pt['Type'] = 'Tipo'; $pt['Free'] = 'livre'; $pt['Shell'] = 'Shell'; $pt['Read'] = 'Ler'; $pt['Write'] = 'Escrever'; $pt['Exec'] = 'Executar'; $pt['Apply'] = 'Aplicar'; $pt['StickyBit'] = 'Sticky Bit'; $pt['Pass'] = 'Senha'; $pt['Lang'] = 'Idioma'; $pt['File'] = 'Arquivo'; $pt['File_s'] = 'arquivo(s)'; $pt['Dir_s'] = 'diretorio(s)'; $pt['To'] = 'para'; $pt['Destination'] = 'Destino'; $pt['Configurations'] = 'Configurações'; $pt['JSError'] = 'Erro de JavaScript'; $pt['NoSel'] = 'Não há itens selecionados'; $pt['SelDir'] = 'Selecione o diretório de destino na árvore a esquerda'; $pt['TypeDir'] = 'Digite o nome do diretório'; $pt['TypeArq'] = 'Digite o nome do arquivo'; $pt['TypeCmd'] = 'Digite o commando'; $pt['TypeArqComp'] = 'Digite o nome do arquivo.\\nA extensão determina o tipo de compactação.\\nEx:\\nnome.zip\\nnome.tar\\nnome.bzip\\nnome.gzip'; $pt['RemSel'] = 'APAGAR itens selecionados'; $pt['NoDestDir'] = 'Não há um diretório de destino selecionado'; $pt['DestEqOrig'] = 'Diretório de origem e destino iguais'; $pt['InvalidDest'] = 'Diretório de destino inválido'; $pt['NoNewPerm'] = 'Nova permissão não foi setada'; $pt['CopyTo'] = 'COPIAR para'; $pt['MoveTo'] = 'MOVER para'; $pt['AlterPermTo'] = 'ALTERAR PERMISSÕES para'; $pt['ConfExec'] = 'Confirma EXECUTAR'; $pt['ConfRem'] = 'Confirma APAGAR'; $pt['EmptyDir'] = 'Diretório vazio'; $pt['IOError'] = 'Erro de E/S'; $pt['FileMan'] = 'PHP File Manager'; $pt['TypePass'] = 'Digite a senha'; $pt['InvPass'] = 'Senha Inválida'; $pt['ReadDenied'] = 'Acesso de leitura negado'; $pt['FileNotFound'] = 'Arquivo não encontrado'; $pt['AutoClose'] = 'Fechar Automaticamente'; $pt['OutDocRoot'] = 'Arquivo fora do DOCUMENT_ROOT'; $pt['NoCmd'] = 'Erro: Comando não informado'; $pt['ConfTrySave'] = 'Arquivo sem permissão de escrita.\\nTentar salvar assim mesmo'; $pt['ConfSaved'] = 'Configurações salvas'; $pt['PassSaved'] = 'Senha salva'; $pt['FileDirExists'] = 'Arquivo ou diretório já existe'; $pt['NoPhpinfo'] = 'Função phpinfo desabilitada'; $pt['NoReturn'] = 'sem retorno'; $pt['FileSent'] = 'Arquivo enviado'; $pt['SpaceLimReached'] = 'Limite de espaço alcançado'; $pt['InvExt'] = 'Extensão inválida'; $pt['FileNoOverw'] = 'Arquivo não pode ser sobreescrito'; $pt['FileOverw'] = 'Arquivo sobreescrito'; $pt['FileIgnored'] = 'Arquivo omitido'; $pt['ChkVer'] = 'Verificar sf.net por nova versão'; $pt['ChkVerAvailable'] = 'Nova versão, clique aqui para iniciar download!!'; $pt['ChkVerNotAvailable'] = 'Não há nova versão disponível :('; $pt['ChkVerError'] = 'Erro de conexão.'; $pt['Website'] = 'Website'; $pt['SendingForm'] = 'Enviando arquivos, aguarde'; $pt['NoFileSel'] = 'Nenhum arquivo selecionado'; $pt['SelAll'] = 'Tudo'; $pt['SelNone'] = 'Nada'; $pt['SelInverse'] = 'Inverso'; $pt['Selected_s'] = 'selecionado(s)'; $pt['Total'] = 'total'; $pt['Partition'] = 'Partição'; $pt['RenderTime'] = 'Tempo para gerar esta página'; $pt['Seconds'] = 'seg'; $pt['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 "\n"; echo ""; //if (!$islinux) $aux=substr($fm_root_atual,0,strlen($fm_root_atual)-1); //else $aux=$fm_root_atual; echo ""; echo " "; echo "
"; if (!$islinux){ echo " "; } echo "
"; clearstatcache(); tree($aux,$aux,-1,0); echo "
\n"; echo "\n"; } function getmicrotime(){ list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function dir_list_form() { global $fm_root_atual,$dir_atual,$quota_mb,$resolveIDs,$order_dir_list_by,$islinux,$cmd_name,$ip,$is_reachable,$path_info,$fm_color; $ti = getmicrotime(); clearstatcache(); $out = "\n"; if ($opdir = @opendir($dir_atual)) { $entry_count = 0; $file_count = 0; $dir_count = 0; $total_size = 0; $uplink = ""; $entry_list = array(); $highlight_cols = 0; while ($file = readdir($opdir)) { if (($file != ".")&&($file != "..")){ if (is_file($dir_atual.$file)){ $ext = strtolower(strrchr($file,".")); $entry_list[$entry_count]["type"] = "file"; // Função filetype() returns only "file"... $entry_list[$entry_count]["size"] = filesize($dir_atual.$file); $entry_list[$entry_count]["sizet"] = getsize($dir_atual.$file); if (strstr($ext,".")){ $entry_list[$entry_count]["ext"] = $ext; $entry_list[$entry_count]["extt"] = $ext; } else { $entry_list[$entry_count]["ext"] = ""; $entry_list[$entry_count]["extt"] = " "; } $file_count++; } elseif (is_dir($dir_atual.$file)) { // Recursive directory size disabled // $entry_list[$entry_count]["size"] = total_size($dir_atual.$file); $entry_list[$entry_count]["size"] = 0; $entry_list[$entry_count]["sizet"] = 0; $entry_list[$entry_count]["type"] = "dir"; $dir_count++; } $entry_list[$entry_count]["name"] = $file; $entry_list[$entry_count]["date"] = date("Ymd", filemtime($dir_atual.$file)); $entry_list[$entry_count]["time"] = date("his", filemtime($dir_atual.$file)); $entry_list[$entry_count]["datet"] = date("d/m/Y h:i:s", filemtime($dir_atual.$file)); if ($islinux && $resolveIDs){ $entry_list[$entry_count]["p"] = show_perms(fileperms($dir_atual.$file)); $entry_list[$entry_count]["u"] = getuser(fileowner($dir_atual.$file)); $entry_list[$entry_count]["g"] = getgroup(filegroup($dir_atual.$file)); } else { $entry_list[$entry_count]["p"] = base_convert(fileperms($dir_atual.$file),10,8); $entry_list[$entry_count]["p"] = substr($entry_list[$entry_count]["p"],strlen($entry_list[$entry_count]["p"])-3); $entry_list[$entry_count]["u"] = fileowner($dir_atual.$file); $entry_list[$entry_count]["g"] = filegroup($dir_atual.$file); } $total_size += $entry_list[$entry_count]["size"]; $entry_count++; } } closedir($opdir); if ($file_count) $highlight_cols = ($islinux)?7:5; else $highlight_cols = ($islinux)?6:4; if($entry_count){ $or1="1A"; $or2="2D"; $or3="3A"; $or4="4A"; $or5="5A"; $or6="6D"; $or7="7D"; switch($order_dir_list_by){ case "1A": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"name",SORT_STRING,SORT_ASC); $or1="1D"; break; case "1D": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"name",SORT_STRING,SORT_DESC); $or1="1A"; break; case "2A": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"p",SORT_STRING,SORT_ASC,"g",SORT_STRING,SORT_ASC,"u",SORT_STRING,SORT_ASC); $or2="2D"; break; case "2D": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"p",SORT_STRING,SORT_DESC,"g",SORT_STRING,SORT_ASC,"u",SORT_STRING,SORT_ASC); $or2="2A"; break; case "3A": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"u",SORT_STRING,SORT_ASC,"g",SORT_STRING,SORT_ASC); $or3="3D"; break; case "3D": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"u",SORT_STRING,SORT_DESC,"g",SORT_STRING,SORT_ASC); $or3="3A"; break; case "4A": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"g",SORT_STRING,SORT_ASC,"u",SORT_STRING,SORT_DESC); $or4="4D"; break; case "4D": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"g",SORT_STRING,SORT_DESC,"u",SORT_STRING,SORT_DESC); $or4="4A"; break; case "5A": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"size",SORT_NUMERIC,SORT_ASC); $or5="5D"; break; case "5D": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"size",SORT_NUMERIC,SORT_DESC); $or5="5A"; break; case "6A": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"date",SORT_STRING,SORT_ASC,"time",SORT_STRING,SORT_ASC,"name",SORT_STRING,SORT_ASC); $or6="6D"; break; case "6D": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"date",SORT_STRING,SORT_DESC,"time",SORT_STRING,SORT_DESC,"name",SORT_STRING,SORT_ASC); $or6="6A"; break; case "7A": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"ext",SORT_STRING,SORT_ASC,"name",SORT_STRING,SORT_ASC); $or7="7D"; break; case "7D": $entry_list = array_csort ($entry_list,"type",SORT_STRING,SORT_ASC,"ext",SORT_STRING,SORT_DESC,"name",SORT_STRING,SORT_ASC); $or7="7A"; break; } } $out .= " "; $out .= " "; $out .= " "; $dir_out=""; $file_out=""; foreach ($entry_list as $ind=>$dir_entry) { $file = $dir_entry["name"]; if ($dir_entry["type"]=="dir"){ $dir_out .= " "; } else { $file_out .= " "; } } $out .= $dir_out; if ($entry_count){ $out .= " "; $out .= " "; $out .= " "; if ($quota_mb) { $out .= " "; } else { $out .= " "; } $tf = getmicrotime(); $tt = ($tf - $ti); $out .= " "; $out .= " "; } else { $out .= " "; } } else $out .= "
$ip "; if ($dir_atual != $fm_root_atual){ $mat = explode("/",$dir_atual); $dir_antes = ""; for($x=0;$x<(count($mat)-2);$x++) $dir_antes .= $mat[$x]."/"; $uplink = "<< "; } if($entry_count){ $out .= "
$uplink $dir_atual
"; if ($islinux) $out .= " "; $out .= " "; $out .= "
$file ".$dir_entry["p"]; if ($islinux) $dir_out .= "".$dir_entry["u"]."".$dir_entry["g"]; $dir_out .= " ".$dir_entry["sizet"]." ".$dir_entry["datet"]; if ($file_count) $dir_out .= " "; // Opções de diretório if ( is_writable($dir_atual.$file) ) $dir_out .= " ".et('Rem')." ".et('Ren').""; $dir_out .= "
$file ".$dir_entry["p"]; if ($islinux) $file_out .= "".$dir_entry["u"]."".$dir_entry["g"]; $file_out .= " ".$dir_entry["sizet"]." ".$dir_entry["datet"]." ".$dir_entry["extt"]; // Opções de arquivo if ( is_writable($dir_atual.$file) ) $file_out .= " ".et('Rem')." ".et('Ren').""; if ( is_readable($dir_atual.$file) && (strpos(".wav#.mp3#.mid#.avi#.mov#.mpeg#.mpg#.rm#.iso#.bin#.img#.dll#.psd#.fla#.swf#.class#.ppt#.jpg#.gif#.png#.wmf#.eps#.bmp#.msi#.exe#.com#.rar#.tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"]."#" ) === false)) $file_out .= " ".et('Edit').""; if ( is_readable($dir_atual.$file) && strlen($dir_entry["ext"]) && (strpos(".tar#.zip#.bz2#.tbz2#.bz#.tbz#.bzip#.gzip#.gz#.tgz#", $dir_entry["ext"]."#" ) !== false)) $file_out .= " ".et('Decompress').""; if( $is_reachable && is_readable($dir_atual.$file) && (strpos(".txt#.sys#.bat#.ini#.conf#.swf#.php#.php3#.asp#.html#.htm#.jpg#.gif#.png#.bmp#", $dir_entry["ext"]."#" ) !== false)) $file_out .= " ".et('View').""; $file_out .= "
".et('Name')." ".et('Perms').""; if ($islinux) $out .= "".et('Owner')."".et('Group').""; $out .= " ".et('Size')." ".et('Date').""; if ($file_count) $out .= " ".et('Type').""; $out .= " "; } $out .= $file_out; $out .= "
"; if ($islinux) $out .= " "; $out .= " "; $out .= "
$dir_count ".et('Dir_s')." ".et('And')." $file_count ".et('File_s')." = ".formatsize($total_size)."
".et('Partition').": ".formatsize(($quota_mb*1024*1024))." ".et('Total')." - ".formatsize(($quota_mb*1024*1024)-total_size($fm_root_atual))." ".et('Free')."
".et('Partition').": ".formatsize(disk_total_space($dir_atual))." ".et('Total')." - ".formatsize(disk_free_space($fm_root_atual))." ".et('Free')."
".et('RenderTime').": ".substr($tt,0,strrpos($tt,".")+5)." ".et('Seconds')."
$uplink$dir_atual
".et('EmptyDir').".
".et('IOError').".
$dir_atual
"; $out .= "
"; echo $out; } function upload_form(){ global $_FILES,$dir_atual,$dir_dest,$fechar,$quota_mb,$path_info; $num_uploads = 5; html_header(); echo ""; if (count($_FILES)==0){ echo "
".et('Upload')."
".et('Destination').":$dir_atual"; for ($x=0;$x<$num_uploads;$x++){ echo "
".et('File').":"; $test_js .= "(document.upload_form.file$x.value.length>0)||"; } echo "
  ".et('AutoClose')."
 
"; } else { $out = "".et('UploadEnd')." ".et('Destination').": $dir_dest"; for ($x=0;$x<$num_uploads;$x++){ $temp_file = $_FILES["file".$x]["tmp_name"]; $filename = $_FILES["file".$x]["name"]; if (strlen($filename)) $resul = save_upload($temp_file,$filename,$dir_dest); else $resul = 7; switch($resul){ case 1: $out .= "".strzero($x+1,3).". ".et('FileSent').":".$filename."\n"; break; case 2: $out .= "".et('IOError')."\n"; $x = $upload_num; break; case 3: $out .= "".et('SpaceLimReached')." ($quota_mb Mb)\n"; $x = $upload_num; break; case 4: $out .= "".strzero($x+1,3).". ".et('InvExt').":".$filename."\n"; break; case 5: $out .= "".strzero($x+1,3).". ".et('FileNoOverw')."".$filename."\n"; break; case 6: $out .= "".strzero($x+1,3).". ".et('FileOverw').":".$filename."\n"; break; case 7: $out .= "".strzero($x+1,3).". ".et('FileIgnored')."\n"; } } if ($fechar) { echo " "; } else { echo " $out
 
"; } } echo "\n"; } function chmod_form(){ $aux = " "; html_header($aux); echo "
".et('Perms')."
".et('Owner')." ".et('Group')." ".et('Other')."
".et('Read')."
".et('Write')."
".et('Exec')."
".et('StickyBit')."
\n"; } function view(){ global $doc_root,$path_info,$url_info,$dir_atual,$islinux,$filename,$is_reachable; html_header(); echo " \n"; } function edit_file_form(){ global $dir_atual,$filename,$file_data,$save_file,$path_info; $file = $dir_atual.$filename; if ($save_file){ $fh=fopen($file,"w"); fputs($fh,$file_data,strlen($file_data)); fclose($fh); } $fh=fopen($file,"r"); $file_data=fread($fh, filesize($file)); fclose($fh); html_header(); echo "
".$file."
\n"; } function config_form(){ global $cfg; global $dir_atual,$script_filename,$doc_root,$path_info,$fm_root_atual,$lang,$error_reporting,$version; global $config_action,$newsenha,$newlang,$newerror,$newfm_root; $Warning = ""; switch ($config_action){ case 1: if ($fh = fopen("http://phpfm.sf.net/latest.php","r")){ $data = ""; while (!feof($fh)) $data .= fread($fh,1024); fclose($fh); $data = unserialize($data); $ChkVerWarning = " "; if (is_array($data)&&count($data)){ // sf.net logo $ChkVerWarning .= "\"SourceForge.net"; if (str_replace(".","",$data['version'])>str_replace(".","",$cfg->data['version'])) $ChkVerWarning .= "".et('ChkVerAvailable').""; else $ChkVerWarning .= "".et('ChkVerNotAvailable').""; } else $ChkVerWarning .= "".et('ChkVerError').""; } else $ChkVerWarning .= "".et('ChkVerError').""; break; case 2: $reload = false; if ($cfg->data['lang'] != $newlang){ $cfg->data['lang'] = $newlang; $lang = $newlang; $reload = true; } if ($cfg->data['error_reporting'] != $newerror){ $cfg->data['error_reporting'] = $newerror; $error_reporting = $newerror; $reload = true; } $newfm_root = formatpath($newfm_root); if ($cfg->data['fm_root'] != $newfm_root){ $cfg->data['fm_root'] = $newfm_root; if (strlen($newfm_root)) $dir_atual = $newfm_root; else $dir_atual = $path_info["dirname"]."/"; setcookie("fm_root_atual", $newfm_root , 0 , "/"); $reload = true; } $cfg->save(); if ($reload){ reloadframe("window.opener.parent",2); reloadframe("window.opener.parent",3); } $Warning1 = et('ConfSaved')."..."; break; case 3: if ($cfg->data['auth_pass'] != md5($newsenha)){ $cfg->data['auth_pass'] = md5($newsenha); setcookie("loggedon", md5($newsenha) , 0 , "/"); } $cfg->save(); $Warning2 = et('PassSaved')."..."; break; } html_header(); echo "\n"; echo "
".strtoupper(et('Configurations'))."
"; if (strlen($ChkVerWarning)) echo $ChkVerWarning.$data['warnings']; else echo ""; echo "
".et('Version').":$version
".et('Size').":".getsize($script_filename)."
".et('Website').":http://phpfm.sf.net
 "; echo "
".et('DocRoot').":".$doc_root."
".et('FLRoot').":data['fm_root']."\" onkeypress=\"enterSubmit(event,'test_config_form(2)')\">
".et('Lang').":
".et('ErrorReport').":
 "; if (strlen($Warning1)) echo " $Warning1"; echo "
".et('Pass').":
 "; if (strlen($Warning2)) echo " $Warning2"; echo "
"; echo "\n"; } function shell_form(){ global $dir_atual,$shell_form,$cmd_arg,$path_info; $data_out = ""; if (strlen($cmd_arg)){ exec($cmd_arg,$mat); if (count($mat)) $data_out = trim(implode("\n",$mat)); } switch ($shell_form){ case 1: html_header(); echo "
"; break; case 2: html_header(); echo " "; echo " "; echo "
"; break; default: $aux = " "; html_header($aux); echo " "; } } function server_info(){ if (!@phpinfo()) echo et('NoPhpinfo')."..."; echo "

"; $a=ini_get_all(); $output=""; while(list($key, $value)=each($a)) { list($k, $v)= each($a[$key]); $output.=""; } $output.="
$key$v
"; echo $output; echo "

"; $safe_mode=trim(ini_get("safe_mode")); if ((strlen($safe_mode)==0)||($safe_mode==0)) $safe_mode=false; else $safe_mode=true; $is_windows_server = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); echo "
".php_uname(); echo "
safe_mode".($safe_mode?"on":"off"); if ($is_windows_server) echo "
sisopWindows
"; else echo "
sisopLinux
"; echo "


"; $display_errors=ini_get("display_errors"); $ignore_user_abort = ignore_user_abort(); $max_execution_time = ini_get("max_execution_time"); $upload_max_filesize = ini_get("upload_max_filesize"); $memory_limit=ini_get("memory_limit"); $output_buffering=ini_get("output_buffering"); $default_socket_timeout=ini_get("default_socket_timeout"); $allow_url_fopen = ini_get("allow_url_fopen"); $magic_quotes_gpc = ini_get("magic_quotes_gpc"); ignore_user_abort(true); ini_set("display_errors",0); ini_set("max_execution_time",0); ini_set("upload_max_filesize","10M"); ini_set("memory_limit","20M"); ini_set("output_buffering",0); ini_set("default_socket_timeout",30); ini_set("allow_url_fopen",1); ini_set("magic_quotes_gpc",0); echo "
 GetSetGet"; echo "
display_errors$display_errors0".ini_get("display_errors"); echo "
ignore_user_abort".($ignore_user_abort?"on":"off")."on".(ignore_user_abort()?"on":"off"); echo "
max_execution_time$max_execution_time0".ini_get("max_execution_time"); echo "
upload_max_filesize$upload_max_filesize10M".ini_get("upload_max_filesize"); echo "
memory_limit$memory_limit20M".ini_get("memory_limit"); echo "
output_buffering$output_buffering0".ini_get("output_buffering"); echo "
default_socket_timeout$default_socket_timeout30".ini_get("default_socket_timeout"); echo "
allow_url_fopen$allow_url_fopen1".ini_get("allow_url_fopen"); echo "
magic_quotes_gpc$magic_quotes_gpc0".ini_get("magic_quotes_gpc"); echo "


"; echo " "; echo "\n"; } // +-------------------------------------------------- // | Session // +-------------------------------------------------- function logout(){ setcookie("loggedon",0,0,"/"); form_login(); } function login(){ global $senha,$auth_pass,$path_info; if (md5(trim($senha)) == $auth_pass){ setcookie("loggedon",$auth_pass,0,"/"); header ("Location: ".$path_info["basename"].""); } else header ("Location: ".$path_info["basename"]."?erro=1"); } function form_login(){ global $erro,$auth_pass,$path_info; html_header(); echo "\n"; if ($auth_pass != md5("")){ echo " "; if (strlen($erro)) echo " "; echo "
".et('FileMan')."
".et('TypePass').".
".et('InvPass').".
"; } else { echo "
".et('FileMan')."
"; } echo "\n"; } function frame3(){ global $islinux,$cmd_arg,$chmod_arg,$zip_dir,$fm_root_atual; global $dir_dest,$dir_atual,$dir_antes; global $selected_file_list,$selected_dir_list,$old_name,$new_name; global $action,$or_by,$order_dir_list_by; if (!isset($order_dir_list_by)){ $order_dir_list_by = "1A"; setcookie("order_dir_list_by", $order_dir_list_by , $cookie_cache_time , "/"); } elseif (strlen($or_by)){ $order_dir_list_by = $or_by; setcookie("order_dir_list_by", $or_by , $cookie_cache_time , "/"); } html_header(); echo "\n"; if ($action){ switch ($action){ case 1: // create dir if (strlen($cmd_arg)){ $cmd_arg = formatpath($dir_atual.$cmd_arg); if (!file_exists($cmd_arg)){ mkdir($cmd_arg,0777); chmod($cmd_arg,0777); reloadframe("parent",2,"&ec_dir=".$cmd_arg); } else alert(et('FileDirExists')."."); } break; case 2: // create arq if (strlen($cmd_arg)){ $cmd_arg = $dir_atual.$cmd_arg; if (!file_exists($cmd_arg)){ if ($fh = @fopen($cmd_arg, "w")){ @fclose($fh); } chmod($cmd_arg,0666); } else alert(et('FileDirExists')."."); } break; case 3: // rename arq ou dir if ((strlen($old_name))&&(strlen($new_name))){ rename($dir_atual.$old_name,$dir_atual.$new_name); if (is_dir($dir_atual.$new_name)) reloadframe("parent",2); } break; case 4: // delete sel if(strstr($dir_atual,$fm_root_atual)){ if (strlen($selected_file_list)){ $selected_file_list = explode("<|*|>",$selected_file_list); if (count($selected_file_list)) { for($x=0;$x",$selected_dir_list); if (count($selected_dir_list)) { for($x=0;$x",$selected_file_list); if (count($selected_file_list)) { for($x=0;$x",$selected_dir_list); if (count($selected_dir_list)) { for($x=0;$x",$selected_file_list); if (count($selected_file_list)) { for($x=0;$x",$selected_dir_list); if (count($selected_dir_list)) { for($x=0;$xset_options(array('basedir'=>$dir_atual,'overwrite'=>1,'level'=>3)); if (strlen($selected_file_list)){ $selected_file_list = explode("<|*|>",$selected_file_list); if (count($selected_file_list)) { for($x=0;$xadd_files($selected_file_list[$x]); } } } if (strlen($selected_dir_list)){ $selected_dir_list = explode("<|*|>",$selected_dir_list); if (count($selected_dir_list)) { for($x=0;$xadd_files($selected_dir_list[$x]); } } } $zipfile->create_archive(); } unset($zipfile); } break; case 72: // decompress arq if (strlen($cmd_arg)){ if (file_exists($dir_atual.$cmd_arg)){ $zipfile=false; if (strstr($cmd_arg,".zip")) zip_extract(); elseif (strstr($cmd_arg,".bzip")||strstr($cmd_arg,".bz2")||strstr($cmd_arg,".tbz2")||strstr($cmd_arg,".bz")||strstr($cmd_arg,".tbz")) $zipfile = new bzip_file($cmd_arg); elseif (strstr($cmd_arg,".gzip")||strstr($cmd_arg,".gz")||strstr($cmd_arg,".tgz")) $zipfile = new gzip_file($cmd_arg); elseif (strstr($cmd_arg,".tar")) $zipfile = new tar_file($cmd_arg); if ($zipfile){ $zipfile->set_options(array('basedir'=>$dir_atual,'overwrite'=>1)); $zipfile->extract_files(); } unset($zipfile); reloadframe("parent",2); } } break; case 8: // delete arq/dir if (strlen($cmd_arg)){ if (file_exists($dir_atual.$cmd_arg)) total_delete($dir_atual.$cmd_arg); if (is_dir($dir_atual.$cmd_arg)) reloadframe("parent",2); } break; case 9: // CHMOD if((strlen($chmod_arg) == 4)&&(strlen($dir_atual))){ if ($chmod_arg[0]=="1") $chmod_arg = "0".$chmod_arg; else $chmod_arg = "0".substr($chmod_arg,strlen($chmod_arg)-3); $new_mod = octdec($chmod_arg); $selected_file_list = explode("<|*|>",$selected_file_list); if (count($selected_file_list)) for($x=0;$x",$selected_dir_list); if (count($selected_dir_list)) for($x=0;$x

roland pro e intelligent arranger keyboard

Maxs back

pampered chef wraps and braid recipes

online casino

driver syncmaster 710n

golden age

shiny spandex lycra pants

Prime Minister

mitchell musso fan mail

York City

pajar fox trot fur boots

San Antonio

pear desert recipe

credit repair

women s sex enhancer

gradually made perfect

itu h 26n

Apple iTune

tied up crossdressers

middle school

mekeni food corporation

long distance

sena bogota suscripciones

hip hop

mediacom cable springfield mo

free VoIP

food safety regulations in malaysia

little bit

home made camphorated oil recipe

car insurance

hanvit bank los angeles

healthy weight

italian rainbow cookie recipe

food preparation

tv show darma

slide easily

the actress madalyn kahn

PHP web

moseley s diamond showcase

could make

alexis taylor shannan leigh catfight

looked like

e rotic kiss me lyrics

him back

review of sony kdl40sl130 t v

James Finch

food scares

having sex

leo s strawberry banana cake

good way

homeopathic remedies for flatulence

Linux web

meyer son tannery ny

thought of as superior to

quotes mahat magandi

pet products

toya s world blogspot

Jeff Combs

venus swimwear models names

designer prom

picture of roast beef dinner

exotic pets

pamona cable

Prime Minister

convicta watches

individual choices

masonic rings wholesale

Baltic Sea

ophiuchus traits personality characteristics

carpal tunnel

serotonin rich foods

control over

georg simmel fashion

found myself

galitsin natia

bad credit

mead g r s

dog beds

vagian

pet food

crabbing regulations florida

complete ship

dr jacob rinse breakfast drink formula

high blood

bcm2045 drivers

ass back

heather vandeven galleries

good view

pictures of indianapolis colts symbol

wedding invitations

irina and absolute skinny

used car

shaved head samurai

I made acquaintance

sticky queerclick

charter school

richard proenneke alone in the wilderness

Crocodile Dundee

girls scout cookies west central florida

shih tzu

german picallili recipe

five minutes

sensitive pornograph episode 1

health through the study

vo2 max norms

parent shore division

craigs list lexington ky

through incentives

gambar ulat di badan manusia

web hosting

vinnie zucchini s italian eatery toronto ontario

truthfulness as a species

benturex

family member

soup plantation coupons

Mazda Motor

porno orgias

correct able

thermostat wiring bryant furnace

music video

leandra n jones

commercial dog

jenna haze trailor

feel good

flavored almond recipes

good look

lonley planet torrent

Kegel exercises

neopolitan cake recipe

breast enhancement

toilet paper magazine holder

low libido

recipe vegetarian lettuce wraps pf chang

North America

portland oregon breakfast all day

difficulties and to

foto de mujer lesbi

would hurt

bigbazar

home business

parachute colorado photos

internet marketing

chattanooga mint magazine

be false

barbie dream house instructions

center love

apache desert moccasins

dry food

sexo poses

moms ass

paula dean sausage ball recipe

auto insurance

ho3 insurance policy form

new home

ruger p90th

Australia began

hiniker oboes for sale

raw foods

mla format for citing movies

book carry took

list of foods that contain aspartame

United States \n"; } function frame2(){ global $expanded_dir_list,$ec_dir; if (!isset($expanded_dir_list)) $expanded_dir_list = ""; if (strlen($ec_dir)){ if (strstr($expanded_dir_list,":".$ec_dir)) $expanded_dir_list = str_replace(":".$ec_dir,"",$expanded_dir_list); else $expanded_dir_list .= ":".$ec_dir; setcookie("expanded_dir_list", $expanded_dir_list , 0 , "/"); } show_tree(); } function frameset(){ global $path_info; html_header(); echo " "; echo ""; } // +-------------------------------------------------- // | Open Source Contributions // +-------------------------------------------------- /*------------------------------------------------- | TAR/GZIP/BZIP2/ZIP ARCHIVE CLASSES 2.0 | By Devin Doucette | Copyright (c) 2004 Devin Doucette | Email: darksnoopy@shaw.ca +-------------------------------------------------- | Email bugs/suggestions to darksnoopy@shaw.ca +-------------------------------------------------- | This script has been created and released under | the GNU GPL and is free to use and redistribute | only if this copyright statement is not removed +-------------------------------------------------- | Limitations: | - Only USTAR archives are officially supported for extraction, but others may work. | - Extraction of bzip2 and gzip archives is limited to compatible tar files that have | been compressed by either bzip2 or gzip. For greater support, use the functions | bzopen and gzopen respectively for bzip2 and gzip extraction. | - Zip extraction is not supported due to the wide variety of algorithms that may be | used for compression and newer features such as encryption. +-------------------------------------------------- */ class archive { function archive($name) { $this->options = array( 'basedir'=>".", 'name'=>$name, 'prepend'=>"", 'inmemory'=>0, 'overwrite'=>0, 'recurse'=>1, 'storepaths'=>1, 'level'=>3, 'method'=>1, 'sfx'=>"", 'type'=>"", 'comment'=>"" ); $this->files = array(); $this->exclude = array(); $this->storeonly = array(); $this->error = array(); } function set_options($options) { foreach($options as $key => $value) { $this->options[$key] = $value; } if(!empty($this->options['basedir'])) { $this->options['basedir'] = str_replace("\\","/",$this->options['basedir']); $this->options['basedir'] = preg_replace("/\/+/","/",$this->options['basedir']); $this->options['basedir'] = preg_replace("/\/$/","",$this->options['basedir']); } if(!empty($this->options['name'])) { $this->options['name'] = str_replace("\\","/",$this->options['name']); $this->options['name'] = preg_replace("/\/+/","/",$this->options['name']); } if(!empty($this->options['prepend'])) { $this->options['prepend'] = str_replace("\\","/",$this->options['prepend']); $this->options['prepend'] = preg_replace("/^(\.*\/+)+/","",$this->options['prepend']); $this->options['prepend'] = preg_replace("/\/+/","/",$this->options['prepend']); $this->options['prepend'] = preg_replace("/\/$/","",$this->options['prepend']) . "/"; } } function create_archive() { $this->make_list(); if($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if($this->options['overwrite'] == 0 && file_exists($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip"? ".tmp" : ""))) { $this->error[] = "File {$this->options['name']} already exists."; chdir($pwd); return 0; } else if($this->archive = @fopen($this->options['name'] . ($this->options['type'] == "gzip" || $this->options['type'] == "bzip"? ".tmp" : ""),"wb+")) { chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else { $this->archive = ""; } switch($this->options['type']) { case "zip": if(!$this->create_zip()) { $this->error[] = "Could not create zip file."; return 0; } break; case "bzip": if(!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } if(!$this->create_bzip()) { $this->error[] = "Could not create bzip2 file."; return 0; } break; case "gzip": if(!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } if(!$this->create_gzip()) { $this->error[] = "Could not create gzip file."; return 0; } break; case "tar": if(!$this->create_tar()) { $this->error[] = "Could not create tar file."; return 0; } } if($this->options['inmemory'] == 0) { fclose($this->archive); chmod($this->options['name'],0666); if($this->options['type'] == "gzip" || $this->options['type'] == "bzip") { unlink($this->options['basedir'] . "/" . $this->options['name'] . ".tmp"); } } } function add_data($data) { if($this->options['inmemory'] == 0) { fwrite($this->archive,$data); } else { $this->archive .= $data; } } function make_list() { if(!empty($this->exclude)) { foreach($this->files as $key => $value) { foreach($this->exclude as $current) { if($value['name'] == $current['name']) { unset($this->files[$key]); } } } } if(!empty($this->storeonly)) { foreach($this->files as $key => $value) { foreach($this->storeonly as $current) { if($value['name'] == $current['name']) { $this->files[$key]['method'] = 0; } } } } unset($this->exclude,$this->storeonly); } function add_files($list) { $temp = $this->list_files($list); foreach($temp as $current) { $this->files[] = $current; } } function exclude_files($list) { $temp = $this->list_files($list); foreach($temp as $current) { $this->exclude[] = $current; } } function store_files($list) { $temp = $this->list_files($list); foreach($temp as $current) { $this->storeonly[] = $current; } } function list_files($list) { if(!is_array($list)) { $temp = $list; $list = array($temp); unset($temp); } $files = array(); $pwd = getcwd(); chdir($this->options['basedir']); foreach($list as $current) { $current = str_replace("\\","/",$current); $current = preg_replace("/\/+/","/",$current); $current = preg_replace("/\/$/","",$current); if(strstr($current,"*")) { $regex = preg_replace("/([\\\^\$\.\[\]\|\(\)\?\+\{\}\/])/","\\\\\\1",$current); $regex = str_replace("*",".*",$regex); $dir = strstr($current,"/")? substr($current,0,strrpos($current,"/")) : "."; $temp = $this->parse_dir($dir); foreach($temp as $current2) { if(preg_match("/^{$regex}$/i",$current2['name'])) { $files[] = $current2; } } unset($regex,$dir,$temp,$current); } else if(@is_dir($current)) { $temp = $this->parse_dir($current); foreach($temp as $file) { $files[] = $file; } unset($temp,$file); } else if(@file_exists($current)) { $files[] = array('name'=>$current,'name2'=>$this->options['prepend'] . preg_replace("/(\.+\/+)+/","",($this->options['storepaths'] == 0 && strstr($current,"/"))? substr($current,strrpos($current,"/") + 1) : $current),'type'=>0, 'ext'=>substr($current,strrpos($current,".")),'stat'=>stat($current)); } } chdir($pwd); unset($current,$pwd); usort($files,array("archive","sort_files")); return $files; } function parse_dir($dirname) { if($this->options['storepaths'] == 1 && !preg_match("/^(\.+\/*)+$/",$dirname)) { $files = array(array('name'=>$dirname,'name2'=>$this->options['prepend'] . preg_replace("/(\.+\/+)+/","",($this->options['storepaths'] == 0 && strstr($dirname,"/"))? substr($dirname,strrpos($dirname,"/") + 1) : $dirname),'type'=>5,'stat'=>stat($dirname))); } else { $files = array(); } $dir = @opendir($dirname); while($file = @readdir($dir)) { if($file == "." || $file == "..") { continue; } else if(@is_dir($dirname."/".$file)) { if(empty($this->options['recurse'])) { continue; } $temp = $this->parse_dir($dirname."/".$file); foreach($temp as $file2) { $files[] = $file2; } } else if(@file_exists($dirname."/".$file)) { $files[] = array('name'=>$dirname."/".$file,'name2'=>$this->options['prepend'] . preg_replace("/(\.+\/+)+/","",($this->options['storepaths'] == 0 && strstr($dirname."/".$file,"/"))? substr($dirname."/".$file,strrpos($dirname."/".$file,"/") + 1) : $dirname."/".$file),'type'=>0, 'ext'=>substr($file,strrpos($file,".")),'stat'=>stat($dirname."/".$file)); } } @closedir($dir); return $files; } function sort_files($a,$b) { if($a['type'] != $b['type']) { return $a['type'] > $b['type']? -1 : 1; } else if($a['type'] == 5) { return strcmp(strtolower($a['name']),strtolower($b['name'])); } else { if($a['ext'] != $b['ext']) { return strcmp($a['ext'],$b['ext']); } else if($a['stat'][7] != $b['stat'][7]) { return $a['stat'][7] > $b['stat'][7]? -1 : 1; } else { return strcmp(strtolower($a['name']),strtolower($b['name'])); } } return 0; } function download_file() { if($this->options['inmemory'] == 0) { $this->error[] = "Can only use download_file() if archive is in memory. Redirect to file otherwise, it is faster."; return; } switch($this->options['type']) { case "zip": header("Content-type:application/zip"); break; case "bzip": header("Content-type:application/x-compressed"); break; case "gzip": header("Content-type:application/x-compressed"); break; case "tar": header("Content-type:application/x-tar"); } $header = "Content-disposition: attachment; filename=\""; $header .= strstr($this->options['name'],"/")? substr($this->options['name'],strrpos($this->options['name'],"/") + 1) : $this->options['name']; $header .= "\""; header($header); header("Content-length: " . strlen($this->archive)); header("Content-transfer-encoding: binary"); header("Cache-control: no-cache, must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Expires: 0"); print($this->archive); } } class tar_file extends archive { function tar_file($name) { $this->archive($name); $this->options['type'] = "tar"; } function create_tar() { $pwd = getcwd(); chdir($this->options['basedir']); foreach($this->files as $current) { if($current['name'] == $this->options['name']) { continue; } if(strlen($current['name2']) > 99) { $path = substr($current['name2'],0,strpos($current['name2'],"/",strlen($current['name2']) - 100) + 1); $current['name2'] = substr($current['name2'],strlen($path)); if(strlen($path) > 154 || strlen($current['name2']) > 99) { $this->error[] = "Could not add {$path}{$current['name2']} to archive because the filename is too long."; continue; } } $block = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12",$current['name2'],decoct($current['stat'][2]), sprintf("%6s ",decoct($current['stat'][4])),sprintf("%6s ",decoct($current['stat'][5])), sprintf("%11s ",decoct($current['stat'][7])),sprintf("%11s ",decoct($current['stat'][9])), " ",$current['type'],"","ustar","00","Unknown","Unknown","","",!empty($path)? $path : "",""); $checksum = 0; for($i = 0; $i < 512; $i++) { $checksum += ord(substr($block,$i,1)); } $checksum = pack("a8",sprintf("%6s ",decoct($checksum))); $block = substr_replace($block,$checksum,148,8); if($current['stat'][7] == 0) { $this->add_data($block); } else if($fp = @fopen($current['name'],"rb")) { $this->add_data($block); while($temp = fread($fp,1048576)) { $this->add_data($temp); } if($current['stat'][7] % 512 > 0) { $temp = ""; for($i = 0; $i < 512 - $current['stat'][7] % 512; $i++) { $temp .= "\0"; } $this->add_data($temp); } fclose($fp); } else { $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; } } $this->add_data(pack("a512","")); chdir($pwd); return 1; } function extract_files() { $pwd = getcwd(); chdir($this->options['basedir']); if($fp = $this->open_archive()) { if($this->options['inmemory'] == 1) { $this->files = array(); } while($block = fread($fp,512)) { $temp = unpack("a100name/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1type/a100temp/a6magic/a2temp/a32temp/a32temp/a8temp/a8temp/a155prefix/a12temp",$block); $file = array( 'name'=>$temp['prefix'] . $temp['name'], 'stat'=>array( 2=>$temp['mode'], 4=>octdec($temp['uid']), 5=>octdec($temp['gid']), 7=>octdec($temp['size']), 9=>octdec($temp['mtime']), ), 'checksum'=>octdec($temp['checksum']), 'type'=>$temp['type'], 'magic'=>$temp['magic'], ); if($file['checksum'] == 0x00000000) { break; } else if($file['magic'] != "ustar") { $this->error[] = "This script does not support extracting this type of tar file."; break; } $block = substr_replace($block," ",148,8); $checksum = 0; for($i = 0; $i < 512; $i++) { $checksum += ord(substr($block,$i,1)); } if($file['checksum'] != $checksum) { $this->error[] = "Could not extract from {$this->options['name']}, it is corrupt."; } if($this->options['inmemory'] == 1) { $file['data'] = fread($fp,$file['stat'][7]); fread($fp,(512 - $file['stat'][7] % 512) == 512? 0 : (512 - $file['stat'][7] % 512)); unset($file['checksum'],$file['magic']); $this->files[] = $file; } else { if($file['type'] == 5) { if(!is_dir($file['name'])) { mkdir($file['name'],0777); //mkdir($file['name'],$file['stat'][2]); //chown($file['name'],$file['stat'][4]); //chgrp($file['name'],$file['stat'][5]); } } else if($this->options['overwrite'] == 0 && file_exists($file['name'])) { $this->error[] = "{$file['name']} already exists."; } else if($new = @fopen($file['name'],"wb")) { fwrite($new,fread($fp,$file['stat'][7])); fread($fp,(512 - $file['stat'][7] % 512) == 512? 0 : (512 - $file['stat'][7] % 512)); fclose($new); chmod($file['name'],0666); //chmod($file['name'],$file['stat'][2]); //chown($file['name'],$file['stat'][4]); //chgrp($file['name'],$file['stat'][5]); } else { $this->error[] = "Could not open {$file['name']} for writing."; } } unset($file); } } else { $this->error[] = "Could not open file {$this->options['name']}"; } chdir($pwd); } function open_archive() { return @fopen($this->options['name'],"rb"); } } class gzip_file extends tar_file { function gzip_file($name) { $this->tar_file($name); $this->options['type'] = "gzip"; } function create_gzip() { if($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if($fp = gzopen($this->options['name'],"wb{$this->options['level']}")) { fseek($this->archive,0); while($temp = fread($this->archive,1048576)) { gzwrite($fp,$temp); } gzclose($fp); chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else { $this->archive = gzencode($this->archive,$this->options['level']); } return 1; } function open_archive() { return @gzopen($this->options['name'],"rb"); } } class bzip_file extends tar_file { function bzip_file($name) { $this->tar_file($name); $this->options['type'] = "bzip"; } function create_bzip() { if($this->options['inmemory'] == 0) { $pwd = getcwd(); chdir($this->options['basedir']); if($fp = bzopen($this->options['name'],"wb")) { fseek($this->archive,0); while($temp = fread($this->archive,1048576)) { bzwrite($fp,$temp); } bzclose($fp); chdir($pwd); } else { $this->error[] = "Could not open {$this->options['name']} for writing."; chdir($pwd); return 0; } } else { $this->archive = bzcompress($this->archive,$this->options['level']); } return 1; } function open_archive() { return @bzopen($this->options['name'],"rb"); } } class zip_file extends archive { function zip_file($name) { $this->archive($name); $this->options['type'] = "zip"; } function create_zip() { $files = 0; $offset = 0; $central = ""; if(!empty($this->options['sfx'])) { if($fp = @fopen($this->options['sfx'],"rb")) { $temp = fread($fp,filesize($this->options['sfx'])); fclose($fp); $this->add_data($temp); $offset += strlen($temp); unset($temp); } else { $this->error[] = "Could not open sfx module from {$this->options['sfx']}."; } } $pwd = getcwd(); chdir($this->options['basedir']); foreach($this->files as $current) { if($current['name'] == $this->options['name']) { continue; } $translate = array('Ç'=>pack("C",128),'ü'=>pack("C",129),'é'=>pack("C",130),'â'=>pack("C",131),'ä'=>pack("C",132), 'à'=>pack("C",133),'å'=>pack("C",134),'ç'=>pack("C",135),'ê'=>pack("C",136),'ë'=>pack("C",137), 'è'=>pack("C",138),'ï'=>pack("C",139),'î'=>pack("C",140),'ì'=>pack("C",141),'Ä'=>pack("C",142), 'Å'=>pack("C",143),'É'=>pack("C",144),'æ'=>pack("C",145),'Æ'=>pack("C",146),'ô'=>pack("C",147), 'ö'=>pack("C",148),'ò'=>pack("C",149),'û'=>pack("C",150),'ù'=>pack("C",151),'_'=>pack("C",152), 'Ö'=>pack("C",153),'Ü'=>pack("C",154),'£'=>pack("C",156),'¥'=>pack("C",157),'_'=>pack("C",158), 'ƒ'=>pack("C",159),'á'=>pack("C",160),'í'=>pack("C",161),'ó'=>pack("C",162),'ú'=>pack("C",163), 'ñ'=>pack("C",164),'Ñ'=>pack("C",165)); $current['name2'] = strtr($current['name2'],$translate); $timedate = explode(" ",date("Y n j G i s",$current['stat'][9])); $timedate = ($timedate[0] - 1980 << 25) | ($timedate[1] << 21) | ($timedate[2] << 16) | ($timedate[3] << 11) | ($timedate[4] << 5) | ($timedate[5]); $block = pack("VvvvV",0x04034b50,0x000A,0x0000,(isset($current['method']) || $this->options['method'] == 0)? 0x0000 : 0x0008,$timedate); if($current['stat'][7] == 0 && $current['type'] == 5) { $block .= pack("VVVvv",0x00000000,0x00000000,0x00000000,strlen($current['name2']) + 1,0x0000); $block .= $current['name2'] . "/"; $this->add_data($block); $central .= pack("VvvvvVVVVvvvvvVV",0x02014b50,0x0014,$this->options['method'] == 0? 0x0000 : 0x000A,0x0000, (isset($current['method']) || $this->options['method'] == 0)? 0x0000 : 0x0008,$timedate, 0x00000000,0x00000000,0x00000000,strlen($current['name2']) + 1,0x0000,0x0000,0x0000,0x0000,$current['type'] == 5? 0x00000010 : 0x00000000,$offset); $central .= $current['name2'] . "/"; $files++; $offset += (31 + strlen($current['name2'])); } else if($current['stat'][7] == 0) { $block .= pack("VVVvv",0x00000000,0x00000000,0x00000000,strlen($current['name2']),0x0000); $block .= $current['name2']; $this->add_data($block); $central .= pack("VvvvvVVVVvvvvvVV",0x02014b50,0x0014,$this->options['method'] == 0? 0x0000 : 0x000A,0x0000, (isset($current['method']) || $this->options['method'] == 0)? 0x0000 : 0x0008,$timedate, 0x00000000,0x00000000,0x00000000,strlen($current['name2']),0x0000,0x0000,0x0000,0x0000,$current['type'] == 5? 0x00000010 : 0x00000000,$offset); $central .= $current['name2']; $files++; $offset += (30 + strlen($current['name2'])); } else if($fp = @fopen($current['name'],"rb")) { $temp = fread($fp,$current['stat'][7]); fclose($fp); $crc32 = crc32($temp); if(!isset($current['method']) && $this->options['method'] == 1) { $temp = gzcompress($temp,$this->options['level']); $size = strlen($temp) - 6; $temp = substr($temp,2,$size); } else { $size = strlen($temp); } $block .= pack("VVVvv",$crc32,$size,$current['stat'][7],strlen($current['name2']),0x0000); $block .= $current['name2']; $this->add_data($block); $this->add_data($temp); unset($temp); $central .= pack("VvvvvVVVVvvvvvVV",0x02014b50,0x0014,$this->options['method'] == 0? 0x0000 : 0x000A,0x0000, (isset($current['method']) || $this->options['method'] == 0)? 0x0000 : 0x0008,$timedate, $crc32,$size,$current['stat'][7],strlen($current['name2']),0x0000,0x0000,0x0000,0x0000,0x00000000,$offset); $central .= $current['name2']; $files++; $offset += (30 + strlen($current['name2']) + $size); } else { $this->error[] = "Could not open file {$current['name']} for reading. It was not added."; } } $this->add_data($central); $this->add_data(pack("VvvvvVVv",0x06054b50,0x0000,0x0000,$files,$files,strlen($central),$offset, !empty($this->options['comment'])? strlen($this->options['comment']) : 0x0000)); if(!empty($this->options['comment'])) { $this->add_data($this->options['comment']); } chdir($pwd); return 1; } } // +-------------------------------------------------- // | THE END // +-------------------------------------------------- ?>