skala
Laurent Opprecht 13 years ago
commit 6bf3f4eebf
  1. 57
      custompages/loggedout.php
  2. 10
      index.php
  3. 2
      main/auth/shibboleth/app/controller/shibboleth_controller.class.php
  4. 14
      main/auth/shibboleth/app/shibboleth.class.php
  5. 6
      main/auth/shibboleth/app/view/shibboleth_display.class.php
  6. 7
      main/auth/shibboleth/init.php
  7. 0
      main/auth/shibboleth/lib/model.class.php
  8. 0
      main/auth/shibboleth/lib/scaffolder/scaffolder.class.php
  9. 0
      main/auth/shibboleth/lib/scaffolder/template/default.php
  10. 0
      main/auth/shibboleth/lib/scaffolder/template/model.php
  11. 0
      main/auth/shibboleth/lib/scaffolder/template/public.php
  12. 0
      main/auth/shibboleth/lib/shibboleth_config.class.php
  13. 20
      main/auth/shibboleth/lib/shibboleth_session.class.php
  14. 0
      main/auth/shibboleth/lib/store.class.php
  15. 3
      main/inc/global.inc.php
  16. 60
      main/inc/lib/autoload.class.php
  17. 77
      main/inc/lib/redirect.class.php
  18. 37
      main/inc/lib/request.class.php
  19. 13
      main/inc/lib/userportal.lib.php
  20. 4
      main/inc/local.inc.php
  21. 1
      plugin/rss/resources/rss.css

@ -0,0 +1,57 @@
<?php
/**
* Displayed after the user has been logged out.
*/
$called_direcly = !function_exists('api_get_path');
if ($called_direcly)
{
return '';
}
require_once('language.php');
$www = api_get_path('WEB_PATH');
?>
<!DOCTYPE html>
<html>
<head>
<title>Custompage - logged out</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--[if !IE 6]><!-->
<link rel="stylesheet" type="text/css" href="<?php echo $www ?>custompages/style.css" />
<!--<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="/custompages/style-ie6.css" />
<![endif]-->
<script type="text/javascript" src="<?php echo $www ?>custompages/jquery-1.5.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (top.location != location)
top.location.href = document.location.href ;
});
</script>
</head>
<body>
<div id="backgroundimage">
<img src="<?php echo $www ?>/custompages/images/page-background.png" class="backgroundimage" alt="background"/>
</div>
<div id="wrapper">
<div id="header">
<img src="<?php echo $www ?>/custompages/images/header.png" alt="Logo" />
</div>
<div id="login-form-box" class="form-box">
<div id="login-form-info" class="form-info">
You have been logged out.
</div>
</div>
<a href="<?php echo $www . 'user_portal.php'; ?>">Go to your portal</a>
<div id="footer">
<img src="<?php echo $www ?>/custompages/images/footer.png" alt="footer"/>
</div>
</div>
</body>
</html>

