Removing require_once libs are already loaded in global.inc.php

skala
Julio Montoya 12 years ago
parent e2845dc9bd
commit 030b27b230
  1. 19
      main/auth/cas/logincas.php
  2. 28
      main/auth/cas/logout.php
  3. 8
      main/blog/download.php

@ -1,6 +1,6 @@
<?php
//----------------------------------------------------------------------
// CAS PLUGIN
// CAS PLUGIN
//----------------------------------------------------------------------
// Copyright (c) 2006-2007 University Marc Bloch (UMB)
//----------------------------------------------------------------------
@ -10,25 +10,24 @@
//----------------------------------------------------------------------
// Authors: Pierre Cahard
//----------------------------------------------------------------------
// Load required
// Load required
require('../../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'events.lib.inc.php');
require_once('authcas.php');
use \ChamiloSession as Session;
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
// phpCAS
/*
If we are not logged and in our browser enter an URL with a name of a course
/*
If we are not logged and in our browser enter an URL with a name of a course
e.g. http://www.chamilo.fr/chamilo/courses/COURSTESTOSETE/?id_session=0
we go to page api_not_allowed :
> Vous n'êtes pas autorisé à accéder à cette page.
> Soit votre connexion a expiré, soit vous essayez d'accéder à une page pour laquelle vous ne disposez pas des permissions suffisantes.
> Veuillez vous identifier à nouveau depuis la page d'accueil
> Vous n'<EFBFBD>tes pas autoris<EFBFBD> <EFBFBD> acc<EFBFBD>der <EFBFBD> cette page.
> Soit votre connexion a expir<EFBFBD>, soit vous essayez d'acc<EFBFBD>der <EFBFBD> une page pour laquelle vous ne disposez pas des permissions suffisantes.
> Veuillez vous identifier <EFBFBD> nouveau depuis la page d'accueil
If we click on the link to go to homepage, some datas are entered in $_SESSION and if we enter our CAS loggin, we go to api_not_allowad_page again
and again
As a result, if we are not logged on, we have to destroy the session variables, before calling CAS page
*/
*/
if (api_is_anonymous()) {
Session::destroy();
}

@ -1,18 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/*
Call this file to disconnect from CAS session.
logoutWithUrl() not used because with CAS v3 you cannot redirect your logout to a specific URL
because of security reason.
*/
require('../..//inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'events.lib.inc.php');
require_once('authcas.php');
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri);
phpCAS::logout();
?>
/* For licensing terms, see /license.txt */
/*
Call this file to disconnect from CAS session.
logoutWithUrl() not used because with CAS v3 you cannot redirect your logout to a specific URL
because of security reason.
*/
require('../..//inc/global.inc.php');
require_once('authcas.php');
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri);
phpCAS::logout();

@ -17,8 +17,6 @@ session_cache_limiter('public');
require_once '../inc/global.inc.php';
$this_section=SECTION_COURSES;
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
// IMPORTANT to avoid caching of documents
header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
header('Cache-Control: public');
@ -46,7 +44,7 @@ if (is_dir($full_file_name)) {
//create the path
$document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
//redirect
header('Location: '.$document_explorer);
header('Location: '.$document_explorer);
}
$tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
@ -55,12 +53,12 @@ $course_id = api_get_course_int_id();
// launch event
event_download($doc_url);
$sql = 'SELECT filename FROM '.$tbl_blogs_attachment.'
$sql = 'SELECT filename FROM '.$tbl_blogs_attachment.'
WHERE c_id = '.$course_id.' AND path LIKE BINARY "'.Database::escape_string($doc_url).'"';
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$row = Database::fetch_array($result);
if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/')) {
if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/')) {
DocumentManager::file_send_for_download($full_file_name, TRUE, $row['filename']);
}
}

Loading…
Cancel
Save