Use ChamiloSession

pull/2487/head
jmontoyaa 9 years ago
parent 0d7ff4b6e7
commit 2c1dfe2ce7
  1. 10
      main/document/create_audio.php
  2. 10
      main/document/create_document.php
  3. 6
      main/document/create_draw.php
  4. 8
      main/document/create_paint.php
  5. 7
      main/document/document.php
  6. 17
      main/document/edit_document.php
  7. 5
      main/document/edit_draw.php
  8. 6
      main/document/edit_paint.php
  9. 6
      main/document/record_audio.php
  10. 17
      main/document/webcam_clip.php

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating audio files from a text.
*
@ -20,9 +22,10 @@ $nameTools = get_lang('CreateAudio');
api_protect_course_script();
api_block_anonymous_users();
$groupRights = Session::read('group_member_with_upload_rights');
$groupId = api_get_group_id();
if (api_get_setting('enabled_text2audio') == 'false') {
if (api_get_setting('enabled_text2audio') === 'false') {
api_not_allowed(true);
}
@ -99,8 +102,7 @@ if (!$is_allowed_in_course) {
api_not_allowed(true);
}
if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
if (!($is_allowed_to_edit || $groupRights ||
DocumentManager::is_my_shared_folder(
api_get_user_id(),
Security::remove_XSS($dir),
@ -327,7 +329,7 @@ function downloadMP3_google($filepath, $dir)
$clean_text = trim($_POST['text']);
if (empty($clean_title) || empty($clean_text)) {
echo '<script>window.location.href="' . $location . '"</script>';
return;
}
$clean_title = Security::remove_XSS($clean_title);

@ -1,5 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating new html documents with an online WYSIWYG html editor.
*
@ -11,13 +14,12 @@ require_once '../inc/global.inc.php';
$_SESSION['whereami'] = 'document/create';
$this_section = SECTION_COURSES;
$groupRights = Session::read('group_member_with_upload_rights');
$htmlHeadXtra[] = '
<script>
$(document).ready(function() {
$(".scrollbar-light").scrollbar();
$("#hide_bar_template").click(function() {
$("#expand").toggleClass("hide");
$("#contract").toggleClass("hide");
@ -221,7 +223,7 @@ if (!$is_allowed_in_course) {
}
if (!($is_allowed_to_edit ||
$_SESSION['group_member_with_upload_rights'] ||
$groupRights ||
DocumentManager::is_my_shared_folder($userId, $dir, api_get_session_id()))
) {
api_not_allowed(true);

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating new svg and png documents with an online editor.
*
@ -14,7 +16,7 @@ require_once '../inc/global.inc.php';
$_SESSION['whereami'] = 'document/createdraw';
$this_section = SECTION_COURSES;
$groupRights = Session::read('group_member_with_upload_rights');
$nameTools = get_lang('Draw');
api_protect_course_script();
@ -92,7 +94,7 @@ if (!$is_allowed_in_course) {
api_not_allowed(true);
}
if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
if (!($is_allowed_to_edit || $groupRights ||
DocumentManager::is_my_shared_folder(
api_get_user_id(),
Security::remove_XSS($dir),

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating audio files from a text.
*
@ -14,14 +16,14 @@
require_once '../inc/global.inc.php';
$_SESSION['whereami'] = 'document/createpaint';
$this_section = SECTION_COURSES;
$nameTools = get_lang('PhotoRetouching');
$groupRights = Session::read('group_member_with_upload_rights');
api_protect_course_script();
api_block_anonymous_users();
$_course = api_get_course_info();
if (api_get_setting('enabled_support_paint') == 'false') {
if (api_get_setting('enabled_support_paint') === 'false') {
api_not_allowed(true);
}
@ -96,7 +98,7 @@ if (!$is_allowed_in_course) {
api_not_allowed(true);
}
if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
if (!($is_allowed_to_edit || $groupRights ||
DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))
) {
api_not_allowed(true);

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* Homepage script for the documents tool
*
@ -162,9 +164,10 @@ if (!empty($groupId)) {
$group_member_with_upload_rights = true;
}
}
$_SESSION['group_member_with_upload_rights'] = $group_member_with_upload_rights;
Session::write('group_member_with_upload_rights', $group_member_with_upload_rights);
} else {
$_SESSION['group_member_with_upload_rights'] = false;
Session::write('group_member_with_upload_rights', false);
}
// Actions.

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows editing documents.
*
@ -27,10 +29,11 @@
require_once '../inc/global.inc.php';
$groupRights = Session::read('group_member_with_upload_rights');
// Template's javascript
$htmlHeadXtra[] = '
<script>
$(document).ready(function() {
$(".scrollbar-light").scrollbar();
@ -103,7 +106,7 @@ if (isset($_GET['id'])) {
}
if (empty($document_data)) {
api_not_allowed();
api_not_allowed(true);
}
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
@ -148,7 +151,7 @@ if ($is_certificate_mode) {
$editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']||
$is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId);
$noPHP_SELF = true;
@ -187,7 +190,7 @@ if (empty($document_data['parents'])) {
}
if (!($is_allowed_to_edit ||
$_SESSION['group_member_with_upload_rights'] ||
$groupRights ||
DocumentManager::is_my_shared_folder($user_id, $dir, api_get_session_id()))
) {
api_not_allowed(true);
@ -588,9 +591,7 @@ function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc)
//return button back to
function show_return($document_id, $path, $call_from_tool='', $slide_id=0, $is_certificate_mode=false)
{
$actionsLeft = null;
$actionsRight = null;
global $parent_id;
$url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id;
@ -621,6 +622,6 @@ function show_return($document_id, $path, $call_from_tool='', $slide_id=0, $is_c
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a id="hide_bar_template" href="#">'.Display::return_icon('expand.png',get_lang('Expand'),array('id'=>'expand'),ICON_SIZE_MEDIUM).Display::return_icon('contract.png',get_lang('Collapse'),array('id'=>'contract', 'class'=>'hide'),ICON_SIZE_MEDIUM).'</a>';
}
echo $toolbar = Display::toolbarAction('actions-documents', array(0 => $actionsLeft, 1 => ''));
echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft));
}

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating new svg and png documents with an online editor.
*
@ -14,6 +16,7 @@ require_once '../inc/global.inc.php';
$_SESSION['whereami'] = 'document/editdraw';
$this_section = SECTION_COURSES;
$groupRights = Session::read('group_member_with_upload_rights');
api_protect_course_script(true);
api_block_anonymous_users();
@ -113,7 +116,7 @@ if (empty($document_data['parents'])) {
}
}
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] ||
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
if (!$is_allowedToEdit) {

@ -1,5 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows creating new svg and png documents with an online editor.
*
@ -13,6 +16,7 @@ require_once '../inc/global.inc.php';
$_SESSION['whereami'] = 'document/editpaint';
$this_section = SECTION_COURSES;
$groupRights = Session::read('group_member_with_upload_rights');
api_protect_course_script(true);
api_block_anonymous_users();
@ -112,7 +116,7 @@ if (empty($document_data['parents'])) {
}
}
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] ||
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
if (!$is_allowedToEdit) {

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows record audio files.
* @package chamilo.document
@ -11,6 +13,8 @@ require_once '../inc/global.inc.php';
$_SESSION['whereami'] = 'document/voicerecord';
$this_section = SECTION_COURSES;
$groupRights = Session::read('group_member_with_upload_rights');
$nameTools = get_lang('VoiceRecord');
api_protect_course_script();
@ -80,7 +84,7 @@ if (!$is_allowed_in_course) {
api_not_allowed(true);
}
if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
if (!($is_allowed_to_edit || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) {
api_not_allowed(true);
}

@ -1,6 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This file allows record wav files.
*
@ -15,6 +17,7 @@ require_once '../inc/global.inc.php';
$_SESSION['whereami'] = 'document/webcamclip';
$this_section = SECTION_COURSES;
$nameTools = get_lang('WebCamClip');
$groupRights = Session::read('group_member_with_upload_rights');
api_protect_course_script();
api_block_anonymous_users();
@ -83,7 +86,7 @@ if (!$is_allowed_in_course) {
api_not_allowed(true);
}
if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
if (!($is_allowed_to_edit || $groupRights ||
DocumentManager::is_my_shared_folder(api_get_user_id(), Security::remove_XSS($dir),api_get_session_id()))) {
api_not_allowed(true);
}
@ -157,28 +160,28 @@ echo '</div>';
Webcam.freeze();
return false;
});
$('#btnClean').click(function() {
Webcam.unfreeze();
return false;
});
$('#btnSave').click(function() {
snap();
return false;
});
$('#btnAuto').click(function() {
start_video();
return false;
});
$('#btnStop').click(function() {
stop_video();
return false;
});
});
function snap() {
Webcam.snap( function(data_uri) {
var clip_filename='video_clip.jpg';
@ -230,7 +233,7 @@ echo '</div>';
</td><td width=50></td><td valign='top' align='center'>
<div id="upload_results" style="background-color:#ffffff;"></div>
</td></tr></table>
<!-- Implementing Button html5 Tags instead Inputs and some cool bootstrap button styles -->
<div>
<br/>

Loading…
Cancel
Save