@ -79,9 +79,17 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
unset($_SESSION['info_current_user']);
}
//If we are not logged in and customapages activated
if (!api_get_user_id() && api_get_setting('use_custom_pages') == 'true' ){
if (!api_get_user_id() && api_get_setting('use_custom_pages') == 'true' )
{
require_once api_get_path(LIBRARY_PATH).'custompages.lib.php';
if(Request::get('loggedout'))
{
CustomPages::displayPage('loggedout');
}
else
{
CustomPages::displayPage('index-unlogged');
}
}
/**

@ -31,7 +31,7 @@ class ShibbolethController
if (Shibboleth::session()->is_logged_in())
{
Shibboleth::redirect();
Redirect::home();
}
$user = Shibboleth::store()->get_user();

@ -10,6 +10,7 @@
class Shibboleth
{
const NAME = 'shibboleth';
const UNKNOWN_STATUS = -1;
const TEACHER_STATUS = 1;
const STUDENT_STATUS = 5;
@ -125,17 +126,10 @@ class Shibboleth
$first_slash_pos = strpos($rootWeb, '/', 8);
$rootWeb_wo_uri = substr($rootWeb, 0, $first_slash_pos);
$url = $rootWeb_wo_uri . $course_url . '_stop';
header("Location: $url");
Redirect::go($url);
}
}
else
{
$_SESSION['request_uri'];
}
$url = api_get_path('WEB_PATH') . $url;
header("Location: $url");
die;
Redirect::go();
}
/**
@ -152,6 +146,7 @@ class Shibboleth
$user = User::store()->get_by_shibboleth_id($shibb_user->unique_id);
if (empty($user))
{
$shibb_user->auth_source == self::NAME;
return User::create($shibb_user)->save();
}
@ -163,6 +158,7 @@ class Shibboleth
{
$user->{$key} = $shibb_user->{$key};
}
$user->auth_source == self::NAME;
}
$user->save();
return $result;

@ -25,8 +25,6 @@ class ShibbolethDisplay
public function error_page($message)
{
$include_path = api_get_path(INCLUDE_PATH);
require("$include_path/local.inc.php");
$page_title = get_lang('page_title');
Display :: display_header($page_title);
@ -37,8 +35,6 @@ class ShibbolethDisplay
public function message_page($message, $title = '')
{
$include_path = api_get_path(INCLUDE_PATH);
require("$include_path/local.inc.php");
$title = $title ? $title : get_lang('page_title');
Display :: display_header($title);
@ -49,8 +45,6 @@ class ShibbolethDisplay
public function page($content, $title = '')
{
$include_path = api_get_path(INCLUDE_PATH);
require("$include_path/local.inc.php");
$title = $title ? $title : get_lang('page_title');
Display :: display_header($title);

@ -9,11 +9,12 @@
*/
$__dir = dirname(__FILE__) . '/';
$no_redirection = true; //no redirection in global.
include_once($__dir . '/../../inc/global.inc.php');
require_once $__dir . 'app/lib/shibboleth_config.class.php';
require_once $__dir . 'app/lib/shibboleth_session.class.php';
require_once $__dir . 'app/lib/store.class.php';
require_once $__dir . 'lib/shibboleth_config.class.php';
require_once $__dir . 'lib/shibboleth_session.class.php';
require_once $__dir . 'lib/store.class.php';
require_once $__dir . 'app/controller/shibboleth_controller.class.php';
require_once $__dir . 'app/model/shibboleth_store.class.php';
require_once $__dir . 'app/model/shibboleth_user.class.php';

@ -44,12 +44,20 @@ class ShibbolethSession
/**
* Create a Shibboleth session for the user ID
*
* @param string $_uid - The user ID
* @param string $uid - The user ID
* @return $_user (array) - The user infos array created when the user logs in
*/
function login($_uid)
function login($uid)
{
$user = User::store()->get_by_user_id($_uid);
/* This must be set for local.inc.php to register correctly the global variables in session
* This is BAD. Logic should be migrated into a function and stop relying on global variables.
*/
global $_uid, $is_allowedCreateCourse, $is_platformAdmin, $_real_cid, $_courseUser, $is_courseAdmin;
global $is_courseMember, $is_courseTutor, $is_courseCoach, $is_allowed_in_course, $is_sessionAdmin, $_gid;
$_uid = $uid;
//is_allowedCreateCourse
$user = User::store()->get_by_user_id($uid);
if (empty($user))
{
return;
@ -80,11 +88,7 @@ class ShibbolethSession
$mainDbName = Database :: get_main_database();
$includePath = api_get_path(INCLUDE_PATH);
global $is_platformAdmin;
/* This must be set for local.inc.php to set up correctly the platform admin
* This is BAD.
*/
$no_redirection = true;
require("$includePath/local.inc.php");

@ -92,6 +92,9 @@ ini_set('include_path', api_create_include_path_setting());
ini_set('auto_detect_line_endings', '1');
// Include the libraries that are necessary everywhere
require_once $lib_path.'autoload.class.php';
Autoload::register();
require_once $lib_path.'database.lib.php';
require_once $lib_path.'template.lib.php';
require_once $lib_path.'display.lib.php';

@ -0,0 +1,60 @@
<?php
/**
* Autoload Chamilo classes
*
* @license see /license.txt
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
*/
class Autoload
{
/**
* Register the Chamilo autoloader on the stack.
*/
static public function register()
{
$f = array(new self, 'load');
spl_autoload_register($f);
}
static public function map()
{
static $result = false;
if ($result)
{
return $result;
}
$dir = dirname(__FILE__);
$result = array();
$result['Redirect'] = $dir . '/redirect.class.php';
$result['Request'] = $dir . '/request.class.php';
return $result;
}
/**
* Handles autoloading of classes.
*
* @param string $class_name A class name.
*
* @return boolean returns true if the class has been loaded
*/
public function load($class_name)
{
$map = self::map();
if (isset($map[$class_name]))
{
$path = $map[$class_name];
require_once $path;
return true;
}
else
{
return false;
}
}
}

@ -0,0 +1,77 @@
<?php
/**
* Send a redirect to the user agent and exist
*
* @license see /license.txt
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
*/
class Redirect
{
static function www()
{
static $result = false;
if (empty($result))
{
$result = api_get_path('WEB_PATH');
}
return $result;
}
static function go($url = '')
{
if (empty($url))
{
Redirect::session_request_uri();
$www = self::www();
self::navigate($www);
}
$is_full_uri = (strpos($url, 'http') === 0);
if ($is_full_uri)
{
self::navigate($url);
}
$url = self::www() . $url;
self::navigate($url);
}
/**
* Redirect to the session "request uri" if it exists.
*/
static function session_request_uri()
{
// if (api_is_anonymous())
// {
// return;
// }
$url = isset($_SESSION['request_uri']) ? $_SESSION['request_uri'] : '';
unset($_SESSION['request_uri']);
if ($url)
{
self::navigate($url);
}
}
static function home()
{
$www = self::www();
self::navigate($www);
}
static function user_home()
{
$www = self::www();
self::navigate("$www/user_portal.php");
}
protected static function navigate($url)
{
session_write_close(); //should not be neeeded
header("Location: $url");
exit;
}
}

@ -0,0 +1,37 @@
<?php
/**
* Provides access to various HTTP request elements: GET, POST, FILE, etc paramaters.
* @license see /license.txt
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
*/
class Request
{
public static function get($key, $default = null)
{
return isset($_GET[$key]) ? isset($_GET[$key]) : $default;
}
public static function post($key, $default = null)
{
return isset($_POST[$key]) ? isset($_POST[$key]) : $default;
}
static function server($key, $default = null)
{
return isset($_SERVER[$key]) ? isset($_SERVER[$key]) : $default;
}
static function file($key, $default = null)
{
return isset($_FILES[$key]) ? isset($_FILES[$key]) : $default;
}
static function environment($key, $default = null)
{
return isset($_ENV[$key]) ? isset($_ENV[$key]) : $default;
}
}

@ -158,6 +158,7 @@ class IndexManager {
}
exit_of_chat($uid);
api_session_destroy();
$query_string = $query_string ? "$query_string&loggedout=true" : '?loggedout=true';
header("Location: index.php$query_string");
exit();
}
@ -242,12 +243,12 @@ class IndexManager {
if ($show_menu) {
$html .= '<ul class="menulist">';
if ($show_create_link) {
$html .= '<li><a href="main/create_course/add_course.php">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
$html .= '<li><a href="main/create_course/add_course.php" class="add course">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
}
if ($show_course_link) {
if (!api_is_drh() && !api_is_session_admin()) {
$html .= '<li><a href="main/auth/courses.php">'.get_lang('CourseManagement').'</a></li>';
$html .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseManagement').'</a></li>';
} else {
$html .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}
@ -872,23 +873,23 @@ class IndexManager {
$my_account_content = '<ul class="menulist">';
if ($show_create_link) {
$my_account_content .= '<li><a href="main/create_course/add_course.php">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
$my_account_content .= '<li><a href="main/create_course/add_course.php" class="add course">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
}
//Sort courses
$url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses';
$my_account_content .= '<li>'.Display::url(get_lang('SortMyCourses'), $url).'</li>';
$my_account_content .= '<li>'.Display::url(get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>';
//Course management
if ($show_course_link) {
if (!api_is_drh()) {
$my_account_content .= '<li><a href="main/auth/courses.php">'.get_lang('CourseManagement').'</a></li>';
$my_account_content .= '<li><a href="main/auth/courses.php" class="list course">'.get_lang('CourseManagement').'</a></li>';
if (api_get_setting('use_session_mode') == 'true') {
if (isset($_GET['history']) && intval($_GET['history']) == 1) {
$my_account_content .= '<li><a href="user_portal.php">'.get_lang('DisplayTrainingList').'</a></li>';
} else {
$my_account_content .= '<li><a href="user_portal.php?history=1">'.get_lang('HistoryTrainingSessions').'</a></li>';
$my_account_content .= '<li><a href="user_portal.php?history=1" class="history course">'.get_lang('HistoryTrainingSessions').'</a></li>';
}
}
} else {

@ -1132,7 +1132,9 @@ if (isset($_cid)) {
$sql="UPDATE $tbl_course SET last_visit= '$time' WHERE code='$_cid'";
Database::query($sql);
}
if (isset($_SESSION['request_uri']) && !empty($_SESSION['request_uri'])){
$no_redirection = isset($no_redirection) ? $no_redirection : false;
if (!$no_redirection && (isset($_SESSION['request_uri']) && !empty($_SESSION['request_uri']))){
$req= $_SESSION['request_uri'];
unset($_SESSION['request_uri']);
header('Location: '.$req);

@ -24,7 +24,6 @@
}
.gfg-root {
font-family: Verdana,Geneva,Arial,Helvetica,sans-serif !important;
border-left:0px;
border-right:0px;
border-top:0px ;

Loading…
Cancel
Save