mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-12 19:13:57 +02:00
Enable edit function only for text files, not binary etc. Related to #90
This commit is contained in:
@@ -1565,7 +1565,7 @@ function IFM( params ) {
|
|||||||
icon: "icon icon-archive",
|
icon: "icon icon-archive",
|
||||||
title: "extract"
|
title: "extract"
|
||||||
});
|
});
|
||||||
} else if( self.config.edit && item.icon.indexOf( 'file-image' ) == -1 && ! self.inArray( item.ext, ["zip","tar","tgz","tar.gz","tar.xz","tar.bz2"] ) ) {
|
} else if( self.config.edit && item.mime_type.substr( 0, 4 ) == "text" ) {
|
||||||
item.eaction = "edit";
|
item.eaction = "edit";
|
||||||
item.button.push({
|
item.button.push({
|
||||||
action: "edit",
|
action: "edit",
|
||||||
@@ -3367,6 +3367,7 @@ function IFM( params ) {
|
|||||||
$type = substr( strrchr( $name, "." ), 1 );
|
$type = substr( strrchr( $name, "." ), 1 );
|
||||||
$item["icon"] = $this->getTypeIcon( $type );
|
$item["icon"] = $this->getTypeIcon( $type );
|
||||||
$item["ext"] = strtolower($type);
|
$item["ext"] = strtolower($type);
|
||||||
|
$item["mime_type"] = mime_content_type( $name );
|
||||||
}
|
}
|
||||||
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
|
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
|
||||||
if( $this->config['showfilesize'] == 1 ) {
|
if( $this->config['showfilesize'] == 1 ) {
|
||||||
|
3
ifm.php
3
ifm.php
@@ -1565,7 +1565,7 @@ function IFM( params ) {
|
|||||||
icon: "icon icon-archive",
|
icon: "icon icon-archive",
|
||||||
title: "extract"
|
title: "extract"
|
||||||
});
|
});
|
||||||
} else if( self.config.edit && item.icon.indexOf( 'file-image' ) == -1 && ! self.inArray( item.ext, ["zip","tar","tgz","tar.gz","tar.xz","tar.bz2"] ) ) {
|
} else if( self.config.edit && item.mime_type.substr( 0, 4 ) == "text" ) {
|
||||||
item.eaction = "edit";
|
item.eaction = "edit";
|
||||||
item.button.push({
|
item.button.push({
|
||||||
action: "edit",
|
action: "edit",
|
||||||
@@ -3367,6 +3367,7 @@ function IFM( params ) {
|
|||||||
$type = substr( strrchr( $name, "." ), 1 );
|
$type = substr( strrchr( $name, "." ), 1 );
|
||||||
$item["icon"] = $this->getTypeIcon( $type );
|
$item["icon"] = $this->getTypeIcon( $type );
|
||||||
$item["ext"] = strtolower($type);
|
$item["ext"] = strtolower($type);
|
||||||
|
$item["mime_type"] = mime_content_type( $name );
|
||||||
}
|
}
|
||||||
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
|
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
|
||||||
if( $this->config['showfilesize'] == 1 ) {
|
if( $this->config['showfilesize'] == 1 ) {
|
||||||
|
@@ -145,7 +145,7 @@ function IFM( params ) {
|
|||||||
icon: "icon icon-archive",
|
icon: "icon icon-archive",
|
||||||
title: "extract"
|
title: "extract"
|
||||||
});
|
});
|
||||||
} else if( self.config.edit && item.icon.indexOf( 'file-image' ) == -1 && ! self.inArray( item.ext, ["zip","tar","tgz","tar.gz","tar.xz","tar.bz2"] ) ) {
|
} else if( self.config.edit && item.mime_type.substr( 0, 4 ) == "text" ) {
|
||||||
item.eaction = "edit";
|
item.eaction = "edit";
|
||||||
item.button.push({
|
item.button.push({
|
||||||
action: "edit",
|
action: "edit",
|
||||||
|
@@ -356,6 +356,7 @@ f00bar;
|
|||||||
$type = substr( strrchr( $name, "." ), 1 );
|
$type = substr( strrchr( $name, "." ), 1 );
|
||||||
$item["icon"] = $this->getTypeIcon( $type );
|
$item["icon"] = $this->getTypeIcon( $type );
|
||||||
$item["ext"] = strtolower($type);
|
$item["ext"] = strtolower($type);
|
||||||
|
$item["mime_type"] = mime_content_type( $name );
|
||||||
}
|
}
|
||||||
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
|
if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $name ) ); }
|
||||||
if( $this->config['showfilesize'] == 1 ) {
|
if( $this->config['showfilesize'] == 1 ) {
|
||||||
|
Reference in New Issue
Block a user