skala
Noel Dieschburg 14 years ago
commit a955b9e777
  1. 0
      .hgignore
  2. 13
      404/index.php
  3. 13
      custompages/README
  4. 73
      custompages/language.inc.php
  5. 0
      documentation/changelog.html
  6. 0
      documentation/credits.html
  7. 0
      documentation/dependencies.html
  8. 0
      documentation/index.html
  9. 0
      documentation/installation_guide.html
  10. 0
      documentation/installation_guide_es_ES.html
  11. 0
      documentation/license.html
  12. 0
      documentation/readme.html
  13. 0
      home/faq.html
  14. 49
      index.php
  15. 0
      main/admin/access_url_add_courses_to_url.php
  16. 0
      main/admin/access_url_add_sessions_to_url.php
  17. 0
      main/admin/access_url_add_users_to_url.php
  18. 0
      main/admin/access_url_edit_courses_to_url.php
  19. 0
      main/admin/access_url_edit_sessions_to_url.php
  20. 0
      main/admin/access_url_edit_users_to_url.php
  21. 0
      main/admin/access_urls.php
  22. 0
      main/admin/add_courses_to_session.php
  23. 0
      main/admin/add_many_session_to_category.php
  24. 7
      main/admin/add_users_to_group.php
  25. 0
      main/admin/add_users_to_session.php
  26. 0
      main/admin/calendar.lib.php
  27. 0
      main/admin/calendar.php
  28. 0
      main/admin/class_add.php
  29. 0
      main/admin/class_edit.php
  30. 0
      main/admin/class_import.php
  31. 0
      main/admin/class_information.php
  32. 0
      main/admin/class_list.php
  33. 0
      main/admin/class_user_import.php
  34. 0
      main/admin/configure_homepage.php
  35. 0
      main/admin/configure_inscription.php
  36. 0
      main/admin/course_add.php
  37. 0
      main/admin/course_category.php
  38. 0
      main/admin/course_edit.php
  39. 0
      main/admin/course_import.php
  40. 0
      main/admin/course_list.php
  41. 0
      main/admin/dashboard_add_courses_to_user.php
  42. 0
      main/admin/dashboard_add_sessions_to_user.php
  43. 0
      main/admin/dashboard_add_users_to_user.php
  44. 246
      main/admin/event_type.php
  45. 0
      main/admin/filler.php
  46. 10
      main/admin/group_add.php
  47. 11
      main/admin/group_edit.php
  48. 0
      main/admin/group_list.php
  49. 3
      main/admin/index.php
  50. 0
      main/admin/languages.php
  51. 0
      main/admin/ldap_import_students.php
  52. 0
      main/admin/ldap_import_students_to_session.php
  53. 0
      main/admin/ldap_synchro.php
  54. 0
      main/admin/resume_session.php
  55. 0
      main/admin/session_add.php
  56. 0
      main/admin/session_category_add.php
  57. 0
      main/admin/session_category_edit.php
  58. 0
      main/admin/session_category_list.php
  59. 0
      main/admin/session_course_edit.php
  60. 0
      main/admin/session_course_list.php
  61. 0
      main/admin/session_edit.php
  62. 0
      main/admin/session_export.php
  63. 0
      main/admin/session_import.php
  64. 0
      main/admin/session_list.php
  65. 0
      main/admin/settings.lib.php
  66. 1
      main/admin/settings.php
  67. 0
      main/admin/special_exports.php
  68. 0
      main/admin/specific_fields.php
  69. 0
      main/admin/specific_fields_add.php
  70. 0
      main/admin/statistics.php
  71. 0
      main/admin/statistics/index.php
  72. 0
      main/admin/statistics/statistics.lib.php
  73. 0
      main/admin/sub_language.class.php
  74. 0
      main/admin/sub_language.php
  75. 0
      main/admin/sub_language_add.php
  76. 0
      main/admin/sub_language_ajax.inc.php
  77. 0
      main/admin/subscribe_class2course.php
  78. 0
      main/admin/subscribe_user2class.php
  79. 0
      main/admin/subscribe_user2course.php
  80. 16
      main/admin/system_announcements.php
  81. 0
      main/admin/user_add.php
  82. 0
      main/admin/user_edit.php
  83. 0
      main/admin/user_export.php
  84. 0
      main/admin/user_fields.php
  85. 0
      main/admin/user_fields_add.php
  86. 0
      main/admin/user_import.php
  87. 0
      main/admin/user_information.php
  88. 0
      main/admin/user_list.php
  89. 0
      main/announcements/announcements.inc.php
  90. 0
      main/announcements/announcements.php
  91. 0
      main/announcements/download.php
  92. 0
      main/attendance/attendance_calendar.php
  93. 0
      main/attendance/attendance_controller.php
  94. 0
      main/attendance/attendance_list.php
  95. 0
      main/attendance/attendance_sheet.php
  96. 0
      main/attendance/index.php
  97. 105
      main/auth/cas/authcas.php
  98. 20
      main/auth/cas/cas_var.inc.php
  99. 1610
      main/auth/cas/lib/CAS.php
  100. 218
      main/auth/cas/lib/CAS/PGTStorage/pgt-db.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,13 @@
