Révision 32700c57
Ajouté par Assos Assos il y a environ 5 ans
drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.theme.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* theming functions for ldap_authentication module |
|
6 |
* |
|
5 |
* Theming functions for ldap_authentication module. |
|
7 | 6 |
*/ |
8 | 7 |
|
9 | 8 |
/** |
10 | 9 |
* Returns HTML for user login block links. |
10 |
* |
|
11 | 11 |
* @param $variables |
12 | 12 |
* An associative array containing: |
13 |
* - hide_reset_pwd (boolean) whether reset password link should be visible
|
|
13 |
* - $show_reset_pwd (boolean) whether reset password link should be visible
|
|
14 | 14 |
* - auth_conf: object with ldap authentication configuration data |
15 | 15 |
* |
16 | 16 |
* @ingroup themeable |
17 |
* |
|
18 |
* @return string |
|
17 | 19 |
*/ |
18 | 20 |
function theme_ldap_authentication_user_login_block_links($variables) { |
21 |
/** @var bool $show_reset_pwd */ |
|
22 |
/** @var object $auth_conf */ |
|
19 | 23 |
extract($variables); |
20 | 24 |
|
21 |
// the code below modified from user.module user_login_block function
|
|
22 |
$items = array();
|
|
25 |
// The code below modified from user.module user_login_block function.
|
|
26 |
$items = [];
|
|
23 | 27 |
if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) { |
24 |
$items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
|
|
28 |
$items[] = l(t('Create new account'), 'user/register', ['attributes' => ['title' => t('Create a new user account.')]]);
|
|
25 | 29 |
} |
26 | 30 |
if ($show_reset_pwd) { |
27 |
$items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
|
|
31 |
$items[] = l(t('Request new password'), 'user/password', ['attributes' => ['title' => t('Request new password via e-mail.')]]);
|
|
28 | 32 |
} |
29 | 33 |
elseif ($auth_conf->ldapUserHelpLinkUrl) { |
30 | 34 |
$items[] = l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl); |
31 | 35 |
} |
32 | 36 |
|
33 |
$output = theme('item_list', array('items' => $items));
|
|
37 |
$output = theme('item_list', ['items' => $items]);
|
|
34 | 38 |
return $output; |
35 | 39 |
} |
36 | 40 |
|
37 | 41 |
/** |
38 | 42 |
* Returns HTML warning text for request new password/password reset form. |
43 |
* |
|
39 | 44 |
* @param $variables |
40 | 45 |
* An associative array containing: |
41 | 46 |
* - auth_conf: object with ldap authentication configuration data |
42 | 47 |
* |
43 | 48 |
* @ingroup themeable |
49 |
* |
|
50 |
* @return string|null |
|
44 | 51 |
*/ |
45 | 52 |
function theme_ldap_authentication_user_pass_message($variables) { |
53 |
/** @var object $auth_conf */ |
|
46 | 54 |
extract($variables); |
47 | 55 |
if ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_EXCLUSIVE && $auth_conf->passwordOption != LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) { |
48 | 56 |
$msg = t('This page is only useful for the site administrator. All other users |
... | ... | |
54 | 62 |
$msg .= ' ' . t('with one of your organizations password management sites.'); |
55 | 63 |
} |
56 | 64 |
} |
57 |
else { // mixed mode |
|
58 |
$msg = ""; // warning will come up on validation. we do not know if the user is ldap authenticated or not until they submit form. |
|
65 |
// Mixed mode. |
|
66 |
else { |
|
67 |
// Warning will come up on validation. we do not know if the user is ldap authenticated or not until they submit form. |
|
68 |
$msg = ""; |
|
59 | 69 |
} |
60 | 70 |
|
61 | 71 |
return $msg; |
62 | 72 |
} |
63 | 73 |
|
64 | 74 |
/** |
65 |
* Returns HTML warning text when an ldap authenticated user tries to reset their password. |
|
75 |
* Returns HTML warning text when an ldap authenticated user tries to reset |
|
76 |
* their password. |
|
77 |
* |
|
66 | 78 |
* @param $variables |
67 | 79 |
* An associative array containing: |
68 | 80 |
* - auth_conf: object with ldap authentication configuration data |
69 | 81 |
* - account: user object |
70 | 82 |
* |
71 | 83 |
* @ingroup themeable |
84 |
* |
|
85 |
* @return string|null |
|
72 | 86 |
*/ |
73 | 87 |
function theme_ldap_authentication_user_pass_validate_ldap_authenticated($variables) { |
88 |
/** @var object $auth_conf */ |
|
74 | 89 |
extract($variables); |
75 |
// already know user exists and is ldap authenticated |
|
76 |
|
|
90 |
// Already know user exists and is ldap authenticated. |
|
77 | 91 |
if ($auth_conf->ldapUserHelpLinkUrl) { |
78 | 92 |
$msg = t('You may not reset your password here. You must reset your password via the directions at') |
79 | 93 |
. ' ' . l(t($auth_conf->ldapUserHelpLinkText), $auth_conf->ldapUserHelpLinkUrl); |
... | ... | |
85 | 99 |
return $msg; |
86 | 100 |
} |
87 | 101 |
|
88 |
|
|
89 | 102 |
/** |
90 | 103 |
* The following three functions are theme callbacks for various messages |
91 | 104 |
* from NTLM/seamless login integration. |
... | ... | |
95 | 108 |
* ability to have more complex message handling performed; an example would |
96 | 109 |
* be to use the Real Name module to say "Welcome, User Name" upon successful |
97 | 110 |
* login. |
98 |
* @param $message |
|
99 |
* A text string containing a translatable success message |
|
111 |
* |
|
112 |
* @param string $message |
|
113 |
* A text string containing a translatable success message. |
|
100 | 114 |
* |
101 | 115 |
* @ingroup themeable |
116 |
* |
|
117 |
* @return mixed |
|
102 | 118 |
*/ |
103 | 119 |
function theme_ldap_authentication_login_message($variables) { |
120 |
/** @var string $message */ |
|
104 | 121 |
extract($variables); |
105 | 122 |
return $message; |
106 | 123 |
} |
107 | 124 |
|
108 | 125 |
/** |
109 | 126 |
* Provides a theme callback for user not found messages. |
110 |
* @param $message |
|
111 |
* A text string containing a translatable "user not found" message |
|
127 |
* |
|
128 |
* @param string $message |
|
129 |
* A text string containing a translatable "user not found" message. |
|
112 | 130 |
* |
113 | 131 |
* @ingroup themeable |
132 |
* |
|
133 |
* @return mixed |
|
114 | 134 |
*/ |
115 | 135 |
function theme_ldap_authentication_message_not_found($variables) { |
136 |
/** @var string $message */ |
|
116 | 137 |
extract($variables); |
117 | 138 |
return $message; |
118 | 139 |
} |
119 | 140 |
|
120 | 141 |
/** |
121 | 142 |
* Provides a theme callback for authentication failure messages. |
122 |
* @param $message |
|
123 |
* A text string containing a translatable "authentication failure" message |
|
143 |
* |
|
144 |
* @param string $message |
|
145 |
* A text string containing a translatable "authentication failure" message. |
|
124 | 146 |
* |
125 | 147 |
* @ingroup themeable |
148 |
* |
|
149 |
* @return string |
|
126 | 150 |
*/ |
127 | 151 |
function theme_ldap_authentication_message_not_authenticated($variables) { |
152 |
/** @var string $message */ |
|
128 | 153 |
extract($variables); |
129 | 154 |
return $message; |
130 | 155 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules