@@ -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 |
@@ -84,134 +84,134 @@ discard block |
||
84 | 84 | global $user; |
85 | 85 | |
86 | 86 | switch($form_id) { |
87 | - case 'user_profile_form': |
|
88 | - if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) { |
|
89 | - $form['delete'] = array( |
|
90 | - '#type' => 'submit', |
|
91 | - '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
92 | - '#weight' => 1009, |
|
93 | - '#submit' => array('user_edit_delete_submit'), |
|
94 | - '#prefix' => '<li class="tab">', |
|
95 | - '#suffix' => '</li>', |
|
96 | - ); |
|
97 | - } |
|
98 | - else if ( user_access('administer users') ) { |
|
99 | - $form['delete'] = array( |
|
100 | - '#type' => 'submit', |
|
101 | - '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
102 | - '#weight' => 1009, |
|
103 | - '#submit' => array('_boincuser_delete_goto_admindelete'), |
|
104 | - '#prefix' => '<li class="tab">', |
|
105 | - '#suffix' => '</li>', |
|
106 | - ); |
|
107 | - } |
|
108 | - else { |
|
109 | - unset($form['delete']); |
|
110 | - } |
|
111 | - break; |
|
112 | - case 'user_confirm_delete': |
|
113 | - |
|
114 | - $disable_delete = FALSE; |
|
115 | - // If email address was changed less than 7 days (7 * 86400 s) |
|
116 | - // ago, it cannot be changed again. |
|
117 | - $duration = TOKEN_DURATION_ONE_WEEK; |
|
118 | - if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) { |
|
119 | - drupal_set_message( |
|
120 | - bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
|
121 | - array( |
|
122 | - '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
|
123 | - ), NULL, 'boinc:account-credentials-change') |
|
124 | - , 'info'); |
|
125 | - $disable_delete = TRUE; |
|
126 | - } |
|
127 | - |
|
128 | - $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?'; |
|
129 | - drupal_set_title($question); |
|
130 | - |
|
131 | - unset($form['description']); |
|
132 | - |
|
133 | - $form['main'] = array( |
|
134 | - '#type' => 'fieldset', |
|
135 | - '#weight' => 1, |
|
87 | + case 'user_profile_form': |
|
88 | + if ( user_access('delete own account') AND ($form['#uid'] == $user->uid) AND (arg(3)=='') ) { |
|
89 | + $form['delete'] = array( |
|
90 | + '#type' => 'submit', |
|
91 | + '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
92 | + '#weight' => 1009, |
|
93 | + '#submit' => array('user_edit_delete_submit'), |
|
94 | + '#prefix' => '<li class="tab">', |
|
95 | + '#suffix' => '</li>', |
|
136 | 96 | ); |
137 | - |
|
138 | - $form['main']['help'] = array( |
|
139 | - '#value' => bts( |
|
140 | - "<p><b>Instructions:</b> In order to delete your account, you must provide your password below. You will then be sent an email to the email address on record, with a one-time token that expires in 24-hours. Clicking on this link will bring you to a second form where you must enter your password again. After doing so your account will be deleted.</p>" . |
|
141 | - "<p>If necessary, you may !link first before deleting your addcount. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>", |
|
142 | - array( |
|
143 | - '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'), |
|
144 | - ), NULL, 'boinc:delete-user-account'), |
|
145 | - '#weight' => 11, |
|
146 | - '#prefix' => "<div id='delete-instructions'>", |
|
147 | - '#suffix' => "</div>", |
|
97 | + } |
|
98 | + else if ( user_access('administer users') ) { |
|
99 | + $form['delete'] = array( |
|
100 | + '#type' => 'submit', |
|
101 | + '#value' => bts('Delete Account', array(), null, 'boinc:delete-user-account'), |
|
102 | + '#weight' => 1009, |
|
103 | + '#submit' => array('_boincuser_delete_goto_admindelete'), |
|
104 | + '#prefix' => '<li class="tab">', |
|
105 | + '#suffix' => '</li>', |
|
148 | 106 | ); |
107 | + } |
|
108 | + else { |
|
109 | + unset($form['delete']); |
|
110 | + } |
|
111 | + break; |
|
112 | + case 'user_confirm_delete': |
|
113 | + |
|
114 | + $disable_delete = FALSE; |
|
115 | + // If email address was changed less than 7 days (7 * 86400 s) |
|
116 | + // ago, it cannot be changed again. |
|
117 | + $duration = TOKEN_DURATION_ONE_WEEK; |
|
118 | + if (($form['_account']['#value']->boincuser_email_addr_change_time + $duration) > time()) { |
|
119 | + drupal_set_message( |
|
120 | + bts("INFO: Your email address was changed within the past seven (7) days. You may not delete your account until after !time.", |
|
121 | + array( |
|
122 | + '!time' => date('F j, Y \a\t G:i T', $form['_account']['#value']->boincuser_email_addr_change_time + $duration), |
|
123 | + ), NULL, 'boinc:account-credentials-change') |
|
124 | + , 'info'); |
|
125 | + $disable_delete = TRUE; |
|
126 | + } |
|
149 | 127 | |
150 | - $form['main']['user_delete_action'] = array( |
|
151 | - '#type' => 'radios', |
|
152 | - '#options' => array( |
|
153 | - 'boincuser_delete_delete' => bts('<b>Delete</b> the account. Afterwards your account will be deleted, and all posts/comments will be attributed to the Anonymous User. Your user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'), |
|
154 | - ), |
|
155 | - '#weight' => 21, |
|
156 | - ); |
|
157 | - if ($disable_delete) { |
|
158 | - $form['main']['user_delete_action']['#disabled'] = TRUE; |
|
159 | - } |
|
128 | + $question = 'Are you sure you want to delete the account <em>' . htmlspecialchars($form['_account']['#value']->boincuser_name) . '</em>?'; |
|
129 | + drupal_set_title($question); |
|
160 | 130 | |
161 | - $form['separator_bottom'] = array( |
|
162 | - '#value' => '<div class="separator buttons"></div>', |
|
163 | - '#weight' => 999, |
|
164 | - ); |
|
131 | + unset($form['description']); |
|
165 | 132 | |
166 | - // Password field |
|
167 | - if (!$disable_delete) { |
|
168 | - $form['main']['current_pass'] = array( |
|
169 | - '#type' => 'password', |
|
170 | - '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'), |
|
171 | - '#size' => 17, |
|
172 | - '#attributes' => array( |
|
173 | - 'autocomplete' => 'off', |
|
174 | - ), |
|
175 | - '#weight' => 25, |
|
176 | - ); |
|
177 | - } |
|
178 | - |
|
179 | - // Configure the action buttons |
|
180 | - $uid = $form['_account']['#value']->uid; |
|
181 | - $form['actions']['#weight'] = 1000; |
|
182 | - $form['actions']['form control tabs prefix'] = array( |
|
183 | - '#value' => '<ul class="form-control tab-list">', |
|
184 | - '#weight' => 1001, |
|
185 | - ); |
|
133 | + $form['main'] = array( |
|
134 | + '#type' => 'fieldset', |
|
135 | + '#weight' => 1, |
|
136 | + ); |
|
137 | + |
|
138 | + $form['main']['help'] = array( |
|
139 | + '#value' => bts( |
|
140 | + "<p><b>Instructions:</b> In order to delete your account, you must provide your password below. You will then be sent an email to the email address on record, with a one-time token that expires in 24-hours. Clicking on this link will bring you to a second form where you must enter your password again. After doing so your account will be deleted.</p>" . |
|
141 | + "<p>If necessary, you may !link first before deleting your addcount. But you must wait <b>seven (7) days</b> after an email address change before you may delete your account.</p>", |
|
142 | + array( |
|
143 | + '!link' => l(bts('change your email address', array(), NULL, 'boinc:delete-user-account'), '/account/info/edit'), |
|
144 | + ), NULL, 'boinc:delete-user-account'), |
|
145 | + '#weight' => 11, |
|
146 | + '#prefix' => "<div id='delete-instructions'>", |
|
147 | + '#suffix' => "</div>", |
|
148 | + ); |
|
186 | 149 | |
187 | - unset($form['actions']['#prefix']); |
|
188 | - unset($form['actions']['#suffix']); |
|
189 | - $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
|
190 | - $form['actions']['submit']['#suffix'] = '</li>'; |
|
191 | - $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
192 | - $form['actions']['submit']['#weight'] = 1002; |
|
193 | - if ($disable_delete) { |
|
194 | - $form['actions']['submit']['#disabled'] = TRUE; |
|
195 | - $form['actions']['submit']['#value'] = ''; |
|
196 | - } |
|
197 | - |
|
198 | - $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
|
199 | - $form['actions']['cancel']['#suffix'] = '</li>'; |
|
200 | - $form['actions']['cancel']['#weight'] = 1003; |
|
201 | - $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
202 | - if ($disable_delete) { |
|
203 | - $form['actions']['cancel']['#prefix'] = '<li class="first tab">'; |
|
204 | - } |
|
205 | - |
|
206 | - $form['actions']['form control tabs suffix'] = array( |
|
207 | - '#value' => '</ul>', |
|
208 | - '#weight' => 1010, |
|
150 | + $form['main']['user_delete_action'] = array( |
|
151 | + '#type' => 'radios', |
|
152 | + '#options' => array( |
|
153 | + 'boincuser_delete_delete' => bts('<b>Delete</b> the account. Afterwards your account will be deleted, and all posts/comments will be attributed to the Anonymous User. Your user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'), |
|
154 | + ), |
|
155 | + '#weight' => 21, |
|
156 | + ); |
|
157 | + if ($disable_delete) { |
|
158 | + $form['main']['user_delete_action']['#disabled'] = TRUE; |
|
159 | + } |
|
160 | + |
|
161 | + $form['separator_bottom'] = array( |
|
162 | + '#value' => '<div class="separator buttons"></div>', |
|
163 | + '#weight' => 999, |
|
164 | + ); |
|
165 | + |
|
166 | + // Password field |
|
167 | + if (!$disable_delete) { |
|
168 | + $form['main']['current_pass'] = array( |
|
169 | + '#type' => 'password', |
|
170 | + '#title' => bts('Enter your password before clicking Submit', array(), NULL, 'boinc:delete-user-account'), |
|
171 | + '#size' => 17, |
|
172 | + '#attributes' => array( |
|
173 | + 'autocomplete' => 'off', |
|
174 | + ), |
|
175 | + '#weight' => 25, |
|
209 | 176 | ); |
177 | + } |
|
178 | + |
|
179 | + // Configure the action buttons |
|
180 | + $uid = $form['_account']['#value']->uid; |
|
181 | + $form['actions']['#weight'] = 1000; |
|
182 | + $form['actions']['form control tabs prefix'] = array( |
|
183 | + '#value' => '<ul class="form-control tab-list">', |
|
184 | + '#weight' => 1001, |
|
185 | + ); |
|
210 | 186 | |
211 | - $form['#redirect'] = 'account/' . $uid; |
|
212 | - $form['#validate'] = array('boincuser_delete_validate'); |
|
213 | - $form['#submit'] = array('boincuser_delete_submit'); |
|
214 | - break; |
|
187 | + unset($form['actions']['#prefix']); |
|
188 | + unset($form['actions']['#suffix']); |
|
189 | + $form['actions']['submit']['#prefix'] = '<li class="first tab">'; |
|
190 | + $form['actions']['submit']['#suffix'] = '</li>'; |
|
191 | + $form['actions']['submit']['#value'] = bts('Submit', array(), NULL, 'boinc:form-submit'); |
|
192 | + $form['actions']['submit']['#weight'] = 1002; |
|
193 | + if ($disable_delete) { |
|
194 | + $form['actions']['submit']['#disabled'] = TRUE; |
|
195 | + $form['actions']['submit']['#value'] = ''; |
|
196 | + } |
|
197 | + |
|
198 | + $form['actions']['cancel']['#prefix'] = '<li class="tab">'; |
|
199 | + $form['actions']['cancel']['#suffix'] = '</li>'; |
|
200 | + $form['actions']['cancel']['#weight'] = 1003; |
|
201 | + $form['actions']['cancel']['#value'] = l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'account/info/edit'); |
|
202 | + if ($disable_delete) { |
|
203 | + $form['actions']['cancel']['#prefix'] = '<li class="first tab">'; |
|
204 | + } |
|
205 | + |
|
206 | + $form['actions']['form control tabs suffix'] = array( |
|
207 | + '#value' => '</ul>', |
|
208 | + '#weight' => 1010, |
|
209 | + ); |
|
210 | + |
|
211 | + $form['#redirect'] = 'account/' . $uid; |
|
212 | + $form['#validate'] = array('boincuser_delete_validate'); |
|
213 | + $form['#submit'] = array('boincuser_delete_submit'); |
|
214 | + break; |
|
215 | 215 | |
216 | 216 | } // switch |
217 | 217 | } |
@@ -275,16 +275,16 @@ discard block |
||
275 | 275 | // Perform the requested operation |
276 | 276 | $op = $form_state['values']['user_delete_action']; |
277 | 277 | switch ($op) { |
278 | - case 'boincuser_delete_delete': |
|
279 | - // create token with 1 day/24 hour expiration |
|
280 | - $mytoken = create_token($account->boincuser_id, 'D', 24*60*60); |
|
281 | - $mysubject = "Instructions for account deletion at {$site_name}"; |
|
282 | - |
|
283 | - $mymessage = '' |
|
284 | - . "{$account->boincuser_name},\n" |
|
285 | - . "\n" |
|
286 | - . "We have received a request to DELETE your user account at " |
|
287 | - . "${site_name}. Below in this email is a one-time token you must " |
|
278 | + case 'boincuser_delete_delete': |
|
279 | + // create token with 1 day/24 hour expiration |
|
280 | + $mytoken = create_token($account->boincuser_id, 'D', 24*60*60); |
|
281 | + $mysubject = "Instructions for account deletion at {$site_name}"; |
|
282 | + |
|
283 | + $mymessage = '' |
|
284 | + . "{$account->boincuser_name},\n" |
|
285 | + . "\n" |
|
286 | + . "We have received a request to DELETE your user account at " |
|
287 | + . "${site_name}. Below in this email is a one-time token you must " |
|
288 | 288 | . "use. Either click on the link or copy-and-paste the URL into your " |
289 | 289 | . "browser address bar. Then you will be required to enter your password " |
290 | 290 | . "again to confirm your identity.\n" |