Fixing fckeditor when adding images, creating folders

skala
Julio Montoya 13 years ago
parent 7b67758fa6
commit 49e24acd4c
  1. 16
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php
  2. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_create_folder.php
  3. 12
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_file_listing.php
  4. 27
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.manager.php
  5. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/function.base.php

@ -1,10 +1,9 @@
<div id="content"> <div id="content">
<?php <?php
$count = 1; $count = 1;
$thumbnailBaseUrl = CONFIG_URL_IMG_THUMBNAIL; $thumbnailBaseUrl = CONFIG_URL_IMG_THUMBNAIL;
foreach ($fileList as $file) {
foreach ($fileList as $file) {
///First step for hidden some type of Chamilo files and folders ///First step for hidden some type of Chamilo files and folders
//Juan Carlos Raña Trabado //Juan Carlos Raña Trabado
//hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat, certificates //hidden files and folders deleted by Chamilo. Hidde folders css, hotpotatoes, chat, certificates
@ -16,8 +15,6 @@
$certificates_chamilo = 'certificates'; $certificates_chamilo = 'certificates';
//hidden directory of the group if the user is not a member of the group //hidden directory of the group if the user is not a member of the group
$group_folder = '_groupdocs'; $group_folder = '_groupdocs';
//show group's directory only if I'm member. Or I'm a teacher //show group's directory only if I'm member. Or I'm a teacher
$show_doc_group = true; $show_doc_group = true;
@ -28,6 +25,7 @@
} }
} }
//show icon sharedfolder //show icon sharedfolder
$shared_folder = 'shared folder'; //'shared folder' not 'shared_folder' because in $file['name'] _ is replaced with blank see class.manager.php $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 ///Second step: hiding as the case
@ -191,8 +189,8 @@
</dd> </dd>
</dl> </dl>
<?php <?php
}//end if hidden files and folders deleted by Chamilo }//end if hidden files and folders deleted by Chamilo
$count++; $count++;
} }
?> ?>
</div> </div>

@ -1,5 +1,4 @@
<?php <?php
/** /**
* create a folder * create a folder
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
@ -10,7 +9,8 @@
* @author Juan Carlos Ra<EFBFBD>a * @author Juan Carlos Ra<EFBFBD>a
* @since 18/January/2009 * @since 18/January/2009
*/ */
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php"); require_once dirname(__FILE__).DIRECTORY_SEPARATOR."inc".DIRECTORY_SEPARATOR."config.php";
//@ob_start(); //Disabled for integration with Chamilo //@ob_start(); //Disabled for integration with Chamilo
//displayArray($_POST); //Disabled for integration with Chamilo //displayArray($_POST); //Disabled for integration with Chamilo
//writeInfo(@ob_get_clean()); //Disabled for integration with Chamilo //writeInfo(@ob_get_clean()); //Disabled for integration with Chamilo

