Completed
Push — master ( 039fd9...05172b )
by Christian
52s
created
sites/default/boinc/modules/contrib/privatemsg/privatemsg.author-pane.inc 4 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,45 +9,45 @@
 block discarded – undo
9 9
  * Implements hook_preprocess_author_pane().
10 10
  */
11 11
 function privatemsg_preprocess_author_pane(&$variables) {
12
-  global $user;
13
-  $account = $variables['account'];
14
-  $account_id = $account->uid;
15
-  $account_name = $account->name;
12
+    global $user;
13
+    $account = $variables['account'];
14
+    $account_id = $account->uid;
15
+    $account_name = $account->name;
16 16
 
17
-  if (function_exists('author_pane_api') && author_pane_api() == "2") {
17
+    if (function_exists('author_pane_api') && author_pane_api() == "2") {
18 18
     // Author Pane 2.x
19 19
 
20 20
     // Check if this preprocess needs to be run given who's calling it.
21 21
     if (!author_pane_run_preprocess('privatemsg', $variables['caller'])) {
22
-      return;
22
+        return;
23 23
     }
24 24
 
25 25
     $url = privatemsg_get_link($account);
26 26
     if (!empty($url)) {
27
-      $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE));
27
+        $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE));
28 28
 
29
-      // Early versions of the template used this variable so fill it for
30
-      // backwards compatability.
31
-      $variables['privatemsg_link'] = $variables['privatemsg'];
29
+        // Early versions of the template used this variable so fill it for
30
+        // backwards compatability.
31
+        $variables['privatemsg_link'] = $variables['privatemsg'];
32 32
     }
33
-  }
34
-  else {
33
+    }
34
+    else {
35 35
     // Author Pane 1.x
36 36
 
37 37
     $image_path = $variables['image_path'];
38 38
 
39 39
     // Send private message
40 40
     if ($url = privatemsg_get_link($account)) {
41
-      $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE);
42
-      $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE));
43
-      $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE));
41
+        $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE);
42
+        $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE));
43
+        $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE));
44
+    }
44 45
     }
45
-  }
46 46
 }
47 47
 
48 48
 /**
49 49
  * Implementation of hook_author_pane_allow_preprocess_disable().
50 50
  */
51 51
 function privatemsg_author_pane_allow_preprocess_disable() {
52
-  return array('privatemsg' => 'Privatemsg');
52
+    return array('privatemsg' => 'Privatemsg');
53 53
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
     $url = privatemsg_get_link($account);
26 26
     if (!empty($url)) {
27
-      $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE));
27
+      $variables['privatemsg'] = l('<span>'.t('Send PM').'</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE));
28 28
 
29 29
       // Early versions of the template used this variable so fill it for
30 30
       // backwards compatability.
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
30 30
       // backwards compatability.
31 31
       $variables['privatemsg_link'] = $variables['privatemsg'];
32 32
     }
33
-  }
34
-  else {
33
+  } else {
35 34
     // Author Pane 1.x
36 35
 
37 36
     $image_path = $variables['image_path'];
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     $url = privatemsg_get_link($account);
26 26
     if (!empty($url)) {
27
-      $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => TRUE));
27
+      $variables['privatemsg'] = l('<span>' . t('Send PM') . '</span>', $url, array('attributes' => array('class' => 'author-pane-link', 'title' => t('Send @name a private message', array('@name' => $account_name))), 'html' => true));
28 28
 
29 29
       // Early versions of the template used this variable so fill it for
30 30
       // backwards compatability.
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
     // Send private message
40 40
     if ($url = privatemsg_get_link($account)) {
41
-      $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), NULL, TRUE);
42
-      $variables['privatemsg'] = l($img, $url, array('absolute' => TRUE, 'html' => TRUE));
43
-      $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => TRUE));
41
+      $img = theme('image', "$image_path/private-message.png", t('Send private message'), t('Send private message'), null, true);
42
+      $variables['privatemsg'] = l($img, $url, array('absolute' => true, 'html' => true));
43
+      $variables['privatemsg_link'] = l(t('Send private message'), $url, array('attributes' => array('class' => 'author-privatemsg-icon'), 'html' => true));
44 44
     }
45 45
   }
46 46
 }
Please login to merge, or discard this patch.
modules/contrib/privatemsg/views/views_handler_field_privatemsg_link.inc 4 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -10,62 +10,62 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class views_handler_field_privatemsg_link extends views_handler_field {
12 12
 
13
-  /**
14
-   * Add uid as a additional field.
15
-   */
16
-  function construct() {
13
+    /**
14
+     * Add uid as a additional field.
15
+     */
16
+    function construct() {
17 17
     parent::construct();
18 18
     $this->additional_fields['uid'] = 'uid';
19
-  }
19
+    }
20 20
 
21
-  /**
22
-   * Define our additional configuration setting.
23
-   */
24
-  function option_definition() {
21
+    /**
22
+     * Define our additional configuration setting.
23
+     */
24
+    function option_definition() {
25 25
     $options = parent::option_definition();
26 26
     $options['text'] = array('default' => '', 'translatable' => TRUE);
27 27
     $options['subject'] = array('default' => '', 'translatable' => TRUE);
28 28
     $options['return'] = array('default' => TRUE, 'translatable' => FALSE);
29 29
     return $options;
30
-  }
31
-
32
-  /**
33
-   * Define the configuration form for our textfield.
34
-   */
35
-  function options_form(&$form, &$form_state) {
36
-     $form['label'] = array(
37
-      '#type' => 'textfield',
38
-      '#title' => t('Label'),
39
-      '#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
40
-      '#description' => t('The label for this field that will be displayed to end users if the style requires it.'),
30
+    }
31
+
32
+    /**
33
+     * Define the configuration form for our textfield.
34
+     */
35
+    function options_form(&$form, &$form_state) {
36
+        $form['label'] = array(
37
+        '#type' => 'textfield',
38
+        '#title' => t('Label'),
39
+        '#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
40
+        '#description' => t('The label for this field that will be displayed to end users if the style requires it.'),
41 41
     );
42 42
 
43 43
     $form['text'] = array(
44
-      '#type' => 'textfield',
45
-      '#title' => t('Text to display'),
46
-      '#default_value' => $this->options['text'],
47
-      '#description' => t('Define the text to use for the link title. You can use replacement tokens to insert any existing field output.'),
44
+        '#type' => 'textfield',
45
+        '#title' => t('Text to display'),
46
+        '#default_value' => $this->options['text'],
47
+        '#description' => t('Define the text to use for the link title. You can use replacement tokens to insert any existing field output.'),
48 48
     );
49 49
 
50 50
     $form['subject'] = array(
51
-      '#type' => 'textfield',
52
-      '#title' => t('Pre-filled subject'),
53
-      '#default_value' => $this->options['subject'],
54
-      '#description' => t('Define the subject that will be pre-filled in the send message form. You can use replacement tokens to insert any existing field output.'),
51
+        '#type' => 'textfield',
52
+        '#title' => t('Pre-filled subject'),
53
+        '#default_value' => $this->options['subject'],
54
+        '#description' => t('Define the subject that will be pre-filled in the send message form. You can use replacement tokens to insert any existing field output.'),
55 55
     );
56 56
 
57 57
     // Get a list of the available fields and arguments for token replacement.
58 58
     $options = array();
59 59
     foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
60
-      $options[t('Fields')]["[$field]"] = $handler->ui_name();
61
-      // We only use fields up to (and including) this one.
62
-      if ($field == $this->options['id']) {
60
+        $options[t('Fields')]["[$field]"] = $handler->ui_name();
61
+        // We only use fields up to (and including) this one.
62
+        if ($field == $this->options['id']) {
63 63
         break;
64
-      }
64
+        }
65 65
     }
66 66
     $count = 0; // This lets us prepare the key as we want it printed.
67 67
     foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
68
-      $options[t('Arguments')]['%' . ++$count] = $handler->ui_name();
68
+        $options[t('Arguments')]['%' . ++$count] = $handler->ui_name();
69 69
     }
70 70
 
71 71
 
@@ -73,81 +73,81 @@  discard block
 block discarded – undo
73 73
     $output = t('<p>You must add some additional fields to this display before using this field. These fields may be marked as <em>Exclude from display</em> if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>');
74 74
     // We have some options, so make a list.
75 75
     if (!empty($options)) {
76
-      $output = t('<p>The following substitution patterns are available for this display. Use the pattern shown on the left to display the value indicated on the right. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>');
77
-      foreach (array_keys($options) as $type) {
76
+        $output = t('<p>The following substitution patterns are available for this display. Use the pattern shown on the left to display the value indicated on the right. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.</p>');
77
+        foreach (array_keys($options) as $type) {
78 78
         if (!empty($options[$type])) {
79
-          $items = array();
80
-          $title = t(ucwords($type));
81
-          foreach ($options[$type] as $key => $value) {
79
+            $items = array();
80
+            $title = t(ucwords($type));
81
+            foreach ($options[$type] as $key => $value) {
82 82
             $items[] = $key .' == '. $value;
83
-          }
84
-          $output .= theme('item_list', $items, $title);
83
+            }
84
+            $output .= theme('item_list', $items, $title);
85
+        }
85 86
         }
86
-      }
87 87
     }
88 88
 
89 89
     $form['help'] = array(
90
-      '#type' => 'markup',
91
-      '#id' => 'views-tokens-help',
92
-      '#value' => '<div><fieldset id="views-tokens-help"><legend>' . t('Replacement patterns') . '</legend>' . $output . '</fieldset></div>',
90
+        '#type' => 'markup',
91
+        '#id' => 'views-tokens-help',
92
+        '#value' => '<div><fieldset id="views-tokens-help"><legend>' . t('Replacement patterns') . '</legend>' . $output . '</fieldset></div>',
93 93
     );
94 94
 
95 95
     $form['return'] = array(
96
-      '#type' => 'checkbox',
97
-      '#title' => t('Return to view after message was sent.'),
98
-      '#default_value' => $this->options['return'],
99
-      '#description' => t('Should the user be redirected back to the current view when the message was sent.'),
96
+        '#type' => 'checkbox',
97
+        '#title' => t('Return to view after message was sent.'),
98
+        '#default_value' => $this->options['return'],
99
+        '#description' => t('Should the user be redirected back to the current view when the message was sent.'),
100 100
     );
101
-  }
101
+    }
102 102
 
103
-  /**
104
-   * Renders our field, displays a link if the user is allowed to.
105
-   */
106
-  function render($values) {
103
+    /**
104
+     * Renders our field, displays a link if the user is allowed to.
105
+     */
106
+    function render($values) {
107 107
     if (isset($values->uid)) {
108
-      $uid = $values->uid;
108
+        $uid = $values->uid;
109 109
     }
110 110
     elseif (isset($values->users_uid)) {
111
-      $uid = $values->users_uid;
111
+        $uid = $values->users_uid;
112 112
     }
113 113
     else {
114
-      return '';
114
+        return '';
115 115
     }
116 116
     $text = t('Write private message');
117 117
     if (!empty($this->options['text'])) {
118
-      $tokens = $this->get_render_tokens($this);
119
-      $text = strip_tags(strtr($this->options['text'], $tokens));
118
+        $tokens = $this->get_render_tokens($this);
119
+        $text = strip_tags(strtr($this->options['text'], $tokens));
120 120
     }
121 121
     $subject = NULL;
122 122
     if (!empty($this->options['subject'])) {
123
-      $tokens = $this->get_render_tokens($this);
124
-      $subject = strip_tags(strtr($this->options['subject'], $tokens));
123
+        $tokens = $this->get_render_tokens($this);
124
+        $subject = strip_tags(strtr($this->options['subject'], $tokens));
125 125
     }
126 126
 
127 127
     $options = array();
128 128
     if ($this->options['return']) {
129
-      $options['query'] = drupal_get_destination();
129
+        $options['query'] = drupal_get_destination();
130 130
     }
131 131
 
132 132
     $data = '';
133 133
     if (($recipient = user_load($uid)) && ($url = privatemsg_get_link(array($recipient), NULL, $subject))) {
134
-      $data = l($text, $url, $options);
134
+        $data = l($text, $url, $options);
135 135
     }
136 136
     return $data;
137
-  }
137
+    }
138 138
 
139
-  /**
140
-   * Only display the column for users with the appropriate permission.
141
-   */
142
-  function access() {
139
+    /**
140
+     * Only display the column for users with the appropriate permission.
141
+     */
142
+    function access() {
143 143
     return privatemsg_user_access('write privatemsg');
144
-  }
144
+    }
145 145
 
146
-  /**
147
-   * Just do some basic checks, don't add "privatemsg_link" as field.
148
-   */
149
-  function query() {
146
+    /**
147
+     * Just do some basic checks, don't add "privatemsg_link" as field.
148
+     */
149
+    function query() {
150 150
     $this->ensure_my_table();
151 151
     $this->add_additional_fields();
152
-  }
152
+    }
153 153
 }
154 154
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     }
66 66
     $count = 0; // This lets us prepare the key as we want it printed.
67 67
     foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
68
-      $options[t('Arguments')]['%' . ++$count] = $handler->ui_name();
68
+      $options[t('Arguments')]['%'.++$count] = $handler->ui_name();
69 69
     }
70 70
 
71 71
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
           $items = array();
80 80
           $title = t(ucwords($type));
81 81
           foreach ($options[$type] as $key => $value) {
82
-            $items[] = $key .' == '. $value;
82
+            $items[] = $key.' == '.$value;
83 83
           }
84 84
           $output .= theme('item_list', $items, $title);
85 85
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     $form['help'] = array(
90 90
       '#type' => 'markup',
91 91
       '#id' => 'views-tokens-help',
92
-      '#value' => '<div><fieldset id="views-tokens-help"><legend>' . t('Replacement patterns') . '</legend>' . $output . '</fieldset></div>',
92
+      '#value' => '<div><fieldset id="views-tokens-help"><legend>'.t('Replacement patterns').'</legend>'.$output.'</fieldset></div>',
93 93
     );
94 94
 
95 95
     $form['return'] = array(
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,11 +106,9 @@
 block discarded – undo
106 106
   function render($values) {
107 107
     if (isset($values->uid)) {
108 108
       $uid = $values->uid;
109
-    }
110
-    elseif (isset($values->users_uid)) {
109
+    } elseif (isset($values->users_uid)) {
111 110
       $uid = $values->users_uid;
112
-    }
113
-    else {
111
+    } else {
114 112
       return '';
115 113
     }
116 114
     $text = t('Write private message');
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
    */
24 24
   function option_definition() {
25 25
     $options = parent::option_definition();
26
-    $options['text'] = array('default' => '', 'translatable' => TRUE);
27
-    $options['subject'] = array('default' => '', 'translatable' => TRUE);
28
-    $options['return'] = array('default' => TRUE, 'translatable' => FALSE);
26
+    $options['text'] = array('default' => '', 'translatable' => true);
27
+    $options['subject'] = array('default' => '', 'translatable' => true);
28
+    $options['return'] = array('default' => true, 'translatable' => false);
29 29
     return $options;
30 30
   }
31 31
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
       $tokens = $this->get_render_tokens($this);
119 119
       $text = strip_tags(strtr($this->options['text'], $tokens));
120 120
     }
121
-    $subject = NULL;
121
+    $subject = null;
122 122
     if (!empty($this->options['subject'])) {
123 123
       $tokens = $this->get_render_tokens($this);
124 124
       $subject = strip_tags(strtr($this->options['subject'], $tokens));
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     }
131 131
 
132 132
     $data = '';
133
-    if (($recipient = user_load($uid)) && ($url = privatemsg_get_link(array($recipient), NULL, $subject))) {
133
+    if (($recipient = user_load($uid)) && ($url = privatemsg_get_link(array($recipient), null, $subject))) {
134 134
       $data = l($text, $url, $options);
135 135
     }
136 136
     return $data;
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/privatemsg/views/privatemsg.views.inc 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 function privatemsg_views_data() {
8
-  $data['users']['privatemsg_link'] = array(
8
+    $data['users']['privatemsg_link'] = array(
9 9
     'group' => t('Privatemsg'),
10 10
     'title' => t('Send message'),
11 11
     'field' => array(
12
-      'title' => t('Send Privatemsg link'),
13
-      'help' => t('Displays a link to send a private message to a user.'),
14
-      'handler' => 'views_handler_field_privatemsg_link',
12
+        'title' => t('Send Privatemsg link'),
13
+        'help' => t('Displays a link to send a private message to a user.'),
14
+        'handler' => 'views_handler_field_privatemsg_link',
15 15
     ),
16
-  );
17
-  return $data;
16
+    );
17
+    return $data;
18 18
 }
19 19
 
20 20
 
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
  * Implementation of hook_views_handlers().
23 23
  */
24 24
 function privatemsg_views_handlers() {
25
-  return array(
25
+    return array(
26 26
     'info' => array(
27
-      'path' => drupal_get_path('module', 'privatemsg') . '/views',
27
+        'path' => drupal_get_path('module', 'privatemsg') . '/views',
28 28
     ),
29 29
     'handlers' => array(
30
-      // field handlers
31
-      'views_handler_field_privatemsg_link' => array(
30
+        // field handlers
31
+        'views_handler_field_privatemsg_link' => array(
32 32
         'parent' => 'views_handler_field',
33
-      ),
33
+        ),
34 34
     ),
35
-  );
35
+    );
36 36
 }
37 37
 
38 38
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 function privatemsg_views_handlers() {
25 25
   return array(
26 26
     'info' => array(
27
-      'path' => drupal_get_path('module', 'privatemsg') . '/views',
27
+      'path' => drupal_get_path('module', 'privatemsg').'/views',
28 28
     ),
29 29
     'handlers' => array(
30 30
       // field handlers
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.api.php 3 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
  *   Names that are already in the list and are excluded
123 123
  */
124 124
 function hook_privatemsg_sql_autocomplete_alter(&$fragments, $search, $names) {
125
-  global $user;
126
-  // Extend the query that searches for usernames
125
+    global $user;
126
+    // Extend the query that searches for usernames
127 127
 
128
-  // $fragments is explained in the api documentation in detail
128
+    // $fragments is explained in the api documentation in detail
129 129
 
130
-  // The query is already set up, it's searching for usernames which start with
131
-  // $search and are not $names (may be empty)
132
-  // the main table is {user} a
130
+    // The query is already set up, it's searching for usernames which start with
131
+    // $search and are not $names (may be empty)
132
+    // the main table is {user} a
133 133
 
134
-  // for example, add a join on a table where the user connections are stored
135
-  // and specify that only users connected with the current user should be
136
-  // loaded.
137
-  $fragments['inner_join'] = 'INNER JOIN {my_table} m ON (m.user1 = u.uid AND m.user2 = %d)';
138
-  $fragments['query_args'][] = $user->uid;
134
+    // for example, add a join on a table where the user connections are stored
135
+    // and specify that only users connected with the current user should be
136
+    // loaded.
137
+    $fragments['inner_join'] = 'INNER JOIN {my_table} m ON (m.user1 = u.uid AND m.user2 = %d)';
138
+    $fragments['query_args'][] = $user->uid;
139 139
 }
140 140
 
141 141
 /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
  *   Query fragments array.
158 158
  * @param $pmid
159 159
  *   the id of the message.
160
-  * @param $account
160
+ * @param $account
161 161
  *   User object of account for which to load the message.
162 162
  */
163 163
 function hook_privatemsg_sql_load_alter(&$fragments, $pmid, $account = NULL) {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
  *    Message array
275 275
  */
276 276
 function hook_privatemsg_message_load($message) {
277
-  return array('my_key' => 'my_value');
277
+    return array('my_key' => 'my_value');
278 278
 }
279 279
 
280 280
 /**
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
  *   Message array
303 303
  */
304 304
 function hook_privatemsg_message_validate($message, $form = FALSE) {
305
-  global $_privatemsg_invalid_recipients;
306
-  $_privatemsg_invalid_recipients = array();
305
+    global $_privatemsg_invalid_recipients;
306
+    $_privatemsg_invalid_recipients = array();
307 307
 
308
-  $errors = array();
308
+    $errors = array();
309 309
 
310
-  foreach ($message['recipients'] as $recipient) {
310
+    foreach ($message['recipients'] as $recipient) {
311 311
     if ($recipient->name == 'blocked user') {
312
-      $_privatemsg_invalid_recipients[] = $recipient->uid;
313
-      $errors[] = t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipient->name));
312
+        $_privatemsg_invalid_recipients[] = $recipient->uid;
313
+        $errors[] = t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipient->name));
314
+    }
314 315
     }
315
-  }
316 316
 }
317 317
 
318 318
 /**
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
  *   Message array
326 326
  */
327 327
 function hook_privatemsg_message_presave_alter(&$message) {
328
-  // delete recipients which have been marked as invalid
329
-  global $_privatemsg_invalid_recipients;
330
-  foreach ($_privatemsg_invalid_recipients as $invalid) {
328
+    // delete recipients which have been marked as invalid
329
+    global $_privatemsg_invalid_recipients;
330
+    foreach ($_privatemsg_invalid_recipients as $invalid) {
331 331
     unset($message['recipients'][$invalid]);
332
-  }
332
+    }
333 333
 }
334 334
 /**
335 335
  * Act on the $vars before a message is displayed.
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
  *   Template variables
342 342
  */
343 343
 function hook_privatemsg_message_view_alter(&$var) {
344
-  // add a link to each message
345
-  $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'. $vars['message']['mid']);
344
+    // add a link to each message
345
+    $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'. $vars['message']['mid']);
346 346
 }
347 347
 
348 348
 /**
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
  *   Message array
356 356
  */
357 357
 function hook_privatemsg_message_insert($message) {
358
-  _mymodule_save_data($message['mid']);
358
+    _mymodule_save_data($message['mid']);
359 359
 }
360 360
 
361 361
 /**
@@ -384,41 +384,41 @@  discard block
 block discarded – undo
384 384
  *   message (The reason why the recipient has been blocked).
385 385
  */
386 386
 function hook_privatemsg_block_message($author, $recipients) {
387
-  $blocked = array();
388
-  // Loop through each recipient and ensure there is no rule blocking this
389
-  // author from sending them private messages. Use a reference, so when
390
-  // user_load() is needed here the array is updated, negating the need for
391
-  // further calls to user_load() later in the code.
392
-  foreach (array_keys($recipients) as $uid) {
387
+    $blocked = array();
388
+    // Loop through each recipient and ensure there is no rule blocking this
389
+    // author from sending them private messages. Use a reference, so when
390
+    // user_load() is needed here the array is updated, negating the need for
391
+    // further calls to user_load() later in the code.
392
+    foreach (array_keys($recipients) as $uid) {
393 393
 
394 394
     // Ensure we have a recipient user object which includes roles.
395 395
     if (!isset($recipients[$uid]->roles)) {
396
-      $recipients[$uid] = user_load($uid);
396
+        $recipients[$uid] = user_load($uid);
397 397
     }
398 398
     // Note: this is checked whether the author may send the message (see third
399 399
     // parameter). Further below is a check whether the recipient may block it.
400 400
     if (_pm_block_user_rule_exists($author, $recipients[$uid], PM_BLOCK_USER_DISALLOW_SENDING)) {
401
-      $blocked[] = array(
401
+        $blocked[] = array(
402 402
         'uid' => $uid,
403 403
         'message' => t('Sorry, private messaging rules forbid sending messages to !name.', array('!name' => $recipients[$uid]->name)),
404
-      );
404
+        );
405
+    }
405 406
     }
406
-  }
407 407
 
408
-  $args = array_merge(array($author->uid), array_keys($recipients));
409
-  $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args);
410
-  while ($row = db_fetch_array($result)) {
408
+    $args = array_merge(array($author->uid), array_keys($recipients));
409
+    $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args);
410
+    while ($row = db_fetch_array($result)) {
411 411
     $recipient = $recipients[$row['recipient']];
412 412
     // If there's a rule disallowing blocking of this message, send it anyway.
413 413
     if (_pm_block_user_rule_exists($author, $recipient, PM_BLOCK_USER_DISALLOW_BLOCKING)) {
414
-      continue;
414
+        continue;
415 415
     }
416 416
     $blocked[] = array(
417
-      'uid' => $row['recipient'],
418
-      'message' => t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipients[$row['recipient']]->name))
417
+        'uid' => $row['recipient'],
418
+        'message' => t('%name has chosen to not recieve any more messages from you.', array('%name' => $recipients[$row['recipient']]->name))
419 419
     );
420
-  }
421
-  return $blocked;
420
+    }
421
+    return $blocked;
422 422
 }
