Projet

Général

Profil

Révision c22e192e

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/bulk_export/bulk_export.info
6 6
version = CTOOLS_MODULE_VERSION
7 7

  
8 8

  
9
; Information added by Drupal.org packaging script on 2015-01-28
10
version = "7.x-1.6"
9
; Information added by Drupal.org packaging script on 2015-03-18
10
version = "7.x-1.7"
11 11
core = "7.x"
12 12
project = "ctools"
13
datestamp = "1422471484"
13
datestamp = "1426696183"
14 14

  
drupal7/sites/all/modules/ctools/ctools.info
9 9
files[] = includes/stylizer.inc
10 10
files[] = tests/css_cache.test
11 11

  
12
; Information added by Drupal.org packaging script on 2015-01-28
13
version = "7.x-1.6"
12
; Information added by Drupal.org packaging script on 2015-03-18
13
version = "7.x-1.7"
14 14
core = "7.x"
15 15
project = "ctools"
16
datestamp = "1422471484"
16
datestamp = "1426696183"
17 17

  
drupal7/sites/all/modules/ctools/ctools.module
23 23
 *   ; Requires CTools v7.x-1.4 or newer.
24 24
 *   dependencies[] = ctools (>=1.4)
25 25
 */
26
define('CTOOLS_MODULE_VERSION', '7.x-1.6');
26
define('CTOOLS_MODULE_VERSION', '7.x-1.7');
27 27

  
28 28
/**
29 29
 * Test the CTools API version.
drupal7/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info
5 5
version = CTOOLS_MODULE_VERSION
6 6
dependencies[] = ctools
7 7

  
8
; Information added by Drupal.org packaging script on 2015-01-28
9
version = "7.x-1.6"
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1422471484"
12
datestamp = "1426696183"
13 13

  
drupal7/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info
5 5
dependencies[] = ctools
6 6
core = 7.x
7 7

  
8
; Information added by Drupal.org packaging script on 2015-01-28
9
version = "7.x-1.6"
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1422471484"
12
datestamp = "1426696183"
13 13

  
drupal7/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info
5 5
version = CTOOLS_MODULE_VERSION
6 6
dependencies[] = ctools
7 7

  
8
; Information added by Drupal.org packaging script on 2015-01-28
9
version = "7.x-1.6"
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1422471484"
12
datestamp = "1426696183"
13 13

  
drupal7/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info
8 8
dependencies[] = advanced_help
9 9
core = 7.x
10 10

  
11
; Information added by Drupal.org packaging script on 2015-01-28
12
version = "7.x-1.6"
11
; Information added by Drupal.org packaging script on 2015-03-18
12
version = "7.x-1.7"
13 13
core = "7.x"
14 14
project = "ctools"
15
datestamp = "1422471484"
15
datestamp = "1426696183"
16 16

  
drupal7/sites/all/modules/ctools/includes/content.menu.inc
23 23
/**
24 24
 * Helper function for autocompletion of entity titles.
25 25
 */
