Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent eda29af3c1
commit a4deb526ce
  1. 264
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_details_listing.php
  2. 212
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php
  3. 18
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_load_folders.php
  4. 140
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_create_folder.php
  5. 12
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_delete_file.php
  6. 56
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_download.php
  7. 197
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php
  8. 54
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_copy.php
  9. 57
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_cut.php
  10. 263
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_paste.php
  11. 171
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_file_upload.php
  12. 37
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php
  13. 14
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_folder_listing.php
  14. 435
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_editor.php
  15. 354
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php
  16. 33
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_thumbnail.php
  17. 156
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php
  18. 71
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_login.php
  19. 63
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_preview.php
  20. 65
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_as_form.php
  21. 140
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_name.php
  22. 129
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_save_text.php
  23. 237
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_text_editor.php
  24. 1385
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php
  25. 20
      main/inc/lib/fckeditor/myconfig.php
  26. 4
      main/inc/lib/groupmanager.lib.php

@ -6,139 +6,157 @@ require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanage
?>
<div id="content">
<table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th width="5"><a href="#" class="check_all" id="tickAll" title="<?php echo TIP_SELECT_ALL; ?>" onclick="checkAll(this);">&nbsp;</a></th>
<th width="10" class="fileColumns">&nbsp;</th>
<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> -->
</tr>
</thead>
<tbody id="fileList">
<?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')));
foreach($fileList as $file) {
$css = ($css == "" || $css == "even"?"odd":"even");
$strDisabled = ($file['is_writable']?"":" disabled");
$strClass = ($file['is_writable']?"left":" leftDisabled");
///First step for hidden some type of Chamilo files and folders
//Juan Carlos Raña
<table class="tableList" id="tableList" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th width="5"><a href="#" class="check_all" id="tickAll" title="<?php echo TIP_SELECT_ALL; ?>"
onclick="checkAll(this);">&nbsp;</a></th>
<th width="10" class="fileColumns">&nbsp;</th>
<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> -->
</tr>
</thead>
<tbody id="fileList">
<?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')));
foreach ($fileList as $file) {
$css = ($css == "" || $css == "even" ? "odd" : "even");
$strDisabled = ($file['is_writable'] ? "" : " disabled");
$strClass = ($file['is_writable'] ? "left" : " leftDisabled");
///First step for hidden some type of Chamilo files and folders
//Juan Carlos Raña
//hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat_files, certificates
$deleted_by_chamilo_file=' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
$deleted_by_chamilo_folder='_DELETED_';
$css_folder_chamilo='css';
$hotpotatoes_folder_chamilo='HotPotatoes_files';
$chat_files_chamilo='chat_files';
$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';
//hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat_files, certificates
$deleted_by_chamilo_file = ' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
$deleted_by_chamilo_folder = '_DELETED_';
$css_folder_chamilo = 'css';
$hotpotatoes_folder_chamilo = 'HotPotatoes_files';
$chat_files_chamilo = 'chat_files';
$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'])) {
$show_doc_group=false;
if($is_user_in_group ||( $to_group_id!=0 && api_is_allowed_to_edit())) {
$show_doc_group=true;
}
}
$show_doc_group = true;
if (ereg($group_folder, $file['path'])) {
$show_doc_group = false;
if ($is_user_in_group || ($to_group_id != 0 && api_is_allowed_to_edit())) {
$show_doc_group = true;
}
}
///Second step: hiding as the case
//Juan Carlos Raña
///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]!='.') {
//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 ((!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
} else {
$path_chamilo_file=$file['path'];
}
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
} else {
$path_chamilo_file = $file['path'];
}
?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>" >
<td align="center" id="tdz<?php echo $count; ?>">
<span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span>
<input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> />
</td>
<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 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>
</td>
?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>">
<td align="center" id="tdz<?php echo $count; ?>">
<span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span>
<input type="checkbox" name="check[]" id="cb<?php echo $count; ?>"
value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?> />
</td>
<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 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>
</td>
<td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize($file['size']); ?></td>
<!-- hide while implementing this Chamilo -->
<!--<td class="docInfo" id="tdth<?php //echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
</tr>
<?php
<td class="docInfo" id="tdrd<?php echo $count; ?>"><?php echo transformFileSize(
$file['size']
); ?></td>
<!-- hide while implementing this Chamilo -->
<!--<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; ?>" >
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span><input type="checkbox" name="check[]" id="cb<?php echo $count; ?>" value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?>/>
</td>
<?php
} else {
?>
<tr class="<?php echo $css; ?>" id="row<?php echo $count; ?>">
<td align="center" id="tdz<?php echo $count; ?>"><span id="flag<?php echo $count; ?>"
class="<?php echo $file['flag']; ?>">&nbsp;</span><input
type="checkbox" name="check[]" id="cb<?php echo $count; ?>"
value="<?php echo $file['path']; ?>" <?php echo $strDisabled; ?>/>
</td>
<?php
if (preg_match('/shared_folder/', basename($file['path']))) {
//add icon into ajaxfilemanager if sharedfolder is into Chamilo
?>
<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']:"folderShared"); ?>">&nbsp;</span></a>
</td>
<?php
} elseif(preg_match('/sf_user_/', basename($file['path']))) {
?>
<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>
<?php
} else {
?>
<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['file']||$file['subdir']?$file['cssClass']:"folderEmpty"); ?>">&nbsp;</span></a>
</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>
<td class="docInfo" id="tdrd<?php echo $count; ?>">&nbsp;</td>
<!-- hide while implementing this Chamilo -->
<!--<td class="docInfo" id="tdth<?php// echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
</tr>
<?php
}
if (preg_match('/shared_folder/', basename($file['path']))) {
//add icon into ajaxfilemanager if sharedfolder is into Chamilo
?>
<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'] : "folderShared"); ?>">&nbsp;</span></a>
</td>
<?php
} elseif (preg_match('/sf_user_/', basename($file['path']))) {
?>
<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>
<?php
} else {
?>
<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['file'] || $file['subdir'] ? $file['cssClass'] : "folderEmpty"); ?>">&nbsp;</span></a>
</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>
<td class="docInfo" id="tdrd<?php echo $count; ?>">&nbsp;</td>
<!-- hide while implementing this Chamilo -->
<!--<td class="docInfo" id="tdth<?php// echo $count; ?>"><?php //echo @date(DATE_TIME_FORMAT,$file['mtime']); ?></td> -->
</tr>
<?php
}
}//end if hidden files and folders deleted by Chamilo
}
//end if hidden files and folders deleted by Chamilo
$count++;
}
?>
</tbody>
</table>
$count++;
}
?>
</tbody>
</table>
</div>