<?php
// HTTP404 page with neat styling
// 2011, Jean-Karim Bockstael <jeankarim@cblue.be>
// ErrorDocument 404 /404/
$language_file = array('document', 'index');
require_once('../main/inc/global.inc.php');
$msg = get_lang('FileNotFound');
Display::display_header($msg);
Display::display_error_message($msg);
Display::display_footer();
?>

@ -0,0 +1,13 @@
CustomPages looks for alternatives in this directory, and displays them if present. The user-provided custom pages must exactly be named as such :
- index-logged.php for the general landing page before login
- index-unlogged.php for the general landing page when already logged-in
- registration.php for the registration form
- registration-feedback.php for the registration success feedback
- lostpassword.php for the password recovery form
- lostpassword-feedback.php for the password recovery feedback page
Important note :
If you pull this feature from a repo, not through an upgrade or install process, you have to exectute the following SQL statements in the main database or this option won't appear in the admin interface :
INSERT INTO settings_options (variable, value, display_text) VALUES ('use_custom_pages', 'true', 'Yes'), ('use_custom_pages', 'false', 'No');
INSERT INTO settings_current (variable, type, category, selected_value, title, comment, scope) VALUES ('use_custom_pages','radio','Platform','false','UseCustomPages','UseCustomPagesComment', 'platform');

@ -0,0 +1,73 @@
<?php
// CustomPages : Browser language detection
// Include this file in your custom page if you want to set the language variable of the Chamilo session to the best pick according to the visitor's browser's options.
// 2011, Jean-Karim Bockstael, CBlue <jeankarim@cblue.be>
// This requires the Chamilo system to be initialized
// (note that it's easier to do the following include in the parent page)
// require_once('path/to/main/inc/global.inc.php');
// Returns the best match between available languages and visitor preferences
// return the best match as 2-chars code, null when none match
function get_preferred_language($available_langs) {
// Parsing the Accept-languages HTTP header
$langs = array();
foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $httplang) {
$rawlang = explode(';q=', $httplang);
if (strpos($rawlang[0], '-') !== FALSE) {
// We ignore the locale part, as in en-GB vs en-US
$rawlang[0] = substr($rawlang[0], 0, strpos($rawlang[0], '-'));
}
if (count($rawlang) == 1) {
$rawlang[1] = 1.0; // The absence of weighting means a weight of 1 (max)
}
$langs[$rawlang[1]][] = $rawlang[0];
}
krsort($langs, SORT_NUMERIC);
// Choosing the best match
foreach($langs as $weight => $codes) {
foreach ($codes as $code) {
if (in_array($code, $available_langs)) {
return $code;
}
}
}
// No match
return null;
}
// Wrapper function for the get_lang function
// use this if you want to avoid translation caching issues
function cp_get_lang($variable) {
return get_lang($variable, null, $_SESSION['user_language_choice']);
}
// Note that Chamilo languages are expressed as full english names, not 2-characters codes
// e.g. 'english' instead of 'en', 'french' instead of 'fr', ...
// We need a matching array. Note the value for the null key, which is the default language.
// Also note that this is an example matchin array, not all languages are present.
$chamilo_langs = array(null => 'english', 'en' => 'english', 'fr' => 'french', 'es' => 'spanish');
// Which of these can we actually pick from ?
$available_langs = array('en','fr');
// Which language files will we need ?
$language_file = array('courses', 'index', 'registration', 'admin','userInfo');
// Let's find out which language to serve to this particular browser
$lang_match = $chamilo_langs[get_preferred_language($available_langs)];
// Chamilo overrides this parameters at some places, e.g. in the logout link
if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) {
$lang_match = $_REQUEST['language'];
}
// Maybe a language had already been selected, we should honor this
if (isset($_SESSION['user_language_choice']) && in_array($_SESSION['user_language_choice'], $chamilo_langs)) {
$lang_match = $_SESSION['user_language_choice'];
}
// We need to set the relevant session variables to the best match, to use Chamilo's i18n lib.
$_user['language'] = $lang_match;
$_SESSION['user_language_choice'] = $lang_match;
?>

@ -31,6 +31,8 @@ require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once 'main/chat/chat_functions.lib.php';
require_once api_get_path(LIBRARY_PATH).'custompages.lib.php';
$loginFailed = isset($_GET['loginFailed']) ? true : isset($loginFailed);
$setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true';
@ -123,7 +125,53 @@ else {
// Only if login form was not sent because if the form is sent the user was already on the page.
event_open();
}
//checks user status and redirect him through custom page if setting is enabled
$user_status = (isset($_SESSION['_user']['user_id'])) ? $_user['status'] : null;
if ( $user_status == STUDENT && !api_get_setting('student_page_after_login') == '' ){
$redirect_url = html_entity_decode(api_get_setting('student_page_after_login'));
if ($redirect_url[0] == "/") {
$redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
header('Location: '.$redirect_url);
exit();
}
if ( $user_status == COURSEMANAGER && !api_get_setting('teacher_page_after_login') == '' ){
$redirect_url = html_entity_decode(api_get_setting('teacher_page_after_login'));
if ($redirect_url[0] == "/") {
$redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
header('Location: '.$redirect_url);
exit();
}
if ( $user_status == DRH && !api_get_setting('DRH_page_after_login') == '' ){
$redirect_url = html_entity_decode(api_get_setting('DRH_page_after_login'));
if ($redirect_url[0] == "/") {
$redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
header('Location: '.$redirect_url);
exit();
}
if ( $user_status == SESSIONADMIN && !api_get_setting('sessionadmin_page_after_login') == '' ){
$redirect_url = html_entity_decode(api_get_setting('sessionadmin_page_after_login'));
if ($redirect_url[0] == "/") {
$redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
}
header('Location: '.$redirect_url);
exit();
}
// Custom pages
if (api_get_setting('use_custom_pages') == 'true') {
if (api_get_user_id()) {
CustomPages::displayPage('index-logged');
}
else {
CustomPages::displayPage('index-unlogged');
}
}
// The header.
/*$header_title = get_lang('Homepage');
//$sitename = api_get_setting('siteName');
@ -134,6 +182,7 @@ $header_title = null;
if (!api_is_anonymous()) {
$header_title = " ";
}
Display::display_header($header_title);
/* MAIN CODE */

@ -5,7 +5,7 @@
*/
// name of the language file that needs to be included
$language_file=array('admin','registration');
$language_file=array('admin','registration','userInfo');
// resetting the course id
$cidReset=true;
@ -57,7 +57,7 @@ function search_users($needle,$type,$relation_type) {
// get user_id from relation type and group id
$sql = "SELECT user_id FROM $tbl_group_rel_user
WHERE group_id = '$group_id'
AND relation_type IN (".GROUP_USER_PERMISSION_ADMIN.",".GROUP_USER_PERMISSION_READER.",".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_MODERATOR.") ";
AND relation_type IN (".GROUP_USER_PERMISSION_ADMIN.",".GROUP_USER_PERMISSION_READER.",".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_MODERATOR.", ".GROUP_USER_PERMISSION_HRM.") ";
$res = Database::query($sql);
$user_ids = array();
if (Database::num_rows($res) > 0) {
@ -322,7 +322,7 @@ if ($ajax_search) {
// get user_id from relation type and group id
$sql = "SELECT user_id FROM $tbl_group_rel_user
WHERE group_id = $id
AND relation_type IN (".GROUP_USER_PERMISSION_ADMIN.",".GROUP_USER_PERMISSION_READER.",".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_MODERATOR.") ";
AND relation_type IN (".GROUP_USER_PERMISSION_ADMIN.",".GROUP_USER_PERMISSION_READER.",".GROUP_USER_PERMISSION_PENDING_INVITATION.",".GROUP_USER_PERMISSION_MODERATOR.", ".GROUP_USER_PERMISSION_HRM.") ";
$res = Database::query($sql);
$user_ids = array();
if (Database::num_rows($res) > 0) {
@ -401,6 +401,7 @@ if ($add_type == 'multiple') {
<option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($_POST['relation']) && $_POST['relation']==GROUP_USER_PERMISSION_ADMIN)?'selected=selected':'') ?> > <?php echo get_lang('Admin') ?></option>
<option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($_POST['relation']) && $_POST['relation']==GROUP_USER_PERMISSION_PENDING_INVITATION)?'selected=selected':'') ?> > <?php echo get_lang('Reader') ?></option>
<option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($_POST['relation']) && $_POST['relation']==GROUP_USER_PERMISSION_MODERATOR)?'selected=selected':'') ?> > <?php echo get_lang('Moderator') ?></option>
<option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($_POST['relation']) && $_POST['relation']==GROUP_USER_PERMISSION_HRM)?'selected=selected':'') ?> > <?php echo get_lang('HumanResourcesManager') ?></option>
</select>
<?php

@ -0,0 +1,246 @@
<?php
// name of the language file that needs to be included
$language_file = array('admin','events');
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tool_name = get_lang('events_title');
$action = isset($_POST['action'])?$_POST['action']:null;
$eventId = isset($_POST['eventId'])?$_POST['eventId']:null;
$eventUsers = isset($_POST['eventUsers'])?$_POST['eventUsers']:null;
$eventMessage = isset($_POST['eventMessage'])?$_POST['eventMessage']:null;
$eventSubject = isset($_POST['eventSubject'])?$_POST['eventSubject']:null;
if($action == 'modEventType') {
if($eventUsers) {
$users = explode(';',$eventUsers);
}
else {
$users = array();
}
eventType_mod($eventId,$users,$eventMessage,$eventSubject);
// echo mysql_error();
header('location: event_type.php');
exit;
}
$ets = eventType_getAll();
$ajaxPath = api_get_path(WEB_CODE_PATH).'inc/ajax/events.ajax.php';
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>';
Display::display_header($tool_name);
?>
<script language="javascript">
var usersList;
var eventTypes = <?php print json_encode($ets) ?>;
$(document).ready(function(){
ajax({action:"getUsers"},function(data) {
usersList = data;
}
);
// ajax({action:"getEventTypes"},function(data) {
// eventTypes = data;
// showEventTypes(data);
// }
// );
});
function ajax(params,func) {
$.ajax({
url: "<?php echo $ajaxPath ?>",
type: "POST",
data: params,
success: func
}
);
}
function refreshUsersList() {
removeAllOption($('#usersList'));
$.each(usersList,function(ind,item) {
addOption($('#usersList'),item.user_id,item.firstname + ' '+item.lastname);
}
);
}
// function showEventTypes(data) {
// $.each(data,function(ind,item) {
// addOption($('#eventList'),item.id,item.name);
// }
// );
// }
function getCurrentEventTypeInd() {
var ind=false;
$.each(eventTypes,function(i,item)
{
if(item.id == $('#eventList option:selected').first().attr('value')) {
ind=i;
return false;
}
}
)
return ind;
}
function showEventType() {
eInd = getCurrentEventTypeInd();
$('#eventId').attr('value',eventTypes[eInd].id);
$('#eventName').attr('value',eventTypes[eInd].name);
$('#eventNameTitle').text(eventTypes[eInd].nameLangVar);
$('#eventMessage').text(eventTypes[eInd].message);
$('#eventSubject').attr('value',eventTypes[eInd].subject);
$('#descLangVar').text(eventTypes[eInd].descLangVar);
ajax({action:"getEventTypeUsers","id":eventTypes[eInd].id},function(data) {
removeAllOption($('#usersSubList'));
refreshUsersList();
usersIds = new Array();
$.each(data,function(ind,item) {
addOption($('#usersSubList'),item.user_id,item.firstname + ' '+item.lastname);
usersIds[ind] = item.value;
removeOption($('#usersList'),item.user_id);
});
$('#eventUsers').attr('value',usersIds.join(';'));
}
);
}
function submitForm() {
if($('#eventId')) {
usersIds = new Array();
$('#usersSubList option').each(function(ind,item)
{
usersIds[ind] = item.value;
}
);
$('#eventUsers').attr('value',usersIds.join(';'));
return true;
}
return false;
}
function addOption(select,value,text) {
select.append('<option value="'+value+'">'+text+'</option>');
}
function removeOption(select,value) {
select.find('option[value='+value+']').remove();
}
function removeAllOption(select) {
select.find('option').remove();
}
function moveUsers(src,dest) {
src.find('option:selected').each(function(index,opt) {
text = opt.text;
val = opt.value;
addOption(dest,val,text);
removeOption(src,val);
});
}
</script>
<h3><?php print get_lang('events_title') ?></h3>
<table id="" width="90%">
<tr>
<td width="5%">
<h4><?php print get_lang('events_listTitle'); ?></h4>
</td>
<td width="5%">
<h4><?php print get_lang('events_userListTile'); ?></h4>
</td>
<td width="5%">
&nbsp;
</td>
<td width="5%">
<h4><?php print get_lang('events_userSubListTile'); ?></h4>
</td>
</tr>
<tr>
<td>
<select multiple="1" id="eventList" onChange="showEventType()">
<?php
foreach($ets as $et) {
print '<option value="'.$et['id'].'">'.$et['nameLangVar'].'</option>';
}
?>
</select>
</td>
<td>
<select multiple="1" id="usersList"></select>
</td>
<td valign="middle">
<button class="arrowr" onclick='moveUsers($("#usersList"),$("#usersSubList")); return false;'></button>
<br />
<button class="arrowl" onclick='moveUsers($("#usersSubList"),$("#usersList")); return false;'></button>
</td>
<td>
<select multiple="1" id="usersSubList"></select>
</td>
</tr>
</table>
<br />
<h2 id="eventNameTitle"></h2>
<form method="POST" onSubmit="return submitForm(); ">
<input type="hidden" name="action" value="modEventType" />
<input type="hidden" name="eventId" id="eventId" />
<input type="hidden" name="eventUsers" id="eventUsers" />
<input type="hidden" id="eventName" />
<br />
<div id="descLangVar">
</div>
<br />
<label for="eventSubject"><h4><?php print get_lang('events_labelSubject'); ?></h4></label>
<input type="text" id="eventSubject" name="eventSubject" />
<br /><br />
<label for="eventMessage"><h4><?php print get_lang('events_labelMessage'); ?></h4></label>
<textarea cols="100" rows="10" name="eventMessage" id="eventMessage">
</textarea>
<br /><br />
<input type="submit" value="<?php print get_lang('events_btnMod'); ?>" />
</form>
<?php
Display :: display_footer();
?>

