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. // Loading the global initialization file, Chamilo LMS.
require_once '../../../../../../global.inc.php'; require_once '../../../../../../global.inc.php';
// Disabling access for anonymous users.
api_block_anonymous_users();
// Initialization of the repositories. // Initialization of the repositories.
require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php' ; 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"). // 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 // 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(); $userId = api_get_user_id();
if (api_is_in_course()) { if (api_is_in_course()) {
$coursePath = api_get_path(REL_COURSE_PATH).api_get_course_path(); $coursePath = api_get_path(REL_COURSE_PATH).api_get_course_path();
if (!api_is_in_group()) { if (!api_is_in_group()) {
@ -53,20 +57,20 @@ if (api_is_in_course()) {
$Config['UserFilesPath'] = $coursePath.'/document/'; $Config['UserFilesPath'] = $coursePath.'/document/';
} else { } else {
// 1.2. Student // 1.2. Student
$current_session_id = api_get_session_id(); $current_session_id = api_get_session_id();
if ($current_session_id == 0) { if ($current_session_id == 0) {
$Config['UserFilesPath'] = $coursePath.'/document/shared_folder/sf_user_'.$userId.'/'; $Config['UserFilesPath'] = $coursePath.'/document/shared_folder/sf_user_'.$userId.'/';
} else { } else {
$Config['UserFilesPath'] = $coursePath.'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.$userId.'/'; $Config['UserFilesPath'] = $coursePath.'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.$userId.'/';
} }
} }
} else { } else {
$groupId = api_get_group_id(); $groupId = api_get_group_id();
$groupInfo = GroupManager::get_group_properties($groupId); $groupInfo = GroupManager::get_group_properties($groupId);
// 2. Inside a course and inside a group. if (!empty($groupInfo)) {
$Config['UserFilesPath'] = $coursePath.'/document'.$groupInfo['directory'].'/'; // 2. Inside a course and inside a group.
$Config['UserFilesPath'] = $coursePath.'/document'.$groupInfo['directory'].'/';
}
} }
} else { } else {
if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin') { if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin') {
@ -75,16 +79,19 @@ if (api_is_in_course()) {
} else { } else {
// 4. The user is outside courses. // 4. The user is outside courses.
$my_path = UserManager::get_user_picture_path_by_id($userId, 'rel'); $my_path = UserManager::get_user_picture_path_by_id($userId, 'rel');
$Config['UserFilesPath'] = $my_path['dir'].'my_files/'; $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 // 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 // user files directory. Useful if you are using a virtual directory, symbolic
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. // link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'UserFilesPath' must point to the same directory. // 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 // Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled. // following setting enabled.

@ -576,24 +576,15 @@ class ImageManager
$chamiloFile = $file['name']; $chamiloFile = $file['name'];
$chamiloFileSize = $file['size']; $chamiloFileSize = $file['size'];
if(!empty($group_properties['directory'])) { 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); $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,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
} }
/*
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; $dimensionsIndex = isset($_REQUEST['uploadSize']) ? $_REQUEST['uploadSize'] : 0;
// If maximum size is specified, constrain image to it. // 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 = Image_Transform::factory(IMAGE_CLASS);
$img->load($path . $result); $img->load($path . $result);
@ -609,7 +600,7 @@ class ImageManager
} }
} }
//delete tmp files. // Delete tmp files.
Files::delFile($file['tmp_name']); Files::delFile($file['tmp_name']);
return false; return false;
} }
@ -782,13 +773,7 @@ class ImageManager
{ {
Return false; Return false;
} }
}
/*
} }
else
Return false;
*/
} }
/** /**
@ -820,9 +805,8 @@ class ImageManager
$base_dir = substr($path, 0, strpos($path,'/document/')+9); // $base_dir = substr($path, 0, strpos($path,'/document/')+9); //
$new_dir = substr($fullpath, strlen($base_dir),-1); // $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); $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 ); $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, 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);
} else { } else {
return Files::createFolder($fullpath); return Files::createFolder($fullpath);
} }
@ -891,5 +875,3 @@ class ImageManager
return $errors; return $errors;
} }
} }
?>

@ -36,6 +36,8 @@ api_block_anonymous_users();
// Initialization of the repositories. // Initialization of the repositories.
require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php'; require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php';
$userId = api_get_user_id();
// Choosing the repository to be used. // Choosing the repository to be used.
if (api_is_in_course()) { if (api_is_in_course()) {
if (!api_is_in_group()) { 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/'; $IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/';
} else { } else {
// 1.2. Student // 1.2. Student
$current_session_id = api_get_session_id(); $sessionId = api_get_session_id();
if ($current_session_id == 0) { if ($sessionId == 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_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_'.api_get_user_id().'/'; $IMConfig['base_url'] = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.$userId.'/';
} else { } 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_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_'.$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_'.$sessionId.'/sf_user_'.$userId.'/';
} }
} }
} else { } else {
@ -67,9 +69,9 @@ if (api_is_in_course()) {
$IMConfig['base_url'] = $_configuration['root_web'].'home/default_platform_document/'; $IMConfig['base_url'] = $_configuration['root_web'].'home/default_platform_document/';
} else { } else {
// 4. The user is outside courses. // 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/'; $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/'; $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"> <!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']; ?>"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $IMConfig['language']; ?>" lang="<?php echo $IMConfig['language']; ?>">
<head> <head>
<title>Edit image</title> <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/slider.js"></script>
<script type="text/javascript" src="assets/popup.js"></script> <script type="text/javascript" src="assets/popup.js"></script>
<script type="text/javascript" src="assets/editor.js"></script> <script type="text/javascript" src="assets/editor.js"></script>
<style type="text/css" media="screen, projection"> <style type="text/css" media="screen, projection">
/*<![CDATA[*/ /*<![CDATA[*/
body { 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/wz_dragdrop.js"></script>
<script type="text/javascript" src="assets/EditorContent.js"></script> <script type="text/javascript" src="assets/EditorContent.js"></script>
<script type="text/javascript" src="assets/editorFrame.js"></script> <script type="text/javascript" src="assets/editorFrame.js"></script>
<style> <style>
/* for centering the image vertically in IE */
/* for centering the image vertically in IE */ html, body
html, body {
{ height: 100%;
height: 100%; }
}
</style> </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"> <div id="content">
<table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0"> <table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0">
<thead> <thead>
@ -7,15 +14,15 @@
<th class="docName"><?php echo LBL_NAME; ?></th> <th class="docName"><?php echo LBL_NAME; ?></th>
<th width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th> <th width="70" class="fileColumns"><?php echo LBL_SIZE; ?></th>
<!-- hide while implementing this Chamilo --> <!-- hide while implementing this Chamilo -->
<!--<th class="fileColumns"><?php // echo LBL_MODIFIED; ?></th> --> <!--<th class="fileColumns"><?php // echo LBL_MODIFIED; ?></th> -->
</tr> </tr>
</thead> </thead>
<tbody id="fileList"> <tbody id="fileList">
<?php <?php
$count = 1; $count = 1;
$css = ""; $css = "";
//list all documents (files and folders) under this current folder, //list all documents (files and folders) under this current folder,
//echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path'))); //echo appendQueryString(appendQueryString(CONFIG_URL_FILEnIMAGE_MANAGER, "path=" . $file['path']), makeQueryString(array('path')));
foreach($fileList as $file) { foreach($fileList as $file) {
$css = ($css == "" || $css == "even"?"odd":"even"); $css = ($css == "" || $css == "even"?"odd":"even");
$strDisabled = ($file['is_writable']?"":" disabled"); $strDisabled = ($file['is_writable']?"":" disabled");
@ -32,7 +39,7 @@
$certificates_chamilo='certificates'; $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 ? //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'; $group_folder='_groupdocs';
$show_doc_group=true; $show_doc_group=true;
if(ereg($group_folder, $file['path'])) { if(ereg($group_folder, $file['path'])) {
@ -45,19 +52,19 @@
///Second step: hiding as the case ///Second step: hiding as the case
//Juan Carlos Raña //Juan Carlos Raña
if ((!ereg($deleted_by_chamilo_file, $file['name']) && if ((!ereg($deleted_by_chamilo_file, $file['name']) &&
!ereg($deleted_by_chamilo_folder, $file['path'])) && !ereg($deleted_by_chamilo_folder, $file['path'])) &&
!ereg($css_folder_chamilo, $file['path']) && !ereg($css_folder_chamilo, $file['path']) &&
!ereg($hotpotatoes_folder_chamilo, $file['path']) && !ereg($hotpotatoes_folder_chamilo, $file['path']) &&
!ereg($chat_files_chamilo, $file['path']) && !ereg($chat_files_chamilo, $file['path']) &&
!ereg($certificates_chamilo, $file['path']) && !ereg($certificates_chamilo, $file['path']) &&
$show_doc_group && $file['name'][0]!='.') { $show_doc_group && $file['name'][0]!='.') {
//hide Nanogong tag //hide Nanogong tag
if (strpos($file['path'], '_chnano_')) { if (strpos($file['path'], '_chnano_')) {
$file['path']= substr_replace($file['path'], '.wav', -12);//into real file name $file['path']= substr_replace($file['path'], '.wav', -12);//into real file name
$file['name']= substr_replace($file['name'], '.wav', -12);//into web name $file['name']= substr_replace($file['name'], '.wav', -12);//into web name
} }
if ($file['type'] == 'file') { if ($file['type'] == 'file') {
if(Security::remove_XSS($_GET['editor'])!='stand_alone') { 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 $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; <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"> <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> <span class="<?php echo $file['cssClass']; ?>">&nbsp;</span></a>
</td> </td>
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"> <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"> <a id="<?php echo $count; ?>" href="<?php echo $path_chamilo_file; //fix for Chamilo ?>" target="_blank">
<?php echo $file['name']; ?></a> <?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> --> <!--<td class="docInfo" id="tdth<?php //echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
</tr> </tr>
<?php <?php
} else { } else {
?> ?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" > <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; <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"':''; ?> > <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> <span class="<?php echo ($file['type'] == 'folder '?$file['cssClass']:"unknownUser"); ?>">&nbsp;</span></a>
</td> </td>
<?php <?php
} else { } else {
?> ?>
@ -116,7 +123,7 @@
</td> </td>
<?php <?php
} }
?> ?>
<td class="<?php echo $strClass; ?> docName" id="tdnd<?php echo $count; ?>"> <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> <a id="<?php echo $count; ?>" href="<?php echo "../".$file['path']; ?>" target="_blank"><?php echo $file['name']; ?></a>
</td> </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; $count = 1;
$thumbnailBaseUrl = CONFIG_URL_IMG_THUMBNAIL; $thumbnailBaseUrl = CONFIG_URL_IMG_THUMBNAIL;

@ -1,15 +1,20 @@
<?php <?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"> <select class="input inputSearch" name="search_folder" id="search_folder">
<?php <?php
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
{ {
?> ?>
<option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option> <option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option>
<?php <?php
} }
?> ?>
</select> </select>

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

@ -1,15 +1,9 @@
<?php <?php
/** /* For licensing terms, see /license.txt */
* delete selected files
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) require_once '../../../../../../inc/global.inc.php';
* @link www.phpletter.com require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
* @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";
$error = ""; $error = "";
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE) { if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE) {
$error = SYS_DISABLED; $error = SYS_DISABLED;

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

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

@ -1,5 +1,10 @@
<?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';
/**
* copy file * copy file
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com * @link www.phpletter.com
@ -21,8 +26,8 @@
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
{ {
$error = ERR_FOLDER_PATH_NOT_ALLOWED; $error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else }else
{ {
require_once(CLASS_SESSION_ACTION); require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction(); $sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']); $sessionAction->setAction($_POST['action_value']);

@ -1,5 +1,11 @@
<?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';
/**
* cut file * cut file
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com * @link www.phpletter.com
@ -20,8 +26,8 @@
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
{ {
$error = ERR_FOLDER_PATH_NOT_ALLOWED; $error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else }else
{ {
require_once(CLASS_SESSION_ACTION); require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction(); $sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']); $sessionAction->setAction($_POST['action_value']);

@ -1,6 +1,9 @@
<?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';
include_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php");
$error = ''; $error = '';
$fileMoved = array(); $fileMoved = array();
$unmovedDocDueToSamePath = array(); $unmovedDocDueToSamePath = array();

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

@ -1,16 +1,8 @@
<?php <?php
/* For licensing terms, see /license.txt */
/** require_once '../../../../../../inc/global.inc.php';
* the php script used to get the list of file or folders under a specific folder require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
* @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
if (!isset($manager)) { if (!isset($manager)) {
/** /**

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

@ -1,5 +1,11 @@
<?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';
/**
* Ajax image editor platform * Ajax image editor platform
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com * @link www.phpletter.com
@ -16,7 +22,7 @@
if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path'])) if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
{ {
$path = $_GET['path']; $path = $_GET['path'];
}else }else
{ {
die(IMG_GEN_IMG_NOT_EXISTS); die(IMG_GEN_IMG_NOT_EXISTS);
} }
@ -33,7 +39,7 @@
} }
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php"); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php");
$image = new ImageAjaxFileManager(); $image = new ImageAjaxFileManager();
$imageInfo = $image->getImageInfo($path); $imageInfo = $image->getImageInfo($path);
?> ?>
@ -87,14 +93,14 @@
initDisabledButtons(true); initDisabledButtons(true);
$("#formImageInfo").bind("keypress", function(e) { $("#formImageInfo").bind("keypress", function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
return false; return false;
} }
}); });
} }
); );
</script> </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/ajaximageeditor.css" type="text/css" rel="stylesheet" />
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.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> <body>
<?php <?php
//displayArray($_SESSION); //displayArray($_SESSION);
?> ?>
<div id="controls"> <div id="controls">
<fieldset id="modes"> <fieldset id="modes">
<legend>Modes</legend> <legend>Modes</legend>
<form name="formAction" id="formAction" method="post" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_UNDO, makeQueryString(array('path'))); ?>"> <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']; ?>" /> <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();"/> <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_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_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_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 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;" />--> <!-- <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="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="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="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="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="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> <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"/>--> <!-- <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_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" /> <label><?php echo IMG_LBL_ANGLE; ?></label> <input type="text" name="angle" id="angle" value="" class="input imageInput" />
</p> </p>
</form> </form>
</fieldset> </fieldset>
</div> </div>
<div id="imageArea"> <div id="imageArea">
<div id="imageContainer"> <div id="imageContainer">
<?php <?php
if(Security::remove_XSS($_GET['editor'])!='stand_alone'){ 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 --> $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']; ?>" /> <img src="<?php echo $path; ?>" name="<?php echo basename($path); ?>" width="<?php echo $imageInfo['width']; ?>" height="<?php echo $imageInfo['height']; ?>" />
</div> </div>
<div id="resizeMe"> <div id="resizeMe">
<div id="resizeSE"></div> <div id="resizeSE"></div>

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

@ -1,4 +1,9 @@
<?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';
/** /**
* ajax preview * ajax preview
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @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']); $path = base64_decode($_GET['path']);
if(!empty($path) && file_exists($path) && is_file($path)) { if(!empty($path) && file_exists($path) && is_file($path)) {
require_once CLASS_IMAGE; require_once CLASS_IMAGE;
$image = new ImageAjaxFileManager(true); $image = new ImageAjaxFileManager(true);
if($image->loadImage($path)) { if($image->loadImage($path)) {
if($image->resize(CONFIG_IMG_THUMBNAIL_MAX_X, CONFIG_IMG_THUMBNAIL_MAX_Y, true, true)) { if($image->resize(CONFIG_IMG_THUMBNAIL_MAX_X, CONFIG_IMG_THUMBNAIL_MAX_Y, true, true)) {
$image->showImage(); $image->showImage();
} else { } else {
echo PREVIEW_NOT_PREVIEW . "."; echo PREVIEW_NOT_PREVIEW . ".";
} }
} else { } else {
echo PREVIEW_NOT_PREVIEW . ".."; echo PREVIEW_NOT_PREVIEW . "..";
} }
} else { } else {
echo PREVIEW_NOT_PREVIEW . "..."; echo PREVIEW_NOT_PREVIEW . "...";
} }

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

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

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

@ -1,6 +1,9 @@
<?php <?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';
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!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"> <html xmlns="http://www.w3.org/1999/xhtml">
@ -33,7 +36,7 @@
</th> </th>
<td> <td>
<select class="input" name="save_to"> <select class="input" name="save_to">
</select> </select>
</td> </td>
</tr> </tr>

@ -1,4 +1,9 @@
<?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';
/** /**
* ajax save name * ajax save name
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @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'])) }elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
{ {
$error = ERR_RENAME_FAILED; $error = ERR_RENAME_FAILED;
}else }else
{ {
//update record of session if image exists in session for cut or copy //update record of session if image exists in session for cut or copy
include_once(CLASS_SESSION_ACTION); include_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction(); $sessionAction = new SessionAction();
$selectedDocuments = $sessionAction->get(); $selectedDocuments = $sessionAction->get();
if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments)) if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
{ {
@ -46,13 +51,13 @@
{ {
$selectedDocuments[$key] = $_POST['name']; $selectedDocuments[$key] = $_POST['name'];
$sessionAction->set($selectedDocuments); $sessionAction->set($selectedDocuments);
} }
}elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path'])) }elseif(removeTrailingSlash($sessionAction->getFolder()) == removeTrailingSlash($_POST['original_path']))
{ {
$sessionAction->setFolder($_POST['original_path']); $sessionAction->setFolder($_POST['original_path']);
} }
$path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']; $path = addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'];
if(is_file($path)) if(is_file($path))
{ {
@ -68,7 +73,7 @@
$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']); $fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
} }
} }
echo "{"; echo "{";
echo "error:'" . $error . "' "; echo "error:'" . $error . "' ";
foreach ($fileInfo as $k=>$v) foreach ($fileInfo as $k=>$v)
@ -76,6 +81,6 @@
echo "," . $k . ":'" . $v . "' "; echo "," . $k . ":'" . $v . "' ";
} }
echo "}"; echo "}";
?> ?>

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

@ -1,44 +1,47 @@
<?php <?php
/** /* For licensing terms, see /license.txt */
* Ajax image editor platform /**
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * Ajax image editor platform
* @link www.phpletter.com * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @since 22/May/2007 * @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) require_once '../../../../../../inc/global.inc.php';
{ require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
die(SYS_DISABLED);
} if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) {
//$session->gc(); //disabled for Chamilo die(SYS_DISABLED);
$_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']))
{ //$session->gc(); //disabled for Chamilo
$path = $_GET['path']; $_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['path'];
}else if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
{ {
die(TXT_FILE_NOT_FOUND); $path = $_GET['path'];
} }else
if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js")) {
{ die(TXT_FILE_NOT_FOUND);
$syntax = getFileExt($path); }
}else if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js"))
{ {
switch (getFileExt($path)) $syntax = getFileExt($path);
{ }else
case 'htm': {
$syntax = 'html'; switch (getFileExt($path))
break; {
default: case 'htm':
$syntax = 'basic'; $syntax = 'html';
} break;
} default:
if(array_search(getFileExt($path), getValidTextEditorExts())=== false) $syntax = 'basic';
{ }
die(TXT_DISALLOWED_EXT); }
} 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"> <!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"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
@ -54,36 +57,36 @@
--> -->
<script type="text/javascript" src="jscripts/edit_area/edit_area_full.js"></script> <script type="text/javascript" src="jscripts/edit_area/edit_area_full.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var warningExtNotSelected = '<?php echo TXT_EXT_NOT_SELECTED; ?>'; var warningExtNotSelected = '<?php echo TXT_EXT_NOT_SELECTED; ?>';
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>'; var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
var warningInvalidName = '<?php echo TXT_SAVE_AS_ERR_NAME_INVALID; ?>'; var warningInvalidName = '<?php echo TXT_SAVE_AS_ERR_NAME_INVALID; ?>';
var waringFolderNotSelected = '<?php echo TXT_DEST_FOLDER_NOT_SELECTED; ?>'; var waringFolderNotSelected = '<?php echo TXT_DEST_FOLDER_NOT_SELECTED; ?>';
var currentFolder = '<?php echo dirname($path); ?>'; var currentFolder = '<?php echo dirname($path); ?>';
var currentName = '<?php echo basename($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> </script>
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaxtexteditor.css" type="text/css" rel="stylesheet" /> <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"> <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')));?>"> <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="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" /> <input type="hidden" name="save_as_request" id="save_as_request" value="0" />
<div style="display:none"><textarea name="text" id="text"></textarea></div> <div style="display:none"><textarea name="text" id="text"></textarea></div>
</form> </form>
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a> <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> <p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p>
</div> </div>
@ -139,7 +142,7 @@
</th> </th>
<td> <td>
<select class="input" name="save_to" id="save_to"> <select class="input" name="save_to" id="save_to">
</select> </select>
</td> </td>
</tr> </tr>

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

@ -16,8 +16,9 @@
// Loading the global initialization file. // Loading the global initialization file.
require_once '../../../../../../inc/global.inc.php'; 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'; require_once api_get_path(LIBRARY_PATH).'fckeditor/repository.php';
//FILESYSTEM CONFIG //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_AJAX_EDIT_AREA', DIR_AJAX_JS.'edit_area'.DIRECTORY_SEPARATOR);
define('DIR_LANG', DIR_AJAX_ROOT.'langs'.DIRECTORY_SEPARATOR); define('DIR_LANG', DIR_AJAX_ROOT.'langs'.DIRECTORY_SEPARATOR);
//Class Declarations //Class Declarations
define('CLASS_FILE', DIR_AJAX_INC.'class.file.php'); define('CLASS_FILE', DIR_AJAX_INC.'class.file.php');
define("CLASS_UPLOAD", DIR_AJAX_INC.'class.upload.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; require_once dirname(__FILE__).DIRECTORY_SEPARATOR.$configBaseFileName;
// Loading the selected language file. // Loading the selected language file.
require_once DIR_AJAX_LANGS.CONFIG_LANG_DEFAULT.".php"; 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_LIST_LISTING', 'ajax_get_file_listing.php');
define('CONFIG_URL_IMG_THUMBNAIL', $web_path.'ajax_image_thumbnail.php'); define('CONFIG_URL_IMG_THUMBNAIL', $web_path.'ajax_image_thumbnail.php');
define('CONFIG_URL_FILEnIMAGE_MANAGER', 'ajaxfilemanager.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 * @return string
*/ */
public function CreateHtml() { public function CreateHtml()
{
// Adaptation for the Chamilo LMS // Adaptation for the Chamilo LMS
//@todo why the BasePath is relative ? we should use this constant WEB_PATH //@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(REL_PATH).'main/inc/lib/fckeditor/';
//$this->BasePath = api_get_path(WEB_PATH).'main/inc/lib/fckeditor/';
$config = $this->get_custom_configuration(); $config = $this->get_custom_configuration();
$this->read_configuration($config); $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. * This method returns default configuration for document repository that is to be used by the editor.
* @return array * @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. // Preliminary calculations for assembling required paths.
$base_path = $this->BasePath; $base_path = $this->BasePath;
@ -479,6 +485,7 @@ class FCKeditor
$script_path = api_get_path(WEB_PATH).$script_path; $script_path = api_get_path(WEB_PATH).$script_path;
$use_advanced_filemanager = api_get_setting('advanced_filemanager') == 'true'; $use_advanced_filemanager = api_get_setting('advanced_filemanager') == 'true';
// Let javascripts "know" which file manager has been chosen. // Let javascripts "know" which file manager has been chosen.
$config['AdvancedFileManager'] = $use_advanced_filemanager; $config['AdvancedFileManager'] = $use_advanced_filemanager;
@ -493,15 +500,11 @@ class FCKeditor
} else { } else {
// 1.2. Student // 1.2. Student
$current_session_id = api_get_session_id(); $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['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['CreateDocumentDir'] = $relative_path_prefix.'courses/'.api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
$config['BaseHref'] = $script_path; $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['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['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; $config['BaseHref'] = $script_path;

@ -9,20 +9,31 @@
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; 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_directories = api_get_permissions_for_new_directories();
$permissions_for_new_files = api_get_permissions_for_new_files(); $permissions_for_new_files = api_get_permissions_for_new_files();
$userId = api_get_user_id();
$sessionId = api_get_session_id();
if (!empty($_course['path'])) { if (!empty($_course['path'])) {
require_once api_get_path(LIBRARY_PATH).'document.lib.php'; 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).'groupmanager.lib.php';
// Get the Chamilo session properties. Before ajaximagemanager!!! // Get the Chamilo session properties. Before ajaximagemanager!!!
$to_group_id = !empty($_SESSION['_gid']) ? $_SESSION['_gid'] : 0 ; $groupId = api_get_group_id();
$group_properties = GroupManager::get_group_properties($_SESSION['_gid']); $group_properties = GroupManager::get_group_properties($groupId);
$is_user_in_group = GroupManager::is_user_in_group($_user['user_id'],$_SESSION['_gid']); $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/'; $user_folder = $my_path['dir'].'my_files/';
// Sanity checks for Chamilo. // Sanity checks for Chamilo.
@ -46,46 +57,42 @@ if (api_is_in_course()) {
$course_dir = $_course['path'].'/document'; $course_dir = $_course['path'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH); $sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$course_dir; $base_work_dir = $sys_course_path.$course_dir;
$current_session_id = api_get_session_id(); $userInfo = api_get_user_info();
$userinfo = Database::get_user_info_from_id(api_get_user_id());
if ($current_session_id==0){ if ($sessionId == 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. /* 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')) { if (!file_exists($base_work_dir.'/shared_folder')) {
$usf_dir_title = get_lang('SharedFolder'); $usf_dir_title = get_lang('SharedFolder');
$usf_dir_name = '/shared_folder'; $usf_dir_name = '/shared_folder';
$to_group_id = 0;
$visibility = 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 // Create dynamic user shared folder
if (!file_exists($base_work_dir.'/shared_folder/sf_user_'.api_get_user_id())) { if (!file_exists($base_work_dir.'/shared_folder/sf_user_'.$userId)) {
$usf_dir_title = api_get_person_name($_user['firstName'], $_user['lastName']); $usf_dir_title = $userInfo['complete_name'];
$usf_dir_name = '/shared_folder/sf_user_'.api_get_user_id(); $usf_dir_name = '/shared_folder/sf_user_'.$userId;
$to_group_id = 0;
$visibility = 1; $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 { } else {
//Create shared folder session // Create shared folder session
if (!file_exists($base_work_dir.'/shared_folder_session_'.$current_session_id)) { if (!file_exists($base_work_dir.'/shared_folder_session_'.$sessionId)) {
$usf_dir_title = get_lang('SharedFolder').' ('.api_get_session_name($current_session_id).')'; $usf_dir_title = get_lang('SharedFolder').' ('.$sessionName.')';
$usf_dir_name = '/shared_folder_session_'.$current_session_id; $usf_dir_name = '/shared_folder_session_'.$sessionId;
$to_group_id = 0;
$visibility = 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 into a shared folder session // 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())) { if (!file_exists($base_work_dir.'/shared_folder_session_'.$sessionId.'/sf_user_'.$userId)) {
$usf_dir_title = api_get_person_name($_user['firstName'], $_user['lastName']).'('.api_get_session_name($current_session_id).')'; $usf_dir_title = $userInfo['complete_name'].' ('.$sessionName.')';
$usf_dir_name = '/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id(); $usf_dir_name = '/shared_folder_session_'.$sessionId.'/sf_user_'.$userId;
$to_group_id = 0;
$visibility = 1; $visibility = 1;
create_unexisting_directory( create_unexisting_directory(
$_course, $_course,
$_user['user_id'], $userId,
api_get_session_id(), $sessionId,
$to_group_id, 0,
$to_user_id, $to_user_id,
$base_work_dir, $base_work_dir,
$usf_dir_name, $usf_dir_name,
@ -93,5 +100,5 @@ if (api_is_in_course()) {
$visibility $visibility
); );
} }
} }
} }
Loading…
Cancel
Save