@ -5,65 +5,72 @@ 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;
foreach ($fileList as $file) {
///First step for hidden some type of Chamilo files and folders
//Juan Carlos Raña Trabado
//hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat, certificates
$deleted_by_chamilo_file = ' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
$deleted_by_chamilo_folder = '_DELETED_';
$css_folder_chamilo = 'css';
$hotpotatoes_folder_chamilo = 'HotPotatoes_files';
$chat_files_chamilo = 'chat_files';
$certificates_chamilo = 'certificates';
//hidden directory of the group if the user is not a member of the group
$group_folder = '_groupdocs';
//show group's directory only if I'm member. Or I'm a teacher
$show_doc_group = true;
if (preg_match("/$group_folder/", $file['path'])) {
$show_doc_group = false;
if ($is_user_in_group || ( $to_group_id != 0 && api_is_allowed_to_edit())) {
$show_doc_group = true;
}
$count = 1;
$thumbnailBaseUrl = CONFIG_URL_IMG_THUMBNAIL;
foreach ($fileList as $file) {
///First step for hidden some type of Chamilo files and folders
//Juan Carlos Raña Trabado
//hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat, certificates
$deleted_by_chamilo_file = ' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
$deleted_by_chamilo_folder = '_DELETED_';
$css_folder_chamilo = 'css';
$hotpotatoes_folder_chamilo = 'HotPotatoes_files';
$chat_files_chamilo = 'chat_files';
$certificates_chamilo = 'certificates';
//hidden directory of the group if the user is not a member of the group
$group_folder = '_groupdocs';
//show group's directory only if I'm member. Or I'm a teacher
$show_doc_group = true;
if (preg_match("/$group_folder/", $file['path'])) {
$show_doc_group = false;
if ($is_user_in_group || ($to_group_id != 0 && api_is_allowed_to_edit())) {
$show_doc_group = true;
}
}
//show icon sharedfolder
$shared_folder = 'shared folder'; //'shared folder' not 'shared_folder' because in $file['name'] _ is replaced with blank see class.manager.php
///Second step: hiding as the case
//Juan Carlos Raña Trabado
if ((!preg_match("/$deleted_by_chamilo_file/", $file['name']) &&
//show icon sharedfolder
$shared_folder = 'shared folder'; //'shared folder' not 'shared_folder' because in $file['name'] _ is replaced with blank see class.manager.php
///Second step: hiding as the case
//Juan Carlos Raña Trabado
if ((!preg_match("/$deleted_by_chamilo_file/", $file['name']) &&
!preg_match("/$deleted_by_chamilo_folder/", $file['path'])) &&
!preg_match("/$css_folder_chamilo/", $file['path']) &&
!preg_match("/$hotpotatoes_folder_chamilo/", $file['path']) &&
!preg_match("/$chat_files_chamilo/", $file['path']) &&
!preg_match("/$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
}
?>
<dl class="thumbnailListing" id="dl<?php echo $count; ?>">
!preg_match("/$css_folder_chamilo/", $file['path']) &&
!preg_match("/$hotpotatoes_folder_chamilo/", $file['path']) &&
!preg_match("/$chat_files_chamilo/", $file['path']) &&
!preg_match("/$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
}
?>
<dl class="thumbnailListing" id="dl<?php echo $count; ?>">
<?php
if (preg_match('/shared_folder/', basename($file['path']))) {
//add icon into ajaxfilemanager if sharedfolder is in Chamilo
?>
<dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' || empty($file['file']) || empty($file['subdir']) ? 'folderShared' : $file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>">
<?php
//add icon into ajaxfilemanager if sharedfolder is in Chamilo
?>
<dt id="dt<?php echo $count; ?>"
class="<?php echo($file['type'] == 'folder' || empty($file['file']) || empty($file['subdir']) ? 'folderShared' : $file['cssClass']); ?>"
class="<?php echo $file['cssClass']; ?>">
<?php
} elseif (preg_match('/sf_user_/', basename($file['path']))) {
?>
<dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' || empty($file['file']) || empty($file['subdir']) ? 'unknownUser' : $file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>">
<?php
?>
<dt id="dt<?php echo $count; ?>"
class="<?php echo($file['type'] == 'folder' || empty($file['file']) || empty($file['subdir']) ? 'unknownUser' : $file['cssClass']); ?>"
class="<?php echo $file['cssClass']; ?>">
<?php
} else {
?>
<dt id="dt<?php echo $count; ?>" class="<?php echo ($file['type'] == 'folder' && empty($file['file']) && empty($file['subdir']) ? 'folderEmpty' : $file['cssClass']); ?>" class="<?php echo $file['cssClass']; ?>">
<?php
?>
<dt id="dt<?php echo $count; ?>"
class="<?php echo($file['type'] == 'folder' && empty($file['file']) && empty($file['subdir']) ? 'folderEmpty' : $file['cssClass']); ?>"
class="<?php echo $file['cssClass']; ?>">
<?php
}
switch ($file['cssClass']) {
case 'filePicture':
@ -71,10 +78,10 @@ echo '<div id="content">';
/* Chamilo create thumbnail */
//setting
$allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
$max_thumbnail_width = 100;
$max_thumbnail_height = 100;
$png_compression = 0; //0(none)-9
$jpg_quality = 75; //from 0 to 100 (default is 75). More quality less compression
$max_thumbnail_width = 100;
$max_thumbnail_height = 100;
$png_compression = 0; //0(none)-9
$jpg_quality = 75; //from 0 to 100 (default is 75). More quality less compression
$directory_thumbnails = dirname($file['path']).'/.thumbs/';
@ -84,18 +91,22 @@ echo '<div id="content">';
//create thumbnails
$image = $file['path'];
$image = $file['path'];
$image_thumbnail = $directory_thumbnails.'.'.basename($file['path']);
if (file_exists($image)) {
//check thumbnail
$imagetype = explode(".", $image);
$imagetype = strtolower($imagetype[count($imagetype) - 1]); //or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
$imagetype = strtolower(
$imagetype[count($imagetype) - 1]
); //or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
if (in_array($imagetype, $allowed_thumbnail_types)) {
if (!file_exists($image_thumbnail)) {
$original_image_size = api_getimagesize($image); //run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail
$original_image_size = api_getimagesize(
$image
); //run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail
switch ($imagetype) {
case 'gif':
@ -112,14 +123,22 @@ echo '<div id="content">';
break;
}
$new_thumbnail_size = api_calculate_image_size($original_image_size['width'], $original_image_size['height'], $max_thumbnail_width, $max_thumbnail_height);
$new_thumbnail_size = api_calculate_image_size(
$original_image_size['width'],
$original_image_size['height'],
$max_thumbnail_width,
$max_thumbnail_height
);
if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) {
$new_thumbnail_size['width'] = $original_image_size['width'];
$new_thumbnail_size['width'] = $original_image_size['width'];
$new_thumbnail_size['height'] = $original_image_size['height'];
}
$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
$crop = imagecreatetruecolor(
$new_thumbnail_size['width'],
$new_thumbnail_size['height']
);
// preserve transparency
if ($imagetype == "png") {
@ -134,15 +153,32 @@ echo '<div id="content">';
//GIF89a for transparent and anim (first clip), either GIF87a
if ($transindex >= 0 && $transindex < $palletsize) {
$transcol = imagecolorsforindex($source_img, $transindex);
$transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
$transcol = imagecolorsforindex($source_img, $transindex);
$transindex = imagecolorallocatealpha(
$crop,
$transcol['red'],
$transcol['green'],
$transcol['blue'],
127
);
imagefill($crop, 0, 0, $transindex);
imagecolortransparent($crop, $transindex);
}
}
//resampled image
imagecopyresampled($crop, $source_img, 0, 0, 0, 0, $new_thumbnail_size['width'], $new_thumbnail_size['height'], $original_image_size['width'], $original_image_size['height']);
imagecopyresampled(
$crop,
$source_img,
0,
0,
0,
0,
$new_thumbnail_size['width'],
$new_thumbnail_size['height'],
$original_image_size['width'],
$original_image_size['height']
);
switch ($imagetype) {
case 'gif':
@ -161,14 +197,23 @@ echo '<div id="content">';
//clean memory
imagedestroy($crop);
}//end !exist thumbnail
}
//end !exist thumbnail
//show thumbnail
echo '<img src="'.appendQueryString($thumbnailBaseUrl, ' path='.base64_encode($image_thumbnail)).'" id="thumbImg'.$count.'"></a>'."\n";
echo '<img src="'.appendQueryString(
$thumbnailBaseUrl,
' path='.base64_encode($image_thumbnail)
).'" id="thumbImg'.$count.'"></a>'."\n";
} else {
echo '<img src="'.appendQueryString($thumbnailBaseUrl, ' path='.base64_encode($file['path'])).'" id="thumbImg'.$count.'"></a>'."\n";
}//end allowed image types
}//end if exist file image
echo '<img src="'.appendQueryString(
$thumbnailBaseUrl,
' path='.base64_encode($file['path'])
).'" id="thumbImg'.$count.'"></a>'."\n";
}
//end allowed image types
}
//end if exist file image
///////////////////////////////////////// End Chamilo create thumbnail
break;
@ -186,17 +231,22 @@ echo '<div id="content">';
$path_chamilo_file = $file['path'];
}
?>
</dt>
<dd id="dd<?php echo $count; ?>" class="thumbnailListing_info">
<span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span>
<input id="cb<?php echo $count; ?>" type="checkbox" name="check[]" <?php echo ($file['is_writable'] ? '' : 'disabled'); ?> class="radio" value="<?php echo $file['path']; ?>" />
<a <?php echo ($file['cssClass'] == 'filePicture' ? 'rel="orgImg"' : ''); ?> href="<?php echo $path_chamilo_file; // fix for Chamilo ?>" title="<?php echo $file['name']; ?>" id="a<?php echo $count; ?>">
<?php echo shortenFileName($file['name']); ?>
</a>
</dd>
</dl>
<?php
}//end if hidden files and folders deleted by Chamilo
</dt>
<dd id="dd<?php echo $count; ?>" class="thumbnailListing_info">
<span id="flag<?php echo $count; ?>" class="<?php echo $file['flag']; ?>">&nbsp;</span>
<input id="cb<?php echo $count; ?>" type="checkbox"
name="check[]" <?php echo($file['is_writable'] ? '' : 'disabled'); ?> class="radio"
value="<?php echo $file['path']; ?>"/>
<a <?php echo($file['cssClass'] == 'filePicture' ? 'rel="orgImg"' : ''); ?>
href="<?php echo $path_chamilo_file; // fix for Chamilo ?>" title="<?php echo $file['name']; ?>"
id="a<?php echo $count; ?>">
<?php echo shortenFileName($file['name']); ?>
</a>
</dd>
</dl>
<?php
}
//end if hidden files and folders deleted by Chamilo
$count++;
}
?>

@ -4,17 +4,13 @@
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
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
{
?>
<option value="<?php echo $v; ?>" ><?php echo shortenFileName($k, 30); ?></option>
<?php
}
?>
<?php
foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k => $v) {
?>
<option value="<?php echo $v; ?>"><?php echo shortenFileName($k, 30); ?></option>
<?php
}
?>
</select>

@ -1,27 +1,20 @@
<?php
/* For licensing terms, see /license.txt */
/**
* create a 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
* @since 18/January/2009
*/
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';
//@ob_start(); //Disabled for integration with Chamilo
//displayArray($_POST); //Disabled for integration with Chamilo
//writeInfo(@ob_get_clean()); //Disabled for integration with Chamilo
echo "{";
$error = "";
$info = "";
$info = "";
/* $_POST['new_folder'] = substr(md5(time()), 1, 5);
$_POST['currentFolderPath'] = "../../uploaded/"; */
$_POST['new_folder'] = htmlentities($_POST['new_folder'], ENT_QUOTES); //Chamilo improve security
$_POST['new_folder'] = str_replace(' ', '_', $_POST['new_folder']); //Interaction with Chamilo. Because fix long names. See: ajaxfilemanager/inc/class.manager.php
$_POST['new_folder'] = htmlentities($_POST['new_folder'], ENT_QUOTES); //Chamilo improve security
$_POST['new_folder'] = str_replace(
' ',
'_',
$_POST['new_folder']
); //Interaction with Chamilo. Because fix long names. See: ajaxfilemanager/inc/class.manager.php
$_POST['currentFolderPath'] = htmlentities($_POST['currentFolderPath'], ENT_QUOTES); //Chamilo improve security
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER) {
@ -30,55 +23,82 @@ if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER) {
$error = ERR_FOLDER_NAME_EMPTY;
} elseif (!preg_match("/^[a-zA-Z0-9_\- ]+$/", $_POST['new_folder'])) {
$error = ERR_FOLDER_FORMAT;
} else if (empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} elseif (file_exists(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'])) {
$error = ERR_FOLDER_EXISTS;
} else {
include_once CLASS_FILE;
$file = new file();
if ($file->mkdir(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], 0775)) {
include_once CLASS_MANAGER;
$manager = new manager(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'], false);
$pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder']);
if (empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} elseif (file_exists(addTrailingSlash($_POST['currentFolderPath']).$_POST['new_folder'])) {
$error = ERR_FOLDER_EXISTS;
} else {
include_once CLASS_FILE;
$file = new file();
if ($file->mkdir(addTrailingSlash($_POST['currentFolderPath']).$_POST['new_folder'], 0775)) {
include_once CLASS_MANAGER;
$manager = new manager(addTrailingSlash($_POST['currentFolderPath']).$_POST['new_folder'], false);
$pathInfo = $manager->getFolderInfo(addTrailingSlash($_POST['currentFolderPath']).$_POST['new_folder']);
//bridge to Chamilo
if (!empty($_course['path'])) {
//only inside courses
$mainPath = '../../../../../../../courses/' . $_course['path'] . '/document/'; //get Chamilo
$fullPath = $_POST['currentFolderPath'] . $_POST['new_folder']; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1);
$_POST['new_folder'] = str_replace('_', ' ', $_POST['new_folder']); //Restore for interaction with Chamilo. Because fix long names. See: ajaxfilemanager/inc/class.manager.php
$chamiloFile = $_POST['new_folder']; //get Ajaxfilemanager
//bridge to Chamilo
if (!empty($_course['path'])) {
//only inside courses
$mainPath = '../../../../../../../courses/'.$_course['path'].'/document/'; //get Chamilo
$fullPath = $_POST['currentFolderPath'].$_POST['new_folder']; //get Ajaxfilemanager
$chamiloPath = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1);
$_POST['new_folder'] = str_replace(
'_',
' ',
$_POST['new_folder']
); //Restore for interaction with Chamilo. Because fix long names. See: ajaxfilemanager/inc/class.manager.php
$chamiloFile = $_POST['new_folder']; //get Ajaxfilemanager
$doc_id = add_document($_course, $chamiloPath, 'folder', 0, $chamiloFile); //get Chamilo
$current_session_id = api_get_session_id(); //get Chamilo
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id(), $to_group_id, null, null, null, $current_session_id); //get Chamilo
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(), $to_group_id, null, null, null, $current_session_id); //get Chamilo
}
// end bridge to Chamilo
$doc_id = add_document($_course, $chamiloPath, 'folder', 0, $chamiloFile); //get Chamilo
$current_session_id = api_get_session_id(); //get Chamilo
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'FolderCreated',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
); //get Chamilo
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'invisible',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
); //get Chamilo
}
// end bridge to Chamilo
foreach ($pathInfo as $k => $v) {
switch ($k) {
case "ctime";
case "mtime":
case "atime":
$v = date(DATE_TIME_FORMAT, $v);
break;
case 'name':
$info .= sprintf(", %s:'%s'", 'short_name', shortenFileName($v));
break;
case 'cssClass':
$v = 'folderEmpty';
break;
foreach ($pathInfo as $k => $v) {
switch ($k) {
case "ctime";
case "mtime":
case "atime":
$v = date(DATE_TIME_FORMAT, $v);
break;
case 'name':
$info .= sprintf(", %s:'%s'", 'short_name', shortenFileName($v));
break;
case 'cssClass':
$v = 'folderEmpty';
break;
}
$info .= sprintf(", %s:'%s'", $k, $v);
}
$info .= sprintf(", %s:'%s'", $k, $v);
} else {
$error = ERR_FOLDER_CREATION_FAILED;
}
} else {
$error = ERR_FOLDER_CREATION_FAILED;
}
//$error = "For security reason, folder creation function has been disabled.";
}
echo "error:'" . $error . "'";
echo "error:'".$error."'";
echo $info;
echo "}";
echo "}";

@ -53,7 +53,11 @@ if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE) {
}
} else {
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete']))); //deleted by ajaxfilemanager
event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', addTrailingSlash(backslashToSlash($_GET['delete'])));
event_system(
LOG_USER_PERSONAL_DOC_DELETED,
'document_path',
addTrailingSlash(backslashToSlash($_GET['delete']))
);
}
//////end bridge to Chamilo
$file->delete(addTrailingSlash(backslashToSlash($_GET['delete'])));
@ -144,7 +148,11 @@ if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_DELETE) {
}
} else {
$file->delete(addTrailingSlash(backslashToSlash($doc))); //deleted by ajaxfilemanager
event_system(LOG_USER_PERSONAL_DOC_DELETED, 'document_path', addTrailingSlash(backslashToSlash($doc)));
event_system(
LOG_USER_PERSONAL_DOC_DELETED,
'document_path',
addTrailingSlash(backslashToSlash($doc))
);
}
//////end bridge to Chamilo
} elseif (is_file($doc)

@ -1,38 +1,30 @@
<?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
* @since 22/April/2007
*
*/
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']))
{
* delete selected files
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/April/2007
*
*/
$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);
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
}
}else
{
die(ERR_DOWNLOAD_FILE_NOT_FOUND);
}
?>
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);
}
} else {
die(ERR_DOWNLOAD_FILE_NOT_FOUND);
}

@ -4,119 +4,100 @@
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
if (!isset($_POST['path'])) {
$_POST['path'] = "uploaded/Winter.jpg"."?".makeQueryString(array('path'));
//for crop
$_POST['mode'] = "crop";
$_POST['x'] = 100;
$_POST['y'] = 100;
$imageInfo = @GetImageSize($_POST['path']);
$_POST['width'] = $imageInfo[0];
$_POST['height'] = $imageInfo[1];
/**
* 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");
if(!isset($_POST['path']))
{
$_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path'));
//for crop
$_POST['mode'] = "crop";
$_POST['x'] = 100;
$_POST['y'] = 100;
$imageInfo = @GetImageSize($_POST['path']);
$_POST['width'] = $imageInfo[0];
$_POST['height'] = $imageInfo[1];
}
initSessionHistory($_POST['path']);
}
initSessionHistory($_POST['path']);
echo "{";
$error = "";
$info = "";
echo "{";
$error = "";
$info = "";
if (empty($_POST['path'])) {
$error = IMG_SAVE_EMPTY_PATH;
} elseif (!file_exists($_POST['path'])) {
$error = IMG_SAVE_NOT_EXISTS;
} else {
if (!isUnderRoot($_POST['path'])) {
$error = IMG_SAVE_PATH_DISALLOWED;
} else {
if (!empty($_POST['mode'])) {
if(empty($_POST['path']))
{
$error = IMG_SAVE_EMPTY_PATH;
}elseif(!file_exists($_POST['path']))
{
$error = IMG_SAVE_NOT_EXISTS;
}else if(!isUnderRoot($_POST['path']))
{
$error = IMG_SAVE_PATH_DISALLOWED;
}
else
{
if(!empty($_POST['mode']))
{
include_once(CLASS_IMAGE);
$image = new ImageAjaxFileManager();
$image->loadImage($_POST['path']);
include_once(CLASS_IMAGE);
$image = new ImageAjaxFileManager();
$image->loadImage($_POST['path']);
switch ($_POST['mode']) {
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;
}
switch($_POST['mode'])
{
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'])) {
$error = IMG_SAVE_FLIP_FAILED;
}
break;
case "rotate":
if (!$image->rotate(intval($_POST['angle']))) {
$error = IMG_SAVE_ROTATE_FAILED;
}
break;
default:
$error = IMG_SAVE_UNKNOWN_MODE;
}
if (empty($error)) {
break;
case "flip":
if(!$image->flip($_POST['flip_angle']))
{
$error = IMG_SAVE_FLIP_FAILED;
}
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 = $session->getSessionDir().uniqid(md5(time())).".".getFileExt($_POST['path']);
if (!@copy($_POST['path'], $sessionNewPath)) {
$error = IMG_SAVE_BACKUP_FAILED;
} else {
addSessionHistory($_POST['path'], $sessionNewPath);
if ($image->saveImage($_POST['path'])) {
$imageInfo = $image->getFinalImageInfo();
$info .= ",width:".$imageInfo['width']."\n";
$info .= ",height:".$imageInfo['height']."\n";
$info .= ",size:'".transformFileSize($imageInfo['size'])."'\n";
} else {
$error = IMG_SAVE_FAILED;
}
}
}
} else {
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
}
$sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
if(!@copy($_POST['path'], $sessionNewPath))
{
$error = IMG_SAVE_BACKUP_FAILED;
}else
{
addSessionHistory($_POST['path'], $sessionNewPath);
if($image->saveImage($_POST['path']))
{
$imageInfo = $image->getFinalImageInfo();
$info .= ",width:" . $imageInfo['width'] . "\n";
$info .= ",height:" . $imageInfo['height'] . "\n";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
}else
{
$error = IMG_SAVE_FAILED;
}
}
}else
{
//$image->DestroyImages();
}
}else
{
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
echo "error:'" . $error . "'\n";
if(isset($image) && is_object($image))
{
$image->DestroyImages();
}
echo $info;
echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n";
echo "}";
?>
echo "error:'".$error."'\n";
if (isset($image) && is_object($image)) {
$image->DestroyImages();
}
echo $info;
echo ",history:".sizeof($_SESSION[$_POST['path']])."\n";
echo "}";

@ -5,35 +5,27 @@ 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
* @since 22/May/2007
*
*/
* copy file
* @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");
$error = "";
$info = '';
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_COPY)
{
$error = SYS_DISABLED;
}
elseif(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
{
$error = ERR_NOT_DOC_SELECTED_FOR_COPY;
}
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else
{
require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']);
$sessionAction->setFolder($_POST['currentFolderPath']);
$sessionAction->set($_POST['selectedDoc']);
$info = ',num:' . sizeof($_POST['selectedDoc']);
}
echo "{error:'" . $error . "'\n" . $info . "}";
?>
$error = "";
$info = '';
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_COPY) {
$error = SYS_DISABLED;
} elseif (!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1) {
$error = ERR_NOT_DOC_SELECTED_FOR_COPY;
} elseif (empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} else {
require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']);
$sessionAction->setFolder($_POST['currentFolderPath']);
$sessionAction->set($_POST['selectedDoc']);
$info = ',num:'.sizeof($_POST['selectedDoc']);
}
echo "{error:'".$error."'\n".$info."}";

