Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 8 years ago
parent 06541ca20e
commit ddf46f7fca
  1. 28
      main/admin/access_url_edit_users_to_url.php
  2. 12
      main/document/slideshowoptions.php
  3. 112
      main/exercise/export/qti2/qti2_classes.php
  4. 26
      main/exercise/hotpotatoes_exercise_result.class.php
  5. 8
      main/exercise/hotspot_actionscript_admin.as.php
  6. 4
      main/exercise/hotspot_answers.as.php
  7. 12
      main/forum/editthread.php
  8. 10
      main/forum/reply.php
  9. 40
      main/forum/viewthread.php
  10. 4
      main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
  11. 20
      main/inc/lib/events.lib.php
  12. 4
      main/inc/lib/fileManage.lib.php
  13. 22
      main/inc/lib/formvalidator/FormValidator.class.php
  14. 114
      main/install/install.lib.php
  15. 32
      main/lp/lp_controller.php
  16. 58
      main/lp/openoffice_document.class.php
  17. 12
      main/lp/openoffice_presentation.class.php
  18. 44
      main/permissions/blog_permissions.inc.php
  19. 22
      main/reports/modules/quiz.php
  20. 4
      main/social/friends.php
  21. 26
      main/timeline/index.php
  22. 24
      plugin/bbb/listing.php
  23. 54
      plugin/buycourses/src/buy_course_plugin.class.php
  24. 6
      plugin/buycourses/src/process.php
  25. 10
      plugin/buycourses/src/sales_report.php
  26. 4
      plugin/buycourses/src/service_sales_report.php
  27. 26
      plugin/openmeetings/lib/openmeetings_rest_service.php
  28. 2
      plugin/vchamilo/views/syncparams.php
  29. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Wiki.php

@ -57,7 +57,7 @@ function add_user_to_url(code, content) {
function send() { function send() {
if (document.formulaire.access_url_id.value!=0) { if (document.formulaire.access_url_id.value!=0) {
document.formulaire.form_sent.value=0; document.formulaire.form_sent.value=0;
document.formulaire.add_type.value=\'' . $add_type . '\'; document.formulaire.add_type.value=\'' . $add_type.'\';
document.formulaire.submit(); document.formulaire.submit();
} }
} }
@ -93,17 +93,17 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$result = UrlManager::update_urls_rel_user($UserList, $access_url_id); $result = UrlManager::update_urls_rel_user($UserList, $access_url_id);
$url_info = UrlManager::get_url_data_from_id($access_url_id); $url_info = UrlManager::get_url_data_from_id($access_url_id);
if (!empty($result)) { if (!empty($result)) {
$message .= 'URL: ' . $url_info['url'] . '<br />'; $message .= 'URL: '.$url_info['url'].'<br />';
} }
if (!empty($result['users_added'])) { if (!empty($result['users_added'])) {
$message .= '<h4>' . get_lang('UsersAdded') . ':</h4>'; $message .= '<h4>'.get_lang('UsersAdded').':</h4>';
$i = 1; $i = 1;
$user_added_list = array(); $user_added_list = array();
foreach ($result['users_added'] as $user) { foreach ($result['users_added'] as $user) {
$user_info = api_get_user_info($user); $user_info = api_get_user_info($user);
if (!empty($user_info)) { if (!empty($user_info)) {
$user_added_list[] = $i . '. ' . api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, null, null, $user_info['username']); $user_added_list[] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, null, null, $user_info['username']);
$i++; $i++;
} }
} }
@ -113,13 +113,13 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
} }
if (!empty($result['users_deleted'])) { if (!empty($result['users_deleted'])) {
$message .= '<br /><h4>' . get_lang('UsersDeleted') . ': </h4>'; $message .= '<br /><h4>'.get_lang('UsersDeleted').': </h4>';
$user_deleted_list = array(); $user_deleted_list = array();
$i = 1; $i = 1;
foreach ($result['users_deleted'] as $user) { foreach ($result['users_deleted'] as $user) {
$user_info = api_get_user_info($user); $user_info = api_get_user_info($user);
if (!empty($user_info)) { if (!empty($user_info)) {
$user_deleted_list [] = $i . '. ' . api_get_person_name($user_info['firstname'], $user_info['lastname']); $user_deleted_list [] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
$i++; $i++;
} }
} }
@ -140,7 +140,7 @@ if (!empty($message)) {
echo '<div class="actions">'; echo '<div class="actions">';
echo Display::url( echo Display::url(
Display::return_icon('view_more_stats.gif', get_lang('AddUserToURL'), ''), Display::return_icon('view_more_stats.gif', get_lang('AddUserToURL'), ''),
api_get_path(WEB_CODE_PATH) . 'admin/access_url_add_users_to_url.php' api_get_path(WEB_CODE_PATH).'admin/access_url_add_users_to_url.php'
); );
echo '</div>'; echo '</div>';
@ -165,7 +165,7 @@ if ($ajax_search) {
} }
$sql = "SELECT u.user_id, lastname, firstname, username $sql = "SELECT u.user_id, lastname, firstname, username
FROM $tbl_user u WHERE status <> " . ANONYMOUS . " " . FROM $tbl_user u WHERE status <> ".ANONYMOUS." ".
$order_clause; $order_clause;
$result = Database::query($sql); $result = Database::query($sql);
$Users = Database::store_result($result); $Users = Database::store_result($result);
@ -178,11 +178,11 @@ if ($ajax_search) {
} }
if ($add_type == 'multiple') { if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="' . api_get_self() . '?add_type=unique&access_url_id=' . $access_url_id . '">' . get_lang('SessionAddTypeUnique') . '</a>'; $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_multiple = get_lang('SessionAddTypeMultiple'); $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
} else { } else {
$link_add_type_unique = get_lang('SessionAddTypeUnique'); $link_add_type_unique = get_lang('SessionAddTypeUnique');
$link_add_type_multiple = '<a href="' . api_get_self() . '?add_type=multiple&access_url_id=' . $access_url_id . '">' . get_lang('SessionAddTypeMultiple') . '</a>'; $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>';
} }
$url_list = UrlManager::get_url_data(); $url_list = UrlManager::get_url_data();
?> ?>
@ -194,7 +194,7 @@ $url_list = UrlManager::get_url_data();
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) { <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {
echo ' onsubmit="valide();"'; echo ' onsubmit="valide();"';
} ?> > } ?> >
<?php echo get_lang('SelectUrl') . ' : '; ?> <?php echo get_lang('SelectUrl').' : '; ?>
<select name="access_url_id" onchange="javascript:send();"> <select name="access_url_id" onchange="javascript:send();">
<option value="0"> <?php echo get_lang('SelectUrl') ?></option> <option value="0"> <?php echo get_lang('SelectUrl') ?></option>
<?php <?php
@ -240,7 +240,7 @@ if (!empty($errorMsg)) {
<td align="center"><b><?php echo get_lang('UserListInPlatform') ?> : <?php echo count($nosessionUsersList); ?></b> <td align="center"><b><?php echo get_lang('UserListInPlatform') ?> : <?php echo count($nosessionUsersList); ?></b>
</td> </td>
<td></td> <td></td>
<td align="center"><b><?php echo get_lang('UserListIn') . ' ' . $url_selected; ?> : <?php echo count($sessionUsersList); ?></b></td> <td align="center"><b><?php echo get_lang('UserListIn').' '.$url_selected; ?> : <?php echo count($sessionUsersList); ?></b></td>
</tr> </tr>
<tr> <tr>
<td align="center"> <td align="center">
@ -300,9 +300,9 @@ if (!empty($errorMsg)) {
<br /> <br />
<?php <?php
if (isset($_GET['add'])) { if (isset($_GET['add'])) {
echo '<button class="save" type="button" onclick="valide()" >' . get_lang('AddUsersToURL') . '</button>'; echo '<button class="save" type="button" onclick="valide()" >'.get_lang('AddUsersToURL').'</button>';
} else { } else {
echo '<button class="save" type="button" onclick="valide()" >' . get_lang('EditUsersToURL') . '</button>'; echo '<button class="save" type="button" onclick="valide()" >'.get_lang('EditUsersToURL').'</button>';
} }
?> ?>
</td> </td>

@ -39,7 +39,7 @@ $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
// bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array // bypass the $nametools thing and use <b></b> tags in the $interbreadcrump array
$url = 'slideshowoptions.php?curdirpath='.$pathurl; $url = 'slideshowoptions.php?curdirpath='.$pathurl;
$originaltoolname = '<b>'.get_lang('SlideshowOptions').'</b>'; $originaltoolname = '<b>'.get_lang('SlideshowOptions').'</b>';
$interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname ); $interbreadcrumb[] = array('url' => $url, 'name' => $originaltoolname);
Display::display_header($originaltoolname, 'Doc'); Display::display_header($originaltoolname, 'Doc');
$image_resizing = isset($_SESSION['image_resizing']) ? $_SESSION['image_resizing'] : null; $image_resizing = isset($_SESSION['image_resizing']) ? $_SESSION['image_resizing'] : null;
@ -63,8 +63,8 @@ window.onload = <?php echo $image_resizing == 'resizing' ? 'enableresizing' : 'd
</script> </script>
<?php <?php
$actions = '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; $actions = '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a href="slideshow.php?curdirpath='.$pathurl.'">'.Display::return_icon('slideshow.png',get_lang('BackTo').' '.get_lang('SlideShow'),'',ICON_SIZE_MEDIUM).'</a>'; $actions .= '<a href="slideshow.php?curdirpath='.$pathurl.'">'.Display::return_icon('slideshow.png', get_lang('BackTo').' '.get_lang('SlideShow'), '', ICON_SIZE_MEDIUM).'</a>';
echo Display::toolbarAction('toolbar-slideshow', [$actions]) echo Display::toolbarAction('toolbar-slideshow', [$actions])
?> ?>
<div class="panel panel-default"> <div class="panel panel-default">
@ -79,7 +79,7 @@ echo Display::toolbarAction('toolbar-slideshow', [$actions])
} }
?>> ?>>
</label> </label>
<?php echo '<b>'. get_lang('NoResizing') . '</b>, ' . get_lang('NoResizingComment') ;?> <?php echo '<b>'.get_lang('NoResizing').'</b>, '.get_lang('NoResizingComment'); ?>
</div> </div>
<div class="radio"> <div class="radio">
<label> <label>
@ -89,7 +89,7 @@ echo Display::toolbarAction('toolbar-slideshow', [$actions])
} }
?>> ?>>
</label> </label>
<?php echo '<b>'. get_lang('ResizingAuto') . '</b>, ' . get_lang('ResizingAutoComment');?> <?php echo '<b>'.get_lang('ResizingAuto').'</b>, '.get_lang('ResizingAutoComment'); ?>
</div> </div>
<div class="radio"> <div class="radio">
<label> <label>
@ -101,7 +101,7 @@ echo Display::toolbarAction('toolbar-slideshow', [$actions])
} }
?>> ?>>
</label> </label>
<?php echo '<b>'. get_lang('Resizing') . '</b>, ' . get_lang('ResizingComment'); ?> <?php echo '<b>'.get_lang('Resizing').'</b>, '.get_lang('ResizingComment'); ?>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-1 control-label"><?php echo get_lang('Width'); ?></label> <label class="col-sm-1 control-label"><?php echo get_lang('Width'); ?></label>

