file management system (OOP Please)
Moderator: General Moderators
file management system (OOP Please)
I am looking for a decent (preferably object-oriented) file management system built with php that would be sorta modular and fairly easily brandable. Suggestions please!
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: file management system (OOP Please)
What are you looking for in a file manager?The Ninja Space Goat wrote:I am looking for a decent (preferably object-oriented) file management system built with php that would be sorta modular and fairly easily brandable. Suggestions please!
I have one, but it'll cost ya per license, especially if you use it multiple times...and especially if you rebrand it!!!
What do you need it for?
Here are primary the features:
- Easily rebrandable, template driven
- Very modular design, multi-language support (only English lang packs right now)
- Multiple file/folder Move, Copy, Delete
- Single file/folder rename
- Multiple file upload (5 at a time, but this can be easily changed to any number)
You can restrict the size of file uploads, which type of files, etc...I adress the security concern of rouge PHP files being executed, by disallowing renaming of file extensions once on the server...if you allow PHP uploads, your at risk...you specify which file types are safe...not visa versa...a principle of least privelege approach to security
You can also restrict it's use to a root of your choice...not nessecarily server doc root...
I have some code kicking around for CHMOD and .htaccess but it's not part of the current release...and development has stalled and taken a back seat, so updates (unless you pay me) are likely going to be slow...
There is also a very trivial CMS built into it...does nothing but makes it easy to create static URL web pages...and nothing more...
Anyways, PM me details of how you plan on using it, etc...and we can maybe work something out...
Otherwise, look into http://www.solitude.dk/filethingie/install.php
Not exactly modular but it's free...although I don't know if they'd appreciate rebranding as most open source software at a minimum want some kind of recognition for their works
Cheers
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
The most important feature it must have is multiple logins with different permissions (3 levels, admin - can do anything, user - can upload/download not delete, and visitor who can only download). It MUST be brandable. It needs to be able to upload/download/delete directories and files, and restrict file type and size. I think that is all.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Just curious...
Despite my current release not being what your looking for, my next version will be a complete re-write and more closely modell after MVC, etc...
It will be more enterprise in nature than my current version...
Anyways, you express re-branding as important...so I assume your willing to shell out cash...
In which case I ask the question...what do you feel is a fare price?
- On a per license basis
- Volume discount basis
Cheers
Despite my current release not being what your looking for, my next version will be a complete re-write and more closely modell after MVC, etc...
It will be more enterprise in nature than my current version...
Anyways, you express re-branding as important...so I assume your willing to shell out cash...
In which case I ask the question...what do you feel is a fare price?
- On a per license basis
- Volume discount basis
Cheers
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Uploading "directories" is not really possible...I mean it is...but not using traditional FORM upload components...The Ninja Space Goat wrote:The most important feature it must have is multiple logins with different permissions (3 levels, admin - can do anything, user - can upload/download not delete, and visitor who can only download). It MUST be brandable. It needs to be able to upload/download/delete directories and files, and restrict file type and size. I think that is all.
You will be hard pressed to find any product that does that without the use of ActiveX or Java components I would imagine...
I have seen some which try to allow this by uploading ZIP files and unzipping on success...
The problem is...if inside that ZIP you have other folders which must be recreated but overlap existing folders, etc...
Say bye bye to your existing files...
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
The permissions is one system (part of your controllers), the file browser (and probably view/download/delete) is a separate thing, and upload is a third part. It should be pretty easy to build. The basics are easy ... it's all the fancy features (like Hockey's zip stuff) that gets detailed.The Ninja Space Goat wrote:The most important feature it must have is multiple logins with different permissions (3 levels, admin - can do anything, user - can upload/download not delete, and visitor who can only download). It MUST be brandable. It needs to be able to upload/download/delete directories and files, and restrict file type and size. I think that is all.
(#10850)
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Here is a directory browser I wrote a years ago or so. It need PHP5 DirectoryIterator or a PHP4 clone of it. Very basic but maybe a start.
DirectoryBrowser.php:
And here is an example script using CSS to create a scrolling list:
DirectoryBrowser.php:
Code: Select all
<?php
class DirectoryBrowser {
var $param_dir = 'browse_dir';
var $param_area = 'browse_area';
var $basedir;
var $reldir = '';
var $entries = array();
var $dirs = array();
var $files = array();
var $entry_n = 0;
var $dir_n = 0;
var $file_n = 0;
var $entry_max = 0;
var $dir_max = 0;
var $file_max = 0;
function DirectoryBrowser ($basedir='') {
if ($basedir) {
$this->basedir = $basedir;
} else {
$this->basedir = $_SERVER['DOCUMENT_ROOT'];
}
if (substr($this->basedir, -1, 1) != '/') {
$this->basedir .= '/';
}
$this->reldir = preg_replace('/[^a-zA-Z0-9\-\_\.\/\ ]/', '', $_GET[$this->param_dir]);
$this->reldir = trim($this->reldir, '/');
if ($this->reldir != '') {
$this->reldir .= '/';
}
$this->relarea = preg_replace('/[^a-zA-Z0-9\-\_\.\/\ ]/', '', $_GET[$this->param_area]);
$this->relarea = trim($this->relarea, '/');
if ($this->relarea != '') {
$this->relarea .= '/';
}
}
function readDir () {
$directory = new DirectoryIterator($this->basedir . $this->relarea . $this->reldir);
$result = array();
$this->entry_n = 0;
$this->dir_n = 0;
$this->file_n = 0;
$this->entry_max = 0;
$this->dir_max = 0;
$this->file_max = 0;
$param = "{$this->param_area}={$this->relarea}&{$this->param_dir}=";
while ($directory->valid()) {
$filename = $directory->getFileName();
if ($directory->isDir()) {
if ($filename == '..') {
if ($this->reldir == '') {
$filename = '.'; // don't show
} else {
$pos = strrpos(trim($this->reldir, '/'), '/');
if ($pos === false) {
$dir = '';
} else {
$dir = substr($this->reldir, 0, $pos);
}
}
} else {
$dir = $this->reldir . $filename;
}
if ($filename != '.') {
$this->dirs[$this->dir_max++] = $this->entry_max;
$this->entries[$this->entry_max++] = array('type'=>'dir','param'=>"$param$dir", 'filename'=>$filename);
}
} else {
$this->files[$this->file_max++] = $this->entry_max;
$this->entries[$this->entry_max++] = array('type'=>'file','param'=>"$param{$this->reldir}", 'filename'=>$filename);
}
$directory->next();
}
return $this->entry_max;
}
function getBasePath() {
return $this->basedir;
}
function getPath() {
return $this->basedir . '/' . $this->reldir;
}
function getRelativePath() {
return $this->reldir;
}
function rewindFiles() {
$this->file_n = 0;
}
function nextFile() {
if ($this->file_n < $this->file_max) {
return $this->entries[$this->files[$this->file_n++]];
}
}
function rewindDirs() {
$this->dir_n = 0;
}
function nextDir() {
if ($this->dir_n < $this->dir_max) {
return $this->entries[$this->dirs[$this->dir_n++]];
}
}
}Code: Select all
<?php
include_once 'DirectoryBrowser.php';
$basedir = $_SERVER['DOCUMENT_ROOT'];
$browser = new DirectoryBrowser($basedir);
$browser->readDir();
$maxlength = 20;
$html = '';
while ($entry = $browser->nextDir()) {
if (strlen($entry['filename']) > $maxlength) {
$entry['filename'] = substr($entry['filename'], 0, $maxlength);
}
$html .= "<tr><td><a href=\"?{$entry['param']}\">{$entry['filename']}</a></td></tr>\n";
}
while ($entry = $browser->nextFile()) {
if (strlen($entry['filename']) > $maxlength) {
$entry['filename'] = substr($entry['filename'], 0, $maxlength);
}
$html .= "<tr><td>{$entry['filename']}</td></tr>\n";
}
?>
<doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>DirectoryBrowser Example</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
Browsing: /<?php echo $browser->getRelativePath(); ?><br/>
<div style="width: 300px; height: 200px; border: solid 1px gray; overflow: auto; ">
<table border="0" rowspacing="0" colspacing="0">
<?php echo $html ?>
</table>
</div>
</body>
</html>(#10850)