Jump to content

Recommended Posts

Hello guys,

 

I do not know if anyone work or have worked with the "elFinder (file manager)" .. I incorporate "elFinder" to my platform ..

I have the following question ..

Have its connector:

<?php

error_reporting(0); // Set E_ALL for debuging

include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php';
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php';
// Required for MySQL storage connector
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
// Required for FTP connector support
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';


/**
 * Simple function to demonstrate how to control file access using "accessControl" callback.
 * This method will disable accessing files/folders starting from  '.' (dot)
 *
 * @param  string  $attr  attribute name (read|write|locked|hidden)
 * @param  string  $path  file path relative to volume root directory started with directory separator
 * @return bool|null
 **/
function access($attr, $path, $data, $volume) {
	return strpos(basename($path), '.') === 0       // if file/folder begins with '.' (dot)
		? !($attr == 'read' || $attr == 'write')    // set read+write to false, other (locked+hidden) set to true
		:  null;                                    // else elFinder decide it itself
}

$opts = array(
	// 'debug' => true,
	'roots' => array(
		array(
			'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
			'path'          => '/home/',         // path to files (REQUIRED)
			'URL'           => dirname($_SERVER['PHP_SELF']) . '/home/', // URL to files (REQUIRED)
			'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
		)
	)
);

// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();
I want him to make the call the "$screen" (folder will be created automatically by the user) of each user .. and not the "/home/" (as an example of put) .. the "$screen" comes from my platform, and I add the "elFinder" to it ..

Imagine that each user creates "1/2/3 or 4, etc .." folders ..
The user then enters the "elFinder" and see the folder created "1/2/3 or 4" (created on the left side of the folders ) and want only see your folders him.

 

My Example..

 

It gives me error when I try to use these functions .. I use these functions for the "$screen" ..
Of course, that I try connect only the folder .. but the result was 0 ..
//za screen imeto
function clean($string) {
   $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
   $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.

   return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
}
//end

$srvname = mysql_real_escape_string(trim($_POST['servername'])); //ime na servera
$port = (int)$_POST['ports']; //port na servera
$ip = mysql_real_escape_string(trim($_POST['serverip'])); //serverip

$screen = clean($srvname).$port.'_'.uniqid(); //screen imeto
$dir = "/home/";

$opts = array(
	// 'debug' => true,
	'roots' => array(
		array(
			'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
			'path'          => '$dir/$screen',         // path to files (REQUIRED)
			'URL'           => dirname($_SERVER['PHP_SELF']) . '$dir/$screen', // URL to files (REQUIRED)
			'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
		)
	)
);

This example of more folders..

$opts = array(
    'roots' => array(
        array(
            'driver'        => 'LocalFileSystem',           // driver for accessing file system (REQUIRED)
            'path'          => 'path/to/files/first_root',  // path to files (REQUIRED)
            'URL'           => 'http://localhost/files/first_root/',   // URL to files (REQUIRED)
            'alias'         => 'First home', // The name to replace your actual path name. (OPTIONAL)
            'accessControl' => 'access'      // disable and hide dot starting files (OPTIONAL)
        ),
        array(
            'driver'        => 'LocalFileSystem',
            'path'          => 'path/to/files/second_root',
            'URL'           => 'http://localhost/files/second_root/',
            'alias'         => 'Second home'
        )
    )
);

But I need to be automatic, for each creation of user..

I use the variable "$screen" to create automatic folder of user.. but how to call the database of $screen ? the $screen exist only on my platform..

 

I don't know if you understand me..

 

 

Regards,

Joob

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.