423 423
 /**
424 424
  * Add content to the view thread page.
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
  * @see privatemsg_list_submit()
453 453
  */
454 454
 function hook_privatemsg_thread_operations() {
455
-  return array(
455
+    return array(
456 456
     'operation key' => array(
457
-      'label' => 'Label of the operation. Only use this if the operation
457
+        'label' => 'Label of the operation. Only use this if the operation
458 458
                   should be displayed automatically in the action form',
459
-      'callback' => 'privatemsg_thread_change_status', // Function callback that will be executed.
460
-      'callback arguments' => array('status' => PRIVATEMSG_READ), // Additional arguments to above function
461
-      'undo callback' => 'privatemsg_thread_change_status',  // Provide a function which can "undo" the operation. Optional.
462
-      'undo callback arguments' => array('status' => PRIVATEMSG_UNREAD), // Additional arguments to above function.
459
+        'callback' => 'privatemsg_thread_change_status', // Function callback that will be executed.
460
+        'callback arguments' => array('status' => PRIVATEMSG_READ), // Additional arguments to above function
461
+        'undo callback' => 'privatemsg_thread_change_status',  // Provide a function which can "undo" the operation. Optional.
462
+        'undo callback arguments' => array('status' => PRIVATEMSG_UNREAD), // Additional arguments to above function.
463 463
     ),
464
-  );
464
+    );
465 465
 }
466 466
 
467 467
 /**
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
  * up the string.
475 475
  */
476 476
 function hook_privatemsg_name_lookup($string) {
477
-  if ((int)$string > 0) {
477
+    if ((int)$string > 0) {
478 478
     // This is a possible uid, try to load a matching user.
479 479
     if ($recipient = user_load(array('uid' => $string))) {
480
-      return $recipient;
480
+        return $recipient;
481
+    }
481 482
     }
482
-  }
483 483
 }
484 484
 
485 485
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
  */
343 343
 function hook_privatemsg_message_view_alter(&$var) {
344 344
   // add a link to each message
345
-  $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'. $vars['message']['mid']);
345
+  $vars['message_links'][] = array('title' => t('My link'), 'href' => '/path/to/my/action/'.$vars['message']['mid']);
346 346
 }
347 347
 
348 348
 /**
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
   }
407 407
 
408 408
   $args = array_merge(array($author->uid), array_keys($recipients));
409
-  $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('. db_placeholders($recipients) .') GROUP BY recipient', $args);
409
+  $result = db_query('SELECT recipient FROM {pm_block_user} WHERE author = %d AND recipient IN ('.db_placeholders($recipients).') GROUP BY recipient', $args);
410 410
   while ($row = db_fetch_array($result)) {
411 411
     $recipient = $recipients[$row['recipient']];
412 412
     // If there's a rule disallowing blocking of this message, send it anyway.
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                   should be displayed automatically in the action form',
459 459
       'callback' => 'privatemsg_thread_change_status', // Function callback that will be executed.
460 460
       'callback arguments' => array('status' => PRIVATEMSG_READ), // Additional arguments to above function
461
-      'undo callback' => 'privatemsg_thread_change_status',  // Provide a function which can "undo" the operation. Optional.
461
+      'undo callback' => 'privatemsg_thread_change_status', // Provide a function which can "undo" the operation. Optional.
462 462
       'undo callback arguments' => array('status' => PRIVATEMSG_UNREAD), // Additional arguments to above function.
463 463
     ),
464 464
   );
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
   * @param $account
161 161
  *   User object of account for which to load the message.
162 162
  */
163
-function hook_privatemsg_sql_load_alter(&$fragments, $pmid, $account = NULL) {
163
+function hook_privatemsg_sql_load_alter(&$fragments, $pmid, $account = null) {
164 164
 
165 165
 }
166 166
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
  * @param $load_all
177 177
  *   Deleted messages are only loaded if this is set to TRUE.
178 178
  */
179
-function hook_privatemsg_sql_messages_alter(&$fragments, $threads, $account = NULL, $load_all = FALSE) {
179
+function hook_privatemsg_sql_messages_alter(&$fragments, $threads, $account = null, $load_all = false) {
180 180
 
181 181
 }
182 182
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  * @param $message
302 302
  *   Message array
303 303
  */
304
-function hook_privatemsg_message_validate($message, $form = FALSE) {
304
+function hook_privatemsg_message_validate($message, $form = false) {
305 305
   global $_privatemsg_invalid_recipients;
306 306
   $_privatemsg_invalid_recipients = array();
307 307
 
Please login to merge, or discard this patch.
modules/contrib/privatemsg/privatemsg_filter/privatemsg_filter.admin.inc 4 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -9,39 +9,39 @@  discard block
 block discarded – undo
9 9
  * Display a list of tags to administer them.
10 10
  */
11 11
 function privatemsg_tags_admin() {
12
-  drupal_set_title(t('Tags'));
12
+    drupal_set_title(t('Tags'));
13 13
 
14
-  $header = array(
14
+    $header = array(
15 15
     'tag' => array(
16
-      'data'    => t('Tag'),
17
-      'field'   => 'tag',
18
-      'class'   => 'privatemsg-filter-header-tag',
19
-      'sort'    => 'asc',
20
-      '#weight' => -40,
16
+        'data'    => t('Tag'),
17
+        'field'   => 'tag',
18
+        'class'   => 'privatemsg-filter-header-tag',
19
+        'sort'    => 'asc',
20
+        '#weight' => -40,
21 21
     ),
22 22
     'usage' => array(
23
-      'data'    => t('Usage'),
24
-      'field'   => 'count',
25
-      'class'   => 'privatemsg-filter-header-usage',
26
-      '#weight' => -30,
23
+        'data'    => t('Usage'),
24
+        'field'   => 'count',
25
+        'class'   => 'privatemsg-filter-header-usage',
26
+        '#weight' => -30,
27 27
     ),
28 28
     'public' => array(
29
-      'data'    => t('Public'),
30
-      'field'   => 'public',
31
-      'class'   => 'privatemsg-filter-header-public',
32
-      '#weight' => -20,
29
+        'data'    => t('Public'),
30
+        'field'   => 'public',
31
+        'class'   => 'privatemsg-filter-header-public',
32
+        '#weight' => -20,
33 33
     ),
34 34
     'operations' => array(
35
-      'data'    => t('Operations'),
36
-      'class'   => 'privatemsg-filter-header-operations',
37
-      '#weight' => -10,
35
+        'data'    => t('Operations'),
36
+        'class'   => 'privatemsg-filter-header-operations',
37
+        '#weight' => -10,
38 38
     ),
39
-  );
40
-  $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter'));
41
-  $result = pager_query($query['query'] . tablesort_sql($header), 100);
39
+    );
40
+    $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter'));
41
+    $result = pager_query($query['query'] . tablesort_sql($header), 100);
42 42
 
43
-  $rows = array();
44
-  while ($tag = db_fetch_array($result)) {
43
+    $rows = array();
44
+    while ($tag = db_fetch_array($result)) {
45 45
     $row = array();
46 46
     $row['tag'] = check_plain($tag['tag']);
47 47
     $row['count'] = $tag['count'];
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
     $row['operations'] .= ' ' . l(t('delete'), 'admin/settings/messages/tags/delete/' . $tag['tag_id']);
51 51
 
52 52
     $rows[] = $row;
53
-  }
53
+    }
54 54
 
55
-  if (empty($rows)) {
55
+    if (empty($rows)) {
56 56
     // Display a message if now tags are available.
57 57
     $rows[] = array(array('data' => t('No tags available.'), 'colspan' => count($header)));
58
-  }
58
+    }
59 59
 
60
-  return theme('table', $header, $rows) . theme('pager');
60
+    return theme('table', $header, $rows) . theme('pager');
61 61
 }
62 62
 
63 63
 /**
@@ -70,36 +70,36 @@  discard block
 block discarded – undo
70 70
  *   new tag form.
71 71
  */
72 72
 function privatemsg_tags_form(&$form_state, $tag_id = NULL) {
73
-  $form = array();
73
+    $form = array();
74 74
 
75
-  if ($tag_id) {
75
+    if ($tag_id) {
76 76
     $tag = db_fetch_array(db_query('SELECT * from {pm_tags} pmt WHERE pmt.tag_id = %d', $tag_id));
77 77
     $form['tag_id'] = array(
78
-      '#value' => $tag_id,
79
-      '#type' => 'value',
78
+        '#value' => $tag_id,
79
+        '#type' => 'value',
80 80
     );
81 81
     drupal_set_title(t('Edit @tag', array('@tag' => $tag['tag'])));
82
-  }
82
+    }
83 83
 
84
-  $form['tag'] = array(
84
+    $form['tag'] = array(
85 85
     '#title' => t('Name'),
86 86
     '#type' => 'textfield',
87 87
     '#default_value' => empty($tag_id) ? NULL : $tag['tag'],
88
-  );
88
+    );
89 89
 
90
-  $form['public'] = array(
90
+    $form['public'] = array(
91 91
     '#title' => t('Public'),
92 92
     '#type' => 'checkbox',
93 93
     '#default_value' => empty($tag_id) ? TRUE : $tag['public'],
94 94
     '#description' => t('Public tags are visible for all users, private tags are only visible if they use them.'),
95
-  );
95
+    );
96 96
 
97
-  $form['submit'] = array(
97
+    $form['submit'] = array(
98 98
     '#value' => empty($tag_id) ? t('Create tag') : t('Save tag'),
99 99
     '#type'  => 'submit',
100
-  );
100
+    );
101 101
 
102
-  return $form;
102
+    return $form;
103 103
 }
104 104
 
105 105
 /**
@@ -108,34 +108,34 @@  discard block
 block discarded – undo
108 108
  * Make sure that a tag name is unique.
109 109
  */
110 110
 function privatemsg_tags_form_validate($form, &$form_state) {
111
-  $tag_id = isset($form_state['values']['tag_id']) ? $form_state['values']['tag_id'] : 0;
112
-  if ($tag_id) {
111
+    $tag_id = isset($form_state['values']['tag_id']) ? $form_state['values']['tag_id'] : 0;
112
+    if ($tag_id) {
113 113
     // We are editing an existing tag, exclude the current tag from the search.
114 114
     $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s' AND tag_id <> %d", $form_state['values']['tag'], $tag_id));
115
-  }
116
-  else {
115
+    }
116
+    else {
117 117
     $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s'", $form_state['values']['tag']));
118
-  }
119
-  if ($exists) {
118
+    }
119
+    if ($exists) {
120 120
     form_set_error('tag', t('Tag already exists, choose a different name.'));
121
-  }
121
+    }
122 122
 }
123 123
 
124 124
 /**
125 125
  * Form submit handler for add/edit forms.
126 126
  */
127 127
 function privatemsg_tags_form_submit($form, &$form_state) {
128
-  if (!empty($form_state['values']['tag_id'])) {
128
+    if (!empty($form_state['values']['tag_id'])) {
129 129
     // Tag already exists, update the existing tag.
130 130
     db_query("UPDATE {pm_tags} SET tag = '%s', public = %d WHERE tag_id = %d", $form_state['values']['tag'], $form_state['values']['public'], $form_state['values']['tag_id']);
131 131
     drupal_set_message(t('Tag updated.'));
132 132
     $form_state['redirect'] = 'admin/settings/messages/tags';
133
-  }
134
-  else {
133
+    }
134
+    else {
135 135
     // Tag does not yet exist, create a new one.
136 136
     db_query("INSERT INTO {pm_tags} (tag, public) VALUES ('%s', %d)", $form_state['values']['tag'], $form_state['values']['public']);
137 137
     drupal_set_message(t('Tag created.'));
138
-  }
138
+    }
139 139
 }
140 140
 
141 141
 /**
@@ -145,28 +145,28 @@  discard block
 block discarded – undo
145 145
  *   Id of the tag that should be deleted.
146 146
  */
147 147
 function privatemsg_filter_tags_delete(&$form_state, $tag_id) {
148
-  $form['tag_id'] = array(
148
+    $form['tag_id'] = array(
149 149
     '#type' => 'value',
150 150
     '#value' => $tag_id,
151
-  );
152
-  return confirm_form($form,
151
+    );
152
+    return confirm_form($form,
153 153
     t('Are you sure you want to delete?'),
154 154
     isset($_GET['destination']) ? $_GET['destination'] : 'admin/settings/messages/tags',
155 155
     t('This action cannot be undone.'),
156 156
     t('Delete'),
157 157
     t('Cancel')
158
-  );
158
+    );
159 159
 }
160 160
 
161 161
 /**
162 162
  * Submit handler for the confirm delete form.
163 163
  */
164 164
 function privatemsg_filter_tags_delete_submit($form, &$form_state) {
165
-  if ($form_state['values']['confirm']) {
165
+    if ($form_state['values']['confirm']) {
166 166
     db_query('DELETE FROM {pm_tags} WHERE tag_id = %d', $form_state['values']['tag_id']);
167 167
     db_query('DELETE FROM {pm_tags_index} WHERE tag_id = %d', $form_state['values']['tag_id']);
168 168
 
169 169
     drupal_set_message(t('Tag has been deleted'));
170
-  }
171
-  $form_state['redirect'] = 'admin/settings/messages/tags';
170
+    }
171
+    $form_state['redirect'] = 'admin/settings/messages/tags';
172 172
 }
173 173
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     ),
39 39
   );
40 40
   $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter'));
41
-  $result = pager_query($query['query'] . tablesort_sql($header), 100);
41
+  $result = pager_query($query['query'].tablesort_sql($header), 100);
42 42
 
43 43
   $rows = array();
44 44
   while ($tag = db_fetch_array($result)) {
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     $row['tag'] = check_plain($tag['tag']);
47 47
     $row['count'] = $tag['count'];
48 48
     $row['public'] = $tag['public'] ? t('Yes') : '-';
49
-    $row['operations'] = l(t('edit'), 'admin/settings/messages/tags/edit/' . $tag['tag_id']);
50
-    $row['operations'] .= ' ' . l(t('delete'), 'admin/settings/messages/tags/delete/' . $tag['tag_id']);
49
+    $row['operations'] = l(t('edit'), 'admin/settings/messages/tags/edit/'.$tag['tag_id']);
50
+    $row['operations'] .= ' '.l(t('delete'), 'admin/settings/messages/tags/delete/'.$tag['tag_id']);
51 51
 
52 52
     $rows[] = $row;
53 53
   }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     $rows[] = array(array('data' => t('No tags available.'), 'colspan' => count($header)));
58 58
   }
59 59
 
60
-  return theme('table', $header, $rows) . theme('pager');
60
+  return theme('table', $header, $rows).theme('pager');
61 61
 }
62 62
 
