Fix php errors, use entities

pull/3844/head
Julio Montoya 5 years ago
parent 088f3700c2
commit 89408f6587
  1. 23
      public/main/document/showinframes.php
  2. 2
      public/main/exercise/exercise.class.php
  3. 13
      public/main/exercise/exercise_report.php
  4. 2
      public/main/exercise/result.php
  5. 2
      public/main/gradebook/personal_stats.php
  6. 12
      public/main/inc/lib/TicketManager.php
  7. 2
      public/main/inc/lib/api.lib.php
  8. 2
      public/main/inc/lib/pdf.lib.php
  9. 4
      public/main/inc/lib/sortable_table.class.php
  10. 4
      public/main/lp/lp_list.php
  11. 10
      public/main/lp/scorm_api.php
  12. 8
      public/main/webservices/lp.php

@ -197,9 +197,7 @@ if (isset($document_data['parents']) && isset($document_data['parents'][0])) {
if ($isChatFolder) { if ($isChatFolder) {
$htmlHeadXtra[] = api_get_js('highlight/highlight.pack.js'); $htmlHeadXtra[] = api_get_js('highlight/highlight.pack.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css'); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
$htmlHeadXtra[] = api_get_css( $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/highlight/styles/github.css');
api_get_path(WEB_LIBRARY_PATH).'javascript/highlight/styles/github.css'
);
$htmlHeadXtra[] = ' $htmlHeadXtra[] = '
<script> <script>
hljs.initHighlightingOnLoad(); hljs.initHighlightingOnLoad();
@ -222,14 +220,13 @@ if (!$playerSupported && $execute_iframe) {
var jQueryFrameReadyConfigPath = \''.api_get_jquery_web_path().'\'; var jQueryFrameReadyConfigPath = \''.api_get_jquery_web_path().'\';
--> -->
</script>'; </script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
// Fixes the content height of the frame // Fixes the content height of the frame
$(function() { $(function() {
$(\'#mainFrame\').on(\'load\', function () { $(\'#mainFrame\').on(\'load\', function () {
this.style.height = (this.contentWindow.document.body.scrollHeight + 50) + \'px\'; this.style.height = (this.contentWindow.document.body.scrollHeight + 50) + \'px\';
}); });
'.$frameReady.' '.$frameReady.'
}); });
</script>'; </script>';
@ -331,14 +328,14 @@ if ($execute_iframe) {
echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]); echo $toolbar = Display::toolbarAction('actions-documents', [$actionsLeft]);
echo '<iframe echo '<iframe
id="mainFrame" id="mainFrame"
name="mainFrame" name="mainFrame"
border="0" border="0"
frameborder="0" frameborder="0"
scrolling="no" scrolling="no"
style="width:100%;" height="600" style="width:100%;" height="600"
src="'.$file_url_web.'&rand='.mt_rand(1, 10000).'" src="'.$file_url_web.'&rand='.mt_rand(1, 10000).'"
height="500" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>'; height="500" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>';
} }
} }

