PHP 8.2.30
Preview: filemanager.php Size: 3.67 KB
//var/softaculous/dada/filemanager.php

<?php


ini_set('session.save_path',realpath('[[softdatadir]]/.dada_files/.tmp/php_sessions'));

/**
 * Entry point for PHP connector, put your customizations here.
 *
 * @license     MIT License
 * @author      Pavel Solomienko <https://github.com/servocoder/>
 * @copyright   Authors
 */

// only for debug
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// ini_set('display_errors', '1');

require_once 'vendor/autoload.php';
require_once __DIR__ . '/events.php';

// fix display non-latin chars correctly
// https://github.com/servocoder/RichFilemanager/issues/7
setlocale(LC_CTYPE, 'en_US.UTF-8');

// fix for undefined timezone in php.ini
// https://github.com/servocoder/RichFilemanager/issues/43
if(!ini_get('date.timezone')) {
    date_default_timezone_set('GMT');
}


// This function is called for every server connection. It must return true.
//
// Implement this function to authenticate the user, for example to check a
// password login, or restrict client IP address.
//
// This function only authorizes the user to connect and/or load the initial page.
// Authorization for individual files or dirs is provided by the two functions below.
//
// NOTE: If using session variables, the session must be started first (session_start()).
function fm_authenticate()
{	
    session_start();
    return isset($_SESSION['rfm_authenticated']) && $_SESSION['rfm_session_id'] == $_COOKIE["dadalogin"];
	
}

// This function is called before any filesystem read operation, where
// $filepath is the file or directory being read. It must return true,
// otherwise the read operation will be denied.
//
// Implement this function to do custom individual-file permission checks, such as
// user/group authorization from a database, or session variables, or any other custom logic.
//
// Note that this is not the only permissions check that must pass. The read operation
// must also pass:
//   * Filesystem permissions (if any), e.g. POSIX `rwx` permissions on Linux
//   * The $filepath must be allowed according to config['patterns'] and config['extensions']
//
function fm_has_read_permission($filepath)
{
    // Customize this code as desired.
    return true;
}


// This function is called before any filesystem write operation, where
// $filepath is the file or directory being written to. It must return true,
// otherwise the write operation will be denied.
//
// Implement this function to do custom individual-file permission checks, such as
// user/group authorization from a database, or session variables, or any other custom logic.
//
// Note that this is not the only permissions check that must pass. The write operation
// must also pass:
//   * Filesystem permissions (if any), e.g. POSIX `rwx` permissions on Linux
//   * The $filepath must be allowed according to config['patterns'] and config['extensions']
//   * config['read_only'] must be set to false, otherwise all writes are disabled
//
function fm_has_write_permission($filepath)
{
    // Customize this code as desired.
    return true;
}


$config = [];

// example to override the default config
//$config = [
//    'security' => [
//        'readOnly' => true,
//        'extensions' => [
//            'policy' => 'ALLOW_LIST',
//            'restrictions' => [
//                'jpg',
//                'jpe',
//                'jpeg',
//                'gif',
//                'png',
//            ],
//        ],
//    ],
//];

$app = new \RFM\Application();

// uncomment to use events
//$app->registerEventsListeners();

$local = new \RFM\Repository\Local\Storage($config);

// example to setup files root folder
//$local->setRoot('userfiles', true, true);

$app->setStorage($local);

// set application API
$app->api = new RFM\Api\LocalApi();

$app->run();

Directory Contents

Dirs: 6 × Files: 17

Name Size Perms Modified Actions
images DIR
- drwxr-xr-x 2024-05-04 03:02:59
Edit Download
php53 DIR
- drwxr-xr-x 2024-05-04 03:02:59
Edit Download
php56 DIR
- drwxr-xr-x 2024-05-04 03:02:59
Edit Download
php71 DIR
- drwxr-xr-x 2024-05-04 03:02:59
Edit Download
php81 DIR
- drwxr-xr-x 2024-05-04 03:02:59
Edit Download
php82 DIR
- drwxr-xr-x 2024-05-04 03:02:59
Edit Download
14.94 KB lrw-r--r-- 2023-11-20 05:31:00
Edit Download
788 B lrw-r--r-- 2022-10-04 11:38:04
Edit Download
9.30 KB lrw-r--r-- 2022-10-04 11:38:04
Edit Download
60.70 KB lrw-r--r-- 2023-11-20 05:31:00
Edit Download
2.73 KB lrw-r--r-- 2022-10-04 11:38:04
Edit Download
90 B lrw-r--r-- 2022-10-04 11:38:04
Edit Download
4.93 KB lrw-r--r-- 2022-10-04 11:38:04
Edit Download
3.67 KB lrw-r--r-- 2022-10-04 11:38:04
Edit Download
3.06 KB lrw-r--r-- 2024-05-02 10:57:34
Edit Download
3.48 KB lrw-r--r-- 2024-05-02 10:25:50
Edit Download
924 B lrw-r--r-- 2021-12-23 11:54:36
Edit Download
8.56 KB lrw-r--r-- 2024-05-02 10:57:34
Edit Download
1.72 KB lrw-r--r-- 2021-12-23 11:54:36
Edit Download
6.32 KB lrw-r--r-- 2024-05-02 10:57:34
Edit Download
1.62 KB lrw-r--r-- 2023-11-20 05:31:00
Edit Download
23 B lrw-r--r-- 2021-12-23 11:54:36
Edit Download
2.25 KB lrw-r--r-- 2022-10-04 11:38:04
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).