This commit is contained in:
2017-06-24 00:58:56 +03:00
commit 315d1fded7
2331 changed files with 296580 additions and 0 deletions
.gitignore.htaccessREADME.md
admin
.htaccessadmin.favicon.icoadmin.phpblocks.phpbrowser.phpdbsettings.phpdocs.phpfields.phpfinder.php
functions
groups.phpindex.phpinit.php
lang
logs.phpmodules.phpnavigation.phprequest.phprubs.phpsettings.phpstart.phpsysblocks.phptemplates.php
templates
blocks
browser
css
dbactions
documents
error.tpl
finder
fonts
groups
images
IconHome.gifNavBg.pngaccordion_off.pngaccordion_on.pngadd.pngalertOpacityOverlay.pngarrow.gif
backgrounds
blanc.gifchevron.gifchosen-sprite.pngchosen-sprite@2x.pngclippy.svgdarkBg.jpgdarkBg.png
fancybox
file.giffolder.giffolder_up.gif
forms
icons
jquery_ui
leftNavBg.pngleftNavSub.pngleft_menu_show.pnglevel.pngloader2.gifloader3.gifloading.gifloginLogo.pnglogosmall.png
mediapool
middlebg.pngnav_level_2.gifnav_level_3.gifnumberTop.pngref.pngsearchSmall.pngsprites.gifsprites_doc.pngtable_level.pngtabsSep.pngtipsy.giftitleBg.pngtopNav.jpgui.totop.png
ui
upload.png
uploader
user.pnguserPic.pngwidgetBg.png
js
login.tpllogin_scripts.tpl
logs
main.tpl
modules
navi
navigation
noperm.tplonlycontent.tplpop.tpl
request
rubs
scripts.tpl
settings
start.tpl
sysblocks
templates
user
user.php
backup
cache
class
fields
.htaccess
checkbox
code
date
doc_from_rub
doc_from_rub_check
doc_from_rub_search
download
drop_down
drop_down_key
flash
image_mega
image_multi
image_multi_new_3inputs
image_single
link
multi_checkbox
multi_line
multi_line_simple
multi_line_slim
multi_list
multi_list_single
multi_list_triple
multi_select
single_line
single_line_numeric
teasers
text_to_image
youtube
functions
inc
index.php
install
lib
Smarty
.htaccessConfig_File.class.phpSmarty.class.phpSmarty_Compiler.class.phpdebug.tpl
internals
plugins
StripTagsSmart
SwiftMailer
classes
Swift.php
Swift
Attachment.php
ByteStream
CharacterReader.php
CharacterReader
CharacterReaderFactory.php
CharacterReaderFactory
CharacterStream.php
CharacterStream
ConfigurableSpool.phpDependencyContainer.phpDependencyException.phpEmbeddedFile.phpEncoder.php
Encoder
Encoding.php
Events
FailoverTransport.phpFileSpool.phpFileStream.phpFilterable.phpImage.phpInputByteStream.phpIoException.phpKeyCache.php
KeyCache
LoadBalancedTransport.phpMailTransport.phpMailer.php
Mailer
MemorySpool.phpMessage.php
Mime
MimePart.phpNullTransport.phpOutputByteStream.php
Plugins
Preferences.phpReplacementFilterFactory.phpRfcComplianceException.phpSendmailTransport.phpSignedMessage.phpSigner.php
Signers
SmtpTransport.phpSpool.phpSpoolTransport.phpStreamFilter.php
StreamFilters
SwiftException.phpTransport.php
Transport
TransportException.phpValidate.php
dependency_maps
mime_types.phppreferences.phpswift_init.phpswift_required.phpswift_required_pear.phpswiftmailer_generate_mimes_config.phpversion.txt
bootstrap
combine
flags
ad.pngae.pngaf.pngag.pngai.pngal.pngam.pngan.pngao.pngar.pngas.pngat.pngau.pngaw.pngax.pngaz.pngba.pngbb.pngbd.pngbe.pngbf.pngbg.pngbh.pngbi.pngbj.pngbm.pngbn.pngbo.pngbr.pngbs.pngbt.pngbv.pngbw.pngby.pngbz.pngca.pngcatalonia.pngcc.pngcd.pngcf.pngcg.pngch.pngci.pngck.pngcl.pngcm.pngcn.pngco.pngcr.pngcs.pngcu.pngcv.pngcx.pngcy.pngcz.pngde.pngdj.pngdk.pngdm.pngdo.pngdz.pngec.pngee.pngeg.pngeh.pngen.pngengland.pnger.pnges.pnget.pngeu.pngfam.pngfi.pngfj.pngfk.pngfm.pngfo.pngfr.pngga.pnggb.pnggd.pngge.pnggf.pnggh.pnggi.pnggl.pnggm.pnggn.pnggp.pnggq.pnggr.pnggs.pnggt.pnggu.pnggw.pnggy.pnghk.pnghm.pnghn.pnghr.pnght.pnghu.pngid.pngie.pngil.pngin.pngio.pngiq.pngir.pngis.pngit.pngjm.pngjo.pngjp.pngke.pngkg.pngkh.pngki.pngkm.pngkn.pngkp.pngkr.pngkw.pngky.pngkz.pngla.pnglb.pnglc.pngli.pnglk.pnglr.pngls.pnglt.pnglu.pnglv.pngly.pngma.pngmc.pngmd.pngme.pngmg.pngmh.pngmk.pngml.pngmm.pngmn.pngmo.pngmp.pngmq.pngmr.pngms.pngmt.pngmu.pngmv.pngmw.pngmx.pngmy.pngmz.pngna.pngnc.pngne.pngnf.pngng.pngni.pngnl.pngno.pngnp.pngnr.pngnu.pngnz.pngom.pngpa.pngpe.pngpf.pngpg.pngph.pngpk.pngpl.pngpm.pngpn.pngpr.pngps.pngpt.pngpw.pngpy.pngqa.pngre.pngro.pngrs.pngru.pngrw.pngsa.pngsb.pngsc.pngscotland.pngsd.pngse.pngsg.pngsh.pngsi.pngsj.pngsk.pngsl.pngsm.pngsn.pngso.pngsp.pngsr.pngst.pngsv.pngsy.pngsz.pngtc.pngtd.pngtf.pngtg.pngth.pngtj.pngtk.pngtl.pngtm.pngtn.pngto.pngtr.pngtt.pngtv.pngtw.pngtz.pngua.pngug.pngum.pnguy.pnguz.pngva.pngvc.pngve.pngvg.pngvi.pngvn.pngvu.pngwales.pngwf.pngws.pngye.pngyt.pngza.pngzm.pngzw.png
kcaptcha
mobile_detect
redactor
ckeditor
.htaccess
adapters
block.jsckeditor.jsconfig.default.jsconfig.jscontents.css
lang
plugins
a11yhelp
about
clipboard
dialogs
codemirror
css
icons
js
lang
plugin.js
theme
colordialog
copyformatting
dialog
div
dialogs
find
dialogs
flash
forms
icons.pngicons_hidpi.png
iframe
image
dialogs
images
link
liststyle
magicline
pagebreak
pastefromword
placeholder
preview
savedocs
scayt
showblocks
smiley
specialchar
table
dialogs
tabletools
templates
wsc
skins
styles.jssysblock.js
codemirror
addon
codemirror_connect.tplcodemirror_editor.tplconfig.jsconfig_css.jsfunctions.jsindex.php
lib
mode
theme
elfinder
css
img
inc
js
sounds
elrte
scripts
translate
license.txt
modules
robots.txt
session
templates
uploads