63 63
 /**
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,8 +112,7 @@  discard block
 block discarded – undo
112 112
   if ($tag_id) {
113 113
     // We are editing an existing tag, exclude the current tag from the search.
114 114
     $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s' AND tag_id <> %d", $form_state['values']['tag'], $tag_id));
115
-  }
116
-  else {
115
+  } else {
117 116
     $exists = db_result(db_query("SELECT 1 FROM {pm_tags} WHERE tag = '%s'", $form_state['values']['tag']));
118 117
   }
119 118
   if ($exists) {
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
     db_query("UPDATE {pm_tags} SET tag = '%s', public = %d WHERE tag_id = %d", $form_state['values']['tag'], $form_state['values']['public'], $form_state['values']['tag_id']);
131 130
     drupal_set_message(t('Tag updated.'));
132 131
     $form_state['redirect'] = 'admin/settings/messages/tags';
133
-  }
134
-  else {
132
+  } else {
135 133
     // Tag does not yet exist, create a new one.
136 134
     db_query("INSERT INTO {pm_tags} (tag, public) VALUES ('%s', %d)", $form_state['values']['tag'], $form_state['values']['public']);
137 135
     drupal_set_message(t('Tag created.'));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  *   Tag Id if an edit form should be displayed, NULL for a create
70 70
  *   new tag form.
71 71
  */
