Completed
Pull Request — master (#2171)
by Christian
10:51
created
sites/default/boinc/modules/contrib/flag/includes/flag.views_convert.inc 1 patch
Switch Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -44,124 +44,124 @@
 block discarded – undo
44 44
 
45 45
   // Now update values, options, etc. to those selected in the imported view.
46 46
   switch ($type) {
47
-    case 'field':
48
-      switch ($id) {
49
-        case 'ops':
50
-          $new_field = array(
51
-            'label' => $field['label'],
52
-            'id' => 'ops',
53
-            'table' => 'flag_content',
54
-            'field' => 'ops',
55
-            'relationship' => 'flag_content_rel',
56
-          );
57
-          $new_rel = 'flag_content_rel';
58
-          $flag_content_rel_user = 'current';
59
-          break;
60
-        case 'count':
61
-          $new_field = array(
62
-            'label' => $field['label'],
63
-            'id' => 'count',
64
-            'table' => 'flag_counts',
65
-            'field' => 'count',
66
-            'relationship' => 'flag_counts_rel',
67
-          );
68
-          $new_rel = 'flag_counts_rel';
69
-          break;
70
-        case 'name':
71
-          $new_field = array(
72
-            'label' => $field['label'],
73
-            'link_to_user' => 1,
74
-            'id' => 'name',
75
-            'table' => 'users',
76
-            'field' => 'name',
77
-            'relationship' => 'uid',
78
-          );
79
-          $new_rel = 'uid';
80
-          break;
81
-      }
47
+  case 'field':
48
+    switch ($id) {
49
+    case 'ops':
50
+    $new_field = array(
51
+    'label' => $field['label'],
52
+    'id' => 'ops',
53
+    'table' => 'flag_content',
54
+    'field' => 'ops',
55
+    'relationship' => 'flag_content_rel',
56
+    );
57
+    $new_rel = 'flag_content_rel';
58
+    $flag_content_rel_user = 'current';
59
+    break;
60
+    case 'count':
61
+    $new_field = array(
62
+    'label' => $field['label'],
63
+    'id' => 'count',
64
+    'table' => 'flag_counts',
65
+    'field' => 'count',
66
+    'relationship' => 'flag_counts_rel',
67
+    );
68
+    $new_rel = 'flag_counts_rel';
69
+    break;
70
+    case 'name':
71
+    $new_field = array(
72
+    'label' => $field['label'],
73
+    'link_to_user' => 1,
74
+    'id' => 'name',
75
+    'table' => 'users',
76
+    'field' => 'name',
77
+    'relationship' => 'uid',
78
+    );
79
+    $new_rel = 'uid';
80
+    break;
81
+    }
82 82
       break;
83 83
 
84
-    case 'filter':
85
-    case 'exposed_filter':
86
-      switch ($id) {
87
-        case 'uid':
88
-          // The flag_content uid filter means "Include content only flagged by
89
-          // the current user". In D6, this is no longer a filter, but instead
90
-          // part of the relationship. Make the relationship join on the uid.
91
-          if ($field['value'] == '***CURRENT_USER***') {
92
-            $new_rel = 'flag_content_rel';
93
-            $flag_content_rel_user = 'current';
94
-          }
95
-          // Remove the old filter.
96
-          $view->set_item('default', $type, $id, NULL);
97
-          break;
98
-        case 'timestamp':
99
-          $new_field = array(
100
-            'operator' => $field['operator'],
101
-            'value' => flag_views_convert_timestamp_value($field['value']),
102
-            'group' => 0,
103
-            'id' => 'timestamp',
104
-            'table' => 'flag_content',
105
-            'field' => 'timestamp',
106
-            'relationship' => 'flag_content_rel',
107
-            'exposed' => $type == 'exposed_filter' ? 1 : 0,
108
-          );
109
-          $new_rel = 'flag_content_rel';
110
-          drupal_set_message(t('Flag is not able to convert the <em>Flagged time</em> filter. It\'s value is currently empty, but needs to be populated to work properly.'), 'warning');
111
-          break;
112
-        case 'count':
113
-          $new_field = array(
114
-            'operator' => $field['operator'],
115
-            'value' => array('value' => $field['value']),
116
-            'group' => 0,
117
-            'id' => 'count',
118
-            'table' => 'flag_counts',
119
-            'field' => 'count',
120
-            'relationship' => 'flag_counts_rel',
121
-            'exposed' => $type == 'exposed_filter' ? 1 : 0,
122
-          );
123
-          $new_rel = 'flag_counts_rel';
124
-          break;
125
-      }
84
+  case 'filter':
85
+  case 'exposed_filter':
86
+    switch ($id) {
87
+    case 'uid':
88
+    // The flag_content uid filter means "Include content only flagged by
89
+    // the current user". In D6, this is no longer a filter, but instead
90
+    // part of the relationship. Make the relationship join on the uid.
91
+    if ($field['value'] == '***CURRENT_USER***') {
92
+    $new_rel = 'flag_content_rel';
93
+    $flag_content_rel_user = 'current';
94
+    }
95
+    // Remove the old filter.
96
+    $view->set_item('default', $type, $id, NULL);
97
+    break;
98
+    case 'timestamp':
99
+    $new_field = array(
100
+    'operator' => $field['operator'],
101
+    'value' => flag_views_convert_timestamp_value($field['value']),
102
+    'group' => 0,
103
+    'id' => 'timestamp',
104
+    'table' => 'flag_content',
105
+    'field' => 'timestamp',
106
+    'relationship' => 'flag_content_rel',
107
+    'exposed' => $type == 'exposed_filter' ? 1 : 0,
108
+    );
109
+    $new_rel = 'flag_content_rel';
110
+    drupal_set_message(t('Flag is not able to convert the <em>Flagged time</em> filter. It\'s value is currently empty, but needs to be populated to work properly.'), 'warning');
111
+    break;
112
+    case 'count':
113
+    $new_field = array(
114
+    'operator' => $field['operator'],
115
+    'value' => array('value' => $field['value']),
116
+    'group' => 0,
117
+    'id' => 'count',
118
+    'table' => 'flag_counts',
119
+    'field' => 'count',
120
+    'relationship' => 'flag_counts_rel',
121
+    'exposed' => $type == 'exposed_filter' ? 1 : 0,
122
+    );
123
+    $new_rel = 'flag_counts_rel';
124
+    break;
125
+    }
126 126
       break;
127 127
 
128
-    case 'argument':
129
-      // Flag in Drupal 5 only provides one argument, and in Views 1 arguments
130
-      // weren't given and ID, so we use the field type.
131
-      if (strpos($field['type'], 'flag_content_') === 0) {
132
-        $new_field = array(
133
-          'id' => 'uid',
134
-          'table' => 'users',
135
-          'field' => 'uid',
136
-          'relationship' => 'uid',
137
-        );
138
-        $new_rel = 'uid';
139
-      }
140
-      break;
128
+  case 'argument':
129
+    // Flag in Drupal 5 only provides one argument, and in Views 1 arguments
130
+    // weren't given and ID, so we use the field type.
131
+    if (strpos($field['type'], 'flag_content_') === 0) {
132
+      $new_field = array(
133
+        'id' => 'uid',
134
+        'table' => 'users',
135
+        'field' => 'uid',
136
+        'relationship' => 'uid',
137
+      );
138
+      $new_rel = 'uid';
139
+    }
140
+    break;
141 141
 
142
-    case 'sort':
143
-      switch ($id) {
144
-        case 'count':
145
-          $new_field = array(
146
-            'order' => $field['sortorder'],
147
-            'id' => 'count',
148
-            'table' => 'flag_counts',
149
-            'field' => 'count',
150
-            'relationship' => 'flag_counts_rel',
151
-          );
152
-          $new_rel = 'flag_counts_rel';
153
-          break;
154
-        case 'timestamp':
155
-          $new_field = array(
156
-            'order' => $field['sortorder'],
157
-            'id' => 'timestamp',
158
-            'table' => 'flag_content',
159
-            'field' => 'timestamp',
160
-            'relationship' => 'flag_content_rel',
161
-          );
162
-          $new_rel = 'flag_content_rel';
163
-          break;
164
-      }
142
+  case 'sort':
143
+    switch ($id) {
144
+    case 'count':
145
+    $new_field = array(
146
+    'order' => $field['sortorder'],
147
+    'id' => 'count',
148
+    'table' => 'flag_counts',
149
+    'field' => 'count',
150
+    'relationship' => 'flag_counts_rel',
151
+    );
152
+    $new_rel = 'flag_counts_rel';
153
+    break;
154
+    case 'timestamp':
155
+    $new_field = array(
156
+    'order' => $field['sortorder'],
157
+    'id' => 'timestamp',
158
+    'table' => 'flag_content',
159
+    'field' => 'timestamp',
160
+    'relationship' => 'flag_content_rel',
161
+    );
162
+    $new_rel = 'flag_content_rel';
163
+    break;
164
+    }
165 165
       break;
166 166
   }
167 167
 
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/flag/flag.module 1 patch
Switch Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
  */
166 166
 function flag_help($path, $arg) {
167 167
   switch ($path) {
168
-    case FLAG_ADMIN_PATH:
169
-      $output = '<p>' . t('This page lists all the <em>flags</em> that are currently defined on this system. You may <a href="@add-url">add new flags</a>.', array('@add-url' => url(FLAG_ADMIN_PATH . '/add'))) . '</p>';
170
-      return $output;
168
+  case FLAG_ADMIN_PATH:
169
+    $output = '<p>' . t('This page lists all the <em>flags</em> that are currently defined on this system. You may <a href="@add-url">add new flags</a>.', array('@add-url' => url(FLAG_ADMIN_PATH . '/add'))) . '</p>';
170
+    return $output;
171 171
   }
172 172
 }
173 173
 
@@ -433,57 +433,57 @@  discard block
 block discarded – undo
433 433
 function flag_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
434 434
   global $user;
435 435
   switch ($op) {
436
-    case 'update':
437
-    case 'insert':
438
-      // Response to the flag checkboxes added to the form in flag_form_alter().
439
-      $remembered = FALSE;
440
-      if (isset($node->flag)) {
441
-        foreach ($node->flag as $name => $state) {
442
-          $flag = flag_get_flag($name);
443
-          // Flagging may trigger actions. We want actions to get the current
444
-          // node, not a stale database-loaded one:
445
-          if (!$remembered) {
446
-            $flag->remember_content($node->nid, $node);
447
-            // Actions may modify a node, and we don't want to overwrite this
448
-            // modification:
449
-            $remembered = TRUE;
450
-          }
451
-          flag($state ? 'flag' : 'unflag', $name, $node->nid, $user);
436
+  case 'update':
437
+  case 'insert':
438
+    // Response to the flag checkboxes added to the form in flag_form_alter().
439
+    $remembered = FALSE;
440
+    if (isset($node->flag)) {
441
+      foreach ($node->flag as $name => $state) {
442
+        $flag = flag_get_flag($name);
443
+        // Flagging may trigger actions. We want actions to get the current
444
+        // node, not a stale database-loaded one:
445
+        if (!$remembered) {
446
+          $flag->remember_content($node->nid, $node);
447
+          // Actions may modify a node, and we don't want to overwrite this
448
+          // modification:
449
+          $remembered = TRUE;
452 450
         }
451
+        flag($state ? 'flag' : 'unflag', $name, $node->nid, $user);
453 452
       }
454
-      break;
455
-    case 'delete':
456
-      foreach (flag_get_flags('node') as $flag) {
457
-        // If the flag is being tracked by translation set and the node is part
458
-        // of a translation set, don't delete the flagging record.
459
-        // Instead, data will be updated in the 'translation_change' op, below.
460
-        if (!$flag->i18n || empty($node->tnid)) {
461
-          db_query("DELETE FROM {flag_content} WHERE fid = %d AND content_id = %d", $flag->fid, $node->nid);
462
-          db_query("DELETE FROM {flag_counts} WHERE fid = %d AND content_id = %d", $flag->fid, $node->nid);
463
-
464
-          // Delete comments.
465
-          db_query("DELETE FROM {flag_content}
453
+    }
454
+    break;
455
+  case 'delete':
456
+    foreach (flag_get_flags('node') as $flag) {
457
+      // If the flag is being tracked by translation set and the node is part
458
+      // of a translation set, don't delete the flagging record.
459
+      // Instead, data will be updated in the 'translation_change' op, below.
460
+      if (!$flag->i18n || empty($node->tnid)) {
461
+        db_query("DELETE FROM {flag_content} WHERE fid = %d AND content_id = %d", $flag->fid, $node->nid);
462
+        db_query("DELETE FROM {flag_counts} WHERE fid = %d AND content_id = %d", $flag->fid, $node->nid);
463
+
464
+        // Delete comments.
465
+        db_query("DELETE FROM {flag_content}
466 466
                      WHERE content_type = 'comment'
467 467
                        AND content_id IN(
468 468
                     SELECT cid
469 469
                       FROM {comments}
470 470
                      WHERE nid = %d)", $node->nid);
471
-        }
472 471
       }
473
-      break;
474
-    case 'translation_change':
475
-      if (isset($node->translation_change)) {
476
-        // If there is only one node remaining, track by nid rather than tnid.
477
-        // Otherwise, use the new tnid.
478
-        $content_id = $node->translation_change['new_tnid'] == 0 ? $node->translation_change['remaining_nid'] : $node->translation_change['new_tnid'];
479
-        foreach (flag_get_flags('node') as $flag) {
480
-          if ($flag->i18n) {
481
-            db_query("UPDATE {flag_content} SET content_id = %d WHERE fid = %d AND content_id = %d", $content_id, $flag->fid, $node->translation_change['old_tnid']);
482
-            db_query("UPDATE {flag_counts} SET content_id = %d WHERE fid = %d AND content_id = %d", $content_id, $flag->fid, $node->translation_change['old_tnid']);
483
-          }
472
+    }
473
+    break;
474
+  case 'translation_change':
475
+    if (isset($node->translation_change)) {
476
+      // If there is only one node remaining, track by nid rather than tnid.
477
+      // Otherwise, use the new tnid.
478
+      $content_id = $node->translation_change['new_tnid'] == 0 ? $node->translation_change['remaining_nid'] : $node->translation_change['new_tnid'];
479
+      foreach (flag_get_flags('node') as $flag) {
480
+        if ($flag->i18n) {
481
+          db_query("UPDATE {flag_content} SET content_id = %d WHERE fid = %d AND content_id = %d", $content_id, $flag->fid, $node->translation_change['old_tnid']);
482
+          db_query("UPDATE {flag_counts} SET content_id = %d WHERE fid = %d AND content_id = %d", $content_id, $flag->fid, $node->translation_change['old_tnid']);
484 483
         }
485 484
       }
486
-      break;
485
+    }
486
+    break;
487 487
   }
488 488
 }
489 489
 
@@ -492,74 +492,74 @@  discard block
 block discarded – undo
492 492
  */
493 493
 function flag_user($op, &$edit, &$account, $category = NULL) {
494 494
   switch ($op) {
495
-    case 'login':
496
-      // Migrate anonymous flags to this user's account.
497
-      if (module_exists('session_api') && ($sid = flag_get_sid(0))) {
498
-        // The @ symbol suppresses errors if the user flags a piece of content
499
-        // they have already flagged as a logged-in user.
500
-        @db_query("UPDATE {flag_content} SET uid = %d, sid = 0 WHERE uid = 0 AND sid = %d", $account->uid, $sid);
501
-
502
-        // Delete any remaining flags this user had as an anonymous user. We use the
503
-        // proper unflag action here to make sure the count gets decremented again
504
-        // and so that other modules can clean up their tables if needed.
505
-        $result = db_query("SELECT fcid, fid, content_id FROM {flag_content} WHERE uid = 0 AND sid = %d", $sid);
506
-        $anonymous_user = drupal_anonymous_user();
507
-        while ($row = db_fetch_array($result)) {
508
-          $flag = flag_get_flag(NULL, $row['fid']);
509
-          $flag->flag('unflag', $row['content_id'], $anonymous_user, TRUE);
510
-        }
495
+  case 'login':
496
+    // Migrate anonymous flags to this user's account.
497
+    if (module_exists('session_api') && ($sid = flag_get_sid(0))) {
498
+      // The @ symbol suppresses errors if the user flags a piece of content
499
+      // they have already flagged as a logged-in user.
500
+      @db_query("UPDATE {flag_content} SET uid = %d, sid = 0 WHERE uid = 0 AND sid = %d", $account->uid, $sid);
501
+
502
+      // Delete any remaining flags this user had as an anonymous user. We use the
503
+      // proper unflag action here to make sure the count gets decremented again
504
+      // and so that other modules can clean up their tables if needed.
505
+      $result = db_query("SELECT fcid, fid, content_id FROM {flag_content} WHERE uid = 0 AND sid = %d", $sid);
506
+      $anonymous_user = drupal_anonymous_user();
507
+      while ($row = db_fetch_array($result)) {
508
+        $flag = flag_get_flag(NULL, $row['fid']);
509
+        $flag->flag('unflag', $row['content_id'], $anonymous_user, TRUE);
510
+      }
511 511
 
512
-        // Clean up anonymous cookies.
513
-        FlagCookieStorage::drop();
512
+      // Clean up anonymous cookies.
513
+      FlagCookieStorage::drop();
514
+    }
515
+    break;
516
+  case 'delete':
517
+    // Remove flags by this user.
518
+    $result = db_query("SELECT fc.fid, fc.content_id, c.count FROM {flag_content} fc LEFT JOIN {flag_counts} c ON fc.content_id = c.content_id AND fc.content_type = c.content_type WHERE fc.uid = %d", $account->uid);
519
+    while ($flag_data = db_fetch_object($result)) {
520
+      $flag_data->count--;
521
+      // Only decrement the flag count table if it's greater than 1.
522
+      if ($flag_data->count > 0) {
523
+        db_query("UPDATE {flag_counts} SET count = %d WHERE fid = %d AND content_id = %d", $flag_data->count, $flag_data->fid, $flag_data->content_id);
514 524
       }
515
-      break;
516
-    case 'delete':
517
-      // Remove flags by this user.
518
-      $result = db_query("SELECT fc.fid, fc.content_id, c.count FROM {flag_content} fc LEFT JOIN {flag_counts} c ON fc.content_id = c.content_id AND fc.content_type = c.content_type WHERE fc.uid = %d", $account->uid);
519
-      while ($flag_data = db_fetch_object($result)) {
520
-        $flag_data->count--;
521
-        // Only decrement the flag count table if it's greater than 1.
522
-        if ($flag_data->count > 0) {
523
-          db_query("UPDATE {flag_counts} SET count = %d WHERE fid = %d AND content_id = %d", $flag_data->count, $flag_data->fid, $flag_data->content_id);
524
-        }
525
-        elseif ($flag_data->count == 0) {
526
-          db_query("DELETE FROM {flag_counts} WHERE fid = %d AND content_id = %d", $flag_data->fid, $flag_data->content_id);
527
-        }
525
+      elseif ($flag_data->count == 0) {
526
+        db_query("DELETE FROM {flag_counts} WHERE fid = %d AND content_id = %d", $flag_data->fid, $flag_data->content_id);
528 527
       }
529
-      db_query("DELETE FROM {flag_content} WHERE uid = %d", $account->uid);
530
-
531
-      // Remove flags that have been done to this user.
532
-      db_query("DELETE FROM {flag_counts} WHERE content_type = 'user' AND content_id = %d", $account->uid);
533
-      db_query("DELETE FROM {flag_content} WHERE content_type = 'user' AND content_id = %d", $account->uid);
534
-      break;
535
-    case 'view';
536
-      $flags = flag_get_flags('user');
537
-      $flag_items = array();
538
-      foreach ($flags as $flag) {
539
-        if (!$flag->access($account->uid)) {
540
-          // User has no permission to use this flag.
541
-          continue;
542
-        }
543
-        if (!$flag->uses_hook_link(array())) {
544
-          // Flag not set to appear on profile.
545
-          continue;
546
-        }
547
-        $flag_items[$flag->name] = array(
548
-          '#type' => 'user_profile_item',
549
-          '#title' => $flag->get_title($account->uid),
550
-          '#value' => $flag->theme($flag->is_flagged($account->uid) ? 'unflag' : 'flag', $account->uid),
551
-          '#attributes' => array('class' => 'flag-profile-' . $flag->name),
552
-        );
528
+    }
529
+    db_query("DELETE FROM {flag_content} WHERE uid = %d", $account->uid);
530
+
531
+    // Remove flags that have been done to this user.
532
+    db_query("DELETE FROM {flag_counts} WHERE content_type = 'user' AND content_id = %d", $account->uid);
533
+    db_query("DELETE FROM {flag_content} WHERE content_type = 'user' AND content_id = %d", $account->uid);
534
+    break;
535
+  case 'view';
536
+    $flags = flag_get_flags('user');
537
+    $flag_items = array();
538
+    foreach ($flags as $flag) {
539
+      if (!$flag->access($account->uid)) {
540
+        // User has no permission to use this flag.
541
+        continue;
553 542
       }
554
-      if (!empty($flag_items)) {
555
-        $account->content['flags'] = $flag_items;
556
-        $account->content['flags'] += array(
557
-          '#type' => 'user_profile_category',
558
-          '#title' => t('Actions'),
559
-          '#attributes' => array('class' => 'flag-profile'),
560
-        );
543
+      if (!$flag->uses_hook_link(array())) {
544
+        // Flag not set to appear on profile.
545
+        continue;
561 546
       }
562
-      break;
547
+      $flag_items[$flag->name] = array(
548
+        '#type' => 'user_profile_item',
549
+        '#title' => $flag->get_title($account->uid),
550
+        '#value' => $flag->theme($flag->is_flagged($account->uid) ? 'unflag' : 'flag', $account->uid),
551
+        '#attributes' => array('class' => 'flag-profile-' . $flag->name),
552
+      );
553
+    }
554
+    if (!empty($flag_items)) {
555
+      $account->content['flags'] = $flag_items;
556
+      $account->content['flags'] += array(
557
+        '#type' => 'user_profile_category',
558
+        '#title' => t('Actions'),
559
+        '#attributes' => array('class' => 'flag-profile'),
560
+      );
561
+    }
562
+    break;
563 563
   }
564 564
 }
565 565
 
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
  */
589 589
 function flag_node_type($op, $info) {
590 590
   switch ($op) {
591
-    case 'delete':
592
-      // Remove entry from flaggable content types.
593
-      db_query("DELETE FROM {flag_types} WHERE type = '%s'", $info->type);
594
-      break;
591
+  case 'delete':
592
+    // Remove entry from flaggable content types.
593
+    db_query("DELETE FROM {flag_types} WHERE type = '%s'", $info->type);
594
+    break;
595 595
   }
596 596
 }
597 597
 
@@ -1012,15 +1012,15 @@  discard block
 block discarded – undo
1012 1012
  */
1013 1013
 function flag_comment(&$comment, $op) {
1014 1014
   switch ($op) {
1015
-    case 'delete':
1016
-      db_query("DELETE FROM {flag_content}
1015
+  case 'delete':
1016
+    db_query("DELETE FROM {flag_content}
1017 1017
                  WHERE content_type = 'comment'
1018 1018
                    AND content_id = %d", $comment->cid);
1019 1019
 
1020
-      db_query("DELETE FROM {flag_counts}
1020
+    db_query("DELETE FROM {flag_counts}
1021 1021
                  WHERE content_type = 'comment'
1022 1022
                    AND content_id = %d", $comment->cid);
1023
-      break;
1023
+    break;
1024 1024
   }
1025 1025
 }
1026 1026
 
@@ -1029,10 +1029,10 @@  discard block
 block discarded – undo
1029 1029
  */
1030 1030
 function flag_mail($key, &$message, $params) {
1031 1031
   switch ($key) {
1032
-    case 'over_threshold':
1033
-      $message['subject'] = $params['subject'];
1034
-      $message['body'] = $params['body'];
1035
-      break;
1032
+  case 'over_threshold':
1033
+    $message['subject'] = $params['subject'];
1034
+    $message['body'] = $params['body'];
1035
+    break;
1036 1036
   }
1037 1037
 }
1038 1038
 
Please login to merge, or discard this patch.
views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc 1 patch
Switch Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -57,92 +57,92 @@
 block discarded – undo
57 57
     $transform = isset($this->argument->options['validate_argument_transform']) ? $this->argument->options['validate_argument_transform'] : FALSE;
58 58
 
59 59
     switch ($type) {
60
-      case 'tid':
61
-        if (!is_numeric($argument)) {
62
-          return FALSE;
63
-        }
64
-
65
-        $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid = %d", 't', 'tid', array($argument)),  $argument));
66
-        if (!$result) {
67
-          return FALSE;
68
-        }
69
-
70
-        return empty($vids) || !empty($vids[$result->vid]);
71
-      case 'tids':
72
-        // An empty argument is not a term so doesn't pass.
73
-        if (empty($argument)) {
74
-          return FALSE;
75
-        }
76
-
77
-        $tids = new stdClass();
78
-        $tids->value = $argument;
79
-        $tids = views_break_phrase($argument, $tids);
80
-        if ($tids->value == array(-1)) {
81
-          return FALSE;
82
-        }
83
-
84
-        $test = drupal_map_assoc($tids->value);
85
-        $titles = array();
86
-
87
-        // check, if some tids already verified
88
-        static $validated_cache = array();
89
-        foreach ($test as $tid) {
90
-          if (isset($validated_cache[$tid])) {
91
-            if ($validated_cache[$tid] === FALSE) {
92
-              return FALSE;
93
-            }
94
-            else {
95
-              $titles[] = $validated_cache[$tid];
96
-              unset($test[$tid]);
97
-            }
60
+    case 'tid':
61
+      if (!is_numeric($argument)) {
62
+        return FALSE;
63
+      }
64
+
65
+      $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid = %d", 't', 'tid', array($argument)),  $argument));
66
+      if (!$result) {
67
+        return FALSE;
68
+      }
69
+
70
+      return empty($vids) || !empty($vids[$result->vid]);
71
+    case 'tids':
72
+      // An empty argument is not a term so doesn't pass.
73
+      if (empty($argument)) {
74
+        return FALSE;
75
+      }
76
+
77
+      $tids = new stdClass();
78
+      $tids->value = $argument;
79
+      $tids = views_break_phrase($argument, $tids);
80
+      if ($tids->value == array(-1)) {
81
+        return FALSE;
82
+      }
83
+
84
+      $test = drupal_map_assoc($tids->value);
85
+      $titles = array();
86
+
87
+      // check, if some tids already verified
88
+      static $validated_cache = array();
89
+      foreach ($test as $tid) {
90
+        if (isset($validated_cache[$tid])) {
91
+          if ($validated_cache[$tid] === FALSE) {
92
+            return FALSE;
93
+          }
94
+          else {
95
+            $titles[] = $validated_cache[$tid];
96
+            unset($test[$tid]);
98 97
           }
99 98
         }
99
+      }
100 100
 
101 101
 
102
-        // if unverified tids left - verify them and cache results
103
-        if (count($test)) {
104
-          $placeholders = implode(', ', array_fill(0, count($test), '%d'));
102
+      // if unverified tids left - verify them and cache results
103
+      if (count($test)) {
104
+        $placeholders = implode(', ', array_fill(0, count($test), '%d'));
105 105
 
106
-          $result = db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid IN ($placeholders)", 't', 'tid', array($test)), $test);
107
-          while ($term = db_fetch_object($result)) {
108
-            if ($vids && empty($vids[$term->vid])) {
109
-              $validated_cache[$term->tid] = FALSE;
110
-              return FALSE;
111
-            }
112
-
113
-            $titles[] = $validated_cache[$term->tid] = check_plain($term->name);
114
-            unset($test[$term->tid]);
106
+        $result = db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t WHERE t.tid IN ($placeholders)", 't', 'tid', array($test)), $test);
107
+        while ($term = db_fetch_object($result)) {
108
+          if ($vids && empty($vids[$term->vid])) {
109
+            $validated_cache[$term->tid] = FALSE;
110
+            return FALSE;
115 111
           }
116
-        }
117
-
118
-        // Remove duplicate titles
119
-        $titles = array_unique($titles);
120
-
121
-        $this->argument->validated_title = implode($tids->operator == 'or' ? ' + ' : ', ', $titles);
122
-        // If this is not empty, we did not find a tid.
123
-        return empty($test);
124
-      case 'name':
125
-      case 'convert':
126
-        $and = '';
127
-        if (!empty($vids)) {
128
-          $and = " AND t.vid IN(" . implode(', ', $vids) . ')';
129
-        }
130
-        if ($transform) {
131
-          $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (replace(t.name, ' ', '-') = '%s' OR replace(ts.name, ' ', '-') = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument));
132
-        }
133
-        else {
134
-          $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (t.name = '%s' OR ts.name = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument));
135
-        }
136
-        if (!$result) {
137
-          return FALSE;
138
-        }
139 112
 
140
-        if ($type == 'convert') {
141
-          $this->argument->argument = $result->tid;
113
+          $titles[] = $validated_cache[$term->tid] = check_plain($term->name);
114
+          unset($test[$term->tid]);
142 115
         }
143
-        $this->argument->validated_title = check_plain($result->name);
144
-
145
-        return TRUE;
116
+      }
117
+
118
+      // Remove duplicate titles
119
+      $titles = array_unique($titles);
120
+
121
+      $this->argument->validated_title = implode($tids->operator == 'or' ? ' + ' : ', ', $titles);
122
+      // If this is not empty, we did not find a tid.
123
+      return empty($test);
124
+    case 'name':
125
+    case 'convert':
126
+      $and = '';
127
+      if (!empty($vids)) {
128
+        $and = " AND t.vid IN(" . implode(', ', $vids) . ')';
129
+      }
130
+      if ($transform) {
131
+        $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (replace(t.name, ' ', '-') = '%s' OR replace(ts.name, ' ', '-') = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument));
132
+      }
133
+      else {
134
+        $result = db_fetch_object(db_query(db_rewrite_sql("SELECT t.* FROM {term_data} t LEFT JOIN {term_synonym} ts ON ts.tid = t.tid WHERE (t.name = '%s' OR ts.name = '%s')$and", 't', 'tid', array($argument, $argument)), $argument, $argument));
135
+      }
136
+      if (!$result) {
137
+        return FALSE;
138
+      }
139
+
140
+      if ($type == 'convert') {
141
+        $this->argument->argument = $result->tid;
142
+      }
143
+      $this->argument->validated_title = check_plain($result->name);
144
+
145
+      return TRUE;
146 146
     }
147 147
   }
148 148
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/themes/boinc/template.php 1 patch
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -626,13 +626,13 @@  discard block
 block discarded – undo
626 626
   $sender = user_load($sender->uid);
627 627
   
628 628
   switch ($status) {
629
-    case FLAG_FRIEND_FLAGGED:
630
-      // Sender accepted recipient's friend request
631
-      $email['subject'] = bts('!name accepted your friend request [!site]', array(
632
-        '!name' => $sender->boincuser_name,
633
-        '!site' => variable_get('site_name', 'Drupal-BOINC'),
634
-        ), NULL, 'boinc:friend-request-email');
635
-      $email['body'] = bts('!name confirmed you as a friend on !site.
629
+  case FLAG_FRIEND_FLAGGED:
630
+    // Sender accepted recipient's friend request
631
+    $email['subject'] = bts('!name accepted your friend request [!site]', array(
632
+      '!name' => $sender->boincuser_name,
633
+      '!site' => variable_get('site_name', 'Drupal-BOINC'),
634
+      ), NULL, 'boinc:friend-request-email');
635
+    $email['body'] = bts('!name confirmed you as a friend on !site.
636 636
 
637 637
 Follow this link to view his or her profile:
638 638
 !link
@@ -641,17 +641,17 @@  discard block
 block discarded – undo
641 641
 
642 642
 Thanks,
643 643
 The !site team', array(
644
-        '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
645
-        '!site' => variable_get('site_name', 'Drupal-BOINC'),
646
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
647
-        '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
648
-        ), array(), NULL, 'boinc:friend-request-email');
649
-      break;
644
+      '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
645
+      '!site' => variable_get('site_name', 'Drupal-BOINC'),
646
+      '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
647
+      '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
648
+      ), array(), NULL, 'boinc:friend-request-email');
649
+    break;
650 650
 
651
-    case FLAG_FRIEND_PENDING:
652
-      // Sender is requesting to be recipient's friend
653
-      $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email');
654
-      $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
651
+  case FLAG_FRIEND_PENDING:
652
+    // Sender is requesting to be recipient's friend
653
+    $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email');
654
+    $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
655 655
 
656 656
 Follow the link below to view this request:
657 657
 !link
@@ -660,13 +660,13 @@  discard block
 block discarded – undo
660 660
 
661 661
 Thanks,
662 662
 The !site team', array(
663
-        '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
664
-        '!site' => variable_get('site_name', 'Drupal-BOINC'),
665
-        '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
666
-        '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
667
-        ),
668
-      array(), NULL, 'boinc:friend-request-email');
669
-      break;
663
+      '!name' => isset($sender->boincuser_name) ? $sender->boincuser_name : $sender->name,
664
+      '!site' => variable_get('site_name', 'Drupal-BOINC'),
665
+      '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
666
+      '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
667
+      ),
668
+    array(), NULL, 'boinc:friend-request-email');
669
+    break;
670 670
   }
671 671
   return $email;
672 672
 }
Please login to merge, or discard this patch.
default/boinc/modules/boinctranslate/includes/boinctranslate.helpers.inc 1 patch
Switch Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1398,72 +1398,72 @@
 block discarded – undo
1398 1398
 
1399 1399
   switch ($op) {
1400 1400
     // Return stored strings
1401
-    case 'mem-report':
1402
-      return $strings;
1403
-
1404
-      // Store string in memory (only supports single strings)
1405
-    case 'mem-store':
1406
-      $strings[$value['msgid']] = $value['msgstr'];
1407
-      return;
1408
-
1409
-      // Called at end of import to inform the user
1410
-    case 'db-report':
1411
-      return array(
1412
-        $headerdone,
1413
-        $report['additions'],
1414
-        $report['updates'],
1415
-        $report['deletes'],
1416
-        $report['skips'],
1417
-      );
1401
+  case 'mem-report':
1402
+    return $strings;
1403
+
1404
+    // Store string in memory (only supports single strings)
1405
+  case 'mem-store':
1406
+    $strings[$value['msgid']] = $value['msgstr'];
1407
+    return;
1408
+
1409
+    // Called at end of import to inform the user
1410
+  case 'db-report':
1411
+    return array(
1412
+      $headerdone,
1413
+      $report['additions'],
1414
+      $report['updates'],
1415
+      $report['deletes'],
1416
+      $report['skips'],
1417
+    );
1418 1418
 
1419
-      // Store the string we got in the database.
1420
-    case 'db-store':
1421
-      // We got header information.
1422
-      if ($value['msgid'] == '') {
1423
-        $languages = language_list();
1424
-        if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) {
1425
-          // Since we only need to parse the header if we ought to update the
1426
-          // plural formula, only run this if we don't need to keep existing
1427
-          // data untouched or if we don't have an existing plural formula.
1428
-          $header = _locale_import_parse_header($value['msgstr']);
1429
-
1430
-          // Get and store the plural formula if available.
1431
-          if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1432
-            list($nplurals, $plural) = $p;
1433
-            db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang);
1434
-          }
1419
+    // Store the string we got in the database.
1420
+  case 'db-store':
1421
+    // We got header information.
1422
+    if ($value['msgid'] == '') {
1423
+      $languages = language_list();
1424
+      if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) {
1425
+        // Since we only need to parse the header if we ought to update the
1426
+        // plural formula, only run this if we don't need to keep existing
1427
+        // data untouched or if we don't have an existing plural formula.
1428
+        $header = _locale_import_parse_header($value['msgstr']);
1429
+
1430
+        // Get and store the plural formula if available.
1431
+        if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1432
+          list($nplurals, $plural) = $p;
1433
+          db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang);
1435 1434
         }
1436
-        $headerdone = TRUE;
1437 1435
       }
1436
+      $headerdone = TRUE;
1437
+    }
1438 1438
 
1439
-      else {
1440
-        // Some real string to import.
1441
-        $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
1442
-
1443
-        if (strpos($value['msgid'], "\0")) {
1444
-          // This string has plural versions.
1445
-          $english = explode("\0", $value['msgid'], 2);
1446
-          $entries = array_keys($value['msgstr']);
1447
-          for ($i = 3; $i <= count($entries); $i++) {
1448
-            $english[] = $english[1];
1449
-          }
1450
-          $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1451
-          $english = array_map('_locale_import_append_plural', $english, $entries);
1452
-          foreach ($translation as $key => $trans) {
1453
-            if ($key == 0) {
1454
-              $plid = 0;
1455
-            }
1456
-            $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
1439
+    else {
1440
+      // Some real string to import.
1441
+      $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
1442
+
1443
+      if (strpos($value['msgid'], "\0")) {
1444
+        // This string has plural versions.
1445
+        $english = explode("\0", $value['msgid'], 2);
1446
+        $entries = array_keys($value['msgstr']);
1447
+        for ($i = 3; $i <= count($entries); $i++) {
1448
+          $english[] = $english[1];
1449
+        }
1450
+        $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1451
+        $english = array_map('_locale_import_append_plural', $english, $entries);
1452
+        foreach ($translation as $key => $trans) {
1453
+          if ($key == 0) {
1454
+            $plid = 0;
1457 1455
           }
1456
+          $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
1458 1457
         }
1458
+      }
1459 1459
 
1460
-        else {
1461
-          // A simple string to import.
1462
-          $english = $value['msgid'];
1463
-          $translation = $value['msgstr'];
1464
-          _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1465
-        }
1460
+      else {
1461
+        // A simple string to import.
1462
+        $english = $value['msgid'];
1463
+        $translation = $value['msgstr'];
1464
+        _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1466 1465
       }
1466
+    }
1467 1467
   } // end of db-store operation
1468 1468
 }
1469 1469
 
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/includes/boincwork.helpers.inc 1 patch
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
     }
644 644
     break;
645 645
     
646
-    default:
647
-      // Don't generate form elements for things that aren't explicitly form
648
-      // elements (i.e. 'title', '@attributes' keys, and the like)
646
+  default:
647
+    // Don't generate form elements for things that aren't explicitly form
648
+    // elements (i.e. 'title', '@attributes' keys, and the like)
649 649
   }
650 650
 }
651 651
 
@@ -1863,29 +1863,29 @@  discard block
 block discarded – undo
1863 1863
  */
1864 1864
 function pretty_application_version($appverid, $vernum, $plan_class, $plfm) {
1865 1865
   switch ($appverid) {
1866
-    case ANON_PLATFORM_UNKNOWN:
1867
-      return "Anonymous platform";
1868
-    case ANON_PLATFORM_CPU:
1869
-      return "Anonymous platform CPU";
1870
-    case ANON_PLATFORM_NVIDIA:
1871
-      return "Anonymous platform NVIDIA GPU";
1872
-    case ANON_PLATFORM_ATI:
1873
-      return "Anonymous platform ATI GPU";
1874
-    case ANON_PLATFORM_INTEL:
1875
-      return "Anonymous platform Intel GPU";
1876
-    case 0:
1877
-      return "---";
1878
-    default:
1879
-      // Handle the case where the appversid is still negative. This
1880
-      // may be cause BOINC has introduced a new anonymous platform
1881
-      // that is not handled by the above case statements.
1882
-      if ($appverid < 0) {
1883
-        return "Unknown Anonymous platform";
1884
-      }
1885
-      else {
1886
-        $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100);
1887
-        $prettyc = ($plan_class) ? "($av->plan_class)" : '';
1888
-        return "v$prettyv $prettyc $plfm";
1889
-      }
1866
+  case ANON_PLATFORM_UNKNOWN:
1867
+    return "Anonymous platform";
1868
+  case ANON_PLATFORM_CPU:
1869
+    return "Anonymous platform CPU";
1870
+  case ANON_PLATFORM_NVIDIA:
1871
+    return "Anonymous platform NVIDIA GPU";
1872
+  case ANON_PLATFORM_ATI:
1873
+    return "Anonymous platform ATI GPU";
1874
+  case ANON_PLATFORM_INTEL:
1875
+    return "Anonymous platform Intel GPU";
1876
+  case 0:
1877
+    return "---";
1878
+  default:
1879
+    // Handle the case where the appversid is still negative. This
1880
+    // may be cause BOINC has introduced a new anonymous platform
1881
+    // that is not handled by the above case statements.
1882
+    if ($appverid < 0) {
1883
+      return "Unknown Anonymous platform";
1884
+    }
1885
+    else {
1886
+      $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100);
1887
+      $prettyc = ($plan_class) ? "($av->plan_class)" : '';
1888
+      return "v$prettyv $prettyc $plfm";
1889
+    }
1890 1890
   }
1891 1891
 }
Please login to merge, or discard this patch.