Julio Montoya 12 years ago
parent ea95575891
commit eda29af3c1
  1. 21
      main/inc/lib/fckeditor/editor/filemanager/connectors/php/config.php
  2. 30
      main/inc/lib/fckeditor/editor/plugins/ImageManager/Classes/ImageManager.php
  3. 18
      main/inc/lib/fckeditor/editor/plugins/ImageManager/config.inc.php
  4. 2
      main/inc/lib/fckeditor/editor/plugins/ImageManager/editor.php
  5. 12
      main/inc/lib/fckeditor/editor/plugins/ImageManager/editorFrame.php
  6. 41
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php
  7. 9
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php
  8. 17
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_load_folders.php
  9. 1
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_create_folder.php
  10. 16
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_delete_file.php
  11. 26
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_download.php
  12. 46
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php
  13. 11
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_copy.php
  14. 12
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_cut.php
  15. 5
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_paste.php
  16. 13
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_upload.php
  17. 14
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php
  18. 12
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_folder_listing.php
  19. 36
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_editor.php
  20. 112
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php
  21. 15
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_thumbnail.php
  22. 36
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php
  23. 17
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_login.php
  24. 23
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_preview.php
  25. 11
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_as_form.php
  26. 21
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_name.php
  27. 34
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_text.php
  28. 145
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_text_editor.php
  29. 8
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php
  30. 7
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.php
  31. 23
      main/inc/lib/fckeditor/fckeditor.php
  32. 73
      main/inc/lib/fckeditor/repository.php

@ -30,10 +30,13 @@ $language_file = array('create_course');
// Loading the global initialization file, Chamilo LMS.
require_once '../../../../../../global.inc.php';
// Disabling access for anonymous users.
api_block_anonymous_users();
// Initialization of the repositories.
require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php' ;
global $Config ;
global $Config;
// SECURITY: You must explicitly enable this "connector". (Set it to "true").
// WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only
@ -45,6 +48,7 @@ $Config['UserFilesPath'] = null;
$userId = api_get_user_id();
if (api_is_in_course()) {
$coursePath = api_get_path(REL_COURSE_PATH).api_get_course_path();
if (!api_is_in_group()) {
@ -53,20 +57,20 @@ if (api_is_in_course()) {
$Config['UserFilesPath'] = $coursePath.'/document/';
} else {
// 1.2. Student
$current_session_id = api_get_session_id();
if ($current_session_id == 0) {
$Config['UserFilesPath'] = $coursePath.'/document/shared_folder/sf_user_'.$userId.'/';
} else {
$Config['UserFilesPath'] = $coursePath.'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.$userId.'/';
}
}
} else {
$groupId = api_get_group_id();
$groupInfo = GroupManager::get_group_properties($groupId);
// 2. Inside a course and inside a group.
$Config['UserFilesPath'] = $coursePath.'/document'.$groupInfo['directory'].'/';
if (!empty($groupInfo)) {
// 2. Inside a course and inside a group.
$Config['UserFilesPath'] = $coursePath.'/document'.$groupInfo['directory'].'/';
}
}
} else {
if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin') {
@ -75,16 +79,19 @@ if (api_is_in_course()) {
} else {
// 4. The user is outside courses.
$my_path = UserManager::get_user_picture_path_by_id($userId, 'rel');
$Config['UserFilesPath'] = $my_path['dir'].'my_files/';
}
}
if (empty($Config['UserFilesPath'])) {
api_not_allowed(true);
}
// Fill the following value it you prefer to specify the absolute path for the
// user files directory. Useful if you are using a virtual directory, symbolic
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'UserFilesPath' must point to the same directory.
$Config['UserFilesAbsolutePath'] = rtrim(api_get_path(SYS_SERVER_ROOT_PATH), '/') . $Config['UserFilesPath'];
$Config['UserFilesAbsolutePath'] = rtrim(api_get_path(SYS_SERVER_ROOT_PATH), '/').$Config['UserFilesPath'];
// Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled.

