Changing paths in the fckeditor ajaxmanager to deal with the new data folder changes. See: #5871

skala
Julio Montoya 12 years ago
parent ad03a8146e
commit 3a817aa4a7
  1. 3
      .htaccess
  2. 9
      main/inc/global.inc.php
  3. 9
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_folder_listing.php
  4. 7
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_text_editor.php
  5. 6
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php
  6. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.manager.php
  7. 4
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php
  8. 16
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.base.php
  9. 7
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/config.php
  10. 12
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/function.base.php
  11. 9
      main/inc/lib/fckeditor/repository.php
  12. 21
      src/ChamiloLMS/Controller/IndexController.php
  13. 3
      whoisonline.php

@ -19,6 +19,9 @@
# courses/MATHS/document/folder1/picture.jpg --> courses/MATHS/document/?file=folder1/picture.jpg # courses/MATHS/document/folder1/picture.jpg --> courses/MATHS/document/?file=folder1/picture.jpg
RewriteRule ^courses/(.*)/document/(.*)$ web/courses/$1/document/?file=$2 [R,L] RewriteRule ^courses/(.*)/document/(.*)$ web/courses/$1/document/?file=$2 [R,L]
# Portal default_platform_document files
RewriteRule ^data/default_platform_document/(.*)$ web/data/default_platform_document/?file=$1 [R,L]
# Certificates # Certificates
# certificates/index.php?id=123 --> web/certificates/123 # certificates/index.php?id=123 --> web/certificates/123
RewriteCond %{QUERY_STRING} ^id=([0-9]*) RewriteCond %{QUERY_STRING} ^id=([0-9]*)

