Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ tsconfig.json
tsconfig.node.json
vite.config.mts
.vscode
vendor/typisttech
vendor/typisttech
libs/elFinder/php/.tmp/.htaccess
libs/elFinder/files/.trash/.gitignore
libs/elFinder/files/.gitignore
.github
90 changes: 90 additions & 0 deletions .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: WordPress Plugin Check

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
PLUGIN_SLUG: file-manager

jobs:
plugin-check:
name: Plugin Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer:v2, wp-cli

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Setup package cache
uses: actions/cache@v4
with:
path: |
${{ steps.pnpm-cache.outputs.dir }}
${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-plugin-check-${{ hashFiles('**/pnpm-lock.yaml', '**/composer.lock') }}
restore-keys: |
${{ runner.os }}-plugin-check-

- name: Build plugin
run: |
pnpm production
pnpm build:copy

- name: WordPress Plugin Check
uses: wordpress/plugin-check-action@v1
with:
build-dir: './build/${{ env.PLUGIN_SLUG }}'
exclude-directories: |
vendor
node_modules
libs
categories: |
general
security
performance
accessibility
plugin_repo
checks: |
i18n_usage
late_escaping
plugin_readme
file_type
performant_wp_query_params
plugin_updater
enqueued_scripts_size
plugin_review_phpcs
trademarks
8 changes: 4 additions & 4 deletions backend/app/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class Config

const VAR_PREFIX = 'bit_fm_';

const VERSION = '6.8.6';
const VERSION = '6.8.9';
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Config::VERSION is set to '6.8.9' but the readme.txt shows version 6.8.7 and the file-manager.php header shows 6.8.7. All version numbers across the plugin should be consistent.

Copilot uses AI. Check for mistakes.

const VERSION_ID = 686;
const VERSION_ID = 689;

const DB_VERSION = '1.0';

Expand Down Expand Up @@ -63,7 +63,7 @@ public static function get($type, $default = null)
return plugin_dir_path(self::get('MAIN_FILE')) . 'backend';

case 'SITE_URL':
$parsedUrl = parse_url(get_admin_url());
$parsedUrl = wp_parse_url(get_admin_url());
$siteUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
$siteUrl .= empty($parsedUrl['port']) ? null : ':' . $parsedUrl['port'];

Expand All @@ -81,7 +81,7 @@ public static function get($type, $default = null)
];

case 'ROOT_URI':
return set_url_scheme(plugins_url('', self::get('MAIN_FILE')), parse_url(home_url())['scheme']);
return set_url_scheme(plugins_url('', self::get('MAIN_FILE')), wp_parse_url(home_url())['scheme']);

case 'ASSET_URI':
return self::get('ROOT_URI') . '/assets';
Expand Down
9 changes: 6 additions & 3 deletions backend/app/Http/Controllers/FileManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

use BitApps\FM\Config;
use BitApps\FM\Exception\PreCommandException;

use function BitApps\FM\Functions\fileSystemAdapter;

use BitApps\FM\Plugin;
use BitApps\FM\Providers\FileManager\FileManagerProvider;
use BitApps\FM\Providers\FileManager\FileRoot;
use BitApps\FM\Providers\FileManager\Options;
use BitApps\FM\Vendor\BitApps\WPKit\Utils\Capabilities;
use Error;

use Exception;

final class FileManagerController
Expand All @@ -22,7 +25,7 @@
public function connector()
{
try {
Plugin::instance()->accessControl()->checkPermission(sanitize_key($_REQUEST['cmd']));

Check warning on line 28 in backend/app/Http/Controllers/FileManagerController.php

View workflow job for this annotation

GitHub Actions / Plugin Check

WordPress.Security.ValidatedSanitizedInput.InputNotValidated

Detected usage of a possibly undefined superglobal array index: $_REQUEST['cmd']. Check that the array index exists before using it.

Check warning on line 28 in backend/app/Http/Controllers/FileManagerController.php

View workflow job for this annotation

GitHub Actions / Plugin Check

WordPress.Security.NonceVerification.Recommended

Processing form data without nonce verification.
$finderProvider = new FileManagerProvider($this->getFinderOptions());
$finderProvider->getFinder()->run();
} catch (Exception $th) {
Expand Down Expand Up @@ -68,7 +71,7 @@
'zipdl.pre file.pre rename.pre put.pre rm.pre chmod.pre mkdir.pre mkfile.pre extract.pre',
[Plugin::instance()->logger(), 'log']
);

$finderOptions->setBind(
'upload',
[Plugin::instance()->logger(), 'logUpload']
Expand Down Expand Up @@ -177,7 +180,7 @@
$this->setAllowedFileType($baseRoot);
}

if (is_writable(stripslashes($preferences->getRootPath()) . DIRECTORY_SEPARATOR . '.tmbPath')) {
if (fileSystemAdapter()->is_writable(stripslashes($preferences->getRootPath()) . DIRECTORY_SEPARATOR . '.tmbPath')) {
$baseRoot->setOption('tmbPath', '.tmb');
}

Expand Down
4 changes: 3 additions & 1 deletion backend/app/Http/Controllers/LogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public function all(Request $request)

public function delete(DeleteLogRequest $request)
{
$validatedIds = array_map(function($id) { return intval($id);}, $request->ids);
$validatedIds = array_map(function ($id) {
return \intval($id);
}, $request->ids);
Comment on lines +35 to +37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the current implementation is correct, it can be simplified. Instead of using an anonymous function with array_map, you can directly pass 'intval' as a callable string. This is more concise and generally more readable.

        $validatedIds = array_map('intval', $request->ids);

$status = $this->logger->delete($validatedIds);
if ($status) {
return Response::success([])->message('log deleted successfully');
Expand Down
10 changes: 5 additions & 5 deletions backend/app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace BitApps\FM\Http\Controllers;

use BitApps\FM\Vendor\BitApps\WPKit\Http\Response;
use BitApps\FM\Http\Requests\Settings\LangUpdateRequest;
use BitApps\FM\Http\Requests\Settings\SettingsRequest;
use BitApps\FM\Http\Requests\Settings\SettingsUpdateRequest;
use BitApps\FM\Http\Requests\Settings\ThemeUpdateRequest;
use BitApps\FM\Http\Requests\Settings\ToggleViewRequest;
use BitApps\FM\Plugin;
use BitApps\FM\Providers\PreferenceProvider;
use BitApps\FM\Vendor\BitApps\WPKit\Http\Response;

final class SettingsController
{
Expand Down Expand Up @@ -83,10 +83,10 @@ public function updateTheme(ThemeUpdateRequest $request)
$prefs = Plugin::instance()->preferences();
$prefs->setTheme($reqData['theme']);
if ($prefs->saveOptions()) {
return Response::success([])->message(__('Theme updated successfully', 'file-manger'));
return Response::success([])->message(__('Theme updated successfully', 'file-manager'));
}

return Response::error([])->message(__('Failed to update theme', 'file-manger'));
return Response::error([])->message(__('Failed to update theme', 'file-manager'));
}

public function getLanguages()
Expand All @@ -100,9 +100,9 @@ public function updateLanguage(LangUpdateRequest $request)
$prefs = Plugin::instance()->preferences();
$prefs->setLang($reqData['lang']);
if ($prefs->saveOptions()) {
return Response::success([])->message(__('Language updated successfully', 'file-manger'));
return Response::success([])->message(__('Language updated successfully', 'file-manager'));
}

return Response::error([])->message(__('Failed to update language', 'file-manger'));
return Response::error([])->message(__('Failed to update language', 'file-manager'));
}
}
10 changes: 4 additions & 6 deletions backend/app/Http/Middleware/NonceCheckerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ public function handle(Request $request, $role, ...$params)
)
) {
$response = \in_array($request->getRoute()->getPath(), ['connector', 'connector_front'])
? wp_json_encode(['error' => __('Token expired. please reload the page', 'file-manager')])
: wp_json_encode(
[
? ['error' => __('Token expired. please reload the page', 'file-manager')]
: [
'message' => __('Token expired. please reload the page', 'file-manager'),
'code' => 'INVALID_NONCE',
'status' => 'error',
]
);
];

echo $response;
echo wp_json_encode($response);
wp_die();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace BitApps\FM\Http\Requests\Permissions;

use BitApps\FM\Vendor\BitApps\WPKit\Http\Request\Request;
use BitApps\FM\Vendor\BitApps\WPKit\Utils\Capabilities;
use BitApps\FM\Http\Rules\ValidateCommandsRule;
use BitApps\FM\Http\Rules\ValidateRolesRule;
use BitApps\FM\Http\Rules\ValidateUsersRule;
use BitApps\FM\Http\Rules\ValidPathRule;
use BitApps\FM\Vendor\BitApps\WPKit\Http\Request\Request;
use BitApps\FM\Vendor\BitApps\WPKit\Utils\Capabilities;

class PermissionsUpdateRequest extends Request
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class SearchUserRequest extends Request
public function authorize()
{
return Capabilities::filter('bitapps_fm_can_search_user', 'list_users');

}

public function rules()
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Requests/Settings/LangUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace BitApps\FM\Http\Requests\Settings;

use BitApps\FM\Http\Rules\ValidateLangRule;
use BitApps\FM\Vendor\BitApps\WPKit\Http\Request\Request;
use BitApps\FM\Vendor\BitApps\WPKit\Utils\Capabilities;
use BitApps\FM\Http\Rules\ValidateLangRule;

class LangUpdateRequest extends Request
{
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Requests/Settings/ThemeUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace BitApps\FM\Http\Requests\Settings;

use BitApps\FM\Http\Rules\ValidateThemeRule;
use BitApps\FM\Vendor\BitApps\WPKit\Http\Request\Request;
use BitApps\FM\Vendor\BitApps\WPKit\Utils\Capabilities;
use BitApps\FM\Http\Rules\ValidateThemeRule;

class ThemeUpdateRequest extends Request
{
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Rules/ValidateCommandsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace BitApps\FM\Http\Rules;

use BitApps\FM\Vendor\BitApps\WPValidator\Rule;
use BitApps\FM\Plugin;
use BitApps\FM\Vendor\BitApps\WPValidator\Rule;

class ValidateCommandsRule extends Rule
{
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Rules/ValidateLangRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace BitApps\FM\Http\Rules;

use BitApps\FM\Vendor\BitApps\WPValidator\Rule;
use BitApps\FM\Plugin;
use BitApps\FM\Vendor\BitApps\WPValidator\Rule;

class ValidateLangRule extends Rule
{
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Rules/ValidateRolesRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace BitApps\FM\Http\Rules;

use BitApps\FM\Vendor\BitApps\WPValidator\Rule;
use BitApps\FM\Plugin;
use BitApps\FM\Vendor\BitApps\WPValidator\Rule;

class ValidateRolesRule extends Rule
{
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Rules/ValidateThemeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace BitApps\FM\Http\Rules;

use BitApps\FM\Vendor\BitApps\WPValidator\Rule;
use BitApps\FM\Plugin;
use BitApps\FM\Vendor\BitApps\WPValidator\Rule;

class ValidateThemeRule extends Rule
{
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Rules/ValidateUsersRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace BitApps\FM\Http\Rules;

use BitApps\FM\Vendor\BitApps\WPValidator\Rule;
use BitApps\FM\Plugin;
use BitApps\FM\Vendor\BitApps\WPValidator\Rule;

class ValidateUsersRule extends Rule
{
Expand Down
7 changes: 4 additions & 3 deletions backend/app/Model/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ class Log extends Model
{
public $timestamps = false;

protected $prefix = Config::VAR_PREFIX;

public $casts = ['details' => 'object'];

protected $prefix = Config::VAR_PREFIX;

protected $fillable = [
'user_id',
'command',
'details',
'created_at',
];

public function user() {
public function user()
{
return $this->hasOne(User::class, 'ID', 'user_id');
}
}
6 changes: 5 additions & 1 deletion backend/app/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace BitApps\FM\Model;

use BitApps\FM\Config;
use BitApps\FM\Vendor\BitApps\WPDatabase\Model;

/**
Expand All @@ -20,4 +19,9 @@ class User extends Model
protected $prefix = '';

protected $fillable = [];

public function log()
{
return $this->hasMany(Log::class, 'user_id', 'ID');
}
Comment on lines +23 to +26
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name 'log' is ambiguous and could conflict with logging functionality. Consider renaming to 'logs' (plural) to better indicate it returns a collection of log records.

Copilot uses AI. Check for mistakes.
}
3 changes: 2 additions & 1 deletion backend/app/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace BitApps\FM;

use function BitApps\FM\Functions\fileSystemAdapter;
use function BitApps\FM\Functions\view;

use BitApps\FM\Http\Middleware\CapCheckerMiddleware;
Expand Down Expand Up @@ -424,7 +425,7 @@ protected function setPhpIniVars()
private function uploadFolder()
{
if (!is_dir(FM_UPLOAD_BASE_DIR)) {
mkdir(FM_UPLOAD_BASE_DIR, 0755);
fileSystemAdapter()->mkdir(FM_UPLOAD_BASE_DIR, 0755);
}
}
}
Loading
Loading