@ -1,39 +1,30 @@
<?php
/* For licensing terms, see /license.txt */
/**
* cut file
* @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';
/**
* cut file
* @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");
$error = "";
$info = '';
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_CUT)
{
$error = SYS_DISABLED;
}
elseif(!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1)
{
$error = ERR_NOT_DOC_SELECTED_FOR_CUT;
}
elseif(empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
}else
{
require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']);
$sessionAction->setFolder($_POST['currentFolderPath']);
$sessionAction->set($_POST['selectedDoc']);
$info = ',num:' . sizeof($_POST['selectedDoc']);
}
echo "{error:'" . $error . "'\n" . $info . "}";
?>
$error = "";
$info = '';
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_CUT) {
$error = SYS_DISABLED;
} elseif (!isset($_POST['selectedDoc']) || !is_array($_POST['selectedDoc']) || sizeof($_POST['selectedDoc']) < 1) {
$error = ERR_NOT_DOC_SELECTED_FOR_CUT;
} elseif (empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} else {
require_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$sessionAction->setAction($_POST['action_value']);
$sessionAction->setFolder($_POST['currentFolderPath']);
$sessionAction->set($_POST['selectedDoc']);
$info = ',num:'.sizeof($_POST['selectedDoc']);
}
echo "{error:'".$error."'\n".$info."}";

@ -4,8 +4,8 @@
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
$error = '';
$fileMoved = array();
$error = '';
$fileMoved = array();
$unmovedDocDueToSamePath = array();
if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
$error = SYS_DISABLED;
@ -51,9 +51,9 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
if ($file->copyTo($doc, $_GET['current_folder_path'])) {
$finalPath = $destFolderPath.basename($doc);
$objFile = new file($finalPath);
$tem = $objFile->getFileInfo();
$obj = new manager($finalPath, false);
$objFile = new file($finalPath);
$tem = $objFile->getFileInfo();
$obj = new manager($finalPath, false);
$fileType = $obj->getFileType($finalPath, (is_dir($finalPath) ? true : false));
@ -71,13 +71,13 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
} */
$tem['final_path'] = $finalPath;
$tem['path'] = backslashToSlash($finalPath);
$tem['type'] = (is_dir($finalPath) ? 'folder' : 'file');
$tem['size'] = @transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['flag'] = 'noFlag';
$tem['url'] = getFileUrl($doc);
$tem['path'] = backslashToSlash($finalPath);
$tem['type'] = (is_dir($finalPath) ? 'folder' : 'file');
$tem['size'] = @transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['flag'] = 'noFlag';
$tem['url'] = getFileUrl($doc);
/**
* Bridge to Chamilo documents tool
@ -85,10 +85,15 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
*/
if (!empty($_course['path'])) {
$mainPath = getParentFolderPath($folderInfo['path']); // from ajaxfilemanager sample ../../../../../../../courses/TEST/document/
$fullPath = $tem['final_path']; // from ajaxfilemanager sample ../../../../../../../courses/TEST/document/icons/book_highlight.jpg
$chamiloFolder = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1); // sample /icons/book_highlight.jpg or /icons
$chamiloFile = $tem['name']; //get ajaxmanager
$mainPath = getParentFolderPath(
$folderInfo['path']
); // from ajaxfilemanager sample ../../../../../../../courses/TEST/document/
$fullPath = $tem['final_path']; // from ajaxfilemanager sample ../../../../../../../courses/TEST/document/icons/book_highlight.jpg
$chamiloFolder = substr(
$fullPath,
strlen($mainPath) - strlen($fullPath) - 1
); // sample /icons/book_highlight.jpg or /icons
$chamiloFile = $tem['name']; //get ajaxmanager
$chamiloFileSize = filesize($fullPath); //get ajaxmanager
if (!empty($group_properties['directory'])) {
$chamiloFolder = $group_properties['directory'].$chamiloFolder; //get Chamilo
@ -98,25 +103,43 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
$full_old_path = $doc; // get from ajaxfilemanager sample ../../../../../../../courses/TEST/document/book_highlight.jpg or if you select a folder: ../../../../../../../courses/TEST/document/trainer/
if (is_dir($full_old_path)) {
//update first folder
$old_path = substr($full_old_path, strlen($mainPath) - strlen($full_old_path) - 1, -1);
$old_path = substr(
$full_old_path,
strlen($mainPath) - strlen($full_old_path) - 1,
-1
);
if (!empty($group_properties['directory'])) {
$old_path = $group_properties['directory'].$old_path; //get Chamilo
}
$new_path = $chamiloFolder; //sample /images
$dbTable = Database::get_course_table(TABLE_DOCUMENT); //Chamilo
$dbTable = Database::get_course_table(TABLE_DOCUMENT); //Chamilo
update_db_info('update', $old_path, $new_path); //Chamilo
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id($_course, $curdirpath); //Chamilo
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id(
$_course,
$curdirpath
); //Chamilo
$current_session_id = api_get_session_id();
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderMoved', api_get_user_id(), $to_group_id, null, null, null, $current_session_id);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'FolderMoved',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
);
// update database: inside subdirectories and files
$course_dir = $_course['path']."/document"; //get Chamilo
$course_dir = $_course['path']."/document"; //get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH); //get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo/courses/TEST/document
$source_dir = $base_work_dir.$chamiloFolder;
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo/courses/TEST/document
$source_dir = $base_work_dir.$chamiloFolder;
//thanks to donovan
$path = '';
$path = '';
$stack[] = $source_dir;
while ($stack) {
$thisdir = array_pop($stack);
@ -128,7 +151,7 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
if (is_file($current_file)) {
$path[] = "{$thisdir}/{$dircont[$i]}";
} elseif (is_dir($current_file)) {
$path[] = "{$thisdir}/{$dircont[$i]}";
$path[] = "{$thisdir}/{$dircont[$i]}";
$stack[] = $current_file;
}
}
@ -143,36 +166,74 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
//Sample $item is C:/xampp/htdocs/chamilo/courses/TEST/document/books/book_highlight.jpg
$file_orig = basename($item);
if ($file_orig[0] != '.' && !in_array($invisibleFileNames)) {
$source_item = substr($item, (strlen($base_work_dir) - strlen($item))); // sample /books/book_highlight.jpg or /books
$target_item = $source_item;
$source_item = substr(
$item,
(strlen($base_work_dir) - strlen($item))
); // sample /books/book_highlight.jpg or /books
$target_item = $source_item;
$chamiloFolder = $target_item;
$chamiloFile = basename($target_item);
$chamiloFile = basename($target_item);
//
if (is_dir($item)) {
$old_path = substr($full_old_path, strlen($mainPath) - strlen($full_old_path) - 1, -1);
$old_path = substr(
$full_old_path,
strlen($mainPath) - strlen($full_old_path) - 1,
-1
);
if (!empty($group_properties['directory'])) {
$old_path = $group_properties['directory'].$old_path; //get Chamilo
}
$new_path = $chamiloFolder; //sample /images
$dbTable = Database::get_course_table(TABLE_DOCUMENT); //Chamilo
$dbTable = Database::get_course_table(TABLE_DOCUMENT); //Chamilo
update_db_info('update', $old_path, $new_path); //Chamilo
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id($_course, $curdirpath); //Chamilo
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id(
$_course,
$curdirpath
); //Chamilo
$current_session_id = api_get_session_id();
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderMoved', api_get_user_id(), $to_group_id, null, null, null, $current_session_id);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'FolderMoved',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
);
} elseif (is_file($item)) {
$old_path = substr($full_old_path, strlen($mainPath) - strlen($full_old_path) - 1);
$old_path = substr(
$full_old_path,
strlen($mainPath) - strlen($full_old_path) - 1
);
if (!empty($group_properties['directory'])) {
$old_path = $group_properties['directory'].$old_path; //get Chamilo
}
$new_path = $chamiloFolder; //sample /images/book_highlight.jpg
$dbTable = Database::get_course_table(TABLE_DOCUMENT); //Chamilo
$dbTable = Database::get_course_table(TABLE_DOCUMENT); //Chamilo
update_db_info('update', $old_path, $new_path); //Chamilo
//update items
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id($_course, $curdirpath); //Chamilo
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id(
$_course,
$curdirpath
); //Chamilo
$current_session_id = api_get_session_id();
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentMoved', api_get_user_id(), $to_group_id, null, null, null, $current_session_id);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'DocumentMoved',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
);
}
}
}
@ -186,26 +247,54 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
$dbTable = Database::get_course_table(TABLE_DOCUMENT); //Chamilo
update_db_info('update', $old_path, $new_path); //Chamilo
//update items
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id($_course, $curdirpath);
$curdirpath = $new_path;
$doc_id = DocumentManager::get_document_id($_course, $curdirpath);
$current_session_id = api_get_session_id();
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentMoved', api_get_user_id(), $to_group_id, null, null, null, $current_session_id);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'DocumentMoved',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
);
}
} else {
$current_session_id = api_get_session_id();
if ($tem['type'] == "folder") {
//add to database the first folder to target
$doc_id = add_document($_course, $chamiloFolder, 'folder', $chamiloFileSize, $chamiloFile); //get Chamilo
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id(), $to_group_id, null, null, null, $current_session_id); //get Chamilo
$doc_id = add_document(
$_course,
$chamiloFolder,
'folder',
$chamiloFileSize,
$chamiloFile
); //get Chamilo
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'FolderCreated',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
); //get Chamilo
// add to database inside subdirectories and files
$course_dir = $_course['path']."/document"; //get Chamilo
$course_dir = $_course['path']."/document"; //get Chamilo
$sys_course_path = api_get_path(SYS_COURSE_PATH); //get Chamilo
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo/courses/TEST/document
$source_dir = $base_work_dir.$chamiloFolder;
$base_work_dir = $sys_course_path.$course_dir; // sample c:/xampp/htdocs/chamilo/courses/TEST/document
$source_dir = $base_work_dir.$chamiloFolder;
//thanks to donovan
$path = '';
$path = '';
$stack[] = $source_dir;
while ($stack) {
$thisdir = array_pop($stack);
@ -217,7 +306,7 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
if (is_file($current_file)) {
$path[] = "{$thisdir}/{$dircont[$i]}";
} elseif (is_dir($current_file)) {
$path[] = "{$thisdir}/{$dircont[$i]}";
$path[] = "{$thisdir}/{$dircont[$i]}";
$stack[] = $current_file;
}
}
@ -232,24 +321,78 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
//Sample $item is C:/xampp/htdocs/chamilo/courses/TEST/document/books/book_highlight.jpg
$file_orig = basename($item);
if ($file_orig[0] != '.' && !in_array($invisibleFileNames)) {
$source_item = substr($item, (strlen($base_work_dir) - strlen($item))); // sample /books/book_highlight.jpg or /books
$target_item = $source_item;
$source_item = substr(
$item,
(strlen($base_work_dir) - strlen($item))
); // sample /books/book_highlight.jpg or /books
$target_item = $source_item;
$chamiloFolder = $target_item;
$chamiloFile = basename($target_item);
$chamiloFile = basename($target_item);
//
if (is_dir($item)) {
$doc_id = add_document($_course, $chamiloFolder, 'folder', $chamiloFileSize, $chamiloFile); //get Chamilo
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', api_get_user_id(), $to_group_id, null, null, null, $current_session_id); //get Chamilo
$doc_id = add_document(
$_course,
$chamiloFolder,
'folder',
$chamiloFileSize,
$chamiloFile
); //get Chamilo
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'FolderCreated',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
); //get Chamilo
} elseif (is_file($item)) {
$chamiloFileSize = filesize($item);
$doc_id = add_document($_course, $chamiloFolder, 'file', $chamiloFileSize, $chamiloFile); //get Chamilo
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(), $to_group_id, null, null, null, $current_session_id); //get Chamilo
$doc_id = add_document(
$_course,
$chamiloFolder,
'file',
$chamiloFileSize,
$chamiloFile
); //get Chamilo
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'DocumentAdded',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
); //get Chamilo
}
}
}
} elseif ($tem['type'] == "file") {
$doc_id = add_document($_course, $chamiloFolder, 'file', $chamiloFileSize, $chamiloFile); //get Chamilo
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(), $to_group_id, null, null, null, $current_session_id); //get Chamilo
$doc_id = add_document(
$_course,
$chamiloFolder,
'file',
$chamiloFileSize,
$chamiloFile
); //get Chamilo
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'DocumentAdded',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
); //get Chamilo
}
}
}
@ -261,9 +404,8 @@ if (CONFIG_SYS_VIEW_ONLY || (!CONFIG_OPTIONS_CUT && !CONFIG_OPTIONS_COPY)) {
}
$fileMoved[sizeof($fileMoved)] = $tem;
$tem = null;
$tem = null;
}
} else {
$unmovedDocDueToSamePath[] = $doc;
@ -293,4 +435,3 @@ foreach ($fileMoved as $i => $file) {
echo "} ";
}
echo "} }";
?>

@ -4,95 +4,122 @@
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
// @todo sleep??
sleep(3);
echo "{";
$error = "";
$info = "";
$info = "";
include_once CLASS_UPLOAD ;
include_once CLASS_UPLOAD;
$upload = new Upload();
$folder = base64_decode($_GET['folder']);
//$folder = ($_GET['folder']);
$upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS));
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) {
$error = SYS_DISABLED;
} elseif(empty($folder) || !isUnderRoot($folder)) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} else if(!$upload->isFileUploaded('file')) {
$error = ERR_FILE_NOT_UPLOADED;
}else if(!$upload->moveUploadedFile($folder)) {
$error = ERR_FILE_MOVE_FAILED;
} elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) {
$error = ERR_FILE_TYPE_NOT_ALLOWED;
} elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) {
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) {
$error = SYS_DISABLED;
} elseif (empty($folder) || !isUnderRoot($folder)) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} else if (!$upload->isFileUploaded('file')) {
$error = ERR_FILE_NOT_UPLOADED;
} else {
include_once(CLASS_FILE);
$path = $upload->getFilePath();
$obj = new file($path);
$tem = $obj->getFileInfo();
if (!$upload->moveUploadedFile($folder)) {
$error = ERR_FILE_MOVE_FAILED;
} elseif (!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) {
$error = ERR_FILE_TYPE_NOT_ALLOWED;
} elseif (defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(
CONFIG_UPLOAD_MAXSIZE
)
) {
$error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE));
} else {
include_once(CLASS_FILE);
$path = $upload->getFilePath();
$obj = new file($path);
$tem = $obj->getFileInfo();
if (sizeof($tem)) {
include_once(CLASS_MANAGER);
$manager = new manager($upload->getFilePath(), false);
$fileType = $manager->getFileType($upload->getFileName());
foreach($fileType as $k=>$v) {
$tem[$k] = $v;
}
if (sizeof($tem)) {
include_once(CLASS_MANAGER);
$manager = new manager($upload->getFilePath(), false);
$fileType = $manager->getFileType($upload->getFileName());
foreach ($fileType as $k => $v) {
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($path);
$tem['type'] = "file";
$tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['short_name'] = shortenFileName($tem['name']);
$tem['flag'] = 'noFlag';
$tem['path'] = backslashToSlash($path);
$tem['type'] = "file";
$tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);
$tem['short_name'] = shortenFileName($tem['name']);
$tem['flag'] = 'noFlag';
/**
* Bridge to Chamilo documents tool
* @author Juan Carlos Raña Trabado
*/
/**
* Bridge to Chamilo documents tool
* @author Juan Carlos Raña Trabado
*/
if(!empty($_course['path'])) {
//only inside courses
$fullPath= $upload->getFilePath(); //get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/image.jpg
$folderInfo = $manager->getFolderInfo(); //get ajaxmanager
$mainPath= getParentFolderPath($folderInfo['path']);//get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/
$chamiloFolder = substr($fullPath, strlen($mainPath)-strlen($fullPath)-1);
$chamiloFile = $tem['name']; //get ajaxmanager
$chamiloFileSize = filesize($fullPath); //get ajaxmanager
//get Chamilo
if(!empty($group_properties['directory'])) {
$chamiloFolder=$group_properties['directory'].$chamiloFolder;//get Chamilo
} else {
if(!api_is_allowed_to_edit()) {
$current_session_id = api_get_session_id();
if($current_session_id==0) {
$chamiloFolder='/shared_folder/sf_user_'.api_get_user_id().$chamiloFolder;
} else {
$chamiloFolder='/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().$chamiloFolder;
}
}
}
if (!empty($_course['path'])) {
//only inside courses
$fullPath = $upload->getFilePath(
); //get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/image.jpg
$folderInfo = $manager->getFolderInfo(); //get ajaxmanager
$mainPath = getParentFolderPath(
$folderInfo['path']
); //get ajaxmanager. Sample ../../../../../../../courses/TEST/document/Grupo_1_groupdocs/
$chamiloFolder = substr($fullPath, strlen($mainPath) - strlen($fullPath) - 1);
$chamiloFile = $tem['name']; //get ajaxmanager
$chamiloFileSize = filesize($fullPath); //get ajaxmanager
//get Chamilo
if (!empty($group_properties['directory'])) {
$chamiloFolder = $group_properties['directory'].$chamiloFolder; //get Chamilo
} else {
if (!api_is_allowed_to_edit()) {
$current_session_id = api_get_session_id();
if ($current_session_id == 0) {
$chamiloFolder = '/shared_folder/sf_user_'.api_get_user_id().$chamiloFolder;
} else {
$chamiloFolder = '/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id(
).$chamiloFolder;
}
}
}
$doc_id = add_document($_course, $chamiloFolder,'file', $chamiloFileSize , $chamiloFile); //get Chamilo
$current_session_id = api_get_session_id();
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(),$to_group_id,null,null,null,$current_session_id);//get Chamilo
$doc_id = add_document(
$_course,
$chamiloFolder,
'file',
$chamiloFileSize,
$chamiloFile
); //get Chamilo
$current_session_id = api_get_session_id();
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$doc_id,
'DocumentAdded',
api_get_user_id(),
$to_group_id,
null,
null,
null,
$current_session_id
); //get Chamilo
}
// end bridge
$obj->close();
foreach($tem as $k=>$v) {
$info .= sprintf(", %s:'%s'", $k, $v);
}
$info .= sprintf(", url:'%s'", getFileUrl($path));
$info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME);
} else {
$error = ERR_FILE_NOT_AVAILABLE;
}
}
// end bridge
$obj->close();
foreach ($tem as $k => $v) {
$info .= sprintf(", %s:'%s'", $k, $v);
}
$info .= sprintf(", url:'%s'", getFileUrl($path));
$info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME);
} else {
$error = ERR_FILE_NOT_AVAILABLE;
}
}
}
echo "error:'" . $error . "'";
echo "error:'".$error."'";
echo $info;
echo "}";

