Remove deprecated api_browser_support(), remove Browser class.

pull/3064/head
Julio Montoya 5 years ago
parent af0fd1a49e
commit 7f259e43ba
  1. 77
      main/auth/gotocourse.php
  2. 1
      main/exercise/exercise.php
  3. 7
      main/exercise/overview.php
  4. 7
      main/inc/ajax/model.ajax.php
  5. 7
      main/inc/ajax/statistics.ajax.php
  6. 3
      main/inc/lib/api.lib.php
  7. 1221
      main/inc/lib/browser/Browser.php

@ -1,77 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Allow the user to login to a course after reaching a course URL
* (e.g. http://chamilo.chamilo.org/courses/MYCOURSE/?id_session=0 )
* See https://support.chamilo.org/issues/6768.
*
* Author : hubert.borderiou@grenet.fr
*/
require_once __DIR__.'/../inc/global.inc.php';
require_once api_get_path(SYS_PATH).'main/auth/cas/authcas.php';
$msg = null;
if (isset($_GET['firstpage'])) {
$firstpage = $_GET['firstpage'];
// if course is public, go to course without auth
$tab_course_info = api_get_course_info($firstpage);
api_set_firstpage_parameter($firstpage);
$tpl = new Template(null, 1, 1);
$action = api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
$action = str_replace('&amp;', '&', $action);
$form = new FormValidator('formLogin', 'post', $action, null, ['class' => 'form-stacked']);
$params = [
'placeholder' => get_lang('Username'),
];
// Avoid showing the autocapitalize option if the browser doesn't
// support it: this attribute is against the HTML5 standard
if (api_browser_support('autocapitalize')) {
$params['autocapitalize'] = 'none';
}
$form->addElement(
'text',
'login',
null,
$params
);
$params = [
'placeholder' => get_lang('Password'),
];
if (api_browser_support('autocapitalize')) {
$params['autocapitalize'] = 'none';
}
$form->addElement(
'password',
'password',
null,
$params
);
$form->addButtonNext(get_lang('Login'), 'submitAuth');
// see same text in main_api.lib.php function api_not_allowed
if (api_is_cas_activated()) {
$msg .= Display::return_message(sprintf(get_lang('You already have an institutional account'), api_get_setting("Institution")), '', false);
$msg .= Display::div("<br/><a href='".get_cas_direct_URL(api_get_course_id())."'>".getCASLogoHTML()." ".sprintf(get_lang('Login with your account'), api_get_setting("Institution"))."</a><br/><br/>", ['align' => 'center']);
$msg .= Display::return_message(get_lang('You don\'t have an institutional account'));
$msg .= "<p style='text-align:center'><a href='#' onclick='$(this).parent().next().toggle()'>".get_lang('Login without an institutional account')."</a></p>";
$msg .= "<div style='display:none;'>";
}
$msg .= '<div class="well_login">';
$msg .= $form->returnForm();
$msg .= '</div>';
if (api_is_cas_activated()) {
$msg .= "</div>";
}
$msg .= '<hr/><p style="text-align:center"><a href="'.api_get_path(WEB_PATH).'">'.get_lang('Return to Course Homepage').'</a></p>';
$tpl->assign('content', '<h4>'.get_lang('Please login to go to this course').'</h4>'.$msg);
$tpl->display_one_col_template();
} else {
api_delete_firstpage_parameter();
header('Location: '.api_get_path(WEB_PATH).'index.php');
exit;
}

@ -42,7 +42,6 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);

@ -187,15 +187,8 @@ $table_content = '';
/* Make a special case for IE, which doesn't seem to be able to handle the
* results popup -> send it to the full results page */
$browser = new Browser();
$current_browser = $browser->getBrowser();
$url_suffix = '';
$btn_class = ' ';
if ($current_browser == 'Internet Explorer') {
$url_suffix = '&show_headers=1';
$btn_class = '';
}
$blockShowAnswers = false;
if (in_array(
$objExercise->results_disabled,

@ -2290,12 +2290,7 @@ if (in_array($action, $allowed_actions)) {
break;
case 'xls_html':
//TODO add date if exists
$browser = new Browser();
if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS) {
Export::export_table_xls_html($array, $fileName, 'ISO-8859-15');
} else {
Export::export_table_xls_html($array, $fileName);
}
Export::export_table_xls_html($array, $fileName);
break;
case 'csv':
default:

@ -92,12 +92,7 @@ switch ($action) {
break;
case 'xls_html':
//TODO add date if exists
$browser = new Browser();
if ($browser->getPlatform() == Browser::PLATFORM_WINDOWS) {
Export::export_table_xls_html($list, $fileName, 'ISO-8859-15');
} else {
Export::export_table_xls_html($list, $fileName);
}
Export::export_table_xls_html($list, $fileName);
break;
case 'csv':
default:

@ -6931,6 +6931,7 @@ function api_get_template($path_type = 'rel')
* checked by this method. Make sure you check its definition first.
*
* @param string $format Can be a file format (extension like svg, webm, ...) or a feature (like autocapitalize, ...)
* @deprecated
*
* @return bool or return text array if $format=check_browser
*
@ -6938,6 +6939,8 @@ function api_get_template($path_type = 'rel')
*/
function api_browser_support($format = '')
{
return true;
$browser = new Browser();
$current_browser = $browser->getBrowser();
$a_versiontemp = explode('.', $browser->getVersion());

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save