72
-function privatemsg_tags_form(&$form_state, $tag_id = NULL) {
72
+function privatemsg_tags_form(&$form_state, $tag_id = null) {
73 73
   $form = array();
74 74
 
75 75
   if ($tag_id) {
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
   $form['tag'] = array(
85 85
     '#title' => t('Name'),
86 86
     '#type' => 'textfield',
87
-    '#default_value' => empty($tag_id) ? NULL : $tag['tag'],
87
+    '#default_value' => empty($tag_id) ? null : $tag['tag'],
88 88
   );
89 89
 
90 90
   $form['public'] = array(
91 91
     '#title' => t('Public'),
92 92
     '#type' => 'checkbox',
93
-    '#default_value' => empty($tag_id) ? TRUE : $tag['public'],
93
+    '#default_value' => empty($tag_id) ? true : $tag['public'],
94 94
     '#description' => t('Public tags are visible for all users, private tags are only visible if they use them.'),
95 95
   );
96 96
 
Please login to merge, or discard this patch.
boinc/modules/contrib/privatemsg/privatemsg_filter/privatemsg_filter.module 5 patches
Indentation   +314 added lines, -314 removed lines patch added patch discarded remove patch
@@ -9,34 +9,34 @@  discard block
 block discarded – undo
9 9
  * Implements hook_perm().
10 10
  */
11 11
 function privatemsg_filter_perm() {
12
-  return array(
12
+    return array(
13 13
     'filter private messages',
14 14
     'tag private messages',
15 15
     'create private message tags',
16
-  );
16
+    );
17 17
 }
18 18
 
19 19
 /**
20 20
  * Implements hook_menu().
21 21
  */
22 22
 function privatemsg_filter_menu() {
23
-  $items['admin/settings/messages/filter'] = array(
23
+    $items['admin/settings/messages/filter'] = array(
24 24
     'title'            => 'Filter',
25 25
     'description'      => 'Configure filter settings.',
26 26
     'page callback'    => 'drupal_get_form',
27 27
     'page arguments'   => array('privatemsg_filter_admin'),
28 28
     'access arguments' => array('administer privatemsg settings'),
29 29
     'type'             => MENU_LOCAL_TASK,
30
-  );
31
-  $items['admin/settings/messages/tags'] = array(
30
+    );
31
+    $items['admin/settings/messages/tags'] = array(
32 32
     'title'            => 'Tags',
33 33
     'description'      => 'Configure tags.',
34 34
     'page callback'    => 'privatemsg_tags_admin',
35 35
     'access arguments' => array('administer privatemsg settings'),
36 36
     'type'             => MENU_LOCAL_TASK,
37 37
     'file'             => 'privatemsg_filter.admin.inc',
38
-  );
39
-  $items['admin/settings/messages/tags/list'] = array(
38
+    );
39
+    $items['admin/settings/messages/tags/list'] = array(
40 40
     'title'            => 'List',
41 41
     'description'      => 'Configure tags.',
42 42
     'page callback'    => 'privatemsg_tags_admin',
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
     'type'             => MENU_DEFAULT_LOCAL_TASK,
45 45
     'file'             => 'privatemsg_filter.admin.inc',
46 46
     'weight'           => -10,
47
-  );
48
-  $items['admin/settings/messages/tags/add'] = array(
47
+    );
48
+    $items['admin/settings/messages/tags/add'] = array(
49 49
     'title'            => 'Add',
50 50
     'description'      => 'Configure tags.',
51 51
     'page callback'    => 'drupal_get_form',
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
     'access arguments' => array('administer privatemsg settings'),
54 54
     'type'             => MENU_LOCAL_TASK,
55 55
     'file'             => 'privatemsg_filter.admin.inc',
56
-  );
57
-  $items['admin/settings/messages/tags/edit/%'] = array(
56
+    );
57
+    $items['admin/settings/messages/tags/edit/%'] = array(
58 58
     'title'            => 'Add',
59 59
     'description'      => 'Configure tags.',
60 60
     'page callback'    => 'drupal_get_form',
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
     'access arguments' => array('administer privatemsg settings'),
63 63
     'type'             => MENU_CALLBACK,
64 64
     'file'             => 'privatemsg_filter.admin.inc',
65
-  );
66
-  $items['admin/settings/messages/tags/delete/%'] = array(
65
+    );
66
+    $items['admin/settings/messages/tags/delete/%'] = array(
67 67
     'title'            => 'Add',
68 68
     'description'      => 'Configure tags.',
69 69
     'page callback'    => 'drupal_get_form',
@@ -71,62 +71,62 @@  discard block
 block discarded – undo
71 71
     'access arguments' => array('administer privatemsg settings'),
72 72
     'type'             => MENU_CALLBACK,
73 73
     'file'             => 'privatemsg_filter.admin.inc',
74
-  );
75
-  $items['messages/inbox'] = array(
74
+    );
75
+    $items['messages/inbox'] = array(
76 76
     'title'            => 'Inbox',
77 77
     'page callback'    => 'drupal_get_form',
78 78
     'page arguments'   => array('privatemsg_list', 'inbox'),
79 79
     'access callback'  => 'privatemsg_user_access',
80 80
     'type'             => variable_get('privatemsg_filter_default_list', 0) ? MENU_LOCAL_TASK : MENU_DEFAULT_LOCAL_TASK,
81 81
     'weight'           => -15,
82
-  );
83
-  $items['messages/sent'] = array(
82
+    );
83
+    $items['messages/sent'] = array(
84 84
     'title'            => 'Sent messages',
85 85
     'page callback'    => 'drupal_get_form',
86 86
     'page arguments'   => array('privatemsg_list', 'sent'),
87 87
     'access callback'  => 'privatemsg_user_access',
88 88
     'type'             => MENU_LOCAL_TASK,
89 89
     'weight'           => -12,
90
-  );
91
-  $items['messages/filter/user-name-autocomplete'] = array(
90
+    );
91
+    $items['messages/filter/user-name-autocomplete'] = array(
92 92
     'page callback'    => 'privatemsg_user_name_autocomplete',
93 93
     'access callback'  => 'privatemsg_user_access',
94 94
     'access arguments' => array('write privatemsg'),
95 95
     'type'             => MENU_CALLBACK,
96
-  );
97
-  $items['messages/filter/tag-autocomplete'] = array(
96
+    );
97
+    $items['messages/filter/tag-autocomplete'] = array(
98 98
     'page callback'    => 'privatemsg_filter_tags_autocomplete',
99 99
     'access callback'  => 'privatemsg_user_access',
100 100
     'access arguments' => array('tag private messages'),
101 101
     'type'             => MENU_CALLBACK,
102 102
     'weight'           => -10,
103
-  );
104
-  return $items;
103
+    );
104
+    return $items;
105 105
 }
106 106
 
107 107
 /**
108 108
  * Implements hook_menu_alter().
109 109
  */
110 110
 function privatemsg_filter_menu_alter(&$items) {
111
-  // Rename messages to "All messages".
112
-  $items['messages/list']['title'] = 'All messages';
111
+    // Rename messages to "All messages".
112
+    $items['messages/list']['title'] = 'All messages';
113 113
 
114
-  if (variable_get('privatemsg_filter_default_list', 0) == 0) {
114
+    if (variable_get('privatemsg_filter_default_list', 0) == 0) {
115 115
     // Change default argument of /messages to inbox. and set the task to MENU_LOCAL_TASK.
116 116
     $items['messages']['page arguments'] = array('privatemsg_list', 'inbox');
117 117
     $items['messages/list']['type'] = MENU_LOCAL_TASK;
118
-  }
118
+    }
119 119
 }
120 120
 
121 121
 function privatemsg_filter_admin() {
122
-  $form = array();
122
+    $form = array();
123 123
 
124
-  $form['privatemsg_filter_searchbody'] = array(
124
+    $form['privatemsg_filter_searchbody'] = array(
125 125
     '#type'          => 'checkbox',
126 126
     '#title'         => t('Search message body'),
127 127
     '#description'   => t('WARNING: turning on this feature will slow down search performance by a large factor. Gets worse as your messages database increases.'),
128 128
     '#default_value' => variable_get('privatemsg_filter_searchbody', FALSE),
129
-  );
129
+    );
130 130
 
131 131
     $form['privatemsg_filter_tagfield_weight'] = array(
132 132
     '#type'          => 'textfield',
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     '#description'   => t('Use higher values to push the form lower down the page, lower or negative values to raise it higher.'),
135 135
     '#size'          => 4,
136 136
     '#default_value' => variable_get('privatemsg_filter_tagfield_weight', 10),
137
-  );
137
+    );
138 138
 
139
-  return system_settings_form($form);
139
+    return system_settings_form($form);
140 140
 }
141 141
 
142 142
 /**
@@ -145,26 +145,26 @@  discard block
 block discarded – undo
145 145
  * Add a filter widget to the message listing pages.
146 146
  */
147 147
 function privatemsg_filter_form_private_message_settings_alter(&$form, $form_state) {
148
-  $form['privatemsg_listing']['privatemsg_filter_default_list'] = array(
148
+    $form['privatemsg_listing']['privatemsg_filter_default_list'] = array(
149 149
     '#type' => 'radios',
150 150
     '#default_value' => variable_get('privatemsg_filter_default_list', 0),
151 151
     '#options' => array(t('Inbox'), t('All messages')),
152 152
     '#title' => t('Choose the default list option'),
153 153
     '#description' => t('Choose which of the two lists are shown by default when following the messages link.'),
154
-  );
155
-  // Add tags to the list of possible columns.
156
-  $form['privatemsg_listing']['privatemsg_display_fields']['#options']['tags'] = t('Tags');
154
+    );
155
+    // Add tags to the list of possible columns.
156
+    $form['privatemsg_listing']['privatemsg_display_fields']['#options']['tags'] = t('Tags');
157 157
 
158
-  $form['#submit'][] = 'privatemsg_filter_settings_submit';
158
+    $form['#submit'][] = 'privatemsg_filter_settings_submit';
159 159
 }
160 160
 
161 161
 /**
162 162
  * Rebuilding the menu if necessary.
163 163
  */
164 164
 function privatemsg_filter_settings_submit($form, &$form_state) {
165
-  if ($form['privatemsg_listing']['privatemsg_filter_default_list']['#default_value'] != $form_state['values']['privatemsg_filter_default_list']) {
165
+    if ($form['privatemsg_listing']['privatemsg_filter_default_list']['#default_value'] != $form_state['values']['privatemsg_filter_default_list']) {
166 166
     menu_rebuild();
167
-  }
167
+    }
168 168
 }
169 169
 
170 170
 /**
@@ -174,33 +174,33 @@  discard block
 block discarded – undo
174 174
  *   A single tag or an array of tags.
175 175
  */
176 176
 function privatemsg_filter_create_tags($tags) {
177
-  if (!is_array($tags)) {
177
+    if (!is_array($tags)) {
178 178
     $tags = array($tags);
179
-  }
179
+    }
180 180
 
181
-  $tag_ids = array();
181
+    $tag_ids = array();
182 182
 
183
-  foreach ($tags as $tag) {
183
+    foreach ($tags as $tag) {
184 184
     $tag = trim($tag);
185 185
     if (empty($tag)) {
186
-      // Do not save a blank tag.
187
-      continue;
186
+        // Do not save a blank tag.
187
+        continue;
188 188
     }
189 189
 
190 190
     // Check if the tag already exists and only create the tag if it does not.
191 191
     $tag_id = db_result(db_query("SELECT tag_id FROM {pm_tags} WHERE tag = '%s'", $tag));
192 192
     if (empty($tag_id) && privatemsg_user_access('create private message tags')) {
193
-      db_query("INSERT INTO {pm_tags} (tag) VALUES ('%s')", $tag);
194
-      $tag_id = db_last_insert_id('pm_tags', 'tag_id');
193
+        db_query("INSERT INTO {pm_tags} (tag) VALUES ('%s')", $tag);
194
+        $tag_id = db_last_insert_id('pm_tags', 'tag_id');
195 195
     }
196 196
     elseif (empty($tag_id)) {
197
-      // The user does not have permission to create new tags - disregard this tag and move onto the next.
198
-      drupal_set_message(t('Tag %tag was ignored because you do not have permission to create new tags.', array('%tag' => $tag)));
199
-      continue;
197
+        // The user does not have permission to create new tags - disregard this tag and move onto the next.
198
+        drupal_set_message(t('Tag %tag was ignored because you do not have permission to create new tags.', array('%tag' => $tag)));
199
+        continue;
200 200
     }
201 201
     $tag_ids[] = $tag_id;
202
-  }
203
-  return $tag_ids;
202
+    }
203
+    return $tag_ids;
204 204
 }
205 205
 
206 206
 /**
@@ -212,21 +212,21 @@  discard block
 block discarded – undo
212 212
  *   Id of the tag.
213 213
  */
214 214
 function privatemsg_filter_add_tags($threads, $tag_id, $account = NULL) {
215
-  if (!is_array($threads)) {
215
+    if (!is_array($threads)) {
216 216
     $threads = array($threads);
217
-  }
218
-  if (empty($account)) {
217
+    }
218
+    if (empty($account)) {
219 219
     global $user;
220 220
     $account = drupal_clone($user);
221
-  }
221
+    }
222 222
 
223
-  foreach ($threads as $thread) {
223
+    foreach ($threads as $thread) {
224 224
     // Make sure that we don't add a tag to a thread twice,
225 225
     // only insert if there is no such tag yet.
226 226
     if (db_result(db_query('SELECT COUNT(*) FROM {pm_tags_index} WHERE tag_id = %d AND (uid = %d AND thread_id = %d)', $tag_id, $account->uid, $thread)) == 0) {
227
-      db_query('INSERT INTO {pm_tags_index} (tag_id, uid, thread_id) VALUES (%d, %d, %d)', $tag_id, $account->uid, $thread);
227
+        db_query('INSERT INTO {pm_tags_index} (tag_id, uid, thread_id) VALUES (%d, %d, %d)', $tag_id, $account->uid, $thread);
228
+    }
228 229
     }
229
-  }
230 230
 }
231 231
 
232 232
 /**
@@ -238,238 +238,238 @@  discard block
 block discarded – undo
238 238
  *   Id of the tag - set to NULL to remove all tags.
239 239
  */
240 240
 function privatemsg_filter_remove_tags($threads, $tag_id = NULL, $account = NULL) {
241
-  if (!is_array($threads)) {
241
+    if (!is_array($threads)) {
242 242
     $threads = array($threads);
243
-  }
244
-  if (empty($account)) {
243
+    }
244
+    if (empty($account)) {
245 245
     global $user;
246 246
     $account = drupal_clone($user);
247
-  }
247
+    }
248 248
 
249
-  if (is_null($tag_id)) {
249
+    if (is_null($tag_id)) {
250 250
     // Delete all tag mapping.
251 251
     foreach ($threads as $thread) {
252
-      db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d', $account->uid, $thread);
252
+        db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d', $account->uid, $thread);
253
+    }
253 254
     }
254
-  }
255
-  else {
255
+    else {
256 256
     // Delete tag mapping for the specified tag.
257 257
     foreach ($threads as $thread) {
258
-      db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d AND tag_id = %d', $account->uid, $thread, $tag_id);
258
+        db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d AND tag_id = %d', $account->uid, $thread, $tag_id);
259
+    }
259 260
     }
260
-  }
261 261
 }
262 262
 
263 263
 function privatemsg_filter_get_filter($account) {
264
-  $filter = array();
265
-  if (isset($_GET['tags'])) {
264
+    $filter = array();
265
+    if (isset($_GET['tags'])) {
266 266
     $_GET['tags'] = urldecode($_GET['tags']);
267 267
     $tag_data = privatemsg_filter_get_tags_data($account);
268 268
     foreach (explode(',', $_GET['tags']) as $tag) {
269
-      if (isset($tag_data[$tag])) {
269
+        if (isset($tag_data[$tag])) {
270 270
         $filter['tags'][$tag] = $tag;
271
-      }
272
-      elseif (in_array($tag, $tag_data)) {
271
+        }
272
+        elseif (in_array($tag, $tag_data)) {
273 273
         $filter['tags'][array_search($tag, $tag_data)] = array_search($tag, $tag_data);
274
-      }
274
+        }
275
+    }
275 276
     }
276
-  }
277 277
 
278
-  if (isset($_GET['author'])) {
278
+    if (isset($_GET['author'])) {
279 279
     list($filter['author']) = _privatemsg_parse_userstring($_GET['author']);
280
-  }
280
+    }
281 281
 
282
-  if (isset($_GET['search'])) {
282
+    if (isset($_GET['search'])) {
283 283
     $filter['search'] = $_GET['search'];
284
-  }
284
+    }
285 285
 
286
-  if (!empty($filter)) {
286
+    if (!empty($filter)) {
287 287
     return $filter;
288
-  }
288
+    }
289 289
 
290
-  if (!empty($_SESSION['privatemsg_filter'])) {
290
+    if (!empty($_SESSION['privatemsg_filter'])) {
291 291
     return $_SESSION['privatemsg_filter'];
292
-  }
292
+    }
293 293
 
294 294
 }
295 295
 
296 296
 function privatemsg_filter_get_tags_data($account) {
297
-  static $tag_data;
297
+    static $tag_data;
298 298
 
299
-  if (is_array($tag_data)) {
299
+    if (is_array($tag_data)) {
300 300
     return $tag_data;
301
-  }
301
+    }
302 302
 
303
-  // Only show the tags that a user have used.
304
-  $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter'), $account);
305
-  $results = db_query($query['query']);
303
+    // Only show the tags that a user have used.
304
+    $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter'), $account);
305
+    $results = db_query($query['query']);
306 306
 
307
-  $tag_data = array();
308
-  while ($result = db_fetch_object($results)) {
307
+    $tag_data = array();
308
+    while ($result = db_fetch_object($results)) {
309 309
     $tag_data[$result->tag_id] = $result->tag;
310
-  }
311
-  return $tag_data;
310
+    }
311
+    return $tag_data;
312 312
 }
313 313
 
314 314
 function privatemsg_filter_dropdown(&$form_state, $account) {
315 315
 
316
-  drupal_add_css(drupal_get_path('module', 'privatemsg_filter') .'/privatemsg_filter.css');
316
+    drupal_add_css(drupal_get_path('module', 'privatemsg_filter') .'/privatemsg_filter.css');
317 317
 
318
-  $form['filter'] = array(
318
+    $form['filter'] = array(
319 319
     '#type' => 'fieldset',
320 320
     '#title' => t('Filter messages'),
321 321
     '#collapsible' => TRUE,
322 322
     '#collapsed' => TRUE,
323
-  );
324
-  $form['filter']['search'] = array(
323
+    );
324
+    $form['filter']['search'] = array(
325 325
     '#type' => 'textfield',
326 326
     '#title' => variable_get('privatemsg_filter_searchbody', FALSE) ? t('Search messages') : t('Search subjects'),
327 327
     '#weight' => -20
328
-  );
328
+    );
329 329
 
330
-  $form['filter']['author'] = array(
330
+    $form['filter']['author'] = array(
331 331
     '#type'               => 'textfield',
332 332
     '#title'              => t('Participants'),
333 333
     '#description'        => t('Separate multiple names with commas.'),
334 334
     '#weight'             => -5,
335 335
     '#size'               => 50,
336 336
     '#autocomplete_path'  => 'messages/filter/user-name-autocomplete',
337
-  );
337
+    );
338 338
 
339
-  // Only show form if the user has some messages tagged.
340
-  if (count($tag_data = privatemsg_filter_get_tags_data($account))) {
339
+    // Only show form if the user has some messages tagged.
340
+    if (count($tag_data = privatemsg_filter_get_tags_data($account))) {
341 341
     $form['filter']['tags'] = array(
342
-      '#type' => 'select',
343
-      '#title' => t('Tags'),
344
-      '#options' => $tag_data,
345
-      '#multiple' => TRUE,
346
-      '#size' => 5,
347
-      '#weight' => 0
348
-    );
349
-  }
342
+        '#type' => 'select',
343
+        '#title' => t('Tags'),
344
+        '#options' => $tag_data,
345
+        '#multiple' => TRUE,
346
+        '#size' => 5,
347
+        '#weight' => 0
348
+    );
349
+    }
350 350
     $form['filter']['submit'] = array(
351
-      '#type'     => 'submit',
352
-      '#value'    => t('Filter'),
353
-      '#prefix'   => '<div id="privatemsg-filter-buttons">',
354
-      '#weight'   => 10,
355
-      '#submit'   => array('privatemsg_filter_dropdown_submit'),
351
+        '#type'     => 'submit',
352
+        '#value'    => t('Filter'),
353
+        '#prefix'   => '<div id="privatemsg-filter-buttons">',
354
+        '#weight'   => 10,
355
+        '#submit'   => array('privatemsg_filter_dropdown_submit'),
356 356
     );
357 357
 
358 358
     $form['filter']['save'] = array(
359
-      '#type'     => 'submit',
360
-      '#value'    => t('Save filter'),
361
-      '#suffix'   => '</div>',
362
-      '#weight'   => 11,
363
-      '#submit'   => array('privatemsg_filter_dropdown_submit'),
359
+        '#type'     => 'submit',
360
+        '#value'    => t('Save filter'),
361
+        '#suffix'   => '</div>',
362
+        '#weight'   => 11,
363
+        '#submit'   => array('privatemsg_filter_dropdown_submit'),
364 364
     );
365 365
 
366 366
     if ($filter = privatemsg_filter_get_filter($account)) {
367
-      privatemsg_filter_dropdown_set_active($form, $filter);
367
+        privatemsg_filter_dropdown_set_active($form, $filter);
368 368
     }
369 369
 
370 370
     return $form;
371 371
 }
372 372
 
373 373
 function privatemsg_filter_dropdown_set_active(&$form, $filter) {
374
-  $form['filter']['#title'] = t('Filter messages (active)');
375
-  $form['filter']['#collapsed'] = FALSE;
374
+    $form['filter']['#title'] = t('Filter messages (active)');
375
+    $form['filter']['#collapsed'] = FALSE;
376 376
 
377
-  if (isset($filter['author'])) {
377
+    if (isset($filter['author'])) {
378 378
     $string = '';
379 379
     foreach ($filter['author'] as $author) {
380
-      $string .= $author->name . ', ';
380
+        $string .= $author->name . ', ';
381 381
     }
382 382
     $form['filter']['author']['#default_value'] = $string;
383
-  }
384
-  if (isset($filter['tags'])) {
383
+    }
384
+    if (isset($filter['tags'])) {
385 385
     $form['filter']['tags']['#default_value'] = $filter['tags'];
386
-  }
387
-  if (isset($filter['search'])) {
386
+    }
387
+    if (isset($filter['search'])) {
388 388
     $form['filter']['search']['#default_value'] = $filter['search'];
389
-  }
390
-
391
-  $form['filter']['reset'] = array(
392
-      '#type'     => 'submit',
393
-      '#value'    => t('Reset'),
394
-      '#suffix'   => '</div>',
395
-      '#weight'   => 12,
396
-      '#submit'   => array('privatemsg_filter_dropdown_submit'),
397
-  );
398
-  unset($form['filter']['save']['#suffix']);
389
+    }
390
+
391
+    $form['filter']['reset'] = array(
392
+        '#type'     => 'submit',
393
+        '#value'    => t('Reset'),
394
+        '#suffix'   => '</div>',
395
+        '#weight'   => 12,
396
+        '#submit'   => array('privatemsg_filter_dropdown_submit'),
397
+    );
398
+    unset($form['filter']['save']['#suffix']);
399 399
 }
400 400
 
401 401
 function privatemsg_filter_dropdown_submit($form, &$form_state) {
402 402
 
403
-  if (!empty($form_state['values']['author'])) {
403
+    if (!empty($form_state['values']['author'])) {
404 404
     list($form_state['values']['author']) = _privatemsg_parse_userstring($form_state['values']['author']);
405
-  }
405
+    }
406 406
 
407
-  switch ($form_state['values']['op']) {
407
+    switch ($form_state['values']['op']) {
408 408
     case t('Save filter'):
409 409
       $filter = array();
410
-      if (!empty($form_state['values']['tags'])) {
410
+        if (!empty($form_state['values']['tags'])) {
411 411
         $filter['tags'] = $form_state['values']['tags'];
412
-      }
413
-      if (!empty($form_state['values']['author'])) {
412
+        }
413
+        if (!empty($form_state['values']['author'])) {
414 414
         $filter['author'] = $form_state['values']['author'];
415
-      }
416
-      if (!empty($form_state['values']['search'])) {
415
+        }
416
+        if (!empty($form_state['values']['search'])) {
417 417
         $filter['search'] = $form_state['values']['search'];
418
-      }
419
-      $_SESSION['privatemsg_filter'] = $filter;
420
-      break;
418
+        }
419
+        $_SESSION['privatemsg_filter'] = $filter;
420
+        break;
421 421
     case t('Filter'):
422 422
       drupal_goto($_GET['q'], privatemsg_filter_create_get_query($form_state['values']));
423
-      return;
424
-      break;
423
+        return;
424
+        break;
425 425
     case t('Reset'):
426 426
       $_SESSION['privatemsg_filter'] = array();
427
-      break;
428
-  }
429
-  $form_state['redirect'] = $_GET['q'];
427
+        break;
428
+    }
429
+    $form_state['redirect'] = $_GET['q'];
430 430
 }
431 431
 
432 432
 function privatemsg_filter_create_get_query($filter) {
433
-  $query = array();
434
-  if (isset($filter['tags']) && !empty($filter['tags'])) {
433
+    $query = array();
434
+    if (isset($filter['tags']) && !empty($filter['tags'])) {
435 435
     $ids = array();
436 436
     foreach ($filter['tags'] as $tag) {
437
-      if ((int)$tag > 0) {
437
+        if ((int)$tag > 0) {
438 438
         $ids[] = $tag;
439
-      }
440
-      else {
439
+        }
440
+        else {
441 441
         $query['tags'][] = $tag;
442
-      }
442
+        }
443 443
     }
444 444
     $sql = 'SELECT pmt.tag FROM {pm_tags} pmt WHERE pmt.tag_id IN ('. implode(', ', $filter['tags']) .')';
445 445
     $result = db_query($sql);
446 446
     while ($row = db_fetch_object($result)) {
447
-      $query['tags'][] = $row->tag;
447
+        $query['tags'][] = $row->tag;
448 448
     }
449 449
 
450 450
     if (isset($query['tags'])) {
451
-      $query['tags'] = implode(',', $query['tags']);
451
+        $query['tags'] = implode(',', $query['tags']);
452
+    }
452 453
     }
453
-  }
454 454
 
455
-  if (isset($filter['author']) && !empty($filter['author'])) {
455
+    if (isset($filter['author']) && !empty($filter['author'])) {
456 456
     foreach ($filter['author'] as $author) {
457
-      if (is_object($author) && isset($author->uid) && isset($author->name)) {
457
+        if (is_object($author) && isset($author->uid) && isset($author->name)) {
458 458
         $query['author'][] = $author->name;
459
-      }
460
-      elseif ($author_obj = user_load($author)) {
459
+        }
460
+        elseif ($author_obj = user_load($author)) {
461 461
         $query['author'][] = $author_obj->name;
462
-      }
462
+        }
463 463
     }
464 464
     if (isset($query['author'])) {
465
-      $query['author'] = implode(',', $query['author']);
465
+        $query['author'] = implode(',', $query['author']);
466
+    }
466 467
     }
467
-  }
468 468
 
469
-  if (isset($filter['search']) && !empty($filter['search'])) {
469
+    if (isset($filter['search']) && !empty($filter['search'])) {
470 470
     $query['search'] = $filter['search'];
471
-  }
472
-  return $query;
471
+    }
472
+    return $query;
473 473
 }
474 474
 
475 475
 /**
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
  * Adds a filter widget to the message listing pages.
479 479
  */
480 480
 function privatemsg_filter_form_privatemsg_list_alter(&$form, $form_state) {
481
-  global $user;
481
+    global $user;
482 482
 
483
-  if (privatemsg_user_access('filter private messages') && !empty($form['#data'])) {
483
+    if (privatemsg_user_access('filter private messages') && !empty($form['#data'])) {
484 484
     $form += privatemsg_filter_dropdown($form_state, $form['#account']);
485
-  }
485
+    }
486 486
 
487
-  $fields = array_filter(variable_get('privatemsg_display_fields', array('participants')));
488
-  if (in_array('tags', $fields)) {
487
+    $fields = array_filter(variable_get('privatemsg_display_fields', array('participants')));
488
+    if (in_array('tags', $fields)) {
489 489
     // Load thread id's of the current list.
490 490
     $threads = array_keys($form['#data']);
491 491
 
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
     // Add them to #data
496 496
     $result = db_query($query['query']);
497 497
     while ($tag = db_fetch_array($result)) {
498
-      $form['#data'][$tag['thread_id']]['tags'][$tag['tag_id']] = $tag['tag'];
498
+        $form['#data'][$tag['thread_id']]['tags'][$tag['tag_id']] = $tag['tag'];
499
+    }
499 500
     }
500
-  }
501 501
 
502
-  $tags = privatemsg_filter_get_tags_data($user);
503
-  if (privatemsg_user_access('tag private messages') && !empty($tags) && !empty($form['#data'])) {
502
+    $tags = privatemsg_filter_get_tags_data($user);
503
+    if (privatemsg_user_access('tag private messages') && !empty($tags) && !empty($form['#data'])) {
504 504
     $options = array();
505 505
     $options[] = t('Apply tag...');
506 506
     foreach ($tags as $tag_id => $tag) {
507
-      $options[$tag_id] = $tag;
507
+        $options[$tag_id] = $tag;
508 508
     }
509 509
     $form['actions']['tag-add'] = array(
510
-      '#type'          => 'select',
511
-      '#options'       => $options,
512
-      '#default_value' => 0,
510
+        '#type'          => 'select',
511
+        '#options'       => $options,
512
+        '#default_value' => 0,
513 513
     );
514 514
     $form['actions']['tag-add-submit'] = array(
515 515
         '#prefix'     => '<div class="privatemsg-tag-add-submit">',
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
     );
522 522
     $options[0] = t('Remove Tag...');
523 523
     $form['actions']['tag-remove'] = array(
524
-      '#type'          => 'select',
525
-      '#options'       => $options,
526
-      '#default_value' => 0,
524
+        '#type'          => 'select',
525
+        '#options'       => $options,
526
+        '#default_value' => 0,
527 527
     );
528 528
     $form['actions']['tag-remove-submit'] = array(
529 529
         '#prefix'     => '<div class="privatemsg-tag-remove-submit">',
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 
537 537
     // JS for hiding the submit buttons.
538 538
     drupal_add_js(drupal_get_path('module', 'privatemsg_filter') .'/privatemsg-filter-list.js');
539
-  }
539
+    }
540 540
 }
541 541
 
542 542
 /**
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
  * @see theme_privatemsg_list_header()
546 546
  */
547 547
 function phptemplate_privatemsg_list_header__tags() {
548
-   return array(
548
+    return array(
549 549
     'data' => t('Tags'),
550 550
     'key' => 'tags',
551 551
     'class' => 'privatemsg-header-tags',
552 552
     '#weight' => -42,
553
-  );
553
+    );
554 554
 }
555 555
 
556 556
 
@@ -560,48 +560,48 @@  discard block
 block discarded – undo
560 560
  * @see theme_privatemsg_list_field()
561 561
  */
562 562
 function phptemplate_privatemsg_list_field__tags($thread) {
563
-  if (!empty($thread['tags'])) {
563
+    if (!empty($thread['tags'])) {
564 564
     $tags = array();
565 565
 
566 566
     foreach ($thread['tags'] as $tag_id => $tag) {
567
-      $tags[] = l(strlen($tag) > 15 ? substr($tag, 0, 13) . '...' : $tag, 'messages', array(
567
+        $tags[] = l(strlen($tag) > 15 ? substr($tag, 0, 13) . '...' : $tag, 'messages', array(
568 568
         'attributes' => array('title' => $tag),
569 569
         'query' => array('tags' => $tag)
570
-      ));
570
+        ));
571 571
     }
572 572
     return array(
573
-      'data'  => implode(', ', $tags),
574
-      'class' => 'privatemsg-list-tags',
573
+        'data'  => implode(', ', $tags),
574
+        'class' => 'privatemsg-list-tags',
575 575
     );
576
-  }
576
+    }
577 577
 }
578 578
 
579 579
 /**
580 580
  * Form callback for adding a tag to threads.
581 581
  */
582 582
 function privatemsg_filter_add_tag_submit($form, &$form_state) {
583
-  $operation = array(
583
+    $operation = array(
584 584
     'callback' => 'privatemsg_filter_add_tags',
585 585
     'callback arguments' => array('tag_id' => $form_state['values']['tag-add']),
586 586
     'undo callback' => 'privatemsg_filter_remove_tags',
587 587
     'undo callback arguments' => array('tag_id' => $form_state['values']['tag-add']),
588
-  );
589
-  drupal_set_message(t('The selected conversations have been tagged.'));
590
-  privatemsg_operation_execute($operation, $form_state['values']['threads']);
588
+    );
589
+    drupal_set_message(t('The selected conversations have been tagged.'));
590
+    privatemsg_operation_execute($operation, $form_state['values']['threads']);
591 591
 }
592 592
 
593 593
 /**
594 594
  * Form callback for removing a tag to threads.
595 595
  */
596 596
 function privatemsg_filter_remove_tag_submit($form, &$form_state) {
597
-  $operation = array(
597
+    $operation = array(
598 598
     'callback' => 'privatemsg_filter_remove_tags',
599 599
     'callback arguments' => array('tag_id' => $form_state['values']['tag-remove']),
600 600
     'undo callback' => 'privatemsg_filter_add_tags',
601 601
     'undo callback arguments' => array('tag_id' => $form_state['values']['tag-remove']),
602
-  );
603
-  drupal_set_message(t('The tag has been removed from the selected conversations.'));
604
-  privatemsg_operation_execute($operation, $form_state['values']['threads']);
602
+    );
603
+    drupal_set_message(t('The tag has been removed from the selected conversations.'));
604
+    privatemsg_operation_execute($operation, $form_state['values']['threads']);
605 605
 }
606 606
 
607 607
 /**
@@ -609,114 +609,114 @@  discard block
 block discarded – undo
609 609
  */
610 610
 function privatemsg_filter_privatemsg_sql_list_alter(&$fragments, $account, $argument) {
611 611
 
612
-  // Check if its a filtered view.
613
-  if ($argument == 'sent') {
612
+    // Check if its a filtered view.
613
+    if ($argument == 'sent') {
614 614
     $fragments['where'][]       = "pm.author = %d";
615 615
     $fragments['query_args']['where'][]   = $account->uid;
616
-  }
617
-  if ($argument == 'inbox') {
616
+    }
617
+    if ($argument == 'inbox') {
618 618
     $fragments['having'][]       = '((SELECT pmf.author FROM {pm_message} pmf WHERE pmf.mid = pmi.thread_id) = %d AND COUNT(pmi.thread_id) > 1) OR (SELECT COUNT(*) FROM {pm_message} pmf INNER JOIN {pm_index} pmif ON (pmf.mid = pmif.mid) WHERE pmif.thread_id = pmi.thread_id AND pmf.author <> %d) > 0';
619 619
     $fragments['query_args']['having'][]   = $account->uid;
620 620
     $fragments['query_args']['having'][]   = $account->uid;
621
-  }
621
+    }
622 622
 
623
-  // Filter the message listing by any set tags.
624
-  if ($filter = privatemsg_filter_get_filter($account)) {
623
+    // Filter the message listing by any set tags.
624
+    if ($filter = privatemsg_filter_get_filter($account)) {
625 625
     $count = 0;
626 626
     if (isset($filter['tags']) && !empty($filter['tags'])) {
627
-      foreach ($filter['tags'] as $tag) {
627
+        foreach ($filter['tags'] as $tag) {
628 628
         $fragments['inner_join'][]  = "INNER JOIN {pm_tags_index} pmti$count ON (pmti$count.thread_id = pmi.thread_id AND pmti$count.uid = pmi.uid)";
629 629
         $fragments['where'][]       = "pmti$count.tag_id = %d";
630 630
         $fragments['query_args']['where'][]   = $tag;
631 631
         $count++;
632
-      }
632
+        }
633 633
     }
634 634
 
635 635
     if (isset($filter['author']) && !empty($filter['author'])) {
636
-      foreach ($filter['author'] as $author) {
636
+        foreach ($filter['author'] as $author) {
637 637
         $fragments['inner_join'][]  = "INNER JOIN {pm_index} pmi$count ON (pmi$count.mid = pm.mid)";
638 638
         $fragments['where'][]       = "pmi$count.uid = %d";
639 639
         $fragments['query_args']['where'][]   = $author->uid;
640 640
         $count++;
641
-      }
641
+        }
642 642
     }
643 643
 
644 644
     if (isset($filter['search']) && !empty($filter['search'])) {
645
-      if (variable_get('privatemsg_filter_searchbody', FALSE)) {
645
+        if (variable_get('privatemsg_filter_searchbody', FALSE)) {
646 646
         $fragments['where'][]       = "pm.subject LIKE '%s' OR pm.body LIKE '%s'";
647 647
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
648 648
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
649
-      }
650
-      else {
649
+        }
650
+        else {
651 651
         $fragments['where'][]       = "pm.subject LIKE '%s'";
652 652
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
653
-      }
653
+        }
654
+    }
654 655
     }
655
-  }
656 656
 }
657 657
 
658 658
 /**
659 659
  * Hook into the view messages page to add a form for tagging purposes.
660 660
  */
661 661
 function privatemsg_filter_privatemsg_view_messages_alter(&$content, $thread) {
662
-  if (count($thread['messages']) > 0) {
662
+    if (count($thread['messages']) > 0) {
663 663
     $content['tags']['#value'] = drupal_get_form('privatemsg_filter_form');
664 664
     $content['tags']['#weight'] = variable_get('privatemsg_filter_tagfield_weight', 10);
665
-  }
665
+    }
666 666
 }
667 667
 
668 668
 /**
669 669
  * Form to show and allow modification of tagging information of a conversation.
670 670
  */
671 671
 function privatemsg_filter_form(&$form_state) {
672
-  global $user;
673
-  $thread_id = arg(2);
674
-
675
-  // Get a list of current tags for this thread
676
-  $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter'), $user, array($thread_id));
677
-  $results = db_query($query['query']);
678
-  $count = db_result(db_query($query['count']));
679
-  $tags = '';
680
-  while ($tag = db_fetch_array($results)) {
672
+    global $user;
673
+    $thread_id = arg(2);
674
+
675
+    // Get a list of current tags for this thread
676
+    $query = _privatemsg_assemble_query(array('tags', 'privatemsg_filter'), $user, array($thread_id));
677
+    $results = db_query($query['query']);
678
+    $count = db_result(db_query($query['count']));
679
+    $tags = '';
680
+    while ($tag = db_fetch_array($results)) {
681 681
     $tags .= $tag['tag'] . ', ';
682
-  }
682
+    }
683 683
 
684
-  $form['tags'] = array(
684
+    $form['tags'] = array(
685 685
     '#type' => 'fieldset',
686 686
     '#title' => t('Tags'),
687 687
     '#access' => privatemsg_user_access('tag private messages'),
688 688
     '#collapsible' => TRUE,
689 689
     '#collapsed' => empty($count) ? TRUE : FALSE,
690
-  );
691
-  $form['tags']['user_id'] = array(
690
+    );
691
+    $form['tags']['user_id'] = array(
692 692
     '#type' => 'value',
693 693
     '#value' => $user->uid,
694
-  );
695
-  $form['tags']['thread_id'] = array(
694
+    );
695
+    $form['tags']['thread_id'] = array(
696 696
     '#type' => 'value',
697 697
     '#value' => $thread_id,
698
-  );
698
+    );
699 699
 
700
-  $form['tags']['tags'] = array(
700
+    $form['tags']['tags'] = array(
701 701
     '#type'               => 'textfield',
702 702
     '#title'              => t('Tags for this conversation'),
703 703
     '#description'        => t('Separate multiple tags with commas.'),
704 704
     '#size'               => 50,
705 705
     '#default_value'      => $tags,
706 706
     '#autocomplete_path'  => 'messages/filter/tag-autocomplete',
707
-  );
707
+    );
708 708
 
709
-  $form['tags']['submit'] = array(
709
+    $form['tags']['submit'] = array(
710 710
     '#type'     => 'submit',
711 711
     '#value'    => t('Tag this conversation'),
712 712
     '#submit'   => array('privatemsg_filter_form_submit'),
713
-  );
713
+    );
714 714
 
715
-  return $form;
715
+    return $form;
716 716
 }
717 717
 
718 718
 function privatemsg_filter_form_submit($form, &$form_state) {
719
-  if (isset($form_state['values']['submit'])) {
719
+    if (isset($form_state['values']['submit'])) {
720 720
     $tags = explode(',', $form_state['values']['tags']);
721 721
 
722 722
     // Step 1 - Delete all tag mapping. I cannot think of a better way to remove tags that are no longer in the textfield, so ideas welcome.
@@ -727,10 +727,10 @@  discard block
 block discarded – undo
727 727
 
728 728
     // Step 3 - Save all the tagging data.
729 729
     foreach ($tag_ids as $tag_id) {
730
-      privatemsg_filter_add_tags($form_state['values']['thread_id'], $tag_id);
730
+        privatemsg_filter_add_tags($form_state['values']['thread_id'], $tag_id);
731 731
     }
732 732
     drupal_set_message(t('Tagging information has been saved.'));
733
-  }
733
+    }
734 734
 }
735 735
 
736 736
 /**
@@ -741,28 +741,28 @@  discard block
 block discarded – undo
741 741
  */
742 742
 function privatemsg_filter_tags_autocomplete($string) {
743 743
 
744
-  // 1: Parse $string and build a list of tags.
745
-  $tags = array();
746
-  $fragments = explode(',', $string);
747
-  foreach ($fragments as $index => $tag) {
744
+    // 1: Parse $string and build a list of tags.
745
+    $tags = array();
746
+    $fragments = explode(',', $string);
747
+    foreach ($fragments as $index => $tag) {
748 748
     $tag = trim($tag);
749 749
     $tags[$tag] = $tag;
750
-  }
750
+    }
751 751
 
752
-  // 2: Find the next tag suggestion.
753
-  $fragment = array_pop($tags);
754
-  $matches = array();
755
-  if (!empty($fragment)) {
752
+    // 2: Find the next tag suggestion.
753
+    $fragment = array_pop($tags);
754
+    $matches = array();
755
+    if (!empty($fragment)) {
756 756
     $query = _privatemsg_assemble_query(array('tags_autocomplete', 'privatemsg_filter'), $fragment, $tags);
757 757
     $result = db_query_range($query['query'], $fragment, 0, 10);
758 758
     $prefix = count($tags) ? implode(", ", $tags) .", " : '';
759 759
     // 3: Build proper suggestions and print.
760 760
     while ($tag = db_fetch_object($result)) {
761
-      $matches[$prefix . $tag->tag .", "] = $tag->tag;
761
+        $matches[$prefix . $tag->tag .", "] = $tag->tag;
762 762
     }
763
-  }
764
-  // convert to object to prevent drupal bug, see http://drupal.org/node/175361
765
-  drupal_json((object)$matches);
763
+    }
764
+    // convert to object to prevent drupal bug, see http://drupal.org/node/175361
765
+    drupal_json((object)$matches);
766 766
 }
767 767
 
768 768
 /**
@@ -781,19 +781,19 @@  discard block
 block discarded – undo
781 781
  *   Array of names that are already part of the autocomplete field.
782 782
  */
783 783
 function privatemsg_filter_privatemsg_sql_autocomplete_alter(&$fragments, $search, $names) {
784
-  global $user;
785
-  // arg(1) is an additional URL argument passed to the URL when only
786
-  // users that are listed as recipient for threads of that user should be
787
-  // displayed.
788
-  // @todo: Check if these results can be grouped to avoid unecessary loops.
789
-  if (arg(1) == 'filter') {
784
+    global $user;
785
+    // arg(1) is an additional URL argument passed to the URL when only
786
+    // users that are listed as recipient for threads of that user should be
787
+    // displayed.
788
+    // @todo: Check if these results can be grouped to avoid unecessary loops.
789
+    if (arg(1) == 'filter') {
790 790
     // JOIN on index entries where the to be selected user is a recipient.
791 791
     $fragments['inner_join'][] = 'INNER JOIN {pm_index} pip ON pip.uid = u.uid';
792 792
     // JOIN on rows where the current user is the recipient and that have the
793 793
     // same mid as those above.
794 794
     $fragments['inner_join'][] = 'INNER JOIN {pm_index} piu ON piu.uid = %d AND pip.mid = piu.mid';
795 795
     $fragments['query_args']['join'][] = $user->uid;
796
-  }
796
+    }
797 797
 }
798 798
 
799 799
 /**
@@ -809,19 +809,19 @@  discard block
 block discarded – undo
809 809
  *   Limit the number of tags *per thread*.
810 810
  */
811 811
 function privatemsg_filter_sql_tags(&$fragments, $user = NULL, $threads = NULL, $limit = NULL) {
812
-  $fragments['primary_table'] = '{pm_tags} t';
813
-  $fragments['select'][] = 't.tag';
814
-  $fragments['select'][] = 't.tag_id';
815
-  $fragments['select'][] = 't.public';
812
+    $fragments['primary_table'] = '{pm_tags} t';
813
+    $fragments['select'][] = 't.tag';
814
+    $fragments['select'][] = 't.tag_id';
815
+    $fragments['select'][] = 't.public';
816 816
 
817
-  if (!empty($threads)) {
817
+    if (!empty($threads)) {
818 818
     // If the tag list needs to be for specific threads.
819 819
     $fragments['select'][] = 'ti.thread_id';
820 820
     $fragments['inner_join'][]  = 'INNER JOIN {pm_tags_index} ti on ti.tag_id = t.tag_id';
821 821
     $fragments['where'][] = 'ti.thread_id IN (' . db_placeholders($threads) . ')';
822 822
     $fragments['query_args']['where'] += $threads;
823
-  }
824
-  else {
823
+    }
824
+    else {
825 825
     // Tag usage counter is only used when we select all tags.
826 826
     $fragments['select'][]      = 'COUNT(ti.thread_id) as count';
827 827
     // LEFT JOIN so that unused tags are displayed too.
@@ -829,33 +829,33 @@  discard block
 block discarded – undo
829 829
     $fragments['group_by'][]    = 't.tag_id';
830 830
     $fragments['group_by'][]    = 't.tag';
831 831
     $fragments['group_by'][]    = 't.public';
832
-  }
833
-  if (!empty($user)) {
832
+    }
833
+    if (!empty($user)) {
834 834
     $fragments['where'][]       = 'ti.uid = %d';
835 835
     $fragments['query_args']['where'][] = $user->uid;
836
-  }
837
-
838
-  // Only select n tags per thread (ordered per tag_id), see
839
-  // http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/.
840
-  //
841
-  // It does select how many tags for that thread/uid combination exist that
842
-  // have a lower tag_id and does only select those that have less than $limit.
843
-  //
844
-  // This should only have a very minor performance impact as most users won't
845
-  // tag a thread with 1000 different tags.
846
-  //
847
-  if ($limit) {
836
+    }
837
+
838
+    // Only select n tags per thread (ordered per tag_id), see
839
+    // http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/.
840
+    //
841
+    // It does select how many tags for that thread/uid combination exist that
842
+    // have a lower tag_id and does only select those that have less than $limit.
843
+    //
844
+    // This should only have a very minor performance impact as most users won't
845
+    // tag a thread with 1000 different tags.
846
+    //
847
+    if ($limit) {
848 848
     $fragments['where'][] = '(SELECT count(*) FROM {pm_tags_index} AS pmtic
849 849
                               WHERE pmtic.thread_id = ti.thread_id
850 850
                               AND pmtic.uid = ti.uid
851 851
                               AND pmtic.tag_id < ti.tag_id) < %d';
852 852
     $fragments['query_args']['where'][] = $limit;
853
-  }
854
-  elseif (!empty($threads) || !empty($user)) {
853
+    }
854
+    elseif (!empty($threads) || !empty($user)) {
855 855
     // Only add a sort when we are not loading the tags for the admin page.
856 856
     // Sorting is handled through tablesort_sql() then.
857 857
     $fragments['order_by'][] = 't.tag ASC';
858
-  }
858
+    }
859 859
 }
860 860
 
861 861
 /**
@@ -869,25 +869,25 @@  discard block
 block discarded – undo
869 869
  *   Array of tags not to be used as suggestions.
870 870
  */
871 871
 function privatemsg_filter_sql_tags_autocomplete(&$fragments, $search, $tags) {
872
-  global $user;
873
-
874
-  $fragments['primary_table'] = '{pm_tags} pmt';
875
-  $fragments['select'][] = 'pmt.tag';
876
-  $fragments['where'][] = "pmt.tag LIKE '%s'";
877
-  // Escape % to get through the placeholder replacement.
878
-  $fragments['query_args']['where'][] = $search .'%%';
879
-  if (!empty($tags)) {
872
+    global $user;
873
+
874
+    $fragments['primary_table'] = '{pm_tags} pmt';
875
+    $fragments['select'][] = 'pmt.tag';
876
+    $fragments['where'][] = "pmt.tag LIKE '%s'";
877
+    // Escape % to get through the placeholder replacement.
878
+    $fragments['query_args']['where'][] = $search .'%%';
879
+    if (!empty($tags)) {
880 880
     // Exclude tags.
881 881
     $fragments['where'][] = "pmt.tag NOT IN (". db_placeholders($tags, 'text') .")";
882 882
     $fragments['query_args']['where'] += $tags;
883
-  }
884
-  // LEFT JOIN to be able to load public, unused tags.
885
-  $fragments['inner_join'][]  = 'LEFT JOIN {pm_tags_index} pmti ON pmt.tag_id = pmti.tag_id AND pmti.uid = %d';
886
-  $fragments['query_args']['join'][] = $user->uid;
887
-  // Autocomplete should only display Tags used by that user or public tags.
888
-  // This is done to avoid information disclosure as part of tag names.
889
-  $fragments['where'][] = '(pmti.uid IS NOT NULL OR pmt.public = 1)';
890
-  $fragments['order_by'][] = 'pmt.tag ASC';
883
+    }
884
+    // LEFT JOIN to be able to load public, unused tags.
885
+    $fragments['inner_join'][]  = 'LEFT JOIN {pm_tags_index} pmti ON pmt.tag_id = pmti.tag_id AND pmti.uid = %d';
886
+    $fragments['query_args']['join'][] = $user->uid;
887
+    // Autocomplete should only display Tags used by that user or public tags.
888
+    // This is done to avoid information disclosure as part of tag names.
889
+    $fragments['where'][] = '(pmti.uid IS NOT NULL OR pmt.public = 1)';
890
+    $fragments['order_by'][] = 'pmt.tag ASC';
891 891
 }
892 892
 
893 893
 /**
@@ -898,10 +898,10 @@  discard block
 block discarded – undo
898 898
  * Implement hook_user().
899 899
  */
900 900
 function privatemsg_filter_user($op, &$edit, &$account, $category = NULL) {
901
-  switch ($op) {
902
-      case 'delete':
901
+    switch ($op) {
902
+        case 'delete':
903 903
       // Delete tag information of that user.
904 904
       db_query("DELETE FROM {pm_tags_index} WHERE uid = %d", $account->uid, $account->uid);
905
-      break;
906
-  }
905
+        break;
906
+    }
907 907
 }
Please login to merge, or discard this 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.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 function privatemsg_filter_dropdown(&$form_state, $account) {
315 315
 
316
-  drupal_add_css(drupal_get_path('module', 'privatemsg_filter') .'/privatemsg_filter.css');
316
+  drupal_add_css(drupal_get_path('module', 'privatemsg_filter').'/privatemsg_filter.css');
317 317
 
318 318
   $form['filter'] = array(
319 319
     '#type' => 'fieldset',
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
   if (isset($filter['author'])) {
378 378
     $string = '';
379 379
     foreach ($filter['author'] as $author) {
380
-      $string .= $author->name . ', ';
380
+      $string .= $author->name.', ';
381 381
     }
382 382
     $form['filter']['author']['#default_value'] = $string;
383 383
   }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
         $query['tags'][] = $tag;
442 442
       }
443 443
     }
444
-    $sql = 'SELECT pmt.tag FROM {pm_tags} pmt WHERE pmt.tag_id IN ('. implode(', ', $filter['tags']) .')';
444
+    $sql = 'SELECT pmt.tag FROM {pm_tags} pmt WHERE pmt.tag_id IN ('.implode(', ', $filter['tags']).')';
445 445
     $result = db_query($sql);
446 446
     while ($row = db_fetch_object($result)) {
447 447
       $query['tags'][] = $row->tag;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     );
536 536
 
537 537
     // JS for hiding the submit buttons.
538
-    drupal_add_js(drupal_get_path('module', 'privatemsg_filter') .'/privatemsg-filter-list.js');
538
+    drupal_add_js(drupal_get_path('module', 'privatemsg_filter').'/privatemsg-filter-list.js');
539 539
   }
