fixed lng problems.

This commit is contained in:
Joao Alves 2021-05-20 14:01:57 +01:00
parent 7dc1bc3ed0
commit a11c3d0963

View file

@ -273,7 +273,7 @@ if($ip_ruleset != 'OFF'){
trigger_error('User connection denied from: ' . $clientIp, E_USER_WARNING);
if($ip_silent == false){
fm_set_msg('Access denied. IP restriction applicable', 'error');
fm_set_msg(lng('Access denied. IP restriction applicable'), 'error');
fm_show_header_login();
fm_show_message();
}
@ -433,7 +433,7 @@ if (isset($_POST['ajax']) && !FM_READONLY) {
$file = str_replace('/', '', fm_clean_path($_GET['edit']));
$file_path = os_path_join($path, $file);
if ($file == '' || !is_file($file_path)) {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
header('X-XSS-Protection:0');
@ -613,14 +613,14 @@ if (isset($_GET['del']) && !FM_READONLY) {
$file_path = os_path_join($path, $del);
$is_dir = is_dir($file_path);
if (fm_rdelete($file_path)) {
$msg = $is_dir ? 'Folder <b>%s</b> deleted' : 'File <b>%s</b> deleted';
$msg = $is_dir ? lng('Folder').' <b>%s</b> '.lng('Deleted') : lng('File').' <b>%s</b> '.lng('Deleted');
fm_set_msg(sprintf($msg, fm_enc($del)));
} else {
$msg = $is_dir ? 'Folder <b>%s</b> not deleted' : 'File <b>%s</b> not deleted';
$msg = $is_dir ? lng('Folder').' <b>%s</b> '.lng('not deleted') : lng('File').' <b>%s</b> '.lng('not deleted');
fm_set_msg(sprintf($msg, fm_enc($del)), 'error');
}
} else {
fm_set_msg('Invalid file or folder name', 'error');
fm_set_msg(lng('Invalid file or folder name'), 'error');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -638,7 +638,7 @@ if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) {
@fopen($file_path, 'w') or die('Cannot open file: ' . $new);
fm_set_msg(sprintf(lng('File').' <b>%s</b> '.lng('Created'), fm_enc($new)));
} else {
fm_set_msg('File extension is not allowed', 'error');
fm_set_msg(lng('File extension is not allowed'), 'error');
}
} else {
fm_set_msg(sprintf('File <b>%s</b> already exists', fm_enc($new)), 'alert');
@ -647,13 +647,13 @@ if (isset($_GET['new']) && isset($_GET['type']) && !FM_READONLY) {
if (fm_mkdir($file_path, false) === true) {
fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('Created'), $new));
} elseif (fm_mkdir($file_path, false) === $file_path) {
fm_set_msg(sprintf('Folder <b>%s</b> already exists', fm_enc($new)), 'alert');
fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('already exists'), fm_enc($new)), 'alert');
} else {
fm_set_msg(sprintf('Folder <b>%s</b> not created', fm_enc($new)), 'error');
fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('not created'), fm_enc($new)), 'error');
}
}
} else {
fm_set_msg('Invalid characters in file or folder name', 'error');
fm_set_msg(lng('Invalid characters in file or folder name'), 'error');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -664,7 +664,7 @@ if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
$copy = fm_clean_path($_GET['copy']);
// empty path
if ($copy == '') {
fm_set_msg('Source path not defined', 'error');
fm_set_msg(lng('Source path not defined'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
// abs path from
@ -679,18 +679,17 @@ if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
if ($move) { // Move and to != from so just perform move
$rename = fm_rename($from, $dest);
if ($rename) {
fm_set_msg(sprintf('Moved from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
fm_set_msg(sprintf(lng('Moved from').' <b>%s</b> '.lng('to').' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
} elseif ($rename === null) {
fm_set_msg('File or folder with this path already exists', 'alert');
fm_set_msg(lng('File or folder with this path already exists'), 'alert');
} else {
fm_set_msg(sprintf('Error while moving from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
fm_set_msg(sprintf(lng('Error while moving from').' <b>%s</b> '.lng('to').' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
}
} else { // Not move and to != from so copy with original name
if (fm_rcopy($from, $dest)) {
fm_set_msg(sprintf('Copied from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
fm_set_msg(sprintf(lng('Copied from').' <b>%s</b> '.lng('to').' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)));
} else {
fm_set_msg(sprintf('Error while copying from <b>%s</b> to <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
fm_set_msg(sprintf(lng('Error while copying from').' <b>%s</b> '.lng('to').' <b>%s</b>', fm_enc($copy), fm_enc($msg_from)), 'error');
}
}
} else {
@ -718,7 +717,7 @@ if (isset($_GET['copy'], $_GET['finish']) && !FM_READONLY) {
}
}
else{
fm_set_msg('Paths must be not equal', 'alert');
fm_set_msg(lng('Paths must be not equal'), 'alert');
}
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
@ -736,7 +735,7 @@ if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY)
$copy_to_path .= '/' . $copy_to;
}
if ($path == $copy_to_path) {
fm_set_msg('Paths must be not equal', 'alert');
fm_set_msg(lng('Paths must be not equal'), 'alert');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
if (!is_dir($copy_to_path)) {
@ -778,7 +777,7 @@ if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish']) && !FM_READONLY)
fm_set_msg($msg, 'error');
}
} else {
fm_set_msg('Nothing selected', 'alert');
fm_set_msg(lng('Nothing selected'), 'alert');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -794,12 +793,12 @@ if (isset($_GET['ren'], $_GET['to']) && !FM_READONLY) {
// rename
if (fm_isvalid_filename($new) && $old != '' && $new != '') {
if (fm_rename(os_path_join($path, $old), os_path_join($path, $new))) {
fm_set_msg(sprintf('Renamed from <b>%s</b> to <b>%s</b>', fm_enc($old), fm_enc($new)));
fm_set_msg(sprintf(lng('Renamed from').' <b>%s</b> '. lng('to').' <b>%s</b>', fm_enc($old), fm_enc($new)));
} else {
fm_set_msg(sprintf('Error while renaming from <b>%s</b> to <b>%s</b>', fm_enc($old), fm_enc($new)), 'error');
fm_set_msg(sprintf(lng('Error while renaming from').' <b>%s</b> '. lng('to').' <b>%s</b>', fm_enc($old), fm_enc($new)), 'error');
}
} else {
fm_set_msg('Invalid characters in file name', 'error');
fm_set_msg(lng('Invalid characters in file name'), 'error');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -813,7 +812,7 @@ if (isset($_GET['dl'])) {
fm_download_file($file_path, $dl, 1024);
exit;
} else {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
}
@ -830,7 +829,7 @@ if (isset($_GET['exec']) && !FM_READONLY) {
cmd_exec($file_path,$output, $error);
fm_set_msg("<PRE class=\"ok\">Output of command '{$file_path}':\n".implode("\n",$output). (count($error)>0 ? "\nstderr:\n".implode("\n", $error) : "") . "\n</PRE>");
} else {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -920,12 +919,12 @@ if (isset($_POST['group'], $_POST['delete']) && !FM_READONLY) {
}
}
if ($errors == 0) {
fm_set_msg('Selected files and folder deleted');
fm_set_msg(lng('Selected files and folder deleted'));
} else {
fm_set_msg('Error while deleting items', 'error');
fm_set_msg(lng('Error while deleting items'), 'error');
}
} else {
fm_set_msg('Nothing selected', 'alert');
fm_set_msg(lng('Nothing selected'), 'alert');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
@ -942,7 +941,7 @@ if (isset($_POST['group']) && (isset($_POST['zip']) || isset($_POST['tar'])) &&
if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
fm_set_msg('Operations with archives are not available', 'error');
fm_set_msg(lng('Operations with archives are not available'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -967,12 +966,12 @@ if (isset($_POST['group']) && (isset($_POST['zip']) || isset($_POST['tar'])) &&
}
if ($res) {
fm_set_msg(sprintf('Archive <b>%s</b> created', fm_enc($zipname)));
fm_set_msg(sprintf(lng('Archive').' <b>%s</b> '.lng('Created'), fm_enc($zipname)));
} else {
fm_set_msg('Archive not created', 'error');
fm_set_msg(lng('Archive not created'), 'error');
}
} else {
fm_set_msg('Nothing selected', 'alert');
fm_set_msg(lng('Nothing selected'), 'alert');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
@ -991,12 +990,12 @@ if (isset($_GET['unzip']) && !FM_READONLY) {
$ext = pathinfo($zip_path, PATHINFO_EXTENSION);
$isValid = true;
} else {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
}
if (($ext == "zip" && !class_exists('ZipArchive')) || ($ext == "tar" && !class_exists('PharData'))) {
fm_set_msg('Operations with archives are not available', 'error');
fm_set_msg(lng('Operations with archives are not available'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -1028,13 +1027,13 @@ if (isset($_GET['unzip']) && !FM_READONLY) {
}
if ($res) {
fm_set_msg('Archive unpacked');
fm_set_msg(lng('Archive unpacked'));
} else {
fm_set_msg('Archive not unpacked', 'error');
fm_set_msg(lng('Archive not unpacked'), 'error');
}
} else {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -1046,7 +1045,7 @@ if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {
$file = str_replace('/', '', fm_clean_path($_POST['chmod']));
$file_path = os_path_join($path, $file);
if ($file == '' || (!is_file($file_path) && !is_dir($file_path))) {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -1080,9 +1079,9 @@ if (isset($_POST['chmod']) && !FM_READONLY && !FM_IS_WIN) {
}
if (@chmod($file_path, $mode)) {
fm_set_msg('Permissions changed');
fm_set_msg(lng('Permissions changed'));
} else {
fm_set_msg('Permissions not changed', 'error');
fm_set_msg(lng('Permissions not changed'), 'error');
}
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
@ -1246,7 +1245,7 @@ if (isset($_GET['upload']) && !FM_READONLY) {
if (isset($_POST['copy']) && !FM_READONLY) {
$copy_files = isset($_POST['file']) ? $_POST['file'] : null;
if (!is_array($copy_files) || empty($copy_files)) {
fm_set_msg('Nothing selected', 'alert');
fm_set_msg(lng('Nothing selected'), 'alert');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -1292,7 +1291,7 @@ if (isset($_GET['copy']) && !isset($_GET['finish']) && !FM_READONLY) {
$copy = fm_clean_path($copy);
$copy_path = os_path_join(FM_ROOT_PATH, $copy);
if ($copy == '' || !file_exists($copy_path)) {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
@ -1310,7 +1309,7 @@ if (isset($_GET['copy']) && !isset($_GET['finish']) && !FM_READONLY) {
<b><a href="?p=<?php echo urlencode(FM_PATH) ?>&amp;copy=<?php echo urlencode($copy) ?>&amp;finish=1&amp;move=1"><i class="fa fa-check-circle"></i> Move</a></b> &nbsp;
<b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-times-circle"></i> Cancel</a></b>
</p>
<p><i>Select folder</i></p>
<p><i><?php echo lng('Select folder') ?></i></p>
<ul class="folders break-word">
<?php
if ($parent !== false) {
@ -1663,7 +1662,7 @@ if (isset($_GET['view'])) {
}
echo '</code>';
} else {
echo '<p>Error while fetching archive info</p>';
echo '<p>'.lng('Error while fetching archive info').'</p>';
}
} elseif ($is_image) {
// Image content
@ -1717,7 +1716,7 @@ if (isset($_GET['edit'])) {
$file = str_replace('/', '', fm_clean_path($_GET['edit'], false));
$file_path = os_path_join($path, $file);
if ($file == '' || !is_file($file_path)) {
fm_set_msg('File not found', 'error');
fm_set_msg(lng('File not found'), 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
header('X-XSS-Protection:0');
@ -1740,7 +1739,7 @@ if (isset($_GET['edit'])) {
$fd = fopen($file_path, "w");
@fwrite($fd, $writedata);
fclose($fd);
fm_set_msg('File Saved Successfully');
fm_set_msg(lng('File Saved Successfully'));
}
$ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
@ -1784,7 +1783,7 @@ if (isset($_GET['edit'])) {
<?php if ($is_text) { ?>
<?php if ($isNormalEditor) { ?>
<a title="Advanced" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;edit=<?php echo urlencode($file) ?>&amp;env=ace"><i class="fa fa-pencil-square-o"></i> <?php echo lng('AdvancedEditor') ?></a>
<button type="button" class="btn btn-sm btn-outline-primary name="Save" data-url="<?php echo fm_enc($file_url) ?>" onclick="edit_save(this,'nrl')"><i class="fa fa-floppy-o"></i> Save
<button type="button" class="btn btn-sm btn-outline-primary name="Save" data-url="<?php echo fm_enc($file_url) ?>" onclick="edit_save(this,'nrl')"><i class="fa fa-floppy-o"></i> <?php echo lng('Save') ?>
</button>
<?php } else { ?>
<a title="Plain Editor" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&amp;edit=<?php echo urlencode($file) ?>"><i class="fa fa-text-height"></i> <?php echo lng('NormalEditor') ?></a>
@ -1800,7 +1799,7 @@ if (isset($_GET['edit'])) {
} elseif ($is_text) {
echo '<div id="editor" contenteditable="true">' . htmlspecialchars($content) . '</div>';
} else {
fm_set_msg('FILE EXTENSION HAS NOT SUPPORTED', 'error');
fm_set_msg(lng('FILE EXTENSION HAS NOT SUPPORTED'), 'error');
}
?>
</div>
@ -2175,11 +2174,11 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
<li class="list-inline-item"> <a href="#/select-all" class="btn btn-small btn-outline-primary btn-2" onclick="select_all();return false;"><i class="fa fa-check-square"></i> <?php echo lng('SelectAll') ?> </a></li>
<li class="list-inline-item"><a href="#/unselect-all" class="btn btn-small btn-outline-primary btn-2" onclick="unselect_all();return false;"><i class="fa fa-window-close"></i> <?php echo lng('UnSelectAll') ?> </a></li>
<li class="list-inline-item"><a href="#/invert-all" class="btn btn-small btn-outline-primary btn-2" onclick="invert_all();return false;"><i class="fa fa-th-list"></i> <?php echo lng('InvertSelection') ?> </a></li>
<li class="list-inline-item"><input type="submit" class="hidden" name="delete" id="a-delete" value="Delete" onclick="return confirm('Delete selected files and folders?')">
<li class="list-inline-item"><input type="submit" class="hidden" name="delete" id="a-delete" value="Delete" onclick="return confirm('<?php echo lng('Delete selected files and folders?'); ?>')">
<a href="javascript:document.getElementById('a-delete').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-trash"></i> <?php echo lng('Delete') ?> </a></li>
<li class="list-inline-item"><input type="submit" class="hidden" name="zip" id="a-zip" value="zip" onclick="return confirm('Create archive?')">
<li class="list-inline-item"><input type="submit" class="hidden" name="zip" id="a-zip" value="zip" onclick="return confirm('<?php echo lng('Create archive?'); ?>')">
<a href="javascript:document.getElementById('a-zip').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Zip') ?> </a></li>
<li class="list-inline-item"><input type="submit" class="hidden" name="tar" id="a-tar" value="tar" onclick="return confirm('Create archive?')">
<li class="list-inline-item"><input type="submit" class="hidden" name="tar" id="a-tar" value="tar" onclick="return confirm('<?php echo lng('Create archive?'); ?>')">
<a href="javascript:document.getElementById('a-tar').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Tar') ?> </a></li>
<li class="list-inline-item"><input type="submit" class="hidden" name="copy" id="a-copy" value="Copy">
<a href="javascript:document.getElementById('a-copy').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-files-o"></i> <?php echo lng('Copy') ?> </a></li>
@ -3453,7 +3452,7 @@ function fm_show_nav_path($path)
<div class="input-group-append btn-group">
<span class="input-group-text dropdown-toggle" id="search-addon2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="<?php echo $path2 = $path ? $path : '.'; ?>" id="js-search-modal" data-toggle="modal" data-target="#searchModal">Advanced Search</a>
<a class="dropdown-item" href="<?php echo $path2 = $path ? $path : '.'; ?>" id="js-search-modal" data-toggle="modal" data-target="#searchModal"><?php echo lng('Advanced Search') ?></a>
</div>
</div>
</div>
@ -3795,7 +3794,7 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
<form action="" method="post">
<div class="lds-facebook"><div></div><div></div><div></div></div>
<ul id="search-wrapper">
<p class="m-2">Search file in folder and subfolders...</p>
<p class="m-2"><?php echo lng('Search file in folder and subfolders...') ?></p>
</ul>
</form>
</div>