@ -76,6 +76,13 @@ $form->addElement('file', 'picture', get_lang('AddPicture'));
$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
$form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
//Group Parentship
$groups = array();
$groups[0] = get_lang('NoParentship');
$groups = $groups + GroupPortalManager::get_groups_list($group_id);
$group_data['parent_group'] = GroupPortalManager::get_parent_group($group_id);
$form->addElement('select', 'parent_group', get_lang('GroupParentship'), $groups, array());
// Status
$status = array();
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
@ -105,8 +112,11 @@ if( $form->validate()) {
$url = $values['url'];
$status = intval($values['visibility']);
$picture = $_FILES['picture'];
$parent_group_id = intval($values['parent_group']);
$group_id = GroupPortalManager::add($name, $description, $url, $status);
GroupPortalManager::set_parent_group($group_id,$parent_group_id);
if (!empty($picture['name'])) {
$picture_uri = GroupPortalManager::update_group_picture($group_id, $_FILES['picture']['name'], $_FILES['picture']['tmp_name']);

@ -78,12 +78,18 @@ if (strlen($group_data['picture_uri']) > 0) {
$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
}
//Group Parentship
$groups = array();
$groups = GroupPortalManager::get_groups_list($group_id);
$groups[0] = get_lang('NoParentship');
$group_data['parent_group'] = GroupPortalManager::get_parent_group($group_id);
$form->addElement('select', 'parent_group', get_lang('GroupParentship'), $groups, array());
// Status
$status = array();
$status[GROUP_PERMISSION_OPEN] = get_lang('Open');
$status[GROUP_PERMISSION_CLOSED] = get_lang('Closed');
$form->addElement('select', 'visibility', get_lang('GroupPermissions'), $status, array());
// Submit button
@ -111,8 +117,11 @@ if ( $form->validate()) {
$description = $group['description'];
$url = $group['url'];
$status = intval($group['visibility']);
$parent_group_id = intval($group['parent_group']);
GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
GroupPortalManager::set_parent_group($group_id,$parent_group_id);
$tok = Security::get_token();
header('Location: group_list.php?action=show_message&message='.urlencode(get_lang('GroupUpdated')).'&sec_token='.$tok);
exit();

@ -159,6 +159,9 @@ if (api_is_platform_admin()) { ?>
}
?>
<?php if (api_get_setting('activate_send_event_by_mail') === 'true'): ?>
<li><a href="event_type.php"><?php print get_lang('events_title'); ?></a></li>
<?php endif ?>
</ul>
</div>

@ -528,6 +528,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
Display :: display_header($tool_name);
$action_images['cas'] = 'loginmanager.gif';
// The action images.
$action_images['platform'] = 'platform.png';

@ -23,6 +23,7 @@ require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'system_announcements.lib.php';
require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
// Setting the section (for the tabs).
$this_section=SECTION_PLATFORM_ADMIN;
@ -123,6 +124,8 @@ if (isset ($_GET['action']) && $_GET['action'] == 'edit') {
$values['visible_guest'] = $announcement->visible_guest ;
$values['lang'] = $announcement->lang;
$values['action'] = 'edit';
$groups = SystemAnnouncementManager :: get_announcement_groups($announcement->id);
$values['group'] = isset($groups[0]['group_id']) ? $groups[0]['group_id'] : 0;
$action_todo = true;
}
@ -155,6 +158,12 @@ if ($action_todo) {
$form->addElement('checkbox', 'visible_guest', null, get_lang('Guest'));
$form->addElement('hidden', 'id');
$group_list = GroupPortalManager::get_groups_list();
$group_list[0] = get_lang('AllGroups');
$form->addElement('select', 'group',get_lang('AnnouncementForGroup'),$group_list);
$values['group'] = isset($values['group']) ? $values['group'] : '0';
$form->addElement('checkbox', 'send_mail', get_lang('SendMail'));
if (isset($_REQUEST['action']) && $_REQUEST['action']=='add') {
@ -193,7 +202,9 @@ if ($action_todo) {
}
switch ($values['action']) {
case 'add':
if (SystemAnnouncementManager::add_announcement($values['title'], $values['content'], $values['start'], $values['end'], $values['visible_teacher'], $values['visible_student'], $values['visible_guest'], $values['lang'], $values['send_mail'], $values['add_to_calendar'])) {
$announcement_id = SystemAnnouncementManager::add_announcement($values['title'],$values['content'],$values['start'],$values['end'],$values['visible_teacher'],$values['visible_student'],$values['visible_guest'], $values['lang'],$values['send_mail'], $values['add_to_calendar']);
if ($announcement_id !== false ) {
SystemAnnouncementManager::announcement_for_groups($announcement_id, array($values['group']));
Display :: display_confirmation_message(get_lang('AnnouncementAdded'));
} else {
$show_announcement_list = false;
@ -202,6 +213,7 @@ if ($action_todo) {
break;
case 'edit':
if (SystemAnnouncementManager::update_announcement($values['id'], $values['title'], $values['content'], $values['start'], $values['end'], $values['visible_teacher'], $values['visible_student'], $values['visible_guest'], $values['lang'], $values['send_mail'])) {
SystemAnnouncementManager::announcement_for_groups($values['id'], array($values['group']));
Display :: display_confirmation_message(get_lang('AnnouncementUpdated'));
} else {
$show_announcement_list = false;
@ -260,4 +272,4 @@ if ($show_announcement_list) {
$table->display();
}
/* FOOTER */
Display :: display_footer();
Display :: display_footer();

@ -0,0 +1,105 @@
<?php
/*Written by Noel Dieschburg <noel@cblue.be> for the paris5 university
* Checks if the user is already logged in via the cas system
* 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/ldap/authldap.php');
/**
* checks if the user already get a session
* @return the user login if the user already has a session ,false otherwise
**/
function cas_is_authenticated()
{
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
global $PHPCAS_CLIENT;
global $logout;
if (!is_object($PHPCAS_CLIENT) )
{
phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri);
// die("phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri);");
phpCAS::setNoCasServerValidation();
}
$auth = phpCAS::checkAuthentication();
if ($auth) {
$login= trim(phpCAS::getUser());
/*
Get user attributes. Here are the attributes for crdp platform
sn => name
ENTPersonMailInterne => mail
ENTPersonAlias => login
ENTPersonProfils => profil
givenName => first name
*/
/*$user=phpCAS::getAttributes();
$firstName = trim($user['givenName']);
$lastName = trim($user['sn']);
$login = trim($user['ENTPersonAlias']);
$profil = trim($user['ENTPersonProfils']);
$email = trim($user['ENTPersonMailInterne']);
$satus=5;
switch ($profil){
case 'admin_etab':
$status=3; //Session admin
break;
case 'admin_sie':
$status=3; //Session admin
break;
case 'National_3':
$status=1; // Teacher
break;
case 'National_1':
$status=5; // Student
break;
default:
$status=5; // Student
}*/
//If the user is in the dokeos database and we are ,not in a logout request, we upgrade his infomration by ldap
if (! $logout){
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT user_id, username, password, auth_source, active, expiration_date ".
"FROM $user_table ".
"WHERE username = '$login' ";
$result = api_sql_query($sql,__FILE__,__LINE__);
if(mysql_num_rows($result) == 0) {
require_once(api_get_path(SYS_PATH).'main/inc/lib/usermanager.lib.php');
$rnumber=rand(0,256000);
UserManager::create_user($firstName, $lastName, $status, $email, $login, md5('casplaceholder'.$rnumber), $official_code='',$language='',$phone='',$picture_uri='',$auth_source = PLATFORM_AUTH_SOURCE);
}
else {
$user = mysql_fetch_assoc($result);
$user_id = intval($user['user_id']);
//echo "deb : $status";
UserManager::update_user ($user_id, $firstname, $lastname, $login, null, null, $email, $status, '', '', '', '', 1, null, 0, null,'') ;
}
}
return($login);
}
else
{
return(false);
}
}
/**
* Logs out the user of the cas
* The user MUST be logged in with cas to use this function
**/
function cas_logout()
{
//phpCAS::logoutWithRedirectService("fmc.univ-paris5.fr");
phpCAS::logoutWithRedirectService(api_get_path(WEB_PATH));
}
?>

@ -0,0 +1,20 @@
<?
/* This file contains all the configuration variable for the cas module
* In the future, these will be in the database
*/
require_once('lib/CAS.php');
define("CAS_VERSION_2_0",'2.0');
define("SAML_VERSION_1_1", 'S1');
global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri;
$cas_auth_server = api_get_setting('cas_server');
$cas_auth_uri = api_get_setting('cas_server_uri');
$cas_auth_port = intval(api_get_setting('cas_port'));
$cas_auth_uri = api_get_setting('cas_server_uri');
if ( ! is_string($cas_auth_uri)) $cas_auth_uri = '';
$cas_auth_ver = '2.0';
//$cas_auth_ver = SAML_VERSION_1_1;
?>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,218 @@
<?php
/*
* Copyright © 2003-2010, The ESUP-Portail consortium & the JA-SIG Collaborative.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ESUP-Portail consortium & the JA-SIG
* Collaborative nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file CAS/PGTStorage/pgt-db.php
* Basic class for PGT database storage
*/
/**
* @class PGTStorageDB
* The PGTStorageDB class is a class for PGT database storage. An instance of
* this class is returned by CASClient::SetPGTStorageDB().
*
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
*
* @ingroup internalPGTStorageDB
*/
class PGTStorageDB extends PGTStorage
{
/**
* @addtogroup internalPGTStorageDB
* @{
*/
/**
* a string representing a PEAR DB URL to connect to the database. Written by
* PGTStorageDB::PGTStorageDB(), read by getURL().
*
* @hideinitializer
* @private
*/
var $_url='';
/**
* This method returns the PEAR DB URL to use to connect to the database.
*
* @return a PEAR DB URL
*
* @private
*/
function getURL()
{
return $this->_url;
}
/**
* The handle of the connection to the database where PGT's are stored. Written by
* PGTStorageDB::init(), read by getLink().
*
* @hideinitializer
* @private
*/
var $_link = null;
/**
* This method returns the handle of the connection to the database where PGT's are
* stored.
*
* @return a handle of connection.
*
* @private
*/
function getLink()
{
return $this->_link;
}
/**
* The name of the table where PGT's are stored. Written by
* PGTStorageDB::PGTStorageDB(), read by getTable().
*
* @hideinitializer
* @private
*/
var $_table = '';
/**
* This method returns the name of the table where PGT's are stored.
*
* @return the name of a table.
*
* @private
*/
function getTable()
{
return $this->_table;
}
// ########################################################################
// DEBUGGING
// ########################################################################
/**
* This method returns an informational string giving the type of storage
* used by the object (used for debugging purposes).
*
* @return an informational string.
* @public
*/
function getStorageType()
{
return "database";
}
/**
* This method returns an informational string giving informations on the
* parameters of the storage.(used for debugging purposes).
*
* @public
*/
function getStorageInfo()
{
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
}
// ########################################################################
// CONSTRUCTOR
// ########################################################################
/**
* The class constructor, called by CASClient::SetPGTStorageDB().
*
* @param $cas_parent the CASClient instance that creates the object.
* @param $user the user to access the data with
* @param $password the user's password
* @param $database_type the type of the database hosting the data
* @param $hostname the server hosting the database
* @param $port the port the server is listening on
* @param $database the name of the database
* @param $table the name of the table storing the data
*
* @public
*/
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
// build and store the PEAR DB URL
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
// XXX should use setURL and setTable
phpCAS::traceEnd();
}
// ########################################################################
// INITIALIZATION
// ########################################################################
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ( $this->isInitialized() )
return;
// call the ancestor's method (mark as initialized)
parent::init();
//include phpDB library (the test was introduced in release 0.4.8 for
//the integration into Tikiwiki).
if (!class_exists('DB')) {
include_once('DB.php');
}
// try to connect to the database
$this->_link = DB::connect($this->getURL());
if ( DB::isError($this->_link) ) {
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
}
var_dump($this->_link);
phpCAS::traceBEnd();
}
/** @} */
}
?>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save