File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 77( function ( ) {
88 angular . module ( 'FileManagerApp' ) . constant ( "$config" , {
99 appName : "https://github.com/joni2back/angular-filemanager" ,
10- listUrl : "/hosting/filemanager/listdirectory" ,
10+ listUrl : "bridges/php/handler.php" ,
1111 uploadUrl : "/hosting/filemanager/upload" ,
1212
1313 renameUrl : "/hosting/filemanager/item/rename" ,
1414 copyUrl : "/hosting/filemanager/item/copy" ,
1515 removeUrl : "/hosting/filemanager/item/remove" ,
1616 editUrl : "/hosting/filemanager/item/edit" ,
17- getContentUrl : "/hosting/filemanager/item/content/get " ,
17+ getContentUrl : "bridges/php/handler.php " ,
1818 createFolderUrl : "/hosting/filemanager/item/folder/create" ,
1919 downloadFileUrl : "/hosting/filemanager/item/download" ,
2020 compressUrl : "/hosting/filemanager/item/compress" ,
Original file line number Diff line number Diff line change @@ -38,20 +38,34 @@ public static function getApiParam($param) {
3838
3939class Response {
4040 public function __construct ($ data ) {
41- echo json_encode ($ data );
41+ echo json_encode (array ( ' result ' => $ data) );
4242 exit ;
4343 }
4444}
45+
46+ class FileManager extends FtpHelper {
47+
48+ public function getContent ($ path ) {
49+ $ localPath = tempnam (sys_get_temp_dir (), 'fmanager_ ' );
50+ $ this ->download ($ path , $ localPath );
51+ return file_get_contents ($ localPath );
52+ }
53+
54+ }
55+
4556ExceptionCatcherJSON::register ();
4657
47- $ oFtp = new FtpHelper (array (
48- 'hostname ' => '' ,
49- 'username ' => '' ,
50- 'password ' => ''
58+ $ oFtp = new FileManager (array (
59+ 'hostname ' => '200.58.111.120 ' ,
60+ 'username ' =>
'[email protected] ' ,
61+ 'password ' => 'FM321xxx '
5162));
52- $ oFtp ->connect ();
5363
64+ $ oFtp ->connect ();
5465
5566if (Request::getApiParam ('mode ' ) === 'list ' ) {
5667 new Response ($ oFtp ->listFilesRaw (Request::getApiParam ('path ' )));
68+ }
69+ if (Request::getApiParam ('mode ' ) === 'editfile ' ) {
70+ new Response ($ oFtp ->getContent (Request::getApiParam ('path ' )));
5771}
You can’t perform that action at this time.
0 commit comments