@ -576,24 +576,15 @@ class ImageManager
$chamiloFile = $file['name'];
$chamiloFileSize = $file['size'];
if(!empty($group_properties['directory'])) {
$chamiloFolder=$group_properties['directory'].$chamiloFolder;
$chamiloFolder = $group_properties['directory'].$chamiloFolder;
}
$doc_id = add_document($_course, $document_path,'file', $chamiloFileSize , $chamiloFile);
$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 Dokeos
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(),$to_group_id,null,null,null,api_get_session_id());
}
/*
if (!(api_is_platform_admin() || api_is_course_admin())) {
//setting invisible by default for the students
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id());
}
*/
$dimensionsIndex = isset($_REQUEST['uploadSize']) ? $_REQUEST['uploadSize'] : 0;
// If maximum size is specified, constrain image to it.
if ($this->config['maxWidth'][$dimensionsIndex] > 0 && $this->config['maxHeight'][$dimensionsIndex] > 0)
{
if ($this->config['maxWidth'][$dimensionsIndex] > 0 && $this->config['maxHeight'][$dimensionsIndex] > 0) {
$img = Image_Transform::factory(IMAGE_CLASS);
$img->load($path . $result);
@ -609,7 +600,7 @@ class ImageManager
}
}
//delete tmp files.
// Delete tmp files.
Files::delFile($file['tmp_name']);
return false;
}
@ -782,13 +773,7 @@ class ImageManager
{
Return false;
}
}
/*
}
else
Return false;
*/
}
/**
@ -820,9 +805,8 @@ class ImageManager
$base_dir = substr($path, 0, strpos($path,'/document/')+9); //
$new_dir = substr($fullpath, strlen($base_dir),-1); //
$created_dir = create_unexisting_directory($_course, api_get_user_id(), api_get_session_id(), 0,0, $base_dir, $new_dir,$newDir);
$doc_id = DocumentManager::get_document_id($_course, $new_dir );
$current_session_id = api_get_session_id();
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(),null,null,null,null,$current_session_id);
$doc_id = DocumentManager::get_document_id($_course, $new_dir);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(),null,null,null,null, api_get_session_id());
} else {
return Files::createFolder($fullpath);
}
@ -891,5 +875,3 @@ class ImageManager
return $errors;
}
}
?>

@ -36,6 +36,8 @@ api_block_anonymous_users();
// Initialization of the repositories.
require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php';
$userId = api_get_user_id();
// Choosing the repository to be used.
if (api_is_in_course()) {
if (!api_is_in_group()) {
@ -46,13 +48,13 @@ if (api_is_in_course()) {
$IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/';
} else {
// 1.2. Student
$current_session_id = api_get_session_id();
if ($current_session_id == 0) {
$IMConfig['base_dir'] = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$sessionId = api_get_session_id();
if ($sessionId == 0) {
$IMConfig['base_dir'] = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.$userId.'/';
$IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.$userId.'/';
} else {
$IMConfig['base_dir'] = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';
$IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';
$IMConfig['base_dir'] = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document/shared_folder_session_'.$sessionId.'/sf_user_'.$userId.'/';
$IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder_session_'.$sessionId.'/sf_user_'.$userId.'/';
}
}
} else {
@ -67,9 +69,9 @@ if (api_is_in_course()) {
$IMConfig['base_url'] = $_configuration['root_web'].'home/default_platform_document/';
} else {
// 4. The user is outside courses.
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system');
$my_path = UserManager::get_user_picture_path_by_id($userId, 'system');
$IMConfig['base_dir'] = $my_path['dir'].'my_files/';
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web');
$my_path = UserManager::get_user_picture_path_by_id($userId, 'web');
$IMConfig['base_url'] = $my_path['dir'].'my_files/';
}
}

@ -20,7 +20,6 @@ if (isset($_GET['img'])) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $IMConfig['language']; ?>" lang="<?php echo $IMConfig['language']; ?>">
<head>
<title>Edit image</title>
@ -92,7 +91,6 @@ if (isset($_GET['img'])) {
<script type="text/javascript" src="assets/slider.js"></script>
<script type="text/javascript" src="assets/popup.js"></script>
<script type="text/javascript" src="assets/editor.js"></script>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
body {

@ -35,14 +35,12 @@ $imageInfo = $editor->processImage($imageRelative);
<script type="text/javascript" src="assets/wz_dragdrop.js"></script>
<script type="text/javascript" src="assets/EditorContent.js"></script>
<script type="text/javascript" src="assets/editorFrame.js"></script>
<style>
/* for centering the image vertically in IE */
html, body
{
height: 100%;
}
/* for centering the image vertically in IE */
html, body
{
height: 100%;
}
</style>