540 540
 }
541 541
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
     $tags = array();
565 565
 
566 566
     foreach ($thread['tags'] as $tag_id => $tag) {
567
-      $tags[] = l(strlen($tag) > 15 ? substr($tag, 0, 13) . '...' : $tag, 'messages', array(
567
+      $tags[] = l(strlen($tag) > 15 ? substr($tag, 0, 13).'...' : $tag, 'messages', array(
568 568
         'attributes' => array('title' => $tag),
569 569
         'query' => array('tags' => $tag)
570 570
       ));
@@ -611,11 +611,11 @@  discard block
 block discarded – undo
611 611
 
612 612
   // Check if its a filtered view.
613 613
   if ($argument == 'sent') {
614
-    $fragments['where'][]       = "pm.author = %d";
615
-    $fragments['query_args']['where'][]   = $account->uid;
614
+    $fragments['where'][] = "pm.author = %d";
615
+    $fragments['query_args']['where'][] = $account->uid;
616 616
   }
617 617
   if ($argument == 'inbox') {
618
-    $fragments['having'][]       = '((SELECT pmf.author FROM {pm_message} pmf WHERE pmf.mid = pmi.thread_id) = %d AND COUNT(pmi.thread_id) > 1) OR (SELECT COUNT(*) FROM {pm_message} pmf INNER JOIN {pm_index} pmif ON (pmf.mid = pmif.mid) WHERE pmif.thread_id = pmi.thread_id AND pmf.author <> %d) > 0';
618
+    $fragments['having'][] = '((SELECT pmf.author FROM {pm_message} pmf WHERE pmf.mid = pmi.thread_id) = %d AND COUNT(pmi.thread_id) > 1) OR (SELECT COUNT(*) FROM {pm_message} pmf INNER JOIN {pm_index} pmif ON (pmf.mid = pmif.mid) WHERE pmif.thread_id = pmi.thread_id AND pmf.author <> %d) > 0';
619 619
     $fragments['query_args']['having'][]   = $account->uid;
620 620
     $fragments['query_args']['having'][]   = $account->uid;
621 621
   }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
       foreach ($filter['tags'] as $tag) {
628 628
         $fragments['inner_join'][]  = "INNER JOIN {pm_tags_index} pmti$count ON (pmti$count.thread_id = pmi.thread_id AND pmti$count.uid = pmi.uid)";
629 629
         $fragments['where'][]       = "pmti$count.tag_id = %d";
630
-        $fragments['query_args']['where'][]   = $tag;
630
+        $fragments['query_args']['where'][] = $tag;
631 631
         $count++;
632 632
       }
633 633
     }
@@ -636,20 +636,20 @@  discard block
 block discarded – undo
636 636
       foreach ($filter['author'] as $author) {
637 637
         $fragments['inner_join'][]  = "INNER JOIN {pm_index} pmi$count ON (pmi$count.mid = pm.mid)";
638 638
         $fragments['where'][]       = "pmi$count.uid = %d";
639
-        $fragments['query_args']['where'][]   = $author->uid;
639
+        $fragments['query_args']['where'][] = $author->uid;
640 640
         $count++;
641 641
       }
642 642
     }
643 643
 
644 644
     if (isset($filter['search']) && !empty($filter['search'])) {
645 645
       if (variable_get('privatemsg_filter_searchbody', FALSE)) {
646
-        $fragments['where'][]       = "pm.subject LIKE '%s' OR pm.body LIKE '%s'";
647
-        $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
648
-        $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
646
+        $fragments['where'][] = "pm.subject LIKE '%s' OR pm.body LIKE '%s'";
647
+        $fragments['query_args']['where'][]    = '%%'.$filter['search'].'%%';
648
+        $fragments['query_args']['where'][]    = '%%'.$filter['search'].'%%';
649 649
       }
650 650
       else {
651
-        $fragments['where'][]       = "pm.subject LIKE '%s'";
652
-        $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
651
+        $fragments['where'][] = "pm.subject LIKE '%s'";
652
+        $fragments['query_args']['where'][] = '%%'.$filter['search'].'%%';
653 653
       }
654 654
     }
655 655
   }
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
   $count = db_result(db_query($query['count']));
679 679
   $tags = '';
680 680
   while ($tag = db_fetch_array($results)) {
681
-    $tags .= $tag['tag'] . ', ';
681
+    $tags .= $tag['tag'].', ';
682 682
   }
683 683
 