26
function ctools_content_autocomplete_entity($type, $string = '') {
26
function ctools_content_autocomplete_entity($entity_type, $string = '') {
27 27
  if ($string != '') {
28
    global $user;
29
    $entity_info = entity_get_info($type);
30
    if ($type == 'node') {
31
      $entity_info['entity keys']['bundle field'] = 'type';
28
    $entity_info = entity_get_info($entity_type);
29

  
30
    if (!module_exists('entity')) {
31
      module_load_include('inc', 'ctools', 'includes/entity-access');
32
      _ctools_entity_access($entity_info, $entity_type);
32 33
    }
33 34

  
34 35
    // We must query all ids, because if every one of the 10 don't have access
......
42 43
    // If an ID match was found, use that ID rather than the whole string.
43 44
    if ($match) {
44 45
      $entity_id = $preg_matches[1];
45
      $entity = entity_load($type, array($entity_id));
46

  
47
      // Format results in an array so later we could add attributes to the
48
      // autocomplete text that is returned.
49
      $results = array($entity_id => array(
50
        'label' => $entity[$entity_id]->$entity_info['entity keys']['label'],
51
      ));
46
      $results = _ctools_getReferencableEntities($entity_type, $entity_info, $entity_id, '=', 1);
52 47
    }
53 48
    else {
54
      $results = _ctools_getReferencableEntities($type, $entity_info, $string, 'LIKE', 10);
55
    }
56
    foreach($results as $entity_id => $result) {
57
      if (!$entity_info['entity keys']['label']) {
58
         $matches["[id: $entity_id]"] = '<span class="autocomplete_title">' . $entity_id . '</span>';
59
      }
60
      else {
61
        $matches[$result['label'] . " [id: $entity_id]"] = '<span class="autocomplete_title">' . check_plain($result['label']) . '</span>';
62
        $matches[$result['label'] . " [id: $entity_id]"] .= isset($result['bundle field']) ? ' <span class="autocomplete_bundle">(' . check_plain($result['bundle field']) . ')</span>' : '';
49
      // We cannot find results if the entity doesn't have a label to search.
50
      if (!isset($entity_info['entity keys']['label'])) {
51
        drupal_json_output(array("[id: NULL]" => '<span class="autocomplete_title">' . t('Entity Type !entity_type does not support autocomplete search.', array('!entity_type' => $entity_type)) . '</span>'));
52
        return;
63 53
      }
54
      $results = _ctools_getReferencableEntities($entity_type, $entity_info, $string, 'LIKE', 10);
55
    }
56
    foreach ($results as $entity_id => $result) {
57
      $matches[$result['label'] . " [id: $entity_id]"] = '<span class="autocomplete_title">' . check_plain($result['label']) . '</span>';
58
      $matches[$result['label'] . " [id: $entity_id]"] .= isset($result['bundle']) ? ' <span class="autocomplete_bundle">(' . check_plain($result['bundle']) . ')</span>' : '';
64 59
    }
65 60

  
66 61
    drupal_json_output($matches);
......
73 68
 */
74 69
function _ctools_buildQuery($entity_type, $entity_info, $match = NULL, $match_operator = 'CONTAINS') {
75 70
  $base_table = $entity_info['base table'];
76
    $query = db_select($base_table)
77
      ->fields($base_table, array($entity_info['entity keys']['id']));
71
  $label_key = $entity_info['entity keys']['label'];
72
  $query = db_select($base_table)
73
    ->fields($base_table, array($entity_info['entity keys']['id']));
78 74

  
79
    if (isset($match)) {
80
      if (isset($entity_info['entity keys']['label'])) {
81
        $query->condition($base_table .'.'. $entity_info['entity keys']['label'], '%' . $match . '%' , $match_operator);
82
      }
75
  if (isset($match)) {
76
    if (isset($label_key)) {
77
      $query->condition($base_table . '.' . $label_key, '%' . $match . '%', $match_operator);
83 78
    }
84

  
85
    // Add a label to the query, if the label exists
86
    if (isset($entity_info['entity keys']['label'])) {
87
      $query->fields($base_table, array($entity_info['entity keys']['label']));
79
    // This should never happen, but double check just in case.
80
    else {
81
      return array();
88 82
    }
89

  
90
    // Add bundle field to the query, if it exists.
91
    if (isset($entity_info['entity keys']['bundle field'])) {
92
      $query->fields($base_table, array($entity_info['entity keys']['bundle field']));
83
  }
84
  // Add a generic entity access tag to the query.
85
  $query->addTag('ctools');
86

  
87
  // We have to perform two checks. First check is a query alter (with tags)
88
  // in an attempt to only return results that have access. However, this is
89
  // not full-proof since entities many not implement hook_access query tag.
90
  // This is why we have a second check after entity load, before we display
91
  // the label of an entity.
92
  if ($entity_type == 'comment') {
93
    // Adding the 'comment_access' tag is sadly insufficient for comments: core

94
    // requires us to also know about the concept of 'published' and

95
    // 'unpublished'.

96
    if (!user_access('administer comments')) {
97
      $query->condition('comment.status', COMMENT_PUBLISHED);
93 98
    }
94 99

  
95
    // Add a generic entity access tag to the query.
96
    $query->addTag('ctools');
97

  
98
    if($entity_type == 'comment') {
99
      // Adding the 'comment_access' tag is sadly insufficient for comments: core
100
      // requires us to also know about the concept of 'published' and
101
      // 'unpublished'.
102
      if (!user_access('administer comments')) {
103
        $query->condition('comment.status', COMMENT_PUBLISHED);
104
      }
105
      // Join to a node if the user does not have node access bypass permissions
106
      // to obey node published permissions
107
      if (!user_access('bypass node access') && !count(module_implements('node_grants'))) {
108
        $node_alias = $query->innerJoin('node', 'n', '%alias.nid = comment.nid');
109
        $query->condition($node_alias . '.status', NODE_PUBLISHED);
110
      }
111
      $query->addTag('node_access');
112
    }
113
    else {
114
      $query->addTag($entity_type . '_access');
100
    // Join to a node if the user does not have node access bypass permissions

101
    // to obey node published permissions

102
    if (!user_access('bypass node access')) {
103
      $node_alias = $query->innerJoin('node', 'n', '%alias.nid = comment.nid');
104
      $query->condition($node_alias . '.status', NODE_PUBLISHED);
115 105
    }
106
    $query->addTag('node_access');
107
  }
108
  else {
109
    $query->addTag($entity_type . '_access');
110
  }
116 111

  
117
    // Add the sort option.
118
    if(isset($entity_info['entity keys']['label'])) {
119
      $query->orderBy($base_table .'.'. $entity_info['entity keys']['label'], 'ASC');
120
    }
112
  // Add the sort option.
113
  if (isset($label_key)) {
114
    $query->orderBy($base_table . '.' . $label_key, 'ASC');
115
  }
121 116

  
122
    return $query;
117
  return $query;
123 118
}
124 119

  
125 120
/**
......
127 122
 * Entity Reference module.
128 123
 */
129 124
function _ctools_getReferencableEntities($entity_type, $entity_info, $match = NULL, $match_operator = 'LIKE', $limit = 0) {
125
  global $user;
126
  $account = $user;
130 127
  $options = array();
131

  
132
  $query = _ctools_buildQuery($entity_type, $entity_info, $match, $match_operator);
133
  if ($limit > 0) {
134
    $query->range(0, $limit);
128
  // We're an entity ID, return the id
129
  if (is_numeric($match) && $match_operator == '=') {
130
    if ($entity = array_shift(entity_load($entity_type, array($match)))) {
131
      if (isset($entity_info['access callback']) && function_exists($entity_info['access callback'])) {
132
        if ($entity_info['access callback']('view', $entity, $account, $entity_type)) {
133
          $label = entity_label($entity_type, $entity);
134
          return array(
135
            $match => array(
136
              'label' => !empty($label) ? $label : $entity->{$entity_info['entity keys']['id']},
137
              'bundle' => !empty($entity_info['entity keys']['bundle']) ? check_plain($entity->{$entity_info['entity keys']['bundle']}) : NULL,
138
            ),
139
          );
140
        }
141
      }
142
    }
143
    // If you don't have access, or an access callback or a valid entity, just
144
    // Return back the Entity ID.
145
    return array(
146
      $match =>  array(
147
        'label' => $match,
148
        'bundle' => NULL,
149
        ),
150
    );
135 151
  }
136 152

  
137
  $results = $query->execute();
153
  // We have matches, build a query to fetch the result.
154
  if ($query = _ctools_buildQuery($entity_type, $entity_info, $match, $match_operator)) {
155
    if ($limit > 0) {
156
      $query->range(0, $limit);
157
    }
138 158

  
139
  if (!empty($results)) {
140
    foreach ($results as $record) {
141
      $options[$record->{$entity_info['entity keys']['id']}] = array(
142
        'label' => isset($entity_info['entity keys']['label']) ? check_plain($record->{$entity_info['entity keys']['label']}) : $record->{$entity_info['entity keys']['id']},
143
        'bundle field' => isset($entity_info['entity keys']['bundle field']) ? check_plain($record->{$entity_info['entity keys']['bundle field']}) : '',
144
      );
159
    $results = $query->execute();
160

  
161
    if (!empty($results)) {
162
      foreach ($results as $record) {
163
        $entities = entity_load($entity_type, array($record->{$entity_info['entity keys']['id']}));
164
        $entity = array_shift($entities);
165
        if (isset($entity_info['access callback']) && function_exists($entity_info['access callback'])) {
166
          if ($entity_info['access callback']('view', $entity, $account, $entity_type)) {
167
            $label = entity_label($entity_type, $entity);
168
            $options[$record->{$entity_info['entity keys']['id']}] = array(
169
              'label' => !empty($label) ? $label : $entity->{$entity_info['entity keys']['id']},
170
              'bundle' => !empty($entity_info['entity keys']['bundle']) ? check_plain($entity->{$entity_info['entity keys']['bundle']}) : NULL,
171
            );
172
          }
173
        }
174
      }
145 175
    }
176
    return $options;
146 177
  }
147

  
148
  return $options;
149
}
178
  return array();
179
}
drupal7/sites/all/modules/ctools/includes/context-admin.inc
376 376
    'path' => "ctools/context/ajax/add/$mechanism/$type/$cache_key/$name/%step",
377 377
    'show cancel' => TRUE,
378 378
    'default form' => 'ctools_edit_context_form_defaults',
379
    'auto caching' => TRUE,
379
    'auto cache' => TRUE,
380 380
    'cache mechanism' => $mechanism,
381 381
    'cache key' => $cache_key,
382 382
    // This is stating what the cache will be referred to in $form_state
383
    'cache storage' => 'object',
383
    'cache location' => 'object',
384 384
  );
385 385

  
386 386
  if ($type == 'requiredcontext') {
......
561 561
    'path' => "ctools/context/ajax/configure/$mechanism/$type/$cache_key/$position/%step",
562 562
    'show cancel' => TRUE,
563 563
    'default form' => 'ctools_edit_context_form_defaults',
564
    'auto caching' => TRUE,
564
    'auto cache' => TRUE,
565 565
    'cache mechanism' => $mechanism,
566 566
    'cache key' => $cache_key,
567 567
    // This is stating what the cache will be referred to in $form_state
568
    'cache storage' => 'object',
568
    'cache location' => 'object',
569 569
  );
570 570

  
571 571
  if ($type == 'requiredcontext') {
drupal7/sites/all/modules/ctools/includes/entity-access.inc
1
<?php
2

  
3
/**
4
 * @file
5
 * Provides various callbacks for the whole core module integration.
6
 * This is a copy of Entity API's functionality for use when Entity API isn't
7
 * Enabled, and only works on view functions.
8
 */
9

  
10
/**
11
 * Core hack to include entity api-esque 'access callback' functions to core
12
 * entities without needing to rely on entity api.
13
 * Exception: We don't touch file entity. You must have entity API enabled to
14
 * view files.
15
 */
16
function _ctools_entity_access(&$entity_info, $entity_type) {
17
  // If the access callback is already set, don't change anything.
18
  if (isset($entity_info['access callback'])) {
19
    return;
20
  }
21

  
22
  switch ($entity_type) {
23
    case 'node':
24
      // Sad panda, we don't use Entity API, lets manually add access callbacks.
25
      $entity_info['access callback'] = 'ctools_metadata_no_hook_node_access';
26
      break;
27
    case 'user':
28
      $entity_info['access callback'] = 'ctools_metadata_user_access';
29
      break;
30
    case 'comment':
31
      if (module_exists('comment')) {
32
        $entity_info['access callback'] = 'ctools_metadata_comment_access';
33
      }
34
      break;
35
    case 'taxonomy_term':
36
      if (module_exists('taxonomy')) {
37
        $entity_info['access callback'] = 'ctools_metadata_taxonomy_access';
38
      }
39
      break;
40
    case 'taxonomy_vocabulary':
41
      if (module_exists('taxonomy')) {
42
        $entity_info['access callback'] = 'ctools_metadata_taxonomy_access';
43
      }
44
      break;
45
  }
46
}
47

  
48
/**
49
 * Access callback for the node entity.
50
 *
51
 * This function does not implement hook_node_access(), thus it may not be
52
 * called ctools_metadata_node_access().
53
 *
54
 * @see entity_access()
55
 *
56
 * @param $op
57
 *   The operation being performed. One of 'view', 'update', 'create' or
58
 *   'delete'.
59
 * @param $node
60
 *   A node to check access for. Must be a node object. Must have nid,
61
 *   except in the case of 'create' operations.
62
 * @param $account
63
 *   The user to check for. Leave it to NULL to check for the global user.
64
 *
65
 * @throws EntityMalformedException
66
 *
67
 * @return boolean
68
 *   TRUE if access is allowed, FALSE otherwise.
69
 */
70
function ctools_metadata_no_hook_node_access($op, $node = NULL, $account = NULL) {
71
  // First deal with the case where a $node is provided.
72
  if (isset($node)) {
73
    // If a non-default revision is given, incorporate revision access.
74
    $default_revision = node_load($node->nid);
75
    if ($node->vid !== $default_revision->vid) {
76
      return _node_revision_access($node, $op, $account);
77
    }
78
    else {
79
      return node_access($op, $node, $account);
80
    }
81
  }
82
  // No node is provided. Check for access to all nodes.
83
  if (user_access('bypass node access', $account)) {
84
    return TRUE;
85
  }
86
  if (!user_access('access content', $account)) {
87
    return FALSE;
88
  }
89
  if ($op == 'view' && node_access_view_all_nodes($account)) {
90
    return TRUE;
91
  }
92
  return FALSE;
93
}
94

  
95
/**
96
 * Access callback for the user entity.
97
 */
98
function ctools_metadata_user_access($op, $entity = NULL, $account = NULL, $entity_type) {
99
  $account = isset($account) ? $account : $GLOBALS['user'];
100
  // Grant access to the users own user account and to the anonymous one.
101
  if (isset($entity) && $op != 'delete' && (($entity->uid == $account->uid && $entity->uid) || (!$entity->uid && $op == 'view'))) {
102
    return TRUE;
103
  }
104
  if (user_access('administer users', $account) || user_access('access user profiles', $account) && $op == 'view' && $entity->status) {
105
    return TRUE;
106
  }
107
  return FALSE;
108
}
109

  
110
/**
111
 * Access callback for the comment entity.
112
 */
113
function ctools_metadata_comment_access($op, $entity = NULL, $account = NULL) {
114
  // When determining access to a comment, if comment has an associated node,
115
  // the user must be able to view the node in order to access the comment.
116
  if (isset($entity->nid)) {
117
    if (!node_access('view', node_load($entity->nid), $account)) {
118
      return FALSE;
119
    }
120
  }
121

  
122
  // Comment administrators are allowed to perform all operations on all
123
  // comments.
124
  if (user_access('administer comments', $account)) {
125
    return TRUE;
126
  }
127

  
128
  // Unpublished comments can never be accessed by non-admins.
129
  if (isset($entity->status) && $entity->status == COMMENT_NOT_PUBLISHED) {
130
    return FALSE;
131
  }
132

  
133
  if (user_access('access comments', $account) && $op == 'view') {
134
    return TRUE;
135
  }
136
  return FALSE;
137
}
138

  
139
/**
140
 * Access callback for the taxonomy entities.
141
 */
142
function ctools_metadata_taxonomy_access($op, $entity = NULL, $account = NULL, $entity_type) {
143
  if ($entity_type == 'taxonomy_vocabulary') {
144
    return user_access('administer taxonomy', $account);
145
  }
146
  if (user_access('administer taxonomy', $account) || user_access('access content', $account) && $op == 'view') {
147
    return TRUE;
148
  }
149
  return FALSE;
150
}
drupal7/sites/all/modules/ctools/page_manager/page_manager.admin.inc
1421 1421
        'exists' => 'page_manager_handler_check_machine_name',
1422 1422
        'source' => array('title'),
1423 1423
      ),
1424
      '#field_prefix' => '<span dir="ltr">' . $task['name'] . '__',
1424
      '#field_prefix' => '<span dir="ltr">' . $form_state['task_name'] . '__',
1425 1425
      '#field_suffix' => '</span>&lrm;',
1426 1426
    );
1427 1427
  }
......
1466 1466
 * Check if handler's machine-name is unique
1467 1467
 */
1468 1468
function page_manager_handler_check_machine_name($name, $element, $form_state) {
1469
  $name = $form_state['task']['name'] . '__' . $name;
1469
  $name = $form_state['task_name'] . '__' . $name;
1470 1470

  
1471 1471
  return count(ctools_export_load_object('page_manager_handlers', 'names', array($name)));
1472 1472
}
drupal7/sites/all/modules/ctools/page_manager/page_manager.info
5 5
package = Chaos tool suite
6 6
version = CTOOLS_MODULE_VERSION
7 7

  
8
; Information added by Drupal.org packaging script on 2015-01-28
9
version = "7.x-1.6"
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1422471484"
12
datestamp = "1426696183"
13 13

  
drupal7/sites/all/modules/ctools/page_manager/plugins/task_handlers/http_response.inc
216 216
 * General settings for the panel
217 217
 */
218 218
function page_manager_http_response_edit_settings($form, &$form_state) {
219
  ctools_include('page_manager.admin', 'page_manager', '');
220
  ctools_include('export', 'ctools');
221

  
219 222
  $conf = $form_state['handler']->conf;
220 223
  $form['title'] = array(
221 224
    '#type' => 'textfield',
......
262 265

  
263 266
function page_manager_http_response_edit_settings_submit($form, &$form_state) {
264 267
  $machine_name = $form_state['handler']->name;
265
  $name = $form_state['task_id'] . '__' . $form_state['values']['name'];
268
  $name = $form_state['task_name'] . '__' . $form_state['values']['name'];
266 269

  
267 270
  // If new name doesn't equal machine name, we need to update and redirect.
268 271
  if ($machine_name !== $name) {
269
    $form_state['new trail'] = $form_state['trail'];
270
    $delta = array_search($machine_name, $form_state['new trail']);
271
    $form_state['new trail'][$delta] = $name;
272 272
    $form_state['handler']->name = $name;
273
    // If there's a trail, we need to replace it for redirection.
274
    if (isset($form_state['trail'])) {
275
      $form_state['new trail'] = $form_state['trail'];
276
      $delta = array_search($machine_name, $form_state['new trail']);
277
      $form_state['new trail'][$delta] = $name;
278
    }
279
    // If handler id is set, replace it.
280
    if ($form_state['handler_id']) {
281
      $form_state['handler_id'] = $name;
282
    }
283
    // If we're defining a new custom handler, move page handler to new name.
284
    if (isset($form_state['page']->handlers[$machine_name]) && isset($form_state['page']->handler_info[$machine_name])) {
285
      $form_state['page']->handlers[$name] = $form_state['page']->handlers[$machine_name];
286
      unset($form_state['page']->handlers[$machine_name]);
287
      $form_state['page']->handler_info[$name] = $form_state['page']->handler_info[$machine_name];
288
      unset($form_state['page']->handler_info[$machine_name]);
289
    }
273 290
  }
274 291

  
275 292
  $form_state['handler']->conf['title'] = $form_state['values']['title'];
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/term_view.inc
151 151
  foreach (module_implements('page_manager_override') as $module) {
152 152
    $call = $module . '_page_manager_override';
153 153
    if (($rc = $call('term_view')) && function_exists($rc)) {
154
      return $rc($node);
154
      return $rc($term, $depth);
155 155
    }
156 156
  }
157 157

  
drupal7/sites/all/modules/ctools/plugins/arguments/entity_id.inc
3 3
/**
4 4
 * @file
5 5
 *
6
 * Plugin to provide an argument handler for all entity ids
6
 * Plugin to provide an argument handler for all entity ids.
7 7
 */
8 8

  
9 9
/**
......
17 17
  'get child' => 'ctools_argument_entity_id_get_child',
18 18
  'get children' => 'ctools_argument_entity_id_get_children',
19 19
  'default' => array(
20
    'entity_id' => ''
20
    'entity_id' => '',
21 21
  ),
22 22
  'placeholder form' => 'ctools_argument_entity_id_ctools_argument_placeholder',
23 23
);
......
41 41
    $plugins[$plugin_id] = $plugin;
42 42
  }
43 43
  drupal_alter('ctools_entity_contexts', $plugins);
44

  
44 45
  return $plugins;
45 46
}
46 47

  
......
60 61
    return ctools_context_create('entity:' . $entity_type, $arg);
61 62
  }
62 63

  
64
  // Trim spaces and other garbage.
65
  $arg = trim($arg);
66

  
63 67
  if (!is_numeric($arg)) {
64 68
    $preg_matches = array();
65
    $match        = preg_match('/\[id: (\d+)\]/', $arg, $preg_matches);
69
    $match = preg_match('/\[id: (\d+)\]/', $arg, $preg_matches);
66 70
    if (!$match) {
67 71
      $match = preg_match('/^id: (\d+)/', $arg, $preg_matches);
68 72
    }
......
70 74
    if ($match) {
71 75
      $id = $preg_matches[1];
72 76
    }
73
    if (is_numeric($id)) {
77
    if (isset($id) && is_numeric($id)) {
74 78
      return ctools_context_create('entity:' . $entity_type, $id);
75 79
    }
76 80
    return FALSE;
77 81
  }
78 82

  
79
  $entity = entity_load($entity_type, array($arg));
80
  if (!$entity) {
83
  $entities = entity_load($entity_type, array($arg));
84
  if (empty($entities)) {
81 85
    return FALSE;
82 86
  }
83 87

  
84
  return ctools_context_create('entity:' . $entity_type, $entity[$arg]);
88
  return ctools_context_create('entity:' . $entity_type, reset($entities));
85 89
}
86 90

  
87 91
function ctools_argument_entity_id_settings_form(&$form, &$form_state, $conf) {
......
119 123

  
120 124
  $form['settings']['entity_id'] = array(
121 125
    '#type' => 'value',
122
    '#value' => $conf['entity_id'],
126
    '#value' => isset($conf['entity_id']) ? $conf['entity_id'] : '',
123 127
  );
124 128

  
125 129
  $form['settings']['entity_type'] = array(
......
132 136

  
133 137
function ctools_argument_entity_id_ctools_argument_placeholder($conf) {
134 138
  $conf = array(
135
    '#title'             => t('Enter the title or ID of a @entity entity', array('@entity' => $conf['keyword'])),
136
    '#type'              => 'textfield',
137
    '#maxlength'         => 512,
139
    '#title' => t('Enter the title or ID of a @entity entity', array('@entity' => $conf['keyword'])),
140
    '#type' => 'textfield',
141
    '#maxlength' => 512,
138 142
    '#autocomplete_path' => 'ctools/autocomplete/' . $conf['keyword'],
139
    '#weight'            => -10,
143
    '#weight' => -10,
140 144
  );
145

  
141 146
  return $conf;
142 147
}
drupal7/sites/all/modules/ctools/plugins/contexts/user_edit_form.inc
107 107
  );
108 108

  
109 109
  if (!empty($conf['uid'])) {
110
    $info = db_query('SELECT * FROM {user} WHERE uid = :uid', array(':uid' => $conf['uid']))->fetchObject();
110
    $info = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => $conf['uid']))->fetchObject();
111 111
    if ($info) {
112 112
      $link = l(t("'%name' [user id %uid]", array('%name' => $info->name, '%uid' => $info->uid)), "user/$info->uid", array('attributes' => array('target' => '_blank', 'title' => t('Open in new window')), 'html' => TRUE));
113 113
      $form['user']['#description'] = t('Currently set to !link', array('!link' => $link));
......
154 154
    $uid = $preg_matches[1];
155 155
  }
156 156
  if (is_numeric($uid)) {
157
    $user = db_query('SELECT uid FROM {user} WHEREuid = :uid', array(':uid' => $uid))->fetchObject();
157
    $user = db_query('SELECT uid FROM {users} WHERE uid = :uid', array(':uid' => $uid))->fetchObject();
158 158
  }
159 159
  else {
160
    $user = db_query('SELECT uid FROM {user} WHERE LOWER(name) = LOWER(:name)', array(':name' => $uid))->fetchObject();
160
    $user = db_query('SELECT uid FROM {users} WHERE LOWER(name) = LOWER(:name)', array(':name' => $uid))->fetchObject();
161 161
  }
162 162

  
163 163
  form_set_value($form['uid'], $user->uid, $form_state);
drupal7/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php
1441 1441

  
1442 1442
  $export_key = $plugin['export']['key'];
1443 1443
  $question = str_replace('%title', check_plain($item->{$export_key}), $plugin['strings']['confirmation'][$form_state['op']]['question']);
1444
  $path = empty($_REQUEST['cancel_path']) ? ctools_export_ui_plugin_base_path($plugin) : $_REQUEST['cancel_path'];
1444
  $path = (!empty($_REQUEST['cancel_path']) && !url_is_external($_REQUEST['cancel_path'])) ? $_REQUEST['cancel_path'] : ctools_export_ui_plugin_base_path($plugin);
1445 1445

  
1446 1446
  $form = confirm_form($form,
1447 1447
    $question,
drupal7/sites/all/modules/ctools/stylizer/stylizer.info
6 6
dependencies[] = ctools
7 7
dependencies[] = color
8 8

  
9
; Information added by Drupal.org packaging script on 2015-01-28
10
version = "7.x-1.6"
9
; Information added by Drupal.org packaging script on 2015-03-18
10
version = "7.x-1.7"
11 11
core = "7.x"
12 12
project = "ctools"
13
datestamp = "1422471484"
13
datestamp = "1426696183"
14 14

  
drupal7/sites/all/modules/ctools/term_depth/term_depth.info
5 5
package = Chaos tool suite
6 6
version = CTOOLS_MODULE_VERSION
7 7

  
8
; Information added by Drupal.org packaging script on 2015-01-28
9
version = "7.x-1.6"
8
; Information added by Drupal.org packaging script on 2015-03-18
9
version = "7.x-1.7"
10 10
core = "7.x"
11 11
project = "ctools"
12
datestamp = "1422471484"
12
datestamp = "1426696183"
13 13

  
drupal7/sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.info
8 8

  
9 9
files[] = ctools_export.test
10 10

  
11
; Information added by Drupal.org packaging script on 2015-01-28
12
version = "7.x-1.6"
11
; Information added by Drupal.org packaging script on 2015-03-18
12
version = "7.x-1.7"
13 13
core = "7.x"
14 14
project = "ctools"
15
datestamp = "1422471484"
15
datestamp = "1426696183"
16 16

  
drupal7/sites/all/modules/ctools/tests/ctools_plugin_test.info
12 12
files[] = math_expression_stack.test
13 13
hidden = TRUE
14 14

  
15
; Information added by Drupal.org packaging script on 2015-01-28
16
version = "7.x-1.6"
15
; Information added by Drupal.org packaging script on 2015-03-18
16
version = "7.x-1.7"
17 17
core = "7.x"
18 18
project = "ctools"
19
datestamp = "1422471484"
19
datestamp = "1426696183"
20 20

  
drupal7/sites/all/modules/ctools/views_content/plugins/content_types/views_panes.inc
265 265
  if ($allow['fields_override']) {
266 266
    if ($conf['fields_override']) {
267 267
      $fields = $view->get_items('field');
268
      foreach ($fields as $field => $display) {
268
      foreach ($fields as $field => $field_display) {
269 269
        $fields[$field]['exclude'] = empty($conf['fields_override'][$field]);
270 270
      }
271 271
      $view->display_handler->set_option('fields', $fields);
drupal7/sites/all/modules/ctools/views_content/views_content.info
10 10
files[] = plugins/views/views_content_plugin_display_panel_pane.inc
11 11
files[] = plugins/views/views_content_plugin_style_ctools_context.inc
12 12

  
13
; Information added by Drupal.org packaging script on 2015-01-28
14
version = "7.x-1.6"
13
; Information added by Drupal.org packaging script on 2015-03-18
14
version = "7.x-1.7"
15 15
core = "7.x"
16 16
project = "ctools"
17
datestamp = "1422471484"
17
datestamp = "1426696183"
18 18

  
drupal7/sites/all/modules/rules/includes/rules.core.inc
1124 1124
        elseif ($this->plugin == 'reaction rule') {
1125 1125
          // Clear event sets cached for evaluation.
1126 1126
          cache_clear_all('event_', 'cache_rules', TRUE);
1127
          variable_del('rules_event_whitelist');
1127
          // Clear event whitelist for rebuild.
1128
          cache_clear_all('rules_event_whitelist', 'cache_rules', TRUE);
1128 1129
        }
1129 1130
        drupal_static_reset('rules_get_cache');
1130 1131
        drupal_static_reset('rules_config_update_dirty_flag');
drupal7/sites/all/modules/rules/includes/rules.plugins.inc
809 809
    }
810 810
    // Cache a whitelist of configured events so we can use it to speed up later
811 811
    // calls. See rules_invoke_event().
812
    variable_set('rules_event_whitelist', array_flip(array_keys($sets)));
812
    rules_set_cache('rules_event_whitelist', array_flip(array_keys($sets)));
813 813
  }
814 814

  
815 815
  protected function stateVariables($element = NULL) {
drupal7/sites/all/modules/rules/rules.info
22 22
dependencies[] = entity_token
23 23
dependencies[] = entity
24 24

  
25
; Information added by Drupal.org packaging script on 2015-01-08
26
version = "7.x-2.8"
25
; Information added by Drupal.org packaging script on 2015-03-16
26
version = "7.x-2.9"
27 27
core = "7.x"
28 28
project = "rules"
29
datestamp = "1420734780"
29
datestamp = "1426527210"
30 30

  
drupal7/sites/all/modules/rules/rules.install
508 508
    }
509 509
  }
510 510
}
511

  
512
/**
513
 * Switch out the rules_event_whitelist variable for a cache equivalent.
514
 */
515
function rules_update_7214() {
516
  // Set new event_whitelist cache cid.
517
  rules_set_cache('rules_event_whitelist', variable_get('rules_event_whitelist', array()));
518
  // Delete old conf variable.
519
  variable_del('rules_event_whitelist');
520
  // Avoid any missing class errors.
521
  registry_rebuild();
522
  // Clear and rebuild Rules caches.
523
  // See: rules_admin_settings_cache_rebuild_submit.
524
  rules_clear_cache();
525
  rules_get_cache();
526
  _rules_rebuild_component_cache();
527
  RulesEventSet::rebuildEventCache();
528
}
drupal7/sites/all/modules/rules/rules.module
8 8
// hook_init().
9 9
require_once dirname(__FILE__) . '/modules/events.inc';
10 10

  
11
/**
12
 * Implements hook_module_implements_alter().
13
 */
14
function rules_module_implements_alter(&$implementations, $hook) {
15
  // Ensures the invocation of hook_menu_get_item_alter() triggers
16
  // rules_menu_get_item_alter() first so the rules invocation is ready for all
17
  // sub-sequent hook implementations.
18
  if ($hook == 'menu_get_item_alter' && array_key_exists('rules', $implementations)) {
19
    $group = $implementations['rules'];
20
    unset($implementations['rules']);
21
    $implementations = array_merge(array('rules' => $group), $implementations);
22
  }
23
}
24

  
25
/**
26
 * Implements hook_menu_get_item_alter().
27
 */
28
function rules_menu_get_item_alter() {
29
  // Make sure that event invocation is enabled before menu items are loaded.
30
  // But make sure later calls to menu_get_item() won't automatically re-enabled
31
  // the rules invocation.
32
  // Example: modules that implement hook_entity_ENTITY_TYPE_load() might want
33
  // to invoke Rules events in that load hook, which is also invoked for menu
34
  // item loading. Since this can happen even before hook_init() we need to make
35
  // sure that firing Rules events is enabled at that point. A typical use case
36
  // for this is Drupal Commerce with commerce_cart_commerce_order_load().
37
  if (!drupal_static('rules_init', FALSE)) {
38
    rules_event_invocation_enabled(TRUE);
39
  }
40
}
41

  
11 42
/**
12 43
 * Implements hook_init().
13 44
 */
14 45
function rules_init() {
46
  // See rules_menu_get_item_alter().
47
  $rules_init = &drupal_static(__FUNCTION__, FALSE);
48
  $rules_init = TRUE;
15 49
  // Enable event invocation once hook_init() was invoked for Rules.
16 50
  rules_event_invocation_enabled(TRUE);
17 51
  rules_invoke_event('init');
......
352 386
        $cache[$cid] = FALSE;
353 387
        _rules_rebuild_component_cache();
354 388
      }
355
      elseif (strpos($cid, 'event_') === 0) {
389
      elseif (strpos($cid, 'event_') === 0 || $cid == 'rules_event_whitelist') {
356 390
        $cache[$cid] = FALSE;
357 391
        RulesEventSet::rebuildEventCache();
358 392
      }
......
447 481
 */
448 482
function rules_clear_cache() {
449 483
  cache_clear_all('*', 'cache_rules', TRUE);
450
  variable_del('rules_event_whitelist');
451 484
  drupal_static_reset('rules_get_cache');
452 485
  drupal_static_reset('rules_fetch_data');
453 486
  drupal_static_reset('rules_config_update_dirty_flag');
......
984 1017
 * @see rules_invoke_event_by_args()
985 1018
 */
986 1019
function rules_invoke_event() {
987
  global $conf;
988

  
989 1020
  $args = func_get_args();
990 1021
  $event_name = $args[0];
991 1022
  unset($args[0]);
992 1023
  // We maintain a whitelist of configured events to reduces the number of cache
993
  // reads. We access it directly via the global $conf as this is fast without
994
  // having to introduce another static cache. Then, if the whitelist is unset,
995
  // we ignore it so cache rebuilding is triggered.
996
  if (rules_event_invocation_enabled() && (!isset($conf['rules_event_whitelist']) || isset($conf['rules_event_whitelist'][$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
997
    $event->executeByArgs($args);
1024
  // reads. If the whitelist is empty we proceed and it is rebuilt.
1025
  if (rules_event_invocation_enabled()) {
1026
    $whitelist = rules_get_cache('rules_event_whitelist');
1027
    if ((empty($whitelist) || isset($whitelist[$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
1028
      $event->executeByArgs($args);
1029
    }
998 1030
  }
999 1031
}
1000 1032

  
......
1016 1048
 * @see rules_invoke_event()
1017 1049
 */
1018 1050
function rules_invoke_event_by_args($event_name, $args = array()) {
1019
  global $conf;
1020

  
1021 1051
  // We maintain a whitelist of configured events to reduces the number of cache
1022
  // reads. We access it directly via the global $conf as this is fast without
1023
  // having to introduce another static cache. Then, if the whitelist is unset,
1024
  // we ignore it so cache rebuilding is triggered.
1025
  if (rules_event_invocation_enabled() && (!isset($conf['rules_event_whitelist']) || isset($conf['rules_event_whitelist'][$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
1026
    $event->executeByArgs($args);
1052
  // reads. If the whitelist is empty we proceed and it is rebuilt.
1053
  if (rules_event_invocation_enabled()) {
1054
    $whitelist = rules_get_cache('rules_event_whitelist');
1055
    if ((empty($whitelist) || isset($whitelist[$event_name])) && $event = rules_get_cache('event_' . $event_name)) {
1056
      $event->executeByArgs($args);
1057
    }
1027 1058
  }
1028 1059
}
1029 1060

  
drupal7/sites/all/modules/rules/rules_admin/rules_admin.info
6 6
files[] = rules_admin.inc
7 7
dependencies[] = rules
8 8

  
9
; Information added by Drupal.org packaging script on 2015-01-08
10
version = "7.x-2.8"
9
; Information added by Drupal.org packaging script on 2015-03-16
10
version = "7.x-2.9"
11 11
core = "7.x"
12 12
project = "rules"
13
datestamp = "1420734780"
13
datestamp = "1426527210"
14 14

  
drupal7/sites/all/modules/rules/rules_i18n/rules_i18n.info
7 7
files[] = rules_i18n.i18n.inc
8 8
files[] = rules_i18n.rules.inc
9 9
files[] = rules_i18n.test
10
; Information added by Drupal.org packaging script on 2015-01-08
11
version = "7.x-2.8"
10
; Information added by Drupal.org packaging script on 2015-03-16
11
version = "7.x-2.9"
12 12
core = "7.x"
13 13
project = "rules"
14
datestamp = "1420734780"
14
datestamp = "1426527210"
15 15

  
drupal7/sites/all/modules/rules/rules_scheduler/rules_scheduler.info
13 13
files[] = includes/rules_scheduler.views.inc
14 14
files[] = includes/rules_scheduler_views_filter.inc
15 15

  
16
; Information added by Drupal.org packaging script on 2015-01-08
17
version = "7.x-2.8"
16
; Information added by Drupal.org packaging script on 2015-03-16
17
version = "7.x-2.9"
18 18
core = "7.x"
19 19
project = "rules"
20
datestamp = "1420734780"
20
datestamp = "1426527210"
21 21

  
drupal7/sites/all/modules/rules/rules_scheduler/tests/rules_scheduler_test.info
5 5
files[] = rules_scheduler_test.inc
6 6
hidden = TRUE
7 7

  
8
; Information added by Drupal.org packaging script on 2015-01-08
9
version = "7.x-2.8"
8
; Information added by Drupal.org packaging script on 2015-03-16
9
version = "7.x-2.9"
10 10
core = "7.x"
11 11
project = "rules"
12
datestamp = "1420734780"
12
datestamp = "1426527210"
13 13

  
drupal7/sites/all/modules/rules/tests/rules.test
2099 2099
    }
2100 2100
  }
2101 2101
}
2102

  
2103
/**
2104
 * Test early bootstrap Rules invocation.
2105
 */
2106
class RulesInvocationEnabledTestCase extends DrupalWebTestCase {
2107

  
2108
  /**
2109
   * {@inheritdoc}
2110
   */
2111
  public static function getInfo() {
2112
    return array(
2113
      'name' => 'Rules invocation enabled',
2114
      'description' => 'Tests that Rules events are enabled during menu item loads.',
2115
      'group' => 'Rules',
2116
    );
2117
  }
2118

  
2119
  /**
2120
   * {@inheritdoc}
2121
   */
2122
  public function setUp() {
2123
    parent::setUp('dblog', 'rules', 'rules_test', 'rules_test_invocation');
2124
  }
2125

  
2126
  /**
2127
   * Tests that a Rules event is triggered on node menu item loading.
2128
   *
2129
   * @see rules_test_invocation_node_load()
2130
   */
2131
  public function testInvocationOnNodeMenuLoading() {
2132
    // Create a test node.
2133
    $node = $this->drupalCreateNode(array('title' => 'Test'));
2134
    // Enable Rules logging on the INFO level so that entries are written to
2135
    // dblog.
2136
    variable_set('rules_log_errors', RulesLog::INFO);
2137
    // Create an empty rule that will fire in our node load hook.
2138
    $rule = rules_reaction_rule();
2139
    $rule->event('rules_test_event');
2140
    $rule->save('test_rule');
2141

  
2142
    // Visit the node page which should trigger the load hook.
2143
    $this->drupalGet('node/' . $node->nid);
2144
    $result = db_query("SELECT * FROM {watchdog} WHERE type = 'rules' AND message = 'Reacting on event %label.'")->fetch();
2145
    $this->assertFalse(empty($result), 'Rules event was triggered and logged.');
2146
  }
2147

  
2148
}
drupal7/sites/all/modules/rules/tests/rules_test.info
6 6
files[] = rules_test.rules_defaults.inc
7 7
hidden = TRUE
8 8

  
9
; Information added by Drupal.org packaging script on 2015-01-08
10
version = "7.x-2.8"
9
; Information added by Drupal.org packaging script on 2015-03-16
10
version = "7.x-2.9"
11 11
core = "7.x"
12 12
project = "rules"
13
datestamp = "1420734780"
13
datestamp = "1426527210"
14 14

  
drupal7/sites/all/modules/rules/tests/rules_test_invocation.info
1
name = "Rules Test invocation"
2
description = "Helper module to test Rules invocations."
3
package = Testing
4
core = 7.x
5
hidden = TRUE
6

  
7
; Information added by Drupal.org packaging script on 2015-03-16
8
version = "7.x-2.9"
9
core = "7.x"
10
project = "rules"
11
datestamp = "1426527210"
12

  
drupal7/sites/all/modules/rules/tests/rules_test_invocation.module
1
<?php
2

  
3
/**
4
 * @file
5
 * Helper module for Rules invocation testing.
6
 */
7

  
8
/**
9
 * Implements hook_node_load().
10
 */
11
function rules_test_invocation_node_load($nodes, $types) {
12
  rules_invoke_event('rules_test_event');
13
}
drupal7/sites/all/modules/webform/components/select.inc
316 316
  // Set the component options.
317 317
  $element['#options'] = $options;
318 318

  
319
  // Set the default value.
320
  if (isset($value)) {
321
    if ($component['extra']['multiple']) {
322
      // Set the value as an array.
323
      $element['#default_value'] = array();
324
      foreach ((array) $value as $key => $option_value) {
325
        $element['#default_value'][] = $option_value;
326
      }
327
    }
328
    else {
329
      // Set the value as a single string.
330
      $element['#default_value'] = '';
331
      foreach ((array) $value as $option_value) {
332
        $element['#default_value'] = $option_value;
333
      }
334
    }
319
  // Use the component's default value if the component is currently empty.
320
  if (!isset($value)) {
321
    // The default for multiple selects is a comma-delimited list, without white-space or empty entries.
322
    $value = $component['extra']['multiple'] ? array_filter(array_map('trim', explode(',', $default_value)), 'strlen') : $default_value;
335 323
  }
336
  elseif ($default_value !== '') {
337
    // Convert default value to a list if necessary.
338
    if ($component['extra']['multiple']) {
339
      $varray = explode(',', $default_value);
340
      foreach ($varray as $key => $v) {
341
        $v = trim($v);
342
        if ($v !== '') {
343
          $element['#default_value'][] = $v;
344
        }
345
      }
346
    }
347
    else {
348
      $element['#default_value'] = $default_value;
324

  
325
  // Convert all values into an array; component may now be single but was previously multiple, or vice-versa
326
  $value = (array)$value;
327

  
328
  // Set the default value. Note: "No choice" is stored as an empty string,
329
  // which will match a 0 key for radios; NULL is used to avoid unintentional
330
  // defaulting to the 0 option.
331
  if ($component['extra']['multiple']) {
332
    // Set the value as an array.
333
    $element['#default_value'] = array();
334
    foreach ($value as $option_value) {
335
      $element['#default_value'][] = $option_value === '' ? NULL : $option_value;
349 336
    }
350 337
  }
351
  elseif ($component['extra']['multiple']) {
352
    $element['#default_value'] = array();
338
  else {
339
    // Set the value as a single string.
340
    $option_value = reset($value);
341
    $element['#default_value'] = $option_value === '' ? NULL : $option_value;
353 342
  }
354 343

  
355 344
  if ($component['extra']['other_option'] && module_exists('select_or_other')) {
356 345
    // Set display as a select_or_other element:
357 346
    $element['#type'] = 'select_or_other';
358 347
    $element['#other'] = !empty($component['extra']['other_text']) ? check_plain($component['extra']['other_text']) : t('Other...');
348
    $element['#translatable'][] = 'other';
359 349
    $element['#other_title'] = $element['#title'] . ' ' . $element['#other'];
360 350
    $element['#other_title_display'] = 'invisible';
361 351
    $element['#other_unknown_defaults'] = 'other';
......
389 379
      $element['#type'] = 'checkboxes';
390 380
      $element['#theme_wrappers'] = array_merge(array('checkboxes'), $element['#theme_wrappers']);
391 381
      $element['#process'] = array_merge(element_info_property('checkboxes', '#process'), array('webform_expand_select_ids'));
392

  
393
      // Entirely replace the normal expand checkboxes with our custom version.
394
      // This helps render checkboxes in multipage forms.
395
      $process_key = array_search('form_process_checkboxes', $element['#process']);
396
      $element['#process'][$process_key] = 'webform_expand_checkboxes';
397 382
    }
398 383
    else {
399 384
      // Set display as a radio set.
......
438 423
  return $element;
439 424
}
440 425

  
441
/**
442
 * Drupal 6 hack that properly *renders* checkboxes in multistep forms. This is
443
 * different than the value hack needed in Drupal 5, which is no longer needed.
444
 */
445
function webform_expand_checkboxes($element) {
446
  // Elements that have a value set are already in the form structure cause
447
  // them not to be written when the expand_checkboxes function is called.
448
  $default_value = array();
449
  foreach (element_children($element) as $key) {
450
    if (isset($element[$key]['#default_value'])) {
451
      $default_value[$key] = $element[$key]['#default_value'];
452
      unset($element[$key]);
453
    }
454
  }
455

  
456
  $element = form_process_checkboxes($element);
457

  
458
  // Escape the values of checkboxes.
459
  foreach (element_children($element) as $key) {
460
    $element[$key]['#return_value'] = check_plain($element[$key]['#return_value']);
461
    $element[$key]['#name'] = $element['#name'] . '[' . $element[$key]['#return_value'] . ']';
462
  }
463

  
464
  foreach ($default_value as $key => $val) {
465
    $element[$key]['#default_value'] = $val;
466
  }
467
  return $element;
468
}
469

  
470 426
/**
471 427
 * FAPI process function to rename IDs attached to checkboxes and radios.
472 428
 */
drupal7/sites/all/modules/webform/includes/webform.components.inc
680 680

  
681 681
  // Clear the entity cache if Entity Cache module is installed.
682 682
  if (module_exists('entitycache')) {
683
    cache_clear_all($node->nid, 'cache_entity_node');
683
    entity_get_controller('node')->resetCache(array($node->nid));
684 684
  }
685 685

  
686 686
  $form_state['redirect'] = array('node/' . $node->nid . '/webform/components', isset($cid) ? array('query' => array('cid' => $cid)) : array());
......
735 735

  
736 736
  // Clear the entity cache if Entity Cache module is installed.
737 737
  if (module_exists('entitycache')) {
738
    cache_clear_all($node->nid, 'cache_entity_node');
738
    entity_get_controller('node')->resetCache(array($node->nid));
739 739
  }
740 740

  
741 741
  $form_state['redirect'] = 'node/' . $node->nid . '/webform/components';
drupal7/sites/all/modules/webform/includes/webform.emails.inc
25 25
  );
26 26

  
27 27
  foreach ($node->webform['emails'] as $eid => $email) {
28
    $email_addresses = array_filter(explode(',', check_plain($email['email'])));
28
    $email_addresses = array_filter(explode(',', $email['email']));
29 29
    foreach ($email_addresses as $key => $email_address) {
30
      $email_addresses[$key] = webform_format_email_address($email_address, NULL, $node, NULL, FALSE);
30
      $email_addresses[$key] = check_plain(webform_format_email_address($email_address, NULL, $node, NULL, FALSE));
31 31
    }
32 32

  
33 33
    $form['emails'][$eid]['email'] = array(
......
453 453

  
454 454
  // Clear the entity cache if Entity Cache module is installed.
455 455
  if (module_exists('entitycache')) {
456
    cache_clear_all($node->nid, 'cache_entity_node');
456
    entity_get_controller('node')->resetCache(array($node->nid));
457 457
  }
458 458

  
459 459
  $form_state['redirect'] = array('node/' . $node->nid . '/webform/emails');
......
501 501

  
502 502
  // Clear the entity cache if Entity Cache module is installed.
503 503
  if (module_exists('entitycache')) {
504
    cache_clear_all($node->nid, 'cache_entity_node');
504
    entity_get_controller('node')->resetCache(array($node->nid));
505 505
  }
506 506

  
507 507
  $form_state['redirect'] = 'node/' . $node->nid . '/webform/emails';
drupal7/sites/all/modules/webform/includes/webform.report.inc
29 29
      drupal_set_title(t('Your submissions'));
30 30
      webform_disable_page_cache();
31 31
    }
32
    webform_set_breadcrumb($node);
33 32
    $submissions = webform_get_submissions(array('nid' => $node->nid, 'uid' => $user->uid), $header, $pager_count);
34 33
    $count = webform_get_submission_count($node->nid, $user->uid);
35 34
  }
drupal7/sites/all/modules/webform/webform.api.php
544 544
  }
545 545
}
546 546

  
547
/**
548
 * Determine if a user has access to clear the results of a webform.
549
 *
550
 * Access via this hook is in addition (adds permission) to the standard
551
 * webform access (delete all webform submissions).
552
 *
553
 * @see webform_results_clear_access().
554
 *
555
 * @param $node object
556
 *   The Webform node to check access on.
557
 * @param $account object
558
 *   The user account to check access on.
559
 * @return boolean
560
 *   TRUE or FALSE if the user can access the webform results.
561
 */
562
function hook_webform_results_clear_access($node, $account) {
563
  return user_access('my additional access', $account);
564
}
565

  
566

  
547 567
/**
548 568
 * Return an array of files associated with the component.
549 569
 *
drupal7/sites/all/modules/webform/webform.info
24 24
files[] = tests/submission.test
25 25
files[] = tests/webform.test
26 26

  
27
; Information added by Drupal.org packaging script on 2015-03-03
28
version = "7.x-3.22"
27
; Information added by Drupal.org packaging script on 2015-03-17
28
version = "7.x-3.23"
29 29
core = "7.x"
30 30
project = "webform"
31
datestamp = "1425406686"
31
datestamp = "1426611477"
32 32

  
drupal7/sites/all/modules/webform/webform.install
369 369
    'indexes' => array(
370 370
      'nid' => array('nid'),
371 371
      'sid_nid' => array('sid', 'nid'),
372
      'data' => array(array('data', 64)),
372 373
    ),
373 374
  );
374 375

  
......
851 852
    _webform_delete_file(NULL, array($fid));
852 853
  }
853 854
}
855

  
856
/**
857
 * Add index on {webform_submitted_data}.data.
858
 */
859
function webform_update_7322() {
860
  db_add_index('webform_submitted_data', 'data', array(array('data', 64)));
861
}
drupal7/sites/all/modules/webform/webform.module
1233 1233
}
1234 1234

  
1235 1235
/**
1236
 * Implements hook_delete().
1236
 * Implements hook_node_delete().
1237 1237
 */
1238 1238
function webform_node_delete($node) {
1239 1239
  if (!in_array($node->type, webform_variable_get('webform_node_types'))) {
......
1434 1434
    return;
1435 1435
  }
1436 1436

  
1437
  // If the webform is not set to display in this view mode, return early.
1438
  $extra_fields = field_extra_fields_get_display('node', $node->type, $view_mode);
1439
  if (empty($extra_fields['webform']['visible'])) {
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff