1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117:
<?php
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext('Provides file handling for the <code>upload/files</code> tab and the <em>TinyMCE</em> file browser.');
$plugin_author = "Stephen Billard (sbillard)";
$plugin_category = gettext('Uploader');
$option_interface = 'elFinder_options';
class elFinder_options {
function __construct() {
setOptionDefault('elFinder_files', 1);
setOptionDefault('elFinder_tinymce', 0);
}
function getOptionsSupported() {
$options = array(gettext('Files tab') => array('key' => 'elFinder_files', 'type' => OPTION_TYPE_CHECKBOX,
'desc' => gettext('Use as the upload <em>files</em> subtab.')),
gettext('TinyMCE plugin') => array('key' => 'elFinder_tinymce', 'type' => OPTION_TYPE_CHECKBOX,
'desc' => gettext('Enable plugin for TinyMCE.'))
);
return $options;
}
function handleOption($option, $currentValue) {
}
}
if (getOption('elFinder_files') && zp_loggedin(FILES_RIGHTS)) {
zp_register_filter('admin_tabs', 'elFinder_admin_tabs', 50);
}
if (getOption('elFinder_tinymce')) {
zp_register_filter('tinymce_zenpage_config', 'elFinder_tinymce');
}
function elFinder_admin_tabs($tabs) {
$me = sprintf(gettext('files (%s)'), 'elFinder');
$mylink = FULLWEBPATH . '/'. ZENFOLDER . '/' . PLUGIN_FOLDER . '/elFinder/filemanager.php?page=upload&tab=elFinder&type=' . gettext('files');
if (is_null($tabs['upload'])) {
$tabs['upload'] = array(
'text' => gettext("upload"),
'link' => FULLWEBPATH . '/' . ZENFOLDER . '/admin-upload.php',
'subtabs' => NULL);
}
$tabs['upload']['subtabs'][$me] = $mylink;
if (zp_getcookie('zpcms_admin_uploadtype') == 'elFinder')
$tabs['upload']['link'] = $mylink;
return $tabs;
}
function elFinder_tinymce($discard) {
$file = FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/elFinder/elfinder.php?XSRFToken=' . getXSRFToken('elFinder');
?>
<script type="text/javascript">
function elFinderBrowser(field_name, url, type, win) {
tinymce.activeEditor.windowManager.open({
file: '<?php echo $file; ?>',
title: 'elFinder 2.0',
width: 900,
height: 450,
close_previous: 'no',
inline: 'yes',
popup_css: false,
resizable: 'yes'
}, {
setUrl: function(url) {
win.document.getElementById(field_name).value = url;
}
});
return false;
}
</script>
<?php
return 'elFinderBrowser';
}
?>