684 684
   $form['tags'] = array(
@@ -755,10 +755,10 @@  discard block
 block discarded – undo
755 755
   if (!empty($fragment)) {
756 756
     $query = _privatemsg_assemble_query(array('tags_autocomplete', 'privatemsg_filter'), $fragment, $tags);
757 757
     $result = db_query_range($query['query'], $fragment, 0, 10);
758
-    $prefix = count($tags) ? implode(", ", $tags) .", " : '';
758
+    $prefix = count($tags) ? implode(", ", $tags).", " : '';
759 759
     // 3: Build proper suggestions and print.
760 760
     while ($tag = db_fetch_object($result)) {
761
-      $matches[$prefix . $tag->tag .", "] = $tag->tag;
761
+      $matches[$prefix.$tag->tag.", "] = $tag->tag;
762 762
     }
763 763
   }
764 764
   // convert to object to prevent drupal bug, see http://drupal.org/node/175361
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
   if (!empty($threads)) {
818 818
     // If the tag list needs to be for specific threads.
819 819
     $fragments['select'][] = 'ti.thread_id';
820
-    $fragments['inner_join'][]  = 'INNER JOIN {pm_tags_index} ti on ti.tag_id = t.tag_id';
821
-    $fragments['where'][] = 'ti.thread_id IN (' . db_placeholders($threads) . ')';
820
+    $fragments['inner_join'][] = 'INNER JOIN {pm_tags_index} ti on ti.tag_id = t.tag_id';
821
+    $fragments['where'][] = 'ti.thread_id IN ('.db_placeholders($threads).')';
822 822
     $fragments['query_args']['where'] += $threads;
823 823
   }
824 824
   else {
@@ -875,14 +875,14 @@  discard block
 block discarded – undo
875 875
   $fragments['select'][] = 'pmt.tag';
876 876
   $fragments['where'][] = "pmt.tag LIKE '%s'";
877 877
   // Escape % to get through the placeholder replacement.
878
-  $fragments['query_args']['where'][] = $search .'%%';
878
+  $fragments['query_args']['where'][] = $search.'%%';
879 879
   if (!empty($tags)) {
880 880
     // Exclude tags.
881
-    $fragments['where'][] = "pmt.tag NOT IN (". db_placeholders($tags, 'text') .")";
881
+    $fragments['where'][] = "pmt.tag NOT IN (".db_placeholders($tags, 'text').")";
882 882
     $fragments['query_args']['where'] += $tags;
883 883
   }
884 884
   // LEFT JOIN to be able to load public, unused tags.
885
-  $fragments['inner_join'][]  = 'LEFT JOIN {pm_tags_index} pmti ON pmt.tag_id = pmti.tag_id AND pmti.uid = %d';
885
+  $fragments['inner_join'][] = 'LEFT JOIN {pm_tags_index} pmti ON pmt.tag_id = pmti.tag_id AND pmti.uid = %d';
886 886
   $fragments['query_args']['join'][] = $user->uid;
887 887
   // Autocomplete should only display Tags used by that user or public tags.
888 888
   // This is done to avoid information disclosure as part of tag names.
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -192,8 +192,7 @@  discard block
 block discarded – undo
192 192
     if (empty($tag_id) && privatemsg_user_access('create private message tags')) {
193 193
       db_query("INSERT INTO {pm_tags} (tag) VALUES ('%s')", $tag);
194 194
       $tag_id = db_last_insert_id('pm_tags', 'tag_id');
195
-    }
196
-    elseif (empty($tag_id)) {
195
+    } elseif (empty($tag_id)) {
197 196
       // The user does not have permission to create new tags - disregard this tag and move onto the next.
198 197
       drupal_set_message(t('Tag %tag was ignored because you do not have permission to create new tags.', array('%tag' => $tag)));
199 198
       continue;
@@ -251,8 +250,7 @@  discard block
 block discarded – undo
251 250
     foreach ($threads as $thread) {
252 251
       db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d', $account->uid, $thread);
253 252
     }
254
-  }
255
-  else {
253
+  } else {
256 254
     // Delete tag mapping for the specified tag.
257 255
     foreach ($threads as $thread) {
258 256
       db_query('DELETE FROM {pm_tags_index} WHERE uid = %d AND thread_id = %d AND tag_id = %d', $account->uid, $thread, $tag_id);
@@ -268,8 +266,7 @@  discard block
 block discarded – undo
268 266
     foreach (explode(',', $_GET['tags']) as $tag) {
269 267
       if (isset($tag_data[$tag])) {
270 268
         $filter['tags'][$tag] = $tag;
271
-      }
272
-      elseif (in_array($tag, $tag_data)) {
269
+      } elseif (in_array($tag, $tag_data)) {
273 270
         $filter['tags'][array_search($tag, $tag_data)] = array_search($tag, $tag_data);
274 271
       }
275 272
     }
@@ -436,8 +433,7 @@  discard block
 block discarded – undo
436 433
     foreach ($filter['tags'] as $tag) {
437 434
       if ((int)$tag > 0) {
438 435
         $ids[] = $tag;
439
-      }
440
-      else {
436
+      } else {
441 437
         $query['tags'][] = $tag;
442 438
       }
443 439
     }
@@ -456,8 +452,7 @@  discard block
 block discarded – undo
456 452
     foreach ($filter['author'] as $author) {
457 453
       if (is_object($author) && isset($author->uid) && isset($author->name)) {
458 454
         $query['author'][] = $author->name;
459
-      }
460
-      elseif ($author_obj = user_load($author)) {
455
+      } elseif ($author_obj = user_load($author)) {
461 456
         $query['author'][] = $author_obj->name;
462 457
       }
463 458
     }
@@ -646,8 +641,7 @@  discard block
 block discarded – undo
646 641
         $fragments['where'][]       = "pm.subject LIKE '%s' OR pm.body LIKE '%s'";
647 642
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
648 643
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
649
-      }
650
-      else {
644
+      } else {
651 645
         $fragments['where'][]       = "pm.subject LIKE '%s'";
652 646
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
653 647
       }
@@ -820,8 +814,7 @@  discard block
 block discarded – undo
820 814
     $fragments['inner_join'][]  = 'INNER JOIN {pm_tags_index} ti on ti.tag_id = t.tag_id';
821 815
     $fragments['where'][] = 'ti.thread_id IN (' . db_placeholders($threads) . ')';
822 816
     $fragments['query_args']['where'] += $threads;
823
-  }
824
-  else {
817
+  } else {
825 818
     // Tag usage counter is only used when we select all tags.
826 819
     $fragments['select'][]      = 'COUNT(ti.thread_id) as count';
827 820
     // LEFT JOIN so that unused tags are displayed too.
@@ -850,8 +843,7 @@  discard block
 block discarded – undo
850 843
                               AND pmtic.uid = ti.uid
851 844
                               AND pmtic.tag_id < ti.tag_id) < %d';
852 845
     $fragments['query_args']['where'][] = $limit;
853
-  }
854
-  elseif (!empty($threads) || !empty($user)) {
846
+  } elseif (!empty($threads) || !empty($user)) {
855 847
     // Only add a sort when we are not loading the tags for the admin page.
856 848
     // Sorting is handled through tablesort_sql() then.
857 849
     $fragments['order_by'][] = 't.tag ASC';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     '#type'          => 'checkbox',
126 126
     '#title'         => t('Search message body'),
127 127
     '#description'   => t('WARNING: turning on this feature will slow down search performance by a large factor. Gets worse as your messages database increases.'),
128
-    '#default_value' => variable_get('privatemsg_filter_searchbody', FALSE),
128
+    '#default_value' => variable_get('privatemsg_filter_searchbody', false),
129 129
   );
130 130
 
131 131
     $form['privatemsg_filter_tagfield_weight'] = array(
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
  * @param $tag_id
212 212
  *   Id of the tag.
213 213
  */
214
-function privatemsg_filter_add_tags($threads, $tag_id, $account = NULL) {
214
+function privatemsg_filter_add_tags($threads, $tag_id, $account = null) {
215 215
   if (!is_array($threads)) {
216 216
     $threads = array($threads);
217 217
   }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
  * @param $tag_id
238 238
  *   Id of the tag - set to NULL to remove all tags.
239 239
  */
240
-function privatemsg_filter_remove_tags($threads, $tag_id = NULL, $account = NULL) {
240
+function privatemsg_filter_remove_tags($threads, $tag_id = null, $account = null) {
241 241
   if (!is_array($threads)) {
242 242
     $threads = array($threads);
243 243
   }
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
   $form['filter'] = array(
319 319
     '#type' => 'fieldset',
320 320
     '#title' => t('Filter messages'),
321
-    '#collapsible' => TRUE,
322
-    '#collapsed' => TRUE,
321
+    '#collapsible' => true,
322
+    '#collapsed' => true,
323 323
   );
324 324
   $form['filter']['search'] = array(
325 325
     '#type' => 'textfield',
326
-    '#title' => variable_get('privatemsg_filter_searchbody', FALSE) ? t('Search messages') : t('Search subjects'),
326
+    '#title' => variable_get('privatemsg_filter_searchbody', false) ? t('Search messages') : t('Search subjects'),
327 327
     '#weight' => -20
328 328
   );
329 329
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
       '#type' => 'select',
343 343
       '#title' => t('Tags'),
344 344
       '#options' => $tag_data,
345
-      '#multiple' => TRUE,
345
+      '#multiple' => true,
346 346
       '#size' => 5,
347 347
       '#weight' => 0
348 348
     );
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
 function privatemsg_filter_dropdown_set_active(&$form, $filter) {
374 374
   $form['filter']['#title'] = t('Filter messages (active)');
375
-  $form['filter']['#collapsed'] = FALSE;
375
+  $form['filter']['#collapsed'] = false;
376 376
 
377 377
   if (isset($filter['author'])) {
378 378
     $string = '';
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
     }
643 643
 
644 644
     if (isset($filter['search']) && !empty($filter['search'])) {
645
-      if (variable_get('privatemsg_filter_searchbody', FALSE)) {
645
+      if (variable_get('privatemsg_filter_searchbody', false)) {
646 646
         $fragments['where'][]       = "pm.subject LIKE '%s' OR pm.body LIKE '%s'";
647 647
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
648 648
         $fragments['query_args']['where'][]    = '%%'. $filter['search'] .'%%';
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
     '#type' => 'fieldset',
686 686
     '#title' => t('Tags'),
687 687
     '#access' => privatemsg_user_access('tag private messages'),
688
-    '#collapsible' => TRUE,
689
-    '#collapsed' => empty($count) ? TRUE : FALSE,
688
+    '#collapsible' => true,
689
+    '#collapsed' => empty($count) ? true : false,
690 690
   );
691 691
   $form['tags']['user_id'] = array(
692 692
     '#type' => 'value',
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
  * @param $limit
809 809
  *   Limit the number of tags *per thread*.
810 810
  */
811
-function privatemsg_filter_sql_tags(&$fragments, $user = NULL, $threads = NULL, $limit = NULL) {
811
+function privatemsg_filter_sql_tags(&$fragments, $user = null, $threads = null, $limit = null) {
812 812
   $fragments['primary_table'] = '{pm_tags} t';
813 813
   $fragments['select'][] = 't.tag';
814 814
   $fragments['select'][] = 't.tag_id';
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 /**
898 898
  * Implement hook_user().
899 899
  */
900
-function privatemsg_filter_user($op, &$edit, &$account, $category = NULL) {
900
+function privatemsg_filter_user($op, &$edit, &$account, $category = null) {
901 901
   switch ($op) {
902 902
       case 'delete':
903 903
       // Delete tag information of that user.
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.theme.inc 4 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
  * @see theme_privatemsg_list_field()
76 76
  */
77 77
 function phptemplate_privatemsg_list_field__participants($thread) {
78
-  $participants = _privatemsg_generate_user_array($thread['participants'], -4);
79
-  $field = array();
80
-  $field['data'] = _privatemsg_format_participants($participants, 3, TRUE);
81
-  $field['class'] = 'privatemsg-list-participants';
82
-  return $field;
78
+    $participants = _privatemsg_generate_user_array($thread['participants'], -4);
79
+    $field = array();
80
+    $field['data'] = _privatemsg_format_participants($participants, 3, TRUE);
81
+    $field['class'] = 'privatemsg-list-participants';
82
+    return $field;
83 83
 }
84 84
 
85 85
 /**
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
  * @see theme_privatemsg_list_field()
89 89
  */
90 90
 function phptemplate_privatemsg_list_field__subject($thread) {
91
-  $field = array();
92
-  $options = array();
93
-  $is_new = '';
94
-  if (!empty($thread['is_new'])) {
91
+    $field = array();
92
+    $options = array();
93
+    $is_new = '';
94
+    if (!empty($thread['is_new'])) {
95 95
     $is_new = theme_mark(MARK_NEW);
96 96
     $options['fragment'] = 'new';
97
-  }
98
-  $field['data'] = l($thread['subject'], 'messages/view/' . $thread['thread_id'], $options) . $is_new;
99
-  $field['class'] = 'privatemsg-list-subject';
100
-  return $field;
97
+    }
98
+    $field['data'] = l($thread['subject'], 'messages/view/' . $thread['thread_id'], $options) . $is_new;
99
+    $field['class'] = 'privatemsg-list-subject';
100
+    return $field;
101 101
 }
102 102
 
103 103
 /**
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
  * @see theme_privatemsg_list_field()
107 107
  */
108 108
 function phptemplate_privatemsg_list_field__count($thread) {
109
-  $field = array();
110
-  $field['data'] = $thread['count'];
111
-  $options = array();
112
-  if (!empty($thread['is_new']) && $thread['is_new'] < $thread['count']) {
109
+    $field = array();
110
+    $field['data'] = $thread['count'];
111
+    $options = array();
112
+    if (!empty($thread['is_new']) && $thread['is_new'] < $thread['count']) {
113 113
     $options['fragment'] = 'new';
114 114
     $field['data'] .= '<br />' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/' . $thread['thread_id'], $options);
115
-  }
116
-  $field['class'] = 'privatemsg-list-count';
117
-  return $field;
115
+    }
116
+    $field['class'] = 'privatemsg-list-count';
117
+    return $field;
118 118
 }
119 119
 
120 120
 /**
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
  * @see theme_privatemsg_list_field()
124 124
  */
125 125
 function phptemplate_privatemsg_list_field__last_updated($thread) {
126
-  $field = array();
127
-  $field['data'] = format_date($thread['last_updated'], 'small');
128
-  $field['class'] = 'privatemsg-list-date';
129
-  return $field;
126
+    $field = array();
127
+    $field['data'] = format_date($thread['last_updated'], 'small');
128
+    $field['class'] = 'privatemsg-list-date';
129
+    return $field;
130 130
 }
131 131
 
132 132
 /**
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
  * @see theme_privatemsg_list_field()
136 136
  */
137 137
 function phptemplate_privatemsg_list_field__thread_started($thread) {
138
-  $field = array();
139
-  $field['data'] = format_date($thread['thread_started'], 'small');
140
-  $field['class'] = 'privatemsg-list-date-started';
141
-  return $field;
138
+    $field = array();
139
+    $field['data'] = format_date($thread['thread_started'], 'small');
140
+    $field['class'] = 'privatemsg-list-date-started';
141
+    return $field;
142 142
 }
143 143
 
144 144
 /**
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
  * @see theme_privatemsg_list_header()
163 163
  */
164 164
 function phptemplate_privatemsg_list_header__subject() {
165
-  return array(
165
+    return array(
166 166
     'data'    => t('Subject'),
167 167
     'field'   => 'subject',
168 168
     'key'     => 'subject',
169 169
     'class'   => 'privatemsg-header-subject',
170 170
     '#weight' => -40,
171
-  );
171
+    );
172 172
 }
173 173
 
174 174
 /**
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
  * @see theme_privatemsg_list_header()
178 178
  */
179 179
 function phptemplate_privatemsg_list_header__count() {
180
-  return array(
180
+    return array(
181 181
     'data'    => t('Messages'),
182 182
     'key'     => 'count',
183 183
     'class'   => 'privatemsg-header-count',
184 184
     '#weight' => -25,
185
-  );
185
+    );
186 186
 }
187 187
 
188 188
 /**
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
  * @see theme_privatemsg_list_header()
192 192
  */
193 193
 function phptemplate_privatemsg_list_header__participants() {
194
-  return array(
194
+    return array(
195 195
     'data'    => t('Participants'),
196 196
     'key'     => 'participants',
197 197
     'class'   => 'privatemsg-header-participants',
198 198
     '#weight' => -30,
199
-  );
199
+    );
200 200
 }
201 201
 
202 202
 /**
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
  * @see theme_privatemsg_list_header()
206 206
  */
207 207
 function phptemplate_privatemsg_list_header__last_updated() {
208
-  return array(
208
+    return array(
209 209
     'data'    => t('Last Updated'),
210 210
     'field'   => 'last_updated',
211 211
     'key'     => 'last_updated',
212 212
     'sort'    => 'desc',
213 213
     'class'   => 'privatemsg-header-lastupdated',
214 214
     '#weight' => -20,
215
-  );
215
+    );
216 216
 }
217 217
 
218 218
 /**
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
  * @see theme_privatemsg_list_header()
222 222
  */
223 223
 function phptemplate_privatemsg_list_header__thread_started() {
224
-  return array(
224
+    return array(
225 225
     'data'    => t('Started'),
226 226
     'field'   => 'thread_started',
227 227
     'key'     => 'thread_started',
228 228
     'class'   => 'privatemsg-header-threadstarted',
229 229
     '#weight' => -15,
230
-  );
230
+    );
231 231
 }
232 232
 
233 233
 /**
@@ -237,70 +237,70 @@  discard block
 block discarded – undo
237 237
  * by the header and field theme patterns.
238 238
  */
239 239
 function theme_privatemsg_list($form) {
240
-  $has_posts = !empty($form['#data']);
240
+    $has_posts = !empty($form['#data']);
241 241
 
242
-  drupal_add_css(drupal_get_path('module', 'privatemsg') .'/styles/privatemsg-list.css');
242
+    drupal_add_css(drupal_get_path('module', 'privatemsg') .'/styles/privatemsg-list.css');
243 243
 
244
-  // Load the table columns.
245
-  $columns = array_merge(array('subject', 'last_updated'), array_filter(variable_get('privatemsg_display_fields', array('participants'))));
244
+    // Load the table columns.
245
+    $columns = array_merge(array('subject', 'last_updated'), array_filter(variable_get('privatemsg_display_fields', array('participants'))));
246 246
 
247
-  // Load the themed list headers based on the available data.
248
-  $headers = _privatemsg_list_headers(!empty($form['#data']), $columns);
249
-  // sort the headers array based on the #weight property.
250
-  usort($headers, 'element_sort');
247
+    // Load the themed list headers based on the available data.
248
+    $headers = _privatemsg_list_headers(!empty($form['#data']), $columns);
249
+    // sort the headers array based on the #weight property.
250
+    usort($headers, 'element_sort');
251 251
 
252
-  $themed_rows = array();
253
-  // Check if there is atleast a single thread.
254
-  if ($has_posts) {
252
+    $themed_rows = array();
253
+    // Check if there is atleast a single thread.
254
+    if ($has_posts) {
255 255
     foreach ($form['#data'] as $thread_id => $data) {
256
-      // Theme the row.
257
-      $row = _privatemsg_list_thread($data);
258
-      $data = array();
259
-      // Render the checkbox.
260
-      $data[] = array('data' => drupal_render($form['threads'][$thread_id]), 'class' => 'privatemsg-list-select');
256
+        // Theme the row.
257
+        $row = _privatemsg_list_thread($data);
258
+        $data = array();
259
+        // Render the checkbox.
260
+        $data[] = array('data' => drupal_render($form['threads'][$thread_id]), 'class' => 'privatemsg-list-select');
261 261
 
262
-      // Store the #rows data in the same order as the header is, the key property of the header refers to the field that belongs to it.
263
-      foreach ($headers as $header) {
262
+        // Store the #rows data in the same order as the header is, the key property of the header refers to the field that belongs to it.
263
+        foreach ($headers as $header) {
264 264
         if (!empty($header['key'])) {
265
-          if (isset($row['data'][$header['key']])) {
265
+            if (isset($row['data'][$header['key']])) {
266 266
             $data[] = $row['data'][$header['key']];
267
-          }
268
-          else {
267
+            }
268
+            else {
269 269
             // Store a empty value so that the order is still correct.
270 270
             $data[] = '';
271
-          }
271
+            }
272
+        }
272 273
         }
273
-      }
274
-      // Replace the data
275
-      $row['data'] = $data;
276
-      $themed_rows[] = $row;
274
+        // Replace the data
275
+        $row['data'] = $data;
276
+        $themed_rows[] = $row;
277 277
     }
278
-  }
279
-  else {
278
+    }
279
+    else {
280 280
     // Display a message if now messages are available.
281 281
     $themed_rows[] = array(array('data' => t('No messages available.'), 'colspan' => count($headers)));
282
-  }
282
+    }
283 283
 
284
-  // Remove any data in header that we don't need anymore.
285
-  foreach ($headers as $id => $header) {
284
+    // Remove any data in header that we don't need anymore.
285
+    foreach ($headers as $id => $header) {
286 286
     unset($headers[$id]['key']);
287 287
     unset($headers[$id]['#weight']);
288
-  }
288
+    }
289 289
 
290
-  // Theme the table, pass all generated information to the table theme function.
291
-  $form['list'] = array('#value' => theme('table', $headers, $themed_rows, array('class' => 'privatemsg-list')), '#weight' => 5);
292
-  return drupal_render($form);
290
+    // Theme the table, pass all generated information to the table theme function.
291
+    $form['list'] = array('#value' => theme('table', $headers, $themed_rows, array('class' => 'privatemsg-list')), '#weight' => 5);
292
+    return drupal_render($form);
293 293
 }
294 294
 
295 295
 /**
296 296
  * Theme a block which displays the number of new messages a user has.
297 297
  */
298 298
 function theme_privatemsg_new_block($count) {
299
-  $text = format_plural($count, 'You have a new message, click here to read it',
299
+    $text = format_plural($count, 'You have a new message, click here to read it',
300 300
                         'You have @count new messages, click here to read them',
301 301
                         array('@count' => $count));
302 302
 
303
-  return l($text, 'messages', array('attributes' => array('id' => 'privatemsg-new-link')));
303
+    return l($text, 'messages', array('attributes' => array('id' => 'privatemsg-new-link')));
304 304
 }
305 305
 
306 306
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     $is_new = theme_mark(MARK_NEW);
96 96
     $options['fragment'] = 'new';
97 97
   }
98
-  $field['data'] = l($thread['subject'], 'messages/view/' . $thread['thread_id'], $options) . $is_new;
98
+  $field['data'] = l($thread['subject'], 'messages/view/'.$thread['thread_id'], $options).$is_new;
99 99
   $field['class'] = 'privatemsg-list-subject';
100 100
   return $field;
101 101
 }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
   $options = array();
112 112
   if (!empty($thread['is_new']) && $thread['is_new'] < $thread['count']) {
113 113
     $options['fragment'] = 'new';
114
-    $field['data'] .= '<br />' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/' . $thread['thread_id'], $options);
114
+    $field['data'] .= '<br />'.l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/'.$thread['thread_id'], $options);
115 115
   }
116 116
   $field['class'] = 'privatemsg-list-count';
117 117
   return $field;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 function theme_privatemsg_list($form) {
240 240
   $has_posts = !empty($form['#data']);
241 241
 
242
-  drupal_add_css(drupal_get_path('module', 'privatemsg') .'/styles/privatemsg-list.css');
242
+  drupal_add_css(drupal_get_path('module', 'privatemsg').'/styles/privatemsg-list.css');
243 243
 
244 244
   // Load the table columns.
245 245
   $columns = array_merge(array('subject', 'last_updated'), array_filter(variable_get('privatemsg_display_fields', array('participants'))));
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -264,8 +264,7 @@  discard block
 block discarded – undo
264 264
         if (!empty($header['key'])) {
265 265
           if (isset($row['data'][$header['key']])) {
266 266
             $data[] = $row['data'][$header['key']];
267
-          }
268
-          else {
267
+          } else {
269 268
             // Store a empty value so that the order is still correct.
270 269
             $data[] = '';
271 270
           }
@@ -275,8 +274,7 @@  discard block
 block discarded – undo
275 274
       $row['data'] = $data;
276 275
       $themed_rows[] = $row;
277 276
     }
278
-  }
279
-  else {
277
+  } else {
280 278
     // Display a message if now messages are available.
281 279
     $themed_rows[] = array(array('data' => t('No messages available.'), 'colspan' => count($headers)));
282 280
   }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 function phptemplate_privatemsg_list_field__participants($thread) {
78 78
   $participants = _privatemsg_generate_user_array($thread['participants'], -4);
79 79
   $field = array();
80
-  $field['data'] = _privatemsg_format_participants($participants, 3, TRUE);
80
+  $field['data'] = _privatemsg_format_participants($participants, 3, true);
81 81
   $field['class'] = 'privatemsg-list-participants';
82 82
   return $field;
83 83
 }
Please login to merge, or discard this patch.
sites/default/boinc/modules/node_comment_block/node_comment_block.module 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,45 +9,45 @@  discard block
 block discarded – undo
9 9
  * Implements hook_block() for Drupal 6 compatibility
10 10
  */
11 11
 function node_comment_block_block($op = 'list', $delta = 0, $edit = array()) {
12
-  switch ($op) {
13
-  case 'view':
12
+    switch ($op) {
13
+    case 'view':
14 14
     //$block = node_comment_block_block_view($delta);
15 15
     $block = array();
16 16
     if ($delta == 'node_comments') {
17
-      if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
17
+        if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
18 18
         $node = node_load($nid);
19 19
         if ($node->comment !== 0) {
20
-          $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
21
-          $block['content'] = '';
22
-          if ($node->comment) {
20
+            $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
21
+            $block['content'] = '';
22
+            if ($node->comment) {
23 23
             $block['content'] .= comment_render($node);
24
-          }
24
+            }
25
+        }
25 26
         }
26
-      }
27 27
     }
28 28
     break;
29
-  case 'list':
29
+    case 'list':
30 30
     $blocks = node_comment_block_block_info();
31 31
     return $blocks;
32 32
     break;
33
-  default:
33
+    default:
34 34
   }
35
-  return $block;
35
+    return $block;
36 36
 }
37 37
 
38 38
 /**
39 39
  * Port Drupal 7 render() function to Drupal 6
40 40
  */
41 41
 function render(&$element) {
42
-  if (is_array($element)) {
42
+    if (is_array($element)) {
43 43
     show($element);
44 44
     return drupal_render($element);
45
-  }
46
-  else {
45
+    }
46
+    else {
47 47
     // Safe-guard for inappropriate use of render() on flat variables: return
48 48
     // the variable as-is.
49 49
     return $element;
50
-  }
50
+    }
51 51
 }
52 52
 
53 53
 
@@ -56,50 +56,50 @@  discard block
 block discarded – undo
56 56
  * Implements hook_block_info().
57 57
  */
58 58
 function node_comment_block_block_info() {
59
-  $blocks['node_comments'] = array(
59
+    $blocks['node_comments'] = array(
60 60
     'info' => t('Node comments'),
61
-  );
61
+    );
62 62
 
63
-  return $blocks;
63
+    return $blocks;
64 64
 }
65 65
 
66 66
 /**
67 67
  * Implements hook_block_view().
68 68
  */
69 69
 function node_comment_block_block_view($delta = '') {
70
-  $block = array();
70
+    $block = array();
71 71
 
72
-  if ($delta == 'node_comments') {
72
+    if ($delta == 'node_comments') {
73 73
     if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
74
-      $node = node_load($nid);
74
+        $node = node_load($nid);
75 75
 
76
-      if ($node->comment !== 0) {
76
+        if ($node->comment !== 0) {
77 77
         $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
78 78
         $block['content'] = '';
79 79
 
80 80
         $node = node_view($node);
81 81
 
82 82
         if ($node['comments']) {
83
-          $block['content'] .= render($node['comments']);
83
+            $block['content'] .= render($node['comments']);
84
+        }
84 85
         }
85
-      }
86 86
     }
87
-  }
87
+    }
88 88
 
89
-  return $block;
89
+    return $block;
90 90
 }
91 91
 
92 92
 /**
93 93
  * Implements hook_preprocess_HOOK() for nodes.
94 94
  */
95 95
 function node_comment_block_preprocess_node(&$variables) {
96
-  $node = $variables['node'];
97
-  // Only hide standard comments for news content
98
-  if ($variables['type'] == 'news') {
96
+    $node = $variables['node'];
97
+    // Only hide standard comments for news content
98
+    if ($variables['type'] == 'news') {
99 99
     $variables['node']->comment = 0;
100
-  }
100
+    }
101 101
   
102
-  /* Drupal 7...
102
+    /* Drupal 7...
103 103
   if ($node->comment !== 0 && $variables['view_mode'] == 'full') {
104 104
     if (isset($variables['content']['comments'])) {
105 105
       unset($variables['content']['comments']);
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
  * Implements hook_form_FORM_ID_alter() for block_admin_configure.
114 114
  */
115 115
 function node_comment_block_form_block_admin_configure_alter(&$form, &$form_state) {
116
-  if (isset($form['delta'])) {
116
+    if (isset($form['delta'])) {
117 117
     if ($form['delta']['#value'] == 'node_comments') {
118
-      $form['settings']['title']['#disabled'] = TRUE;
119
-      $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
118
+        $form['settings']['title']['#disabled'] = TRUE;
119
+        $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
120
+    }
120 121
     }
121
-  }
122 122
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
   if (is_array($element)) {
43 43
     show($element);
44 44
     return drupal_render($element);
45
-  }
46
-  else {
45
+  } else {
47 46
     // Safe-guard for inappropriate use of render() on flat variables: return
48 47
     // the variable as-is.
49 48
     return $element;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
       if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
18 18
         $node = node_load($nid);
19 19
         if ($node->comment !== 0) {
20
-          $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
20
+          $block['subject'] = null; // This should be NULL otherwise there will be duplicate h2 elements.
21 21
           $block['content'] = '';
22 22
           if ($node->comment) {
23 23
             $block['content'] .= comment_render($node);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
       $node = node_load($nid);
75 75
 
76 76
       if ($node->comment !== 0) {
77
-        $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
77
+        $block['subject'] = null; // This should be NULL otherwise there will be duplicate h2 elements.
78 78
         $block['content'] = '';
79 79
 
80 80
         $node = node_view($node);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 function node_comment_block_form_block_admin_configure_alter(&$form, &$form_state) {
116 116
   if (isset($form['delta'])) {
117 117
     if ($form['delta']['#value'] == 'node_comments') {
118
-      $form['settings']['title']['#disabled'] = TRUE;
118
+      $form['settings']['title']['#disabled'] = true;
119 119
       $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
120 120
     }
121 121
   }
Please login to merge, or discard this patch.
modules/boinc_solr_search/boinc_solr_comments/boinc_solr_comments.module 5 patches
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
   }
281 281
 
282 282
   switch ($op) {
283
-    case 'delete':
284
-      // Only call delete function on certain node types
285
-      if (in_array( $node->type, $node_types)) {
286
-        boinc_solr_comments_delete($node);
287
-      }
288
-      break;
283
+  case 'delete':
284
+    // Only call delete function on certain node types
285
+    if (in_array( $node->type, $node_types)) {
286
+      boinc_solr_comments_delete($node);
287
+    }
288
+    break;
289 289
   } //switch
290 290
 }
291 291
 
@@ -335,13 +335,13 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function boinc_solr_comments_comment(&$a1, $op) {
337 337
   switch ($op) {
338
-    case 'view':
339
-    case 'update':
340
-      break;
341
-    case 'delete':
342
-      // $a1 should be a comment object
343
-      boinc_solr_comments_deletecomment($a1);
344
-      break;
338
+  case 'view':
339
+  case 'update':
340
+    break;
341
+  case 'delete':
342
+    // $a1 should be a comment object
343
+    boinc_solr_comments_deletecomment($a1);
344
+    break;
345 345
   }// switch
346 346
 }
347 347
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -131,8 +131,7 @@  discard block
 block discarded – undo
131 131
         if ($comment->uid == 0 || strlen($comment->name) == 0) {
132 132
           // @see user_validate_name(). !'0' === TRUE.
133 133
           $comment_document->ss_name = '0';
134
-        }
135
-        else {
134
+        } else {
136 135
           $comment_document->ss_name = $comment->name;
137 136
           // We want the name to be searchable for keywords.
138 137
           $comment_document->tos_name = $comment->name;
@@ -318,8 +317,7 @@  discard block
 block discarded – undo
318 317
     $solr->deleteByQuery($query);
319 318
     // Log the query used for deletion.
320 319
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
321
-  }
322
-  catch (Exception $e) {
320
+  } catch (Exception $e) {
323 321
       watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
324 322
       return FALSE;
325 323
   }// try
@@ -376,8 +374,7 @@  discard block
 block discarded – undo
376 374
     $solr->deleteByQuery($query);
377 375
     // Log the query used for deletion.
378 376
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
379
-    }
380
-  catch (Exception $e) {
377
+    } catch (Exception $e) {
381 378
     watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
382 379
     return FALSE;
383 380
   }// try
Please login to merge, or discard this patch.
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
  * Implementation of hook_menu()
15 15
  */
16 16
 function boinc_solr_comments_menu() {
17
-  $items = array();
18
-  $base_path = 'admin/settings/apachesolr/indexcomments';
19
-  $items[$base_path] = array(
20
-      'title' => 'Index Comments',
21
-      'description' => 'Administer Indexing of Comments',
22
-      'page callback' => 'drupal_get_form',
23
-      'page arguments' => array('boinc_solr_comments_form'),
24
-      'access arguments' => array('administer search'),
25
-      'file' => 'boinc_solr_comments.admin.inc',
26
-      'weight' => '10',
27
-  );
28
-
29
-  return $items;
17
+    $items = array();
18
+    $base_path = 'admin/settings/apachesolr/indexcomments';
19
+    $items[$base_path] = array(
20
+        'title' => 'Index Comments',
21
+        'description' => 'Administer Indexing of Comments',
22
+        'page callback' => 'drupal_get_form',
23
+        'page arguments' => array('boinc_solr_comments_form'),
24
+        'access arguments' => array('administer search'),
25
+        'file' => 'boinc_solr_comments.admin.inc',
26
+        'weight' => '10',
27
+    );
28
+
29
+    return $items;
30 30
 }
31 31
 
32 32
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
  *   Environment ID for apache solr.
59 59
  */
60 60
 function boinc_solr_comments_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
61
-  $comdocs = array();
61
+    $comdocs = array();
62 62
 
63
-  // Array of node types that will have comments indexed.
64
-  $node_types = variable_get('boinc_solr_comments_nodetypes', '');
65
-  if (empty($node_types)) {
63
+    // Array of node types that will have comments indexed.
64
+    $node_types = variable_get('boinc_solr_comments_nodetypes', '');
65
+    if (empty($node_types)) {
66 66
     // If the variable has not been set, then by default index
67 67
     // comments for all known node types.
68 68
     $node_types = array(
@@ -72,28 +72,28 @@  discard block
 block discarded – undo
72 72
         'story'      => 'story',
73 73
         'team_forum' => 'team_forum',
74 74
     );
75
-  }
75
+    }
76 76
   
77
-  // Loop over all documents and alter:
78
-  foreach ($documents as $document) {
77
+    // Loop over all documents and alter:
78
+    foreach ($documents as $document) {
79 79
     //dd($document, "index documents alter - document");
80 80
 
81 81
     $to_process = ( array_key_exists($document->bundle, $node_types) AND $node_types[$document->bundle] );
82 82
     if ( $document->entity_type=='node' AND $to_process) {
83 83
       
84
-      // Remove ts_comments if present.
85
-      if (isset($document->ts_comments)) {
84
+        // Remove ts_comments if present.
85
+        if (isset($document->ts_comments)) {
86 86
         unset($document->ts_comments);
87
-      }
88
-      // Node information.
89
-      $nid = $document->entity_id;
90
-      $node = node_load($nid);
87
+        }
88
+        // Node information.
89
+        $nid = $document->entity_id;
90
+        $node = node_load($nid);
91 91
       
92
-      // Query database for comments of node. Only return comments
93
-      // with status 0 (0 is published for comments).
94
-      $sql = 'SELECT cid from {comments} WHERE nid = %d AND status = 0 ORDER by timestamp DESC';
95
-      $resource = db_query($sql, $nid);
96
-      while ($row = db_fetch_array($resource)) {
92
+        // Query database for comments of node. Only return comments
93
+        // with status 0 (0 is published for comments).
94
+        $sql = 'SELECT cid from {comments} WHERE nid = %d AND status = 0 ORDER by timestamp DESC';
95
+        $resource = db_query($sql, $nid);
96
+        while ($row = db_fetch_array($resource)) {
97 97
         // Load the comment from cid.
98 98
         $comment = _comment_load($row['cid']);
99 99
 
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         // Comment object has no language
117 117
         $comment_document->ss_language = 'und';
118 118
         if (function_exists('drupal_get_path_alias')) {
119
-          $output = drupal_get_path_alias($comment_document->path, NULL);
120
-          if ($output && $output != $document->path) {
119
+            $output = drupal_get_path_alias($comment_document->path, NULL);
120
+            if ($output && $output != $document->path) {
121 121
             $comment_document->path_alias = $output;
122
-          }
122
+            }
123 123
         }
124 124
         
125 125
         // Code derived from apachesolr_index_node_solr_document
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 
130 130
         // Author information
131 131
         if ($comment->uid == 0 || strlen($comment->name) == 0) {
132
-          // @see user_validate_name(). !'0' === TRUE.
133
-          $comment_document->ss_name = '0';
132
+            // @see user_validate_name(). !'0' === TRUE.
133
+            $comment_document->ss_name = '0';
134 134
         }
135 135
         else {
136
-          $comment_document->ss_name = $comment->name;
137
-          // We want the name to be searchable for keywords.
138
-          $comment_document->tos_name = $comment->name;
136
+            $comment_document->ss_name = $comment->name;
137
+            // We want the name to be searchable for keywords.
138
+            $comment_document->tos_name = $comment->name;
139 139
         }
140 140
 
141 141
         // Index formatted username so it can be searched and sorted
@@ -157,59 +157,59 @@  discard block
 block discarded – undo
157 157
         // Unset the following fields (if set) that don't make sense
158 158
         // for a comment.
159 159
         if (isset($comment_document->bs_sticky)) {
160
-          unset($comment_document->bs_sticky);
160
+            unset($comment_document->bs_sticky);
161 161
         }
162 162
         if (isset($comment_document->bs_promote)) {
163
-          unset($comment_document->bs_promote);
163
+            unset($comment_document->bs_promote);
164 164
         }    
165 165
         if (isset($comment_document->is_tnid)) {
166
-          unset($comment_document->is_tnid);
166
+            unset($comment_document->is_tnid);
167 167
         }
168 168
         if (isset($comment_document->bs_translate)) {
169
-          unset($comment_document->bs_translate);
169
+            unset($comment_document->bs_translate);
170 170
         }
171 171
         if (isset($comment_document->ts_last_comment_timestamp)) {
172
-          unset($comment_document->ts_last_comment_timestamp);
172
+            unset($comment_document->ts_last_comment_timestamp);
173 173
         }
174 174
         if (isset($comment_document->ds_last_comment_or_change)) {
175
-          unset($comment_document->ds_last_comment_or_change);
175
+            unset($comment_document->ds_last_comment_or_change);
176 176
         }
177 177
         if (isset($comment_document->is_comment_count)) {
178
-          unset($comment_document->is_comment_count);
178
+            unset($comment_document->is_comment_count);
179 179
         }
180 180
 
181 181
         // Loop over fields in document and copy relevant values into
182 182
         // comment_document.
183 183
         foreach ($document as $fieldName => $fieldValue) {
184 184
 
185
-          // Copy over fields [im_taxonomy_vid_1], [tid], [im_vid_1],
186
-          // [im_vid_Forums], [tm_vid_1_names]
187
-          if ( ( preg_match('/tid/', $fieldName) OR preg_match('/vid/', $fieldName) ) AND is_array($fieldValue) ) {
185
+            // Copy over fields [im_taxonomy_vid_1], [tid], [im_vid_1],
186
+            // [im_vid_Forums], [tm_vid_1_names]
187
+            if ( ( preg_match('/tid/', $fieldName) OR preg_match('/vid/', $fieldName) ) AND is_array($fieldValue) ) {
188 188
             foreach ($fieldValue as $subkey => $subvalue) {
189
-              $comment_document->addField($fieldName, $subvalue);
189
+                $comment_document->addField($fieldName, $subvalue);
190 190
             }
191
-          }// if preg_match
191
+            }// if preg_match
192 192
                
193
-          // Set the access keys so this module will work with
194
-          // apachesolr_access.
195
-          if (module_exists('apachesolr_access')) {
193
+            // Set the access keys so this module will work with
194
+            // apachesolr_access.
195
+            if (module_exists('apachesolr_access')) {
196 196
             if (preg_match('/^access/', $fieldName) AND is_array($fieldValue)) {
197
-              foreach ($fieldValue as $subkey => $subvalue) {
197
+                foreach ($fieldValue as $subkey => $subvalue) {
198 198
                 $comment_document->addField($fieldName, $subvalue);
199
-              }
199
+                }
200 200
             }// if preg_match
201
-          }// if module_exist
201
+            }// if module_exist
202 202
             
203 203
         }// foreach document
204 204
         
205 205
         $comdocs[] = $comment_document;
206
-      }// while
206
+        }// while
207 207
     }// if entity_type=node
208
-  }// documents
208
+    }// documents
209 209
 
210
-  // Merge the comment documents with the input documents array. These
211
-  // documents will now be added to the Solr search index.
212
-  $documents = array_merge($documents, $comdocs);
210
+    // Merge the comment documents with the input documents array. These
211
+    // documents will now be added to the Solr search index.
212
+    $documents = array_merge($documents, $comdocs);
213 213
 }
214 214
 
215 215
 /**
@@ -225,19 +225,19 @@  discard block
 block discarded – undo
225 225
  *   The Solr query used for the search.
226 226
  */
227 227
 function boinc_solr_comments_apachesolr_process_results(&$results, DrupalSolrQueryInterface $query) {
228
-  //dpm($query->getSolrParams(), "process_results query getSolrParams");
229
-  foreach($results as $id => $result) {
228
+    //dpm($query->getSolrParams(), "process_results query getSolrParams");
229
+    foreach($results as $id => $result) {
230 230
     if ($result['entity_type']=='comment') {
231 231
         $results[$id]['type'] = 'Comment';
232 232
         $results[$id]['date'] = $result['fields']['changed'];
233 233
         if (isset($result['fields']['is_uid'])) {
234
-          $uid = $result['fields']['is_uid'];
235
-          $results[$id]['uid']  = $uid;
236
-          $results[$id]['user'] = theme('username', user_load($uid));
234
+            $uid = $result['fields']['is_uid'];
235
+            $results[$id]['uid']  = $uid;
236
+            $results[$id]['user'] = theme('username', user_load($uid));
237 237
         }
238 238
     } //if result entity_type == comment
239
-  }// foreach $result
240
-  //dpm($results, "process_results array_results");
239
+    }// foreach $result
240
+    //dpm($results, "process_results array_results");
241 241
 }
242 242
 
243 243
 /**
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
  *   The Solr query used for the search.
252 252
  */
253 253
 function boinc_solr_comments_apachesolr_query_alter($query) {
254
-  // Add custom field to query results
255
-  $query->addParam('fl','tos_content_extra');
254
+    // Add custom field to query results
255
+    $query->addParam('fl','tos_content_extra');
256 256
 }
257 257
 
258 258
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
  * 
266 266
  */
267 267
 function boinc_solr_comments_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
268
-  // Array of node types that will have comments indexed.
269
-  $node_types = variable_get('boinc_solr_comments_nodetypes', '');
270
-  if (empty($node_types)) {
268
+    // Array of node types that will have comments indexed.
269
+    $node_types = variable_get('boinc_solr_comments_nodetypes', '');
270
+    if (empty($node_types)) {
271 271
     // If the variable has not been set, then by default index
272 272
     // comments for all known node types.
273 273
     $node_types = array(
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
         'story'      => 'story',
278 278
         'team_forum' => 'team_forum',
279 279
     );
280
-  }
280
+    }
281 281
 
282
-  switch ($op) {
282
+    switch ($op) {
283 283
     case 'delete':
284 284
       // Only call delete function on certain node types
285 285
       if (in_array( $node->type, $node_types)) {
286 286
         boinc_solr_comments_delete($node);
287
-      }
288
-      break;
289
-  } //switch
287
+        }
288
+        break;
289
+    } //switch
290 290
 }
291 291
 
292 292
 
@@ -303,30 +303,30 @@  discard block
 block discarded – undo
303 303
  *   Returns TRUE if the comment was deleted, otherwise return FALSE.
304 304
  */
305 305
 function boinc_solr_comments_delete($node) {
306
-  // Load the Solr environment.
307
-  $env_id = apachesolr_default_environment();
308
-  // Check to see if Solr is read-only.
309
-  if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
306
+    // Load the Solr environment.
307
+    $env_id = apachesolr_default_environment();
308
+    // Check to see if Solr is read-only.
309
+    if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
310 310
     return FALSE;
311
-  }
311
+    }
312 312
   
313
-  // Code derived from apachesolr_index_delete_entity_from_index
314
-  try {
313
+    // Code derived from apachesolr_index_delete_entity_from_index
314
+    try {
315 315
     $solr = apachesolr_get_solr($env_id);
316 316
     // Custom query to find all comments with parent nid of the node bing deleted.
317 317
     $query = "entity_type:comment AND tos_content_extra:" . $node->nid;
318 318
     $solr->deleteByQuery($query);
319 319
     // Log the query used for deletion.
320 320
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
321
-  }
322
-  catch (Exception $e) {
323
-      watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
324
-      return FALSE;
325
-  }// try
326
-
327
-  // all deletions sucessful
328
-  apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
329
-  return TRUE;
321
+    }
322
+    catch (Exception $e) {
323
+        watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
324
+        return FALSE;
325
+    }// try
326
+
327
+    // all deletions sucessful
328
+    apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
329
+    return TRUE;
330 330
 }
331 331
 
332 332
 /**
@@ -334,15 +334,15 @@  discard block
 block discarded – undo
334 334
  *
335 335
  */
336 336
 function boinc_solr_comments_comment(&$a1, $op) {
337
-  switch ($op) {
337
+    switch ($op) {
338 338
     case 'view':
339 339
     case 'update':
340 340
       break;
341 341
     case 'delete':
342 342
       // $a1 should be a comment object
343 343
       boinc_solr_comments_deletecomment($a1);
344
-      break;
345
-  }// switch
344
+        break;
345
+    }// switch
346 346
 }
347 347
 
348 348
 /** 
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
  *   Returns TRUE if the comment was deleted, otherwise return FALSE.
359 359
  */
360 360
 function boinc_solr_comments_deletecomment($comment) {
361
-  // Load the Solr environment.
362
-  $env_id = apachesolr_default_environment();
363
-  // Check to see if Solr is read-only.
364
-  if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
361
+    // Load the Solr environment.
362
+    $env_id = apachesolr_default_environment();
363
+    // Check to see if Solr is read-only.
364
+    if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
365 365
     return FALSE;
366
-  }
367
-  //dd($comment->cid, "delete - nid begin");
366
+    }
367
+    //dd($comment->cid, "delete - nid begin");
368 368
     
369
-  // Code derived from apachesolr_index_delete_entity_from_index.
370
-  try {
369
+    // Code derived from apachesolr_index_delete_entity_from_index.
370
+    try {
371 371
     $solr = apachesolr_get_solr($env_id);
372 372
     $entity_id = $comment->cid;
373 373
     $entity_type = 'comment';
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
     // Log the query used for deletion.
378 378
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
379 379
     }
380
-  catch (Exception $e) {
380
+    catch (Exception $e) {
381 381
     watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
382 382
     return FALSE;
383
-  }// try
383
+    }// try
384 384
 
385
-  // deletion sucessful
386
-  apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
387
-  return TRUE;
385
+    // deletion sucessful
386
+    apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
387
+    return TRUE;
388 388
 }
389 389
 
390 390
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
  */
400 400
 
401 401
 function boinc_solr_comments_enable() {
402
-  drupal_set_message( bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), NULL, 'boinc:admin-solr-index-comments-message'), 'warning');
402
+    drupal_set_message( bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), NULL, 'boinc:admin-solr-index-comments-message'), 'warning');
403 403
 }
404 404
 
405 405
 /** 
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
  *   The comment to be published (unhidden).
411 411
  */
412 412
 function boinc_solr_comments_publish($comment) {
413
-  if ( ($comment->cid) AND ($comment->nid) ) {
413
+    if ( ($comment->cid) AND ($comment->nid) ) {
414 414
     $node = node_load($comment->nid);
415 415
     // Tell Solr that the node has been updated, so the comment can be
416 416
     // indexed.
417 417
     apachesolr_entity_update($node, 'node');
418
-  }
418
+    }
419 419
 }
420 420
 
421 421
 /** 
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
  *   The comment to be unpublished (hidden). 
427 427
  */
428 428
 function boinc_solr_comments_unpublish($comment) {
429
-  if ( ($comment->cid) ) {
429
+    if ( ($comment->cid) ) {
430 430
     // Call the deletecomment function for hook comment.
431 431
     boinc_solr_comments_deletecomment($comment);
432
-  }
432
+    }
433 433
 }
434 434
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
   foreach ($documents as $document) {
79 79
     //dd($document, "index documents alter - document");
80 80
 
81
-    $to_process = ( array_key_exists($document->bundle, $node_types) AND $node_types[$document->bundle] );
82
-    if ( $document->entity_type=='node' AND $to_process) {
81
+    $to_process = (array_key_exists($document->bundle, $node_types) AND $node_types[$document->bundle]);
82
+    if ($document->entity_type == 'node' AND $to_process) {
83 83
       
84 84
       // Remove ts_comments if present.
85 85
       if (isset($document->ts_comments)) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $comment_document->bundle = 'Comment';
111 111
         $comment_document->bundle_name = 'Comment';
112 112
 
113
-        $comment_document->path = 'goto/comment/' . $comment->cid;
113
+        $comment_document->path = 'goto/comment/'.$comment->cid;
114 114
         $comment_document->url = url($comment_document->path, $url_options);
115 115
 
116 116
         // Comment object has no language
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
         // Index formatted username so it can be searched and sorted
142 142
         // on.
143
-        $account = (object) array('uid' => $comment->uid, 'name' => $comment->name);
143
+        $account = (object)array('uid' => $comment->uid, 'name' => $comment->name);
144 144
         $username = check_plain($account->name);
145 145
         $comment_document->ss_name_formatted = $username;
146 146
         $comment_document->tos_name_formatted = $username;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
           // Copy over fields [im_taxonomy_vid_1], [tid], [im_vid_1],
186 186
           // [im_vid_Forums], [tm_vid_1_names]
187
-          if ( ( preg_match('/tid/', $fieldName) OR preg_match('/vid/', $fieldName) ) AND is_array($fieldValue) ) {
187
+          if ((preg_match('/tid/', $fieldName) OR preg_match('/vid/', $fieldName)) AND is_array($fieldValue)) {
188 188
             foreach ($fieldValue as $subkey => $subvalue) {
189 189
               $comment_document->addField($fieldName, $subvalue);
190 190
             }
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
  */
227 227
 function boinc_solr_comments_apachesolr_process_results(&$results, DrupalSolrQueryInterface $query) {
228 228
   //dpm($query->getSolrParams(), "process_results query getSolrParams");
229
-  foreach($results as $id => $result) {
230
-    if ($result['entity_type']=='comment') {
229
+  foreach ($results as $id => $result) {
230
+    if ($result['entity_type'] == 'comment') {
231 231
         $results[$id]['type'] = 'Comment';
232 232
         $results[$id]['date'] = $result['fields']['changed'];
233 233
         if (isset($result['fields']['is_uid'])) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  */
253 253
 function boinc_solr_comments_apachesolr_query_alter($query) {
254 254
   // Add custom field to query results
255
-  $query->addParam('fl','tos_content_extra');
255
+  $query->addParam('fl', 'tos_content_extra');
256 256
 }
257 257
 
258 258
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
   switch ($op) {
283 283
     case 'delete':
284 284
       // Only call delete function on certain node types
285
-      if (in_array( $node->type, $node_types)) {
285
+      if (in_array($node->type, $node_types)) {
286 286
         boinc_solr_comments_delete($node);
287 287
       }
288 288
       break;
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
   try {
315 315
     $solr = apachesolr_get_solr($env_id);
316 316
     // Custom query to find all comments with parent nid of the node bing deleted.
317
-    $query = "entity_type:comment AND tos_content_extra:" . $node->nid;
317
+    $query = "entity_type:comment AND tos_content_extra:".$node->nid;
318 318
     $solr->deleteByQuery($query);
319 319
     // Log the query used for deletion.
320 320
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
  */
400 400
 
401 401
 function boinc_solr_comments_enable() {
402
-  drupal_set_message( bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), NULL, 'boinc:admin-solr-index-comments-message'), 'warning');
402
+  drupal_set_message(bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), NULL, 'boinc:admin-solr-index-comments-message'), 'warning');
403 403
 }
404 404
 
405 405
 /** 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
  *   The comment to be published (unhidden).
411 411
  */
412 412
 function boinc_solr_comments_publish($comment) {
413
-  if ( ($comment->cid) AND ($comment->nid) ) {
413
+  if (($comment->cid) AND ($comment->nid)) {
414 414
     $node = node_load($comment->nid);
415 415
     // Tell Solr that the node has been updated, so the comment can be
416 416
     // indexed.
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
  *   The comment to be unpublished (hidden). 
427 427
  */
428 428
 function boinc_solr_comments_unpublish($comment) {
429
-  if ( ($comment->cid) ) {
429
+  if (($comment->cid)) {
430 430
     // Call the deletecomment function for hook comment.
431 431
     boinc_solr_comments_deletecomment($comment);
432 432
   }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
   foreach ($documents as $document) {
79 79
     //dd($document, "index documents alter - document");
80 80
 
81
-    $to_process = ( array_key_exists($document->bundle, $node_types) AND $node_types[$document->bundle] );
82
-    if ( $document->entity_type=='node' AND $to_process) {
81
+    $to_process = ( array_key_exists($document->bundle, $node_types) and $node_types[$document->bundle] );
82
+    if ( $document->entity_type=='node' and $to_process) {
83 83
       
84 84
       // Remove ts_comments if present.
85 85
       if (isset($document->ts_comments)) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $comment = _comment_load($row['cid']);
99 99
 
100 100
         // Code derived from _apachesolr_index_process_entity_get_document
101
-        $url_options = array('absolute' => TRUE);
101
+        $url_options = array('absolute' => true);
102 102
         $comment_document = new ApacheSolrdocument();
103 103
 
104 104
         $comment_document->id = apachesolr_document_id($comment->cid, 'comment');
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
         // Comment object has no language
117 117
         $comment_document->ss_language = 'und';
118 118
         if (function_exists('drupal_get_path_alias')) {
119
-          $output = drupal_get_path_alias($comment_document->path, NULL);
119
+          $output = drupal_get_path_alias($comment_document->path, null);
120 120
           if ($output && $output != $document->path) {
121 121
             $comment_document->path_alias = $output;
122 122
           }
123 123
         }
124 124
         
125 125
         // Code derived from apachesolr_index_node_solr_document
126
-        $comment_document->label = truncate_utf8(apachesolr_clean_text($comment->comment), 32, TRUE);
126
+        $comment_document->label = truncate_utf8(apachesolr_clean_text($comment->comment), 32, true);
127 127
         $comment_document->content = apachesolr_clean_text($comment->comment);
128
-        $comment_document->teaser = truncate_utf8($document->content, 300, TRUE);
128
+        $comment_document->teaser = truncate_utf8($document->content, 300, true);
129 129
 
130 130
         // Author information
131 131
         if ($comment->uid == 0 || strlen($comment->name) == 0) {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
           // Copy over fields [im_taxonomy_vid_1], [tid], [im_vid_1],
186 186
           // [im_vid_Forums], [tm_vid_1_names]
187
-          if ( ( preg_match('/tid/', $fieldName) OR preg_match('/vid/', $fieldName) ) AND is_array($fieldValue) ) {
187
+          if ( ( preg_match('/tid/', $fieldName) or preg_match('/vid/', $fieldName) ) and is_array($fieldValue) ) {
188 188
             foreach ($fieldValue as $subkey => $subvalue) {
189 189
               $comment_document->addField($fieldName, $subvalue);
190 190
             }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
           // Set the access keys so this module will work with
194 194
           // apachesolr_access.
195 195
           if (module_exists('apachesolr_access')) {
196
-            if (preg_match('/^access/', $fieldName) AND is_array($fieldValue)) {
196
+            if (preg_match('/^access/', $fieldName) and is_array($fieldValue)) {
197 197
               foreach ($fieldValue as $subkey => $subvalue) {
198 198
                 $comment_document->addField($fieldName, $subvalue);
199 199
               }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
  * Implementation of hook_nodeapi()
265 265
  * 
266 266
  */
267
-function boinc_solr_comments_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
267
+function boinc_solr_comments_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
268 268
   // Array of node types that will have comments indexed.
269 269
   $node_types = variable_get('boinc_solr_comments_nodetypes', '');
270 270
   if (empty($node_types)) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
   $env_id = apachesolr_default_environment();
308 308
   // Check to see if Solr is read-only.
309 309
   if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
310
-    return FALSE;
310
+    return false;
311 311
   }
312 312
   
313 313
   // Code derived from apachesolr_index_delete_entity_from_index
@@ -320,13 +320,13 @@  discard block
 block discarded – undo
320 320
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
321 321
   }
322 322
   catch (Exception $e) {
323
-      watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
324
-      return FALSE;
323
+      watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), null, WATCHDOG_ERROR);
324
+      return false;
325 325
   }// try
326 326
 
327 327
   // all deletions sucessful
328 328
   apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
329
-  return TRUE;
329
+  return true;
330 330
 }
331 331
 
332 332
 /**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
   $env_id = apachesolr_default_environment();
363 363
   // Check to see if Solr is read-only.
364 364
   if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
365
-    return FALSE;
365
+    return false;
366 366
   }
367 367
   //dd($comment->cid, "delete - nid begin");
368 368
     
@@ -378,13 +378,13 @@  discard block
 block discarded – undo
378 378
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
379 379
     }
380 380
   catch (Exception $e) {
381
-    watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
382
-    return FALSE;
381
+    watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), null, WATCHDOG_ERROR);
382
+    return false;
383 383
   }// try
384 384
 
385 385
   // deletion sucessful
386 386
   apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
387
-  return TRUE;
387
+  return true;
388 388
 }
389 389
 
390 390
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
  */
400 400
 
401 401
 function boinc_solr_comments_enable() {
402
-  drupal_set_message( bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), NULL, 'boinc:admin-solr-index-comments-message'), 'warning');
402
+  drupal_set_message( bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), null, 'boinc:admin-solr-index-comments-message'), 'warning');
403 403
 }
404 404
 
405 405
 /** 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
  *   The comment to be published (unhidden).
411 411
  */
412 412
 function boinc_solr_comments_publish($comment) {
413
-  if ( ($comment->cid) AND ($comment->nid) ) {
413
+  if ( ($comment->cid) and ($comment->nid) ) {
414 414
     $node = node_load($comment->nid);
415 415
     // Tell Solr that the node has been updated, so the comment can be
416 416
     // indexed.
Please login to merge, or discard this patch.