@ -1,3 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
?>
<div id="content">
<table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0">
<thead>
@ -7,15 +14,15 @@
<th class="docName"><?php echo LBL_NAME; ?></th>
<th width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th>
<!-- hide while implementing this Chamilo -->
<!--<th class="fileColumns"><?php // echo LBL_MODIFIED; ?></th> -->
<!--<th class="fileColumns"><?php // echo LBL_MODIFIED; ?></th> -->
</tr>
</thead>
<tbody id="fileList">
<?php
<?php
$count = 1;
$css = "";
//list all documents (files and folders) under this current folder,
//echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path')));
//list all documents (files and folders) under this current folder,
//echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path')));
foreach($fileList as $file) {
$css = ($css == "" || $css == "even"?"odd":"even");
$strDisabled = ($file['is_writable']?"":" disabled");
@ -32,7 +39,7 @@
$certificates_chamilo='certificates';
//show group's directory only if I'm member. Or if I'm a teacher. TODO: check groups not necessary because the student dont have access to main folder documents (only to document/group or document/shared_folder). Teachers can access to all groups ?
$group_folder='_groupdocs';
$show_doc_group=true;
if(ereg($group_folder, $file['path'])) {
@ -45,19 +52,19 @@
///Second step: hiding as the case
//Juan Carlos Raña
if ((!ereg($deleted_by_chamilo_file, $file['name']) &&
!ereg($deleted_by_chamilo_folder, $file['path'])) &&
!ereg($css_folder_chamilo, $file['path']) &&
!ereg($hotpotatoes_folder_chamilo, $file['path']) &&
!ereg($chat_files_chamilo, $file['path']) &&
!ereg($certificates_chamilo, $file['path']) &&
$show_doc_group && $file['name'][0]!='.') {
if ((!ereg($deleted_by_chamilo_file, $file['name']) &&
!ereg($deleted_by_chamilo_folder, $file['path'])) &&
!ereg($css_folder_chamilo, $file['path']) &&
!ereg($hotpotatoes_folder_chamilo, $file['path']) &&
!ereg($chat_files_chamilo, $file['path']) &&
!ereg($certificates_chamilo, $file['path']) &&
$show_doc_group && $file['name'][0]!='.') {
//hide Nanogong tag
if (strpos($file['path'], '_chnano_')) {
$file['path']= substr_replace($file['path'], '.wav', -12);//into real file name
$file['name']= substr_replace($file['name'], '.wav', -12);//into web name
}
if ($file['type'] == 'file') {
if(Security::remove_XSS($_GET['editor'])!='stand_alone') {
$path_chamilo_file='../'.$file['path'];// fix for makes a good show when pressed next on window preview, don't only one image
@ -74,7 +81,7 @@
<td align="center" class="fileColumns" id="tdst<?php echo $count; ?>">&nbsp;
<a id="<?php echo $count; ?>" href="<?php echo $path_chamilo_file; // fix for Chamilo ?>" target="_blank">
<span class="<?php echo $file['cssClass']; ?>">&nbsp;</span></a>
</td>
</td>
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>">
<a id="<?php echo $count; ?>" href="<?php echo $path_chamilo_file; //fix for Chamilo ?>" target="_blank">
<?php echo $file['name']; ?></a>
@ -85,7 +92,7 @@
<!--<td class="docInfo" id="tdth<?php //echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
</tr>
<?php
} else {
?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
@ -106,7 +113,7 @@
<td lign="center" class="fileColumns" id="tdst<?php echo $count; ?>">&nbsp;
<a id="<?php echo $count; ?>" href="<?php echo $file['path']; ?>" <?php echo $file['cssClass'] == 'filePicture'?'rel="ajaxPhotos"':''; ?> >
<span class="<?php echo ($file['type'] == 'folder '?$file['cssClass']:"unknownUser"); ?>">&nbsp;</span></a>
</td>
</td>
<?php
} else {
?>
@ -116,7 +123,7 @@
</td>
<?php
}
?>
?>
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>">
<a id="<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a>
</td>

@ -1,5 +1,10 @@
<div id="content">
<?php
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
echo '<div id="content">';
$count = 1;
$thumbnailBaseUrl = CONFIG_URL_IMG_THUMBNAIL;

@ -1,15 +1,20 @@
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
?>
<select class="input inputSearch" name="search_folder" id="search_folder">
<?php
<?php
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
{
?>
<option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option>
<?php
<?php
}
?>
?>
</select>

@ -11,6 +11,7 @@
* @since 18/January/2009
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
//@ob_start(); //Disabled for integration with Chamilo
//displayArray($_POST); //Disabled for integration with Chamilo
//writeInfo(@ob_get_clean()); //Disabled for integration with Chamilo

@ -1,15 +1,9 @@
<?php
/**
* delete selected files
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/April/2007
*
* Modify for Chamilo
* @author Juan Carlos Ra<EFBFBD>a
* @since 19/March/2009
*/
require_once dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php";
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
$error = "";
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE) {
$error = SYS_DISABLED;

@ -1,5 +1,11 @@
<?php
/**
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* delete selected files
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
@ -10,22 +16,22 @@
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
{
$path = $_GET['path'];
//check if the file size
$fileSize = @filesize($path);
if($fileSize > getMemoryLimit())
{//larger then the php memory limit, redirect to the file
header('Location: ' . $path);
exit;
}else
{//open it up and send out with php
downloadFile($path);
exit;
}else
{//open it up and send out with php
downloadFile($path);
}
}else
}else
{
die(ERR_DOWNLOAD_FILE_NOT_FOUND);
}

@ -1,12 +1,18 @@
<?php
/**
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* reset the image
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
if(!isset($_POST['path']))
{
$_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path'));
@ -17,14 +23,14 @@
$imageInfo = @GetImageSize($_POST['path']);
$_POST['width'] = $imageInfo[0];
$_POST['height'] = $imageInfo[1];
}
initSessionHistory($_POST['path']);
echo "{";
$error = "";
$info = "";
if(empty($_POST['path']))
{
$error = IMG_SAVE_EMPTY_PATH;
@ -39,25 +45,25 @@
{
if(!empty($_POST['mode']))
{
include_once(CLASS_IMAGE);
$image = new ImageAjaxFileManager();
$image->loadImage($_POST['path']);
switch($_POST['mode'])
{
case "resize":
case "resize":
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
{
$error = IMG_SAVE_RESIZE_FAILED;
}
}
break;
case "crop":
if(!$image->cropToDimensions($_POST['x'], $_POST['y'], intval($_POST['x']) + intval($_POST['width']), intval($_POST['y']) + intval($_POST['height'])))
{
$error = IMG_SAVE_CROP_FAILED;
}
break;
case "flip":
if(!$image->flip($_POST['flip_angle']))
@ -76,35 +82,35 @@
}
if(empty($error))
{
$sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
if(!@copy($_POST['path'], $sessionNewPath))
{
$error = IMG_SAVE_BACKUP_FAILED;
}else
}else
{
addSessionHistory($_POST['path'], $sessionNewPath);
if($image->saveImage($_POST['path']))
{
$imageInfo = $image->getFinalImageInfo();
{
$imageInfo = $image->getFinalImageInfo();
$info .= ",width:" . $imageInfo['width'] . "\n";
$info .= ",height:" . $imageInfo['height'] . "\n";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
}else
}else
{
$error = IMG_SAVE_FAILED;
}
}
}else
}
}
}else
{
//$image->DestroyImages();
}
}else
}else
{
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
echo "error:'" . $error . "'\n";
if(isset($image) && is_object($image))
{

@ -1,5 +1,10 @@
<?php
/**
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* copy file
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
@ -21,8 +26,8 @@
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else
{
}else
{
require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']);

@ -1,5 +1,11 @@
<?php
/**
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* cut file
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
@ -20,8 +26,8 @@
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else
{
}else
{
require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']);

@ -1,6 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
include_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php");
$error = '';
$fileMoved = array();
$unmovedDocDueToSamePath = array();

@ -1,13 +1,10 @@
<?php
/**
* processing the uploaded files
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
// @todo sleep??
sleep(3);
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
echo "{";
$error = "";
$info = "";

@ -1,16 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* the php script used to get the list of file or folders under a specific folder
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
* Modify for Chamilo
* @author Juan Carlos Ra<EFBFBD>a Trabado
* @since 31/December/2008
*/
require_once '../../../../../../inc/global.inc.php'; // Integrating with Chamilo
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
if (!isset($manager)) {
/**

@ -1,12 +1,16 @@
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
echo '{';
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
echo '{';
$count = 1;
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
{
echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'";
echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'";
$count++;
}
echo "}";

@ -1,5 +1,11 @@
<?php
/**
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* Ajax image editor platform
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
@ -16,7 +22,7 @@
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
{
$path = $_GET['path'];
}else
}else
{
die(IMG_GEN_IMG_NOT_EXISTS);
}
@ -33,7 +39,7 @@
}
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php");
$image = new ImageAjaxFileManager();
$imageInfo = $image->getImageInfo($path);
?>
@ -87,14 +93,14 @@
initDisabledButtons(true);
$("#formImageInfo").bind("keypress", function(e) {
if (e.keyCode == 13) {
return false;
}
});
});
}
);
</script>
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaximageeditor.css" type="text/css" rel="stylesheet" />
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.css" type="text/css" rel="stylesheet" />
@ -103,25 +109,25 @@
<body>
<?php
//displayArray($_SESSION);
?>
<div id="controls">
<fieldset id="modes">
<legend>Modes</legend>
<form name="formAction" id="formAction" method="post" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_UNDO, makeQueryString(array('path'))); ?>">
<input type="hidden" name="file_path" id="file_path" value="<?php echo $_GET['path']; ?>" />
<p><label id="label_resize" class="labelMode"><?php echo IMG_MODE_RESIZE; ?></label> <input type="radio" name="mode" value="resize" class="input" checked="checked" onclick="return changeMode();"/>
<label id="label_crop" class="labelMode"><?php echo IMG_MODE_CROP; ?></label> <input type="radio" name="mode" value="crop" class="input" onclick="return changeMode();" />
<label id="label_rotate" class="labelMode"><?php echo IMG_MODE_ROTATE; ?></label> <input type="radio" name="mode" value="rotate" class="input" onclick="return changeMode();" />
<label id="label_flip" class="labelMode"><?php echo IMG_MODE_FLIP; ?></label> <input type="radio" name="mode" value="flip" class="input" onclick="return changeMode();" />
|| <label id="label_constraint"><?php echo IMG_CHECKBOX_CONSTRAINT; ?></label> <input type="checkbox" name="constraint" id="constraint" value="1" class="input" onclick="return toggleConstraint();" />
<!-- <label>Watermark:</label> <input type="radio" name="mode" value="watermark" class="input" onclick="return false;" />-->
<button id="actionRotateLeft" class="disabledButton" onclick="return leftRotate();" disabled><?php echo IMG_BTN_ROTATE_LEFT; ?></button>
<button id="actionRotateRight" class="disabledButton" onclick="return rightRotate();" disabled><?php echo IMG_BTN_ROTATE_RIGHT; ?></button>
<button id="actionFlipH" class="disabledButton" onclick="return flipHorizontal();" disabled><?php echo IMG_BTN_FLIP_H; ?></button>
<button id="actionFlipV" class="disabledButton" onclick="return flipVertical();" disabled><?php echo IMG_BTN_FLIP_V; ?></button>
<button id="actionFlipV" class="disabledButton" onclick="return flipVertical();" disabled><?php echo IMG_BTN_FLIP_V; ?></button>
<button id="actionReset" class="button" onclick="return resetEditor();"><?php echo IMG_BTN_RESET; ?></button>
<button id="actionUndo" class="button" onclick="return undoImage();"><?php echo IMG_BTN_UNDO; ?></button>
<button id="actionSave" class="button" onclick="return saveImage();"><?php echo IMG_BTN_SAVE; ?></button>
@ -144,22 +150,22 @@
<!-- <b>Percentage:</b> <input type="text" name="percentage" id="percentage" value="" class="input imageInput"/>-->
<label><?php echo IMG_LBL_RATIO; ?></label> <input type="text" name="ratio" id="ratio" value="" class="input imageInput"/>
<label><?php echo IMG_LBL_ANGLE; ?></label> <input type="text" name="angle" id="angle" value="" class="input imageInput" />
</p>
</form>
</fieldset>
</div>
<div id="imageArea">
<div id="imageContainer">
<?php
if(Security::remove_XSS($_GET['editor'])!='stand_alone'){
$path='../'.$path;//<!-- For Chamilo integrating, enter a back directory "../" to avoid introducing main and can not read the image -->
}
?>
<img src="<?php echo $path; ?>" name="<?php echo basename($path); ?>" width="<?php echo $imageInfo['width']; ?>" height="<?php echo $imageInfo['height']; ?>" />
</div>
<div id="resizeMe">
<div id="resizeSE"></div>

@ -1,4 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* image save function
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
@ -6,8 +11,7 @@
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
$error = "";
$info = "";
@ -19,7 +23,7 @@
{
$error = IMG_SAVE_EMPTY_PATH;
}elseif(!file_exists($_POST['path']))
{
{
$error = IMG_SAVE_NOT_EXISTS;
}elseif(!isUnderRoot($_POST['path']))
{
@ -29,7 +33,7 @@
$error = SESSION_PERSONAL_DIR_NOT_FOUND;
}
else
{
{
require_once(CLASS_HISTORY);
$history = new History($_POST['path'], $session);
if(!empty($_POST['mode']))
@ -37,32 +41,32 @@
//get the original image which is the lastest session image if any when the system is in demo
$lastestSessionImageInfo = $history->getLastestRestorable();
if(sizeof($lastestSessionImageInfo) && CONFIG_SYS_DEMO_ENABLE)
{
{
$originalSessionImageInfo = $history->getOriginalImage();
if(sizeof($originalSessionImageInfo))
{
{
$originalImage = $sessionDir . $originalSessionImageInfo['info']['name'];
}
}
}
if(empty($originalImage))
{
$originalImage = $_POST['path'];
}
include_once(CLASS_IMAGE);
$image = new ImageAjaxFileManager();
if($image->loadImage($originalImage))
{
{
switch($_POST['mode'])
{
case "resize":
case "resize":
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
{
$error = IMG_SAVE_RESIZE_FAILED;
}
}
break;
case "crop":
case "crop":
if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
{
$error = IMG_SAVE_CROP_FAILED;
@ -75,27 +79,27 @@
}
break;
case "rotate":
if(!$image->rotate(intval($_POST['angle'])))
{
$error = IMG_SAVE_ROTATE_FAILED;
}
break;
default:
$error = IMG_SAVE_UNKNOWN_MODE;
}
if(empty($error))
{
$sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
{
$sessionNewPath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
if(!@copy($originalImage, $sessionNewPath))
{//keep a copy under the session folder
$error = IMG_SAVE_BACKUP_FAILED;
}else
$error = IMG_SAVE_BACKUP_FAILED;
}else
{
$isSaveAsRequest = (!empty($_POST['new_name']) && !empty($_POST['save_to'])?true:false);
//save the modified image
$sessionImageInfo = array('name'=>basename($sessionNewPath), 'restorable'=>1);
@ -105,52 +109,52 @@
if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
{
$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
}else
{
}else
{
$imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
}
}else
{
}else
{
if($isSaveAsRequest)
{//save as request
//check save to folder if exists
$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']);
$imagePath = addTrailingSlash(backslashToSlash($_POST['save_to'])) . $_POST['new_name'] . "." . getFileExt($_POST['path']);
if(!file_exists($_POST['save_to']) || !is_dir($_POST['save_to']))
{
$error = IMG_SAVE_AS_FOLDER_NOT_FOUND;
}elseif(file_exists($imagePath))
}elseif(file_exists($imagePath))
{
$error = IMG_SAVE_AS_NEW_IMAGE_EXISTS;
}elseif(!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_name']))
{
$error = IMG_SAVE_AS_ERR_NAME_INVALID;
}
}else
}else
{//save request
$imagePath = $originalImage;
$imagePath = $originalImage;
}
}
if($image->saveImage($imagePath))
{
{
if(CONFIG_SYS_DEMO_ENABLE)
{
if(!isset($originalSessionImageInfo) || !sizeof($originalSessionImageInfo))
{//keep this original image information on session for future reference if demo only
{//keep this original image information on session for future reference if demo only
$originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1);
$history->add($originalSessionImageInfo);
}
}
$imageInfo = $image->getFinalImageInfo();
}else
$imageInfo = $image->getFinalImageInfo();
}else
{
$error = IMG_SAVE_FAILED;
}
}
if(isset($imageInfo))
{
$info .= ",width:" . $imageInfo['width'] . "";
@ -159,29 +163,29 @@
if($isSaveAsRequest)
{
$info .= ",save_as:'1'";
}else
}else
{
$info .= ",save_as:'0'";
}
$info .= ",folder_path:'" . dirname($imagePath) . "'";
$info .= ",path:'" . backslashToSlash($imagePath) . "'";
}
}
}
}else
$info .= ",path:'" . backslashToSlash($imagePath) . "'";
}
}
}
}else
{
$error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage;
}
}
}else
}else
{
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
echo "{";
echo "{";
echo "error:'" . $error . "'";
if(isset($image) && is_object($image))
{
@ -190,6 +194,6 @@
echo $info;
echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0) . "";
echo "}";
?>

@ -1,4 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* ajax preview
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
@ -7,20 +12,20 @@
*
*/
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
$path = base64_decode($_GET['path']);
if(!empty($path) && file_exists($path) && is_file($path)) {
require_once CLASS_IMAGE;
require_once CLASS_IMAGE;
$image = new ImageAjaxFileManager(true);
if($image->loadImage($path)) {
if($image->resize(CONFIG_IMG_THUMBNAIL_MAX_X, CONFIG_IMG_THUMBNAIL_MAX_Y, true, true)) {
$image->showImage();
} else {
echo PREVIEW_NOT_PREVIEW . ".";
echo PREVIEW_NOT_PREVIEW . ".";
}
} else {
echo PREVIEW_NOT_PREVIEW . "..";
}
echo PREVIEW_NOT_PREVIEW . "..";
}
} else {
echo PREVIEW_NOT_PREVIEW . "...";
}

@ -1,4 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* ajax image undo function
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
@ -6,7 +12,7 @@
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
require_once(CLASS_HISTORY);
$history = new History($_POST['file_path'], $session);
$lastestSessionImageInfo = $history->getLastestRestorable();
@ -31,18 +37,18 @@
$error = IMG_UNDO_NO_HISTORY_AVAIALBE;
}
else
{
{
//get the original image which is the lastest session image if any when the system is in demo
$sessionImage = $session->getSessionDir() . $lastestSessionImageInfo['name'];
$originalSessionImageInfo = $history->getOriginalImage();
if(CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo))
{
$originalImage = $session->getSessionDir() . $originalSessionImageInfo['info']['name'];
}else
$originalImage = $session->getSessionDir() . $originalSessionImageInfo['info']['name'];
}else
{
$originalImage = $_POST['file_path'];
}
}
include_once(CLASS_IMAGE);
$image = new ImageAjaxFileManager();
if($image->loadImage($sessionImage))
@ -51,25 +57,25 @@
if(!@copy($sessionImage, $originalImage))
{
$error = IMG_UNDO_COPY_FAILED;
}else
}else
{
//remove the session image
if(@unlink($sessionImage))
{
$history->restore();
}
//only one left, remove the session original if demo
if($history->getNumRestorable() == 0 && CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo))
{
@unlink($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
@unlink($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
$originalImage = $_POST['file_path'];
}
}
$imagePath = $originalImage;
}else
}else
{
$error = IMG_SAVE_IMG_OPEN_FAILED;
}
@ -78,11 +84,11 @@
$info .= ",width:" . $imageInfo['width'] . "\n";
$info .= ",height:" . $imageInfo['height'] . "\n";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
$info .= ",path:'" . backslashToSlash($imagePath) . "'\n";
}
$info .= ",path:'" . backslashToSlash($imagePath) . "'\n";
}
}
echo "error:'" . $error . "'\n";
if(isset($image) && is_object($image))
{

@ -1,18 +1,15 @@
<?php
/**
* access control login form
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/April/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
if(isset($_POST['username']))
{
if($auth->login())
{
header('Location: ' . appendQueryString(CONFIG_URL_HOME, makeQueryString()));
exit;
exit;
}
}
?>
@ -47,7 +44,7 @@ if(isset($_POST['username']))
<tr>
<td>&nbsp;</td>
<td><input type="submit" class="button" value="Login" /></td>
</tr>
</tr>
</tfoot>
</table>
</form>

@ -1,15 +1,10 @@
<?php
/**
* AJAX preview
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @author Julio Montoya - adding support for chamilo
* @link www.phpletter.com
* @since 22/April/2007
*
*/
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
api_block_anonymous_users();
if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path'])) {
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path'])) {
include_once(CLASS_MANAGER);
$manager = new manager($_GET['path'], false);
$fileTypes = $manager->getFileType(basename($_GET['path']));
@ -19,7 +14,7 @@ if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']
$imageInfo = @getimagesize($_GET['path']);
if(!empty($imageInfo[0]) && !empty($imageInfo[1])) {
$thumInfo = getThumbWidthHeight($imageInfo[0], $imageInfo[1], 400, 135);
printf("<img src=\"%s\" width=\"%s\" height=\"%s\" />", getFileUrl($_GET['path']), $thumInfo['width'], $thumInfo['height']);
printf("<img src=\"%s\" width=\"%s\" height=\"%s\" />", getFileUrl($_GET['path']), $thumInfo['width'], $thumInfo['height']);
} else {
echo PREVIEW_IMAGE_LOAD_FAILED;
}
@ -31,13 +26,13 @@ if (!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']
} else {
echo PREVIEW_OPEN_FAILED . ".";
}
break;
break;
case "video":
break;
}
} else {
echo PREVIEW_NOT_PREVIEW . "..";
}
}
} else {
echo PREVIEW_NOT_PREVIEW . "...";
}

