/ZengcodeLive V1.0/files/FckAjaxFileManage/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php

https://github.com/zengcode/ZengCode-PHP-Framework · PHP · 251 lines · 225 code · 17 blank · 9 comment · 4 complexity · 5a25392cb5b5798df395d353b94576a9 MD5 · raw file

  1. <?php
  2. session_start();
  3. /**
  4. * file manager platform
  5. * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
  6. * @link www.phpletter.com
  7. * @since 22/May/2007
  8. *
  9. */
  10. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
  11. $session->gc();
  12. require_once(CLASS_MANAGER);
  13. define('URL_AJAX_FILE_MANAGER', CONFIG_URL_HOME);
  14. require_once(CLASS_SESSION_ACTION);
  15. $sessionAction = new SessionAction();
  16. //displayArray($sessionAction->get());
  17. require_once(DIR_AJAX_INC . "class.manager.php");
  18. $manager = new manager();
  19. $manager->setSessionAction($sessionAction);
  20. $fileList = $manager->getFileList();
  21. $folderInfo = $manager->getFolderInfo();
  22. ?>
  23. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  27. <meta name="author" content="Logan Cai" />
  28. <meta name="website" content="http://www.phpletter.com" />
  29. <script type="text/javascript" src="jscripts/ajaxfilemanager_compressed.js"></script>
  30. <script type="text/javascript" src="jscripts/file_manager_general.js"></script>
  31. <!--
  32. <script type="text/javascript" src="jscripts/jquery.js"></script>
  33. <script type="text/javascript" src="jscripts/form.js"></script>
  34. <script type="text/javascript" src="jscripts/select.js"></script>
  35. <script type="text/javascript" src="jscripts/thickbox.js"></script>
  36. <script type="text/javascript" src="jscripts/jeditable.js"></script>
  37. <script type="text/javascript" src="jscripts/media.js"></script>
  38. <script type="text/javascript" src="jscripts/file_manager_general.js"></script>
  39. -->
  40. <script type="text/javascript" src="jscripts/<?php echo 'for_' . CONFIG_EDITOR_NAME . '.js'; ?>"></script>
  41. <script type="text/javascript">
  42. function enableEditable()
  43. {
  44. $("#fileList tr[@id^=row] td.left").editable("<?php echo appendQueryString(CONFIG_URL_SAVE_NAME, makeQueryString(array('path'))); ?>",
  45. {
  46. submit : 'Save',
  47. width : '150',
  48. height : '14',
  49. loadtype : 'POST',
  50. event : 'dblclick',
  51. indicator : "<img src='theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif'>",
  52. tooltip : '<?php echo TIP_DOC_RENAME; ?>'
  53. }
  54. );
  55. }
  56. var tb_pathToImage = "theme/<?php echo CONFIG_THEME_NAME; ?>/images/loadingAnimation.gif";
  57. var urlPreview = '<?php echo appendQueryString(CONFIG_URL_PREVIEW, makeQueryString(array('path'))); ?>';
  58. var msgNotPreview = '<?php echo PREVIEW_NOT_PREVIEW; ?>';
  59. var urlCut = '<?php echo appendQueryString(CONFIG_URL_CUT, makeQueryString(array('path'))); ?>';
  60. var urlCopy = '<?php echo appendQueryString(CONFIG_URL_COPY, makeQueryString(array('path'))); ?>';
  61. var urlPaste = '<?php echo appendQueryString(CONFIG_URL_PASTE, makeQueryString(array('path'))); ?>';
  62. var warningCutPaste = '<?php echo WARNING_CUT_PASTE; ?>';
  63. var warningCopyPaste = '<?php echo WARNING_COPY_PASTE; ?>';
  64. var urlDelete = '<?php echo appendQueryString(CONFIG_URL_DELETE, makeQueryString(array('path'))); ?>';
  65. var action = '<?php echo $sessionAction->getAction(); ?>';
  66. var numFiles = <?php echo $sessionAction->count(); ?>;
  67. var urlRename = '<?php echo appendQueryString(CONFIG_URL_SAVE_NAME, makeQueryString(array('path'))); ?>';
  68. var warningCloseWindow = '<?php echo WARING_WINDOW_CLOSE; ?>';
  69. var numRows = <?php echo (($folderInfo['subdir'] + $folderInfo['file']) + 1); ?>;
  70. var urlImgPreview = '<?php echo appendQueryString(CONFIG_URL_IMAGE_PREVIEW, makeQueryString(array('path'))); ?>';
  71. var urlDownload = '<?php echo appendQueryString(CONFIG_URL_DOWNLOAD, makeQueryString(array('path'))); ?>';
  72. var urlTextEditor = '<?php echo appendQueryString(CONFIG_URL_TEXT_EDITOR, makeQueryString(array('path'))); ?>';
  73. var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
  74. var urlImageEditor = '<?php echo appendQueryString(CONFIG_URL_IMAGE_EDITOR, makeQueryString(array('path'))); ?>';
  75. var wordPreviewClick = '<?php echo LBL_CLICK_PREVIEW; ?>';
  76. var supporedPreviewExts = 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd';
  77. var elementId = <?php echo (!empty($_GET['elementId'])?"'" . $_GET['elementId'] . "'":'null'); ?>;
  78. $(document).ready(
  79. function()
  80. {
  81. //tableRuler('#tableList tbody tr');
  82. $('#edit').hide();
  83. enableEditable();
  84. initAction();
  85. enableDownload();
  86. enablePopup();
  87. } );
  88. </script>
  89. <link rel="stylesheet" type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/<?php echo CONFIG_EDITOR_NAME; ?>.css" />
  90. <link rel="stylesheet" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/thickbox.css" type="text/css" media="screen" />
  91. <title>Ajax File Manager</title>
  92. </head>
  93. <body>
  94. <div id="container">
  95. <div id="leftCol">
  96. <div id="header">
  97. <ul id="actionHeader">
  98. <li><a href="#" id="actionRefresh" onclick="windowRefresh();"><span><?php echo LBL_ACTION_REFRESH; ?></span></a></li>
  99. <li><a href="#" id="actionDelete" onclick="deleteDocuments('<?php echo ERR_NOT_DOC_SELECTED; ?>', '<?php echo ERR_DELTED_FAILED; ?>', '<?php echo WARNING_DELETE; ?>');"><span><?php echo LBL_ACTION_DELETE; ?></span></a></li>
  100. <li><a href="#" id="actionCut" onclick="cutDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_CUT; ?>');"><span><?php echo LBL_ACTION_CUT; ?></span></a><li>
  101. <li><a href="#" id="actionCopy" onclick="copyDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_COPY; ?>');"><span><?php echo LBL_ACTION_COPY; ?></span></a><li>
  102. <li><a href="#" id="actionPaste" onclick="pasteDocuments('<?php echo ERR_NOT_DOC_SELECTED_FOR_PASTE; ?>');"><span><?php echo LBL_ACTION_PASTE; ?></span></a><li>
  103. <li ><a href="#" id="actionInfo" target="_blank" title="Visit www.phpletter.com for more information"><span>Info</span></a><li>
  104. <!-- thest functions will be added in the near future
  105. <li ><a href="#" id="actionZip"><span>Zip</span></a><li>
  106. <li ><a href="#" id="actionUnzip"><span>Unzip</span></a><li>-->
  107. </ul>
  108. <img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" id="loading" width="32" height="32" style="display:none;" />
  109. </div>
  110. <form action="<?php echo appendQueryString(CONFIG_URL_DELETE, makeQueryString(array('path'))) ?>" method="POST" name="formAction" id="formAction"><select name="selectedDoc[]" id="selectedDoc" style="display:none;" multiple="multiple"></select><input type="hidden" name="action_value" value="" id="action_value" /><input type="hidden" name="currentFolderPath" value="<?php echo $folderInfo['path']; ?>" /></form>
  111. <div id="body"><?php
  112. include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ajax_get_file_list.php');
  113. ?></div>
  114. <div id="footer">
  115. <form name="hiddenForm" id="hiddenForm" action="" method="POST">
  116. <input type="hidden" name="selectedFileRowNum" id="selectedFileRowNum" value="" />
  117. </form>
  118. <div id="divNewFolder">
  119. <form id="formNewFolder" name="formNewFolder" action="<?php echo appendQueryString(CONFIG_URL_CREATE_FOLDER, makeQueryString(array('path'))); ?>" method="POST">
  120. <p><input type="hidden" name="currentFolderPath" value="<?php echo $folderInfo['path']; ?>" />
  121. <input class="input" type="text" name="new_folder" id="new_folder" value="<?php echo LBL_BTN_NEW_FOLDER; ?>" size="44"/>
  122. <button class="button" id="create" onclick="return createFolder( '<?php echo ERR_FOLDER_FORMAT; ?>');"><?php echo LBL_BTN_CREATE; ?></button></p>
  123. </form>
  124. </div>
  125. <div id="divFormFile">
  126. <form name="formFile" action="<?php echo appendQueryString(CONFIG_URL_UPLOAD, makeQueryString(array('path'))); ?>" method="post" id="formFile" enctype="multipart/form-data">
  127. <p><input type="hidden" name="currentFolderPath" value="<?php echo $folderInfo['path']; ?>" />
  128. <input class="inputFile" type="file" name="new_file" id="new_file" size="34"/>
  129. <button class="button" id="upload" onclick="return uploadFile('<?php echo ERR_FILE_NAME_FORMAT; ?>', '<?php echo ERR_FILE_NOT_UPLOADED; ?>');"><?php echo LBL_BTN_UPLOAD; ?></button></p>
  130. </form>
  131. </div>
  132. <div class="clear"></div>
  133. </div>
  134. </div>
  135. <div id="rightCol">
  136. <fieldset id="fileFieldSet" style="display:none" >
  137. <legend><?php echo LBL_FILE_INFO; ?></legend>
  138. <table cellpadding="0" cellspacing="0" class="tableSummary" id="fileInfo">
  139. <tbody>
  140. <tr>
  141. <th><?php echo LBL_FILE_NAME; ?></th>
  142. <td colspan="3" id="fileName"></td>
  143. </tr>
  144. <tr>
  145. <th><?php echo LBL_FILE_CREATED; ?></th>
  146. <td colspan="3" id="fileCtime"></td>
  147. </tr>
  148. <tr>
  149. <th><?php echo LBL_FILE_MODIFIED; ?></th>
  150. <td colspan="3" id="fileMtime"></td>
  151. </tr>
  152. <tr>
  153. <th><?php echo LBL_FILE_SIZE; ?></th>
  154. <td id="fileSize"></td>
  155. <th><?php echo LBL_FILE_TYPE; ?></th>
  156. <td id="fileType"></td>
  157. </tr>
  158. <tr>
  159. <th><?php echo LBL_FILE_WRITABLE; ?></th>
  160. <td id="fileWritable"><span class="flagYes">&nbsp;</span></td>
  161. <th><?php echo LBL_FILE_READABLE; ?></th>
  162. <td id="fileReadable"><span class="flagNo">&nbsp;</span></td>
  163. </tr>
  164. </tbody>
  165. </table>
  166. </fieldset>
  167. <fieldset id="folderFieldSet" >
  168. <legend><?php echo LBL_FOLDER_INFO; ?></legend>
  169. <table cellpadding="0" cellspacing="0" class="tableSummary" id="folderInfo">
  170. <tbody>
  171. <tr>
  172. <th><?php echo LBL_FOLDER_PATH; ?></th>
  173. <td colspan="3" id="folderPath"><?php echo transformFilePath($folderInfo['path']); ?></td>
  174. </tr>
  175. <tr>
  176. <th><?php echo LBL_FOLDER_CREATED; ?></th>
  177. <td colspan="3" id="folderCtime"><?php echo date(DATE_TIME_FORMAT,$folderInfo['ctime']); ?></td>
  178. </tr>
  179. <tr>
  180. <th><?php echo LBL_FOLDER_MODIFIED; ?></th>
  181. <td colspan="3" id="folderMtime"><?php echo date(DATE_TIME_FORMAT,$folderInfo['mtime']); ?></td>
  182. </tr>
  183. <tr>
  184. <th><?php echo LBL_FOLDER_SUDDIR; ?></th>
  185. <td id="folderSubdir"><?php echo $folderInfo['subdir']; ?></td>
  186. <th><?php echo LBL_FOLDER_FIELS; ?></th>
  187. <td id="folderFile"><?php echo $folderInfo['file']; ?></td>
  188. </tr>
  189. <tr>
  190. <th><?php echo LBL_FOLDER_WRITABLE; ?></th>
  191. <td id="folderWritable"><span class="<?php echo ($folderInfo['is_readable']?'flagYes':'flagNo'); ?>">&nbsp;</span></td>
  192. <th><?php echo LBL_FOLDER_READABLE; ?></th>
  193. <td id="folderReadable"><span class="<?php echo ($folderInfo['is_writable']?'flagYes':'flagNo'); ?>">&nbsp;</span></td>
  194. </tr>
  195. </tbody>
  196. </table>
  197. </fieldset>
  198. <fieldset>
  199. <legend><?php echo LBL_PREVIEW; ?></legend>
  200. <div id="preview">
  201. <?php echo PREVIEW_NOT_PREVIEW; ?>
  202. </div>
  203. <img id="previewLoading" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" style="display:none" width="32" height="32" />
  204. </fieldset>
  205. <div id="previewFooter">
  206. <p>
  207. <?php
  208. if(CONFIG_EDITOR_NAME != 'stand_alone')
  209. {//select button is not needed for stand alone mode
  210. ?>
  211. <button class="button" id="select" onclick="selectFile('<?php echo ERR_NOT_FILE_SELECTED; ?>');"><?php echo LBL_BTN_SELECT; ?></button>
  212. <?php
  213. }
  214. ?>
  215. <button class="button" id="edit" onclick="selectForEdit('<?php echo WARNING_NOT_FILE_EDIT; ?>');"><?php echo LBL_BTN_EDIT_IMAGE; ?></button>
  216. <?php
  217. if(CONFIG_EDITOR_NAME != 'stand_alone')
  218. {//cacel button is not needed for stand alone mode
  219. ?>
  220. <button class="button" id="cancel" onclick="cancelSelectFile();"><?php echo LBL_BTN_CANCEL; ?></button></p>
  221. <?php
  222. }else
  223. {
  224. ?>
  225. <button class="button" id="close" onclick="return closeWindow();"><?php echo LBL_BTN_CLOSE; ?></button></p>
  226. <?php
  227. }
  228. ?>
  229. </div>
  230. </div>
  231. </div>
  232. <div class="clear"></div>
  233. </body>
  234. </html>