Pārlūkot izejas kodu

Every item of the breadcrumb is check with the security::remove_XSS and cut depending of the MAX_LENGTH_BREADCRUMB constant located in the display class? This fix many bugs when using loooong document/lp titles.

Julio Montoya 13 gadi atpakaļ
vecāks
revīzija
43aab9b126

+ 0 - 3
main/inc/header.inc.php

@@ -119,12 +119,9 @@ if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=
 
 <script src="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/thickbox.js" type="text/javascript" ></script>
 <link rel="stylesheet" href="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/thickbox.css" type="text/css" media="projection, screen" />
-
 <link rel="stylesheet" href="<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/chosen/chosen.css" type="text/css" media="projection, screen" />
 
 
-
-
 <link rel="top" href="<?php echo api_get_path(WEB_PATH); ?>index.php" title="" />
 <link rel="courses" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/courses.php" title="<?php echo api_htmlentities(get_lang('OtherCourses'), ENT_QUOTES); ?>" />
 <link rel="profil" href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/profile.php" title="<?php echo api_htmlentities(get_lang('ModifyProfile'), ENT_QUOTES); ?>" />

+ 5 - 0
main/inc/lib/banner.lib.php

@@ -530,6 +530,11 @@ function show_header_4($interbreadcrumb, $language_file, $nameTools) {
             } elseif($breadcrumb_step['name'] == 'gallery') {           
                 $navigation_item['title'] = get_lang('Gallery');
             }
+            //Fixes breadcrumb title now we applied the Security::remove_XSS and we cut the string depending of the MAX_LENGTH_BREADCRUMB value
+            if (api_strlen($navigation_item['title']) > MAX_LENGTH_BREADCRUMB) {
+            	$navigation_item['title'] = api_substr($navigation_item['title'], 0, MAX_LENGTH_BREADCRUMB).' ...';
+            }
+            $navigation_item['title'] = Security::remove_XSS($navigation_item['title']);
             $navigation[] = $navigation_item;
         }
     }

+ 2 - 0
main/inc/lib/display.lib.php

@@ -22,6 +22,8 @@
  * @package chamilo.library
  */
 
+define('MAX_LENGTH_BREADCRUMB', 100);
+
 class Display {
 
     private function __construct() {

+ 1 - 1
main/newscorm/lp_build.php

@@ -108,7 +108,7 @@ if (!empty($gradebook) && $gradebook == 'view') {
     );
 }
 $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
-$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}"));
+$interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", "name" => $therow['name']);
 
 // Theme calls.
 $lp_theme_css=$_SESSION['oLP']->get_theme();