Fixing PHP warning, formatting code, removing unused FCK code.

1.10.x
Julio Montoya 12 years ago
parent d40780e31d
commit 9a5b3ce481
  1. 113
      main/document/create_document.php
  2. 57
      main/document/edit_document.php
  3. 6
      main/document/upload.php
  4. 2
      main/dropbox/dropbox_functions.inc.php
  5. 14
      main/link/link.php
  6. 1
      src/ChamiloLMS/Component/Auth/LoginSuccessHandler.php
  7. 4
      src/ChamiloLMS/Controller/Admin/AdminController.php
  8. 2
      src/ChamiloLMS/Controller/IndexController.php

@ -46,114 +46,13 @@ $(document).ready(function() {
);
});
function InnerDialogLoaded() {
/*
var B=new window.frames[0].FCKToolbarButton(\'Templates\',window.frames[0].FCKLang.Templates);
return B.ClickFrame();
*/
var isIE = (navigator.appVersion.indexOf(\'MSIE\') != -1) ? true : false ;
var EditorFrame = null ;
if ( !isIE ) {
EditorFrame = window.frames[0] ;
} else {
// For this dynamic page window.frames[0] enumerates frames in a different order in IE.
// We need a sure method to locate the frame that contains the online editor.
for ( var i = 0, n = window.frames.length ; i < n ; i++ ) {
if ( window.frames[i].location.toString().indexOf(\'InstanceName=content\') != -1 ) {
EditorFrame = window.frames[i] ;
}
}
}
if ( !EditorFrame ) {
return null ;
}
var B = new EditorFrame.FCKToolbarButton(\'Templates\', EditorFrame.FCKLang.Templates);
return B.ClickFrame();
};
var temp=false;
var temp2=false;
var load_default_template = '.((isset($_POST['submit']) || empty($_SERVER['QUERY_STRING'])) ? 'false' : 'true').';
function FCKeditor_OnComplete( editorInstance ) {
editorInstance.Events.AttachEvent( \'OnSelectionChange\', check_for_title ) ;
document.getElementById(\'frmModel\').innerHTML = "<iframe style=\'height: 525px; width: 180px;\' scrolling=\'no\' frameborder=\'0\' src=\''.api_get_path(
WEB_LIBRARY_PATH
).'fckeditor/editor/fckdialogframe.html \'>";
}
function check_for_title() {
if (temp) {
// This functions shows that you can interact directly with the editor area
// DOM. In this way you have the freedom to do anything you want with it.
// Get the editor instance that we want to interact with.
var oEditor = FCKeditorAPI.GetInstance(\'content\') ;
// Get the Editor Area DOM (Document object).
var oDOM = oEditor.EditorDocument ;
var iLength ;
var contentText ;
var contentTextArray;
var bestandsnaamNieuw = "";
var bestandsnaamOud = "";
// The are two diffent ways to get the text (without HTML markups).
// It is browser specific.
if( document.all ) // If Internet Explorer.
{
contentText = oDOM.body.innerText ;
}
else // If Gecko.
{
var r = oDOM.createRange() ;
r.selectNodeContents( oDOM.body ) ;
contentText = r.toString() ;
}
var index=contentText.indexOf("/*<![CDATA");
contentText=contentText.substr(0,index);
// Compose title if there is none
contentTextArray = contentText.split(\' \') ;
var x=0;
for(x=0; (x<5 && x<contentTextArray.length); x++)
{
if(x < 4)
{
bestandsnaamNieuw += contentTextArray[x] + \' \';
}
else
{
bestandsnaamNieuw += contentTextArray[x];
}
}
}
temp=true;
}
function trim(s) {
while(s.substring(0,1) == \' \') {
s = s.substring(1,s.length);
}
while(s.substring(s.length-1,s.length) == \' \') {
s = s.substring(0,s.length-1);
}
return s;
}
function setFocus() {
$("#document_title").focus();
}
function setFocus() {
$("#document_title").focus();
}
$(window).load(function () {
setFocus();
});
$(window).load(function () {
setFocus();
});
</script>';
require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';

@ -62,40 +62,6 @@ $(document).ready(function() {
}
);
});
function InnerDialogLoaded() {
/*
var B=new window.frames[0].FCKToolbarButton(\'Templates\',window.frames[0].FCKLang.Templates);
return B.ClickFrame();
*/
var isIE = (navigator.appVersion.indexOf(\'MSIE\') != -1) ? true : false ;
var EditorFrame = null ;
if ( !isIE ) {
EditorFrame = window.frames[0] ;
} else {
// For this dynamic page window.frames[0] enumerates frames in a different order in IE.
// We need a sure method to locate the frame that contains the online editor.
for ( var i = 0, n = window.frames.length ; i < n ; i++ ) {
if ( window.frames[i].location.toString().indexOf(\'InstanceName=content\') != -1 ) {
EditorFrame = window.frames[i] ;
}
}
}
if ( !EditorFrame ) {
return null ;
}
var B = new EditorFrame.FCKToolbarButton(\'Templates\', EditorFrame.FCKLang.Templates);
return B.ClickFrame();
};
function FCKeditor_OnComplete( editorInstance) {
document.getElementById(\'frmModel\').innerHTML = "<iframe style=\'height: 525px; width: 180px;\' scrolling=\'no\' frameborder=\'0\' src=\''.api_get_path(
WEB_LIBRARY_PATH
).'fckeditor/editor/fckdialogframe.html \'>";
}
</script>';
$_SESSION['whereami'] = 'document/create';
@ -122,7 +88,7 @@ if (isset($_GET['id'])) {
$dir_original = $dir;
$doc = basename($file);
$my_cur_dir_path = Security::remove_XSS($_GET['curdirpath']);
$my_cur_dir_path = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
$readonly = $document_data['readonly'];
}
@ -133,8 +99,8 @@ if (empty($document_data)) {
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
//Call from
$call_from_tool = Security::remove_XSS($_GET['origin']);
$slide_id = Security::remove_XSS($_GET['origin_opt']);
$call_from_tool = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
$slide_id = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
$file_name = $doc;
$group_document = false;
@ -183,15 +149,14 @@ $dbTable = Database::get_course_table(TABLE_DOCUMENT);
$course_id = api_get_course_int_id();
if (!empty($group_id)) {
$req_gid = '&amp;gidReq='.$group_id;
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace'));
$group_document = true;
$noPHP_SELF = true;
}
if (!$is_certificate_mode) {
$interbreadcrumb[] = array(
"url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).$req_gid,
"url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(),
"name" => get_lang('Documents')
);
} else {
@ -220,7 +185,7 @@ if (!$is_allowed_to_edit) {
event_access_tool(TOOL_DOCUMENT);
//TODO:check the below code and his functionality
if (!is_allowed_to_edit()) {
if (!api_is_allowed_to_edit()) {
if (DocumentManager::check_readonly($course_info, $user_id, $file)) {
api_not_allowed();
}
@ -250,7 +215,7 @@ if (isset($_POST['comment'])) {
/* WYSIWYG HTML EDITOR - Program Logic */
if ($is_allowed_to_edit) {
if ($_POST['formSent'] == 1) {
if (isset($_POST['formSent']) && $_POST['formSent'] == 1) {
$filename = stripslashes($_POST['filename']);
$extension = $_POST['extension'];
@ -470,7 +435,7 @@ if ($owner_id == api_get_user_id() || api_is_platform_admin(
$form->addElement('hidden', 'formSent');
$defaults['formSent'] = 1;
$read_only_flag = $_POST['readonly'];
$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
// Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
// This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
@ -518,12 +483,12 @@ if ($owner_id == api_get_user_id() || api_is_platform_admin(
$defaults['filename'] = $filename;
$defaults['extension'] = $extension;
$defaults['file_path'] = Security::remove_XSS($_GET['file']);
$defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
$defaults['commentPath'] = $file;
$defaults['renameTo'] = $file_name;
$defaults['comment'] = $document_data['comment'];
$defaults['origin'] = Security::remove_XSS($_GET['origin']);
$defaults['origin_opt'] = Security::remove_XSS($_GET['origin_opt']);
$defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
$defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
$form->setDefaults($defaults);

@ -213,13 +213,7 @@ $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is
if (!$is_certificate_mode) {
echo build_directory_selector($folders, $document_id, (isset($group_properties['directory']) ? $group_properties['directory'] : array()));
}
/*$params = Uri::course_params();
$params['id'] = Request::get('id');
$action = Uri::here($params, false);*/
$action = api_get_self().'?'.api_get_cidreq().'&id='.$document_id;
$form = new FormValidator('upload', 'POST', $action.'#tabs-2', '', 'enctype="multipart/form-data"');
$form->addElement('hidden', 'id', $document_id);
$form->addElement('hidden', 'curdirpath', $path);

@ -37,7 +37,7 @@ function handle_multiple_actions()
}
// STEP 2: at least one file has to be selected. If not we return an error message
$ids = Request::get('id', array());
$ids = isset($_GET['id']) ? $_GET['id'] : array();
if (count($ids) > 0) {
$checked_file_ids = $_POST['id'];
} else {

@ -33,7 +33,7 @@ require_once api_get_path(LIBRARY_PATH).'link.lib.php';
$this_section = SECTION_COURSES;
api_protect_course_script();
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
for (i=0;i<$(".actions").length;i++) {
if ($(".actions:eq("+i+")").html()=="<table border=\"0\"></table>" || $(".actions:eq("+i+")").html()=="" || $(".actions:eq("+i+")").html()==null) {
@ -78,15 +78,15 @@ $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, true, true);
if (isset($_GET['action']) && $_GET['action'] == 'addlink') {
$nameTools = '';
$interbreadcrumb[] = array('url' => 'link.php', 'name' => get_lang('Links'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddLink'));
$nameTools = '';
$interbreadcrumb[] = array('url' => 'link.php', 'name' => get_lang('Links'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddLink'));
}
if (isset($_GET['action']) && $_GET['action'] == 'addcategory') {
$nameTools = '';
$interbreadcrumb[] = array('url' => 'link.php', 'name' => get_lang('Links'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddCategory'));
$nameTools = '';
$interbreadcrumb[] = array('url' => 'link.php', 'name' => get_lang('Links'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddCategory'));
}
if (isset($_GET['action']) && $_GET['action'] == 'editlink') {

@ -40,6 +40,7 @@ class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
$userId = $user->getUserId();
$session = $request->getSession();
\ChamiloSession::setSession($session);
event_login($user);

@ -25,6 +25,7 @@ class AdminController extends CommonController
* @param Application $app
* @Route("/")
* @Method({"GET"})
* @return Response
*/
public function indexAction()
{
@ -66,8 +67,7 @@ class AdminController extends CommonController
$adminUrl = api_get_path(WEB_CODE_PATH).'admin/';
/* Users */
$blocks['users']['icon'] = \Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
$blocks['users']['icon'] = \Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
$blocks['users']['label'] = api_ucfirst(get_lang('Users'));
if (api_is_platform_admin()) {

@ -169,8 +169,6 @@ class IndexController extends CommonController
}
$response = $template->render_layout('layout_2_col.tpl');
//return new Response($response, 200, array('Cache-Control' => 's-maxage=3600, public'));
return new Response($response, 200, array());
}

Loading…
Cancel
Save