@ -1099,7 +1099,7 @@ $userAccessPermissions = function (Request $request) use ($app) {
* src/ChamiloLMS/Controller/LegacyController.php * src/ChamiloLMS/Controller/LegacyController.php
*/ */
// @todo put routes somewhere else yml file. // @todo put routes somewhere else, in a yml/php file .
$app->get('/', 'legacy.controller:classicAction') $app->get('/', 'legacy.controller:classicAction')
->before($courseAccessConditions) ->before($courseAccessConditions)
@ -1126,8 +1126,6 @@ $app->get('/userportal/{type}/{filter}/{page}', 'userPortal.controller:indexActi
$app->get('/logout', 'index.controller:logoutAction') $app->get('/logout', 'index.controller:logoutAction')
->bind('logout'); ->bind('logout');
// Course home instead of courses/MATHS the new URL is web/courses/MATHS // Course home instead of courses/MATHS the new URL is web/courses/MATHS
$app->match('/courses/{courseCode}/{sessionId}/', 'course_home.controller:indexAction', 'GET|POST') $app->match('/courses/{courseCode}/{sessionId}/', 'course_home.controller:indexAction', 'GET|POST')
->assert('sessionId', '\d+') ->assert('sessionId', '\d+')
@ -1165,8 +1163,9 @@ $app->match('/learnpath/subscribe_users/{lpId}', 'learnpath.controller:indexActi
->bind('subscribe_users'); ->bind('subscribe_users');
// Data document_templates // Data document_templates
$app->get('/data/document_templates/{file}', 'index.controller:dumpDataAction') $app->get('/data/document_templates/{file}', 'index.controller:getDocumentTemplateAction')
->bind('data'); ->bind('data');
//var_dump($app['url_generator']->generate('index'));
$app->get('/data/default_platform_document/', 'index.controller:getDefaultPlatformDocumentAction')
->assert('type', '.+');
return $app; return $app;

@ -1,13 +1,10 @@
<?php <?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
echo '{'; echo '{';
$count = 1; $count = 1;
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) foreach (getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v) {
{
echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'";
$count++; $count++;
} }
echo "}"; echo "}";
?>

@ -62,8 +62,7 @@
var currentName = '<?php echo basename($path); ?>'; var currentName = '<?php echo basename($path); ?>';
jQuery(document).ready( jQuery(document).ready(
function() function() {
{
editAreaLoader.init({ editAreaLoader.init({
id: "content" // id of the textarea to transform id: "content" // id of the textarea to transform
,start_highlight: false // if start with highlight ,start_highlight: false // if start with highlight
@ -80,10 +79,6 @@
jQuery('#windowProcessing').jqm({modal:true}); jQuery('#windowProcessing').jqm({modal:true});
} }
); );
</script> </script>
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaxtexteditor.css" type="text/css" rel="stylesheet" /> <link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaxtexteditor.css" type="text/css" rel="stylesheet" />

@ -10,12 +10,14 @@
* @since 31/December/2008 * @since 31/December/2008
*/ */
include '../../../../../../inc/global.inc.php'; // Integrating with Chamilo // Integrating with Chamilo
require_once '../../../../../../inc/global.inc.php';
api_block_anonymous_users();// from Chamilo api_block_anonymous_users();// from Chamilo
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
require_once CLASS_SESSION_ACTION; require_once CLASS_SESSION_ACTION;
$sessionAction = new SessionAction(); $sessionAction = new SessionAction();
if (CONFIG_LOAD_DOC_LATTER) { if (CONFIG_LOAD_DOC_LATTER) {

@ -71,15 +71,15 @@ class manager
if (defined('CONFIG_SYS_FOLDER_SHOWN_ON_TOP')) { if (defined('CONFIG_SYS_FOLDER_SHOWN_ON_TOP')) {
$this->forceFolderOnTop = CONFIG_SYS_FOLDER_SHOWN_ON_TOP; $this->forceFolderOnTop = CONFIG_SYS_FOLDER_SHOWN_ON_TOP;
} }
if (!is_null($path)) { if (!is_null($path)) {
$this->currentFolderPath = $path; $this->currentFolderPath = $path;
} elseif (isset($_GET[$this->folderPathIndex]) && file_exists(base64_decode($_GET[$this->folderPathIndex])) && !is_file(base64_decode($_GET[$this->folderPathIndex]))) { } elseif (isset($_GET[$this->folderPathIndex]) && file_exists(base64_decode($_GET[$this->folderPathIndex])) && !is_file(base64_decode($_GET[$this->folderPathIndex]))) {
$this->currentFolderPath = api_htmlentities(Security::remove_XSS($_GET[$this->folderPathIndex])); $this->currentFolderPath = api_htmlentities(Security::remove_XSS($_GET[$this->folderPathIndex]));
} 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 = CONFIG_SYS_DEFAULT_PATH; $this->currentFolderPath = base64_encode(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);

@ -48,7 +48,6 @@ class Upload
function isFileUploaded($indexInPost = "file") function isFileUploaded($indexInPost = "file")
{ {
$this->errCode = isset($_FILES[$indexInPost]['error']) ? $_FILES[$indexInPost]['error'] : 999; $this->errCode = isset($_FILES[$indexInPost]['error']) ? $_FILES[$indexInPost]['error'] : 999;
if ((isset($_FILES[$indexInPost]['error']) && $_FILES[$indexInPost] == 0) || if ((isset($_FILES[$indexInPost]['error']) && $_FILES[$indexInPost] == 0) ||
(!empty($_FILES[$indexInPost]['tmp_name']) && $_FILES[$indexInPost]['tmp_name'] != 'none') (!empty($_FILES[$indexInPost]['tmp_name']) && $_FILES[$indexInPost]['tmp_name'] != 'none')
@ -210,14 +209,11 @@ class Upload
$fileName = $this->fileBaseName.'_'.$counter.$this->fileExtension; $fileName = $this->fileBaseName.'_'.$counter.$this->fileExtension;
} }
$this->fileBaseName .= "_".$counter; $this->fileBaseName .= "_".$counter;
} }
if (@move_uploaded_file($this->_value['tmp_name'], $dest.$fileName)) { if (@move_uploaded_file($this->_value['tmp_name'], $dest.$fileName)) {
@chmod($dest.$fileName, $this->uploadFileMode); @chmod($dest.$fileName, $this->uploadFileMode);
$this->fileName = $fileName; $this->fileName = $fileName;
$this->filePath = $dest.$fileName; $this->filePath = $dest.$fileName;
return true; return true;
} else { } else {
return false; return false;

@ -75,25 +75,26 @@ these two paths accept relative path only, don't use absolute path
// Integration for Chamilo // Integration for Chamilo
if(!empty($_course['path']) && !isset($_GET['editor']) && isset($_GET['editor']) && $_GET['editor'] != 'stand_alone') { //if(!empty($_course['path']) && isset($_GET['editor']) && $_GET['editor'] != 'stand_alone') {
if (isset($_course['path']) && !empty($_course['path'])) {
if (!empty($group_properties['directory'])) { if (!empty($group_properties['directory'])) {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document'.$group_properties['directory'].'/'; $PathChamiloAjaxFileManager='../../../../../../../data/courses/'.$_course['path'].'/document'.$group_properties['directory'].'/';
} else { } else {
if(api_is_allowed_to_edit()) { if(api_is_allowed_to_edit()) {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/'; $PathChamiloAjaxFileManager='../../../../../../../data/courses/'.$_course['path'].'/document/';
} else { } else {
$current_session_id = api_get_session_id(); $current_session_id = api_get_session_id();
if ($current_session_id==0) { if ($current_session_id==0) {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/'; $PathChamiloAjaxFileManager = '../../../../../../../data/courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
} else { } else {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/'; $PathChamiloAjaxFileManager = '../../../../../../../data/courses/'.$_course['path'].'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';
} }
} }
} }
} else { } else {
if (api_is_platform_admin() && isset($_SESSION['this_section']) && $_SESSION['this_section']=='platform_admin') { if (api_is_platform_admin() && isset($_SESSION['this_section']) && $_SESSION['this_section']=='platform_admin') {
//home page portal //home page portal
$PathChamiloAjaxFileManager='../../../../../../../home/default_platform_document/'; $PathChamiloAjaxFileManager = '../../../../../../../data/default_platform_document/';
} else { } else {
//my profile //my profile
$my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'none'); $my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'none');
@ -113,8 +114,6 @@ define('CONFIG_SYS_ROOT_PATH', $PathChamiloAjaxFileManager);
// end chamilo // end chamilo
define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name define('CONFIG_SYS_FOLDER_SHOWN_ON_TOP', true); //show your folders on the top of list if true or order by name
define("CONFIG_SYS_DIR_SESSION_PATH", session_save_path()); // Hack by Juan Carlos Raña define("CONFIG_SYS_DIR_SESSION_PATH", session_save_path()); // Hack by Juan Carlos Raña
define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns define("CONFIG_SYS_PATTERN_FORMAT", 'list'); //three options: reg ,csv, list, this option define the parttern format for the following patterns
@ -209,7 +208,6 @@ define('CONFIG_DEFAULT_VIEW', (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE?'thumbnail':'det
define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10000); //change 10 by 10000 while pagination is deactivated on Chamilo define('CONFIG_DEFAULT_PAGINATION_LIMIT', 10000); //change 10 by 10000 while pagination is deactivated on Chamilo
define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client define('CONFIG_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
//General Option Declarations //General Option Declarations
//LANGAUGAE DECLARATIONNS //LANGAUGAE DECLARATIONNS

@ -71,16 +71,17 @@ require_once dirname(__FILE__).DIRECTORY_SEPARATOR.$configBaseFileName;
// Loading the selected language file. // Loading the selected language file.
require_once DIR_AJAX_LANGS.CONFIG_LANG_DEFAULT.".php"; //This fires a lots of notices because you can't redefine PHP constants
/*require_once DIR_AJAX_LANGS.CONFIG_LANG_DEFAULT.".php";
// In order the manager not to look ugly in cases of incompleted translations, // In order the manager not to look ugly in cases of incompleted translations,
// we will initialize undefined language constants with English strings. // we will initialize undefined language constants with English strings.
if (CONFIG_LANG_DEFAULT != "en") { if (CONFIG_LANG_DEFAULT != "en") {
require_once(DIR_AJAX_LANGS."en.php"); require_once(DIR_AJAX_LANGS."en.php");
} }*/
require_once DIR_AJAX_LANGS."en.php";
require_once DIR_AJAX_INC."function.base.php"; require_once DIR_AJAX_INC."function.base.php";
require_once dirname(__FILE__).DIRECTORY_SEPARATOR."class.session.php"; require_once dirname(__FILE__).DIRECTORY_SEPARATOR."class.session.php";
$auth = new Auth(); $auth = new Auth();

@ -274,8 +274,8 @@ function getParentPath($value) {
* @return boolean * @return boolean
*/ */
function isUnderRoot($value) { function isUnderRoot($value) {
$roorPath = strtolower(addTrailingSlash(backslashToSlash(getRealPath(CONFIG_SYS_ROOT_PATH)))); $rootPath = strtolower(addTrailingSlash(backslashToSlash(getRealPath(CONFIG_SYS_ROOT_PATH))));
if (file_exists($value) && @strpos(strtolower(addTrailingSlash(backslashToSlash(getRealPath($value)))), $roorPath) === 0) { if (file_exists($value) && @strpos(strtolower(addTrailingSlash(backslashToSlash(getRealPath($value)))), $rootPath) === 0) {
return true; return true;
} }
return false; return false;
@ -422,21 +422,21 @@ function getFileUrl($value) {
$urlprefix = ""; $urlprefix = "";
$urlsuffix = ""; $urlsuffix = "";
$value = backslashToSlash(getRealPath($value)); $value = backslashToSlash(getRealPath($value));
$pos = stripos($value, $wwwroot); $pos = stripos($value, $wwwroot);
if ($pos !== false && $pos == 0) { if ($pos !== false && $pos == 0) {
$output = $urlprefix.substr($value, strlen($wwwroot)).$urlsuffix; $output = $urlprefix.substr($value, strlen($wwwroot)).$urlsuffix;
} else { } else {
$output = $value; $output = $value;
} }
$protocol = "http://"; $protocol = "http://";
if (isset($_SERVER['HTTPS'])) { if (isset($_SERVER['HTTPS'])) {
$protocol = "https://"; $protocol = "https://";
} }
//Removing /data folder in order to work like usual
$output = str_replace('/data/courses', '/courses', $output);
//$output = str_replace('/data/default_platform_document', '/default_platform_document', $output);
return $protocol.addTrailingSlash(backslashToSlash($_SERVER['HTTP_HOST'])).removeBeginingSlash(backslashToSlash($output)); return $protocol.addTrailingSlash(backslashToSlash($_SERVER['HTTP_HOST'])).removeBeginingSlash(backslashToSlash($output));
} }

@ -41,15 +41,6 @@ if (!file_exists($user_folder)) {
@mkdir($user_folder, $permissions_for_new_directories, true); @mkdir($user_folder, $permissions_for_new_directories, true);
} }
// Creation of repository used by paltform administrators if it does not exist.
if (api_is_platform_admin()) {
$homepage_folder = api_get_path(SYS_PATH).'home/default_platform_document/';
if (!file_exists($homepage_folder)) {
@mkdir($homepage_folder, $permissions_for_new_directories);
}
}
// Create course shared folders // Create course shared folders
if (api_is_in_course()) { if (api_is_in_course()) {
$course_dir = $_course['path'].'/document'; $course_dir = $_course['path'].'/document';

@ -275,7 +275,12 @@ class IndexController extends CommonController
return $html; return $html;
} }
public function dumpDataAction(Application $app) /**
*
* @param Application $app
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse|void
*/
public function getDocumentTemplateAction(Application $app)
{ {
try { try {
$file = $app['request']->get('file'); $file = $app['request']->get('file');
@ -286,7 +291,8 @@ class IndexController extends CommonController
} }
} }
public function getDocumentAction(Application $app, $courseCode) { public function getDocumentAction(Application $app, $courseCode)
{
try { try {
$filePath = $app['request']->get('file'); $filePath = $app['request']->get('file');
$file = $app['chamilo.filesystem']->getCourseDocument($courseCode, $filePath); $file = $app['chamilo.filesystem']->getCourseDocument($courseCode, $filePath);
@ -296,6 +302,17 @@ class IndexController extends CommonController
} }
} }
public function getDefaultPlatformDocumentAction(Application $app)
{
try {
$file = $app['request']->get('file');
$file = $app['chamilo.filesystem']->get('default_platform_document/'.$file);
return $app->sendFile($file->getPathname());
} catch (\InvalidArgumentException $e) {
return $app->abort(404, 'No file found');
}
}
/** /**
* Reacts on a failed login: * Reacts on a failed login:
* Displays an explanation with a link to the registration form. * Displays an explanation with a link to the registration form.

@ -169,7 +169,8 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
exit; exit;
} }
$tpl = new Template(get_lang('UsersOnLineList')); $app['title'] = get_lang('UsersOnLineList');
$tpl = $app['template'];
if (api_get_setting('allow_social_tool') == 'true' && !api_is_anonymous()) { if (api_get_setting('allow_social_tool') == 'true' && !api_is_anonymous()) {
$tpl->set_help('Groups'); $tpl->set_help('Groups');

Loading…
Cancel
Save