Minor - cleaning white spaces

skala
Julio Montoya 12 years ago
parent 3183418821
commit f375361b5a
  1. 37
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_upload.php

@ -5,7 +5,7 @@
* @link www.phpletter.com * @link www.phpletter.com
* @since 22/May/2007 * @since 22/May/2007
* *
*/ */
sleep(3); sleep(3);
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
echo "{"; echo "{";
@ -17,7 +17,6 @@ $upload = new Upload();
$folder = base64_decode($_GET['folder']); $folder = base64_decode($_GET['folder']);
//$folder = ($_GET['folder']); //$folder = ($_GET['folder']);
$upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS)); $upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS));
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) { if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) {
$error = SYS_DISABLED; $error = SYS_DISABLED;
@ -27,39 +26,39 @@ if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) {
$error = ERR_FILE_NOT_UPLOADED; $error = ERR_FILE_NOT_UPLOADED;
}else if(!$upload->moveUploadedFile($folder)) { }else if(!$upload->moveUploadedFile($folder)) {
$error = ERR_FILE_MOVE_FAILED; $error = ERR_FILE_MOVE_FAILED;
} elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) { } elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) {
$error = ERR_FILE_TYPE_NOT_ALLOWED; $error = ERR_FILE_TYPE_NOT_ALLOWED;
} elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) { } elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) {
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
} else { } else {
include_once(CLASS_FILE); include_once(CLASS_FILE);
$path = $upload->getFilePath(); $path = $upload->getFilePath();
$obj = new file($path); $obj = new file($path);
$tem = $obj->getFileInfo(); $tem = $obj->getFileInfo();
if (sizeof($tem)) { if (sizeof($tem)) {
include_once(CLASS_MANAGER); include_once(CLASS_MANAGER);
$manager = new manager($upload->getFilePath(), false); $manager = new manager($upload->getFilePath(), false);
$fileType = $manager->getFileType($upload->getFileName()); $fileType = $manager->getFileType($upload->getFileName());
foreach($fileType as $k=>$v) { foreach($fileType as $k=>$v) {
$tem[$k] = $v; $tem[$k] = $v;
} }
$tem['path'] = backslashToSlash($path); $tem['path'] = backslashToSlash($path);
$tem['type'] = "file"; $tem['type'] = "file";
$tem['size'] = transformFileSize($tem['size']); $tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']); $tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['short_name'] = shortenFileName($tem['name']); $tem['short_name'] = shortenFileName($tem['name']);
$tem['flag'] = 'noFlag'; $tem['flag'] = 'noFlag';
/** /**
* Bridge to Chamilo documents tool * Bridge to Chamilo documents tool
* @author Juan Carlos Raña Trabado * @author Juan Carlos Raña Trabado
*/ */
if(!empty($_course['path'])) { if(!empty($_course['path'])) {
//only inside courses //only inside courses
$fullPath= $upload->getFilePath(); //get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/image.jpg $fullPath= $upload->getFilePath(); //get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/image.jpg
$folderInfo = $manager->getFolderInfo(); //get ajaxmanager $folderInfo = $manager->getFolderInfo(); //get ajaxmanager
$mainPath= getParentFolderPath($folderInfo['path']);//get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/ $mainPath= getParentFolderPath($folderInfo['path']);//get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/
@ -72,7 +71,7 @@ if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) {
} else { } else {
if(!api_is_allowed_to_edit()) { if(!api_is_allowed_to_edit()) {
$current_session_id = api_get_session_id(); $current_session_id = api_get_session_id();
if($current_session_id==0) { if($current_session_id==0) {
$chamiloFolder='/shared_folder/sf_user_'.api_get_user_id().$chamiloFolder; $chamiloFolder='/shared_folder/sf_user_'.api_get_user_id().$chamiloFolder;
} else { } else {
$chamiloFolder='/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().$chamiloFolder; $chamiloFolder='/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().$chamiloFolder;
@ -83,15 +82,15 @@ if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) {
$doc_id = add_document($_course, $chamiloFolder,'file', $chamiloFileSize , $chamiloFile); //get Chamilo $doc_id = add_document($_course, $chamiloFolder,'file', $chamiloFileSize , $chamiloFile); //get Chamilo
$current_session_id = api_get_session_id(); $current_session_id = api_get_session_id();
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(),$to_group_id,null,null,null,$current_session_id);//get Chamilo api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(),$to_group_id,null,null,null,$current_session_id);//get Chamilo
} }
// end bridge // end bridge
$obj->close(); $obj->close();
foreach($tem as $k=>$v) { foreach($tem as $k=>$v) {
$info .= sprintf(", %s:'%s'", $k, $v); $info .= sprintf(", %s:'%s'", $k, $v);
} }
$info .= sprintf(", url:'%s'", getFileUrl($path)); $info .= sprintf(", url:'%s'", getFileUrl($path));
$info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME);
} else { } else {
$error = ERR_FILE_NOT_AVAILABLE; $error = ERR_FILE_NOT_AVAILABLE;
} }

Loading…
Cancel
Save