Passed
Push — master ( 8e685f...ce48d5 )
by Kevin
13:20
created
boinc/modules/contrib/cck/modules/userreference/userreference.module 1 patch
Switch Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -70,108 +70,108 @@  discard block
 block discarded – undo
70 70
  */
71 71
 function userreference_field_settings($op, $field) {
72 72
   switch ($op) {
73
-    case 'form':
74
-      $form = array();
75
-      $form['referenceable_roles'] = array(
76
-        '#type' => 'checkboxes',
77
-        '#title' => t('User roles that can be referenced'),
78
-        '#default_value' => isset($field['referenceable_roles']) && is_array($field['referenceable_roles']) ? array_filter($field['referenceable_roles']) : array(),
79
-        '#options' => user_roles(1),
80
-      );
81
-      $form['referenceable_status'] = array(
82
-        '#type' => 'radios',
83
-        '#title' => t('User status that can be referenced'),
84
-        '#default_value' => isset($field['referenceable_status']) ? $field['referenceable_status'] : '',
85
-        '#options' => array('' => t('All users'), 1 => t('Active users'), 0 => t('Blocked users')),
86
-      );
87
-      if (module_exists('views')) {
88
-        $views = array('--' => '--');
89
-        $all_views = views_get_all_views();
90
-        foreach ($all_views as $view) {
91
-          // Only 'users' views that have fields will work for our purpose.
92
-          if ($view->base_table == 'users' && !empty($view->display['default']->display_options['fields'])) {
93
-            if ($view->type == 'Default') {
94
-              $views[t('Default Views')][$view->name] = $view->name;
95
-            }
96
-            else {
97
-              $views[t('Existing Views')][$view->name] = $view->name;
98
-            }
73
+  case 'form':
74
+    $form = array();
75
+    $form['referenceable_roles'] = array(
76
+      '#type' => 'checkboxes',
77
+      '#title' => t('User roles that can be referenced'),
78
+      '#default_value' => isset($field['referenceable_roles']) && is_array($field['referenceable_roles']) ? array_filter($field['referenceable_roles']) : array(),
79
+      '#options' => user_roles(1),
80
+    );
81
+    $form['referenceable_status'] = array(
82
+      '#type' => 'radios',
83
+      '#title' => t('User status that can be referenced'),
84
+      '#default_value' => isset($field['referenceable_status']) ? $field['referenceable_status'] : '',
85
+      '#options' => array('' => t('All users'), 1 => t('Active users'), 0 => t('Blocked users')),
86
+    );
87
+    if (module_exists('views')) {
88
+      $views = array('--' => '--');
89
+      $all_views = views_get_all_views();
90
+      foreach ($all_views as $view) {
91
+        // Only 'users' views that have fields will work for our purpose.
92
+        if ($view->base_table == 'users' && !empty($view->display['default']->display_options['fields'])) {
93
+          if ($view->type == 'Default') {
94
+            $views[t('Default Views')][$view->name] = $view->name;
95
+          }
96
+          else {
97
+            $views[t('Existing Views')][$view->name] = $view->name;
99 98
           }
100
-        }
101
-
102
-        $form['advanced'] = array(
103
-           '#type' => 'fieldset',
104
-           '#title' => t('Advanced - Users that can be referenced (View)'),
105
-           '#collapsible' => TRUE,
106
-           '#collapsed' => !isset($field['advanced_view']) || $field['advanced_view'] == '--',
107
-         );
108
-        if (count($views) > 1) {
109
-          $form['advanced']['advanced_view'] = array(
110
-            '#type' => 'select',
111
-            '#title' => t('View used to select the users'),
112
-            '#options' => $views,
113
-            '#default_value' => isset($field['advanced_view']) ? $field['advanced_view'] : '--',
114
-            '#description' =>  t('<p>Choose the "Views module" view that selects the users that can be referenced.<br />Note:</p>') .
115
-              t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Referenceable Roles" and "Referenceable Status" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate users on user creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate users will be displayed.</li></ul>'),
116
-          );
117
-          $form['advanced']['advanced_view_args'] = array(
118
-            '#type' => 'textfield',
119
-            '#title' => t('View arguments'),
120
-            '#default_value' => isset($field['advanced_view_args']) ? $field['advanced_view_args'] : '',
121
-            '#required' => FALSE,
122
-            '#description' => t('Provide a comma separated list of arguments to pass to the view.'),
123
-          );
124
-        }
125
-        else {
126
-          $form['advanced']['no_view_help'] = array(
127
-            '#value' => t('<p>The list of user that can be referenced can be based on a "Views module" view but no appropriate views were found. <br />Note:</p>') .
128
-              t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Referenceable Roles" and "Referenceable Status" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate users on user creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate users will be displayed.</li></ul>'),
129
-          );
130 99
         }
131 100
       }
132
-      return $form;
133 101
 
134
-    case 'save':
135
-      $settings = array('referenceable_roles', 'referenceable_status');
136
-      if (module_exists('views')) {
137
-        $settings[] = 'advanced_view';
138
-        $settings[] = 'advanced_view_args';
102
+      $form['advanced'] = array(
103
+         '#type' => 'fieldset',
104
+         '#title' => t('Advanced - Users that can be referenced (View)'),
105
+         '#collapsible' => TRUE,
106
+         '#collapsed' => !isset($field['advanced_view']) || $field['advanced_view'] == '--',
107
+       );
108
+      if (count($views) > 1) {
109
+        $form['advanced']['advanced_view'] = array(
110
+          '#type' => 'select',
111
+          '#title' => t('View used to select the users'),
112
+          '#options' => $views,
113
+          '#default_value' => isset($field['advanced_view']) ? $field['advanced_view'] : '--',
114
+          '#description' =>  t('<p>Choose the "Views module" view that selects the users that can be referenced.<br />Note:</p>') .
115
+            t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Referenceable Roles" and "Referenceable Status" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate users on user creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate users will be displayed.</li></ul>'),
116
+        );
117
+        $form['advanced']['advanced_view_args'] = array(
118
+          '#type' => 'textfield',
119
+          '#title' => t('View arguments'),
120
+          '#default_value' => isset($field['advanced_view_args']) ? $field['advanced_view_args'] : '',
121
+          '#required' => FALSE,
122
+          '#description' => t('Provide a comma separated list of arguments to pass to the view.'),
123
+        );
124
+      }
125
+      else {
126
+        $form['advanced']['no_view_help'] = array(
127
+          '#value' => t('<p>The list of user that can be referenced can be based on a "Views module" view but no appropriate views were found. <br />Note:</p>') .
128
+            t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Referenceable Roles" and "Referenceable Status" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate users on user creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate users will be displayed.</li></ul>'),
129
+        );
139 130
       }
140
-      return $settings;
131
+    }
132
+    return $form;
141 133
 
142
-    case 'database columns':
143
-      $columns = array(
144
-        'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'index' => TRUE),
145
-      );
146
-      return $columns;
147
-
148
-    case 'views data':
149
-      $data = content_views_field_views_data($field);
150
-      $db_info = content_database_info($field);
151
-      $table_alias = content_views_tablename($field);
152
-
153
-      // Filter : swap the handler to the 'in' operator.
154
-      $data[$table_alias][$field['field_name'] .'_uid']['filter']['handler'] = 'content_handler_filter_many_to_one';
155
-      // Argument: get the user name for summaries.
156
-      // We need to join a new instance of the users table.
157
-      $data["users_$table_alias"]['table']['join']['node'] = array(
158
-        'table' => 'users',
159
-        'field' => 'uid',
160
-        'left_table' => $table_alias,
161
-        'left_field' => $field['field_name'] .'_uid',
162
-      );
163
-      $data[$table_alias][$field['field_name'] .'_uid']['argument']['handler'] = 'content_handler_argument_reference';
164
-      $data[$table_alias][$field['field_name'] .'_uid']['argument']['name table'] = "users_$table_alias";
165
-      $data[$table_alias][$field['field_name'] .'_uid']['argument']['name field'] = 'name';
166
-      // Relationship: Add a relationship for related user.
167
-      $data[$table_alias][$field['field_name'] .'_uid']['relationship'] = array(
168
-        'base' => 'users',
169
-        'field' => $db_info['columns']['uid']['column'],
170
-        'handler' => 'content_handler_relationship',
171
-        'label' => t($field['widget']['label']),
172
-        'content_field_name' => $field['field_name'],
173
-      );
174
-      return $data;
134
+  case 'save':
135
+    $settings = array('referenceable_roles', 'referenceable_status');
136
+    if (module_exists('views')) {
137
+      $settings[] = 'advanced_view';
138
+      $settings[] = 'advanced_view_args';
139
+    }
140
+    return $settings;
141
+
142
+  case 'database columns':
143
+    $columns = array(
144
+      'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'index' => TRUE),
145
+    );
146
+    return $columns;
147
+
148
+  case 'views data':
149
+    $data = content_views_field_views_data($field);
150
+    $db_info = content_database_info($field);
151
+    $table_alias = content_views_tablename($field);
152
+
153
+    // Filter : swap the handler to the 'in' operator.
154
+    $data[$table_alias][$field['field_name'] .'_uid']['filter']['handler'] = 'content_handler_filter_many_to_one';
155
+    // Argument: get the user name for summaries.
156
+    // We need to join a new instance of the users table.
157
+    $data["users_$table_alias"]['table']['join']['node'] = array(
158
+      'table' => 'users',
159
+      'field' => 'uid',
160
+      'left_table' => $table_alias,
161
+      'left_field' => $field['field_name'] .'_uid',
162
+    );
163
+    $data[$table_alias][$field['field_name'] .'_uid']['argument']['handler'] = 'content_handler_argument_reference';
164
+    $data[$table_alias][$field['field_name'] .'_uid']['argument']['name table'] = "users_$table_alias";
165
+    $data[$table_alias][$field['field_name'] .'_uid']['argument']['name field'] = 'name';
166
+    // Relationship: Add a relationship for related user.
167
+    $data[$table_alias][$field['field_name'] .'_uid']['relationship'] = array(
168
+      'base' => 'users',
169
+      'field' => $db_info['columns']['uid']['column'],
170
+      'handler' => 'content_handler_relationship',
171
+      'label' => t($field['widget']['label']),
172
+      'content_field_name' => $field['field_name'],
173
+    );
174
+    return $data;
175 175
 
176 176
   }
177 177
 }
@@ -181,35 +181,35 @@  discard block
 block discarded – undo
181 181
  */
182 182
 function userreference_field($op, &$node, $field, &$items, $teaser, $page) {
183 183
   switch ($op) {
184
-    case 'validate':
185
-      // Extract uids to check.
186
-      $ids = array();
187
-      foreach ($items as $delta => $item) {
188
-        if (is_array($item) && !empty($item['uid'])) {
189
-          if (is_numeric($item['uid'])) {
190
-            $ids[] = $item['uid'];
191
-          }
192
-          else {
193
-            $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
194
-            if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
195
-            form_set_error($error_element, t('%name: invalid input.', array('%name' => t($field['widget']['label']))));
196
-          }
184
+  case 'validate':
185
+    // Extract uids to check.
186
+    $ids = array();
187
+    foreach ($items as $delta => $item) {
188
+      if (is_array($item) && !empty($item['uid'])) {
189
+        if (is_numeric($item['uid'])) {
190
+          $ids[] = $item['uid'];
191
+        }
192
+        else {
193
+          $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
194
+          if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
195
+          form_set_error($error_element, t('%name: invalid input.', array('%name' => t($field['widget']['label']))));
197 196
         }
198 197
       }
199
-      // Prevent performance hog if there are no ids to check.
200
-      if ($ids) {
201
-        $refs = _userreference_potential_references($field, '', NULL, $ids);
202
-        foreach ($items as $delta => $item) {
203
-          if (is_array($item)) {
204
-            $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
205
-            if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
206
-            if (!empty($item['uid']) && !isset($refs[$item['uid']])) {
207
-              form_set_error($error_element, t('%name: invalid user.', array('%name' => t($field['widget']['label']))));
208
-            }
198
+    }
199
+    // Prevent performance hog if there are no ids to check.
200
+    if ($ids) {
201
+      $refs = _userreference_potential_references($field, '', NULL, $ids);
202
+      foreach ($items as $delta => $item) {
203
+        if (is_array($item)) {
204
+          $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
205
+          if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
206
+          if (!empty($item['uid']) && !isset($refs[$item['uid']])) {
207
+            form_set_error($error_element, t('%name: invalid user.', array('%name' => t($field['widget']['label']))));
209 208
           }
210 209
         }
211 210
       }
212
-      return $items;
211
+    }
212
+    return $items;
213 213
   }
214 214
 }
215 215
 
@@ -345,43 +345,43 @@  discard block
 block discarded – undo
345 345
  */
346 346
 function userreference_widget_settings($op, $widget) {
347 347
   switch ($op) {
348
-    case 'form':
349
-      $form = array();
350
-      $match = isset($widget['autocomplete_match']) ? $widget['autocomplete_match'] : 'contains';
351
-      $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60;
352
-      if ($widget['type'] == 'userreference_autocomplete') {
353
-        $form['autocomplete_match'] = array(
354
-          '#type' => 'select',
355
-          '#title' => t('Autocomplete matching'),
356
-          '#default_value' => $match,
357
-          '#options' => array(
358
-            'starts_with' => t('Starts with'),
359
-            'contains' => t('Contains'),
360
-          ),
361
-          '#description' => t('Select the method used to collect autocomplete suggestions. Note that <em>Contains</em> can cause performance issues on sites with thousands of users.'),
362
-        );
363
-        $form['size'] = array(
364
-          '#type' => 'textfield',
365
-          '#title' => t('Size of textfield'),
366
-          '#default_value' => $size,
367
-          '#element_validate' => array('_element_validate_integer_positive'),
368
-          '#required' => TRUE,
369
-        );
370
-      }
371
-      else {
372
-        $form['autocomplete_match'] = array('#type' => 'hidden', '#value' => $match);
373
-        $form['size'] = array('#type' => 'hidden', '#value' => $size);
374
-      }
375
-      $form['reverse_link'] = array(
376
-        '#type' => 'checkbox',
377
-        '#title' => t('Reverse link'),
378
-        '#default_value' => isset($widget['reverse_link']) ? $widget['reverse_link'] : 0,
379
-        '#description' => t('If selected, a reverse link back to the referencing node will displayed on the referenced user record.'),
348
+  case 'form':
349
+    $form = array();
350
+    $match = isset($widget['autocomplete_match']) ? $widget['autocomplete_match'] : 'contains';
351
+    $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60;
352
+    if ($widget['type'] == 'userreference_autocomplete') {
353
+      $form['autocomplete_match'] = array(
354
+        '#type' => 'select',
355
+        '#title' => t('Autocomplete matching'),
356
+        '#default_value' => $match,
357
+        '#options' => array(
358
+          'starts_with' => t('Starts with'),
359
+          'contains' => t('Contains'),
360
+        ),
361
+        '#description' => t('Select the method used to collect autocomplete suggestions. Note that <em>Contains</em> can cause performance issues on sites with thousands of users.'),
380 362
       );
381
-      return $form;
363
+      $form['size'] = array(
364
+        '#type' => 'textfield',
365
+        '#title' => t('Size of textfield'),
366
+        '#default_value' => $size,
367
+        '#element_validate' => array('_element_validate_integer_positive'),
368
+        '#required' => TRUE,
369
+      );
370
+    }
371
+    else {
372
+      $form['autocomplete_match'] = array('#type' => 'hidden', '#value' => $match);
373
+      $form['size'] = array('#type' => 'hidden', '#value' => $size);
374
+    }
375
+    $form['reverse_link'] = array(
376
+      '#type' => 'checkbox',
377
+      '#title' => t('Reverse link'),
378
+      '#default_value' => isset($widget['reverse_link']) ? $widget['reverse_link'] : 0,
379
+      '#description' => t('If selected, a reverse link back to the referencing node will displayed on the referenced user record.'),
380
+    );
381
+    return $form;
382 382
 
383
-    case 'save':
384
-      return array('autocomplete_match', 'size', 'reverse_link');
383
+  case 'save':
384
+    return array('autocomplete_match', 'size', 'reverse_link');
385 385
   }
386 386
 }
387 387
 
@@ -418,27 +418,27 @@  discard block
 block discarded – undo
418 418
  */
419 419
 function userreference_widget(&$form, &$form_state, $field, $items, $delta = 0) {
420 420
   switch ($field['widget']['type']) {
421
-    case 'userreference_select':
422
-      $element = array(
423
-        '#type' => 'userreference_select',
424
-        '#default_value' => $items,
425
-      );
426
-      break;
421
+  case 'userreference_select':
422
+    $element = array(
423
+      '#type' => 'userreference_select',
424
+      '#default_value' => $items,
425
+    );
426
+    break;
427 427
 
428
-    case 'userreference_buttons':
429
-      $element = array(
430
-        '#type' => 'userreference_buttons',
431
-        '#default_value' => $items,
432
-      );
433
-      break;
428
+  case 'userreference_buttons':
429
+    $element = array(
430
+      '#type' => 'userreference_buttons',
431
+      '#default_value' => $items,
432
+    );
433
+    break;
434 434
 
435
-    case 'userreference_autocomplete':
436
-      $element = array(
437
-        '#type' => 'userreference_autocomplete',
438
-        '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,
439
-        '#value_callback' => 'userreference_autocomplete_value',
440
-      );
441
-      break;
435
+  case 'userreference_autocomplete':
436
+    $element = array(
437
+      '#type' => 'userreference_autocomplete',
438
+      '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,
439
+      '#value_callback' => 'userreference_autocomplete_value',
440
+    );
441
+    break;
442 442
   }
443 443
   return $element;
444 444
 }
@@ -845,67 +845,67 @@  discard block
 block discarded – undo
845 845
  */
846 846
 function userreference_user($type, &$edit, &$account) {
847 847
   switch ($type) {
848
-    case 'load':
849
-      // Only add links if we are on the user 'view' page.
850
-      if (arg(0) != 'user' || arg(2)) {
851
-        return;
852
-      }
853
-      // find CCK userreference field tables
854
-      // search through them for matching user ids and load those nodes
855
-      $additions = array();
856
-      $types = content_types();
857
-
858
-      // Find the table and columns to search through, if the same
859
-      // table comes up in more than one content type, we only need
860
-      // to search it once.
861
-      $search_tables = array();
862
-      foreach ($types as $type_name => $type) {
863
-        foreach ($type['fields'] as $field) {
864
-          // Only add tables when reverse link has been selected.
865
-          if ($field['type'] == 'userreference' && !empty($field['widget']['reverse_link'])) {
866
-            $db_info = content_database_info($field);
867
-            $search_tables[$db_info['table']][] = $db_info['columns']['uid']['column'];
868
-          }
848
+  case 'load':
849
+    // Only add links if we are on the user 'view' page.
850
+    if (arg(0) != 'user' || arg(2)) {
851
+      return;
852
+    }
853
+    // find CCK userreference field tables
854
+    // search through them for matching user ids and load those nodes
855
+    $additions = array();
856
+    $types = content_types();
857
+
858
+    // Find the table and columns to search through, if the same
859
+    // table comes up in more than one content type, we only need
860
+    // to search it once.
861
+    $search_tables = array();
862
+    foreach ($types as $type_name => $type) {
863
+      foreach ($type['fields'] as $field) {
864
+        // Only add tables when reverse link has been selected.
865
+        if ($field['type'] == 'userreference' && !empty($field['widget']['reverse_link'])) {
866
+          $db_info = content_database_info($field);
867
+          $search_tables[$db_info['table']][] = $db_info['columns']['uid']['column'];
869 868
         }
870 869
       }
871
-      foreach ($search_tables as $table => $columns) {
872
-        foreach ($columns as $column) {
873
-          $ids = db_query(db_rewrite_sql("SELECT DISTINCT(n.nid), n.title, n.type FROM {node} n LEFT JOIN {". $table ."} f ON n.vid = f.vid WHERE f.". $column ."=". $account->uid. " AND n.status = 1"));
874
-          while ($data = db_fetch_object($ids)) {
875
-            $additions[$data->type][$data->nid] = $data->title;
876
-          }
870
+    }
871
+    foreach ($search_tables as $table => $columns) {
872
+      foreach ($columns as $column) {
873
+        $ids = db_query(db_rewrite_sql("SELECT DISTINCT(n.nid), n.title, n.type FROM {node} n LEFT JOIN {". $table ."} f ON n.vid = f.vid WHERE f.". $column ."=". $account->uid. " AND n.status = 1"));
874
+        while ($data = db_fetch_object($ids)) {
875
+          $additions[$data->type][$data->nid] = $data->title;
877 876
         }
878 877
       }
879
-      $account->userreference = $additions;
880
-      break;
878
+    }
879
+    $account->userreference = $additions;
880
+    break;
881 881
 
882
-    case 'view':
883
-      if (!empty($account->userreference)) {
884
-        $node_types = content_types();
885
-        $additions = array();
886
-        $values = array();
887
-        foreach ($account->userreference as $node_type => $nodes) {
888
-          foreach ($nodes as $nid => $title) {
889
-            $values[$node_type][] = l($title, 'node/'. $nid);
890
-          }
891
-          if (isset($values[$node_type])) {
892
-            $additions[] = array(
893
-              '#type' => 'user_profile_item',
894
-              '#title' => check_plain($node_types[$node_type]['name']),
895
-              '#value' => theme('item_list', $values[$node_type]),
896
-            );
897
-          }
882
+  case 'view':
883
+    if (!empty($account->userreference)) {
884
+      $node_types = content_types();
885
+      $additions = array();
886
+      $values = array();
887
+      foreach ($account->userreference as $node_type => $nodes) {
888
+        foreach ($nodes as $nid => $title) {
889
+          $values[$node_type][] = l($title, 'node/'. $nid);
898 890
         }
899
-        if ($additions) {
900
-          $account->content['userreference'] = $additions + array(
901
-            '#type' => 'user_profile_category',
902
-            '#attributes' => array('class' => 'user-member'),
903
-            '#title' => t('Related content'),
904
-            '#weight' => 10,
891
+        if (isset($values[$node_type])) {
892
+          $additions[] = array(
893
+            '#type' => 'user_profile_item',
894
+            '#title' => check_plain($node_types[$node_type]['name']),
895
+            '#value' => theme('item_list', $values[$node_type]),
905 896
           );
906 897
         }
907 898
       }
908
-      break;
899
+      if ($additions) {
900
+        $account->content['userreference'] = $additions + array(
901
+          '#type' => 'user_profile_category',
902
+          '#attributes' => array('class' => 'user-member'),
903
+          '#title' => t('Related content'),
904
+          '#weight' => 10,
905
+        );
906
+      }
907
+    }
908
+    break;
909 909
   }
910 910
 }
911 911
 
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/cck/theme/theme.inc 1 patch
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,15 +53,15 @@
 block discarded – undo
53 53
     $element['hidden_name']['#attributes']['class'] = 'field-name';
54 54
     // Add target classes for the update selects behavior.
55 55
     switch ($element['#row_type']) {
56
-      case 'add_new_field':
57
-        $element['type']['#attributes']['class'] = 'content-field-type-select';
58
-        $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
59
-        break;
60
-      case 'add_existing_field':
61
-        $element['field_name']['#attributes']['class'] = 'content-field-select';
62
-        $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
63
-        $element['label']['#attributes']['class'] = 'content-label-textfield';
64
-        break;
56
+    case 'add_new_field':
57
+      $element['type']['#attributes']['class'] = 'content-field-type-select';
58
+      $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
59
+      break;
60
+    case 'add_existing_field':
61
+      $element['field_name']['#attributes']['class'] = 'content-field-select';
62
+      $element['widget_type']['#attributes']['class'] = 'content-widget-type-select';
63
+      $element['label']['#attributes']['class'] = 'content-label-textfield';
64
+      break;
65 65
     }
66 66
     foreach (element_children($element) as $child) {
67 67
       $row->{$child} = drupal_render($element[$child]);
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/cck/content.module 1 patch
Switch Indentation   +340 added lines, -340 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@  discard block
 block discarded – undo
17 17
 
18 18
 function content_help($path, $arg) {
19 19
   switch ($path) {
20
-    case 'admin/help#content':
21
-      $output = '<p>'. t('The content module, a required component of the Content Construction Kit (CCK), allows administrators to associate custom fields with content types. In Drupal, content types are used to define the characteristics of a post, including the title and description of the fields displayed on its add and edit pages. Using the content module (and the other helper modules included in CCK), custom fields beyond the default "Title" and "Body" may be added. CCK features are accessible through tabs on the <a href="@content-types">content types administration page</a>. (See the <a href="@node-help">node module help page</a> for more information about content types.)', array('@content-types' => url('admin/content/types'), '@node-help' => url('admin/help/node'))) .'</p>';
22
-      $output .= '<p>'. t('When adding a custom field to a content type, you determine its type (whether it will contain text, numbers, or references to other objects) and how it will be displayed (either as a text field or area, a select box, checkbox, radio button, or autocompleting field). A field may have multiple values (i.e., a "person" may have multiple e-mail addresses) or a single value (i.e., an "employee" has a single employee identification number). As you add and edit fields, CCK automatically adjusts the structure of the database as necessary. CCK also provides a number of other features, including intelligent caching for your custom data, an import and export facility for content type definitions, and integration with other contributed modules.') .'</p>';
23
-      $output .= '<p>'. t('Custom field types are provided by a set of optional modules included with CCK (each module provides a different type). The <a href="@modules">modules page</a> allows you to enable or disable CCK components. A default installation of CCK includes:', array('@modules' => url('admin/build/modules'))) .'</p>';
24
-      $output .= '<ul>';
25
-      $output .= '<li>'. t('<em>number</em>, which adds numeric field types, in integer, decimal or floating point form. You may define a set of allowed inputs, or specify an allowable range of values. A variety of common formats for displaying numeric data are available.') .'</li>';
26
-      $output .= '<li>'. t("<em>text</em>, which adds text field types. A text field may contain plain text only, or optionally, may use Drupal's input format filters to securely manage rich text input. Text input fields may be either a single line (text field), multiple lines (text area), or for greater input control, a select box, checkbox, or radio buttons. If desired, CCK can validate the input to a set of allowed values.") .'</li>';
27
-      $output .= '<li>'. t('<em>nodereference</em>, which creates custom references between Drupal nodes. By adding a <em>nodereference</em> field and two different content types, for instance, you can easily create complex parent/child relationships between data (multiple "employee" nodes may contain a <em>nodereference</em> field linking to an "employer" node).') .'</li>';
28
-      $output .= '<li>'. t('<em>userreference</em>, which creates custom references to your sites\' user accounts. By adding a <em>userreference</em> field, you can create complex relationships between your site\'s users and posts. To track user involvement in a post beyond Drupal\'s standard <em>Authored by</em> field, for instance, add a <em>userreference</em> field named "Edited by" to a content type to store a link to an editor\'s user account page.') .'</li>';
29
-      $output .= '<li>'. t('<em>fieldgroup</em>, which creates collapsible fieldsets to hold a group of related fields. A fieldset may either be open or closed by default. The order of your fieldsets, and the order of fields within a fieldset, is managed via a drag-and-drop interface provided by content module.') .'</li>';
30
-      $output .= '</ul>';
31
-      $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@handbook-cck">CCK</a> or the <a href="@project-cck">CCK project page</a>.', array('@handbook-cck' => 'http://drupal.org/handbook/modules/cck', '@project-cck' => 'http://drupal.org/project/cck')) .'</p>';
32
-      return $output;
20
+  case 'admin/help#content':
21
+    $output = '<p>'. t('The content module, a required component of the Content Construction Kit (CCK), allows administrators to associate custom fields with content types. In Drupal, content types are used to define the characteristics of a post, including the title and description of the fields displayed on its add and edit pages. Using the content module (and the other helper modules included in CCK), custom fields beyond the default "Title" and "Body" may be added. CCK features are accessible through tabs on the <a href="@content-types">content types administration page</a>. (See the <a href="@node-help">node module help page</a> for more information about content types.)', array('@content-types' => url('admin/content/types'), '@node-help' => url('admin/help/node'))) .'</p>';
22
+    $output .= '<p>'. t('When adding a custom field to a content type, you determine its type (whether it will contain text, numbers, or references to other objects) and how it will be displayed (either as a text field or area, a select box, checkbox, radio button, or autocompleting field). A field may have multiple values (i.e., a "person" may have multiple e-mail addresses) or a single value (i.e., an "employee" has a single employee identification number). As you add and edit fields, CCK automatically adjusts the structure of the database as necessary. CCK also provides a number of other features, including intelligent caching for your custom data, an import and export facility for content type definitions, and integration with other contributed modules.') .'</p>';
23
+    $output .= '<p>'. t('Custom field types are provided by a set of optional modules included with CCK (each module provides a different type). The <a href="@modules">modules page</a> allows you to enable or disable CCK components. A default installation of CCK includes:', array('@modules' => url('admin/build/modules'))) .'</p>';
24
+    $output .= '<ul>';
25
+    $output .= '<li>'. t('<em>number</em>, which adds numeric field types, in integer, decimal or floating point form. You may define a set of allowed inputs, or specify an allowable range of values. A variety of common formats for displaying numeric data are available.') .'</li>';
26
+    $output .= '<li>'. t("<em>text</em>, which adds text field types. A text field may contain plain text only, or optionally, may use Drupal's input format filters to securely manage rich text input. Text input fields may be either a single line (text field), multiple lines (text area), or for greater input control, a select box, checkbox, or radio buttons. If desired, CCK can validate the input to a set of allowed values.") .'</li>';
27
+    $output .= '<li>'. t('<em>nodereference</em>, which creates custom references between Drupal nodes. By adding a <em>nodereference</em> field and two different content types, for instance, you can easily create complex parent/child relationships between data (multiple "employee" nodes may contain a <em>nodereference</em> field linking to an "employer" node).') .'</li>';
28
+    $output .= '<li>'. t('<em>userreference</em>, which creates custom references to your sites\' user accounts. By adding a <em>userreference</em> field, you can create complex relationships between your site\'s users and posts. To track user involvement in a post beyond Drupal\'s standard <em>Authored by</em> field, for instance, add a <em>userreference</em> field named "Edited by" to a content type to store a link to an editor\'s user account page.') .'</li>';
29
+    $output .= '<li>'. t('<em>fieldgroup</em>, which creates collapsible fieldsets to hold a group of related fields. A fieldset may either be open or closed by default. The order of your fieldsets, and the order of fields within a fieldset, is managed via a drag-and-drop interface provided by content module.') .'</li>';
30
+    $output .= '</ul>';
31
+    $output .= '<p>'. t('For more information, see the online handbook entry for <a href="@handbook-cck">CCK</a> or the <a href="@project-cck">CCK project page</a>.', array('@handbook-cck' => 'http://drupal.org/handbook/modules/cck', '@project-cck' => 'http://drupal.org/project/cck')) .'</p>';
32
+    return $output;
33 33
   }
34 34
 }
35 35
 
@@ -553,27 +553,27 @@  discard block
 block discarded – undo
553 553
  */
554 554
 function content_notify($op, $module) {
555 555
   switch ($op) {
556
-    case 'install':
557
-      content_clear_type_cache();
558
-      break;
559
-    case 'uninstall':
560
-      module_load_include('inc', 'content', 'includes/content.crud');
561
-      content_module_delete($module);
562
-      break;
563
-    case 'enable':
564
-      content_associate_fields($module);
565
-      content_clear_type_cache();
566
-      break;
567
-    case 'disable':
568
-      // When CCK modules are disabled before content module's update is run
569
-      // to add the active column, we can't do this.
570
-      if (variable_get('content_schema_version', -1) < 6007) {
571
-        return FALSE;
572
-      }
573
-      db_query("UPDATE {". content_field_tablename() ."} SET active=0 WHERE module='%s'", $module);
574
-      db_query("UPDATE {". content_instance_tablename() ."} SET widget_active=0 WHERE widget_module='%s'", $module);
575
-      content_clear_type_cache(TRUE);
576
-      break;
556
+  case 'install':
557
+    content_clear_type_cache();
558
+    break;
559
+  case 'uninstall':
560
+    module_load_include('inc', 'content', 'includes/content.crud');
561
+    content_module_delete($module);
562
+    break;
563
+  case 'enable':
564
+    content_associate_fields($module);
565
+    content_clear_type_cache();
566
+    break;
567
+  case 'disable':
568
+    // When CCK modules are disabled before content module's update is run
569
+    // to add the active column, we can't do this.
570
+    if (variable_get('content_schema_version', -1) < 6007) {
571
+      return FALSE;
572
+    }
573
+    db_query("UPDATE {". content_field_tablename() ."} SET active=0 WHERE module='%s'", $module);
574
+    db_query("UPDATE {". content_instance_tablename() ."} SET widget_active=0 WHERE widget_module='%s'", $module);
575
+    content_clear_type_cache(TRUE);
576
+    break;
577 577
   }
578 578
 }
579 579
 
@@ -685,38 +685,53 @@  discard block
 block discarded – undo
685 685
  */
686 686
 function content_field($op, &$node, $field, &$items, $teaser, $page) {
687 687
   switch ($op) {
688
-    case 'validate':
689
-      // TODO: here we could validate that the number of multiple data is correct ?
690
-      // We're controlling the number of fields to fill out and saving empty
691
-      // ones if a specified number is requested, so no reason to do any validation
692
-      // here right now, but if later create a method to indicate whether
693
-      // 'required' means all values must be filled out, we can come back
694
-      // here and check that they're not empty.
695
-      break;
696
-
697
-    case 'presave':
698
-      if (!empty($node->devel_generate)) {
699
-        include_once('./'. drupal_get_path('module', 'content') .'/includes/content.devel.inc');
700
-        content_generate_fields($node, $field);
701
-        $items = $node->{$field['field_name']};
702
-      }
688
+  case 'validate':
689
+    // TODO: here we could validate that the number of multiple data is correct ?
690
+    // We're controlling the number of fields to fill out and saving empty
691
+    // ones if a specified number is requested, so no reason to do any validation
692
+    // here right now, but if later create a method to indicate whether
693
+    // 'required' means all values must be filled out, we can come back
694
+    // here and check that they're not empty.
695
+    break;
696
+
697
+  case 'presave':
698
+    if (!empty($node->devel_generate)) {
699
+      include_once('./'. drupal_get_path('module', 'content') .'/includes/content.devel.inc');
700
+      content_generate_fields($node, $field);
701
+      $items = $node->{$field['field_name']};
702
+    }
703 703
 
704
-      // Manual node_save calls might not have all fields filled in.
705
-      // On node insert, we need to make sure all tables get at least an empty
706
-      // record, or subsequent edits, using drupal_write_record() in update mode,
707
-      // won't insert any data.
708
-      // Missing fields on node update are handled in content_storage().
709
-      if (empty($items) && !isset($node->nid)) {
710
-        foreach (array_keys($field['columns']) as $column) {
711
-          $items[0][$column] = NULL;
712
-        }
713
-        $node->$field['field_name'] = $items;
704
+    // Manual node_save calls might not have all fields filled in.
705
+    // On node insert, we need to make sure all tables get at least an empty
706
+    // record, or subsequent edits, using drupal_write_record() in update mode,
707
+    // won't insert any data.
708
+    // Missing fields on node update are handled in content_storage().
709
+    if (empty($items) && !isset($node->nid)) {
710
+      foreach (array_keys($field['columns']) as $column) {
711
+        $items[0][$column] = NULL;
714 712
       }
713
+      $node->$field['field_name'] = $items;
714
+    }
715 715
 
716
-      // If there was an AHAH add more button in this field, don't save it.
717
-      // TODO: is it still needed ?
718
-      unset($items[$field['field_name'] .'_add_more']);
716
+    // If there was an AHAH add more button in this field, don't save it.
717
+    // TODO: is it still needed ?
718
+    unset($items[$field['field_name'] .'_add_more']);
719
+
720
+    if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
721
+      // Reorder items to account for drag-n-drop reordering.
722
+      $items = _content_sort_items($field, $items);
723
+    }
724
+
725
+    // Filter out empty values.
726
+    $items = content_set_empty($field, $items);
719 727
 
728
+    break;
729
+
730
+  case 'view':
731
+    $addition = array();
732
+
733
+    // Previewed nodes bypass the 'presave' op, so we need to some massaging.
734
+    if ($node->build_mode == NODE_BUILD_PREVIEW && content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
720 735
       if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
721 736
         // Reorder items to account for drag-n-drop reordering.
722 737
         $items = _content_sort_items($field, $items);
@@ -724,166 +739,151 @@  discard block
 block discarded – undo
724 739
 
725 740
       // Filter out empty values.
726 741
       $items = content_set_empty($field, $items);
742
+    }
727 743
 
728
-      break;
729
-
730
-    case 'view':
731
-      $addition = array();
744
+    // NODE_BUILD_NORMAL is 0, and ('whatever' == 0) is TRUE, so we need a ===.
745
+    if ($node->build_mode === NODE_BUILD_NORMAL || $node->build_mode == NODE_BUILD_PREVIEW) {
746
+      $context = $teaser ? 'teaser' : 'full';
747
+    }
748
+    else {
749
+      $context = $node->build_mode;
750
+    }
751
+    // The field may be missing info for $contexts added by modules
752
+    // enabled after the field was last edited.
753
+    $formatter_name = isset($field['display_settings'][$context]) && isset($field['display_settings'][$context]['format']) ? $field['display_settings'][$context]['format'] : 'default';
754
+    if ($formatter = _content_get_formatter($formatter_name, $field['type'])) {
755
+      $theme = $formatter['module'] .'_formatter_'. $formatter_name;
756
+      $single = (content_handle('formatter', 'multiple values', $formatter) == CONTENT_HANDLE_CORE);
757
+
758
+      $label_display = isset($field['display_settings']['label']['format']) ? $field['display_settings']['label']['format'] : 'above';
759
+      // Do not include field labels when indexing content.
760
+      if ($context == NODE_BUILD_SEARCH_INDEX) {
761
+        $label_display = 'hidden';
762
+      }
732 763
 
733
-      // Previewed nodes bypass the 'presave' op, so we need to some massaging.
734
-      if ($node->build_mode == NODE_BUILD_PREVIEW && content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
735
-        if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
736
-          // Reorder items to account for drag-n-drop reordering.
737
-          $items = _content_sort_items($field, $items);
738
-        }
764
+      $element = array(
765
+        '#type' => 'content_field',
766
+        '#title' => check_plain(t($field['widget']['label'])),
767
+        '#field_name' => $field['field_name'],
768
+        '#access' => $formatter_name != 'hidden' && content_access('view', $field, NULL, $node),
769
+        '#label_display' => $label_display,
770
+        '#node' => $node,
771
+        '#teaser' => $teaser,
772
+        '#page' => $page,
773
+        '#context' => $context,
774
+        '#single' => $single,
775
+        'items' => array(),
776
+      );
739 777
 
740
-        // Filter out empty values.
741
-        $items = content_set_empty($field, $items);
778
+      // Fill-in items.
779
+      foreach ($items as $delta => $item) {
780
+        $element['items'][$delta] = array(
781
+          '#item' => $item,
782
+          '#weight' => $delta,
783
+        );
742 784
       }
743 785
 
744
-      // NODE_BUILD_NORMAL is 0, and ('whatever' == 0) is TRUE, so we need a ===.
745
-      if ($node->build_mode === NODE_BUILD_NORMAL || $node->build_mode == NODE_BUILD_PREVIEW) {
746
-        $context = $teaser ? 'teaser' : 'full';
786
+      // Append formatter information either on each item ('single-value' formatter)
787
+      // or at the upper 'items' level ('multiple-value' formatter)
788
+      $format_info = array(
789
+        '#theme' => $theme,
790
+        '#field_name' => $field['field_name'],
791
+        '#type_name' => $node->type,
792
+        '#formatter' => $formatter_name,
793
+        '#node' => $node,
794
+      );
795
+      if ($single) {
796
+        foreach ($items as $delta => $item) {
797
+          $element['items'][$delta] += $format_info;
798
+          $element['items'][$delta]['#item']['#delta'] = $delta;
799
+        }
747 800
       }
748 801
       else {
749
-        $context = $node->build_mode;
802
+        $element['items'] += $format_info;
750 803
       }
751
-      // The field may be missing info for $contexts added by modules
752
-      // enabled after the field was last edited.
753
-      $formatter_name = isset($field['display_settings'][$context]) && isset($field['display_settings'][$context]['format']) ? $field['display_settings'][$context]['format'] : 'default';
754
-      if ($formatter = _content_get_formatter($formatter_name, $field['type'])) {
755
-        $theme = $formatter['module'] .'_formatter_'. $formatter_name;
756
-        $single = (content_handle('formatter', 'multiple values', $formatter) == CONTENT_HANDLE_CORE);
757
-
758
-        $label_display = isset($field['display_settings']['label']['format']) ? $field['display_settings']['label']['format'] : 'above';
759
-        // Do not include field labels when indexing content.
760
-        if ($context == NODE_BUILD_SEARCH_INDEX) {
761
-          $label_display = 'hidden';
762
-        }
763 804
 
764
-        $element = array(
765
-          '#type' => 'content_field',
766
-          '#title' => check_plain(t($field['widget']['label'])),
767
-          '#field_name' => $field['field_name'],
768
-          '#access' => $formatter_name != 'hidden' && content_access('view', $field, NULL, $node),
769
-          '#label_display' => $label_display,
770
-          '#node' => $node,
771
-          '#teaser' => $teaser,
772
-          '#page' => $page,
773
-          '#context' => $context,
774
-          '#single' => $single,
775
-          'items' => array(),
776
-        );
805
+      // The wrapper lets us get the themed output for the whole field
806
+      // to populate the $FIELD_NAME_rendered variable for node templates,
807
+      // and hide it from the $content variable if needed.
808
+      // See 'preprocess_node' op and theme_content_field_wrapper()?
809
+      $wrapper = array(
810
+        'field' => $element,
811
+        '#weight' => $field['widget']['weight'],
812
+        '#post_render' => array('content_field_wrapper_post_render'),
813
+        '#field_name' => $field['field_name'],
814
+        '#type_name' => $node->type,
815
+        '#context' => $context,
816
+      );
777 817
 
778
-        // Fill-in items.
779
-        foreach ($items as $delta => $item) {
780
-          $element['items'][$delta] = array(
781
-            '#item' => $item,
782
-            '#weight' => $delta,
783
-          );
784
-        }
818
+      $addition = array($field['field_name'] => $wrapper);
819
+    }
820
+    return $addition;
821
+
822
+  case 'alter':
823
+    // Add back the formatted values in the 'view' element,
824
+    // so that tokens and node templates can use it.
825
+    // Note: Doing this in 'preprocess_node' breaks token integration.
826
+
827
+    // The location of the field's rendered output depends on whether the
828
+    // field is in a fieldgroup or not.
829
+    $wrapper = NULL;
830
+    if (isset($node->content[$field['field_name']])) {
831
+      $wrapper = $node->content[$field['field_name']];
832
+    }
833
+    elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) {
834
+      $wrapper = $node->content[$group_name]['group'][$field['field_name']];
835
+    }
785 836
 
786
-        // Append formatter information either on each item ('single-value' formatter)
787
-        // or at the upper 'items' level ('multiple-value' formatter)
788
-        $format_info = array(
789
-          '#theme' => $theme,
790
-          '#field_name' => $field['field_name'],
791
-          '#type_name' => $node->type,
792
-          '#formatter' => $formatter_name,
793
-          '#node' => $node,
794
-        );
795
-        if ($single) {
796
-          foreach ($items as $delta => $item) {
797
-            $element['items'][$delta] += $format_info;
798
-            $element['items'][$delta]['#item']['#delta'] = $delta;
837
+    if ($wrapper) {
838
+      $element = $wrapper['field'];
839
+      // '#single' is not set if the field is hidden or inaccessible.
840
+      if (isset($element['#single'])) {
841
+        if (!empty($element['#single'])) {
842
+          // Single value formatter.
843
+          foreach (element_children($element['items']) as $delta) {
844
+            // '#chilren' is not set if the field is empty.
845
+            $items[$delta]['view'] = isset($element['items'][$delta]['#children']) ? $element['items'][$delta]['#children'] : '';
799 846
           }
800 847
         }
801
-        else {
802
-          $element['items'] += $format_info;
848
+        elseif (isset($element['items']['#children']))  {
849
+          // Multiple values formatter.
850
+          $items[0]['view'] = $element['items']['#children'];
803 851
         }
804
-
805
-        // The wrapper lets us get the themed output for the whole field
806
-        // to populate the $FIELD_NAME_rendered variable for node templates,
807
-        // and hide it from the $content variable if needed.
808
-        // See 'preprocess_node' op and theme_content_field_wrapper()?
809
-        $wrapper = array(
810
-          'field' => $element,
811
-          '#weight' => $field['widget']['weight'],
812
-          '#post_render' => array('content_field_wrapper_post_render'),
813
-          '#field_name' => $field['field_name'],
814
-          '#type_name' => $node->type,
815
-          '#context' => $context,
816
-        );
817
-
818
-        $addition = array($field['field_name'] => $wrapper);
819
-      }
820
-      return $addition;
821
-
822
-    case 'alter':
823
-      // Add back the formatted values in the 'view' element,
824
-      // so that tokens and node templates can use it.
825
-      // Note: Doing this in 'preprocess_node' breaks token integration.
826
-
827
-      // The location of the field's rendered output depends on whether the
828
-      // field is in a fieldgroup or not.
829
-      $wrapper = NULL;
830
-      if (isset($node->content[$field['field_name']])) {
831
-        $wrapper = $node->content[$field['field_name']];
832 852
       }
833
-      elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) {
834
-        $wrapper = $node->content[$group_name]['group'][$field['field_name']];
835
-      }
836
-
837
-      if ($wrapper) {
838
-        $element = $wrapper['field'];
839
-        // '#single' is not set if the field is hidden or inaccessible.
840
-        if (isset($element['#single'])) {
841
-          if (!empty($element['#single'])) {
842
-            // Single value formatter.
843
-            foreach (element_children($element['items']) as $delta) {
844
-              // '#chilren' is not set if the field is empty.
845
-              $items[$delta]['view'] = isset($element['items'][$delta]['#children']) ? $element['items'][$delta]['#children'] : '';
846
-            }
847
-          }
848
-          elseif (isset($element['items']['#children']))  {
849
-            // Multiple values formatter.
850
-            $items[0]['view'] = $element['items']['#children'];
851
-          }
852
-        }
853
-        else {
854
-          // Hidden or inaccessible field.
855
-          $items[0]['view'] = '';
856
-        }
853
+      else {
854
+        // Hidden or inaccessible field.
855
+        $items[0]['view'] = '';
857 856
       }
858
-      break;
857
+    }
858
+    break;
859 859
 
860
-    case 'preprocess_node':
861
-      // Add $FIELD_NAME_rendered variables.
862
-      $addition = array();
860
+  case 'preprocess_node':
861
+    // Add $FIELD_NAME_rendered variables.
862
+    $addition = array();
863 863
 
864
-      // The location of the field's rendered output depends on whether the
865
-      // field is in a fieldgroup or not.
866
-      $wrapper = NULL;
867
-      if (isset($node->content[$field['field_name']])) {
868
-        $wrapper = $node->content[$field['field_name']];
869
-      }
870
-      elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) {
871
-        $wrapper = $node->content[$group_name]['group'][$field['field_name']];
872
-      }
864
+    // The location of the field's rendered output depends on whether the
865
+    // field is in a fieldgroup or not.
866
+    $wrapper = NULL;
867
+    if (isset($node->content[$field['field_name']])) {
868
+      $wrapper = $node->content[$field['field_name']];
869
+    }
870
+    elseif (module_exists('fieldgroup') && ($group_name = fieldgroup_get_group($node->type, $field['field_name'])) && isset($node->content[$group_name]['group'][$field['field_name']])) {
871
+      $wrapper = $node->content[$group_name]['group'][$field['field_name']];
872
+    }
873 873
 
874
-      if ($wrapper) {
875
-        // '#chilren' is not set if the field is empty.
876
-        $addition[$field['field_name'] .'_rendered'] = isset($wrapper['#children']) ? $wrapper['#children'] : '';
877
-      }
874
+    if ($wrapper) {
875
+      // '#chilren' is not set if the field is empty.
876
+      $addition[$field['field_name'] .'_rendered'] = isset($wrapper['#children']) ? $wrapper['#children'] : '';
877
+    }
878 878
 
879
-      return $addition;
879
+    return $addition;
880 880
 
881
-    case 'prepare translation':
882
-      $addition = array();
883
-      if (isset($node->translation_source->$field['field_name'])) {
884
-        $addition[$field['field_name']] = $node->translation_source->$field['field_name'];
885
-      }
886
-      return $addition;
881
+  case 'prepare translation':
882
+    $addition = array();
883
+    if (isset($node->translation_source->$field['field_name'])) {
884
+      $addition[$field['field_name']] = $node->translation_source->$field['field_name'];
885
+    }
886
+    return $addition;
887 887
   }
888 888
 }
889 889
 
@@ -974,122 +974,122 @@  discard block
 block discarded – undo
974 974
   $type = content_types($type_name);
975 975
 
976 976
   switch ($op) {
977
-    case 'load':
978
-      // OPTIMIZE: load all non multiple fields in a single JOIN query ?
979
-      // warning: 61-join limit in MySQL ?
980
-      $additions = array();
981
-      // For each table used by this content type,
982
-      foreach ($type['tables'] as $table) {
983
-        $schema = drupal_get_schema($table);
984
-        // The per-type table might not have any fields actually stored in it.
985
-        if (!$schema['content fields']) {
986
-          continue;
987
-        }
988
-        $query = 'SELECT * FROM {'. $table .'} WHERE vid = %d';
989
-
990
-        // If we're loading a table for a multiple field,
991
-        // we fetch all rows (values) ordered by delta,
992
-        // else we only fetch one row.
993
-        $result = isset($schema['fields']['delta']) ? db_query($query .' ORDER BY delta', $node->vid) : db_query_range($query, $node->vid, 0, 1);
994
-
995
-        // For each table row, populate the fields.
996
-        while ($row = db_fetch_array($result)) {
997
-          // For each field stored in the table, add the field item.
998
-          foreach ($schema['content fields'] as $field_name) {
999
-            $item = array();
1000
-            $field = content_fields($field_name, $type_name);
1001
-            $db_info = content_database_info($field);
1002
-            // For each column declared by the field, populate the item.
1003
-            foreach ($db_info['columns'] as $column => $attributes) {
1004
-              $item[$column] = $row[$attributes['column']];
1005
-            }
1006
-
1007
-            // Add the item to the field values for the node.
1008
-            if (!isset($additions[$field_name])) {
1009
-              $additions[$field_name] = array();
1010
-            }
1011
-            $additions[$field_name][] = $item;
1012
-          }
1013
-        }
977
+  case 'load':
978
+    // OPTIMIZE: load all non multiple fields in a single JOIN query ?
979
+    // warning: 61-join limit in MySQL ?
980
+    $additions = array();
981
+    // For each table used by this content type,
982
+    foreach ($type['tables'] as $table) {
983
+      $schema = drupal_get_schema($table);
984
+      // The per-type table might not have any fields actually stored in it.
985
+      if (!$schema['content fields']) {
986
+        continue;
1014 987
       }
1015
-      return $additions;
988
+      $query = 'SELECT * FROM {'. $table .'} WHERE vid = %d';
989
+
990
+      // If we're loading a table for a multiple field,
991
+      // we fetch all rows (values) ordered by delta,
992
+      // else we only fetch one row.
993
+      $result = isset($schema['fields']['delta']) ? db_query($query .' ORDER BY delta', $node->vid) : db_query_range($query, $node->vid, 0, 1);
1016 994
 
1017
-    case 'insert':
1018
-    case 'update':
1019
-      foreach ($type['tables'] as $table) {
1020
-        $schema = drupal_get_schema($table);
1021
-        $record = array();
995
+      // For each table row, populate the fields.
996
+      while ($row = db_fetch_array($result)) {
997
+        // For each field stored in the table, add the field item.
1022 998
         foreach ($schema['content fields'] as $field_name) {
1023
-          if (isset($node->$field_name)) {
1024
-            $field = content_fields($field_name, $type_name);
1025
-            // Multiple fields need specific handling, we'll deal with them later on.
1026
-            if ($field['multiple']) {
1027
-              continue;
1028
-            }
1029
-            $db_info = content_database_info($field);
1030
-            foreach ($db_info['columns'] as $column => $attributes) {
1031
-              $record[$attributes['column']] = $node->{$field_name}[0][$column];
1032
-            }
999
+          $item = array();
1000
+          $field = content_fields($field_name, $type_name);
1001
+          $db_info = content_database_info($field);
1002
+          // For each column declared by the field, populate the item.
1003
+          foreach ($db_info['columns'] as $column => $attributes) {
1004
+            $item[$column] = $row[$attributes['column']];
1033 1005
           }
1006
+
1007
+          // Add the item to the field values for the node.
1008
+          if (!isset($additions[$field_name])) {
1009
+            $additions[$field_name] = array();
1010
+          }
1011
+          $additions[$field_name][] = $item;
1034 1012
         }
1035
-        // $record might be empty because
1036
-        // - the table stores a multiple field :
1037
-        //   we do nothing, this is handled later on
1038
-        // - this is the per-type table and no field is actually stored in it :
1039
-        //   we still store the nid and vid
1040
-        if (count($record) || empty($schema['content fields'])) {
1041
-          $record['nid'] = $node->nid;
1042
-          $record['vid'] = $node->vid;
1043
-          // Can't rely on the insert/update op of the node to decide if this
1044
-          // is an insert or an update, a node or revision may have existed
1045
-          // before any fields were created, so there may not be an entry here.
1046
-
1047
-          // TODO - should we auto create an entry for all existing nodes when
1048
-          // fields are added to content types -- either a NULL value
1049
-          // or the default value? May need to offer the user an option of
1050
-          // how to handle that.
1051
-          if (db_result(db_query("SELECT COUNT(*) FROM {". $table ."} WHERE vid = %d", $node->vid))) {
1052
-            content_write_record($table, $record, array('vid'));
1013
+      }
1014
+    }
1015
+    return $additions;
1016
+
1017
+  case 'insert':
1018
+  case 'update':
1019
+    foreach ($type['tables'] as $table) {
1020
+      $schema = drupal_get_schema($table);
1021
+      $record = array();
1022
+      foreach ($schema['content fields'] as $field_name) {
1023
+        if (isset($node->$field_name)) {
1024
+          $field = content_fields($field_name, $type_name);
1025
+          // Multiple fields need specific handling, we'll deal with them later on.
1026
+          if ($field['multiple']) {
1027
+            continue;
1053 1028
           }
1054
-          else {
1055
-            content_write_record($table, $record);
1029
+          $db_info = content_database_info($field);
1030
+          foreach ($db_info['columns'] as $column => $attributes) {
1031
+            $record[$attributes['column']] = $node->{$field_name}[0][$column];
1056 1032
           }
1057 1033
         }
1058 1034
       }
1035
+      // $record might be empty because
1036
+      // - the table stores a multiple field :
1037
+      //   we do nothing, this is handled later on
1038
+      // - this is the per-type table and no field is actually stored in it :
1039
+      //   we still store the nid and vid
1040
+      if (count($record) || empty($schema['content fields'])) {
1041
+        $record['nid'] = $node->nid;
1042
+        $record['vid'] = $node->vid;
1043
+        // Can't rely on the insert/update op of the node to decide if this
1044
+        // is an insert or an update, a node or revision may have existed
1045
+        // before any fields were created, so there may not be an entry here.
1046
+
1047
+        // TODO - should we auto create an entry for all existing nodes when
1048
+        // fields are added to content types -- either a NULL value
1049
+        // or the default value? May need to offer the user an option of
1050
+        // how to handle that.
1051
+        if (db_result(db_query("SELECT COUNT(*) FROM {". $table ."} WHERE vid = %d", $node->vid))) {
1052
+          content_write_record($table, $record, array('vid'));
1053
+        }
1054
+        else {
1055
+          content_write_record($table, $record);
1056
+        }
1057
+      }
1058
+    }
1059 1059
 
1060
-      // Handle multiple fields.
1061
-      foreach ($type['fields'] as $field) {
1062
-        if ($field['multiple'] && isset($node->$field['field_name'])) {
1063
-          $db_info = content_database_info($field);
1064
-          // Delete and insert, rather than update, in case a value was added.
1065
-          if ($op == 'update') {
1066
-            db_query('DELETE FROM {'. $db_info['table'] .'} WHERE vid = %d', $node->vid);
1067
-          }
1068
-          foreach ($node->$field['field_name'] as $delta => $item) {
1069
-            $record = array();
1070
-            foreach ($db_info['columns'] as $column => $attributes) {
1071
-              $record[$attributes['column']] = $item[$column];
1072
-            }
1073
-            $record['nid'] = $node->nid;
1074
-            $record['vid'] = $node->vid;
1075
-            $record['delta'] = $delta;
1076
-            content_write_record($db_info['table'], $record);
1060
+    // Handle multiple fields.
1061
+    foreach ($type['fields'] as $field) {
1062
+      if ($field['multiple'] && isset($node->$field['field_name'])) {
1063
+        $db_info = content_database_info($field);
1064
+        // Delete and insert, rather than update, in case a value was added.
1065
+        if ($op == 'update') {
1066
+          db_query('DELETE FROM {'. $db_info['table'] .'} WHERE vid = %d', $node->vid);
1067
+        }
1068
+        foreach ($node->$field['field_name'] as $delta => $item) {
1069
+          $record = array();
1070
+          foreach ($db_info['columns'] as $column => $attributes) {
1071
+            $record[$attributes['column']] = $item[$column];
1077 1072
           }
1073
+          $record['nid'] = $node->nid;
1074
+          $record['vid'] = $node->vid;
1075
+          $record['delta'] = $delta;
1076
+          content_write_record($db_info['table'], $record);
1078 1077
         }
1079 1078
       }
1080
-      break;
1079
+    }
1080
+    break;
1081 1081
 
1082
-    case 'delete':
1083
-      foreach ($type['tables'] as $table) {
1084
-        db_query('DELETE FROM {'. $table .'} WHERE nid = %d', $node->nid);
1085
-      }
1086
-      break;
1082
+  case 'delete':
1083
+    foreach ($type['tables'] as $table) {
1084
+      db_query('DELETE FROM {'. $table .'} WHERE nid = %d', $node->nid);
1085
+    }
1086
+    break;
1087 1087
 
1088
-    case 'delete revision':
1089
-      foreach ($type['tables'] as $table) {
1090
-        db_query('DELETE FROM {'. $table .'} WHERE vid = %d', $node->vid);
1091
-      }
1092
-      break;
1088
+  case 'delete revision':
1089
+    foreach ($type['tables'] as $table) {
1090
+      db_query('DELETE FROM {'. $table .'} WHERE vid = %d', $node->vid);
1091
+    }
1092
+    break;
1093 1093
   }
1094 1094
 }
1095 1095
 
@@ -1526,18 +1526,18 @@  discard block
 block discarded – undo
1526 1526
  */
1527 1527
 function content_node_type($op, $info) {
1528 1528
   switch ($op) {
1529
-    case 'insert':
1530
-      module_load_include('inc', 'content', 'includes/content.crud');
1531
-      content_type_create($info);
1532
-      break;
1533
-    case 'update':
1534
-      module_load_include('inc', 'content', 'includes/content.crud');
1535
-      content_type_update($info);
1536
-      break;
1537
-    case 'delete':
1538
-      module_load_include('inc', 'content', 'includes/content.crud');
1539
-      content_type_delete($info);
1540
-      break;
1529
+  case 'insert':
1530
+    module_load_include('inc', 'content', 'includes/content.crud');
1531
+    content_type_create($info);
1532
+    break;
1533
+  case 'update':
1534
+    module_load_include('inc', 'content', 'includes/content.crud');
1535
+    content_type_update($info);
1536
+    break;
1537
+  case 'delete':
1538
+    module_load_include('inc', 'content', 'includes/content.crud');
1539
+    content_type_delete($info);
1540
+    break;
1541 1541
   }
1542 1542
 }
1543 1543
 
@@ -1994,14 +1994,14 @@  discard block
 block discarded – undo
1994 1994
 
1995 1995
   $name = str_replace('-', '_', $name);
1996 1996
   switch ("$version-$storage") {
1997
-    case '0-'. CONTENT_DB_STORAGE_PER_CONTENT_TYPE :
1998
-      return "node_$name";
1999
-    case '0-'. CONTENT_DB_STORAGE_PER_FIELD :
2000
-      return "node_data_$name";
2001
-    case '1003-'. CONTENT_DB_STORAGE_PER_CONTENT_TYPE :
2002
-      return "content_type_$name";
2003
-    case '1003-'. CONTENT_DB_STORAGE_PER_FIELD :
2004
-      return "content_$name";
1997
+  case '0-'. CONTENT_DB_STORAGE_PER_CONTENT_TYPE :
1998
+    return "node_$name";
1999
+  case '0-'. CONTENT_DB_STORAGE_PER_FIELD :
2000
+    return "node_data_$name";
2001
+  case '1003-'. CONTENT_DB_STORAGE_PER_CONTENT_TYPE :
2002
+    return "content_type_$name";
2003
+  case '1003-'. CONTENT_DB_STORAGE_PER_FIELD :
2004
+    return "content_$name";
2005 2005
   }
2006 2006
 }
2007 2007
 
@@ -2153,13 +2153,13 @@  discard block
 block discarded – undo
2153 2153
  */
2154 2154
 function content_callback($entity, $op, $field) {
2155 2155
   switch ($entity) {
2156
-    case 'field':
2157
-      $info = module_invoke($field['module'], "field_info");
2158
-      return isset($info[$field['type']]['callbacks'][$op]) ? $info[$field['type']]['callbacks'][$op] : CONTENT_CALLBACK_DEFAULT;
2156
+  case 'field':
2157
+    $info = module_invoke($field['module'], "field_info");
2158
+    return isset($info[$field['type']]['callbacks'][$op]) ? $info[$field['type']]['callbacks'][$op] : CONTENT_CALLBACK_DEFAULT;
2159 2159
 
2160
-    case 'widget':
2161
-      $info = module_invoke($field['widget']['module'], "widget_info");
2162
-      return isset($info[$field['widget']['type']]['callbacks'][$op]) ? $info[$field['widget']['type']]['callbacks'][$op] : CONTENT_CALLBACK_DEFAULT;
2160
+  case 'widget':
2161
+    $info = module_invoke($field['widget']['module'], "widget_info");
2162
+    return isset($info[$field['widget']['type']]['callbacks'][$op]) ? $info[$field['widget']['type']]['callbacks'][$op] : CONTENT_CALLBACK_DEFAULT;
2163 2163
   }
2164 2164
 }
2165 2165
 
@@ -2183,18 +2183,18 @@  discard block
 block discarded – undo
2183 2183
  */
2184 2184
 function content_handle($entity, $op, $object) {
2185 2185
   switch ($entity) {
2186
-    case 'field':
2187
-      $info = module_invoke($object['module'], "field_info");
2188
-      return isset($info[$object['type']][$op]) ? $info[$object['type']][$op] : CONTENT_HANDLE_CORE;
2189
-
2190
-    case 'widget':
2191
-      $info = module_invoke($object['widget']['module'], "widget_info");
2192
-      return isset($info[$object['widget']['type']][$op]) ? $info[$object['widget']['type']][$op] : CONTENT_HANDLE_CORE;
2193
-
2194
-    case 'formatter':
2195
-      // Much simpler, formatters arrays *are* the 'formatter_info' itself.
2196
-      // We let content_handle deal with them only for code consistency.
2197
-      return isset($object[$op]) ? $object[$op] : CONTENT_HANDLE_CORE;
2186
+  case 'field':
2187
+    $info = module_invoke($object['module'], "field_info");
2188
+    return isset($info[$object['type']][$op]) ? $info[$object['type']][$op] : CONTENT_HANDLE_CORE;
2189
+
2190
+  case 'widget':
2191
+    $info = module_invoke($object['widget']['module'], "widget_info");
2192
+    return isset($info[$object['widget']['type']][$op]) ? $info[$object['widget']['type']][$op] : CONTENT_HANDLE_CORE;
2193
+
2194
+  case 'formatter':
2195
+    // Much simpler, formatters arrays *are* the 'formatter_info' itself.
2196
+    // We let content_handle deal with them only for code consistency.
2197
+    return isset($object[$op]) ? $object[$op] : CONTENT_HANDLE_CORE;
2198 2198
   }
2199 2199
 }
2200 2200
 
Please login to merge, or discard this patch.
boinc/modules/contrib/content_profile/modules/content_profile_tokens.module 1 patch
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -15,44 +15,44 @@
 block discarded – undo
15 15
   $values = array();
16 16
   $types = content_profile_get_types('types');
17 17
   switch ($type) {
18
-    case 'user':
19
-      foreach($types as $type_name => $type) {
20
-        if (isset($object)) {
21
-          $profile = content_profile_load($type_name, $object->uid);
22
-        }
23
-        else {
24
-          global $user;
25
-          $profile = content_profile_load($type_name, $user->uid);
26
-        }
27
-        $fields = content_types($type_name);
28
-        foreach ($fields['fields'] as $field_name => $field) {
29
-          if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
30
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
-              $values['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile->{$field_name}[0]['value'];
32
-          }
18
+  case 'user':
19
+    foreach($types as $type_name => $type) {
20
+      if (isset($object)) {
21
+        $profile = content_profile_load($type_name, $object->uid);
22
+      }
23
+      else {
24
+        global $user;
25
+        $profile = content_profile_load($type_name, $user->uid);
26
+      }
27
+      $fields = content_types($type_name);
28
+      foreach ($fields['fields'] as $field_name => $field) {
29
+        if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
30
+            $values['content-profile-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile->{$field_name}[0]['value']);
31
+            $values['content-profile-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile->{$field_name}[0]['value'];
33 32
         }
34 33
       }
35
-      break;
34
+    }
35
+    break;
36 36
 
37
-    case 'flag_friend':
38
-      if(!empty($object)) {
39
-        foreach($types as $type_name => $type) {
40
-          $profile_requestor = content_profile_load($type_name, $object->friend->uid);
41
-          $profile_requestee = content_profile_load($type_name, $object->uid);
37
+  case 'flag_friend':
38
+    if(!empty($object)) {
39
+      foreach($types as $type_name => $type) {
40
+        $profile_requestor = content_profile_load($type_name, $object->friend->uid);
41
+        $profile_requestee = content_profile_load($type_name, $object->uid);
42 42
           
43
-          $fields = content_types($type_name);
44
-          foreach ($fields['fields'] as $field_name => $field) {
45
-            if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
46
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
-              $values['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestor->{$field_name}[0]['value'];
43
+        $fields = content_types($type_name);
44
+        foreach ($fields['fields'] as $field_name => $field) {
45
+          if (!$field['multiple'] && ($field['widget']['type'] == 'text_textfield' || $field['widget']['type'] == 'number')) {
46
+            $values['requestor-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestor->{$field_name}[0]['value']);
47
+            $values['requestor-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestor->{$field_name}[0]['value'];
48 48
               
49
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
-              $values['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestee->{$field_name}[0]['value'];
51
-            }
49
+            $values['requestee-'. $type_name .'-'. substr($field_name, 6)] = check_plain($profile_requestee->{$field_name}[0]['value']);
50
+            $values['requestee-'. $type_name .'-'. substr($field_name, 6) .'-raw'] = $profile_requestee->{$field_name}[0]['value'];
52 51
           }
53 52
         }
54 53
       }
55
-      break;
54
+    }
55
+    break;
56 56
   }
57 57
   return $values;
58 58
 }
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/content_profile/content_profile.module 1 patch
Switch Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
  */
235 235
 function content_profile_node_type($op, $info) {
236 236
   switch ($op) {
237
-    case 'delete':
238
-      variable_del('content_profile_use_'. $info->type);
239
-      variable_del('content_profile_'. $info->type);
240
-      break;
241
-    case 'update':
242
-      if (!empty($info->old_type) && $info->old_type != $info->type) {
243
-        if (is_content_profile($info->old_type)) {
244
-          $settings = variable_get('content_profile_'. $info->old_type, array());
245
-          variable_del('content_profile_use_'. $info->old_type);
246
-          variable_del('content_profile_'. $info->old_type);
247
-          variable_set('content_profile_use_'. $info->type, 1);
248
-          variable_set('content_profile_'. $info->type, $settings);
249
-        }
237
+  case 'delete':
238
+    variable_del('content_profile_use_'. $info->type);
239
+    variable_del('content_profile_'. $info->type);
240
+    break;
241
+  case 'update':
242
+    if (!empty($info->old_type) && $info->old_type != $info->type) {
243
+      if (is_content_profile($info->old_type)) {
244
+        $settings = variable_get('content_profile_'. $info->old_type, array());
245
+        variable_del('content_profile_use_'. $info->old_type);
246
+        variable_del('content_profile_'. $info->old_type);
247
+        variable_set('content_profile_use_'. $info->type, 1);
248
+        variable_set('content_profile_'. $info->type, $settings);
250 249
       }
251
-      break;
250
+    }
251
+    break;
252 252
   }
253 253
 }
254 254
 
@@ -292,33 +292,33 @@  discard block
 block discarded – undo
292 292
   global $user;
293 293
 
294 294
   switch ($op) {
295
-    case 'categories':
296
-      $data = array();
297
-      foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
298
-        $data[] = array(
299
-          'name' => $type,
300
-          'title' => drupal_ucfirst($type_name),
301
-          'weight' => content_profile_get_settings($type, 'weight') + 1,
302
-        );
303
-      }
304
-      return $data;
295
+  case 'categories':
296
+    $data = array();
297
+    foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
298
+      $data[] = array(
299
+        'name' => $type,
300
+        'title' => drupal_ucfirst($type_name),
301
+        'weight' => content_profile_get_settings($type, 'weight') + 1,
302
+      );
303
+    }
304
+    return $data;
305 305
 
306
-    case 'view':
307
-      $account->content['content_profile'] = content_profile_show_profiles($account->uid);
308
-      break;
306
+  case 'view':
307
+    $account->content['content_profile'] = content_profile_show_profiles($account->uid);
308
+    break;
309 309
 
310
-    case 'delete':
311
-      // Retrieve all profile nodes (in any language) for this user by issueing an SQL query.
312
-      if ($types = content_profile_get_types()) {
313
-        $condition = array_fill(0, count($types), "type = '%s'");
314
-        $arguments = array_merge(array_keys($types), array($account->uid));
310
+  case 'delete':
311
+    // Retrieve all profile nodes (in any language) for this user by issueing an SQL query.
312
+    if ($types = content_profile_get_types()) {
313
+      $condition = array_fill(0, count($types), "type = '%s'");
314
+      $arguments = array_merge(array_keys($types), array($account->uid));
315 315
 
316
-        $result = db_query("SELECT * FROM {node} WHERE (". implode(' OR ', $condition) .") AND uid = %d", $arguments);
317
-        while ($node = db_fetch_object($result)) {
318
-          _content_profile_node_delete($node);
319
-        }
316
+      $result = db_query("SELECT * FROM {node} WHERE (". implode(' OR ', $condition) .") AND uid = %d", $arguments);
317
+      while ($node = db_fetch_object($result)) {
318
+        _content_profile_node_delete($node);
320 319
       }
321
-      break;
320
+    }
321
+    break;
322 322
   }
323 323
 }
324 324
 
Please login to merge, or discard this patch.
default/boinc/modules/contrib/mobile_menu_toggle/mobile_menu_toggle.module 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@
 block discarded – undo
55 55
   elseif ($op == 'view') {
56 56
     $block = array();
57 57
     switch ($delta) {
58
-      case 0:
59
-        drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js');
60
-        $block['content'] = theme('mobile_menu_toggle');
61
-        break;
58
+    case 0:
59
+      drupal_add_js(drupal_get_path('module', 'mobile_menu_toggle') . '/mobile_menu_toggle.js');
60
+      $block['content'] = theme('mobile_menu_toggle');
61
+      break;
62 62
     }
63 63
     return $block;
64 64
   }
Please login to merge, or discard this patch.
boinc/modules/contrib/privatemsg/pm_email_notify/pm_email_notify.module 1 patch
Switch Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
   $variables = user_mail_tokens($params['recipient'], $language);
107 107
   $variables = array_merge($variables, _pm_email_notify_token($params['recipient'], $params['message'], $language));
108 108
   switch ($key) {
109
-    case 'notice':
110
-      $message['subject'] = t(variable_get('pm_email_notify_subject', 'New private message at !site.'), $variables, $language->language);
111
-      $message['body'] = t(variable_get('pm_email_notify_body', _pm_email_notify_default_body()), $variables, $language->language);
112
-      break;
109
+  case 'notice':
110
+    $message['subject'] = t(variable_get('pm_email_notify_subject', 'New private message at !site.'), $variables, $language->language);
111
+    $message['body'] = t(variable_get('pm_email_notify_body', _pm_email_notify_default_body()), $variables, $language->language);
112
+    break;
113 113
   }
114 114
 }
115 115
 
@@ -151,42 +151,42 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function pm_email_notify_user($op, &$edit, &$account, $category = NULL) {
153 153
   switch ($op) {
154
-    case 'form':
155
-      if ($category == 'account' && privatemsg_user_access('read privatemsg', $account)) {
156
-        $form['enable_pm_mail'] = array(
157
-          '#type' => 'fieldset',
158
-          '#title' => t('Privatemsg e-mail notification'),
159
-          '#collapsible' => TRUE,
160
-          '#collapsed' => FALSE,
161
-          '#weight' => 10,
162
-        );
163
-        $form['enable_pm_mail']['pm_send_notifications'] = array(
164
-          '#type' => 'checkbox',
165
-          '#title' => t('Receive email notification for incoming private messages'),
166
-          '#default_value' => _pm_email_notify_is_enabled($account->uid),
167
-        );
168
-      }
169
-      return $form;
154
+  case 'form':
155
+    if ($category == 'account' && privatemsg_user_access('read privatemsg', $account)) {
156
+      $form['enable_pm_mail'] = array(
157
+        '#type' => 'fieldset',
158
+        '#title' => t('Privatemsg e-mail notification'),
159
+        '#collapsible' => TRUE,
160
+        '#collapsed' => FALSE,
161
+        '#weight' => 10,
162
+      );
163
+      $form['enable_pm_mail']['pm_send_notifications'] = array(
164
+        '#type' => 'checkbox',
165
+        '#title' => t('Receive email notification for incoming private messages'),
166
+        '#default_value' => _pm_email_notify_is_enabled($account->uid),
167
+      );
168
+    }
169
+    return $form;
170 170
 
171
-     case 'submit':
172
-      if (isset($edit['pm_send_notifications']) && privatemsg_user_access('read privatemsg', $account)) {
173
-        $pm_email_enabled = $edit['pm_send_notifications'];
174
-        unset($edit['pm_send_notifications']);
175
-        // Update database entry with user preference.
176
-        $exists = db_result(db_query("SELECT 1 FROM {pm_email_notify} WHERE user_id = %d", $account->uid));
177
-        if ($exists) {
178
-          // If there is an existing entry, update.
179
-          db_query("UPDATE {pm_email_notify} SET email_notify_is_enabled = %d WHERE user_id = %d", $pm_email_enabled, $account->uid);
180
-        }
181
-        else {
182
-          // If not, create a new one.
183
-          db_query("INSERT INTO {pm_email_notify} (email_notify_is_enabled, user_id) VALUES (%d, %d)", $pm_email_enabled, $account->uid);
184
-        }
185
-      }
186
-      break;
171
+  case 'submit':
172
+   if (isset($edit['pm_send_notifications']) && privatemsg_user_access('read privatemsg', $account)) {
173
+     $pm_email_enabled = $edit['pm_send_notifications'];
174
+     unset($edit['pm_send_notifications']);
175
+     // Update database entry with user preference.
176
+     $exists = db_result(db_query("SELECT 1 FROM {pm_email_notify} WHERE user_id = %d", $account->uid));
177
+     if ($exists) {
178
+       // If there is an existing entry, update.
179
+       db_query("UPDATE {pm_email_notify} SET email_notify_is_enabled = %d WHERE user_id = %d", $pm_email_enabled, $account->uid);
180
+     }
181
+     else {
182
+       // If not, create a new one.
183
+       db_query("INSERT INTO {pm_email_notify} (email_notify_is_enabled, user_id) VALUES (%d, %d)", $pm_email_enabled, $account->uid);
184
+     }
185
+   }
186
+   break;
187 187
 
188
-     case 'delete':
189
-      db_query("DELETE FROM {pm_email_notify} WHERE user_id = %d", $account->uid);
190
-      break;
188
+  case 'delete':
189
+   db_query("DELETE FROM {pm_email_notify} WHERE user_id = %d", $account->uid);
190
+   break;
191 191
   }
192 192
 }
Please login to merge, or discard this patch.
boinc/modules/contrib/privatemsg/privatemsg_filter/privatemsg_filter.module 1 patch
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -405,26 +405,26 @@  discard block
 block discarded – undo
405 405
   }
406 406
 
407 407
   switch ($form_state['values']['op']) {
408
-    case t('Save filter'):
409
-      $filter = array();
410
-      if (!empty($form_state['values']['tags'])) {
411
-        $filter['tags'] = $form_state['values']['tags'];
412
-      }
413
-      if (!empty($form_state['values']['author'])) {
414
-        $filter['author'] = $form_state['values']['author'];
415
-      }
416
-      if (!empty($form_state['values']['search'])) {
417
-        $filter['search'] = $form_state['values']['search'];
418
-      }
419
-      $_SESSION['privatemsg_filter'] = $filter;
420
-      break;
421
-    case t('Filter'):
422
-      drupal_goto($_GET['q'], privatemsg_filter_create_get_query($form_state['values']));
423
-      return;
424
-      break;
425
-    case t('Reset'):
426
-      $_SESSION['privatemsg_filter'] = array();
427
-      break;
408
+  case t('Save filter'):
409
+    $filter = array();
410
+    if (!empty($form_state['values']['tags'])) {
411
+      $filter['tags'] = $form_state['values']['tags'];
412
+    }
413
+    if (!empty($form_state['values']['author'])) {
414
+      $filter['author'] = $form_state['values']['author'];
415
+    }
416
+    if (!empty($form_state['values']['search'])) {
417
+      $filter['search'] = $form_state['values']['search'];
418
+    }
419
+    $_SESSION['privatemsg_filter'] = $filter;
420
+    break;
421
+  case t('Filter'):
422
+    drupal_goto($_GET['q'], privatemsg_filter_create_get_query($form_state['values']));
423
+    return;
424
+    break;
425
+  case t('Reset'):
426
+    $_SESSION['privatemsg_filter'] = array();
427
+    break;
428 428
   }
429 429
   $form_state['redirect'] = $_GET['q'];
430 430
 }
@@ -899,9 +899,9 @@  discard block
 block discarded – undo
899 899
  */
900 900
 function privatemsg_filter_user($op, &$edit, &$account, $category = NULL) {
901 901
   switch ($op) {
902
-      case 'delete':
903
-      // Delete tag information of that user.
904
-      db_query("DELETE FROM {pm_tags_index} WHERE uid = %d", $account->uid, $account->uid);
905
-      break;
902
+  case 'delete':
903
+  // Delete tag information of that user.
904
+  db_query("DELETE FROM {pm_tags_index} WHERE uid = %d", $account->uid, $account->uid);
905
+  break;
906 906
   }
907 907
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module 1 patch
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1437,43 +1437,43 @@  discard block
 block discarded – undo
1437 1437
   global $user;
1438 1438
 
1439 1439
   switch ($op) {
1440
-    case 'view':
1441
-      if ($url = privatemsg_get_link(array($account))) {
1442
-        $account->content['privatemsg_send_new_message'] = array(
1443
-          '#type'   => 'markup',
1444
-          '#value'  => l(t('Send this user a message'), $url, array('query' => drupal_get_destination())),
1445
-          '#weight' => 10,
1446
-        );
1447
-      }
1448
-      break;
1449
-    case 'login':
1450
-      if (variable_get('privatemsg_display_loginmessage', TRUE) && privatemsg_user_access()) {
1451
-        $count = privatemsg_unread_count();
1452
-        if ($count) {
1453
-          drupal_set_message(format_plural($count, 'You have <a href="@messages">1 unread message</a>.', 'You have <a href="@messages">@count unread messages</a>', array('@messages' => url('messages'))));
1454
-        }
1440
+  case 'view':
1441
+    if ($url = privatemsg_get_link(array($account))) {
1442
+      $account->content['privatemsg_send_new_message'] = array(
1443
+        '#type'   => 'markup',
1444
+        '#value'  => l(t('Send this user a message'), $url, array('query' => drupal_get_destination())),
1445
+        '#weight' => 10,
1446
+      );
1447
+    }
1448
+    break;
1449
+  case 'login':
1450
+    if (variable_get('privatemsg_display_loginmessage', TRUE) && privatemsg_user_access()) {
1451
+      $count = privatemsg_unread_count();
1452
+      if ($count) {
1453
+        drupal_set_message(format_plural($count, 'You have <a href="@messages">1 unread message</a>.', 'You have <a href="@messages">@count unread messages</a>', array('@messages' => url('messages'))));
1455 1454
       }
1456
-      break;
1457
-    case 'delete':
1455
+    }
1456
+    break;
1457
+  case 'delete':
1458 1458
 
1459
-      // Load all mids of the messages the user wrote.
1460
-      $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid);
1461
-      $mids = array();
1462
-      while ($row = db_fetch_array($result)) {
1463
-        $mids[] = $row['mid'];
1464
-      }
1459
+    // Load all mids of the messages the user wrote.
1460
+    $result = db_query("SELECT mid FROM {pm_message} WHERE author = %d", $account->uid);
1461
+    $mids = array();
1462
+    while ($row = db_fetch_array($result)) {
1463
+      $mids[] = $row['mid'];
1464
+    }
1465 1465
 
1466
-      // Delete messages the user wrote.
1467
-      db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid);
1466
+    // Delete messages the user wrote.
1467
+    db_query('DELETE FROM {pm_message} WHERE author = %d', $account->uid);
1468 1468
 
1469
-      if (!empty($mids)) {
1470
-        // Delete recipient entries in {pm_index} of the messages the user wrote.
1471
-        db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids);
1472
-      }
1469
+    if (!empty($mids)) {
1470
+      // Delete recipient entries in {pm_index} of the messages the user wrote.
1471
+      db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids);
1472
+    }
1473 1473
 
1474
-      // Delete recipient entries of that user.
1475
-      db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid);
1476
-      break;
1474
+    // Delete recipient entries of that user.
1475
+    db_query('DELETE FROM {pm_index} WHERE uid = %d', $account->uid);
1476
+    break;
1477 1477
   }
1478 1478
 }
1479 1479
 
@@ -1494,12 +1494,12 @@  discard block
 block discarded – undo
1494 1494
   elseif ('view' == $op) {
1495 1495
     $block = array();
1496 1496
     switch ($delta) {
1497
-      case 'privatemsg-menu':
1498
-        $block = _privatemsg_block_menu();
1499
-        break;
1500
-      case 'privatemsg-new':
1501
-        $block = _privatemsg_block_new();
1502
-        break;
1497
+    case 'privatemsg-menu':
1498
+      $block = _privatemsg_block_menu();
1499
+      break;
1500
+    case 'privatemsg-new':
1501
+      $block = _privatemsg_block_new();
1502
+      break;
1503 1503
     }
1504 1504
     return $block;
1505 1505
   }
Please login to merge, or discard this patch.