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. 19
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_get_folder_listing.php
  4. 39
      main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_text_editor.php
  5. 10
      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. 22
      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
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/index.php?id=123 --> web/certificates/123
RewriteCond %{QUERY_STRING} ^id=([0-9]*)

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

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

@ -10,20 +10,20 @@
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
}else
{
die(TXT_FILE_NOT_FOUND);
}
if(file_exists(DIR_AJAX_EDIT_AREA . "reg_syntax" . DIRECTORY_SEPARATOR . getFileExt($path) . ".js"))
{
$syntax = getFileExt($path);
}else
$syntax = getFileExt($path);
}else
{
switch (getFileExt($path))
{
@ -36,7 +36,7 @@
}
if(array_search(getFileExt($path), getValidTextEditorExts())=== false)
{
die(TXT_DISALLOWED_EXT);
die(TXT_DISALLOWED_EXT);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@ -62,10 +62,9 @@
var currentName = '<?php echo basename($path); ?>';
jQuery(document).ready(
function()
{
editAreaLoader.init({
id: "content" // id of the textarea to transform
function() {
editAreaLoader.init({
id: "content" // id of the textarea to transform
,start_highlight: false // if start with highlight
,allow_resize: "both"
,gecko_spellcheck:true
@ -74,16 +73,12 @@
,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});
,syntax: "<?php echo $syntax; ?>"
});
jQuery('#windowSaveAs').jqm();
jQuery('#windowProcessing').jqm({modal:true});
}
);
);
</script>
<link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/ajaxtexteditor.css" type="text/css" rel="stylesheet" />
@ -98,10 +93,10 @@
<div id="windowProcessing" class="jqmWindow" style="display:none">
<form name="frmProcessing" id="frmProcessing" method="post" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>">
<input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" />
<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />
<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />
<input type="hidden" name="save_as_request" id="save_as_request" value="0" />
<div style="display:none"><textarea name="text" id="text"></textarea></div>
</form>
<div style="display:none"><textarea name="text" id="text"></textarea></div>
</form>
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
<p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p>
</div>
@ -139,7 +134,7 @@
</th>
<td>
<select class="input" name="save_to" id="save_to">
</select>
</td>
</tr>

@ -10,12 +10,14 @@
* @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
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
require_once CLASS_SESSION_ACTION;
$sessionAction = new SessionAction();
if (CONFIG_LOAD_DOC_LATTER) {
@ -29,7 +31,7 @@ if (CONFIG_LOAD_DOC_LATTER) {
$folderInfo = $manager->getFolderInfo();
}
if(CONFIG_SYS_THUMBNAIL_VIEW_ENABLE) {
if (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE) {
$views = array(
'detail'=>LBL_BTN_VIEW_DETAILS,
'thumbnail'=>LBL_BTN_VIEW_THUMBNAIL,
@ -40,7 +42,7 @@ if(CONFIG_SYS_THUMBNAIL_VIEW_ENABLE) {
);
}
if(!empty($_GET['view'])) {
if (!empty($_GET['view'])) {
switch($_GET['view']) {
case 'detail':
case 'thumbnail':

@ -71,15 +71,15 @@ class manager
if (defined('CONFIG_SYS_FOLDER_SHOWN_ON_TOP')) {
$this->forceFolderOnTop = CONFIG_SYS_FOLDER_SHOWN_ON_TOP;
}
if (!is_null($path)) {
$this->currentFolderPath = $path;
} 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]));
} elseif (isset($_SESSION[$this->lastVisitedFolderPathIndex]) && file_exists($_SESSION[$this->lastVisitedFolderPathIndex]) && !is_file($_SESSION[$this->lastVisitedFolderPathIndex])) {
$this->currentFolderPath = $_SESSION[$this->lastVisitedFolderPathIndex];
} 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);

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

@ -75,25 +75,26 @@ these two paths accept relative path only, don't use absolute path
// Integration for Chamilo
if(!empty($_course['path']) && !isset($_GET['editor']) && isset($_GET['editor']) && $_GET['editor'] != 'stand_alone') {
if(!empty($group_properties['directory'])) {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document'.$group_properties['directory'].'/';
//if(!empty($_course['path']) && isset($_GET['editor']) && $_GET['editor'] != 'stand_alone') {
if (isset($_course['path']) && !empty($_course['path'])) {
if (!empty($group_properties['directory'])) {
$PathChamiloAjaxFileManager='../../../../../../../data/courses/'.$_course['path'].'/document'.$group_properties['directory'].'/';
} else {
if(api_is_allowed_to_edit()) {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/';
$PathChamiloAjaxFileManager='../../../../../../../data/courses/'.$_course['path'].'/document/';
} else {
$current_session_id = api_get_session_id();
if($current_session_id==0) {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
if ($current_session_id==0) {
$PathChamiloAjaxFileManager = '../../../../../../../data/courses/'.$_course['path'].'/document/shared_folder/sf_user_'.api_get_user_id().'/';
} 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 {
if (api_is_platform_admin() && isset($_SESSION['this_section']) && $_SESSION['this_section']=='platform_admin') {
//home page portal
$PathChamiloAjaxFileManager='../../../../../../../home/default_platform_document/';
$PathChamiloAjaxFileManager = '../../../../../../../data/default_platform_document/';
} else {
//my profile
$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
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_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_LOAD_DOC_LATTER', false); //all documents will be loaded up after the template has been loaded to the client
//General Option Declarations
//LANGAUGAE DECLARATIONNS
@ -221,4 +219,4 @@ $langajaxfilemanager = file_exists(api_get_path(SYS_PATH).'main/inc/lib/fckedito
define('CONFIG_LANG_INDEX', 'language'); //the index in the session
define('CONFIG_LANG_DEFAULT', (CONFIG_QUERY_STRING_ENABLE && !empty($_GET['language']) && file_exists(DIR_LANG . secureFileName($_GET['language']) . '.php')?secureFileName($_GET['language']):$langajaxfilemanager)); //change it to be your language file base name, such en
// Language text direction.
define('CONFIG_LANG_TEXT_DIRECTION_DEFAULT', in_array(CONFIG_LANG_DEFAULT, array('ar', 'prs', 'he', 'ps', 'fa')) ? 'rtl' : 'ltr');
define('CONFIG_LANG_TEXT_DIRECTION_DEFAULT', in_array(CONFIG_LANG_DEFAULT, array('ar', 'prs', 'he', 'ps', 'fa')) ? 'rtl' : 'ltr');

@ -71,16 +71,17 @@ require_once dirname(__FILE__).DIRECTORY_SEPARATOR.$configBaseFileName;
// 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,
// we will initialize undefined language constants with English strings.
if (CONFIG_LANG_DEFAULT != "en") {
require_once(DIR_AJAX_LANGS."en.php");
}
}*/
require_once DIR_AJAX_LANGS."en.php";
require_once DIR_AJAX_INC."function.base.php";
require_once dirname(__FILE__).DIRECTORY_SEPARATOR."class.session.php";
$auth = new Auth();

@ -274,8 +274,8 @@ function getParentPath($value) {
* @return boolean
*/
function isUnderRoot($value) {
$roorPath = strtolower(addTrailingSlash(backslashToSlash(getRealPath(CONFIG_SYS_ROOT_PATH))));
if (file_exists($value) && @strpos(strtolower(addTrailingSlash(backslashToSlash(getRealPath($value)))), $roorPath) === 0) {
$rootPath = strtolower(addTrailingSlash(backslashToSlash(getRealPath(CONFIG_SYS_ROOT_PATH))));
if (file_exists($value) && @strpos(strtolower(addTrailingSlash(backslashToSlash(getRealPath($value)))), $rootPath) === 0) {
return true;
}
return false;
@ -422,21 +422,21 @@ function getFileUrl($value) {
$urlprefix = "";
$urlsuffix = "";
$value = backslashToSlash(getRealPath($value));
$pos = stripos($value, $wwwroot);
if ($pos !== false && $pos == 0) {
$output = $urlprefix.substr($value, strlen($wwwroot)).$urlsuffix;
} else {
$output = $value;
}
$protocol = "http://";
if (isset($_SERVER['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));
}

@ -41,15 +41,6 @@ if (!file_exists($user_folder)) {
@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
if (api_is_in_course()) {
$course_dir = $_course['path'].'/document';

@ -275,7 +275,12 @@ class IndexController extends CommonController
return $html;
}
public function dumpDataAction(Application $app)
/**
*
* @param Application $app
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse|void
*/
public function getDocumentTemplateAction(Application $app)
{
try {
$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 {
$filePath = $app['request']->get('file');
$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:
* 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;
}
$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()) {
$tpl->set_help('Groups');

Loading…
Cancel
Save