Project

General

Profile

Feature #20146 » 0010639.patch

Administrator Admin, 2009-03-09 00:30

View differences:

t3lib/class.t3lib_div.php (Arbeitskopie)
$bInfo['BROWSER']= 'msie';
} elseif (strpos($useragent,'Mozilla/4') !== false || strpos($useragent,'Mozilla/5') !== false) {
$bInfo['BROWSER']='net';
} elseif (strpos($useragent, 'Flash') !== false) {
$bInfo['BROWSER'] = 'flash';
}
if ($bInfo['BROWSER']) {
// Browser version
t3lib/class.t3lib_userauth.php (Arbeitskopie)
$this->hash_length = t3lib_div::intInRange($this->hash_length,6,32);
$this->svConfig = $TYPO3_CONF_VARS['SVCONF']['auth'];
// if we have a flash client, take the ID from the GP
if (!$id && $GLOBALS['CLIENT']['BROWSER'] == 'flash') {
$id = t3lib_div::_GP($this->name);
}
// If fallback to get mode....
if (!$id && $this->getFallBack && $this->get_name) {
......
/**
* This returns the where-clause needed to lock a user to a hash integer
*
* if the client is flash (e.g. from a flash application inside TYPO3 that does a server request)
* then don't evaluate with the hashLockClause, as the client /browser is included in this hash
* and thus, the flash request would be rejected
*
* @return string
* @access private
*/
function hashLockClause() {
$wherePart = 'AND '.$this->session_table.'.ses_hashlock='.intval($this->hashLockClause_getHashInt());
if ($GLOBALS['CLIENT']['BROWSER'] == 'flash') {
$wherePart = '';
} else {
$wherePart = 'AND ' . $this->session_table . '.ses_hashlock = ' . intval($this->hashLockClause_getHashInt());
}
return $wherePart;
}
typo3/file_list.php (Arbeitskopie)
unset($MCONF);
require ('mod/file/list/conf.php');
require ('init.php');
require ('template.php');
require('mod/file/list/conf.php');
require('init.php');
require('template.php');
$LANG->includeLLFile('EXT:lang/locallang_mod_file_list.xml');
require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
require_once (PATH_t3lib.'class.t3lib_extfilefunc.php');
require_once (PATH_t3lib.'class.t3lib_recordlist.php');
require_once (PATH_t3lib.'class.t3lib_clipboard.php');
require_once (PATH_t3lib.'class.t3lib_parsehtml.php');
require_once ('class.file_list.inc');
$BE_USER->modAccess($MCONF,1);
$LANG->includeLLFile('EXT:lang/locallang_misc.xml');
require_once(PATH_t3lib . 'class.t3lib_basicfilefunc.php');
require_once(PATH_t3lib . 'class.t3lib_extfilefunc.php');
require_once(PATH_t3lib . 'class.t3lib_recordlist.php');
require_once(PATH_t3lib . 'class.t3lib_clipboard.php');
require_once(PATH_t3lib . 'class.t3lib_parsehtml.php');
require_once('class.file_list.inc');
$BE_USER->modAccess($MCONF, 1);
......
* @subpackage core
*/
class SC_file_list {
var $MCONF=array(); // Module configuration
var $MOD_MENU=array();
var $MOD_SETTINGS=array();
var $MCONF = array(); // Module configuration
var $MOD_MENU = array();
var $MOD_SETTINGS = array();
// Internal:
......
*
* @return void
*/
function init() {
function init() {
global $TYPO3_CONF_VARS,$FILEMOUNTS;
// Setting GPvars:
......
*
* @return void
*/
function menuConfig() {
function menuConfig() {
// MENU-ITEMS:
// If array, then it's a selector box menu
// If empty string it's just a variable, that'll be saved.
......
*
* @return void
*/
function main() {
global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS,$FILEMOUNTS;
function main() {
global $LANG,$TYPO3_CONF_VARS,$FILEMOUNTS;
// Initialize the template object
$this->doc = t3lib_div::makeInstance('template');
$this->doc->backPath = $BACK_PATH;
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('templates/file_list.html');
$this->doc->loadJavascriptLib('contrib/prototype/prototype.js');
// Validating the input "id" (the path, directory!) and checking it against the mounts of the user.
$this->id = $this->basicFF->is_directory($this->id);
$access = $this->id && $this->basicFF->checkPathAgainstMounts($this->id.'/');
$access = $this->id && $this->basicFF->checkPathAgainstMounts($this->id . '/');
// There there was access to this file path, continue, make the list
if ($access) {
if ($access) {
// include the initialization for the flash uploader
if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) {
$uploadURL = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')) . '/tce_file.php';
$uploadFileSizeLimit = $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'];
$uploadFileTypes = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
if (count($uploadFileTypes)) {
$uploadFileTypes = implode(';*.', $uploadFileTypes);
$uploadFileTypes = '*.' . $uploadFileTypes;
} else {
$uploadFileTypes = '*.*';
}
$this->doc->JScodeArray['flashUploader'] = '
document.observe("dom:loaded", function() {
// monitor the button
$("button-upload").observe("click", initFlashUploader);
function initFlashUploader(event) {
// set the page specific options for the flashUploader
var flashUploadOptions = {
uploadURL: "' . $uploadURL . '",
uploadFileSizeLimit: "' . $uploadFileSizeLimit . '",
uploadFileTypes: "' . $allowedFileExtensions . '",
uploadFilePostName: "upload_1",
uploadPostParams: {
"file[upload][1][target]": "' . $this->id . '",
"file[upload][1][data]": 1
}
};
// get the flashUploaderWindow instance from the parent frame
var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions);
// add an additional function inside the container to show the checkbox option
var infoComponent = new top.Ext.Panel({
autoEl: { tag: "div"},
height: "auto",
id: "t3-upload-window-infopanel-addition",
html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" /> ' . $GLOBALS['LANG']->getLL('overwriteExistingFiles', 1) . '</label>\',
style: "text-align: center; line-height: 24px;"
});
flashUploader.add(infoComponent);
// do a reload of this frame once all uploads are done
flashUploader.on("totalcomplete", function() {
window.location.reload();
});
// this is the callback function that delivers the additional post parameter to the flash application
top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) {
var uploader = top.TYPO3.getInstance("FileUploadWindow");
if (uploader.isVisible()) {
uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0));
}
};
event.stop();
};
});
';
}
// Create filelisting object
$this->filelist = t3lib_div::makeInstance('fileList');
$this->filelist->backPath = $BACK_PATH;
$this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs']?1:$BE_USER->uc['thumbnailsByDefault'];
$this->filelist->backPath = $GLOBALS['BACK_PATH'];
$this->filelist->thumbs = ($this->MOD_SETTINGS['displayThumbs'] ? 1 : $GLOBALS['BE_USER']->uc['thumbnailsByDefault']);
// Create clipboard object and initialize that
$this->filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
$this->filelist->clipObj->fileMode=1;
$this->filelist->clipObj->fileMode = 1;
$this->filelist->clipObj->initializeClipboard();
$CB = t3lib_div::_GET('CB');
if ($this->cmd=='setCB') $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'),t3lib_div::_POST('CBC')),'_FILE');
if (!$this->MOD_SETTINGS['clipBoard']) $CB['setP']='normal';
if ($this->cmd == 'setCB') {
$CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'), t3lib_div::_POST('CBC')), '_FILE');
}
if (!$this->MOD_SETTINGS['clipBoard']) {
$CB['setP'] = 'normal';
}
$this->filelist->clipObj->setCmd($CB);
$this->filelist->clipObj->cleanCurrent();
$this->filelist->clipObj->endClipboard(); // Saves
// Saves the clipboard
$this->filelist->clipObj->endClipboard();
// If the "cmd" was to delete files from the list (clipboard thing), do that:
if ($this->cmd=='delete') {
if ($this->cmd == 'delete') {
$items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'),'_FILE',1);
if (count($items)) {
if (count($items)) {
// Make command array:
$FILE=array();
$FILE = array();
reset($items);
while(list(,$v)=each($items)) {
$FILE['delete'][]=array('data'=>$v);
foreach ($items as $item) {
$FILE['delete'][] = array('data' => $item);
}
// Init file processing object for deleting and pass the cmd array.
......
}
}
if (!isset($this->MOD_SETTINGS['sort'])) {
// Set default sorting
// Set default sorting
if (!isset($this->MOD_SETTINGS['sort'])) {
$this->MOD_SETTINGS['sort'] = 'file';
$this->MOD_SETTINGS['reverse'] = 0;
}
......
$this->filelist->writeBottom();
// Set top JavaScript:
$this->doc->JScode=$this->doc->wrapScriptTags('
$this->doc->JScodeArray[] = '
if (top.fsMod) top.fsMod.recentIds["file"] = unescape("' . rawurlencode($this->id) . '");
function jumpToUrl(URL) {
window.location.href = URL;
}
';
if (top.fsMod) top.fsMod.recentIds["file"] = unescape("'.rawurlencode($this->id).'");
function jumpToUrl(URL) { //
window.location.href = URL;
}
// ... and add clipboard JavaScript functions
$this->doc->JScodeArray[] = $this->filelist->CBfunctions();
'.$this->filelist->CBfunctions() // ... and add clipboard JavaScript functions
);
// This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers.
$this->doc->getContextMenuCode();
......
$this->content = $this->doc->startPage($LANG->getLL('files'));
// Create output
$pageContent='';
$pageContent.= '<form action="'.htmlspecialchars($this->filelist->listURL()).'" method="post" name="dblistForm">';
$pageContent.= $this->filelist->HTMLcode;
$pageContent.= '<input type="hidden" name="cmd" /></form>';
$pageContent = '';
$pageContent .= '<form action="'.htmlspecialchars($this->filelist->listURL()).'" method="post" name="dblistForm">';
$pageContent .= $this->filelist->HTMLcode;
$pageContent .= '<input type="hidden" name="cmd" /></form>';
if ($this->filelist->HTMLcode) { // Making listing options:
// Making listing options:
if ($this->filelist->HTMLcode) {
$pageContent.='
<!--
......
// Set clipboard:
if ($this->MOD_SETTINGS['clipBoard']) {
if ($this->MOD_SETTINGS['clipBoard']) {
$pageContent.=$this->filelist->clipObj->printClipboard();
$pageContent.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_clipboard', $GLOBALS['BACK_PATH']);
}
}
$markerArray = array(
'CSH' => $docHeaderButtons['csh'],
'CSH' => $docHeaderButtons['csh'],
'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']),
'CONTENT' => $pageContent
'CONTENT' => $pageContent
);
$this->content.= $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
$this->content .= $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
} else {
// Create output - no access (no warning though)
$this->content = '';
$this->content = '';
$this->content .= $this->doc->startPage($LANG->getLL('files'));
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
$this->content = $this->doc->insertStylesAndJS($this->content);
}
......
*
* @return void
*/
function printContent() {
function printContent() {
echo $this->content;
}
......
*
* @return array all available buttons as an assoc. array
*/
function getButtons() {
global $TCA, $LANG, $BACK_PATH, $BE_USER;
function getButtons() {
$buttons = array(
'csh' => '',
'csh' => '',
'shortcut' => '',
'upload' => '',
'new' => '',
'upload' => '',
'new' => '',
);
// Add shortcut
if ($BE_USER->mayMakeShortcut()) {
$buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table',implode(',',array_keys($this->MOD_MENU)),$this->MCONF['name']);
if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
$buttons['shortcut'] = $this->doc->makeShortcutIcon('pointer,id,target,table', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
}
// FileList Module CSH:
$buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', TRUE);
$buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', true);
// upload button
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/upload.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.upload',1)).'" alt="" />';
$buttons['upload'] = '<a href="'.$BACK_PATH.'file_upload.php?target='.rawurlencode($this->id).'&returnUrl='.rawurlencode($this->filelist->listURL()).'">'.$theIcon.'</a>';
$theIcon = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/upload.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.upload', 1)) . '" alt="" />';
$buttons['upload'] = '<a id="button-upload" href="' . $GLOBALS['BACK_PATH'] . 'file_upload.php?target=' . rawurlencode($this->id) . '&returnUrl=' . rawurlencode($this->filelist->listURL()) . '">' . $theIcon . '</a>';
$theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_file.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new',1)).'" alt="" />';
$buttons['new'] = '<a href="'.$BACK_PATH.'file_newfolder.php?target='.rawurlencode($this->id).'&returnUrl='.rawurlencode($this->filelist->listURL()).'">'.$theIcon.'</a>';
// new file button
$theIcon = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/new_file.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new', 1)) . '" alt="" />';
$buttons['new'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_newfolder.php?target='.rawurlencode($this->id) . '&returnUrl='.rawurlencode($this->filelist->listURL()) . '">' . $theIcon . '</a>';
return $buttons;
}
......
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_list.php']) {
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_list.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/file_list.php']);
}
......
$SOBE->main();
$SOBE->printContent();
?>
?>
typo3/backend.php (Arbeitskopie)
'contrib/prototype/prototype.js',
'contrib/scriptaculous/scriptaculous.js?load=builder,effects,controls,dragdrop',
'contrib/extjs/adapter/prototype/ext-prototype-adapter.js',
'contrib/extjs/ext-all.js',
'contrib/extjs/ext-all-debug.js',
'contrib/swfupload/swfupload.js',
'contrib/swfupload/plugins/swfupload.swfobject.js',
'contrib/swfupload/plugins/swfupload.cookies.js',
'contrib/swfupload/plugins/swfupload.queue.js',
'js/flashupload.js',
'md5.js',
'js/backend.js',
'js/common.js',
typo3/tce_file.php (Arbeitskopie)
* @return void
*/
function main() {
global $FILEMOUNTS,$TYPO3_CONF_VARS,$BE_USER;
// Initializing:
$this->fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
$this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
......
// Checking referer / executing:
$refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
$httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
if ($httpHost != $refInfo['host'] && $this->vC != $GLOBALS['BE_USER']->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']) {
if ($httpHost != $refInfo['host'] && $this->vC != $GLOBALS['BE_USER']->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer'] && $GLOBALS['CLIENT']['BROWSER'] != 'flash') {
$this->fileProcessor->writeLog(0, 2, 1, 'Referer host "%s" and server host "%s" did not match!', array($refInfo['host'], $httpHost));
} else {
$this->fileProcessor->start($this->file);
......
function finish() {
// Prints errors, if...
$this->fileProcessor->printLogErrorMessages($this->redirect);
t3lib_BEfunc::getSetUpdateSignal('updateFolderTree');
if ($this->redirect) {
Header('Location: '.t3lib_div::locationHeaderUrl($this->redirect));
} else {
echo $_FILES['upload_1']['name'];
}
}
}
typo3/css/backend-style.css (Arbeitskopie)
- - - - - - - - - - - - - - - - - - - - - */
/* ----- Basics ----- */
#typo3-backend {
......
}
/* ----- File Upload Window ----- */
.swfupload {
display: block;
position: absolute;
width: 60px;
height: 17px;
}
typo3/sysext/setup/mod/locallang.xml (Arbeitskopie)
<label index="edit_wideDocument">Wide document background</label>
<label index="edit_RTE">Enable Rich Text Editor (if available)</label>
<label index="edit_docModuleUpload">File upload directly in Doc-module</label>
<label index="enableFlashUploader">Enable Flash Uploader (requires Flash 9 and a Backend refresh)</label>
<label index="edit_functions">Edit</label>
<label index="disableCMlayers">Disable Popup Context Menus</label>
<label index="setToStandard">Reset all Values to default</label>
typo3/sysext/setup/mod/index.php (Arbeitskopie)
$BE_USER->uc['edit_wideDocument'] = $d['edit_wideDocument'];
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { $BE_USER->uc['edit_RTE'] = $d['edit_RTE']; }
$BE_USER->uc['edit_docModuleUpload'] = $d['edit_docModuleUpload'];
$BE_USER->uc['enableFlashUploader'] = $d['enableFlashUploader'];
$BE_USER->uc['edit_showFieldHelp'] = $d['edit_showFieldHelp'];
$BE_USER->uc['disableCMlayers'] = $d['disableCMlayers'];
......
'type' => 'check',
'form' => '<input id="field_edit_docModuleUpload" type="checkbox" name="data[edit_docModuleUpload]"'.($BE_USER->uc['edit_docModuleUpload']?' checked="checked"':'').' />'
),
'enableFlashUploader' => array(
'type' => 'check',
'form' => '<input id="field_enableFlashUploader" type="checkbox" name="data[enableFlashUploader]"' . ($BE_USER->uc['enableFlashUploader']?' checked="checked"' : '') . ' />',
),
'disableCMlayers' => array(
'type' => 'check',
'form' => '<input id="field_disableCMlayers" type="checkbox" name="data[disableCMlayers]"'.($BE_USER->uc['disableCMlayers']?' checked="checked"':'').' />'
......
'recursiveDelete' => array(
'type' => 'check',
'form' => '<input id="field_recursiveDelete" type="checkbox" name="data[recursiveDelete]"'.($BE_USER->uc['recursiveDelete']?' checked="checked"':'').' />',
),
),
);
if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) {
(1-1/8)