zharnikov/yii2-dirbrowser

Yii2 server directory browser and filemanager

This package's canonical repository appears to be gone and the package has been frozen as a result.

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Type:yii2-extension

v1.0.2 2015-12-23 15:32 UTC

This package is auto-updated.

Last update: 2019-09-19 14:44:21 UTC


README

Simple Yii2 server directory filemanager

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist zharnikov/yii2-dirbrowser "*"

or add

"zharnikov/yii2-dirbrowser": "*"

to the require section of your composer.json file.

Usage

Warning! This extension allows to user to create new .php and other executable files and upload any files. It could be very danger on public service.

You can use it in your CMS or something like that.

Once the extension is installed, simply use it in your code by :

in your view:

#!php

<?php

echo DirbrowserWidget::widget([
		'options' => [
			'id'=>'main-db', //very important! use unique id for each dirbrowser
			'menu' => [
				['path' => '@runtime/testdirwdir/tf1' ],
				['path' => '@runtime/testdirwdir/tf2' ],
				['path' => '@runtime/testdirwfile'],
				['path'=>'@runtime'],
				['path'=>'@runtime/..'],
				['path'=>'@webroot', 'label'=>'Site WebRoot']	
			],
			//security restrictions
			//user will not be able to browse directories and files outside these:
			'accessibleDirs' => ['@runtime', '@webroot'],	
		]
	]);

?>

in your controller:

#!php

<?php

class YourController extends \yii\web\Controller {

    /* some code  */
    
    public function actions()
    {
        return [
            'dirbrowser-save-content' => 'dirbrowser\actions\SaveContentAction',
            'dirbrowser-upload' => 'dirbrowser\actions\UploadFileAction',
            'dirbrowser-remove' => 'dirbrowser\actions\RemoveAction',
            'dirbrowser-display-path' => 'dirbrowser\actions\DisplayPathAction',
            'dirbrowser-create-directory' => 'dirbrowser\actions\CreateDirectoryAction',
            'dirbrowser-create-file' => 'dirbrowser\actions\CreateFileAction',
        ];
    }

}

?>