@ -1,6 +1,9 @@
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@ -33,7 +36,7 @@
</th>
<td>
<select class="input" name="save_to">
</select>
</td>
</tr>

@ -1,4 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* ajax save name
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
@ -34,11 +39,11 @@
}elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
{
$error = ERR_RENAME_FAILED;
}else
}else
{
//update record of session if image exists in session for cut or copy
include_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$sessionAction = new SessionAction();
$selectedDocuments = $sessionAction->get();
if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
{
@ -46,13 +51,13 @@
{
$selectedDocuments[$key] = $_POST['name'];
$sessionAction->set($selectedDocuments);
}
}elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
{
$sessionAction->setFolder($_POST['original_path']);
}
}
$path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
if(is_file($path))
{
@ -68,7 +73,7 @@
$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
}
}
echo "{";
echo "error:'" . $error . "' ";
foreach ($fileInfo as $k=>$v)
@ -76,6 +81,6 @@
echo "," . $k . ":'" . $v . "' ";
}
echo "}";
?>

@ -1,4 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
/**
* ajax save name
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
@ -14,7 +18,7 @@
$error = SYS_DISABLED;
}
elseif(isset($_POST['save_as_request']))
{
{
if(!preg_match('/^[a-zA-Z0-9_\-.]+$/', $_POST['name']))
{
$error = TXT_SAVE_AS_ERR_NAME_INVALID;
@ -27,56 +31,56 @@
}
else
{
if(!empty($_POST['save_as_request']))
{//save as request
if(file_exists($path))
{
$error = TXT_FILE_EXIST;
}else
}else
{
if(($fp = @fopen($path, 'w+')) !== false)
{
if(@fwrite($fp, $_POST['text']))
{
@fclose($fp);
}else
}else
{
$error = TXT_CONTENT_WRITE_FAILED;
}
}else
}else
{
$error = TXT_CREATE_FAILED;
}
}
}
}else
}else
{
if(!file_exists($path))
{
$error = TXT_FILE_NOT_EXIST;
}else
}else
{
if(($fp = @fopen($path, 'w')) !== false)
{
if(@fwrite($fp, $_POST['text']))
{
@fclose($fp);
}else
}else
{
$error = TXT_CONTENT_UPDATE_FAILED;
}
}else
}else
{
$error = TXT_FILE_OPEN_FAILED;
}
}
}
}
}
}else
}else
{
$error = TXT_UNKNOWN_REQUEST;
}
@ -84,5 +88,5 @@
echo "error:'" . $error . "',\n";
echo "path:'" . $path . "'";
echo "}";
?>

@ -1,44 +1,47 @@
<?php
/**
* Ajax image editor platform
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
{
die(SYS_DISABLED);
}
//$session->gc(); //disabled for Chamilo
$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
{
$path = $_GET['path'];
}else
{
die(TXT_FILE_NOT_FOUND);
}
if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js"))
{
$syntax = getFileExt($path);
}else
{
switch (getFileExt($path))
{
case 'htm':
$syntax = 'html';
break;
default:
$syntax = 'basic';
}
}
if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
{
die(TXT_DISALLOWED_EXT);
}
?>
/* For licensing terms, see /license.txt */
/**
* Ajax image editor platform
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) {
die(SYS_DISABLED);
}
//$session->gc(); //disabled for Chamilo
$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
{
$path = $_GET['path'];
}else
{
die(TXT_FILE_NOT_FOUND);
}
if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js"))
{
$syntax = getFileExt($path);
}else
{
switch (getFileExt($path))
{
case 'htm':
$syntax = 'html';
break;
default:
$syntax = 'basic';
}
}
if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
{
die(TXT_DISALLOWED_EXT);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@ -54,36 +57,36 @@
-->
<script type="text/javascript" src="jscripts/edit_area/edit_area_full.js"></script>
<script type="text/javascript">
var warningExtNotSelected = '<?php echo TXT_EXT_NOT_SELECTED; ?>';
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
var warningInvalidName = '<?php echo TXT_SAVE_AS_ERR_NAME_INVALID; ?>';
var waringFolderNotSelected = '<?php echo TXT_DEST_FOLDER_NOT_SELECTED; ?>';
var currentFolder = '<?php echo dirname($path); ?>';
var currentName = '<?php echo basename($path); ?>';
var warningExtNotSelected = '<?php echo TXT_EXT_NOT_SELECTED; ?>';
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
var warningInvalidName = '<?php echo TXT_SAVE_AS_ERR_NAME_INVALID; ?>';
var waringFolderNotSelected = '<?php echo TXT_DEST_FOLDER_NOT_SELECTED; ?>';
var currentFolder = '<?php echo dirname($path); ?>';
var currentName = '<?php echo basename($path); ?>';
jQuery(document).ready(
function()
{
editAreaLoader.init({
id: "content" // id of the textarea to transform
,start_highlight: false // if start with highlight
,allow_resize: "both"
,gecko_spellcheck:true
,allow_toggle: true
,toolbar:"search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, save, save_as"
,save_callback:"save"
,save_as_callback:"save_as"
,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA . 'langs' . DIRECTORY_SEPARATOR .CONFIG_LANG_INDEX . ".js")?CONFIG_LANG_INDEX:'en'); ?>"
,syntax: "<?php echo $syntax; ?>"
});
jQuery('#windowSaveAs').jqm();
jQuery('#windowProcessing').jqm({modal:true});
}
);
jQuery(document).ready(
function()
{
editAreaLoader.init({
id: "content" // id of the textarea to transform
,start_highlight: false // if start with highlight
,allow_resize: "both"
,gecko_spellcheck:true
,allow_toggle: true
,toolbar:"search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, save, save_as"
,save_callback:"save"
,save_as_callback:"save_as"
,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA . 'langs' . DIRECTORY_SEPARATOR .CONFIG_LANG_INDEX . ".js")?CONFIG_LANG_INDEX:'en'); ?>"
,syntax: "<?php echo $syntax; ?>"
});
jQuery('#windowSaveAs').jqm();
jQuery('#windowProcessing').jqm({modal:true});
}
);
</script>
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaxtexteditor.css" type="text/css" rel="stylesheet" />
@ -98,10 +101,10 @@
<div id="windowProcessing" class="jqmWindow" style="display:none">
<form name="frmProcessing" id="frmProcessing" method="post" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>">
<input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" />
<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />
<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />
<input type="hidden" name="save_as_request" id="save_as_request" value="0" />
<div style="display:none"><textarea name="text" id="text"></textarea></div>
</form>
<div style="display:none"><textarea name="text" id="text"></textarea></div>
</form>
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
<p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p>
</div>
@ -139,7 +142,7 @@
</th>
<td>
<select class="input" name="save_to" id="save_to">
</select>
</td>
</tr>

@ -1,4 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* file manager platform
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
@ -10,10 +12,8 @@
* @since 31/December/2008
*/
include '../../../../../../inc/global.inc.php'; // Integrating with Chamilo
api_block_anonymous_users();// from Chamilo
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
require_once CLASS_SESSION_ACTION;
$sessionAction = new SessionAction();

