/**
* file manager platform
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
$session->gc();
require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
if(CONFIG_LOAD_DOC_LATTER)
{
$fileList = array();
$folderInfo = array('path'=>getCurrentFolderPath());
}else
{
require_once(CLASS_MANAGER);


$manager = new manager();
$manager->setSessionAction($sessionAction);
$fileList = $manager->getFileList();
$folderInfo = $manager->getFolderInfo();
}
if(CONFIG_SYS_THUMBNAIL_VIEW_ENABLE)
{
$views = array(
'detail'=>LBL_BTN_VIEW_DETAILS,
'thumbnail'=>LBL_BTN_VIEW_THUMBNAIL,
);
}else
{
$views = array(
'detail'=>LBL_BTN_VIEW_DETAILS,
);
}

if(!empty($_GET['view']))
{
switch($_GET['view'])
{
case 'detail':
case 'thumbnail':
$view = $_GET['view'];
break;
default:
$view = CONFIG_DEFAULT_VIEW;
}
}else
{
$view = CONFIG_DEFAULT_VIEW;
}


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" debug="true">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Ajax File Manager<title>Ajax File Manager</title>
<script type="text/javascript" src="jscripts/ajaxfilemanager_c.js"></script>
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
<script type="text/javascript" src="jscripts/form.js"></script>
<script type="text/javascript" src="jscripts/select.js"></script>
<script type="text/javascript" src="jscripts/thickbox.js"></script>
<script type="text/javascript" src="jscripts/calendar.js"></script>
<script type="text/javascript" src="jscripts/contextmenu.js"></script>
<script type="text/javascript" src="jscripts/media.js"></script>
<script type="text/javascript" src="jscripts/ajaxfileupload.js"></script>
<script type="text/javascript" src="jscripts/ajaxfilemanager.js"></script>-->
<script type="text/javascript">
var globalSettings = {'upload_init':false};
var queryString = ' echo makeQueryString(array('path')); ';
var paths = {'root':' echo addTrailingSlash(backslashToSlash(CONFIG_SYS_ROOT_PATH)); ', 'root_title':' echo LBL_FOLDER_ROOT; '};
var parentFolder = {};
var urls = {
'upload':' echo CONFIG_URL_UPLOAD; ',
'preview':' echo CONFIG_URL_PREVIEW; ',
'cut':' echo CONFIG_URL_CUT; ',
'copy':' echo CONFIG_URL_COPY; ',
'paste':' echo CONFIG_URL_FILE_PASTE; ',
'delete':' echo CONFIG_URL_DELETE; ',
'rename':' echo CONFIG_URL_SAVE_NAME; ',
'thumbnail':' echo CONFIG_URL_IMG_THUMBNAIL; ',
'create_folder':' echo CONFIG_URL_CREATE_FOLDER; ',
'text_editor':' echo CONFIG_URL_TEXT_EDITOR; ',
'image_editor':' echo CONFIG_URL_IMAGE_EDITOR; ',
'download':' echo CONFIG_URL_DOWNLOAD; ',
'present':' echo getCurrentUrl(); ',
'home':' echo CONFIG_URL_HOME; ',
'view':' echo CONFIG_URL_LIST_LISTING; '
};
var permits = {'del': echo (CONFIG_OPTIONS_DELETE?1:0); , 'cut': echo (CONFIG_OPTIONS_CUT?'1':'0'); , 'copy': echo (CONFIG_OPTIONS_COPY?1:0); , 'newfolder': echo (CONFIG_OPTIONS_NEWFOLDER?1:0); , 'rename': echo (CONFIG_OPTIONS_RENAME?1:0); , 'upload': echo (CONFIG_OPTIONS_UPLOAD?1:0); , 'edit': echo (CONFIG_OPTIONS_EDITABLE?1:0); , 'view_only': echo (CONFIG_SYS_VIEW_ONLY?1:0); };
var currentFolder = {};
var warningDelete = ' echo WARNING_DELETE; ';
var newFile = {'num':1, 'label':' echo FILE_LABEL_SELECT; ', 'upload':' echo FILE_LBL_UPLOAD; '};
var counts = {'new_file':1};
var thickbox = {'width':' echo CONFIG_THICKBOX_MAX_WIDTH; ',
'height':' echo CONFIG_THICKBOX_MAX_HEIGHT; ',
'next':' echo THICKBOX_NEXT; ',
'previous':' echo THICKBOX_PREVIOUS; ',
'close':' echo THICKBOX_CLOSE; '

};

var tb_pathToImage = "theme/ echo CONFIG_THEME_NAME; /images/loadingAnimation.gif";
var msgInvalidFolderName = ' echo ERR_FOLDER_FORMAT; ';
var msgInvalidFileName = ' echo ERR_FILE_NAME_FORMAT; ';
var msgInvalidExt = ' echo ERR_FILE_TYPE_NOT_ALLOWED; ';
var msgNotPreview = ' echo PREVIEW_NOT_PREVIEW; ';

var warningCutPaste = ' echo WARNING_CUT_PASTE; ';
var warningCopyPaste = ' echo WARNING_COPY_PASTE; ';
var warningDel = ' echo WARNING_DELETE; ';
var warningNotDocSelected = ' echo ERR_NOT_DOC_SELECTED; ';
var noFileSelected = ' echo ERR_NOT_FILE_SELECTED; ';
var unselectAllText = ' echo TIP_UNSELECT_ALL; ';
var selectAllText = ' echo TIP_SELECT_ALL; ';
var action = ' echo $sessionAction->getAction(); ';
var numFiles = echo $sessionAction->count(); ;
var warningCloseWindow = ' echo WARING_WINDOW_CLOSE; ';
var numRows = 0;

var wordCloseWindow = ' echo LBL_ACTION_CLOSE; ';
var wordPreviewClick = ' echo LBL_CLICK_PREVIEW; ';

var searchRequired = false;
var supporedPreviewExts = ' echo CONFIG_VIEWABLE_VALID_EXTS; ';
var supportedUploadExts = ' echo CONFIG_UPLOAD_VALID_EXTS; '
var elementId = echo (!empty($_GET['elementId'])?"'" . $_GET['elementId'] . "'":'null'); ;
var files = {};
$(document).ready(
function()
{
jQuery(document).bind('keypress', function(event) {
var code=event.charCode || event.keyCode;
if(code && code == 13) {// if enter is pressed
event.preventDefault(); //prevent browser from following the actual href
};
});
if(typeof(cancelSelectFile) != 'undefined')
{
$('#linkClose').show();
}
$('input[@name=view]').each(
function()
{

if(this.value == ' echo $view; ')
{
this.checked = true;
}else
{
this.checked = false;
}
}
);

popUpCal.clearText = ' echo CALENDAR_CLEAR; ';
popUpCal.closeText = ' echo CALENDAR_CLOSE; ';
popUpCal.prevText = ' echo CALENDAR_PREVIOUS; ';
popUpCal.nextText = ' echo CALENDAR_NEXT; ';
popUpCal.currentText = ' echo CALENDAR_CURRENT; ';
popUpCal.buttonImageOnly = true;
popUpCal.dayNames = new Array(' echo CALENDAR_SUN; ',' echo CALENDAR_MON; ',' echo CALENDAR_TUE; ',' echo CALENDAR_WED; ',' echo CALENDAR_THU; ',' echo CALENDAR_FRI; ',' echo CALENDAR_SAT; ');
popUpCal.monthNames = new Array(' echo CALENDAR_JAN; ',' echo CALENDAR_FEB; ',' echo CALENDAR_MAR; ',' echo CALENDAR_APR; ',' echo CALENDAR_MAY; ',' echo CALENDAR_JUN; ',' echo CALENDAR_JUL; ',' echo CALENDAR_AUG; ',' echo CALENDAR_SEP; ',' echo CALENDAR_OCT; ',' echo CALENDAR_NOV; ',' echo CALENDAR_DEC; ');
popUpCal.dateFormat = 'YMD-';
$('.inputMtime').calendar({autoPopUp:'both', buttonImage:'theme/ echo CONFIG_THEME_NAME; /images/date_picker.png'});


initAfterListingLoaded();
//addMoreFile();

} );


</script>

if(file_exists(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'jscripts' . DIRECTORY_SEPARATOR . 'for_' . CONFIG_EDITOR_NAME . ".js")
{

<script type="text/javascript" src="jscripts/ echo 'for_' . CONFIG_EDITOR_NAME . '.js'; "></script>

}

<link rel="stylesheet" type="text/css" href="theme/ echo CONFIG_THEME_NAME; /css/ echo CONFIG_EDITOR_NAME; .css" />
<link rel="stylesheet" type="text/css" href="theme/ echo CONFIG_THEME_NAME; /css/jquery-calendar.css" />
<link rel="stylesheet" href="theme/ echo CONFIG_THEME_NAME; /css/thickbox.css" type="text/css" media="screen" />
<!--[if IE 6]>
<link href="theme/ echo CONFIG_THEME_NAME; /css/ie6.css" type="text/css" rel="Stylesheet" media="screen">
<![endif]-->

<body style="background-color:#E8E8E8;">
<div id="wrapper">
<div id="header">
<dl id="currentFolderInfo">
<dt> echo LBL_CURRENT_FOLDER_PATH; </dt>
<dd id="currentFolderPath"> echo $folderInfo['path']; </dd>
</dl>
<div id="viewList">


<label> echo LBL_BTN_VIEW_OPTIONS; </label>

foreach($views as $k=>$v)
{

echo $v; &nbsp;&nbsp;


}
</div>
<ul id="actionHeader">
<li><a href="#" id="actionRefresh" onclick="return windowRefresh();"><span> echo LBL_ACTION_REFRESH; </span></a></li>
<li><a href="#" id="actionSelectAll" class="check_all" onclick="return checkAll(this);"><span> echo LBL_ACTION_SELECT_ALL; </span></a></li>

if(CONFIG_OPTIONS_DELETE)
{

<li><a href="#" id="actionDelete" onclick="return deleteDocuments();"><span> echo LBL_ACTION_DELETE; </span></a></li>

}


if(CONFIG_OPTIONS_CUT)
{

<li><a href="#" id="actionCut" onclick="return cutDocuments(' echo ERR_NOT_DOC_SELECTED_FOR_CUT; ');"><span> echo LBL_ACTION_CUT; </span></a></li>

}


if(CONFIG_OPTIONS_COPY)
{

<li><a href="#" id="actionCopy" onclick="return copyDocuments(' echo ERR_NOT_DOC_SELECTED_FOR_COPY; ');"><span> echo LBL_ACTION_COPY; </span></a></li>

}


if(CONFIG_OPTIONS_CUT || CONFIG_OPTIONS_COPY)
{

<li><a href="#" id="actionPaste" onclick="return pasteDocuments(' echo ERR_NOT_DOC_SELECTED_FOR_PASTE; ');"><span> echo LBL_ACTION_PASTE; </span></a></li>

}



if(CONFIG_OPTIONS_NEWFOLDER)
{

<li><a id="actionNewFolder" href="#" onclick="return newFolderWin(this);"><span> echo LBL_BTN_NEW_FOLDER; </span></a></li>

}


if(CONFIG_OPTIONS_UPLOAD)
{

<li><a id="actionUpload" href="#" onclick="return uploadFileWin(this);"><span> echo LBL_BTN_UPLOAD; </span></a></li>

}







<!-- <li><a href="#" id="actionClose" onclick="closeWindow(' echo IMG_WARING_WIN_CLOSE; ');"> echo IMG_BTN_CLOSE; </a></li>-->
<li><a href="#" class="thickbox" id="actionInfo" onclick="return infoWin(this);"><span>Info</span></a></li>
<!-- thest functions will be added in the near future
<li ><a href="#" id="actionZip"><span>Zip</span></a><li>
<li ><a href="#" id="actionUnzip"><span>Unzip</span></a><li>-->
</ul>
<select name="selectedDoc[]" id="selectedDoc" style="display:none;" multiple="multiple"></select>

</div>

<div id="body">


<div id="rightCol">

if(CONFIG_LOAD_DOC_LATTER )
{
$currentPath = getCurrentFolderPath();

<script type="text/javascript">
parentFolder = {path:' echo getParentFolderPath($currentPath); '};
currentFolder = {'friendly_path':' echo transformFilePath($currentPath); '};
$(document).ready(
function()
{
var url = getUrl('view', false, false, false);
$('#rightCol').empty();
ajaxStart('#rightCol');

$('#rightCol').load(url,
{},
function(){
ajaxStop('#rightCol img.ajaxLoadingImg');
urls.present = getUrl('home', true, true);
initAfterListingLoaded();
});
}
);
</script>

}else
{
include_once(CONFIG_URL_LIST_LISTING);
}

</div>

<div id="leftCol">



<fieldset id="folderFieldSet" >

<legend> echo LBL_FOLDER_INFO; </legend>
<table cellpadding="0" cellspacing="0" class="tableSummary" id="folderInfo">
<tbody>

<th> echo LBL_FOLDER_PATH; </th>
<td colspan="3" id="folderPath"> echo transformFilePath($folderInfo['path']);


<th> echo LBL_FOLDER_CREATED; </th>
<td colspan="3" id="folderCtime"> echo (!empty($folderInfo['ctime'])?date(DATE_TIME_FORMAT,$folderInfo['ctime']):'&nbsp;') ;



<th> echo LBL_FOLDER_MODIFIED; </th>
<td colspan="3" id="folderMtime"> echo (!empty($folderInfo['mtime'])?date(DATE_TIME_FORMAT,$folderInfo['mtime']):'&nbsp;');


<th> echo LBL_FOLDER_SUDDIR; </th>
<td colspan="3" id="folderSubdir"> echo (isset($folderInfo['subdir'])?$folderInfo['subdir']:"&nbsp;");



<th> echo LBL_FOLDER_FIELS; </th>
<td colspan="3" id="folderFile"> echo (isset($folderInfo['file'])?$folderInfo['file']:'&nbsp;');



<th> echo LBL_FOLDER_WRITABLE; </th>
<td id="folderWritable"><span class=" echo (isset($folderInfo['is_readable'])?($folderInfo['is_readable']?'flagYes':'flagNo'):'&nbsp;'); ">&nbsp;</span>
<th> echo LBL_FOLDER_READABLE; </th>
<td id="folderReadable"><span class=" echo (isset($folderInfo['is_writable'])?($folderInfo['is_writable']?'flagYes':'flagNo'):'&nbsp;'); ">&nbsp;</span>





</tbody>

</fieldset>
<fieldset id="fileFieldSet" style="display:none" >
<legend> echo LBL_FILE_INFO; </legend>
<table cellpadding="0" cellspacing="0" class="tableSummary" id="fileInfo">
<tbody>

<th> echo LBL_FILE_NAME; </th>
<td colspan="3" id="fileName">


<th> echo LBL_FILE_CREATED; </th>
<td colspan="3" id="fileCtime">



<th> echo LBL_FILE_MODIFIED; </th>
<td colspan="3" id="fileMtime">


<th> echo LBL_FILE_SIZE; </th>
<td colspan="3" id="fileSize">



<th> echo LBL_FILE_TYPE; </th>
<td colspan="3" id="fileType">


<th> echo LBL_FILE_WRITABLE; </th>
<td id="fileWritable"><span class="flagYes">&nbsp;</span>
<th> echo LBL_FILE_READABLE; </th>
<td id="fileReadable"><span class="flagNo">&nbsp;</span>


</tbody>


<p class="searchButtons" id="returnCurrentUrl">

<span class="right" id="linkSelect">

</span>

</p>
</fieldset>



<fieldset class="boxSearch">
<legend> echo LBL_SEARCH; </legend>



<table cellpadding="0" cellspacing="0" class="tableSearch">
<tbody>


echo LBL_SEARCH_NAME; <br />




<td >
echo LBL_SEARCH_FOLDER; <br />
<span id="searchFolderContainer">

if(CONFIG_LOAD_DOC_LATTER)
{

<script type="text/javascript">
$(document).ready(
function()
{
ajaxStart('#searchFolderContainer');
$('#searchFolderContainer').load(' echo CONFIG_URL_LOAD_FOLDERS; ');
}
);
</script>

}else
{

<select class="input inputSearch" name="search_folder" id="search_folder">


foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
{

<option value=" echo $v; " echo (removeTrailingSlash(backslashToSlash(($folderInfo['path']))) == removeTrailingSlash(backslashToSlash(($v)))?' selected="selected"':''); > echo shortenFileName($k, 30); </option>

}


</select>

}
</span>




echo LBL_SEARCH_MTIME; <br />

<span class="leftToRightArrow">&nbsp;</span>





echo LBL_SEARCH_RECURSIVELY; &nbsp;&nbsp;
echo LBL_RECURSIVELY_YES;
echo LBL_RECURSIVELY_NO;


</tbody>





<p class="searchButtons">
<span class="left" id="linkClose" style="display:none">

</span>
<span class="right" id="linkSearch">

</span>

</p>
</fieldset>

</div>

<div class="clear"></div>
</div>


</div>
<div class="clear"></div>



<div id="ajaxLoading" style="display:none"><img class="ajaxLoadingImg" src="theme/ echo CONFIG_THEME_NAME; /images/ajaxLoading.gif" /></div>
<div id="winUpload" style="display:none">
<div class="jqmContainer">
<div class="jqmHeader">
<a href="#" onclick="tb_remove();"> echo LBL_ACTION_CLOSE; </a>
</div>
<div class="jqmBody">

<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>

<th colspan="2"> echo FILE_FORM_TITLE; <a class="action" href="#" title=" echo FILE_LBL_MORE; " onclick="return addMoreFile();"><span class="addMore">&nbsp;</span></a></th>

</thead>
<tbody id="fileUploadBody">
<tr style="display:none">
<th><label> echo FILE_LABEL_SELECT; </label></th>
<a href="#" class="action" title="Cancel" style="display:none" ><span class="cancel">&nbsp;</span></a> <span class="uploadProcessing" style="display:none">&nbsp;<span>

</tbody>
<tfoot>

<th>&nbsp;</th>


</tfoot>


</div>

</div>
</div>
<div id="winNewFolder" style="display:none">
<div class="jqmContainer">
<div class="jqmHeader">
<a href="#" onclick="tb_remove();"> echo LBL_ACTION_CLOSE; </a>
</div>
<div class="jqmBody">


<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>

<th colspan="2"> echo FOLDER_FORM_TITLE; </th>

</thead>
<tbody>

<th><label> echo FOLDER_LBL_TITLE; </label></th>




</tbody>
<tfoot>

<th>&nbsp;</th>


</tfoot>


</div>



</div>
</div>
<div id="winPlay" style="display:none">
<div class="jqmContainer">
<div class="jqmHeader">
<a href="#" onclick="closeWinPlay();"> echo LBL_ACTION_CLOSE; </a>
</div>
<div class="jqmBody">
<div id="playGround"></div>
</div>
</div>
</div>
<div id="winRename" style="display:none">
<div class="jqmContainer">
<div class="jqmHeader">
<a href="#" onclick="tb_remove();"> echo LBL_ACTION_CLOSE; </a>
</div>
<div class="jqmBody">



<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>

<th colspan="2"> echo RENAME_FORM_TITLE; </th>

</thead>
<tbody>

<th><label> echo RENAME_NEW_NAME; </label></th>



</tbody>
<tfoot>

<th>&nbsp;</th>


</tfoot>


</div>

</div>

</div>
<div id="winInfo" style="display:none">
<div class="jqmContainer">
<div class="jqmHeader">
<a href="#" onclick="tb_remove();"> echo LBL_ACTION_CLOSE; </a>
</div>
<div class="jqmBody">
<table class="tableInfo" cellpadding="0" cellspacing="0">
<tbody>

<th nowrap>
<label>Author:</label>
</th>

<a href="&#109;a&#105;l&#116;&#111;:&#99;&#97;&#105;&#108;&#111;&#110;&#103;&#113;&#117;&#110;&#64;&#121;&#97;&#104;&#111;&#111;&#46;&#99;&#111;&#109;&#46;&#99;&#110;">Logan Cai</a>



<th nowrap>
<label>Template Designer:</label>
</th>

<a href="&#109;a&#105;l&#116;&#111;:&#71;&#97;&#98;&#114;&#105;&#101;&#108;&#64;&#52;&#118;&#46;&#99;&#111;&#109;&#46;&#98;&#114;">Gabriel</a>



<th nowrap>
<label>Official Website:</label>
</th>

<a href="http://www.phpletter.com">http://www.phpletter.com</a>



<th nowrap>
<label>Support Forum:</label>
</th>

<a href="http://www.phpletter.com/forum/">http://www.phpletter.com/forum/</a>



<th nowrap>
<label>&copy;Copyright:</label>
</th>

All copyright declarations in the source must remain unchange. Please contact us if you need to make changes to it, in order to avoid any Legal Issues.


</tbody>

</div>


</div>
</div>
<div id="contextMenu" style="display:none">
<ul>
<li><a href="#" class="contentMenuItem" id="menuSelect"> echo MENU_SELECT; </a></li>
<li><a href="#" class="contentMenuItem" id="menuPreview"> echo MENU_PREVIEW; </a></li>
<li><a href="#" class="contentMenuItem" id="menuDownload"> echo MENU_DOWNLOAD; </a></li>
<li><a href="#" class="contentMenuItem" id="menuRename"> echo MENU_RENAME; </a></li>
<li><a href="#" class="contentMenuItem" id="menuEdit"> echo MENU_EDIT; </a></li>
<li><a href="#" class="contentMenuItem" id="menuCut"> echo MENU_CUT; </a></li>
<li><a href="#" class="contentMenuItem" id="menuCopy"> echo MENU_COPY; </a></li>
<li><a href="#" class="contentMenuItem" id="menuPaste"> echo MENU_PASTE; </a></li>
<li><a href="#" class="contentMenuItem" id="menuDelete"> echo MENU_DELETE; </a></li>
<li><a href="#" class="contentMenuItem" id="menuPlay"> echo MENU_PLAY; </a></li>
</ul>
</div>