diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..402378e
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
+*
+!compiler.php
+!src
+!docker/docker-startup.sh
diff --git a/docker/Dockerfile b/Dockerfile
similarity index 74%
rename from docker/Dockerfile
rename to Dockerfile
index 6547fe8..3a8cb80 100644
--- a/docker/Dockerfile
+++ b/Dockerfile
@@ -24,9 +24,15 @@ RUN echo "Set disable_coredump false" > /etc/sudo.conf
# prepare files
RUN rm -rf /var/www/html && \
mkdir -p /usr/local/share/webapps/ifm && \
- ln -s /var/www /usr/local/share/webapps/ifm/www
-COPY ifm.php /usr/local/share/webapps/ifm/index.php
-COPY docker-startup.sh /usr/local/bin
+ chown -R 33:33 /var/www && \
+ ln -s /var/www /usr/local/share/webapps/ifm/www && \
+ mkdir -p /usr/src/ifm
+COPY / /usr/src/ifm/
+RUN /usr/src/ifm/compiler.php --languages=all && \
+ cp /usr/src/ifm/dist/ifm.php /usr/local/share/webapps/ifm/index.php && \
+ rm -rf /usr/src/ifm
+
+COPY docker/docker-startup.sh /usr/local/bin
# start php server
WORKDIR /usr/local/share/webapps/ifm
diff --git a/compiler.php b/compiler.php
index f0ba522..1ea03e8 100755
--- a/compiler.php
+++ b/compiler.php
@@ -6,22 +6,15 @@
* This script compiles all sources into one single file.
*/
-chdir( realpath( dirname( __FILE__ ) ) );
+chdir(realpath(dirname(__FILE__)));
// output files and common attrs
-define( "IFM_CDN", false );
-define( "IFM_VERSION", "v2.6.1 " );
+define( "IFM_VERSION", "v2.6.2" );
define( "IFM_RELEASE_DIR", "dist/");
define( "IFM_STANDALONE", "ifm.php" );
define( "IFM_STANDALONE_GZ", "ifm.min.php" );
define( "IFM_LIB", "libifm.php" );
-if( IFM_CDN ){
- $IFM_ASSETS = "src/assets.cdn.part";
-} else {
- $IFM_ASSETS = "src/assets.part";
-}
-
// php source files
$IFM_SRC_PHP = array(
0 => "src/main.php",
@@ -30,14 +23,31 @@ $IFM_SRC_PHP = array(
);
// get options
-$options = getopt( null, array( "language::" ) );
+$options = getopt(null, array("language::", "languages::", "lang::", "cdn"));
+
+// build CDN version?
+if (isset($options['cdn']))
+ define("IFM_CDN", true);
+else
+ define("IFM_CDN", false);
// process languages
-$vars['languages'] = isset( $options['language'] ) ? explode( ',', $options['language'] ) : array( "en", "ru" );
-$vars['defaultlanguage'] = $vars['languages'][0];
+$langs = [];
+foreach ($options as $key => $value)
+ if (substr($key, 0, 4) == "lang")
+ $langs = array_merge($langs, explode(",", $value));
+$langs = array_unique($langs);
+$vars['default_lang'] = ($langs[0] == "all") ? "en" : $langs[0];
+
+if (in_array("all", $langs))
+ $langs = array_map(
+ function($i) { return str_replace("src/i18n/", "", str_replace(".json", "", $i)); },
+ glob("src/i18n/*.json")
+ );
+
$vars['languageincludes'] = "";
-foreach( $vars['languages'] as $l ) {
- if( file_exists( "src/i18n/".$l.".json" ) )
+foreach ($langs as $l)
+ if (file_exists("src/i18n/".$l.".json"))
$vars['languageincludes'] .=
'$i18n["'.$l.'"] = <<<\'f00bar\'' . "\n"
. file_get_contents( "src/i18n/".$l.".json" ) . "\n"
@@ -45,11 +55,8 @@ foreach( $vars['languages'] as $l ) {
. '$i18n["'.$l.'"] = json_decode( $i18n["'.$l.'"], true );' . "\n" ;
else
print "WARNING: Language file src/i18n/".$l.".json not found.\n";
-}
-/**
- * Concat PHP Files
- */
+// Concat PHP Files
$compiled = array( "run();
// build compressed ifm
file_put_contents(
- IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_STANDALONE_GZ,
+ IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : '') . IFM_STANDALONE_GZ,
''
- . gzencode( file_get_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') .IFM_STANDALONE, false, null, 5 ) )
+ . gzencode( file_get_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : '') .IFM_STANDALONE, false, null, 5 ) )
);
// build lib
-file_put_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : 'simple.') . IFM_LIB, $compiled );
+file_put_contents( IFM_RELEASE_DIR . (IFM_CDN ? 'cdn.' : '') . IFM_LIB, $compiled );
diff --git a/docker/.dockerignore b/docker/.dockerignore
deleted file mode 100644
index d24cb44..0000000
--- a/docker/.dockerignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*
-!ifm.php
-!docker-startup.sh
diff --git a/docker/docker-startup.sh b/docker/docker-startup.sh
old mode 100644
new mode 100755
diff --git a/src/i18n/ru.json b/src/i18n/ru.json
index f269c7d..b5b0756 100644
--- a/src/i18n/ru.json
+++ b/src/i18n/ru.json
@@ -101,7 +101,7 @@
"toggle_nav": "Переключить вид",
"upload": "Загрузить",
"upload_drop": "Перетащите файлы для загрузки",
- "upload_file": "Загрузить файла",
+ "upload_file": "Загрузить файл",
"upload_remote": "Удаленная загрузка",
"upload_remote_url": "Удаленная загрузка по URL",
"username": "Имя пользователя",
diff --git a/src/ifm.js b/src/ifm.js
index d284552..926f81e 100644
--- a/src/ifm.js
+++ b/src/ifm.js
@@ -1390,18 +1390,19 @@ function IFM(params) {
if( ! document.querySelector( "footer" ) ) {
var newFooter = self.getNodeFromString( Mustache.render( self.templates.footer, { i18n: self.i18n } ) );
newFooter.addEventListener( 'click', function( e ) {
- if( e.target.name == 'showAll' ) {
- if( newFooter.style.maxHeight == '80%' ) {
- newFooter.style.maxHeight = '6em';
- newFooter.style.overflow = 'hidden';
+ if( e.target.name == 'showAll' || e.target.parentElement.name == "showAll" ) {
+ wq = newFooter.children.wq_container.children[0].children.waitqueue;
+ if( wq.style.maxHeight == '70vh' ) {
+ wq.style.maxHeight = '6rem';
+ wq.style.overflow = 'hidden';
} else {
- newFooter.style.maxHeight = '80%';
- newFooter.style.overflow = 'scroll';
+ wq.style.maxHeight = '70vh';
+ wq.style.overflow = 'auto';
}
}
});
document.body.appendChild( newFooter );
- document.body.style.paddingBottom = '6em';
+ document.body.style.paddingBottom = '9rem';
}
task.id = "wq-"+task.id;
task.type = task.type || "info";
diff --git a/src/ifmarchive.php b/src/ifmarchive.php
index 2140606..f38434f 100644
--- a/src/ifmarchive.php
+++ b/src/ifmarchive.php
@@ -31,15 +31,17 @@ class IFMArchive {
while (false !== $f = readdir($handle)) {
if ($f != '.' && $f != '..') {
$filePath = $folder . '/' . $f;
- if (file_exists($filePath) && is_readable($filePath))
- if (is_file($filePath))
+ if (file_exists($filePath) && is_readable($filePath)) {
+ if (is_file($filePath)) {
if (!is_callable($exclude_callback) || $exclude_callback($f))
$archive->addFile( $filePath, substr( $filePath, $offset ) );
- elseif (is_dir($filePath))
+ } elseif (is_dir($filePath)) {
if (is_callable($exclude_callback))
self::addFolder($archive, $filePath, $offset, $exclude_callback);
else
self::addFolder($archive, $filePath, $offset);
+ }
+ }
}
}
closedir($handle);
@@ -55,8 +57,6 @@ class IFMArchive {
if (!is_array($src))
$src = array($src);
- file_put_contents("debug.ifm.log", var_export(is_callable($exclude_callback), true)."\n");
-
foreach ($src as $s)
if (is_dir($s))
if (is_callable($exclude_callback))
diff --git a/src/main.php b/src/main.php
index 6dd90c0..6971ef3 100644
--- a/src/main.php
+++ b/src/main.php
@@ -24,7 +24,7 @@ class IFM {
"timezone" => "",
"forbiddenChars" => array(),
"dateLocale" => "en-US",
- "language" => "@@@vars:defaultlanguage@@@",
+ "language" => "@@@vars:default_lang@@@",
"selfoverwrite" => 0,
// api controls
@@ -62,7 +62,7 @@ class IFM {
private $config = array();
private $templates = array();
private $i18n = array();
- public $mode = "";
+ public $mode = "standalone";
public function __construct( $config=array() ) {
@@ -218,7 +218,7 @@ IFM_ASSETS
IFM - improved file manager
- ';
+ ';
$this->getCSS();
print '';
}
@@ -972,7 +972,7 @@ IFM_ASSETS
$item = utf8_encode( $item );
}
- public function checkAuth() {
+ function checkAuth() {
if( $this->config['auth'] == 0 )
return true;
@@ -1080,10 +1080,10 @@ IFM_ASSETS
return false;
}
- private function loginForm($loginFailed=false) {
+ private function loginForm($loginFailed=false, $loginMessage="") {
$err = "";
if( $loginFailed )
- $err = ''.$this->l['login_failed'].'
';
+ $err = ''.$loginMessage.'
';
$this->getHTMLHeader();
$html = str_replace( "{{error}}", $err, $this->templates['login'] );
$html = str_replace( "{{i18n.username}}", $this->l['username'], $html );
@@ -1177,15 +1177,16 @@ IFM_ASSETS
private function getTypeIcon( $type ) {
$type = strtolower($type);
switch( $type ) {
- case "aac": case "aiff": case "mid": case "mp3": case "wav": return 'icon icon-file-audio'; break;
- case "ai": case "bmp": case "eps": case "tiff": case "gif": case "jpg": case "jpeg": case "png": case "psd": return 'icon icon-file-image'; break;
+ case "aac": case "aiff": case "mid": case "mp3": case "wav": return 'icon icon-file-audio'; break;
+ case "ai": case "bmp": case "eps": case "tiff": case "gif": case "jpg": case "jpeg": case "png": case "psd": case "svg": return 'icon icon-file-image'; break;
case "avi": case "flv": case "mp4": case "mpg": case "mkv": case "mpeg": case "webm": case "wmv": case "mov": return 'icon icon-file-video'; break;
- case "c": case "cpp": case "css": case "dat": case "h": case "html": case "java": case "js": case "php": case "py": case "sql": case "xml": case "yml": return 'icon icon-file-code'; break;
+ case "c": case "cpp": case "css": case "dat": case "h": case "html": case "java": case "js": case "php": case "py": case "sql": case "xml": case "yml": case "json": return 'icon icon-file-code'; break;
case "doc": case "docx": case "odf": case "odt": case "rtf": return 'icon icon-file-word'; break;
+ case "txt": case "log": return 'icon icon-doc-text'; break;
case "ods": case "xls": case "xlsx": return 'icon icon-file-excel'; break;
case "odp": case "ppt": case "pptx": return 'icon icon-file-powerpoint'; break;
case "pdf": return 'icon icon-file-pdf'; break;
- case "tgz": case "zip": case "tar": case "tgz": case "tar.gz": case "tar.xz": case "tar.bz2": case "7z": case "rar": return 'icon icon-file-archive';
+ case "tgz": case "zip": case "tar": case "tgz": case "tar.gz": case "tar.xz": case "tar.bz2": case "7z": case "rar": return 'icon icon-file-archive';
default: return 'icon icon-doc';
}
}
diff --git a/src/style.css b/src/style.css
index c8cc36e..141c024 100644
--- a/src/style.css
+++ b/src/style.css
@@ -1,59 +1,75 @@
body {
- padding-top: 70px;
- overflow-y: scroll !important;
+ padding-top: 70px;
+ overflow-y: scroll !important;
}
-a { cursor: pointer !important; }
-a.ifmitem:focus { outline: 0 }
-
-img.imgpreview { max-width: 100%; }
-
-div#content { width: 100%; height: 350px; } /* is for the ACE editor */
-
-label {
- display: inline-block;
- margin-bottom: .5rem;
- font-weight: 700;
+main {
+ margin-bottom: 1rem;
}
+a {
+ cursor: pointer !important;
+}
+
+a.ifmitem:focus {
+ outline: 0
+}
+
+img.imgpreview {
+ max-width: 100%;
+ background-repeat: repeat repeat;
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAAAAACoWZBhAAABI2lDQ1BJQ0MgcHJvZmlsZQAAKJGdkLFKw1AUhr9UsaXYSXEQhwyuBRHM5FIVgqAQYwWrU5qkWExiSFKKb+Cb6MN0EASfwCdQcPa/0cHBLF44/B+Hc/7/3gstOwnTcnkH0qwqXH8wuhxd2e032nTosksvCMt84HknNJ7PVyyjL33j1Tz351mJ4jKULlRZmBcVWPtiZ17lhlWs3w79Q/GD2I7SLBI/ibejNDJsdv00mYU/nuY2q3F2cW76qi1cjjnFw2bMjCkJFX1pps4RDntSl4KAe0pCaUKs3lwzFTeiUk4uB6KhSLdpyNus8zyljOUxlZdJuCOVp8nD/O/32sdZvWltLPKgCOrWkqo1mcD7I/RGsPYM3euGrM7vtzXMOPXMP9/4BdaxUFxWskm6AAAAAmJLR0QAy6Y7OAoAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAiSURBVAjXY/zPwMDAcIaBgYGBiQEOCDJZzjAwMDCYkKoNAPmXAuEuYku0AAAAAElFTkSuQmCC");
+}
+
+div#content { /* is for the ACE editor */
+ width: 100%;
+ height: 350px;
+}
+
+/* label {
+ display: inline-block;
+ margin-bottom: .5rem;
+ font-weight: 700;
+} */
+
/* Make tables more compact (overwrites bootstrap default of 0.75rem) */
.table td, .table th {
- padding: 0.25rem;
+ padding: 0.25rem;
}
/* narrow navbar */
.navbar {
- padding: 0.3rem;
+ padding: 0.3rem !important;
}
/*
* Icon size
*/
.icon {
- font-size: 14pt;
+ font-size: 14pt;
}
@media (max-width: 768px) {
- .icon { font-size: 12pt; }
- #filetable tr th.buttons { min-width: 85px !important; }
+ .icon { font-size: 12pt; }
+ #filetable tr th.buttons { min-width: 85px !important; }
}
/*
* Filetable related settings
*/
#filetable th {
- border-top: 0;
+ border-top: 0;
}
#filetable td:nth-child(5), #filetable th:nth-child(5) {
- text-align: center;
+ text-align: center;
}
#filetable td:nth-child(6), #filetable th:nth-child(6) {
- text-align: center;
+ text-align: center;
}
#filetable tr td:last-child {
- text-align: right;
+ text-align: right;
}
#filetable td:last-child a:hover {
- text-decoration: none;
+ text-decoration: none;
}
.td-permissions { width: 1px; }
@@ -76,53 +92,56 @@ div.ifminfo div.panel div.panel-body { padding: 0px !important; text-align: cen
* Footer / Task-Queue settings
*/
footer {
- position: fixed;
- padding-top: 1em;
- border-top: 1px;
- background-color: #EEE;
- bottom: 0;
- width: 100%;
- max-height: 6em;
- overflow: hidden;
+ position: fixed;
+ padding-top: 1em;
+ border-top: 1px;
+ background-color: #EEE;
+ bottom: 0;
+ width: 100%;
+ overflow: hidden;
+}
+
+#waitqueue {
+ max-height: 6rem;
}
#waitqueue .progress {
- position: relative;
- margin-bottom: 0;
+ position: relative;
+ margin-bottom: 0;
}
#waitqueue .progbarlabel {
- position:absolute;
- top: 0;
- left: 10px;
- font-weight: bold;
+ position:absolute;
+ top: 0;
+ left: 10px;
+ font-weight: bold;
}
/*
* File drop overlay
*/
#filedropoverlay {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- text-align: center;
- color: #FFF;
- background-color: lightblue;
- filter: alpha(opacity=70);
- -moz-opacity: 0.7;
- opacity: 0.7;
- z-index: 1000;
+ display: none;
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ text-align: center;
+ color: #FFF;
+ background-color: lightblue;
+ filter: alpha(opacity=70);
+ -moz-opacity: 0.7;
+ opacity: 0.7;
+ z-index: 1000;
}
#filedropoverlay h1 {
- border-radius: 5px;
- color: #000;
- position:relative;
- top:50%;
- font-size: 6em;
- pointer-events: none;
+ border-radius: 5px;
+ color: #000;
+ position:relative;
+ top:50%;
+ font-size: 6em;
+ pointer-events: none;
}
@@ -130,8 +149,8 @@ footer {
* Datatables related settings
*/
table.dataTable thead th {
- position: relative;
- background-image: none !important;
+ position: relative;
+ background-image: none !important;
}
/* remove original sort icons */
@@ -140,50 +159,54 @@ table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_asc_disabled:before,
table.dataTable thead .sorting_desc_disabled:before {
- right: 0 !important;
- content: "" !important;
+ right: 0 !important;
+ content: "" !important;
}
/* custom sort icons */
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
- position: absolute;
- top: 6px;
- right: 8px;
- display: block;
- font-family: fontello;
- font-size: 0.8em;
- opacity: 1;
- color: #000;
+ position: absolute;
+ top: 6px;
+ right: 8px;
+ display: block;
+ font-family: fontello;
+ font-size: 0.8em;
+ opacity: 1;
+ color: #000;
}
table.dataTable thead th.sorting:after {
- content: "\F0DC";
- color: #ddd;
+ content: "\F0DC";
+ color: #ddd;
}
table.dataTable thead th.sorting_asc:after {
- content: "\f0de";
+ content: "\f0de";
}
table.dataTable thead th.sorting_desc:after {
- content: "\f0dd";
+ content: "\f0dd";
}
/*
* Modal related settings
*/
#copyMoveTree {
- max-height: 80vh;
- overflow: auto;
+ max-height: 80vh;
+ overflow: auto;
+}
+
+.modal-open {
+ padding-right: 0px !important;
}
@media (min-width: 576px) {
- .modal-dialog {
- max-width: 600px;
- margin: 1.75rem auto;
- }
+ .modal-dialog {
+ max-width: 600px;
+ margin: 1.75rem auto;
+ }
}
@media (min-width: 992px) {
- .modal-lg, .modal-xl {
- max-width: 800px;
- }
+ .modal-lg, .modal-xl {
+ max-width: 800px;
+ }
}
diff --git a/src/templates/app.html b/src/templates/app.html
index 92b39db..9924b38 100644
--- a/src/templates/app.html
+++ b/src/templates/app.html
@@ -1,108 +1,108 @@
-
+ {{^config.inline}}
+ fixed-top
+ {{/config.inline}} bg-dark">
+
-
{{i18n.upload_drop}}
+ {{i18n.upload_drop}}
-
-
-
-
-
- {{i18n.filename}}
- {{#config.download}}
-
- {{/config.download}}
- {{#config.showlastmodified}}
- {{i18n.last_modified}}
- {{/config.showlastmodified}}
- {{#config.showfilesize}}
- {{i18n.size}}
- {{/config.showfilesize}}
- {{#config.showpermissions}}
- {{i18n.permissions}}
- {{/config.showpermissions}}
- {{#config.showowner}}
- {{i18n.owner}}
- {{/config.showowner}}
- {{#config.showgroup}}
- {{i18n.group}}
- {{/config.showgroup}}
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{i18n.filename}}
+ {{#config.download}}
+
+ {{/config.download}}
+ {{#config.showlastmodified}}
+ {{i18n.last_modified}}
+ {{/config.showlastmodified}}
+ {{#config.showfilesize}}
+ {{i18n.size}}
+ {{/config.showfilesize}}
+ {{#config.showpermissions}}
+ {{i18n.permissions}}
+ {{/config.showpermissions}}
+ {{#config.showowner}}
+ {{i18n.owner}}
+ {{/config.showowner}}
+ {{#config.showgroup}}
+ {{i18n.group}}
+ {{/config.showgroup}}
+
+
+
+
+
+
+
+
diff --git a/src/templates/footer.html b/src/templates/footer.html
index d86b17f..ba01243 100644
--- a/src/templates/footer.html
+++ b/src/templates/footer.html
@@ -1,11 +1,11 @@
\ No newline at end of file
+
+
diff --git a/src/templates/login.html b/src/templates/login.html
index 89c0d32..4a93494 100644
--- a/src/templates/login.html
+++ b/src/templates/login.html
@@ -107,6 +107,7 @@ body {
IFM {{i18n.login}}
+ {{error}}
{{i18n.username}}
@@ -115,6 +116,8 @@ body {
{{i18n.password}}
+
+
{{i18n.login}}
\ No newline at end of file
diff --git a/src/templates/modal.ajaxrequest.html b/src/templates/modal.ajaxrequest.html
index a4707b6..59567c2 100644
--- a/src/templates/modal.ajaxrequest.html
+++ b/src/templates/modal.ajaxrequest.html
@@ -1,16 +1,31 @@
diff --git a/src/templates/modal.copymove.html b/src/templates/modal.copymove.html
index 0faeb4d..8a50312 100644
--- a/src/templates/modal.copymove.html
+++ b/src/templates/modal.copymove.html
@@ -1,13 +1,15 @@
-
{{i18n.select_destination}}:
-
+
diff --git a/src/templates/modal.createarchive.html b/src/templates/modal.createarchive.html
index 43e1300..20c4d65 100644
--- a/src/templates/modal.createarchive.html
+++ b/src/templates/modal.createarchive.html
@@ -1,12 +1,14 @@
diff --git a/src/templates/modal.createdir.html b/src/templates/modal.createdir.html
index e379b8a..b5e771c 100644
--- a/src/templates/modal.createdir.html
+++ b/src/templates/modal.createdir.html
@@ -1,12 +1,14 @@
diff --git a/src/templates/modal.extractfile.html b/src/templates/modal.extractfile.html
index a357ff8..ec3c0dd 100644
--- a/src/templates/modal.extractfile.html
+++ b/src/templates/modal.extractfile.html
@@ -1,29 +1,37 @@