@ -16,8 +16,9 @@
// Loading the global initialization file.
require_once '../../../../../../inc/global.inc.php';
// Loading document repositories settings.
api_block_anonymous_users();
// Loading document repositories settings.
require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php';
//FILESYSTEM CONFIG
@ -48,7 +49,6 @@ define('DIR_AJAX_JS', DIR_AJAX_ROOT.'jscripts'.DIRECTORY_SEPARATOR);
define('DIR_AJAX_EDIT_AREA', DIR_AJAX_JS.'edit_area'.DIRECTORY_SEPARATOR);
define('DIR_LANG', DIR_AJAX_ROOT.'langs'.DIRECTORY_SEPARATOR);
//Class Declarations
define('CLASS_FILE', DIR_AJAX_INC.'class.file.php');
define("CLASS_UPLOAD", DIR_AJAX_INC.'class.upload.php');
@ -69,7 +69,6 @@ if (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['config']) && file_exists(dirname
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.$configBaseFileName;
// Loading the selected language file.
require_once DIR_AJAX_LANGS.CONFIG_LANG_DEFAULT.".php";
@ -116,4 +115,4 @@ define('CONFIG_URL_SAVE_TEXT', 'ajax_save_text.php');
define('CONFIG_URL_LIST_LISTING', 'ajax_get_file_listing.php');
define('CONFIG_URL_IMG_THUMBNAIL', $web_path.'ajax_image_thumbnail.php');
define('CONFIG_URL_FILEnIMAGE_MANAGER', 'ajaxfilemanager.php');
define('CONFIG_URL_FILE_PASTE', 'ajax_file_paste.php');
define('CONFIG_URL_FILE_PASTE', 'ajax_file_paste.php');

@ -162,12 +162,11 @@ class FCKeditor
*
* @return string
*/
public function CreateHtml() {
public function CreateHtml()
{
// Adaptation for the Chamilo LMS
//@todo why the BasePath is relative ? we should use this constant WEB_PATH
$this->BasePath = api_get_path(REL_PATH).'main/inc/lib/fckeditor/';
//$this->BasePath = api_get_path(WEB_PATH).'main/inc/lib/fckeditor/';
$config = $this->get_custom_configuration();
$this->read_configuration($config);
@ -463,7 +462,14 @@ class FCKeditor
* This method returns default configuration for document repository that is to be used by the editor.
* @return array
*/
private function & get_repository_configuration() {
private function & get_repository_configuration()
{
// Disabling access for anonymous users.
$isAnonymous = api_is_anonymous();
if ($isAnonymous) {
return array();
}
// Preliminary calculations for assembling required paths.
$base_path = $this->BasePath;
@ -479,6 +485,7 @@ class FCKeditor
$script_path = api_get_path(WEB_PATH).$script_path;
$use_advanced_filemanager = api_get_setting('advanced_filemanager') == 'true';
// Let javascripts "know" which file manager has been chosen.
$config['AdvancedFileManager'] = $use_advanced_filemanager;
@ -493,15 +500,11 @@ class FCKeditor
} else {
// 1.2. Student
$current_session_id = api_get_session_id();
if($current_session_id==0)
{
if($current_session_id==0) {
$config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$config['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$config['BaseHref'] = $script_path;
}
else
{
} else {
$config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document//shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';
$config['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';
$config['BaseHref'] = $script_path;

@ -9,20 +9,31 @@
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
// Disabling access for anonymous users.
api_block_anonymous_users();
$permissions_for_new_directories = api_get_permissions_for_new_directories();
$permissions_for_new_files = api_get_permissions_for_new_files();
$userId = api_get_user_id();
$sessionId = api_get_session_id();
if (!empty($_course['path'])) {
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
// Get the Chamilo session properties. Before ajaximagemanager!!!
$to_group_id = !empty($_SESSION['_gid']) ? $_SESSION['_gid'] : 0 ;
$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
$is_user_in_group = GroupManager::is_user_in_group($_user['user_id'],$_SESSION['_gid']);
$groupId = api_get_group_id();
$group_properties = GroupManager::get_group_properties($groupId);
$is_user_in_group = GroupManager::is_user_in_group($userId, $groupId);
}
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'system');
$sessionName = null;
if (!empty($sessionId)) {
$sessionName = api_get_session_name($sessionId);
}
$my_path = UserManager::get_user_picture_path_by_id($userId, 'system');
$user_folder = $my_path['dir'].'my_files/';
// Sanity checks for Chamilo.
@ -46,46 +57,42 @@ if (api_is_in_course()) {
$course_dir = $_course['path'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir;
$current_session_id = api_get_session_id();
$userinfo = Database::get_user_info_from_id(api_get_user_id());
$userInfo = api_get_user_info();
if ($current_session_id==0){
//Create shared folder. Necessary for courses recycled. Allways session_id should be zero. Allway should be created from a base course, never from a session.
if ($sessionId == 0) {
/* Create shared folder. Necessary for courses recycled.
Always session_id should be zero. Always should be created from a base course, never from a session.*/
if (!file_exists($base_work_dir.'/shared_folder')) {
$usf_dir_title = get_lang('SharedFolder');
$usf_dir_name = '/shared_folder';
$to_group_id = 0;
$visibility = 0;
create_unexisting_directory($_course, $_user['user_id'], api_get_session_id(), $to_group_id, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
create_unexisting_directory($_course, $userId, $sessionId, 0, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
// Create dynamic user shared folder
if (!file_exists($base_work_dir.'/shared_folder/sf_user_'.api_get_user_id())) {
$usf_dir_title = api_get_person_name($_user['firstName'], $_user['lastName']);
$usf_dir_name = '/shared_folder/sf_user_'.api_get_user_id();
$to_group_id = 0;
if (!file_exists($base_work_dir.'/shared_folder/sf_user_'.$userId)) {
$usf_dir_title = $userInfo['complete_name'];
$usf_dir_name = '/shared_folder/sf_user_'.$userId;
$visibility = 1;
create_unexisting_directory($_course, $_user['user_id'], api_get_session_id(), $to_group_id, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
create_unexisting_directory($_course, $userId, $sessionId, 0, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
} else {
//Create shared folder session
if (!file_exists($base_work_dir.'/shared_folder_session_'.$current_session_id)) {
$usf_dir_title = get_lang('SharedFolder').' ('.api_get_session_name($current_session_id).')';
$usf_dir_name = '/shared_folder_session_'.$current_session_id;
$to_group_id = 0;
} else {
// Create shared folder session
if (!file_exists($base_work_dir.'/shared_folder_session_'.$sessionId)) {
$usf_dir_title = get_lang('SharedFolder').' ('.$sessionName.')';
$usf_dir_name = '/shared_folder_session_'.$sessionId;
$visibility = 0;
create_unexisting_directory($_course, $_user['user_id'], api_get_session_id(), $to_group_id, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
create_unexisting_directory($_course, $userId, $sessionId, 0, $to_user_id, $base_work_dir, $usf_dir_name, $usf_dir_title, $visibility);
}
//Create dynamic user shared folder into a shared folder session
if (!file_exists($base_work_dir.'/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id())) {
$usf_dir_title = api_get_person_name($_user['firstName'], $_user['lastName']).'('.api_get_session_name($current_session_id).')';
$usf_dir_name = '/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id();
$to_group_id = 0;
// Create dynamic user shared folder into a shared folder session.
if (!file_exists($base_work_dir.'/shared_folder_session_'.$sessionId.'/sf_user_'.$userId)) {
$usf_dir_title = $userInfo['complete_name'].' ('.$sessionName.')';
$usf_dir_name = '/shared_folder_session_'.$sessionId.'/sf_user_'.$userId;
$visibility = 1;
create_unexisting_directory(
$_course,
$_user['user_id'],
api_get_session_id(),
$to_group_id,
$userId,
$sessionId,
0,
$to_user_id,
$base_work_dir,
$usf_dir_name,
@ -93,5 +100,5 @@ if (api_is_in_course()) {
$visibility
);
}
}
}
}
Loading…
Cancel
Save