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 # 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");
echo '{';
$count = 1;
foreach(getFolderListing(CONFIG_SYS_ROOT_PATH) as $k=>$v)
{
echo (($count > 1)?', ':''). "'" . $v . "':'" . $k . "'"; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php";
$count++; echo '{';
} $count = 1;
echo "}"; 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) if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_EDITABLE)
{ {
die(SYS_DISABLED); die(SYS_DISABLED);
} }
//$session->gc(); //disabled for Chamilo //$session->gc(); //disabled for Chamilo
$_GET['path'] = empty($_GET['path'])?CONFIG_SYS_ROOT_PATH . "ajax_image_editor_demo.jpg":$_GET['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'])) if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path']) && isUnderRoot($_GET['path']))
{ {
$path = $_GET['path']; $path = $_GET['path'];
}else }else
{ {
die(TXT_FILE_NOT_FOUND); 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); $syntax = getFileExt($path);
}else }else
{ {
switch (getFileExt($path)) switch (getFileExt($path))
{ {
@ -36,7 +36,7 @@
} }
if(array_search(getFileExt($path), getValidTextEditorExts())=== false) 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"> <!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); ?>'; 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
,allow_resize: "both" ,allow_resize: "both"
,gecko_spellcheck:true ,gecko_spellcheck:true
@ -74,16 +73,12 @@
,save_callback:"save" ,save_callback:"save"
,save_as_callback:"save_as" ,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'); ?>" ,language: "<?php echo (file_exists(DIR_AJAX_EDIT_AREA . 'langs' . DIRECTORY_SEPARATOR .CONFIG_LANG_INDEX . ".js")?CONFIG_LANG_INDEX:'en'); ?>"
,syntax: "<?php echo $syntax; ?>" ,syntax: "<?php echo $syntax; ?>"
}); });
jQuery('#windowSaveAs').jqm(); jQuery('#windowSaveAs').jqm();
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" />
@ -98,10 +93,10 @@
<div id="windowProcessing" class="jqmWindow" style="display:none"> <div id="windowProcessing" class="jqmWindow" style="display:none">
<form name="frmProcessing" id="frmProcessing" method="post" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>"> <form name="frmProcessing" id="frmProcessing" method="post" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>">
<input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" /> <input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" />
<input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" /> <input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" />
<input type="hidden" name="save_as_request" id="save_as_request" value="0" /> <input type="hidden" name="save_as_request" id="save_as_request" value="0" />
<div style="display:none"><textarea name="text" id="text"></textarea></div> <div style="display:none"><textarea name="text" id="text"></textarea></div>
</form> </form>
<a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a> <a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a>
<p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p> <p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p>
</div> </div>
@ -139,7 +134,7 @@
</th> </th>
<td> <td>
<select class="input" name="save_to" id="save_to"> <select class="input" name="save_to" id="save_to">
</select> </select>
</td> </td>
</tr> </tr>

@ -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) {
@ -29,7 +31,7 @@ if (CONFIG_LOAD_DOC_LATTER) {
$folderInfo = $manager->getFolderInfo(); $folderInfo = $manager->getFolderInfo();
} }
if(CONFIG_SYS_THUMBNAIL_VIEW_ENABLE) { if (CONFIG_SYS_THUMBNAIL_VIEW_ENABLE) {
$views = array( $views = array(
'detail'=>LBL_BTN_VIEW_DETAILS, 'detail'=>LBL_BTN_VIEW_DETAILS,
'thumbnail'=>LBL_BTN_VIEW_THUMBNAIL, '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']) { switch($_GET['view']) {
case 'detail': case 'detail':
case 'thumbnail': case 'thumbnail':

@ -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(!empty($group_properties['directory'])) { if (isset($_course['path']) && !empty($_course['path'])) {
$PathChamiloAjaxFileManager='../../../../../../../courses/'.$_course['path'].'/document'.$group_properties['directory'].'/'; if (!empty($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
@ -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_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 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. // 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. // 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