diff --git a/build/libifm.php b/build/libifm.php
index 33b3264..82beceb 100644
--- a/build/libifm.php
+++ b/build/libifm.php
@@ -40,6 +40,7 @@ class IFM {
"rename" => 1,
"zipnload" => 1,
"createarchive" => 1,
+ "search" => 1,
// gui controls
"showlastmodified" => 0,
@@ -51,7 +52,8 @@ class IFM {
"showhiddenfiles" => 1,
"showpath" => 0,
"contextmenu" => 1,
- "disable_mime_detection" => 0
+ "disable_mime_detection" => 0,
+ "showrefresh" => 1
);
private $config = array();
@@ -97,6 +99,8 @@ class IFM {
$this->config['showhiddenfiles'] = getenv('IFM_GUI_SHOWHIDDENFILES') !== false ? intval( getenv('IFM_GUI_SHOWHIDDENFILES') ) : $this->config['showhiddenfiles'] ;
$this->config['showpath'] = getenv('IFM_GUI_SHOWPATH') !== false ? intval( getenv('IFM_GUI_SHOWPATH') ) : $this->config['showpath'] ;
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
+ $this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
+ $this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
// optional settings
if( getenv('IFM_SESSION_LIFETIME') !== false )
@@ -140,8 +144,12 @@ f00bar;
+ {{#config.showrefresh}}
- {{i18n.refresh}}
+ {{/config.showrefresh}}
+ {{#config.search}}
- {{i18n.search}}
+ {{/config.search}}
{{#config.upload}}
- {{i18n.upload}}
{{/config.upload}}
@@ -1756,6 +1764,7 @@ function IFM(params) {
* @param object options - options for changing the directory
*/
this.changeDirectory = function( newdir, options ) {
+ console.log("Change dir to: |"+newdir+"|");
options = options || {};
config = { absolute: false, pushState: true };
jQuery.extend( config, options );
@@ -2463,7 +2472,7 @@ function IFM(params) {
searchresults.tBodies[0].addEventListener( 'click', function( e ) {
if( e.target.classList.contains( 'searchitem' ) || e.target.parentElement.classList.contains( 'searchitem' ) ) {
e.preventDefault();
- self.changeDirectory( self.pathCombine( self.search.data.currentDir, e.target.dataset.folder || e.target.parentElement.dataset.foldera ), { absolute: true } );
+ self.changeDirectory(self.pathCombine(self.search.data.currentDir, e.target.dataset.folder || e.target.parentElement.dataset.folder), {absolute: true});
self.hideModal();
}
});
@@ -2916,8 +2925,10 @@ function IFM(params) {
// global key events
switch( e.key ) {
case '/':
- e.preventDefault();
- self.showSearchDialog();
+ if (self.config.search) {
+ e.preventDefault();
+ self.showSearchDialog();
+ }
break;
case 'g':
e.preventDefault();
@@ -2925,9 +2936,10 @@ function IFM(params) {
return;
break;
case 'r':
- e.preventDefault();
- self.refreshFileTable();
- return;
+ if (self.config.showrefresh) {
+ e.preventDefault();
+ self.refreshFileTable();
+ }
break;
case 'u':
if( self.config.upload ) {
@@ -3154,8 +3166,12 @@ function IFM(params) {
});
// bind static buttons
- document.getElementById( 'refresh' ).onclick = function() { self.refreshFileTable(); };
- document.getElementById( 'search' ).onclick = function() { self.showSearchDialog(); };
+ if (el_r = document.getElementById('refresh'))
+ el_r.onclick = function() { self.refreshFileTable(); };
+ if (el_s = document.getElementById('search'))
+ el_s.onclick = function() { self.showSearchDialog(); };
+ //document.getElementById( 'refresh' ).onclick = function() { self.refreshFileTable(); };
+ //document.getElementById( 'search' ).onclick = function() { self.showSearchDialog(); };
if( self.config.createfile )
document.getElementById( 'createFile' ).onclick = function() { self.showFileDialog(); };
if( self.config.createdir )
@@ -3516,6 +3532,11 @@ f00bar;
}
private function searchItems( $d ) {
+ if( $this->config['search'] != 1 ) {
+ $this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['nopermissions'] ) );
+ return;
+ }
+
if( strpos( $d['pattern'], '/' ) !== false ) {
$this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['pattern_error_slashes'] ) );
exit( 1 );
@@ -3884,7 +3905,6 @@ f00bar;
elseif ( ! $this->isFilenameValid( $d['filename'] ) )
$this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['invalid_filename'] ) );
else {
- trigger_error("foo bar");
unset( $zip );
$dfile = $this->pathCombine( __DIR__, $this->config['tmp_dir'], uniqid( "ifm-tmp-" ) . ".zip" ); // temporary filename
try {
diff --git a/ifm.php b/ifm.php
index bc5a933..9d6f2ca 100644
--- a/ifm.php
+++ b/ifm.php
@@ -40,6 +40,7 @@ class IFM {
"rename" => 1,
"zipnload" => 1,
"createarchive" => 1,
+ "search" => 1,
// gui controls
"showlastmodified" => 0,
@@ -51,7 +52,8 @@ class IFM {
"showhiddenfiles" => 1,
"showpath" => 0,
"contextmenu" => 1,
- "disable_mime_detection" => 0
+ "disable_mime_detection" => 0,
+ "showrefresh" => 1
);
private $config = array();
@@ -97,6 +99,8 @@ class IFM {
$this->config['showhiddenfiles'] = getenv('IFM_GUI_SHOWHIDDENFILES') !== false ? intval( getenv('IFM_GUI_SHOWHIDDENFILES') ) : $this->config['showhiddenfiles'] ;
$this->config['showpath'] = getenv('IFM_GUI_SHOWPATH') !== false ? intval( getenv('IFM_GUI_SHOWPATH') ) : $this->config['showpath'] ;
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
+ $this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
+ $this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
// optional settings
if( getenv('IFM_SESSION_LIFETIME') !== false )
@@ -140,8 +144,12 @@ f00bar;
+ {{#config.showrefresh}}
- {{i18n.refresh}}
+ {{/config.showrefresh}}
+ {{#config.search}}
- {{i18n.search}}
+ {{/config.search}}
{{#config.upload}}
- {{i18n.upload}}
{{/config.upload}}
@@ -1756,6 +1764,7 @@ function IFM(params) {
* @param object options - options for changing the directory
*/
this.changeDirectory = function( newdir, options ) {
+ console.log("Change dir to: |"+newdir+"|");
options = options || {};
config = { absolute: false, pushState: true };
jQuery.extend( config, options );
@@ -2463,7 +2472,7 @@ function IFM(params) {
searchresults.tBodies[0].addEventListener( 'click', function( e ) {
if( e.target.classList.contains( 'searchitem' ) || e.target.parentElement.classList.contains( 'searchitem' ) ) {
e.preventDefault();
- self.changeDirectory( self.pathCombine( self.search.data.currentDir, e.target.dataset.folder || e.target.parentElement.dataset.foldera ), { absolute: true } );
+ self.changeDirectory(self.pathCombine(self.search.data.currentDir, e.target.dataset.folder || e.target.parentElement.dataset.folder), {absolute: true});
self.hideModal();
}
});
@@ -2916,8 +2925,10 @@ function IFM(params) {
// global key events
switch( e.key ) {
case '/':
- e.preventDefault();
- self.showSearchDialog();
+ if (self.config.search) {
+ e.preventDefault();
+ self.showSearchDialog();
+ }
break;
case 'g':
e.preventDefault();
@@ -2925,9 +2936,10 @@ function IFM(params) {
return;
break;
case 'r':
- e.preventDefault();
- self.refreshFileTable();
- return;
+ if (self.config.showrefresh) {
+ e.preventDefault();
+ self.refreshFileTable();
+ }
break;
case 'u':
if( self.config.upload ) {
@@ -3154,8 +3166,12 @@ function IFM(params) {
});
// bind static buttons
- document.getElementById( 'refresh' ).onclick = function() { self.refreshFileTable(); };
- document.getElementById( 'search' ).onclick = function() { self.showSearchDialog(); };
+ if (el_r = document.getElementById('refresh'))
+ el_r.onclick = function() { self.refreshFileTable(); };
+ if (el_s = document.getElementById('search'))
+ el_s.onclick = function() { self.showSearchDialog(); };
+ //document.getElementById( 'refresh' ).onclick = function() { self.refreshFileTable(); };
+ //document.getElementById( 'search' ).onclick = function() { self.showSearchDialog(); };
if( self.config.createfile )
document.getElementById( 'createFile' ).onclick = function() { self.showFileDialog(); };
if( self.config.createdir )
@@ -3516,6 +3532,11 @@ f00bar;
}
private function searchItems( $d ) {
+ if( $this->config['search'] != 1 ) {
+ $this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['nopermissions'] ) );
+ return;
+ }
+
if( strpos( $d['pattern'], '/' ) !== false ) {
$this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['pattern_error_slashes'] ) );
exit( 1 );
@@ -3884,7 +3905,6 @@ f00bar;
elseif ( ! $this->isFilenameValid( $d['filename'] ) )
$this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['invalid_filename'] ) );
else {
- trigger_error("foo bar");
unset( $zip );
$dfile = $this->pathCombine( __DIR__, $this->config['tmp_dir'], uniqid( "ifm-tmp-" ) . ".zip" ); // temporary filename
try {
diff --git a/src/ifm.js b/src/ifm.js
index 0384577..f24d23d 100644
--- a/src/ifm.js
+++ b/src/ifm.js
@@ -1594,9 +1594,10 @@ function IFM(params) {
return;
break;
case 'r':
- e.preventDefault();
- self.refreshFileTable();
- return;
+ if (self.config.showrefresh) {
+ e.preventDefault();
+ self.refreshFileTable();
+ }
break;
case 'u':
if( self.config.upload ) {
@@ -1823,8 +1824,12 @@ function IFM(params) {
});
// bind static buttons
- document.getElementById( 'refresh' ).onclick = function() { self.refreshFileTable(); };
- document.getElementById( 'search' ).onclick = function() { self.showSearchDialog(); };
+ if (el_r = document.getElementById('refresh'))
+ el_r.onclick = function() { self.refreshFileTable(); };
+ if (el_s = document.getElementById('search'))
+ el_s.onclick = function() { self.showSearchDialog(); };
+ //document.getElementById( 'refresh' ).onclick = function() { self.refreshFileTable(); };
+ //document.getElementById( 'search' ).onclick = function() { self.showSearchDialog(); };
if( self.config.createfile )
document.getElementById( 'createFile' ).onclick = function() { self.showFileDialog(); };
if( self.config.createdir )
diff --git a/src/main.php b/src/main.php
index ef2c0b0..8022379 100644
--- a/src/main.php
+++ b/src/main.php
@@ -41,6 +41,7 @@ class IFM {
"rename" => 1,
"zipnload" => 1,
"createarchive" => 1,
+ "search" => 1,
// gui controls
"showlastmodified" => 0,
@@ -52,7 +53,8 @@ class IFM {
"showhiddenfiles" => 1,
"showpath" => 0,
"contextmenu" => 1,
- "disable_mime_detection" => 0
+ "disable_mime_detection" => 0,
+ "showrefresh" => 1
);
private $config = array();
@@ -98,6 +100,8 @@ class IFM {
$this->config['showhiddenfiles'] = getenv('IFM_GUI_SHOWHIDDENFILES') !== false ? intval( getenv('IFM_GUI_SHOWHIDDENFILES') ) : $this->config['showhiddenfiles'] ;
$this->config['showpath'] = getenv('IFM_GUI_SHOWPATH') !== false ? intval( getenv('IFM_GUI_SHOWPATH') ) : $this->config['showpath'] ;
$this->config['contextmenu'] = getenv('IFM_GUI_CONTEXTMENU') !== false ? intval( getenv('IFM_GUI_CONTEXTMENU') ) : $this->config['contextmenu'] ;
+ $this->config['search'] = getenv('IFM_API_SEARCH') !== false ? intval( getenv('IFM_API_SEARCH') ) : $this->config['search'] ;
+ $this->config['showrefresh'] = getenv('IFM_GUI_REFRESH') !== false ? intval( getenv('IFM_GUI_REFRESH') ) : $this->config['showrefresh'] ;
// optional settings
if( getenv('IFM_SESSION_LIFETIME') !== false )
@@ -451,6 +455,11 @@ f00bar;
}
private function searchItems( $d ) {
+ if( $this->config['search'] != 1 ) {
+ $this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['nopermissions'] ) );
+ return;
+ }
+
if( strpos( $d['pattern'], '/' ) !== false ) {
$this->jsonResponse( array( "status" => "ERROR", "message" => $this->l['pattern_error_slashes'] ) );
exit( 1 );
diff --git a/src/templates/app.html b/src/templates/app.html
index 4895223..c8636c5 100644
--- a/src/templates/app.html
+++ b/src/templates/app.html
@@ -23,8 +23,12 @@