@ -0,0 +1,121 @@
<?php
/**
* elFinder Plugin Sanitizer
*
* Sanitizer of file-name and file-path etc.
*
* ex. binding, configure on connector options
* $opts = array(
* 'bind' => array(
* 'upload.pre mkdir.pre mkfile.pre rename.pre archive.pre ls.pre' => array(
* 'Plugin.Sanitizer.cmdPreprocess'
* ),
* 'ls' => array(
* 'Plugin.Sanitizer.cmdPostprocess'
* ),
* 'upload.presave' => array(
* 'Plugin.Sanitizer.onUpLoadPreSave'
* )
* ),
* // global configure (optional)
* 'plugin' => array(
* 'Sanitizer' => array(
* 'enable' => true,
* 'targets' => array('\\','/',':','*','?','"','<','>','|'), // target chars
* 'replace' => '_' // replace to this
* )
* ),
* // each volume configure (optional)
* 'roots' => array(
* array(
* 'driver' => 'LocalFileSystem',
* 'path' => '/path/to/files/',
* 'URL' => 'http://localhost/to/files/'
* 'plugin' => array(
* 'Sanitizer' => array(
* 'enable' => true,
* 'targets' => array('\\','/',':','*','?','"','<','>','|'), // target chars
* 'replace' => '_' // replace to this
* )
* )
* )
* )
* );
*
* @package elfinder
* @author Naoki Sawada
* @license New BSD
*/
class elFinderPluginSanitizer extends elFinderPlugin
{
private $replaced = array();
private $keyMap = array(
'ls' => 'intersect',
'upload' => 'renames'
);
public function __construct($opts) {
$defaults = array(
'enable' => true, // For control by volume driver
'targets' => array('\\','/',':','*','?','"','<','>','|'), // target chars
'replace' => '_' // replace to this
);
$this->opts = array_merge($defaults, $opts);
}
public function cmdPreprocess($cmd, &$args, $elfinder, $volume) {
$opts = $this->getCurrentOpts($volume);
if (! $opts['enable']) {
return false;
}
$this->replaced[$cmd] = array();
$key = (isset($this->keyMap[$cmd]))? $this->keyMap[$cmd] : 'name';
if (isset($args[$key])) {
if (is_array($args[$key])) {
foreach($args[$key] as $i => $name) {
$this->replaced[$cmd][$name] = $args[$key][$i] = $this->sanitizeFileName($name, $opts);
}
} else {
$name = $args[$key];
$this->replaced[$cmd][$name] = $args[$key] = $this->sanitizeFileName($name, $opts);
}
}
return true;
}
public function cmdPostprocess($cmd, &$result, $args, $elfinder) {
if ($cmd === 'ls') {
if (! empty($result['list']) && ! empty($this->replaced['ls'])) {
foreach($result['list'] as $hash => $name) {
if ($keys = array_keys($this->replaced['ls'], $name)) {
if (count($keys) === 1) {
$result['list'][$hash] = $keys[0];
} else {
$result['list'][$hash] = $keys;
}
}
}
}
}
}
public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) {
$opts = $this->getCurrentOpts($volume);
if (! $opts['enable']) {
return false;
}
if ($path) {
$path = $this->sanitizeFileName($path, $opts, array('/'));
}
$name = $this->sanitizeFileName($name, $opts);
return true;
}
private function sanitizeFileName($filename, $opts, $allows = array()) {
$targets = $allows? array_diff($opts['targets'], $allows) : $opts['targets'];
return str_replace($targets, $opts['replace'], $filename);
}
}