Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 9 years ago
parent 1dceff2b93
commit d23a5f6a1c
  1. 54
      main/admin/languages.php
  2. 18
      main/admin/statistics/index.php
  3. 10
      main/auth/cas/authcas.php
  4. 4
      main/badge/assertion.php
  5. 6
      main/course_progress/thematic.php
  6. 16
      main/cron/lang/langstats.class.php
  7. 6
      main/cron/user_import/get_data_from_mail.php
  8. 84
      main/document/create_audio.php
  9. 12
      main/exercise/hotpotatoes.lib.php
  10. 8
      main/gradebook/gradebook_edit_result.php
  11. 4
      main/inc/ajax/record_audio_wami.ajax.php
  12. 4
      main/inc/lib/formvalidator/Element/receivers.php
  13. 4
      main/link/link_goto.php
  14. 14
      main/lp/openoffice_text_document.class.php
  15. 2
      main/survey/ch_percentage.php
  16. 10
      main/webservices/test.php
  17. 18
      main/work/work_list.php

@ -32,7 +32,7 @@ if (isset($_POST['sent_http_request'])) {
SubLanguageManager::make_unavailable_language($_POST['id']); SubLanguageManager::make_unavailable_language($_POST['id']);
echo 'set_hidden'; echo 'set_hidden';
} else { } else {
echo 'confirm:' . intval($_POST['id']); echo 'confirm:'.intval($_POST['id']);
} }
} }
} }
@ -54,21 +54,21 @@ $htmlHeadXtra[] = '<script>
var disabledLang = "'.$disabledLang.'" var disabledLang = "'.$disabledLang.'"
if (msgLang == 1) { if (msgLang == 1) {
$("#id_content_message").html("<div class=\"warning-message alert alert-warning\">' . get_lang('ThereAreUsersUsingThisLanguagesDisableItManually') . ' <br /> " + disabledLang + "</div"); $("#id_content_message").html("<div class=\"warning-message alert alert-warning\">' . get_lang('ThereAreUsersUsingThisLanguagesDisableItManually').' <br /> " + disabledLang + "</div");
} }
$("#disable_all_except_default").click(function () { $("#disable_all_except_default").click(function () {
if(confirm("'. get_lang('ConfirmYourChoice') .'")) { if(confirm("'. get_lang('ConfirmYourChoice').'")) {
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) { beforeSend: function(objeto) {
$("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em> ' . get_lang('Loading') . '</div>"); $("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em> ' . get_lang('Loading').'</div>");
}, },
type: "GET", type: "GET",
url: "../admin/languages.php", url: "../admin/languages.php",
data: "action=disable_all_except_default", data: "action=disable_all_except_default",
success: function(datos) { success: function(datos) {
window.location.href = "' . api_get_self() . '"; window.location.href = "' . api_get_self().'";
} }
}); });
} }
@ -104,7 +104,7 @@ $htmlHeadXtra[] = '<script>
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) { beforeSend: function(objeto) {
$("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em> ' . get_lang('Loading') . '</div>"); $("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em> ' . get_lang('Loading').'</div>");
}, },
type: "POST", type: "POST",
url: "../admin/languages.php", url: "../admin/languages.php",
@ -115,26 +115,26 @@ $htmlHeadXtra[] = '<script>
$("#"+id_img_link_tool).attr("src",path_name_of_imglinktool); $("#"+id_img_link_tool).attr("src",path_name_of_imglinktool);
if (my_image_tool=="visible.png") { if (my_image_tool=="visible.png") {
$("#"+id_img_link_tool).attr("alt","' . get_lang('MakeAvailable', '') . '"); $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeAvailable', '').'");
$("#"+id_img_link_tool).attr("title","' . get_lang('MakeAvailable', '') . '"); $("#"+id_img_link_tool).attr("title","' . get_lang('MakeAvailable', '').'");
} else { } else {
$("#"+id_img_link_tool).attr("alt","' . get_lang('MakeUnavailable', '') . '"); $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeUnavailable', '').'");
$("#"+id_img_link_tool).attr("title","' . get_lang('MakeUnavailable', '') . '"); $("#"+id_img_link_tool).attr("title","' . get_lang('MakeUnavailable', '').'");
} }
if (datos=="set_visible") { if (datos=="set_visible") {
$("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowVisible', '') . '</div>"); $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowVisible', '').'</div>");
} }
if (datos=="set_hidden") { if (datos=="set_hidden") {
$("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowHidden', '') . '</div>"); $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowHidden', '').'</div>");
} }
} }
var action = datos.split(":")[0]; var action = datos.split(":")[0];
if (action && action == "confirm") { if (action && action == "confirm") {
var id = datos.split(":")[1]; var id = datos.split(":")[1];
var sure = "<div class=\"warning-message alert alert-warning\">'.get_lang('ThereAreUsersUsingThisLanguageYouWantToDisableThisLanguageAndSetUsersWithTheDefaultPortalLanguage').'<br /><br /><a href=\"languages.php?action=make_unavailable_confirmed&id="+id+"\" class=\"btn btn-default\"><em class=\"fa fa-eye\"></em> ' . get_lang('MakeUnavailable') . '</a></div>"; var sure = "<div class=\"warning-message alert alert-warning\">'.get_lang('ThereAreUsersUsingThisLanguageYouWantToDisableThisLanguageAndSetUsersWithTheDefaultPortalLanguage').'<br /><br /><a href=\"languages.php?action=make_unavailable_confirmed&id="+id+"\" class=\"btn btn-default\"><em class=\"fa fa-eye\"></em> '.get_lang('MakeUnavailable').'</a></div>";
$("#id_content_message").html(sure); $("#id_content_message").html(sure);
$("html, body").animate({ scrollTop: 0 }, 200); $("html, body").animate({ scrollTop: 0 }, 200);
} }
@ -179,7 +179,7 @@ if ($action == 'disable_all_except_default') {
SubLanguageManager::make_unavailable_language($language['id']); SubLanguageManager::make_unavailable_language($language['id']);
} else { } else {
if (intval(SubLanguageManager::get_platform_language_id()) !== intval($language['id'])) { if (intval(SubLanguageManager::get_platform_language_id()) !== intval($language['id'])) {
$failedDisabledLanguages .= ' - ' .$language['english_name'] . '<br />'; $failedDisabledLanguages .= ' - '.$language['english_name'].'<br />';
$checkFailed = true; $checkFailed = true;
} }
} }
@ -210,7 +210,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
foreach ($_POST['id'] as $index => $id) { foreach ($_POST['id'] as $index => $id) {
$ids[] = intval($id); $ids[] = intval($id);
} }
$sql = "UPDATE $tbl_admin_languages SET available='1' WHERE id IN ('" . implode("','", $ids) . "')"; $sql = "UPDATE $tbl_admin_languages SET available='1' WHERE id IN ('".implode("','", $ids)."')";
Database::query($sql); Database::query($sql);
} }
break; break;
@ -220,7 +220,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
foreach ($_POST['id'] as $index => $id) { foreach ($_POST['id'] as $index => $id) {
$ids[] = intval($id); $ids[] = intval($id);
} }
$sql = "UPDATE $tbl_admin_languages SET available='0' WHERE id IN ('" . implode("','", $ids) . "')"; $sql = "UPDATE $tbl_admin_languages SET available='0' WHERE id IN ('".implode("','", $ids)."')";
Database::query($sql); Database::query($sql);
} }
break; break;
@ -249,7 +249,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'make_unavailable_confirmed') {
// displaying the explanation for this tool // displaying the explanation for this tool
Display::display_normal_message(get_lang('PlatformLanguagesExplanation')); Display::display_normal_message(get_lang('PlatformLanguagesExplanation'));
echo '<a id="disable_all_except_default" href="javascript:void(0)" class="btn btn-primary"><em class="fa fa-eye"></em> ' . get_lang('LanguagesDisableAllExceptDefault') . '</a><br /><br />'; echo '<a id="disable_all_except_default" href="javascript:void(0)" class="btn btn-primary"><em class="fa fa-eye"></em> '.get_lang('LanguagesDisableAllExceptDefault').'</a><br /><br />';
// selecting all the languages // selecting all the languages
$sql_select = "SELECT * FROM $tbl_admin_languages"; $sql_select = "SELECT * FROM $tbl_admin_languages";
@ -270,8 +270,8 @@ while ($row = Database::fetch_array($result_select)) {
$checked = ' checked="checked" '; $checked = ' checked="checked" ';
} }
$row_td[] = '<input type="hidden" name="edit_id" value="' . Security::remove_XSS($_GET['id']) . '" /><input type="text" name="txt_name" value="' . $row['original_name'] . '" /> ' $row_td[] = '<input type="hidden" name="edit_id" value="'.Security::remove_XSS($_GET['id']).'" /><input type="text" name="txt_name" value="'.$row['original_name'].'" /> '
. '<input type="checkbox" ' . $checked . 'name="platformlanguage" id="platformlanguage" value="' . $row['english_name'] . '" /><label for="platformlanguage">' . $row['original_name'] . ' ' . get_lang('AsPlatformLanguage') . '</label> <input type="submit" name="Submit" value="' . get_lang('Ok') . '" /><a name="value" />'; . '<input type="checkbox" '.$checked.'name="platformlanguage" id="platformlanguage" value="'.$row['english_name'].'" /><label for="platformlanguage">'.$row['original_name'].' '.get_lang('AsPlatformLanguage').'</label> <input type="submit" name="Submit" value="'.get_lang('Ok').'" /><a name="value" />';
} else { } else {
$row_td[] = $row['original_name']; $row_td[] = $row['original_name'];
} }
@ -285,7 +285,7 @@ while ($row = Database::fetch_array($result_select)) {
if ($row['english_name'] == $row_lang['selected_value']) { if ($row['english_name'] == $row_lang['selected_value']) {
$setplatformlanguage = Display::return_icon('languages.png', get_lang('CurrentLanguagesPortal'), '', ICON_SIZE_SMALL); $setplatformlanguage = Display::return_icon('languages.png', get_lang('CurrentLanguagesPortal'), '', ICON_SIZE_SMALL);
} else { } else {
$setplatformlanguage = "<a href=\"javascript:if (confirm('" . addslashes(get_lang('AreYouSureYouWantToSetThisLanguageAsThePortalDefault')) . "')) { location.href='" . api_get_self() . "?action=setplatformlanguage&id=" . $row['id'] . "'; }\">" . Display::return_icon('languages_na.png', get_lang('SetLanguageAsDefault'), '', ICON_SIZE_SMALL) . "</a>"; $setplatformlanguage = "<a href=\"javascript:if (confirm('".addslashes(get_lang('AreYouSureYouWantToSetThisLanguageAsThePortalDefault'))."')) { location.href='".api_get_self()."?action=setplatformlanguage&id=".$row['id']."'; }\">".Display::return_icon('languages_na.png', get_lang('SetLanguageAsDefault'), '', ICON_SIZE_SMALL)."</a>";
} }
$allow_delete_sub_language = null; $allow_delete_sub_language = null;
@ -297,7 +297,7 @@ while ($row = Database::fetch_array($result_select)) {
if ($verified_if_is_sub_language === false) { if ($verified_if_is_sub_language === false) {
$verified_if_is_father = SubLanguageManager::check_if_language_is_father($row['id']); $verified_if_is_father = SubLanguageManager::check_if_language_is_father($row['id']);
$allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=" . $row['id'] . "'>" . Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), array(), ICON_SIZE_SMALL) . "</a>"; $allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=".$row['id']."'>".Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), array(), ICON_SIZE_SMALL)."</a>";
if ($verified_if_is_father === true) { if ($verified_if_is_father === true) {
//$allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".$row['id']."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'),array('width'=>ICON_SIZE_SMALL,'height'=>ICON_SIZE_SMALL))."</a>"; //$allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".$row['id']."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'),array('width'=>ICON_SIZE_SMALL,'height'=>ICON_SIZE_SMALL))."</a>";
$allow_add_term_sub_language = ''; $allow_add_term_sub_language = '';
@ -307,8 +307,8 @@ while ($row = Database::fetch_array($result_select)) {
} else { } else {
$allow_use_sub_language = ''; $allow_use_sub_language = '';
$all_information_of_sub_language = SubLanguageManager::get_all_information_of_language($row['id']); $all_information_of_sub_language = SubLanguageManager::get_all_information_of_language($row['id']);
$allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>"; $allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
$allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>"; $allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
} }
} else { } else {
$allow_use_sub_language = ''; $allow_use_sub_language = '';
@ -316,13 +316,13 @@ while ($row = Database::fetch_array($result_select)) {
} }
if ($row['english_name'] == $row_lang['selected_value']) { if ($row['english_name'] == $row_lang['selected_value']) {
$row_td[] = Display::return_icon('visible.png', get_lang('Visible'))."<a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a> $row_td[] = Display::return_icon('visible.png', get_lang('Visible'))."<a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>
&nbsp;" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language; &nbsp;" . $setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
} else { } else {
if ($row['available'] == 1) { if ($row['available'] == 1) {
$row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_" . $row['id'] . "\" href='" . api_get_self() . "?action=makeunavailable&id=" . $row['id'] . "'>" . Display::return_icon('visible.png', get_lang('MakeUnavailable'), array('id' => 'imglinktool_' . $row['id']), ICON_SIZE_SMALL) . "</a> <a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>&nbsp;" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language; $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeunavailable&id=".$row['id']."'>".Display::return_icon('visible.png', get_lang('MakeUnavailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
} else { } else {
$row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_" . $row['id'] . "\" href='" . api_get_self() . "?action=makeavailable&id=" . $row['id'] . "'>" . Display::return_icon('invisible.png', get_lang('MakeAvailable'), array('id' => 'imglinktool_' . $row['id']), ICON_SIZE_SMALL) . "</a> <a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>&nbsp;" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language; $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeavailable&id=".$row['id']."'>".Display::return_icon('invisible.png', get_lang('MakeAvailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
} }
} }
$language_data[] = $row_td; $language_data[] = $row_td;

@ -20,7 +20,7 @@ if ($report) {
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$.ajax({ $.ajax({
url: "'. api_get_path(WEB_CODE_PATH) .'inc/ajax/statistics.ajax.php?a=recentlogins", url: "'. api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=recentlogins",
type: "POST", type: "POST",
success: function(data) { success: function(data) {
Chart.defaults.global.responsive = true; Chart.defaults.global.responsive = true;
@ -50,10 +50,10 @@ $tools[$strCourse]['report=coursebylanguage'] = get_lang('CountCourseByLanguage'
// users ... // users ...
$tools[$strUsers]['report=users'] = get_lang('CountUsers'); $tools[$strUsers]['report=users'] = get_lang('CountUsers');
$tools[$strUsers]['report=recentlogins'] = get_lang('Logins'); $tools[$strUsers]['report=recentlogins'] = get_lang('Logins');
$tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins') . ' (' . get_lang('PeriodMonth') . ')'; $tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins').' ('.get_lang('PeriodMonth').')';
$tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins') . ' (' . get_lang('PeriodDay') . ')'; $tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins').' ('.get_lang('PeriodDay').')';
$tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins') . ' (' . get_lang('PeriodHour') . ')'; $tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins').' ('.get_lang('PeriodHour').')';
$tools[$strUsers]['report=pictures'] = get_lang('CountUsers') . ' (' . get_lang('UserPicture') . ')'; $tools[$strUsers]['report=pictures'] = get_lang('CountUsers').' ('.get_lang('UserPicture').')';
$tools[$strUsers]['report=no_login_users'] = get_lang('StatsUsersDidNotLoginInLastPeriods'); $tools[$strUsers]['report=no_login_users'] = get_lang('StatsUsersDidNotLoginInLastPeriods');
$tools[$strUsers]['report=zombies'] = get_lang('Zombies'); $tools[$strUsers]['report=zombies'] = get_lang('Zombies');
@ -68,10 +68,10 @@ $tools[$strSocial]['report=friends'] = get_lang('CountFriends');
echo '<table><tr>'; echo '<table><tr>';
foreach ($tools as $section => $items) { foreach ($tools as $section => $items) {
echo '<td style="vertical-align:top;">'; echo '<td style="vertical-align:top;">';
echo '<h3>' . $section . '</h3>'; echo '<h3>'.$section.'</h3>';
echo '<ul>'; echo '<ul>';
foreach ($items as $key => $value) { foreach ($items as $key => $value) {
echo '<li><a href="index.php?' . $key . '">' . $value . '</a></li>'; echo '<li><a href="index.php?'.$key.'">'.$value.'</a></li>';
} }
echo '</ul>'; echo '</ul>';
echo '</td>'; echo '</td>';
@ -79,7 +79,7 @@ foreach ($tools as $section => $items) {
echo '</tr></table>'; echo '</tr></table>';
$course_categories = Statistics::getCourseCategories(); $course_categories = Statistics::getCourseCategories();
echo '<br/><br/>';//@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation echo '<br/><br/>'; //@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
switch ($report) { switch ($report) {
case 'courses': case 'courses':
@ -121,7 +121,7 @@ switch ($report) {
Statistics::printStats(get_lang('Students'), $students); Statistics::printStats(get_lang('Students'), $students);
break; break;
case 'recentlogins': case 'recentlogins':
echo '<h2>'. sprintf(get_lang('LastXDays'), '15') . '</h2>'; echo '<h2>'.sprintf(get_lang('LastXDays'), '15').'</h2>';
echo '<canvas class="col-md-12" id="canvas" height="100px" style="margin-bottom: 20px"></canvas>'; echo '<canvas class="col-md-12" id="canvas" height="100px" style="margin-bottom: 20px"></canvas>';
Statistics::printRecentLoginStats(); Statistics::printRecentLoginStats();
Statistics::printRecentLoginStats(true); Statistics::printRecentLoginStats(true);

@ -5,9 +5,9 @@
* Gets all the info via the ldap module (ldap has to work) * Gets all the info via the ldap module (ldap has to work)
*/ */
require_once api_get_path(SYS_PATH) . 'main/auth/cas/cas_var.inc.php'; require_once api_get_path(SYS_PATH).'main/auth/cas/cas_var.inc.php';
require_once api_get_path(SYS_PATH) . 'main/auth/external_login/ldap.inc.php'; require_once api_get_path(SYS_PATH).'main/auth/external_login/ldap.inc.php';
require_once api_get_path(SYS_PATH) . 'main/auth/external_login/functions.inc.php'; require_once api_get_path(SYS_PATH).'main/auth/external_login/functions.inc.php';
/** /**
* @return true if cas is configured * @return true if cas is configured
@ -187,14 +187,14 @@ function cas_logout($uinfo = null, $location = null)
*/ */
function get_cas_direct_URL($in_course_code) function get_cas_direct_URL($in_course_code)
{ {
return api_get_path(WEB_PATH) . 'main/auth/cas/logincas.php?firstpage=' . $in_course_code; return api_get_path(WEB_PATH).'main/auth/cas/logincas.php?firstpage='.$in_course_code;
} }
function getCASLogoHTML() function getCASLogoHTML()
{ {
$out_res = ""; $out_res = "";
if (api_get_setting("casLogoURL") != "") { if (api_get_setting("casLogoURL") != "") {
$out_res = "<img src='" . api_get_setting("casLogoURL") . "' alt='CAS Logo' />"; $out_res = "<img src='".api_get_setting("casLogoURL")."' alt='CAS Logo' />";
} }
return $out_res; return $out_res;
} }

@ -42,10 +42,10 @@ $json = array(
'identity' => $user['email'] 'identity' => $user['email']
), ),
'issuedOn' => strtotime($userSkill['acquired_skill_at']), 'issuedOn' => strtotime($userSkill['acquired_skill_at']),
'badge' => api_get_path(WEB_CODE_PATH) . "badge/class.php?id=$skillId", 'badge' => api_get_path(WEB_CODE_PATH)."badge/class.php?id=$skillId",
'verify' => array( 'verify' => array(
'type' => 'hosted', 'type' => 'hosted',
'url' => api_get_path(WEB_CODE_PATH) . "badge/assertion.php?" . http_build_query(array( 'url' => api_get_path(WEB_CODE_PATH)."badge/assertion.php?".http_build_query(array(
'user' => $userId, 'user' => $userId,
'skill' => $skillId, 'skill' => $skillId,
'course' => $courseId, 'course' => $courseId,

@ -46,7 +46,7 @@ if (api_is_allowed_to_edit(null, true)) {
Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).'</a>';
} }
$toolbar= Display::toolbarAction('thematic-bar', array($actionLeft)); $toolbar = Display::toolbarAction('thematic-bar', array($actionLeft));
} }
@ -133,12 +133,12 @@ if ($action == 'thematic_list') {
if ($thematic['display_order'] > 1) { if ($thematic['display_order'] > 1) {
$toolbarThematic .= ' <a class="btn btn-default" href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_TINY).'</a>'; $toolbarThematic .= ' <a class="btn btn-default" href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_TINY).'</a>';
} else { } else {
$toolbarThematic .= '<div class="btn btn-default">'.Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_TINY) . '</div>'; $toolbarThematic .= '<div class="btn btn-default">'.Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_TINY).'</div>';
} }
if (isset($thematic['max_thematic_item']) && $thematic['display_order'] < $thematic['max_thematic_item']) { if (isset($thematic['max_thematic_item']) && $thematic['display_order'] < $thematic['max_thematic_item']) {
$toolbarThematic .= ' <a class="btn btn-default" href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_TINY).'</a>'; $toolbarThematic .= ' <a class="btn btn-default" href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'.Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_TINY).'</a>';
} else { } else {
$toolbarThematic .= '<div class="btn btn-default">'.Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_TINY) . '</div>'; $toolbarThematic .= '<div class="btn btn-default">'.Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_TINY).'</div>';
} }
} }
if (api_get_session_id() == $thematic['session_id']) { if (api_get_session_id() == $thematic['session_id']) {

@ -30,7 +30,7 @@ class langstats
return false; //cannot use if sqlite not installed return false; //cannot use if sqlite not installed
} }
if (empty($file)) { if (empty($file)) {
$file = api_get_path(SYS_ARCHIVE_PATH) . '/langstasdb'; $file = api_get_path(SYS_ARCHIVE_PATH).'/langstasdb';
} }
if (is_file($file) && is_writeable($file)) { if (is_file($file) && is_writeable($file)) {
$this->db = new SQLite3($file, SQLITE3_OPEN_READWRITE); $this->db = new SQLite3($file, SQLITE3_OPEN_READWRITE);
@ -39,7 +39,7 @@ class langstats
$this->db = new SQLite3($file); $this->db = new SQLite3($file);
} catch (Exception $e) { } catch (Exception $e) {
$this->error = 'DatabaseCreateError'; $this->error = 'DatabaseCreateError';
error_log('Exception: ' . $e->getMessage()); error_log('Exception: '.$e->getMessage());
return false; return false;
} }
$err = $this->db->exec( $err = $this->db->exec(
@ -104,7 +104,7 @@ class langstats
$num = $row[3]; $num = $row[3];
$num++; $num++;
$res = $this->db->query( $res = $this->db->query(
'UPDATE lang_freq SET term_count = ' . $num . ' WHERE id = ' . $row[0] 'UPDATE lang_freq SET term_count = '.$num.' WHERE id = '.$row[0]
); );
if ($res === false) { if ($res === false) {
$this->error = 'CouldNotUpdateTerm'; $this->error = 'CouldNotUpdateTerm';
@ -136,7 +136,7 @@ class langstats
public function get_popular_terms($num = 1000) public function get_popular_terms($num = 1000)
{ {
$res = $this->db->query( $res = $this->db->query(
'SELECT * FROM lang_freq ORDER BY term_count DESC LIMIT ' . $num 'SELECT * FROM lang_freq ORDER BY term_count DESC LIMIT '.$num
); );
$list = array(); $list = array();
while ($row = $res->fetchArray()) { while ($row = $res->fetchArray()) {
@ -163,16 +163,16 @@ class langstats
*/ */
public function get_variables_origin() public function get_variables_origin()
{ {
$path = api_get_path(SYS_LANG_PATH) . 'english/'; $path = api_get_path(SYS_LANG_PATH).'english/';
$vars = array(); $vars = array();
$priority = array('trad4all'); $priority = array('trad4all');
foreach ($priority as $file) { foreach ($priority as $file) {
$list = SubLanguageManager::get_all_language_variable_in_file( $list = SubLanguageManager::get_all_language_variable_in_file(
$path . $file . '.inc.php', $path.$file.'.inc.php',
true true
); );
foreach ($list as $var => $trad) { foreach ($list as $var => $trad) {
$vars[$var] = $file . '.inc.php'; $vars[$var] = $file.'.inc.php';
} }
} }
$files = scandir($path); $files = scandir($path);
@ -181,7 +181,7 @@ class langstats
continue; continue;
} }
$list = SubLanguageManager::get_all_language_variable_in_file( $list = SubLanguageManager::get_all_language_variable_in_file(
$path . $file, $path.$file,
true true
); );
foreach ($list as $var => $trad) { foreach ($list as $var => $trad) {

@ -18,12 +18,12 @@ die();
$list = file('input.txt'); $list = file('input.txt');
require_once '../../inc/global.inc.php'; require_once '../../inc/global.inc.php';
$users = Database::get_main_table(TABLE_MAIN_USER); $users = Database::get_main_table(TABLE_MAIN_USER);
$string=''; $string = '';
foreach ($list as $mail) { foreach ($list as $mail) {
$mail = trim($mail); $mail = trim($mail);
$sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n"; $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n";
$res = Database::query($sql); $res = Database::query($sql);
if ($res === false) { die(mysql_error());} if ($res === false) { die(mysql_error()); }
if (Database::num_rows($res) == 0) { if (Database::num_rows($res) == 0) {
$string .= 'No encontrado;'.$row['email']; $string .= 'No encontrado;'.$row['email'];
} else { } else {
@ -32,4 +32,4 @@ foreach ($list as $mail) {
} }
} }
echo $string; echo $string;
file_put_contents('/tmp/list.txt',$string); file_put_contents('/tmp/list.txt', $string);

@ -66,35 +66,35 @@ if ($dir[0] == '.') {
} }
if ($dir[0] != '/') { if ($dir[0] != '/') {
$dir = '/' . $dir; $dir = '/'.$dir;
} }
if ($dir[strlen($dir) - 1] != '/') { if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/'; $dir .= '/';
} }
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
if (!is_dir($filepath)) { if (!is_dir($filepath)) {
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/'; $dir = '/';
} }
//groups //TODO: clean //groups //TODO: clean
if (!empty($groupId)) { if (!empty($groupId)) {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
"url" => "../group/group_space.php?" . api_get_cidreq(), "url" => "../group/group_space.php?".api_get_cidreq(),
"name" => get_lang('GroupSpace') "name" => get_lang('GroupSpace')
); );
$group = GroupManager:: get_group_properties($groupId); $group = GroupManager:: get_group_properties($groupId);
$path = explode('/', $dir); $path = explode('/', $dir);
if ('/' . $path[1] != $group['directory']) { if ('/'.$path[1] != $group['directory']) {
api_not_allowed(true); api_not_allowed(true);
} }
} }
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
"url" => "./document.php?curdirpath=" . urlencode($dir) . "&" . api_get_cidreq(), "url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(),
"name" => get_lang('Documents') "name" => get_lang('Documents')
); );
@ -130,11 +130,11 @@ $array_len = count($dir_array);
$dir_acum = ''; $dir_acum = '';
for ($i = 0; $i < $array_len; $i++) { for ($i = 0; $i < $array_len; $i++) {
$url_dir = 'document.php?&curdirpath=' . $dir_acum . $dir_array[$i]; $url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i];
//Max char 80 //Max char 80
$url_to_who = cut($dir_array[$i], 80); $url_to_who = cut($dir_array[$i], 80);
$interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who); $interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who);
$dir_acum .= $dir_array[$i] . '/'; $dir_acum .= $dir_array[$i].'/';
} }
$service = isset($_GET['service']) ? $_GET['service'] : 'pediaphon'; $service = isset($_GET['service']) ? $_GET['service'] : 'pediaphon';
@ -142,15 +142,15 @@ $service = isset($_GET['service']) ? $_GET['service'] : 'pediaphon';
Display:: display_header($nameTools, 'Doc'); Display:: display_header($nameTools, 'Doc');
echo '<div class="actions">'; echo '<div class="actions">';
echo '<a href="document.php?id=' . $document_id . '">' . echo '<a href="document.php?id='.$document_id.'">'.
Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '',
ICON_SIZE_MEDIUM) . '</a>'; ICON_SIZE_MEDIUM).'</a>';
echo '<a href="create_audio.php?' . api_get_cidreq() . '&id=' . $document_id . '&service=pediaphon">' . echo '<a href="create_audio.php?'.api_get_cidreq().'&id='.$document_id.'&service=pediaphon">'.
Display::return_icon('pediaphon.png', get_lang('Pediaphon'), '', ICON_SIZE_MEDIUM) . '</a>'; Display::return_icon('pediaphon.png', get_lang('Pediaphon'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="create_audio.php?' . api_get_cidreq() . '&id=' . $document_id . '&service=google">' . echo '<a href="create_audio.php?'.api_get_cidreq().'&id='.$document_id.'&service=google">'.
Display::return_icon('google.png', get_lang('GoogleAudio'), '', ICON_SIZE_MEDIUM) . '</a>'; Display::return_icon('google.png', get_lang('GoogleAudio'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo '</div>';
?> ?>
<!-- javascript and styles for textareaCounter--> <!-- javascript and styles for textareaCounter-->
@ -215,14 +215,14 @@ $options = $options_pedia = array();
$selected_language = null; $selected_language = null;
while ($row = Database::fetch_array($result_select)) { while ($row = Database::fetch_array($result_select)) {
$options[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')'; $options[$row['isocode']] = $row['original_name'].' ('.$row['english_name'].')';
if (in_array($row['isocode'], array('de', 'en', 'es', 'fr'))) { if (in_array($row['isocode'], array('de', 'en', 'es', 'fr'))) {
$options_pedia[$row['isocode']] = $row['original_name'] . ' (' . $row['english_name'] . ')'; $options_pedia[$row['isocode']] = $row['original_name'].' ('.$row['english_name'].')';
} }
} }
if ($service == 'google') { if ($service == 'google') {
$selected_language = api_get_language_isocode();//lang default is the course language $selected_language = api_get_language_isocode(); //lang default is the course language
$form = new FormValidator('form1', 'post', api_get_self().'?'.api_get_cidreq(), '', array('id' => 'form1')); $form = new FormValidator('form1', 'post', api_get_self().'?'.api_get_cidreq(), '', array('id' => 'form1'));
$form->addHeader(get_lang('HelpText2Audio')); $form->addHeader(get_lang('HelpText2Audio'));
@ -274,16 +274,16 @@ if ($service == 'pediaphon') {
var voices = new Array() var voices = new Array()
<!--German --> <!--German -->
voices['de'] = ["<?php echo get_lang('Female') . ' (de1)'; ?>|de1", "<?php echo get_lang('Male') . ' (de2)'; ?>|de2", "<?php echo get_lang('Female') . ' (de3)'; ?>|de3", "<?php echo get_lang('Male') . ' (de4)'; ?>|de4", "<?php echo get_lang('Female') . ' (de5)'; ?>|de5", "<?php echo get_lang('Male') . ' (de6)'; ?>|de6", "<?php echo get_lang('Female') . ' (de7)'; ?>|de7", "<?php echo get_lang('Female') . ' (de8 HQ)'; ?>|de8"] voices['de'] = ["<?php echo get_lang('Female').' (de1)'; ?>|de1", "<?php echo get_lang('Male').' (de2)'; ?>|de2", "<?php echo get_lang('Female').' (de3)'; ?>|de3", "<?php echo get_lang('Male').' (de4)'; ?>|de4", "<?php echo get_lang('Female').' (de5)'; ?>|de5", "<?php echo get_lang('Male').' (de6)'; ?>|de6", "<?php echo get_lang('Female').' (de7)'; ?>|de7", "<?php echo get_lang('Female').' (de8 HQ)'; ?>|de8"]
<!--English --> <!--English -->
voices['en'] = ["<?php echo get_lang('Male') . ' (en1)'; ?>|en1", "<?php echo get_lang('Male') . ' (en2 HQ)'; ?>|en2", "<?php echo get_lang('Female') . ' (us1)'; ?>|us1", "<?php echo get_lang('Male') . ' (us2)'; ?>|us2", "<?php echo get_lang('Male') . ' (us3)'; ?>|us3", "<?php echo get_lang('Female') . '(us4 HQ)'; ?>|us4"] voices['en'] = ["<?php echo get_lang('Male').' (en1)'; ?>|en1", "<?php echo get_lang('Male').' (en2 HQ)'; ?>|en2", "<?php echo get_lang('Female').' (us1)'; ?>|us1", "<?php echo get_lang('Male').' (us2)'; ?>|us2", "<?php echo get_lang('Male').' (us3)'; ?>|us3", "<?php echo get_lang('Female').'(us4 HQ)'; ?>|us4"]
<!--Spanish --> <!--Spanish -->
voices['es'] = ["<?php echo get_lang('Male') . ' (es5 HQ)'; ?>|es5"] voices['es'] = ["<?php echo get_lang('Male').' (es5 HQ)'; ?>|es5"]
<!--French --> <!--French -->
voices['fr'] = ["<?php echo get_lang('Female') . ' (fr8 HQ)'; ?>|fr8"] voices['fr'] = ["<?php echo get_lang('Female').' (fr8 HQ)'; ?>|fr8"]
$(document).ready(function () { $(document).ready(function () {
$('.lang').on('change', function () { $('.lang').on('change', function () {
@ -314,11 +314,11 @@ Display:: display_footer();
*/ */
function downloadMP3_google($filepath, $dir) function downloadMP3_google($filepath, $dir)
{ {
$location = 'create_audio.php?' . api_get_cidreq() . '&id=' . intval($_POST['id']) . '&service=google'; $location = 'create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&service=google';
//security //security
if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
echo '<script>window.location.href="' . $location . '"</script>'; echo '<script>window.location.href="'.$location.'"</script>';
return; return;
} }
@ -363,7 +363,7 @@ function downloadMP3_google($filepath, $dir)
$proxySettings = api_get_configuration_value('proxy_settings'); $proxySettings = api_get_configuration_value('proxy_settings');
$key = api_get_configuration_value('translate_app_google_key'); $key = api_get_configuration_value('translate_app_google_key');
$url = "https://www.googleapis.com/language/translate/v2?key=$key&" . $clean_lang . "&target=$clean_lang&q=" . urlencode($clean_text) . ""; $url = "https://www.googleapis.com/language/translate/v2?key=$key&".$clean_lang."&target=$clean_lang&q=".urlencode($clean_text)."";
if (empty($proxySettings)) { if (empty($proxySettings)) {
$content = file_get_contents($url); $content = file_get_contents($url);
@ -383,7 +383,7 @@ function downloadMP3_google($filepath, $dir)
$relativeUrlPath = $dir; $relativeUrlPath = $dir;
$doc_id = add_document( $doc_id = add_document(
$_course, $_course,
$relativeUrlPath . $audio_filename, $relativeUrlPath.$audio_filename,
'file', 'file',
filesize($documentPath), filesize($documentPath),
$audio_title $audio_title
@ -402,7 +402,7 @@ function downloadMP3_google($filepath, $dir)
); );
Display::display_confirmation_message(get_lang('DocumentCreated')); Display::display_confirmation_message(get_lang('DocumentCreated'));
//return to location //return to location
echo '<script>window.location.href="' . $location . '"</script>'; echo '<script>window.location.href="'.$location.'"</script>';
} }
/** /**
@ -415,10 +415,10 @@ function downloadMP3_google($filepath, $dir)
*/ */
function downloadMP3_pediaphon($filepath, $dir) function downloadMP3_pediaphon($filepath, $dir)
{ {
$location = 'create_audio.php?' . api_get_cidreq() . '&id=' . intval($_POST['id']) . '&service=pediaphon'; $location = 'create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&service=pediaphon';
//security //security
if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
echo '<script>window.location.href="' . $location . '"</script>'; echo '<script>window.location.href="'.$location.'"</script>';
return; return;
} }
$_course = api_get_course_info(); $_course = api_get_course_info();
@ -428,33 +428,33 @@ function downloadMP3_pediaphon($filepath, $dir)
$clean_text = trim($_POST['text']); $clean_text = trim($_POST['text']);
$clean_voices = Security::remove_XSS($_POST['voices']); $clean_voices = Security::remove_XSS($_POST['voices']);
if (empty($clean_title) || empty($clean_text) || empty($clean_voices)) { if (empty($clean_title) || empty($clean_text) || empty($clean_voices)) {
echo '<script>window.location.href="' . $location . '"</script>'; echo '<script>window.location.href="'.$location.'"</script>';
return; return;
} }
$clean_title = Security::remove_XSS($clean_title); $clean_title = Security::remove_XSS($clean_title);
$clean_title = Database::escape_string($clean_title); $clean_title = Database::escape_string($clean_title);
$clean_title = str_replace(' ', '_', $clean_title);//compound file names $clean_title = str_replace(' ', '_', $clean_title); //compound file names
$clean_text = Security::remove_XSS($clean_text); $clean_text = Security::remove_XSS($clean_text);
$clean_lang = Security::remove_XSS($_POST['lang']); $clean_lang = Security::remove_XSS($_POST['lang']);
$clean_speed = Security::remove_XSS($_POST['speed']); $clean_speed = Security::remove_XSS($_POST['speed']);
$extension = 'mp3'; $extension = 'mp3';
$audio_filename = $clean_title . '.' . $extension; $audio_filename = $clean_title.'.'.$extension;
$audio_title = str_replace('_', ' ', $clean_title); $audio_title = str_replace('_', ' ', $clean_title);
//prevent duplicates //prevent duplicates
if (file_exists($filepath . '/' . $clean_title . '.' . $extension)) { if (file_exists($filepath.'/'.$clean_title.'.'.$extension)) {
$i = 1; $i = 1;
while (file_exists($filepath . '/' . $clean_title . '_' . $i . '.' . $extension)) { while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) {
$i++; $i++;
} }
$audio_filename = $clean_title . '_' . $i . '.' . $extension; $audio_filename = $clean_title.'_'.$i.'.'.$extension;
$audio_title = $clean_title . '_' . $i . '.' . $extension; $audio_title = $clean_title.'_'.$i.'.'.$extension;
$audio_title = str_replace('_', ' ', $audio_title); $audio_title = str_replace('_', ' ', $audio_title);
} }
$documentPath = $filepath . '/' . $audio_filename; $documentPath = $filepath.'/'.$audio_filename;
$clean_text = api_replace_dangerous_char($clean_text); $clean_text = api_replace_dangerous_char($clean_text);
//adding the file //adding the file
@ -463,17 +463,17 @@ function downloadMP3_pediaphon($filepath, $dir)
$url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi'; $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi';
$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/'; $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/';
} else { } else {
$url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_' . $clean_lang . '.cgi';//en, es, fr $url_pediaphon = 'http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_'.$clean_lang.'.cgi'; //en, es, fr
$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/' . $clean_lang . '\/(.*)\.mp3\"/'; $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/'.$clean_lang.'\/(.*)\.mp3\"/';
} }
$data = "stimme=" . $clean_voices . "&inputtext=" . $clean_text . "&speed=" . $clean_speed . "&go=speak"; $data = "stimme=".$clean_voices."&inputtext=".$clean_text."&speed=".$clean_speed."&go=speak";
$opts = array( $opts = array(
'http' => 'http' =>
array( array(
'method' => 'POST', 'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n", 'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
"Content-Length: " . strlen($data) . "\r\n", "Content-Length: ".strlen($data)."\r\n",
'content' => $data 'content' => $data
) )
); );
@ -517,5 +517,5 @@ function downloadMP3_pediaphon($filepath, $dir)
); );
Display::display_confirmation_message(get_lang('DocumentCreated')); Display::display_confirmation_message(get_lang('DocumentCreated'));
//return to location //return to location
echo '<script>window.location.href="' . $location . '"</script>'; echo '<script>window.location.href="'.$location.'"</script>';
} }

@ -66,7 +66,7 @@ function GetQuizName($fname, $fpath)
if ($title == '') { if ($title == '') {
$title = basename($fname); $title = basename($fname);
} }
return (string)$title; return (string) $title;
} }
/** /**
@ -177,7 +177,7 @@ function GetImgName($imgtag)
if ($src == '') { if ($src == '') {
return ''; return '';
} else { } else {
$tmp_src = basename($src) ; $tmp_src = basename($src);
if ($tmp_src == '') { if ($tmp_src == '') {
return $src; return $src;
} else { } else {
@ -199,7 +199,7 @@ function GetSrcName($imgtag)
{ {
// Select src tag from img tag. // Select src tag from img tag.
$match = array(); $match = array();
preg_match("|(src=\".*\" )|U", $imgtag, $match); //src preg_match("|(src=\".*\" )|U", $imgtag, $match); //src
list($key, $srctag) = each($match); list($key, $srctag) = each($match);
$src = substr($srctag, 5, (strlen($srctag) - 7)); $src = substr($srctag, 5, (strlen($srctag) - 7));
if (stristr($src, 'http') === false) { if (stristr($src, 'http') === false) {
@ -231,8 +231,8 @@ function GetImgParams($fname, $fpath, &$imgparams, &$imgcount)
while (list($key, $imgtag) = each($match)) { while (list($key, $imgtag) = each($match)) {
$imgname = GetImgName($imgtag); $imgname = GetImgName($imgtag);
if ($imgname != '' && !in_array($imgname, $imgparams)) { if ($imgname != '' && !in_array($imgname, $imgparams)) {
array_push($imgparams, $imgname); // name (+ type) of the images in the html test array_push($imgparams, $imgname); // name (+ type) of the images in the html test
$imgcount = $imgcount + 1; // number of images in the html test $imgcount = $imgcount + 1; // number of images in the html test
} }
} }
} }
@ -408,7 +408,7 @@ function CheckSubFolder($path)
if ($file != '..') { if ($file != '..') {
$full_name = $folder.'/'.$file; $full_name = $folder.'/'.$file;
if (is_dir($full_name)) { if (is_dir($full_name)) {
$dflag = 1; // first directory $dflag = 1; // first directory
} }
} }
} }

@ -8,7 +8,7 @@
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users(); api_block_anonymous_users();
GradebookUtils::block_students(); GradebookUtils::block_students();
$select_eval=Security::remove_XSS($_GET['selecteval']); $select_eval = Security::remove_XSS($_GET['selecteval']);
if (empty($select_eval)) { if (empty($select_eval)) {
api_not_allowed(); api_not_allowed();
} }
@ -34,7 +34,7 @@ if ($edit_result_form->validate()) {
/** @var Result $result */ /** @var Result $result */
$result = $resultedit[0]; $result = $resultedit[0];
if (empty($score)){ if (empty($score)) {
$score = 0; $score = 0;
} }
$result->set_score(api_number_format($score, api_get_setting('gradebook_number_decimals'))); $result->set_score(api_number_format($score, api_get_setting('gradebook_number_decimals')));
@ -47,11 +47,11 @@ if ($edit_result_form->validate()) {
$table = $edit_result_form->toHtml(); $table = $edit_result_form->toHtml();
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'], 'url' => $_SESSION['gradebook_dest'],
'name' => get_lang('Gradebook') 'name' => get_lang('Gradebook')
); );
$interbreadcrumb[]= array ( $interbreadcrumb[] = array(
'url' => 'gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(), 'url' => 'gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(),
'name' => get_lang('ViewResult') 'name' => get_lang('ViewResult')
); );

@ -50,7 +50,7 @@ if ($ext != 'wav') {
// Do not use here check Fileinfo method because return: text/plain // Do not use here check Fileinfo method because return: text/plain
$dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; $dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$saveDir = $dirBaseDocuments . $wamidir; $saveDir = $dirBaseDocuments.$wamidir;
if (!is_dir($saveDir)) { if (!is_dir($saveDir)) {
DocumentManager::createDefaultAudioFolder($_course); DocumentManager::createDefaultAudioFolder($_course);
@ -90,7 +90,7 @@ $output = true;
ob_start(); ob_start();
// Strangely the file path changes with a double extension // Strangely the file path changes with a double extension
copy($documentPath, $documentPath . '.wav'); copy($documentPath, $documentPath.'.wav');
$documentData = DocumentManager::upload_document( $documentData = DocumentManager::upload_document(
$file, $file,

@ -43,9 +43,9 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group
*/ */
function _createElements() function _createElements()
{ {
$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
$this->_elements[0]->setChecked(true); $this->_elements[0]->setChecked(true);
$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array('onclick' => 'javascript:receivers_show(\'receivers_to\')'));
$this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
$this->_elements[2]->setSelected($this->receivers_selected); $this->_elements[2]->setSelected($this->receivers_selected);
} }

@ -25,8 +25,8 @@ $linkUrl = html_entity_decode(Security::remove_XSS($linkInfo['url']));
// Launch event // Launch event
Event::event_link($linkId); Event::event_link($linkId);
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
header("Location: $linkUrl"); header("Location: $linkUrl");
exit; exit;

@ -121,7 +121,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
$intro_content = api_substr($content, 0, api_strpos($content, $matches[0][0])); $intro_content = api_substr($content, 0, api_strpos($content, $matches[0][0]));
$items_to_create[get_lang('Introduction')] = $intro_content; $items_to_create[get_lang('Introduction')] = $intro_content;
for ($i = 0; $i<count($matches[0]); $i++) { for ($i = 0; $i < count($matches[0]); $i++) {
if (empty($matches[1][$i])) if (empty($matches[1][$i]))
continue; continue;
@ -195,7 +195,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
$first_item = 0; $first_item = 0;
foreach($pages as $key => $page_content) { foreach ($pages as $key => $page_content) {
// For every pages, we create a new file. // For every pages, we create a new file.
$key += 1; $key += 1;
@ -249,7 +249,7 @@ class OpenOfficeTextDocument 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) {
@ -258,7 +258,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
} }
} }
} }
$page_content = $all_specific_terms .' '. $page_content; $page_content = $all_specific_terms.' '.$page_content;
$ic_slide->addValue('content', $page_content); $ic_slide->addValue('content', $page_content);
// Add a comment to say terms separated by commas. // Add a comment to say terms separated by commas.
$courseid = api_get_course_id(); $courseid = api_get_course_id();
@ -269,7 +269,7 @@ class OpenOfficeTextDocument 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);
@ -312,7 +312,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
$content = '<body><div style="width:'.$max_width.'">'.$content; $content = '<body><div style="width:'.$max_width.'">'.$content;
} }
$content = preg_replace('|</body>|i','</div>\\0', $content, -1, $count); $content = preg_replace('|</body>|i', '</div>\\0', $content, -1, $count);
if ($count < 1) { if ($count < 1) {
$content = $content.'</div></body>'; $content = $content.'</div></body>';
} }
@ -340,7 +340,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
} }
} elseif ($img_width > $max_width - 10) { } elseif ($img_width > $max_width - 10) {
$picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width-10).'"', $images[0][$key]); $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width - 10).'"', $images[0][$key]);
$content = str_replace($images[0][$key], $picture_resized, $content); $content = str_replace($images[0][$key], $picture_resized, $content);
} }
} }

@ -21,7 +21,7 @@ class ch_percentage extends survey_question
$options[$key] = $value; $options[$key] = $value;
} }
$name = 'question' . $questionData['question_id']; $name = 'question'.$questionData['question_id'];
$form->addSelect( $form->addSelect(
$name, null, $options $name, null, $options

@ -15,13 +15,13 @@ $serversys = api_get_path(SYS_CODE_PATH).'webservices/';
$script = isset($_POST['script']) ? $_POST['script'] : false; $script = isset($_POST['script']) ? $_POST['script'] : false;
$function = isset($_POST['function']) ? $_POST['function'] : false; $function = isset($_POST['function']) ? $_POST['function'] : false;
$contact= $server.$script.'?wsdl'; $contact = $server.$script.'?wsdl';
$client = new nusoap_client($contact); $client = new nusoap_client($contact);
$err = $client->getError(); $err = $client->getError();
if ($err) { if ($err) {
// Display the error // Display the error
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; echo '<h2>Constructor error</h2><pre>'.$err.'</pre>';
// At this point, you know the call that follows will fail // At this point, you know the call that follows will fail
} }
$response = array(); $response = array();
@ -37,8 +37,8 @@ if (!empty($function)) {
$list = scandir($serversys); $list = scandir($serversys);
$scripts = array(); $scripts = array();
foreach ($list as $item) { foreach ($list as $item) {
if (substr($item,0,1) == '.') { continue; } if (substr($item, 0, 1) == '.') { continue; }
if (substr($item,-8)=='soap.php') { if (substr($item, -8) == 'soap.php') {
$scripts[] = $item; $scripts[] = $item;
} }
} }
@ -55,7 +55,7 @@ foreach ($scripts as $script) {
?> ?>
</select><br /> </select><br />
<label for="function">Function</label> <label for="function">Function</label>
<input type="text" name="function" value="<?php echo $function;?>"></input><br /> <input type="text" name="function" value="<?php echo $function; ?>"></input><br />
<label for="param[0]">Param 0</label> <label for="param[0]">Param 0</label>
<input type="text" name="param[0]" ></input><br /> <input type="text" name="param[0]" ></input><br />
<input type="submit" name="submit" value="Send"/> <input type="submit" name="submit" value="Send"/>

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION; $current_course_tool = TOOL_STUDENTPUBLICATION;
api_protect_course_script(true); api_protect_course_script(true);
@ -74,7 +74,7 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !api_is_in
get_lang('UploadMyAssignment'), get_lang('UploadMyAssignment'),
null, null,
ICON_SIZE_MEDIUM ICON_SIZE_MEDIUM
) . get_lang('UploadMyAssignment'), ).get_lang('UploadMyAssignment'),
$url, $url,
array('class'=>'btn-toolbar') array('class'=>'btn-toolbar')
); );
@ -125,10 +125,10 @@ if (!api_is_invitee()) {
); );
$column_model = array( $column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'), array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
array('name'=>'qualification', 'index'=>'qualification', 'width'=>'30', 'align'=>'center', 'search' => 'true'), array('name'=>'qualification', 'index'=>'qualification', 'width'=>'30', 'align'=>'center', 'search' => 'true'),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'), array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
array('name'=>'qualificator_id', 'index'=>'qualificator_id', 'width'=>'20', 'align'=>'left', 'search' => 'true'), array('name'=>'qualificator_id', 'index'=>'qualificator_id', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
); );
@ -144,11 +144,11 @@ if (!api_is_invitee()) {
); );
$column_model = array( $column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'), array('name'=>'type', 'index'=>'file', 'width'=>'5', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"), array('name'=>'title', 'index'=>'title', 'width'=>'60', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
array('name'=>'qualification', 'index'=>'qualification', 'width'=>'30', 'align'=>'center', 'search' => 'true'), array('name'=>'qualification', 'index'=>'qualification', 'width'=>'30', 'align'=>'center', 'search' => 'true'),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true', 'sortable'=>'false'), array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'30', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true', 'sortable'=>'false'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false') array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
); );
} }

Loading…
Cancel
Save