Révision 59ae487e
Ajouté par Assos Assos il y a presque 7 ans
drupal7/sites/all/modules/entityreference/entityreference.info | ||
---|---|---|
29 | 29 |
files[] = tests/entityreference.feeds.test |
30 | 30 |
files[] = tests/entityreference.entity_translation.test |
31 | 31 |
|
32 |
; Information added by Drupal.org packaging script on 2017-05-10
|
|
33 |
version = "7.x-1.3"
|
|
32 |
; Information added by Drupal.org packaging script on 2017-05-23
|
|
33 |
version = "7.x-1.4"
|
|
34 | 34 |
core = "7.x" |
35 | 35 |
project = "entityreference" |
36 |
datestamp = "1494450489"
|
|
36 |
datestamp = "1495557187"
|
|
37 | 37 |
|
drupal7/sites/all/modules/entityreference/entityreference.install | ||
---|---|---|
165 | 165 |
} |
166 | 166 |
|
167 | 167 |
/** |
168 |
* Implements hook_update_N(). |
|
169 |
* |
|
168 | 170 |
* Remove duplicate rows in the taxonomy_index table. |
169 | 171 |
*/ |
170 | 172 |
function entityreference_update_7100() { |
171 | 173 |
if (db_table_exists('taxonomy_index')) { |
174 |
if (db_table_exists('taxonomy_index_tmp')) { |
|
175 |
db_drop_table('taxonomy_index_tmp'); |
|
176 |
} |
|
177 |
|
|
172 | 178 |
$tx_schema = drupal_get_schema('taxonomy_index'); |
173 | 179 |
db_create_table('taxonomy_index_tmp', $tx_schema); |
174 | 180 |
$select = db_select('taxonomy_index', 'tx'); |
175 |
$select->fields('tx'); |
|
181 |
$select->fields('tx', array('nid', 'tid'));
|
|
176 | 182 |
$select->groupBy('tx.nid'); |
177 | 183 |
$select->groupBy('tx.tid'); |
184 |
$select->addExpression('MAX(sticky)', 'sticky'); |
|
185 |
$select->addExpression('MAX(created)', 'created'); |
|
178 | 186 |
db_insert('taxonomy_index_tmp')->from($select)->execute(); |
179 | 187 |
db_drop_table('taxonomy_index'); |
180 | 188 |
db_rename_table('taxonomy_index_tmp', 'taxonomy_index'); |
drupal7/sites/all/modules/entityreference/examples/entityreference_behavior_example/entityreference_behavior_example.info | ||
---|---|---|
4 | 4 |
package = Fields |
5 | 5 |
dependencies[] = entityreference |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2017-05-10
|
|
8 |
version = "7.x-1.3"
|
|
7 |
; Information added by Drupal.org packaging script on 2017-05-23
|
|
8 |
version = "7.x-1.4"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "entityreference" |
11 |
datestamp = "1494450489"
|
|
11 |
datestamp = "1495557187"
|
|
12 | 12 |
|
drupal7/sites/all/modules/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.info | ||
---|---|---|
8 | 8 |
dependencies[] = feeds_ui |
9 | 9 |
dependencies[] = entityreference |
10 | 10 |
|
11 |
; Information added by Drupal.org packaging script on 2017-05-10
|
|
12 |
version = "7.x-1.3"
|
|
11 |
; Information added by Drupal.org packaging script on 2017-05-23
|
|
12 |
version = "7.x-1.4"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "entityreference" |
15 |
datestamp = "1494450489"
|
|
15 |
datestamp = "1495557187"
|
|
16 | 16 |
|
drupal7/sites/all/modules/file_entity/file_entity.field.inc | ||
---|---|---|
284 | 284 |
foreach ($items as $delta => $item) { |
285 | 285 |
// Protect ourselves from recursive rendering. |
286 | 286 |
static $recursive_render_depth = array(); |
287 |
$recursive_render_id = $entity_type . $field['field_name'] . $item['fid']; |
|
287 |
if (!empty($item)) { |
|
288 |
$recursive_render_id = $entity_type . $field['field_name'] . $item['fid']; |
|
289 |
if (isset($recursive_render_depth[$recursive_render_id])) { |
|
290 |
$recursive_render_depth[$recursive_render_id]++; |
|
291 |
} |
|
292 |
else { |
|
293 |
$recursive_render_depth[$recursive_render_id] = 1; |
|
294 |
} |
|
288 | 295 |
|
289 |
if (isset($recursive_render_depth[$recursive_render_id])) { |
|
290 |
$recursive_render_depth[$recursive_render_id]++; |
|
291 |
} |
|
292 |
else { |
|
293 |
$recursive_render_depth[$recursive_render_id] = 1; |
|
294 |
} |
|
296 |
if ($recursive_render_depth[$recursive_render_id] > 20) { |
|
297 |
watchdog( |
|
298 |
'file_entity', |
|
299 |
'Recursive rendering detected when rendering entity %entity_type: %entity_id, using the %field_name field. Aborting rendering.', |
|
300 |
array( |
|
301 |
'%entity_type' => 'file', |
|
302 |
'%entity_id' => $item['fid'], |
|
303 |
'%field_name' => $field['field_name'], |
|
304 |
), |
|
305 |
WATCHDOG_ERROR |
|
306 |
); |
|
307 |
return $element; |
|
308 |
} |
|
309 |
|
|
310 |
$file = file_load($item['fid']); |
|
311 |
|
|
312 |
// Add some references to the referencing entity. |
|
313 |
// @see https://www.drupal.org/node/2333107 |
|
314 |
$file->referencing_entity = $entity; |
|
315 |
$file->referencing_entity_type = $entity_type; |
|
316 |
$file->referencing_field = $field['field_name']; |
|
295 | 317 |
|
296 |
if ($recursive_render_depth[$recursive_render_id] > 20) { |
|
318 |
$element[$delta] = file_view($file, $settings['file_view_mode'], $langcode); |
|
319 |
} else { |
|
297 | 320 |
watchdog( |
298 | 321 |
'file_entity', |
299 |
'Recursive rendering detected when rendering entity %entity_type: %entity_id, using the %field_name field. Aborting rendering.',
|
|
322 |
'In the %referencing_entity_type, the %field_name field refers to a %entity_type which does not exist. Aborting the render for it.',
|
|
300 | 323 |
array( |
301 |
'%entity_type' => 'file', |
|
302 |
'%entity_id' => $item['fid'], |
|
324 |
'%referencing_entity_type' => $entity_type, |
|
303 | 325 |
'%field_name' => $field['field_name'], |
326 |
'%entity_type' => 'file', |
|
304 | 327 |
), |
305 | 328 |
WATCHDOG_ERROR |
306 | 329 |
); |
307 |
return $element; |
|
308 | 330 |
} |
309 |
|
|
310 |
$file = (object) $item; |
|
311 |
|
|
312 |
// Add some references to the referencing entity. |
|
313 |
// @see https://www.drupal.org/node/2333107 |
|
314 |
$file->referencing_entity = $entity; |
|
315 |
$file->referencing_entity_type = $entity_type; |
|
316 |
$file->referencing_field = $field['field_name']; |
|
317 |
|
|
318 |
$element[$delta] = file_view($file, $settings['file_view_mode'], $langcode); |
|
319 | 331 |
} |
320 | 332 |
break; |
321 | 333 |
|
322 | 334 |
case 'file_download_link': |
335 |
// Prevent 'empty' fields from causing a WSOD. |
|
336 |
$items = array_filter($items); |
|
323 | 337 |
foreach ($items as $delta => $item) { |
324 |
$file = (object) $item; |
|
325 |
if (file_entity_access('download', $file)) { |
|
338 |
if (!empty($item['fid']) && ($file = file_load($item['fid'])) && file_entity_access('download', $file)) { |
|
326 | 339 |
$element[$delta] = array( |
327 | 340 |
'#theme' => 'file_entity_download_link', |
328 | 341 |
'#file' => $file, |
... | ... | |
342 | 355 |
$source_lists = array(); |
343 | 356 |
if ($multiple_file_behavior == 'tags') { |
344 | 357 |
foreach ($items as $delta => $item) { |
345 |
if ($item['type'] == 'audio') {
|
|
358 |
if (file_entity_file_get_mimetype_type($item) == 'audio') {
|
|
346 | 359 |
$source_lists[$delta] = array($item); |
347 | 360 |
} |
348 | 361 |
} |
349 | 362 |
} |
350 | 363 |
else { |
351 | 364 |
foreach ($items as $delta => $item) { |
352 |
if ($item['type'] == 'audio') {
|
|
365 |
if (file_entity_file_get_mimetype_type($item) == 'audio') {
|
|
353 | 366 |
$source_lists[0][$delta] = $item; |
354 | 367 |
} |
355 | 368 |
} |
... | ... | |
378 | 391 |
$source_lists = array(); |
379 | 392 |
if ($multiple_file_behavior == 'tags') { |
380 | 393 |
foreach ($items as $delta => $item) { |
381 |
if ($item['type'] == 'video') {
|
|
394 |
if (file_entity_file_get_mimetype_type($item) == 'video') {
|
|
382 | 395 |
$source_lists[$delta] = array($item); |
383 | 396 |
} |
384 | 397 |
} |
385 | 398 |
} |
386 | 399 |
else { |
387 | 400 |
foreach ($items as $delta => $item) { |
388 |
if ($item['type'] == 'video') {
|
|
401 |
if (file_entity_file_get_mimetype_type($item) == 'video') {
|
|
389 | 402 |
$source_lists[0][$delta] = $item; |
390 | 403 |
} |
391 | 404 |
} |
drupal7/sites/all/modules/file_entity/file_entity.info | ||
---|---|---|
9 | 9 |
dependencies[] = system (>=7.33) |
10 | 10 |
|
11 | 11 |
test_dependencies[] = token |
12 |
test_dependencies[] = views |
|
12 | 13 |
|
13 | 14 |
files[] = views/views_handler_argument_file_type.inc |
14 | 15 |
files[] = views/views_handler_field_file_rendered.inc |
... | ... | |
24 | 25 |
files[] = views/views_plugin_row_file_rss.inc |
25 | 26 |
files[] = views/views_plugin_row_file_view.inc |
26 | 27 |
files[] = file_entity.test |
28 |
files[] = file_entity_views.test |
|
27 | 29 |
|
28 | 30 |
configure = admin/config/media/file-settings |
29 | 31 |
|
30 | 32 |
; We have to add a fake version so Git checkouts do not fail Media dependencies |
31 | 33 |
version = 7.x-2.x-dev |
32 | 34 |
|
33 |
; Information added by Drupal.org packaging script on 2016-05-31
|
|
34 |
version = "7.x-2.0-beta3"
|
|
35 |
; Information added by Drupal.org packaging script on 2017-05-22
|
|
36 |
version = "7.x-2.0" |
|
35 | 37 |
core = "7.x" |
36 | 38 |
project = "file_entity" |
37 |
datestamp = "1464653173"
|
|
39 |
datestamp = "1495456387"
|
|
38 | 40 |
|
drupal7/sites/all/modules/file_entity/file_entity.module | ||
---|---|---|
1794 | 1794 |
* access conditions are added for field values belonging to files only. |
1795 | 1795 |
*/ |
1796 | 1796 |
function file_entity_query_entity_field_access_alter(QueryAlterableInterface $query) { |
1797 |
//_file_entity_query_file_entity_access_alter($query, 'entity');
|
|
1797 |
_file_entity_query_file_entity_access_alter($query, 'entity'); |
|
1798 | 1798 |
} |
1799 | 1799 |
|
1800 | 1800 |
/** |
... | ... | |
1822 | 1822 |
|
1823 | 1823 |
$tables = $query->getTables(); |
1824 | 1824 |
$base_table = $query->getMetaData('base_table'); |
1825 |
// Do not use the base table for general entity queries unless this is |
|
1826 |
// querying the file_managed table directly. |
|
1827 |
if ($base_table && $type == 'entity' && $base_table != 'file_managed') { |
|
1828 |
$base_table = ''; |
|
1829 |
} |
|
1830 |
|
|
1825 | 1831 |
// If no base table is specified explicitly, search for one. |
1826 | 1832 |
if (!$base_table) { |
1827 | 1833 |
$fallback = ''; |
... | ... | |
1853 | 1859 |
$fallback = $table; |
1854 | 1860 |
} |
1855 | 1861 |
} |
1862 |
elseif (isset($schema['fields']['entity_id']) && isset($schema['fields']['entity_type']) && isset($schema['fields']['deleted']) && isset($schema['fields']['delta'])) { |
|
1863 |
// The table is a field data table, use it as fallback. |
|
1864 |
$base_table = $table; |
|
1865 |
} |
|
1856 | 1866 |
} |
1857 | 1867 |
} |
1858 | 1868 |
} |
... | ... | |
1863 | 1873 |
$base_table = $fallback; |
1864 | 1874 |
} |
1865 | 1875 |
else { |
1876 |
// Ignore this query as it was a general field query and no |
|
1877 |
// relationships were found to the file_managed table. |
|
1878 |
if ($type == 'entity') { |
|
1879 |
return; |
|
1880 |
} |
|
1866 | 1881 |
throw new Exception(t('Query tagged for file access but there is no fid. Add foreign keys to file_managed.fid in schema to fix.')); |
1867 | 1882 |
} |
1868 | 1883 |
} |
... | ... | |
1925 | 1940 |
} |
1926 | 1941 |
} |
1927 | 1942 |
|
1928 |
if ($subquery_conditions->count()) { |
|
1943 |
// If there is no subquery conditions, the query is likely for file usage. |
|
1944 |
// Or user can only access public files. |
|
1945 |
// If there are subquery conditions then add them to the subquery. |
|
1946 |
if ($subquery_conditions->count() >= 1) { |
|
1929 | 1947 |
$subquery->condition($subquery_conditions); |
1948 |
} |
|
1930 | 1949 |
|
1931 |
$field = 'fid';
|
|
1932 |
// Now handle entities.
|
|
1933 |
if ($type == 'entity') {
|
|
1934 |
// Set a common alias for entities.
|
|
1935 |
$base_alias = $falias;
|
|
1936 |
$field = 'entity_id';
|
|
1937 |
}
|
|
1938 |
$subquery->where("$falias.$field = fm_access.fid");
|
|
1950 |
$field = 'fid'; |
|
1951 |
// Now handle entities. |
|
1952 |
if ($type == 'entity') { |
|
1953 |
// Set a common alias for entities. |
|
1954 |
$base_alias = $falias; |
|
1955 |
$field = ($falias == 'file_managed' ? 'fid' : 'entity_id');
|
|
1956 |
} |
|
1957 |
$subquery->where("$falias.$field = fm_access.fid"); |
|
1939 | 1958 |
|
1940 |
// For an entity query, attach the subquery to entity conditions. |
|
1941 |
if ($type == 'entity') { |
|
1942 |
$file_conditions->exists($subquery); |
|
1943 |
} |
|
1944 |
// Otherwise attach it to the node query itself. |
|
1945 |
elseif ($table == 'file_managed') { |
|
1946 |
// Fix for https://drupal.org/node/2073085 |
|
1947 |
$db_or = db_or(); |
|
1948 |
$db_or->exists($subquery); |
|
1949 |
$db_or->isNull($falias . '.' . $field); |
|
1950 |
$query->condition($db_or); |
|
1951 |
} |
|
1952 |
else { |
|
1953 |
$query->exists($subquery); |
|
1954 |
} |
|
1959 |
// For an entity query, attach the subquery to entity conditions. |
|
1960 |
if ($type == 'entity') { |
|
1961 |
$file_conditions->exists($subquery); |
|
1962 |
} |
|
1963 |
// Otherwise attach it to the node query itself. |
|
1964 |
elseif ($table == 'file_managed') { |
|
1965 |
// Fix for https://drupal.org/node/2073085 |
|
1966 |
$db_or = db_or(); |
|
1967 |
$db_or->exists($subquery); |
|
1968 |
$db_or->isNull($falias . '.' . $field); |
|
1969 |
$query->condition($db_or); |
|
1970 |
} |
|
1971 |
else { |
|
1972 |
$query->exists($subquery); |
|
1955 | 1973 |
} |
1956 | 1974 |
} |
1957 | 1975 |
} |
... | ... | |
1959 | 1977 |
if ($type == 'entity' && $file_conditions->count()) { |
1960 | 1978 |
// All the file access conditions are only for field values belonging to |
1961 | 1979 |
// files. |
1962 |
$file_conditions->condition("$base_alias.entity_type", 'file'); |
|
1963 |
$or = db_or(); |
|
1964 |
$or->condition($file_conditions); |
|
1965 |
// If the field value belongs to a non-file entity type then this function |
|
1966 |
// does not do anything with it. |
|
1967 |
$or->condition("$base_alias.entity_type", 'file', '<>'); |
|
1968 |
// Add the compiled set of rules to the query. |
|
1969 |
$query->condition($or); |
|
1980 |
if ($base_alias !== 'file_managed') { |
|
1981 |
$file_conditions->condition("$base_alias.entity_type", 'file'); |
|
1982 |
$or = db_or(); |
|
1983 |
$or->condition($file_conditions); |
|
1984 |
// If the field value belongs to a non-file entity type then this function |
|
1985 |
// does not do anything with it. |
|
1986 |
$or->condition("$base_alias.entity_type", 'file', '<>'); |
|
1987 |
// Add the compiled set of rules to the query. |
|
1988 |
$query->condition($or); |
|
1989 |
} |
|
1990 |
else { |
|
1991 |
$query->condition($file_conditions); |
|
1992 |
} |
|
1970 | 1993 |
} |
1971 | 1994 |
} |
1972 | 1995 |
|
... | ... | |
2479 | 2502 |
} |
2480 | 2503 |
|
2481 | 2504 |
function file_entity_file_get_mimetype_type($file) { |
2505 |
if (is_array($file)) { |
|
2506 |
$file = (object) $file; |
|
2507 |
} |
|
2482 | 2508 |
list($type, $subtype) = explode('/', $file->filemime, 2); |
2483 | 2509 |
return $type; |
2484 | 2510 |
} |
... | ... | |
2600 | 2626 |
$pipe['variable'][] = "pathauto_file_{$file_type}_pattern"; |
2601 | 2627 |
} |
2602 | 2628 |
} |
2629 |
|
drupal7/sites/all/modules/file_entity/file_entity.pages.inc | ||
---|---|---|
35 | 35 |
if (!is_file($file->uri)) { |
36 | 36 |
return MENU_NOT_FOUND; |
37 | 37 |
} |
38 |
|
|
38 |
// @todo Remove this once drupal_basename is fixed for PHP versions greater |
|
39 |
// than '5.3.29'. |
|
40 |
$basename_function = version_compare(PHP_VERSION,'5.3.29','>') ? 'basename' : 'drupal_basename'; |
|
39 | 41 |
$headers = array( |
40 | 42 |
'Content-Type' => mime_header_encode($file->filemime), |
41 |
'Content-Disposition' => 'attachment; filename="' . mime_header_encode(drupal_basename($file->uri)) . '"',
|
|
43 |
'Content-Disposition' => 'attachment; filename="' . mime_header_encode($basename_function($file->uri)) . '"',
|
|
42 | 44 |
'Content-Length' => $file->filesize, |
43 | 45 |
'Content-Transfer-Encoding' => 'binary', |
44 | 46 |
'Pragma' => 'no-cache', |
... | ... | |
77 | 79 |
* - Edit fields |
78 | 80 |
* Skip this step if there are no fields on this entity type. |
79 | 81 |
*/ |
80 |
function file_entity_add_upload($form, &$form_state, array $options = array()) { |
|
82 |
function file_entity_add_upload($form, &$form_state, $options = array()) { |
|
83 |
if (!is_array($options)) { |
|
84 |
$options = array($options); |
|
85 |
} |
|
81 | 86 |
$step = (isset($form_state['step']) && in_array($form_state['step'], array(1, 2, 3, 4))) ? $form_state['step'] : 1; |
82 | 87 |
$form['#step'] = $step; |
83 | 88 |
$form['#options'] = $options; |
... | ... | |
398 | 403 |
// We have the filetype, check if we can skip step 4. |
399 | 404 |
if (($form['#step'] == 3 && $trigger == 'edit-next')) { |
400 | 405 |
$file = file_load($form_state['storage']['upload']); |
406 |
$form_state['file'] = $file; |
|
401 | 407 |
if (!field_info_instances('file', $form_state['storage']['type'])) { |
402 | 408 |
// This filetype doesn't have fields, save the file. |
403 | 409 |
$save = TRUE; |
... | ... | |
800 | 806 |
if (!empty($form_state['values']['replace_upload'])) { |
801 | 807 |
$replacement = $form_state['values']['replace_upload']; |
802 | 808 |
// Move file from temp to permanent home. |
803 |
$destination_uri = rtrim($file->uri, drupal_basename($file->uri)) . drupal_basename($replacement->uri); |
|
804 |
$replace_mode = $destination_uri == $file->uri ? FILE_EXISTS_REPLACE : FILE_EXISTS_RENAME; |
|
805 |
if ($new_file_uri = file_unmanaged_copy($replacement->uri, $destination_uri, $replace_mode)) { |
|
806 |
// @todo Add watchdog() about replaced file here? |
|
807 |
|
|
808 |
// Remove temporary file. |
|
809 |
file_delete($replacement); |
|
810 |
|
|
811 |
// Update if the uri target has changed. |
|
812 |
if ($new_file_uri != $file->uri) { |
|
813 |
// Store the original file uri to delete if save is successful. |
|
814 |
$orphaned_uri = $file->uri; |
|
815 |
|
|
816 |
// Update file entity uri. |
|
817 |
$file->uri = $new_file_uri; |
|
809 |
if (pathinfo($replacement->uri, PATHINFO_EXTENSION) == pathinfo($file->uri, PATHINFO_EXTENSION)) { |
|
810 |
file_unmanaged_copy($replacement->uri, $file->uri, FILE_EXISTS_REPLACE); |
|
811 |
} else { |
|
812 |
$destination_uri = rtrim($file->uri, drupal_basename($file->uri)) . drupal_basename($replacement->uri); |
|
813 |
$replace_mode = $destination_uri == $file->uri ? FILE_EXISTS_REPLACE : FILE_EXISTS_RENAME; |
|
814 |
if ($new_file_uri = file_unmanaged_copy($replacement->uri, $destination_uri, $replace_mode)) { |
|
815 |
// @todo Add watchdog() about replaced file here? |
|
816 |
|
|
817 |
// Remove temporary file. |
|
818 |
file_delete($replacement); |
|
819 |
|
|
820 |
// Update if the uri target has changed. |
|
821 |
if ($new_file_uri != $file->uri) { |
|
822 |
// Store the original file uri to delete if save is successful. |
|
823 |
$orphaned_uri = $file->uri; |
|
824 |
|
|
825 |
// Update file entity uri. |
|
826 |
$file->uri = $new_file_uri; |
|
827 |
} |
|
818 | 828 |
} |
819 | 829 |
} |
820 | 830 |
} |
drupal7/sites/all/modules/file_entity/file_entity.pathauto.inc | ||
---|---|---|
27 | 27 |
$settings['token_type'] = 'file'; |
28 | 28 |
$settings['groupheader'] = t('File paths'); |
29 | 29 |
$settings['patterndescr'] = t('Default path pattern (applies to all file types with blank patterns below)'); |
30 |
$settings['patterndefault'] = 'files/[file:name]';
|
|
30 |
$settings['patterndefault'] = ''; |
|
31 | 31 |
$settings['batch_update_callback'] = 'file_entity_pathauto_bulk_update_batch_process'; |
32 | 32 |
$settings['batch_file'] = drupal_get_path('module', 'file_entity') . '/file_entity.pathauto.inc'; |
33 | 33 |
|
drupal7/sites/all/modules/file_entity/file_entity.test | ||
---|---|---|
1205 | 1205 |
$this->drupalGet('admin/structure/file-types'); |
1206 | 1206 |
$this->assertResponse(403, 'File types UI page is not accessible to unauthorized users.'); |
1207 | 1207 |
|
1208 |
$user = $this->drupalCreateUser(array('administer file types')); |
|
1208 |
$user = $this->drupalCreateUser(array('administer file types', 'administer fields'));
|
|
1209 | 1209 |
$this->drupalLogin($user); |
1210 | 1210 |
|
1211 | 1211 |
$this->drupalGet('admin/structure/file-types'); |
... | ... | |
1671 | 1671 |
$this->assertEqual($build['#file']->$attribute, $expected_value, format_string('The %attribute was overridden correctly.', array('%attribute' => $attribute))); |
1672 | 1672 |
} |
1673 | 1673 |
} |
1674 |
|
|
1675 |
/** |
|
1676 |
* @param EntityFieldQuery $query |
|
1677 |
* @param $expected |
|
1678 |
* An associative array of expected result. Keys are file ids, values are |
|
1679 |
* booleans to indicate if the result should include the file. |
|
1680 |
*/ |
|
1681 |
function assertEntityFieldQueryAccess(EntityFieldQuery $query, $expected, $account = NULL, $query_name = 'unnamed') { |
|
1682 |
if ($account) { |
|
1683 |
$query->addMetaData('account', $account); |
|
1684 |
} |
|
1685 |
$query->addTag('entity_field_access'); |
|
1686 |
$results = $query->execute(); |
|
1687 |
$fids = isset($results['file']) ? array_keys($results['file']) : array(); |
|
1688 |
foreach ($expected as $fid => $in_result) { |
|
1689 |
if ($in_result) { |
|
1690 |
$this->assertTrue(in_array($fid, $fids), format_string("For the %name query, the result should contain %fid", array('%name' => $query_name, '%fid' => $fid))); |
|
1691 |
} |
|
1692 |
else { |
|
1693 |
$this->assertFalse(in_array($fid, $fids), format_string("For the %name query, the result should not contain %fid", array('%name' => $query_name, '%fid' => $fid))); |
|
1694 |
} |
|
1695 |
} |
|
1696 |
} |
|
1697 |
|
|
1698 |
/** |
|
1699 |
* Test file entity access for entity field queries. |
|
1700 |
*/ |
|
1701 |
function testEntityFieldQueryAccess() { |
|
1702 |
// Attach a text field to the default image file type. |
|
1703 |
$field = array( |
|
1704 |
'field_name' => drupal_strtolower($this->randomName()), |
|
1705 |
'type' => 'text', |
|
1706 |
'settings' => array( |
|
1707 |
'max_length' => 255, |
|
1708 |
) |
|
1709 |
); |
|
1710 |
field_create_field($field); |
|
1711 |
$instance = array( |
|
1712 |
'field_name' => $field['field_name'], |
|
1713 |
'entity_type' => 'file', |
|
1714 |
'bundle' => 'document', |
|
1715 |
'widget' => array( |
|
1716 |
'type' => 'text_textfield', |
|
1717 |
), |
|
1718 |
'display' => array( |
|
1719 |
'default' => array( |
|
1720 |
'type' => 'text_default', |
|
1721 |
), |
|
1722 |
), |
|
1723 |
); |
|
1724 |
field_create_instance($instance); |
|
1725 |
// Create test files. |
|
1726 |
$file_owner = $this->drupalCreateUser(array('view own files', 'view own private files')); |
|
1727 |
$public_file = $this->createFileEntity(array( |
|
1728 |
'status' => 0, |
|
1729 |
)); |
|
1730 |
$private_file = $this->createFileEntity(array('scheme' => 'private')); |
|
1731 |
$owned_public_file = $this->createFileEntity(array( |
|
1732 |
'uid' => $file_owner->uid, |
|
1733 |
'scheme' => 'public', |
|
1734 |
)); |
|
1735 |
$owned_private_file = $this->createFileEntity(array( |
|
1736 |
'uid' => $file_owner->uid, |
|
1737 |
'scheme' => 'private', |
|
1738 |
)); |
|
1739 |
$fids = array( |
|
1740 |
$public_file->fid, |
|
1741 |
$private_file->fid, |
|
1742 |
$owned_public_file->fid, |
|
1743 |
$owned_private_file->fid, |
|
1744 |
); |
|
1745 |
foreach (file_load_multiple($fids) as $file) { |
|
1746 |
$file->{$field['field_name']}[LANGUAGE_NONE][0] = array('value' => 'find me'); |
|
1747 |
file_save($file); |
|
1748 |
} |
|
1749 |
|
|
1750 |
$efq_fids = new EntityFieldQuery(); |
|
1751 |
$queries['entity type and id conditions'] = $efq_fids |
|
1752 |
->entityCondition('entity_type', 'file') |
|
1753 |
->entityCondition('entity_id', $fids); |
|
1754 |
$efq_field_name = new EntityFieldQuery(); |
|
1755 |
$queries['single field condition'] = $efq_field_name |
|
1756 |
->fieldCondition($field['field_name'], 'value', 'find me'); |
|
1757 |
|
|
1758 |
foreach($queries as $name => $query) { |
|
1759 |
$message = format_string(''); |
|
1760 |
// User should not see private files, only his own public files. |
|
1761 |
$this->assertEntityFieldQueryAccess(clone $query, array( |
|
1762 |
$public_file->fid => TRUE, |
|
1763 |
$private_file->fid => FALSE, |
|
1764 |
$owned_public_file->fid => TRUE, |
|
1765 |
$owned_private_file->fid => FALSE, |
|
1766 |
), $this->drupalCreateUser(array('create files')), $name); |
|
1767 |
|
|
1768 |
// A user with the 'view own files' and 'view own private files' permissions should only see owned files and public files. |
|
1769 |
$this->drupalLogin($file_owner); |
|
1770 |
$this->assertEntityFieldQueryAccess(clone $query, array( |
|
1771 |
$public_file->fid => TRUE, |
|
1772 |
$private_file->fid => FALSE, |
|
1773 |
$owned_public_file->fid => TRUE, |
|
1774 |
$owned_private_file->fid => TRUE, |
|
1775 |
), $file_owner, $name); |
|
1776 |
|
|
1777 |
// User with the 'view files' permission should only see public files but cannot create files. |
|
1778 |
$this->assertEntityFieldQueryAccess(clone $query, array( |
|
1779 |
$public_file->fid => TRUE, |
|
1780 |
$private_file->fid => FALSE, |
|
1781 |
$owned_public_file->fid => TRUE, |
|
1782 |
$owned_private_file->fid => FALSE, |
|
1783 |
), $this->drupalCreateUser(array('view files')), $name); |
|
1784 |
|
|
1785 |
// User with the 'view files' and 'view private files' permissions should only see all files. |
|
1786 |
$this->assertEntityFieldQueryAccess(clone $query, array( |
|
1787 |
$public_file->fid => TRUE, |
|
1788 |
$private_file->fid => TRUE, |
|
1789 |
$owned_public_file->fid => TRUE, |
|
1790 |
$owned_private_file->fid => TRUE, |
|
1791 |
), $this->drupalCreateUser(array('view files', 'view private files')), $name); |
|
1792 |
|
|
1793 |
// User with the 'bypass file access' permissions should only see all files. |
|
1794 |
$this->assertEntityFieldQueryAccess(clone $query, array( |
|
1795 |
$public_file->fid => TRUE, |
|
1796 |
$private_file->fid => TRUE, |
|
1797 |
$owned_public_file->fid => TRUE, |
|
1798 |
$owned_private_file->fid => TRUE, |
|
1799 |
), $this->drupalCreateUser(array('bypass file access')), $name); |
|
1800 |
} |
|
1801 |
} |
|
1674 | 1802 |
} |
drupal7/sites/all/modules/file_entity/file_entity.theme.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
function theme_file_entity_file_link($variables) { |
14 | 14 |
$file = $variables['file']; |
15 |
$icon_directory = $variables['icon_directory']; |
|
15 |
$uri = entity_uri('file', $file); |
|
16 |
|
|
17 |
// Human-readable names, for use as text-alternatives to icons. |
|
18 |
$mime_name = array( |
|
19 |
'application/msword' => t('Microsoft Office document icon'), |
|
20 |
'application/vnd.ms-excel' => t('Office spreadsheet icon'), |
|
21 |
'application/vnd.ms-powerpoint' => t('Office presentation icon'), |
|
22 |
'application/pdf' => t('PDF icon'), |
|
23 |
'video/quicktime' => t('Movie icon'), |
|
24 |
'audio/mpeg' => t('Audio icon'), |
|
25 |
'audio/wav' => t('Audio icon'), |
|
26 |
'image/jpeg' => t('Image icon'), |
|
27 |
'image/png' => t('Image icon'), |
|
28 |
'image/gif' => t('Image icon'), |
|
29 |
'application/zip' => t('Package icon'), |
|
30 |
'text/html' => t('HTML icon'), |
|
31 |
'text/plain' => t('Plain text icon'), |
|
32 |
'application/octet-stream' => t('Binary Data'), |
|
33 |
); |
|
34 |
|
|
35 |
$mimetype = file_get_mimetype($file->uri); |
|
16 | 36 |
|
17 |
$url = 'file/' . $file->fid; |
|
18 |
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory)); |
|
37 |
$icon = theme('file_icon', array( |
|
38 |
'file' => $file, |
|
39 |
'icon_directory' => $variables['icon_directory'], |
|
40 |
'alt' => !empty($mime_name[$mimetype]) ? $mime_name[$mimetype] : t('File'), |
|
41 |
)); |
|
19 | 42 |
|
20 | 43 |
// Set options as per anchor format described at |
21 | 44 |
// http://microformats.org/wiki/file-format-examples |
22 |
$options = array( |
|
23 |
'attributes' => array( |
|
24 |
'type' => $file->filemime . '; length=' . $file->filesize, |
|
25 |
), |
|
26 |
); |
|
45 |
$uri['options']['attributes']['type'] = $file->filemime . '; length=' . $file->filesize; |
|
27 | 46 |
|
28 | 47 |
// Use the description as the link text if available. |
29 | 48 |
if (empty($file->description)) { |
... | ... | |
44 | 63 |
*/ |
45 | 64 |
function theme_file_entity_download_link($variables) { |
46 | 65 |
$file = $variables['file']; |
47 |
$icon_directory = $variables['icon_directory']; |
|
48 |
|
|
49 | 66 |
$uri = file_entity_download_uri($file); |
50 |
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory)); |
|
67 |
|
|
68 |
// Human-readable names, for use as text-alternatives to icons. |
|
69 |
$mime_name = array( |
|
70 |
'application/msword' => t('Microsoft Office document icon'), |
|
71 |
'application/vnd.ms-excel' => t('Office spreadsheet icon'), |
|
72 |
'application/vnd.ms-powerpoint' => t('Office presentation icon'), |
|
73 |
'application/pdf' => t('PDF icon'), |
|
74 |
'video/quicktime' => t('Movie icon'), |
|
75 |
'audio/mpeg' => t('Audio icon'), |
|
76 |
'audio/wav' => t('Audio icon'), |
|
77 |
'image/jpeg' => t('Image icon'), |
|
78 |
'image/png' => t('Image icon'), |
|
79 |
'image/gif' => t('Image icon'), |
|
80 |
'application/zip' => t('Package icon'), |
|
81 |
'text/html' => t('HTML icon'), |
|
82 |
'text/plain' => t('Plain text icon'), |
|
83 |
'application/octet-stream' => t('Binary Data'), |
|
84 |
); |
|
85 |
|
|
86 |
$mimetype = file_get_mimetype($file->uri); |
|
87 |
|
|
88 |
$icon = theme('file_icon', array( |
|
89 |
'file' => $file, |
|
90 |
'icon_directory' => $variables['icon_directory'], |
|
91 |
'alt' => !empty($mime_name[$mimetype]) ? $mime_name[$mimetype] : t('File'), |
|
92 |
)); |
|
51 | 93 |
|
52 | 94 |
// Set options as per anchor format described at |
53 | 95 |
// http://microformats.org/wiki/file-format-examples |
drupal7/sites/all/modules/file_entity/file_entity_views.test | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Definition of FileEntityViewsFieldLinkUsageHandlerTest. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* Tests for file_entity views file usage handlers. |
|
10 |
*/ |
|
11 |
class FileEntityViewsFieldLinkUsageHandlerTest extends FileEntityTestHelper { |
|
12 |
|
|
13 |
/** |
|
14 |
* {@inheritdoc} |
|
15 |
*/ |
|
16 |
public function setUp() { |
|
17 |
parent::setUp('views'); |
|
18 |
} |
|
19 |
|
|
20 |
/** |
|
21 |
* {@inheritdoc} |
|
22 |
*/ |
|
23 |
public static function getInfo() { |
|
24 |
return array( |
|
25 |
'name' => 'File entity views integration: file link usage', |
|
26 |
'description' => 'Test file usage Views field.', |
|
27 |
'group' => 'File entity', |
|
28 |
); |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* Test views file usage handlers. |
|
33 |
*/ |
|
34 |
public function testViewsUsageField() { |
|
35 |
$file = $this->createFileEntity(); |
|
36 |
file_usage_add($file, 'foo', 'bar', 1,1); |
|
37 |
file_usage_add($file, 'foo', 'bar', 1,2); |
|
38 |
$file2 = $this->createFileEntity(); |
|
39 |
file_usage_add($file2, 'foo', 'bar', 1, 99); |
|
40 |
|
|
41 |
$view = $this->getTestView(); |
|
42 |
$view->set_display(); |
|
43 |
$view->pre_execute(); |
|
44 |
$view->execute(); |
|
45 |
|
|
46 |
$row = $view->result[0]; |
|
47 |
$render = $view->field['usage']->render_link($row, $row); |
|
48 |
$this->assertEqual($render, '1 place'); |
|
49 |
|
|
50 |
$row = $view->result[1]; |
|
51 |
$render = $view->field['usage']->render_link($row, $row); |
|
52 |
$this->assertEqual($render, '1 place'); |
|
53 |
|
|
54 |
$view->field['usage']->options['count_entities_once'] = 0; |
|
55 |
|
|
56 |
$row = $view->result[0]; |
|
57 |
$render = $view->field['usage']->render_link($row, $row); |
|
58 |
$this->assertEqual($render, '3 places'); |
|
59 |
|
|
60 |
$row = $view->result[1]; |
|
61 |
$render = $view->field['usage']->render_link($row, $row); |
|
62 |
$this->assertEqual($render, '99 places'); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Creates a test view containing a file usage field. |
|
67 |
*/ |
|
68 |
protected function getTestView() { |
|
69 |
$view = new view(); |
|
70 |
$view->name = 'file_list'; |
|
71 |
$view->description = ''; |
|
72 |
$view->tag = 'default'; |
|
73 |
$view->base_table = 'file_managed'; |
|
74 |
$view->human_name = 'File List'; |
|
75 |
$view->core = 7; |
|
76 |
$view->api_version = '3.0'; |
|
77 |
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
|
78 |
|
|
79 |
/* Display: Master */ |
|
80 |
$handler = $view->new_display('default', 'Master', 'default'); |
|
81 |
$handler->display->display_options['title'] = 'File List'; |
|
82 |
$handler->display->display_options['use_more_always'] = FALSE; |
|
83 |
$handler->display->display_options['access']['type'] = 'perm'; |
|
84 |
$handler->display->display_options['cache']['type'] = 'none'; |
|
85 |
$handler->display->display_options['query']['type'] = 'views_query'; |
|
86 |
$handler->display->display_options['exposed_form']['type'] = 'basic'; |
|
87 |
$handler->display->display_options['pager']['type'] = 'none'; |
|
88 |
$handler->display->display_options['style_plugin'] = 'default'; |
|
89 |
$handler->display->display_options['row_plugin'] = 'fields'; |
|
90 |
/* Field: File: Name */ |
|
91 |
$handler->display->display_options['fields']['filename']['id'] = 'filename'; |
|
92 |
$handler->display->display_options['fields']['filename']['table'] = 'file_managed'; |
|
93 |
$handler->display->display_options['fields']['filename']['field'] = 'filename'; |
|
94 |
$handler->display->display_options['fields']['filename']['label'] = ''; |
|
95 |
$handler->display->display_options['fields']['filename']['alter']['word_boundary'] = FALSE; |
|
96 |
$handler->display->display_options['fields']['filename']['alter']['ellipsis'] = FALSE; |
|
97 |
/* Field: File: Usage link */ |
|
98 |
$handler->display->display_options['fields']['usage']['id'] = 'usage'; |
|
99 |
$handler->display->display_options['fields']['usage']['table'] = 'file_managed'; |
|
100 |
$handler->display->display_options['fields']['usage']['field'] = 'usage'; |
|
101 |
$handler->display->display_options['fields']['usage']['count_entities_once'] = 1; |
|
102 |
/* Field: File Usage: Use count */ |
|
103 |
$handler->display->display_options['fields']['count']['id'] = 'count'; |
|
104 |
$handler->display->display_options['fields']['count']['table'] = 'file_usage'; |
|
105 |
$handler->display->display_options['fields']['count']['field'] = 'count'; |
|
106 |
|
|
107 |
/* Display: Page */ |
|
108 |
$handler = $view->new_display('page', 'Page', 'page'); |
|
109 |
$handler->display->display_options['path'] = 'file-list'; |
|
110 |
|
|
111 |
return $view; |
|
112 |
} |
|
113 |
|
|
114 |
} |
drupal7/sites/all/modules/file_entity/plugins/tasks/file_view.inc | ||
---|---|---|
105 | 105 |
} |
106 | 106 |
|
107 | 107 |
// Otherwise, fall back. |
108 |
module_load_include('inc', 'file_entity', 'file_entity.pages'); |
|
108 | 109 |
return $function($file); |
109 | 110 |
} |
110 | 111 |
|
drupal7/sites/all/modules/file_entity/tests/file_entity_test.info | ||
---|---|---|
5 | 5 |
dependencies[] = file_entity |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2016-05-31
|
|
9 |
version = "7.x-2.0-beta3"
|
|
8 |
; Information added by Drupal.org packaging script on 2017-05-22
|
|
9 |
version = "7.x-2.0" |
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "file_entity" |
12 |
datestamp = "1464653173"
|
|
12 |
datestamp = "1495456387"
|
|
13 | 13 |
|
drupal7/sites/all/modules/file_entity/views/views_handler_field_file_link_usage.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
class views_handler_field_file_link_usage extends views_handler_field_file_link { |
14 | 14 |
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
function option_definition() { |
|
19 |
$options = parent::option_definition(); |
|
20 |
$options['count_entities_once'] = array('default' => TRUE); |
|
21 |
return $options; |
|
22 |
} |
|
23 |
|
|
24 |
/** |
|
25 |
* {@inheritdoc} |
|
26 |
*/ |
|
27 |
function options_form(&$form, &$form_state) { |
|
28 |
$form['count_entities_once'] = array( |
|
29 |
'#type' => 'checkbox', |
|
30 |
'#title' => t('Count each unique entity once'), |
|
31 |
'#description' => t('Files can be used multiple times for an entity, especially when an entity is revisionable.'), |
|
32 |
'#default_value' => !empty($this->options['count_entities_once']), |
|
33 |
); |
|
34 |
parent::options_form($form, $form_state); |
|
35 |
} |
|
36 |
|
|
15 | 37 |
/** |
16 | 38 |
* Renders the link. |
17 | 39 |
*/ |
... | ... | |
27 | 49 |
|
28 | 50 |
// Get total count for each file. |
29 | 51 |
$total_count = 0; |
30 |
foreach (file_usage_list($file) as $module => $usage) { |
|
52 |
$file_usage = file_usage_list($file); |
|
53 |
$count_entities_once = !empty($this->options['count_entities_once']); |
|
54 |
foreach ($file_usage as $module => $usage) { |
|
31 | 55 |
foreach ($usage as $entity_type => $entity_ids) { |
32 |
foreach ($entity_ids as $id => $count) { |
|
33 |
$total_count += $count; |
|
56 |
if ($count_entities_once) { |
|
57 |
// Just count each unique entity once. |
|
58 |
$total_count += count($entity_ids); |
|
59 |
} |
|
60 |
else { |
|
61 |
// Count multiple usages for each entity. |
|
62 |
foreach ($entity_ids as $id => $count) { |
|
63 |
$total_count += $count; |
|
64 |
} |
|
34 | 65 |
} |
35 | 66 |
} |
36 | 67 |
} |
drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.api.php | ||
---|---|---|
20 | 20 |
* |
21 | 21 |
* @return boolean &$hook_result passed by reference |
22 | 22 |
*/ |
23 |
|
|
24 | 23 |
function hook_ldap_authentication_allowuser_results_alter($ldap_user, $name, &$hook_result) { |
25 | 24 |
|
26 | 25 |
if ($hook_result === FALSE) { // other module has denied user, should not override |
... | ... | |
34 | 33 |
|
35 | 34 |
} |
36 | 35 |
|
37 |
|
|
36 |
/** |
|
37 |
* Allow a custom module to alter $ldap_user before validating user login. |
|
38 |
* |
|
39 |
* @param array $ldap_user |
|
40 |
* See README.developers.txt for structure |
|
41 |
*/ |
|
42 |
function hook_ldap_entry_alter(&$ldap_user) { |
|
43 |
$ldap_user['mail'] = 'newmail@example.com'; |
|
44 |
} |
drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc | ||
---|---|---|
237 | 237 |
* IV. test credentials and if available get corresponding ldap user and ldap server |
238 | 238 |
*/ |
239 | 239 |
list($authentication_result, $ldap_user, $ldap_server_authenticated_on) = ldap_authentication_test_credentials($auth_conf, $sso_login, $authname, $form_state['values']['pass'], $watchdog_tokens); |
240 |
drupal_alter('ldap_entry', $ldap_user); |
|
240 | 241 |
if ($authentication_result != LDAP_AUTHENTICATION_RESULT_SUCCESS) { |
241 | 242 |
ldap_authentication_fail_response($authentication_result, $auth_conf, $detailed_watchdog_log, $watchdog_tokens); |
242 | 243 |
return; |
drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info | ||
---|---|---|
14 | 14 |
files[] = ldap_authentication.admin.inc |
15 | 15 |
files[] = tests/ldap_authentication.test |
16 | 16 |
|
17 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
18 |
version = "7.x-2.0"
|
|
17 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
18 |
version = "7.x-2.1"
|
|
19 | 19 |
core = "7.x" |
20 | 20 |
project = "ldap" |
21 |
datestamp = "1489858388"
|
|
21 |
datestamp = "1495392789"
|
|
22 | 22 |
|
drupal7/sites/all/modules/ldap/ldap_authentication/tests/ldap_authentication.test | ||
---|---|---|
416 | 416 |
'drupal_role_authentication_test' |
417 | 417 |
); |
418 | 418 |
|
419 |
//debug($this->testFunctions); |
|
420 | 419 |
$ldap_servers = ldap_servers_get_servers($sid, 'enabled'); |
421 | 420 |
$this->assertTrue(count($ldap_servers) == 1, ' ldap_authentication test server setup successful', $testid); |
422 | 421 |
|
... | ... | |
807 | 806 |
$value = $conf['values'][$i]; |
808 | 807 |
$property = isset($conf['property']) ? $conf['property'] : $field_name; |
809 | 808 |
$edit[$field_name] = $value; |
810 |
// debug("$field_name $value"); debug($conf);debug($edit); |
|
811 | 809 |
} |
812 |
// debug($edit); |
|
813 | 810 |
$this->drupalPost('admin/config/people/ldap/authentication', $edit, t('Save')); |
814 | 811 |
$ldap_authentication_conf_post = ldap_authentication_get_valid_conf(TRUE); |
815 | 812 |
|
drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerAbstract.class.php | ||
---|---|---|
341 | 341 |
$log .= "revoking existing consumer object, "; |
342 | 342 |
if ($user_has_authorization) { |
343 | 343 |
// revoke case 1: user has authorization, revoke it. revokeSingleAuthorization will remove $user_auth_data[$consumer_id] |
344 |
//debug("op=revoke, consumer_id=$consumer_id, calling revokeSingleAuthorization"); |
|
345 | 344 |
$results[$consumer_id] = $this->revokeSingleAuthorization($user, $consumer_id, $consumer, $user_auth_data, $user_save); // defer to default for $user_save param |
346 | 345 |
$log .= t(',result=') . (boolean)($results[$consumer_id]); |
347 | 346 |
} |
... | ... | |
364 | 363 |
} |
365 | 364 |
$watchdog_tokens['%consumer_ids_log'] = (count($consumer_ids_log)) ? join('<hr/>', $consumer_ids_log) : t('no actions'); |
366 | 365 |
|
367 |
// debug("user->data and user_auth_data"); debug($user->data); debug($user_auth_data); |
|
368 | 366 |
if ($user_save) { |
369 | 367 |
$user = user_load($user->uid, TRUE); |
370 | 368 |
$user_edit = $user->data; |
drupal7/sites/all/modules/ldap/ldap_authorization/LdapAuthorizationConsumerConfAdmin.class.php | ||
---|---|---|
45 | 45 |
$values->export_type = NULL; |
46 | 46 |
$result = ctools_export_crud_save('ldap_authorization', $values); |
47 | 47 |
} catch (Exception $e) { |
48 |
// debug($e); Integrity constraint violation: 1062 Duplicate entry |
|
49 | 48 |
$values->export_type = EXPORT_IN_DATABASE; |
50 | 49 |
$result = ctools_export_crud_save('ldap_authorization', $values); |
51 | 50 |
} |
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.inc | ||
---|---|---|
483 | 483 |
|
484 | 484 |
// traditional groups (dns) |
485 | 485 |
$group_dns = $consumer_conf->server->groupMembershipsFromUser($user, 'group_dns'); |
486 |
// debug("groupMembershipsFromUser, group_dns"); debug($group_dns); |
|
487 | 486 |
if (!$group_dns) { |
488 | 487 |
$group_dns = array(); |
489 | 488 |
} |
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info | ||
---|---|---|
17 | 17 |
files[] = tests/Og2Tests.test |
18 | 18 |
configure = admin/config/people/ldap/authorization |
19 | 19 |
|
20 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
21 |
version = "7.x-2.0"
|
|
20 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
21 |
version = "7.x-2.1"
|
|
22 | 22 |
core = "7.x" |
23 | 23 |
project = "ldap" |
24 |
datestamp = "1489858388"
|
|
24 |
datestamp = "1495392789"
|
|
25 | 25 |
|
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info | ||
---|---|---|
9 | 9 |
files[] = ldap_authorization_drupal_role.module |
10 | 10 |
files[] = ldap_authorization_drupal_role.inc |
11 | 11 |
|
12 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
13 |
version = "7.x-2.0"
|
|
12 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
13 |
version = "7.x-2.1"
|
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "ldap" |
16 |
datestamp = "1489858388"
|
|
16 |
datestamp = "1495392789"
|
|
17 | 17 |
|
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/LdapAuthorizationConsumerOG.class.php | ||
---|---|---|
429 | 429 |
unset($diff[$i]); |
430 | 430 |
} |
431 | 431 |
} |
432 |
// dpm("diff"); dpm($diff); dpm("existing"); dpm($existing); dpm("desired"); dpm($desired); dpm("final diff"); dpm($diff); |
|
433 | 432 |
return $diff; |
434 | 433 |
} |
435 | 434 |
|
436 | 435 |
protected function grantsAndRevokes($op, &$user, &$user_auth_data, $consumers, &$ldap_entry = NULL, $user_save = TRUE) { |
437 |
// debug("grantsAndRevokes, op=$op, user_save=$user_save"); debug($user_auth_data); debug($consumers); |
|
438 | 436 |
|
439 | 437 |
if (!is_array($user_auth_data)) { |
440 | 438 |
$user_auth_data = array(); |
... | ... | |
468 | 466 |
$consumer_ids_log = ""; |
469 | 467 |
$log = ""; |
470 | 468 |
|
471 |
//dpm('consumers');dpm($consumers); dpm('users_authorization_consumer_ids'); dpm($users_authorization_consumer_ids); |
|
472 | 469 |
foreach ($consumers as $consumer_id => $consumer) { |
473 | 470 |
if ($detailed_watchdog_log) { |
474 | 471 |
watchdog('ldap_authorization', "consumer_id=$consumer_id, user_save=$user_save, op=$op", $watchdog_tokens, WATCHDOG_DEBUG); |
... | ... | |
573 | 570 |
* - remove and grant og roles |
574 | 571 |
* - flush appropriate caches |
575 | 572 |
*/ |
576 |
//debug("og_actions"); debug($og_actions); debug("user_auth_data"); debug($user_auth_data); |
|
577 | 573 |
if ($this->ogVersion == 1) { |
578 | 574 |
$this->og1Grants($og_actions, $user, $user_auth_data); |
579 | 575 |
$this->og1Revokes($og_actions, $user, $user_auth_data); |
... | ... | |
639 | 635 |
$users_group_rids = array_keys(og_get_user_roles($group_entity_type, $gid, $user->uid, TRUE)); // users current rids w/authen or anon roles returned |
640 | 636 |
$users_group_rids = array_diff($users_group_rids, array($anonymous_rid)); |
641 | 637 |
$new_rids = array_diff($granting_rids, $users_group_rids, array($anonymous_rid)); // rids to be added without anonymous rid |
642 |
// debug("new rids"); debug($new_rids);debug("granting_rids"); debug($granting_rids);debug("users_group_rids"); debug($users_group_rids); |
|
643 |
|
|
638 |
|
|
644 | 639 |
// if adding OG_AUTHENTICATED_ROLE or any other role and does not currently have OG_AUTHENTICATED_ROLE, group |
645 | 640 |
if (!in_array($authenticated_rid, $users_group_rids) && count($new_rids) > 0) { |
646 | 641 |
$values = array( |
... | ... | |
650 | 645 |
'state' => OG_STATE_ACTIVE, |
651 | 646 |
); |
652 | 647 |
$og_membership = og_group($group_entity_type, $gid, $values); |
653 |
// debug("consumer_id=$consumer_id, og group called( $group_entity_type, $gid, values:"); debug($values); debug("response og_membership"); debug($og_membership); |
|
654 | 648 |
$consumer_id = join(':', array($group_entity_type, $gid, $authenticated_rid)); |
655 | 649 |
$user_auth_data[$consumer_id] = array( |
656 | 650 |
'date_granted' => time(), |
... | ... | |
660 | 654 |
|
661 | 655 |
} |
662 | 656 |
foreach ($new_rids as $i => $rid) { |
663 |
// debug("role grant $group_entity_type $gid $user->uid $rid"); |
|
664 | 657 |
og_role_grant($group_entity_type, $gid, $user->uid, $rid); |
665 | 658 |
} |
666 | 659 |
foreach ($granting_rids as $i => $rid) { |
... | ... | |
886 | 879 |
|
887 | 880 |
if (!empty($og_fields['bundles'])) { |
888 | 881 |
foreach ($og_fields['bundles'] as $entity_type => $bundles) { |
889 |
|
|
890 | 882 |
foreach ($bundles as $i => $bundle) { |
891 |
|
|
892 | 883 |
$query = new EntityFieldQuery(); |
893 | 884 |
$query->entityCondition('entity_type', $entity_type) |
894 | 885 |
->entityCondition('bundle', $bundle) |
895 | 886 |
->range(0, 5) |
896 | 887 |
->addMetaData('account', user_load(1)); // run the query as user 1 |
897 | 888 |
$result = $query->execute(); |
898 |
$entities = entity_load($entity_type, array_keys($result[$entity_type])); |
|
899 |
$i=0; |
|
900 |
foreach ($entities as $entity_id => $entity) { |
|
901 |
$i++; |
|
902 |
$rid = ldap_authorization_og2_rid_from_role_name($entity_type, $bundle, $entity_id, OG_AUTHENTICATED_ROLE); |
|
903 |
$title = (is_object($entity) && property_exists($entity, 'title')) ? $entity->title : ''; |
|
904 |
$middle = ($title && $i < 3) ? $title : $entity_id; |
|
905 |
$group_role_identifier = ldap_authorization_og_authorization_id($middle, $rid, $entity_type); |
|
906 |
$example = "<code>ou=IT,dc=myorg,dc=mytld,dc=edu|$group_role_identifier</code>"; |
|
907 |
$rows[] = array("$entity_type $title - $role_name", $example); |
|
908 |
|
|
889 |
if (!empty($result)) { |
|
890 |
$entities = entity_load($entity_type, array_keys($result[$entity_type])); |
|
891 |
$i=0; |
|
892 |
foreach ($entities as $entity_id => $entity) { |
|
893 |
$i++; |
|
894 |
$rid = ldap_authorization_og2_rid_from_role_name($entity_type, $bundle, $entity_id, OG_AUTHENTICATED_ROLE); |
|
895 |
$title = (is_object($entity) && property_exists($entity, 'title')) ? $entity->title : ''; |
|
896 |
$middle = ($title && $i < 3) ? $title : $entity_id; |
|
897 |
$group_role_identifier = ldap_authorization_og_authorization_id($middle, $rid, $entity_type); |
|
898 |
$example = "<code>ou=IT,dc=myorg,dc=mytld,dc=edu|$group_role_identifier</code>"; |
|
899 |
$rows[] = array("$entity_type $title - $role_name", $example); |
|
900 |
} |
|
909 | 901 |
} |
910 |
|
|
911 | 902 |
} |
912 | 903 |
} |
913 | 904 |
} |
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info | ||
---|---|---|
13 | 13 |
|
14 | 14 |
core = "7.x" |
15 | 15 |
|
16 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
17 |
version = "7.x-2.0"
|
|
16 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
17 |
version = "7.x-2.1"
|
|
18 | 18 |
core = "7.x" |
19 | 19 |
project = "ldap" |
20 |
datestamp = "1489858388"
|
|
20 |
datestamp = "1495392789"
|
|
21 | 21 |
|
drupal7/sites/all/modules/ldap/ldap_authorization/tests/BasicTests.test | ||
---|---|---|
437 | 437 |
'error_message' => '', |
438 | 438 |
); |
439 | 439 |
$this->consumerAdminConf['drupal_role']->save(); |
440 |
// debug('mappings'); debug($this->consumerAdminConf['drupal_role']->mappings); |
|
441 | 440 |
|
442 | 441 |
$edit = array( |
443 | 442 |
'name' => 'hpotter', |
... | ... | |
446 | 445 |
$this->drupalPost('user', $edit, t('Log in')); |
447 | 446 |
|
448 | 447 |
$new_role_created = in_array($new_role, array_values(user_roles())); |
449 |
// debug("roles"); debug(user_roles()); |
|
450 | 448 |
$roles_by_name = array_flip(user_roles()); |
451 | 449 |
$hpotter = user_load_by_name('hpotter'); |
452 | 450 |
$hpotter = user_load($hpotter->uid, TRUE); |
... | ... | |
548 | 546 |
if (count($mismatches)) { |
549 | 547 |
debug('mismatches between ldap server properties and form submitted values'); |
550 | 548 |
debug($mismatches); |
551 |
// debug($ldap_consumer); // throw recursion |
|
552 | 549 |
debug($consumer_form_data); |
553 | 550 |
} |
554 | 551 |
$this->assertTrue(count($mismatches) == 0, 'Add form for ldap consumer properties match values submitted.', $this->ldapTestId . ' Add consumer conf'); |
... | ... | |
574 | 571 |
if (count($mismatches)) { |
575 | 572 |
debug('mismatches between ldap server properties and form submitted values'); |
576 | 573 |
debug($mismatches); |
577 |
// debug($ldap_consumer); // throw recursion |
|
578 | 574 |
debug($consumer_form_data); |
579 | 575 |
} |
580 | 576 |
$this->assertTrue(count($mismatches) == 0, 'Update form for ldap server properties match values submitted.', $this->ldapTestId . '.Update consumer conf'); |
drupal7/sites/all/modules/ldap/ldap_authorization/tests/Og2Tests.test | ||
---|---|---|
285 | 285 |
*/ |
286 | 286 |
|
287 | 287 |
list($students_group, $group_entity_id) = ldap_authorization_og2_get_group_from_name('node', 'students'); |
288 |
//debug("ldap_authorization_og2_get_group_from_name: students_group"); debug($students_group); |
|
289 | 288 |
$this->assertTrue($students_group->title == 'students', 'ldap_authorization_og2_get_group_from_name() function works', $this->ldapTestId); |
290 | 289 |
|
291 | 290 |
$test = ldap_authorization_og2_has_role($this->groupType, $group_nids['gryffindor'], $web_user->uid, OG_ADMINISTRATOR_ROLE); |
... | ... | |
338 | 337 |
|
339 | 338 |
list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hpotter, 'query'); // just see if the correct ones are derived. |
340 | 339 |
$groups1 = $new_authorizations['og_group']; |
341 |
// debug('ldap_authorizations_user_authorizations disabled:'); debug($new_authorizations); debug($notifications); |
|
342 | 340 |
$this->assertTrue( |
343 | 341 |
count($new_authorizations['og_group']) == 0, |
344 | 342 |
'disabled consumer configuration disallows authorizations.', |
... | ... | |
350 | 348 |
$this->consumerAdminConf['og_group']->status = 1; |
351 | 349 |
$this->consumerAdminConf['og_group']->save(); |
352 | 350 |
list($new_authorizations, $notifications) = ldap_authorizations_user_authorizations($hpotter, 'query', 'og_group'); // just see if the correct ones are derived. |
353 |
//debug('ldap_authorizations_user_authorizations enabled: '); debug($new_authorizations); debug($notifications); |
|
354 | 351 |
|
355 | 352 |
$correct_groups = !empty($new_authorizations['og_group'][$consumer_ids['students'][OG_AUTHENTICATED_ROLE]]) && |
356 | 353 |
!empty($new_authorizations['og_group'][$consumer_ids['gryffindor'][OG_AUTHENTICATED_ROLE]]); |
drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info | ||
---|---|---|
12 | 12 |
core = 7.x |
13 | 13 |
php = 5.2 |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
16 |
version = "7.x-2.0"
|
|
15 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
16 |
version = "7.x-2.1"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "ldap" |
19 |
datestamp = "1489858388"
|
|
19 |
datestamp = "1495392789"
|
|
20 | 20 |
|
drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.module | ||
---|---|---|
110 | 110 |
|
111 | 111 |
$source = feeds_source($importer->id); |
112 | 112 |
$fetcher = feeds_plugin('FeedsLdapQueryFetcher', $source->importer->id); |
113 |
//dpm((array)$fetcher); dpm((array)$source->importer->parser->ldap_result); |
|
114 | 113 |
// $fetcher_result = new FeedsLdapQueryFetcher($source->config); |
115 | 114 |
// $records = $fetcher->getRaw(); // FeedsSource $source |
116 |
// dpm($records); |
|
117 | 115 |
// foreach ($records[0] as $field_name => $value) { |
118 | 116 |
// $sources[$field_name] = array( |
119 | 117 |
// 'name' => array('#markup' => $field_name), |
drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info | ||
---|---|---|
5 | 5 |
|
6 | 6 |
dependencies[] = ldap_servers |
7 | 7 |
dependencies[] = ldap_test |
8 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
9 |
version = "7.x-2.0"
|
|
8 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
9 |
version = "7.x-2.1"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "ldap" |
12 |
datestamp = "1489858388"
|
|
12 |
datestamp = "1495392789"
|
|
13 | 13 |
|
drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info | ||
---|---|---|
17 | 17 |
|
18 | 18 |
configure = admin/config/people/ldap/query |
19 | 19 |
|
20 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
21 |
version = "7.x-2.0"
|
|
20 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
21 |
version = "7.x-2.1"
|
|
22 | 22 |
core = "7.x" |
23 | 23 |
project = "ldap" |
24 |
datestamp = "1489858388"
|
|
24 |
datestamp = "1495392789"
|
|
25 | 25 |
|
drupal7/sites/all/modules/ldap/ldap_servers/LdapServer.class.php | ||
---|---|---|
172 | 172 |
$server_record->{$db_field_name} = $value; |
173 | 173 |
} |
174 | 174 |
} |
175 |
//debug('ctools record'); debug($server_record); |
|
176 | 175 |
} |
177 | 176 |
else { |
178 | 177 |
$select = db_select('ldap_servers') |
... | ... | |
471 | 470 |
if (!$result) { |
472 | 471 |
$error = "LDAP Server ldap_add(%dn) Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str "; |
473 | 472 |
$tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))); |
474 |
//debug(t($error, $tokens)); |
|
475 | 473 |
watchdog('ldap_server', $error, $tokens, WATCHDOG_ERROR); |
476 | 474 |
} |
477 | 475 |
|
... | ... | |
1324 | 1322 |
*/ |
1325 | 1323 |
public function groupAddGroup($group_dn, $attributes = array()) { |
1326 | 1324 |
|
1327 |
//debug("this->dnExists( $group_dn, boolean)"); debug($this->dnExists($group_dn, 'boolean')); |
|
1328 |
// debug("this->dnExists( $group_dn, boolean)"); debug($this->dnExists($group_dn)); |
|
1329 | 1325 |
if ($this->dnExists($group_dn, 'boolean')) { |
1330 | 1326 |
return FALSE; |
1331 | 1327 |
} |
... | ... | |
1451 | 1447 |
* @return FALSE on error otherwise array of group members (could be users or groups) |
1452 | 1448 |
*/ |
1453 | 1449 |
public function groupAllMembers($group_dn) { |
1454 |
// debug("groupAllMembers $group_dn, this->groupMembershipsAttr=". $this->groupMembershipsAttr . 'this->groupGroupEntryMembershipsConfigured=' . $this->groupGroupEntryMembershipsConfigured); |
|
1455 | 1450 |
if (!$this->groupGroupEntryMembershipsConfigured) { |
1456 | 1451 |
return FALSE; |
1457 | 1452 |
} |
... | ... | |
1504 | 1499 |
}; |
1505 | 1500 |
|
1506 | 1501 |
foreach ($current_member_entries as $i => $member_entry) { |
1507 |
//dpm("groupMembersResursive:member_entry $i, level=$level < max_levels=$max_levels"); dpm($member_entry); |
|
1508 | 1502 |
// 1. Add entry itself if of the correct type to $all_member_dns |
1509 | 1503 |
$objectClassMatch = (!$object_classes || (count(array_intersect(array_values($member_entry['objectclass']), $object_classes)) > 0)); |
1510 | 1504 |
$objectIsGroup = in_array($this->groupObjectClass, array_values($member_entry['objectclass'])); |
... | ... | |
1674 | 1668 |
$query_for_parent_groups = '(&(objectClass=' . $this->groupObjectClass . ')' . $or . ')'; |
1675 | 1669 |
|
1676 | 1670 |
foreach ($this->basedn as $base_dn) { // need to search on all basedns one at a time |
1677 |
// debug("query for parent groups, base_dn=$base_dn, $query_for_parent_groups"); |
|
1678 | 1671 |
$group_entries = $this->search($base_dn, $query_for_parent_groups); // no attributes, just dns needed |
1679 | 1672 |
if ($group_entries !== FALSE && $level < LDAP_SERVER_LDAP_QUERY_RECURSION_LIMIT) { |
1680 | 1673 |
$this->groupMembershipsFromEntryRecursive($group_entries, $all_group_dns, $tested_group_ids, $level + 1, LDAP_SERVER_LDAP_QUERY_RECURSION_LIMIT); |
drupal7/sites/all/modules/ldap/ldap_servers/LdapServerAdmin.class.php | ||
---|---|---|
158 | 158 |
|
159 | 159 |
} |
160 | 160 |
|
161 |
// debug("values sent to save op=$op, ctools=". (int)module_exists('ctools')); debug($values); |
|
162 | 161 |
if ($result) { |
163 | 162 |
$this->inDatabase = TRUE; |
164 | 163 |
} |
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info | ||
---|---|---|
17 | 17 |
files[] = tests/ldap_servers.test |
18 | 18 |
configure = admin/config/people/ldap/servers |
19 | 19 |
|
20 |
; Information added by Drupal.org packaging script on 2017-03-18
|
|
21 |
version = "7.x-2.0"
|
|
20 |
; Information added by Drupal.org packaging script on 2017-05-21
|
|
21 |
version = "7.x-2.1"
|
|
22 | 22 |
core = "7.x" |
23 | 23 |
project = "ldap" |
24 |
datestamp = "1489858388"
|
|
24 |
datestamp = "1495392789"
|
|
25 | 25 |
|
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install | ||
---|---|---|
703 | 703 |
//5. ldap_authentication and ldap_user changes are in variables, not tables |
704 | 704 |
|
705 | 705 |
$ldap_authentication_conf_data = variable_get('ldap_authentication_conf', array()); |
706 |
if (!is_array($ldap_authentication_conf_data['sids'])) { |
|
707 |
$ldap_authentication_conf_data['sids'] = array(); |
|
708 |
} |
|
709 |
|
|
706 | 710 |
$ldap_user_conf_data = variable_get('ldap_user_conf', array()); |
707 | 711 |
|
708 | 712 |
$ldap_authentication_sids = array_keys($ldap_authentication_conf_data['sids']); |
... | ... | |
757 | 761 |
'title' => 'Changes in 7.x-1.x to 7.x-2.x update') |
758 | 762 |
); |
759 | 763 |
|
760 |
watchdog('ldap_servers', $summary, WATCHDOG_INFO); |
|
764 |
watchdog('ldap_servers', $summary, array(), WATCHDOG_INFO);
|
|
761 | 765 |
return $summary; |
762 | 766 |
|
763 | 767 |
|
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module | ||
---|---|---|
347 | 347 |
*/ |
348 | 348 |
|
349 | 349 |
function ldap_servers_ldap_user_attrs_list_alter(&$available_user_attrs, &$params) { |
350 |
//debug('ldap_servers_ldap_user_attrs_list_alter'); debug($available_user_attrs); debug($params); |
|
351 | 350 |
|
352 | 351 |
if (isset($params['ldap_server']) && $params['ldap_server']) { |
353 | 352 |
$ldap_server = $params['ldap_server']; |
... | ... | |
487 | 486 |
} |
488 | 487 |
} |
489 | 488 |
} |
490 |
// debug('available_user_attrs2'); debug($available_user_attrs); |
|
491 |
|
|
492 | 489 |
} |
493 | 490 |
|
494 | 491 |
/** |
... | ... | |
538 | 535 |
* see ldap_servers_get_servers() |
539 | 536 |
*/ |
540 | 537 |
function _ldap_servers_get_servers($sid, $type, $flatten, $reset) { |
541 |
// dpm('_ldap_servers_get_servers params'); dpm(array($sid, $type, $flatten, $reset)); |
|
542 | 538 |
ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class'); |
543 | 539 |
static $servers; |
544 | 540 |
$type = ($type) ? $type : 'all'; |
... | ... | |
814 | 810 |
*/ |
815 | 811 |
function ldap_servers_disable_http_check(&$form) { |
816 | 812 |
|
817 |
if (variable_get('ldap_servers_require_ssl_for_credentials', 0) == 1 && @$_SERVER['HTTPS'] != 'on') {
|
|
813 |
if (variable_get('ldap_servers_require_ssl_for_credentials', 0) == 1 && !drupal_is_https()) {
|
|
818 | 814 |
|
819 | 815 |
$tokens = array( |
820 | 816 |
'site_name' => variable_get('site_name', 'this site'), |
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.theme.inc | ||
---|---|---|
122 | 122 |
} |
123 | 123 |
|
124 | 124 |
function theme_ldap_server_ldap_entry_table($variables) { |
125 |
// debug($variables); |
|
126 | 125 |
if (!isset($variables['entry']) || !is_array($variables['entry'])) { |
127 | 126 |
return '<p>' . t('No Entry Returned.') . t('</p>'); |
128 | 127 |
} |
drupal7/sites/all/modules/ldap/ldap_servers/tests/ldap_servers.test | ||
---|---|---|
380 | 380 |
foreach ($data as $field_id => $values) { |
381 | 381 |
$field_id = drupal_strtolower($field_id); |
382 | 382 |
if (!isset($map[$field_id])) { |
383 |
// debug("no mapping for field: $field_id in item_id $item_id"); |
|
384 | 383 |
continue; |
385 | 384 |
} |
386 | 385 |
$property = $map[$field_id]; |
387 | 386 |
if (!property_exists($object, $property) && !property_exists($object, drupal_strtolower($property))) { |
388 |
// debug("property $property does not exist in object in item_id $item_id"); |
|
389 | 387 |
continue; |
390 | 388 |
} |
391 | 389 |
$property_value = $object->{$property}; |
Formats disponibles : Unified diff
Weekly update of contrib modules