@@ -25,30 +25,30 @@ |
||
25 | 25 | * Implementation of hook_menu() |
26 | 26 | */ |
27 | 27 | function boincteam_forum_menu() { |
28 | - $items = array(); |
|
28 | +$items = array(); |
|
29 | 29 | |
30 | - return $items; |
|
30 | +return $items; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Implementation of hook_form_alter() |
35 | 35 | */ |
36 | 36 | function boincteam_forum_form_alter(&$form, $form_state, $form_id) { |
37 | - switch ($form_id) { |
|
38 | - // Team forum node edit form |
|
39 | - case 'team_forum_node_form': |
|
37 | +switch ($form_id) { |
|
38 | +// Team forum node edit form |
|
39 | +case 'team_forum_node_form': |
|
40 | 40 | |
41 | - // Internal fields to indicate where these changes are taking place |
|
42 | - array_unshift($form, array( |
|
43 | - 'tfid' => array( |
|
44 | - '#type' => 'hidden', |
|
45 | - '#value' => arg(3), |
|
46 | - ), |
|
47 | - )); |
|
48 | - break; |
|
41 | +// Internal fields to indicate where these changes are taking place |
|
42 | +array_unshift($form, array( |
|
43 | +'tfid' => array( |
|
44 | +'#type' => 'hidden', |
|
45 | +'#value' => arg(3), |
|
46 | +), |
|
47 | +)); |
|
48 | +break; |
|
49 | 49 | |
50 | - default: |
|
51 | - } |
|
50 | +default: |
|
51 | +} |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -50,47 +50,47 @@ discard block |
||
50 | 50 | } |
51 | 51 | $resultLength = 0; |
52 | 52 | switch ($algo) { |
53 | - case PASSWORD_BCRYPT: |
|
54 | - $cost = PASSWORD_BCRYPT_DEFAULT_COST; |
|
55 | - if (isset($options['cost'])) { |
|
56 | - $cost = (int) $options['cost']; |
|
57 | - if ($cost < 4 || $cost > 31) { |
|
58 | - trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); |
|
59 | - return null; |
|
60 | - } |
|
53 | + case PASSWORD_BCRYPT: |
|
54 | + $cost = PASSWORD_BCRYPT_DEFAULT_COST; |
|
55 | + if (isset($options['cost'])) { |
|
56 | + $cost = (int) $options['cost']; |
|
57 | + if ($cost < 4 || $cost > 31) { |
|
58 | + trigger_error(sprintf("password_hash(): Invalid bcrypt cost parameter specified: %d", $cost), E_USER_WARNING); |
|
59 | + return null; |
|
61 | 60 | } |
62 | - // The length of salt to generate |
|
63 | - $raw_salt_len = 16; |
|
64 | - // The length required in the final serialization |
|
65 | - $required_salt_len = 22; |
|
66 | - $hash_format = sprintf("$2y$%02d$", $cost); |
|
67 | - // The expected length of the final crypt() output |
|
68 | - $resultLength = 60; |
|
69 | - break; |
|
70 | - default: |
|
71 | - trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING); |
|
72 | - return null; |
|
61 | + } |
|
62 | + // The length of salt to generate |
|
63 | + $raw_salt_len = 16; |
|
64 | + // The length required in the final serialization |
|
65 | + $required_salt_len = 22; |
|
66 | + $hash_format = sprintf("$2y$%02d$", $cost); |
|
67 | + // The expected length of the final crypt() output |
|
68 | + $resultLength = 60; |
|
69 | + break; |
|
70 | + default: |
|
71 | + trigger_error(sprintf("password_hash(): Unknown password hashing algorithm: %s", $algo), E_USER_WARNING); |
|
72 | + return null; |
|
73 | 73 | } |
74 | 74 | $salt_req_encoding = false; |
75 | 75 | if (isset($options['salt'])) { |
76 | 76 | switch (gettype($options['salt'])) { |
77 | - case 'NULL': |
|
78 | - case 'boolean': |
|
79 | - case 'integer': |
|
80 | - case 'double': |
|
81 | - case 'string': |
|
77 | + case 'NULL': |
|
78 | + case 'boolean': |
|
79 | + case 'integer': |
|
80 | + case 'double': |
|
81 | + case 'string': |
|
82 | + $salt = (string) $options['salt']; |
|
83 | + break; |
|
84 | + case 'object': |
|
85 | + if (method_exists($options['salt'], '__tostring')) { |
|
82 | 86 | $salt = (string) $options['salt']; |
83 | 87 | break; |
84 | - case 'object': |
|
85 | - if (method_exists($options['salt'], '__tostring')) { |
|
86 | - $salt = (string) $options['salt']; |
|
87 | - break; |
|
88 | - } |
|
89 | - case 'array': |
|
90 | - case 'resource': |
|
91 | - default: |
|
92 | - trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING); |
|
93 | - return null; |
|
88 | + } |
|
89 | + case 'array': |
|
90 | + case 'resource': |
|
91 | + default: |
|
92 | + trigger_error('password_hash(): Non-string salt parameter supplied', E_USER_WARNING); |
|
93 | + return null; |
|
94 | 94 | } |
95 | 95 | if (PasswordCompat\binary\_strlen($salt) < $required_salt_len) { |
96 | 96 | trigger_error(sprintf("password_hash(): Provided salt is too short: %d expecting %d", PasswordCompat\binary\_strlen($salt), $required_salt_len), E_USER_WARNING); |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | return true; |
213 | 213 | } |
214 | 214 | switch ($algo) { |
215 | - case PASSWORD_BCRYPT: |
|
216 | - $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
217 | - if ($cost !== $info['options']['cost']) { |
|
218 | - return true; |
|
219 | - } |
|
220 | - break; |
|
215 | + case PASSWORD_BCRYPT: |
|
216 | + $cost = isset($options['cost']) ? (int) $options['cost'] : PASSWORD_BCRYPT_DEFAULT_COST; |
|
217 | + if ($cost !== $info['options']['cost']) { |
|
218 | + return true; |
|
219 | + } |
|
220 | + break; |
|
221 | 221 | } |
222 | 222 | return false; |
223 | 223 | } |
@@ -50,11 +50,11 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | switch ($this->options['format']) { |
53 | - case 'raw': |
|
54 | - $output = $value; |
|
55 | - break; |
|
56 | - default: |
|
57 | - $output = theme('filefield_meta_samplerate', $value); |
|
53 | + case 'raw': |
|
54 | + $output = $value; |
|
55 | + break; |
|
56 | + default: |
|
57 | + $output = theme('filefield_meta_samplerate', $value); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']); |
@@ -48,20 +48,20 @@ |
||
48 | 48 | $value = $values->{$this->field_alias}; |
49 | 49 | |
50 | 50 | switch ($this->options['format']) { |
51 | - case 'hours': |
|
52 | - $output = date('g', (int) $value); |
|
53 | - break; |
|
54 | - case 'minutes': |
|
55 | - $output = date('i', (int) $value); |
|
56 | - break; |
|
57 | - case 'seconds': |
|
58 | - $output = date('s', (int) $value); |
|
59 | - break; |
|
60 | - case 'total': |
|
61 | - $output = check_plain($value); |
|
62 | - break; |
|
63 | - default: |
|
64 | - $output = theme('filefield_meta_duration', $value); |
|
51 | + case 'hours': |
|
52 | + $output = date('g', (int) $value); |
|
53 | + break; |
|
54 | + case 'minutes': |
|
55 | + $output = date('i', (int) $value); |
|
56 | + break; |
|
57 | + case 'seconds': |
|
58 | + $output = date('s', (int) $value); |
|
59 | + break; |
|
60 | + case 'total': |
|
61 | + $output = check_plain($value); |
|
62 | + break; |
|
63 | + default: |
|
64 | + $output = theme('filefield_meta_duration', $value); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // Check to see if hiding should happen before adding prefix and suffix. |
@@ -50,11 +50,11 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | switch ($this->options['format']) { |
53 | - case 'raw': |
|
54 | - $output = $value; |
|
55 | - break; |
|
56 | - default: |
|
57 | - $output = theme('filefield_meta_bitrate', $value); |
|
53 | + case 'raw': |
|
54 | + $output = $value; |
|
55 | + break; |
|
56 | + default: |
|
57 | + $output = theme('filefield_meta_bitrate', $value); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']); |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | unset($fields['table']); |
23 | 23 | foreach ($fields as $filefield_field => $definition) { |
24 | 24 | switch ($filefield_field) { |
25 | - case $content_field['field_name'] .'_fid': |
|
26 | - $filefield_fields[$filefield_field] = array( |
|
27 | - 'table' => $table, |
|
28 | - 'field' => $filefield_field, |
|
29 | - ); |
|
30 | - $filefield_arguments['content: '. $content_field['field_name']] = &$filefield_fields[$filefield_field]; |
|
31 | - break; |
|
32 | - case $content_field['field_name'] .'_list': |
|
33 | - $filefield_filters[$content_field['field_name'] .'_fid_not null'] = array( |
|
34 | - 'table' => $table, |
|
35 | - 'field' => $filefield_field, |
|
36 | - ); |
|
37 | - break; |
|
25 | + case $content_field['field_name'] .'_fid': |
|
26 | + $filefield_fields[$filefield_field] = array( |
|
27 | + 'table' => $table, |
|
28 | + 'field' => $filefield_field, |
|
29 | + ); |
|
30 | + $filefield_arguments['content: '. $content_field['field_name']] = &$filefield_fields[$filefield_field]; |
|
31 | + break; |
|
32 | + case $content_field['field_name'] .'_list': |
|
33 | + $filefield_filters[$content_field['field_name'] .'_fid_not null'] = array( |
|
34 | + 'table' => $table, |
|
35 | + 'field' => $filefield_field, |
|
36 | + ); |
|
37 | + break; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
@@ -43,39 +43,39 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | switch ($type) { |
46 | - case 'field': |
|
47 | - if (isset($filefield_fields[$field['field']])) { |
|
48 | - $multiple = array(); |
|
49 | - switch ($field['handler']) { |
|
50 | - case 'content_views_field_handler_ungroup': |
|
51 | - $view->set_item_option($display, 'field', $id, 'multiple', array('group' => FALSE)); |
|
52 | - break; |
|
53 | - case 'content_views_field_handler_last': |
|
54 | - $multiple['multiple_reversed'] = TRUE; |
|
55 | - case 'content_views_field_handler_first': |
|
56 | - $multiple['multiple_number'] = 1; |
|
57 | - $view->set_item_option($display, 'field', $id, 'multiple', $multiple); |
|
58 | - break; |
|
59 | - } |
|
60 | - $view->set_item_option($display, 'field', $id, 'format', $field['options']); |
|
61 | - } |
|
46 | + case 'field': |
|
47 | + if (isset($filefield_fields[$field['field']])) { |
|
48 | + $multiple = array(); |
|
49 | + switch ($field['handler']) { |
|
50 | + case 'content_views_field_handler_ungroup': |
|
51 | + $view->set_item_option($display, 'field', $id, 'multiple', array('group' => FALSE)); |
|
62 | 52 | break; |
63 | - case 'filter': |
|
64 | - if (isset($filefield_filters[$field['field']])) { |
|
65 | - $filter = $filefield_filters[$field['field']]; |
|
66 | - $item = $view->get_item($display, 'filter', $id); |
|
67 | - $item['value'] = $field['value']; |
|
68 | - $item['table'] = $filter['table']; |
|
69 | - $item['field'] = $filter['field']; |
|
70 | - $view->set_item($display, 'filter', $id, $item); |
|
71 | - } |
|
53 | + case 'content_views_field_handler_last': |
|
54 | + $multiple['multiple_reversed'] = TRUE; |
|
55 | + case 'content_views_field_handler_first': |
|
56 | + $multiple['multiple_number'] = 1; |
|
57 | + $view->set_item_option($display, 'field', $id, 'multiple', $multiple); |
|
72 | 58 | break; |
73 | - case 'argument': |
|
74 | - if (isset($filefield_arguments[$field['type']])) { |
|
75 | - $argument = $filefield_arguments[$field['type']]; |
|
76 | - $options = $field['argoptions']; |
|
77 | - $view->add_item($display, 'argument', $argument['table'], $argument['field'], $options, $field['id']); |
|
59 | + } |
|
60 | + $view->set_item_option($display, 'field', $id, 'format', $field['options']); |
|
78 | 61 | } |
79 | 62 | break; |
63 | + case 'filter': |
|
64 | + if (isset($filefield_filters[$field['field']])) { |
|
65 | + $filter = $filefield_filters[$field['field']]; |
|
66 | + $item = $view->get_item($display, 'filter', $id); |
|
67 | + $item['value'] = $field['value']; |
|
68 | + $item['table'] = $filter['table']; |
|
69 | + $item['field'] = $filter['field']; |
|
70 | + $view->set_item($display, 'filter', $id, $item); |
|
71 | + } |
|
72 | + break; |
|
73 | + case 'argument': |
|
74 | + if (isset($filefield_arguments[$field['type']])) { |
|
75 | + $argument = $filefield_arguments[$field['type']]; |
|
76 | + $options = $field['argoptions']; |
|
77 | + $view->add_item($display, 'argument', $argument['table'], $argument['field'], $options, $field['id']); |
|
78 | + } |
|
79 | + break; |
|
80 | 80 | } |
81 | 81 | } |
@@ -123,126 +123,126 @@ |
||
123 | 123 | function _filefield_generic_icon_map($file) { |
124 | 124 | switch ($file['filemime']) { |
125 | 125 | // Word document types. |
126 | - case 'application/msword': |
|
127 | - case 'application/vnd.ms-word.document.macroEnabled.12': |
|
128 | - case 'application/vnd.oasis.opendocument.text': |
|
129 | - case 'application/vnd.oasis.opendocument.text-template': |
|
130 | - case 'application/vnd.oasis.opendocument.text-master': |
|
131 | - case 'application/vnd.oasis.opendocument.text-web': |
|
132 | - case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': |
|
133 | - case 'application/vnd.stardivision.writer': |
|
134 | - case 'application/vnd.sun.xml.writer': |
|
135 | - case 'application/vnd.sun.xml.writer.template': |
|
136 | - case 'application/vnd.sun.xml.writer.global': |
|
137 | - case 'application/vnd.wordperfect': |
|
138 | - case 'application/x-abiword': |
|
139 | - case 'application/x-applix-word': |
|
140 | - case 'application/x-kword': |
|
141 | - case 'application/x-kword-crypt': |
|
142 | - return 'x-office-document'; |
|
143 | - |
|
144 | - // Spreadsheet document types. |
|
145 | - case 'application/vnd.ms-excel': |
|
146 | - case 'application/vnd.ms-excel.sheet.macroEnabled.12': |
|
147 | - case 'application/vnd.oasis.opendocument.spreadsheet': |
|
148 | - case 'application/vnd.oasis.opendocument.spreadsheet-template': |
|
149 | - case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': |
|
150 | - case 'application/vnd.stardivision.calc': |
|
151 | - case 'application/vnd.sun.xml.calc': |
|
152 | - case 'application/vnd.sun.xml.calc.template': |
|
153 | - case 'application/vnd.lotus-1-2-3': |
|
154 | - case 'application/x-applix-spreadsheet': |
|
155 | - case 'application/x-gnumeric': |
|
156 | - case 'application/x-kspread': |
|
157 | - case 'application/x-kspread-crypt': |
|
158 | - return 'x-office-spreadsheet'; |
|
159 | - |
|
160 | - // Presentation document types. |
|
161 | - case 'application/vnd.ms-powerpoint': |
|
162 | - case 'application/vnd.ms-powerpoint.presentation.macroEnabled.12': |
|
163 | - case 'application/vnd.oasis.opendocument.presentation': |
|
164 | - case 'application/vnd.oasis.opendocument.presentation-template': |
|
165 | - case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': |
|
166 | - case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': |
|
167 | - case 'application/vnd.stardivision.impress': |
|
168 | - case 'application/vnd.sun.xml.impress': |
|
169 | - case 'application/vnd.sun.xml.impress.template': |
|
170 | - case 'application/x-kpresenter': |
|
171 | - return 'x-office-presentation'; |
|
172 | - |
|
173 | - // Compressed archive types. |
|
174 | - case 'application/zip': |
|
175 | - case 'application/x-zip': |
|
176 | - case 'application/stuffit': |
|
177 | - case 'application/x-stuffit': |
|
178 | - case 'application/x-7z-compressed': |
|
179 | - case 'application/x-ace': |
|
180 | - case 'application/x-arj': |
|
181 | - case 'application/x-bzip': |
|
182 | - case 'application/x-bzip-compressed-tar': |
|
183 | - case 'application/x-compress': |
|
184 | - case 'application/x-compressed-tar': |
|
185 | - case 'application/x-cpio-compressed': |
|
186 | - case 'application/x-deb': |
|
187 | - case 'application/x-gzip': |
|
188 | - case 'application/x-java-archive': |
|
189 | - case 'application/x-lha': |
|
190 | - case 'application/x-lhz': |
|
191 | - case 'application/x-lzop': |
|
192 | - case 'application/x-rar': |
|
193 | - case 'application/x-rpm': |
|
194 | - case 'application/x-tzo': |
|
195 | - case 'application/x-tar': |
|
196 | - case 'application/x-tarz': |
|
197 | - case 'application/x-tgz': |
|
198 | - return 'package-x-generic'; |
|
199 | - |
|
200 | - // Script file types. |
|
201 | - case 'application/ecmascript': |
|
202 | - case 'application/javascript': |
|
203 | - case 'application/mathematica': |
|
204 | - case 'application/vnd.mozilla.xul+xml': |
|
205 | - case 'application/x-asp': |
|
206 | - case 'application/x-awk': |
|
207 | - case 'application/x-cgi': |
|
208 | - case 'application/x-csh': |
|
209 | - case 'application/x-m4': |
|
210 | - case 'application/x-perl': |
|
211 | - case 'application/x-php': |
|
212 | - case 'application/x-ruby': |
|
213 | - case 'application/x-shellscript': |
|
214 | - case 'text/vnd.wap.wmlscript': |
|
215 | - case 'text/x-emacs-lisp': |
|
216 | - case 'text/x-haskell': |
|
217 | - case 'text/x-literate-haskell': |
|
218 | - case 'text/x-lua': |
|
219 | - case 'text/x-makefile': |
|
220 | - case 'text/x-matlab': |
|
221 | - case 'text/x-python': |
|
222 | - case 'text/x-sql': |
|
223 | - case 'text/x-tcl': |
|
224 | - return 'text-x-script'; |
|
225 | - |
|
226 | - // HTML aliases. |
|
227 | - case 'application/xhtml+xml': |
|
228 | - return 'text-html'; |
|
229 | - |
|
230 | - // RTF files. |
|
231 | - case 'application/rtf': |
|
232 | - return 'text-rtf'; |
|
233 | - |
|
234 | - // Google earth files. |
|
235 | - case 'application/vnd.google-earth.kml+xml': |
|
236 | - case 'application/vnd.google-earth.kmz': |
|
237 | - return 'application-google-earth'; |
|
238 | - |
|
239 | - // Executable types. |
|
240 | - case 'application/x-macbinary': |
|
241 | - case 'application/x-ms-dos-executable': |
|
242 | - case 'application/x-pef-executable': |
|
243 | - return 'application-x-executable'; |
|
244 | - |
|
245 | - default: |
|
246 | - return FALSE; |
|
126 | + case 'application/msword': |
|
127 | + case 'application/vnd.ms-word.document.macroEnabled.12': |
|
128 | + case 'application/vnd.oasis.opendocument.text': |
|
129 | + case 'application/vnd.oasis.opendocument.text-template': |
|
130 | + case 'application/vnd.oasis.opendocument.text-master': |
|
131 | + case 'application/vnd.oasis.opendocument.text-web': |
|
132 | + case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': |
|
133 | + case 'application/vnd.stardivision.writer': |
|
134 | + case 'application/vnd.sun.xml.writer': |
|
135 | + case 'application/vnd.sun.xml.writer.template': |
|
136 | + case 'application/vnd.sun.xml.writer.global': |
|
137 | + case 'application/vnd.wordperfect': |
|
138 | + case 'application/x-abiword': |
|
139 | + case 'application/x-applix-word': |
|
140 | + case 'application/x-kword': |
|
141 | + case 'application/x-kword-crypt': |
|
142 | + return 'x-office-document'; |
|
143 | + |
|
144 | + // Spreadsheet document types. |
|
145 | + case 'application/vnd.ms-excel': |
|
146 | + case 'application/vnd.ms-excel.sheet.macroEnabled.12': |
|
147 | + case 'application/vnd.oasis.opendocument.spreadsheet': |
|
148 | + case 'application/vnd.oasis.opendocument.spreadsheet-template': |
|
149 | + case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': |
|
150 | + case 'application/vnd.stardivision.calc': |
|
151 | + case 'application/vnd.sun.xml.calc': |
|
152 | + case 'application/vnd.sun.xml.calc.template': |
|
153 | + case 'application/vnd.lotus-1-2-3': |
|
154 | + case 'application/x-applix-spreadsheet': |
|
155 | + case 'application/x-gnumeric': |
|
156 | + case 'application/x-kspread': |
|
157 | + case 'application/x-kspread-crypt': |
|
158 | + return 'x-office-spreadsheet'; |
|
159 | + |
|
160 | + // Presentation document types. |
|
161 | + case 'application/vnd.ms-powerpoint': |
|
162 | + case 'application/vnd.ms-powerpoint.presentation.macroEnabled.12': |
|
163 | + case 'application/vnd.oasis.opendocument.presentation': |
|
164 | + case 'application/vnd.oasis.opendocument.presentation-template': |
|
165 | + case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': |
|
166 | + case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': |
|
167 | + case 'application/vnd.stardivision.impress': |
|
168 | + case 'application/vnd.sun.xml.impress': |
|
169 | + case 'application/vnd.sun.xml.impress.template': |
|
170 | + case 'application/x-kpresenter': |
|
171 | + return 'x-office-presentation'; |
|
172 | + |
|
173 | + // Compressed archive types. |
|
174 | + case 'application/zip': |
|
175 | + case 'application/x-zip': |
|
176 | + case 'application/stuffit': |
|
177 | + case 'application/x-stuffit': |
|
178 | + case 'application/x-7z-compressed': |
|
179 | + case 'application/x-ace': |
|
180 | + case 'application/x-arj': |
|
181 | + case 'application/x-bzip': |
|
182 | + case 'application/x-bzip-compressed-tar': |
|
183 | + case 'application/x-compress': |
|
184 | + case 'application/x-compressed-tar': |
|
185 | + case 'application/x-cpio-compressed': |
|
186 | + case 'application/x-deb': |
|
187 | + case 'application/x-gzip': |
|
188 | + case 'application/x-java-archive': |
|
189 | + case 'application/x-lha': |
|
190 | + case 'application/x-lhz': |
|
191 | + case 'application/x-lzop': |
|
192 | + case 'application/x-rar': |
|
193 | + case 'application/x-rpm': |
|
194 | + case 'application/x-tzo': |
|
195 | + case 'application/x-tar': |
|
196 | + case 'application/x-tarz': |
|
197 | + case 'application/x-tgz': |
|
198 | + return 'package-x-generic'; |
|
199 | + |
|
200 | + // Script file types. |
|
201 | + case 'application/ecmascript': |
|
202 | + case 'application/javascript': |
|
203 | + case 'application/mathematica': |
|
204 | + case 'application/vnd.mozilla.xul+xml': |
|
205 | + case 'application/x-asp': |
|
206 | + case 'application/x-awk': |
|
207 | + case 'application/x-cgi': |
|
208 | + case 'application/x-csh': |
|
209 | + case 'application/x-m4': |
|
210 | + case 'application/x-perl': |
|
211 | + case 'application/x-php': |
|
212 | + case 'application/x-ruby': |
|
213 | + case 'application/x-shellscript': |
|
214 | + case 'text/vnd.wap.wmlscript': |
|
215 | + case 'text/x-emacs-lisp': |
|
216 | + case 'text/x-haskell': |
|
217 | + case 'text/x-literate-haskell': |
|
218 | + case 'text/x-lua': |
|
219 | + case 'text/x-makefile': |
|
220 | + case 'text/x-matlab': |
|
221 | + case 'text/x-python': |
|
222 | + case 'text/x-sql': |
|
223 | + case 'text/x-tcl': |
|
224 | + return 'text-x-script'; |
|
225 | + |
|
226 | + // HTML aliases. |
|
227 | + case 'application/xhtml+xml': |
|
228 | + return 'text-html'; |
|
229 | + |
|
230 | + // RTF files. |
|
231 | + case 'application/rtf': |
|
232 | + return 'text-rtf'; |
|
233 | + |
|
234 | + // Google earth files. |
|
235 | + case 'application/vnd.google-earth.kml+xml': |
|
236 | + case 'application/vnd.google-earth.kmz': |
|
237 | + return 'application-google-earth'; |
|
238 | + |
|
239 | + // Executable types. |
|
240 | + case 'application/x-macbinary': |
|
241 | + case 'application/x-ms-dos-executable': |
|
242 | + case 'application/x-pef-executable': |
|
243 | + return 'application-x-executable'; |
|
244 | + |
|
245 | + default: |
|
246 | + return FALSE; |
|
247 | 247 | } |
248 | 248 | } |
@@ -313,10 +313,10 @@ |
||
313 | 313 | */ |
314 | 314 | function filefield_widget_settings($op, $widget) { |
315 | 315 | switch ($op) { |
316 | - case 'form': |
|
317 | - return filefield_widget_settings_form($widget); |
|
318 | - case 'save': |
|
319 | - return filefield_widget_settings_save($widget); |
|
316 | + case 'form': |
|
317 | + return filefield_widget_settings_form($widget); |
|
318 | + case 'save': |
|
319 | + return filefield_widget_settings_save($widget); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | * Utility Form to delete teams suspected of being spammers. |
18 | 18 | */ |
19 | 19 | function boincteam_utility_delete(&$form_state) { |
20 | - $form = array(); |
|
20 | +$form = array(); |
|
21 | 21 | |
22 | - $form['help'] = array( |
|
23 | - '#type' => 'fieldset', |
|
24 | - '#title' => t('Help'), |
|
25 | - '#collapsible' => TRUE, |
|
26 | - ); |
|
22 | +$form['help'] = array( |
|
23 | +'#type' => 'fieldset', |
|
24 | +'#title' => t('Help'), |
|
25 | +'#collapsible' => TRUE, |
|
26 | +); |
|
27 | 27 | |
28 | - $form['help']['text'] = array( |
|
29 | - '#type' => 'item', |
|
30 | - '#description' => t('This utility page will help in identifying BOINC teams created by SPAMMERs which can be deleted. The search will find BOINC teams that meet the following criteria. |
|
28 | +$form['help']['text'] = array( |
|
29 | +'#type' => 'item', |
|
30 | +'#description' => t('This utility page will help in identifying BOINC teams created by SPAMMERs which can be deleted. The search will find BOINC teams that meet the following criteria. |
|
31 | 31 | <ul> |
32 | 32 | <li>Team has zero or one members.</li> |
33 | 33 | <li>The team has zero (0) total credits.</li> |
@@ -38,121 +38,121 @@ discard block |
||
38 | 38 | <p> <i>How teams are deleted</i>: Select the teams to be deleted from the table below. Click "Delete Selected Teams" button to begin a batch operation to delete the teams. If you select teams, and then page through to another page of the table, your selections will be lost. I.e., only the teams select on the current page will be deleted. |
39 | 39 | <p> The site must be offline/in maintenance mode before searching for and deleting teams. If not, the delete button below is disabled. |
40 | 40 | '), |
41 | - ); |
|
41 | +); |
|
42 | 42 | |
43 | - // This variable name has been changed for Drupal 7/8. |
|
44 | - $maintenance_mode = variable_get('site_offline'); |
|
45 | - if (!$maintenance_mode) { |
|
46 | - drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ') . l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning'); |
|
43 | +// This variable name has been changed for Drupal 7/8. |
|
44 | +$maintenance_mode = variable_get('site_offline'); |
|
45 | +if (!$maintenance_mode) { |
|
46 | +drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ') . l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning'); |
|
47 | +} |
|
48 | + |
|
49 | +$form['teamdelete'] = array( |
|
50 | +'#type' => 'fieldset', |
|
51 | +'#title' => t('Teams to delete'), |
|
52 | +); |
|
53 | +$form['teamdelete']['deleteall'] = array( |
|
54 | +'#type' => 'submit', |
|
55 | +'#disabled' => !($maintenance_mode), |
|
56 | +'#value' => t('Delete Selected Teams'), |
|
57 | +'#submit' => array('boincteam_utility_delete_team'), |
|
58 | +'#attributes' => array( |
|
59 | + 'onclick' => 'return confirm(\'' . t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?') . '\')', |
|
60 | +), |
|
61 | +); |
|
62 | +$form['teamdelete']['results_table'] = array( |
|
63 | +'#value' => drupal_get_form('boincteam_utility_team_table'), |
|
64 | +); |
|
65 | + |
|
66 | +return $form; |
|
67 | +} |
|
68 | + |
|
69 | +function boincteam_utility_team_table() { |
|
70 | + |
|
71 | +$limit=50; |
|
72 | +$sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'"; |
|
73 | + |
|
74 | +// @todo - add bts() or t() |
|
75 | +$resultheader = array( |
|
76 | +array( |
|
77 | + 'data' => 'Team ID', |
|
78 | + 'field' => 'id', |
|
79 | + 'sort' => 'asc', |
|
80 | +), |
|
81 | +array( |
|
82 | + 'data' => 'Team Name', |
|
83 | + 'field' => 'name', |
|
84 | +), |
|
85 | +array( |
|
86 | + 'data' => 'Num Users', |
|
87 | + 'field' => 'nusers', |
|
88 | +), |
|
89 | +array( |
|
90 | + 'data' => 'Link to Team', |
|
91 | + 'field' => 'link', |
|
92 | +), |
|
93 | +); |
|
94 | + |
|
95 | +$tablesort = tablesort_sql($resultheader); |
|
96 | +db_set_active('boinc_rw'); |
|
97 | +$db_res = pager_query($sql . $tablesort, $limit); |
|
98 | +db_set_active('default'); |
|
99 | + |
|
100 | +$form = array(); |
|
101 | +$form['options'] = array(); |
|
102 | +$checkboxes = array(); |
|
103 | +if ($db_res) { |
|
104 | +while ($result = db_fetch_object($db_res)) { |
|
105 | + $drupalnid = boincteam_lookup_nid($result->id); |
|
106 | + if ($drupalnid) { |
|
107 | + $tlink = l($result->name, '/community/teams/' . $drupalnid); |
|
108 | + } |
|
109 | + else { |
|
110 | + $tlink = ''; |
|
47 | 111 | } |
112 | + // only keys no values |
|
113 | + $checkboxes[$result->id] = ''; |
|
48 | 114 | |
49 | - $form['teamdelete'] = array( |
|
50 | - '#type' => 'fieldset', |
|
51 | - '#title' => t('Teams to delete'), |
|
115 | + $form['id'][$result->id] = array( |
|
116 | + '#value' => $result->id, |
|
52 | 117 | ); |
53 | - $form['teamdelete']['deleteall'] = array( |
|
54 | - '#type' => 'submit', |
|
55 | - '#disabled' => !($maintenance_mode), |
|
56 | - '#value' => t('Delete Selected Teams'), |
|
57 | - '#submit' => array('boincteam_utility_delete_team'), |
|
58 | - '#attributes' => array( |
|
59 | - 'onclick' => 'return confirm(\'' . t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?') . '\')', |
|
60 | - ), |
|
118 | + $form['name'][$result->id] = array( |
|
119 | + '#value' => $result->name, |
|
61 | 120 | ); |
62 | - $form['teamdelete']['results_table'] = array( |
|
63 | - '#value' => drupal_get_form('boincteam_utility_team_table'), |
|
121 | + $form['nusers'][$result->id] = array( |
|
122 | + '#value' => $result->nusers, |
|
123 | + ); |
|
124 | + $form['link'][$result->id] = array( |
|
125 | + '#value' => $tlink, |
|
64 | 126 | ); |
65 | - |
|
66 | - return $form; |
|
67 | 127 | } |
68 | 128 | |
69 | -function boincteam_utility_team_table() { |
|
129 | +$form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes); |
|
130 | +$form['pager'] = array('#value' => theme('pager', NULL, $limit, 0)); |
|
70 | 131 | |
71 | - $limit=50; |
|
72 | - $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'"; |
|
73 | - |
|
74 | - // @todo - add bts() or t() |
|
75 | - $resultheader = array( |
|
76 | - array( |
|
77 | - 'data' => 'Team ID', |
|
78 | - 'field' => 'id', |
|
79 | - 'sort' => 'asc', |
|
80 | - ), |
|
81 | - array( |
|
82 | - 'data' => 'Team Name', |
|
83 | - 'field' => 'name', |
|
84 | - ), |
|
85 | - array( |
|
86 | - 'data' => 'Num Users', |
|
87 | - 'field' => 'nusers', |
|
88 | - ), |
|
89 | - array( |
|
90 | - 'data' => 'Link to Team', |
|
91 | - 'field' => 'link', |
|
92 | - ), |
|
93 | - ); |
|
94 | - |
|
95 | - $tablesort = tablesort_sql($resultheader); |
|
96 | - db_set_active('boinc_rw'); |
|
97 | - $db_res = pager_query($sql . $tablesort, $limit); |
|
98 | - db_set_active('default'); |
|
99 | - |
|
100 | - $form = array(); |
|
101 | - $form['options'] = array(); |
|
102 | - $checkboxes = array(); |
|
103 | - if ($db_res) { |
|
104 | - while ($result = db_fetch_object($db_res)) { |
|
105 | - $drupalnid = boincteam_lookup_nid($result->id); |
|
106 | - if ($drupalnid) { |
|
107 | - $tlink = l($result->name, '/community/teams/' . $drupalnid); |
|
108 | - } |
|
109 | - else { |
|
110 | - $tlink = ''; |
|
111 | - } |
|
112 | - // only keys no values |
|
113 | - $checkboxes[$result->id] = ''; |
|
114 | - |
|
115 | - $form['id'][$result->id] = array( |
|
116 | - '#value' => $result->id, |
|
117 | - ); |
|
118 | - $form['name'][$result->id] = array( |
|
119 | - '#value' => $result->name, |
|
120 | - ); |
|
121 | - $form['nusers'][$result->id] = array( |
|
122 | - '#value' => $result->nusers, |
|
123 | - ); |
|
124 | - $form['link'][$result->id] = array( |
|
125 | - '#value' => $tlink, |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - $form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes); |
|
130 | - $form['pager'] = array('#value' => theme('pager', NULL, $limit, 0)); |
|
131 | - |
|
132 | - return $form; |
|
133 | - } |
|
134 | - return "<p>No teams matched the criteria for a SPAM team.</p>"; |
|
132 | +return $form; |
|
133 | +} |
|
134 | +return "<p>No teams matched the criteria for a SPAM team.</p>"; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | 138 | * Submit handler - also creates the batch job to delete the teams. |
139 | 139 | */ |
140 | 140 | function boincteam_utility_delete_team($form, &$form_state) { |
141 | - $checkedteamids = $form_state['clicked_button']['#post']['checkboxes']; |
|
142 | - // Use batch to delete teams |
|
143 | - $operations = array(); |
|
144 | - foreach ($checkedteamids as $id) { |
|
145 | - $operations[] = array('boincteam_utility_batch_process', array($id)); |
|
146 | - } |
|
147 | - $batch = array( |
|
148 | - 'title' => t('Processing BOINC Teams'), |
|
149 | - 'operations' => $operations, |
|
150 | - 'init_message' => t('Starting team deletion'), |
|
151 | - 'finished' => 'boincteam_utility_batch_finished', |
|
152 | - 'file' => drupal_get_path('module', 'boincteam') . '/boincteam.admin.inc', |
|
153 | - ); |
|
154 | - batch_set($batch); |
|
155 | - //batch_process('/admin/boinc/utility-team-delete'); |
|
141 | +$checkedteamids = $form_state['clicked_button']['#post']['checkboxes']; |
|
142 | +// Use batch to delete teams |
|
143 | +$operations = array(); |
|
144 | +foreach ($checkedteamids as $id) { |
|
145 | +$operations[] = array('boincteam_utility_batch_process', array($id)); |
|
146 | +} |
|
147 | +$batch = array( |
|
148 | +'title' => t('Processing BOINC Teams'), |
|
149 | +'operations' => $operations, |
|
150 | +'init_message' => t('Starting team deletion'), |
|
151 | +'finished' => 'boincteam_utility_batch_finished', |
|
152 | +'file' => drupal_get_path('module', 'boincteam') . '/boincteam.admin.inc', |
|
153 | +); |
|
154 | +batch_set($batch); |
|
155 | +//batch_process('/admin/boinc/utility-team-delete'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /* |
@@ -163,37 +163,37 @@ discard block |
||
163 | 163 | * Input form (table) |
164 | 164 | */ |
165 | 165 | function theme_boincteam_utility_team_table($form) { |
166 | - //define table header |
|
167 | - $header = array( |
|
168 | - theme('table_select_header_cell'), //using that previously empty field |
|
169 | - array('data' => t('Team ID'), 'field' => 'id', 'sort' => 'asc'), |
|
170 | - array('data' => t('Name'), 'field' => 'name'), |
|
171 | - array('data' => t('Num Users'), 'field' => 'nusers'), |
|
172 | - array('data' => t('Link to Team'), 'field' => 'link'), |
|
166 | +//define table header |
|
167 | +$header = array( |
|
168 | +theme('table_select_header_cell'), //using that previously empty field |
|
169 | +array('data' => t('Team ID'), 'field' => 'id', 'sort' => 'asc'), |
|
170 | +array('data' => t('Name'), 'field' => 'name'), |
|
171 | +array('data' => t('Num Users'), 'field' => 'nusers'), |
|
172 | +array('data' => t('Link to Team'), 'field' => 'link'), |
|
173 | +); |
|
174 | +$rows = array(); |
|
175 | +$output = ""; |
|
176 | +if(!empty($form['checkboxes']['#options'])) { |
|
177 | +foreach (element_children($form['id']) as $key) { |
|
178 | + $rows[] = array( |
|
179 | + drupal_render($form['checkboxes'][$key]), |
|
180 | + drupal_render($form['id'][$key]), |
|
181 | + drupal_render($form['name'][$key]), |
|
182 | + drupal_render($form['nusers'][$key]), |
|
183 | + drupal_render($form['link'][$key]), |
|
173 | 184 | ); |
174 | - $rows = array(); |
|
175 | - $output = ""; |
|
176 | - if(!empty($form['checkboxes']['#options'])) { |
|
177 | - foreach (element_children($form['id']) as $key) { |
|
178 | - $rows[] = array( |
|
179 | - drupal_render($form['checkboxes'][$key]), |
|
180 | - drupal_render($form['id'][$key]), |
|
181 | - drupal_render($form['name'][$key]), |
|
182 | - drupal_render($form['nusers'][$key]), |
|
183 | - drupal_render($form['link'][$key]), |
|
184 | - ); |
|
185 | - } |
|
186 | - } |
|
187 | - else { |
|
188 | - $rows[] = array(array('data' => '<div class="error">No teams found</div>', 'colspan' => 5)); |
|
189 | - } |
|
190 | - $output .= theme('table', $header, $rows); |
|
191 | - if ($form['pager']['#value']) { |
|
192 | - $output .= drupal_render($form['pager']); |
|
193 | - } |
|
185 | +} |
|
186 | +} |
|
187 | +else { |
|
188 | +$rows[] = array(array('data' => '<div class="error">No teams found</div>', 'colspan' => 5)); |
|
189 | +} |
|
190 | +$output .= theme('table', $header, $rows); |
|
191 | +if ($form['pager']['#value']) { |
|
192 | +$output .= drupal_render($form['pager']); |
|
193 | +} |
|
194 | 194 | |
195 | - $output .= drupal_render($form); |
|
196 | - return $output; |
|
195 | +$output .= drupal_render($form); |
|
196 | +return $output; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -202,26 +202,26 @@ discard block |
||
202 | 202 | * table. It also removes the team's drupal page (node) if found. |
203 | 203 | */ |
204 | 204 | function boincteam_utility_batch_process($id, &$context) { |
205 | - $boincteam = boincteam_load($id); |
|
206 | - $drupalid = boincteam_lookup_nid($id); |
|
207 | - |
|
208 | - // Delete entry in team table |
|
209 | - db_set_active('boinc_rw'); |
|
210 | - $sql1='DELETE FROM {team} WHERE id=%d'; |
|
211 | - $db_res = db_query($sql1, $id); |
|
212 | - db_set_active('default'); |
|
213 | - |
|
214 | - // Delete entry in boincteam table |
|
215 | - $sql2='DELETE FROM {boincteam} WHERE id=%d'; |
|
216 | - $db_res = db_query($sql2, $id); |
|
217 | - |
|
218 | - // Delete the drupal node (if present) |
|
219 | - if ($drupalid) { |
|
220 | - node_delete($drupalid); |
|
221 | - } |
|
205 | +$boincteam = boincteam_load($id); |
|
206 | +$drupalid = boincteam_lookup_nid($id); |
|
207 | + |
|
208 | +// Delete entry in team table |
|
209 | +db_set_active('boinc_rw'); |
|
210 | +$sql1='DELETE FROM {team} WHERE id=%d'; |
|
211 | +$db_res = db_query($sql1, $id); |
|
212 | +db_set_active('default'); |
|
213 | + |
|
214 | +// Delete entry in boincteam table |
|
215 | +$sql2='DELETE FROM {boincteam} WHERE id=%d'; |
|
216 | +$db_res = db_query($sql2, $id); |
|
217 | + |
|
218 | +// Delete the drupal node (if present) |
|
219 | +if ($drupalid) { |
|
220 | +node_delete($drupalid); |
|
221 | +} |
|
222 | 222 | |
223 | - $context['results'][] = $id . ' : ' . check_plain($boincteam->name); |
|
224 | - $context['message'] = t('Processing team @name', array('@name' => $boincteam->name)); |
|
223 | +$context['results'][] = $id . ' : ' . check_plain($boincteam->name); |
|
224 | +$context['message'] = t('Processing team @name', array('@name' => $boincteam->name)); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | * or failure. |
230 | 230 | */ |
231 | 231 | function boincteam_utility_batch_finished($success, $results, $operations) { |
232 | - if ($success) { |
|
233 | - $message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.'; |
|
234 | - drupal_set_message($message, 'info'); |
|
235 | - } |
|
236 | - else { |
|
237 | - // An error occurred. |
|
238 | - // $operations contains the operations that remained unprocessed. |
|
239 | - $error_operation = reset($operations); |
|
240 | - $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
241 | - drupal_set_message($message, 'error'); |
|
242 | - } |
|
232 | +if ($success) { |
|
233 | +$message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.'; |
|
234 | +drupal_set_message($message, 'info'); |
|
235 | +} |
|
236 | +else { |
|
237 | +// An error occurred. |
|
238 | +// $operations contains the operations that remained unprocessed. |
|
239 | +$error_operation = reset($operations); |
|
240 | +$message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
241 | +drupal_set_message($message, 'error'); |
|
242 | +} |
|
243 | 243 | } |
244 | 244 | \ No newline at end of file |