@ -77,21 +77,21 @@ class ImsAnswerMultipleChoice extends Answer
{ {
// @todo getAnswersList() converts the answers using api_html_entity_decode() // @todo getAnswersList() converts the answers using api_html_entity_decode()
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$out = ' <choiceInteraction responseIdentifier="' . $questionIdent . '" >' . "\n"; $out = ' <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";
$out .= ' <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment) . ']]></prompt>'. "\n"; $out .= ' <prompt><![CDATA['.formatExerciseQtiTitle($questionStatment).']]></prompt>'."\n";
if (is_array($this->answerList)) { if (is_array($this->answerList)) {
foreach ($this->answerList as $current_answer) { foreach ($this->answerList as $current_answer) {
$out .= '<simpleChoice identifier="answer_' . $current_answer['id'] . '" fixed="false"> $out .= '<simpleChoice identifier="answer_'.$current_answer['id'].'" fixed="false">
<![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>'; <![CDATA['.formatExerciseQtiTitle($current_answer['answer']).']]>';
if (isset($current_answer['comment']) && $current_answer['comment'] != '') { if (isset($current_answer['comment']) && $current_answer['comment'] != '') {
$out .= '<feedbackInline identifier="answer_' . $current_answer['id'] . '"> $out .= '<feedbackInline identifier="answer_'.$current_answer['id'].'">
<![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]> <![CDATA['.formatExerciseQtiTitle($current_answer['comment']).']]>
</feedbackInline>'; </feedbackInline>';
} }
$out .= '</simpleChoice>'. "\n"; $out .= '</simpleChoice>'."\n";
} }
} }
$out .= ' </choiceInteraction>'. "\n"; $out .= ' </choiceInteraction>'."\n";
return $out; return $out;
} }
@ -106,32 +106,32 @@ class ImsAnswerMultipleChoice extends Answer
$type = $this->getQuestionType(); $type = $this->getQuestionType();
if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single';
$out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n"; $out = ' <responseDeclaration identifier="'.$questionIdent.'" cardinality="'.$cardinality.'" baseType="identifier">'."\n";
// Match the correct answers. // Match the correct answers.
$out .= ' <correctResponse>'. "\n"; $out .= ' <correctResponse>'."\n";
if (is_array($this->answerList)) { if (is_array($this->answerList)) {
foreach($this->answerList as $current_answer) { foreach ($this->answerList as $current_answer) {
if ($current_answer['correct']) { if ($current_answer['correct']) {
$out .= ' <value>answer_'. $current_answer['id'] .'</value>'. "\n"; $out .= ' <value>answer_'.$current_answer['id'].'</value>'."\n";
} }
} }
} }
$out .= ' </correctResponse>'. "\n"; $out .= ' </correctResponse>'."\n";
//Add the grading //Add the grading
$out .= ' <mapping>'. "\n"; $out .= ' <mapping>'."\n";
if (is_array($this->answerList)) { if (is_array($this->answerList)) {
foreach($this->answerList as $current_answer) { foreach ($this->answerList as $current_answer) {
if (isset($current_answer['grade'])) { if (isset($current_answer['grade'])) {
$out .= ' <mapEntry mapKey="answer_'. $current_answer['id'] .'" mappedValue="'.$current_answer['grade'].'" />'. "\n"; $out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n";
} }
} }
} }
$out .= ' </mapping>'. "\n"; $out .= ' </mapping>'."\n";
$out .= ' </responseDeclaration>'. "\n"; $out .= ' </responseDeclaration>'."\n";
return $out; return $out;
} }
@ -158,7 +158,7 @@ class ImsAnswerFillInBlanks extends Answer
$key = $answer['id']; $key = $answer['id'];
$answer = $answer['answer']; $answer = $answer['answer'];
$len = api_strlen($answer); $len = api_strlen($answer);
$text = str_replace('['.$answer.']','<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text); $text = str_replace('['.$answer.']', '<textEntryInteraction responseIdentifier="fill_'.$key.'" expectedLength="'.api_strlen($answer).'"/>', $text);
} }
} }
$out = $text; $out = $text;
@ -178,17 +178,17 @@ class ImsAnswerFillInBlanks extends Answer
foreach ($this->answerList as $answer) { foreach ($this->answerList as $answer) {
$answerKey = $answer['id']; $answerKey = $answer['id'];
$answer = $answer['answer']; $answer = $answer['answer'];
$out .= ' <responseDeclaration identifier="fill_' . $answerKey . '" cardinality="single" baseType="identifier">' . "\n"; $out .= ' <responseDeclaration identifier="fill_'.$answerKey.'" cardinality="single" baseType="identifier">'."\n";
$out .= ' <correctResponse>'. "\n"; $out .= ' <correctResponse>'."\n";
$out .= ' <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'. "\n"; $out .= ' <value><![CDATA['.formatExerciseQtiTitle($answer).']]></value>'."\n";
$out .= ' </correctResponse>'. "\n"; $out .= ' </correctResponse>'."\n";
if (isset($this->gradeList[$answerKey])) { if (isset($this->gradeList[$answerKey])) {
$out .= ' <mapping>'. "\n"; $out .= ' <mapping>'."\n";
$out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'. "\n"; $out .= ' <mapEntry mapKey="'.$answer.'" mappedValue="'.$this->gradeList[$answerKey].'"/>'."\n";
$out .= ' </mapping>'. "\n"; $out .= ' </mapping>'."\n";
} }
$out .= ' </responseDeclaration>'. "\n"; $out .= ' </responseDeclaration>'."\n";
} }
} }
@ -210,11 +210,11 @@ class ImsAnswerMatching extends Answer
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$maxAssociation = max(count($this->leftList), count($this->rightList)); $maxAssociation = max(count($this->leftList), count($this->rightList));
$out = '<matchInteraction responseIdentifier="' . $questionIdent . '" maxAssociations="'. $maxAssociation .'">'. "\n"; $out = '<matchInteraction responseIdentifier="'.$questionIdent.'" maxAssociations="'.$maxAssociation.'">'."\n";
$out .= $questionStatment; $out .= $questionStatment;
//add left column //add left column
$out .= ' <simpleMatchSet>'. "\n"; $out .= ' <simpleMatchSet>'."\n";
if (is_array($this->leftList)) { if (is_array($this->leftList)) {
foreach ($this->leftList as $leftKey=>$leftElement) { foreach ($this->leftList as $leftKey=>$leftElement) {
$out .= ' $out .= '
@ -224,22 +224,22 @@ class ImsAnswerMatching extends Answer
} }
} }
$out .= ' </simpleMatchSet>'. "\n"; $out .= ' </simpleMatchSet>'."\n";
//add right column //add right column
$out .= ' <simpleMatchSet>'. "\n"; $out .= ' <simpleMatchSet>'."\n";
$i = 0; $i = 0;
if (is_array($this->rightList)) { if (is_array($this->rightList)) {
foreach($this->rightList as $rightKey=>$rightElement) { foreach ($this->rightList as $rightKey=>$rightElement) {
$out .= '<simpleAssociableChoice identifier="right_'.$i.'" > $out .= '<simpleAssociableChoice identifier="right_'.$i.'" >
<![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]> <![CDATA['.formatExerciseQtiTitle($rightElement['answer']).']]>
</simpleAssociableChoice>'. "\n"; </simpleAssociableChoice>'. "\n";
$i++; $i++;
} }
} }
$out .= ' </simpleMatchSet>'. "\n"; $out .= ' </simpleMatchSet>'."\n";
$out .= '</matchInteraction>'. "\n"; $out .= '</matchInteraction>'."\n";
return $out; return $out;
} }
@ -250,31 +250,31 @@ class ImsAnswerMatching extends Answer
public function imsExportResponsesDeclaration($questionIdent) public function imsExportResponsesDeclaration($questionIdent)
{ {
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="single" baseType="identifier">' . "\n"; $out = ' <responseDeclaration identifier="'.$questionIdent.'" cardinality="single" baseType="identifier">'."\n";
$out .= ' <correctResponse>' . "\n"; $out .= ' <correctResponse>'."\n";
$gradeArray = array(); $gradeArray = array();
if (isset($this->leftList) && is_array($this->leftList)) { if (isset($this->leftList) && is_array($this->leftList)) {
foreach ($this->leftList as $leftKey => $leftElement) { foreach ($this->leftList as $leftKey => $leftElement) {
$i=0; $i = 0;
foreach ($this->rightList as $rightKey=>$rightElement) { foreach ($this->rightList as $rightKey=>$rightElement) {
if (($leftElement['match'] == $rightElement['code'])) { if (($leftElement['match'] == $rightElement['code'])) {
$out .= ' <value>left_' . $leftKey . ' right_'.$i.'</value>'. "\n"; $out .= ' <value>left_'.$leftKey.' right_'.$i.'</value>'."\n";
$gradeArray['left_' . $leftKey . ' right_'.$i] = $leftElement['grade']; $gradeArray['left_'.$leftKey.' right_'.$i] = $leftElement['grade'];
} }
$i++; $i++;
} }
} }
} }
$out .= ' </correctResponse>'. "\n"; $out .= ' </correctResponse>'."\n";
$out .= ' <mapping>' . "\n"; $out .= ' <mapping>'."\n";
if (is_array($gradeArray)) { if (is_array($gradeArray)) {
foreach ($gradeArray as $gradeKey=>$grade) { foreach ($gradeArray as $gradeKey=>$grade) {
$out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>' . "\n"; $out .= ' <mapEntry mapKey="'.$gradeKey.'" mappedValue="'.$grade.'"/>'."\n";
} }
} }
$out .= ' </mapping>' . "\n"; $out .= ' </mapping>'."\n";
$out .= ' </responseDeclaration>'. "\n"; $out .= ' </responseDeclaration>'."\n";
return $out; return $out;
} }
@ -290,12 +290,12 @@ class ImsAnswerHotspot extends Answer
* TODO update this to match hot spots instead of copying matching * TODO update this to match hot spots instead of copying matching
* Export the question part as a matrix-choice, with only one possible answer per line. * Export the question part as a matrix-choice, with only one possible answer per line.
*/ */
public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
{ {
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia; $questionMedia = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/images/'.$questionMedia;
$mimetype = mime_content_type($questionMedia); $mimetype = mime_content_type($questionMedia);
if(empty($mimetype)){ if (empty($mimetype)) {
$mimetype = 'image/jpeg'; $mimetype = 'image/jpeg';
} }
@ -311,26 +311,26 @@ class ImsAnswerHotspot extends Answer
//coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663 //coords are transformed according to QTIv2 rules here: http://www.imsproject.org/question/qtiv2p1pd/imsqti_infov2p1pd.html#element10663
$coords = ''; $coords = '';
$type = 'default'; $type = 'default';
switch($answer['hotspot_type']){ switch ($answer['hotspot_type']) {
case 'square': case 'square':
$type = 'rect'; $type = 'rect';
$res = array(); $res = array();
$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res);
$coords = $res[1].','.$res[2].','.((int)$res[1]+(int)$res[3]).",".((int)$res[2]+(int)$res[4]); $coords = $res[1].','.$res[2].','.((int) $res[1] + (int) $res[3]).",".((int) $res[2] + (int) $res[4]);
break; break;
case 'circle': case 'circle':
$type = 'circle'; $type = 'circle';
$res = array(); $res = array();
$coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/',$answer['hotspot_coord'],$res); $coords = preg_match('/^\s*(\d+);(\d+)\|(\d+)\|(\d+)\s*$/', $answer['hotspot_coord'], $res);
$coords = $res[1].','.$res[2].','.sqrt(pow(($res[1]-$res[3]),2)+pow(($res[2]-$res[4]))); $coords = $res[1].','.$res[2].','.sqrt(pow(($res[1] - $res[3]), 2) + pow(($res[2] - $res[4])));
break; break;
case 'poly': case 'poly':
$type = 'poly'; $type = 'poly';
$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); $coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
break; break;
case 'delineation' : case 'delineation' :
$type = 'delineation'; $type = 'delineation';
$coords = str_replace(array(';','|'),array(',',','),$answer['hotspot_coord']); $coords = str_replace(array(';', '|'), array(',', ','), $answer['hotspot_coord']);
break; break;
} }
$text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n"; $text .= ' <hotspotChoice shape="'.$type.'" coords="'.$coords.'" identifier="'.$key.'"/>'."\n";
@ -350,8 +350,8 @@ class ImsAnswerHotspot extends Answer
$this->answerList = $this->getAnswersList(true); $this->answerList = $this->getAnswersList(true);
$this->gradeList = $this->getGradesList(); $this->gradeList = $this->getGradesList();
$out = ''; $out = '';
$out .= ' <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">' . "\n"; $out .= ' <responseDeclaration identifier="hotspot_'.$questionIdent.'" cardinality="ordered" baseType="identifier">'."\n";
$out .= ' <correctResponse>'. "\n"; $out .= ' <correctResponse>'."\n";
if (is_array($this->answerList)) { if (is_array($this->answerList)) {
foreach ($this->answerList as $answerKey=>$answer) { foreach ($this->answerList as $answerKey=>$answer) {
@ -360,8 +360,8 @@ class ImsAnswerHotspot extends Answer
$out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>'; $out .= '<value><![CDATA['.formatExerciseQtiTitle($answerKey).']]></value>';
} }
} }
$out .= ' </correctResponse>'. "\n"; $out .= ' </correctResponse>'."\n";
$out .= ' </responseDeclaration>'. "\n"; $out .= ' </responseDeclaration>'."\n";
return $out; return $out;
} }
@ -377,7 +377,7 @@ class ImsAnswerFree extends Answer
* TODO implement * TODO implement
* Export the question part as a matrix-choice, with only one possible answer per line. * Export the question part as a matrix-choice, with only one possible answer per line.
*/ */
public function imsExportResponses($questionIdent, $questionStatment, $questionDesc='', $questionMedia='') public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
{ {
return ''; return '';
} }

