Révision 4f315dab
Ajouté par Assos Assos il y a environ 8 ans
drupal7/sites/all/modules/cas/README.txt | ||
---|---|---|
22 | 22 |
|
23 | 23 |
Requirements |
24 | 24 |
============ |
25 |
PHP 5 with the following modules:
|
|
25 |
PHP 5 with the following extensions:
|
|
26 | 26 |
curl, openssl, dom, zlib, and xml |
27 | 27 |
phpCAS version 1.0.0 or later. |
28 | 28 |
|
... | ... | |
32 | 32 |
* Place the cas folder in your Drupal modules directory. |
33 | 33 |
|
34 | 34 |
* Download phpCAS from https://wiki.jasig.org/display/CASC/phpCAS. You will |
35 |
need version 1.0.0 or later. The most recent release is available at
|
|
36 |
http://downloads.jasig.org/cas-clients/php/current.tgz |
|
35 |
need version 1.3.2 or later (1.3.3 for CAS 3.0 support). The most recent
|
|
36 |
release is available at http://downloads.jasig.org/cas-clients/php/current.tgz
|
|
37 | 37 |
|
38 | 38 |
* There are several locations you can install the phpCAS library. |
39 | 39 |
|
40 | 40 |
1. Module directory installation. This means installing the library folder |
41 |
under the moduels directory, so that the file
|
|
41 |
under the modules directory, so that the file
|
|
42 | 42 |
sites/<site>/modules/cas/CAS/CAS.php exists. |
43 | 43 |
|
44 | 44 |
2. System wide installation. See the phpCAS installation guide, currently at |
drupal7/sites/all/modules/cas/cas.admin.inc | ||
---|---|---|
47 | 47 |
$form['server']['cas_version'] = array( |
48 | 48 |
'#type' => 'radios', |
49 | 49 |
'#title' => t('Version'), |
50 |
'#default_value' => variable_get('cas_version', '2.0'),
|
|
50 |
'#default_value' => variable_get('cas_version', '3.0'),
|
|
51 | 51 |
'#options' => array( |
52 | 52 |
'1.0' => '1.0', |
53 |
'2.0' => t('2.0 or higher'), |
|
53 |
'2.0' => t('2.0'), |
|
54 |
'3.0' => t('3.0 or higher (requires phpCAS >= 1.3.3)'), |
|
54 | 55 |
'S1' => t('SAML Version 1.1'), |
55 | 56 |
), |
56 | 57 |
); |
... | ... | |
105 | 106 |
'#options' => array( |
106 | 107 |
CAS_NO_LINK => t('Do not add link to login forms'), |
107 | 108 |
CAS_ADD_LINK => t('Add link to login forms'), |
108 |
CAS_MAKE_DEFAULT => t('Make CAS login default on login forms')), |
|
109 |
CAS_MAKE_DEFAULT => t('Make CAS login default on login forms'), |
|
110 |
CAS_REDIRECT => t('Redirect the login form to CAS'), |
|
111 |
), |
|
109 | 112 |
); |
110 | 113 |
|
111 | 114 |
$form['login']['cas_login_invite'] = array( |
... | ... | |
129 | 132 |
'#description' => t('Message users see at the top of the CAS login form to warn them that they are being redirected to the CAS server.'), |
130 | 133 |
); |
131 | 134 |
|
132 |
// Setting for message displayed to user upon successfull login
|
|
135 |
// Setting for message displayed to user upon successful login |
|
133 | 136 |
$form['login']['cas_login_message'] = array( |
134 | 137 |
'#type' => 'textfield', |
135 | 138 |
'#title' => t('Successful login message'), |
drupal7/sites/all/modules/cas/cas.drush.inc | ||
---|---|---|
60 | 60 |
$options = array('invoke_cas_user_presave' => TRUE); |
61 | 61 |
$new_user_object = cas_user_register($cas_name, $options); |
62 | 62 |
if ($new_user_object !== FALSE) { |
63 |
_drush_user_print_info($new_user_object->uid); |
|
64 |
// return $new_user_object->uid; |
|
63 |
$user_fields = array('cas_name', 'uid', 'name', 'mail', 'status'); |
|
64 |
$new_user_object = (array) $new_user_object; |
|
65 |
$new_user_object = array_intersect_key($new_user_object, array_flip($user_fields)); |
|
66 |
$new_user_object = drush_key_value_to_array_table($new_user_object); |
|
67 |
drush_print_table($new_user_object); |
|
65 | 68 |
} |
66 | 69 |
else { |
67 | 70 |
drush_set_error(dt('Could not create a new user account with CAS username @cas_name.', array('@cas_name' => $cas_name))); |
drupal7/sites/all/modules/cas/cas.info | ||
---|---|---|
7 | 7 |
files[] = cas.test |
8 | 8 |
files[] = includes/views/handlers/cas_handler_field_cas_name.inc |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2014-06-09
|
|
11 |
version = "7.x-1.4"
|
|
10 |
; Information added by Drupal.org packaging script on 2016-02-09
|
|
11 |
version = "7.x-1.5"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "cas" |
14 |
datestamp = "1402318728"
|
|
14 |
datestamp = "1455051844"
|
|
15 | 15 |
|
drupal7/sites/all/modules/cas/cas.install | ||
---|---|---|
57 | 57 |
'unique keys' => array( |
58 | 58 |
'cas_name' => array('cas_name'), |
59 | 59 |
), |
60 |
|
|
61 |
'indexes' => array('cas_user' => array('uid')), |
|
60 | 62 |
'primary key' => array('aid'), |
61 | 63 |
'foreign keys' => array( |
62 | 64 |
'user' => array( |
... | ... | |
370 | 372 |
} |
371 | 373 |
variable_del('cas_check_first'); |
372 | 374 |
} |
375 |
|
|
376 |
/** |
|
377 |
* Add index on cas_user.uid |
|
378 |
*/ |
|
379 |
function cas_update_7102() { |
|
380 |
if (!db_index_exists('cas_user', 'cas_user')) { |
|
381 |
db_add_index('cas_user', 'cas_user', array('uid')); |
|
382 |
} |
|
383 |
} |
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 |
drupal7/sites/all/modules/cas/cas.test | ||
---|---|---|
35 | 35 |
$this->admin_user = $this->drupalCreateUser(array('administer users', 'administer cas')); |
36 | 36 |
|
37 | 37 |
// Download and extract in PHPCAS. |
38 |
$this->downloadExtractPhpCas('1.3.2');
|
|
38 |
$this->downloadExtractPhpCas('1.3.3');
|
|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
/** |
... | ... | |
278 | 278 |
$this->assertFalse($account->cas_name, t('CAS username successfully deleted.')); |
279 | 279 |
$this->assertEqual(count($account->cas_names), 0, t('No CAS usernames are present.')); |
280 | 280 |
|
281 |
// Attempt to load by a non-existant CAS username.
|
|
281 |
// Attempt to load by a non-existent CAS username.
|
|
282 | 282 |
$account = cas_user_load_by_name($cas_new_name); |
283 | 283 |
$this->assertFalse($account, t('Could not load account with non-existent CAS username.')); |
284 | 284 |
|
drupal7/sites/all/modules/cas/cas_server.admin.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* CAS Server module settings UI. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* Provides settings pages. |
|
10 |
*/ |
|
11 |
function cas_server_admin_settings() { |
|
12 |
$form = array(); |
|
13 |
|
|
14 |
$form['whitelist'] = array( |
|
15 |
'#type' => 'fieldset', |
|
16 |
'#title' => t('Service Whitelist Settings'), |
|
17 |
); |
|
18 |
|
|
19 |
$example_list_1 = array('http://example.com', 'http://example.com/*', 'https://example.com', 'https://example.com/*'); |
|
20 |
$example_list_2 = array('https://example.com/some_directory/*'); |
|
21 |
|
|
22 |
$form['whitelist']['cas_server_service_whitelist'] = array( |
|
23 |
'#type' => 'textarea', |
|
24 |
'#title' => t('Whitelist'), |
|
25 |
'#description' => t("Define which services CAS Server will accept. Leave blank to accept all services.<br/> |
|
26 |
<strong>It is strongly recommended that you use this feature to prevent inadvertent information disclosure |
|
27 |
about your users.</strong> |
|
28 |
<br/><br/> |
|
29 |
Enter the URL of each service you wish to accept, one per line. The '*' character is a wildcard.<br/> |
|
30 |
As an example, if you wished to accept any and all validation requests from example.com, you would need the following lines: |
|
31 |
!example_list_1 |
|
32 |
If you only wanted to accept secure connections from some_directory at example.com, you would just need this line: |
|
33 |
!example_list_2", array('!example_list_1' => theme('item_list', array('items' => $example_list_1)), |
|
34 |
'!example_list_2' => theme('item_list', array('items' => $example_list_2)), |
|
35 |
)), |
|
36 |
'#default_value' => variable_get('cas_server_service_whitelist', ''), |
|
37 |
); |
|
38 |
|
|
39 |
$form['whitelist']['cas_server_whitelist_failure'] = array( |
|
40 |
'#type' => 'textfield', |
|
41 |
'#title' => t('Whitelist failure message'), |
|
42 |
'#description' => t('Message to display when an unauthorized service attempts to authenticate via this CAS server.'), |
|
43 |
'#default_value' => variable_get('cas_server_whitelist_failure', t('You do not have permission to login to CAS from this service.')), |
|
44 |
); |
|
45 |
|
|
46 |
return system_settings_form($form); |
|
47 |
} |
drupal7/sites/all/modules/cas/cas_server.info | ||
---|---|---|
2 | 2 |
package = Central Authentication Service |
3 | 3 |
core = 7.x |
4 | 4 |
description = "Provides protocol compliant CAS Server" |
5 |
configure = admin/config/people/cas_server |
|
5 | 6 |
|
6 |
; Information added by Drupal.org packaging script on 2014-06-09
|
|
7 |
version = "7.x-1.4"
|
|
7 |
; Information added by Drupal.org packaging script on 2016-02-09
|
|
8 |
version = "7.x-1.5"
|
|
8 | 9 |
core = "7.x" |
9 | 10 |
project = "cas" |
10 |
datestamp = "1402318728"
|
|
11 |
datestamp = "1455051844"
|
|
11 | 12 |
|
drupal7/sites/all/modules/cas/cas_server.install | ||
---|---|---|
47 | 47 |
return $schema; |
48 | 48 |
} |
49 | 49 |
|
50 |
/** |
|
51 |
* Implements hook_uninstall(). |
|
52 |
*/ |
|
53 |
function cas_server_uninstall() { |
|
54 |
variable_del('cas_server_service_whitelist'); |
|
55 |
variable_del('cas_server_whitelist_failure'); |
|
56 |
} |
|
50 | 57 |
|
51 | 58 |
/** |
52 | 59 |
* Creates CAS server tickets table. |
drupal7/sites/all/modules/cas/cas_server.module | ||
---|---|---|
44 | 44 |
'access callback' => TRUE, |
45 | 45 |
'type' => MENU_CALLBACK, |
46 | 46 |
); |
47 |
|
|
48 |
$items['admin/config/people/cas_server'] = array( |
|
49 |
'title' => 'CAS Server', |
|
50 |
'description' => 'Configure central authentication services server', |
|
51 |
'page callback' => 'drupal_get_form', |
|
52 |
'page arguments' => array('cas_server_admin_settings'), |
|
53 |
'access arguments' => array('administer cas server'), |
|
54 |
'type' => MENU_NORMAL_ITEM, |
|
55 |
'file' => 'cas_server.admin.inc', |
|
56 |
); |
|
57 |
|
|
58 |
$items['admin/config/people/cas_server/settings'] = array( |
|
59 |
'title' => 'Settings', |
|
60 |
'type' => MENU_DEFAULT_LOCAL_TASK, |
|
61 |
'weight' => -10, |
|
62 |
); |
|
63 |
|
|
47 | 64 |
return $items; |
48 | 65 |
} |
49 | 66 |
|
67 |
/** |
|
68 |
* Implements hook_permission(). |
|
69 |
*/ |
|
70 |
function cas_server_permission() { |
|
71 |
return array( |
|
72 |
'administer cas server' => array( |
|
73 |
'title' => t('Administer CAS Server'), |
|
74 |
'description' => t('Configure CAS server settings.'), |
|
75 |
'restrict access' => TRUE, |
|
76 |
) |
|
77 |
); |
|
78 |
} |
|
79 |
|
|
50 | 80 |
/** |
51 | 81 |
* Implements hook_theme(). |
52 | 82 |
*/ |
... | ... | |
68 | 98 |
'variables' => array('ticket' => NULL, 'date' => NULL, 'id' => NULL), |
69 | 99 |
'file' => 'cas_server.response.inc', |
70 | 100 |
), |
101 |
'cas_service_validate_whitelist_failure' => array( |
|
102 |
'variables' => array('service' => NULL, 'error_code' => NULL), |
|
103 |
'file' => 'cas_server.response.inc', |
|
104 |
), |
|
71 | 105 |
); |
72 | 106 |
} |
73 | 107 |
|
... | ... | |
105 | 139 |
// Set login cookie so that we know we're in the process of logging in |
106 | 140 |
global $user; |
107 | 141 |
$output=''; |
142 |
$whitelist_error_msg = variable_get('cas_server_whitelist_failure', t('You do not have permission to login to CAS from this service.')); |
|
108 | 143 |
$service = isset($_REQUEST['service']) ? $_REQUEST['service'] : ''; |
109 | 144 |
$gateway = isset($_REQUEST['gateway']); |
110 | 145 |
if ($user->uid) { |
111 | 146 |
if ($service) { |
112 |
$_COOKIE[CAS_LOGIN_COOKIE] = $service; |
|
147 |
// Check service against whitelist |
|
148 |
if (!_cas_server_check_service_whitelist($service)) { |
|
149 |
return $whitelist_error_msg; |
|
150 |
} |
|
151 |
else { |
|
152 |
$_COOKIE[CAS_LOGIN_COOKIE] = $service; |
|
153 |
} |
|
113 | 154 |
} |
114 | 155 |
$output=t('You have successfully logged into CAS'); |
115 | 156 |
cas_server_service_return(); |
... | ... | |
121 | 162 |
else { |
122 | 163 |
// Redirect to user login |
123 | 164 |
if ($service) { |
124 |
setcookie(CAS_LOGIN_COOKIE, $service); |
|
165 |
// Check service against whitelist |
|
166 |
if (!_cas_server_check_service_whitelist($service)) { |
|
167 |
return $whitelist_error_msg; |
|
168 |
} |
|
169 |
else { |
|
170 |
setcookie(CAS_LOGIN_COOKIE, $service); |
|
171 |
} |
|
125 | 172 |
} |
126 | 173 |
$output .= l(t('Login'), 'user', array('query' => array('destination' => 'cas/login'))); |
127 |
drupal_goto('user', array('query' => array('destination' => 'cas/login'))); |
|
174 |
drupal_goto('user/login', array('query' => array('destination' => 'cas/login')));
|
|
128 | 175 |
} |
129 | 176 |
} |
130 | 177 |
return $output; |
... | ... | |
144 | 191 |
//Obtain the ticket from the url and validate it. |
145 | 192 |
$ticket = isset($_REQUEST['ticket']) ? $_REQUEST['ticket'] : ''; |
146 | 193 |
$service = isset($_REQUEST['service']) ? $_REQUEST['service'] : ''; |
194 |
|
|
195 |
// Check service against whitelist |
|
196 |
if (!_cas_server_check_service_whitelist($service)) { |
|
197 |
print "no\n"; |
|
198 |
print "\n"; |
|
199 |
return; |
|
200 |
} |
|
201 |
|
|
147 | 202 |
$user_name = _cas_server_validate($service, $ticket); |
148 | 203 |
if ($user_name) { |
149 | 204 |
print "yes\n"; |
... | ... | |
167 | 222 |
|
168 | 223 |
$ticket = isset($_REQUEST['ticket']) ? $_REQUEST['ticket'] : ''; |
169 | 224 |
$service = isset($_REQUEST['service']) ? $_REQUEST['service'] : ''; |
225 |
|
|
226 |
// Check service against whitelist |
|
227 |
if (!_cas_server_check_service_whitelist($service)) { |
|
228 |
$cas_error='INVALID_REQUEST'; |
|
229 |
print theme('cas_server_validate_whitelist_failure', array('service' => $service, 'error_code' => $cas_error)); |
|
230 |
watchdog('cas', 'Service %service validation failed!', array('%service' => $service)); |
|
231 |
return; |
|
232 |
} |
|
233 |
|
|
170 | 234 |
$user_name = _cas_server_validate($service, $ticket); |
171 | 235 |
if (!$user_name) $cas_error='INVALID_TICKET'; |
172 | 236 |
if (!$ticket || !$service) $cas_error='INVALID_REQUEST'; |
... | ... | |
186 | 250 |
drupal_alter('cas_server_user_attributes', $attributes, $account, $context); |
187 | 251 |
|
188 | 252 |
print theme('cas_service_validate_success', array('name' => $user_name, 'attributes' => $attributes)); |
189 |
watchdog('cas', 'User %name CAS sucessully authenticated.', array('%name' => $user_name));
|
|
253 |
watchdog('cas', 'User %name CAS successfully authenticated.', array('%name' => $user_name));
|
|
190 | 254 |
} |
191 | 255 |
else { |
192 | 256 |
print theme('cas_service_validate_failure', array('ticket' => $ticket, 'error_code' => $cas_error)); |
... | ... | |
194 | 258 |
} |
195 | 259 |
} |
196 | 260 |
|
261 |
function _cas_server_check_service_whitelist($service) { |
|
262 |
$mapping_raw = variable_get('cas_server_service_whitelist', ''); |
|
263 |
if (trim($mapping_raw) != '') { |
|
264 |
if (!drupal_match_path($service, $mapping_raw)) { |
|
265 |
return FALSE; |
|
266 |
} |
|
267 |
} |
|
268 |
return TRUE; |
|
269 |
} |
|
270 |
|
|
197 | 271 |
/** |
198 | 272 |
* Test to see if a one time use ticket is valid |
199 | 273 |
* |
... | ... | |
239 | 313 |
* Menu callback; triggers a CAS logout. |
240 | 314 |
*/ |
241 | 315 |
function cas_server_logout() { |
242 |
global $user; |
|
316 |
// Check service against whitelist |
|
317 |
if (!_cas_server_check_service_whitelist($_GET['service'])) { |
|
318 |
return variable_get('cas_server_whitelist_failure', t('You do not have permission to login to CAS from this service.')); |
|
319 |
} |
|
243 | 320 |
|
244 |
watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
|
|
321 |
global $user;
|
|
245 | 322 |
|
246 |
module_invoke_all('user_logout', $user); |
|
323 |
// Due to the order of sessions being destroyed on a client site vs CAS server, |
|
324 |
// there is a workflow that would allow the user's session to not exist at this point. |
|
325 |
// Skip triggering user logout related processes if there is not a valid user in session. |
|
326 |
if(user_is_logged_in()) { |
|
327 |
// Log the successful logout process. |
|
328 |
watchdog('user', 'Session closed for %name.', array('%name' => $user->name)); |
|
329 |
// Tell modules about the logout. |
|
330 |
module_invoke_all('user_logout', $user); |
|
331 |
} |
|
247 | 332 |
|
248 | 333 |
// Destroy the current session, and reset $user to the anonymous user. |
249 | 334 |
session_destroy(); |
drupal7/sites/all/modules/cas/cas_server.response.inc | ||
---|---|---|
29 | 29 |
* Returns CAS attributes as part of a CAS 2.0 service response. |
30 | 30 |
* |
31 | 31 |
* @param $variables |
32 |
* An asociative array containing the keys 'attributes' and 'style', where |
|
32 |
* An associative array containing the keys 'attributes' and 'style', where
|
|
33 | 33 |
* the value of 'style' must be one of: |
34 | 34 |
* - 'jasig' (default) |
35 | 35 |
* - 'rubycas' |
... | ... | |
93 | 93 |
} |
94 | 94 |
|
95 | 95 |
|
96 |
/** |
|
97 |
* Returns a CAS 2.0 service response for a service not on the whitelist. |
|
98 |
* |
|
99 |
* @param $variables |
|
100 |
* An associative array containing the keys 'service' and 'error_code'. |
|
101 |
*/ |
|
102 |
function theme_cas_service_validate_whitelist_failure($variables) { |
|
103 |
$service = $variables['service']; |
|
104 |
$error_code = $variables['error_code']; |
|
105 |
$output = "<cas:serviceReponse xmlns:cas='http://www.yale.edu/tp/cas'>\n" . |
|
106 |
"<cas:authenticationFailure code=\"$error_code\">\n" . |
|
107 |
"Service $service not recognized.\n" . |
|
108 |
"</cas:authenticationFailure>\n" . |
|
109 |
"</cas:serviceResponse>\n"; |
|
110 |
return $output; |
|
111 |
} |
|
112 |
|
|
113 |
|
|
96 | 114 |
/** |
97 | 115 |
* Generate the Single Sign Out request. |
98 | 116 |
* |
drupal7/sites/all/modules/cas/tests/cas_test.info | ||
---|---|---|
8 | 8 |
; code duplication we use several themes defined by that module. |
9 | 9 |
dependencies[] = cas_server |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2014-06-09
|
|
12 |
version = "7.x-1.4"
|
|
11 |
; Information added by Drupal.org packaging script on 2016-02-09
|
|
12 |
version = "7.x-1.5"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "cas" |
15 |
datestamp = "1402318728"
|
|
15 |
datestamp = "1455051844"
|
|
16 | 16 |
|
drupal7/sites/all/modules/cas/tests/cas_test.module | ||
---|---|---|
25 | 25 |
'absolute' => TRUE, |
26 | 26 |
))); |
27 | 27 |
|
28 |
switch (variable_get('cas_version', '2.0')) {
|
|
28 |
switch (variable_get('cas_version', '3.0')) {
|
|
29 | 29 |
case CAS_VERSION_1_0: |
30 | 30 |
phpCAS::setServerServiceValidateURL(url('cas_test/validate', array('absolute' => TRUE))); |
31 | 31 |
break; |
... | ... | |
33 | 33 |
phpCAS::setServerServiceValidateURL(url('cas_test/serviceValidate', array('absolute' => TRUE))); |
34 | 34 |
phpCAS::setServerProxyValidateURL(url('cas_test/proxyValidate', array('absolute' => TRUE))); |
35 | 35 |
break; |
36 |
case CAS_VERSION_3_0: |
|
37 |
phpCAS::setServerServiceValidateURL(url('cas_test/p3/serviceValidate', array('absolute' => TRUE))); |
|
38 |
phpCAS::setServerProxyValidateURL(url('cas_test/p3/proxyValidate', array('absolute' => TRUE))); |
|
39 |
break; |
|
36 | 40 |
default: |
37 | 41 |
throw new Exception('Unknown CAS server version.'); |
38 | 42 |
break; |
... | ... | |
73 | 77 |
'access callback' => TRUE, |
74 | 78 |
'type' => MENU_CALLBACK, |
75 | 79 |
); |
80 |
$items['cas_test/p3/serviceValidate'] = array( |
|
81 |
'page callback' => 'cas_test_service_validate', |
|
82 |
'title' => 'CAS 3.0 Service Validate', |
|
83 |
'access callback' => TRUE, |
|
84 |
'type' => MENU_CALLBACK, |
|
85 |
); |
|
86 |
$items['cas_test/p3/proxyValidate'] = array( |
|
87 |
'page callback' => 'cas_test_service_validate', |
|
88 |
'title' => 'CAS 3.0 Proxy Ticket Validate', |
|
89 |
'access callback' => TRUE, |
|
90 |
'type' => MENU_CALLBACK, |
|
91 |
); |
|
76 | 92 |
$items['cas_test/logout'] = array( |
77 | 93 |
'page callback' => 'cas_test_logout', |
78 | 94 |
'title' => 'CAS Logout', |
... | ... | |
151 | 167 |
} |
152 | 168 |
|
153 | 169 |
/** |
154 |
* Validate a ticket using the CAS 2.0 protocol.
|
|
170 |
* Validate a ticket using the CAS 2.0 and CAS 3.0 protocols.
|
|
155 | 171 |
*/ |
156 | 172 |
function cas_test_service_validate() { |
157 | 173 |
// Prevent this page from being cached. |
drupal7/sites/all/modules/ds/ds.info | ||
---|---|---|
13 | 13 |
files[] = tests/ds.forms.test |
14 | 14 |
configure = admin/structure/ds |
15 | 15 |
|
16 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
17 |
version = "7.x-2.12"
|
|
16 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
17 |
version = "7.x-2.13"
|
|
18 | 18 |
core = "7.x" |
19 | 19 |
project = "ds" |
20 |
datestamp = "1452953681"
|
|
20 |
datestamp = "1455211441"
|
|
21 | 21 |
|
drupal7/sites/all/modules/ds/ds.module | ||
---|---|---|
608 | 608 |
} |
609 | 609 |
|
610 | 610 |
// Move any preprocess fields to render container. |
611 |
// Inconsitency in taxonomy term naming. |
|
612 |
$object = $vars['elements']['#entity_type'];
|
|
611 |
// Inconsistency in taxonomy term naming.
|
|
612 |
$entity_type = $vars['elements']['#entity_type'];
|
|
613 | 613 |
if ($vars['elements']['#entity_type'] == 'taxonomy_term') { |
614 |
$object = 'term';
|
|
614 |
$entity_type = 'term';
|
|
615 | 615 |
} |
616 | 616 |
|
617 | 617 |
// Get entity id and bundle |
618 |
list($id,, $bundle) = entity_extract_ids($vars['elements']['#entity_type'], $vars[$object]); |
|
618 |
$id = NULL; |
|
619 |
$bundle = $vars['elements']['#bundle']; |
|
620 |
$entity = isset($vars[$entity_type]) ? $vars[$entity_type] : (isset($vars['elements']['#' . $entity_type]) ? $vars['elements']['#' . $entity_type] : NULL); |
|
621 |
list($id,, $bundle) = entity_extract_ids($entity_type, $entity); |
|
619 | 622 |
|
620 |
if (isset($vars[$object]->preprocess_fields)) {
|
|
621 |
foreach ($vars[$object]->preprocess_fields as $field) {
|
|
623 |
if (isset($vars[$entity_type]->preprocess_fields)) {
|
|
624 |
foreach ($vars[$entity_type]->preprocess_fields as $field) {
|
|
622 | 625 |
|
623 | 626 |
// Process RDF if the module is enabled before moving preprocess fields. |
624 | 627 |
if (module_exists('rdf')) { |
... | ... | |
667 | 670 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $vars['elements']['#view_mode']; |
668 | 671 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $bundle; |
669 | 672 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '_' . $bundle . '_' . $vars['elements']['#view_mode']; |
670 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '__' . $id; |
|
673 |
if (!empty($id)) { |
|
674 |
$vars['theme_hook_suggestions'][] = $layout['layout'] . '__' . $vars['elements']['#entity_type'] . '__' . $id; |
|
675 |
} |
|
671 | 676 |
} |
672 | 677 |
|
673 | 678 |
// If the layout has wrapper class lets add it. |
... | ... | |
677 | 682 |
} |
678 | 683 |
} |
679 | 684 |
|
685 |
$layout_render_array = array(); |
|
680 | 686 |
// Create region variables based on the layout settings. |
681 | 687 |
foreach ($layout['regions'] as $region_name => $region) { |
682 | 688 |
|
... | ... | |
700 | 706 |
$vars[$region_name . '_classes'] = !empty($layout['settings']['classes'][$region_name]) ? ' ' . implode(' ', $layout['settings']['classes'][$region_name]) : ''; |
701 | 707 |
|
702 | 708 |
// Token support for region classes. |
703 |
if (module_exists('token') && isset($vars[$object])) {
|
|
704 |
$vars[$region_name . '_classes'] = token_replace($vars[$region_name . '_classes'], array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE));
|
|
709 |
if (module_exists('token') && isset($vars[$entity_type])) {
|
|
710 |
$vars[$region_name . '_classes'] = token_replace($vars[$region_name . '_classes'], array($entity_type => $vars[$entity_type]), array('clear' => TRUE, 'sanitize' => TRUE));
|
|
705 | 711 |
} |
706 | 712 |
} |
707 | 713 |
// Add a wrapper to the region. |
... | ... | |
719 | 725 |
// Add layout attributes if any. |
720 | 726 |
$vars['layout_attributes'] = ''; |
721 | 727 |
if (!empty($layout['settings']['layout_attributes'])) { |
722 |
if (isset($vars[$object])) {
|
|
723 |
$vars['layout_attributes'] .= ' ' . token_replace($layout['settings']['layout_attributes'], array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE));
|
|
728 |
if (isset($vars[$entity_type])) {
|
|
729 |
$vars['layout_attributes'] .= ' ' . token_replace($layout['settings']['layout_attributes'], array($entity_type => $vars[$entity_type]), array('clear' => TRUE, 'sanitize' => TRUE));
|
|
724 | 730 |
} |
725 | 731 |
else { |
726 | 732 |
$vars['layout_attributes'] .= ' ' . $layout['settings']['layout_attributes']; |
... | ... | |
737 | 743 |
} |
738 | 744 |
|
739 | 745 |
// Token support for layout classes. |
740 |
if (module_exists('token') && isset($vars[$object])) {
|
|
746 |
if (module_exists('token') && isset($vars[$entity_type])) {
|
|
741 | 747 |
foreach ($vars['classes_array'] as &$class) { |
742 |
$class = token_replace($class, array($object => $vars[$object]), array('clear' => TRUE, 'sanitize' => TRUE));
|
|
748 |
$class = token_replace($class, array($entity_type => $vars[$entity_type]), array('clear' => TRUE, 'sanitize' => TRUE));
|
|
743 | 749 |
} |
744 | 750 |
} |
745 | 751 |
|
... | ... | |
748 | 754 |
$url = ''; |
749 | 755 |
switch ($layout['settings']['layout_link_attribute']) { |
750 | 756 |
case 'content': |
751 |
if ($object == 'user') {
|
|
757 |
if ($entity_type == 'user') {
|
|
752 | 758 |
$uri = entity_uri($vars['elements']['#entity_type'], $vars['elements']['#account']); |
753 | 759 |
} |
754 | 760 |
else { |
755 |
$uri = entity_uri($vars['elements']['#entity_type'], $vars[$object]);
|
|
761 |
$uri = entity_uri($vars['elements']['#entity_type'], $vars[$entity_type]);
|
|
756 | 762 |
} |
757 | 763 |
if (!empty($uri)) { |
758 | 764 |
$url = $uri['path']; |
... | ... | |
762 | 768 |
$url = $layout['settings']['layout_link_custom']; |
763 | 769 |
break; |
764 | 770 |
case 'tokens': |
765 |
$url = token_replace($layout['settings']['layout_link_custom'], array($vars['elements']['#entity_type'] => $vars[$object]), array('clear' => TRUE));
|
|
771 |
$url = token_replace($layout['settings']['layout_link_custom'], array($vars['elements']['#entity_type'] => $vars[$entity_type]), array('clear' => TRUE));
|
|
766 | 772 |
break; |
767 | 773 |
} |
768 | 774 |
|
... | ... | |
772 | 778 |
} |
773 | 779 |
|
774 | 780 |
// Set field weights for all fields, including pre-process. |
775 |
foreach($layout_render_array as $region => &$fields) { |
|
781 |
foreach ($layout_render_array as $region => &$fields) {
|
|
776 | 782 |
foreach ($fields as $field_key => &$field) { |
777 | 783 |
$field['#weight'] = $field_key; |
778 | 784 |
} |
779 | 785 |
} |
780 | 786 |
|
781 | 787 |
// Let other modules alter the ds array before creating the region variables. |
782 |
$context = array('entity' => isset($vars[$object]) ? $vars[$object] : (isset($vars['elements']['#' . $object]) ? $vars['elements']['#' . $object] : ''), 'entity_type' => $vars['elements']['#entity_type'], 'bundle' => $vars['elements']['#bundle'], 'view_mode' => $vars['elements']['#view_mode']);
|
|
788 |
$context = array('entity' => isset($vars[$entity_type]) ? $vars[$entity_type] : (isset($vars['elements']['#' . $entity_type]) ? $vars['elements']['#' . $entity_type] : ''), 'entity_type' => $vars['elements']['#entity_type'], 'bundle' => $vars['elements']['#bundle'], 'view_mode' => $vars['elements']['#view_mode']);
|
|
783 | 789 |
drupal_alter('ds_pre_render', $layout_render_array, $context, $vars); |
784 | 790 |
foreach ($layout_render_array as $region_name => $content) { |
785 | 791 |
// In case this is a panels layout, add the region to the $content variable. |
drupal7/sites/all/modules/ds/modules/ds_devel/ds_devel.info | ||
---|---|---|
5 | 5 |
dependencies[] = ds |
6 | 6 |
dependencies[] = devel |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
9 |
version = "7.x-2.12"
|
|
8 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
9 |
version = "7.x-2.13"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "ds" |
12 |
datestamp = "1452953681"
|
|
12 |
datestamp = "1455211441"
|
|
13 | 13 |
|
drupal7/sites/all/modules/ds/modules/ds_extras/ds_extras.info | ||
---|---|---|
5 | 5 |
dependencies[] = ds |
6 | 6 |
configure = admin/structure/ds/list/extras |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
9 |
version = "7.x-2.12"
|
|
8 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
9 |
version = "7.x-2.13"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "ds" |
12 |
datestamp = "1452953681"
|
|
12 |
datestamp = "1455211441"
|
|
13 | 13 |
|
drupal7/sites/all/modules/ds/modules/ds_format/ds_format.info | ||
---|---|---|
5 | 5 |
dependencies[] = ds |
6 | 6 |
configure = admin/structure/ds/list/extras |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
9 |
version = "7.x-2.12"
|
|
8 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
9 |
version = "7.x-2.13"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "ds" |
12 |
datestamp = "1452953681"
|
|
12 |
datestamp = "1455211441"
|
|
13 | 13 |
|
drupal7/sites/all/modules/ds/modules/ds_forms/ds_forms.info | ||
---|---|---|
4 | 4 |
package = "Display Suite" |
5 | 5 |
dependencies[] = ds |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
8 |
version = "7.x-2.12"
|
|
7 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
8 |
version = "7.x-2.13"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "ds" |
11 |
datestamp = "1452953681"
|
|
11 |
datestamp = "1455211441"
|
|
12 | 12 |
|
drupal7/sites/all/modules/ds/modules/ds_search/ds_search.info | ||
---|---|---|
5 | 5 |
dependencies[] = ds |
6 | 6 |
configure = admin/structure/ds/list/search |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
9 |
version = "7.x-2.12"
|
|
8 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
9 |
version = "7.x-2.13"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "ds" |
12 |
datestamp = "1452953681"
|
|
12 |
datestamp = "1455211441"
|
|
13 | 13 |
|
drupal7/sites/all/modules/ds/modules/ds_ui/ds_ui.info | ||
---|---|---|
4 | 4 |
package = "Display Suite" |
5 | 5 |
dependencies[] = ds |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
8 |
version = "7.x-2.12"
|
|
7 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
8 |
version = "7.x-2.13"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "ds" |
11 |
datestamp = "1452953681"
|
|
11 |
datestamp = "1455211441"
|
|
12 | 12 |
|
drupal7/sites/all/modules/ds/tests/ds.entities.test | ||
---|---|---|
105 | 105 |
$node = $this->entitiesTestSetup(); |
106 | 106 |
$node_author = user_load($node->uid); |
107 | 107 |
|
108 |
// Test theme_hook_suggestions in ds_entity_variables(). |
|
109 |
$this->drupalGet('node/' . $node->nid, array('query' => array('store' => 1))); |
|
110 |
$cache = cache_get('ds_test'); |
|
111 |
$this->assertTrue(!empty($cache)); |
|
112 |
$hook_suggestions = $cache->data['theme_hook_suggestions']; |
|
113 |
$expected_hook_suggestions = array( |
|
114 |
'node__article', |
|
115 |
'node__1', |
|
116 |
'ds_2col_stacked', |
|
117 |
'ds_2col_stacked__node', |
|
118 |
'ds_2col_stacked__node_full', |
|
119 |
'ds_2col_stacked__node_article', |
|
120 |
'ds_2col_stacked__node_article_full', |
|
121 |
'ds_2col_stacked__node__1' |
|
122 |
); |
|
123 |
$this->assertEqual($hook_suggestions, $expected_hook_suggestions); |
|
124 |
|
|
108 | 125 |
// Look at node and verify token and block field. |
109 | 126 |
$this->drupalGet('node/' . $node->nid); |
110 | 127 |
$this->assertRaw('view-mode-full', 'Template file found (in full view mode)'); |
drupal7/sites/all/modules/ds/tests/ds_exportables_test/ds_exportables_test.info | ||
---|---|---|
4 | 4 |
core = 7.x |
5 | 5 |
hidden = TRUE |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
8 |
version = "7.x-2.12"
|
|
7 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
8 |
version = "7.x-2.13"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "ds" |
11 |
datestamp = "1452953681"
|
|
11 |
datestamp = "1455211441"
|
|
12 | 12 |
|
drupal7/sites/all/modules/ds/tests/ds_test.info | ||
---|---|---|
5 | 5 |
dependencies[] = ds_extras |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2016-01-16
|
|
9 |
version = "7.x-2.12"
|
|
8 |
; Information added by Drupal.org packaging script on 2016-02-11
|
|
9 |
version = "7.x-2.13"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "ds" |
12 |
datestamp = "1452953681"
|
|
12 |
datestamp = "1455211441"
|
|
13 | 13 |
|
drupal7/sites/all/modules/ds/tests/ds_test.module | ||
---|---|---|
24 | 24 |
->execute(); |
25 | 25 |
} |
26 | 26 |
|
27 |
/** |
|
28 |
* Implements hook_theme_registry_alter(). |
|
29 |
*/ |
|
30 |
function ds_test_theme_registry_alter(&$theme_registry) { |
|
31 |
|
|
32 |
// Inject ds_entity_variables in all entity theming functions. |
|
33 |
$entity_info = entity_get_info(); |
|
34 |
foreach ($entity_info as $entity => $info) { |
|
35 |
if (isset($entity_info[$entity]['fieldable']) && $entity_info[$entity]['fieldable']) { |
|
36 |
|
|
37 |
// User uses user_profile for theming. |
|
38 |
if ($entity == 'user') $entity = 'user_profile'; |
|
39 |
|
|
40 |
// Only add preprocess functions if entity exposes theme function. |
|
41 |
if (isset($theme_registry[$entity])) { |
|
42 |
$theme_registry[$entity]['preprocess functions'][] = 'ds_test_entity_variables'; |
|
43 |
} |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
// Support for File Entity. |
|
48 |
if (isset($theme_registry['file_entity'])) { |
|
49 |
$theme_registry['file_entity']['preprocess functions'][] = 'ds_test_entity_variables'; |
|
50 |
} |
|
51 |
|
|
52 |
// Support for Entity API. |
|
53 |
if (isset($theme_registry['entity'])) { |
|
54 |
$theme_registry['entity']['preprocess functions'][] = 'ds_test_entity_variables'; |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Theming function, added after ds_entity_variables(). |
|
60 |
* |
|
61 |
* @param $variables |
|
62 |
*/ |
|
63 |
function ds_test_entity_variables(&$variables) { |
|
64 |
if (isset($_GET['store'])) { |
|
65 |
cache_set('ds_test', $variables); |
|
66 |
} |
|
67 |
} |
|
68 |
|
|
27 | 69 |
/** |
28 | 70 |
* Implements hook_views_api(). |
29 | 71 |
*/ |
drupal7/sites/all/modules/menu_attributes/menu_attributes.info | ||
---|---|---|
6 | 6 |
|
7 | 7 |
files[] = menu_attributes.test |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2014-10-19
|
|
10 |
version = "7.x-1.0-rc3"
|
|
9 |
; Information added by Drupal.org packaging script on 2016-02-15
|
|
10 |
version = "7.x-1.0" |
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "menu_attributes" |
13 |
datestamp = "1413756231"
|
|
13 |
datestamp = "1455568740"
|
|
14 | 14 |
|
drupal7/sites/all/modules/menu_attributes/menu_attributes.module | ||
---|---|---|
16 | 16 |
return array( |
17 | 17 |
'administer menu attributes' => array( |
18 | 18 |
'title' => t('Administer menu attributes'), |
19 |
'description' => t('Administer menu attributes.'), |
|
19 |
'description' => t('Administer menu attributes configuration.'),
|
|
20 | 20 |
), |
21 | 21 |
); |
22 | 22 |
} |
... | ... | |
177 | 177 |
'#type' => 'fieldset', |
178 | 178 |
'#title' => t('Menu link attributes'), |
179 | 179 |
'#collapsible' => TRUE, |
180 |
'#collapsed' => FALSE,
|
|
180 |
'#collapsed' => TRUE,
|
|
181 | 181 |
'#tree' => TRUE, |
182 | 182 |
); |
183 | 183 |
|
... | ... | |
255 | 255 |
$has_visible_children = (bool) element_get_visible_children($form['options']['attributes']); |
256 | 256 |
$user_has_access = user_access('administer menu attributes'); |
257 | 257 |
$form['options']['attributes']['#access'] = ($has_visible_children && $user_has_access); |
258 |
|
|
259 |
$has_visible_children = (bool) element_get_visible_children($form['options']['item_attributes']); |
|
260 |
$form['options']['item_attributes']['#access'] = ($has_visible_children && $user_has_access); |
|
258 | 261 |
} |
259 | 262 |
|
260 | 263 |
/** |
... | ... | |
337 | 340 |
// Class get's special treatment, as it's an array and it should not |
338 | 341 |
// replace existing values. |
339 | 342 |
if ($attribute == 'class') { |
340 |
$value = explode(' ', $value);
|
|
343 |
$value = !is_array($value) ? explode(' ', $value) : $value;
|
|
341 | 344 |
if (isset($attributes[$attribute])) { |
342 | 345 |
$value = array_merge($attributes[$attribute], $value); |
343 | 346 |
} |
drupal7/sites/all/modules/recaptcha/recaptcha.info | ||
---|---|---|
8 | 8 |
files[] = tests/recaptcha_server_status.test |
9 | 9 |
configure = admin/config/people/captcha/recaptcha |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2015-04-09
|
|
12 |
version = "7.x-1.12"
|
|
11 |
; Information added by Drupal.org packaging script on 2016-02-17
|
|
12 |
version = "7.x-1.13"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "recaptcha" |
15 |
datestamp = "1428593287"
|
|
15 |
datestamp = "1455735240"
|
|
16 | 16 |
|
drupal7/sites/all/modules/recaptcha/recaptcha.install | ||
---|---|---|
9 | 9 |
* Implements hook_uninstall(). |
10 | 10 |
*/ |
11 | 11 |
function recaptcha_uninstall() { |
12 |
// Delete all the recaptcha variables and then clear the variable cache |
|
12 |
// Delete all the recaptcha variables and then clear the variable cache.
|
|
13 | 13 |
db_delete('variable') |
14 | 14 |
->condition('name', 'recaptcha_%', 'LIKE') |
15 | 15 |
->execute(); |
16 |
cache_clear_all('variables', 'cache'); |
|
16 |
cache_clear_all('variables', 'cache_bootstrap');
|
|
17 | 17 |
} |
18 | 18 |
|
19 | 19 |
/** |
20 |
* @todo The next time there is an update hook, that hook should run: |
|
21 |
* variable_del('recaptcha_secure_connection'); |
|
22 |
* This removes a variable no longer in use due to https://drupal.org/node/1827922 |
|
20 |
* Implements hook_update_N(). |
|
23 | 21 |
*/ |
22 |
|
|
23 |
/** |
|
24 |
* Issue #2473329: Remove obsolete variables. |
|
25 |
*/ |
|
26 |
function recaptcha_update_7100() { |
|
27 |
$variables = array( |
|
28 |
'recaptcha_secure_connection', |
|
29 |
'recaptcha_api_server', |
|
30 |
'recaptcha_api_secure_server', |
|
31 |
'recaptcha_verify_server', |
|
32 |
); |
|
33 |
foreach ($variables as $variable) { |
|
34 |
variable_del($variable); |
|
35 |
} |
|
36 |
return t('Removed obsolete variables.'); |
|
37 |
} |
drupal7/sites/all/modules/recaptcha/recaptcha.js | ||
---|---|---|
1 |
/** |
|
2 |
* @file |
|
3 |
* Drupal JavaScript behaviors for recaptcha. |
|
4 |
*/ |
|
5 |
|
|
1 | 6 |
(function ($) { |
2 | 7 |
Drupal.behaviors.recaptcha = { |
3 | 8 |
attach: function (context) { |
4 | 9 |
Recaptcha.create(Drupal.settings.recaptcha.public_key, Drupal.settings.recaptcha.container, {theme: Drupal.settings.recaptcha.theme}); |
5 | 10 |
}, |
6 |
detach: function (context) {} |
|
11 |
detach: function (context) { |
|
12 |
} |
|
7 | 13 |
}; |
8 | 14 |
}(jQuery)); |
drupal7/sites/all/modules/recaptcha/recaptcha.module | ||
---|---|---|
10 | 10 |
*/ |
11 | 11 |
function recaptcha_help($path, $arg) { |
12 | 12 |
$output = ''; |
13 |
|
|
13 | 14 |
switch ($path) { |
14 | 15 |
case 'admin/modules#name': |
15 | 16 |
$output .= t('reCAPTCHA'); |
16 | 17 |
break; |
18 |
|
|
17 | 19 |
case 'admin/modules#description': |
18 | 20 |
case 'admin/user/captcha/recaptcha': |
19 | 21 |
$output .= t('Uses the <a href="@url" target="_blank">reCAPTCHA</a> web service to improve the CAPTCHA system and protect email addresses.', array('@url' => url('https://www.google.com/recaptcha'))); |
20 | 22 |
break; |
23 |
|
|
21 | 24 |
case 'admin/help#recaptcha': |
22 | 25 |
$output .= '<p>' . |
23 | 26 |
t('Uses the reCAPTCHA web service to improve the CAPTCHA module and protect email addresses. For more information on what reCAPTCHA is, visit <a href="@url" target="_blank">the official website</a>.', array('@url' => url('https://www.google.com/recaptcha'))) . |
... | ... | |
28 | 31 |
'</p>'; |
29 | 32 |
break; |
30 | 33 |
} |
34 |
|
|
31 | 35 |
return $output; |
32 | 36 |
} |
33 | 37 |
|
... | ... | |
99 | 103 |
global $language; |
100 | 104 |
if (isset($language->language)) { |
101 | 105 |
// reCAPTCHA uses two-character language codes, so 'pt-br' must be |
102 |
// passed as 'pt'; cf. https://developers.google.com/recaptcha/docs/customization#i18n
|
|
106 |
// passed as 'pt'.
|
|
103 | 107 |
$recaptcha_options['lang'] = drupal_substr($language->language, 0, 2); |
104 | 108 |
} |
105 | 109 |
|
... | ... | |
166 | 170 |
} |
167 | 171 |
|
168 | 172 |
/** |
173 |
* Test whether the reCAPTCHA server is up. |
|
174 |
* |
|
169 | 175 |
* @return bool |
170 | 176 |
* TRUE if the reCAPTCHA server is up, FALSE otherwise. |
171 | 177 |
*/ |
drupal7/sites/all/modules/recaptcha/recaptcha_mailhide.info | ||
---|---|---|
1 |
name = reCAPTCHA Mailhide |
|
2 |
description = "Uses the reCAPTCHA web service to protect email addresses." |
|
3 |
package = "Spam control" |
|
4 |
core = 7.x |
|
5 |
|
|
6 |
files[] = recaptcha_mailhide.module |
|
7 |
|
|
8 |
; Information added by Drupal.org packaging script on 2015-04-09 |
|
9 |
version = "7.x-1.12" |
|
10 |
core = "7.x" |
|
11 |
project = "recaptcha" |
|
12 |
datestamp = "1428593287" |
|
13 |
|
drupal7/sites/all/modules/recaptcha/recaptcha_mailhide/recaptcha_mailhide.info | ||
---|---|---|
1 |
name = reCAPTCHA Mailhide |
|
2 |
description = Uses the reCAPTCHA web service to protect email addresses. |
|
3 |
core = 7.x |
|
4 |
package = Spam control |
|
5 |
|
|
6 |
; Information added by Drupal.org packaging script on 2016-02-17 |
|
7 |
version = "7.x-1.13" |
|
8 |
core = "7.x" |
|
9 |
project = "recaptcha" |
|
10 |
datestamp = "1455735240" |
|
11 |
|
drupal7/sites/all/modules/recaptcha/recaptcha_mailhide/recaptcha_mailhide.install | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Provides install, updated, and uninstall functions for recaptcha_mailhide. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* Implements hook_update_N(). |
|
10 |
*/ |
|
11 |
|
|
12 |
/** |
|
13 |
* Issue #2473329: Remove obsolete variables. |
|
14 |
*/ |
|
15 |
function recaptcha_mailhide_update_7100() { |
|
16 |
// recaptcha_mailhide no longer uses any variables. |
|
17 |
db_delete('variable') |
|
18 |
->condition('name', 'recaptcha_mailhide_%', 'LIKE') |
|
19 |
->execute(); |
|
20 |
cache_clear_all('variables', 'cache_bootstrap'); |
|
21 |
return t('Removed obsolete variables.'); |
|
22 |
} |
drupal7/sites/all/modules/recaptcha/recaptcha_mailhide/recaptcha_mailhide.module | ||
---|---|---|
10 | 10 |
*/ |
11 | 11 |
function recaptcha_mailhide_help($path, $arg) { |
12 | 12 |
$output = ''; |
13 |
|
|
13 | 14 |
switch ($path) { |
14 | 15 |
case 'admin/modules#name': |
15 | 16 |
$output .= t('reCAPTCHA'); |
16 | 17 |
break; |
18 |
|
|
17 | 19 |
case 'admin/modules#description': |
18 |
$output .= t('Uses the <a href="@url" target="_blank">reCAPTCHA</a> web service to protect email addresses.', array('@url' => url('https://www.google.com/recaptcha'))); |
|
20 |
$output .= t('Uses the <a href="@url" target="_blank">reCAPTCHA</a> web service to protect email addresses.', array('@url' => url('https://www.google.com/recaptcha/mailhide/apikey')));
|
|
19 | 21 |
break; |
22 |
|
|
20 | 23 |
case 'admin/help#recaptcha': |
21 | 24 |
$output .= '<p>' . |
22 |
t('Uses the reCAPTCHA web service to protect email addresses. For more information on what reCAPTCHA Mailhide is, visit <a href="@url" target="_blank">the official website</a>.', array('@url' => url('https://www.google.com/recaptcha/mailhide/'))) . |
|
25 |
t('Uses the reCAPTCHA web service to protect email addresses. For more information on what reCAPTCHA Mailhide is, visit <a href="@url" target="_blank">the official website</a>.', array('@url' => url('https://www.google.com/recaptcha/mailhide/apikey'))) .
|
|
23 | 26 |
'</p><h3>' . |
24 | 27 |
t('Configuration') . |
25 | 28 |
'</h3><p>' . |
26 |
t('Head over to the <a href="@inputformats">input format settings</a> and add the <a href="@url" target="_blank">reCAPTCHA Mailhide</a> input filter to hide posted emails.', array('@inputformats' => url('admin/settings/filter'), '@url' => url('https://www.google.com/recaptcha/mailhide/'))) . |
|
29 |
t('Head over to the <a href="@inputformats">input format settings</a> and add the <a href="@url" target="_blank">reCAPTCHA Mailhide</a> input filter to hide posted emails.', array('@inputformats' => url('admin/settings/filter'), '@url' => url('https://www.google.com/recaptcha/mailhide/apikey'))) .
|
|
27 | 30 |
'</p>'; |
28 | 31 |
break; |
29 | 32 |
} |
33 |
|
|
30 | 34 |
return $output; |
31 | 35 |
} |
32 | 36 |
|
... | ... | |
64 | 68 |
return $text; |
65 | 69 |
} |
66 | 70 |
|
71 |
/** |
|
72 |
* |
|
73 |
*/ |
|
67 | 74 |
function _filter_recaptcha_mailhide_settings($form, &$form_state, $filter, $format, $defaults, $filters) { |
68 | 75 |
_recaptcha_mailhide_load_library(); |
69 | 76 |
$public = isset($filter->settings['recaptcha_mailhide_public_key']) ? $filter->settings['recaptcha_mailhide_public_key'] : ''; |
... | ... | |
74 | 81 |
'#default_value' => $public, |
75 | 82 |
'#maxlength' => 50, |
76 | 83 |
'#description' => t('Your public Mailhide key obtained from <a href="@url" target="_blank">reCAPTCHA</a>.', array('@url' => 'https://www.google.com/recaptcha/mailhide/apikey')), |
77 |
);
|
|
84 |
); |
|
78 | 85 |
$settings['recaptcha_mailhide_private_key'] = array( |
79 | 86 |
'#type' => 'textfield', |
80 | 87 |
'#title' => t('Private Key'), |
81 | 88 |
'#default_value' => $private, |
82 | 89 |
'#maxlength' => 50, |
83 | 90 |
'#description' => t('Your private Mailhide key obtained from <a href="@url" target="_blank">reCAPTCHA</a>.', array('@url' => 'https://www.google.com/recaptcha/mailhide/apikey')), |
84 |
);
|
|
91 |
); |
|
85 | 92 |
return $settings; |
86 | 93 |
} |
87 | 94 |
|
95 |
/** |
|
96 |
* |
|
97 |
*/ |
|
88 | 98 |
function _filter_recaptcha_mailhide_tips($filter, $format, $long = FALSE) { |
89 |
return t('E-Mail addresses are hidden with <a href="@url" target="_blank">reCAPTCHA Mailhide</a>.', array('@url' => 'https://www.google.com/recaptcha/mailhide/')); |
|
99 |
return t('E-Mail addresses are hidden with <a href="@url" target="_blank">reCAPTCHA Mailhide</a>.', array('@url' => 'https://www.google.com/recaptcha/mailhide/apikey'));
|
|
90 | 100 |
} |
91 | 101 |
|
92 | 102 |
/** |
93 |
* Private reCAPTCHA function to replace an email regex match |
|
103 |
* Private reCAPTCHA function to replace an email regex match.
|
|
94 | 104 |
*/ |
95 | 105 |
function _recaptcha_replace($match) { |
96 | 106 |
global $_recaptcha_mailhide_public_key, $_recaptcha_mailhide_private_key, $_recaptcha_mailhide_nokey_warn; |
97 |
// recaptchalib will die if we invoke without setting the keys. Fail gracefully in this case. |
|
107 |
// If we invoke recaptchalib without setting the keys, it will die(). Instead, |
|
108 |
// fail gracefully. |
|
98 | 109 |
if (empty($_recaptcha_mailhide_public_key) || empty($_recaptcha_mailhide_private_key) || !function_exists('mcrypt_encrypt')) { |
99 | 110 |
if ($_recaptcha_mailhide_nokey_warn != TRUE) { |
100 | 111 |
if (!function_exists('mcrypt_encrypt')) { |
drupal7/sites/all/modules/recaptcha/tests/recaptcha_base.test | ||
---|---|---|
12 | 12 |
|
13 | 13 |
/** |
14 | 14 |
* User with various administrative permissions. |
15 |
* |
|
15 | 16 |
* @var object Drupal user |
16 | 17 |
*/ |
17 | 18 |
protected $admin_user; |
18 | 19 |
|
19 | 20 |
/** |
20 |
* Normal visitor with limited permissions |
|
21 |
* Normal visitor with limited permissions. |
|
22 |
* |
|
21 | 23 |
* @var object Drupal user; |
22 | 24 |
*/ |
23 | 25 |
protected $normal_user; |
24 | 26 |
|
25 | 27 |
/** |
26 |
* Drupal path of the (general) CAPTCHA admin page |
|
28 |
* Drupal path of the (general) CAPTCHA admin page.
|
|
27 | 29 |
*/ |
28 | 30 |
const RECAPTCHA_ADMIN_PATH = 'admin/config/people/captcha/recaptcha'; |
29 | 31 |
|
30 | 32 |
/** |
31 | 33 |
* Set up some required modules and users. |
32 | 34 |
*/ |
33 |
function setUp() { |
|
35 |
public function setUp() {
|
|
34 | 36 |
parent::setUp('recaptcha'); |
35 | 37 |
|
36 | 38 |
// Create a normal user. |
drupal7/sites/all/modules/recaptcha/tests/recaptcha_server_status.test | ||
---|---|---|
11 | 11 |
class ReCaptchaServerStatusTestCase extends ReCaptchaBaseTestCase { |
12 | 12 |
|
13 | 13 |
/** |
14 |
* Drupal path of the (general) CAPTCHA admin page |
|
14 |
* Drupal path of the (general) CAPTCHA admin page.
|
|
15 | 15 |
*/ |
16 | 16 |
const RECAPTCHA_ADMIN_PATH = 'admin/config/people/captcha/recaptcha'; |
17 | 17 |
|
18 |
/** |
|
19 |
* |
|
20 |
*/ |
|
18 | 21 |
public static function getInfo() { |
19 | 22 |
return array( |
20 | 23 |
'name' => 'ReCaptcha server status cache test', |
21 | 24 |
'group' => 'reCAPTCHA', |
22 |
'description' => 'Tests reCaptcha admin UI' |
|
25 |
'description' => 'Tests reCaptcha admin UI',
|
|
23 | 26 |
); |
24 | 27 |
} |
25 | 28 |
|
29 |
/** |
|
30 |
* |
|
31 |
*/ |
|
26 | 32 |
public function setup() { |
27 | 33 |
parent::setUp(); |
28 | 34 |
include_once drupal_get_path('module', 'recaptcha') . '/recaptcha-php-1.11/recaptchalib.php'; |
29 | 35 |
} |
30 | 36 |
|
37 |
/** |
|
38 |
* |
|
39 |
*/ |
|
31 | 40 |
public function testServerStatusCache() { |
32 | 41 |
// No cache before status check. |
33 | 42 |
$status_cache = cache_get('recaptcha_server_status'); |
drupal7/sites/all/modules/recaptcha/tests/recaptcha_ui.test | ||
---|---|---|
11 | 11 |
class ReCaptchaAdminUITestCase extends ReCaptchaBaseTestCase { |
12 | 12 |
|
13 | 13 |
/** |
14 |
* Drupal path of the (general) CAPTCHA admin page |
|
14 |
* Drupal path of the (general) CAPTCHA admin page.
|
|
15 | 15 |
*/ |
16 | 16 |
const RECAPTCHA_ADMIN_PATH = 'admin/config/people/captcha/recaptcha'; |
17 | 17 |
|
18 |
/** |
|
19 |
* |
|
20 |
*/ |
|
18 | 21 |
public static function getInfo() { |
19 | 22 |
return array( |
20 | 23 |
'name' => 'ReCaptcha admin UI test', |
21 | 24 |
'group' => 'reCAPTCHA', |
22 |
'description' => 'Tests reCaptcha admin UI' |
|
25 |
'description' => 'Tests reCaptcha admin UI',
|
|
23 | 26 |
); |
24 | 27 |
} |
25 | 28 |
|
26 | 29 |
/** |
27 | 30 |
* Test access to the admin pages. |
28 | 31 |
*/ |
29 |
function testAdminAccess() { |
|
32 |
public function testAdminAccess() {
|
|
30 | 33 |
$this->drupalLogin($this->normal_user); |
31 | 34 |
$this->drupalGet(self::RECAPTCHA_ADMIN_PATH); |
32 | 35 |
file_put_contents('tmp.simpletest.html', $this->drupalGetContent()); |
... | ... | |
38 | 41 |
$this->assertResponse(200); |
39 | 42 |
$this->assertField('recaptcha_server_status_check_interval'); |
40 | 43 |
|
41 |
|
|
42 | 44 |
// Update the interval and make sure it get saved properly. |
43 | 45 |
$edit = array( |
44 | 46 |
'recaptcha_server_status_check_interval' => 20, |
drupal7/sites/all/modules/webform_validation/webform_validation.admin.inc | ||
---|---|---|
213 | 213 |
'#default_value' => (isset($rule['components'])) ? array_keys($rule['components']) : array(), |
214 | 214 |
); |
215 | 215 |
|
216 |
if (isset($rule_validator['custom_data']) && is_array($rule_validator['custom_data'])) {
|
|
216 |
if (!empty($rule_validator['custom_data']) && is_array($rule_validator['custom_data'])) {
|
|
217 | 217 |
$required = isset($rule_validator['custom_data']['required']) ? $rule_validator['custom_data']['required'] : TRUE; |
218 | 218 |
$form['rule']['data'] = array( |
219 | 219 |
'#type' => 'textfield', |
220 | 220 |
'#title' => $rule_validator['custom_data']['label'], |
221 | 221 |
'#description' => $rule_validator['custom_data']['description'], |
222 |
'#required' => ($required !== FALSE) ? TRUE : FALSE,
|
|
222 |
'#required' => (bool) $required,
|
|
223 | 223 |
'#size' => 60, |
224 | 224 |
'#maxlength' => NULL, |
225 | 225 |
'#default_value' => $rule['data'], |
... | ... | |
227 | 227 |
); |
228 | 228 |
} |
229 | 229 |
|
230 |
if (isset($rule_validator['negatable'])) {
|
|
230 |
if (!empty($rule_validator['negatable'])) {
|
|
231 | 231 |
$form['rule']['negate'] = array( |
232 | 232 |
'#type' => 'checkbox', |
233 | 233 |
'#title' => t('Negate rule'), |
... | ... | |
237 | 237 |
); |
238 | 238 |
} |
239 | 239 |
|
240 |
if (isset($rule_validator['custom_error'])) { |
|
240 |
if (!empty($rule_validator['custom_error'])) { |
Formats disponibles : Unified diff
Weekly update of contrib modules