dialog->all."|*.*","htm;html;txt:".$Language->dialog->document."|*.htm;*.html;*.txt","gif;jpg;png:".$Language->dialog->image."|*.gif;*.jpg;*.png","mov;wmv;avi;mpg;mpeg;mp2;mp3:".$Language->dialog->media."|*.mov;*.wmv;*.avi;mpeg","cgi;php:".$Language->dialog->script."|*.cgi;*.php");if($_REQUEST['typeID']){list($_REQUEST['type'],$name)=split(":",$Filters[$_REQUEST['typeID']]);}foreach($Filters as $val){list($key,$value)=split(":",$val);$select="";$_REQUEST['type']==$key&&$select="selected";$filteroption.="";}if($_REQUEST['start']){ $paths=split("/",$_REQUEST['start']);$cnt=count($paths);for($i=1;$i<$cnt - 1;$i++){ $startDir.="/$paths[$i]";}if(!is_dir($_SERVER['DOCUMENT_ROOT'].$startDir)){ $_REQUEST['start']="";$startDir="";$startFilename="";}else{ $startFilename=$paths[$cnt - 1];}}if($_REQUEST['cmd']=='tree'){ $body.="
";$javascript="$(document).ready(function(){ $('#browser').treeview({persist: 'cookie',cookieId: 'filetreeview'});});";}elseif($_REQUEST['cmd']=='dir'){ $_REQUEST['dir']=="/"&&$_REQUEST['dir']="";$abs=$_SERVER['DOCUMENT_ROOT'].$_REQUEST['dir'];if($_REQUEST['action']=="mkdir"){ $newdir=$_SERVER['DOCUMENT_ROOT'].$_REQUEST['dir']."/".$_REQUEST['name'];if($_REQUEST['mode']==777){mkdir($newdir,0777);}elseif($_REQUEST['mode']==750){mkdir($newdir,0750);}else{mkdir($newdir,0755);}$javascript="parent.listview.location.replace('$scriptname?cmd=tree');";}elseif($_REQUEST['action']=="upload"){if($_FILES['upload']['name']){ $filename=$_FILES['upload']['name'];$filepath="$abs/$filename";move_uploaded_file($_FILES['upload']['tmp_name'],$filepath);chmod($filepath,0644);}}elseif($_REQUEST['action']=="multiupload"){for($i=0;$i<10;$i++){if($_FILES['upload']['name'][$i]){ $filepath="$abs/".$_FILES['upload']['name'][$i];move_uploaded_file($_FILES['upload']['tmp_name'][$i],$filepath);}}}$body="
";$body.=dir_view($_REQUEST['dir']);$body.="
";!$_REQUEST['dir']&&$_REQUEST['dir']='/';$javascript.="parent.document.dialogform.currentdir.value='".$_REQUEST['dir']."';";}else{ $body="
";if($Init['nontree']){ $body.="";}else{ $body.="";}$body.="
dialog->updir."\"onclick=\"updir()\">
dialog->uploads."\">
dialog->fileupload."\"> dialog->newdir."\"onclick=\"mkDir();\">Dir
".$Language->dialog->filename." :  OK
".$Language->dialog->filetype." : Cancel
";$javascript="var fm='".$_REQUEST['fm']."';var f='".$_REQUEST['f']."';var filetype='".$_REQUEST['type']."';var md='".$_REQUEST['m']."';function uploads(){var html='
';for(i=1;i<=10;i++){html +='';}html +='
  1. ".$Language->dialog->comm1."
  2. ".$Language->dialog->comm2."
  3. ".$Language->dialog->comm3."
'+i+'
';document.getElementById('confirmdialog').innerHTML=html;$(function(){ $('#confirmdialog').dialog({title: '".$Language->button->upload."',resizable: false,width: 480,height:520,modal:true,show:'blind',hide:'blind',buttons:{".$Language->button->upload.": function(){ $(this).dialog('close');document.uploadform.dir.value=$('#currentdir').val();document.uploadform.submit();},".$Language->button->cancel.": function(){ $(this).dialog('close');}}});});}function fileupload(){with(document.dialogform){if(upload.value==''){alertdialog('".$Language->caption->error."','".$Language->dialog->selectfile."');return;}target='dirview';cmd.value='dir';dir.value=currentdir.value;action.value='upload';submit();}}function getselectobj(){var rn='';with(dirview.document.dirviewform){var max=objcount.value;for(i=0;i<=max;i++){if(selectfile[i].checked){rn=selectfile[i].value;break;}}}return(rn);}function mkDir(){document.getElementById('confirmdialog').innerHTML='
".$Language->dialog->newdir."
".$Language->dialog->dirname." : 
".$Language->dialog->permission." : 
';$(function(){ $('#confirmdialog').dialog({title: '".$Language->system->caption->newdir."',resizable: false,width: 400,height:200,modal:true,show:'blind',hide:'blind',buttons:{".$Language->button->create.": function(){if(document.actionform.name.value==''){alert('".$Language->system->alert->newdir."');return;}$(this).dialog('close');dirview.location.replace('$scriptname?cmd=dir&dir='+$('#currentdir').val()+'&action=mkdir&name='+document.actionform.name.value+'&mode='+document.actionform.mode.value);},".$Language->button->cancel.": function(){ $(this).dialog('close');}}});});}function selectfilename(file){ $('#filename').val(file);}function diraccess(addr){dirview.location.href='$scriptname?cmd=dir&dir='+addr+'&type='+filetype;}function updir(){var currentdir=$('#currentdir').val();if(currentdir !='/'){var Split=currentdir.split('/');var cnt=Split.length - 1;var newdir='';for(i=1;isystem->caption->error."','".$Language->system->alert->filename."');return;}var path=$('#currentdir').val();if($('#filename').val()){if(path=='/')path='';path +='/'+$('#filename').val();}";if($_REQUEST['fm']&&$_REQUEST['f']){ $javascript.="opener.document.".$_REQUEST['fm'].".".$_REQUEST['f'].".value=path;";}if($_REQUEST['func']){ $javascript.="opener.".$_REQUEST['func']."(path);";}$javascript.="window.close();}function returnfilename(){if($('#filename').val()==''){alertdialog('".$Language->system->caption->error."','".$Language->system->alert->filename."');return;}var path=$('#currentdir').val();if(path=='/')path='';path +='/'+$('#filename').val();opener.".$_REQUEST['func']."(path);window.close();}function popup(img,w,h){pw=w;ph=h;ww=w;if(ww<320)ww=320;if(ww>800)ww=800;if(w>800)w=800;document.getElementById('confirmdialog').innerHTML='';$(function(){ $('#confirmdialog').dialog({title: '".$Language->system->caption->confirm."('+pw+'px,'+ph+'px)',resizable: true,width: ww + 32,height: h + 48,maxWidth: 800,minWidth: 320,modal: false});});}diraccess('$startDir');";}header("Content-type:text/html;charset=utf-8;");$html="trycms v7 file dialog
$body";$html=str_replace("\t","",$html);$html=str_replace("\n","",$html);$html=str_replace("><","><",$html);echo $html;exit;function tree_view($dir=""){global $body,$Init,$System,$nonDirs;$nonDirs['inc']=true;$abs=$_SERVER['DOCUMENT_ROOT']."/$dir";$abs=preg_replace("/\/$/","",$abs);$child=false;if($dh=opendir($abs)){while(($file=readdir($dh))!==false){if(!preg_match("/^\./",$file)){ $type=filetype("$abs/$file");if($type=="dir"){ !$nonDirs[$file]&&$Dir[]=$file;}}}closedir($dh);}if($count=count($Dir)){ $child=true;$body.="";$body.="";}}return($child);}function dir_view($dir){global $Init,$System,$nonDirs;$nonDirs['inc']=true;$cols=4;$abs=$_SERVER['DOCUMENT_ROOT']."/$dir";$abs=preg_replace("/\/$/","",$abs);$Types=split(";",$_REQUEST['type']);if($dh=opendir($abs)){while(($file=readdir($dh))!==false){if(!preg_match("/^\./",$file)){ $type=filetype("$abs/$file");if($type=="dir"){ !$nonDirs[$file]&&$Dir[]=$file;}elseif($type=="file"&&!preg_match("/\.inc$/",$file)){list($fname,$ext)=split("\.",$file);if(!$_REQUEST['type']||in_array($ext,$Types)){ $Files[]=$file;}}}}closedir($dh);if(count($Dir)){sort($Dir);$Allfiles=$Dir;}if(count($Files)){sort($Files);if(count($Ext)){ $Files=preg_grep("/$mt$/i",$Files);}foreach($Files as $val){ $Allfiles[]=$val;}}}$html="";$col=1;$obj=-1;$cellwidth=int(100 / $cols);if(count($Allfiles)){foreach($Allfiles as $val){ $fl=$val;if($col>$cols){ $col=1;$html.="\n";}$filepath="$abs/$val";$date=date("Y/m/d",filemtime($filepath));$size=filesize($filepath);$mode=substr(sprintf('%o',fileperms($filepath)),-3);$ft="";if(is_file($filepath)){ $filetype='file';if(preg_match("/\.gif$/i",$val)||preg_match("/\.jpg$/i",$val)||preg_match("/\.jpeg$/i",$val)||preg_match("/\.bmp$/i",$val)||preg_match("/\.png$/i",$val)){list($width,$height,$type,$attr)=getimagesize($filepath);$w=$width;$h=$height;if($width>80||$height>80){if($height>$width){ $ritu=$width / $height;$height=80;$width=80 * $ritu;}else{ $ritu=$height / $width;$width=80;$height=80 * $ritu;}}$icon="$dir/$val\"width=\"$width\"height=\"$height";$ft="image";}else{if(preg_match("/\.htm/i",$val)||preg_match("/\.shtm/i",$val)){ $icon="images/exp/htmlfile.png";}elseif(preg_match("/\.doc$/i",$val)){ $icon="images/exp/word.png";}elseif(preg_match("/\.pdf$/i",$val)){ $icon="images/exp/pdf.png";}elseif(preg_match("/\.js$/i",$val)){ $icon="images/exp/js.png";}elseif(preg_match("/\.css$/i",$val)){ $icon="images/exp/css.png";}elseif(preg_match("/\.ini$/i",$val)){ $icon="images/exp/ini.png";}elseif(preg_match("/\.fla$/i",$val)||preg_match("/\.swf$/i",$val)){ $icon="images/exp/flash.png";}elseif(preg_match("/\.csv$/i",$val)||preg_match("/\.xls$/i",$val)||preg_match("/\.xlt$/i",$val)||preg_match("/\.xlw$/i",$val)){ $icon="images/exp/excel.png";}elseif(preg_match("/\.inc$/i",$val)||preg_match("/\.php$/i",$val)){ $icon="images/exp/php.png";}elseif(preg_match("/\.cgi$/i",$val)||preg_match("/\.pl$/i",$val)){ $icon="images/exp/cgi.png";}elseif(preg_match("/\.zip/i",$val)){ $icon="images/exp/zip.png";$ft="zip";}elseif(preg_match("/\.lzh/i",$val)){ $icon="images/exp/lzh.png";$ft="lzh";}elseif(preg_match("/\.mov/i",$val)||preg_match("/\.mpg/i",$val)||preg_match("/\.mpeg/i",$val)||preg_match("/\.mid/i",$val)||preg_match("/\.wav/i",$val)||preg_match("/\.au$/i",$val)){ $icon="images/exp/movie.ong";}elseif(preg_match("/\.txt$/i",$val)){ $icon="images/exp/textfile.png";}else{ $icon="images/exp/bin.png";}}}else{if($val=="trycms"){ $filetype="sys";$icon="images/exp/folder_sys.png";}else{ $filetype="dir";$icon="images/exp/folder.png";}}if($filetype=="dir"||$filetype=="sys"){ $absolutelypath=str_replace("../","/","$dir$val");$href="javascript:parent.diraccess('$dir/$val')";}else{if($ft=="image"){ $key=str_replace(".","-",$val);$key=preg_replace("/[\ \(\)]/","_",$key);$href="$dir/$val";$href="javascript:parent.popup('$dir/$val',$w,$h);parent.selectfilename('$val');";}else{ $href="javascript:parent.selectfilename('$val');";}}if($filetype=='file'){if($ft=="image"){ $size="
$w"."x".$h."px";}else{ $size="
$size Byte";}}else{ $size="";}$html.="";$obj++;$col++;}}$html.="

$val
$date$size
";return($html);}?>