@ -30,7 +30,7 @@ class HotpotatoesExerciseResult
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
//$user_id = intval($user_id); //$user_id = intval($user_id);
$user_id = null; $user_id = null;
$session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' '; $session_id_and = ' AND te.session_id = '.api_get_session_id().' ';
$hotpotato_name = Database::escape_string($hotpotato_name); $hotpotato_name = Database::escape_string($hotpotato_name);
if (!empty($exercise_id)) { if (!empty($exercise_id)) {
@ -54,7 +54,7 @@ class HotpotatoesExerciseResult
$sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date $sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date
FROM $TBL_TRACK_HOTPOTATOES FROM $TBL_TRACK_HOTPOTATOES
WHERE WHERE
exe_user_id = '" . $user_id . "' AND exe_user_id = '".$user_id."' AND
c_id = $course_id AND c_id = $course_id AND
tth.exe_name = '$hotpotato_name' tth.exe_name = '$hotpotato_name'
ORDER BY c_id ASC, exe_date ASC"; ORDER BY c_id ASC, exe_date ASC";
@ -78,7 +78,7 @@ class HotpotatoesExerciseResult
for ($i = 0; $i < sizeof($hpresults); $i++) { for ($i = 0; $i < sizeof($hpresults); $i++) {
$return[$i] = array(); $return[$i] = array();
$title = GetQuizName($hpresults[$i]['exe_name'], $document_path); $title = GetQuizName($hpresults[$i]['exe_name'], $document_path);
if ($title =='') { if ($title == '') {
$title = basename($hpresults[$i]['exe_name']); $title = basename($hpresults[$i]['exe_name']);
} }
if (empty($user_id)) { if (empty($user_id)) {
@ -140,18 +140,18 @@ class HotpotatoesExerciseResult
// Results // Results
foreach ($this->results as $row) { foreach ($this->results as $row) {
if (api_is_western_name_order()) { if (api_is_western_name_order()) {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
} else { } else {
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';';
} }
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';';
$data .= str_replace("\r\n",' ',$row['exe_date']).';'; $data .= str_replace("\r\n", ' ', $row['exe_date']).';';
$data .= str_replace("\r\n",' ',$row['result']).';'; $data .= str_replace("\r\n", ' ', $row['result']).';';
$data .= str_replace("\r\n",' ',$row['max']).';'; $data .= str_replace("\r\n", ' ', $row['max']).';';
$data .= "\n"; $data .= "\n";
} }
@ -298,7 +298,7 @@ class HotpotatoesExerciseResult
$column++; $column++;
if (api_is_western_name_order()) { if (api_is_western_name_order()) {
$worksheet->setCellValueByColumnAndRow($column, $line,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); $worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset));
$column++; $column++;
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); $worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset));
$column++; $column++;

@ -10,7 +10,7 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(false); api_protect_course_script(false);
$isAllowedToEdit = api_is_allowed_to_edit(null,true); $isAllowedToEdit = api_is_allowed_to_edit(null, true);
if (!$isAllowedToEdit) { if (!$isAllowedToEdit) {
api_not_allowed(true); api_not_allowed(true);
@ -64,13 +64,13 @@ $answer_type = $objQuestion->type;
$answers = $_SESSION['tmp_answers']; $answers = $_SESSION['tmp_answers'];
$nbrAnswers = count($answers['answer']); $nbrAnswers = count($answers['answer']);
for ($i=1;$i <= $nbrAnswers; $i++) { for ($i = 1; $i <= $nbrAnswers; $i++) {
$hotSpot = []; $hotSpot = [];
$hotSpot['id'] = null; $hotSpot['id'] = null;
$hotSpot['answer']= $answers['answer'][$i]; $hotSpot['answer'] = $answers['answer'][$i];
if ($answer_type == HOT_SPOT_DELINEATION) { if ($answer_type == HOT_SPOT_DELINEATION) {
if ($i==1) { if ($i == 1) {
$hotSpot['type'] = 'delineation'; $hotSpot['type'] = 'delineation';
} else { } else {
$hotSpot['type'] = 'oar'; $hotSpot['type'] = 'oar';

@ -22,9 +22,9 @@ $objExercise = new Exercise(api_get_course_int_id());
$objExercise->read($trackExerciseInfo['exe_exo_id']); $objExercise->read($trackExerciseInfo['exe_exo_id']);
$em = Database::getManager(); $em = Database::getManager();
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$picturePath = $documentPath . '/images'; $picturePath = $documentPath.'/images';
$pictureName = $objQuestion->getPictureFilename(); $pictureName = $objQuestion->getPictureFilename();
$pictureSize = getimagesize($picturePath . '/' . $pictureName); $pictureSize = getimagesize($picturePath.'/'.$pictureName);
$pictureWidth = $pictureSize[0]; $pictureWidth = $pictureSize[0];
$pictureHeight = $pictureSize[1]; $pictureHeight = $pictureSize[1];
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();

@ -41,7 +41,7 @@ if (isset($_SESSION['gradebook'])) {
} }
if (!empty($gradebook) && $gradebook == 'view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
@ -104,7 +104,7 @@ if (!empty($groupId)) {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.$forumId, 'name' => $currentForum['forum_title']); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.$forumId, 'name' => $currentForum['forum_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.$forumId,'name' => get_lang('EditThread')); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.$forumId, 'name' => get_lang('EditThread'));
} else { } else {
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$currentForumCategory['cat_id'], 'name' => $currentForumCategory['cat_title']); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$currentForumCategory['cat_id'], 'name' => $currentForumCategory['cat_title']);
@ -153,10 +153,10 @@ $threadData = getThreadInfo($threadId, $cId);
$form = new FormValidator( $form = new FormValidator(
'thread', 'thread',
'post', 'post',
api_get_self() . '?' . http_build_query([ api_get_self().'?'.http_build_query([
'forum' => $forumId, 'forum' => $forumId,
'thread' => $threadId, 'thread' => $threadId,
]) . '&' . api_get_cidreq() ]).'&'.api_get_cidreq()
); );
$form->addElement('header', get_lang('EditThread')); $form->addElement('header', get_lang('EditThread'));
@ -202,7 +202,7 @@ if ((api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) &&
$form->addGroup( $form->addGroup(
$group, $group,
'', '',
[get_lang('ForumThreadPeerScoring'), get_lang('ForumThreadPeerScoringComment'),] [get_lang('ForumThreadPeerScoring'), get_lang('ForumThreadPeerScoringComment'), ]
); );
$form->addElement('html', '</div>'); $form->addElement('html', '</div>');
} }
@ -214,7 +214,7 @@ if ($forumSettings['allow_sticky'] && api_is_allowed_to_edit(null, true)) {
$form->addElement('html', '</div>'); $form->addElement('html', '</div>');
if (!empty($threadData)) { if (!empty($threadData)) {
$defaults['thread_qualify_gradebook'] = ($threadData['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0 ; $defaults['thread_qualify_gradebook'] = ($threadData['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0;
$defaults['thread_title'] = prepare4display($threadData['threadTitle']); $defaults['thread_title'] = prepare4display($threadData['threadTitle']);
$defaults['thread_sticky'] = strval(intval($threadData['threadSticky'])); $defaults['thread_sticky'] = strval(intval($threadData['threadSticky']));
$defaults['thread_peer_qualify'] = intval($threadData['threadPeerQualify']); $defaults['thread_peer_qualify'] = intval($threadData['threadPeerQualify']);

@ -32,8 +32,8 @@ $origin = api_get_origin();
require_once 'forumconfig.inc.php'; require_once 'forumconfig.inc.php';
require_once 'forumfunction.inc.php'; require_once 'forumfunction.inc.php';
$forumId = isset($_GET['forum']) ? (int)$_GET['forum'] : 0; $forumId = isset($_GET['forum']) ? (int) $_GET['forum'] : 0;
$threadId = isset($_GET['thread']) ? (int)$_GET['thread'] : 0; $threadId = isset($_GET['thread']) ? (int) $_GET['thread'] : 0;
/* MAIN DISPLAY SECTION */ /* MAIN DISPLAY SECTION */
@ -80,12 +80,12 @@ if ($current_forum['forum_of_group'] != 0) {
/* Breadcrumbs */ /* Breadcrumbs */
$gradebook = null; $gradebook = null;
if (isset($_SESSION['gradebook'])){ if (isset($_SESSION['gradebook'])) {
$gradebook = Security::remove_XSS($_SESSION['gradebook']); $gradebook = Security::remove_XSS($_SESSION['gradebook']);
} }
if (!empty($gradebook) && $gradebook == 'view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
@ -189,7 +189,7 @@ echo '<div class="forum_title">';
echo '<h1>'; echo '<h1>';
echo Display::url( echo Display::url(
prepare4display($current_forum['forum_title']), prepare4display($current_forum['forum_title']),
'viewforum.php?' . api_get_cidreq() . '&' . http_build_query(['forum' => $current_forum['forum_id']]), 'viewforum.php?'.api_get_cidreq().'&'.http_build_query(['forum' => $current_forum['forum_id']]),
['class' => empty($current_forum['visibility']) ? 'text-muted' : null] ['class' => empty($current_forum['visibility']) ? 'text-muted' : null]
); );
echo '</h1>'; echo '</h1>';

@ -46,8 +46,8 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
} }
if (!empty($gradebook) && $gradebook == 'view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
} }
@ -81,15 +81,15 @@ if (!empty($groupId)) {
'name' => get_lang('Groups') 'name' => get_lang('Groups')
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?' . api_get_cidreq(), 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace') . ' ' . $group_properties['name'] 'name' => get_lang('GroupSpace').' '.$group_properties['name']
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum=' . intval($_GET['forum']) . '&' . api_get_cidreq(). "&search=" . Security::remove_XSS(urlencode($my_search)), 'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum='.intval($_GET['forum']).'&'.api_get_cidreq()."&search=".Security::remove_XSS(urlencode($my_search)),
'name' => Security::remove_XSS($current_forum['forum_title']) 'name' => Security::remove_XSS($current_forum['forum_title'])
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?forum=' . intval($_GET['forum']) . '&' . api_get_cidreq(). '&thread=' . intval($_GET['thread']), 'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?forum='.intval($_GET['forum']).'&'.api_get_cidreq().'&thread='.intval($_GET['thread']),
'name' => Security::remove_XSS($current_thread['thread_title']) 'name' => Security::remove_XSS($current_thread['thread_title'])
); );
@ -100,15 +100,15 @@ if (!empty($groupId)) {
Display::display_reduced_header(); Display::display_reduced_header();
} else { } else {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&search=' . Security::remove_XSS(urlencode($my_search)), 'url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&search='.Security::remove_XSS(urlencode($my_search)),
'name' => $nameTools 'name' => $nameTools
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?forumcategory='. $current_forum_category['cat_id']. "&search=". Security::remove_XSS(urlencode($my_search)), 'url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?forumcategory='.$current_forum_category['cat_id']."&search=".Security::remove_XSS(urlencode($my_search)),
'name' => Security::remove_XSS($current_forum_category['cat_title']) 'name' => Security::remove_XSS($current_forum_category['cat_title'])
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.api_get_cidreq().'&forum=' . intval($_GET['forum']). "&search=". Security::remove_XSS(urlencode($my_search)), 'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.api_get_cidreq().'&forum='.intval($_GET['forum'])."&search=".Security::remove_XSS(urlencode($my_search)),
'name' => Security::remove_XSS($current_forum['forum_title']) 'name' => Security::remove_XSS($current_forum['forum_title'])
); );
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
@ -172,9 +172,9 @@ if ($my_message != 'PostDeletedSpecial') {
echo '<div class="actions">'; echo '<div class="actions">';
echo '<span style="float:right;">'.search_link().'</span>'; echo '<span style="float:right;">'.search_link().'</span>';
if ($origin != 'learnpath') { if ($origin != 'learnpath') {
echo '<a href="' . $forumUrl . 'viewforum.php?forum=' echo '<a href="'.$forumUrl.'viewforum.php?forum='
. intval($_GET['forum']) . '&' . api_get_cidreq() . '">' . intval($_GET['forum']).'&'.api_get_cidreq().'">'
. Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM) . '</a>'; . Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).'</a>';
} }
// The reply to thread link should only appear when the forum_category is // The reply to thread link should only appear when the forum_category is
// not locked AND the forum is not locked AND the thread is not locked. // not locked AND the forum is not locked AND the thread is not locked.
@ -189,9 +189,9 @@ if ($my_message != 'PostDeletedSpecial') {
if ($_user['user_id'] || ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) { if ($_user['user_id'] || ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) {
// reply link // reply link
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
echo '<a href="' . $forumUrl . 'reply.php?' . api_get_cidreq() . '&forum=' echo '<a href="'.$forumUrl.'reply.php?'.api_get_cidreq().'&forum='
. intval($_GET['forum']) . '&thread=' . intval($_GET['forum']).'&thread='
. intval($_GET['thread']) . '&action=replythread">' . intval($_GET['thread']).'&action=replythread">'
. Display::return_icon('reply_thread.png', get_lang('ReplyToThread'), '', ICON_SIZE_MEDIUM) . Display::return_icon('reply_thread.png', get_lang('ReplyToThread'), '', ICON_SIZE_MEDIUM)
. '</a>'; . '</a>';
} }
@ -214,13 +214,13 @@ if ($my_message != 'PostDeletedSpecial') {
// The different views of the thread. // The different views of the thread.
if ($origin != 'learnpath') { if ($origin != 'learnpath') {
$my_url = '<a href="' . $forumUrl . 'viewthread.php?' . api_get_cidreq() . '&' . api_get_cidreq() $my_url = '<a href="'.$forumUrl.'viewthread.php?'.api_get_cidreq().'&'.api_get_cidreq()
. '&forum=' . intval($_GET['forum']) . '&thread=' . intval($_GET['thread']) . '&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread'])
. '&search=' . Security::remove_XSS(urlencode($my_search)); . '&search='.Security::remove_XSS(urlencode($my_search));
echo $my_url . '&view=flat">' echo $my_url.'&view=flat">'
. Display::return_icon('forum_listview.png', get_lang('FlatView'), null, ICON_SIZE_MEDIUM) . Display::return_icon('forum_listview.png', get_lang('FlatView'), null, ICON_SIZE_MEDIUM)
. '</a>'; . '</a>';
echo $my_url . '&view=nested">' echo $my_url.'&view=nested">'
. Display::return_icon('forum_nestedview.png', get_lang('NestedView'), null, ICON_SIZE_MEDIUM) . Display::return_icon('forum_nestedview.png', get_lang('NestedView'), null, ICON_SIZE_MEDIUM)
. '</a>'; . '</a>';
} }

@ -44,10 +44,10 @@ class Accessurleditcoursestourl
' ORDER BY title, code '. ' ORDER BY title, code '.
' LIMIT 11'; ' LIMIT 11';
$rs = Database::query($sql); $rs = Database::query($sql);
$i=0; $i = 0;
while ($course = Database::fetch_array($rs)) { while ($course = Database::fetch_array($rs)) {
$i++; $i++;
if ($i<=10) { if ($i <= 10) {
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />'; $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />';
} else { } else {
$return .= '...<br />'; $return .= '...<br />';

@ -78,9 +78,7 @@ class Event
Database::query($sql); Database::query($sql);
// Auto subscribe // Auto subscribe
$user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student';
$userInfo['status'] == COURSEMANAGER ? 'teacher' :
$userInfo['status'] == DRH ? 'DRH' : 'student';
$autoSubscribe = api_get_setting($user_status.'_autosubscribe'); $autoSubscribe = api_get_setting($user_status.'_autosubscribe');
if ($autoSubscribe) { if ($autoSubscribe) {
$autoSubscribe = explode('|', $autoSubscribe); $autoSubscribe = explode('|', $autoSubscribe);
@ -337,7 +335,7 @@ class Event
global $debug; global $debug;
if ($debug) error_log('Called to update_event_exercice'); if ($debug) error_log('Called to update_event_exercice');
if ($debug) error_log('duration:' . $duration); if ($debug) error_log('duration:'.$duration);
if ($exeid != '') { if ($exeid != '') {
/* /*
@ -385,7 +383,7 @@ class Event
status = '".$status."', status = '".$status."',
questions_to_check = '".$remind_list."', questions_to_check = '".$remind_list."',
data_tracking = '".implode(',', $question_list)."', data_tracking = '".implode(',', $question_list)."',
user_ip = '" . Database::escape_string(api_get_real_ip()) . "' user_ip = '" . Database::escape_string(api_get_real_ip())."'
WHERE exe_id = '".Database::escape_string($exeid)."'"; WHERE exe_id = '".Database::escape_string($exeid)."'";
$res = Database::query($sql); $res = Database::query($sql);
@ -1069,15 +1067,15 @@ class Event
if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) { if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) {
$sql = "DELETE FROM $track_e_exercises $sql = "DELETE FROM $track_e_exercises
WHERE exe_id IN (" . implode(',', $exe_list) . ")"; WHERE exe_id IN (".implode(',', $exe_list).")";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $track_attempts $sql = "DELETE FROM $track_attempts
WHERE exe_id IN (" . implode(',', $exe_list) . ")"; WHERE exe_id IN (".implode(',', $exe_list).")";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM $recording_table $sql = "DELETE FROM $recording_table
WHERE exe_id IN (" . implode(',', $exe_list) . ")"; WHERE exe_id IN (".implode(',', $exe_list).")";
Database::query($sql); Database::query($sql);
} }
@ -1119,7 +1117,7 @@ class Event
self::addEvent( self::addEvent(
LOG_EXERCISE_RESULT_DELETE, LOG_EXERCISE_RESULT_DELETE,
LOG_EXERCISE_AND_USER_ID, LOG_EXERCISE_AND_USER_ID,
$exercise_id . '-' . $user_id, $exercise_id.'-'.$user_id,
null, null,
null, null,
$course_id, $course_id,
@ -1719,7 +1717,7 @@ class Event
self::addEvent( self::addEvent(
LOG_QUESTION_RESULT_DELETE, LOG_QUESTION_RESULT_DELETE,
LOG_EXERCISE_ATTEMPT_QUESTION_ID, LOG_EXERCISE_ATTEMPT_QUESTION_ID,
$exe_id . '-' . $question_id, $exe_id.'-'.$question_id,
null, null,
null, null,
$courseId, $courseId,
@ -1756,7 +1754,7 @@ class Event
self::addEvent( self::addEvent(
LOG_QUESTION_RESULT_DELETE, LOG_QUESTION_RESULT_DELETE,
LOG_EXERCISE_ATTEMPT_QUESTION_ID, LOG_EXERCISE_ATTEMPT_QUESTION_ID,
$exe_id . '-' . $question_id, $exe_id.'-'.$question_id,
null, null,
null, null,
$courseId, $courseId,

@ -197,11 +197,11 @@ function move($source, $target, $forceMove = true, $moveContent = false)
exec('mv '.$source.' '.$target.'/'.$file_name); exec('mv '.$source.' '.$target.'/'.$file_name);
} else { } else {
// Try copying // Try copying
copy($source, $target . '/' . $file_name); copy($source, $target.'/'.$file_name);
unlink($source); unlink($source);
} }
} else { } else {
copy($source, $target . '/' . $file_name); copy($source, $target.'/'.$file_name);
unlink($source); unlink($source);
} }
return true; return true;

@ -99,7 +99,7 @@ class FormValidator extends HTML_QuickForm
$renderer->setHeaderTemplate('<legend>{header}</legend>'); $renderer->setHeaderTemplate('<legend>{header}</legend>');
//Set required field template //Set required field template
$this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>'); $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>');
$noteTemplate = <<<EOT $noteTemplate = <<<EOT
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10">{requiredNote}</div> <div class="col-sm-offset-2 col-sm-10">{requiredNote}</div>
@ -942,7 +942,7 @@ EOT;
if ($geolocalization) { if ($geolocalization) {
$gmapsApiKey = $gMapsPlugin->get('api_key'); $gmapsApiKey = $gMapsPlugin->get('api_key');
$this->addHtml('<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key='. $gmapsApiKey . '" ></script>'); $this->addHtml('<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key='.$gmapsApiKey.'" ></script>');
} }
$this->addElement( $this->addElement(
'text', 'text',
@ -980,7 +980,7 @@ EOT;
if (typeof google === "object") { if (typeof google === "object") {
var address = $("#' . $name . '").val(); var address = $("#' . $name.'").val();
initializeGeo'.$name.'(address, false); initializeGeo'.$name.'(address, false);
$("#geolocalization_'.$name.'").on("click", function() { $("#geolocalization_'.$name.'").on("click", function() {
@ -1002,7 +1002,7 @@ EOT;
}); });
} else { } else {
$("#map_'.$name.'").html("<div class=\"alert alert-info\">' . get_lang('YouNeedToActivateTheGoogleMapsPluginInAdminPlatformToSeeTheMap') . '</div>"); $("#map_'.$name.'").html("<div class=\"alert alert-info\">'.get_lang('YouNeedToActivateTheGoogleMapsPluginInAdminPlatformToSeeTheMap').'</div>");
} }
}); });
@ -1017,7 +1017,7 @@ EOT;
}; };
var geoError = function(error) { var geoError = function(error) {
alert("Geocode ' . get_lang('Error') . ': " + error); alert("Geocode ' . get_lang('Error').': " + error);
}; };
var geoOptions = { var geoOptions = {
@ -1068,11 +1068,11 @@ EOT;
infowindow.open(map_'.$name.', marker); infowindow.open(map_'.$name.', marker);
}); });
} else { } else {
alert("' . get_lang("NotFound") . '"); alert("' . get_lang("NotFound").'");
} }
} else { } else {
alert("Geocode ' . get_lang('Error') . ': ' . get_lang("AddressField") . ' ' . get_lang("NotFound") . '"); alert("Geocode ' . get_lang('Error').': '.get_lang("AddressField").' '.get_lang("NotFound").'");
} }
}); });
} }
@ -1107,8 +1107,8 @@ EOT;
$this->with_progress_bar = true; $this->with_progress_bar = true;
$id = $this->getAttribute('id'); $id = $this->getAttribute('id');
$this->updateAttributes("onsubmit=\"javascript: addProgress('" . $id . "')\""); $this->updateAttributes("onsubmit=\"javascript: addProgress('".$id."')\"");
$this->addHtml('<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); $this->addHtml('<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>');
} }
/** /**
@ -1681,7 +1681,7 @@ EOT;
.attr('target', '_blank') .attr('target', '_blank')
.prop('href', file.url); .prop('href', file.url);
$(data.context.children()[index]).parent().wrap(link); $(data.context.children()[index]).parent().wrap(link);
var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded')) . "')); var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded'))."'));
$(data.context.children()[index]).parent().append(successMessage); $(data.context.children()[index]).parent().append(successMessage);
} else if (file.error) { } else if (file.error) {
var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(file.error)); var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(file.error));
@ -1691,7 +1691,7 @@ EOT;
$('#dropzone').removeClass('hover'); $('#dropzone').removeClass('hover');
}).on('fileuploadfail', function (e, data) { }).on('fileuploadfail', function (e, data) {
$.each(data.files, function (index) { $.each(data.files, function (index) {
var failedMessage = '" . addslashes(get_lang('UplUploadFailed')) . "'; var failedMessage = '" . addslashes(get_lang('UplUploadFailed'))."';
var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(failedMessage)); var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(failedMessage));
$(data.context.children()[index]).parent().append(error); $(data.context.children()[index]).parent().append(error);
}); });

@ -411,7 +411,7 @@ function & get_language_folder_list()
if (!is_array($result)) { if (!is_array($result)) {
$result = array(); $result = array();
$exceptions = array('.', '..', 'CVS', '.svn'); $exceptions = array('.', '..', 'CVS', '.svn');
$search = array('_latin', '_unicode', '_corporate', '_org' , '_KM', '_'); $search = array('_latin', '_unicode', '_corporate', '_org', '_KM', '_');
$replace_with = array(' (Latin)', ' (unicode)', ' (corporate)', ' (org)', ' (KM)', ' '); $replace_with = array(' (Latin)', ' (unicode)', ' (corporate)', ' (org)', ' (KM)', ' ');
$dirname = api_get_path(SYS_LANG_PATH); $dirname = api_get_path(SYS_LANG_PATH);
$handle = opendir($dirname); $handle = opendir($dirname);
@ -446,9 +446,9 @@ function my_directory_to_array($directory)
if ($handle = opendir($directory)) { if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") { if ($file != "." && $file != "..") {
if (is_dir($directory. "/" . $file)) { if (is_dir($directory."/".$file)) {
$array_items = array_merge($array_items, my_directory_to_array($directory. '/' . $file)); $array_items = array_merge($array_items, my_directory_to_array($directory.'/'.$file));
$file = $directory . "/" . $file; $file = $directory."/".$file;
$array_items[] = preg_replace("/\/\//si", '/', $file); $array_items[] = preg_replace("/\/\//si", '/', $file);
} }
} }
@ -493,7 +493,7 @@ function get_config_param($param, $updatePath = '')
// try to recover config file from Chamilo 1.9.x // try to recover config file from Chamilo 1.9.x
if (file_exists($updatePath.'main/inc/conf/configuration.php')) { if (file_exists($updatePath.'main/inc/conf/configuration.php')) {
$updateFromConfigFile = 'main/inc/conf/configuration.php'; $updateFromConfigFile = 'main/inc/conf/configuration.php';
} elseif (file_exists($updatePath . 'app/config/configuration.php')) { } elseif (file_exists($updatePath.'app/config/configuration.php')) {
$updateFromConfigFile = 'app/config/configuration.php'; $updateFromConfigFile = 'app/config/configuration.php';
} else { } else {
// Give up recovering. // Give up recovering.
@ -654,7 +654,7 @@ function display_language_selection()
<h2><?php get_lang('WelcomeToTheChamiloInstaller'); ?></h2> <h2><?php get_lang('WelcomeToTheChamiloInstaller'); ?></h2>
<div class="RequirementHeading"> <div class="RequirementHeading">
<h2><?php echo display_step_sequence(); ?> <h2><?php echo display_step_sequence(); ?>
<?php echo get_lang('InstallationLanguage');?> <?php echo get_lang('InstallationLanguage'); ?>
</h2> </h2>
<p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p> <p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p>
<form id="lang_form" method="post" action="<?php echo api_get_self(); ?>"> <form id="lang_form" method="post" action="<?php echo api_get_self(); ?>">
@ -713,9 +713,9 @@ function display_requirements(
if (!$properlyAccessUrl) { if (!$properlyAccessUrl) {
echo ' echo '
<div class="alert alert-danger"> <div class="alert alert-danger">
' . Display::return_icon('error.png', get_lang('Error'), [], ICON_SIZE_MEDIUM, true, false, true) . ' . Display::return_icon('error.png', get_lang('Error'), [], ICON_SIZE_MEDIUM, true, false, true).
' ' . ' '.
sprintf(get_lang('InstallMultiURLDetectedNotMainURL'), api_get_configuration_value('root_web')) . ' sprintf(get_lang('InstallMultiURLDetectedNotMainURL'), api_get_configuration_value('root_web')).'
</div> </div>
'; ';
} }
@ -747,7 +747,7 @@ function display_requirements(
if (phpversion() < REQUIRED_PHP_VERSION) { if (phpversion() < REQUIRED_PHP_VERSION) {
echo '<strong><font color="red">'.get_lang('PHPVersionError').'</font></strong>'; echo '<strong><font color="red">'.get_lang('PHPVersionError').'</font></strong>';
} else { } else {
echo '<strong><font color="green">'.get_lang('PHPVersionOK'). ' '.phpversion().'</font></strong>'; echo '<strong><font color="green">'.get_lang('PHPVersionOK').' '.phpversion().'</font></strong>';
} }
echo '</td> echo '</td>
</tr> </tr>
@ -1105,9 +1105,9 @@ function display_requirements(
} }
$deprecated = [ $deprecated = [
api_get_path(SYS_CODE_PATH) . 'exercice/', api_get_path(SYS_CODE_PATH).'exercice/',
api_get_path(SYS_CODE_PATH) . 'newscorm/', api_get_path(SYS_CODE_PATH).'newscorm/',
api_get_path(SYS_PLUGIN_PATH) . 'ticket/' api_get_path(SYS_PLUGIN_PATH).'ticket/'
]; ];
$deprecatedToRemove = []; $deprecatedToRemove = [];
@ -1217,7 +1217,7 @@ function display_license_agreement()
function get_contact_registration_form() function get_contact_registration_form()
{ {
$html =' $html = '
<div class="form-horizontal"> <div class="form-horizontal">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
@ -1314,7 +1314,7 @@ function get_contact_registration_form()
<div class="col-sm-9"> <div class="col-sm-9">
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes') . ' <input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes').'
</label> </label>
</div> </div>
<div class="radio"> <div class="radio">
@ -1373,8 +1373,8 @@ function displayDatabaseParameter(
echo '<input type="hidden" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />'; echo '<input type="hidden" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />';
echo api_htmlentities($parameterValue); echo api_htmlentities($parameterValue);
} else { } else {
echo '<div class="col-sm-5"><input type="' . $inputType . '" class="form-control" size="' . DATABASE_FORM_FIELD_DISPLAY_LENGTH . '" maxlength="' . $maxLength . '" name="' . $formFieldName . '" id="' . $formFieldName . '" value="' . api_htmlentities($parameterValue) . '" />' . "</div>"; echo '<div class="col-sm-5"><input type="'.$inputType.'" class="form-control" size="'.DATABASE_FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.$maxLength.'" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />'."</div>";
echo '<div class="col-sm-3">' . $extra_notice . '</div>'; echo '<div class="col-sm-3">'.$extra_notice.'</div>';
} }
} }
} }
@ -1408,12 +1408,12 @@ function display_database_settings_form(
$dbNameForm = $_configuration['main_database']; $dbNameForm = $_configuration['main_database'];
$dbPortForm = isset($_configuration['db_port']) ? $_configuration['db_port'] : ''; $dbPortForm = isset($_configuration['db_port']) ? $_configuration['db_port'] : '';
echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>'; echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>';
echo '<div class="RequirementContent">'; echo '<div class="RequirementContent">';
echo get_lang('DBSettingUpgradeIntro'); echo get_lang('DBSettingUpgradeIntro');
echo '</div>'; echo '</div>';
} else { } else {
echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>'; echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>';
echo '<div class="RequirementContent">'; echo '<div class="RequirementContent">';
echo get_lang('DBSettingIntro'); echo get_lang('DBSettingIntro');
echo '</div>'; echo '</div>';
@ -1423,12 +1423,12 @@ function display_database_settings_form(
<div class="panel-body"> <div class="panel-body">
<div class="form-group"> <div class="form-group">
<label class="col-sm-4"><?php echo get_lang('DBHost'); ?> </label> <label class="col-sm-4"><?php echo get_lang('DBHost'); ?> </label>
<?php if ($installType == 'update'){ ?> <?php if ($installType == 'update') { ?>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?> <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?>
</div> </div>
<div class="col-sm-3"></div> <div class="col-sm-3"></div>
<?php }else{ ?> <?php } else { ?>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /> <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" />
</div> </div>
@ -1437,12 +1437,12 @@ function display_database_settings_form(
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-4"><?php echo get_lang('DBPort'); ?> </label> <label class="col-sm-4"><?php echo get_lang('DBPort'); ?> </label>
<?php if ($installType == 'update'){ ?> <?php if ($installType == 'update') { ?>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?> <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?>
</div> </div>
<div class="col-sm-3"></div> <div class="col-sm-3"></div>
<?php }else{ ?> <?php } else { ?>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /> <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" />
</div> </div>
@ -1468,7 +1468,7 @@ function display_database_settings_form(
<?php <?php
//Database Name fix replace weird chars //Database Name fix replace weird chars
if ($installType != INSTALL_TYPE_UPDATE) { if ($installType != INSTALL_TYPE_UPDATE) {
$dbNameForm = str_replace(array('-','*', '$', ' ', '.'), '', $dbNameForm); $dbNameForm = str_replace(array('-', '*', '$', ' ', '.'), '', $dbNameForm);
} }
displayDatabaseParameter( displayDatabaseParameter(
@ -1561,7 +1561,7 @@ function panel($content = null, $title = null, $id = null, $style = null) {
if (!empty($title)) { if (!empty($title)) {
$panelTitle = Display::div($title, array('class' => 'panel-heading')); $panelTitle = Display::div($title, array('class' => 'panel-heading'));
$panelBody = Display::div($content, array('class' => 'panel-body')); $panelBody = Display::div($content, array('class' => 'panel-body'));
$panelParent = Display::div($panelTitle . $panelBody, array('id' => $id, 'class' => 'panel panel-'.$style)); $panelParent = Display::div($panelTitle.$panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
} else { } else {
$panelBody = Display::div($html, array('class' => 'panel-body')); $panelBody = Display::div($html, array('class' => 'panel-body'));
$panelParent = Display::div($panelBody, array('id' => $id, 'class' => 'panel panel-'.$style)); $panelParent = Display::div($panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
@ -1587,9 +1587,9 @@ function display_configuration_parameter(
$displayWhenUpdate = 'true' $displayWhenUpdate = 'true'
) { ) {
$html = '<div class="form-group">'; $html = '<div class="form-group">';
$html .= '<label class="col-sm-6 control-label">' . $parameterName . '</label>'; $html .= '<label class="col-sm-6 control-label">'.$parameterName.'</label>';
if ($installType == INSTALL_TYPE_UPDATE && $displayWhenUpdate) { if ($installType == INSTALL_TYPE_UPDATE && $displayWhenUpdate) {
$html .= '<input type="hidden" name="' . $formFieldName . '" value="'. api_htmlentities($parameterValue, ENT_QUOTES). '" />' . $parameterValue; $html .= '<input type="hidden" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'.$parameterValue;
} else { } else {
$html .= '<div class="col-sm-6"><input class="form-control" type="text" size="'.FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.MAX_FORM_FIELD_LENGTH.'" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'."</div>"; $html .= '<div class="col-sm-6"><input class="form-control" type="text" size="'.FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.MAX_FORM_FIELD_LENGTH.'" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'."</div>";
} }
@ -1637,7 +1637,7 @@ function display_configuration_settings_form(
$languageForm = $_SESSION['install_language']; $languageForm = $_SESSION['install_language'];
} }
echo '<div class="RequirementHeading">'; echo '<div class="RequirementHeading">';
echo "<h2>" . display_step_sequence() . get_lang("CfgSetting") . "</h2>"; echo "<h2>".display_step_sequence().get_lang("CfgSetting")."</h2>";
echo '</div>'; echo '</div>';
echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>app/config/configuration.php</strong></p>'; echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>app/config/configuration.php</strong></p>';
@ -1681,12 +1681,12 @@ function display_configuration_settings_form(
$html .= display_language_selection_box('languageForm', $languageForm); $html .= display_language_selection_box('languageForm', $languageForm);
$html .= '</div>'; $html .= '</div>';
} }
$html.= "</div>"; $html .= "</div>";
//Second parameter: Chamilo URL //Second parameter: Chamilo URL
$html .= '<div class="form-group">'; $html .= '<div class="form-group">';
$html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL') .get_lang('ThisFieldIsRequired').'</label>'; $html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL').get_lang('ThisFieldIsRequired').'</label>';
@ -1710,34 +1710,34 @@ function display_configuration_settings_form(
$html .= '<div class="form-group"> $html .= '<div class="form-group">
<label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass") . '</label> <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass").'</label>
<div class="col-sm-6">'; <div class="col-sm-6">';
if ($installType == 'update') { if ($installType == 'update') {
$html .= '<input type="hidden" name="encryptPassForm" value="'. $encryptPassForm .'" />'. $encryptPassForm; $html .= '<input type="hidden" name="encryptPassForm" value="'.$encryptPassForm.'" />'.$encryptPassForm;
} else { } else {
$html .= '<div class="checkbox"> $html .= '<div class="checkbox">
<label> <label>
<input type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ':'') .'/> bcrypt <input type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ' : '').'/> bcrypt
</label>'; </label>';
$html .= '<label> $html .= '<label>
<input type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ':'') .'/> sha1 <input type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ' : '').'/> sha1
</label>'; </label>';
$html .= '<label> $html .= '<label>
<input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ':'') .'/> md5 <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ' : '').'/> md5
</label>'; </label>';
$html .= '<label> $html .= '<label>
<input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ':'') .'/>'. get_lang('None').' <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ' : '').'/>'.get_lang('None').'
</label>'; </label>';
$html .= '</div>'; $html .= '</div>';
} }
$html .= '</div></div>'; $html .= '</div></div>';
$html .= '<div class="form-group"> $html .= '<div class="form-group">
<label class="col-sm-6 control-label">' . get_lang('AllowSelfReg') . '</label> <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg').'</label>
<div class="col-sm-6">'; <div class="col-sm-6">';
if ($installType == 'update') { if ($installType == 'update') {
if ($allowSelfReg == 'true') { if ($allowSelfReg == 'true') {
@ -1747,17 +1747,17 @@ function display_configuration_settings_form(
} else { } else {
$label = get_lang('AfterApproval'); $label = get_lang('AfterApproval');
} }
$html .= '<input type="hidden" name="allowSelfReg" value="'. $allowSelfReg .'" />'. $label; $html .= '<input type="hidden" name="allowSelfReg" value="'.$allowSelfReg.'" />'.$label;
} else { } else {
$html .= '<div class="control-group">'; $html .= '<div class="control-group">';
$html .= '<label class="checkbox-inline"> $html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="true" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '') . ' /> '. get_lang('Yes') .' <input type="radio" name="allowSelfReg" value="true" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '').' /> '.get_lang('Yes').'
</label>'; </label>';
$html .= '<label class="checkbox-inline"> $html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="false" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .' <input type="radio" name="allowSelfReg" value="false" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ').' /> '.get_lang('No').'
</label>'; </label>';
$html .= '<label class="checkbox-inline"> $html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="approval" id="allowSelfReg2" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .' <input type="radio" name="allowSelfReg" value="approval" id="allowSelfReg2" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ').' /> '.get_lang('AfterApproval').'
</label>'; </label>';
$html .= '</div>'; $html .= '</div>';
} }
@ -1765,7 +1765,7 @@ function display_configuration_settings_form(
$html .= '</div>'; $html .= '</div>';
$html .= '<div class="form-group">'; $html .= '<div class="form-group">';
$html .= '<label class="col-sm-6 control-label">'. get_lang('AllowSelfRegProf') .'</label> $html .= '<label class="col-sm-6 control-label">'.get_lang('AllowSelfRegProf').'</label>
<div class="col-sm-6">'; <div class="col-sm-6">';
if ($installType == 'update') { if ($installType == 'update') {
if ($allowSelfRegProf == 'true') { if ($allowSelfRegProf == 'true') {
@ -1773,16 +1773,16 @@ function display_configuration_settings_form(
} else { } else {
$label = get_lang('No'); $label = get_lang('No');
} }
$html .= '<input type="hidden" name="allowSelfRegProf" value="'. $allowSelfRegProf.'" />'. $label; $html .= '<input type="hidden" name="allowSelfRegProf" value="'.$allowSelfRegProf.'" />'.$label;
} else { } else {
$html .= '<div class="control-group"> $html .= '<div class="control-group">
<label class="checkbox-inline"> <label class="checkbox-inline">
<input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '') .'/> <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '').'/>
' . get_lang('Yes') .' ' . get_lang('Yes').'
</label>'; </label>';
$html .= '<label class="checkbox-inline"> $html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ') .' /> <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ').' />
'. get_lang('No') .' '. get_lang('No').'
</label>'; </label>';
$html .= '</div>'; $html .= '</div>';
} }
@ -1847,7 +1847,7 @@ function get_countries_list_from_array($combo = false)
"Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar",
"Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway",
"Oman", "Oman",
"Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland","Portugal", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal",
"Qatar", "Qatar",
"Romania", "Russia", "Rwanda", "Romania", "Russia", "Rwanda",
"Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria",
@ -1894,11 +1894,11 @@ function updateDirAndFilesPermissions()
$permissions_for_new_directories = isset($_SESSION['permissions_for_new_directories']) ? $_SESSION['permissions_for_new_directories'] : 0770; $permissions_for_new_directories = isset($_SESSION['permissions_for_new_directories']) ? $_SESSION['permissions_for_new_directories'] : 0770;
$permissions_for_new_files = isset($_SESSION['permissions_for_new_files']) ? $_SESSION['permissions_for_new_files'] : 0660; $permissions_for_new_files = isset($_SESSION['permissions_for_new_files']) ? $_SESSION['permissions_for_new_files'] : 0660;
// use decoct() to store as string // use decoct() to store as string
$sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_directories) . "' $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_directories)."'
WHERE variable = 'permissions_for_new_directories'"; WHERE variable = 'permissions_for_new_directories'";
Database::query($sql); Database::query($sql);
$sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_files) . "' WHERE variable = 'permissions_for_new_files'"; $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_files)."' WHERE variable = 'permissions_for_new_files'";
Database::query($sql); Database::query($sql);
if (isset($_SESSION['permissions_for_new_directories'])) { if (isset($_SESSION['permissions_for_new_directories'])) {
@ -1918,8 +1918,8 @@ function updateDirAndFilesPermissions()
function compare_setting_values($current_value, $wanted_value) function compare_setting_values($current_value, $wanted_value)
{ {
$current_value_string = $current_value; $current_value_string = $current_value;
$current_value = (float)$current_value; $current_value = (float) $current_value;
$wanted_value = (float)$wanted_value; $wanted_value = (float) $wanted_value;
if ($current_value >= $wanted_value) { if ($current_value >= $wanted_value) {
return Display::label($current_value_string, 'success'); return Display::label($current_value_string, 'success');
@ -1983,7 +1983,7 @@ function check_course_script_interpretation($course_dir, $course_attempt_name, $
fwrite($fp, $out); fwrite($fp, $out);
while (!feof($fp)) { while (!feof($fp)) {
$result = str_replace("\r\n", '',fgets($fp, 128)); $result = str_replace("\r\n", '', fgets($fp, 128));
if (!empty($result) && $result == '123') { if (!empty($result) && $result == '123') {
$output = true; $output = true;
} }
@ -2006,7 +2006,7 @@ function check_course_script_interpretation($course_dir, $course_attempt_name, $
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
//curl_setopt($ch, CURLOPT_TIMEOUT, 30); //curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec ($ch); $result = curl_exec($ch);
if (!empty($result) && $result == '123') { if (!empty($result) && $result == '123') {
$output = true; $output = true;
} }
@ -2860,7 +2860,7 @@ function finishInstallation(
$adminPhoneForm, $adminPhoneForm,
'', //$picture_uri = '', '', //$picture_uri = '',
PLATFORM_AUTH_SOURCE, PLATFORM_AUTH_SOURCE,
'',//$expirationDate, '', //$expirationDate,
1, 1,
0, 0,
null, null,
@ -2922,7 +2922,7 @@ function finishInstallation(
Database::query($sql); Database::query($sql);
foreach ($files as $version) { foreach ($files as $version) {
$version = str_replace(['Version', '.php' ], '', $version->getFilename()); $version = str_replace(['Version', '.php'], '', $version->getFilename());
$sql = "INSERT INTO version (version) VALUES ('$version')"; $sql = "INSERT INTO version (version) VALUES ('$version')";
Database::query($sql); Database::query($sql);
} }
@ -2968,7 +2968,7 @@ function installProfileSettings($installationProfile = '')
SET selected_value = '".$param->selected_value."' SET selected_value = '".$param->selected_value."'
WHERE variable = '".$param->variable."'"; WHERE variable = '".$param->variable."'";
if (!empty($param->subkey)) { if (!empty($param->subkey)) {
$sql .= " AND subkey='" . $param->subkey . "'"; $sql .= " AND subkey='".$param->subkey."'";
} }
Database::query($sql); Database::query($sql);
} }

@ -39,11 +39,11 @@ if ($showGlossary) {
) { ) {
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
<!-- <!--
var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path() . '\'; var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path().'\';
--> -->
</script>'; </script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
} }
} }
@ -248,7 +248,7 @@ if (isset($_SESSION['lpobject'])) {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($debug>0) error_log('New LP - Passed data remains check', 0); if ($debug > 0) error_log('New LP - Passed data remains check', 0);
if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) { if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
@ -272,7 +272,7 @@ if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $
if (Database::num_rows($res)) { if (Database::num_rows($res)) {
$row = Database::fetch_array($res); $row = Database::fetch_array($res);
$type = $row['lp_type']; $type = $row['lp_type'];
if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); if ($debug > 0) error_log('New LP - found row - type '.$type.' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
switch ($type) { switch ($type) {
case 1: case 1:
if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
@ -707,8 +707,8 @@ switch ($action) {
$editPrerequisite = $_SESSION['oLP']->edit_item_prereq( $editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
$_GET['id'], $_GET['id'],
$_POST['prerequisites'], $_POST['prerequisites'],
$_POST['min_' . $_POST['prerequisites']], $_POST['min_'.$_POST['prerequisites']],
$_POST['max_' . $_POST['prerequisites']] $_POST['max_'.$_POST['prerequisites']]
); );
if ($editPrerequisite) { if ($editPrerequisite) {
@ -1148,8 +1148,8 @@ switch ($action) {
error_log('New LP - No learnpath given for view', 0); error_log('New LP - No learnpath given for view', 0);
require 'lp_list.php'; require 'lp_list.php';
} else { } else {
if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); } if ($debug > 0) {error_log('New LP - Trying to set current item to '.$_REQUEST['item_id'], 0); }
if ( !empty($_REQUEST['item_id']) ) { if (!empty($_REQUEST['item_id'])) {
$_SESSION['oLP']->set_current_item($_REQUEST['item_id']); $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
} }
require 'lp_view.php'; require 'lp_view.php';
@ -1231,7 +1231,7 @@ switch ($action) {
break; break;
*/ */
case 'switch_attempt_mode': case 'switch_attempt_mode':
if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; } if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
$_SESSION['refresh'] = 1; $_SESSION['refresh'] = 1;
$_SESSION['oLP']->switch_attempt_mode(); $_SESSION['oLP']->switch_attempt_mode();
require 'lp_list.php'; require 'lp_list.php';
@ -1276,8 +1276,8 @@ switch ($action) {
error_log('New LP - No learnpath given for view', 0); error_log('New LP - No learnpath given for view', 0);
require 'lp_list.php'; require 'lp_list.php';
} else { } else {
if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); } if ($debug > 0) {error_log('New LP - Trying to impress this LP item to '.$_REQUEST['item_id'], 0); }
if (!empty($_REQUEST['item_id']) ) { if (!empty($_REQUEST['item_id'])) {
$_SESSION['oLP']->set_current_item($_REQUEST['item_id']); $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
} }
require 'lp_impress.php'; require 'lp_impress.php';
@ -1337,7 +1337,7 @@ switch ($action) {
$_SESSION['oLP']->lp_session_id $_SESSION['oLP']->lp_session_id
); );
$forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0; $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id'] : 0;
if (empty($forumCategoryId)) { if (empty($forumCategoryId)) {
$forumCategoryId = store_forumcategory( $forumCategoryId = store_forumcategory(
@ -1369,7 +1369,7 @@ switch ($action) {
} }
} }
header('Location:' . api_get_self() . '?' . http_build_query([ header('Location:'.api_get_self().'?'.http_build_query([
'action' => 'add_item', 'action' => 'add_item',
'type' => 'step', 'type' => 'step',
'lp_id' => $_SESSION['oLP']->lp_id 'lp_id' => $_SESSION['oLP']->lp_id
@ -1409,7 +1409,7 @@ switch ($action) {
} }
} }
header('Location:' . api_get_self() . '?' . http_build_query([ header('Location:'.api_get_self().'?'.http_build_query([
'action' => 'add_item', 'action' => 'add_item',
'type' => 'step', 'type' => 'step',
'lp_id' => $_SESSION['oLP']->lp_id 'lp_id' => $_SESSION['oLP']->lp_id
@ -1429,7 +1429,7 @@ switch ($action) {
} }
$_SESSION['oLP']->getFinalItemForm(); $_SESSION['oLP']->getFinalItemForm();
$redirectTo = api_get_self() . '?' . api_get_cidreq().'&'.http_build_query([ $redirectTo = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
'action' => 'add_item', 'action' => 'add_item',
'type' => 'step', 'type' => 'step',
'lp_id' => intval($_SESSION['oLP']->lp_id) 'lp_id' => intval($_SESSION['oLP']->lp_id)

@ -58,9 +58,9 @@ abstract class OpenofficeDocument extends learnpath
///learning_path/ppt_dirname directory ///learning_path/ppt_dirname directory
$this->created_dir = $result['dir']; $this->created_dir = $result['dir'];
if (substr($this->created_dir, -1, 1) == '/') { if (substr($this->created_dir, -1, 1) == '/') {
$this->file_path = $this->created_dir . api_replace_dangerous_char($file['name']); $this->file_path = $this->created_dir.api_replace_dangerous_char($file['name']);
} else { } else {
$this->file_path = $this->created_dir . '/' . api_replace_dangerous_char($file['name']); $this->file_path = $this->created_dir.'/'.api_replace_dangerous_char($file['name']);
} }
//var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir); //var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir);
@ -104,18 +104,18 @@ abstract class OpenofficeDocument extends learnpath
$perm = api_get_setting('permissions_for_new_files'); $perm = api_get_setting('permissions_for_new_files');
if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
$converter_path = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
$class_path = $converter_path . ';' . $converter_path . '/jodconverter-2.2.2.jar;' . $converter_path . '/jodconverter-cli-2.2.2.jar'; $class_path = $converter_path.';'.$converter_path.'/jodconverter-2.2.2.jar;'.$converter_path.'/jodconverter-cli-2.2.2.jar';
//$cmd = 'java -cp "'.$class_path.'" DokeosConverter'; //$cmd = 'java -cp "'.$class_path.'" DokeosConverter';
$cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $class_path . '" DokeosConverter'; $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$class_path.'" DokeosConverter';
} else { } else {
$converter_path = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; $converter_path = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
//$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar'; //$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar';
$class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; $class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
$cmd = 'cd ' . $converter_path . ' && java ' . $class_path . ' DokeosConverter'; $cmd = 'cd '.$converter_path.' && java '.$class_path.' DokeosConverter';
} }
$cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
// Call to the function implemented by child. // Call to the function implemented by child.
$cmd .= $this->add_command_parameters(); $cmd .= $this->add_command_parameters();
// To allow openoffice to manipulate docs. // To allow openoffice to manipulate docs.
@ -124,7 +124,7 @@ abstract class OpenofficeDocument extends learnpath
@chmod($this->base_work_dir.$this->file_path, 0777); @chmod($this->base_work_dir.$this->file_path, 0777);
$locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere.
putenv('LC_ALL=' . $locale); putenv('LC_ALL='.$locale);
$files = array(); $files = array();
$return = 0; $return = 0;
@ -153,12 +153,12 @@ abstract class OpenofficeDocument extends learnpath
$result = $this->_get_remote_ppt2lp_files($file, $size); $result = $this->_get_remote_ppt2lp_files($file, $size);
$result = unserialize($result); $result = unserialize($result);
// Save remote images to server // Save remote images to server
chmod($this->base_work_dir . $this->created_dir, api_get_permissions_for_new_directories()); chmod($this->base_work_dir.$this->created_dir, api_get_permissions_for_new_directories());
if (!empty($result['images'])) { if (!empty($result['images'])) {
foreach ($result['images'] as $image => $img_data) { foreach ($result['images'] as $image => $img_data) {
$image_path = $this->base_work_dir.$this->created_dir; $image_path = $this->base_work_dir.$this->created_dir;
@file_put_contents($image_path . '/' . $image, base64_decode($img_data)); @file_put_contents($image_path.'/'.$image, base64_decode($img_data));
@chmod($image_path . '/' . $image, 0777); @chmod($image_path.'/'.$image, 0777);
} }
} }
@ -202,7 +202,7 @@ abstract class OpenofficeDocument extends learnpath
$uri = ''; $uri = '';
$result = preg_match('/^([a-zA-Z0-9]*):\/\/([^\/]*)\//', $ppt2lp_host, $matches); $result = preg_match('/^([a-zA-Z0-9]*):\/\/([^\/]*)\//', $ppt2lp_host, $matches);
if ($result) { if ($result) {
$uri = $matches[1] . '://' . $matches[2] . '/'; $uri = $matches[1].'://'.$matches[2].'/';
} else { } else {
$uri = $ppt2lp_host; $uri = $ppt2lp_host;
} }
@ -246,7 +246,7 @@ abstract class OpenofficeDocument extends learnpath
//error_log('['.time().'] Calling wsConvertPpt webservice on ' . $ppt2lp_host); //error_log('['.time().'] Calling wsConvertPpt webservice on ' . $ppt2lp_host);
$result = $client->__call('wsConvertPpt', array('pptData' => $params)); $result = $client->__call('wsConvertPpt', array('pptData' => $params));
} catch (Exception $e) { } catch (Exception $e) {
error_log('['.time().'] Chamilo SOAP call error: ' . $e->getMessage()); error_log('['.time().'] Chamilo SOAP call error: '.$e->getMessage());
} }
// Make sure we destroy the SOAP client as it may generate SSL connection // Make sure we destroy the SOAP client as it may generate SSL connection
// binding issue (if using SSL) // binding issue (if using SSL)
@ -279,38 +279,38 @@ abstract class OpenofficeDocument extends learnpath
$ppt2lpHost = api_get_setting('service_ppt2lp', 'host'); $ppt2lpHost = api_get_setting('service_ppt2lp', 'host');
$permissionFile = api_get_permissions_for_new_files(); $permissionFile = api_get_permissions_for_new_files();
$permissionFolder = api_get_permissions_for_new_directories(); $permissionFolder = api_get_permissions_for_new_directories();
if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
return $ids; return $ids;
} }
if ($ppt2lpHost == 'localhost') { if ($ppt2lpHost == 'localhost') {
if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
$converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
$classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar'; $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar';
$cmd = 'java -Dfile.encoding=UTF-8 -jar "' . $classPath . '/jodconverter-2.2.2.jar"'; $cmd = 'java -Dfile.encoding=UTF-8 -jar "'.$classPath.'/jodconverter-2.2.2.jar"';
} else { } else {
$converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
$classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar'; $classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar';
$cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' '; $cmd = 'cd '.$converterPath.' && java '.$classPath.' ';
} }
$cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
// Call to the function implemented by child. // Call to the function implemented by child.
$cmd .= ' "' . $this->base_work_dir . '/' . $this->file_path . '" "' . $this->base_work_dir . '/' . $this->created_dir . '"'; $cmd .= ' "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.'/'.$this->created_dir.'"';
// To allow openoffice to manipulate docs. // To allow openoffice to manipulate docs.
@chmod($this->base_work_dir, $permissionFolder); @chmod($this->base_work_dir, $permissionFolder);
@chmod($this->base_work_dir . '/' . $this->file_path, $permissionFile); @chmod($this->base_work_dir.'/'.$this->file_path, $permissionFile);
$locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere.
putenv('LC_ALL=' . $locale); putenv('LC_ALL='.$locale);
$files = array(); $files = array();
$return = 0; $return = 0;
$shell = exec($cmd, $files, $return); $shell = exec($cmd, $files, $return);
// TODO: Chown is not working, root keep user privileges, should be www-data // TODO: Chown is not working, root keep user privileges, should be www-data
@chown($this->base_work_dir . '/' . $this->created_dir, 'www-data'); @chown($this->base_work_dir.'/'.$this->created_dir, 'www-data');
@chmod($this->base_work_dir . '/' . $this->created_dir, $permissionFile); @chmod($this->base_work_dir.'/'.$this->created_dir, $permissionFile);
if ($return != 0) { // If the java application returns an error code. if ($return != 0) { // If the java application returns an error code.
switch ($return) { switch ($return) {
@ -352,14 +352,14 @@ abstract class OpenofficeDocument extends learnpath
*/ */
} }
if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { if (file_exists($this->base_work_dir.'/'.$this->created_dir)) {
// Register Files to Document tool // Register Files to Document tool
$ids[] = add_document( $ids[] = add_document(
$_course, $_course,
'/' . $this->created_dir, '/'.$this->created_dir,
'file', 'file',
filesize($this->base_work_dir . '/' . $this->created_dir), filesize($this->base_work_dir.'/'.$this->created_dir),
$convertedTitle, $convertedTitle,
sprintf( sprintf(
get_lang('FileConvertedFromXToY'), get_lang('FileConvertedFromXToY'),

@ -98,7 +98,7 @@ class OpenofficePresentation extends OpenofficeDocument
); );
// Generating the thumbnail. // Generating the thumbnail.
$image = $this->base_work_dir.$dir . $file_name; $image = $this->base_work_dir.$dir.$file_name;
$pattern = '/(\w+)\.png$/'; $pattern = '/(\w+)\.png$/';
$replacement = '${1}_thumb.png'; $replacement = '${1}_thumb.png';
@ -114,7 +114,7 @@ class OpenofficePresentation extends OpenofficeDocument
$my_new_image = new Image($image); $my_new_image = new Image($image);
$my_new_image->resize($thumb_width, $thumb_height); $my_new_image->resize($thumb_width, $thumb_height);
$my_new_image->send_image($this->base_work_dir.$dir . $thumb_name, -1, 'png'); $my_new_image->send_image($this->base_work_dir.$dir.$thumb_name, -1, 'png');
// Adding the thumbnail to documents. // Adding the thumbnail to documents.
$document_id_thumb = add_document( $document_id_thumb = add_document(
@ -191,7 +191,7 @@ class OpenofficePresentation extends OpenofficeDocument
foreach ($specific_fields as $specific_field) { foreach ($specific_fields as $specific_field) {
if (isset($_REQUEST[$specific_field['code']])) { if (isset($_REQUEST[$specific_field['code']])) {
$sterms = trim($_REQUEST[$specific_field['code']]); $sterms = trim($_REQUEST[$specific_field['code']]);
$all_specific_terms .= ' '. $sterms; $all_specific_terms .= ' '.$sterms;
if (!empty($sterms)) { if (!empty($sterms)) {
$sterms = explode(',', $sterms); $sterms = explode(',', $sterms);
foreach ($sterms as $sterm) { foreach ($sterms as $sterm) {
@ -200,7 +200,7 @@ class OpenofficePresentation extends OpenofficeDocument
} }
} }
} }
$slide_body = $all_specific_terms .' '. $slide_body; $slide_body = $all_specific_terms.' '.$slide_body;
$ic_slide->addValue('content', $slide_body); $ic_slide->addValue('content', $slide_body);
/* FIXME: cidReq:lp_id:doc_id al indexar */ /* FIXME: cidReq:lp_id:doc_id al indexar */
// Add a comment to say terms separated by commas. // Add a comment to say terms separated by commas.
@ -212,7 +212,7 @@ class OpenofficePresentation extends OpenofficeDocument
SE_COURSE_ID => $courseid, SE_COURSE_ID => $courseid,
SE_TOOL_ID => TOOL_LEARNPATH, SE_TOOL_ID => TOOL_LEARNPATH,
SE_DATA => array('lp_id' => $lp_id, 'lp_item' => $previous, 'document_id' => $document_id), SE_DATA => array('lp_id' => $lp_id, 'lp_item' => $previous, 'document_id' => $document_id),
SE_USER => (int)api_get_user_id(), SE_USER => (int) api_get_user_id(),
); );
$ic_slide->xapian_data = serialize($xapian_data); $ic_slide->xapian_data = serialize($xapian_data);
$di->addChunk($ic_slide); $di->addChunk($ic_slide);
@ -250,7 +250,7 @@ class OpenofficePresentation extends OpenofficeDocument
$_course = api_get_course_info(); $_course = api_get_course_info();
foreach ($files as $file) { foreach ($files as $file) {
// '||' is used as separator between slide name (with accents) and file name (without accents). // '||' is used as separator between slide name (with accents) and file name (without accents).
list($slide_name,$file_name) = explode('||',$file); list($slide_name, $file_name) = explode('||', $file);
$slide_name = api_htmlentities($slide_name, ENT_COMPAT, $this->original_charset); $slide_name = api_htmlentities($slide_name, ENT_COMPAT, $this->original_charset);
$slide_name = str_replace('&rsquo;', '\'', $slide_name); $slide_name = str_replace('&rsquo;', '\'', $slide_name);
$slide_name = api_convert_encoding($slide_name, api_get_system_encoding(), $this->original_charset); $slide_name = api_convert_encoding($slide_name, api_get_system_encoding(), $this->original_charset);

@ -46,7 +46,7 @@ $course_id = api_get_course_int_id();
$tbl_course_rel_user = $table = Database::get_main_table(TABLE_MAIN_COURSE_USER); $tbl_course_rel_user = $table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT user_id $sql = "SELECT user_id
FROM $tbl_course_rel_user FROM $tbl_course_rel_user
WHERE status = '1' AND c_id = '" . api_get_course_int_id() . "'"; WHERE status = '1' AND c_id = '".api_get_course_int_id()."'";
$result = Database::query($sql); $result = Database::query($sql);
while ($user = Database::fetch_assoc($result)) { while ($user = Database::fetch_assoc($result)) {
unset($blog_users[$user['user_id']]); unset($blog_users[$user['user_id']]);
@ -110,7 +110,7 @@ if (api_get_setting('group_roles') == 'true') {
} }
} }
echo "<form method=\"post\" action=\"" . str_replace('&', '&amp;', $_SERVER['REQUEST_URI']) . "\">"; echo "<form method=\"post\" action=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."\">";
// --------------------------------------------------- // ---------------------------------------------------
// DISPLAYING THE ROLES LIST // DISPLAYING THE ROLES LIST
@ -118,7 +118,7 @@ echo "<form method=\"post\" action=\"" . str_replace('&', '&amp;', $_SERVER['REQ
if (api_get_setting('user_roles') == 'true') { if (api_get_setting('user_roles') == 'true') {
// the list of the roles for the user // the list of the roles for the user
echo '<strong>' . get_lang('UserRoles') . '</strong><br />'; echo '<strong>'.get_lang('UserRoles').'</strong><br />';
$current_user_course_roles = get_roles('user', $user_id); $current_user_course_roles = get_roles('user', $user_id);
$current_user_platform_roles = get_roles('user', $user_id, 'platform'); $current_user_platform_roles = get_roles('user', $user_id, 'platform');
display_role_list($current_user_course_roles, $current_user_platform_roles); display_role_list($current_user_course_roles, $current_user_platform_roles);
@ -132,24 +132,24 @@ echo "<table class=\"data_table\">\n";
// the header // the header
echo "\t<tr>\n"; echo "\t<tr>\n";
echo "\t\t<th rowspan=\"2\">" . get_lang('Module') . "</th>\n"; echo "\t\t<th rowspan=\"2\">".get_lang('Module')."</th>\n";
echo "\t\t<th colspan=\"4\">" . get_lang('ArticleManager') . "</th>\n"; echo "\t\t<th colspan=\"4\">".get_lang('ArticleManager')."</th>\n";
echo "\t\t<th colspan=\"3\">" . get_lang('CommentManager') . "</th>\n"; echo "\t\t<th colspan=\"3\">".get_lang('CommentManager')."</th>\n";
echo "\t\t<th colspan=\"3\">" . get_lang('BlogManager') . "</th>\n"; echo "\t\t<th colspan=\"3\">".get_lang('BlogManager')."</th>\n";
echo "\t</tr>\n"; echo "\t</tr>\n";
// Subheader // Subheader
echo "\t<tr>\n"; echo "\t<tr>\n";
echo "\t\t<th align='center'>" . get_lang('Add') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Add')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Delete') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Delete')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Edit') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Edit')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Rate') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Rate')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Add') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Add')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Delete') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Delete')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Rate') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Rate')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Tasks') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Tasks')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Members') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Members')."</th>\n";
echo "\t\t<th align='center'>" . get_lang('Roles') . "</th>\n"; echo "\t\t<th align='center'>".get_lang('Roles')."</th>\n";
echo "\t</tr>\n"; echo "\t</tr>\n";
// the main area with the checkboxes or images // the main area with the checkboxes or images
@ -171,7 +171,7 @@ foreach ($blog_users as $user_id => $user_name) { // $blog_users contains all th
display_image_matrix_for_blogs( display_image_matrix_for_blogs(
$current_user_permissions, $current_user_permissions,
$user_id, $user_id,
'BLOG_' . $blog_id, 'BLOG_'.$blog_id,
$value, $value,
(isset($inherited_permissions) ? $inherited_permissions : null), (isset($inherited_permissions) ? $inherited_permissions : null),
(isset($course_admin) ? $course_admin : null) (isset($course_admin) ? $course_admin : null)
@ -190,7 +190,7 @@ echo "</table>\n";
echo "</form><br />"; echo "</form><br />";
// LEGEND // LEGEND
echo '<strong>' . get_lang('Legend') . '</strong><br />'; echo '<strong>'.get_lang('Legend').'</strong><br />';
echo '<img src="../img/wrong.gif" /> ' . get_lang('UserHasPermissionNot') . '<br />'; echo '<img src="../img/wrong.gif" /> '.get_lang('UserHasPermissionNot').'<br />';
echo '<img src="../img/checkbox_on2.gif" /> ' . get_lang('UserHasPermission') . '<br />'; echo '<img src="../img/checkbox_on2.gif" /> '.get_lang('UserHasPermission').'<br />';
echo '<img src="../img/checkbox_on3.gif" /> ' . get_lang('UserHasPermissionByRoleGroup') . '<br />'; echo '<img src="../img/checkbox_on3.gif" /> '.get_lang('UserHasPermissionByRoleGroup').'<br />';

@ -16,10 +16,10 @@ function reports_modules_quiz_init_forEachCourses($course_code, $course_id, $cou
array_push($reports_modules['quiz'], array_push($reports_modules['quiz'],
array( array(
'keys_query' => 'keys_query' =>
'select ' . $course_id . ' as course_id, ' . 'select '.$course_id.' as course_id, '.
$reports_modules_quiz_toolid . ' as tool_id, ' . $reports_modules_quiz_toolid.' as tool_id, '.
'q.id as child_id, q.title as child_name, ' . 'q.id as child_id, q.title as child_name, '.
"'" . $course_code . "'" . ' as course_code from ' . Database::get_course_table(TABLE_QUIZ_TEST) . ' q ', "'".$course_code."'".' as course_code from '.Database::get_course_table(TABLE_QUIZ_TEST).' q ',
'values_query_function' => 'reports_modules_quiz_quizVal' 'values_query_function' => 'reports_modules_quiz_quizVal'
)); ));
} }
@ -30,12 +30,12 @@ function reports_modules_quiz_quizVal($quiz, $key_id)
return array( return array(
'type' => 'sql', 'type' => 'sql',
'sql' => 'sql' =>
'select ' . $key_id . ', exe_user_id as uid, ' . 'select '.$key_id.', exe_user_id as uid, '.
'session_id, -1 as attempt, exe_result as score, ' . 'session_id, -1 as attempt, exe_result as score, '.
REPORTS_PROGRESS_COMPLETED . ' as progress, ' . REPORTS_PROGRESS_COMPLETED.' as progress, '.
'exe_duration as time, exe_date as ts from ' . 'exe_duration as time, exe_date as ts from '.
Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).
' where c_id = ' . $courseId . ' where c_id = '.$courseId.
' and exe_exo_id=' . $quiz['child_id'] ' and exe_exo_id='.$quiz['child_id']
); );
} }

@ -118,8 +118,8 @@ if (count($friends) == 0) {
while ($j < $number_friends) { while ($j < $number_friends) {
if (isset($friends[$j])) { if (isset($friends[$j])) {
$friend = $friends[$j]; $friend = $friends[$j];
$toolBar = '<button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '> $toolBar = '<button class="btn btn-danger" onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].'>
' . get_lang('Delete') . ' ' . get_lang('Delete').'
</button>'; </button>';
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$friend['friend_user_id']; $url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$friend['friend_user_id'];
$friend['user_info']['complete_name'] = Display::url($friend['user_info']['complete_name'], $url); $friend['user_info']['complete_name'] = Display::url($friend['user_info']['complete_name'], $url);

@ -23,19 +23,19 @@ $token = Security::get_token();
switch ($action) { switch ($action) {
case 'add': case 'add':
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Add')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
break; break;
case 'edit': case 'edit':
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
break; break;
case 'add_item': case 'add_item':
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline'));
$interbreadcrumb[]=array('url' => '#','name' => get_lang('TimelineItem')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('TimelineItem'));
break; break;
default: default:
$interbreadcrumb[]=array('url' => '#','name' => get_lang('Timeline')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Timeline'));
} }
//jqgrid will use this URL to do the selects //jqgrid will use this URL to do the selects
@ -55,11 +55,11 @@ $extra_params['autowidth'] = 'true';
$extra_params['height'] = 'auto'; $extra_params['height'] = 'auto';
//With this function we can add actions to the jgrid (edit, delete, etc) //With this function we can add actions to the jgrid (edit, delete, etc)
$htmlHeadXtra[] =' $htmlHeadXtra[] = '
<script> <script>
$(function() { $(function() {
// grid definition see the $timeline->display() function // grid definition see the $timeline->display() function
'.Display::grid_js('timelines', $url,$columns,$column_model,$extra_params, array(), null,true).' '.Display::grid_js('timelines', $url, $columns, $column_model, $extra_params, array(), null, true).'
}); });
</script>'; </script>';
$toolbarAction = ''; $toolbarAction = '';
@ -80,12 +80,12 @@ switch ($action) {
$values = $form->exportValues(); $values = $form->exportValues();
$res = $timeline->save($values); $res = $timeline->save($values);
if ($res) { if ($res) {
$message = Display::return_message(get_lang('ItemAdded'),'success'); $message = Display::return_message(get_lang('ItemAdded'), 'success');
} }
} }
$content = $timeline->listing(); $content = $timeline->listing();
} else { } else {
$actions .= '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; $actions .= '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
$form->addElement('hidden', 'sec_token'); $form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token)); $form->setConstants(array('sec_token' => $token));
$content = $form->return_form(); $content = $form->return_form();
@ -106,7 +106,7 @@ switch ($action) {
} }
$timeline->display(); $timeline->display();
} else { } else {
$actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; $actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
$form->addElement('hidden', 'sec_token'); $form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token)); $form->setConstants(array('sec_token' => $token));
$content = $form->return_form(); $content = $form->return_form();
@ -128,7 +128,7 @@ switch ($action) {
} }
$timeline->display(); $timeline->display();
} else { } else {
$actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; $actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
$form->addElement('hidden', 'sec_token'); $form->addElement('hidden', 'sec_token');
$form->setConstants(array('sec_token' => $token)); $form->setConstants(array('sec_token' => $token));
$content = $form->return_form(); $content = $form->return_form();

@ -11,14 +11,14 @@ $plugin = BBBPlugin::create();
$tool_name = $plugin->get_lang('Videoconference'); $tool_name = $plugin->get_lang('Videoconference');
$htmlHeadXtra[] = api_get_js_simple( $htmlHeadXtra[] = api_get_js_simple(
api_get_path(WEB_PLUGIN_PATH) . 'bbb/resources/utils.js' api_get_path(WEB_PLUGIN_PATH).'bbb/resources/utils.js'
); );
$htmlHeadXtra[] = "<script>var _p = {web_plugin: '" . api_get_path(WEB_PLUGIN_PATH). "'}</script>"; $htmlHeadXtra[] = "<script>var _p = {web_plugin: '".api_get_path(WEB_PLUGIN_PATH)."'}</script>";
$tpl = new Template($tool_name); $tpl = new Template($tool_name);
$isGlobal = isset($_GET['global']) ? true : false; $isGlobal = isset($_GET['global']) ? true : false;
$isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id']: false; $isGlobalPerUser = isset($_GET['user_id']) ? (int) $_GET['user_id'] : false;
$bbb = new bbb('', '', $isGlobal, $isGlobalPerUser); $bbb = new bbb('', '', $isGlobal, $isGlobalPerUser);
$action = isset($_GET['action']) ? $_GET['action'] : null; $action = isset($_GET['action']) ? $_GET['action'] : null;
@ -80,22 +80,22 @@ if ($conferenceManager) {
case 'end': case 'end':
$bbb->endMeeting($_GET['id']); $bbb->endMeeting($_GET['id']);
$message = Display::return_message( $message = Display::return_message(
$plugin->get_lang('MeetingClosed') . '<br />' . $plugin->get_lang( $plugin->get_lang('MeetingClosed').'<br />'.$plugin->get_lang(
'MeetingClosedComment' 'MeetingClosedComment'
), ),
'success', 'success',
false false
); );
if (file_exists(__DIR__ . '/config.vm.php')) { if (file_exists(__DIR__.'/config.vm.php')) {
require __DIR__ . '/../../vendor/autoload.php'; require __DIR__.'/../../vendor/autoload.php';
require __DIR__ . '/lib/vm/AbstractVM.php'; require __DIR__.'/lib/vm/AbstractVM.php';
require __DIR__ . '/lib/vm/VMInterface.php'; require __DIR__.'/lib/vm/VMInterface.php';
require __DIR__ . '/lib/vm/DigitalOceanVM.php'; require __DIR__.'/lib/vm/DigitalOceanVM.php';
require __DIR__ . '/lib/VM.php'; require __DIR__.'/lib/VM.php';
$config = require __DIR__ . '/config.vm.php'; $config = require __DIR__.'/config.vm.php';
$vm = new VM($config); $vm = new VM($config);
$vm->resizeToMinLimit(); $vm->resizeToMinLimit();
@ -191,7 +191,7 @@ $content = $tpl->fetch($listing_tpl);
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$actionLinks = Display::toolbarButton( $actionLinks = Display::toolbarButton(
$plugin->get_lang('AdminView'), $plugin->get_lang('AdminView'),
api_get_path(WEB_PLUGIN_PATH) . 'bbb/admin.php', api_get_path(WEB_PLUGIN_PATH).'bbb/admin.php',
'list', 'list',
'primary' 'primary'
); );

@ -125,7 +125,7 @@ class BuyCoursesPlugin extends Plugin
return false; return false;
} }
require_once api_get_path(SYS_PLUGIN_PATH) . 'buycourses/database.php'; require_once api_get_path(SYS_PLUGIN_PATH).'buycourses/database.php';
} }
/** /**
@ -174,10 +174,10 @@ class BuyCoursesPlugin extends Plugin
$item = $this->getItemByProduct(intval($productId), $productType); $item = $this->getItemByProduct(intval($productId), $productType);
$return['html'] = '<div class="buycourses-price">'; $return['html'] = '<div class="buycourses-price">';
if ($item) { if ($item) {
$return['html'] .= '<span class="label label-primary"><b>'. $item['iso_code'] .' ' . $item['price'] . '</b></span>'; $return['html'] .= '<span class="label label-primary"><b>'.$item['iso_code'].' '.$item['price'].'</b></span>';
$return['verificator'] = true; $return['verificator'] = true;
} else { } else {
$return['html'] .= '<span class="label label-primary"><b>'. $this->get_lang('Free'). '</b></span>'; $return['html'] .= '<span class="label label-primary"><b>'.$this->get_lang('Free').'</b></span>';
$return['verificator'] = false; $return['verificator'] = false;
} }
$return['html'] .= '</div>'; $return['html'] .= '</div>';
@ -196,15 +196,15 @@ class BuyCoursesPlugin extends Plugin
*/ */
public function returnBuyCourseButton($productId, $productType) public function returnBuyCourseButton($productId, $productType)
{ {
$url = api_get_path(WEB_PLUGIN_PATH) . $url = api_get_path(WEB_PLUGIN_PATH).
'buycourses/src/process.php?i=' . 'buycourses/src/process.php?i='.
intval($productId) . intval($productId).
'&t=' . '&t='.
$productType $productType
; ;
$html = ' <a class="btn btn-success btn-sm" title="' . $this->get_lang('Buy') . '" href="' . $url . '">' . $html = ' <a class="btn btn-success btn-sm" title="'.$this->get_lang('Buy').'" href="'.$url.'">'.
Display::returnFontAwesomeIcon('fa fa-shopping-cart') . '</a>'; Display::returnFontAwesomeIcon('fa fa-shopping-cart').'</a>';
return $html; return $html;
} }
@ -749,7 +749,7 @@ class BuyCoursesPlugin extends Plugin
); );
if (!empty($sessionImage)) { if (!empty($sessionImage)) {
$sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH) . $sessionImage['value']; $sessionInfo['image'] = api_get_path(WEB_UPLOAD_PATH).$sessionImage['value'];
} }
$sessionCourses = $session->getCourses(); $sessionCourses = $session->getCourses();
@ -1202,7 +1202,7 @@ class BuyCoursesPlugin extends Plugin
$str = ''; $str = '';
srand((double)microtime() * 1000000); srand((double) microtime() * 1000000);
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {
$numbers = rand(0, strlen($salt) - 1); $numbers = rand(0, strlen($salt) - 1);
@ -1544,8 +1544,8 @@ class BuyCoursesPlugin extends Plugin
*/ */
public function getPayouts($status = self::PAYOUT_STATUS_PENDING, $payoutId = false, $userId = false) public function getPayouts($status = self::PAYOUT_STATUS_PENDING, $payoutId = false, $userId = false)
{ {
$condition = ($payoutId) ? 'AND p.id = '. intval($payoutId) : ''; $condition = ($payoutId) ? 'AND p.id = '.intval($payoutId) : '';
$condition2 = ($userId) ? ' AND p.user_id = ' . intval($userId) : ''; $condition2 = ($userId) ? ' AND p.user_id = '.intval($userId) : '';
$typeResult = ($condition) ? 'first' : 'all'; $typeResult = ($condition) ? 'first' : 'all';
$payoutsTable = Database::get_main_table(self::TABLE_PAYPAL_PAYOUTS); $payoutsTable = Database::get_main_table(self::TABLE_PAYPAL_PAYOUTS);
$saleTable = Database::get_main_table(self::TABLE_SALE); $saleTable = Database::get_main_table(self::TABLE_SALE);
@ -1572,14 +1572,14 @@ class BuyCoursesPlugin extends Plugin
INNER JOIN $saleTable s ON s.id = p.sale_id INNER JOIN $saleTable s ON s.id = p.sale_id
INNER JOIN $currencyTable c ON s.currency_id = c.id INNER JOIN $currencyTable c ON s.currency_id = c.id
LEFT JOIN $extraFieldValues efv ON p.user_id = efv.item_id LEFT JOIN $extraFieldValues efv ON p.user_id = efv.item_id
AND field_id = " . intval($paypalExtraField['id']) . " AND field_id = ".intval($paypalExtraField['id'])."
"; ";
$payouts = Database::select( $payouts = Database::select(
"p.* , u.firstname, u.lastname, efv.value as paypal_account, s.reference as sale_reference, s.price as item_price, c.iso_code", "p.* , u.firstname, u.lastname, efv.value as paypal_account, s.reference as sale_reference, s.price as item_price, c.iso_code",
"$payoutsTable p $innerJoins", "$payoutsTable p $innerJoins",
[ [
'where' => ['p.status = ? '.$condition . ' ' .$condition2 => $status] 'where' => ['p.status = ? '.$condition.' '.$condition2 => $status]
], ],
$typeResult $typeResult
); );
@ -1642,7 +1642,7 @@ class BuyCoursesPlugin extends Plugin
$platformCommission = $this->getPlatformCommission(); $platformCommission = $this->getPlatformCommission();
$sale = $this->getSale($saleId); $sale = $this->getSale($saleId);
$teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission']))/100, 2); $teachersCommission = number_format((floatval($sale['price']) * intval($platformCommission['commission'])) / 100, 2);
$beneficiaries = $this->getBeneficiariesBySale($saleId); $beneficiaries = $this->getBeneficiariesBySale($saleId);
@ -1654,7 +1654,7 @@ class BuyCoursesPlugin extends Plugin
'payout_date' => getdate(), 'payout_date' => getdate(),
'sale_id' => intval($saleId), 'sale_id' => intval($saleId),
'user_id' => $beneficiary['user_id'], 'user_id' => $beneficiary['user_id'],
'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions']))/100, 2), 'commission' => number_format((floatval($teachersCommission) * intval($beneficiary['commissions'])) / 100, 2),
'status' => self::PAYOUT_STATUS_PENDING 'status' => self::PAYOUT_STATUS_PENDING
] ]
); );
@ -2252,17 +2252,17 @@ class BuyCoursesPlugin extends Plugin
*/ */
public function getPath($var) public function getPath($var)
{ {
$pluginPath = api_get_path(WEB_PLUGIN_PATH) . 'buycourses/'; $pluginPath = api_get_path(WEB_PLUGIN_PATH).'buycourses/';
$paths = [ $paths = [
'SERVICE_IMAGES' => $pluginPath . 'uploads/services/images/', 'SERVICE_IMAGES' => $pluginPath.'uploads/services/images/',
'SRC' => $pluginPath . 'src/', 'SRC' => $pluginPath.'src/',
'VIEW' => $pluginPath . 'view/', 'VIEW' => $pluginPath.'view/',
'UPLOADS' => $pluginPath . 'uploads/', 'UPLOADS' => $pluginPath.'uploads/',
'LANGUAGES' => $pluginPath . 'lang/', 'LANGUAGES' => $pluginPath.'lang/',
'RESOURCES' => $pluginPath . 'resources/', 'RESOURCES' => $pluginPath.'resources/',
'RESOURCES_IMG' => $pluginPath . 'resources/img/', 'RESOURCES_IMG' => $pluginPath.'resources/img/',
'RESOURCES_CSS' => $pluginPath . 'resources/css/', 'RESOURCES_CSS' => $pluginPath.'resources/css/',
'RESOURCES_JS' => $pluginPath . 'resources/js/', 'RESOURCES_JS' => $pluginPath.'resources/js/',
]; ];
return $paths[$var]; return $paths[$var];

@ -33,7 +33,7 @@ if (!isset($_REQUEST['t'], $_REQUEST['i'])) {
$buyingCourse = intval($_REQUEST['t']) === BuyCoursesPlugin::PRODUCT_TYPE_COURSE; $buyingCourse = intval($_REQUEST['t']) === BuyCoursesPlugin::PRODUCT_TYPE_COURSE;
$buyingSession = intval($_REQUEST['t']) === BuyCoursesPlugin::PRODUCT_TYPE_SESSION; $buyingSession = intval($_REQUEST['t']) === BuyCoursesPlugin::PRODUCT_TYPE_SESSION;
$queryString = 'i=' . intval($_REQUEST['i']) . '&t=' . intval($_REQUEST['t']); $queryString = 'i='.intval($_REQUEST['i']).'&t='.intval($_REQUEST['t']);
if ($buyingCourse) { if ($buyingCourse) {
$courseInfo = $plugin->getCourseInfo($_REQUEST['i']); $courseInfo = $plugin->getCourseInfo($_REQUEST['i']);
@ -54,7 +54,7 @@ if ($form->validate()) {
Display::addFlash( Display::addFlash(
Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false) Display::return_message($plugin->get_lang('NeedToSelectPaymentType'), 'error', false)
); );
header('Location:' . api_get_self() . '?' . $queryString); header('Location:'.api_get_self().'?'.$queryString);
exit; exit;
} }
@ -62,7 +62,7 @@ if ($form->validate()) {
if ($saleId !== false) { if ($saleId !== false) {
$_SESSION['bc_sale_id'] = $saleId; $_SESSION['bc_sale_id'] = $saleId;
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/process_confirm.php'); header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/process_confirm.php');
} }
exit; exit;

@ -25,7 +25,7 @@ if (isset($_GET['order'])) {
api_not_allowed(true); api_not_allowed(true);
} }
$urlToRedirect = api_get_self() . '?'; $urlToRedirect = api_get_self().'?';
switch ($_GET['action']) { switch ($_GET['action']) {
case 'confirm': case 'confirm':
@ -94,10 +94,10 @@ $form->addRadio(
get_lang('Filter'), get_lang('Filter'),
[$plugin->get_lang('ByStatus'), $plugin->get_lang('ByUser')] [$plugin->get_lang('ByStatus'), $plugin->get_lang('ByUser')]
); );
$form->addHtml('<div id="report-by-status" ' . ($selectedFilterType !== '0' ? 'style="display:none"' : '') . '>'); $form->addHtml('<div id="report-by-status" '.($selectedFilterType !== '0' ? 'style="display:none"' : '').'>');
$form->addSelect('status', $plugin->get_lang('OrderStatus'), $saleStatuses); $form->addSelect('status', $plugin->get_lang('OrderStatus'), $saleStatuses);
$form->addHtml('</div>'); $form->addHtml('</div>');
$form->addHtml('<div id="report-by-user" ' . ($selectedFilterType !== '1' ? 'style="display:none"' : '') . '>'); $form->addHtml('<div id="report-by-user" '.($selectedFilterType !== '1' ? 'style="display:none"' : '').'>');
$form->addText('user', get_lang('UserName'), false); $form->addText('user', get_lang('UserName'), false);
$form->addHtml('</div>'); $form->addHtml('</div>');
$form->addButtonFilter(get_lang('Search')); $form->addButtonFilter(get_lang('Search'));
@ -142,7 +142,7 @@ $template = new Template($templateName);
if ($paypalEnable == "true" && $commissionsEnable == "true") { if ($paypalEnable == "true" && $commissionsEnable == "true") {
$toolbar = Display::toolbarButton( $toolbar = Display::toolbarButton(
$plugin->get_lang('PaypalPayoutCommissions'), $plugin->get_lang('PaypalPayoutCommissions'),
api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/paypal_payout.php', api_get_path(WEB_PLUGIN_PATH).'buycourses/src/paypal_payout.php',
'paypal', 'paypal',
'primary', 'primary',
['title' => $plugin->get_lang('PaypalPayoutCommissions')] ['title' => $plugin->get_lang('PaypalPayoutCommissions')]
@ -157,7 +157,7 @@ if ($paypalEnable == "true" && $commissionsEnable == "true") {
if ($commissionsEnable == "true") { if ($commissionsEnable == "true") {
$toolbar = Display::toolbarButton( $toolbar = Display::toolbarButton(
$plugin->get_lang('PayoutReport'), $plugin->get_lang('PayoutReport'),
api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/payout_report.php', api_get_path(WEB_PLUGIN_PATH).'buycourses/src/payout_report.php',
'money', 'money',
'info', 'info',
['title' => $plugin->get_lang('PayoutReport')] ['title' => $plugin->get_lang('PayoutReport')]

@ -54,7 +54,7 @@ $template = new Template($templateName);
if ($paypalEnable == 'true' && $commissionsEnable == 'true') { if ($paypalEnable == 'true' && $commissionsEnable == 'true') {
$toolbar = Display::toolbarButton( $toolbar = Display::toolbarButton(
$plugin->get_lang('PaypalPayoutCommissions'), $plugin->get_lang('PaypalPayoutCommissions'),
api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/paypal_payout.php', api_get_path(WEB_PLUGIN_PATH).'buycourses/src/paypal_payout.php',
'paypal', 'paypal',
'primary', 'primary',
['title' => $plugin->get_lang('PaypalPayoutCommissions')] ['title' => $plugin->get_lang('PaypalPayoutCommissions')]
@ -69,7 +69,7 @@ if ($paypalEnable == 'true' && $commissionsEnable == 'true') {
if ($commissionsEnable == 'true') { if ($commissionsEnable == 'true') {
$toolbar = Display::toolbarButton( $toolbar = Display::toolbarButton(
$plugin->get_lang('PayoutReport'), $plugin->get_lang('PayoutReport'),
api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/payout_report.php', api_get_path(WEB_PLUGIN_PATH).'buycourses/src/payout_report.php',
'money', 'money',
'info', 'info',
['title' => $plugin->get_lang('PayoutReport')] ['title' => $plugin->get_lang('PayoutReport')]

@ -40,31 +40,31 @@ class OpenMeetingsRestService
// $request // $request
// Initialize the session by passing the request as a parameter // Initialize the session by passing the request as a parameter
$session = curl_init ( $request ); $session = curl_init($request);
// Set curl options by passing session and flags // Set curl options by passing session and flags
// CURLOPT_HEADER allows us to receive the HTTP header // CURLOPT_HEADER allows us to receive the HTTP header
curl_setopt ( $session, CURLOPT_HEADER, true ); curl_setopt($session, CURLOPT_HEADER, true);
// CURLOPT_RETURNTRANSFER will return the response // CURLOPT_RETURNTRANSFER will return the response
curl_setopt ( $session, CURLOPT_RETURNTRANSFER, true ); curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// Make the request // Make the request
$response = curl_exec ( $session ); $response = curl_exec($session);
// Close the curl session // Close the curl session
curl_close ( $session ); curl_close($session);
// Confirm that the request was transmitted to the OpenMeetings! Image Search Service // Confirm that the request was transmitted to the OpenMeetings! Image Search Service
if (! $response) { if (!$response) {
die ( "Request OpenMeetings! OpenMeetings Service failed and no response was returned in ".__CLASS__.'::'.__FUNCTION__.'()' ); die ("Request OpenMeetings! OpenMeetings Service failed and no response was returned in ".__CLASS__.'::'.__FUNCTION__.'()');
} }
// Create an array to store the HTTP response codes // Create an array to store the HTTP response codes
$status_code = array (); $status_code = array();
// Use regular expressions to extract the code from the header // Use regular expressions to extract the code from the header
preg_match ( '/\d\d\d/', $response, $status_code ); preg_match('/\d\d\d/', $response, $status_code);
$bt = debug_backtrace(); $bt = debug_backtrace();
$caller = array_shift($bt); $caller = array_shift($bt);
$extra = ' (from '.$caller['file'].' at line '.$caller['line'].') '; $extra = ' (from '.$caller['file'].' at line '.$caller['line'].') ';
@ -74,24 +74,24 @@ class OpenMeetingsRestService
// Success // Success
break; break;
case 503 : case 503 :
error_log( 'Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 503. error_log('Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 503.
That means: Service unavailable. An internal problem prevented us from returning data to you.' ); That means: Service unavailable. An internal problem prevented us from returning data to you.' );
return false; return false;
break; break;
case 403 : case 403 :
error_log( 'Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 403. error_log('Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 403.
That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.' ); That means: Forbidden. You do not have permission to access this resource, or are over your rate limit.' );
return false; return false;
break; break;
case 400 : case 400 :
// You may want to fall through here and read the specific XML error // You may want to fall through here and read the specific XML error
error_log( 'Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 400. error_log('Your call to OpenMeetings Web Services '.$extra.' failed and returned an HTTP status of 400.
That means: Bad request. The parameters passed to the service did not match as expected. That means: Bad request. The parameters passed to the service did not match as expected.
The exact error is returned in the XML response.' ); The exact error is returned in the XML response.' );
return false; return false;
break; break;
default: default:
error_log( 'Your call to OpenMeetings Web Services '.$extra.' returned an unexpected HTTP status of: ' . $status_code [0] . " Request " . $request ); error_log('Your call to OpenMeetings Web Services '.$extra.' returned an unexpected HTTP status of: '.$status_code [0]." Request ".$request);
return false; return false;
} }

@ -46,7 +46,7 @@ foreach ($settings as $param) {
isset($param['subkey']) && !empty($param['subkey']) ? $param['variable'].' ['.$param['subkey'].']' : $param['variable'], isset($param['subkey']) && !empty($param['subkey']) ? $param['variable'].' ['.$param['subkey'].']' : $param['variable'],
$param['category'], $param['category'],
$param['access_url'], $param['access_url'],
'<input type="text" disabled name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8' ).'" />'. '<input type="text" disabled name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8').'" />'.
'<br />Master value: '.$param['selected_value'], '<br />Master value: '.$param['selected_value'],
$syncButton, $syncButton,
); );

@ -63,6 +63,6 @@ class Wiki extends Resource
public function show() public function show()
{ {
parent::show(); parent::show();
echo $this->reflink.' ('. (empty($this->group_id) ? get_lang('Everyone') : get_lang('Group') . ' ' . $this->group_id) .') ' . '<i>(' . $this->dtime . ')</i>'; echo $this->reflink.' ('.(empty($this->group_id) ? get_lang('Everyone') : get_lang('Group').' '.$this->group_id).') '.'<i>('.$this->dtime.')</i>';
} }
} }

Loading…
Cancel
Save