@ -8,10 +8,8 @@ if (!isset($manager)) {
/**
* this is part of script for processing file paste
*/
//$_GET = $_POST;
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php";
include_once CLASS_PAGINATION;
$pagination = new pagination(false);
$pagination = new pagination(false);
$search_folder = null;
if (isset($_GET['search_folder'])) {
$search_folder = str_replace("'", "", $_GET['search_folder']); //security fix for Chamilo by cfasanando
@ -29,7 +27,7 @@ if (!isset($manager)) {
$search->addSearchKeyword('recursive', @$_GET['search_recursively']);
$search->addSearchKeyword('name', @$_GET['search_name']);
$search->doSearch();
$fileList = $search->getFoundFiles();
$fileList = $search->getFoundFiles();
$folderInfo = $search->getRootFolderInfo();
} else {
include_once(CLASS_MANAGER);
@ -40,7 +38,7 @@ if (!isset($manager)) {
$manager = new manager();
$manager->setSessionAction($sessionAction);
$fileList = $manager->getFileList();
$fileList = $manager->getFileList();
$folderInfo = $manager->getFolderInfo();
}
$pagination->setUrl(CONFIG_URL_FILEnIMAGE_MANAGER);
@ -60,18 +58,20 @@ echo $pagination->getPaginationHTML();
// Chamilo fix for count hidden folders
$count_hideItem = 0;
$deleted_by_Chamilo_file = ' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
$deleted_by_Chamilo_folder = '_DELETED_';
$css_folder_Chamilo = 'css';
$deleted_by_Chamilo_file = ' DELETED '; // ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
$deleted_by_Chamilo_folder = '_DELETED_';
$css_folder_Chamilo = 'css';
$hotpotatoes_folder_Chamilo = 'HotPotatoes_files';
$chat_files_Chamilo = 'chat_files';
$certificates_Chamilo = 'certificates';
$chat_files_Chamilo = 'chat_files';
$certificates_Chamilo = 'certificates';
//end previous fix for count hidden folders
echo "<script>";
echo "parentFolder = {path_base64:'".base64_encode(getParentFolderPath($folderInfo['path']))."', path:'".getParentFolderPath($folderInfo['path'])."'};";
echo "parentFolder = {path_base64:'".base64_encode(
getParentFolderPath($folderInfo['path'])
)."', path:'".getParentFolderPath($folderInfo['path'])."'};";
echo 'currentFolder ={';
$count = 1;
foreach ($folderInfo as $k => $v) {
@ -86,23 +86,24 @@ $count = 1;
foreach ($fileList as $file) {
//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';
$hide_doc_group = false;
if (preg_match("/$group_folder/", $file['path'])) {
$hide_doc_group = true;
if ($is_user_in_group || ( $to_group_id != 0 && api_is_allowed_to_edit())) {
if ($is_user_in_group || ($to_group_id != 0 && api_is_allowed_to_edit())) {
$hide_doc_group = false;
}
}
if ((!preg_match("/$deleted_by_Chamilo_file/", $file['name']) ||
!preg_match("/$deleted_by_Chamilo_folder/", $file['path'])) ||
!preg_match("/$deleted_by_Chamilo_folder/", $file['path'])) ||
preg_match("/$css_folder_Chamilo/", $file['path']) ||
preg_match("/$hotpotatoes_folder_Chamilo/", $file['path']) ||
preg_match("/$chat_files_Chamilo/", $file['path']) ||
preg_match("/$certificates_Chamilo/", $file['path']) ||
$hide_doc_group ||
$file['name'][0] == '.') { //Chamilo fix for hidden items.
$file['name'][0] == '.'
) { //Chamilo fix for hidden items.
$count_hideItem = $count_hideItem + 1;
}
@ -120,7 +121,11 @@ foreach ($fileList as $file) {
echo (($j++ > 1) ? "," : '')."'url':'".getFileUrl($file['path'])."'";
echo "}\n";
}
$fileList = array_slice($fileList, $pagination->getPageOffset(), $pagination->getLimit()); //Chamilo fix for hidden files added +$count_hideItem
$fileList = array_slice(
$fileList,
$pagination->getPageOffset(),
$pagination->getLimit()
); //Chamilo fix for hidden files added +$count_hideItem
echo "};</script>";
if (!empty($_GET['view'])) {

@ -5,13 +5,11 @@ 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)
{
$count = 1;
foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k => $v) {
echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'";
$count++;
}
echo "}";
?>
echo (($count > 1) ? ', ' : '')."'".$v."':'".$k."'";
$count++;
}
echo "}";

@ -1,229 +1,262 @@
<?php
/* 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);
}
/**
* 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 integration with 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(IMG_GEN_IMG_NOT_EXISTS);
}
require_once(CLASS_HISTORY);
$history = new History($path, $session);
if(CONFIG_SYS_DEMO_ENABLE)
{
$sessionImageInfo = $history->getLastestRestorable();
$originalSessionImageInfo = $history->getOriginalImage();
if(sizeof($originalSessionImageInfo))
{
$path = backslashToSlash($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
}
}
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php");
$image = new ImageAjaxFileManager();
$imageInfo = $image->getImageInfo($path);
?>
$_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(IMG_GEN_IMG_NOT_EXISTS);
}
require_once(CLASS_HISTORY);
$history = new History($path, $session);
if (CONFIG_SYS_DEMO_ENABLE) {
$sessionImageInfo = $history->getLastestRestorable();
$originalSessionImageInfo = $history->getOriginalImage();
if (sizeof($originalSessionImageInfo)) {
$path = backslashToSlash($session->getSessionDir().$originalSessionImageInfo['info']['name']);
}
}
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."class.image.php");
$image = new ImageAjaxFileManager();
$imageInfo = $image->getImageInfo($path);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Logan Cai" />
<meta name="website" content="http://www.phpletter.com" />
<script type="text/javascript" src="jscripts/ajaximageeditor_c.js"></script>
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
<script type="text/javascript" src="jscripts/form.js"></script>
<script type="text/javascript" src="jscripts/select.js"></script>
<script type="text/javascript" src="jscripts/jqModal.js"></script>
<script type="text/javascript" src="jscripts/rotate.js"></script>
<script type="text/javascript" src="jscripts/interface.js"></script>-->
<script type="text/javascript" src="jscripts/ajaximageeditor.js"></script>
<script type="text/javascript">
var imageHistory = false;
var currentFolder = '<?php echo removeTrailingSlash(backslashToSlash(dirname($path))); ?>';
var warningLostChanges = '<?php echo IMG_WARNING_LOST_CHANAGES; ?>';
var warningReset = '<?php echo IMG_WARNING_REST; ?>';
var warningResetEmpty = '<?php echo IMG_WARNING_EMPTY_RESET; ?>';
var warningEditorClose = '<?php echo IMG_WARING_WIN_CLOSE; ?>';
var warningUndoImage = '<?php echo IMG_WARNING_UNDO; ?>';
var warningFlipHorizotal = '<?php echo IMG_WARING_FLIP_H; ?>';
var warningFlipVertical = '<?php echo IMG_WARING_FLIP_V; ?>';
var numSessionHistory = <?php echo $history->getNumRestorable(); ?>;
var noChangeMadeBeforeSave = '<?php echo IMG_WARNING_NO_CHANGE_BEFORE_SAVE; ?>';
var warningInvalidNewName = '<?php echo IMG_SAVE_AS_ERR_NAME_INVALID; ?>';
var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
var warningNoFolderSelected = '<?php echo IMG_SAVE_AS_NOT_FOLDER_SELECTED; ?>';
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
$(document).ready(
function()
{
$('#windowSaveAs').jqm();
$('#image_mode').val('');
$('#angle').val(0);
$(getImageElement()).clone().appendTo("#hiddenImage");
changeMode();
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" />
<title>Ajax Image Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="author" content="Logan Cai"/>
<meta name="website" content="http://www.phpletter.com"/>
<script type="text/javascript" src="jscripts/ajaximageeditor_c.js"></script>
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
<script type="text/javascript" src="jscripts/form.js"></script>
<script type="text/javascript" src="jscripts/select.js"></script>
<script type="text/javascript" src="jscripts/jqModal.js"></script>
<script type="text/javascript" src="jscripts/rotate.js"></script>
<script type="text/javascript" src="jscripts/interface.js"></script>-->
<script type="text/javascript" src="jscripts/ajaximageeditor.js"></script>
<script type="text/javascript">
var imageHistory = false;
var currentFolder = '<?php echo removeTrailingSlash(backslashToSlash(dirname($path))); ?>';
var warningLostChanges = '<?php echo IMG_WARNING_LOST_CHANAGES; ?>';
var warningReset = '<?php echo IMG_WARNING_REST; ?>';
var warningResetEmpty = '<?php echo IMG_WARNING_EMPTY_RESET; ?>';
var warningEditorClose = '<?php echo IMG_WARING_WIN_CLOSE; ?>';
var warningUndoImage = '<?php echo IMG_WARNING_UNDO; ?>';
var warningFlipHorizotal = '<?php echo IMG_WARING_FLIP_H; ?>';
var warningFlipVertical = '<?php echo IMG_WARING_FLIP_V; ?>';
var numSessionHistory = <?php echo $history->getNumRestorable(); ?>;
var noChangeMadeBeforeSave = '<?php echo IMG_WARNING_NO_CHANGE_BEFORE_SAVE; ?>';
var warningInvalidNewName = '<?php echo IMG_SAVE_AS_ERR_NAME_INVALID; ?>';
var wordCloseWindow = '<?php echo LBL_ACTION_CLOSE; ?>';
var warningNoFolderSelected = '<?php echo IMG_SAVE_AS_NOT_FOLDER_SELECTED; ?>';
var urlGetFolderList = '<?php echo appendQueryString(CONFIG_URL_GET_FOLDER_LIST, makeQueryString(array('path'))); ?>';
$(document).ready(
function () {
$('#windowSaveAs').jqm();
$('#image_mode').val('');
$('#angle').val(0);
$(getImageElement()).clone().appendTo("#hiddenImage");
changeMode();
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"/>
<title>Ajax Image Editor</title>
</head>
<body>
<?php
//displayArray($_SESSION);
//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="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>
<button id="actionSaveAs" class="button" onclick="return saveAsImagePre();"><?php echo IMG_BTN_SAVE_AS; ?></button>
<button id="actionClose" class="button" onclick="return editorClose();"><?php echo IMG_BTN_CLOSE; ?></button></p>
</form>
</fieldset>
<fieldset id="imageInfo">
<legend id="imageInfoLegend"><?php echo IMG_INFO; ?></legend>
<form name="formImageInfo" action="<?php echo appendQueryString(CONFIG_URL_IMAGE_SAVE, makeQueryString(array('path'))); ?>" method="post" id="formImageInfo">
<p><input type="hidden" name="mode" id="image_mode" value="" />
<input type="hidden" name="new_name" id="hidden_new_name" value="" />
<input type="hidden" name="save_to" id="hidden_save_to" value="" />
<input type="hidden" name="path" id="path" value="<?php echo $_GET['path']; ?>" />
<input type="hidden" name="flip_angle" id="flip_angle" value="" />
<label><?php echo IMG_LBL_WIDTH; ?></label> <input type="text" name="width" id="width" value="" class="input imageInput" />
<label><?php echo IMG_LBL_HEIGHT; ?></label> <input type="text" name="height" id="height" value="" class="input imageInput" />
<label><?php echo IMG_LBL_X; ?></label> <input type="text" name="x" id="x" value="" class="input imageInput"/>
<label><?php echo IMG_LBL_Y; ?></label> <input type="text" name="y" id="y" 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_ANGLE; ?></label> <input type="text" name="angle" id="angle" value="" class="input imageInput" />
</p>
</form>
</fieldset>
<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="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>
<button id="actionSaveAs" class="button"
onclick="return saveAsImagePre();"><?php echo IMG_BTN_SAVE_AS; ?></button>
<button id="actionClose" class="button"
onclick="return editorClose();"><?php echo IMG_BTN_CLOSE; ?></button>
</p>
</form>
</fieldset>
<fieldset id="imageInfo">
<legend id="imageInfoLegend"><?php echo IMG_INFO; ?></legend>
<form name="formImageInfo"
action="<?php echo appendQueryString(CONFIG_URL_IMAGE_SAVE, makeQueryString(array('path'))); ?>"
method="post" id="formImageInfo">
<p><input type="hidden" name="mode" id="image_mode" value=""/>
<input type="hidden" name="new_name" id="hidden_new_name" value=""/>
<input type="hidden" name="save_to" id="hidden_save_to" value=""/>
<input type="hidden" name="path" id="path" value="<?php echo $_GET['path']; ?>"/>
<input type="hidden" name="flip_angle" id="flip_angle" value=""/>
<label><?php echo IMG_LBL_WIDTH; ?></label> <input type="text" name="width" id="width" value=""
class="input imageInput"/>
<label><?php echo IMG_LBL_HEIGHT; ?></label> <input type="text" name="height" id="height" value=""
class="input imageInput"/>
<label><?php echo IMG_LBL_X; ?></label> <input type="text" name="x" id="x" value=""
class="input imageInput"/>
<label><?php echo IMG_LBL_Y; ?></label> <input type="text" name="y" id="y" 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_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'){
<?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']; ?>" />
$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>
<div id="resizeE"></div>
<div id="resizeNE"></div>
<div id="resizeN"></div>
<div id="resizeNW"></div>
<div id="resizeW"></div>
<div id="resizeSW"></div>
<div id="resizeS"></div>
<img id="loading" style="display:none;" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif" />
<div id="resizeSE"></div>
<div id="resizeE"></div>
<div id="resizeNE"></div>
<div id="resizeN"></div>
<div id="resizeNW"></div>
<div id="resizeW"></div>
<div id="resizeSW"></div>
<div id="resizeS"></div>
<img id="loading" style="display:none;" src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/ajaxLoading.gif"/>
</div>
</div>
<div id="hiddenImage">
</div>
<div id="windowSaveAs" class="jqmWindow" style="display:none">
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo LBL_ACTION_CLOSE; ?></a>
<form id="formSaveAs" name="formSaveAs" action="" method="post">
<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
</tr>
</thead>
<tbody>
<tr>
<th>
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
</th>
<td>
<input type="text" id="new_name" class="input" name="new_name" value="" />&nbsp;.<?php echo getFileExt($path); ?>
</td>
</tr>
<tr>
<th>
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
</th>
<td>
<select class="input" name="save_to" id="save_to"></select>
</td>
</tr>
<tr>
<th>&nbsp;
</th>
<td>
<span class="comments">*</span>
<?php echo IMG_NEW_NAME_COMMENTS; ?>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>&nbsp;</th>
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return saveAsImage();" /></td>
</tr>
</tfoot>
</table>
</form>
</div>
<div id="hiddenImage">
</div>
<div id="windowSaveAs" class="jqmWindow" style="display:none">
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo LBL_ACTION_CLOSE; ?></a>
<form id="formSaveAs" name="formSaveAs" action="" method="post">
<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
</tr>
</thead>
<tbody>
<tr>
<th>
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
</th>
<td>
<input type="text" id="new_name" class="input" name="new_name"
value=""/>&nbsp;.<?php echo getFileExt($path); ?>
</td>
</tr>
<tr>
<th>
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
</th>
<td>
<select class="input" name="save_to" id="save_to"></select>
</td>
</tr>
<tr>
<th>&nbsp;
</th>
<td>
<span class="comments">*</span>
<?php echo IMG_NEW_NAME_COMMENTS; ?>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>&nbsp;</th>
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>"
onclick="return saveAsImage();"/></td>
</tr>
</tfoot>
</table>
</form>
</div>
</body>
</html>

@ -4,196 +4,170 @@
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)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
$error = "";
$info = "";
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
{
$error = SYS_DISABLED;
}
elseif(empty($_POST['path']))
{
$error = IMG_SAVE_EMPTY_PATH;
}elseif(!file_exists($_POST['path']))
{
$error = IMG_SAVE_NOT_EXISTS;
}elseif(!isUnderRoot($_POST['path']))
{
$error = IMG_SAVE_PATH_DISALLOWED;
}elseif(($sessionDir = $session->getSessionDir()) == '')
{
$error = SESSION_PERSONAL_DIR_NOT_FOUND;
}
else
{
require_once(CLASS_HISTORY);
$history = new History($_POST['path'], $session);
if(!empty($_POST['mode']))
{
//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":
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
{
$error = IMG_SAVE_RESIZE_FAILED;
}
break;
case "crop":
if(!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height']))
{
$error = IMG_SAVE_CROP_FAILED;
}
break;
case "flip":
if(!$image->flip($_POST['flip_angle']))
{
$error = IMG_SAVE_FLIP_FAILED;
}
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']);
if(!@copy($originalImage, $sessionNewPath))
{//keep a copy under the session folder
$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);
$history->add($sessionImageInfo);
if(CONFIG_SYS_DEMO_ENABLE)
{//demo only
if(isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo))
{
$imagePath = $sessionDir . $originalSessionImageInfo['info']['name'];
}else
{
$imagePath = $sessionDir . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
}
}else
{
if($isSaveAsRequest)
{//save as request
//check save to folder if exists
$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))
{
$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
{//save request
$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
$originalSessionImageInfo = array('name'=>basename($imagePath), 'restorable'=>0, 'is_original'=>1);
$history->add($originalSessionImageInfo);
}
}
$imageInfo = $image->getFinalImageInfo();
}else
{
$error = IMG_SAVE_FAILED;
}
if(isset($imageInfo))
{
$info .= ",width:" . $imageInfo['width'] . "";
$info .= ",height:" . $imageInfo['height'] . "";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'";
if($isSaveAsRequest)
{
$info .= ",save_as:'1'";
}else
{
$info .= ",save_as:'0'";
}
$info .= ",folder_path:'" . dirname($imagePath) . "'";
$info .= ",path:'" . backslashToSlash($imagePath) . "'";
}
}
}
}else
{
$error = IMG_SAVE_IMG_OPEN_FAILED . $originalImage;
}
}else
{
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
echo "{";
echo "error:'" . $error . "'";
if(isset($image) && is_object($image))
{
$image->DestroyImages();
}
echo $info;
echo ",history:" . (isset($history) && is_object($history)?($history->getNumRestorable()):0) . "";
echo "}";
/**
* image save function
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
$error = "";
$info = "";
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) {
$error = SYS_DISABLED;
} elseif (empty($_POST['path'])) {
$error = IMG_SAVE_EMPTY_PATH;
} elseif (!file_exists($_POST['path'])) {
$error = IMG_SAVE_NOT_EXISTS;
} elseif (!isUnderRoot($_POST['path'])) {
$error = IMG_SAVE_PATH_DISALLOWED;
} elseif (($sessionDir = $session->getSessionDir()) == '') {
$error = SESSION_PERSONAL_DIR_NOT_FOUND;
} else {
require_once(CLASS_HISTORY);
$history = new History($_POST['path'], $session);
if (!empty($_POST['mode'])) {
//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":
if (!$image->resize(
$_POST['width'],
$_POST['height'],
(!empty($_POST['constraint']) ? true : false)
)
) {
$error = IMG_SAVE_RESIZE_FAILED;
}
break;
case "crop":
if (!$image->crop($_POST['x'], $_POST['y'], $_POST['width'], $_POST['height'])) {
$error = IMG_SAVE_CROP_FAILED;
}
break;
case "flip":
if (!$image->flip($_POST['flip_angle'])) {
$error = IMG_SAVE_FLIP_FAILED;
}
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']);
if (!@copy($originalImage, $sessionNewPath)) { //keep a copy under the session folder
$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);
$history->add($sessionImageInfo);
if (CONFIG_SYS_DEMO_ENABLE) { //demo only
if (isset($originalSessionImageInfo) && sizeof($originalSessionImageInfo)) {
$imagePath = $sessionDir.$originalSessionImageInfo['info']['name'];
} else {
$imagePath = $sessionDir.uniqid(md5(time())).".".getFileExt($_POST['path']);
}
} else {
if ($isSaveAsRequest) { //save as request
//check save to folder if exists
$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)) {
$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 { //save request
$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
$originalSessionImageInfo = array(
'name' => basename($imagePath),
'restorable' => 0,
'is_original' => 1
);
$history->add($originalSessionImageInfo);
}
}
$imageInfo = $image->getFinalImageInfo();
} else {
$error = IMG_SAVE_FAILED;
}
if (isset($imageInfo)) {
$info .= ",width:".$imageInfo['width']."";
$info .= ",height:".$imageInfo['height']."";
$info .= ",size:'".transformFileSize($imageInfo['size'])."'";
if ($isSaveAsRequest) {
$info .= ",save_as:'1'";
} else {
$info .= ",save_as:'0'";
}
$info .= ",folder_path:'".dirname($imagePath)."'";
$info .= ",path:'".backslashToSlash($imagePath)."'";
}
}
}
} else {
$error = IMG_SAVE_IMG_OPEN_FAILED.$originalImage;
}
} else {
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
echo "{";
echo "error:'".$error."'";
if (isset($image) && is_object($image)) {
$image->DestroyImages();
}
echo $info;
echo ",history:".(isset($history) && is_object($history) ? ($history->getNumRestorable()) : 0)."";
echo "}";
?>

@ -1,9 +1,6 @@
<?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)
@ -12,20 +9,22 @@ require_once api_get_path(LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanage
*
*/
include_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';
$path = base64_decode($_GET['path']);
if(!empty($path) && file_exists($path) && is_file($path)) {
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 . ".";
}
} else {
echo PREVIEW_NOT_PREVIEW . "..";
}
if (!empty($path) && file_exists($path) && is_file($path)) {
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.".";
}
} else {
echo PREVIEW_NOT_PREVIEW."..";
}
} else {
echo PREVIEW_NOT_PREVIEW . "...";
echo PREVIEW_NOT_PREVIEW."...";
}

@ -5,96 +5,80 @@
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)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
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();
echo "{";
$error = "";
$info = "";
if(CONFIG_SYS_VIEW_ONLY)
{
$error = SYS_DISABLED;
}
elseif(empty($_POST['file_path']))
{
$error = IMG_SAVE_EMPTY_PATH;
}elseif(!file_exists($_POST['file_path']))
{
$error = IMG_SAVE_NOT_EXISTS;
}elseif(!isUnderRoot($_POST['file_path']))
{
$error = IMG_SAVE_PATH_DISALLOWED;
}else if(!sizeof($lastestSessionImageInfo))
{
$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 = $_POST['file_path'];
}
/**
* ajax image undo function
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
include_once(CLASS_IMAGE);
$image = new ImageAjaxFileManager();
if($image->loadImage($sessionImage))
{
$imageInfo = $image->getOriginalImageInfo();
if(!@copy($sessionImage, $originalImage))
{
$error = IMG_UNDO_COPY_FAILED;
}else
{
require_once(CLASS_HISTORY);
$history = new History($_POST['file_path'], $session);
$lastestSessionImageInfo = $history->getLastestRestorable();
echo "{";
$error = "";
$info = "";
if (CONFIG_SYS_VIEW_ONLY) {
$error = SYS_DISABLED;
} elseif (empty($_POST['file_path'])) {
$error = IMG_SAVE_EMPTY_PATH;
} elseif (!file_exists($_POST['file_path'])) {
$error = IMG_SAVE_NOT_EXISTS;
} elseif (!isUnderRoot($_POST['file_path'])) {
$error = IMG_SAVE_PATH_DISALLOWED;
} else {
if (!sizeof($lastestSessionImageInfo)) {
$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 = $_POST['file_path'];
}
//remove the session image
if(@unlink($sessionImage))
{
$history->restore();
}
//only one left, remove the session original if demo
include_once(CLASS_IMAGE);
$image = new ImageAjaxFileManager();
if ($image->loadImage($sessionImage)) {
$imageInfo = $image->getOriginalImageInfo();
if (!@copy($sessionImage, $originalImage)) {
$error = IMG_UNDO_COPY_FAILED;
} else {
if($history->getNumRestorable() == 0 && CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo))
{
@unlink($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
$originalImage = $_POST['file_path'];
}
}
$imagePath = $originalImage;
//remove the session image
if (@unlink($sessionImage)) {
$history->restore();
}
//only one left, remove the session original if demo
}else
{
$error = IMG_SAVE_IMG_OPEN_FAILED;
}
if(isset($imageInfo))
{
$info .= ",width:" . $imageInfo['width'] . "\n";
$info .= ",height:" . $imageInfo['height'] . "\n";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
$info .= ",path:'" . backslashToSlash($imagePath) . "'\n";
}
if ($history->getNumRestorable() == 0 && CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo)) {
@unlink($session->getSessionDir().$originalSessionImageInfo['info']['name']);
$originalImage = $_POST['file_path'];
}
}
$imagePath = $originalImage;
}
} else {
$error = IMG_SAVE_IMG_OPEN_FAILED;
}
if (isset($imageInfo)) {
$info .= ",width:".$imageInfo['width']."\n";
$info .= ",height:".$imageInfo['height']."\n";
$info .= ",size:'".transformFileSize($imageInfo['size'])."'\n";
$info .= ",path:'".backslashToSlash($imagePath)."'\n";
}
echo "error:'" . $error . "'\n";
if(isset($image) && is_object($image))
{
$image->DestroyImages();
}
echo $info;
echo ",history:" . ($history->getNumRestorable()) . "\n";
echo "}";
}
}
echo "error:'".$error."'\n";
if (isset($image) && is_object($image)) {
$image->DestroyImages();
}
echo $info;
echo ",history:".($history->getNumRestorable())."\n";
echo "}";
?>

@ -4,50 +4,49 @@
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;
}
if (isset($_POST['username'])) {
if ($auth->login()) {
header('Location: '.appendQueryString(CONFIG_URL_HOME, makeQueryString()));
exit;
}
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/login.css" rel="stylesheet" />
<title><?php echo LOGIN_PAGE_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link type="text/css" href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/login.css" rel="stylesheet"/>
<title><?php echo LOGIN_PAGE_TITLE; ?></title>
</head>
<body>
<div id="container">
<div id="content">
<form name="frmLogin" method="post" action="">
<table class="adminLoginTable" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo LOGIN_FORM_TITLE; ?></th>
</tr>
</thead>
<tbody>
<tr>
<th class="padTop"><label><?php echo LOGIN_USERNAME; ?> </label></th>
<td class="padTop"><input type="text" value="" class="input" name="username" id="username" /></td>
</tr>
<tr>
<th><label><?php echo LOGIN_PASSWORD; ?> </label></th>
<td><input type="password" value="" class="input" name="password" id="password" /></td>
</tr>
</tbody>
<tfoot>
<tr>
<td>&nbsp;</td>
<td><input type="submit" class="button" value="Login" /></td>
</tr>
</tfoot>
</table>
</form>
<form name="frmLogin" method="post" action="">
<table class="adminLoginTable" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo LOGIN_FORM_TITLE; ?></th>
</tr>
</thead>
<tbody>
<tr>
<th class="padTop"><label><?php echo LOGIN_USERNAME; ?> </label></th>
<td class="padTop"><input type="text" value="" class="input" name="username" id="username"/></td>
</tr>
<tr>
<th><label><?php echo LOGIN_PASSWORD; ?> </label></th>
<td><input type="password" value="" class="input" name="password" id="password"/></td>
</tr>
</tbody>
<tfoot>
<tr>
<td>&nbsp;</td>
<td><input type="submit" class="button" value="Login"/></td>
</tr>
</tfoot>
</table>
</form>
</div>
</div>
</body>

@ -5,34 +5,39 @@ 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']));
if ($fileTypes['preview']) {
switch($fileTypes['fileType']) {
case "image":
$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']);
} else {
echo PREVIEW_IMAGE_LOAD_FAILED;
}
break;
case "txt":
if(($fp = @fopen($_GET['path'], 'r'))) {
echo @fread($fp, @filesize($_GET['path']));
@fclose($fp);
} else {
echo PREVIEW_OPEN_FAILED . ".";
}
break;
case "video":
break;
}
} else {
echo PREVIEW_NOT_PREVIEW . "..";
}
include_once(CLASS_MANAGER);
$manager = new manager($_GET['path'], false);
$fileTypes = $manager->getFileType(basename($_GET['path']));
if ($fileTypes['preview']) {
switch ($fileTypes['fileType']) {
case "image":
$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']
);
} else {
echo PREVIEW_IMAGE_LOAD_FAILED;
}
break;
case "txt":
if (($fp = @fopen($_GET['path'], 'r'))) {
echo @fread($fp, @filesize($_GET['path']));
@fclose($fp);
} else {
echo PREVIEW_OPEN_FAILED.".";
}
break;
case "video":
break;
}
} else {
echo PREVIEW_NOT_PREVIEW."..";
}
} else {
echo PREVIEW_NOT_PREVIEW . "...";
echo PREVIEW_NOT_PREVIEW."...";
}

@ -5,56 +5,59 @@ 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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Untitled Document</title>
</head>
<body>
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
<form id="formSaveAs" name="formSaveAs" action="" method="post">
<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
</tr>
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
<form id="formSaveAs" name="formSaveAs" action="" method="post">
<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
</tr>
</thead>
<tbody>
<tr>
<th>
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
<tr>
<th>
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
</th>
<td>
<input type="text" id="new_name" class="input" name="new_name" value="" />
<input type="text" id="new_name" class="input" name="new_name" value=""/>
</td>
</tr>
<tr>
<th>
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
</tr>
<tr>
<th>
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
</th>
<td>
<select class="input" name="save_to">
<select class="input" name="save_to">
</select>
</select>
</td>
</tr>
<tr>
<th>&nbsp;
</tr>
<tr>
<th>&nbsp;
</th>
<td>
<span class="comments">*</span>
<?php echo IMG_NEW_NAME_COMMENTS; ?>
<span class="comments">*</span>
<?php echo IMG_NEW_NAME_COMMENTS; ?>
</td>
</tr>
</tr>
</tbody>
<tfoot>
<tr>
<th>&nbsp;</th>
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return saveAsImage();" /></td>
</tr>
<tr>
<th>&nbsp;</th>
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>"
onclick="return saveAsImage();"/></td>
</tr>
</tfoot>
</table>
</table>
</body>
</html>

@ -4,83 +4,75 @@
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)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
$error = '';
$fileInfo = array();
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME)
{
$error = SYS_DISABLED;
}
elseif(empty($_POST['name']))
{
$error = ERR_RENAME_EMPTY;
}elseif(!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name']))
{
$error = ERR_RENAME_FORMAT;
}elseif(empty($_POST['original_path']) || !file_exists($_POST['original_path']))
{
$error = ERR_RENAME_FILE_NOT_EXISTS;
}elseif(substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name'])
{
$error = ERR_NO_CHANGES_MADE;
}elseif(file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
{
$error = ERR_RENAME_EXISTS;
}elseif(is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS)))
{
$error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
}elseif(!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name']))
{
$error = ERR_RENAME_FAILED;
}else
{
//update record of session if image exists in session for cut or copy
include_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$selectedDocuments = $sessionAction->get();
if(removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments))
{
if(($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false)
{
$selectedDocuments[$key] = $_POST['name'];
$sessionAction->set($selectedDocuments);
$error = '';
$fileInfo = array();
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME) {
$error = SYS_DISABLED;
} elseif (empty($_POST['name'])) {
$error = ERR_RENAME_EMPTY;
} elseif (!preg_match("/^[a-zA-Z0-9 _\-.]+$/", $_POST['name'])) {
$error = ERR_RENAME_FORMAT;
} elseif (empty($_POST['original_path']) || !file_exists($_POST['original_path'])) {
$error = ERR_RENAME_FILE_NOT_EXISTS;
} elseif (substr(
slashToBackslash(removeTrailingSlash($_POST['original_path'])),
strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1
) == $_POST['name']
) {
$error = ERR_NO_CHANGES_MADE;
} elseif (file_exists(addTrailingSlash(getParentPath($_POST['original_path'])).$_POST['name'])) {
$error = ERR_RENAME_EXISTS;
} elseif (is_file($_POST['original_path']) && !isValidExt(
$_POST['name'],
explode(",", CONFIG_UPLOAD_VALID_EXTS),
explode(",", CONFIG_UPLOAD_INVALID_EXTS)
)
) {
$error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
} elseif (!rename(
removeTrailingSlash($_POST['original_path']),
addTrailingSlash(getParentPath($_POST['original_path'])).$_POST['name']
)
) {
$error = ERR_RENAME_FAILED;
} else {
//update record of session if image exists in session for cut or copy
include_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction();
$selectedDocuments = $sessionAction->get();
if (removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof(
$selectedDocuments
)
) {
if (($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false) {
$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))
{
include_once(CLASS_FILE);
$file = new file($path);
$fileInfo = $file->getFileInfo();
$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
}else
{
include_once(CLASS_MANAGER);
$manager = new manager($path, false);
$fileInfo = $manager->getFolderInfo();
$fileInfo['mtime'] = date(DATE_TIME_FORMAT,$fileInfo['mtime']);
}
}
} 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)) {
include_once(CLASS_FILE);
$file = new file($path);
$fileInfo = $file->getFileInfo();
$fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
} else {
include_once(CLASS_MANAGER);
$manager = new manager($path, false);
$fileInfo = $manager->getFolderInfo();
$fileInfo['mtime'] = date(DATE_TIME_FORMAT, $fileInfo['mtime']);
}
}
echo "{";
echo "error:'" . $error . "' ";
foreach ($fileInfo as $k=>$v)
{
echo "," . $k . ":'" . $v . "' ";
}
echo "}";
echo "{";
echo "error:'".$error."' ";
foreach ($fileInfo as $k => $v) {
echo ",".$k.":'".$v."' ";
}
echo "}";
?>

@ -3,90 +3,59 @@
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)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
$error = '';
$path = addTrailingSlash(backslashToSlash($_POST['folder'])) . $_POST['name'];
if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
{
$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;
}elseif(array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false)
{
$error = TXT_DISALLOWED_EXT;
}elseif(!isUnderRoot($_POST['folder']))
{
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
}
else
{
$error = '';
$path = addTrailingSlash(backslashToSlash($_POST['folder'])).$_POST['name'];
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE) {
$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;
} elseif (array_search(strtolower(getFileExt($_POST['name'])), getValidTextEditorExts()) === false) {
$error = TXT_DISALLOWED_EXT;
} elseif (!isUnderRoot($_POST['folder'])) {
$error = ERR_FOLDER_PATH_NOT_ALLOWED;
} else {
if(!empty($_POST['save_as_request']))
{//save as request
if(file_exists($path))
{
$error = TXT_FILE_EXIST;
}else
{
if(($fp = @fopen($path, 'w+')) !== false)
{
if(@fwrite($fp, $_POST['text']))
{
@fclose($fp);
}else
{
$error = TXT_CONTENT_WRITE_FAILED;
}
}else
{
$error = TXT_CREATE_FAILED;
}
}
if (!empty($_POST['save_as_request'])) { //save as request
if (file_exists($path)) {
$error = TXT_FILE_EXIST;
} else {
if (($fp = @fopen($path, 'w+')) !== false) {
if (@fwrite($fp, $_POST['text'])) {
@fclose($fp);
} else {
$error = TXT_CONTENT_WRITE_FAILED;
}
} else {
$error = TXT_CREATE_FAILED;
}
}
}else
{
if(!file_exists($path))
{
$error = TXT_FILE_NOT_EXIST;
}else
{
if(($fp = @fopen($path, 'w')) !== false)
{
if(@fwrite($fp, $_POST['text']))
{
@fclose($fp);
}else
{
$error = TXT_CONTENT_UPDATE_FAILED;
}
}else
{
$error = TXT_FILE_OPEN_FAILED;
}
}
}
} else {
if (!file_exists($path)) {
$error = TXT_FILE_NOT_EXIST;
} else {
if (($fp = @fopen($path, 'w')) !== false) {
if (@fwrite($fp, $_POST['text'])) {
@fclose($fp);
} else {
$error = TXT_CONTENT_UPDATE_FAILED;
}
} else {
$error = TXT_FILE_OPEN_FAILED;
}
}
}
}
}
}else
{
$error = TXT_UNKNOWN_REQUEST;
}
echo "{";
echo "error:'" . $error . "',\n";
echo "path:'" . $path . "'";
echo "}";
} else {
$error = TXT_UNKNOWN_REQUEST;
}
echo "{";
echo "error:'".$error."',\n";
echo "path:'".$path."'";
echo "}";
?>

@ -1,35 +1,30 @@
<?php
/* 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
*
*/
* 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) {
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
{
$_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"))
{
if (file_exists(DIR_AJAX_EDIT_AREA."reg_syntax".DIRECTORY_SEPARATOR.getFileExt($path).".js")) {
$syntax = getFileExt($path);
}else
{
switch (getFileExt($path))
{
} else {
switch (getFileExt($path)) {
case 'htm':
$syntax = 'html';
break;
@ -37,26 +32,25 @@ if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFile
$syntax = 'basic';
}
}
if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
{
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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Logan Cai" />
<meta name="website" content="http://www.phpletter.com" />
<script type="text/javascript" src="jscripts/ajaxtexteditor_c.js"></script>
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
<script type="text/javascript" src="jscripts/form.js"></script>
<script type="text/javascript" src="jscripts/select.js"></script>
<script type="text/javascript" src="jscripts/jqModal.js"></script>
<script type="text/javascript" src="jscripts/ajaxtexteditor.js"></script>
-->
<script type="text/javascript" src="jscripts/edit_area/edit_area_full.js"></script>
<script type="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="author" content="Logan Cai"/>
<meta name="website" content="http://www.phpletter.com"/>
<script type="text/javascript" src="jscripts/ajaxtexteditor_c.js"></script>
<!--<script type="text/javascript" src="jscripts/jquery.js"></script>
<script type="text/javascript" src="jscripts/form.js"></script>
<script type="text/javascript" src="jscripts/select.js"></script>
<script type="text/javascript" src="jscripts/jqModal.js"></script>
<script type="text/javascript" src="jscripts/ajaxtexteditor.js"></script>
-->
<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; ?>';
@ -64,106 +58,105 @@ if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
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>
</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/jqModal.css" type="text/css" rel="stylesheet" />
<title>Ajax Text Editor</title>
<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/jqModal.css" type="text/css" rel="stylesheet"/>
<title>Ajax Text Editor</title>
</head>
<body>
<div id="pageBody">
<textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent($path); ?></textarea>
<textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent(
$path
); ?></textarea>
</div>
<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="save_as_request" id="save_as_request" value="0" />
<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>
<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="save_as_request" id="save_as_request" value="0"/>
<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>
<div id="windowSaveAs" class="jqmWindow" style="display:none">
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
<form id="formSaveAs" name="formSaveAs" action="" method="post">
<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
</tr>
</thead>
<tbody>
<tr>
<th>
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
</th>
<td>
<input type="text" id="new_name" class="input" name="new_name" value="" />
&nbsp;.&nbsp;<select id="ext" name="ext">
<?php
foreach(getValidTextEditorExts() as $v)
{
?>
<option value="<?php echo $v; ?>" <?php echo (strtolower($v) == strtolower(getFileExt($path))?'selected':''); ?>><?php echo $v; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<th>
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
</th>
<td>
<select class="input" name="save_to" id="save_to">
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
<form id="formSaveAs" name="formSaveAs" action="" method="post">
<table class="tableForm" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th colspan="2"><?php echo IMG_LBL_SAVE_AS; ?></th>
</tr>
</thead>
<tbody>
<tr>
<th>
<label><?php echo IMG_LBL_NEW_NAME; ?></label>
</th>
<td>
<input type="text" id="new_name" class="input" name="new_name" value=""/>
&nbsp;.&nbsp;<select id="ext" name="ext">
<?php
foreach (getValidTextEditorExts() as $v) {
?>
<option value="<?php echo $v; ?>" <?php echo(strtolower($v) == strtolower(
getFileExt($path)
) ? 'selected' : ''); ?>><?php echo $v; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<th>
<label><?php echo IMG_LBL_SAVE_TO; ?></label>
</th>
<td>
<select class="input" name="save_to" id="save_to">
</select>
</td>
</tr>
<tr>
<th>&nbsp;
</th>
<td>
<span class="comments">*</span>
<?php echo IMG_NEW_NAME_COMMENTS; ?>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>&nbsp;</th>
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>" onclick="return do_save_as();" /></td>
</tr>
</tfoot>
</table>
</form>
</div>
</select>
</td>
</tr>
<tr>
<th>&nbsp;
</th>
<td>
<span class="comments">*</span>
<?php echo IMG_NEW_NAME_COMMENTS; ?>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>&nbsp;</th>
<td><input type="button" class="button" value="<?php echo IMG_BTN_SAVE_AS; ?>"
onclick="return do_save_as();"/></td>
</tr>
</tfoot>
</table>
</form>
</div>
</body></html>
</body>
</html>

@ -1,23 +1,5 @@
<?php
/*
* Chamilo LMS
*
* Copyright (c) 2009-2011 Juan Carlos Raña
* Copyright (c) 2009-2011 Ivan Tcholakov
* Copyright (c) 2009 Dokeos SPRL
*
* For a full list of contributors, see "credits.txt".
* The full license can be read in "license.txt".
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* See the GNU General Public License for more details.
*/
/* For licensing terms, see /license.txt */
/*
* Custom editor configuration settings, php-side.

@ -1546,8 +1546,8 @@ class GroupManager
* Is the user part of this group? This can be a tutor or a normal member
* you should use this function if the access to a tool or functionality is restricted to the people who are actually in the group
* before you had to check if the user was 1. a member of the group OR 2. a tutor of the group. This function combines both
* @param $user_id the id of the user
* @param $group_id the id of the group
* @param int $user_id the id of the user
* @param int $group_id the id of the group
* @return boolean true/false
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*/

Loading…
Cancel
Save