curly_braces_position

This commit is contained in:
Nguyen Tran Chung 2022-12-02 13:19:15 +09:00
parent 941067da22
commit 9a2b4077ca
No known key found for this signature in database
GPG key ID: 1E47DA8A9B29876B

View file

@ -201,7 +201,8 @@ if (defined('FM_EMBED')) {
session_cache_limiter('');
session_name(FM_SESSION_ID);
function session_error_handling_function($code, $msg, $file, $line) {
function session_error_handling_function($code, $msg, $file, $line)
{
// Permission denied for default session, try to create a new one
if ($code == 2) {
session_abort();
@ -247,7 +248,8 @@ if (isset($_GET['logout'])) {
// Validate connection IP
if ($ip_ruleset != 'OFF') {
function getClientIP() {
function getClientIP()
{
if (array_key_exists('HTTP_CF_CONNECTING_IP', $_SERVER)) {
return $_SERVER['HTTP_CF_CONNECTING_IP'];
}elseif (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
@ -550,12 +552,14 @@ if (isset($_SESSION[FM_SESSION_ID]['logged'], $auth_users[$_SESSION[FM_SESSION_I
$path .= '/'.FM_PATH;
}
function event_callback($message) {
function event_callback($message)
{
global $callback;
echo json_encode($message);
}
function get_file_path() {
function get_file_path()
{
global $path, $fileinfo, $temp_file;
return $path.'/'.basename($fileinfo->name);
@ -948,7 +952,9 @@ if (!empty($_FILES) && !FM_READONLY) {
if ($out) {
$in = @fopen($tmp_name, 'rb');
if ($in) {
while ($buff = fread($in, 4096)) { fwrite($out, $buff); }
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
$response = array (
'status' => 'success',
'info' => 'file upload successful'
@ -1273,7 +1279,8 @@ if (isset($_GET['upload']) && !FM_READONLY) {
fm_show_header(); // HEADER
fm_show_nav_path(FM_PATH); // current path
//get the allowed file extensions
function getUploadExt() {
function getUploadExt()
{
$extArr = explode(',', FM_UPLOAD_EXTENSION);
if(FM_UPLOAD_EXTENSION && $extArr) {
array_walk($extArr, function (&$x) {$x = ".$x";});
@ -1473,7 +1480,8 @@ if (isset($_GET['settings']) && !FM_READONLY) {
<div class="col-sm-5">
<select class="form-select" id="js-language" name="js-language">
<?php
function getSelected($l) {
function getSelected($l)
{
global $lang;
return ($lang == $l) ? 'selected' : '';
@ -2410,7 +2418,8 @@ function fm_redirect($url, $code = 302)
* @param $path
* @return string
*/
function get_absolute_path($path) {
function get_absolute_path($path)
{
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
@ -2471,7 +2480,8 @@ function fm_get_parent_path($path)
* @param string $file
* @return bool
*/
function fm_is_exclude_items($file) {
function fm_is_exclude_items($file)
{
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if (isset($exclude_items) and count($exclude_items)) {
unset($exclude_items);
@ -2493,14 +2503,14 @@ function fm_is_exclude_items($file) {
* @param int $tr
* @return array
*/
function fm_get_translations($tr) {
function fm_get_translations($tr)
{
try {
$content = @file_get_contents('translation.json');
if($content !== false) {
$lng = json_decode($content, true);
global $lang_list;
foreach ($lng['language'] as $key => $value)
{
foreach ($lng['language'] as $key => $value) {
$code = $value['code'];
$lang_list[$code] = $value['name'];
if ($tr)
@ -2587,7 +2597,8 @@ function fm_get_filesize($size)
* @param string $directory Relative or absolute directory name.
* @return int Total number of bytes.
*/
function fm_get_directorysize($directory) {
function fm_get_directorysize($directory)
{
$bytes = 0;
$directory = realpath($directory);
if ($directory !== false && $directory != '' && file_exists($directory)) {
@ -2604,7 +2615,8 @@ function fm_get_directorysize($directory) {
* @param string $path
* @return array|bool
*/
function fm_get_zif_info($path, $ext) {
function fm_get_zif_info($path, $ext)
{
if ($ext == 'zip' && function_exists('zip_open')) {
$arch = @zip_open($path);
if ($arch) {
@ -2662,7 +2674,8 @@ function fm_enc($text)
* @param string $text
* @return string
*/
function fm_isvalid_filename($text) {
function fm_isvalid_filename($text)
{
return (strpbrk($text, '/?%*:|"<>') === false) ? true : false;
}
@ -3075,7 +3088,8 @@ function fm_get_file_mimes($extension)
* @param string $filter
* @return array|null
*/
function scan($dir = '', $filter = '') {
function scan($dir = '', $filter = '')
{
$path = FM_ROOT_PATH.'/'.$dir;
if($path) {
$ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
@ -3182,7 +3196,8 @@ function fm_download_file($fileLocation, $fileName, $chunkSize = 1024)
* If the theme is dark, return the text-white and bg-dark classes.
* @return string the value of the variable.
*/
function fm_get_theme() {
function fm_get_theme()
{
$result = '';
if(FM_THEME == 'dark') {
$result = 'text-white bg-dark';
@ -4177,7 +4192,8 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
* @param string $txt
* @return string
*/
function lng($txt) {
function lng($txt)
{
global $lang;
// English Language