Projet

Général

Profil

Révision 4f315dab

Ajouté par Assos Assos il y a environ 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/cas/cas.module
10 10
define('CAS_NO_LINK', 0);
11 11
define('CAS_ADD_LINK', 1);
12 12
define('CAS_MAKE_DEFAULT', 2);
13
define('CAS_REDIRECT', 3);
13 14
define('CAS_LOGIN_INVITE_DEFAULT', 'Log in using CAS');
14 15
define('CAS_LOGIN_DRUPAL_INVITE_DEFAULT', 'Cancel CAS login');
15 16
define('CAS_LOGIN_REDIR_MESSAGE', 'You will be redirected to the secure CAS login page.');
......
33 34
    // do any processing here. Necessary for CAS gateway tests.
34 35
    return;
35 36
  }
37
  elseif (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'install') {
38
    // Do nothing on profile install.
39
    return;
40
  }
36 41

  
37 42
  // Process a single-sign out request.
38 43
  _cas_single_sign_out_check();
......
246 251
  $initialized = TRUE;
247 252

  
248 253
  // Variable set
249
  $server_version    = (string)variable_get('cas_version', '2.0');
254
  $server_version    = (string)variable_get('cas_version', '3.0');
250 255
  $server_cas_server = (string)variable_get('cas_server', 'sso-cas.univ-rennes1.fr');
251 256
  $server_port       = (int)variable_get('cas_port', '443');
252 257
  $server_uri        = (string)variable_get('cas_uri', '');
......
392 397
 * Implements hook_menu_site_status_alter().
393 398
 */
394 399
function cas_menu_site_status_alter(&$menu_site_status, $path) {
395
  if (user_is_logged_in() && $path == 'cas') {
400
  if (user_is_logged_in() && strtolower($path) == 'cas') {
396 401
    // If user is logged in, redirect to '<front>' instead of giving 403.
397 402
    drupal_goto('');
398 403
  }
......
405 410
 * @see cas_translated_menu_link_alter()
406 411
 */
407 412
function cas_menu_link_alter(&$item) {
408
  if ($item['link_path'] == 'cas' || $item['link_path'] == 'caslogout') {
413
  if (strtolower($item['link_path']) == 'cas' || strtolower($item['link_path']) == 'caslogout') {
409 414
    $item['options']['alter'] = TRUE;
410 415
  }
411 416
}
......
416 421
 * Append dynamic query 'destination' to several menu items.
417 422
 */
418 423
function cas_translated_menu_link_alter(&$item) {
419
  if ($item['href'] == 'cas') {
424
  if (strtolower($item['href']) == 'cas') {
420 425
    $item['localized_options']['query'] = drupal_get_destination();
421 426
  }
422
  elseif ($item['href'] == 'caslogout' && !variable_get('cas_logout_destination', '')) {
427
  elseif (strtolower($item['href']) == 'caslogout' && !variable_get('cas_logout_destination', '')) {
423 428
    $item['localized_options']['query'] = drupal_get_destination();
424 429
  }
425 430
}
......
650 655
 * adjust the hook execution order using hook_module_implements_alter().
651 656
 *
652 657
 * @param $invoke_hook
653
 *   If TRUE, invoke hook_user_logout() and save a watchdog mesage indicating
658
 *   If TRUE, invoke hook_user_logout() and save a watchdog message indicating
654 659
 *   that the user has logged out.
655 660
 */
656 661
function cas_logout($invoke_hook = TRUE) {
......
661 666

  
662 667
  if (isset($_GET['destination']) && !url_is_external($_GET['destination'])) {
663 668
    // Add destination override so that a destination can be specified on the
664
    // logout link, e.g., caslogout?desination=http://foo.bar.com/foobar. We do
669
    // logout link, e.g., caslogout?destination=http://foo.bar.com/foobar. We do
665 670
    // not allow absolute URLs to be passed via $_GET, as this can be an attack
666 671
    // vector.
667 672
    $destination = $_GET['destination'];
......
830 835
 */
831 836
function _cas_force_login() {
832 837
  // The 'cas' page is a shortcut to force authentication.
833
  if (arg(0) == 'cas') {
838
  if (strtolower(arg(0)) == 'cas') {
834 839
    return TRUE;
835 840
  }
836 841

  
......
861 866
  // Set the default behavior.
862 867
  $force_login = variable_get('cas_access', 0);
863 868

  
864
  // If we match the speficied paths, reverse the behavior.
869
  // If we match the specified paths, reverse the behavior.
865 870
  if ($pages = variable_get('cas_pages', '')) {
866 871
    $path = drupal_get_path_alias($_GET['q']);
867 872
    if (drupal_match_path($path, $pages)) {
......
877 882
 * Overrides specific from settings based on user policy.
878 883
 */
879 884
function cas_form_alter(&$form, &$form_state, $form_id) {
885
  // Special handling of the user login page when the CAS login form is set to
886
  // redirect.
887
  if ($form_id == 'user_login' && variable_get('cas_login_form', CAS_NO_LINK) == CAS_REDIRECT) {
888
    drupal_goto('cas');
889
  }
880 890

  
881 891
  switch ($form_id) {
882 892
    case 'user_login':
......
1013 1023
/**
1014 1024
 * Form element 'cas_name' validator.
1015 1025
 *
1016
 * If the element is disaplying an existing {cas_user} entry, set
1017
 * #cas_user_aid to the corresponing authmap id to avoid spurious
1026
 * If the element is displaying an existing {cas_user} entry, set
1027
 * #cas_user_aid to the corresponding authmap id to avoid spurious
1018 1028
 * validation errors.
1019 1029
 */
1020 1030
function _cas_name_element_validate($element, &$form_state) {
......
1311 1321
  else {
1312 1322
    // If logged in through forced authentication ('/cas'), then redirect user to the
1313 1323
    // homepage, or to wherever the current "destination" parameter points.
1314
    if (current_path() == 'cas') {
1324
    if (strtolower(current_path()) == 'cas') {
1315 1325
      drupal_goto('');
1316 1326
    }
1317 1327
    // If logged in through gateway feature, then just reload the current path

Formats disponibles : Unified diff