git add stuff

This commit is contained in:
Alan
2026-02-14 19:50:25 +03:00
parent 5c3329238b
commit 3942076805
1130 changed files with 120023 additions and 6 deletions

View File

@@ -0,0 +1,90 @@
<?php
error_reporting(0); // Set E_ALL for debuging
if (function_exists('date_default_timezone_set')) {
date_default_timezone_set('Europe/Moscow');
}
include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
/**
* Simple example how to use logger with elFinder
**/
class elFinderLogger implements elFinderILogger {
public function log($cmd, $ok, $context, $err='', $errorData = array()) {
if (false != ($fp = fopen('./log.txt', 'a'))) {
if ($ok) {
$str = "cmd: $cmd; OK; context: ".str_replace("\n", '', var_export($context, true))."; \n";
} else {
$str = "cmd: $cmd; FAILED; context: ".str_replace("\n", '', var_export($context, true))."; error: $err; errorData: ".str_replace("\n", '', var_export($errorData, true))."\n";
}
fwrite($fp, $str);
fclose($fp);
}
}
}
$opts = array(
'root' => $_SERVER["DOCUMENT_ROOT"].'/userfiles', // path to root directory
//'root' => '../../../../userfiles', // path to root directory
'URL' => '/userfiles/', // root directory URL
'rootAlias' => 'Home', // display this instead of root directory name
//'uploadAllow' => array('images/*'),
//'uploadDeny' => array('all'),
//'uploadOrder' => 'deny,allow'
// 'disabled' => array(), // list of not allowed commands
// 'dotFiles' => false, // display dot files
// 'dirSize' => true, // count total directories sizes
// 'fileMode' => 0666, // new files mode
// 'dirMode' => 0777, // new folders mode
// 'mimeDetect' => 'internal', // files mimetypes detection method (finfo, mime_content_type, linux (file -ib), bsd (file -Ib), internal (by extensions))
// 'uploadAllow' => array(), // mimetypes which allowed to upload
// 'uploadDeny' => array(), // mimetypes which not allowed to upload
// 'uploadOrder' => 'deny,allow', // order to proccess uploadAllow and uploadAllow options
'imgLib' => 'gd', // image manipulation library (imagick, mogrify, gd)
'tmbDir' => '.tmb', // directory name for image thumbnails. Set to "" to avoid thumbnails generation
// 'tmbCleanProb' => 1, // how frequiently clean thumbnails dir (0 - never, 100 - every init request)
// 'tmbAtOnce' => 5, // number of thumbnails to generate per request
'tmbSize' => 48, // images thumbnails size (px)
// 'fileURL' => true, // display file URL in "get info"
// 'dateFormat' => 'j M Y H:i', // file modification date format
// 'logger' => null, // object logger
// 'defaults' => array( // default permisions
// 'read' => true,
// 'write' => true,
// 'rm' => true
// ),
// 'perms' => array(), // individual folders/files permisions
// 'debug' => true, // send debug to client
// 'archiveMimes' => array(), // allowed archive's mimetypes to create. Leave empty for all available types.
// 'archivers' => array() // info about archivers to use. See example below. Leave empty for auto detect
// 'archivers' => array(
// 'create' => array(
// 'application/x-gzip' => array(
// 'cmd' => 'tar',
// 'argc' => '-czf',
// 'ext' => 'tar.gz'
// )
// ),
// 'extract' => array(
// 'application/x-gzip' => array(
// 'cmd' => 'tar',
// 'argc' => '-xzf',
// 'ext' => 'tar.gz'
// ),
// 'application/x-bzip2' => array(
// 'cmd' => 'tar',
// 'argc' => '-xjf',
// 'ext' => 'tar.bz'
// )
// )
// )
);
$fm = new elFinder($opts);
$fm->run();
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,112 @@
#!/usr/bin/env python
import cgi
try:
import json
except ImportError:
import simplejson as json
import elFinder
# configure connector options
opts = {
#'root': '/home/troex/Sites/git/elfinder/files',
'root': '../git/elfinder/files/',
'URL': 'http://localhost:8001/~troex/git/elfinder/files',
## other options
'debug': True,
'fileURL': True, # download files using connector, no direct urls to files
# 'dirSize': True,
# 'dotFiles': True,
# 'perms': {
# 'backup': {
# 'read': True,
# 'write': False,
# 'rm': False
# },
# '^/pics': {
# 'read': True,
# 'write': False,
# 'rm': False
# }
# },
# 'uploadDeny': ['image', 'application'],
# 'uploadAllow': ['image/png', 'image/jpeg'],
# 'uploadOrder': ['deny', 'allow']
# 'disabled': ['rename', 'quicklook', 'upload']
}
# init connector and pass options
elf = elFinder.connector(opts)
# fetch only needed GET/POST parameters
httpRequest = {}
form = cgi.FieldStorage()
for field in elf.httpAllowedParameters:
if field in form:
httpRequest[field] = form.getvalue(field)
if field == 'upload[]':
upFiles = {}
cgiUploadFiles = form['upload[]']
for up in cgiUploadFiles:
if up.filename:
upFiles[up.filename] = up.file # pack dict(filename: filedescriptor)
httpRequest['upload[]'] = upFiles
# run connector with parameters
status, header, response = elf.run(httpRequest)
# get connector output and print it out
# code below is tested with apache only (maybe other server need other method?)
if status == 200:
print 'Status: 200'
elif status == 403:
print 'Status: 403'
elif status == 404:
print 'Status: 404'
if len(header) >= 1:
for h, v in header.iteritems():
print h + ': ' + v
print
if not response is None and status == 200:
# send file
if 'file' in response and isinstance(response['file'], file):
print response['file'].read()
response['file'].close()
# output json
else:
print json.dumps(response, indent = True)
## logging
#import sys
#log = open('/home/troex/Sites/git/elfinder/files/out.log', 'w')
#print >>log, 'FORM: ', form
#log.close()
## another aproach
## get connector output and print it out
#if elf.httpStatusCode == 200:
# print 'HTTP/1.1 200 OK'
#elif elf.httpStatusCode == 403:
# print 'HTTP/1.x 403 Access Denied'
#elif elf.httpStatusCode == 404:
# print 'HTTP/1.x 404 Not Found'
#
#if len(elf.httpHeader) >= 1:
# for header, value in elf.httpHeader.iteritems():
# print header + ': ' + value
# print
#
#if not elf.httpResponse is None:
# if isinstance(elf.httpResponse['file'], file):
# print elf.httpResponse['file'].read()
# elf.httpResponse['file'].close()
# else:
# print json.dumps(elf.httpResponse, indent = True)
#

File diff suppressed because it is too large Load Diff