@ -9416,7 +9416,7 @@ class Exercise
) { ) {
if ($num > 0) { if ($num > 0) {
$row_track = Database::fetch_array($qryres); $row_track = Database::fetch_array($qryres);
$attempt_text = get_lang('LatestAttempt').' : '; $attempt_text = get_lang('Latest attempt').' : ';
$attempt_text .= ExerciseLib::show_score( $attempt_text .= ExerciseLib::show_score(
$row_track['score'], $row_track['score'],
$row_track['max_score'] $row_track['max_score']

@ -3,6 +3,8 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\TrackEAttemptRecording; use Chamilo\CoreBundle\Entity\TrackEAttemptRecording;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLp;
/** /**
* Exercise list: This script shows the list of exercises for administrators and students. * Exercise list: This script shows the list of exercises for administrators and students.
@ -354,16 +356,23 @@ if (isset($_REQUEST['comments']) &&
$statsTeacher $statsTeacher
); );
} }
// Updating LP score here // Updating LP score here
if (!empty($lp_id) && !empty($lpItemId)) { if (!empty($lp_id) && !empty($lpItemId)) {
$lpRepo = Container::getLpRepository();
$lp = null;
if (!empty($lpId)) {
/** @var CLp $lp */
$lp = $lpRepo->find($lpId);
}
$statusCondition = ''; $statusCondition = '';
$item = new learnpathItem($lpItemId, api_get_user_id(), api_get_course_int_id()); $item = new learnpathItem($lp, $lpItemId, api_get_course_int_id());
if ($item) { if ($item) {
$prereqId = $item->get_prereq_string(); $prereqId = $item->get_prereq_string();
$minScore = $item->getPrerequisiteMinScore(); $minScore = $item->getPrerequisiteMinScore();
$maxScore = $item->getPrerequisiteMaxScore(); $maxScore = $item->getPrerequisiteMaxScore();
$passed = false; $passed = false;
$lp = new learnpath(api_get_course_id(), $lp_id, $student_id); $lp = new learnpath($lp, api_get_course_info(), $student_id);
$prereqCheck = $lp->prerequisites_match($lpItemId); $prereqCheck = $lp->prerequisites_match($lpItemId);
if ($prereqCheck) { if ($prereqCheck) {
$passed = true; $passed = true;

@ -157,7 +157,7 @@ switch ($action) {
$pageBottom = '<div class="question-return">'; $pageBottom = '<div class="question-return">';
$pageBottom .= Display::url( $pageBottom .= Display::url(
get_lang('BackToAttemptList'), get_lang('Back to the attempt list'),
api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$exercise_id.'&'.api_get_cidreq(), api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$exercise_id.'&'.api_get_cidreq(),
['class' => 'btn btn-primary'] ['class' => 'btn btn-primary']
); );

@ -4,7 +4,7 @@
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$categoryId = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : false; $categoryId = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : false;
if (empty($categoryId)) { if (empty($categoryId)) {
api_not_allowed(false); api_not_allowed(false);

@ -6,6 +6,8 @@ use Chamilo\CoreBundle\Entity\TicketMessageAttachment;
use Chamilo\CoreBundle\Entity\TicketPriority; use Chamilo\CoreBundle\Entity\TicketPriority;
use Chamilo\CoreBundle\Entity\TicketProject; use Chamilo\CoreBundle\Entity\TicketProject;
use Chamilo\CoreBundle\Entity\TicketStatus; use Chamilo\CoreBundle\Entity\TicketStatus;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLp;
/** /**
* Class TicketManager. * Class TicketManager.
@ -1183,6 +1185,8 @@ class TicketManager
ticket.id = $ticketId "; ticket.id = $ticketId ";
$result = Database::query($sql); $result = Database::query($sql);
$ticket = []; $ticket = [];
$repo = Container::getLpRepository();
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
while ($row = Database::fetch_assoc($result)) { while ($row = Database::fetch_assoc($result)) {
$row['course'] = null; $row['course'] = null;
@ -1231,7 +1235,8 @@ class TicketManager
$row['lp_url'] = null; $row['lp_url'] = null;
if (!empty($row['lp_id'])) { if (!empty($row['lp_id'])) {
$lpName = learnpath::getLpNameById($row['lp_id']); /** @var CLp $lp */
$lp = $repo->find($row['lp_id']);
$dataLp = [ $dataLp = [
'cidReq' => $course['code'], 'cidReq' => $course['code'],
'id_session' => $sessionId, 'id_session' => $sessionId,
@ -1240,7 +1245,10 @@ class TicketManager
]; ];
$urlParamsLp = http_build_query($dataLp); $urlParamsLp = http_build_query($dataLp);
$row['lp_url'] = '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.$urlParamsLp.'">'.$lpName.'</a>'; $row['lp_url'] = '<a
href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.$urlParamsLp.'">'.
$lp->getName().
'</a>';
} }
} }

@ -6267,7 +6267,7 @@ function api_get_bootstrap_and_font_awesome($returnOnlyPath = false)
{ {
$url = api_get_path(WEB_PUBLIC_PATH).'build/css/bootstrap.css'; $url = api_get_path(WEB_PUBLIC_PATH).'build/css/bootstrap.css';
if ($returnOnlyPath) { if ($returnOnlyPath) {
return $url; return api_get_path(SYS_PUBLIC_PATH).'build/css/bootstrap.css';
} }
return '<link href="'.$url.'" rel="stylesheet" type="text/css" />'."\n"; return '<link href="'.$url.'" rel="stylesheet" type="text/css" />'."\n";

@ -414,8 +414,6 @@ class PDF
); );
if (!empty($courseInfo['path'])) { if (!empty($courseInfo['path'])) {
//$document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
$doc = new DOMDocument(); $doc = new DOMDocument();
@$doc->loadHTML($document_html); @$doc->loadHTML($document_html);

@ -387,10 +387,10 @@ class SortableTable extends HTML_Table
$params = $this->get_sortable_table_param_string().'&amp;'.$this->get_additional_url_paramstring(); $params = $this->get_sortable_table_param_string().'&amp;'.$this->get_additional_url_paramstring();
$table_id = 'form_'.$this->table_name.'_id'; $table_id = 'form_'.$this->table_name.'_id';
$html = ''; $html = '';
$form = '';
if (false === $this->hideNavigation) { if (false === $this->hideNavigation) {
$form = $this->get_page_select_form(); $form = $this->get_page_select_form();
$nav = $this->get_navigation_html(); $nav = $this->get_navigation_html();
$html = '<div class="card-action">'; $html = '<div class="card-action">';
$html .= '<div class="row">'; $html .= '<div class="row">';
$html .= '<div class="col-12 col-md-4">'; $html .= '<div class="col-12 col-md-4">';
@ -769,7 +769,7 @@ class SortableTable extends HTML_Table
* Get the HTML-code which represents a form to select how many items a page * Get the HTML-code which represents a form to select how many items a page
* should contain. * should contain.
*/ */
public function get_page_select_form() public function get_page_select_form(): string
{ {
$total_number_of_items = $this->get_total_number_of_items(); $total_number_of_items = $this->get_total_number_of_items();
if ($total_number_of_items <= $this->default_items_per_page) { if ($total_number_of_items <= $this->default_items_per_page) {

@ -24,9 +24,6 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(); api_protect_course_script();
/**
* Display initialisation and security checks.
*/
// Extra javascript functions for in html head: // Extra javascript functions for in html head:
$htmlHeadXtra[] = "<script> $htmlHeadXtra[] = "<script>
function confirmation(name) { function confirmation(name) {
@ -69,7 +66,6 @@ $introduction = '';
$message = ''; $message = '';
$actions = ''; $actions = '';
$allowCategory = true; $allowCategory = true;
if (!empty($sessionId)) { if (!empty($sessionId)) {
$allowCategory = false; $allowCategory = false;

@ -34,7 +34,7 @@ if (!is_object($oLP)) {
exit; exit;
} }
/** @var learnpathItem $oItem */ /** @var learnpathItem $oItem */
$oItem = isset($oLP->items[$oLP->current]) ? $oLP->items[$oLP->current] : null; $oItem = $oLP->items[$oLP->current] ?? null;
if (!is_object($oItem)) { if (!is_object($oItem)) {
error_log('New LP - scorm_api - Could not load oItem item', 0); error_log('New LP - scorm_api - Could not load oItem item', 0);
@ -170,8 +170,10 @@ olms.lms_initialized = 0;
// commands received are executed on the *previous/current* item // commands received are executed on the *previous/current* item
// This flag is updated in LMSInitialize() and in switch_item() // This flag is updated in LMSInitialize() and in switch_item()
olms.switch_finished = 0; olms.switch_finished = 0;
olms.lms_view_id = '<?php echo $oLP->get_view(null, $userId); ?>'; olms.lms_view_id = '<?php echo $oLP->get_view(0, $userId); ?>';
if(olms.lms_view_id == ''){ olms.lms_view_id = 1;} if (olms.lms_view_id == '') {
olms.lms_view_id = 1;
}
olms.lms_user_id = '<?php echo $userId; ?>'; olms.lms_user_id = '<?php echo $userId; ?>';
olms.lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>'; olms.lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>';
olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>'; olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>';
@ -288,7 +290,7 @@ function LMSInitialize() {
}; };
$.ajax({ $.ajax({
type: "POST", type: "GET",
url: "lp_ajax_initialize.php" + courseUrl, url: "lp_ajax_initialize.php" + courseUrl,
data: params, data: params,
dataType: 'script', dataType: 'script',

@ -2,6 +2,8 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
ini_set('memory_limit', -1); ini_set('memory_limit', -1);
@ -43,7 +45,7 @@ function WSHelperVerifyKey($params)
// if we are behind a reverse proxy, assume it will send the // if we are behind a reverse proxy, assume it will send the
// HTTP_X_FORWARDED_FOR header and use this IP instead // HTTP_X_FORWARDED_FOR header and use this IP instead
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); [$ip1] = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$ip = trim($ip1); $ip = trim($ip1);
} }
if ($debug) { if ($debug) {
@ -457,7 +459,7 @@ function WSDeleteLp($params)
} }
*/ */
$lp = \Chamilo\CoreBundle\Framework\Container::getLpRepository()->find($lpId); $lp = Container::getLpRepository()->find($lpId);
$lp = new learnpath($lp, $lpId, null); $lp = new learnpath($lp, $lpId, null);
if ($lp) { if ($lp) {
if ($debug) { if ($debug) {
@ -469,7 +471,7 @@ function WSDeleteLp($params)
if (!empty($items)) { if (!empty($items)) {
/** @var $item learnpathItem */ /** @var $item learnpathItem */
foreach ($items as $itemId) { foreach ($items as $itemId) {
$item = new learnpathItem($itemId, null, $courseId); $item = new learnpathItem($lp, $itemId, $courseId);
if ($item) { if ($item) {
$documentId = $item->get_path(); $documentId = $item->get_path();

Loading…
Cancel
Save