1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-09 17:46:31 +02:00

More coding-style fixes.

Signed-off-by: Marco Dickert <marco@misterunknown.de>
This commit is contained in:
Marco Dickert
2020-10-15 17:13:04 +02:00
parent 5ee3e4a8dc
commit 2edf48cb9b
3 changed files with 15 additions and 14 deletions

View File

@@ -2035,12 +2035,15 @@ function IFM(params) {
// handle window.onbeforeunload
window.onbeforeunload = self.onbeforeunloadHandler;
/*
// load initial file table
if( window.location.hash ) {
self.changeDirectory( decodeURIComponent( window.location.hash.substring( 1 ) ) );
} else {
this.refreshFileTable();
}
*/
console.log("Finished initialisation without file table");
};
this.init = function(id) {

View File

@@ -164,9 +164,9 @@ f00bar;
else
$this->getInlineApplication();
} catch (IFMException $e) {
throw new IFMException($e->getMessage());
$this->jsonResponse(["status" => "ERROR", "message" => $e->getMessage()]);
} catch (Exception $e) {
throw new IFMException($e->getMessage());
$this->jsonResponse(["status" => "ERROR", "message" => $e->getMessage()]);
}
}
@@ -243,9 +243,7 @@ f00bar;
*/
private function getI18N($lang="en") {
if (in_array($lang, array_keys($i18n)))
// Merge english with the language in case of missing keys
if (in_array($lang, array_keys($this->i18n)))
return array_merge($this->i18n['en'], $this->i18n[$lang]);
else
return $this->i18n['en'];
@@ -342,7 +340,7 @@ f00bar;
usort($dirs, [$this, "sortByName"]);
usort($files, [$this, "sortByName"]);
return array_merge($dirs, $files);
return ["data" => array_merge($dirs, $files)];
}
private function getItemInformation($name) {
@@ -556,7 +554,7 @@ f00bar;
throw new IFMException($this->l('invalid_dir'));
if (@mkdir($dn))
return ["status" => "OK", "message" => $this->l('folder_create_success')]);
return ["status" => "OK", "message" => $this->l('folder_create_success')];
else
throw new IFMException($this->l('folder_create_error').". ".error_get_last()['message']);
}
@@ -574,7 +572,7 @@ f00bar;
// work around magic quotes
$content = get_magic_quotes_gpc() == 1 ? stripslashes($d['content']) : $d['content'];
if (@file_put_contents($d['filename'], $content) !== false)
return ["status" => "OK", "message" => $this->l('file_save_success')]);
return ["status" => "OK", "message" => $this->l('file_save_success')];
else
throw new Exception($this->l('file_save_error'));
} else
@@ -593,7 +591,7 @@ f00bar;
$content = @file_get_contents($d['filename']);
if (function_exists("mb_check_encoding") && !mb_check_encoding($content, "UTF-8"))
$content = utf8_encode($content);
return ["status" => "OK", "data" => ["filename" => $d['filename'], "content" => $content]]);
return ["status" => "OK", "data" => ["filename" => $d['filename'], "content" => $content]];
} else
throw new IFMException($this->l('file_not_found'));
}
@@ -623,7 +621,7 @@ f00bar;
}
}
if (empty($err))
return ["status" => "OK", "message" => $this->l('file_delete_success'), "errflag" => "1"]);
return ["status" => "OK", "message" => $this->l('file_delete_success'), "errflag" => "1"];
else {
$errmsg = $this->l('file_delete_error') . "<ul>";
foreach ($err as $item)
@@ -638,7 +636,7 @@ f00bar;
if ($this->config['rename'] != 1)
throw new IFMException($this->l('nopermissions'));
elseif (!$this->isFilenameValid($d['filename']) || !$this->isFilenameValid($d['newname']))
throw new IFMException($this->l('invalid_filename')));
throw new IFMException($this->l('invalid_filename'));
if (@rename($d['filename'], $d['newname']))
return ["status" => "OK", "message" => $this->l('file_rename_success')];
@@ -912,8 +910,8 @@ f00bar;
private function l($str) {
if (isset($_REQUEST['lang'])
&& in_array($_REQUEST['lang'], array_keys($this->i18n))
&& isset($this->i18n[$_REQUEST['lang'][$str]))
return $this->i18n[$_REQUEST['lang'][$str];
&& isset($this->i18n[$_REQUEST['lang']][$str]))
return $this->i18n[$_REQUEST['lang']][$str];
else
return $this->i18n['en'][$str];
}

View File

@@ -103,7 +103,7 @@ body {
}
</style>
<form id="loginForm" class="form-signin">
<form id="loginForm" class="form-signin" method="post">
<div class="text-center mb-4">
<h1 class="h3 mb-3 font-weight-normal">IFM {{i18n.login}}</h1>
</div>