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

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

@ -3,6 +3,8 @@
/* For licensing terms, see /license.txt */
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.
@ -354,16 +356,23 @@ if (isset($_REQUEST['comments']) &&
$statsTeacher
);
}
// Updating LP score here
if (!empty($lp_id) && !empty($lpItemId)) {
$lpRepo = Container::getLpRepository();
$lp = null;
if (!empty($lpId)) {
/** @var CLp $lp */
$lp = $lpRepo->find($lpId);
}
$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) {
$prereqId = $item->get_prereq_string();
$minScore = $item->getPrerequisiteMinScore();
$maxScore = $item->getPrerequisiteMaxScore();
$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);
if ($prereqCheck) {
$passed = true;

@ -157,7 +157,7 @@ switch ($action) {
$pageBottom = '<div class="question-return">';
$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(),
['class' => 'btn btn-primary']
);

@ -4,7 +4,7 @@
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)) {
api_not_allowed(false);

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

@ -414,8 +414,6 @@ class PDF
);
if (!empty($courseInfo['path'])) {
//$document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
$doc = new DOMDocument();
@$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();
$table_id = 'form_'.$this->table_name.'_id';
$html = '';
$form = '';
if (false === $this->hideNavigation) {
$form = $this->get_page_select_form();
$nav = $this->get_navigation_html();
$html = '<div class="card-action">';
$html .= '<div class="row">';
$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
* 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();
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();
/**
* Display initialisation and security checks.
*/
// Extra javascript functions for in html head:
$htmlHeadXtra[] = "<script>
function confirmation(name) {
@ -69,7 +66,6 @@ $introduction = '';
$message = '';
$actions = '';
$allowCategory = true;
if (!empty($sessionId)) {
$allowCategory = false;

@ -34,7 +34,7 @@ if (!is_object($oLP)) {
exit;
}
/** @var learnpathItem $oItem */
$oItem = isset($oLP->items[$oLP->current]) ? $oLP->items[$oLP->current] : null;
$oItem = $oLP->items[$oLP->current] ?? null;
if (!is_object($oItem)) {
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
// This flag is updated in LMSInitialize() and in switch_item()
olms.switch_finished = 0;
olms.lms_view_id = '<?php echo $oLP->get_view(null, $userId); ?>';
if(olms.lms_view_id == ''){ olms.lms_view_id = 1;}
olms.lms_view_id = '<?php echo $oLP->get_view(0, $userId); ?>';
if (olms.lms_view_id == '') {
olms.lms_view_id = 1;
}
olms.lms_user_id = '<?php echo $userId; ?>';
olms.lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>';
olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>';
@ -288,7 +290,7 @@ function LMSInitialize() {
};
$.ajax({
type: "POST",
type: "GET",
url: "lp_ajax_initialize.php" + courseUrl,
data: params,
dataType: 'script',

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

Loading…
Cancel
Save