@ -13,6 +13,7 @@
require_once '../../../../../../inc/global.inc.php'; // Integrating with Chamilo require_once '../../../../../../inc/global.inc.php'; // Integrating with Chamilo
if (!isset($manager)) { if (!isset($manager)) {
/** /**
* this is part of script for processing file paste * this is part of script for processing file paste
*/ */
@ -45,8 +46,8 @@ if (!isset($manager)) {
include_once(CLASS_SESSION_ACTION); include_once(CLASS_SESSION_ACTION);
$sessionAction = new SessionAction(); $sessionAction = new SessionAction();
include_once(DIR_AJAX_INC."class.manager.php"); include_once(DIR_AJAX_INC."class.manager.php");
$path = isset($_REQUEST['path']) ? base64_decode($_REQUEST['path']) : null;
$manager = new manager(); $manager = new manager($path);
$manager->setSessionAction($sessionAction); $manager->setSessionAction($sessionAction);
$fileList = $manager->getFileList(); $fileList = $manager->getFileList();
@ -64,6 +65,7 @@ $pagination->setPreviousText(PAGINATION_PREVIOUS);
$pagination->setNextText(PAGINATION_NEXT); $pagination->setNextText(PAGINATION_NEXT);
$pagination->setLastText(PAGINATION_LAST); $pagination->setLastText(PAGINATION_LAST);
$pagination->setLimit(!empty($_GET['limit']) ? intval($_GET['limit']) : CONFIG_DEFAULT_PAGINATION_LIMIT); $pagination->setLimit(!empty($_GET['limit']) ? intval($_GET['limit']) : CONFIG_DEFAULT_PAGINATION_LIMIT);
echo $pagination->getPaginationHTML(); echo $pagination->getPaginationHTML();
// Chamilo fix for count hidden folders // Chamilo fix for count hidden folders
@ -77,11 +79,9 @@ $chat_files_Chamilo = 'chat_files';
$certificates_Chamilo = 'certificates'; $certificates_Chamilo = 'certificates';
//end previous fix for count hidden folders //end previous fix for count hidden folders
echo "<script>"; 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 ={'; echo 'currentFolder = {';
$count = 1; $count = 1;
foreach ($folderInfo as $k => $v) { foreach ($folderInfo as $k => $v) {
echo ($count++ == 1 ? '' : ',')."'".$k."':'".($k == 'ctime' || $k == 'mtime' ? date(DATE_TIME_FORMAT, $v) : $v)."'"; echo ($count++ == 1 ? '' : ',')."'".$k."':'".($k == 'ctime' || $k == 'mtime' ? date(DATE_TIME_FORMAT, $v) : $v)."'";
@ -130,7 +130,6 @@ foreach ($fileList as $file) {
echo "}\n"; 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>"; echo "};</script>";
if (!empty($_GET['view'])) { if (!empty($_GET['view'])) {
switch ($_GET['view']) { switch ($_GET['view']) {
@ -145,7 +144,6 @@ if (!empty($_GET['view'])) {
} else { } else {
$view = CONFIG_DEFAULT_VIEW; $view = CONFIG_DEFAULT_VIEW;
} }
switch ($view) { switch ($view) {
case 'text': case 'text':
//list file name only //list file name only

@ -58,7 +58,8 @@ class manager
array(array("ods", "ots", "sxc", "stc"), "fileODS", SEARCH_TYPE_ODS, 1), array(array("ods", "ots", "sxc", "stc"), "fileODS", SEARCH_TYPE_ODS, 1),
array(array("odg", "otg", "sxd", "std"), "fileODG", SEARCH_TYPE_ODG, 1), array(array("odg", "otg", "sxd", "std"), "fileODG", SEARCH_TYPE_ODG, 1),
array(array("mm"), "freemind", SEARCH_TYPE_PDF, 0) array(array("mm"), "freemind", SEARCH_TYPE_PDF, 0)
); // Added mm, svg, svgz, pps, docx, pptx, xlsx, midi, ogg, ogv, oga,(odt,ods,odp,odg and extra) types to Chamilo, and change flv from flash to video );
// Added mm, svg, svgz, pps, docx, pptx, xlsx, midi, ogg, ogv, oga,(odt,ods,odp,odg and extra) types to Chamilo, and change flv from flash to video
/** /**
* constructor * constructor
@ -79,11 +80,10 @@ class manager
} elseif (isset($_SESSION[$this->lastVisitedFolderPathIndex]) && file_exists($_SESSION[$this->lastVisitedFolderPathIndex]) && !is_file($_SESSION[$this->lastVisitedFolderPathIndex])) { } elseif (isset($_SESSION[$this->lastVisitedFolderPathIndex]) && file_exists($_SESSION[$this->lastVisitedFolderPathIndex]) && !is_file($_SESSION[$this->lastVisitedFolderPathIndex])) {
$this->currentFolderPath = $_SESSION[$this->lastVisitedFolderPathIndex]; $this->currentFolderPath = $_SESSION[$this->lastVisitedFolderPathIndex];
} else { } else {
$this->currentFolderPath = base64_encode(CONFIG_SYS_DEFAULT_PATH); $this->currentFolderPath = CONFIG_SYS_DEFAULT_PATH;
} }
$this->currentFolderPath = (isUnderRoot($this->getCurrentFolderPath()) ? backslashToSlash((addTrailingSlash($this->getCurrentFolderPath()))) : CONFIG_SYS_DEFAULT_PATH); $this->currentFolderPath = (isUnderRoot($this->getCurrentFolderPath()) ? backslashToSlash((addTrailingSlash($this->getCurrentFolderPath()))) : CONFIG_SYS_DEFAULT_PATH);
$this->currentFolderPath = base64_encode($this->currentFolderPath);
if ($this->calculateSubdir) { if ($this->calculateSubdir) {
// keep track of this folder path in session // keep track of this folder path in session
@ -148,23 +148,25 @@ class manager
* @return string * @return string
*/ */
function getCurrentFolderPath() { function getCurrentFolderPath() {
return base64_decode($this->currentFolderPath); return $this->currentFolderPath;
} }
/** /**
* get the list of files and folders under this current fold * get the list of files and folders under this current fold
* @return array * @return array
*/ */
function getFileList() { function getFileList()
{
$outputs = array(); $outputs = array();
$files = array(); $files = array();
$folders = array(); $folders = array();
$tem = array();
$dirHandler = @opendir($this->getCurrentFolderPath()); $dirHandler = @opendir($this->getCurrentFolderPath());
if ($dirHandler) { if ($dirHandler) {
while (false !== ($file = readdir($dirHandler))) { while (false !== ($file = readdir($dirHandler))) {
if ($file != '.' && $file != '..') { if ($file != '.' && $file != '..') {
$flag = $this->flags['no']; $flag = $this->flags['no'];
if ($this->sessionAction->getFolder() == $this->getCurrentFolderPath()) { if ($this->sessionAction->getFolder() == $this->getCurrentFolderPath()) {
//check if any flag associated with this folder or file //check if any flag associated with this folder or file
@ -179,9 +181,10 @@ class manager
} }
$path = $this->getCurrentFolderPath().$file; $path = $this->getCurrentFolderPath().$file;
if (is_dir($path) && isListingDocument($path)) { if (is_dir($path) && isListingDocument($path)) {
$this->currentFolderInfo['subdir']++; $this->currentFolderInfo['subdir']++;
//fix count left folders for Chamilo //fix count left folders for Chamilo
$deleted_by_Chamilo_folder = '_DELETED_'; $deleted_by_Chamilo_folder = '_DELETED_';
$css_folder_Chamilo = 'css'; $css_folder_Chamilo = 'css';
@ -190,7 +193,7 @@ class manager
$certificates_Chamilo = 'certificates'; $certificates_Chamilo = 'certificates';
//show group's directory only if I'm member. Or if I'm a teacher. //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). //@todo: check groups not necessary because the student don't have access to main folder documents (only to document/group or document/shared_folder).
//Teachers can access to all groups ? //Teachers can access to all groups ?
$group_folder = '_groupdocs'; $group_folder = '_groupdocs';
$hide_doc_group = false; $hide_doc_group = false;
@ -207,7 +210,8 @@ class manager
preg_match("/$hotpotatoes_folder_Chamilo/", $path) || preg_match("/$hotpotatoes_folder_Chamilo/", $path) ||
preg_match("/$chat_files_Chamilo/", $path) || preg_match("/$chat_files_Chamilo/", $path) ||
preg_match("/$certificates_Chamilo/", $path) || preg_match("/$certificates_Chamilo/", $path) ||
$hide_doc_group || $file[0] == '.') { $hide_doc_group || $file[0] == '.')
{
$this->currentFolderInfo['subdir'] = $this->currentFolderInfo['subdir'] - 1; $this->currentFolderInfo['subdir'] = $this->currentFolderInfo['subdir'] - 1;
} }
//end fix for Chamilo //end fix for Chamilo
@ -220,6 +224,9 @@ class manager
$folders[$file] = $folder; $folders[$file] = $folder;
$outputs[$file] = $folders[$file]; $outputs[$file] = $folders[$file];
} }
} elseif (is_file($path) && isListingDocument($path)) { } elseif (is_file($path) && isListingDocument($path)) {
$obj = new file($path); $obj = new file($path);
$tem = $obj->getFileInfo(); $tem = $obj->getFileInfo();
@ -279,6 +286,7 @@ class manager
} else { } else {
trigger_error('Unable to locate the folder '.$this->getCurrentFolderPath(), E_NOTICE); trigger_error('Unable to locate the folder '.$this->getCurrentFolderPath(), E_NOTICE);
} }
return $outputs; return $outputs;
} }
@ -292,7 +300,6 @@ class manager
if (is_null($path)) { if (is_null($path)) {
return $this->currentFolderInfo; return $this->currentFolderInfo;
} else { } else {
$path = base64_encode($path);
$obj = new manager($path, false); $obj = new manager($path, false);
$obj->setSessionAction($this->sessionAction); $obj->setSessionAction($this->sessionAction);
$obj->getFileList(); $obj->getFileList();

@ -13,7 +13,6 @@ require_once dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
* force to ensure existence of stripos * force to ensure existence of stripos
*/ */
if (!function_exists("stripos")) { if (!function_exists("stripos")) {
function stripos($str, $needle, $offset = 0) { function stripos($str, $needle, $offset = 0) {
return @strpos(strtolower($str), strtolower($needle), $offset); return @strpos(strtolower($str), strtolower($needle), $offset);
} }
@ -811,7 +810,8 @@ function isListingDocument($path) {
} }
return true; return true;
} }
} else {//regular expression } else {
//regular expression
if (is_dir($path)) { if (is_dir($path)) {
if (isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, $path) && !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, $path)) { if (isValidPattern(CONFIG_SYS_INC_DIR_PATTERN, $path) && !isInvalidPattern(CONFIG_SYS_EXC_DIR_PATTERN, $path)) {
return true; return true;

Loading…
Cancel
Save