@@ -6,11 +6,11 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | class views_handler_field_boincwork_app_version_number extends views_handler_field { |
| 9 | - function construct() { |
|
| 9 | + function construct() { |
|
| 10 | 10 | parent::construct(); |
| 11 | - } |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - function render($values) { |
|
| 13 | + function render($values) { |
|
| 14 | 14 | return sprintf("%01.2f", $values->app_version_host_app_version_version_num / 100); |
| 15 | - } |
|
| 15 | + } |
|
| 16 | 16 | } |
@@ -11,6 +11,6 @@ |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | function render($values) { |
| 14 | - return sprintf("%01.2f", $values->app_version_host_app_version_version_num / 100); |
|
| 14 | + return sprintf("%01.2f", $values->app_version_host_app_version_version_num/100); |
|
| 15 | 15 | } |
| 16 | 16 | } |
@@ -1637,7 +1637,7 @@ |
||
| 1637 | 1637 | |
| 1638 | 1638 | return array( |
| 1639 | 1639 | 'info' => array( |
| 1640 | - 'path' => drupal_get_path('module', 'boincwork') . '/views', |
|
| 1640 | + 'path' => drupal_get_path('module', 'boincwork').'/views', |
|
| 1641 | 1641 | ), |
| 1642 | 1642 | 'handlers' => array( |
| 1643 | 1643 | 'views_handler_argument_boincuser_id' => array( |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | // Primary keys allowed as arguments |
| 50 | 50 | |
| 51 | 51 | $data['host']['id'] = array( |
| 52 | - 'title' => bts('Computer ID', array(), NULL, 'boinc:host-list'), |
|
| 52 | + 'title' => bts('Computer ID', array(), null, 'boinc:host-list'), |
|
| 53 | 53 | 'help' => t('The ID number of this host.'), |
| 54 | 54 | 'field' => array( |
| 55 | 55 | 'handler' => 'views_handler_field_numeric', |
| 56 | - 'click sortable' => TRUE |
|
| 56 | + 'click sortable' => true |
|
| 57 | 57 | ), |
| 58 | 58 | 'argument' => array( |
| 59 | 59 | 'handler' => 'views_handler_argument', |
| 60 | 60 | 'name field' => 'title', |
| 61 | - 'numeric' => TRUE, |
|
| 61 | + 'numeric' => true, |
|
| 62 | 62 | 'validate type' => 'id' |
| 63 | 63 | ), |
| 64 | 64 | 'filter' => array( |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | ) |
| 70 | 70 | ); |
| 71 | 71 | $data['host']['venue'] = array( |
| 72 | - 'title' => bts('Location', array(), NULL, 'boinc:host-list'), |
|
| 72 | + 'title' => bts('Location', array(), null, 'boinc:host-list'), |
|
| 73 | 73 | 'help' => t('The name of the preference set assigned to this host.'), |
| 74 | 74 | 'field' => array( |
| 75 | 75 | 'handler' => 'views_handler_field', |
| 76 | - 'click sortable' => TRUE |
|
| 76 | + 'click sortable' => true |
|
| 77 | 77 | ), |
| 78 | 78 | 'argument' => array( |
| 79 | 79 | 'handler' => 'views_handler_argument', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // Foreign key fields |
| 91 | 91 | |
| 92 | 92 | $data['host']['userid'] = array( |
| 93 | - 'title' => bts('User ID', array(), NULL, 'boinc:user-details'), |
|
| 93 | + 'title' => bts('User ID', array(), null, 'boinc:user-details'), |
|
| 94 | 94 | 'help' => t('The owner of this host.'), |
| 95 | 95 | // Because this is a foreign key to the {user} table. This allows us to |
| 96 | 96 | // have, when the view is configured with this relationship, all the fields |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 'argument' => array( |
| 99 | 99 | 'handler' => 'views_handler_argument_boincuser_id', |
| 100 | 100 | 'name field' => 'title', |
| 101 | - 'numeric' => TRUE, |
|
| 101 | + 'numeric' => true, |
|
| 102 | 102 | 'validate type' => 'id' |
| 103 | 103 | ), |
| 104 | 104 | 'relationship' => array( |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | ), |
| 110 | 110 | 'field' => array( |
| 111 | 111 | 'handler' => 'views_handler_field_numeric', |
| 112 | - 'click sortable' => TRUE |
|
| 112 | + 'click sortable' => true |
|
| 113 | 113 | ), |
| 114 | 114 | 'filter' => array( |
| 115 | 115 | 'handler' => 'views_handler_filter_numeric' |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | // Descriptions of general host fields (alphabetized) |
| 123 | 123 | |
| 124 | 124 | $data['host']['active_frac'] = array( |
| 125 | - 'title' => bts('While BOINC running, % of time work is allowed', array(), NULL, 'boinc:host-details'), |
|
| 125 | + 'title' => bts('While BOINC running, % of time work is allowed', array(), null, 'boinc:host-details'), |
|
| 126 | 126 | 'help' => t('The percentage of time that work is allowed.'), |
| 127 | 127 | 'field' => array( |
| 128 | 128 | 'handler' => 'views_handler_field_numeric', |
| 129 | - 'click sortable' => TRUE, |
|
| 130 | - 'float' => TRUE |
|
| 129 | + 'click sortable' => true, |
|
| 130 | + 'float' => true |
|
| 131 | 131 | ), |
| 132 | 132 | 'filter' => array( |
| 133 | 133 | 'handler' => 'views_handler_filter_numeric' |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | ) |
| 138 | 138 | ); |
| 139 | 139 | $data['host']['avg_turnaround'] = array( |
| 140 | - 'title' => bts('Average turnaround time', array(), NULL, 'boinc:host-details'), |
|
| 140 | + 'title' => bts('Average turnaround time', array(), null, 'boinc:host-details'), |
|
| 141 | 141 | 'help' => t('The average time required for work to be completed.'), |
| 142 | 142 | 'field' => array( |
| 143 | 143 | 'handler' => 'views_handler_field_numeric', |
| 144 | - 'click sortable' => TRUE, |
|
| 145 | - 'float' => TRUE |
|
| 144 | + 'click sortable' => true, |
|
| 145 | + 'float' => true |
|
| 146 | 146 | ), |
| 147 | 147 | 'filter' => array( |
| 148 | 148 | 'handler' => 'views_handler_filter_numeric' |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | ) |
| 153 | 153 | ); |
| 154 | 154 | $data['host']['create_time'] = array( |
| 155 | - 'title' => bts('Created', array(), NULL, 'boinc:host-details'), |
|
| 155 | + 'title' => bts('Created', array(), null, 'boinc:host-details'), |
|
| 156 | 156 | 'help' => t('The time the host record was created.'), |
| 157 | 157 | 'field' => array( |
| 158 | 158 | 'handler' => 'views_handler_field_date', |
| 159 | - 'click sortable' => TRUE |
|
| 159 | + 'click sortable' => true |
|
| 160 | 160 | ), |
| 161 | 161 | 'filter' => array( |
| 162 | 162 | 'handler' => 'views_handler_filter_date' |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | ) |
| 167 | 167 | ); |
| 168 | 168 | $data['host']['connected_frac'] = array( |
| 169 | - 'title' => bts('While BOINC running, % of time host has an Internet connection', array(), NULL, 'boinc:host-details'), |
|
| 169 | + 'title' => bts('While BOINC running, % of time host has an Internet connection', array(), null, 'boinc:host-details'), |
|
| 170 | 170 | 'help' => t('The percentage of time that the host has an Internet connection.'), |
| 171 | 171 | 'field' => array( |
| 172 | 172 | 'handler' => 'views_handler_field_numeric', |
| 173 | - 'click sortable' => TRUE, |
|
| 174 | - 'float' => TRUE |
|
| 173 | + 'click sortable' => true, |
|
| 174 | + 'float' => true |
|
| 175 | 175 | ), |
| 176 | 176 | 'filter' => array( |
| 177 | 177 | 'handler' => 'views_handler_filter_numeric' |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | ) |
| 182 | 182 | ); |
| 183 | 183 | $data['host']['cpu_efficiency'] = array( |
| 184 | - 'title' => bts('Average CPU efficiency', array(), NULL, 'boinc:host-details'), |
|
| 184 | + 'title' => bts('Average CPU efficiency', array(), null, 'boinc:host-details'), |
|
| 185 | 185 | 'help' => t('The average efficiency of the host CPU.'), |
| 186 | 186 | 'field' => array( |
| 187 | 187 | 'handler' => 'views_handler_field_numeric', |
| 188 | - 'click sortable' => TRUE, |
|
| 189 | - 'float' => TRUE |
|
| 188 | + 'click sortable' => true, |
|
| 189 | + 'float' => true |
|
| 190 | 190 | ), |
| 191 | 191 | 'filter' => array( |
| 192 | 192 | 'handler' => 'views_handler_filter_numeric' |
@@ -196,11 +196,11 @@ discard block |
||
| 196 | 196 | ) |
| 197 | 197 | ); |
| 198 | 198 | $data['host']['d_free'] = array( |
| 199 | - 'title' => bts('Free disk space', array(), NULL, 'boinc:host-details'), |
|
| 199 | + 'title' => bts('Free disk space', array(), null, 'boinc:host-details'), |
|
| 200 | 200 | 'help' => t('The amount of disk space that is not in use.'), |
| 201 | 201 | 'field' => array( |
| 202 | 202 | 'handler' => 'views_handler_field_numeric', |
| 203 | - 'click sortable' => TRUE |
|
| 203 | + 'click sortable' => true |
|
| 204 | 204 | ), |
| 205 | 205 | 'filter' => array( |
| 206 | 206 | 'handler' => 'views_handler_filter_numeric' |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | ) |
| 211 | 211 | ); |
| 212 | 212 | $data['host']['d_total'] = array( |
| 213 | - 'title' => bts('Total disk space', array(), NULL, 'boinc:host-details'), |
|
| 213 | + 'title' => bts('Total disk space', array(), null, 'boinc:host-details'), |
|
| 214 | 214 | 'help' => t('The size of the disk on which BOINC is installed.'), |
| 215 | 215 | 'field' => array( |
| 216 | 216 | 'handler' => 'views_handler_field_numeric', |
| 217 | - 'click sortable' => TRUE |
|
| 217 | + 'click sortable' => true |
|
| 218 | 218 | ), |
| 219 | 219 | 'filter' => array( |
| 220 | 220 | 'handler' => 'views_handler_filter_numeric' |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | ) |
| 225 | 225 | ); |
| 226 | 226 | $data['host']['domain_name'] = array( |
| 227 | - 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 227 | + 'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 228 | 228 | 'help' => t('The name of the host.'), |
| 229 | 229 | 'field' => array( |
| 230 | 230 | 'handler' => 'views_handler_field', |
| 231 | - 'click sortable' => TRUE |
|
| 231 | + 'click sortable' => true |
|
| 232 | 232 | ), |
| 233 | 233 | 'filter' => array( |
| 234 | 234 | 'handler' => 'views_handler_filter_string' |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | ) |
| 239 | 239 | ); |
| 240 | 240 | $data['host']['duration_correction_factor'] = array( |
| 241 | - 'title' => bts('Task duration correction factor', array(), NULL, 'boinc:host-details'), |
|
| 241 | + 'title' => bts('Task duration correction factor', array(), null, 'boinc:host-details'), |
|
| 242 | 242 | 'help' => t('Task duration correction factor.'), |
| 243 | 243 | 'field' => array( |
| 244 | 244 | 'handler' => 'views_handler_field_numeric', |
| 245 | - 'click sortable' => TRUE, |
|
| 246 | - 'float' => TRUE |
|
| 245 | + 'click sortable' => true, |
|
| 246 | + 'float' => true |
|
| 247 | 247 | ), |
| 248 | 248 | 'filter' => array( |
| 249 | 249 | 'handler' => 'views_handler_filter_numeric' |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | ) |
| 254 | 254 | ); |
| 255 | 255 | $data['host']['expavg_credit'] = array( |
| 256 | - 'title' => bts('Avg. credit', array(), NULL, 'boinc:host-details'), |
|
| 256 | + 'title' => bts('Avg. credit', array(), null, 'boinc:host-details'), |
|
| 257 | 257 | 'help' => t('A decaying average of credit per day.'), |
| 258 | 258 | 'field' => array( |
| 259 | 259 | 'handler' => 'views_handler_field_numeric', |
| 260 | - 'click sortable' => TRUE, |
|
| 261 | - 'float' => TRUE |
|
| 260 | + 'click sortable' => true, |
|
| 261 | + 'float' => true |
|
| 262 | 262 | ), |
| 263 | 263 | 'filter' => array( |
| 264 | 264 | 'handler' => 'views_handler_filter_numeric' |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | ) |
| 269 | 269 | ); |
| 270 | 270 | $data['host']['external_ip_addr'] = array( |
| 271 | - 'title' => bts('External IP address', array(), NULL, 'boinc:host-details'), |
|
| 271 | + 'title' => bts('External IP address', array(), null, 'boinc:host-details'), |
|
| 272 | 272 | 'help' => t('The IP address from which the host last communicated.'), |
| 273 | 273 | 'field' => array( |
| 274 | 274 | 'handler' => 'views_handler_field', |
| 275 | - 'click sortable' => TRUE |
|
| 275 | + 'click sortable' => true |
|
| 276 | 276 | ), |
| 277 | 277 | 'filter' => array( |
| 278 | 278 | 'handler' => 'views_handler_filter_string' |
@@ -282,11 +282,11 @@ discard block |
||
| 282 | 282 | ) |
| 283 | 283 | ); |
| 284 | 284 | $data['host']['host_cpid'] = array( |
| 285 | - 'title' => bts('Cross project ID', array(), NULL, 'boinc:host-details'), |
|
| 285 | + 'title' => bts('Cross project ID', array(), null, 'boinc:host-details'), |
|
| 286 | 286 | 'help' => t('The consistent identifier of the host across projects.'), |
| 287 | 287 | 'field' => array( |
| 288 | 288 | 'handler' => 'views_handler_field', |
| 289 | - 'click sortable' => TRUE |
|
| 289 | + 'click sortable' => true |
|
| 290 | 290 | ), |
| 291 | 291 | 'filter' => array( |
| 292 | 292 | 'handler' => 'views_handler_filter_string' |
@@ -296,11 +296,11 @@ discard block |
||
| 296 | 296 | ) |
| 297 | 297 | ); |
| 298 | 298 | $data['host']['last_ip_addr'] = array( |
| 299 | - 'title' => bts('Last IP address', array(), NULL, 'boinc:host-details'), |
|
| 299 | + 'title' => bts('Last IP address', array(), null, 'boinc:host-details'), |
|
| 300 | 300 | 'help' => t('The IP address of the host at last communication.'), |
| 301 | 301 | 'field' => array( |
| 302 | 302 | 'handler' => 'views_handler_field', |
| 303 | - 'click sortable' => TRUE |
|
| 303 | + 'click sortable' => true |
|
| 304 | 304 | ), |
| 305 | 305 | 'filter' => array( |
| 306 | 306 | 'handler' => 'views_handler_filter_string' |
@@ -310,11 +310,11 @@ discard block |
||
| 310 | 310 | ) |
| 311 | 311 | ); |
| 312 | 312 | $data['host']['m_cache'] = array( |
| 313 | - 'title' => bts('Cache', array(), NULL, 'boinc:host-details'), |
|
| 313 | + 'title' => bts('Cache', array(), null, 'boinc:host-details'), |
|
| 314 | 314 | 'help' => t('The amount of cache on the processor(s).'), |
| 315 | 315 | 'field' => array( |
| 316 | 316 | 'handler' => 'views_handler_field_numeric', |
| 317 | - 'click sortable' => TRUE |
|
| 317 | + 'click sortable' => true |
|
| 318 | 318 | ), |
| 319 | 319 | 'filter' => array( |
| 320 | 320 | 'handler' => 'views_handler_filter_numeric' |
@@ -324,11 +324,11 @@ discard block |
||
| 324 | 324 | ) |
| 325 | 325 | ); |
| 326 | 326 | $data['host']['m_nbytes'] = array( |
| 327 | - 'title' => bts('Memory', array(), NULL, 'boinc:host-details'), |
|
| 327 | + 'title' => bts('Memory', array(), null, 'boinc:host-details'), |
|
| 328 | 328 | 'help' => t('The amount of memory installed.'), |
| 329 | 329 | 'field' => array( |
| 330 | 330 | 'handler' => 'views_handler_field_numeric', |
| 331 | - 'click sortable' => TRUE |
|
| 331 | + 'click sortable' => true |
|
| 332 | 332 | ), |
| 333 | 333 | 'filter' => array( |
| 334 | 334 | 'handler' => 'views_handler_filter_numeric' |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | ) |
| 339 | 339 | ); |
| 340 | 340 | $data['host']['m_swap'] = array( |
| 341 | - 'title' => bts('Swap space', array(), NULL, 'boinc:host-details'), |
|
| 341 | + 'title' => bts('Swap space', array(), null, 'boinc:host-details'), |
|
| 342 | 342 | 'help' => t('The amount of swap space configured.'), |
| 343 | 343 | 'field' => array( |
| 344 | 344 | 'handler' => 'views_handler_field_numeric', |
| 345 | - 'click sortable' => TRUE |
|
| 345 | + 'click sortable' => true |
|
| 346 | 346 | ), |
| 347 | 347 | 'filter' => array( |
| 348 | 348 | 'handler' => 'views_handler_filter_numeric' |
@@ -352,11 +352,11 @@ discard block |
||
| 352 | 352 | ) |
| 353 | 353 | ); |
| 354 | 354 | $data['host']['max_results_day'] = array( |
| 355 | - 'title' => bts('Maximum daily WU quota per CPU', array(), NULL, 'boinc:host-details'), |
|
| 355 | + 'title' => bts('Maximum daily WU quota per CPU', array(), null, 'boinc:host-details'), |
|
| 356 | 356 | 'help' => t('The maximum number of workunits to be allocated per CPU.'), |
| 357 | 357 | 'field' => array( |
| 358 | 358 | 'handler' => 'views_handler_field_numeric', |
| 359 | - 'click sortable' => TRUE |
|
| 359 | + 'click sortable' => true |
|
| 360 | 360 | ), |
| 361 | 361 | 'filter' => array( |
| 362 | 362 | 'handler' => 'views_handler_filter_numeric' |
@@ -366,12 +366,12 @@ discard block |
||
| 366 | 366 | ) |
| 367 | 367 | ); |
| 368 | 368 | $data['host']['n_bwdown'] = array( |
| 369 | - 'title' => bts('Average download rate', array(), NULL, 'boinc:host-details'), |
|
| 369 | + 'title' => bts('Average download rate', array(), null, 'boinc:host-details'), |
|
| 370 | 370 | 'help' => t('The average rate at which new work is downloaded.'), |
| 371 | 371 | 'field' => array( |
| 372 | 372 | 'handler' => 'views_handler_field_numeric', |
| 373 | - 'click sortable' => TRUE, |
|
| 374 | - 'float' => TRUE |
|
| 373 | + 'click sortable' => true, |
|
| 374 | + 'float' => true |
|
| 375 | 375 | ), |
| 376 | 376 | 'filter' => array( |
| 377 | 377 | 'handler' => 'views_handler_filter_numeric' |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | ) |
| 382 | 382 | ); |
| 383 | 383 | $data['host']['n_bwup'] = array( |
| 384 | - 'title' => bts('Average upload rate', array(), NULL, 'boinc:host-details'), |
|
| 384 | + 'title' => bts('Average upload rate', array(), null, 'boinc:host-details'), |
|
| 385 | 385 | 'help' => t('The average rate at which completed work is uploaded.'), |
| 386 | 386 | 'field' => array( |
| 387 | 387 | 'handler' => 'views_handler_field_numeric', |
| 388 | - 'click sortable' => TRUE, |
|
| 389 | - 'float' => TRUE |
|
| 388 | + 'click sortable' => true, |
|
| 389 | + 'float' => true |
|
| 390 | 390 | ), |
| 391 | 391 | 'filter' => array( |
| 392 | 392 | 'handler' => 'views_handler_filter_numeric' |
@@ -396,11 +396,11 @@ discard block |
||
| 396 | 396 | ) |
| 397 | 397 | ); |
| 398 | 398 | $data['host']['nsame_ip_addr'] = array( |
| 399 | - 'title' => bts('Same IP address count', array(), NULL, 'boinc:host-details'), |
|
| 399 | + 'title' => bts('Same IP address count', array(), null, 'boinc:host-details'), |
|
| 400 | 400 | 'help' => t('The number of times the last IP address.'), |
| 401 | 401 | 'field' => array( |
| 402 | 402 | 'handler' => 'views_handler_field', |
| 403 | - 'click sortable' => TRUE |
|
| 403 | + 'click sortable' => true |
|
| 404 | 404 | ), |
| 405 | 405 | 'filter' => array( |
| 406 | 406 | 'handler' => 'views_handler_filter_string' |
@@ -410,12 +410,12 @@ discard block |
||
| 410 | 410 | ) |
| 411 | 411 | ); |
| 412 | 412 | $data['host']['on_frac'] = array( |
| 413 | - 'title' => bts('% of time BOINC client is running', array(), NULL, 'boinc:host-details'), |
|
| 413 | + 'title' => bts('% of time BOINC client is running', array(), null, 'boinc:host-details'), |
|
| 414 | 414 | 'help' => t('The percentage of time that the BOINC client is running.'), |
| 415 | 415 | 'field' => array( |
| 416 | 416 | 'handler' => 'views_handler_field_numeric', |
| 417 | - 'click sortable' => TRUE, |
|
| 418 | - 'float' => TRUE |
|
| 417 | + 'click sortable' => true, |
|
| 418 | + 'float' => true |
|
| 419 | 419 | ), |
| 420 | 420 | 'filter' => array( |
| 421 | 421 | 'handler' => 'views_handler_filter_numeric' |
@@ -425,11 +425,11 @@ discard block |
||
| 425 | 425 | ) |
| 426 | 426 | ); |
| 427 | 427 | $data['host']['os_name'] = array( |
| 428 | - 'title' => bts('Operating system', array(), NULL, 'boinc:host-details'), |
|
| 428 | + 'title' => bts('Operating system', array(), null, 'boinc:host-details'), |
|
| 429 | 429 | 'help' => t('The name of the host operating system.'), |
| 430 | 430 | 'field' => array( |
| 431 | 431 | 'handler' => 'views_handler_field', |
| 432 | - 'click sortable' => TRUE |
|
| 432 | + 'click sortable' => true |
|
| 433 | 433 | ), |
| 434 | 434 | 'filter' => array( |
| 435 | 435 | 'handler' => 'views_handler_filter_string' |
@@ -439,11 +439,11 @@ discard block |
||
| 439 | 439 | ) |
| 440 | 440 | ); |
| 441 | 441 | $data['host']['os_version'] = array( |
| 442 | - 'title' => bts('Operating system version', array(), NULL, 'boinc:host-details'), |
|
| 442 | + 'title' => bts('Operating system version', array(), null, 'boinc:host-details'), |
|
| 443 | 443 | 'help' => t('The version of the host operating system.'), |
| 444 | 444 | 'field' => array( |
| 445 | 445 | 'handler' => 'views_handler_field', |
| 446 | - 'click sortable' => TRUE |
|
| 446 | + 'click sortable' => true |
|
| 447 | 447 | ), |
| 448 | 448 | 'filter' => array( |
| 449 | 449 | 'handler' => 'views_handler_filter_string' |
@@ -453,12 +453,12 @@ discard block |
||
| 453 | 453 | ) |
| 454 | 454 | ); |
| 455 | 455 | $data['host']['p_fpops'] = array( |
| 456 | - 'title' => bts('Measured floating point speed', array(), NULL, 'boinc:host-details'), |
|
| 456 | + 'title' => bts('Measured floating point speed', array(), null, 'boinc:host-details'), |
|
| 457 | 457 | 'help' => t('The capability of the host in floating point operations per second.'), |
| 458 | 458 | 'field' => array( |
| 459 | 459 | 'handler' => 'views_handler_field_numeric', |
| 460 | - 'click sortable' => TRUE, |
|
| 461 | - 'float' => TRUE |
|
| 460 | + 'click sortable' => true, |
|
| 461 | + 'float' => true |
|
| 462 | 462 | ), |
| 463 | 463 | 'filter' => array( |
| 464 | 464 | 'handler' => 'views_handler_filter_numeric' |
@@ -468,12 +468,12 @@ discard block |
||
| 468 | 468 | ) |
| 469 | 469 | ); |
| 470 | 470 | $data['host']['p_iops'] = array( |
| 471 | - 'title' => bts('Measured integer speed', array(), NULL, 'boinc:host-details'), |
|
| 471 | + 'title' => bts('Measured integer speed', array(), null, 'boinc:host-details'), |
|
| 472 | 472 | 'help' => t('The capability of the host in integer operations per second.'), |
| 473 | 473 | 'field' => array( |
| 474 | 474 | 'handler' => 'views_handler_field_numeric', |
| 475 | - 'click sortable' => TRUE, |
|
| 476 | - 'float' => TRUE |
|
| 475 | + 'click sortable' => true, |
|
| 476 | + 'float' => true |
|
| 477 | 477 | ), |
| 478 | 478 | 'filter' => array( |
| 479 | 479 | 'handler' => 'views_handler_filter_numeric' |
@@ -483,11 +483,11 @@ discard block |
||
| 483 | 483 | ) |
| 484 | 484 | ); |
| 485 | 485 | $data['host']['p_model'] = array( |
| 486 | - 'title' => bts('CPU model', array(), NULL, 'boinc:host-details'), |
|
| 486 | + 'title' => bts('CPU model', array(), null, 'boinc:host-details'), |
|
| 487 | 487 | 'help' => t('The model of the CPU in the host.'), |
| 488 | 488 | 'field' => array( |
| 489 | 489 | 'handler' => 'views_handler_field', |
| 490 | - 'click sortable' => TRUE |
|
| 490 | + 'click sortable' => true |
|
| 491 | 491 | ), |
| 492 | 492 | 'filter' => array( |
| 493 | 493 | 'handler' => 'views_handler_filter_string' |
@@ -497,11 +497,11 @@ discard block |
||
| 497 | 497 | ) |
| 498 | 498 | ); |
| 499 | 499 | $data['host']['p_ncpus'] = array( |
| 500 | - 'title' => bts('Number of processors', array(), NULL, 'boinc:host-details'), |
|
| 500 | + 'title' => bts('Number of processors', array(), null, 'boinc:host-details'), |
|
| 501 | 501 | 'help' => t('The count of CPU cores in the system.'), |
| 502 | 502 | 'field' => array( |
| 503 | 503 | 'handler' => 'views_handler_field', |
| 504 | - 'click sortable' => TRUE |
|
| 504 | + 'click sortable' => true |
|
| 505 | 505 | ), |
| 506 | 506 | 'filter' => array( |
| 507 | 507 | 'handler' => 'views_handler_filter_string' |
@@ -511,11 +511,11 @@ discard block |
||
| 511 | 511 | ) |
| 512 | 512 | ); |
| 513 | 513 | $data['host']['p_vendor'] = array( |
| 514 | - 'title' => bts('CPU', array(), NULL, 'boinc:host-details'), |
|
| 514 | + 'title' => bts('CPU', array(), null, 'boinc:host-details'), |
|
| 515 | 515 | 'help' => t('The manufacturer of the CPU in the host.'), |
| 516 | 516 | 'field' => array( |
| 517 | 517 | 'handler' => 'views_handler_field', |
| 518 | - 'click sortable' => TRUE |
|
| 518 | + 'click sortable' => true |
|
| 519 | 519 | ), |
| 520 | 520 | 'filter' => array( |
| 521 | 521 | 'handler' => 'views_handler_filter_string' |
@@ -525,11 +525,11 @@ discard block |
||
| 525 | 525 | ) |
| 526 | 526 | ); |
| 527 | 527 | $data['host']['rpc_seqno'] = array( |
| 528 | - 'title' => bts('Number of times client has contacted server', array(), NULL, 'boinc:host-details'), |
|
| 528 | + 'title' => bts('Number of times client has contacted server', array(), null, 'boinc:host-details'), |
|
| 529 | 529 | 'help' => t('The number of times the client has contacted the server.'), |
| 530 | 530 | 'field' => array( |
| 531 | 531 | 'handler' => 'views_handler_field_numeric', |
| 532 | - 'click sortable' => TRUE |
|
| 532 | + 'click sortable' => true |
|
| 533 | 533 | ), |
| 534 | 534 | 'filter' => array( |
| 535 | 535 | 'handler' => 'views_handler_filter_numeric' |
@@ -539,11 +539,11 @@ discard block |
||
| 539 | 539 | ) |
| 540 | 540 | ); |
| 541 | 541 | $data['host']['rpc_time'] = array( |
| 542 | - 'title' => bts('Last contact', array(), NULL, 'boinc:host-details'), |
|
| 542 | + 'title' => bts('Last contact', array(), null, 'boinc:host-details'), |
|
| 543 | 543 | 'help' => t('The time of the last RPC contact with the host.'), |
| 544 | 544 | 'field' => array( |
| 545 | 545 | 'handler' => 'views_handler_field_date', |
| 546 | - 'click sortable' => TRUE |
|
| 546 | + 'click sortable' => true |
|
| 547 | 547 | ), |
| 548 | 548 | 'filter' => array( |
| 549 | 549 | 'handler' => 'views_handler_filter_date' |
@@ -553,11 +553,11 @@ discard block |
||
| 553 | 553 | ) |
| 554 | 554 | ); |
| 555 | 555 | $data['host']['serialnum'] = array( |
| 556 | - 'title' => bts('Serial number', array(), NULL, 'boinc:host-details'), |
|
| 556 | + 'title' => bts('Serial number', array(), null, 'boinc:host-details'), |
|
| 557 | 557 | 'help' => t('Contains the release number of the BOINC application in use and the GPU of the host.'), |
| 558 | 558 | 'field' => array( |
| 559 | 559 | 'handler' => 'views_handler_field', |
| 560 | - 'click sortable' => TRUE |
|
| 560 | + 'click sortable' => true |
|
| 561 | 561 | ), |
| 562 | 562 | 'filter' => array( |
| 563 | 563 | 'handler' => 'views_handler_filter_string' |
@@ -567,11 +567,11 @@ discard block |
||
| 567 | 567 | ) |
| 568 | 568 | ); |
| 569 | 569 | $data['host']['timezone'] = array( |
| 570 | - 'title' => bts('Timezone', array(), NULL, 'boinc:host-details'), |
|
| 570 | + 'title' => bts('Timezone', array(), null, 'boinc:host-details'), |
|
| 571 | 571 | 'help' => t('The UTC offset of the local time.'), |
| 572 | 572 | 'field' => array( |
| 573 | 573 | 'handler' => 'views_handler_field_numeric', |
| 574 | - 'click sortable' => TRUE |
|
| 574 | + 'click sortable' => true |
|
| 575 | 575 | ), |
| 576 | 576 | 'filter' => array( |
| 577 | 577 | 'handler' => 'views_handler_filter_numeric' |
@@ -581,12 +581,12 @@ discard block |
||
| 581 | 581 | ) |
| 582 | 582 | ); |
| 583 | 583 | $data['host']['total_credit'] = array( |
| 584 | - 'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'), |
|
| 584 | + 'title' => bts('Total credit', array(), null, 'boinc:user-or-team-total-credits'), |
|
| 585 | 585 | 'help' => t('The total accumulated BOINC credit for a host.'), |
| 586 | 586 | 'field' => array( |
| 587 | 587 | 'handler' => 'views_handler_field_numeric', |
| 588 | - 'click sortable' => TRUE, |
|
| 589 | - 'float' => TRUE |
|
| 588 | + 'click sortable' => true, |
|
| 589 | + 'float' => true |
|
| 590 | 590 | ), |
| 591 | 591 | 'filter' => array( |
| 592 | 592 | 'handler' => 'views_handler_filter_numeric' |
@@ -611,16 +611,16 @@ discard block |
||
| 611 | 611 | // Primary keys allowed as arguments |
| 612 | 612 | |
| 613 | 613 | $data['platform']['id'] = array( |
| 614 | - 'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'), |
|
| 614 | + 'title' => bts('Platform ID', array(), null, 'boinc:platform-details'), |
|
| 615 | 615 | 'help' => t('The ID number of the platform.'), |
| 616 | 616 | 'field' => array( |
| 617 | 617 | 'handler' => 'views_handler_field_numeric', |
| 618 | - 'click sortable' => TRUE |
|
| 618 | + 'click sortable' => true |
|
| 619 | 619 | ), |
| 620 | 620 | 'argument' => array( |
| 621 | 621 | 'handler' => 'views_handler_argument', |
| 622 | 622 | 'name field' => 'title', |
| 623 | - 'numeric' => TRUE, |
|
| 623 | + 'numeric' => true, |
|
| 624 | 624 | 'validate type' => 'id' |
| 625 | 625 | ), |
| 626 | 626 | 'filter' => array( |
@@ -634,11 +634,11 @@ discard block |
||
| 634 | 634 | // Descriptions of app fields (alphabetized) |
| 635 | 635 | |
| 636 | 636 | $data['platform']['name'] = array( |
| 637 | - 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 637 | + 'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 638 | 638 | 'help' => t('The name of the platform.'), |
| 639 | 639 | 'field' => array( |
| 640 | 640 | 'handler' => 'views_handler_field', |
| 641 | - 'click sortable' => TRUE |
|
| 641 | + 'click sortable' => true |
|
| 642 | 642 | ), |
| 643 | 643 | 'filter' => array( |
| 644 | 644 | 'handler' => 'views_handler_filter_string' |
@@ -680,16 +680,16 @@ discard block |
||
| 680 | 680 | // Primary keys allowed as arguments |
| 681 | 681 | |
| 682 | 682 | $data['result']['id'] = array( |
| 683 | - 'title' => bts('Task ID', array(), NULL, 'boinc:task-details'), |
|
| 683 | + 'title' => bts('Task ID', array(), null, 'boinc:task-details'), |
|
| 684 | 684 | 'help' => t('The ID number of this result.'), |
| 685 | 685 | 'field' => array( |
| 686 | 686 | 'handler' => 'views_handler_field_numeric', |
| 687 | - 'click sortable' => TRUE |
|
| 687 | + 'click sortable' => true |
|
| 688 | 688 | ), |
| 689 | 689 | 'argument' => array( |
| 690 | 690 | 'handler' => 'views_handler_argument', |
| 691 | 691 | 'name field' => 'title', |
| 692 | - 'numeric' => TRUE, |
|
| 692 | + 'numeric' => true, |
|
| 693 | 693 | 'validate type' => 'id' |
| 694 | 694 | ), |
| 695 | 695 | 'filter' => array( |
@@ -703,13 +703,13 @@ discard block |
||
| 703 | 703 | // Foreign key fields |
| 704 | 704 | |
| 705 | 705 | $data['result']['userid'] = array( |
| 706 | - 'title' => bts('User ID', array(), NULL, 'boinc:user-details'), |
|
| 706 | + 'title' => bts('User ID', array(), null, 'boinc:user-details'), |
|
| 707 | 707 | 'help' => t('The owner of this result.'), |
| 708 | 708 | // Foreign key to the {user} table |
| 709 | 709 | 'argument' => array( |
| 710 | 710 | 'handler' => 'views_handler_argument_boincuser_id', |
| 711 | 711 | 'name field' => 'title', |
| 712 | - 'numeric' => TRUE, |
|
| 712 | + 'numeric' => true, |
|
| 713 | 713 | 'validate type' => 'id' |
| 714 | 714 | ), |
| 715 | 715 | 'relationship' => array( |
@@ -720,13 +720,13 @@ discard block |
||
| 720 | 720 | ) |
| 721 | 721 | ); |
| 722 | 722 | $data['result']['workunitid'] = array( |
| 723 | - 'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'), |
|
| 723 | + 'title' => bts('Workunit ID', array(), null, 'boinc:workunit-details'), |
|
| 724 | 724 | 'help' => t('The workunit associated with this result.'), |
| 725 | 725 | // Foreign key to the {workunit} table |
| 726 | 726 | 'argument' => array( |
| 727 | 727 | 'handler' => 'views_handler_argument', |
| 728 | 728 | 'name field' => 'title', |
| 729 | - 'numeric' => TRUE, |
|
| 729 | + 'numeric' => true, |
|
| 730 | 730 | 'validate type' => 'id' |
| 731 | 731 | ), |
| 732 | 732 | 'relationship' => array( |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | ), |
| 738 | 738 | 'field' => array( |
| 739 | 739 | 'handler' => 'views_handler_field_numeric', |
| 740 | - 'click sortable' => TRUE |
|
| 740 | + 'click sortable' => true |
|
| 741 | 741 | ), |
| 742 | 742 | 'filter' => array( |
| 743 | 743 | 'handler' => 'views_handler_filter_numeric' |
@@ -747,13 +747,13 @@ discard block |
||
| 747 | 747 | ) |
| 748 | 748 | ); |
| 749 | 749 | $data['result']['hostid'] = array( |
| 750 | - 'title' => bts('Host ID', array(), NULL, 'boinc:task-details'), |
|
| 750 | + 'title' => bts('Host ID', array(), null, 'boinc:task-details'), |
|
| 751 | 751 | 'help' => t('The host associated with this result.'), |
| 752 | 752 | // Foreign key to the {host} table |
| 753 | 753 | 'argument' => array( |
| 754 | 754 | 'handler' => 'views_handler_argument', |
| 755 | 755 | 'name field' => 'title', |
| 756 | - 'numeric' => TRUE, |
|
| 756 | + 'numeric' => true, |
|
| 757 | 757 | 'validate type' => 'id' |
| 758 | 758 | ), |
| 759 | 759 | 'relationship' => array( |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | ), |
| 765 | 765 | 'field' => array( |
| 766 | 766 | 'handler' => 'views_handler_field_numeric', |
| 767 | - 'click sortable' => TRUE |
|
| 767 | + 'click sortable' => true |
|
| 768 | 768 | ), |
| 769 | 769 | 'filter' => array( |
| 770 | 770 | 'handler' => 'views_handler_filter_numeric' |
@@ -777,11 +777,11 @@ discard block |
||
| 777 | 777 | // Descriptions of result fields (alphabetized) |
| 778 | 778 | |
| 779 | 779 | $data['result']['appid'] = array( |
| 780 | - 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
|
| 780 | + 'title' => bts('Application ID', array(), null, 'boinc:application-details'), |
|
| 781 | 781 | 'help' => t('The ID number of the application.'), |
| 782 | 782 | 'field' => array( |
| 783 | 783 | 'handler' => 'views_handler_field_numeric', |
| 784 | - 'click sortable' => TRUE |
|
| 784 | + 'click sortable' => true |
|
| 785 | 785 | ), |
| 786 | 786 | 'filter' => array( |
| 787 | 787 | 'handler' => 'views_handler_filter_numeric' |
@@ -791,11 +791,11 @@ discard block |
||
| 791 | 791 | ) |
| 792 | 792 | ); |
| 793 | 793 | $data['result']['app_version_id'] = array( |
| 794 | - 'title' => bts('Application version', array(), NULL, 'boinc:task-details'), |
|
| 794 | + 'title' => bts('Application version', array(), null, 'boinc:task-details'), |
|
| 795 | 795 | 'help' => t('The version number of the application.'), |
| 796 | 796 | 'field' => array( |
| 797 | 797 | 'handler' => 'views_handler_field_numeric', |
| 798 | - 'click sortable' => TRUE |
|
| 798 | + 'click sortable' => true |
|
| 799 | 799 | ), |
| 800 | 800 | 'filter' => array( |
| 801 | 801 | 'handler' => 'views_handler_filter_numeric' |
@@ -805,12 +805,12 @@ discard block |
||
| 805 | 805 | ) |
| 806 | 806 | ); |
| 807 | 807 | $data['result']['claimed_credit'] = array( |
| 808 | - 'title' => bts('Claimed credit', array(), NULL, 'boinc:task-details'), |
|
| 808 | + 'title' => bts('Claimed credit', array(), null, 'boinc:task-details'), |
|
| 809 | 809 | 'help' => t('The credit claimed for this result.'), |
| 810 | 810 | 'field' => array( |
| 811 | 811 | 'handler' => 'views_handler_field_numeric', |
| 812 | - 'click sortable' => TRUE, |
|
| 813 | - 'float' => TRUE |
|
| 812 | + 'click sortable' => true, |
|
| 813 | + 'float' => true |
|
| 814 | 814 | ), |
| 815 | 815 | 'filter' => array( |
| 816 | 816 | 'handler' => 'views_handler_filter_numeric' |
@@ -820,11 +820,11 @@ discard block |
||
| 820 | 820 | ) |
| 821 | 821 | ); |
| 822 | 822 | $data['result']['client_state'] = array( |
| 823 | - 'title' => bts('Client state', array(), NULL, 'boinc:task-details'), |
|
| 823 | + 'title' => bts('Client state', array(), null, 'boinc:task-details'), |
|
| 824 | 824 | 'help' => t('The state of the task on the client side.'), |
| 825 | 825 | 'field' => array( |
| 826 | 826 | 'handler' => 'views_handler_field_numeric', |
| 827 | - 'click sortable' => TRUE |
|
| 827 | + 'click sortable' => true |
|
| 828 | 828 | ), |
| 829 | 829 | 'filter' => array( |
| 830 | 830 | 'handler' => 'views_handler_filter_numeric' |
@@ -834,12 +834,12 @@ discard block |
||
| 834 | 834 | ) |
| 835 | 835 | ); |
| 836 | 836 | $data['result']['cpu_time'] = array( |
| 837 | - 'title' => bts('CPU time', array(), NULL, 'boinc:task-details'), |
|
| 837 | + 'title' => bts('CPU time', array(), null, 'boinc:task-details'), |
|
| 838 | 838 | 'help' => t('The CPU time spent on the task.'), |
| 839 | 839 | 'field' => array( |
| 840 | 840 | 'handler' => 'views_handler_field_numeric', |
| 841 | - 'click sortable' => TRUE, |
|
| 842 | - 'float' => TRUE |
|
| 841 | + 'click sortable' => true, |
|
| 842 | + 'float' => true |
|
| 843 | 843 | ), |
| 844 | 844 | 'filter' => array( |
| 845 | 845 | 'handler' => 'views_handler_filter_numeric' |
@@ -849,11 +849,11 @@ discard block |
||
| 849 | 849 | ) |
| 850 | 850 | ); |
| 851 | 851 | $data['result']['create_time'] = array( |
| 852 | - 'title' => bts('Created', array(), NULL, 'boinc:task-details:-1:ignoreoverwrite'), |
|
| 852 | + 'title' => bts('Created', array(), null, 'boinc:task-details:-1:ignoreoverwrite'), |
|
| 853 | 853 | 'help' => t('The time that the task was created.'), |
| 854 | 854 | 'field' => array( |
| 855 | 855 | 'handler' => 'views_handler_field_date', |
| 856 | - 'click sortable' => TRUE |
|
| 856 | + 'click sortable' => true |
|
| 857 | 857 | ), |
| 858 | 858 | 'filter' => array( |
| 859 | 859 | 'handler' => 'views_handler_filter_date' |
@@ -863,12 +863,12 @@ discard block |
||
| 863 | 863 | ) |
| 864 | 864 | ); |
| 865 | 865 | $data['result']['elapsed_time'] = array( |
| 866 | - 'title' => bts('Run time', array(), NULL, 'boinc:task-details'), |
|
| 866 | + 'title' => bts('Run time', array(), null, 'boinc:task-details'), |
|
| 867 | 867 | 'help' => t('The run time of the task.'), |
| 868 | 868 | 'field' => array( |
| 869 | 869 | 'handler' => 'views_handler_field_numeric', |
| 870 | - 'click sortable' => TRUE, |
|
| 871 | - 'float' => TRUE |
|
| 870 | + 'click sortable' => true, |
|
| 871 | + 'float' => true |
|
| 872 | 872 | ), |
| 873 | 873 | 'filter' => array( |
| 874 | 874 | 'handler' => 'views_handler_filter_numeric' |
@@ -878,11 +878,11 @@ discard block |
||
| 878 | 878 | ) |
| 879 | 879 | ); |
| 880 | 880 | $data['result']['exit_status'] = array( |
| 881 | - 'title' => bts('Exit status', array(), NULL, 'boinc:task-details'), |
|
| 881 | + 'title' => bts('Exit status', array(), null, 'boinc:task-details'), |
|
| 882 | 882 | 'help' => t('The exit code of the task.'), |
| 883 | 883 | 'field' => array( |
| 884 | 884 | 'handler' => 'views_handler_field_numeric', |
| 885 | - 'click sortable' => TRUE |
|
| 885 | + 'click sortable' => true |
|
| 886 | 886 | ), |
| 887 | 887 | 'filter' => array( |
| 888 | 888 | 'handler' => 'views_handler_filter_numeric' |
@@ -892,12 +892,12 @@ discard block |
||
| 892 | 892 | ) |
| 893 | 893 | ); |
| 894 | 894 | $data['result']['granted_credit'] = array( |
| 895 | - 'title' => bts('Granted credit', array(), NULL, 'boinc:task-details'), |
|
| 895 | + 'title' => bts('Granted credit', array(), null, 'boinc:task-details'), |
|
| 896 | 896 | 'help' => t('The credit granted for this result.'), |
| 897 | 897 | 'field' => array( |
| 898 | 898 | 'handler' => 'views_handler_field_numeric', |
| 899 | - 'click sortable' => TRUE, |
|
| 900 | - 'float' => TRUE |
|
| 899 | + 'click sortable' => true, |
|
| 900 | + 'float' => true |
|
| 901 | 901 | ), |
| 902 | 902 | 'filter' => array( |
| 903 | 903 | 'handler' => 'views_handler_filter_numeric' |
@@ -907,11 +907,11 @@ discard block |
||
| 907 | 907 | ) |
| 908 | 908 | ); |
| 909 | 909 | $data['result']['name'] = array( |
| 910 | - 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 910 | + 'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 911 | 911 | 'help' => t('The name of the task.'), |
| 912 | 912 | 'field' => array( |
| 913 | 913 | 'handler' => 'views_handler_field', |
| 914 | - 'click sortable' => TRUE |
|
| 914 | + 'click sortable' => true |
|
| 915 | 915 | ), |
| 916 | 916 | 'filter' => array( |
| 917 | 917 | 'handler' => 'views_handler_filter_string' |
@@ -921,11 +921,11 @@ discard block |
||
| 921 | 921 | ) |
| 922 | 922 | ); |
| 923 | 923 | $data['result']['outcome'] = array( |
| 924 | - 'title' => bts('Outcome', array(), NULL, 'boinc:task-details'), |
|
| 924 | + 'title' => bts('Outcome', array(), null, 'boinc:task-details'), |
|
| 925 | 925 | 'help' => t('The outcome of the task.'), |
| 926 | 926 | 'field' => array( |
| 927 | 927 | 'handler' => 'views_handler_field_numeric', |
| 928 | - 'click sortable' => TRUE |
|
| 928 | + 'click sortable' => true |
|
| 929 | 929 | ), |
| 930 | 930 | 'filter' => array( |
| 931 | 931 | 'handler' => 'views_handler_filter_numeric' |
@@ -935,11 +935,11 @@ discard block |
||
| 935 | 935 | ) |
| 936 | 936 | ); |
| 937 | 937 | $data['result']['received_time'] = array( |
| 938 | - 'title' => bts('Received time', array(), NULL, 'boinc:task-details'), |
|
| 938 | + 'title' => bts('Received time', array(), null, 'boinc:task-details'), |
|
| 939 | 939 | 'help' => t('The time that the result was received.'), |
| 940 | 940 | 'field' => array( |
| 941 | 941 | 'handler' => 'views_handler_field_date', |
| 942 | - 'click sortable' => TRUE |
|
| 942 | + 'click sortable' => true |
|
| 943 | 943 | ), |
| 944 | 944 | 'filter' => array( |
| 945 | 945 | 'handler' => 'views_handler_filter_date' |
@@ -949,11 +949,11 @@ discard block |
||
| 949 | 949 | ) |
| 950 | 950 | ); |
| 951 | 951 | $data['result']['report_deadline'] = array( |
| 952 | - 'title' => bts('Report deadline', array(), NULL, 'boinc:task-details'), |
|
| 952 | + 'title' => bts('Report deadline', array(), null, 'boinc:task-details'), |
|
| 953 | 953 | 'help' => t('The deadline for the task.'), |
| 954 | 954 | 'field' => array( |
| 955 | 955 | 'handler' => 'views_handler_field_date', |
| 956 | - 'click sortable' => TRUE |
|
| 956 | + 'click sortable' => true |
|
| 957 | 957 | ), |
| 958 | 958 | 'filter' => array( |
| 959 | 959 | 'handler' => 'views_handler_filter_date' |
@@ -963,11 +963,11 @@ discard block |
||
| 963 | 963 | ) |
| 964 | 964 | ); |
| 965 | 965 | $data['result']['sent_time'] = array( |
| 966 | - 'title' => bts('Sent', array(), NULL, 'boinc:task-details'), |
|
| 966 | + 'title' => bts('Sent', array(), null, 'boinc:task-details'), |
|
| 967 | 967 | 'help' => t('The time that the task was sent.'), |
| 968 | 968 | 'field' => array( |
| 969 | 969 | 'handler' => 'views_handler_field_date', |
| 970 | - 'click sortable' => TRUE |
|
| 970 | + 'click sortable' => true |
|
| 971 | 971 | ), |
| 972 | 972 | 'filter' => array( |
| 973 | 973 | 'handler' => 'views_handler_filter_date' |
@@ -977,11 +977,11 @@ discard block |
||
| 977 | 977 | ) |
| 978 | 978 | ); |
| 979 | 979 | $data['result']['server_state'] = array( |
| 980 | - 'title' => bts('Server state', array(), NULL, 'boinc:task-details'), |
|
| 980 | + 'title' => bts('Server state', array(), null, 'boinc:task-details'), |
|
| 981 | 981 | 'help' => t('The state of task on the server side.'), |
| 982 | 982 | 'field' => array( |
| 983 | 983 | 'handler' => 'views_handler_field_numeric', |
| 984 | - 'click sortable' => TRUE |
|
| 984 | + 'click sortable' => true |
|
| 985 | 985 | ), |
| 986 | 986 | 'filter' => array( |
| 987 | 987 | 'handler' => 'views_handler_filter_numeric' |
@@ -991,11 +991,11 @@ discard block |
||
| 991 | 991 | ) |
| 992 | 992 | ); |
| 993 | 993 | $data['result']['stderr_out'] = array( |
| 994 | - 'title' => bts('Stderr out', array(), NULL, 'boinc:task-details'), |
|
| 994 | + 'title' => bts('Stderr out', array(), null, 'boinc:task-details'), |
|
| 995 | 995 | 'help' => t('The output to standard error.'), |
| 996 | 996 | 'field' => array( |
| 997 | 997 | 'handler' => 'views_handler_field', |
| 998 | - 'click sortable' => TRUE |
|
| 998 | + 'click sortable' => true |
|
| 999 | 999 | ), |
| 1000 | 1000 | 'filter' => array( |
| 1001 | 1001 | 'handler' => 'views_handler_filter_string' |
@@ -1005,11 +1005,11 @@ discard block |
||
| 1005 | 1005 | ) |
| 1006 | 1006 | ); |
| 1007 | 1007 | $data['result']['validate_state'] = array( |
| 1008 | - 'title' => bts('Validation state', array(), NULL, 'boinc:task-details'), |
|
| 1008 | + 'title' => bts('Validation state', array(), null, 'boinc:task-details'), |
|
| 1009 | 1009 | 'help' => t('The state of validation of this result.'), |
| 1010 | 1010 | 'field' => array( |
| 1011 | 1011 | 'handler' => 'views_handler_field_numeric', |
| 1012 | - 'click sortable' => TRUE |
|
| 1012 | + 'click sortable' => true |
|
| 1013 | 1013 | ), |
| 1014 | 1014 | 'filter' => array( |
| 1015 | 1015 | 'handler' => 'views_handler_filter_numeric' |
@@ -1019,11 +1019,11 @@ discard block |
||
| 1019 | 1019 | ) |
| 1020 | 1020 | ); |
| 1021 | 1021 | $data['result']['peak_working_set_size'] = array( |
| 1022 | - 'title' => bts('Peak working set size', array(), NULL, 'boinc:task-details'), |
|
| 1022 | + 'title' => bts('Peak working set size', array(), null, 'boinc:task-details'), |
|
| 1023 | 1023 | 'help' => t('Peak working set size.'), |
| 1024 | 1024 | 'field' => array( |
| 1025 | 1025 | 'handler' => 'views_handler_field_numeric', |
| 1026 | - 'click sortable' => TRUE |
|
| 1026 | + 'click sortable' => true |
|
| 1027 | 1027 | ), |
| 1028 | 1028 | 'filter' => array( |
| 1029 | 1029 | 'handler' => 'views_handler_filter_numeric' |
@@ -1033,11 +1033,11 @@ discard block |
||
| 1033 | 1033 | ) |
| 1034 | 1034 | ); |
| 1035 | 1035 | $data['result']['peak_swap_size'] = array( |
| 1036 | - 'title' => bts('Peak swap size', array(), NULL, 'boinc:task-details'), |
|
| 1036 | + 'title' => bts('Peak swap size', array(), null, 'boinc:task-details'), |
|
| 1037 | 1037 | 'help' => t('Peak swap size.'), |
| 1038 | 1038 | 'field' => array( |
| 1039 | 1039 | 'handler' => 'views_handler_field_numeric', |
| 1040 | - 'click sortable' => TRUE |
|
| 1040 | + 'click sortable' => true |
|
| 1041 | 1041 | ), |
| 1042 | 1042 | 'filter' => array( |
| 1043 | 1043 | 'handler' => 'views_handler_filter_numeric' |
@@ -1047,11 +1047,11 @@ discard block |
||
| 1047 | 1047 | ) |
| 1048 | 1048 | ); |
| 1049 | 1049 | $data['result']['peak_disk_usage'] = array( |
| 1050 | - 'title' => bts('Peak disk usage', array(), NULL, 'boinc:task-details'), |
|
| 1050 | + 'title' => bts('Peak disk usage', array(), null, 'boinc:task-details'), |
|
| 1051 | 1051 | 'help' => t('Peak disk usage.'), |
| 1052 | 1052 | 'field' => array( |
| 1053 | 1053 | 'handler' => 'views_handler_field_numeric', |
| 1054 | - 'click sortable' => TRUE |
|
| 1054 | + 'click sortable' => true |
|
| 1055 | 1055 | ), |
| 1056 | 1056 | 'filter' => array( |
| 1057 | 1057 | 'handler' => 'views_handler_filter_numeric' |
@@ -1086,16 +1086,16 @@ discard block |
||
| 1086 | 1086 | // Primary keys allowed as arguments |
| 1087 | 1087 | |
| 1088 | 1088 | $data['workunit']['id'] = array( |
| 1089 | - 'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'), |
|
| 1089 | + 'title' => bts('Workunit ID', array(), null, 'boinc:workunit-details'), |
|
| 1090 | 1090 | 'help' => t('The ID number of this workunit.'), |
| 1091 | 1091 | 'field' => array( |
| 1092 | 1092 | 'handler' => 'views_handler_field_numeric', |
| 1093 | - 'click sortable' => TRUE |
|
| 1093 | + 'click sortable' => true |
|
| 1094 | 1094 | ), |
| 1095 | 1095 | 'argument' => array( |
| 1096 | 1096 | 'handler' => 'views_handler_argument', |
| 1097 | 1097 | 'name field' => 'title', |
| 1098 | - 'numeric' => TRUE, |
|
| 1098 | + 'numeric' => true, |
|
| 1099 | 1099 | 'validate type' => 'id' |
| 1100 | 1100 | ), |
| 1101 | 1101 | 'filter' => array( |
@@ -1109,12 +1109,12 @@ discard block |
||
| 1109 | 1109 | // Foreign key fields |
| 1110 | 1110 | |
| 1111 | 1111 | $data['workunit']['appid'] = array( |
| 1112 | - 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
|
| 1112 | + 'title' => bts('Application ID', array(), null, 'boinc:application-details'), |
|
| 1113 | 1113 | 'help' => t('The application associated with this workunit.'), |
| 1114 | 1114 | 'argument' => array( // foreign key to the {app} table |
| 1115 | 1115 | 'handler' => 'views_handler_argument', |
| 1116 | 1116 | 'name field' => 'title', |
| 1117 | - 'numeric' => TRUE, |
|
| 1117 | + 'numeric' => true, |
|
| 1118 | 1118 | 'validate type' => 'id' |
| 1119 | 1119 | ), |
| 1120 | 1120 | 'relationship' => array( |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | ), |
| 1126 | 1126 | 'field' => array( |
| 1127 | 1127 | 'handler' => 'views_handler_field_numeric', |
| 1128 | - 'click sortable' => TRUE |
|
| 1128 | + 'click sortable' => true |
|
| 1129 | 1129 | ), |
| 1130 | 1130 | 'filter' => array( |
| 1131 | 1131 | 'handler' => 'views_handler_filter_numeric' |
@@ -1138,12 +1138,12 @@ discard block |
||
| 1138 | 1138 | // Descriptions of workunit fields (alphabetized) |
| 1139 | 1139 | |
| 1140 | 1140 | $data['workunit']['canonical_credit'] = array( |
| 1141 | - 'title' => bts('Canonical credit', array(), NULL, 'boinc:workunit-details'), |
|
| 1141 | + 'title' => bts('Canonical credit', array(), null, 'boinc:workunit-details'), |
|
| 1142 | 1142 | 'help' => t('The canonical credit of the workunit.'), |
| 1143 | 1143 | 'field' => array( |
| 1144 | 1144 | 'handler' => 'views_handler_field_numeric', |
| 1145 | - 'click sortable' => TRUE, |
|
| 1146 | - 'float' => TRUE |
|
| 1145 | + 'click sortable' => true, |
|
| 1146 | + 'float' => true |
|
| 1147 | 1147 | ), |
| 1148 | 1148 | 'filter' => array( |
| 1149 | 1149 | 'handler' => 'views_handler_filter_numeric' |
@@ -1153,11 +1153,11 @@ discard block |
||
| 1153 | 1153 | ) |
| 1154 | 1154 | ); |
| 1155 | 1155 | $data['workunit']['canonical_resultid'] = array( |
| 1156 | - 'title' => bts('Canonical result ID', array(), NULL, 'boinc:workunit-details'), |
|
| 1156 | + 'title' => bts('Canonical result ID', array(), null, 'boinc:workunit-details'), |
|
| 1157 | 1157 | 'help' => t('The ID of the canonical result associated with the workunit.'), |
| 1158 | 1158 | 'field' => array( |
| 1159 | 1159 | 'handler' => 'views_handler_field_numeric', |
| 1160 | - 'click sortable' => TRUE |
|
| 1160 | + 'click sortable' => true |
|
| 1161 | 1161 | ), |
| 1162 | 1162 | 'filter' => array( |
| 1163 | 1163 | 'handler' => 'views_handler_filter_numeric' |
@@ -1167,11 +1167,11 @@ discard block |
||
| 1167 | 1167 | ) |
| 1168 | 1168 | ); |
| 1169 | 1169 | $data['workunit']['create_time'] = array( |
| 1170 | - 'title' => bts('Created time', array(), NULL, 'boinc:workunit-details'), |
|
| 1170 | + 'title' => bts('Created time', array(), null, 'boinc:workunit-details'), |
|
| 1171 | 1171 | 'help' => t('The time that the workunit was created.'), |
| 1172 | 1172 | 'field' => array( |
| 1173 | 1173 | 'handler' => 'views_handler_field_date', |
| 1174 | - 'click sortable' => TRUE |
|
| 1174 | + 'click sortable' => true |
|
| 1175 | 1175 | ), |
| 1176 | 1176 | 'filter' => array( |
| 1177 | 1177 | 'handler' => 'views_handler_filter_date' |
@@ -1181,11 +1181,11 @@ discard block |
||
| 1181 | 1181 | ) |
| 1182 | 1182 | ); |
| 1183 | 1183 | $data['workunit']['error_mask'] = array( |
| 1184 | - 'title' => bts('Error mask', array(), NULL, 'boinc:workunit-details'), |
|
| 1184 | + 'title' => bts('Error mask', array(), null, 'boinc:workunit-details'), |
|
| 1185 | 1185 | 'help' => t('Error mask of the workunit.'), |
| 1186 | 1186 | 'field' => array( |
| 1187 | 1187 | 'handler' => 'views_handler_field_numeric', |
| 1188 | - 'click sortable' => TRUE |
|
| 1188 | + 'click sortable' => true |
|
| 1189 | 1189 | ), |
| 1190 | 1190 | 'filter' => array( |
| 1191 | 1191 | 'handler' => 'views_handler_filter_numeric' |
@@ -1195,11 +1195,11 @@ discard block |
||
| 1195 | 1195 | ) |
| 1196 | 1196 | ); |
| 1197 | 1197 | $data['workunit']['min_quorum'] = array( |
| 1198 | - 'title' => bts('Minimum quorum', array(), NULL, 'boinc:workunit-details'), |
|
| 1198 | + 'title' => bts('Minimum quorum', array(), null, 'boinc:workunit-details'), |
|
| 1199 | 1199 | 'help' => t('Minimum quorum of the workunit.'), |
| 1200 | 1200 | 'field' => array( |
| 1201 | 1201 | 'handler' => 'views_handler_field_numeric', |
| 1202 | - 'click sortable' => TRUE |
|
| 1202 | + 'click sortable' => true |
|
| 1203 | 1203 | ), |
| 1204 | 1204 | 'filter' => array( |
| 1205 | 1205 | 'handler' => 'views_handler_filter_numeric' |
@@ -1209,11 +1209,11 @@ discard block |
||
| 1209 | 1209 | ) |
| 1210 | 1210 | ); |
| 1211 | 1211 | $data['workunit']['name'] = array( |
| 1212 | - 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreovewrite'), |
|
| 1212 | + 'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreovewrite'), |
|
| 1213 | 1213 | 'help' => t('The name of the workunit.'), |
| 1214 | 1214 | 'field' => array( |
| 1215 | 1215 | 'handler' => 'views_handler_field', |
| 1216 | - 'click sortable' => TRUE |
|
| 1216 | + 'click sortable' => true |
|
| 1217 | 1217 | ), |
| 1218 | 1218 | 'filter' => array( |
| 1219 | 1219 | 'handler' => 'views_handler_filter_string' |
@@ -1223,11 +1223,11 @@ discard block |
||
| 1223 | 1223 | ) |
| 1224 | 1224 | ); |
| 1225 | 1225 | $data['workunit']['max_error_results'] = array( |
| 1226 | - 'title' => bts('Max error tasks', array(), NULL, 'boinc:workunit-details'), |
|
| 1226 | + 'title' => bts('Max error tasks', array(), null, 'boinc:workunit-details'), |
|
| 1227 | 1227 | 'help' => t('The maximum number of error tasks in the workunit.'), |
| 1228 | 1228 | 'field' => array( |
| 1229 | 1229 | 'handler' => 'views_handler_field_numeric', |
| 1230 | - 'click sortable' => TRUE |
|
| 1230 | + 'click sortable' => true |
|
| 1231 | 1231 | ), |
| 1232 | 1232 | 'filter' => array( |
| 1233 | 1233 | 'handler' => 'views_handler_filter_numeric' |
@@ -1237,11 +1237,11 @@ discard block |
||
| 1237 | 1237 | ) |
| 1238 | 1238 | ); |
| 1239 | 1239 | $data['workunit']['max_success_results'] = array( |
| 1240 | - 'title' => bts('Max success tasks', array(), NULL, 'boinc:workunit-details'), |
|
| 1240 | + 'title' => bts('Max success tasks', array(), null, 'boinc:workunit-details'), |
|
| 1241 | 1241 | 'help' => t('The maximum number of successful tasks in the workunit.'), |
| 1242 | 1242 | 'field' => array( |
| 1243 | 1243 | 'handler' => 'views_handler_field_numeric', |
| 1244 | - 'click sortable' => TRUE |
|
| 1244 | + 'click sortable' => true |
|
| 1245 | 1245 | ), |
| 1246 | 1246 | 'filter' => array( |
| 1247 | 1247 | 'handler' => 'views_handler_filter_numeric' |
@@ -1251,11 +1251,11 @@ discard block |
||
| 1251 | 1251 | ) |
| 1252 | 1252 | ); |
| 1253 | 1253 | $data['workunit']['max_total_results'] = array( |
| 1254 | - 'title' => bts('Max total tasks', array(), NULL, 'boinc:workunit-details'), |
|
| 1254 | + 'title' => bts('Max total tasks', array(), null, 'boinc:workunit-details'), |
|
| 1255 | 1255 | 'help' => t('The maximum number of total tasks in the workunit.'), |
| 1256 | 1256 | 'field' => array( |
| 1257 | 1257 | 'handler' => 'views_handler_field_numeric', |
| 1258 | - 'click sortable' => TRUE |
|
| 1258 | + 'click sortable' => true |
|
| 1259 | 1259 | ), |
| 1260 | 1260 | 'filter' => array( |
| 1261 | 1261 | 'handler' => 'views_handler_filter_numeric' |
@@ -1265,11 +1265,11 @@ discard block |
||
| 1265 | 1265 | ) |
| 1266 | 1266 | ); |
| 1267 | 1267 | $data['workunit']['need_validate'] = array( |
| 1268 | - 'title' => bts('Needs validation', array(), NULL, 'boinc:workunit-details'), |
|
| 1268 | + 'title' => bts('Needs validation', array(), null, 'boinc:workunit-details'), |
|
| 1269 | 1269 | 'help' => t('Whether or not a workunit needs validation.'), |
| 1270 | 1270 | 'field' => array( |
| 1271 | 1271 | 'handler' => 'views_handler_field_numeric', |
| 1272 | - 'click sortable' => TRUE |
|
| 1272 | + 'click sortable' => true |
|
| 1273 | 1273 | ), |
| 1274 | 1274 | 'filter' => array( |
| 1275 | 1275 | 'handler' => 'views_handler_filter_numeric' |
@@ -1279,11 +1279,11 @@ discard block |
||
| 1279 | 1279 | ) |
| 1280 | 1280 | ); |
| 1281 | 1281 | $data['workunit']['target_nresults'] = array( |
| 1282 | - 'title' => bts('Initial replication', array(), NULL, 'boinc:workunit-details'), |
|
| 1282 | + 'title' => bts('Initial replication', array(), null, 'boinc:workunit-details'), |
|
| 1283 | 1283 | 'help' => t('The target number of results for the workunit.'), |
| 1284 | 1284 | 'field' => array( |
| 1285 | 1285 | 'handler' => 'views_handler_field_numeric', |
| 1286 | - 'click sortable' => TRUE |
|
| 1286 | + 'click sortable' => true |
|
| 1287 | 1287 | ), |
| 1288 | 1288 | 'filter' => array( |
| 1289 | 1289 | 'handler' => 'views_handler_filter_numeric' |
@@ -1308,16 +1308,16 @@ discard block |
||
| 1308 | 1308 | // Primary keys allowed as arguments |
| 1309 | 1309 | |
| 1310 | 1310 | $data['app']['id'] = array( |
| 1311 | - 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
|
| 1311 | + 'title' => bts('Application ID', array(), null, 'boinc:application-details'), |
|
| 1312 | 1312 | 'help' => t('The ID number of this application.'), |
| 1313 | 1313 | 'field' => array( |
| 1314 | 1314 | 'handler' => 'views_handler_field_numeric', |
| 1315 | - 'click sortable' => TRUE |
|
| 1315 | + 'click sortable' => true |
|
| 1316 | 1316 | ), |
| 1317 | 1317 | 'argument' => array( |
| 1318 | 1318 | 'handler' => 'views_handler_argument', |
| 1319 | 1319 | 'name field' => 'title', |
| 1320 | - 'numeric' => TRUE, |
|
| 1320 | + 'numeric' => true, |
|
| 1321 | 1321 | 'validate type' => 'id' |
| 1322 | 1322 | ), |
| 1323 | 1323 | 'filter' => array( |
@@ -1331,11 +1331,11 @@ discard block |
||
| 1331 | 1331 | // Descriptions of app fields (alphabetized) |
| 1332 | 1332 | |
| 1333 | 1333 | $data['app']['target_nresults'] = array( |
| 1334 | - 'title' => bts('Target number of results', array(), NULL, 'boinc:application-details'), |
|
| 1334 | + 'title' => bts('Target number of results', array(), null, 'boinc:application-details'), |
|
| 1335 | 1335 | 'help' => t('The number of times to replicate tasks in this application.'), |
| 1336 | 1336 | 'field' => array( |
| 1337 | 1337 | 'handler' => 'views_handler_field_numeric', |
| 1338 | - 'click sortable' => TRUE |
|
| 1338 | + 'click sortable' => true |
|
| 1339 | 1339 | ), |
| 1340 | 1340 | 'filter' => array( |
| 1341 | 1341 | 'handler' => 'views_handler_filter_numeric' |
@@ -1345,11 +1345,11 @@ discard block |
||
| 1345 | 1345 | ) |
| 1346 | 1346 | ); |
| 1347 | 1347 | $data['app']['user_friendly_name'] = array( |
| 1348 | - 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 1348 | + 'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 1349 | 1349 | 'help' => t('The user friendly name of the application.'), |
| 1350 | 1350 | 'field' => array( |
| 1351 | 1351 | 'handler' => 'views_handler_field', |
| 1352 | - 'click sortable' => TRUE |
|
| 1352 | + 'click sortable' => true |
|
| 1353 | 1353 | ), |
| 1354 | 1354 | 'filter' => array( |
| 1355 | 1355 | 'handler' => 'views_handler_filter_string' |
@@ -1374,16 +1374,16 @@ discard block |
||
| 1374 | 1374 | // Primary keys allowed as arguments |
| 1375 | 1375 | |
| 1376 | 1376 | $data['app_version']['id'] = array( |
| 1377 | - 'title' => bts('Application version ID', array(), NULL, 'boinc:application-details'), |
|
| 1377 | + 'title' => bts('Application version ID', array(), null, 'boinc:application-details'), |
|
| 1378 | 1378 | 'help' => t('The ID number of this application version.'), |
| 1379 | 1379 | 'field' => array( |
| 1380 | 1380 | 'handler' => 'views_handler_field_numeric', |
| 1381 | - 'click sortable' => TRUE |
|
| 1381 | + 'click sortable' => true |
|
| 1382 | 1382 | ), |
| 1383 | 1383 | 'argument' => array( |
| 1384 | 1384 | 'handler' => 'views_handler_argument', |
| 1385 | 1385 | 'name field' => 'title', |
| 1386 | - 'numeric' => TRUE, |
|
| 1386 | + 'numeric' => true, |
|
| 1387 | 1387 | 'validate type' => 'id' |
| 1388 | 1388 | ), |
| 1389 | 1389 | 'filter' => array( |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | // Foreign key fields |
| 1398 | 1398 | |
| 1399 | 1399 | $data['app_version']['appid'] = array( |
| 1400 | - 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
|
| 1400 | + 'title' => bts('Application ID', array(), null, 'boinc:application-details'), |
|
| 1401 | 1401 | 'help' => t('The application ID associated with this app version.'), |
| 1402 | 1402 | // Because this is a foreign key to the {app} table. This allows us to |
| 1403 | 1403 | // have, when the view is configured with this relationship, all the fields |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | 'argument' => array( |
| 1406 | 1406 | 'handler' => 'views_handler_argument_numeric', |
| 1407 | 1407 | 'name field' => 'title', |
| 1408 | - 'numeric' => TRUE, |
|
| 1408 | + 'numeric' => true, |
|
| 1409 | 1409 | 'validate type' => 'id' |
| 1410 | 1410 | ), |
| 1411 | 1411 | 'relationship' => array( |
@@ -1416,7 +1416,7 @@ discard block |
||
| 1416 | 1416 | ), |
| 1417 | 1417 | 'field' => array( |
| 1418 | 1418 | 'handler' => 'views_handler_field_numeric', |
| 1419 | - 'click sortable' => TRUE |
|
| 1419 | + 'click sortable' => true |
|
| 1420 | 1420 | ), |
| 1421 | 1421 | 'filter' => array( |
| 1422 | 1422 | 'handler' => 'views_handler_filter_numeric' |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | ); |
| 1428 | 1428 | |
| 1429 | 1429 | $data['app_version']['platformid'] = array( |
| 1430 | - 'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'), |
|
| 1430 | + 'title' => bts('Platform ID', array(), null, 'boinc:platform-details'), |
|
| 1431 | 1431 | 'help' => t('The platform ID associated with this app version.'), |
| 1432 | 1432 | // Because this is a foreign key to the {platform} table. This allows us to |
| 1433 | 1433 | // have, when the view is configured with this relationship, all the fields |
@@ -1435,7 +1435,7 @@ discard block |
||
| 1435 | 1435 | 'argument' => array( |
| 1436 | 1436 | 'handler' => 'views_handler_argument_numeric', |
| 1437 | 1437 | 'name field' => 'title', |
| 1438 | - 'numeric' => TRUE, |
|
| 1438 | + 'numeric' => true, |
|
| 1439 | 1439 | 'validate type' => 'id' |
| 1440 | 1440 | ), |
| 1441 | 1441 | 'relationship' => array( |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | ), |
| 1447 | 1447 | 'field' => array( |
| 1448 | 1448 | 'handler' => 'views_handler_field_numeric', |
| 1449 | - 'click sortable' => TRUE |
|
| 1449 | + 'click sortable' => true |
|
| 1450 | 1450 | ), |
| 1451 | 1451 | 'filter' => array( |
| 1452 | 1452 | 'handler' => 'views_handler_filter_numeric' |
@@ -1459,11 +1459,11 @@ discard block |
||
| 1459 | 1459 | // Descriptions of app fields (alphabetized) |
| 1460 | 1460 | |
| 1461 | 1461 | $data['app_version']['plan_class'] = array( |
| 1462 | - 'title' => bts('Plan class', array(), NULL, 'boinc:application-details'), |
|
| 1462 | + 'title' => bts('Plan class', array(), null, 'boinc:application-details'), |
|
| 1463 | 1463 | 'help' => t('App version plan class.'), |
| 1464 | 1464 | 'field' => array( |
| 1465 | 1465 | 'handler' => 'views_handler_field', |
| 1466 | - 'click sortable' => TRUE |
|
| 1466 | + 'click sortable' => true |
|
| 1467 | 1467 | ), |
| 1468 | 1468 | 'filter' => array( |
| 1469 | 1469 | 'handler' => 'views_handler_filter_string' |
@@ -1473,12 +1473,12 @@ discard block |
||
| 1473 | 1473 | ) |
| 1474 | 1474 | ); |
| 1475 | 1475 | $data['app_version']['version_num'] = array( |
| 1476 | - 'title' => bts('Version number', array(), NULL, 'boinc:application-details'), |
|
| 1476 | + 'title' => bts('Version number', array(), null, 'boinc:application-details'), |
|
| 1477 | 1477 | 'help' => t('The application version number.'), |
| 1478 | 1478 | 'field' => array( |
| 1479 | 1479 | 'handler' => 'views_handler_field_boincwork_app_version_number', |
| 1480 | - 'click sortable' => TRUE, |
|
| 1481 | - 'float' => TRUE, |
|
| 1480 | + 'click sortable' => true, |
|
| 1481 | + 'float' => true, |
|
| 1482 | 1482 | ), |
| 1483 | 1483 | 'filter' => array( |
| 1484 | 1484 | 'handler' => 'views_handler_filter_numeric' |
@@ -1512,16 +1512,16 @@ discard block |
||
| 1512 | 1512 | // Primary keys allowed as arguments |
| 1513 | 1513 | |
| 1514 | 1514 | $data['host_app_version']['host_id'] = array( |
| 1515 | - 'title' => bts('Computer', array(), NULL, 'boinc:host-details'), |
|
| 1515 | + 'title' => bts('Computer', array(), null, 'boinc:host-details'), |
|
| 1516 | 1516 | 'help' => t('The host ID connected to this app version data.'), |
| 1517 | 1517 | 'field' => array( |
| 1518 | 1518 | 'handler' => 'views_handler_field_numeric', |
| 1519 | - 'click sortable' => TRUE |
|
| 1519 | + 'click sortable' => true |
|
| 1520 | 1520 | ), |
| 1521 | 1521 | 'argument' => array( |
| 1522 | 1522 | 'handler' => 'views_handler_argument', |
| 1523 | 1523 | 'name field' => 'title', |
| 1524 | - 'numeric' => TRUE, |
|
| 1524 | + 'numeric' => true, |
|
| 1525 | 1525 | 'validate type' => 'id' |
| 1526 | 1526 | ), |
| 1527 | 1527 | 'filter' => array( |
@@ -1535,7 +1535,7 @@ discard block |
||
| 1535 | 1535 | // Foreign key fields |
| 1536 | 1536 | |
| 1537 | 1537 | $data['host_app_version']['app_version_id'] = array( |
| 1538 | - 'title' => bts('App version ID', array(), NULL, 'boinc:application-details'), |
|
| 1538 | + 'title' => bts('App version ID', array(), null, 'boinc:application-details'), |
|
| 1539 | 1539 | 'help' => t('The app version ID connected to this host data.'), |
| 1540 | 1540 | // Because this is a foreign key to the {host} table. This allows us to |
| 1541 | 1541 | // have, when the view is configured with this relationship, all the fields |
@@ -1543,7 +1543,7 @@ discard block |
||
| 1543 | 1543 | 'argument' => array( |
| 1544 | 1544 | 'handler' => 'views_handler_argument_numeric', |
| 1545 | 1545 | 'name field' => 'title', |
| 1546 | - 'numeric' => TRUE, |
|
| 1546 | + 'numeric' => true, |
|
| 1547 | 1547 | 'validate type' => 'id' |
| 1548 | 1548 | ), |
| 1549 | 1549 | 'relationship' => array( |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | ), |
| 1555 | 1555 | 'field' => array( |
| 1556 | 1556 | 'handler' => 'views_handler_field_numeric', |
| 1557 | - 'click sortable' => TRUE |
|
| 1557 | + 'click sortable' => true |
|
| 1558 | 1558 | ), |
| 1559 | 1559 | 'filter' => array( |
| 1560 | 1560 | 'handler' => 'views_handler_filter_numeric' |
@@ -1567,11 +1567,11 @@ discard block |
||
| 1567 | 1567 | // Descriptions of host_app_version fields (alphabetized) |
| 1568 | 1568 | |
| 1569 | 1569 | $data['host_app_version']['consecutive_valid'] = array( |
| 1570 | - 'title' => bts('Consecutive valid tasks', array(), NULL, 'boinc:application-details'), |
|
| 1570 | + 'title' => bts('Consecutive valid tasks', array(), null, 'boinc:application-details'), |
|
| 1571 | 1571 | 'help' => t('The number of consecutive valid tasks for this app and by this host.'), |
| 1572 | 1572 | 'field' => array( |
| 1573 | 1573 | 'handler' => 'views_handler_field_numeric', |
| 1574 | - 'click sortable' => TRUE |
|
| 1574 | + 'click sortable' => true |
|
| 1575 | 1575 | ), |
| 1576 | 1576 | 'filter' => array( |
| 1577 | 1577 | 'handler' => 'views_handler_filter_numeric' |
@@ -1585,7 +1585,7 @@ discard block |
||
| 1585 | 1585 | 'help' => t('The "et_avg" for this app and by this host.'), |
| 1586 | 1586 | 'field' => array( |
| 1587 | 1587 | 'handler' => 'views_handler_field_boincwork_host_app_et_avg', |
| 1588 | - 'click sortable' => TRUE |
|
| 1588 | + 'click sortable' => true |
|
| 1589 | 1589 | ), |
| 1590 | 1590 | 'filter' => array( |
| 1591 | 1591 | 'handler' => 'views_handler_filter_numeric' |
@@ -1595,11 +1595,11 @@ discard block |
||
| 1595 | 1595 | ) |
| 1596 | 1596 | ); |
| 1597 | 1597 | $data['host_app_version']['et_n'] = array( |
| 1598 | - 'title' => bts('Number of tasks completed', array(), NULL, 'boinc:application-details'), |
|
| 1598 | + 'title' => bts('Number of tasks completed', array(), null, 'boinc:application-details'), |
|
| 1599 | 1599 | 'help' => t('The tasks completed for this app and by this host.'), |
| 1600 | 1600 | 'field' => array( |
| 1601 | 1601 | 'handler' => 'views_handler_field_numeric', |
| 1602 | - 'click sortable' => TRUE |
|
| 1602 | + 'click sortable' => true |
|
| 1603 | 1603 | ), |
| 1604 | 1604 | 'filter' => array( |
| 1605 | 1605 | 'handler' => 'views_handler_filter_numeric' |
@@ -1609,11 +1609,11 @@ discard block |
||
| 1609 | 1609 | ) |
| 1610 | 1610 | ); |
| 1611 | 1611 | $data['host_app_version']['max_jobs_per_day'] = array( |
| 1612 | - 'title' => bts('Max tasks per day', array(), NULL, 'boinc:application-details'), |
|
| 1612 | + 'title' => bts('Max tasks per day', array(), null, 'boinc:application-details'), |
|
| 1613 | 1613 | 'help' => t('The maximum tasks per day for this app and by this host.'), |
| 1614 | 1614 | 'field' => array( |
| 1615 | 1615 | 'handler' => 'views_handler_field_numeric', |
| 1616 | - 'click sortable' => TRUE |
|
| 1616 | + 'click sortable' => true |
|
| 1617 | 1617 | ), |
| 1618 | 1618 | 'filter' => array( |
| 1619 | 1619 | 'handler' => 'views_handler_filter_numeric' |
@@ -1623,11 +1623,11 @@ discard block |
||
| 1623 | 1623 | ) |
| 1624 | 1624 | ); |
| 1625 | 1625 | $data['host_app_version']['n_jobs_today'] = array( |
| 1626 | - 'title' => bts('Number of tasks today', array(), NULL, 'boinc:application-details'), |
|
| 1626 | + 'title' => bts('Number of tasks today', array(), null, 'boinc:application-details'), |
|
| 1627 | 1627 | 'help' => t('The number of tasks today for this app and by this host.'), |
| 1628 | 1628 | 'field' => array( |
| 1629 | 1629 | 'handler' => 'views_handler_field_numeric', |
| 1630 | - 'click sortable' => TRUE |
|
| 1630 | + 'click sortable' => true |
|
| 1631 | 1631 | ), |
| 1632 | 1632 | 'filter' => array( |
| 1633 | 1633 | 'handler' => 'views_handler_filter_numeric' |
@@ -1637,12 +1637,12 @@ discard block |
||
| 1637 | 1637 | ) |
| 1638 | 1638 | ); |
| 1639 | 1639 | $data['host_app_version']['turnaround_avg'] = array( |
| 1640 | - 'title' => bts('Average turnaround time', array(), NULL, 'boinc:application-details:-1:ignoreoverwrite'), |
|
| 1640 | + 'title' => bts('Average turnaround time', array(), null, 'boinc:application-details:-1:ignoreoverwrite'), |
|
| 1641 | 1641 | 'help' => t('The average turnaround time per task for this app and by this host.'), |
| 1642 | 1642 | 'field' => array( |
| 1643 | 1643 | 'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg', |
| 1644 | - 'click sortable' => TRUE, |
|
| 1645 | - 'float' => TRUE, |
|
| 1644 | + 'click sortable' => true, |
|
| 1645 | + 'float' => true, |
|
| 1646 | 1646 | ), |
| 1647 | 1647 | 'filter' => array( |
| 1648 | 1648 | 'handler' => 'views_handler_filter_numeric' |
@@ -1652,11 +1652,11 @@ discard block |
||
| 1652 | 1652 | ) |
| 1653 | 1653 | ); |
| 1654 | 1654 | $data['host_app_version']['user_friendly_name'] = array( |
| 1655 | - 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 1655 | + 'title' => bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
|
| 1656 | 1656 | 'help' => t('The user friendly name of the application.'), |
| 1657 | 1657 | 'field' => array( |
| 1658 | 1658 | 'handler' => 'views_handler_field', |
| 1659 | - 'click sortable' => TRUE |
|
| 1659 | + 'click sortable' => true |
|
| 1660 | 1660 | ), |
| 1661 | 1661 | 'filter' => array( |
| 1662 | 1662 | 'handler' => 'views_handler_filter_string' |
@@ -13,1660 +13,1660 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function boincwork_views_data() { |
| 15 | 15 | |
| 16 | - // ----------------------------------------------------------------------------------------------- |
|
| 17 | - // Definition for host table |
|
| 18 | - // ----------------------------------------------------------------------------------------------- |
|
| 16 | + // ----------------------------------------------------------------------------------------------- |
|
| 17 | + // Definition for host table |
|
| 18 | + // ----------------------------------------------------------------------------------------------- |
|
| 19 | 19 | |
| 20 | - $data['host']['table']['group'] = t('BOINC'); |
|
| 20 | + $data['host']['table']['group'] = t('BOINC'); |
|
| 21 | 21 | |
| 22 | - $data['host']['table']['base'] = array( |
|
| 23 | - 'field' => 'id', |
|
| 24 | - 'title' => t('BOINC host'), |
|
| 25 | - 'help' => t('Computers attached to BOINC'), |
|
| 26 | - 'database' => 'boinc_ro' |
|
| 27 | - ); |
|
| 22 | + $data['host']['table']['base'] = array( |
|
| 23 | + 'field' => 'id', |
|
| 24 | + 'title' => t('BOINC host'), |
|
| 25 | + 'help' => t('Computers attached to BOINC'), |
|
| 26 | + 'database' => 'boinc_ro' |
|
| 27 | + ); |
|
| 28 | 28 | |
| 29 | - // This table references the {user} table. |
|
| 30 | - // This join creates an 'implicit' relationship to the user table, so that when |
|
| 31 | - // "User" is the base table, the fields are automatically available. |
|
| 29 | + // This table references the {user} table. |
|
| 30 | + // This join creates an 'implicit' relationship to the user table, so that when |
|
| 31 | + // "User" is the base table, the fields are automatically available. |
|
| 32 | 32 | |
| 33 | - // Index this array by the table name to which this table refers. |
|
| 34 | - // 'left_field' is the primary key in the referenced table. |
|
| 35 | - // 'field' is the foreign key in this table. |
|
| 33 | + // Index this array by the table name to which this table refers. |
|
| 34 | + // 'left_field' is the primary key in the referenced table. |
|
| 35 | + // 'field' is the foreign key in this table. |
|
| 36 | 36 | |
| 37 | - $data['host']['table']['join'] = array( |
|
| 37 | + $data['host']['table']['join'] = array( |
|
| 38 | 38 | 'user' => array( |
| 39 | - 'left_field' => 'id', |
|
| 40 | - 'field' => 'userid', |
|
| 39 | + 'left_field' => 'id', |
|
| 40 | + 'field' => 'userid', |
|
| 41 | 41 | ) |
| 42 | - ); |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - // Describe each of the individual fields in this table to Views. For |
|
| 45 | - // each field, you may define what field, sort, argument, and/or filter |
|
| 46 | - // handlers it supports. This will determine where in the Views interface you |
|
| 47 | - // may use the field. |
|
| 44 | + // Describe each of the individual fields in this table to Views. For |
|
| 45 | + // each field, you may define what field, sort, argument, and/or filter |
|
| 46 | + // handlers it supports. This will determine where in the Views interface you |
|
| 47 | + // may use the field. |
|
| 48 | 48 | |
| 49 | - // Primary keys allowed as arguments |
|
| 49 | + // Primary keys allowed as arguments |
|
| 50 | 50 | |
| 51 | - $data['host']['id'] = array( |
|
| 51 | + $data['host']['id'] = array( |
|
| 52 | 52 | 'title' => bts('Computer ID', array(), NULL, 'boinc:host-list'), |
| 53 | 53 | 'help' => t('The ID number of this host.'), |
| 54 | 54 | 'field' => array( |
| 55 | - 'handler' => 'views_handler_field_numeric', |
|
| 56 | - 'click sortable' => TRUE |
|
| 55 | + 'handler' => 'views_handler_field_numeric', |
|
| 56 | + 'click sortable' => TRUE |
|
| 57 | 57 | ), |
| 58 | 58 | 'argument' => array( |
| 59 | - 'handler' => 'views_handler_argument', |
|
| 60 | - 'name field' => 'title', |
|
| 61 | - 'numeric' => TRUE, |
|
| 62 | - 'validate type' => 'id' |
|
| 59 | + 'handler' => 'views_handler_argument', |
|
| 60 | + 'name field' => 'title', |
|
| 61 | + 'numeric' => TRUE, |
|
| 62 | + 'validate type' => 'id' |
|
| 63 | 63 | ), |
| 64 | 64 | 'filter' => array( |
| 65 | - 'handler' => 'views_handler_filter_numeric' |
|
| 65 | + 'handler' => 'views_handler_filter_numeric' |
|
| 66 | 66 | ), |
| 67 | 67 | 'sort' => array( |
| 68 | - 'handler' => 'views_handler_sort_numeric' |
|
| 68 | + 'handler' => 'views_handler_sort_numeric' |
|
| 69 | 69 | ) |
| 70 | - ); |
|
| 71 | - $data['host']['venue'] = array( |
|
| 70 | + ); |
|
| 71 | + $data['host']['venue'] = array( |
|
| 72 | 72 | 'title' => bts('Location', array(), NULL, 'boinc:host-list'), |
| 73 | 73 | 'help' => t('The name of the preference set assigned to this host.'), |
| 74 | 74 | 'field' => array( |
| 75 | - 'handler' => 'views_handler_field', |
|
| 76 | - 'click sortable' => TRUE |
|
| 75 | + 'handler' => 'views_handler_field', |
|
| 76 | + 'click sortable' => TRUE |
|
| 77 | 77 | ), |
| 78 | 78 | 'argument' => array( |
| 79 | - 'handler' => 'views_handler_argument', |
|
| 80 | - 'name field' => 'title' |
|
| 79 | + 'handler' => 'views_handler_argument', |
|
| 80 | + 'name field' => 'title' |
|
| 81 | 81 | ), |
| 82 | 82 | 'filter' => array( |
| 83 | - 'handler' => 'views_handler_filter_string' |
|
| 83 | + 'handler' => 'views_handler_filter_string' |
|
| 84 | 84 | ), |
| 85 | 85 | 'sort' => array( |
| 86 | - 'handler' => 'views_handler_sort_string' |
|
| 86 | + 'handler' => 'views_handler_sort_string' |
|
| 87 | 87 | ) |
| 88 | - ); |
|
| 88 | + ); |
|
| 89 | 89 | |
| 90 | - // Foreign key fields |
|
| 90 | + // Foreign key fields |
|
| 91 | 91 | |
| 92 | - $data['host']['userid'] = array( |
|
| 92 | + $data['host']['userid'] = array( |
|
| 93 | 93 | 'title' => bts('User ID', array(), NULL, 'boinc:user-details'), |
| 94 | 94 | 'help' => t('The owner of this host.'), |
| 95 | 95 | // Because this is a foreign key to the {user} table. This allows us to |
| 96 | 96 | // have, when the view is configured with this relationship, all the fields |
| 97 | 97 | // for the related node available. |
| 98 | 98 | 'argument' => array( |
| 99 | - 'handler' => 'views_handler_argument_boincuser_id', |
|
| 100 | - 'name field' => 'title', |
|
| 101 | - 'numeric' => TRUE, |
|
| 102 | - 'validate type' => 'id' |
|
| 99 | + 'handler' => 'views_handler_argument_boincuser_id', |
|
| 100 | + 'name field' => 'title', |
|
| 101 | + 'numeric' => TRUE, |
|
| 102 | + 'validate type' => 'id' |
|
| 103 | 103 | ), |
| 104 | 104 | 'relationship' => array( |
| 105 | - 'base' => 'user', |
|
| 106 | - 'field' => 'userid', |
|
| 107 | - 'handler' => 'views_handler_relationship', |
|
| 108 | - 'label' => t('User') |
|
| 105 | + 'base' => 'user', |
|
| 106 | + 'field' => 'userid', |
|
| 107 | + 'handler' => 'views_handler_relationship', |
|
| 108 | + 'label' => t('User') |
|
| 109 | 109 | ), |
| 110 | 110 | 'field' => array( |
| 111 | - 'handler' => 'views_handler_field_numeric', |
|
| 112 | - 'click sortable' => TRUE |
|
| 111 | + 'handler' => 'views_handler_field_numeric', |
|
| 112 | + 'click sortable' => TRUE |
|
| 113 | 113 | ), |
| 114 | 114 | 'filter' => array( |
| 115 | - 'handler' => 'views_handler_filter_numeric' |
|
| 115 | + 'handler' => 'views_handler_filter_numeric' |
|
| 116 | 116 | ), |
| 117 | 117 | 'sort' => array( |
| 118 | - 'handler' => 'views_handler_sort_numeric' |
|
| 118 | + 'handler' => 'views_handler_sort_numeric' |
|
| 119 | 119 | ) |
| 120 | - ); |
|
| 120 | + ); |
|
| 121 | 121 | |
| 122 | - // Descriptions of general host fields (alphabetized) |
|
| 122 | + // Descriptions of general host fields (alphabetized) |
|
| 123 | 123 | |
| 124 | - $data['host']['active_frac'] = array( |
|
| 124 | + $data['host']['active_frac'] = array( |
|
| 125 | 125 | 'title' => bts('While BOINC running, % of time work is allowed', array(), NULL, 'boinc:host-details'), |
| 126 | 126 | 'help' => t('The percentage of time that work is allowed.'), |
| 127 | 127 | 'field' => array( |
| 128 | - 'handler' => 'views_handler_field_numeric', |
|
| 129 | - 'click sortable' => TRUE, |
|
| 130 | - 'float' => TRUE |
|
| 128 | + 'handler' => 'views_handler_field_numeric', |
|
| 129 | + 'click sortable' => TRUE, |
|
| 130 | + 'float' => TRUE |
|
| 131 | 131 | ), |
| 132 | 132 | 'filter' => array( |
| 133 | - 'handler' => 'views_handler_filter_numeric' |
|
| 133 | + 'handler' => 'views_handler_filter_numeric' |
|
| 134 | 134 | ), |
| 135 | 135 | 'sort' => array( |
| 136 | - 'handler' => 'views_handler_sort_numeric' |
|
| 136 | + 'handler' => 'views_handler_sort_numeric' |
|
| 137 | 137 | ) |
| 138 | - ); |
|
| 139 | - $data['host']['avg_turnaround'] = array( |
|
| 138 | + ); |
|
| 139 | + $data['host']['avg_turnaround'] = array( |
|
| 140 | 140 | 'title' => bts('Average turnaround time', array(), NULL, 'boinc:host-details'), |
| 141 | 141 | 'help' => t('The average time required for work to be completed.'), |
| 142 | 142 | 'field' => array( |
| 143 | - 'handler' => 'views_handler_field_numeric', |
|
| 144 | - 'click sortable' => TRUE, |
|
| 145 | - 'float' => TRUE |
|
| 143 | + 'handler' => 'views_handler_field_numeric', |
|
| 144 | + 'click sortable' => TRUE, |
|
| 145 | + 'float' => TRUE |
|
| 146 | 146 | ), |
| 147 | 147 | 'filter' => array( |
| 148 | - 'handler' => 'views_handler_filter_numeric' |
|
| 148 | + 'handler' => 'views_handler_filter_numeric' |
|
| 149 | 149 | ), |
| 150 | 150 | 'sort' => array( |
| 151 | - 'handler' => 'views_handler_sort_numeric' |
|
| 151 | + 'handler' => 'views_handler_sort_numeric' |
|
| 152 | 152 | ) |
| 153 | - ); |
|
| 154 | - $data['host']['create_time'] = array( |
|
| 153 | + ); |
|
| 154 | + $data['host']['create_time'] = array( |
|
| 155 | 155 | 'title' => bts('Created', array(), NULL, 'boinc:host-details'), |
| 156 | 156 | 'help' => t('The time the host record was created.'), |
| 157 | 157 | 'field' => array( |
| 158 | - 'handler' => 'views_handler_field_date', |
|
| 159 | - 'click sortable' => TRUE |
|
| 158 | + 'handler' => 'views_handler_field_date', |
|
| 159 | + 'click sortable' => TRUE |
|
| 160 | 160 | ), |
| 161 | 161 | 'filter' => array( |
| 162 | - 'handler' => 'views_handler_filter_date' |
|
| 162 | + 'handler' => 'views_handler_filter_date' |
|
| 163 | 163 | ), |
| 164 | 164 | 'sort' => array( |
| 165 | - 'handler' => 'views_handler_sort_date' |
|
| 165 | + 'handler' => 'views_handler_sort_date' |
|
| 166 | 166 | ) |
| 167 | - ); |
|
| 168 | - $data['host']['connected_frac'] = array( |
|
| 167 | + ); |
|
| 168 | + $data['host']['connected_frac'] = array( |
|
| 169 | 169 | 'title' => bts('While BOINC running, % of time host has an Internet connection', array(), NULL, 'boinc:host-details'), |
| 170 | 170 | 'help' => t('The percentage of time that the host has an Internet connection.'), |
| 171 | 171 | 'field' => array( |
| 172 | - 'handler' => 'views_handler_field_numeric', |
|
| 173 | - 'click sortable' => TRUE, |
|
| 174 | - 'float' => TRUE |
|
| 172 | + 'handler' => 'views_handler_field_numeric', |
|
| 173 | + 'click sortable' => TRUE, |
|
| 174 | + 'float' => TRUE |
|
| 175 | 175 | ), |
| 176 | 176 | 'filter' => array( |
| 177 | - 'handler' => 'views_handler_filter_numeric' |
|
| 177 | + 'handler' => 'views_handler_filter_numeric' |
|
| 178 | 178 | ), |
| 179 | 179 | 'sort' => array( |
| 180 | - 'handler' => 'views_handler_sort_numeric' |
|
| 180 | + 'handler' => 'views_handler_sort_numeric' |
|
| 181 | 181 | ) |
| 182 | - ); |
|
| 183 | - $data['host']['cpu_efficiency'] = array( |
|
| 182 | + ); |
|
| 183 | + $data['host']['cpu_efficiency'] = array( |
|
| 184 | 184 | 'title' => bts('Average CPU efficiency', array(), NULL, 'boinc:host-details'), |
| 185 | 185 | 'help' => t('The average efficiency of the host CPU.'), |
| 186 | 186 | 'field' => array( |
| 187 | - 'handler' => 'views_handler_field_numeric', |
|
| 188 | - 'click sortable' => TRUE, |
|
| 189 | - 'float' => TRUE |
|
| 187 | + 'handler' => 'views_handler_field_numeric', |
|
| 188 | + 'click sortable' => TRUE, |
|
| 189 | + 'float' => TRUE |
|
| 190 | 190 | ), |
| 191 | 191 | 'filter' => array( |
| 192 | - 'handler' => 'views_handler_filter_numeric' |
|
| 192 | + 'handler' => 'views_handler_filter_numeric' |
|
| 193 | 193 | ), |
| 194 | 194 | 'sort' => array( |
| 195 | - 'handler' => 'views_handler_sort_numeric' |
|
| 195 | + 'handler' => 'views_handler_sort_numeric' |
|
| 196 | 196 | ) |
| 197 | - ); |
|
| 198 | - $data['host']['d_free'] = array( |
|
| 197 | + ); |
|
| 198 | + $data['host']['d_free'] = array( |
|
| 199 | 199 | 'title' => bts('Free disk space', array(), NULL, 'boinc:host-details'), |
| 200 | 200 | 'help' => t('The amount of disk space that is not in use.'), |
| 201 | 201 | 'field' => array( |
| 202 | - 'handler' => 'views_handler_field_numeric', |
|
| 203 | - 'click sortable' => TRUE |
|
| 202 | + 'handler' => 'views_handler_field_numeric', |
|
| 203 | + 'click sortable' => TRUE |
|
| 204 | 204 | ), |
| 205 | 205 | 'filter' => array( |
| 206 | - 'handler' => 'views_handler_filter_numeric' |
|
| 206 | + 'handler' => 'views_handler_filter_numeric' |
|
| 207 | 207 | ), |
| 208 | 208 | 'sort' => array( |
| 209 | - 'handler' => 'views_handler_sort_numeric' |
|
| 209 | + 'handler' => 'views_handler_sort_numeric' |
|
| 210 | 210 | ) |
| 211 | - ); |
|
| 212 | - $data['host']['d_total'] = array( |
|
| 211 | + ); |
|
| 212 | + $data['host']['d_total'] = array( |
|
| 213 | 213 | 'title' => bts('Total disk space', array(), NULL, 'boinc:host-details'), |
| 214 | 214 | 'help' => t('The size of the disk on which BOINC is installed.'), |
| 215 | 215 | 'field' => array( |
| 216 | - 'handler' => 'views_handler_field_numeric', |
|
| 217 | - 'click sortable' => TRUE |
|
| 216 | + 'handler' => 'views_handler_field_numeric', |
|
| 217 | + 'click sortable' => TRUE |
|
| 218 | 218 | ), |
| 219 | 219 | 'filter' => array( |
| 220 | - 'handler' => 'views_handler_filter_numeric' |
|
| 220 | + 'handler' => 'views_handler_filter_numeric' |
|
| 221 | 221 | ), |
| 222 | 222 | 'sort' => array( |
| 223 | - 'handler' => 'views_handler_sort_numeric' |
|
| 223 | + 'handler' => 'views_handler_sort_numeric' |
|
| 224 | 224 | ) |
| 225 | - ); |
|
| 226 | - $data['host']['domain_name'] = array( |
|
| 225 | + ); |
|
| 226 | + $data['host']['domain_name'] = array( |
|
| 227 | 227 | 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
| 228 | 228 | 'help' => t('The name of the host.'), |
| 229 | 229 | 'field' => array( |
| 230 | - 'handler' => 'views_handler_field', |
|
| 231 | - 'click sortable' => TRUE |
|
| 230 | + 'handler' => 'views_handler_field', |
|
| 231 | + 'click sortable' => TRUE |
|
| 232 | 232 | ), |
| 233 | 233 | 'filter' => array( |
| 234 | - 'handler' => 'views_handler_filter_string' |
|
| 234 | + 'handler' => 'views_handler_filter_string' |
|
| 235 | 235 | ), |
| 236 | 236 | 'sort' => array( |
| 237 | - 'handler' => 'views_handler_sort_string' |
|
| 237 | + 'handler' => 'views_handler_sort_string' |
|
| 238 | 238 | ) |
| 239 | - ); |
|
| 240 | - $data['host']['duration_correction_factor'] = array( |
|
| 239 | + ); |
|
| 240 | + $data['host']['duration_correction_factor'] = array( |
|
| 241 | 241 | 'title' => bts('Task duration correction factor', array(), NULL, 'boinc:host-details'), |
| 242 | 242 | 'help' => t('Task duration correction factor.'), |
| 243 | 243 | 'field' => array( |
| 244 | - 'handler' => 'views_handler_field_numeric', |
|
| 245 | - 'click sortable' => TRUE, |
|
| 246 | - 'float' => TRUE |
|
| 244 | + 'handler' => 'views_handler_field_numeric', |
|
| 245 | + 'click sortable' => TRUE, |
|
| 246 | + 'float' => TRUE |
|
| 247 | 247 | ), |
| 248 | 248 | 'filter' => array( |
| 249 | - 'handler' => 'views_handler_filter_numeric' |
|
| 249 | + 'handler' => 'views_handler_filter_numeric' |
|
| 250 | 250 | ), |
| 251 | 251 | 'sort' => array( |
| 252 | - 'handler' => 'views_handler_sort_numeric' |
|
| 252 | + 'handler' => 'views_handler_sort_numeric' |
|
| 253 | 253 | ) |
| 254 | - ); |
|
| 255 | - $data['host']['expavg_credit'] = array( |
|
| 254 | + ); |
|
| 255 | + $data['host']['expavg_credit'] = array( |
|
| 256 | 256 | 'title' => bts('Avg. credit', array(), NULL, 'boinc:host-details'), |
| 257 | 257 | 'help' => t('A decaying average of credit per day.'), |
| 258 | 258 | 'field' => array( |
| 259 | - 'handler' => 'views_handler_field_numeric', |
|
| 260 | - 'click sortable' => TRUE, |
|
| 261 | - 'float' => TRUE |
|
| 259 | + 'handler' => 'views_handler_field_numeric', |
|
| 260 | + 'click sortable' => TRUE, |
|
| 261 | + 'float' => TRUE |
|
| 262 | 262 | ), |
| 263 | 263 | 'filter' => array( |
| 264 | - 'handler' => 'views_handler_filter_numeric' |
|
| 264 | + 'handler' => 'views_handler_filter_numeric' |
|
| 265 | 265 | ), |
| 266 | 266 | 'sort' => array( |
| 267 | - 'handler' => 'views_handler_sort_numeric' |
|
| 267 | + 'handler' => 'views_handler_sort_numeric' |
|
| 268 | 268 | ) |
| 269 | - ); |
|
| 270 | - $data['host']['external_ip_addr'] = array( |
|
| 269 | + ); |
|
| 270 | + $data['host']['external_ip_addr'] = array( |
|
| 271 | 271 | 'title' => bts('External IP address', array(), NULL, 'boinc:host-details'), |
| 272 | 272 | 'help' => t('The IP address from which the host last communicated.'), |
| 273 | 273 | 'field' => array( |
| 274 | - 'handler' => 'views_handler_field', |
|
| 275 | - 'click sortable' => TRUE |
|
| 274 | + 'handler' => 'views_handler_field', |
|
| 275 | + 'click sortable' => TRUE |
|
| 276 | 276 | ), |
| 277 | 277 | 'filter' => array( |
| 278 | - 'handler' => 'views_handler_filter_string' |
|
| 278 | + 'handler' => 'views_handler_filter_string' |
|
| 279 | 279 | ), |
| 280 | 280 | 'sort' => array( |
| 281 | - 'handler' => 'views_handler_sort_string' |
|
| 281 | + 'handler' => 'views_handler_sort_string' |
|
| 282 | 282 | ) |
| 283 | - ); |
|
| 284 | - $data['host']['host_cpid'] = array( |
|
| 283 | + ); |
|
| 284 | + $data['host']['host_cpid'] = array( |
|
| 285 | 285 | 'title' => bts('Cross project ID', array(), NULL, 'boinc:host-details'), |
| 286 | 286 | 'help' => t('The consistent identifier of the host across projects.'), |
| 287 | 287 | 'field' => array( |
| 288 | - 'handler' => 'views_handler_field', |
|
| 289 | - 'click sortable' => TRUE |
|
| 288 | + 'handler' => 'views_handler_field', |
|
| 289 | + 'click sortable' => TRUE |
|
| 290 | 290 | ), |
| 291 | 291 | 'filter' => array( |
| 292 | - 'handler' => 'views_handler_filter_string' |
|
| 292 | + 'handler' => 'views_handler_filter_string' |
|
| 293 | 293 | ), |
| 294 | 294 | 'sort' => array( |
| 295 | - 'handler' => 'views_handler_sort_string' |
|
| 295 | + 'handler' => 'views_handler_sort_string' |
|
| 296 | 296 | ) |
| 297 | - ); |
|
| 298 | - $data['host']['last_ip_addr'] = array( |
|
| 297 | + ); |
|
| 298 | + $data['host']['last_ip_addr'] = array( |
|
| 299 | 299 | 'title' => bts('Last IP address', array(), NULL, 'boinc:host-details'), |
| 300 | 300 | 'help' => t('The IP address of the host at last communication.'), |
| 301 | 301 | 'field' => array( |
| 302 | - 'handler' => 'views_handler_field', |
|
| 303 | - 'click sortable' => TRUE |
|
| 302 | + 'handler' => 'views_handler_field', |
|
| 303 | + 'click sortable' => TRUE |
|
| 304 | 304 | ), |
| 305 | 305 | 'filter' => array( |
| 306 | - 'handler' => 'views_handler_filter_string' |
|
| 306 | + 'handler' => 'views_handler_filter_string' |
|
| 307 | 307 | ), |
| 308 | 308 | 'sort' => array( |
| 309 | - 'handler' => 'views_handler_sort_string' |
|
| 309 | + 'handler' => 'views_handler_sort_string' |
|
| 310 | 310 | ) |
| 311 | - ); |
|
| 312 | - $data['host']['m_cache'] = array( |
|
| 311 | + ); |
|
| 312 | + $data['host']['m_cache'] = array( |
|
| 313 | 313 | 'title' => bts('Cache', array(), NULL, 'boinc:host-details'), |
| 314 | 314 | 'help' => t('The amount of cache on the processor(s).'), |
| 315 | 315 | 'field' => array( |
| 316 | - 'handler' => 'views_handler_field_numeric', |
|
| 317 | - 'click sortable' => TRUE |
|
| 316 | + 'handler' => 'views_handler_field_numeric', |
|
| 317 | + 'click sortable' => TRUE |
|
| 318 | 318 | ), |
| 319 | 319 | 'filter' => array( |
| 320 | - 'handler' => 'views_handler_filter_numeric' |
|
| 320 | + 'handler' => 'views_handler_filter_numeric' |
|
| 321 | 321 | ), |
| 322 | 322 | 'sort' => array( |
| 323 | - 'handler' => 'views_handler_sort_numeric' |
|
| 323 | + 'handler' => 'views_handler_sort_numeric' |
|
| 324 | 324 | ) |
| 325 | - ); |
|
| 326 | - $data['host']['m_nbytes'] = array( |
|
| 325 | + ); |
|
| 326 | + $data['host']['m_nbytes'] = array( |
|
| 327 | 327 | 'title' => bts('Memory', array(), NULL, 'boinc:host-details'), |
| 328 | 328 | 'help' => t('The amount of memory installed.'), |
| 329 | 329 | 'field' => array( |
| 330 | - 'handler' => 'views_handler_field_numeric', |
|
| 331 | - 'click sortable' => TRUE |
|
| 330 | + 'handler' => 'views_handler_field_numeric', |
|
| 331 | + 'click sortable' => TRUE |
|
| 332 | 332 | ), |
| 333 | 333 | 'filter' => array( |
| 334 | - 'handler' => 'views_handler_filter_numeric' |
|
| 334 | + 'handler' => 'views_handler_filter_numeric' |
|
| 335 | 335 | ), |
| 336 | 336 | 'sort' => array( |
| 337 | - 'handler' => 'views_handler_sort_numeric' |
|
| 337 | + 'handler' => 'views_handler_sort_numeric' |
|
| 338 | 338 | ) |
| 339 | - ); |
|
| 340 | - $data['host']['m_swap'] = array( |
|
| 339 | + ); |
|
| 340 | + $data['host']['m_swap'] = array( |
|
| 341 | 341 | 'title' => bts('Swap space', array(), NULL, 'boinc:host-details'), |
| 342 | 342 | 'help' => t('The amount of swap space configured.'), |
| 343 | 343 | 'field' => array( |
| 344 | - 'handler' => 'views_handler_field_numeric', |
|
| 345 | - 'click sortable' => TRUE |
|
| 344 | + 'handler' => 'views_handler_field_numeric', |
|
| 345 | + 'click sortable' => TRUE |
|
| 346 | 346 | ), |
| 347 | 347 | 'filter' => array( |
| 348 | - 'handler' => 'views_handler_filter_numeric' |
|
| 348 | + 'handler' => 'views_handler_filter_numeric' |
|
| 349 | 349 | ), |
| 350 | 350 | 'sort' => array( |
| 351 | - 'handler' => 'views_handler_sort_numeric' |
|
| 351 | + 'handler' => 'views_handler_sort_numeric' |
|
| 352 | 352 | ) |
| 353 | - ); |
|
| 354 | - $data['host']['max_results_day'] = array( |
|
| 353 | + ); |
|
| 354 | + $data['host']['max_results_day'] = array( |
|
| 355 | 355 | 'title' => bts('Maximum daily WU quota per CPU', array(), NULL, 'boinc:host-details'), |
| 356 | 356 | 'help' => t('The maximum number of workunits to be allocated per CPU.'), |
| 357 | 357 | 'field' => array( |
| 358 | - 'handler' => 'views_handler_field_numeric', |
|
| 359 | - 'click sortable' => TRUE |
|
| 358 | + 'handler' => 'views_handler_field_numeric', |
|
| 359 | + 'click sortable' => TRUE |
|
| 360 | 360 | ), |
| 361 | 361 | 'filter' => array( |
| 362 | - 'handler' => 'views_handler_filter_numeric' |
|
| 362 | + 'handler' => 'views_handler_filter_numeric' |
|
| 363 | 363 | ), |
| 364 | 364 | 'sort' => array( |
| 365 | - 'handler' => 'views_handler_sort_numeric' |
|
| 365 | + 'handler' => 'views_handler_sort_numeric' |
|
| 366 | 366 | ) |
| 367 | - ); |
|
| 368 | - $data['host']['n_bwdown'] = array( |
|
| 367 | + ); |
|
| 368 | + $data['host']['n_bwdown'] = array( |
|
| 369 | 369 | 'title' => bts('Average download rate', array(), NULL, 'boinc:host-details'), |
| 370 | 370 | 'help' => t('The average rate at which new work is downloaded.'), |
| 371 | 371 | 'field' => array( |
| 372 | - 'handler' => 'views_handler_field_numeric', |
|
| 373 | - 'click sortable' => TRUE, |
|
| 374 | - 'float' => TRUE |
|
| 372 | + 'handler' => 'views_handler_field_numeric', |
|
| 373 | + 'click sortable' => TRUE, |
|
| 374 | + 'float' => TRUE |
|
| 375 | 375 | ), |
| 376 | 376 | 'filter' => array( |
| 377 | - 'handler' => 'views_handler_filter_numeric' |
|
| 377 | + 'handler' => 'views_handler_filter_numeric' |
|
| 378 | 378 | ), |
| 379 | 379 | 'sort' => array( |
| 380 | - 'handler' => 'views_handler_sort_numeric' |
|
| 380 | + 'handler' => 'views_handler_sort_numeric' |
|
| 381 | 381 | ) |
| 382 | - ); |
|
| 383 | - $data['host']['n_bwup'] = array( |
|
| 382 | + ); |
|
| 383 | + $data['host']['n_bwup'] = array( |
|
| 384 | 384 | 'title' => bts('Average upload rate', array(), NULL, 'boinc:host-details'), |
| 385 | 385 | 'help' => t('The average rate at which completed work is uploaded.'), |
| 386 | 386 | 'field' => array( |
| 387 | - 'handler' => 'views_handler_field_numeric', |
|
| 388 | - 'click sortable' => TRUE, |
|
| 389 | - 'float' => TRUE |
|
| 387 | + 'handler' => 'views_handler_field_numeric', |
|
| 388 | + 'click sortable' => TRUE, |
|
| 389 | + 'float' => TRUE |
|
| 390 | 390 | ), |
| 391 | 391 | 'filter' => array( |
| 392 | - 'handler' => 'views_handler_filter_numeric' |
|
| 392 | + 'handler' => 'views_handler_filter_numeric' |
|
| 393 | 393 | ), |
| 394 | 394 | 'sort' => array( |
| 395 | - 'handler' => 'views_handler_sort_numeric' |
|
| 395 | + 'handler' => 'views_handler_sort_numeric' |
|
| 396 | 396 | ) |
| 397 | - ); |
|
| 398 | - $data['host']['nsame_ip_addr'] = array( |
|
| 397 | + ); |
|
| 398 | + $data['host']['nsame_ip_addr'] = array( |
|
| 399 | 399 | 'title' => bts('Same IP address count', array(), NULL, 'boinc:host-details'), |
| 400 | 400 | 'help' => t('The number of times the last IP address.'), |
| 401 | 401 | 'field' => array( |
| 402 | - 'handler' => 'views_handler_field', |
|
| 403 | - 'click sortable' => TRUE |
|
| 402 | + 'handler' => 'views_handler_field', |
|
| 403 | + 'click sortable' => TRUE |
|
| 404 | 404 | ), |
| 405 | 405 | 'filter' => array( |
| 406 | - 'handler' => 'views_handler_filter_string' |
|
| 406 | + 'handler' => 'views_handler_filter_string' |
|
| 407 | 407 | ), |
| 408 | 408 | 'sort' => array( |
| 409 | - 'handler' => 'views_handler_sort_string' |
|
| 409 | + 'handler' => 'views_handler_sort_string' |
|
| 410 | 410 | ) |
| 411 | - ); |
|
| 412 | - $data['host']['on_frac'] = array( |
|
| 411 | + ); |
|
| 412 | + $data['host']['on_frac'] = array( |
|
| 413 | 413 | 'title' => bts('% of time BOINC client is running', array(), NULL, 'boinc:host-details'), |
| 414 | 414 | 'help' => t('The percentage of time that the BOINC client is running.'), |
| 415 | 415 | 'field' => array( |
| 416 | - 'handler' => 'views_handler_field_numeric', |
|
| 417 | - 'click sortable' => TRUE, |
|
| 418 | - 'float' => TRUE |
|
| 416 | + 'handler' => 'views_handler_field_numeric', |
|
| 417 | + 'click sortable' => TRUE, |
|
| 418 | + 'float' => TRUE |
|
| 419 | 419 | ), |
| 420 | 420 | 'filter' => array( |
| 421 | - 'handler' => 'views_handler_filter_numeric' |
|
| 421 | + 'handler' => 'views_handler_filter_numeric' |
|
| 422 | 422 | ), |
| 423 | 423 | 'sort' => array( |
| 424 | - 'handler' => 'views_handler_sort_numeric' |
|
| 424 | + 'handler' => 'views_handler_sort_numeric' |
|
| 425 | 425 | ) |
| 426 | - ); |
|
| 427 | - $data['host']['os_name'] = array( |
|
| 426 | + ); |
|
| 427 | + $data['host']['os_name'] = array( |
|
| 428 | 428 | 'title' => bts('Operating system', array(), NULL, 'boinc:host-details'), |
| 429 | 429 | 'help' => t('The name of the host operating system.'), |
| 430 | 430 | 'field' => array( |
| 431 | - 'handler' => 'views_handler_field', |
|
| 432 | - 'click sortable' => TRUE |
|
| 431 | + 'handler' => 'views_handler_field', |
|
| 432 | + 'click sortable' => TRUE |
|
| 433 | 433 | ), |
| 434 | 434 | 'filter' => array( |
| 435 | - 'handler' => 'views_handler_filter_string' |
|
| 435 | + 'handler' => 'views_handler_filter_string' |
|
| 436 | 436 | ), |
| 437 | 437 | 'sort' => array( |
| 438 | - 'handler' => 'views_handler_sort_string' |
|
| 438 | + 'handler' => 'views_handler_sort_string' |
|
| 439 | 439 | ) |
| 440 | - ); |
|
| 441 | - $data['host']['os_version'] = array( |
|
| 440 | + ); |
|
| 441 | + $data['host']['os_version'] = array( |
|
| 442 | 442 | 'title' => bts('Operating system version', array(), NULL, 'boinc:host-details'), |
| 443 | 443 | 'help' => t('The version of the host operating system.'), |
| 444 | 444 | 'field' => array( |
| 445 | - 'handler' => 'views_handler_field', |
|
| 446 | - 'click sortable' => TRUE |
|
| 445 | + 'handler' => 'views_handler_field', |
|
| 446 | + 'click sortable' => TRUE |
|
| 447 | 447 | ), |
| 448 | 448 | 'filter' => array( |
| 449 | - 'handler' => 'views_handler_filter_string' |
|
| 449 | + 'handler' => 'views_handler_filter_string' |
|
| 450 | 450 | ), |
| 451 | 451 | 'sort' => array( |
| 452 | - 'handler' => 'views_handler_sort_string' |
|
| 452 | + 'handler' => 'views_handler_sort_string' |
|
| 453 | 453 | ) |
| 454 | - ); |
|
| 455 | - $data['host']['p_fpops'] = array( |
|
| 454 | + ); |
|
| 455 | + $data['host']['p_fpops'] = array( |
|
| 456 | 456 | 'title' => bts('Measured floating point speed', array(), NULL, 'boinc:host-details'), |
| 457 | 457 | 'help' => t('The capability of the host in floating point operations per second.'), |
| 458 | 458 | 'field' => array( |
| 459 | - 'handler' => 'views_handler_field_numeric', |
|
| 460 | - 'click sortable' => TRUE, |
|
| 461 | - 'float' => TRUE |
|
| 459 | + 'handler' => 'views_handler_field_numeric', |
|
| 460 | + 'click sortable' => TRUE, |
|
| 461 | + 'float' => TRUE |
|
| 462 | 462 | ), |
| 463 | 463 | 'filter' => array( |
| 464 | - 'handler' => 'views_handler_filter_numeric' |
|
| 464 | + 'handler' => 'views_handler_filter_numeric' |
|
| 465 | 465 | ), |
| 466 | 466 | 'sort' => array( |
| 467 | - 'handler' => 'views_handler_sort_numeric' |
|
| 467 | + 'handler' => 'views_handler_sort_numeric' |
|
| 468 | 468 | ) |
| 469 | - ); |
|
| 470 | - $data['host']['p_iops'] = array( |
|
| 469 | + ); |
|
| 470 | + $data['host']['p_iops'] = array( |
|
| 471 | 471 | 'title' => bts('Measured integer speed', array(), NULL, 'boinc:host-details'), |
| 472 | 472 | 'help' => t('The capability of the host in integer operations per second.'), |
| 473 | 473 | 'field' => array( |
| 474 | - 'handler' => 'views_handler_field_numeric', |
|
| 475 | - 'click sortable' => TRUE, |
|
| 476 | - 'float' => TRUE |
|
| 474 | + 'handler' => 'views_handler_field_numeric', |
|
| 475 | + 'click sortable' => TRUE, |
|
| 476 | + 'float' => TRUE |
|
| 477 | 477 | ), |
| 478 | 478 | 'filter' => array( |
| 479 | - 'handler' => 'views_handler_filter_numeric' |
|
| 479 | + 'handler' => 'views_handler_filter_numeric' |
|
| 480 | 480 | ), |
| 481 | 481 | 'sort' => array( |
| 482 | - 'handler' => 'views_handler_sort_numeric' |
|
| 482 | + 'handler' => 'views_handler_sort_numeric' |
|
| 483 | 483 | ) |
| 484 | - ); |
|
| 485 | - $data['host']['p_model'] = array( |
|
| 484 | + ); |
|
| 485 | + $data['host']['p_model'] = array( |
|
| 486 | 486 | 'title' => bts('CPU model', array(), NULL, 'boinc:host-details'), |
| 487 | 487 | 'help' => t('The model of the CPU in the host.'), |
| 488 | 488 | 'field' => array( |
| 489 | - 'handler' => 'views_handler_field', |
|
| 490 | - 'click sortable' => TRUE |
|
| 489 | + 'handler' => 'views_handler_field', |
|
| 490 | + 'click sortable' => TRUE |
|
| 491 | 491 | ), |
| 492 | 492 | 'filter' => array( |
| 493 | - 'handler' => 'views_handler_filter_string' |
|
| 493 | + 'handler' => 'views_handler_filter_string' |
|
| 494 | 494 | ), |
| 495 | 495 | 'sort' => array( |
| 496 | - 'handler' => 'views_handler_sort_string' |
|
| 496 | + 'handler' => 'views_handler_sort_string' |
|
| 497 | 497 | ) |
| 498 | - ); |
|
| 499 | - $data['host']['p_ncpus'] = array( |
|
| 498 | + ); |
|
| 499 | + $data['host']['p_ncpus'] = array( |
|
| 500 | 500 | 'title' => bts('Number of processors', array(), NULL, 'boinc:host-details'), |
| 501 | 501 | 'help' => t('The count of CPU cores in the system.'), |
| 502 | 502 | 'field' => array( |
| 503 | - 'handler' => 'views_handler_field', |
|
| 504 | - 'click sortable' => TRUE |
|
| 503 | + 'handler' => 'views_handler_field', |
|
| 504 | + 'click sortable' => TRUE |
|
| 505 | 505 | ), |
| 506 | 506 | 'filter' => array( |
| 507 | - 'handler' => 'views_handler_filter_string' |
|
| 507 | + 'handler' => 'views_handler_filter_string' |
|
| 508 | 508 | ), |
| 509 | 509 | 'sort' => array( |
| 510 | - 'handler' => 'views_handler_sort_string' |
|
| 510 | + 'handler' => 'views_handler_sort_string' |
|
| 511 | 511 | ) |
| 512 | - ); |
|
| 513 | - $data['host']['p_vendor'] = array( |
|
| 512 | + ); |
|
| 513 | + $data['host']['p_vendor'] = array( |
|
| 514 | 514 | 'title' => bts('CPU', array(), NULL, 'boinc:host-details'), |
| 515 | 515 | 'help' => t('The manufacturer of the CPU in the host.'), |
| 516 | 516 | 'field' => array( |
| 517 | - 'handler' => 'views_handler_field', |
|
| 518 | - 'click sortable' => TRUE |
|
| 517 | + 'handler' => 'views_handler_field', |
|
| 518 | + 'click sortable' => TRUE |
|
| 519 | 519 | ), |
| 520 | 520 | 'filter' => array( |
| 521 | - 'handler' => 'views_handler_filter_string' |
|
| 521 | + 'handler' => 'views_handler_filter_string' |
|
| 522 | 522 | ), |
| 523 | 523 | 'sort' => array( |
| 524 | - 'handler' => 'views_handler_sort_string' |
|
| 524 | + 'handler' => 'views_handler_sort_string' |
|
| 525 | 525 | ) |
| 526 | - ); |
|
| 527 | - $data['host']['rpc_seqno'] = array( |
|
| 526 | + ); |
|
| 527 | + $data['host']['rpc_seqno'] = array( |
|
| 528 | 528 | 'title' => bts('Number of times client has contacted server', array(), NULL, 'boinc:host-details'), |
| 529 | 529 | 'help' => t('The number of times the client has contacted the server.'), |
| 530 | 530 | 'field' => array( |
| 531 | - 'handler' => 'views_handler_field_numeric', |
|
| 532 | - 'click sortable' => TRUE |
|
| 531 | + 'handler' => 'views_handler_field_numeric', |
|
| 532 | + 'click sortable' => TRUE |
|
| 533 | 533 | ), |
| 534 | 534 | 'filter' => array( |
| 535 | - 'handler' => 'views_handler_filter_numeric' |
|
| 535 | + 'handler' => 'views_handler_filter_numeric' |
|
| 536 | 536 | ), |
| 537 | 537 | 'sort' => array( |
| 538 | - 'handler' => 'views_handler_sort_numeric' |
|
| 538 | + 'handler' => 'views_handler_sort_numeric' |
|
| 539 | 539 | ) |
| 540 | - ); |
|
| 541 | - $data['host']['rpc_time'] = array( |
|
| 540 | + ); |
|
| 541 | + $data['host']['rpc_time'] = array( |
|
| 542 | 542 | 'title' => bts('Last contact', array(), NULL, 'boinc:host-details'), |
| 543 | 543 | 'help' => t('The time of the last RPC contact with the host.'), |
| 544 | 544 | 'field' => array( |
| 545 | - 'handler' => 'views_handler_field_date', |
|
| 546 | - 'click sortable' => TRUE |
|
| 545 | + 'handler' => 'views_handler_field_date', |
|
| 546 | + 'click sortable' => TRUE |
|
| 547 | 547 | ), |
| 548 | 548 | 'filter' => array( |
| 549 | - 'handler' => 'views_handler_filter_date' |
|
| 549 | + 'handler' => 'views_handler_filter_date' |
|
| 550 | 550 | ), |
| 551 | 551 | 'sort' => array( |
| 552 | - 'handler' => 'views_handler_sort_date' |
|
| 552 | + 'handler' => 'views_handler_sort_date' |
|
| 553 | 553 | ) |
| 554 | - ); |
|
| 555 | - $data['host']['serialnum'] = array( |
|
| 554 | + ); |
|
| 555 | + $data['host']['serialnum'] = array( |
|
| 556 | 556 | 'title' => bts('Serial number', array(), NULL, 'boinc:host-details'), |
| 557 | 557 | 'help' => t('Contains the release number of the BOINC application in use and the GPU of the host.'), |
| 558 | 558 | 'field' => array( |
| 559 | - 'handler' => 'views_handler_field', |
|
| 560 | - 'click sortable' => TRUE |
|
| 559 | + 'handler' => 'views_handler_field', |
|
| 560 | + 'click sortable' => TRUE |
|
| 561 | 561 | ), |
| 562 | 562 | 'filter' => array( |
| 563 | - 'handler' => 'views_handler_filter_string' |
|
| 563 | + 'handler' => 'views_handler_filter_string' |
|
| 564 | 564 | ), |
| 565 | 565 | 'sort' => array( |
| 566 | - 'handler' => 'views_handler_sort_string' |
|
| 566 | + 'handler' => 'views_handler_sort_string' |
|
| 567 | 567 | ) |
| 568 | - ); |
|
| 569 | - $data['host']['timezone'] = array( |
|
| 568 | + ); |
|
| 569 | + $data['host']['timezone'] = array( |
|
| 570 | 570 | 'title' => bts('Timezone', array(), NULL, 'boinc:host-details'), |
| 571 | 571 | 'help' => t('The UTC offset of the local time.'), |
| 572 | 572 | 'field' => array( |
| 573 | - 'handler' => 'views_handler_field_numeric', |
|
| 574 | - 'click sortable' => TRUE |
|
| 573 | + 'handler' => 'views_handler_field_numeric', |
|
| 574 | + 'click sortable' => TRUE |
|
| 575 | 575 | ), |
| 576 | 576 | 'filter' => array( |
| 577 | - 'handler' => 'views_handler_filter_numeric' |
|
| 577 | + 'handler' => 'views_handler_filter_numeric' |
|
| 578 | 578 | ), |
| 579 | 579 | 'sort' => array( |
| 580 | - 'handler' => 'views_handler_sort_numeric' |
|
| 580 | + 'handler' => 'views_handler_sort_numeric' |
|
| 581 | 581 | ) |
| 582 | - ); |
|
| 583 | - $data['host']['total_credit'] = array( |
|
| 582 | + ); |
|
| 583 | + $data['host']['total_credit'] = array( |
|
| 584 | 584 | 'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'), |
| 585 | 585 | 'help' => t('The total accumulated BOINC credit for a host.'), |
| 586 | 586 | 'field' => array( |
| 587 | - 'handler' => 'views_handler_field_numeric', |
|
| 588 | - 'click sortable' => TRUE, |
|
| 589 | - 'float' => TRUE |
|
| 587 | + 'handler' => 'views_handler_field_numeric', |
|
| 588 | + 'click sortable' => TRUE, |
|
| 589 | + 'float' => TRUE |
|
| 590 | 590 | ), |
| 591 | 591 | 'filter' => array( |
| 592 | - 'handler' => 'views_handler_filter_numeric' |
|
| 592 | + 'handler' => 'views_handler_filter_numeric' |
|
| 593 | 593 | ), |
| 594 | 594 | 'sort' => array( |
| 595 | - 'handler' => 'views_handler_sort_numeric' |
|
| 595 | + 'handler' => 'views_handler_sort_numeric' |
|
| 596 | 596 | ) |
| 597 | - ); |
|
| 597 | + ); |
|
| 598 | 598 | |
| 599 | - // ------------------------------------------------------------------------------------------------ |
|
| 600 | - // Definition for platform table |
|
| 601 | - // ------------------------------------------------------------------------------------------------ |
|
| 599 | + // ------------------------------------------------------------------------------------------------ |
|
| 600 | + // Definition for platform table |
|
| 601 | + // ------------------------------------------------------------------------------------------------ |
|
| 602 | 602 | |
| 603 | - $data['platform']['table']['group'] = t('BOINC'); |
|
| 604 | - $data['platform']['table']['base'] = array( |
|
| 605 | - 'field' => 'id', |
|
| 606 | - 'title' => t('BOINC platform'), |
|
| 607 | - 'help' => t('Operating system platforms'), |
|
| 608 | - 'database' => 'boinc_ro' |
|
| 609 | - ); |
|
| 603 | + $data['platform']['table']['group'] = t('BOINC'); |
|
| 604 | + $data['platform']['table']['base'] = array( |
|
| 605 | + 'field' => 'id', |
|
| 606 | + 'title' => t('BOINC platform'), |
|
| 607 | + 'help' => t('Operating system platforms'), |
|
| 608 | + 'database' => 'boinc_ro' |
|
| 609 | + ); |
|
| 610 | 610 | |
| 611 | - // Primary keys allowed as arguments |
|
| 611 | + // Primary keys allowed as arguments |
|
| 612 | 612 | |
| 613 | - $data['platform']['id'] = array( |
|
| 613 | + $data['platform']['id'] = array( |
|
| 614 | 614 | 'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'), |
| 615 | 615 | 'help' => t('The ID number of the platform.'), |
| 616 | 616 | 'field' => array( |
| 617 | - 'handler' => 'views_handler_field_numeric', |
|
| 618 | - 'click sortable' => TRUE |
|
| 617 | + 'handler' => 'views_handler_field_numeric', |
|
| 618 | + 'click sortable' => TRUE |
|
| 619 | 619 | ), |
| 620 | 620 | 'argument' => array( |
| 621 | - 'handler' => 'views_handler_argument', |
|
| 622 | - 'name field' => 'title', |
|
| 623 | - 'numeric' => TRUE, |
|
| 624 | - 'validate type' => 'id' |
|
| 621 | + 'handler' => 'views_handler_argument', |
|
| 622 | + 'name field' => 'title', |
|
| 623 | + 'numeric' => TRUE, |
|
| 624 | + 'validate type' => 'id' |
|
| 625 | 625 | ), |
| 626 | 626 | 'filter' => array( |
| 627 | - 'handler' => 'views_handler_filter_numeric' |
|
| 627 | + 'handler' => 'views_handler_filter_numeric' |
|
| 628 | 628 | ), |
| 629 | 629 | 'sort' => array( |
| 630 | - 'handler' => 'views_handler_sort_numeric' |
|
| 630 | + 'handler' => 'views_handler_sort_numeric' |
|
| 631 | 631 | ) |
| 632 | - ); |
|
| 632 | + ); |
|
| 633 | 633 | |
| 634 | - // Descriptions of app fields (alphabetized) |
|
| 634 | + // Descriptions of app fields (alphabetized) |
|
| 635 | 635 | |
| 636 | - $data['platform']['name'] = array( |
|
| 636 | + $data['platform']['name'] = array( |
|
| 637 | 637 | 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
| 638 | 638 | 'help' => t('The name of the platform.'), |
| 639 | 639 | 'field' => array( |
| 640 | - 'handler' => 'views_handler_field', |
|
| 641 | - 'click sortable' => TRUE |
|
| 640 | + 'handler' => 'views_handler_field', |
|
| 641 | + 'click sortable' => TRUE |
|
| 642 | 642 | ), |
| 643 | 643 | 'filter' => array( |
| 644 | - 'handler' => 'views_handler_filter_string' |
|
| 644 | + 'handler' => 'views_handler_filter_string' |
|
| 645 | 645 | ), |
| 646 | 646 | 'sort' => array( |
| 647 | - 'handler' => 'views_handler_sort_string' |
|
| 647 | + 'handler' => 'views_handler_sort_string' |
|
| 648 | 648 | ) |
| 649 | - ); |
|
| 649 | + ); |
|
| 650 | 650 | |
| 651 | - // ------------------------------------------------------------------------------------------------ |
|
| 652 | - // Definition for result (task) table |
|
| 653 | - // ------------------------------------------------------------------------------------------------ |
|
| 651 | + // ------------------------------------------------------------------------------------------------ |
|
| 652 | + // Definition for result (task) table |
|
| 653 | + // ------------------------------------------------------------------------------------------------ |
|
| 654 | 654 | |
| 655 | - $data['result']['table']['group'] = t('BOINC'); |
|
| 656 | - $data['result']['table']['base'] = array( |
|
| 657 | - 'field' => 'id', |
|
| 658 | - 'title' => t('BOINC result'), |
|
| 659 | - 'help' => t('Results produced by BOINC'), |
|
| 660 | - 'database' => 'boinc_ro' |
|
| 661 | - ); |
|
| 655 | + $data['result']['table']['group'] = t('BOINC'); |
|
| 656 | + $data['result']['table']['base'] = array( |
|
| 657 | + 'field' => 'id', |
|
| 658 | + 'title' => t('BOINC result'), |
|
| 659 | + 'help' => t('Results produced by BOINC'), |
|
| 660 | + 'database' => 'boinc_ro' |
|
| 661 | + ); |
|
| 662 | 662 | |
| 663 | - // Create implicit relationships to the user, workunit, and host tables |
|
| 663 | + // Create implicit relationships to the user, workunit, and host tables |
|
| 664 | 664 | |
| 665 | - $data['result']['table']['join'] = array( |
|
| 665 | + $data['result']['table']['join'] = array( |
|
| 666 | 666 | 'user' => array( |
| 667 | - 'left_field' => 'id', |
|
| 668 | - 'field' => 'userid' |
|
| 667 | + 'left_field' => 'id', |
|
| 668 | + 'field' => 'userid' |
|
| 669 | 669 | ), |
| 670 | 670 | 'workunit' => array( |
| 671 | - 'left_field' => 'id', |
|
| 672 | - 'field' => 'workunitid' |
|
| 671 | + 'left_field' => 'id', |
|
| 672 | + 'field' => 'workunitid' |
|
| 673 | 673 | ), |
| 674 | 674 | 'host' => array( |
| 675 | - 'left_field' => 'id', |
|
| 676 | - 'field' => 'hostid' |
|
| 675 | + 'left_field' => 'id', |
|
| 676 | + 'field' => 'hostid' |
|
| 677 | 677 | ) |
| 678 | - ); |
|
| 678 | + ); |
|
| 679 | 679 | |
| 680 | - // Primary keys allowed as arguments |
|
| 680 | + // Primary keys allowed as arguments |
|
| 681 | 681 | |
| 682 | - $data['result']['id'] = array( |
|
| 682 | + $data['result']['id'] = array( |
|
| 683 | 683 | 'title' => bts('Task ID', array(), NULL, 'boinc:task-details'), |
| 684 | 684 | 'help' => t('The ID number of this result.'), |
| 685 | 685 | 'field' => array( |
| 686 | - 'handler' => 'views_handler_field_numeric', |
|
| 687 | - 'click sortable' => TRUE |
|
| 686 | + 'handler' => 'views_handler_field_numeric', |
|
| 687 | + 'click sortable' => TRUE |
|
| 688 | 688 | ), |
| 689 | 689 | 'argument' => array( |
| 690 | - 'handler' => 'views_handler_argument', |
|
| 691 | - 'name field' => 'title', |
|
| 692 | - 'numeric' => TRUE, |
|
| 693 | - 'validate type' => 'id' |
|
| 690 | + 'handler' => 'views_handler_argument', |
|
| 691 | + 'name field' => 'title', |
|
| 692 | + 'numeric' => TRUE, |
|
| 693 | + 'validate type' => 'id' |
|
| 694 | 694 | ), |
| 695 | 695 | 'filter' => array( |
| 696 | - 'handler' => 'views_handler_filter_numeric' |
|
| 696 | + 'handler' => 'views_handler_filter_numeric' |
|
| 697 | 697 | ), |
| 698 | 698 | 'sort' => array( |
| 699 | - 'handler' => 'views_handler_sort_numeric' |
|
| 699 | + 'handler' => 'views_handler_sort_numeric' |
|
| 700 | 700 | ) |
| 701 | - ); |
|
| 701 | + ); |
|
| 702 | 702 | |
| 703 | - // Foreign key fields |
|
| 703 | + // Foreign key fields |
|
| 704 | 704 | |
| 705 | - $data['result']['userid'] = array( |
|
| 705 | + $data['result']['userid'] = array( |
|
| 706 | 706 | 'title' => bts('User ID', array(), NULL, 'boinc:user-details'), |
| 707 | 707 | 'help' => t('The owner of this result.'), |
| 708 | 708 | // Foreign key to the {user} table |
| 709 | 709 | 'argument' => array( |
| 710 | - 'handler' => 'views_handler_argument_boincuser_id', |
|
| 711 | - 'name field' => 'title', |
|
| 712 | - 'numeric' => TRUE, |
|
| 713 | - 'validate type' => 'id' |
|
| 710 | + 'handler' => 'views_handler_argument_boincuser_id', |
|
| 711 | + 'name field' => 'title', |
|
| 712 | + 'numeric' => TRUE, |
|
| 713 | + 'validate type' => 'id' |
|
| 714 | 714 | ), |
| 715 | 715 | 'relationship' => array( |
| 716 | - 'base' => 'user', |
|
| 717 | - 'field' => 'userid', |
|
| 718 | - 'handler' => 'views_handler_relationship', |
|
| 719 | - 'label' => t('User') |
|
| 716 | + 'base' => 'user', |
|
| 717 | + 'field' => 'userid', |
|
| 718 | + 'handler' => 'views_handler_relationship', |
|
| 719 | + 'label' => t('User') |
|
| 720 | 720 | ) |
| 721 | - ); |
|
| 722 | - $data['result']['workunitid'] = array( |
|
| 721 | + ); |
|
| 722 | + $data['result']['workunitid'] = array( |
|
| 723 | 723 | 'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'), |
| 724 | 724 | 'help' => t('The workunit associated with this result.'), |
| 725 | 725 | // Foreign key to the {workunit} table |
| 726 | 726 | 'argument' => array( |
| 727 | - 'handler' => 'views_handler_argument', |
|
| 728 | - 'name field' => 'title', |
|
| 729 | - 'numeric' => TRUE, |
|
| 730 | - 'validate type' => 'id' |
|
| 727 | + 'handler' => 'views_handler_argument', |
|
| 728 | + 'name field' => 'title', |
|
| 729 | + 'numeric' => TRUE, |
|
| 730 | + 'validate type' => 'id' |
|
| 731 | 731 | ), |
| 732 | 732 | 'relationship' => array( |
| 733 | - 'base' => 'workunit', |
|
| 734 | - 'field' => 'workunitid', |
|
| 735 | - 'handler' => 'views_handler_relationship', |
|
| 736 | - 'label' => t('Workunit') |
|
| 733 | + 'base' => 'workunit', |
|
| 734 | + 'field' => 'workunitid', |
|
| 735 | + 'handler' => 'views_handler_relationship', |
|
| 736 | + 'label' => t('Workunit') |
|
| 737 | 737 | ), |
| 738 | 738 | 'field' => array( |
| 739 | - 'handler' => 'views_handler_field_numeric', |
|
| 740 | - 'click sortable' => TRUE |
|
| 739 | + 'handler' => 'views_handler_field_numeric', |
|
| 740 | + 'click sortable' => TRUE |
|
| 741 | 741 | ), |
| 742 | 742 | 'filter' => array( |
| 743 | - 'handler' => 'views_handler_filter_numeric' |
|
| 743 | + 'handler' => 'views_handler_filter_numeric' |
|
| 744 | 744 | ), |
| 745 | 745 | 'sort' => array( |
| 746 | - 'handler' => 'views_handler_sort_numeric' |
|
| 746 | + 'handler' => 'views_handler_sort_numeric' |
|
| 747 | 747 | ) |
| 748 | - ); |
|
| 749 | - $data['result']['hostid'] = array( |
|
| 748 | + ); |
|
| 749 | + $data['result']['hostid'] = array( |
|
| 750 | 750 | 'title' => bts('Host ID', array(), NULL, 'boinc:task-details'), |
| 751 | 751 | 'help' => t('The host associated with this result.'), |
| 752 | 752 | // Foreign key to the {host} table |
| 753 | 753 | 'argument' => array( |
| 754 | - 'handler' => 'views_handler_argument', |
|
| 755 | - 'name field' => 'title', |
|
| 756 | - 'numeric' => TRUE, |
|
| 757 | - 'validate type' => 'id' |
|
| 754 | + 'handler' => 'views_handler_argument', |
|
| 755 | + 'name field' => 'title', |
|
| 756 | + 'numeric' => TRUE, |
|
| 757 | + 'validate type' => 'id' |
|
| 758 | 758 | ), |
| 759 | 759 | 'relationship' => array( |
| 760 | - 'base' => 'host', |
|
| 761 | - 'field' => 'hostid', |
|
| 762 | - 'handler' => 'views_handler_relationship', |
|
| 763 | - 'label' => t('Host') |
|
| 760 | + 'base' => 'host', |
|
| 761 | + 'field' => 'hostid', |
|
| 762 | + 'handler' => 'views_handler_relationship', |
|
| 763 | + 'label' => t('Host') |
|
| 764 | 764 | ), |
| 765 | 765 | 'field' => array( |
| 766 | - 'handler' => 'views_handler_field_numeric', |
|
| 767 | - 'click sortable' => TRUE |
|
| 766 | + 'handler' => 'views_handler_field_numeric', |
|
| 767 | + 'click sortable' => TRUE |
|
| 768 | 768 | ), |
| 769 | 769 | 'filter' => array( |
| 770 | - 'handler' => 'views_handler_filter_numeric' |
|
| 770 | + 'handler' => 'views_handler_filter_numeric' |
|
| 771 | 771 | ), |
| 772 | 772 | 'sort' => array( |
| 773 | - 'handler' => 'views_handler_sort_numeric' |
|
| 773 | + 'handler' => 'views_handler_sort_numeric' |
|
| 774 | 774 | ) |
| 775 | - ); |
|
| 775 | + ); |
|
| 776 | 776 | |
| 777 | - // Descriptions of result fields (alphabetized) |
|
| 777 | + // Descriptions of result fields (alphabetized) |
|
| 778 | 778 | |
| 779 | - $data['result']['appid'] = array( |
|
| 779 | + $data['result']['appid'] = array( |
|
| 780 | 780 | 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
| 781 | 781 | 'help' => t('The ID number of the application.'), |
| 782 | 782 | 'field' => array( |
| 783 | - 'handler' => 'views_handler_field_numeric', |
|
| 784 | - 'click sortable' => TRUE |
|
| 783 | + 'handler' => 'views_handler_field_numeric', |
|
| 784 | + 'click sortable' => TRUE |
|
| 785 | 785 | ), |
| 786 | 786 | 'filter' => array( |
| 787 | - 'handler' => 'views_handler_filter_numeric' |
|
| 787 | + 'handler' => 'views_handler_filter_numeric' |
|
| 788 | 788 | ), |
| 789 | 789 | 'sort' => array( |
| 790 | - 'handler' => 'views_handler_sort_numeric' |
|
| 790 | + 'handler' => 'views_handler_sort_numeric' |
|
| 791 | 791 | ) |
| 792 | - ); |
|
| 793 | - $data['result']['app_version_id'] = array( |
|
| 792 | + ); |
|
| 793 | + $data['result']['app_version_id'] = array( |
|
| 794 | 794 | 'title' => bts('Application version', array(), NULL, 'boinc:task-details'), |
| 795 | 795 | 'help' => t('The version number of the application.'), |
| 796 | 796 | 'field' => array( |
| 797 | - 'handler' => 'views_handler_field_numeric', |
|
| 798 | - 'click sortable' => TRUE |
|
| 797 | + 'handler' => 'views_handler_field_numeric', |
|
| 798 | + 'click sortable' => TRUE |
|
| 799 | 799 | ), |
| 800 | 800 | 'filter' => array( |
| 801 | - 'handler' => 'views_handler_filter_numeric' |
|
| 801 | + 'handler' => 'views_handler_filter_numeric' |
|
| 802 | 802 | ), |
| 803 | 803 | 'sort' => array( |
| 804 | - 'handler' => 'views_handler_sort_numeric' |
|
| 804 | + 'handler' => 'views_handler_sort_numeric' |
|
| 805 | 805 | ) |
| 806 | - ); |
|
| 807 | - $data['result']['claimed_credit'] = array( |
|
| 806 | + ); |
|
| 807 | + $data['result']['claimed_credit'] = array( |
|
| 808 | 808 | 'title' => bts('Claimed credit', array(), NULL, 'boinc:task-details'), |
| 809 | 809 | 'help' => t('The credit claimed for this result.'), |
| 810 | 810 | 'field' => array( |
| 811 | - 'handler' => 'views_handler_field_numeric', |
|
| 812 | - 'click sortable' => TRUE, |
|
| 813 | - 'float' => TRUE |
|
| 811 | + 'handler' => 'views_handler_field_numeric', |
|
| 812 | + 'click sortable' => TRUE, |
|
| 813 | + 'float' => TRUE |
|
| 814 | 814 | ), |
| 815 | 815 | 'filter' => array( |
| 816 | - 'handler' => 'views_handler_filter_numeric' |
|
| 816 | + 'handler' => 'views_handler_filter_numeric' |
|
| 817 | 817 | ), |
| 818 | 818 | 'sort' => array( |
| 819 | - 'handler' => 'views_handler_sort_numeric' |
|
| 819 | + 'handler' => 'views_handler_sort_numeric' |
|
| 820 | 820 | ) |
| 821 | - ); |
|
| 822 | - $data['result']['client_state'] = array( |
|
| 821 | + ); |
|
| 822 | + $data['result']['client_state'] = array( |
|
| 823 | 823 | 'title' => bts('Client state', array(), NULL, 'boinc:task-details'), |
| 824 | 824 | 'help' => t('The state of the task on the client side.'), |
| 825 | 825 | 'field' => array( |
| 826 | - 'handler' => 'views_handler_field_numeric', |
|
| 827 | - 'click sortable' => TRUE |
|
| 826 | + 'handler' => 'views_handler_field_numeric', |
|
| 827 | + 'click sortable' => TRUE |
|
| 828 | 828 | ), |
| 829 | 829 | 'filter' => array( |
| 830 | - 'handler' => 'views_handler_filter_numeric' |
|
| 830 | + 'handler' => 'views_handler_filter_numeric' |
|
| 831 | 831 | ), |
| 832 | 832 | 'sort' => array( |
| 833 | - 'handler' => 'views_handler_sort_numeric' |
|
| 833 | + 'handler' => 'views_handler_sort_numeric' |
|
| 834 | 834 | ) |
| 835 | - ); |
|
| 836 | - $data['result']['cpu_time'] = array( |
|
| 835 | + ); |
|
| 836 | + $data['result']['cpu_time'] = array( |
|
| 837 | 837 | 'title' => bts('CPU time', array(), NULL, 'boinc:task-details'), |
| 838 | 838 | 'help' => t('The CPU time spent on the task.'), |
| 839 | 839 | 'field' => array( |
| 840 | - 'handler' => 'views_handler_field_numeric', |
|
| 841 | - 'click sortable' => TRUE, |
|
| 842 | - 'float' => TRUE |
|
| 840 | + 'handler' => 'views_handler_field_numeric', |
|
| 841 | + 'click sortable' => TRUE, |
|
| 842 | + 'float' => TRUE |
|
| 843 | 843 | ), |
| 844 | 844 | 'filter' => array( |
| 845 | - 'handler' => 'views_handler_filter_numeric' |
|
| 845 | + 'handler' => 'views_handler_filter_numeric' |
|
| 846 | 846 | ), |
| 847 | 847 | 'sort' => array( |
| 848 | - 'handler' => 'views_handler_sort_numeric' |
|
| 848 | + 'handler' => 'views_handler_sort_numeric' |
|
| 849 | 849 | ) |
| 850 | - ); |
|
| 851 | - $data['result']['create_time'] = array( |
|
| 850 | + ); |
|
| 851 | + $data['result']['create_time'] = array( |
|
| 852 | 852 | 'title' => bts('Created', array(), NULL, 'boinc:task-details:-1:ignoreoverwrite'), |
| 853 | 853 | 'help' => t('The time that the task was created.'), |
| 854 | 854 | 'field' => array( |
| 855 | - 'handler' => 'views_handler_field_date', |
|
| 856 | - 'click sortable' => TRUE |
|
| 855 | + 'handler' => 'views_handler_field_date', |
|
| 856 | + 'click sortable' => TRUE |
|
| 857 | 857 | ), |
| 858 | 858 | 'filter' => array( |
| 859 | - 'handler' => 'views_handler_filter_date' |
|
| 859 | + 'handler' => 'views_handler_filter_date' |
|
| 860 | 860 | ), |
| 861 | 861 | 'sort' => array( |
| 862 | - 'handler' => 'views_handler_sort_date' |
|
| 862 | + 'handler' => 'views_handler_sort_date' |
|
| 863 | 863 | ) |
| 864 | - ); |
|
| 865 | - $data['result']['elapsed_time'] = array( |
|
| 864 | + ); |
|
| 865 | + $data['result']['elapsed_time'] = array( |
|
| 866 | 866 | 'title' => bts('Run time', array(), NULL, 'boinc:task-details'), |
| 867 | 867 | 'help' => t('The run time of the task.'), |
| 868 | 868 | 'field' => array( |
| 869 | - 'handler' => 'views_handler_field_numeric', |
|
| 870 | - 'click sortable' => TRUE, |
|
| 871 | - 'float' => TRUE |
|
| 869 | + 'handler' => 'views_handler_field_numeric', |
|
| 870 | + 'click sortable' => TRUE, |
|
| 871 | + 'float' => TRUE |
|
| 872 | 872 | ), |
| 873 | 873 | 'filter' => array( |
| 874 | - 'handler' => 'views_handler_filter_numeric' |
|
| 874 | + 'handler' => 'views_handler_filter_numeric' |
|
| 875 | 875 | ), |
| 876 | 876 | 'sort' => array( |
| 877 | - 'handler' => 'views_handler_sort_numeric' |
|
| 877 | + 'handler' => 'views_handler_sort_numeric' |
|
| 878 | 878 | ) |
| 879 | - ); |
|
| 880 | - $data['result']['exit_status'] = array( |
|
| 879 | + ); |
|
| 880 | + $data['result']['exit_status'] = array( |
|
| 881 | 881 | 'title' => bts('Exit status', array(), NULL, 'boinc:task-details'), |
| 882 | 882 | 'help' => t('The exit code of the task.'), |
| 883 | 883 | 'field' => array( |
| 884 | - 'handler' => 'views_handler_field_numeric', |
|
| 885 | - 'click sortable' => TRUE |
|
| 884 | + 'handler' => 'views_handler_field_numeric', |
|
| 885 | + 'click sortable' => TRUE |
|
| 886 | 886 | ), |
| 887 | 887 | 'filter' => array( |
| 888 | - 'handler' => 'views_handler_filter_numeric' |
|
| 888 | + 'handler' => 'views_handler_filter_numeric' |
|
| 889 | 889 | ), |
| 890 | 890 | 'sort' => array( |
| 891 | - 'handler' => 'views_handler_sort_numeric' |
|
| 891 | + 'handler' => 'views_handler_sort_numeric' |
|
| 892 | 892 | ) |
| 893 | - ); |
|
| 894 | - $data['result']['granted_credit'] = array( |
|
| 893 | + ); |
|
| 894 | + $data['result']['granted_credit'] = array( |
|
| 895 | 895 | 'title' => bts('Granted credit', array(), NULL, 'boinc:task-details'), |
| 896 | 896 | 'help' => t('The credit granted for this result.'), |
| 897 | 897 | 'field' => array( |
| 898 | - 'handler' => 'views_handler_field_numeric', |
|
| 899 | - 'click sortable' => TRUE, |
|
| 900 | - 'float' => TRUE |
|
| 898 | + 'handler' => 'views_handler_field_numeric', |
|
| 899 | + 'click sortable' => TRUE, |
|
| 900 | + 'float' => TRUE |
|
| 901 | 901 | ), |
| 902 | 902 | 'filter' => array( |
| 903 | - 'handler' => 'views_handler_filter_numeric' |
|
| 903 | + 'handler' => 'views_handler_filter_numeric' |
|
| 904 | 904 | ), |
| 905 | 905 | 'sort' => array( |
| 906 | - 'handler' => 'views_handler_sort_numeric' |
|
| 906 | + 'handler' => 'views_handler_sort_numeric' |
|
| 907 | 907 | ) |
| 908 | - ); |
|
| 909 | - $data['result']['name'] = array( |
|
| 908 | + ); |
|
| 909 | + $data['result']['name'] = array( |
|
| 910 | 910 | 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
| 911 | 911 | 'help' => t('The name of the task.'), |
| 912 | 912 | 'field' => array( |
| 913 | - 'handler' => 'views_handler_field', |
|
| 914 | - 'click sortable' => TRUE |
|
| 913 | + 'handler' => 'views_handler_field', |
|
| 914 | + 'click sortable' => TRUE |
|
| 915 | 915 | ), |
| 916 | 916 | 'filter' => array( |
| 917 | - 'handler' => 'views_handler_filter_string' |
|
| 917 | + 'handler' => 'views_handler_filter_string' |
|
| 918 | 918 | ), |
| 919 | 919 | 'sort' => array( |
| 920 | - 'handler' => 'views_handler_sort_string' |
|
| 920 | + 'handler' => 'views_handler_sort_string' |
|
| 921 | 921 | ) |
| 922 | - ); |
|
| 923 | - $data['result']['outcome'] = array( |
|
| 922 | + ); |
|
| 923 | + $data['result']['outcome'] = array( |
|
| 924 | 924 | 'title' => bts('Outcome', array(), NULL, 'boinc:task-details'), |
| 925 | 925 | 'help' => t('The outcome of the task.'), |
| 926 | 926 | 'field' => array( |
| 927 | - 'handler' => 'views_handler_field_numeric', |
|
| 928 | - 'click sortable' => TRUE |
|
| 927 | + 'handler' => 'views_handler_field_numeric', |
|
| 928 | + 'click sortable' => TRUE |
|
| 929 | 929 | ), |
| 930 | 930 | 'filter' => array( |
| 931 | - 'handler' => 'views_handler_filter_numeric' |
|
| 931 | + 'handler' => 'views_handler_filter_numeric' |
|
| 932 | 932 | ), |
| 933 | 933 | 'sort' => array( |
| 934 | - 'handler' => 'views_handler_sort_numeric' |
|
| 934 | + 'handler' => 'views_handler_sort_numeric' |
|
| 935 | 935 | ) |
| 936 | - ); |
|
| 937 | - $data['result']['received_time'] = array( |
|
| 936 | + ); |
|
| 937 | + $data['result']['received_time'] = array( |
|
| 938 | 938 | 'title' => bts('Received time', array(), NULL, 'boinc:task-details'), |
| 939 | 939 | 'help' => t('The time that the result was received.'), |
| 940 | 940 | 'field' => array( |
| 941 | - 'handler' => 'views_handler_field_date', |
|
| 942 | - 'click sortable' => TRUE |
|
| 941 | + 'handler' => 'views_handler_field_date', |
|
| 942 | + 'click sortable' => TRUE |
|
| 943 | 943 | ), |
| 944 | 944 | 'filter' => array( |
| 945 | - 'handler' => 'views_handler_filter_date' |
|
| 945 | + 'handler' => 'views_handler_filter_date' |
|
| 946 | 946 | ), |
| 947 | 947 | 'sort' => array( |
| 948 | - 'handler' => 'views_handler_sort_date' |
|
| 948 | + 'handler' => 'views_handler_sort_date' |
|
| 949 | 949 | ) |
| 950 | - ); |
|
| 951 | - $data['result']['report_deadline'] = array( |
|
| 950 | + ); |
|
| 951 | + $data['result']['report_deadline'] = array( |
|
| 952 | 952 | 'title' => bts('Report deadline', array(), NULL, 'boinc:task-details'), |
| 953 | 953 | 'help' => t('The deadline for the task.'), |
| 954 | 954 | 'field' => array( |
| 955 | - 'handler' => 'views_handler_field_date', |
|
| 956 | - 'click sortable' => TRUE |
|
| 955 | + 'handler' => 'views_handler_field_date', |
|
| 956 | + 'click sortable' => TRUE |
|
| 957 | 957 | ), |
| 958 | 958 | 'filter' => array( |
| 959 | - 'handler' => 'views_handler_filter_date' |
|
| 959 | + 'handler' => 'views_handler_filter_date' |
|
| 960 | 960 | ), |
| 961 | 961 | 'sort' => array( |
| 962 | - 'handler' => 'views_handler_sort_date' |
|
| 962 | + 'handler' => 'views_handler_sort_date' |
|
| 963 | 963 | ) |
| 964 | - ); |
|
| 965 | - $data['result']['sent_time'] = array( |
|
| 964 | + ); |
|
| 965 | + $data['result']['sent_time'] = array( |
|
| 966 | 966 | 'title' => bts('Sent', array(), NULL, 'boinc:task-details'), |
| 967 | 967 | 'help' => t('The time that the task was sent.'), |
| 968 | 968 | 'field' => array( |
| 969 | - 'handler' => 'views_handler_field_date', |
|
| 970 | - 'click sortable' => TRUE |
|
| 969 | + 'handler' => 'views_handler_field_date', |
|
| 970 | + 'click sortable' => TRUE |
|
| 971 | 971 | ), |
| 972 | 972 | 'filter' => array( |
| 973 | - 'handler' => 'views_handler_filter_date' |
|
| 973 | + 'handler' => 'views_handler_filter_date' |
|
| 974 | 974 | ), |
| 975 | 975 | 'sort' => array( |
| 976 | - 'handler' => 'views_handler_sort_date' |
|
| 976 | + 'handler' => 'views_handler_sort_date' |
|
| 977 | 977 | ) |
| 978 | - ); |
|
| 979 | - $data['result']['server_state'] = array( |
|
| 978 | + ); |
|
| 979 | + $data['result']['server_state'] = array( |
|
| 980 | 980 | 'title' => bts('Server state', array(), NULL, 'boinc:task-details'), |
| 981 | 981 | 'help' => t('The state of task on the server side.'), |
| 982 | 982 | 'field' => array( |
| 983 | - 'handler' => 'views_handler_field_numeric', |
|
| 984 | - 'click sortable' => TRUE |
|
| 983 | + 'handler' => 'views_handler_field_numeric', |
|
| 984 | + 'click sortable' => TRUE |
|
| 985 | 985 | ), |
| 986 | 986 | 'filter' => array( |
| 987 | - 'handler' => 'views_handler_filter_numeric' |
|
| 987 | + 'handler' => 'views_handler_filter_numeric' |
|
| 988 | 988 | ), |
| 989 | 989 | 'sort' => array( |
| 990 | - 'handler' => 'views_handler_sort_numeric' |
|
| 990 | + 'handler' => 'views_handler_sort_numeric' |
|
| 991 | 991 | ) |
| 992 | - ); |
|
| 993 | - $data['result']['stderr_out'] = array( |
|
| 992 | + ); |
|
| 993 | + $data['result']['stderr_out'] = array( |
|
| 994 | 994 | 'title' => bts('Stderr out', array(), NULL, 'boinc:task-details'), |
| 995 | 995 | 'help' => t('The output to standard error.'), |
| 996 | 996 | 'field' => array( |
| 997 | - 'handler' => 'views_handler_field', |
|
| 998 | - 'click sortable' => TRUE |
|
| 997 | + 'handler' => 'views_handler_field', |
|
| 998 | + 'click sortable' => TRUE |
|
| 999 | 999 | ), |
| 1000 | 1000 | 'filter' => array( |
| 1001 | - 'handler' => 'views_handler_filter_string' |
|
| 1001 | + 'handler' => 'views_handler_filter_string' |
|
| 1002 | 1002 | ), |
| 1003 | 1003 | 'sort' => array( |
| 1004 | - 'handler' => 'views_handler_sort_string' |
|
| 1004 | + 'handler' => 'views_handler_sort_string' |
|
| 1005 | 1005 | ) |
| 1006 | - ); |
|
| 1007 | - $data['result']['validate_state'] = array( |
|
| 1006 | + ); |
|
| 1007 | + $data['result']['validate_state'] = array( |
|
| 1008 | 1008 | 'title' => bts('Validation state', array(), NULL, 'boinc:task-details'), |
| 1009 | 1009 | 'help' => t('The state of validation of this result.'), |
| 1010 | 1010 | 'field' => array( |
| 1011 | - 'handler' => 'views_handler_field_numeric', |
|
| 1012 | - 'click sortable' => TRUE |
|
| 1011 | + 'handler' => 'views_handler_field_numeric', |
|
| 1012 | + 'click sortable' => TRUE |
|
| 1013 | 1013 | ), |
| 1014 | 1014 | 'filter' => array( |
| 1015 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1015 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1016 | 1016 | ), |
| 1017 | 1017 | 'sort' => array( |
| 1018 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1018 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1019 | 1019 | ) |
| 1020 | - ); |
|
| 1021 | - $data['result']['peak_working_set_size'] = array( |
|
| 1020 | + ); |
|
| 1021 | + $data['result']['peak_working_set_size'] = array( |
|
| 1022 | 1022 | 'title' => bts('Peak working set size', array(), NULL, 'boinc:task-details'), |
| 1023 | 1023 | 'help' => t('Peak working set size.'), |
| 1024 | 1024 | 'field' => array( |
| 1025 | - 'handler' => 'views_handler_field_numeric', |
|
| 1026 | - 'click sortable' => TRUE |
|
| 1025 | + 'handler' => 'views_handler_field_numeric', |
|
| 1026 | + 'click sortable' => TRUE |
|
| 1027 | 1027 | ), |
| 1028 | 1028 | 'filter' => array( |
| 1029 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1029 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1030 | 1030 | ), |
| 1031 | 1031 | 'sort' => array( |
| 1032 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1032 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1033 | 1033 | ) |
| 1034 | - ); |
|
| 1035 | - $data['result']['peak_swap_size'] = array( |
|
| 1034 | + ); |
|
| 1035 | + $data['result']['peak_swap_size'] = array( |
|
| 1036 | 1036 | 'title' => bts('Peak swap size', array(), NULL, 'boinc:task-details'), |
| 1037 | 1037 | 'help' => t('Peak swap size.'), |
| 1038 | 1038 | 'field' => array( |
| 1039 | - 'handler' => 'views_handler_field_numeric', |
|
| 1040 | - 'click sortable' => TRUE |
|
| 1039 | + 'handler' => 'views_handler_field_numeric', |
|
| 1040 | + 'click sortable' => TRUE |
|
| 1041 | 1041 | ), |
| 1042 | 1042 | 'filter' => array( |
| 1043 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1043 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1044 | 1044 | ), |
| 1045 | 1045 | 'sort' => array( |
| 1046 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1046 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1047 | 1047 | ) |
| 1048 | - ); |
|
| 1048 | + ); |
|
| 1049 | 1049 | $data['result']['peak_disk_usage'] = array( |
| 1050 | 1050 | 'title' => bts('Peak disk usage', array(), NULL, 'boinc:task-details'), |
| 1051 | 1051 | 'help' => t('Peak disk usage.'), |
| 1052 | 1052 | 'field' => array( |
| 1053 | - 'handler' => 'views_handler_field_numeric', |
|
| 1054 | - 'click sortable' => TRUE |
|
| 1053 | + 'handler' => 'views_handler_field_numeric', |
|
| 1054 | + 'click sortable' => TRUE |
|
| 1055 | 1055 | ), |
| 1056 | 1056 | 'filter' => array( |
| 1057 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1057 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1058 | 1058 | ), |
| 1059 | 1059 | 'sort' => array( |
| 1060 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1060 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1061 | 1061 | ) |
| 1062 | - ); |
|
| 1062 | + ); |
|
| 1063 | 1063 | |
| 1064 | 1064 | |
| 1065 | - // ------------------------------------------------------------------------------------------------ |
|
| 1066 | - // Definition for workunit table |
|
| 1067 | - // ------------------------------------------------------------------------------------------------ |
|
| 1065 | + // ------------------------------------------------------------------------------------------------ |
|
| 1066 | + // Definition for workunit table |
|
| 1067 | + // ------------------------------------------------------------------------------------------------ |
|
| 1068 | 1068 | |
| 1069 | - $data['workunit']['table']['group'] = t('BOINC'); |
|
| 1070 | - $data['workunit']['table']['base'] = array( |
|
| 1071 | - 'field' => 'id', |
|
| 1072 | - 'title' => t('BOINC workunit'), |
|
| 1073 | - 'help' => t('Workunits produced by BOINC'), |
|
| 1074 | - 'database' => 'boinc_ro' |
|
| 1075 | - ); |
|
| 1069 | + $data['workunit']['table']['group'] = t('BOINC'); |
|
| 1070 | + $data['workunit']['table']['base'] = array( |
|
| 1071 | + 'field' => 'id', |
|
| 1072 | + 'title' => t('BOINC workunit'), |
|
| 1073 | + 'help' => t('Workunits produced by BOINC'), |
|
| 1074 | + 'database' => 'boinc_ro' |
|
| 1075 | + ); |
|
| 1076 | 1076 | |
| 1077 | - // Create implicit relationship to the app table |
|
| 1077 | + // Create implicit relationship to the app table |
|
| 1078 | 1078 | |
| 1079 | - $data['workunit']['table']['join'] = array( |
|
| 1079 | + $data['workunit']['table']['join'] = array( |
|
| 1080 | 1080 | 'app' => array( |
| 1081 | - 'left_field' => 'id', |
|
| 1082 | - 'field' => 'appid' |
|
| 1081 | + 'left_field' => 'id', |
|
| 1082 | + 'field' => 'appid' |
|
| 1083 | 1083 | ) |
| 1084 | - ); |
|
| 1084 | + ); |
|
| 1085 | 1085 | |
| 1086 | - // Primary keys allowed as arguments |
|
| 1086 | + // Primary keys allowed as arguments |
|
| 1087 | 1087 | |
| 1088 | - $data['workunit']['id'] = array( |
|
| 1088 | + $data['workunit']['id'] = array( |
|
| 1089 | 1089 | 'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'), |
| 1090 | 1090 | 'help' => t('The ID number of this workunit.'), |
| 1091 | 1091 | 'field' => array( |
| 1092 | - 'handler' => 'views_handler_field_numeric', |
|
| 1093 | - 'click sortable' => TRUE |
|
| 1092 | + 'handler' => 'views_handler_field_numeric', |
|
| 1093 | + 'click sortable' => TRUE |
|
| 1094 | 1094 | ), |
| 1095 | 1095 | 'argument' => array( |
| 1096 | - 'handler' => 'views_handler_argument', |
|
| 1097 | - 'name field' => 'title', |
|
| 1098 | - 'numeric' => TRUE, |
|
| 1099 | - 'validate type' => 'id' |
|
| 1096 | + 'handler' => 'views_handler_argument', |
|
| 1097 | + 'name field' => 'title', |
|
| 1098 | + 'numeric' => TRUE, |
|
| 1099 | + 'validate type' => 'id' |
|
| 1100 | 1100 | ), |
| 1101 | 1101 | 'filter' => array( |
| 1102 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1102 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1103 | 1103 | ), |
| 1104 | 1104 | 'sort' => array( |
| 1105 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1105 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1106 | 1106 | ) |
| 1107 | - ); |
|
| 1107 | + ); |
|
| 1108 | 1108 | |
| 1109 | - // Foreign key fields |
|
| 1109 | + // Foreign key fields |
|
| 1110 | 1110 | |
| 1111 | - $data['workunit']['appid'] = array( |
|
| 1111 | + $data['workunit']['appid'] = array( |
|
| 1112 | 1112 | 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
| 1113 | 1113 | 'help' => t('The application associated with this workunit.'), |
| 1114 | 1114 | 'argument' => array( // foreign key to the {app} table |
| 1115 | - 'handler' => 'views_handler_argument', |
|
| 1116 | - 'name field' => 'title', |
|
| 1117 | - 'numeric' => TRUE, |
|
| 1118 | - 'validate type' => 'id' |
|
| 1115 | + 'handler' => 'views_handler_argument', |
|
| 1116 | + 'name field' => 'title', |
|
| 1117 | + 'numeric' => TRUE, |
|
| 1118 | + 'validate type' => 'id' |
|
| 1119 | 1119 | ), |
| 1120 | 1120 | 'relationship' => array( |
| 1121 | - 'base' => 'app', |
|
| 1122 | - 'field' => 'appid', |
|
| 1123 | - 'handler' => 'views_handler_relationship', |
|
| 1124 | - 'label' => t('Application') |
|
| 1121 | + 'base' => 'app', |
|
| 1122 | + 'field' => 'appid', |
|
| 1123 | + 'handler' => 'views_handler_relationship', |
|
| 1124 | + 'label' => t('Application') |
|
| 1125 | 1125 | ), |
| 1126 | 1126 | 'field' => array( |
| 1127 | - 'handler' => 'views_handler_field_numeric', |
|
| 1128 | - 'click sortable' => TRUE |
|
| 1127 | + 'handler' => 'views_handler_field_numeric', |
|
| 1128 | + 'click sortable' => TRUE |
|
| 1129 | 1129 | ), |
| 1130 | 1130 | 'filter' => array( |
| 1131 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1131 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1132 | 1132 | ), |
| 1133 | 1133 | 'sort' => array( |
| 1134 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1134 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1135 | 1135 | ) |
| 1136 | - ); |
|
| 1136 | + ); |
|
| 1137 | 1137 | |
| 1138 | - // Descriptions of workunit fields (alphabetized) |
|
| 1138 | + // Descriptions of workunit fields (alphabetized) |
|
| 1139 | 1139 | |
| 1140 | - $data['workunit']['canonical_credit'] = array( |
|
| 1140 | + $data['workunit']['canonical_credit'] = array( |
|
| 1141 | 1141 | 'title' => bts('Canonical credit', array(), NULL, 'boinc:workunit-details'), |
| 1142 | 1142 | 'help' => t('The canonical credit of the workunit.'), |
| 1143 | 1143 | 'field' => array( |
| 1144 | - 'handler' => 'views_handler_field_numeric', |
|
| 1145 | - 'click sortable' => TRUE, |
|
| 1146 | - 'float' => TRUE |
|
| 1144 | + 'handler' => 'views_handler_field_numeric', |
|
| 1145 | + 'click sortable' => TRUE, |
|
| 1146 | + 'float' => TRUE |
|
| 1147 | 1147 | ), |
| 1148 | 1148 | 'filter' => array( |
| 1149 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1149 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1150 | 1150 | ), |
| 1151 | 1151 | 'sort' => array( |
| 1152 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1152 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1153 | 1153 | ) |
| 1154 | - ); |
|
| 1155 | - $data['workunit']['canonical_resultid'] = array( |
|
| 1154 | + ); |
|
| 1155 | + $data['workunit']['canonical_resultid'] = array( |
|
| 1156 | 1156 | 'title' => bts('Canonical result ID', array(), NULL, 'boinc:workunit-details'), |
| 1157 | 1157 | 'help' => t('The ID of the canonical result associated with the workunit.'), |
| 1158 | 1158 | 'field' => array( |
| 1159 | - 'handler' => 'views_handler_field_numeric', |
|
| 1160 | - 'click sortable' => TRUE |
|
| 1159 | + 'handler' => 'views_handler_field_numeric', |
|
| 1160 | + 'click sortable' => TRUE |
|
| 1161 | 1161 | ), |
| 1162 | 1162 | 'filter' => array( |
| 1163 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1163 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1164 | 1164 | ), |
| 1165 | 1165 | 'sort' => array( |
| 1166 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1166 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1167 | 1167 | ) |
| 1168 | - ); |
|
| 1169 | - $data['workunit']['create_time'] = array( |
|
| 1168 | + ); |
|
| 1169 | + $data['workunit']['create_time'] = array( |
|
| 1170 | 1170 | 'title' => bts('Created time', array(), NULL, 'boinc:workunit-details'), |
| 1171 | 1171 | 'help' => t('The time that the workunit was created.'), |
| 1172 | 1172 | 'field' => array( |
| 1173 | - 'handler' => 'views_handler_field_date', |
|
| 1174 | - 'click sortable' => TRUE |
|
| 1173 | + 'handler' => 'views_handler_field_date', |
|
| 1174 | + 'click sortable' => TRUE |
|
| 1175 | 1175 | ), |
| 1176 | 1176 | 'filter' => array( |
| 1177 | - 'handler' => 'views_handler_filter_date' |
|
| 1177 | + 'handler' => 'views_handler_filter_date' |
|
| 1178 | 1178 | ), |
| 1179 | 1179 | 'sort' => array( |
| 1180 | - 'handler' => 'views_handler_sort_date' |
|
| 1180 | + 'handler' => 'views_handler_sort_date' |
|
| 1181 | 1181 | ) |
| 1182 | - ); |
|
| 1183 | - $data['workunit']['error_mask'] = array( |
|
| 1182 | + ); |
|
| 1183 | + $data['workunit']['error_mask'] = array( |
|
| 1184 | 1184 | 'title' => bts('Error mask', array(), NULL, 'boinc:workunit-details'), |
| 1185 | 1185 | 'help' => t('Error mask of the workunit.'), |
| 1186 | 1186 | 'field' => array( |
| 1187 | - 'handler' => 'views_handler_field_numeric', |
|
| 1188 | - 'click sortable' => TRUE |
|
| 1187 | + 'handler' => 'views_handler_field_numeric', |
|
| 1188 | + 'click sortable' => TRUE |
|
| 1189 | 1189 | ), |
| 1190 | 1190 | 'filter' => array( |
| 1191 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1191 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1192 | 1192 | ), |
| 1193 | 1193 | 'sort' => array( |
| 1194 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1194 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1195 | 1195 | ) |
| 1196 | - ); |
|
| 1197 | - $data['workunit']['min_quorum'] = array( |
|
| 1196 | + ); |
|
| 1197 | + $data['workunit']['min_quorum'] = array( |
|
| 1198 | 1198 | 'title' => bts('Minimum quorum', array(), NULL, 'boinc:workunit-details'), |
| 1199 | 1199 | 'help' => t('Minimum quorum of the workunit.'), |
| 1200 | 1200 | 'field' => array( |
| 1201 | - 'handler' => 'views_handler_field_numeric', |
|
| 1202 | - 'click sortable' => TRUE |
|
| 1201 | + 'handler' => 'views_handler_field_numeric', |
|
| 1202 | + 'click sortable' => TRUE |
|
| 1203 | 1203 | ), |
| 1204 | 1204 | 'filter' => array( |
| 1205 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1205 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1206 | 1206 | ), |
| 1207 | 1207 | 'sort' => array( |
| 1208 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1208 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1209 | 1209 | ) |
| 1210 | - ); |
|
| 1211 | - $data['workunit']['name'] = array( |
|
| 1210 | + ); |
|
| 1211 | + $data['workunit']['name'] = array( |
|
| 1212 | 1212 | 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreovewrite'), |
| 1213 | 1213 | 'help' => t('The name of the workunit.'), |
| 1214 | 1214 | 'field' => array( |
| 1215 | - 'handler' => 'views_handler_field', |
|
| 1216 | - 'click sortable' => TRUE |
|
| 1215 | + 'handler' => 'views_handler_field', |
|
| 1216 | + 'click sortable' => TRUE |
|
| 1217 | 1217 | ), |
| 1218 | 1218 | 'filter' => array( |
| 1219 | - 'handler' => 'views_handler_filter_string' |
|
| 1219 | + 'handler' => 'views_handler_filter_string' |
|
| 1220 | 1220 | ), |
| 1221 | 1221 | 'sort' => array( |
| 1222 | - 'handler' => 'views_handler_sort_string' |
|
| 1222 | + 'handler' => 'views_handler_sort_string' |
|
| 1223 | 1223 | ) |
| 1224 | - ); |
|
| 1225 | - $data['workunit']['max_error_results'] = array( |
|
| 1224 | + ); |
|
| 1225 | + $data['workunit']['max_error_results'] = array( |
|
| 1226 | 1226 | 'title' => bts('Max error tasks', array(), NULL, 'boinc:workunit-details'), |
| 1227 | 1227 | 'help' => t('The maximum number of error tasks in the workunit.'), |
| 1228 | 1228 | 'field' => array( |
| 1229 | - 'handler' => 'views_handler_field_numeric', |
|
| 1230 | - 'click sortable' => TRUE |
|
| 1229 | + 'handler' => 'views_handler_field_numeric', |
|
| 1230 | + 'click sortable' => TRUE |
|
| 1231 | 1231 | ), |
| 1232 | 1232 | 'filter' => array( |
| 1233 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1233 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1234 | 1234 | ), |
| 1235 | 1235 | 'sort' => array( |
| 1236 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1236 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1237 | 1237 | ) |
| 1238 | - ); |
|
| 1239 | - $data['workunit']['max_success_results'] = array( |
|
| 1238 | + ); |
|
| 1239 | + $data['workunit']['max_success_results'] = array( |
|
| 1240 | 1240 | 'title' => bts('Max success tasks', array(), NULL, 'boinc:workunit-details'), |
| 1241 | 1241 | 'help' => t('The maximum number of successful tasks in the workunit.'), |
| 1242 | 1242 | 'field' => array( |
| 1243 | - 'handler' => 'views_handler_field_numeric', |
|
| 1244 | - 'click sortable' => TRUE |
|
| 1243 | + 'handler' => 'views_handler_field_numeric', |
|
| 1244 | + 'click sortable' => TRUE |
|
| 1245 | 1245 | ), |
| 1246 | 1246 | 'filter' => array( |
| 1247 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1247 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1248 | 1248 | ), |
| 1249 | 1249 | 'sort' => array( |
| 1250 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1250 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1251 | 1251 | ) |
| 1252 | - ); |
|
| 1253 | - $data['workunit']['max_total_results'] = array( |
|
| 1252 | + ); |
|
| 1253 | + $data['workunit']['max_total_results'] = array( |
|
| 1254 | 1254 | 'title' => bts('Max total tasks', array(), NULL, 'boinc:workunit-details'), |
| 1255 | 1255 | 'help' => t('The maximum number of total tasks in the workunit.'), |
| 1256 | 1256 | 'field' => array( |
| 1257 | - 'handler' => 'views_handler_field_numeric', |
|
| 1258 | - 'click sortable' => TRUE |
|
| 1257 | + 'handler' => 'views_handler_field_numeric', |
|
| 1258 | + 'click sortable' => TRUE |
|
| 1259 | 1259 | ), |
| 1260 | 1260 | 'filter' => array( |
| 1261 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1261 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1262 | 1262 | ), |
| 1263 | 1263 | 'sort' => array( |
| 1264 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1264 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1265 | 1265 | ) |
| 1266 | - ); |
|
| 1267 | - $data['workunit']['need_validate'] = array( |
|
| 1266 | + ); |
|
| 1267 | + $data['workunit']['need_validate'] = array( |
|
| 1268 | 1268 | 'title' => bts('Needs validation', array(), NULL, 'boinc:workunit-details'), |
| 1269 | 1269 | 'help' => t('Whether or not a workunit needs validation.'), |
| 1270 | 1270 | 'field' => array( |
| 1271 | - 'handler' => 'views_handler_field_numeric', |
|
| 1272 | - 'click sortable' => TRUE |
|
| 1271 | + 'handler' => 'views_handler_field_numeric', |
|
| 1272 | + 'click sortable' => TRUE |
|
| 1273 | 1273 | ), |
| 1274 | 1274 | 'filter' => array( |
| 1275 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1275 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1276 | 1276 | ), |
| 1277 | 1277 | 'sort' => array( |
| 1278 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1278 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1279 | 1279 | ) |
| 1280 | - ); |
|
| 1281 | - $data['workunit']['target_nresults'] = array( |
|
| 1280 | + ); |
|
| 1281 | + $data['workunit']['target_nresults'] = array( |
|
| 1282 | 1282 | 'title' => bts('Initial replication', array(), NULL, 'boinc:workunit-details'), |
| 1283 | 1283 | 'help' => t('The target number of results for the workunit.'), |
| 1284 | 1284 | 'field' => array( |
| 1285 | - 'handler' => 'views_handler_field_numeric', |
|
| 1286 | - 'click sortable' => TRUE |
|
| 1285 | + 'handler' => 'views_handler_field_numeric', |
|
| 1286 | + 'click sortable' => TRUE |
|
| 1287 | 1287 | ), |
| 1288 | 1288 | 'filter' => array( |
| 1289 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1289 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1290 | 1290 | ), |
| 1291 | 1291 | 'sort' => array( |
| 1292 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1292 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1293 | 1293 | ) |
| 1294 | - ); |
|
| 1294 | + ); |
|
| 1295 | 1295 | |
| 1296 | - // ------------------------------------------------------------------------------------------------ |
|
| 1297 | - // Definition for app table |
|
| 1298 | - // ------------------------------------------------------------------------------------------------ |
|
| 1296 | + // ------------------------------------------------------------------------------------------------ |
|
| 1297 | + // Definition for app table |
|
| 1298 | + // ------------------------------------------------------------------------------------------------ |
|
| 1299 | 1299 | |
| 1300 | - $data['app']['table']['group'] = t('BOINC'); |
|
| 1301 | - $data['app']['table']['base'] = array( |
|
| 1302 | - 'field' => 'id', |
|
| 1303 | - 'title' => t('BOINC app'), |
|
| 1304 | - 'help' => t('Research applications run by BOINC'), |
|
| 1305 | - 'database' => 'boinc_ro' |
|
| 1306 | - ); |
|
| 1300 | + $data['app']['table']['group'] = t('BOINC'); |
|
| 1301 | + $data['app']['table']['base'] = array( |
|
| 1302 | + 'field' => 'id', |
|
| 1303 | + 'title' => t('BOINC app'), |
|
| 1304 | + 'help' => t('Research applications run by BOINC'), |
|
| 1305 | + 'database' => 'boinc_ro' |
|
| 1306 | + ); |
|
| 1307 | 1307 | |
| 1308 | - // Primary keys allowed as arguments |
|
| 1308 | + // Primary keys allowed as arguments |
|
| 1309 | 1309 | |
| 1310 | - $data['app']['id'] = array( |
|
| 1310 | + $data['app']['id'] = array( |
|
| 1311 | 1311 | 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
| 1312 | 1312 | 'help' => t('The ID number of this application.'), |
| 1313 | 1313 | 'field' => array( |
| 1314 | - 'handler' => 'views_handler_field_numeric', |
|
| 1315 | - 'click sortable' => TRUE |
|
| 1314 | + 'handler' => 'views_handler_field_numeric', |
|
| 1315 | + 'click sortable' => TRUE |
|
| 1316 | 1316 | ), |
| 1317 | 1317 | 'argument' => array( |
| 1318 | - 'handler' => 'views_handler_argument', |
|
| 1319 | - 'name field' => 'title', |
|
| 1320 | - 'numeric' => TRUE, |
|
| 1321 | - 'validate type' => 'id' |
|
| 1318 | + 'handler' => 'views_handler_argument', |
|
| 1319 | + 'name field' => 'title', |
|
| 1320 | + 'numeric' => TRUE, |
|
| 1321 | + 'validate type' => 'id' |
|
| 1322 | 1322 | ), |
| 1323 | 1323 | 'filter' => array( |
| 1324 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1324 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1325 | 1325 | ), |
| 1326 | 1326 | 'sort' => array( |
| 1327 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1327 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1328 | 1328 | ) |
| 1329 | - ); |
|
| 1329 | + ); |
|
| 1330 | 1330 | |
| 1331 | - // Descriptions of app fields (alphabetized) |
|
| 1331 | + // Descriptions of app fields (alphabetized) |
|
| 1332 | 1332 | |
| 1333 | - $data['app']['target_nresults'] = array( |
|
| 1333 | + $data['app']['target_nresults'] = array( |
|
| 1334 | 1334 | 'title' => bts('Target number of results', array(), NULL, 'boinc:application-details'), |
| 1335 | 1335 | 'help' => t('The number of times to replicate tasks in this application.'), |
| 1336 | 1336 | 'field' => array( |
| 1337 | - 'handler' => 'views_handler_field_numeric', |
|
| 1338 | - 'click sortable' => TRUE |
|
| 1337 | + 'handler' => 'views_handler_field_numeric', |
|
| 1338 | + 'click sortable' => TRUE |
|
| 1339 | 1339 | ), |
| 1340 | 1340 | 'filter' => array( |
| 1341 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1341 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1342 | 1342 | ), |
| 1343 | 1343 | 'sort' => array( |
| 1344 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1344 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1345 | 1345 | ) |
| 1346 | - ); |
|
| 1347 | - $data['app']['user_friendly_name'] = array( |
|
| 1346 | + ); |
|
| 1347 | + $data['app']['user_friendly_name'] = array( |
|
| 1348 | 1348 | 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
| 1349 | 1349 | 'help' => t('The user friendly name of the application.'), |
| 1350 | 1350 | 'field' => array( |
| 1351 | - 'handler' => 'views_handler_field', |
|
| 1352 | - 'click sortable' => TRUE |
|
| 1351 | + 'handler' => 'views_handler_field', |
|
| 1352 | + 'click sortable' => TRUE |
|
| 1353 | 1353 | ), |
| 1354 | 1354 | 'filter' => array( |
| 1355 | - 'handler' => 'views_handler_filter_string' |
|
| 1355 | + 'handler' => 'views_handler_filter_string' |
|
| 1356 | 1356 | ), |
| 1357 | 1357 | 'sort' => array( |
| 1358 | - 'handler' => 'views_handler_sort_string' |
|
| 1358 | + 'handler' => 'views_handler_sort_string' |
|
| 1359 | 1359 | ) |
| 1360 | - ); |
|
| 1360 | + ); |
|
| 1361 | 1361 | |
| 1362 | - // ------------------------------------------------------------------------------------------------ |
|
| 1363 | - // Definition for app_version table |
|
| 1364 | - // ------------------------------------------------------------------------------------------------ |
|
| 1362 | + // ------------------------------------------------------------------------------------------------ |
|
| 1363 | + // Definition for app_version table |
|
| 1364 | + // ------------------------------------------------------------------------------------------------ |
|
| 1365 | 1365 | |
| 1366 | - $data['app_version']['table']['group'] = t('BOINC'); |
|
| 1367 | - $data['app_version']['table']['base'] = array( |
|
| 1368 | - 'field' => 'id', |
|
| 1369 | - 'title' => t('BOINC app version'), |
|
| 1370 | - 'help' => t('Versions of research applications run by BOINC'), |
|
| 1371 | - 'database' => 'boinc_ro' |
|
| 1372 | - ); |
|
| 1366 | + $data['app_version']['table']['group'] = t('BOINC'); |
|
| 1367 | + $data['app_version']['table']['base'] = array( |
|
| 1368 | + 'field' => 'id', |
|
| 1369 | + 'title' => t('BOINC app version'), |
|
| 1370 | + 'help' => t('Versions of research applications run by BOINC'), |
|
| 1371 | + 'database' => 'boinc_ro' |
|
| 1372 | + ); |
|
| 1373 | 1373 | |
| 1374 | - // Primary keys allowed as arguments |
|
| 1374 | + // Primary keys allowed as arguments |
|
| 1375 | 1375 | |
| 1376 | - $data['app_version']['id'] = array( |
|
| 1376 | + $data['app_version']['id'] = array( |
|
| 1377 | 1377 | 'title' => bts('Application version ID', array(), NULL, 'boinc:application-details'), |
| 1378 | 1378 | 'help' => t('The ID number of this application version.'), |
| 1379 | 1379 | 'field' => array( |
| 1380 | - 'handler' => 'views_handler_field_numeric', |
|
| 1381 | - 'click sortable' => TRUE |
|
| 1380 | + 'handler' => 'views_handler_field_numeric', |
|
| 1381 | + 'click sortable' => TRUE |
|
| 1382 | 1382 | ), |
| 1383 | 1383 | 'argument' => array( |
| 1384 | - 'handler' => 'views_handler_argument', |
|
| 1385 | - 'name field' => 'title', |
|
| 1386 | - 'numeric' => TRUE, |
|
| 1387 | - 'validate type' => 'id' |
|
| 1384 | + 'handler' => 'views_handler_argument', |
|
| 1385 | + 'name field' => 'title', |
|
| 1386 | + 'numeric' => TRUE, |
|
| 1387 | + 'validate type' => 'id' |
|
| 1388 | 1388 | ), |
| 1389 | 1389 | 'filter' => array( |
| 1390 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1390 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1391 | 1391 | ), |
| 1392 | 1392 | 'sort' => array( |
| 1393 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1393 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1394 | 1394 | ) |
| 1395 | - ); |
|
| 1395 | + ); |
|
| 1396 | 1396 | |
| 1397 | - // Foreign key fields |
|
| 1397 | + // Foreign key fields |
|
| 1398 | 1398 | |
| 1399 | - $data['app_version']['appid'] = array( |
|
| 1399 | + $data['app_version']['appid'] = array( |
|
| 1400 | 1400 | 'title' => bts('Application ID', array(), NULL, 'boinc:application-details'), |
| 1401 | 1401 | 'help' => t('The application ID associated with this app version.'), |
| 1402 | 1402 | // Because this is a foreign key to the {app} table. This allows us to |
| 1403 | 1403 | // have, when the view is configured with this relationship, all the fields |
| 1404 | 1404 | // for the related node available. |
| 1405 | 1405 | 'argument' => array( |
| 1406 | - 'handler' => 'views_handler_argument_numeric', |
|
| 1407 | - 'name field' => 'title', |
|
| 1408 | - 'numeric' => TRUE, |
|
| 1409 | - 'validate type' => 'id' |
|
| 1406 | + 'handler' => 'views_handler_argument_numeric', |
|
| 1407 | + 'name field' => 'title', |
|
| 1408 | + 'numeric' => TRUE, |
|
| 1409 | + 'validate type' => 'id' |
|
| 1410 | 1410 | ), |
| 1411 | 1411 | 'relationship' => array( |
| 1412 | - 'base' => 'app', |
|
| 1413 | - 'field' => 'id', |
|
| 1414 | - 'handler' => 'views_handler_relationship', |
|
| 1415 | - 'label' => t('App ID') |
|
| 1412 | + 'base' => 'app', |
|
| 1413 | + 'field' => 'id', |
|
| 1414 | + 'handler' => 'views_handler_relationship', |
|
| 1415 | + 'label' => t('App ID') |
|
| 1416 | 1416 | ), |
| 1417 | 1417 | 'field' => array( |
| 1418 | - 'handler' => 'views_handler_field_numeric', |
|
| 1419 | - 'click sortable' => TRUE |
|
| 1418 | + 'handler' => 'views_handler_field_numeric', |
|
| 1419 | + 'click sortable' => TRUE |
|
| 1420 | 1420 | ), |
| 1421 | 1421 | 'filter' => array( |
| 1422 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1422 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1423 | 1423 | ), |
| 1424 | 1424 | 'sort' => array( |
| 1425 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1425 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1426 | 1426 | ) |
| 1427 | - ); |
|
| 1427 | + ); |
|
| 1428 | 1428 | |
| 1429 | - $data['app_version']['platformid'] = array( |
|
| 1429 | + $data['app_version']['platformid'] = array( |
|
| 1430 | 1430 | 'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'), |
| 1431 | 1431 | 'help' => t('The platform ID associated with this app version.'), |
| 1432 | 1432 | // Because this is a foreign key to the {platform} table. This allows us to |
| 1433 | 1433 | // have, when the view is configured with this relationship, all the fields |
| 1434 | 1434 | // for the related node available. |
| 1435 | 1435 | 'argument' => array( |
| 1436 | - 'handler' => 'views_handler_argument_numeric', |
|
| 1437 | - 'name field' => 'title', |
|
| 1438 | - 'numeric' => TRUE, |
|
| 1439 | - 'validate type' => 'id' |
|
| 1436 | + 'handler' => 'views_handler_argument_numeric', |
|
| 1437 | + 'name field' => 'title', |
|
| 1438 | + 'numeric' => TRUE, |
|
| 1439 | + 'validate type' => 'id' |
|
| 1440 | 1440 | ), |
| 1441 | 1441 | 'relationship' => array( |
| 1442 | - 'base' => 'platform', |
|
| 1443 | - 'field' => 'id', |
|
| 1444 | - 'handler' => 'views_handler_relationship', |
|
| 1445 | - 'label' => t('Platform ID') |
|
| 1442 | + 'base' => 'platform', |
|
| 1443 | + 'field' => 'id', |
|
| 1444 | + 'handler' => 'views_handler_relationship', |
|
| 1445 | + 'label' => t('Platform ID') |
|
| 1446 | 1446 | ), |
| 1447 | 1447 | 'field' => array( |
| 1448 | - 'handler' => 'views_handler_field_numeric', |
|
| 1449 | - 'click sortable' => TRUE |
|
| 1448 | + 'handler' => 'views_handler_field_numeric', |
|
| 1449 | + 'click sortable' => TRUE |
|
| 1450 | 1450 | ), |
| 1451 | 1451 | 'filter' => array( |
| 1452 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1452 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1453 | 1453 | ), |
| 1454 | 1454 | 'sort' => array( |
| 1455 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1455 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1456 | 1456 | ) |
| 1457 | - ); |
|
| 1457 | + ); |
|
| 1458 | 1458 | |
| 1459 | - // Descriptions of app fields (alphabetized) |
|
| 1459 | + // Descriptions of app fields (alphabetized) |
|
| 1460 | 1460 | |
| 1461 | - $data['app_version']['plan_class'] = array( |
|
| 1461 | + $data['app_version']['plan_class'] = array( |
|
| 1462 | 1462 | 'title' => bts('Plan class', array(), NULL, 'boinc:application-details'), |
| 1463 | 1463 | 'help' => t('App version plan class.'), |
| 1464 | 1464 | 'field' => array( |
| 1465 | - 'handler' => 'views_handler_field', |
|
| 1466 | - 'click sortable' => TRUE |
|
| 1465 | + 'handler' => 'views_handler_field', |
|
| 1466 | + 'click sortable' => TRUE |
|
| 1467 | 1467 | ), |
| 1468 | 1468 | 'filter' => array( |
| 1469 | - 'handler' => 'views_handler_filter_string' |
|
| 1469 | + 'handler' => 'views_handler_filter_string' |
|
| 1470 | 1470 | ), |
| 1471 | 1471 | 'sort' => array( |
| 1472 | - 'handler' => 'views_handler_sort_string' |
|
| 1472 | + 'handler' => 'views_handler_sort_string' |
|
| 1473 | 1473 | ) |
| 1474 | - ); |
|
| 1475 | - $data['app_version']['version_num'] = array( |
|
| 1474 | + ); |
|
| 1475 | + $data['app_version']['version_num'] = array( |
|
| 1476 | 1476 | 'title' => bts('Version number', array(), NULL, 'boinc:application-details'), |
| 1477 | 1477 | 'help' => t('The application version number.'), |
| 1478 | 1478 | 'field' => array( |
| 1479 | - 'handler' => 'views_handler_field_boincwork_app_version_number', |
|
| 1480 | - 'click sortable' => TRUE, |
|
| 1481 | - 'float' => TRUE, |
|
| 1479 | + 'handler' => 'views_handler_field_boincwork_app_version_number', |
|
| 1480 | + 'click sortable' => TRUE, |
|
| 1481 | + 'float' => TRUE, |
|
| 1482 | 1482 | ), |
| 1483 | 1483 | 'filter' => array( |
| 1484 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1484 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1485 | 1485 | ), |
| 1486 | 1486 | 'sort' => array( |
| 1487 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1487 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1488 | 1488 | ) |
| 1489 | - ); |
|
| 1489 | + ); |
|
| 1490 | 1490 | |
| 1491 | - // ------------------------------------------------------------------------------------------------ |
|
| 1492 | - // Definition for host_app_version table |
|
| 1493 | - // ------------------------------------------------------------------------------------------------ |
|
| 1491 | + // ------------------------------------------------------------------------------------------------ |
|
| 1492 | + // Definition for host_app_version table |
|
| 1493 | + // ------------------------------------------------------------------------------------------------ |
|
| 1494 | 1494 | |
| 1495 | - $data['host_app_version']['table']['group'] = t('BOINC'); |
|
| 1495 | + $data['host_app_version']['table']['group'] = t('BOINC'); |
|
| 1496 | 1496 | |
| 1497 | - // This table references the {host} table. |
|
| 1498 | - // This join creates an 'implicit' relationship to the host table, so that when |
|
| 1499 | - // "Host" is the base table, the fields are automatically available. |
|
| 1497 | + // This table references the {host} table. |
|
| 1498 | + // This join creates an 'implicit' relationship to the host table, so that when |
|
| 1499 | + // "Host" is the base table, the fields are automatically available. |
|
| 1500 | 1500 | |
| 1501 | - // Index this array by the table name to which this table refers. |
|
| 1502 | - // 'left_field' is the primary key in the referenced table. |
|
| 1503 | - // 'field' is the foreign key in this table. |
|
| 1501 | + // Index this array by the table name to which this table refers. |
|
| 1502 | + // 'left_field' is the primary key in the referenced table. |
|
| 1503 | + // 'field' is the foreign key in this table. |
|
| 1504 | 1504 | |
| 1505 | - $data['host_app_version']['table']['join'] = array( |
|
| 1505 | + $data['host_app_version']['table']['join'] = array( |
|
| 1506 | 1506 | 'host' => array( |
| 1507 | - 'left_field' => 'id', |
|
| 1508 | - 'field' => 'host_id', |
|
| 1507 | + 'left_field' => 'id', |
|
| 1508 | + 'field' => 'host_id', |
|
| 1509 | 1509 | ) |
| 1510 | - ); |
|
| 1510 | + ); |
|
| 1511 | 1511 | |
| 1512 | - // Primary keys allowed as arguments |
|
| 1512 | + // Primary keys allowed as arguments |
|
| 1513 | 1513 | |
| 1514 | - $data['host_app_version']['host_id'] = array( |
|
| 1514 | + $data['host_app_version']['host_id'] = array( |
|
| 1515 | 1515 | 'title' => bts('Computer', array(), NULL, 'boinc:host-details'), |
| 1516 | 1516 | 'help' => t('The host ID connected to this app version data.'), |
| 1517 | 1517 | 'field' => array( |
| 1518 | - 'handler' => 'views_handler_field_numeric', |
|
| 1519 | - 'click sortable' => TRUE |
|
| 1518 | + 'handler' => 'views_handler_field_numeric', |
|
| 1519 | + 'click sortable' => TRUE |
|
| 1520 | 1520 | ), |
| 1521 | 1521 | 'argument' => array( |
| 1522 | - 'handler' => 'views_handler_argument', |
|
| 1523 | - 'name field' => 'title', |
|
| 1524 | - 'numeric' => TRUE, |
|
| 1525 | - 'validate type' => 'id' |
|
| 1522 | + 'handler' => 'views_handler_argument', |
|
| 1523 | + 'name field' => 'title', |
|
| 1524 | + 'numeric' => TRUE, |
|
| 1525 | + 'validate type' => 'id' |
|
| 1526 | 1526 | ), |
| 1527 | 1527 | 'filter' => array( |
| 1528 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1528 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1529 | 1529 | ), |
| 1530 | 1530 | 'sort' => array( |
| 1531 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1531 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1532 | 1532 | ) |
| 1533 | - ); |
|
| 1533 | + ); |
|
| 1534 | 1534 | |
| 1535 | - // Foreign key fields |
|
| 1535 | + // Foreign key fields |
|
| 1536 | 1536 | |
| 1537 | - $data['host_app_version']['app_version_id'] = array( |
|
| 1537 | + $data['host_app_version']['app_version_id'] = array( |
|
| 1538 | 1538 | 'title' => bts('App version ID', array(), NULL, 'boinc:application-details'), |
| 1539 | 1539 | 'help' => t('The app version ID connected to this host data.'), |
| 1540 | 1540 | // Because this is a foreign key to the {host} table. This allows us to |
| 1541 | 1541 | // have, when the view is configured with this relationship, all the fields |
| 1542 | 1542 | // for the related node available. |
| 1543 | 1543 | 'argument' => array( |
| 1544 | - 'handler' => 'views_handler_argument_numeric', |
|
| 1545 | - 'name field' => 'title', |
|
| 1546 | - 'numeric' => TRUE, |
|
| 1547 | - 'validate type' => 'id' |
|
| 1544 | + 'handler' => 'views_handler_argument_numeric', |
|
| 1545 | + 'name field' => 'title', |
|
| 1546 | + 'numeric' => TRUE, |
|
| 1547 | + 'validate type' => 'id' |
|
| 1548 | 1548 | ), |
| 1549 | 1549 | 'relationship' => array( |
| 1550 | - 'base' => 'app_version', |
|
| 1551 | - 'field' => 'id', |
|
| 1552 | - 'handler' => 'views_handler_relationship', |
|
| 1553 | - 'label' => t('App version') |
|
| 1550 | + 'base' => 'app_version', |
|
| 1551 | + 'field' => 'id', |
|
| 1552 | + 'handler' => 'views_handler_relationship', |
|
| 1553 | + 'label' => t('App version') |
|
| 1554 | 1554 | ), |
| 1555 | 1555 | 'field' => array( |
| 1556 | - 'handler' => 'views_handler_field_numeric', |
|
| 1557 | - 'click sortable' => TRUE |
|
| 1556 | + 'handler' => 'views_handler_field_numeric', |
|
| 1557 | + 'click sortable' => TRUE |
|
| 1558 | 1558 | ), |
| 1559 | 1559 | 'filter' => array( |
| 1560 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1560 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1561 | 1561 | ), |
| 1562 | 1562 | 'sort' => array( |
| 1563 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1563 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1564 | 1564 | ) |
| 1565 | - ); |
|
| 1565 | + ); |
|
| 1566 | 1566 | |
| 1567 | - // Descriptions of host_app_version fields (alphabetized) |
|
| 1567 | + // Descriptions of host_app_version fields (alphabetized) |
|
| 1568 | 1568 | |
| 1569 | - $data['host_app_version']['consecutive_valid'] = array( |
|
| 1569 | + $data['host_app_version']['consecutive_valid'] = array( |
|
| 1570 | 1570 | 'title' => bts('Consecutive valid tasks', array(), NULL, 'boinc:application-details'), |
| 1571 | 1571 | 'help' => t('The number of consecutive valid tasks for this app and by this host.'), |
| 1572 | 1572 | 'field' => array( |
| 1573 | - 'handler' => 'views_handler_field_numeric', |
|
| 1574 | - 'click sortable' => TRUE |
|
| 1573 | + 'handler' => 'views_handler_field_numeric', |
|
| 1574 | + 'click sortable' => TRUE |
|
| 1575 | 1575 | ), |
| 1576 | 1576 | 'filter' => array( |
| 1577 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1577 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1578 | 1578 | ), |
| 1579 | 1579 | 'sort' => array( |
| 1580 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1580 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1581 | 1581 | ) |
| 1582 | - ); |
|
| 1583 | - $data['host_app_version']['et_avg'] = array( |
|
| 1582 | + ); |
|
| 1583 | + $data['host_app_version']['et_avg'] = array( |
|
| 1584 | 1584 | 'title' => t('Average processing rate'), |
| 1585 | 1585 | 'help' => t('The "et_avg" for this app and by this host.'), |
| 1586 | 1586 | 'field' => array( |
| 1587 | - 'handler' => 'views_handler_field_boincwork_host_app_et_avg', |
|
| 1588 | - 'click sortable' => TRUE |
|
| 1587 | + 'handler' => 'views_handler_field_boincwork_host_app_et_avg', |
|
| 1588 | + 'click sortable' => TRUE |
|
| 1589 | 1589 | ), |
| 1590 | 1590 | 'filter' => array( |
| 1591 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1591 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1592 | 1592 | ), |
| 1593 | 1593 | 'sort' => array( |
| 1594 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1594 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1595 | 1595 | ) |
| 1596 | - ); |
|
| 1597 | - $data['host_app_version']['et_n'] = array( |
|
| 1596 | + ); |
|
| 1597 | + $data['host_app_version']['et_n'] = array( |
|
| 1598 | 1598 | 'title' => bts('Number of tasks completed', array(), NULL, 'boinc:application-details'), |
| 1599 | 1599 | 'help' => t('The tasks completed for this app and by this host.'), |
| 1600 | 1600 | 'field' => array( |
| 1601 | - 'handler' => 'views_handler_field_numeric', |
|
| 1602 | - 'click sortable' => TRUE |
|
| 1601 | + 'handler' => 'views_handler_field_numeric', |
|
| 1602 | + 'click sortable' => TRUE |
|
| 1603 | 1603 | ), |
| 1604 | 1604 | 'filter' => array( |
| 1605 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1605 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1606 | 1606 | ), |
| 1607 | 1607 | 'sort' => array( |
| 1608 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1608 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1609 | 1609 | ) |
| 1610 | - ); |
|
| 1611 | - $data['host_app_version']['max_jobs_per_day'] = array( |
|
| 1610 | + ); |
|
| 1611 | + $data['host_app_version']['max_jobs_per_day'] = array( |
|
| 1612 | 1612 | 'title' => bts('Max tasks per day', array(), NULL, 'boinc:application-details'), |
| 1613 | 1613 | 'help' => t('The maximum tasks per day for this app and by this host.'), |
| 1614 | 1614 | 'field' => array( |
| 1615 | - 'handler' => 'views_handler_field_numeric', |
|
| 1616 | - 'click sortable' => TRUE |
|
| 1615 | + 'handler' => 'views_handler_field_numeric', |
|
| 1616 | + 'click sortable' => TRUE |
|
| 1617 | 1617 | ), |
| 1618 | 1618 | 'filter' => array( |
| 1619 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1619 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1620 | 1620 | ), |
| 1621 | 1621 | 'sort' => array( |
| 1622 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1622 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1623 | 1623 | ) |
| 1624 | - ); |
|
| 1625 | - $data['host_app_version']['n_jobs_today'] = array( |
|
| 1624 | + ); |
|
| 1625 | + $data['host_app_version']['n_jobs_today'] = array( |
|
| 1626 | 1626 | 'title' => bts('Number of tasks today', array(), NULL, 'boinc:application-details'), |
| 1627 | 1627 | 'help' => t('The number of tasks today for this app and by this host.'), |
| 1628 | 1628 | 'field' => array( |
| 1629 | - 'handler' => 'views_handler_field_numeric', |
|
| 1630 | - 'click sortable' => TRUE |
|
| 1629 | + 'handler' => 'views_handler_field_numeric', |
|
| 1630 | + 'click sortable' => TRUE |
|
| 1631 | 1631 | ), |
| 1632 | 1632 | 'filter' => array( |
| 1633 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1633 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1634 | 1634 | ), |
| 1635 | 1635 | 'sort' => array( |
| 1636 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1636 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1637 | 1637 | ) |
| 1638 | - ); |
|
| 1639 | - $data['host_app_version']['turnaround_avg'] = array( |
|
| 1638 | + ); |
|
| 1639 | + $data['host_app_version']['turnaround_avg'] = array( |
|
| 1640 | 1640 | 'title' => bts('Average turnaround time', array(), NULL, 'boinc:application-details:-1:ignoreoverwrite'), |
| 1641 | 1641 | 'help' => t('The average turnaround time per task for this app and by this host.'), |
| 1642 | 1642 | 'field' => array( |
| 1643 | - 'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg', |
|
| 1644 | - 'click sortable' => TRUE, |
|
| 1645 | - 'float' => TRUE, |
|
| 1643 | + 'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg', |
|
| 1644 | + 'click sortable' => TRUE, |
|
| 1645 | + 'float' => TRUE, |
|
| 1646 | 1646 | ), |
| 1647 | 1647 | 'filter' => array( |
| 1648 | - 'handler' => 'views_handler_filter_numeric' |
|
| 1648 | + 'handler' => 'views_handler_filter_numeric' |
|
| 1649 | 1649 | ), |
| 1650 | 1650 | 'sort' => array( |
| 1651 | - 'handler' => 'views_handler_sort_numeric' |
|
| 1651 | + 'handler' => 'views_handler_sort_numeric' |
|
| 1652 | 1652 | ) |
| 1653 | - ); |
|
| 1654 | - $data['host_app_version']['user_friendly_name'] = array( |
|
| 1653 | + ); |
|
| 1654 | + $data['host_app_version']['user_friendly_name'] = array( |
|
| 1655 | 1655 | 'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), |
| 1656 | 1656 | 'help' => t('The user friendly name of the application.'), |
| 1657 | 1657 | 'field' => array( |
| 1658 | - 'handler' => 'views_handler_field', |
|
| 1659 | - 'click sortable' => TRUE |
|
| 1658 | + 'handler' => 'views_handler_field', |
|
| 1659 | + 'click sortable' => TRUE |
|
| 1660 | 1660 | ), |
| 1661 | 1661 | 'filter' => array( |
| 1662 | - 'handler' => 'views_handler_filter_string' |
|
| 1662 | + 'handler' => 'views_handler_filter_string' |
|
| 1663 | 1663 | ), |
| 1664 | 1664 | 'sort' => array( |
| 1665 | - 'handler' => 'views_handler_sort_string' |
|
| 1665 | + 'handler' => 'views_handler_sort_string' |
|
| 1666 | 1666 | ) |
| 1667 | - ); |
|
| 1667 | + ); |
|
| 1668 | 1668 | |
| 1669 | - return $data; |
|
| 1669 | + return $data; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | /* |
@@ -1678,23 +1678,23 @@ discard block |
||
| 1678 | 1678 | |
| 1679 | 1679 | function boincwork_views_handlers() { |
| 1680 | 1680 | |
| 1681 | - return array( |
|
| 1681 | + return array( |
|
| 1682 | 1682 | 'info' => array( |
| 1683 | - 'path' => drupal_get_path('module', 'boincwork') . '/views', |
|
| 1683 | + 'path' => drupal_get_path('module', 'boincwork') . '/views', |
|
| 1684 | 1684 | ), |
| 1685 | 1685 | 'handlers' => array( |
| 1686 | - 'views_handler_argument_boincuser_id' => array( |
|
| 1686 | + 'views_handler_argument_boincuser_id' => array( |
|
| 1687 | 1687 | 'parent' => 'views_handler_argument_numeric' |
| 1688 | - ), |
|
| 1689 | - 'views_handler_field_boincwork_app_version_number' => array( |
|
| 1688 | + ), |
|
| 1689 | + 'views_handler_field_boincwork_app_version_number' => array( |
|
| 1690 | 1690 | 'parent' => 'views_handler_field_numeric' |
| 1691 | - ), |
|
| 1692 | - 'views_handler_field_boincwork_host_app_et_avg' => array( |
|
| 1691 | + ), |
|
| 1692 | + 'views_handler_field_boincwork_host_app_et_avg' => array( |
|
| 1693 | 1693 | 'parent' => 'views_handler_field_numeric' |
| 1694 | - ), |
|
| 1695 | - 'views_handler_field_boincwork_host_app_turnaround_avg' => array( |
|
| 1694 | + ), |
|
| 1695 | + 'views_handler_field_boincwork_host_app_turnaround_avg' => array( |
|
| 1696 | 1696 | 'parent' => 'views_handler_field_numeric' |
| 1697 | - ), |
|
| 1697 | + ), |
|
| 1698 | 1698 | ) |
| 1699 | - ); |
|
| 1699 | + ); |
|
| 1700 | 1700 | } |
@@ -180,12 +180,12 @@ |
||
| 180 | 180 | */ |
| 181 | 181 | function boincwork_locale($op = 'groups', $group = NULL) { |
| 182 | 182 | switch ($op) { |
| 183 | - case 'groups': |
|
| 184 | - return array('project' => bts('Project')); |
|
| 185 | - case 'info': |
|
| 186 | - $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
|
| 187 | - $info['project']['format'] = FALSE; |
|
| 188 | - return $info; |
|
| 183 | + case 'groups': |
|
| 184 | + return array('project' => bts('Project')); |
|
| 185 | + case 'info': |
|
| 186 | + $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
|
| 187 | + $info['project']['format'] = FALSE; |
|
| 188 | + return $info; |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
@@ -279,8 +279,7 @@ discard block |
||
| 279 | 279 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
| 280 | 280 | 'query' => 'destination=messages/view/' . $thread_id, |
| 281 | 281 | ); |
| 282 | - } |
|
| 283 | - else { |
|
| 282 | + } else { |
|
| 284 | 283 | $vars['message_actions']['ignore_user'] = array( |
| 285 | 284 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
| 286 | 285 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
@@ -387,8 +386,7 @@ discard block |
||
| 387 | 386 | } |
| 388 | 387 | if (!$special) { |
| 389 | 388 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
| 390 | - } |
|
| 391 | - else { |
|
| 389 | + } else { |
|
| 392 | 390 | // The "very special" case where we merge two prefs |
| 393 | 391 | $second_pref = $special_map[$name]; |
| 394 | 392 | $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
@@ -396,8 +394,7 @@ discard block |
||
| 396 | 394 | $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
| 397 | 395 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
| 398 | 396 | } |
| 399 | - } |
|
| 400 | - else { |
|
| 397 | + } else { |
|
| 401 | 398 | $output .= '<td>---</td>'; |
| 402 | 399 | } |
| 403 | 400 | } |
@@ -923,22 +920,19 @@ discard block |
||
| 923 | 920 | drupal_set_message(t('Host @id has been removed from your account.', |
| 924 | 921 | array('@id' => $host_id))); |
| 925 | 922 | drupal_goto('account/computers'); |
| 926 | - } |
|
| 927 | - else { |
|
| 923 | + } else { |
|
| 928 | 924 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
| 929 | 925 | array('@id' => $host_id)), 'error' |
| 930 | 926 | ); |
| 931 | 927 | } |
| 932 | - } |
|
| 933 | - else { |
|
| 928 | + } else { |
|
| 934 | 929 | drupal_set_message(t('Host @id cannot be deleted because it still has |
| 935 | 930 | tasks associated with it. These tasks should be processed within the |
| 936 | 931 | next few days, after which the host can be deleted.', |
| 937 | 932 | array('@id' => $host_id)), 'warning' |
| 938 | 933 | ); |
| 939 | 934 | } |
| 940 | - } |
|
| 941 | - else { |
|
| 935 | + } else { |
|
| 942 | 936 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
| 943 | 937 | delete it.', |
| 944 | 938 | array('@id' => $host_id)), 'error' |
@@ -986,15 +980,13 @@ discard block |
||
| 986 | 980 | bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
| 987 | 981 | . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
| 988 | 982 | ); |
| 989 | - } |
|
| 990 | - else { |
|
| 983 | + } else { |
|
| 991 | 984 | drupal_set_message( |
| 992 | 985 | bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
| 993 | 986 | 'error' |
| 994 | 987 | ); |
| 995 | 988 | } |
| 996 | - } |
|
| 997 | - else { |
|
| 989 | + } else { |
|
| 998 | 990 | drupal_set_message( |
| 999 | 991 | bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
| 1000 | 992 | 'warning' |
@@ -1129,8 +1121,7 @@ discard block |
||
| 1129 | 1121 | $venue = $active_venue; |
| 1130 | 1122 | //unset($_SESSION['prefs venue']); |
| 1131 | 1123 | } |
| 1132 | - } |
|
| 1133 | - else { |
|
| 1124 | + } else { |
|
| 1134 | 1125 | // Set the active venue to keep it selected between computing and project |
| 1135 | 1126 | // preference pages |
| 1136 | 1127 | $_SESSION['prefs venue'] = $venue; |
@@ -232,13 +232,13 @@ discard block |
||
| 232 | 232 | /** |
| 233 | 233 | * Implementation of hook_locale(). |
| 234 | 234 | */ |
| 235 | -function boincwork_locale($op = 'groups', $group = NULL) { |
|
| 235 | +function boincwork_locale($op = 'groups', $group = null) { |
|
| 236 | 236 | switch ($op) { |
| 237 | 237 | case 'groups': |
| 238 | 238 | return array('project' => bts('Project')); |
| 239 | 239 | case 'info': |
| 240 | 240 | $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
| 241 | - $info['project']['format'] = FALSE; |
|
| 241 | + $info['project']['format'] = false; |
|
| 242 | 242 | return $info; |
| 243 | 243 | } |
| 244 | 244 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | 'project_specific' => array(), |
| 255 | 255 | ); |
| 256 | 256 | boincwork_add_project_specific_prefs($form, $prefs); |
| 257 | - return TRUE; // Meaning it completed with no issues |
|
| 257 | + return true; // Meaning it completed with no issues |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -275,14 +275,14 @@ discard block |
||
| 275 | 275 | if ($user->uid != $author->uid) { |
| 276 | 276 | if ($vars['message']['is_blocked']) { |
| 277 | 277 | $vars['message_actions']['unignore_user'] = array( |
| 278 | - 'title' => bts('Stop Ignoring User', array(), NULL, 'boinc:ignore-user-remove'), |
|
| 278 | + 'title' => bts('Stop Ignoring User', array(), null, 'boinc:ignore-user-remove'), |
|
| 279 | 279 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
| 280 | 280 | 'query' => 'destination=messages/view/' . $thread_id, |
| 281 | 281 | ); |
| 282 | 282 | } |
| 283 | 283 | else { |
| 284 | 284 | $vars['message_actions']['ignore_user'] = array( |
| 285 | - 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
|
| 285 | + 'title' => bts('Ignore User', array(), null, 'boinc:ignore-user-add'), |
|
| 286 | 286 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
| 287 | 287 | 'query' => 'destination=messages/view/' . $thread_id, |
| 288 | 288 | ); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | require_boinc('boinc_db'); |
| 299 | 299 | $num_deleted = BoincHostDeleted::delete_expired(); |
| 300 | 300 | if ($num_deleted>0) { |
| 301 | - watchdog('boincwork', "Deleted ${num_deleted} hosts from host_deleted table", WATCHDOG_NOTICE); |
|
| 301 | + watchdog('boincwork', "deleted ${num_deleted} hosts from host_deleted table", WATCHDOG_NOTICE); |
|
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * General preferences menu callback. |
| 311 | 311 | * Called when user goes to edit preferences page |
| 312 | 312 | */ |
| 313 | -function generalprefs_page($action = null, $venue = null, $advanced = FALSE) { |
|
| 313 | +function generalprefs_page($action = null, $venue = null, $advanced = false) { |
|
| 314 | 314 | |
| 315 | 315 | // Keep the venue selected across preference pages |
| 316 | 316 | boincwork_select_venue($venue); |
@@ -325,8 +325,8 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | case 'clear': |
| 327 | 327 | // Remove settings from this preference set |
| 328 | - if ($venue AND $venue != 'generic') { |
|
| 329 | - boincwork_save_prefs(NULL, 'general', $venue); |
|
| 328 | + if ($venue and $venue != 'generic') { |
|
| 329 | + boincwork_save_prefs(null, 'general', $venue); |
|
| 330 | 330 | drupal_set_message(t('Settings for the "@name" preference set have been |
| 331 | 331 | cleared', array('@name' => ucfirst($venue)))); |
| 332 | 332 | // Set the generic preference set as active |
@@ -344,10 +344,10 @@ discard block |
||
| 344 | 344 | drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>'; |
|
| 348 | - $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), NULL, 'boinc:account-preferences-computing') . '</p>'; |
|
| 349 | - $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>'; |
|
| 350 | - $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing') . '</h2>'; |
|
| 347 | + $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), null, 'boinc:account-preferences-computing') . '<br/>'; |
|
| 348 | + $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), null, 'boinc:account-preferences-computing') . '</p>'; |
|
| 349 | + $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), null, 'boinc:account-preferences') . '</p>'; |
|
| 350 | + $output .= '<h2>' . bts('Combined preferences', array(), null, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/computing') . '</h2>'; |
|
| 351 | 351 | |
| 352 | 352 | $output .= '<table class="preferences combined">'; |
| 353 | 353 | |
@@ -369,9 +369,9 @@ discard block |
||
| 369 | 369 | 'daily_xfer_limit_mb' => 'daily_xfer_period_days', |
| 370 | 370 | ); |
| 371 | 371 | $special_delimiter = array( |
| 372 | - 'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 373 | - 'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 374 | - 'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'), |
|
| 372 | + 'start_hour' => bts('and', array(), null, 'boinc:account-preference'), |
|
| 373 | + 'net_start_hour'=> bts('and', array(), null, 'boinc:account-preference'), |
|
| 374 | + 'daily_xfer_limit_mb' => bts('every', array(), null, 'boinc:account-preference'), |
|
| 375 | 375 | ); |
| 376 | 376 | $special = isset($special_map[$name]); |
| 377 | 377 | $very_special = in_array($name, $special_map); |
@@ -386,8 +386,8 @@ discard block |
||
| 386 | 386 | // Output values for each preference set, again with ugly hacks for |
| 387 | 387 | // time range preferences |
| 388 | 388 | foreach ($pref_sets as $pref_set) { |
| 389 | - if (($prefs[$pref_set]) AND |
|
| 390 | - $prefs[$pref_set]['#established'] AND |
|
| 389 | + if (($prefs[$pref_set]) and |
|
| 390 | + $prefs[$pref_set]['#established'] and |
|
| 391 | 391 | isset($prefs[$pref_set]['prefs']['advanced'][$category])) { |
| 392 | 392 | $pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$name]; |
| 393 | 393 | $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value']; |
@@ -430,19 +430,19 @@ discard block |
||
| 430 | 430 | $output .= '<tr>'; |
| 431 | 431 | $output .= '<td></td>'; |
| 432 | 432 | foreach ($pref_sets as $pref_set) { |
| 433 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 433 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), null, 'boinc:form-edit') : bts('Add', array(), null, 'boinc:form-add'); |
|
| 434 | 434 | $output .= '<td><ul class="tab-list"><li class="first tab">'; |
| 435 | 435 | $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1", |
| 436 | 436 | array('fragment' => "") |
| 437 | 437 | ); |
| 438 | 438 | // Show Clear links for established preference sets |
| 439 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 440 | - $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}", |
|
| 439 | + if ($pref_set != 'generic' and $prefs[$pref_set]['#established']) { |
|
| 440 | + $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}", |
|
| 441 | 441 | array( |
| 442 | 442 | 'query' => drupal_get_destination(), |
| 443 | 443 | 'attributes' => array( |
| 444 | 444 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
| 445 | - array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')' |
|
| 445 | + array('@name' => ucfirst($pref_set)), null, 'boinc:account-computing-preferences') . '\')' |
|
| 446 | 446 | ) |
| 447 | 447 | ) |
| 448 | 448 | ); |
@@ -462,10 +462,10 @@ discard block |
||
| 462 | 462 | if (function_exists('jump_quickly')) { |
| 463 | 463 | $path = 'account/prefs/computing/edit'; |
| 464 | 464 | $venues = array( |
| 465 | - "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
|
| 466 | - "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
|
| 467 | - "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
|
| 468 | - "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
|
| 465 | + "{$path}/generic" => bts('Generic', array(), null, 'boinc:account-preferences-location'), |
|
| 466 | + "{$path}/home" => bts('Home', array(), null, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
|
| 467 | + "{$path}/school" => bts('School', array(), null, 'boinc:account-preferences-location'), |
|
| 468 | + "{$path}/work" => bts('Work', array(), null, 'boinc:account-preferences-location') |
|
| 469 | 469 | ); |
| 470 | 470 | variable_set('jump_use_js_venues-Array', 1); |
| 471 | 471 | drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | $output .= ' </div>'; |
| 479 | 479 | $output .= '</div>'; |
| 480 | 480 | } |
| 481 | - $output .= drupal_get_form('boincwork_generalprefs_form', $venue, NULL, $advanced); |
|
| 481 | + $output .= drupal_get_form('boincwork_generalprefs_form', $venue, null, $advanced); |
|
| 482 | 482 | |
| 483 | 483 | // If viewing the edit page for a preference set that doesn't |
| 484 | 484 | // exist, inform the user that preferences are not set. |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | drupal_set_message(bts( |
| 491 | 491 | "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
| 492 | 492 | array( '@venue' => $venue, ), |
| 493 | - NULL, 'boinc:account-preferences'), 'status'); |
|
| 493 | + null, 'boinc:account-preferences'), 'status'); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | break; |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | case 'clear': |
| 522 | 522 | // Remove settings from this preference set |
| 523 | - if ($venue AND $venue != 'generic') { |
|
| 524 | - boincwork_save_prefs(NULL, 'project', $venue); |
|
| 523 | + if ($venue and $venue != 'generic') { |
|
| 524 | + boincwork_save_prefs(null, 'project', $venue); |
|
| 525 | 525 | drupal_set_message(t('Settings for the "@name" preference set have been |
| 526 | 526 | cleared', array('@name' => ucfirst($venue)))); |
| 527 | 527 | |
@@ -548,8 +548,8 @@ discard block |
||
| 548 | 548 | drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>'; |
|
| 552 | - $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project') . '</h2>'; |
|
| 551 | + $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), null, 'boinc:account-preferences') . '</p>'; |
|
| 552 | + $output .= '<h2>' . bts('Combined preferences', array(), null, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/project') . '</h2>'; |
|
| 553 | 553 | |
| 554 | 554 | $output .= '<table class="preferences combined">'; |
| 555 | 555 | |
@@ -569,8 +569,8 @@ discard block |
||
| 569 | 569 | $output .= "<div class=\"description\">{$setting['description']}</div>"; |
| 570 | 570 | $output .= '</td>'; |
| 571 | 571 | foreach ($pref_sets as $pref_set) { |
| 572 | - if (($prefs[$pref_set]) AND |
|
| 573 | - $prefs[$pref_set]['#established'] AND |
|
| 572 | + if (($prefs[$pref_set]) and |
|
| 573 | + $prefs[$pref_set]['#established'] and |
|
| 574 | 574 | isset($prefs[$pref_set][$category])) { |
| 575 | 575 | $pref_setting = $prefs[$pref_set][$category][$name]; |
| 576 | 576 | $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value']; |
@@ -596,17 +596,17 @@ discard block |
||
| 596 | 596 | $output .= '<tr>'; |
| 597 | 597 | $output .= '<td></td>'; |
| 598 | 598 | foreach ($pref_sets as $pref_set) { |
| 599 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 599 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), null, 'boinc:form-edit') : bts('Add', array(), null, 'boinc:form-add'); |
|
| 600 | 600 | $output .= '<td><ul class="tab-list"><li class="first tab">'; |
| 601 | 601 | $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
| 602 | 602 | // Show Clear links for established preference sets |
| 603 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 604 | - $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}", |
|
| 603 | + if ($pref_set != 'generic' and $prefs[$pref_set]['#established']) { |
|
| 604 | + $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}", |
|
| 605 | 605 | array( |
| 606 | 606 | 'query' => drupal_get_destination(), |
| 607 | 607 | 'attributes' => array( |
| 608 | 608 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
| 609 | - array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')' |
|
| 609 | + array('@name' => ucfirst($pref_set)), null, 'boinc:account-preferences-project') . '\')' |
|
| 610 | 610 | ) |
| 611 | 611 | ) |
| 612 | 612 | ); |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | // Set this preference set as the one to use for any new hosts attached |
| 623 | 623 | // to the user account |
| 624 | 624 | boincwork_set_default_venue($venue); |
| 625 | - drupal_set_message( bts('The primary preference set has been changed to "@set"', array('@set' => $venue), NULL, 'boinc:account-preferences-project') ); |
|
| 625 | + drupal_set_message( bts('The primary preference set has been changed to "@set"', array('@set' => $venue), null, 'boinc:account-preferences-project') ); |
|
| 626 | 626 | drupal_goto('account/prefs/project/combined'); |
| 627 | 627 | break; |
| 628 | 628 | |
@@ -635,10 +635,10 @@ discard block |
||
| 635 | 635 | if (function_exists('jump_quickly')) { |
| 636 | 636 | $path = 'account/prefs/project/edit'; |
| 637 | 637 | $venues = array( |
| 638 | - "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
|
| 639 | - "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
|
| 640 | - "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
|
| 641 | - "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
|
| 638 | + "{$path}/generic" => bts('Generic', array(), null, 'boinc:account-preferences-location'), |
|
| 639 | + "{$path}/home" => bts('Home', array(), null, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
|
| 640 | + "{$path}/school" => bts('School', array(), null, 'boinc:account-preferences-location'), |
|
| 641 | + "{$path}/work" => bts('Work', array(), null, 'boinc:account-preferences-location') |
|
| 642 | 642 | ); |
| 643 | 643 | variable_set('jump_use_js_venues-Array', 1); |
| 644 | 644 | drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | drupal_set_message(bts( |
| 664 | 664 | "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
| 665 | 665 | array( '@venue' => $venue, ), |
| 666 | - NULL, 'boinc:account-preferences'), 'status'); |
|
| 666 | + null, 'boinc:account-preferences'), 'status'); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | break; |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | foreach ($section as $name => $setting) { |
| 720 | 720 | if ($name{0} == '#') continue; |
| 721 | 721 | $value = isset($setting['#default_value']) ? $setting['#default_value'] : ''; |
| 722 | - if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value]; |
|
| 722 | + if ($value and isset($setting['#options'])) $value = $setting['#options'][$value]; |
|
| 723 | 723 | elseif ($value == '') $value = '---'; |
| 724 | 724 | if (!isset($setting['#title'])) $setting['#title'] = ''; |
| 725 | 725 | if (!isset($setting['#description'])) $setting['#description'] = ''; |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | // Edit preferences link |
| 735 | 735 | $output .= '<tr>'; |
| 736 | 736 | $output .= '<td></td>'; |
| 737 | - $output .= '<td>' . l(bts('Edit privacy preferences', array('@project' => PROJECT), NULL, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit") . '</td>'; |
|
| 737 | + $output .= '<td>' . l(bts('Edit privacy preferences', array('@project' => PROJECT), null, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit") . '</td>'; |
|
| 738 | 738 | $output .= '</tr>'; |
| 739 | 739 | |
| 740 | 740 | $output .= '</table>'; |
@@ -966,17 +966,17 @@ discard block |
||
| 966 | 966 | function boincwork_host_log($host_id = null) { |
| 967 | 967 | $root_log_dir = variable_get('boinc_host_sched_logs_dir', ''); |
| 968 | 968 | $log = ''; |
| 969 | - if ($root_log_dir AND $host_id) { |
|
| 970 | - $subdir = substr($host_id, 0, -3) OR $subdir = 0; |
|
| 969 | + if ($root_log_dir and $host_id) { |
|
| 970 | + $subdir = substr($host_id, 0, -3) or $subdir = 0; |
|
| 971 | 971 | $log = implode('/', array($root_log_dir, $subdir, $host_id)); |
| 972 | 972 | } |
| 973 | - if ($log AND file_exists($log)) { |
|
| 973 | + if ($log and file_exists($log)) { |
|
| 974 | 974 | header('Content-type: text/plain'); |
| 975 | 975 | include($log); |
| 976 | 976 | } |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | -function boincwork_host_set_venue($host_id = NULL, $venue = NULL) { |
|
| 979 | +function boincwork_host_set_venue($host_id = null, $venue = null) { |
|
| 980 | 980 | global $user; |
| 981 | 981 | $account = user_load($user->uid); |
| 982 | 982 | db_set_active('boinc_ro'); |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | $host_id |
| 987 | 987 | )); |
| 988 | 988 | db_set_active('default'); |
| 989 | - if ($host_owner AND $host_owner == $account->boincuser_id) { |
|
| 989 | + if ($host_owner and $host_owner == $account->boincuser_id) { |
|
| 990 | 990 | db_set_active('boinc_rw'); |
| 991 | 991 | $updated = db_query( |
| 992 | 992 | "UPDATE {host} SET venue = '%s' WHERE id = '%d'", |
@@ -995,20 +995,20 @@ discard block |
||
| 995 | 995 | db_set_active('default'); |
| 996 | 996 | if ($updated) { |
| 997 | 997 | drupal_set_message( |
| 998 | - bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
|
| 999 | - . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
|
| 998 | + bts('The location for this host has been updated.', array(), null, 'boinc:account-host-details') |
|
| 999 | + . bts('This will take effect next time the host contacts the project.', array(), null, 'boinc:account-host-details') |
|
| 1000 | 1000 | ); |
| 1001 | 1001 | } |
| 1002 | 1002 | else { |
| 1003 | 1003 | drupal_set_message( |
| 1004 | - bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
|
| 1004 | + bts('Unable to save changes to this host for some reason!', array(), null, 'boinc:account-host-details'), |
|
| 1005 | 1005 | 'error' |
| 1006 | 1006 | ); |
| 1007 | 1007 | } |
| 1008 | 1008 | } |
| 1009 | 1009 | else { |
| 1010 | 1010 | drupal_set_message( |
| 1011 | - bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
|
| 1011 | + bts('You are not allowed to make changes to this host.', array(), null, 'boinc:account-host-details'), |
|
| 1012 | 1012 | 'warning' |
| 1013 | 1013 | ); |
| 1014 | 1014 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | |
| 1061 | 1061 | // obtain Drupal variables |
| 1062 | 1062 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
| 1063 | - $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE); |
|
| 1063 | + $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', false); |
|
| 1064 | 1064 | |
| 1065 | 1065 | // If terms of use string exists and override is true, set terms-of-use |
| 1066 | 1066 | // to Drupal varaible. |
@@ -1096,8 +1096,8 @@ discard block |
||
| 1096 | 1096 | /** |
| 1097 | 1097 | * Page callback for user account task table |
| 1098 | 1098 | */ |
| 1099 | -function boincwork_account_task_table($tselect = NULL, $app_id = NULL) { |
|
| 1100 | - $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table'); |
|
| 1099 | +function boincwork_account_task_table($tselect = null, $app_id = null) { |
|
| 1100 | + $title = bts('Tasks for your account', array(), null, 'boinc:account-task-table'); |
|
| 1101 | 1101 | drupal_set_title($title); |
| 1102 | 1102 | |
| 1103 | 1103 | global $user; |
@@ -1108,14 +1108,14 @@ discard block |
||
| 1108 | 1108 | /** |
| 1109 | 1109 | * Page callback for host task table |
| 1110 | 1110 | */ |
| 1111 | -function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) { |
|
| 1111 | +function boincwork_host_task_table($host_id = null, $tselect = null, $app_id = null) { |
|
| 1112 | 1112 | require_boinc( array('util', 'result') ); |
| 1113 | 1113 | |
| 1114 | - $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
|
| 1114 | + $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), null, 'boinc:host-task-table'); |
|
| 1115 | 1115 | drupal_set_title($title); |
| 1116 | 1116 | |
| 1117 | 1117 | if (is_null($host_id)) { |
| 1118 | - drupal_set_message(bts('ERROR: Invalid host ID', array(), NULL, 'boinc:host-task-table'), 'error'); |
|
| 1118 | + drupal_set_message(bts('ERROR: Invalid host ID', array(), null, 'boinc:host-task-table'), 'error'); |
|
| 1119 | 1119 | return ''; |
| 1120 | 1120 | } |
| 1121 | 1121 | |
@@ -1125,12 +1125,12 @@ discard block |
||
| 1125 | 1125 | /** |
| 1126 | 1126 | * Page callback for workunit task table |
| 1127 | 1127 | */ |
| 1128 | -function boincwork_workunit_task_table($workunit_id = NULL, $tselect = NULL, $app_id = NULL) { |
|
| 1129 | - $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table'); |
|
| 1128 | +function boincwork_workunit_task_table($workunit_id = null, $tselect = null, $app_id = null) { |
|
| 1129 | + $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), null, 'boinc:workunit-task-table'); |
|
| 1130 | 1130 | drupal_set_title($title); |
| 1131 | 1131 | |
| 1132 | 1132 | if (is_null($workunit_id)) { |
| 1133 | - drupal_set_message(bts('ERROR: Invalid workunit ID', array(), NULL, 'boinc:workunit-task-table'), 'error'); |
|
| 1133 | + drupal_set_message(bts('ERROR: Invalid workunit ID', array(), null, 'boinc:workunit-task-table'), 'error'); |
|
| 1134 | 1134 | return ''; |
| 1135 | 1135 | } |
| 1136 | 1136 | |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | */ |
| 1157 | 1157 | function boincwork_select_venue(&$venue) { |
| 1158 | 1158 | if (!$venue) { |
| 1159 | - $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : NULL; |
|
| 1159 | + $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : null; |
|
| 1160 | 1160 | if ($active_venue) { |
| 1161 | 1161 | $venue = $active_venue; |
| 1162 | 1162 | //unset($_SESSION['prefs venue']); |
@@ -2,9 +2,9 @@ discard block |
||
| 2 | 2 | // $Id$ |
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | - * @file |
|
| 6 | - * Enable BOINC features related to processing work and credit. |
|
| 7 | - */ |
|
| 5 | + * @file |
|
| 6 | + * Enable BOINC features related to processing work and credit. |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -20,70 +20,70 @@ discard block |
||
| 20 | 20 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * Implementation of hook_menu(). |
|
| 24 | - */ |
|
| 23 | + * Implementation of hook_menu(). |
|
| 24 | + */ |
|
| 25 | 25 | function boincwork_menu() { |
| 26 | - require_boinc('util'); |
|
| 27 | - $items['account/prefs'] = array( |
|
| 26 | + require_boinc('util'); |
|
| 27 | + $items['account/prefs'] = array( |
|
| 28 | 28 | 'title' => 'Computing', |
| 29 | 29 | 'description' => '', |
| 30 | 30 | 'page callback' => 'generalprefs_page', |
| 31 | 31 | 'access callback' => 'user_is_logged_in', |
| 32 | 32 | 'type' => MENU_NORMAL_ITEM |
| 33 | - ); |
|
| 34 | - $items['account/prefs/computing'] = array( |
|
| 33 | + ); |
|
| 34 | + $items['account/prefs/computing'] = array( |
|
| 35 | 35 | 'title' => 'Computing', |
| 36 | 36 | 'page callback' => 'generalprefs_page', |
| 37 | 37 | 'access callback' => 'user_is_logged_in', |
| 38 | 38 | 'type' => MENU_DEFAULT_LOCAL_TASK, |
| 39 | 39 | 'weight' => 0 |
| 40 | - ); |
|
| 41 | - $items['account/prefs/project'] = array( |
|
| 40 | + ); |
|
| 41 | + $items['account/prefs/project'] = array( |
|
| 42 | 42 | 'title' => 'Project', |
| 43 | 43 | 'page callback' => 'projectprefs_page', |
| 44 | 44 | 'access callback' => 'user_is_logged_in', |
| 45 | 45 | 'type' => MENU_LOCAL_TASK, |
| 46 | 46 | 'weight' => 5 |
| 47 | - ); |
|
| 48 | - $items['account/prefs/community'] = array( |
|
| 47 | + ); |
|
| 48 | + $items['account/prefs/community'] = array( |
|
| 49 | 49 | 'title' => 'Community', |
| 50 | 50 | 'page callback' => 'communityprefs_page', |
| 51 | 51 | 'access callback' => 'user_is_logged_in', |
| 52 | 52 | 'type' => MENU_LOCAL_TASK, |
| 53 | 53 | 'weight' => 10 |
| 54 | - ); |
|
| 55 | - $items['account/prefs/privacy'] = array( |
|
| 54 | + ); |
|
| 55 | + $items['account/prefs/privacy'] = array( |
|
| 56 | 56 | 'title' => 'Privacy', |
| 57 | 57 | 'page callback' => 'privacyprefs_page', |
| 58 | 58 | 'access callback' => 'user_is_logged_in', |
| 59 | 59 | 'type' => MENU_LOCAL_TASK, |
| 60 | 60 | 'weight' => 15 |
| 61 | - ); |
|
| 62 | - if (module_exists('ignore_user')) { |
|
| 61 | + ); |
|
| 62 | + if (module_exists('ignore_user')) { |
|
| 63 | 63 | $items['account/prefs/privacy/ignore_user/add'] = array( |
| 64 | - 'title' => 'Add from ignore list', |
|
| 65 | - 'description' => 'Add user that you with to ignore to your ignore list.', |
|
| 66 | - 'page callback' => 'boincwork_ignore_user_add_user', |
|
| 67 | - 'access callback' => 'user_access', |
|
| 68 | - 'access arguments' => array('ignore user'), |
|
| 69 | - 'type' => MENU_CALLBACK, |
|
| 64 | + 'title' => 'Add from ignore list', |
|
| 65 | + 'description' => 'Add user that you with to ignore to your ignore list.', |
|
| 66 | + 'page callback' => 'boincwork_ignore_user_add_user', |
|
| 67 | + 'access callback' => 'user_access', |
|
| 68 | + 'access arguments' => array('ignore user'), |
|
| 69 | + 'type' => MENU_CALLBACK, |
|
| 70 | 70 | ); |
| 71 | 71 | $items['account/prefs/privacy/ignore_user/remove'] = array( |
| 72 | - 'title' => 'Remove from ignore list', |
|
| 73 | - 'description' => 'Remove user from your ignore list.', |
|
| 74 | - 'page callback' => 'boincwork_ignore_user_remove_user', |
|
| 75 | - 'access callback' => 'user_access', |
|
| 76 | - 'access arguments' => array('ignore user'), |
|
| 77 | - 'type' => MENU_CALLBACK, |
|
| 72 | + 'title' => 'Remove from ignore list', |
|
| 73 | + 'description' => 'Remove user from your ignore list.', |
|
| 74 | + 'page callback' => 'boincwork_ignore_user_remove_user', |
|
| 75 | + 'access callback' => 'user_access', |
|
| 76 | + 'access arguments' => array('ignore user'), |
|
| 77 | + 'type' => MENU_CALLBACK, |
|
| 78 | 78 | ); |
| 79 | - }// endif module_exists |
|
| 80 | - $items['account/certs'] = array( |
|
| 79 | + }// endif module_exists |
|
| 80 | + $items['account/certs'] = array( |
|
| 81 | 81 | 'title' =>'Account certificate', |
| 82 | 82 | 'page callback' => 'boincwork_certificates', |
| 83 | 83 | 'access arguments' => array('access content'), |
| 84 | 84 | 'type' => MENU_CALLBACK |
| 85 | - ); |
|
| 86 | - $items['admin/boinc/prefs/general'] = array( |
|
| 85 | + ); |
|
| 86 | + $items['admin/boinc/prefs/general'] = array( |
|
| 87 | 87 | 'title' => 'Preferences: General', |
| 88 | 88 | 'description' => 'Set options for BOINC preference set pages', |
| 89 | 89 | 'page callback' => 'drupal_get_form', |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | 'access arguments' => array('administer site configuration'), |
| 92 | 92 | 'type' => MENU_NORMAL_ITEM, |
| 93 | 93 | 'file' => 'boincwork.admin.inc' |
| 94 | - ); |
|
| 95 | - $items['admin/boinc/prefs/presets'] = array( |
|
| 94 | + ); |
|
| 95 | + $items['admin/boinc/prefs/presets'] = array( |
|
| 96 | 96 | 'title' => 'Preferences: Presets', |
| 97 | 97 | 'description' => 'Set values for BOINC preference set presets.', |
| 98 | 98 | 'page callback' => 'boincwork_admin_prefs_presets_page', |
| 99 | 99 | 'access arguments' => array('administer site configuration'), |
| 100 | 100 | 'type' => MENU_NORMAL_ITEM, |
| 101 | 101 | 'file' => 'boincwork.admin.inc' |
| 102 | - ); |
|
| 103 | - $items['admin/boinc/prefs/upload'] = array( |
|
| 102 | + ); |
|
| 103 | + $items['admin/boinc/prefs/upload'] = array( |
|
| 104 | 104 | 'title' => 'Preferences: Project-specific XML upload', |
| 105 | 105 | 'description' => 'Upload XML configuration for project specific preferences.', |
| 106 | 106 | 'page callback' => 'drupal_get_form', |
@@ -108,153 +108,153 @@ discard block |
||
| 108 | 108 | 'access arguments' => array('administer site configuration'), |
| 109 | 109 | 'type' => MENU_NORMAL_ITEM, |
| 110 | 110 | 'file' => 'boincwork.admin.inc' |
| 111 | - ); |
|
| 112 | - $items['host/%/delete'] = array( |
|
| 111 | + ); |
|
| 112 | + $items['host/%/delete'] = array( |
|
| 113 | 113 | 'title' => 'Delete host', |
| 114 | 114 | 'page callback' => 'boincwork_host_delete', |
| 115 | 115 | 'page arguments' => array(1), |
| 116 | 116 | 'access callback' => 'user_is_logged_in', |
| 117 | 117 | 'type' => MENU_CALLBACK, |
| 118 | - ); |
|
| 119 | - $items['host/%/log'] = array( |
|
| 118 | + ); |
|
| 119 | + $items['host/%/log'] = array( |
|
| 120 | 120 | 'title' => 'Host log', |
| 121 | 121 | 'page callback' => 'boincwork_host_log', |
| 122 | 122 | 'page arguments' => array(1), |
| 123 | 123 | 'access callback' => 'user_is_logged_in', |
| 124 | 124 | 'type' => MENU_CALLBACK, |
| 125 | - ); |
|
| 126 | - $items['host/%/merge'] = array( |
|
| 125 | + ); |
|
| 126 | + $items['host/%/merge'] = array( |
|
| 127 | 127 | 'title' => 'Merge computer', |
| 128 | 128 | 'page callback' => 'drupal_get_form', |
| 129 | 129 | 'page arguments' => array('boincwork_host_merge_form', 1), |
| 130 | 130 | 'access callback' => 'user_is_logged_in', |
| 131 | 131 | 'type' => MENU_CALLBACK, |
| 132 | - ); |
|
| 133 | - $items['host/%/set-venue/%'] = array( |
|
| 132 | + ); |
|
| 133 | + $items['host/%/set-venue/%'] = array( |
|
| 134 | 134 | 'title' => 'Set host venue', |
| 135 | 135 | 'page callback' => 'boincwork_host_set_venue', |
| 136 | 136 | 'page arguments' => array(1,3), |
| 137 | 137 | 'access callback' => 'user_is_logged_in', |
| 138 | 138 | 'type' => MENU_CALLBACK, |
| 139 | - ); |
|
| 140 | - $items['user/%/mobile'] = array( |
|
| 139 | + ); |
|
| 140 | + $items['user/%/mobile'] = array( |
|
| 141 | 141 | 'title' => 'Mobile stats', |
| 142 | 142 | 'page callback' => 'boincwork_mobile_stats', |
| 143 | 143 | 'page arguments' => array(1), |
| 144 | 144 | 'access callback' => 'user_is_logged_in', |
| 145 | 145 | 'type' => MENU_CALLBACK |
| 146 | - ); |
|
| 147 | - $items['server_status.php'] = array( |
|
| 146 | + ); |
|
| 147 | + $items['server_status.php'] = array( |
|
| 148 | 148 | 'title' => 'Server status', |
| 149 | 149 | 'page callback' => 'boincwork_server_status', |
| 150 | 150 | 'access arguments' => array('access content'), |
| 151 | 151 | 'type' => MENU_CALLBACK |
| 152 | - ); |
|
| 153 | - $items['job_file.php'] = array( |
|
| 152 | + ); |
|
| 153 | + $items['job_file.php'] = array( |
|
| 154 | 154 | 'title' => 'Job file input', |
| 155 | 155 | 'page callback' => 'boincwork_job_file', |
| 156 | 156 | 'access arguments' => array('access content'), |
| 157 | 157 | 'type' => MENU_CALLBACK |
| 158 | - ); |
|
| 159 | - $items['get_output.php'] = array( |
|
| 158 | + ); |
|
| 159 | + $items['get_output.php'] = array( |
|
| 160 | 160 | 'title' => 'Get output file', |
| 161 | 161 | 'page callback' => 'boincwork_get_output', |
| 162 | 162 | 'access arguments' => array('access content'), |
| 163 | 163 | 'type' => MENU_CALLBACK |
| 164 | - ); |
|
| 165 | - $items['get_project_config.php'] = array( |
|
| 164 | + ); |
|
| 165 | + $items['get_project_config.php'] = array( |
|
| 166 | 166 | 'title' => 'Project config', |
| 167 | 167 | 'page callback' => 'boincwork_get_project_config', |
| 168 | 168 | 'access arguments' => array('access content'), |
| 169 | 169 | 'type' => MENU_CALLBACK |
| 170 | - ); |
|
| 171 | - $items['submit_rpc_handler.php'] = array( |
|
| 170 | + ); |
|
| 171 | + $items['submit_rpc_handler.php'] = array( |
|
| 172 | 172 | 'title' => 'Remote job submission', |
| 173 | 173 | 'page callback' => 'boincwork_submit_rpc_handler', |
| 174 | 174 | 'access arguments' => array('access content'), |
| 175 | 175 | 'type' => MENU_CALLBACK |
| 176 | - ); |
|
| 177 | - $items['userw.php'] = array( |
|
| 176 | + ); |
|
| 177 | + $items['userw.php'] = array( |
|
| 178 | 178 | 'title' => 'User WAP', |
| 179 | 179 | 'page callback' => 'boincwork_user_wap', |
| 180 | 180 | 'access arguments' => array('access content'), |
| 181 | 181 | 'type' => MENU_CALLBACK |
| 182 | - ); |
|
| 183 | - $items['account/tasks/%/%'] = array( |
|
| 182 | + ); |
|
| 183 | + $items['account/tasks/%/%'] = array( |
|
| 184 | 184 | 'title' => 'Account Tasks Table', |
| 185 | 185 | 'description' => '', |
| 186 | 186 | 'page callback' => 'boincwork_account_task_table', |
| 187 | 187 | 'page arguments' => array(2,3), |
| 188 | 188 | 'access arguments' => array('access content'), |
| 189 | 189 | 'type' => MENU_CALLBACK, |
| 190 | - ); |
|
| 191 | - $items['host/%/tasks/%/%'] = array( |
|
| 190 | + ); |
|
| 191 | + $items['host/%/tasks/%/%'] = array( |
|
| 192 | 192 | 'title' => 'Host Tasks Table', |
| 193 | 193 | 'description' => '', |
| 194 | 194 | 'page callback' => 'boincwork_host_task_table', |
| 195 | 195 | 'page arguments' => array(1,3,4), |
| 196 | 196 | 'access arguments' => array('access content'), |
| 197 | 197 | 'type' => MENU_CALLBACK, |
| 198 | - ); |
|
| 199 | - // Workunit task table disabled |
|
| 200 | - //$items['workunit/%/tasks/%/%'] = array( |
|
| 201 | - // 'title' => 'Workunit Tasks Table', |
|
| 202 | - // 'description' => '', |
|
| 203 | - // 'page callback' => 'boincwork_workunit_task_table', |
|
| 204 | - // 'page arguments' => array(1,3,4), |
|
| 205 | - // 'access arguments' => array('access content'), |
|
| 206 | - // 'type' => MENU_CALLBACK, |
|
| 207 | - //); |
|
| 208 | - return $items; |
|
| 198 | + ); |
|
| 199 | + // Workunit task table disabled |
|
| 200 | + //$items['workunit/%/tasks/%/%'] = array( |
|
| 201 | + // 'title' => 'Workunit Tasks Table', |
|
| 202 | + // 'description' => '', |
|
| 203 | + // 'page callback' => 'boincwork_workunit_task_table', |
|
| 204 | + // 'page arguments' => array(1,3,4), |
|
| 205 | + // 'access arguments' => array('access content'), |
|
| 206 | + // 'type' => MENU_CALLBACK, |
|
| 207 | + //); |
|
| 208 | + return $items; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * Implementation of hook_theme(). |
| 213 | 213 | */ |
| 214 | 214 | function boincwork_theme() { |
| 215 | - return array( |
|
| 215 | + return array( |
|
| 216 | 216 | 'boincwork_privacyprefs_form' => array( |
| 217 | - 'arguments' => array('form'), |
|
| 217 | + 'arguments' => array('form'), |
|
| 218 | 218 | ), |
| 219 | - ); |
|
| 219 | + ); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Implementation of hook_views_api(). |
| 224 | 224 | */ |
| 225 | 225 | function boincwork_views_api() { |
| 226 | - return array( |
|
| 226 | + return array( |
|
| 227 | 227 | 'api' => 2.0, |
| 228 | 228 | 'path' => drupal_get_path('module', 'boincwork') |
| 229 | - ); |
|
| 229 | + ); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Implementation of hook_locale(). |
| 234 | 234 | */ |
| 235 | 235 | function boincwork_locale($op = 'groups', $group = NULL) { |
| 236 | - switch ($op) { |
|
| 236 | + switch ($op) { |
|
| 237 | 237 | case 'groups': |
| 238 | 238 | return array('project' => bts('Project')); |
| 239 | 239 | case 'info': |
| 240 | 240 | $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
| 241 | - $info['project']['format'] = FALSE; |
|
| 242 | - return $info; |
|
| 243 | - } |
|
| 241 | + $info['project']['format'] = FALSE; |
|
| 242 | + return $info; |
|
| 243 | + } |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | 247 | * Refresh strings. |
| 248 | 248 | */ |
| 249 | 249 | function boincwork_locale_refresh() { |
| 250 | - // Mimic process of adding project specific prefs to the project preferences |
|
| 251 | - // form -- this parses the prefs XML and calls i18nstrings_update() |
|
| 252 | - $form = array(); |
|
| 253 | - $prefs = array( |
|
| 250 | + // Mimic process of adding project specific prefs to the project preferences |
|
| 251 | + // form -- this parses the prefs XML and calls i18nstrings_update() |
|
| 252 | + $form = array(); |
|
| 253 | + $prefs = array( |
|
| 254 | 254 | 'project_specific' => array(), |
| 255 | - ); |
|
| 256 | - boincwork_add_project_specific_prefs($form, $prefs); |
|
| 257 | - return TRUE; // Meaning it completed with no issues |
|
| 255 | + ); |
|
| 256 | + boincwork_add_project_specific_prefs($form, $prefs); |
|
| 257 | + return TRUE; // Meaning it completed with no issues |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -263,43 +263,43 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | |
| 265 | 265 | function boincwork_privatemsg_message_view_alter(&$vars) { |
| 266 | - global $user; |
|
| 266 | + global $user; |
|
| 267 | 267 | |
| 268 | - $author = $vars['message']['author']; |
|
| 269 | - if (!isset($vars['message']['thread_id'])) { |
|
| 268 | + $author = $vars['message']['author']; |
|
| 269 | + if (!isset($vars['message']['thread_id'])) { |
|
| 270 | 270 | // No thread id, this is probably only a preview |
| 271 | 271 | return; |
| 272 | - } |
|
| 273 | - $thread_id = $vars['message']['thread_id']; |
|
| 272 | + } |
|
| 273 | + $thread_id = $vars['message']['thread_id']; |
|
| 274 | 274 | |
| 275 | - if ($user->uid != $author->uid) { |
|
| 275 | + if ($user->uid != $author->uid) { |
|
| 276 | 276 | if ($vars['message']['is_blocked']) { |
| 277 | - $vars['message_actions']['unignore_user'] = array( |
|
| 277 | + $vars['message_actions']['unignore_user'] = array( |
|
| 278 | 278 | 'title' => bts('Stop Ignoring User', array(), NULL, 'boinc:ignore-user-remove'), |
| 279 | 279 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
| 280 | 280 | 'query' => 'destination=messages/view/' . $thread_id, |
| 281 | - ); |
|
| 281 | + ); |
|
| 282 | 282 | } |
| 283 | 283 | else { |
| 284 | - $vars['message_actions']['ignore_user'] = array( |
|
| 284 | + $vars['message_actions']['ignore_user'] = array( |
|
| 285 | 285 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
| 286 | 286 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
| 287 | 287 | 'query' => 'destination=messages/view/' . $thread_id, |
| 288 | - ); |
|
| 288 | + ); |
|
| 289 | + } |
|
| 289 | 290 | } |
| 290 | - } |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | 294 | * Implementation of hook_cron() |
| 295 | 295 | */ |
| 296 | 296 | function boincwork_cron() { |
| 297 | - // Delete expired hosts in the BOINC database, host_delete table. |
|
| 298 | - require_boinc('boinc_db'); |
|
| 299 | - $num_deleted = BoincHostDeleted::delete_expired(); |
|
| 300 | - if ($num_deleted>0) { |
|
| 297 | + // Delete expired hosts in the BOINC database, host_delete table. |
|
| 298 | + require_boinc('boinc_db'); |
|
| 299 | + $num_deleted = BoincHostDeleted::delete_expired(); |
|
| 300 | + if ($num_deleted>0) { |
|
| 301 | 301 | watchdog('boincwork', "Deleted ${num_deleted} hosts from host_deleted table", WATCHDOG_NOTICE); |
| 302 | - } |
|
| 302 | + } |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -307,41 +307,41 @@ discard block |
||
| 307 | 307 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 308 | 308 | |
| 309 | 309 | /** |
| 310 | - * General preferences menu callback. |
|
| 311 | - * Called when user goes to edit preferences page |
|
| 312 | - */ |
|
| 310 | + * General preferences menu callback. |
|
| 311 | + * Called when user goes to edit preferences page |
|
| 312 | + */ |
|
| 313 | 313 | function generalprefs_page($action = null, $venue = null, $advanced = FALSE) { |
| 314 | 314 | |
| 315 | - // Keep the venue selected across preference pages |
|
| 316 | - boincwork_select_venue($venue); |
|
| 315 | + // Keep the venue selected across preference pages |
|
| 316 | + boincwork_select_venue($venue); |
|
| 317 | 317 | |
| 318 | - $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 319 | - $output = null; |
|
| 320 | - // Set the page title |
|
| 321 | - $title = 'Computing'; |
|
| 322 | - drupal_set_title($title); |
|
| 318 | + $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 319 | + $output = null; |
|
| 320 | + // Set the page title |
|
| 321 | + $title = 'Computing'; |
|
| 322 | + drupal_set_title($title); |
|
| 323 | 323 | |
| 324 | - switch ($action) { |
|
| 324 | + switch ($action) { |
|
| 325 | 325 | |
| 326 | - case 'clear': |
|
| 326 | + case 'clear': |
|
| 327 | 327 | // Remove settings from this preference set |
| 328 | 328 | if ($venue AND $venue != 'generic') { |
| 329 | - boincwork_save_prefs(NULL, 'general', $venue); |
|
| 330 | - drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 329 | + boincwork_save_prefs(NULL, 'general', $venue); |
|
| 330 | + drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 331 | 331 | cleared', array('@name' => ucfirst($venue)))); |
| 332 | - // Set the generic preference set as active |
|
| 333 | - $_SESSION['prefs venue'] = 'generic'; |
|
| 332 | + // Set the generic preference set as active |
|
| 333 | + $_SESSION['prefs venue'] = 'generic'; |
|
| 334 | 334 | } |
| 335 | 335 | drupal_goto(); |
| 336 | 336 | break; |
| 337 | 337 | |
| 338 | - case 'combined': |
|
| 338 | + case 'combined': |
|
| 339 | 339 | // Compare preference sets; tabular view |
| 340 | 340 | |
| 341 | 341 | foreach ($pref_sets as $pref_set) { |
| 342 | - $form_state = array(); |
|
| 343 | - $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set); |
|
| 344 | - drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
|
| 342 | + $form_state = array(); |
|
| 343 | + $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set); |
|
| 344 | + drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>'; |
@@ -354,29 +354,29 @@ discard block |
||
| 354 | 354 | $prefs_table = boincwork_make_prefs_table($prefs['generic']['prefs']['advanced']); |
| 355 | 355 | |
| 356 | 356 | foreach ($prefs_table as $category => $section) { |
| 357 | - $output .= '<tr class="section-heading">'; |
|
| 358 | - $output .= "<td>{$section['name']}</td>"; |
|
| 359 | - foreach ($pref_sets as $pref_set) { |
|
| 357 | + $output .= '<tr class="section-heading">'; |
|
| 358 | + $output .= "<td>{$section['name']}</td>"; |
|
| 359 | + foreach ($pref_sets as $pref_set) { |
|
| 360 | 360 | $output .= '<td>' . $pref_set . '</td>'; |
| 361 | - } |
|
| 362 | - $output .= '</tr>'; |
|
| 363 | - foreach ($section['elements'] as $name => $setting) { |
|
| 361 | + } |
|
| 362 | + $output .= '</tr>'; |
|
| 363 | + foreach ($section['elements'] as $name => $setting) { |
|
| 364 | 364 | // Output the setting name and description, with an ugly exception |
| 365 | 365 | // made for preferences with special formatting |
| 366 | 366 | $special_map = array( |
| 367 | - 'start_hour' => 'end_hour', |
|
| 368 | - 'net_start_hour'=> 'net_end_hour', |
|
| 369 | - 'daily_xfer_limit_mb' => 'daily_xfer_period_days', |
|
| 367 | + 'start_hour' => 'end_hour', |
|
| 368 | + 'net_start_hour'=> 'net_end_hour', |
|
| 369 | + 'daily_xfer_limit_mb' => 'daily_xfer_period_days', |
|
| 370 | 370 | ); |
| 371 | 371 | $special_delimiter = array( |
| 372 | - 'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 373 | - 'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 374 | - 'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'), |
|
| 372 | + 'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 373 | + 'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 374 | + 'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'), |
|
| 375 | 375 | ); |
| 376 | 376 | $special = isset($special_map[$name]); |
| 377 | 377 | $very_special = in_array($name, $special_map); |
| 378 | 378 | if ($very_special) { |
| 379 | - continue; |
|
| 379 | + continue; |
|
| 380 | 380 | } |
| 381 | 381 | $output .= '<tr>'; |
| 382 | 382 | $output .= '<td>'; |
@@ -386,35 +386,35 @@ discard block |
||
| 386 | 386 | // Output values for each preference set, again with ugly hacks for |
| 387 | 387 | // time range preferences |
| 388 | 388 | foreach ($pref_sets as $pref_set) { |
| 389 | - if (($prefs[$pref_set]) AND |
|
| 389 | + if (($prefs[$pref_set]) AND |
|
| 390 | 390 | $prefs[$pref_set]['#established'] AND |
| 391 | 391 | isset($prefs[$pref_set]['prefs']['advanced'][$category])) { |
| 392 | 392 | $pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$name]; |
| 393 | 393 | $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value']; |
| 394 | 394 | if ($value == '') { |
| 395 | - $value = '---'; |
|
| 395 | + $value = '---'; |
|
| 396 | 396 | } |
| 397 | 397 | if (!isset($pref_setting['#field_suffix'])) { |
| 398 | - $pref_setting['#field_suffix'] = ''; |
|
| 398 | + $pref_setting['#field_suffix'] = ''; |
|
| 399 | 399 | } |
| 400 | 400 | if (!$special) { |
| 401 | - $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
|
| 401 | + $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
|
| 402 | 402 | } |
| 403 | 403 | else { |
| 404 | - // The "very special" case where we merge two prefs |
|
| 405 | - $second_pref = $special_map[$name]; |
|
| 406 | - $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
|
| 407 | - $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value']; |
|
| 408 | - $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
|
| 404 | + // The "very special" case where we merge two prefs |
|
| 405 | + $second_pref = $special_map[$name]; |
|
| 406 | + $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
|
| 407 | + $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value']; |
|
| 408 | + $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
|
| 409 | 409 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
| 410 | 410 | } |
| 411 | - } |
|
| 412 | - else { |
|
| 411 | + } |
|
| 412 | + else { |
|
| 413 | 413 | $output .= '<td>---</td>'; |
| 414 | - } |
|
| 414 | + } |
|
| 415 | 415 | } |
| 416 | 416 | $output .= '</tr>'; |
| 417 | - } |
|
| 417 | + } |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // Empty line above action links... :/ |
@@ -430,24 +430,24 @@ discard block |
||
| 430 | 430 | $output .= '<tr>'; |
| 431 | 431 | $output .= '<td></td>'; |
| 432 | 432 | foreach ($pref_sets as $pref_set) { |
| 433 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 434 | - $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 435 | - $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1", |
|
| 433 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 434 | + $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 435 | + $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1", |
|
| 436 | 436 | array('fragment' => "") |
| 437 | - ); |
|
| 438 | - // Show Clear links for established preference sets |
|
| 439 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 437 | + ); |
|
| 438 | + // Show Clear links for established preference sets |
|
| 439 | + if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 440 | 440 | $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}", |
| 441 | - array( |
|
| 441 | + array( |
|
| 442 | 442 | 'query' => drupal_get_destination(), |
| 443 | 443 | 'attributes' => array( |
| 444 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 444 | + 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 445 | 445 | array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')' |
| 446 | 446 | ) |
| 447 | - ) |
|
| 447 | + ) |
|
| 448 | 448 | ); |
| 449 | - } |
|
| 450 | - $output .= '</li></ul></td>'; |
|
| 449 | + } |
|
| 450 | + $output .= '</li></ul></td>'; |
|
| 451 | 451 | } |
| 452 | 452 | $output .= '</tr>'; |
| 453 | 453 | |
@@ -455,28 +455,28 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | break; |
| 457 | 457 | |
| 458 | - case 'edit': |
|
| 458 | + case 'edit': |
|
| 459 | 459 | default: |
| 460 | 460 | |
| 461 | 461 | // Return the HTML generated from the $form data structure. |
| 462 | 462 | if (function_exists('jump_quickly')) { |
| 463 | - $path = 'account/prefs/computing/edit'; |
|
| 464 | - $venues = array( |
|
| 463 | + $path = 'account/prefs/computing/edit'; |
|
| 464 | + $venues = array( |
|
| 465 | 465 | "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
| 466 | 466 | "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
| 467 | 467 | "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
| 468 | 468 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
| 469 | - ); |
|
| 470 | - variable_set('jump_use_js_venues-Array', 1); |
|
| 471 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 472 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 469 | + ); |
|
| 470 | + variable_set('jump_use_js_venues-Array', 1); |
|
| 471 | + drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 472 | + drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 473 | 473 | |
| 474 | - $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 475 | - $output .= ' <div class="form-item venue">'; |
|
| 476 | - $output .= ' <label>Preference set:</label>'; |
|
| 477 | - $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 478 | - $output .= ' </div>'; |
|
| 479 | - $output .= '</div>'; |
|
| 474 | + $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 475 | + $output .= ' <div class="form-item venue">'; |
|
| 476 | + $output .= ' <label>Preference set:</label>'; |
|
| 477 | + $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 478 | + $output .= ' </div>'; |
|
| 479 | + $output .= '</div>'; |
|
| 480 | 480 | } |
| 481 | 481 | $output .= drupal_get_form('boincwork_generalprefs_form', $venue, NULL, $advanced); |
| 482 | 482 | |
@@ -487,54 +487,54 @@ discard block |
||
| 487 | 487 | drupal_prepare_form('boincwork_generalprefs_form', $current_set, $form_state); |
| 488 | 488 | |
| 489 | 489 | if (!$current_set['#established']) { |
| 490 | - drupal_set_message(bts( |
|
| 491 | - "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 492 | - array( '@venue' => $venue, ), |
|
| 493 | - NULL, 'boinc:account-preferences'), 'status'); |
|
| 490 | + drupal_set_message(bts( |
|
| 491 | + "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 492 | + array( '@venue' => $venue, ), |
|
| 493 | + NULL, 'boinc:account-preferences'), 'status'); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | break; |
| 497 | - } |
|
| 497 | + } |
|
| 498 | 498 | |
| 499 | - return $output; |
|
| 499 | + return $output; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
| 503 | - * Project preferences menu callback |
|
| 504 | - * Called when user goes to edit project preferences page. |
|
| 505 | - */ |
|
| 503 | + * Project preferences menu callback |
|
| 504 | + * Called when user goes to edit project preferences page. |
|
| 505 | + */ |
|
| 506 | 506 | function projectprefs_page($action = null, $venue = null) { |
| 507 | 507 | |
| 508 | - // Keep the venue selected across preference pages |
|
| 509 | - boincwork_select_venue($venue); |
|
| 508 | + // Keep the venue selected across preference pages |
|
| 509 | + boincwork_select_venue($venue); |
|
| 510 | 510 | |
| 511 | - require_boinc(array('util', 'prefs')); |
|
| 512 | - global $project_has_beta; |
|
| 513 | - $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 514 | - $output = null; |
|
| 511 | + require_boinc(array('util', 'prefs')); |
|
| 512 | + global $project_has_beta; |
|
| 513 | + $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 514 | + $output = null; |
|
| 515 | 515 | |
| 516 | - $title = 'Project'; |
|
| 517 | - drupal_set_title($title); |
|
| 516 | + $title = 'Project'; |
|
| 517 | + drupal_set_title($title); |
|
| 518 | 518 | |
| 519 | - switch ($action) { |
|
| 519 | + switch ($action) { |
|
| 520 | 520 | |
| 521 | - case 'clear': |
|
| 521 | + case 'clear': |
|
| 522 | 522 | // Remove settings from this preference set |
| 523 | 523 | if ($venue AND $venue != 'generic') { |
| 524 | - boincwork_save_prefs(NULL, 'project', $venue); |
|
| 525 | - drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 524 | + boincwork_save_prefs(NULL, 'project', $venue); |
|
| 525 | + drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 526 | 526 | cleared', array('@name' => ucfirst($venue)))); |
| 527 | 527 | |
| 528 | - // Set the generic preference set as active |
|
| 529 | - $_SESSION['prefs venue'] = 'generic'; |
|
| 528 | + // Set the generic preference set as active |
|
| 529 | + $_SESSION['prefs venue'] = 'generic'; |
|
| 530 | 530 | |
| 531 | - // If the user has removed their default preference set, make it generic |
|
| 532 | - boincwork_set_default_venue(); |
|
| 531 | + // If the user has removed their default preference set, make it generic |
|
| 532 | + boincwork_set_default_venue(); |
|
| 533 | 533 | } |
| 534 | 534 | drupal_goto(); |
| 535 | 535 | break; |
| 536 | 536 | |
| 537 | - case 'combined': |
|
| 537 | + case 'combined': |
|
| 538 | 538 | |
| 539 | 539 | // Compare preference sets; tabular view |
| 540 | 540 | |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | $boincuser = BoincUser::lookup_id($account->boincuser_id); |
| 544 | 544 | |
| 545 | 545 | foreach ($pref_sets as $pref_set) { |
| 546 | - $form_state = array(); |
|
| 547 | - $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set); |
|
| 548 | - drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
|
| 546 | + $form_state = array(); |
|
| 547 | + $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set); |
|
| 548 | + drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>'; |
@@ -556,20 +556,20 @@ discard block |
||
| 556 | 556 | $prefs_table = boincwork_make_prefs_table($prefs['generic']); |
| 557 | 557 | |
| 558 | 558 | foreach ($prefs_table as $category => $section) { |
| 559 | - $output .= '<tr class="section-heading">'; |
|
| 560 | - $output .= "<td>{$section['name']}</td>"; |
|
| 561 | - foreach ($pref_sets as $pref_set) { |
|
| 559 | + $output .= '<tr class="section-heading">'; |
|
| 560 | + $output .= "<td>{$section['name']}</td>"; |
|
| 561 | + foreach ($pref_sets as $pref_set) { |
|
| 562 | 562 | $output .= '<td>' . $pref_set . '</td>'; |
| 563 | - } |
|
| 564 | - $output .= '</tr>'; |
|
| 565 | - foreach ($section['elements'] as $name => $setting) { |
|
| 563 | + } |
|
| 564 | + $output .= '</tr>'; |
|
| 565 | + foreach ($section['elements'] as $name => $setting) { |
|
| 566 | 566 | $output .= '<tr>'; |
| 567 | 567 | $output .= '<td>'; |
| 568 | 568 | $output .= "<div class=\"title\">{$setting['name']}</div>"; |
| 569 | 569 | $output .= "<div class=\"description\">{$setting['description']}</div>"; |
| 570 | 570 | $output .= '</td>'; |
| 571 | 571 | foreach ($pref_sets as $pref_set) { |
| 572 | - if (($prefs[$pref_set]) AND |
|
| 572 | + if (($prefs[$pref_set]) AND |
|
| 573 | 573 | $prefs[$pref_set]['#established'] AND |
| 574 | 574 | isset($prefs[$pref_set][$category])) { |
| 575 | 575 | $pref_setting = $prefs[$pref_set][$category][$name]; |
@@ -577,10 +577,10 @@ discard block |
||
| 577 | 577 | if ($value == '') $value = '---'; |
| 578 | 578 | if (!isset($pref_setting['#field_suffix'])) $pref_setting['#field_suffix'] = ''; |
| 579 | 579 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
| 580 | - } else $output .= '<td>---</td>'; |
|
| 580 | + } else $output .= '<td>---</td>'; |
|
| 581 | 581 | } |
| 582 | 582 | $output .= '</tr>'; |
| 583 | - } |
|
| 583 | + } |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | // Empty line above action links... :/ |
@@ -596,29 +596,29 @@ discard block |
||
| 596 | 596 | $output .= '<tr>'; |
| 597 | 597 | $output .= '<td></td>'; |
| 598 | 598 | foreach ($pref_sets as $pref_set) { |
| 599 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 600 | - $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 601 | - $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
|
| 602 | - // Show Clear links for established preference sets |
|
| 603 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 599 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 600 | + $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 601 | + $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
|
| 602 | + // Show Clear links for established preference sets |
|
| 603 | + if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 604 | 604 | $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}", |
| 605 | - array( |
|
| 605 | + array( |
|
| 606 | 606 | 'query' => drupal_get_destination(), |
| 607 | 607 | 'attributes' => array( |
| 608 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 608 | + 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 609 | 609 | array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')' |
| 610 | 610 | ) |
| 611 | - ) |
|
| 611 | + ) |
|
| 612 | 612 | ); |
| 613 | - } |
|
| 614 | - $output .= '</li></ul></td>'; |
|
| 613 | + } |
|
| 614 | + $output .= '</li></ul></td>'; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | $output .= '</table>'; |
| 618 | 618 | |
| 619 | 619 | break; |
| 620 | 620 | |
| 621 | - case 'set-default': |
|
| 621 | + case 'set-default': |
|
| 622 | 622 | // Set this preference set as the one to use for any new hosts attached |
| 623 | 623 | // to the user account |
| 624 | 624 | boincwork_set_default_venue($venue); |
@@ -626,30 +626,30 @@ discard block |
||
| 626 | 626 | drupal_goto('account/prefs/project/combined'); |
| 627 | 627 | break; |
| 628 | 628 | |
| 629 | - case 'edit': |
|
| 629 | + case 'edit': |
|
| 630 | 630 | default: |
| 631 | 631 | |
| 632 | 632 | // Return the HTML generated from the $form data structure. |
| 633 | 633 | require_boinc('util'); |
| 634 | 634 | |
| 635 | 635 | if (function_exists('jump_quickly')) { |
| 636 | - $path = 'account/prefs/project/edit'; |
|
| 637 | - $venues = array( |
|
| 636 | + $path = 'account/prefs/project/edit'; |
|
| 637 | + $venues = array( |
|
| 638 | 638 | "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
| 639 | 639 | "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
| 640 | 640 | "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
| 641 | 641 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
| 642 | - ); |
|
| 643 | - variable_set('jump_use_js_venues-Array', 1); |
|
| 644 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 645 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 642 | + ); |
|
| 643 | + variable_set('jump_use_js_venues-Array', 1); |
|
| 644 | + drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 645 | + drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 646 | 646 | |
| 647 | - $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 648 | - $output .= ' <div class="form-item venue">'; |
|
| 649 | - $output .= ' <label>Preference set:</label>'; |
|
| 650 | - $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 651 | - $output .= ' </div>'; |
|
| 652 | - $output .= '</div>'; |
|
| 647 | + $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 648 | + $output .= ' <div class="form-item venue">'; |
|
| 649 | + $output .= ' <label>Preference set:</label>'; |
|
| 650 | + $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 651 | + $output .= ' </div>'; |
|
| 652 | + $output .= '</div>'; |
|
| 653 | 653 | } |
| 654 | 654 | $output .= drupal_get_form('boincwork_projectprefs_form', $venue); |
| 655 | 655 | |
@@ -660,63 +660,63 @@ discard block |
||
| 660 | 660 | drupal_prepare_form('boincwork_projectprefs_form', $current_set, $form_state); |
| 661 | 661 | |
| 662 | 662 | if (!$current_set['#established']) { |
| 663 | - drupal_set_message(bts( |
|
| 664 | - "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 665 | - array( '@venue' => $venue, ), |
|
| 666 | - NULL, 'boinc:account-preferences'), 'status'); |
|
| 663 | + drupal_set_message(bts( |
|
| 664 | + "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 665 | + array( '@venue' => $venue, ), |
|
| 666 | + NULL, 'boinc:account-preferences'), 'status'); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | break; |
| 670 | 670 | |
| 671 | - } |
|
| 672 | - return $output; |
|
| 671 | + } |
|
| 672 | + return $output; |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | - * Community preferences menu callback |
|
| 677 | - * Called when user goes to edit community preferences page. |
|
| 678 | - */ |
|
| 676 | + * Community preferences menu callback |
|
| 677 | + * Called when user goes to edit community preferences page. |
|
| 678 | + */ |
|
| 679 | 679 | function communityprefs_page($action = null) { |
| 680 | 680 | |
| 681 | - require_boinc(array('util', 'prefs')); |
|
| 682 | - $output = null; |
|
| 681 | + require_boinc(array('util', 'prefs')); |
|
| 682 | + $output = null; |
|
| 683 | 683 | |
| 684 | - $title = 'Community'; |
|
| 685 | - drupal_set_title($title); |
|
| 684 | + $title = 'Community'; |
|
| 685 | + drupal_set_title($title); |
|
| 686 | 686 | |
| 687 | - //$output .= '<h2>Community preferences</h2>'; |
|
| 687 | + //$output .= '<h2>Community preferences</h2>'; |
|
| 688 | 688 | |
| 689 | - $output .= drupal_get_form('communityprefs_form'); |
|
| 689 | + $output .= drupal_get_form('communityprefs_form'); |
|
| 690 | 690 | |
| 691 | - return $output; |
|
| 691 | + return $output; |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
| 695 | - * Privacy preferences menu callback |
|
| 696 | - * Called when user goes to edit privacy preferences page. |
|
| 697 | - */ |
|
| 695 | + * Privacy preferences menu callback |
|
| 696 | + * Called when user goes to edit privacy preferences page. |
|
| 697 | + */ |
|
| 698 | 698 | function privacyprefs_page($action = null) { |
| 699 | 699 | |
| 700 | - require_boinc(array('util', 'prefs')); |
|
| 701 | - $output = null; |
|
| 702 | - $title = 'Privacy'; |
|
| 703 | - drupal_set_title($title); |
|
| 700 | + require_boinc(array('util', 'prefs')); |
|
| 701 | + $output = null; |
|
| 702 | + $title = 'Privacy'; |
|
| 703 | + drupal_set_title($title); |
|
| 704 | 704 | |
| 705 | - switch ($action) { |
|
| 706 | - case 'view': |
|
| 705 | + switch ($action) { |
|
| 706 | + case 'view': |
|
| 707 | 707 | $form_state = array(); |
| 708 | 708 | $prefs = drupal_retrieve_form('boincwork_privacyprefs_form', $form_state); |
| 709 | 709 | drupal_prepare_form('boincwork_privacyprefs_form', $prefs, $form_state); |
| 710 | 710 | $output .= '<table>'; |
| 711 | 711 | |
| 712 | 712 | $sections = array( |
| 713 | - 'privacy' => $prefs['privacy'] |
|
| 713 | + 'privacy' => $prefs['privacy'] |
|
| 714 | 714 | ); |
| 715 | 715 | |
| 716 | 716 | foreach ($sections as $section) { |
| 717 | - $output .= '<tr class="section-heading">'; |
|
| 718 | - $output .= "<td>{$section['#title']}</td></tr>"; |
|
| 719 | - foreach ($section as $name => $setting) { |
|
| 717 | + $output .= '<tr class="section-heading">'; |
|
| 718 | + $output .= "<td>{$section['#title']}</td></tr>"; |
|
| 719 | + foreach ($section as $name => $setting) { |
|
| 720 | 720 | if ($name{0} == '#') continue; |
| 721 | 721 | $value = isset($setting['#default_value']) ? $setting['#default_value'] : ''; |
| 722 | 722 | if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value]; |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $output .= "<td>{$setting['#title']}<br/>{$setting['#description']}</td>"; |
| 729 | 729 | $output .= "<td>{$value} {$setting['#field_suffix']}</td>"; |
| 730 | 730 | $output .= '</tr>'; |
| 731 | - } |
|
| 731 | + } |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | // Edit preferences link |
@@ -741,33 +741,33 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | break; |
| 743 | 743 | |
| 744 | - case 'edit': |
|
| 744 | + case 'edit': |
|
| 745 | 745 | default: |
| 746 | 746 | require_boinc('util'); |
| 747 | 747 | // Return the HTML generated from the $form data structure. |
| 748 | 748 | $output .= drupal_get_form('boincwork_privacyprefs_form'); |
| 749 | 749 | break; |
| 750 | 750 | |
| 751 | - } |
|
| 751 | + } |
|
| 752 | 752 | |
| 753 | - return $output; |
|
| 753 | + return $output; |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /** |
| 757 | - * Certificates menu callback |
|
| 758 | - * Called when user goes to account certificate pages |
|
| 759 | - */ |
|
| 757 | + * Certificates menu callback |
|
| 758 | + * Called when user goes to account certificate pages |
|
| 759 | + */ |
|
| 760 | 760 | function boincwork_certificates($type = null, $border = null) { |
| 761 | - global $user; |
|
| 762 | - $drupuser = user_load($user->uid); |
|
| 763 | - // Load BOINC account and pre-authenticate with BOINC code |
|
| 764 | - require_boinc(array('util', 'cert')); |
|
| 765 | - $boincuser = BoincUser::lookup_id($drupuser->boincuser_id); |
|
| 766 | - //global $g_logged_in_user; |
|
| 767 | - //$g_logged_in_user = $boincuser; |
|
| 768 | - //print_r($boincuser); exit; |
|
| 769 | - switch ($type) { |
|
| 770 | - case 'all': |
|
| 761 | + global $user; |
|
| 762 | + $drupuser = user_load($user->uid); |
|
| 763 | + // Load BOINC account and pre-authenticate with BOINC code |
|
| 764 | + require_boinc(array('util', 'cert')); |
|
| 765 | + $boincuser = BoincUser::lookup_id($drupuser->boincuser_id); |
|
| 766 | + //global $g_logged_in_user; |
|
| 767 | + //$g_logged_in_user = $boincuser; |
|
| 768 | + //print_r($boincuser); exit; |
|
| 769 | + switch ($type) { |
|
| 770 | + case 'all': |
|
| 771 | 771 | //include_boinc('user/cert_all.php'); |
| 772 | 772 | require_boinc(array('util','cert','user')); |
| 773 | 773 | |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | "; |
| 838 | 838 | break; |
| 839 | 839 | |
| 840 | - case 'account': |
|
| 840 | + case 'account': |
|
| 841 | 841 | default: |
| 842 | 842 | //include_boinc('user/cert1.php'); |
| 843 | 843 | require_boinc(array('util','cert')); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | echo " |
| 914 | 914 | </td><tr></table> |
| 915 | 915 | "; |
| 916 | - } |
|
| 916 | + } |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | /** |
@@ -921,42 +921,42 @@ discard block |
||
| 921 | 921 | * Called when user selects to delete a host |
| 922 | 922 | */ |
| 923 | 923 | function boincwork_host_delete($host_id) { |
| 924 | - // Verify that host has no tasks |
|
| 925 | - if (boincwork_host_user_is_owner($host_id)) { |
|
| 924 | + // Verify that host has no tasks |
|
| 925 | + if (boincwork_host_user_is_owner($host_id)) { |
|
| 926 | 926 | if (!boincwork_host_get_task_count($host_id)) { |
| 927 | - // Delete the host record |
|
| 928 | - db_set_active('boinc_rw'); |
|
| 929 | - $host_deleted = db_query( |
|
| 927 | + // Delete the host record |
|
| 928 | + db_set_active('boinc_rw'); |
|
| 929 | + $host_deleted = db_query( |
|
| 930 | 930 | "DELETE FROM {host} WHERE id = '%d'", |
| 931 | 931 | $host_id |
| 932 | - ); |
|
| 933 | - db_set_active('default'); |
|
| 934 | - if ($host_deleted) { |
|
| 932 | + ); |
|
| 933 | + db_set_active('default'); |
|
| 934 | + if ($host_deleted) { |
|
| 935 | 935 | drupal_set_message(t('Host @id has been removed from your account.', |
| 936 | - array('@id' => $host_id))); |
|
| 936 | + array('@id' => $host_id))); |
|
| 937 | 937 | drupal_goto('account/computers'); |
| 938 | - } |
|
| 939 | - else { |
|
| 938 | + } |
|
| 939 | + else { |
|
| 940 | 940 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
| 941 | - array('@id' => $host_id)), 'error' |
|
| 941 | + array('@id' => $host_id)), 'error' |
|
| 942 | 942 | ); |
| 943 | - } |
|
| 943 | + } |
|
| 944 | 944 | } |
| 945 | 945 | else { |
| 946 | - drupal_set_message(t('Host @id cannot be deleted because it still has |
|
| 946 | + drupal_set_message(t('Host @id cannot be deleted because it still has |
|
| 947 | 947 | tasks associated with it. These tasks should be processed within the |
| 948 | 948 | next few days, after which the host can be deleted.', |
| 949 | 949 | array('@id' => $host_id)), 'warning' |
| 950 | - ); |
|
| 950 | + ); |
|
| 951 | + } |
|
| 951 | 952 | } |
| 952 | - } |
|
| 953 | - else { |
|
| 953 | + else { |
|
| 954 | 954 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
| 955 | 955 | delete it.', |
| 956 | - array('@id' => $host_id)), 'error' |
|
| 956 | + array('@id' => $host_id)), 'error' |
|
| 957 | 957 | ); |
| 958 | - } |
|
| 959 | - drupal_goto("host/{$host_id}"); |
|
| 958 | + } |
|
| 959 | + drupal_goto("host/{$host_id}"); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -964,55 +964,55 @@ discard block |
||
| 964 | 964 | * Called when user accesses the log for a host |
| 965 | 965 | */ |
| 966 | 966 | function boincwork_host_log($host_id = null) { |
| 967 | - $root_log_dir = variable_get('boinc_host_sched_logs_dir', ''); |
|
| 968 | - $log = ''; |
|
| 969 | - if ($root_log_dir AND $host_id) { |
|
| 967 | + $root_log_dir = variable_get('boinc_host_sched_logs_dir', ''); |
|
| 968 | + $log = ''; |
|
| 969 | + if ($root_log_dir AND $host_id) { |
|
| 970 | 970 | $subdir = substr($host_id, 0, -3) OR $subdir = 0; |
| 971 | 971 | $log = implode('/', array($root_log_dir, $subdir, $host_id)); |
| 972 | - } |
|
| 973 | - if ($log AND file_exists($log)) { |
|
| 972 | + } |
|
| 973 | + if ($log AND file_exists($log)) { |
|
| 974 | 974 | header('Content-type: text/plain'); |
| 975 | 975 | include($log); |
| 976 | - } |
|
| 976 | + } |
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | function boincwork_host_set_venue($host_id = NULL, $venue = NULL) { |
| 980 | - global $user; |
|
| 981 | - $account = user_load($user->uid); |
|
| 982 | - db_set_active('boinc_ro'); |
|
| 983 | - // Verify that this is my host |
|
| 984 | - $host_owner = db_result(db_query( |
|
| 980 | + global $user; |
|
| 981 | + $account = user_load($user->uid); |
|
| 982 | + db_set_active('boinc_ro'); |
|
| 983 | + // Verify that this is my host |
|
| 984 | + $host_owner = db_result(db_query( |
|
| 985 | 985 | "SELECT userid FROM {host} WHERE id = '%d'", |
| 986 | 986 | $host_id |
| 987 | - )); |
|
| 988 | - db_set_active('default'); |
|
| 989 | - if ($host_owner AND $host_owner == $account->boincuser_id) { |
|
| 987 | + )); |
|
| 988 | + db_set_active('default'); |
|
| 989 | + if ($host_owner AND $host_owner == $account->boincuser_id) { |
|
| 990 | 990 | db_set_active('boinc_rw'); |
| 991 | 991 | $updated = db_query( |
| 992 | - "UPDATE {host} SET venue = '%s' WHERE id = '%d'", |
|
| 993 | - $venue, $host_id |
|
| 992 | + "UPDATE {host} SET venue = '%s' WHERE id = '%d'", |
|
| 993 | + $venue, $host_id |
|
| 994 | 994 | ); |
| 995 | 995 | db_set_active('default'); |
| 996 | 996 | if ($updated) { |
| 997 | - drupal_set_message( |
|
| 997 | + drupal_set_message( |
|
| 998 | 998 | bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
| 999 | 999 | . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
| 1000 | - ); |
|
| 1000 | + ); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | else { |
| 1003 | - drupal_set_message( |
|
| 1003 | + drupal_set_message( |
|
| 1004 | 1004 | bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
| 1005 | 1005 | 'error' |
| 1006 | - ); |
|
| 1006 | + ); |
|
| 1007 | 1007 | } |
| 1008 | - } |
|
| 1009 | - else { |
|
| 1008 | + } |
|
| 1009 | + else { |
|
| 1010 | 1010 | drupal_set_message( |
| 1011 | - bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
|
| 1012 | - 'warning' |
|
| 1011 | + bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
|
| 1012 | + 'warning' |
|
| 1013 | 1013 | ); |
| 1014 | - } |
|
| 1015 | - drupal_goto("host/{$host_id}"); |
|
| 1014 | + } |
|
| 1015 | + drupal_goto("host/{$host_id}"); |
|
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | /** |
@@ -1020,8 +1020,8 @@ discard block |
||
| 1020 | 1020 | * Called when user accesses cell phone stats |
| 1021 | 1021 | */ |
| 1022 | 1022 | function boincwork_mobile_stats($userid = null) { |
| 1023 | - $_GET['id'] = $userid; |
|
| 1024 | - include_boinc('user/userw.php'); |
|
| 1023 | + $_GET['id'] = $userid; |
|
| 1024 | + include_boinc('user/userw.php'); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | 1027 | /** |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | * Called to build the server status page |
| 1030 | 1030 | */ |
| 1031 | 1031 | function boincwork_server_status() { |
| 1032 | - include_boinc('user/server_status.php'); |
|
| 1032 | + include_boinc('user/server_status.php'); |
|
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | /** |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | * RPC for managing job input files |
| 1038 | 1038 | */ |
| 1039 | 1039 | function boincwork_job_file() { |
| 1040 | - include_boinc('user/job_file.php'); |
|
| 1040 | + include_boinc('user/job_file.php'); |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | /** |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | * Get output file from remote job submission |
| 1046 | 1046 | */ |
| 1047 | 1047 | function boincwork_get_output() { |
| 1048 | - include_boinc('user/get_output.php'); |
|
| 1048 | + include_boinc('user/get_output.php'); |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | /** |
@@ -1053,28 +1053,28 @@ discard block |
||
| 1053 | 1053 | * Get the project configuration XML; used by client software |
| 1054 | 1054 | */ |
| 1055 | 1055 | function boincwork_get_project_config() { |
| 1056 | - ob_start(); |
|
| 1057 | - include_boinc('user/get_project_config.php'); |
|
| 1058 | - $xml = ob_get_clean(); |
|
| 1059 | - $xml = load_configuration($xml); |
|
| 1060 | - |
|
| 1061 | - // obtain Drupal variables |
|
| 1062 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 1063 | - $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE); |
|
| 1064 | - |
|
| 1065 | - // If terms of use string exists and override is true, set terms-of-use |
|
| 1066 | - // to Drupal varaible. |
|
| 1067 | - if ( (!empty($termsofuse) && ($overrideboinctou)) ) { |
|
| 1056 | + ob_start(); |
|
| 1057 | + include_boinc('user/get_project_config.php'); |
|
| 1058 | + $xml = ob_get_clean(); |
|
| 1059 | + $xml = load_configuration($xml); |
|
| 1060 | + |
|
| 1061 | + // obtain Drupal variables |
|
| 1062 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 1063 | + $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE); |
|
| 1064 | + |
|
| 1065 | + // If terms of use string exists and override is true, set terms-of-use |
|
| 1066 | + // to Drupal varaible. |
|
| 1067 | + if ( (!empty($termsofuse) && ($overrideboinctou)) ) { |
|
| 1068 | 1068 | if (!empty($xml['project_config']['terms_of_use'])) { |
| 1069 | - // Remove any existing terms of use |
|
| 1070 | - unset($xml['project_config']['terms_of_use']); |
|
| 1069 | + // Remove any existing terms of use |
|
| 1070 | + unset($xml['project_config']['terms_of_use']); |
|
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | // Add terms of use from Drupal |
| 1074 | 1074 | $xml['project_config']['terms_of_use']['@value'] = $termsofuse; |
| 1075 | - } |
|
| 1075 | + } |
|
| 1076 | 1076 | |
| 1077 | - print save_configuration($xml); |
|
| 1077 | + print save_configuration($xml); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | |
@@ -1082,16 +1082,16 @@ discard block |
||
| 1082 | 1082 | * Page callback for the remote job submission RPC (submit_rpc_handler.php). |
| 1083 | 1083 | */ |
| 1084 | 1084 | function boincwork_submit_rpc_handler() { |
| 1085 | - include_boinc('user/submit_rpc_handler.php'); |
|
| 1085 | + include_boinc('user/submit_rpc_handler.php'); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | /** |
| 1089 | 1089 | * Page callback for user WAP (userw.php). |
| 1090 | 1090 | */ |
| 1091 | 1091 | function boincwork_user_wap() { |
| 1092 | - // Remove q from the GET request or BOINC will panic |
|
| 1093 | - unset($_GET['q']); |
|
| 1094 | - include_boinc('user/userw.php'); |
|
| 1092 | + // Remove q from the GET request or BOINC will panic |
|
| 1093 | + unset($_GET['q']); |
|
| 1094 | + include_boinc('user/userw.php'); |
|
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | 1097 | |
@@ -1099,44 +1099,44 @@ discard block |
||
| 1099 | 1099 | * Page callback for user account task table |
| 1100 | 1100 | */ |
| 1101 | 1101 | function boincwork_account_task_table($tselect = NULL, $app_id = NULL) { |
| 1102 | - $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table'); |
|
| 1103 | - drupal_set_title($title); |
|
| 1102 | + $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table'); |
|
| 1103 | + drupal_set_title($title); |
|
| 1104 | 1104 | |
| 1105 | - global $user; |
|
| 1106 | - $account = user_load($user->uid); |
|
| 1107 | - return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id); |
|
| 1105 | + global $user; |
|
| 1106 | + $account = user_load($user->uid); |
|
| 1107 | + return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id); |
|
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | /** |
| 1111 | 1111 | * Page callback for host task table |
| 1112 | 1112 | */ |
| 1113 | 1113 | function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) { |
| 1114 | - require_boinc( array('util', 'result') ); |
|
| 1114 | + require_boinc( array('util', 'result') ); |
|
| 1115 | 1115 | |
| 1116 | - $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
|
| 1117 | - drupal_set_title($title); |
|
| 1116 | + $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
|
| 1117 | + drupal_set_title($title); |
|
| 1118 | 1118 | |
| 1119 | - if (is_null($host_id)) { |
|
| 1119 | + if (is_null($host_id)) { |
|
| 1120 | 1120 | drupal_set_message(bts('ERROR: Invalid host ID', array(), NULL, 'boinc:host-task-table'), 'error'); |
| 1121 | 1121 | return ''; |
| 1122 | - } |
|
| 1122 | + } |
|
| 1123 | 1123 | |
| 1124 | - return boincwork_tasktable(2, $host_id, $tselect, $app_id); |
|
| 1124 | + return boincwork_tasktable(2, $host_id, $tselect, $app_id); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | /** |
| 1128 | 1128 | * Page callback for workunit task table |
| 1129 | 1129 | */ |
| 1130 | 1130 | function boincwork_workunit_task_table($workunit_id = NULL, $tselect = NULL, $app_id = NULL) { |
| 1131 | - $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table'); |
|
| 1132 | - drupal_set_title($title); |
|
| 1131 | + $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table'); |
|
| 1132 | + drupal_set_title($title); |
|
| 1133 | 1133 | |
| 1134 | - if (is_null($workunit_id)) { |
|
| 1134 | + if (is_null($workunit_id)) { |
|
| 1135 | 1135 | drupal_set_message(bts('ERROR: Invalid workunit ID', array(), NULL, 'boinc:workunit-task-table'), 'error'); |
| 1136 | 1136 | return ''; |
| 1137 | - } |
|
| 1137 | + } |
|
| 1138 | 1138 | |
| 1139 | - return boincwork_tasktable(1, $workunit_id, $tselect, $app_id); |
|
| 1139 | + return boincwork_tasktable(1, $workunit_id, $tselect, $app_id); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | /** |
@@ -1144,8 +1144,8 @@ discard block |
||
| 1144 | 1144 | * Take a node ID and render that node as a page |
| 1145 | 1145 | */ |
| 1146 | 1146 | function boincwork_view_page($nid) { |
| 1147 | - $node = node_load($nid); |
|
| 1148 | - return node_page_view($node); |
|
| 1147 | + $node = node_load($nid); |
|
| 1148 | + return node_page_view($node); |
|
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | |
@@ -1157,16 +1157,16 @@ discard block |
||
| 1157 | 1157 | * Determine which venue should be selected |
| 1158 | 1158 | */ |
| 1159 | 1159 | function boincwork_select_venue(&$venue) { |
| 1160 | - if (!$venue) { |
|
| 1160 | + if (!$venue) { |
|
| 1161 | 1161 | $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : NULL; |
| 1162 | 1162 | if ($active_venue) { |
| 1163 | - $venue = $active_venue; |
|
| 1164 | - //unset($_SESSION['prefs venue']); |
|
| 1163 | + $venue = $active_venue; |
|
| 1164 | + //unset($_SESSION['prefs venue']); |
|
| 1165 | + } |
|
| 1165 | 1166 | } |
| 1166 | - } |
|
| 1167 | - else { |
|
| 1167 | + else { |
|
| 1168 | 1168 | // Set the active venue to keep it selected between computing and project |
| 1169 | 1169 | // preference pages |
| 1170 | 1170 | $_SESSION['prefs venue'] = $venue; |
| 1171 | - } |
|
| 1171 | + } |
|
| 1172 | 1172 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $items['host/%/set-venue/%'] = array( |
| 134 | 134 | 'title' => 'Set host venue', |
| 135 | 135 | 'page callback' => 'boincwork_host_set_venue', |
| 136 | - 'page arguments' => array(1,3), |
|
| 136 | + 'page arguments' => array(1, 3), |
|
| 137 | 137 | 'access callback' => 'user_is_logged_in', |
| 138 | 138 | 'type' => MENU_CALLBACK, |
| 139 | 139 | ); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | 'title' => 'Account Tasks Table', |
| 185 | 185 | 'description' => '', |
| 186 | 186 | 'page callback' => 'boincwork_account_task_table', |
| 187 | - 'page arguments' => array(2,3), |
|
| 187 | + 'page arguments' => array(2, 3), |
|
| 188 | 188 | 'access arguments' => array('access content'), |
| 189 | 189 | 'type' => MENU_CALLBACK, |
| 190 | 190 | ); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | 'title' => 'Host Tasks Table', |
| 193 | 193 | 'description' => '', |
| 194 | 194 | 'page callback' => 'boincwork_host_task_table', |
| 195 | - 'page arguments' => array(1,3,4), |
|
| 195 | + 'page arguments' => array(1, 3, 4), |
|
| 196 | 196 | 'access arguments' => array('access content'), |
| 197 | 197 | 'type' => MENU_CALLBACK, |
| 198 | 198 | ); |
@@ -276,15 +276,15 @@ discard block |
||
| 276 | 276 | if ($vars['message']['is_blocked']) { |
| 277 | 277 | $vars['message_actions']['unignore_user'] = array( |
| 278 | 278 | 'title' => bts('Stop Ignoring User', array(), NULL, 'boinc:ignore-user-remove'), |
| 279 | - 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
|
| 280 | - 'query' => 'destination=messages/view/' . $thread_id, |
|
| 279 | + 'href' => 'account/prefs/privacy/ignore_user/remove/'.$author->uid, |
|
| 280 | + 'query' => 'destination=messages/view/'.$thread_id, |
|
| 281 | 281 | ); |
| 282 | 282 | } |
| 283 | 283 | else { |
| 284 | 284 | $vars['message_actions']['ignore_user'] = array( |
| 285 | 285 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
| 286 | - 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
|
| 287 | - 'query' => 'destination=messages/view/' . $thread_id, |
|
| 286 | + 'href' => 'account/prefs/privacy/ignore_user/add/'.$author->uid, |
|
| 287 | + 'query' => 'destination=messages/view/'.$thread_id, |
|
| 288 | 288 | ); |
| 289 | 289 | } |
| 290 | 290 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | // Delete expired hosts in the BOINC database, host_delete table. |
| 298 | 298 | require_boinc('boinc_db'); |
| 299 | 299 | $num_deleted = BoincHostDeleted::delete_expired(); |
| 300 | - if ($num_deleted>0) { |
|
| 300 | + if ($num_deleted > 0) { |
|
| 301 | 301 | watchdog('boincwork', "Deleted ${num_deleted} hosts from host_deleted table", WATCHDOG_NOTICE); |
| 302 | 302 | } |
| 303 | 303 | } |
@@ -344,10 +344,10 @@ discard block |
||
| 344 | 344 | drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>'; |
|
| 348 | - $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), NULL, 'boinc:account-preferences-computing') . '</p>'; |
|
| 349 | - $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>'; |
|
| 350 | - $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing') . '</h2>'; |
|
| 347 | + $output .= '<p>'.bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing').'<br/>'; |
|
| 348 | + $output .= bts('On computers attached to multiple projects, the most recently modified preferences will be used.', array(), NULL, 'boinc:account-preferences-computing').'</p>'; |
|
| 349 | + $output .= '<p>'.bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['prefs']['modified']['#value'])), NULL, 'boinc:account-preferences').'</p>'; |
|
| 350 | + $output .= '<h2>'.bts('Combined preferences', array(), NULL, 'boinc:account-preferences').' '.l('('.bts('Switch View', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/computing').'</h2>'; |
|
| 351 | 351 | |
| 352 | 352 | $output .= '<table class="preferences combined">'; |
| 353 | 353 | |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $output .= '<tr class="section-heading">'; |
| 358 | 358 | $output .= "<td>{$section['name']}</td>"; |
| 359 | 359 | foreach ($pref_sets as $pref_set) { |
| 360 | - $output .= '<td>' . $pref_set . '</td>'; |
|
| 360 | + $output .= '<td>'.$pref_set.'</td>'; |
|
| 361 | 361 | } |
| 362 | 362 | $output .= '</tr>'; |
| 363 | 363 | foreach ($section['elements'] as $name => $setting) { |
@@ -405,11 +405,11 @@ discard block |
||
| 405 | 405 | $second_pref = $special_map[$name]; |
| 406 | 406 | $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
| 407 | 407 | $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value']; |
| 408 | - $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
|
| 408 | + $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}". |
|
| 409 | 409 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | - else { |
|
| 412 | + else { |
|
| 413 | 413 | $output .= '<td>---</td>'; |
| 414 | 414 | } |
| 415 | 415 | } |
@@ -437,12 +437,12 @@ discard block |
||
| 437 | 437 | ); |
| 438 | 438 | // Show Clear links for established preference sets |
| 439 | 439 | if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
| 440 | - $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}", |
|
| 440 | + $output .= ' </li><li class="tab"> '.l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}", |
|
| 441 | 441 | array( |
| 442 | 442 | 'query' => drupal_get_destination(), |
| 443 | 443 | 'attributes' => array( |
| 444 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 445 | - array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')' |
|
| 444 | + 'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 445 | + array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences').'\')' |
|
| 446 | 446 | ) |
| 447 | 447 | ) |
| 448 | 448 | ); |
@@ -468,8 +468,8 @@ discard block |
||
| 468 | 468 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
| 469 | 469 | ); |
| 470 | 470 | variable_set('jump_use_js_venues-Array', 1); |
| 471 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 472 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 471 | + drupal_add_js(drupal_get_path('module', 'jump').'/jump.js'); |
|
| 472 | + drupal_add_js(drupal_get_path('theme', 'boinc').'/js/prefs.js', 'theme'); |
|
| 473 | 473 | |
| 474 | 474 | $output .= '<div id="venue-selector" class="simple-form-controls">'; |
| 475 | 475 | $output .= ' <div class="form-item venue">'; |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | if (!$current_set['#established']) { |
| 490 | 490 | drupal_set_message(bts( |
| 491 | 491 | "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
| 492 | - array( '@venue' => $venue, ), |
|
| 492 | + array('@venue' => $venue,), |
|
| 493 | 493 | NULL, 'boinc:account-preferences'), 'status'); |
| 494 | 494 | } |
| 495 | 495 | |
@@ -548,8 +548,8 @@ discard block |
||
| 548 | 548 | drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>'; |
|
| 552 | - $output .= '<h2>' . bts('Combined preferences', array(), NULL, 'boinc:account-preferences') . ' ' . l('(' . bts('Switch View', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project') . '</h2>'; |
|
| 551 | + $output .= '<p>'.bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), NULL, 'boinc:account-preferences').'</p>'; |
|
| 552 | + $output .= '<h2>'.bts('Combined preferences', array(), NULL, 'boinc:account-preferences').' '.l('('.bts('Switch View', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/project').'</h2>'; |
|
| 553 | 553 | |
| 554 | 554 | $output .= '<table class="preferences combined">'; |
| 555 | 555 | |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | $output .= '<tr class="section-heading">'; |
| 560 | 560 | $output .= "<td>{$section['name']}</td>"; |
| 561 | 561 | foreach ($pref_sets as $pref_set) { |
| 562 | - $output .= '<td>' . $pref_set . '</td>'; |
|
| 562 | + $output .= '<td>'.$pref_set.'</td>'; |
|
| 563 | 563 | } |
| 564 | 564 | $output .= '</tr>'; |
| 565 | 565 | foreach ($section['elements'] as $name => $setting) { |
@@ -601,12 +601,12 @@ discard block |
||
| 601 | 601 | $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
| 602 | 602 | // Show Clear links for established preference sets |
| 603 | 603 | if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
| 604 | - $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}", |
|
| 604 | + $output .= ' </li><li class="tab"> '.l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}", |
|
| 605 | 605 | array( |
| 606 | 606 | 'query' => drupal_get_destination(), |
| 607 | 607 | 'attributes' => array( |
| 608 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 609 | - array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')' |
|
| 608 | + 'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 609 | + array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project').'\')' |
|
| 610 | 610 | ) |
| 611 | 611 | ) |
| 612 | 612 | ); |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | // Set this preference set as the one to use for any new hosts attached |
| 623 | 623 | // to the user account |
| 624 | 624 | boincwork_set_default_venue($venue); |
| 625 | - drupal_set_message( bts('The primary preference set has been changed to "@set"', array('@set' => $venue), NULL, 'boinc:account-preferences-project') ); |
|
| 625 | + drupal_set_message(bts('The primary preference set has been changed to "@set"', array('@set' => $venue), NULL, 'boinc:account-preferences-project')); |
|
| 626 | 626 | drupal_goto('account/prefs/project/combined'); |
| 627 | 627 | break; |
| 628 | 628 | |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
| 642 | 642 | ); |
| 643 | 643 | variable_set('jump_use_js_venues-Array', 1); |
| 644 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 645 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 644 | + drupal_add_js(drupal_get_path('module', 'jump').'/jump.js'); |
|
| 645 | + drupal_add_js(drupal_get_path('theme', 'boinc').'/js/prefs.js', 'theme'); |
|
| 646 | 646 | |
| 647 | 647 | $output .= '<div id="venue-selector" class="simple-form-controls">'; |
| 648 | 648 | $output .= ' <div class="form-item venue">'; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | if (!$current_set['#established']) { |
| 663 | 663 | drupal_set_message(bts( |
| 664 | 664 | "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
| 665 | - array( '@venue' => $venue, ), |
|
| 665 | + array('@venue' => $venue,), |
|
| 666 | 666 | NULL, 'boinc:account-preferences'), 'status'); |
| 667 | 667 | } |
| 668 | 668 | |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | // Edit preferences link |
| 735 | 735 | $output .= '<tr>'; |
| 736 | 736 | $output .= '<td></td>'; |
| 737 | - $output .= '<td>' . l(bts('Edit privacy preferences', array('@project' => PROJECT), NULL, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit") . '</td>'; |
|
| 737 | + $output .= '<td>'.l(bts('Edit privacy preferences', array('@project' => PROJECT), NULL, 'boinc:account-preferences-privacy'), "account/prefs/privacy/edit").'</td>'; |
|
| 738 | 738 | $output .= '</tr>'; |
| 739 | 739 | |
| 740 | 740 | $output .= '</table>'; |
@@ -769,15 +769,15 @@ discard block |
||
| 769 | 769 | switch ($type) { |
| 770 | 770 | case 'all': |
| 771 | 771 | //include_boinc('user/cert_all.php'); |
| 772 | - require_boinc(array('util','cert','user')); |
|
| 772 | + require_boinc(array('util', 'cert', 'user')); |
|
| 773 | 773 | |
| 774 | 774 | $join = date('j F Y', $boincuser->create_time); |
| 775 | 775 | $today = date('j F Y', time(0)); |
| 776 | 776 | |
| 777 | - if ($border=="no") { |
|
| 777 | + if ($border == "no") { |
|
| 778 | 778 | $border = 0; |
| 779 | 779 | } else { |
| 780 | - $border=8; |
|
| 780 | + $border = 8; |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | $title_font = "\"Optima,ZapfChancery\""; |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr> |
| 822 | 822 | "; |
| 823 | 823 | foreach ($boincuser->projects as $p) { |
| 824 | - if ($p->total_credit<100) continue; |
|
| 824 | + if ($p->total_credit < 100) continue; |
|
| 825 | 825 | show_proj($p); |
| 826 | 826 | } |
| 827 | 827 | echo " |
@@ -840,15 +840,15 @@ discard block |
||
| 840 | 840 | case 'account': |
| 841 | 841 | default: |
| 842 | 842 | //include_boinc('user/cert1.php'); |
| 843 | - require_boinc(array('util','cert')); |
|
| 843 | + require_boinc(array('util', 'cert')); |
|
| 844 | 844 | |
| 845 | 845 | $join = date('j F Y', $boincuser->create_time); |
| 846 | 846 | $today = date('j F Y', time(0)); |
| 847 | 847 | |
| 848 | - if ($border=="no") { |
|
| 848 | + if ($border == "no") { |
|
| 849 | 849 | $border = 0; |
| 850 | 850 | } else { |
| 851 | - $border=8; |
|
| 851 | + $border = 8; |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | $credit = credit_string($boincuser->total_credit, false); |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | // If terms of use string exists and override is true, set terms-of-use |
| 1066 | 1066 | // to Drupal varaible. |
| 1067 | - if ( (!empty($termsofuse) && ($overrideboinctou)) ) { |
|
| 1067 | + if ((!empty($termsofuse) && ($overrideboinctou))) { |
|
| 1068 | 1068 | if (!empty($xml['project_config']['terms_of_use'])) { |
| 1069 | 1069 | // Remove any existing terms of use |
| 1070 | 1070 | unset($xml['project_config']['terms_of_use']); |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | * Page callback for host task table |
| 1112 | 1112 | */ |
| 1113 | 1113 | function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) { |
| 1114 | - require_boinc( array('util', 'result') ); |
|
| 1114 | + require_boinc(array('util', 'result')); |
|
| 1115 | 1115 | |
| 1116 | 1116 | $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
| 1117 | 1117 | drupal_set_title($title); |
@@ -300,125 +300,125 @@ |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | switch ($form_state['values']['import']) { |
| 303 | - case 'users': |
|
| 304 | - boincimport_users(); |
|
| 305 | - break; |
|
| 306 | - |
|
| 307 | - case 'teams': |
|
| 308 | - boincimport_teams(); |
|
| 309 | - if (!variable_get('boincimport_import_team_successful', 0)) { |
|
| 310 | - $_SESSION['boincimport_stage_selected'] = 'teams'; |
|
| 311 | - } |
|
| 312 | - else { |
|
| 313 | - $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
| 314 | - } |
|
| 315 | - break; |
|
| 303 | + case 'users': |
|
| 304 | + boincimport_users(); |
|
| 305 | + break; |
|
| 316 | 306 | |
| 317 | - case 'friends': |
|
| 318 | - boincimport_friends(); |
|
| 319 | - if (!variable_get('boincimport_import_friend_successful', 0)) { |
|
| 320 | - $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
| 321 | - } |
|
| 322 | - else { |
|
| 323 | - $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
| 324 | - } |
|
| 325 | - break; |
|
| 307 | + case 'teams': |
|
| 308 | + boincimport_teams(); |
|
| 309 | + if (!variable_get('boincimport_import_team_successful', 0)) { |
|
| 310 | + $_SESSION['boincimport_stage_selected'] = 'teams'; |
|
| 311 | + } |
|
| 312 | + else { |
|
| 313 | + $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
| 314 | + } |
|
| 315 | + break; |
|
| 326 | 316 | |
| 327 | - case 'preferences': |
|
| 328 | - boincimport_preferences(); |
|
| 329 | - if (!variable_get('boincimport_import_preferences_successful', 0)) { |
|
| 330 | - $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
| 331 | - } |
|
| 332 | - else { |
|
| 333 | - $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
| 334 | - } |
|
| 335 | - break; |
|
| 317 | + case 'friends': |
|
| 318 | + boincimport_friends(); |
|
| 319 | + if (!variable_get('boincimport_import_friend_successful', 0)) { |
|
| 320 | + $_SESSION['boincimport_stage_selected'] = 'friends'; |
|
| 321 | + } |
|
| 322 | + else { |
|
| 323 | + $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
| 324 | + } |
|
| 325 | + break; |
|
| 336 | 326 | |
| 337 | - case 'private messages': |
|
| 338 | - boincimport_private_msgs(); |
|
| 339 | - if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
|
| 340 | - $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
| 341 | - } |
|
| 342 | - else { |
|
| 343 | - $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
| 344 | - } |
|
| 345 | - break; |
|
| 327 | + case 'preferences': |
|
| 328 | + boincimport_preferences(); |
|
| 329 | + if (!variable_get('boincimport_import_preferences_successful', 0)) { |
|
| 330 | + $_SESSION['boincimport_stage_selected'] = 'preferences'; |
|
| 331 | + } |
|
| 332 | + else { |
|
| 333 | + $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
| 334 | + } |
|
| 335 | + break; |
|
| 346 | 336 | |
| 347 | - case 'categories': |
|
| 348 | - boincimport_forum_categories(); |
|
| 349 | - if (!variable_get('boincimport_import_category_successful', 0)) { |
|
| 350 | - $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
| 351 | - } |
|
| 352 | - else { |
|
| 353 | - $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
| 354 | - } |
|
| 355 | - break; |
|
| 337 | + case 'private messages': |
|
| 338 | + boincimport_private_msgs(); |
|
| 339 | + if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
|
| 340 | + $_SESSION['boincimport_stage_selected'] = 'private messages'; |
|
| 341 | + } |
|
| 342 | + else { |
|
| 343 | + $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
| 344 | + } |
|
| 345 | + break; |
|
| 356 | 346 | |
| 357 | - case 'topics': |
|
| 358 | - boincimport_forum_topics(); |
|
| 359 | - if (!variable_get('boincimport_import_topic_successful', 0)) { |
|
| 360 | - $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
| 361 | - } |
|
| 362 | - else { |
|
| 363 | - $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
| 364 | - } |
|
| 365 | - break; |
|
| 347 | + case 'categories': |
|
| 348 | + boincimport_forum_categories(); |
|
| 349 | + if (!variable_get('boincimport_import_category_successful', 0)) { |
|
| 350 | + $_SESSION['boincimport_stage_selected'] = 'categories'; |
|
| 351 | + } |
|
| 352 | + else { |
|
| 353 | + $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
| 354 | + } |
|
| 355 | + break; |
|
| 356 | + |
|
| 357 | + case 'topics': |
|
| 358 | + boincimport_forum_topics(); |
|
| 359 | + if (!variable_get('boincimport_import_topic_successful', 0)) { |
|
| 360 | + $_SESSION['boincimport_stage_selected'] = 'topics'; |
|
| 361 | + } |
|
| 362 | + else { |
|
| 363 | + $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
| 364 | + } |
|
| 365 | + break; |
|
| 366 | 366 | |
| 367 | - case 'posts': |
|
| 368 | - boincimport_forum_posts(); |
|
| 369 | - if (!variable_get('boincimport_import_post_successful', 0)) { |
|
| 370 | - $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
| 371 | - } |
|
| 372 | - else { |
|
| 373 | - $_SESSION['boincimport_stage_selected'] = 'url'; |
|
| 374 | - } |
|
| 375 | - break; |
|
| 367 | + case 'posts': |
|
| 368 | + boincimport_forum_posts(); |
|
| 369 | + if (!variable_get('boincimport_import_post_successful', 0)) { |
|
| 370 | + $_SESSION['boincimport_stage_selected'] = 'posts'; |
|
| 371 | + } |
|
| 372 | + else { |
|
| 373 | + $_SESSION['boincimport_stage_selected'] = 'url'; |
|
| 374 | + } |
|
| 375 | + break; |
|
| 376 | 376 | |
| 377 | - case 'team forums': |
|
| 378 | - boincimport_team_forums(); |
|
| 379 | - if (!variable_get('boincimport_team_forum_successful', 0)) { |
|
| 380 | - $_SESSION['boincimport_stage_selected'] = 'team forums'; |
|
| 381 | - } |
|
| 382 | - else { |
|
| 383 | - $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
| 384 | - } |
|
| 385 | - break; |
|
| 377 | + case 'team forums': |
|
| 378 | + boincimport_team_forums(); |
|
| 379 | + if (!variable_get('boincimport_team_forum_successful', 0)) { |
|
| 380 | + $_SESSION['boincimport_stage_selected'] = 'team forums'; |
|
| 381 | + } |
|
| 382 | + else { |
|
| 383 | + $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
| 384 | + } |
|
| 385 | + break; |
|
| 386 | 386 | |
| 387 | - case 'team topics': |
|
| 388 | - boincimport_team_forum_topics(); |
|
| 389 | - if (!variable_get('boincimport_team_topic_successful', 0)) { |
|
| 390 | - $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
| 391 | - } |
|
| 392 | - else { |
|
| 393 | - $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
| 394 | - } |
|
| 395 | - break; |
|
| 387 | + case 'team topics': |
|
| 388 | + boincimport_team_forum_topics(); |
|
| 389 | + if (!variable_get('boincimport_team_topic_successful', 0)) { |
|
| 390 | + $_SESSION['boincimport_stage_selected'] = 'team topics'; |
|
| 391 | + } |
|
| 392 | + else { |
|
| 393 | + $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
| 394 | + } |
|
| 395 | + break; |
|
| 396 | 396 | |
| 397 | - case 'team posts': |
|
| 398 | - boincimport_team_forum_posts(); |
|
| 399 | - if (!variable_get('boincimport_team_post_successful', 0)) { |
|
| 400 | - $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
| 401 | - } |
|
| 402 | - else { |
|
| 403 | - $_SESSION['boincimport_stage_selected'] = 'url'; |
|
| 404 | - } |
|
| 405 | - break; |
|
| 397 | + case 'team posts': |
|
| 398 | + boincimport_team_forum_posts(); |
|
| 399 | + if (!variable_get('boincimport_team_post_successful', 0)) { |
|
| 400 | + $_SESSION['boincimport_stage_selected'] = 'team posts'; |
|
| 401 | + } |
|
| 402 | + else { |
|
| 403 | + $_SESSION['boincimport_stage_selected'] = 'url'; |
|
| 404 | + } |
|
| 405 | + break; |
|
| 406 | 406 | |
| 407 | - case 'url': |
|
| 408 | - boincimport_replace_urls(); |
|
| 409 | - if (!variable_get('boincimport_replace_url_successful', 0)) { |
|
| 410 | - $_SESSION['boincimport_stage_selected'] = 'url'; |
|
| 411 | - } |
|
| 412 | - else { |
|
| 413 | - drupal_set_message('Congratulations. Import Finished'); |
|
| 414 | - drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
|
| 415 | - watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
|
| 416 | - unset($_SESSION['boincimport_stage_selected']); |
|
| 417 | - } |
|
| 418 | - break; |
|
| 419 | - default: |
|
| 420 | - $_SESSION['boincimport_stage_selected'] = 'users'; |
|
| 421 | - break; |
|
| 407 | + case 'url': |
|
| 408 | + boincimport_replace_urls(); |
|
| 409 | + if (!variable_get('boincimport_replace_url_successful', 0)) { |
|
| 410 | + $_SESSION['boincimport_stage_selected'] = 'url'; |
|
| 411 | + } |
|
| 412 | + else { |
|
| 413 | + drupal_set_message('Congratulations. Import Finished'); |
|
| 414 | + drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
|
| 415 | + watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
|
| 416 | + unset($_SESSION['boincimport_stage_selected']); |
|
| 417 | + } |
|
| 418 | + break; |
|
| 419 | + default: |
|
| 420 | + $_SESSION['boincimport_stage_selected'] = 'users'; |
|
| 421 | + break; |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | // An error occurred. |
| 662 | 662 | // $operations contains the operations that remained unprocessed. |
| 663 | 663 | $error_operation = reset($operations); |
| 664 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 664 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 665 | 665 | } |
| 666 | 666 | drupal_set_message($message); |
| 667 | 667 | |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | // An error occurred. |
| 873 | 873 | // $operations contains the operations that remained unprocessed. |
| 874 | 874 | $error_operation = reset($operations); |
| 875 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 875 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 876 | 876 | } |
| 877 | 877 | drupal_set_message($message); |
| 878 | 878 | |
@@ -977,13 +977,13 @@ discard block |
||
| 977 | 977 | function boincimport_friends_op($friendship, &$context) { |
| 978 | 978 | |
| 979 | 979 | $input_format = variable_get('boincimport_input_format', 0); |
| 980 | - $success = FALSE; |
|
| 980 | + $success = false; |
|
| 981 | 981 | $message = ''; |
| 982 | 982 | |
| 983 | 983 | // Convert BOINC friends to Drupal friends |
| 984 | 984 | $uid = boincuser_lookup_uid($friendship->user_src); |
| 985 | 985 | $friend_uid = boincuser_lookup_uid($friendship->user_dest); |
| 986 | - if ($uid AND $friend_uid) { |
|
| 986 | + if ($uid and $friend_uid) { |
|
| 987 | 987 | $success = db_query(" |
| 988 | 988 | INSERT IGNORE INTO {flag_friend} |
| 989 | 989 | SET uid = '%d', friend_uid = '%d', created = '%d'", |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | // An error occurred. |
| 1047 | 1047 | // $operations contains the operations that remained unprocessed. |
| 1048 | 1048 | $error_operation = reset($operations); |
| 1049 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1049 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 1050 | 1050 | } |
| 1051 | 1051 | drupal_set_message($message); |
| 1052 | 1052 | |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | */ |
| 1146 | 1146 | function boincimport_quarrels_op($boinc_user, &$context) { |
| 1147 | 1147 | |
| 1148 | - $success = FALSE; |
|
| 1148 | + $success = false; |
|
| 1149 | 1149 | $uid = boincuser_lookup_uid($boinc_user->userid); |
| 1150 | 1150 | $ignored_users = explode('|', trim($boinc_user->ignorelist, '|')); |
| 1151 | 1151 | foreach ($ignored_users as $ignored_user) { |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | $uid, $ignored_user_uid |
| 1166 | 1166 | ); |
| 1167 | 1167 | if ($user_ignored) { |
| 1168 | - $success = TRUE; |
|
| 1168 | + $success = true; |
|
| 1169 | 1169 | } |
| 1170 | 1170 | else { |
| 1171 | 1171 | $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | // An error occurred. |
| 1232 | 1232 | // $operations contains the operations that remained unprocessed. |
| 1233 | 1233 | $error_operation = reset($operations); |
| 1234 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1234 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | drupal_set_message($message); |
| 1237 | 1237 | |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | ); |
| 1358 | 1358 | |
| 1359 | 1359 | $message = ''; |
| 1360 | - if ($message_added AND $recipient_added AND $sender_added) { |
|
| 1360 | + if ($message_added and $recipient_added and $sender_added) { |
|
| 1361 | 1361 | // Store some result for post-processing in the finished callback. |
| 1362 | 1362 | $context['results']['success'][] = $pm->id; |
| 1363 | 1363 | $message = "Successfully imported private message {$pm->id}"; |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | // An error occurred. |
| 1409 | 1409 | // $operations contains the operations that remained unprocessed. |
| 1410 | 1410 | $error_operation = reset($operations); |
| 1411 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1411 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 1412 | 1412 | } |
| 1413 | 1413 | drupal_set_message($message); |
| 1414 | 1414 | |
@@ -1547,7 +1547,7 @@ discard block |
||
| 1547 | 1547 | if (!$hidden_forum_tid) { |
| 1548 | 1548 | $operations[] = array( |
| 1549 | 1549 | 'boincimport_forum_categories_op', array( |
| 1550 | - NULL, $forum_vid, $pre, TRUE |
|
| 1550 | + null, $forum_vid, $pre, true |
|
| 1551 | 1551 | ) |
| 1552 | 1552 | ); |
| 1553 | 1553 | } |
@@ -1561,7 +1561,7 @@ discard block |
||
| 1561 | 1561 | else { |
| 1562 | 1562 | $operations[] = array( |
| 1563 | 1563 | 'boincimport_forum_categories_op', array( |
| 1564 | - $boinc_forum_category, $forum_vid, $pre, FALSE |
|
| 1564 | + $boinc_forum_category, $forum_vid, $pre, false |
|
| 1565 | 1565 | ) |
| 1566 | 1566 | ); |
| 1567 | 1567 | } |
@@ -1630,16 +1630,16 @@ discard block |
||
| 1630 | 1630 | $parent_id = 0; |
| 1631 | 1631 | $description = ''; |
| 1632 | 1632 | $weight = 0; |
| 1633 | - $hidden = FALSE; |
|
| 1633 | + $hidden = false; |
|
| 1634 | 1634 | |
| 1635 | 1635 | $category_map = variable_get('boincimport_forum_category_map', array()); |
| 1636 | 1636 | |
| 1637 | - if (!$category AND $create_hidden) { |
|
| 1637 | + if (!$category and $create_hidden) { |
|
| 1638 | 1638 | // Create the special "hidden" container |
| 1639 | 1639 | $category = new stdClass(); |
| 1640 | 1640 | $category->name = 'Hidden'; |
| 1641 | 1641 | $category->id = 0; |
| 1642 | - $hidden = TRUE; |
|
| 1642 | + $hidden = true; |
|
| 1643 | 1643 | } |
| 1644 | 1644 | else { |
| 1645 | 1645 | // If this container is empty, put it into the hidden container |
@@ -1652,7 +1652,7 @@ discard block |
||
| 1652 | 1652 | db_set_active('default'); |
| 1653 | 1653 | if (!$forums_contained) { |
| 1654 | 1654 | $parent_id = $category_map[0]; |
| 1655 | - $hidden = TRUE; |
|
| 1655 | + $hidden = true; |
|
| 1656 | 1656 | } |
| 1657 | 1657 | } |
| 1658 | 1658 | |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | $message = ''; |
| 1683 | 1683 | if ($success) { |
| 1684 | 1684 | // Store some result for post-processing in the finished callback. |
| 1685 | - if (!$category AND $create_hidden) { |
|
| 1685 | + if (!$category and $create_hidden) { |
|
| 1686 | 1686 | $message = "Created special hidden container"; |
| 1687 | 1687 | } |
| 1688 | 1688 | else { |
@@ -1719,8 +1719,8 @@ discard block |
||
| 1719 | 1719 | */ |
| 1720 | 1720 | function boincimport_forums_op($boincforum, $forum_vid, $pre = '', &$context) { |
| 1721 | 1721 | |
| 1722 | - $hidden_forum = FALSE; |
|
| 1723 | - $open_forum = FALSE; |
|
| 1722 | + $hidden_forum = false; |
|
| 1723 | + $open_forum = false; |
|
| 1724 | 1724 | $category_map = variable_get('boincimport_forum_category_map', array()); |
| 1725 | 1725 | |
| 1726 | 1726 | // Set term parameters for forums |
@@ -1731,11 +1731,11 @@ discard block |
||
| 1731 | 1731 | $weight = $boincforum->orderID; |
| 1732 | 1732 | if ($parent_id == $category_map[0]) { |
| 1733 | 1733 | // If this forum is hidden, flag for appropriate access controls |
| 1734 | - $hidden_forum = TRUE; |
|
| 1734 | + $hidden_forum = true; |
|
| 1735 | 1735 | } |
| 1736 | 1736 | if ($name == 'Getting Started') { |
| 1737 | 1737 | // Must allow users to post in this forum even if they have no credit! |
| 1738 | - $open_forum = TRUE; |
|
| 1738 | + $open_forum = true; |
|
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | 1741 | // Try to detect a BOINC news forum and flag it so that news can be |
@@ -1743,7 +1743,7 @@ discard block |
||
| 1743 | 1743 | if ($name == 'News') { |
| 1744 | 1744 | // Save the ID of the News forum for later import |
| 1745 | 1745 | variable_set('boincimport_news_forum_id', $forum_id); |
| 1746 | - $success = TRUE; |
|
| 1746 | + $success = true; |
|
| 1747 | 1747 | } |
| 1748 | 1748 | else { |
| 1749 | 1749 | // Save all other forums as taxonomy terms |
@@ -1794,7 +1794,7 @@ discard block |
||
| 1794 | 1794 | /** |
| 1795 | 1795 | * Helper function to set permissions on forums upon import |
| 1796 | 1796 | */ |
| 1797 | -function boincimport_forum_set_permissions($forum, $hidden = FALSE, $open = FALSE) { |
|
| 1797 | +function boincimport_forum_set_permissions($forum, $hidden = false, $open = false) { |
|
| 1798 | 1798 | |
| 1799 | 1799 | // Set access controls |
| 1800 | 1800 | $forum_perms = array(); |
@@ -1892,7 +1892,7 @@ discard block |
||
| 1892 | 1892 | // An error occurred. |
| 1893 | 1893 | // $operations contains the operations that remained unprocessed. |
| 1894 | 1894 | $error_operation = reset($operations); |
| 1895 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1895 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 1896 | 1896 | } |
| 1897 | 1897 | drupal_set_message($message); |
| 1898 | 1898 | |
@@ -2040,8 +2040,8 @@ discard block |
||
| 2040 | 2040 | $topic->id |
| 2041 | 2041 | )); |
| 2042 | 2042 | |
| 2043 | - if ($duplicate OR !$post) { |
|
| 2044 | - $success = FALSE; |
|
| 2043 | + if ($duplicate or !$post) { |
|
| 2044 | + $success = false; |
|
| 2045 | 2045 | } |
| 2046 | 2046 | |
| 2047 | 2047 | else { |
@@ -2069,7 +2069,7 @@ discard block |
||
| 2069 | 2069 | } |
| 2070 | 2070 | |
| 2071 | 2071 | // If dealing with a News topic, be sure it is imported as such |
| 2072 | - if ($news_forum_id AND $topic->forum == $news_forum_id) { |
|
| 2072 | + if ($news_forum_id and $topic->forum == $news_forum_id) { |
|
| 2073 | 2073 | $node_type = 'news'; |
| 2074 | 2074 | $promote = 1; |
| 2075 | 2075 | } |
@@ -2096,7 +2096,7 @@ discard block |
||
| 2096 | 2096 | $node = (object) $node; // node_save requires an object form |
| 2097 | 2097 | node_save($node); |
| 2098 | 2098 | taxonomy_node_save($node, array($tid)); |
| 2099 | - $success = ($node->nid) ? TRUE : FALSE; |
|
| 2099 | + $success = ($node->nid) ? true : false; |
|
| 2100 | 2100 | if ($success) { |
| 2101 | 2101 | $success = db_query(' |
| 2102 | 2102 | INSERT INTO {boincimport_temp_topic} (topic_id, post_id, nid) |
@@ -2127,7 +2127,7 @@ discard block |
||
| 2127 | 2127 | } |
| 2128 | 2128 | elseif ($duplicate) { |
| 2129 | 2129 | $context['results']['duplicate'][] = $topic->id; |
| 2130 | - $message = "Topic {$topic->id} was already imported"; |
|
| 2130 | + $message = "topic {$topic->id} was already imported"; |
|
| 2131 | 2131 | } |
| 2132 | 2132 | elseif (!$post) { |
| 2133 | 2133 | $context['results']['empty'][] = $topic->id; |
@@ -2194,7 +2194,7 @@ discard block |
||
| 2194 | 2194 | // An error occurred. |
| 2195 | 2195 | // $operations contains the operations that remained unprocessed. |
| 2196 | 2196 | $error_operation = reset($operations); |
| 2197 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2197 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 2198 | 2198 | } |
| 2199 | 2199 | drupal_set_message($message); |
| 2200 | 2200 | |
@@ -2335,8 +2335,8 @@ discard block |
||
| 2335 | 2335 | db_set_active('default'); |
| 2336 | 2336 | |
| 2337 | 2337 | $first_post = true; |
| 2338 | - $topic_has_responses = FALSE; |
|
| 2339 | - $success = FALSE; |
|
| 2338 | + $topic_has_responses = false; |
|
| 2339 | + $success = false; |
|
| 2340 | 2340 | $posts_imported = 0; |
| 2341 | 2341 | $empty_posts = 0; |
| 2342 | 2342 | $error_posts = 0; |
@@ -2351,7 +2351,7 @@ discard block |
||
| 2351 | 2351 | } |
| 2352 | 2352 | |
| 2353 | 2353 | // Making it this far confirms that there are posts to import |
| 2354 | - $topic_has_responses = TRUE; |
|
| 2354 | + $topic_has_responses = true; |
|
| 2355 | 2355 | |
| 2356 | 2356 | $is_duplicate = db_result(db_query(' |
| 2357 | 2357 | SELECT COUNT(*) FROM {boincimport_temp_post} |
@@ -2397,14 +2397,14 @@ discard block |
||
| 2397 | 2397 | )); |
| 2398 | 2398 | $post_reply = $pid; |
| 2399 | 2399 | |
| 2400 | - if ($post_reply OR $topic_reply) { |
|
| 2400 | + if ($post_reply or $topic_reply) { |
|
| 2401 | 2401 | // Create a subject for the post from the post content. The body may be in |
| 2402 | 2402 | // any format, so we: |
| 2403 | 2403 | // 1) Filter it into HTML |
| 2404 | 2404 | // 2) Strip out all HTML tags |
| 2405 | 2405 | // 3) Convert entities back to plain-text. |
| 2406 | 2406 | // Note: format is checked by check_markup(). |
| 2407 | - $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, TRUE); |
|
| 2407 | + $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, true); |
|
| 2408 | 2408 | // Replace "Quote:" with "RE:" |
| 2409 | 2409 | $subject = str_replace('Quote:', 'RE: ', $subject); |
| 2410 | 2410 | // Fringe cases where the comment body is populated only by HTML tags |
@@ -2456,10 +2456,10 @@ discard block |
||
| 2456 | 2456 | } |
| 2457 | 2457 | |
| 2458 | 2458 | $message = ''; |
| 2459 | - if ($success OR !$topic_has_responses) { |
|
| 2459 | + if ($success or !$topic_has_responses) { |
|
| 2460 | 2460 | // Store some result for post-processing in the finished callback. |
| 2461 | 2461 | $context['results']['success'][] = $boinc_topic->id; |
| 2462 | - $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
|
| 2462 | + $message = "imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
|
| 2463 | 2463 | } |
| 2464 | 2464 | else { |
| 2465 | 2465 | $context['results']['failure'][] = $boinc_topic->id; |
@@ -2528,7 +2528,7 @@ discard block |
||
| 2528 | 2528 | // An error occurred. |
| 2529 | 2529 | // $operations contains the operations that remained unprocessed. |
| 2530 | 2530 | $error_operation = reset($operations); |
| 2531 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2531 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 2532 | 2532 | } |
| 2533 | 2533 | drupal_set_message($message); |
| 2534 | 2534 | |
@@ -2725,7 +2725,7 @@ discard block |
||
| 2725 | 2725 | // An error occurred. |
| 2726 | 2726 | // $operations contains the operations that remained unprocessed. |
| 2727 | 2727 | $error_operation = reset($operations); |
| 2728 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2728 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 2729 | 2729 | } |
| 2730 | 2730 | drupal_set_message($message); |
| 2731 | 2731 | |
@@ -2852,7 +2852,7 @@ discard block |
||
| 2852 | 2852 | function boincimport_team_topics_op($topic, &$context) { |
| 2853 | 2853 | |
| 2854 | 2854 | $input_format = variable_get('boincimport_input_format', 0); |
| 2855 | - $success = FALSE; |
|
| 2855 | + $success = false; |
|
| 2856 | 2856 | $missing_parent = array(); |
| 2857 | 2857 | $empty_topics = array(); |
| 2858 | 2858 | |
@@ -2937,7 +2937,7 @@ discard block |
||
| 2937 | 2937 | WHERE nid = %d', |
| 2938 | 2938 | $node->created, $node->nid |
| 2939 | 2939 | ); |
| 2940 | - $success = TRUE; |
|
| 2940 | + $success = true; |
|
| 2941 | 2941 | } |
| 2942 | 2942 | } |
| 2943 | 2943 | } |
@@ -2994,7 +2994,7 @@ discard block |
||
| 2994 | 2994 | // An error occurred. |
| 2995 | 2995 | // $operations contains the operations that remained unprocessed. |
| 2996 | 2996 | $error_operation = reset($operations); |
| 2997 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2997 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 2998 | 2998 | } |
| 2999 | 2999 | drupal_set_message($message); |
| 3000 | 3000 | |
@@ -3149,7 +3149,7 @@ discard block |
||
| 3149 | 3149 | function boincimport_team_posts_op($post, &$context) { |
| 3150 | 3150 | |
| 3151 | 3151 | $input_format = variable_get('boincimport_input_format', 0); |
| 3152 | - $success = FALSE; |
|
| 3152 | + $success = false; |
|
| 3153 | 3153 | |
| 3154 | 3154 | // Make sure the post is valid |
| 3155 | 3155 | if ($post->content) { |
@@ -3183,14 +3183,14 @@ discard block |
||
| 3183 | 3183 | )); |
| 3184 | 3184 | $post_reply = $pid; |
| 3185 | 3185 | |
| 3186 | - if ($post_reply OR $topic_reply) { |
|
| 3186 | + if ($post_reply or $topic_reply) { |
|
| 3187 | 3187 | // Create a subject for the post from the post content. The body may be in |
| 3188 | 3188 | // any format, so we: |
| 3189 | 3189 | // 1) Filter it into HTML |
| 3190 | 3190 | // 2) Strip out all HTML tags |
| 3191 | 3191 | // 3) Convert entities back to plain-text. |
| 3192 | 3192 | // Note: format is checked by check_markup(). |
| 3193 | - $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, TRUE); |
|
| 3193 | + $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, true); |
|
| 3194 | 3194 | // Replace "Quote:" with "RE:" |
| 3195 | 3195 | $subject = str_replace('Quote:', 'RE: ', $subject); |
| 3196 | 3196 | // Fringe cases where the comment body is populated only by HTML tags |
@@ -3276,7 +3276,7 @@ discard block |
||
| 3276 | 3276 | // An error occurred. |
| 3277 | 3277 | // $operations contains the operations that remained unprocessed. |
| 3278 | 3278 | $error_operation = reset($operations); |
| 3279 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 3279 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 3280 | 3280 | } |
| 3281 | 3281 | drupal_set_message($message); |
| 3282 | 3282 | |
@@ -3427,7 +3427,7 @@ discard block |
||
| 3427 | 3427 | // An error occurred. |
| 3428 | 3428 | // $operations contains the operations that remained unprocessed. |
| 3429 | 3429 | $error_operation = reset($operations); |
| 3430 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 3430 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 3431 | 3431 | } |
| 3432 | 3432 | drupal_set_message($message); |
| 3433 | 3433 | |
@@ -3477,7 +3477,7 @@ discard block |
||
| 3477 | 3477 | FROM {pm_message} pm' |
| 3478 | 3478 | )); |
| 3479 | 3479 | |
| 3480 | - if (!$node_count AND !$comment_count AND !$pm_count) { |
|
| 3480 | + if (!$node_count and !$comment_count and !$pm_count) { |
|
| 3481 | 3481 | drupal_set_message( |
| 3482 | 3482 | t('There were no nodes, comments, or private messages found: Aborting script'), 'warning' |
| 3483 | 3483 | ); |
@@ -3579,14 +3579,14 @@ discard block |
||
| 3579 | 3579 | ); |
| 3580 | 3580 | |
| 3581 | 3581 | while ($node = db_fetch_object($nodes)) { |
| 3582 | - $updated = FALSE; |
|
| 3582 | + $updated = false; |
|
| 3583 | 3583 | |
| 3584 | 3584 | // Update URLs in node contents |
| 3585 | 3585 | $original_body = $node->body; |
| 3586 | 3586 | $original_teaser = $node->teaser; |
| 3587 | 3587 | $node->body = _boincimport_replace_links($node->body); |
| 3588 | 3588 | $node->teaser = _boincimport_replace_links($node->teaser); |
| 3589 | - if ($node->body != $original_body OR $node->teaser != $original_teaser) { |
|
| 3589 | + if ($node->body != $original_body or $node->teaser != $original_teaser) { |
|
| 3590 | 3590 | $updated = db_query(" |
| 3591 | 3591 | UPDATE {node_revisions} |
| 3592 | 3592 | SET body= '%s', teaser = '%s' |
@@ -3645,7 +3645,7 @@ discard block |
||
| 3645 | 3645 | ); |
| 3646 | 3646 | |
| 3647 | 3647 | while ($comment = db_fetch_object($comments)) { |
| 3648 | - $updated = FALSE; |
|
| 3648 | + $updated = false; |
|
| 3649 | 3649 | |
| 3650 | 3650 | // Update URLs in comment contents |
| 3651 | 3651 | $original_comment = $comment->comment; |
@@ -3708,7 +3708,7 @@ discard block |
||
| 3708 | 3708 | ); |
| 3709 | 3709 | |
| 3710 | 3710 | while ($pm = db_fetch_object($messages)) { |
| 3711 | - $updated = FALSE; |
|
| 3711 | + $updated = false; |
|
| 3712 | 3712 | |
| 3713 | 3713 | // Update URLs in private message body |
| 3714 | 3714 | $original_pm_body = $pm->body; |
@@ -3812,7 +3812,7 @@ discard block |
||
| 3812 | 3812 | // An error occurred. |
| 3813 | 3813 | // $operations contains the operations that remained unprocessed. |
| 3814 | 3814 | $error_operation = reset($operations); |
| 3815 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 3815 | + $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], true); |
|
| 3816 | 3816 | } |
| 3817 | 3817 | drupal_set_message($message); |
| 3818 | 3818 | |
@@ -4009,7 +4009,7 @@ discard block |
||
| 4009 | 4009 | foreach ($boinc_base_urls as $url) { |
| 4010 | 4010 | $domain = parse_url($url, PHP_URL_HOST); |
| 4011 | 4011 | if ($domain) { |
| 4012 | - $this->boincDomains[$domain] = TRUE; |
|
| 4012 | + $this->boincDomains[$domain] = true; |
|
| 4013 | 4013 | } |
| 4014 | 4014 | } |
| 4015 | 4015 | if (!$this->boincDomains) { |
@@ -4031,7 +4031,7 @@ discard block |
||
| 4031 | 4031 | } |
| 4032 | 4032 | else { |
| 4033 | 4033 | // This URL should not be transformed |
| 4034 | - return NULL; |
|
| 4034 | + return null; |
|
| 4035 | 4035 | } |
| 4036 | 4036 | } |
| 4037 | 4037 | else { |
@@ -4047,7 +4047,7 @@ discard block |
||
| 4047 | 4047 | function transformPostLinks($matches) { |
| 4048 | 4048 | $link = $matches[0]; |
| 4049 | 4049 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4050 | - if ($newBaseUrl !== NULL) { |
|
| 4050 | + if ($newBaseUrl !== null) { |
|
| 4051 | 4051 | $id = db_result(db_query(' |
| 4052 | 4052 | SELECT p.cid |
| 4053 | 4053 | FROM {boincimport_temp_post} p |
@@ -4072,7 +4072,7 @@ discard block |
||
| 4072 | 4072 | function transformOldPostLinks($matches) { |
| 4073 | 4073 | $link = $matches[0]; |
| 4074 | 4074 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4075 | - if ($newBaseUrl !== NULL) { |
|
| 4075 | + if ($newBaseUrl !== null) { |
|
| 4076 | 4076 | $id = db_result(db_query(' |
| 4077 | 4077 | SELECT p.cid |
| 4078 | 4078 | FROM {boincimport_temp_post} p |
@@ -4093,7 +4093,7 @@ discard block |
||
| 4093 | 4093 | function transformTopicLinks($matches) { |
| 4094 | 4094 | $link = $matches[0]; |
| 4095 | 4095 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4096 | - if ($newBaseUrl !== NULL) { |
|
| 4096 | + if ($newBaseUrl !== null) { |
|
| 4097 | 4097 | $id = db_result(db_query(' |
| 4098 | 4098 | SELECT nid |
| 4099 | 4099 | FROM {boincimport_temp_topic} |
@@ -4108,7 +4108,7 @@ discard block |
||
| 4108 | 4108 | function transformForumLinks($matches) { |
| 4109 | 4109 | $link = $matches[0]; |
| 4110 | 4110 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4111 | - if ($newBaseUrl !== NULL) { |
|
| 4111 | + if ($newBaseUrl !== null) { |
|
| 4112 | 4112 | $forum = db_fetch_object(db_query(' |
| 4113 | 4113 | SELECT tid |
| 4114 | 4114 | FROM {boincimport_temp_forum} |
@@ -4123,7 +4123,7 @@ discard block |
||
| 4123 | 4123 | function transformUserLinks($matches) { |
| 4124 | 4124 | $link = $matches[0]; |
| 4125 | 4125 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4126 | - if ($newBaseUrl !== NULL) { |
|
| 4126 | + if ($newBaseUrl !== null) { |
|
| 4127 | 4127 | // Make sure this isn't an RPC link (no need to transform those) |
| 4128 | 4128 | if (!$matches[5]) { |
| 4129 | 4129 | // TODO: This regex doesn't seem to capture the format=xml part of the |
@@ -4139,7 +4139,7 @@ discard block |
||
| 4139 | 4139 | function transformWorkUnitLinks($matches) { |
| 4140 | 4140 | $link = $matches[0]; |
| 4141 | 4141 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4142 | - if ($newBaseUrl !== NULL) { |
|
| 4142 | + if ($newBaseUrl !== null) { |
|
| 4143 | 4143 | $id = $matches[3]; |
| 4144 | 4144 | $link = "{$newBaseUrl}workunit/{$id}"; |
| 4145 | 4145 | } |
@@ -4149,7 +4149,7 @@ discard block |
||
| 4149 | 4149 | function transformResultLinks($matches) { |
| 4150 | 4150 | $link = $matches[0]; |
| 4151 | 4151 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4152 | - if ($newBaseUrl !== NULL) { |
|
| 4152 | + if ($newBaseUrl !== null) { |
|
| 4153 | 4153 | $id = $matches[3]; |
| 4154 | 4154 | $link = "{$newBaseUrl}task/{$id}"; |
| 4155 | 4155 | } |
@@ -4159,7 +4159,7 @@ discard block |
||
| 4159 | 4159 | function transformHostResultsLinks($matches) { |
| 4160 | 4160 | $link = $matches[0]; |
| 4161 | 4161 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4162 | - if ($newBaseUrl !== NULL) { |
|
| 4162 | + if ($newBaseUrl !== null) { |
|
| 4163 | 4163 | $id = $matches[3]; |
| 4164 | 4164 | $link = "{$newBaseUrl}host/{$id}/tasks"; |
| 4165 | 4165 | } |
@@ -4169,7 +4169,7 @@ discard block |
||
| 4169 | 4169 | function transformUserResultsLinks($matches) { |
| 4170 | 4170 | $link = $matches[0]; |
| 4171 | 4171 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4172 | - if ($newBaseUrl !== NULL) { |
|
| 4172 | + if ($newBaseUrl !== null) { |
|
| 4173 | 4173 | $link = "{$newBaseUrl}account/tasks"; |
| 4174 | 4174 | } |
| 4175 | 4175 | return $link; |
@@ -4178,7 +4178,7 @@ discard block |
||
| 4178 | 4178 | function transformHostLinks($matches) { |
| 4179 | 4179 | $link = $matches[0]; |
| 4180 | 4180 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4181 | - if ($newBaseUrl !== NULL) { |
|
| 4181 | + if ($newBaseUrl !== null) { |
|
| 4182 | 4182 | $id = $matches[3]; |
| 4183 | 4183 | $link = "{$newBaseUrl}host/{$id}"; |
| 4184 | 4184 | } |
@@ -4188,7 +4188,7 @@ discard block |
||
| 4188 | 4188 | function transformUserHostsLinks($matches) { |
| 4189 | 4189 | $link = $matches[0]; |
| 4190 | 4190 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4191 | - if ($newBaseUrl !== NULL) { |
|
| 4191 | + if ($newBaseUrl !== null) { |
|
| 4192 | 4192 | $uid = boincuser_lookup_uid($matches[3]); |
| 4193 | 4193 | if ($uid) { |
| 4194 | 4194 | $link = "{$newBaseUrl}account/{$uid}/computers"; |
@@ -4200,7 +4200,7 @@ discard block |
||
| 4200 | 4200 | function transformForumIndexLinks($matches) { |
| 4201 | 4201 | $link = $matches[0]; |
| 4202 | 4202 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4203 | - if ($newBaseUrl !== NULL) { |
|
| 4203 | + if ($newBaseUrl !== null) { |
|
| 4204 | 4204 | $link = "{$newBaseUrl}community/forum"; |
| 4205 | 4205 | } |
| 4206 | 4206 | return $link; |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | $boinc_db_url = (is_array($db_url)) ? (isset($db_url['boinc_rw']) ? $db_url['boinc_rw'] : $db_url['default']) : $db_url; |
| 106 | 106 | variable_set('boincimport_db_url', $boinc_db_url); |
| 107 | 107 | variable_set('boincimport_ready', 0); |
| 108 | - return '<p>'. t('The BOINC database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.', |
|
| 109 | - array('@configlink' => url('admin/boinc/import/settings'))) .'</p>'; |
|
| 108 | + return '<p>'.t('The BOINC database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.', |
|
| 109 | + array('@configlink' => url('admin/boinc/import/settings'))).'</p>'; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -114,18 +114,18 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | function boincimport_unlock() { |
| 116 | 116 | variable_del('boincimport_process_locked'); |
| 117 | - return '<p>'. t('The BOINC data import process has been unlocked. You may |
|
| 117 | + return '<p>'.t('The BOINC data import process has been unlocked. You may |
|
| 118 | 118 | now !proceed_with_import.', array( |
| 119 | 119 | '!proceed_with_import' => l(t('proceed with the import'), |
| 120 | 120 | 'admin/boinc/import/process') |
| 121 | - )) .'</p>'; |
|
| 121 | + )).'</p>'; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * Callback admin/boinc/import/cleanup |
| 126 | 126 | */ |
| 127 | 127 | function boincimport_cleanup() { |
| 128 | - return boincimport_process_cleanup() .'<p>'. t('Drupal database cleaned.') .'</p>'; |
|
| 128 | + return boincimport_process_cleanup().'<p>'.t('Drupal database cleaned.').'</p>'; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * fails, the process will die() which is a bit too much since we only |
| 139 | 139 | * want to test. Therefore, the test part of the code is not used, now. |
| 140 | 140 | */ |
| 141 | -function _boincimport_db_connect($test= 0) { |
|
| 141 | +function _boincimport_db_connect($test = 0) { |
|
| 142 | 142 | global $db_url; |
| 143 | 143 | $db_ready = variable_get('boincimport_db_configured', 1); |
| 144 | 144 | if (!$db_ready) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $db_url2['default'] = $db_url; |
| 149 | 149 | } |
| 150 | 150 | $db_url2['boinc_rw'] = variable_get('boincimport_db_url', $db_url); |
| 151 | - $GLOBALS['db_url'] =& $db_url2; |
|
| 151 | + $GLOBALS['db_url'] = & $db_url2; |
|
| 152 | 152 | if ($test) { |
| 153 | 153 | if (!db_connect($db_url2['boinc_rw'])) { |
| 154 | 154 | return 0; |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | $result = module_exists($module); |
| 172 | 172 | $out['result'] = $result; |
| 173 | 173 | if ($result == 1) { |
| 174 | - $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>'; |
|
| 174 | + $out['html'] .= '<li>'.t('Module %module is enabled. OK!', array('%module' => $module)).'</li>'; |
|
| 175 | 175 | } |
| 176 | 176 | else { |
| 177 | - $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>'; |
|
| 177 | + $out['html'] .= '<li><span class="marker">'.t('Module %module is disabled.', array('%module' => $module)).'</span></li>'; |
|
| 178 | 178 | } |
| 179 | 179 | $out['html'] .= '</ul>'; |
| 180 | 180 | return $out; |
@@ -187,32 +187,32 @@ discard block |
||
| 187 | 187 | * $out['html'] = formatted html. |
| 188 | 188 | * $out['result'] = boolean. |
| 189 | 189 | */ |
| 190 | -function _boincimport_check_tables($tables = array(), $db = 'default' , $prefix = 1) { |
|
| 190 | +function _boincimport_check_tables($tables = array(), $db = 'default', $prefix = 1) { |
|
| 191 | 191 | _boincimport_db_connect(); |
| 192 | 192 | |
| 193 | 193 | $out['html'] = '<ul>'; |
| 194 | - $out['result']= 1; |
|
| 194 | + $out['result'] = 1; |
|
| 195 | 195 | foreach ($tables as $table) { |
| 196 | 196 | if ($prefix) { |
| 197 | - $table = db_prefix_tables('{'. $table .'}'); |
|
| 197 | + $table = db_prefix_tables('{'.$table.'}'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | db_set_active($db); |
| 201 | 201 | if ($GLOBALS['db_type'] == 'pgsql') { |
| 202 | 202 | // adapt from db_table_exists in database.pgsql.inc |
| 203 | - $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
|
| 203 | + $result = (bool)db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
|
| 204 | 204 | } |
| 205 | 205 | else { |
| 206 | 206 | // adapt from db_table_exists in database.mysql.inc |
| 207 | - $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
|
| 207 | + $result = (bool)db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
|
| 208 | 208 | } |
| 209 | 209 | db_set_active('default'); |
| 210 | 210 | if ($result) { |
| 211 | - $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
|
| 211 | + $out['html'] .= '<li>'.t('Table %table: OK!', array('%table' => $table)).'</li>'; |
|
| 212 | 212 | } |
| 213 | 213 | else { |
| 214 | - $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
|
| 215 | - $out['result']= 0; |
|
| 214 | + $out['html'] .= '<li><span class="marker">'.t('Table <strong>%table</strong> does not exist!', array('%table' => $table)).'</span></li>'; |
|
| 215 | + $out['result'] = 0; |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | $out['html'] .= '</ul>'; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | boinc_get_path(); |
| 227 | 227 | |
| 228 | 228 | if (!variable_get('boincimport_ready', 0)) { |
| 229 | - return '<p>'. t('You cannot import the data now. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/boinc/import/settings'))) .'</p>'; |
|
| 229 | + return '<p>'.t('You cannot import the data now. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/boinc/import/settings'))).'</p>'; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $output = 'BOINC import process form'; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | function boincimport_process_form() { |
| 238 | 238 | $form = array(); |
| 239 | - _boincimport_db_connect() ; |
|
| 239 | + _boincimport_db_connect(); |
|
| 240 | 240 | // Causes problems with form api redirect |
| 241 | 241 | //ini_set('display_errors', TRUE); |
| 242 | 242 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | else { |
| 413 | 413 | drupal_set_message('Congratulations. Import Finished'); |
| 414 | - drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
|
| 414 | + drupal_set_message('Please visit the '.l('Post migration configuration', 'admin/boinc/import/post_configuration').' page'); |
|
| 415 | 415 | watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
| 416 | 416 | unset($_SESSION['boincimport_stage_selected']); |
| 417 | 417 | } |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | $context['finished'] = 1; |
| 633 | 633 | } |
| 634 | 634 | else { |
| 635 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 635 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | // An error occurred. |
| 662 | 662 | // $operations contains the operations that remained unprocessed. |
| 663 | 663 | $error_operation = reset($operations); |
| 664 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 664 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 665 | 665 | } |
| 666 | 666 | drupal_set_message($message); |
| 667 | 667 | |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | $context['finished'] = 1; |
| 846 | 846 | } |
| 847 | 847 | else { |
| 848 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 848 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | // An error occurred. |
| 873 | 873 | // $operations contains the operations that remained unprocessed. |
| 874 | 874 | $error_operation = reset($operations); |
| 875 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 875 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 876 | 876 | } |
| 877 | 877 | drupal_set_message($message); |
| 878 | 878 | |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | $context['finished'] = 1; |
| 1019 | 1019 | } |
| 1020 | 1020 | else { |
| 1021 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 1021 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | } |
| 1024 | 1024 | |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | // An error occurred. |
| 1047 | 1047 | // $operations contains the operations that remained unprocessed. |
| 1048 | 1048 | $error_operation = reset($operations); |
| 1049 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1049 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 1050 | 1050 | } |
| 1051 | 1051 | drupal_set_message($message); |
| 1052 | 1052 | |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | $context['finished'] = 1; |
| 1203 | 1203 | } |
| 1204 | 1204 | else { |
| 1205 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 1205 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 1206 | 1206 | } |
| 1207 | 1207 | } |
| 1208 | 1208 | |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | // An error occurred. |
| 1232 | 1232 | // $operations contains the operations that remained unprocessed. |
| 1233 | 1233 | $error_operation = reset($operations); |
| 1234 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1234 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | drupal_set_message($message); |
| 1237 | 1237 | |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | $context['finished'] = 1; |
| 1382 | 1382 | } |
| 1383 | 1383 | else { |
| 1384 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 1384 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 1385 | 1385 | } |
| 1386 | 1386 | } |
| 1387 | 1387 | |
@@ -1408,7 +1408,7 @@ discard block |
||
| 1408 | 1408 | // An error occurred. |
| 1409 | 1409 | // $operations contains the operations that remained unprocessed. |
| 1410 | 1410 | $error_operation = reset($operations); |
| 1411 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1411 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 1412 | 1412 | } |
| 1413 | 1413 | drupal_set_message($message); |
| 1414 | 1414 | |
@@ -1709,7 +1709,7 @@ discard block |
||
| 1709 | 1709 | $context['finished'] = 1; |
| 1710 | 1710 | } |
| 1711 | 1711 | else { |
| 1712 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 1712 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 1713 | 1713 | } |
| 1714 | 1714 | } |
| 1715 | 1715 | |
@@ -1787,7 +1787,7 @@ discard block |
||
| 1787 | 1787 | $context['finished'] = 1; |
| 1788 | 1788 | } |
| 1789 | 1789 | else { |
| 1790 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 1790 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 1791 | 1791 | } |
| 1792 | 1792 | } |
| 1793 | 1793 | |
@@ -1800,34 +1800,34 @@ discard block |
||
| 1800 | 1800 | $forum_perms = array(); |
| 1801 | 1801 | $role_map = array_flip(user_roles()); |
| 1802 | 1802 | $forum_perms[$role_map['anonymous user']] = array( |
| 1803 | - 'view' => (int) !$hidden, |
|
| 1803 | + 'view' => (int)!$hidden, |
|
| 1804 | 1804 | 'update' => 0, |
| 1805 | 1805 | 'delete' => 0, |
| 1806 | 1806 | 'create' => 0, |
| 1807 | 1807 | ); |
| 1808 | 1808 | $forum_perms[$role_map['authenticated user']] = array( |
| 1809 | - 'view' => (int) !$hidden, |
|
| 1809 | + 'view' => (int)!$hidden, |
|
| 1810 | 1810 | 'update' => 0, |
| 1811 | 1811 | 'delete' => 0, |
| 1812 | 1812 | 'create' => 0, |
| 1813 | 1813 | ); |
| 1814 | 1814 | $forum_perms[$role_map['community member']] = array( |
| 1815 | - 'view' => (int) !$hidden, |
|
| 1815 | + 'view' => (int)!$hidden, |
|
| 1816 | 1816 | 'update' => 0, |
| 1817 | 1817 | 'delete' => 0, |
| 1818 | - 'create' => (int) $open, |
|
| 1818 | + 'create' => (int)$open, |
|
| 1819 | 1819 | ); |
| 1820 | 1820 | $forum_perms[$role_map['verified contributor']] = array( |
| 1821 | - 'view' => (int) !$hidden, |
|
| 1821 | + 'view' => (int)!$hidden, |
|
| 1822 | 1822 | 'update' => 0, |
| 1823 | 1823 | 'delete' => 0, |
| 1824 | - 'create' => (int) !$hidden, |
|
| 1824 | + 'create' => (int)!$hidden, |
|
| 1825 | 1825 | ); |
| 1826 | 1826 | $forum_perms[$role_map['moderator']] = array( |
| 1827 | - 'view' => (int) !$hidden, |
|
| 1828 | - 'update' => (int) !$hidden, |
|
| 1827 | + 'view' => (int)!$hidden, |
|
| 1828 | + 'update' => (int)!$hidden, |
|
| 1829 | 1829 | 'delete' => 0, |
| 1830 | - 'create' => (int) !$hidden, |
|
| 1830 | + 'create' => (int)!$hidden, |
|
| 1831 | 1831 | ); |
| 1832 | 1832 | $forum_perms[$role_map['administrator']] = array( |
| 1833 | 1833 | 'view' => 1, |
@@ -1892,7 +1892,7 @@ discard block |
||
| 1892 | 1892 | // An error occurred. |
| 1893 | 1893 | // $operations contains the operations that remained unprocessed. |
| 1894 | 1894 | $error_operation = reset($operations); |
| 1895 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 1895 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 1896 | 1896 | } |
| 1897 | 1897 | drupal_set_message($message); |
| 1898 | 1898 | |
@@ -1962,7 +1962,7 @@ discard block |
||
| 1962 | 1962 | $batch_size = 100; |
| 1963 | 1963 | |
| 1964 | 1964 | // Create batches to process |
| 1965 | - for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) { |
|
| 1965 | + for ($offset = 0; $offset < $topic_count; $offset += $batch_size) { |
|
| 1966 | 1966 | $topics_per_batch = $batch_size; |
| 1967 | 1967 | if ($offset + $batch_size > $topic_count) { |
| 1968 | 1968 | $topics_per_batch = $topic_count - $offset; |
@@ -2079,7 +2079,7 @@ discard block |
||
| 2079 | 2079 | 'type' => $node_type, |
| 2080 | 2080 | 'title' => $topic->title, |
| 2081 | 2081 | 'uid' => $uid, |
| 2082 | - 'status' => ($topic->hidden) ? 0 : 1, // published or not |
|
| 2082 | + 'status' => ($topic->hidden) ? 0 : 1, // published or not |
|
| 2083 | 2083 | 'promote' => $promote, |
| 2084 | 2084 | 'created' => $topic->create_time, |
| 2085 | 2085 | 'changed' => $topic->timestamp, |
@@ -2093,7 +2093,7 @@ discard block |
||
| 2093 | 2093 | $node['tid'] = $tid; |
| 2094 | 2094 | |
| 2095 | 2095 | // Save the topic node |
| 2096 | - $node = (object) $node; // node_save requires an object form |
|
| 2096 | + $node = (object)$node; // node_save requires an object form |
|
| 2097 | 2097 | node_save($node); |
| 2098 | 2098 | taxonomy_node_save($node, array($tid)); |
| 2099 | 2099 | $success = ($node->nid) ? TRUE : FALSE; |
@@ -2156,7 +2156,7 @@ discard block |
||
| 2156 | 2156 | $context['finished'] = 1; |
| 2157 | 2157 | } |
| 2158 | 2158 | else { |
| 2159 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2159 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 2160 | 2160 | } |
| 2161 | 2161 | } |
| 2162 | 2162 | } |
@@ -2194,7 +2194,7 @@ discard block |
||
| 2194 | 2194 | // An error occurred. |
| 2195 | 2195 | // $operations contains the operations that remained unprocessed. |
| 2196 | 2196 | $error_operation = reset($operations); |
| 2197 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2197 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 2198 | 2198 | } |
| 2199 | 2199 | drupal_set_message($message); |
| 2200 | 2200 | |
@@ -2270,7 +2270,7 @@ discard block |
||
| 2270 | 2270 | $batch_size = 100; |
| 2271 | 2271 | |
| 2272 | 2272 | // Create batches to process |
| 2273 | - for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) { |
|
| 2273 | + for ($offset = 0; $offset < $topic_count; $offset += $batch_size) { |
|
| 2274 | 2274 | $topics_per_batch = $batch_size; |
| 2275 | 2275 | if ($offset + $batch_size > $topic_count) { |
| 2276 | 2276 | $topics_per_batch = $topic_count - $offset; |
@@ -2484,7 +2484,7 @@ discard block |
||
| 2484 | 2484 | $context['finished'] = 1; |
| 2485 | 2485 | } |
| 2486 | 2486 | else { |
| 2487 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2487 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 2488 | 2488 | } |
| 2489 | 2489 | } |
| 2490 | 2490 | } |
@@ -2502,10 +2502,10 @@ discard block |
||
| 2502 | 2502 | $empty_posts = count($results['posts']['empty']); |
| 2503 | 2503 | $failed_posts = count($results['posts']['failure']); |
| 2504 | 2504 | $message = t( |
| 2505 | - 'Successfully imported @post_count posts in @topic_count topics ' . |
|
| 2506 | - '(@skipped topics either had no replies or all replies were already imported, ' . |
|
| 2507 | - '@duplicates posts were skipped as already imported, ' . |
|
| 2508 | - '@empty_posts had no content, ' . |
|
| 2505 | + 'Successfully imported @post_count posts in @topic_count topics '. |
|
| 2506 | + '(@skipped topics either had no replies or all replies were already imported, '. |
|
| 2507 | + '@duplicates posts were skipped as already imported, '. |
|
| 2508 | + '@empty_posts had no content, '. |
|
| 2509 | 2509 | 'and @error_posts encountered errors during import)', |
| 2510 | 2510 | array( |
| 2511 | 2511 | '@post_count' => $posts_imported, |
@@ -2528,7 +2528,7 @@ discard block |
||
| 2528 | 2528 | // An error occurred. |
| 2529 | 2529 | // $operations contains the operations that remained unprocessed. |
| 2530 | 2530 | $error_operation = reset($operations); |
| 2531 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2531 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 2532 | 2532 | } |
| 2533 | 2533 | drupal_set_message($message); |
| 2534 | 2534 | |
@@ -2698,7 +2698,7 @@ discard block |
||
| 2698 | 2698 | $context['finished'] = 1; |
| 2699 | 2699 | } |
| 2700 | 2700 | else { |
| 2701 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2701 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 2702 | 2702 | } |
| 2703 | 2703 | } |
| 2704 | 2704 | |
@@ -2725,7 +2725,7 @@ discard block |
||
| 2725 | 2725 | // An error occurred. |
| 2726 | 2726 | // $operations contains the operations that remained unprocessed. |
| 2727 | 2727 | $error_operation = reset($operations); |
| 2728 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2728 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 2729 | 2729 | } |
| 2730 | 2730 | drupal_set_message($message); |
| 2731 | 2731 | |
@@ -2907,7 +2907,7 @@ discard block |
||
| 2907 | 2907 | 'type' => $node_type, |
| 2908 | 2908 | 'title' => $topic->title, |
| 2909 | 2909 | 'uid' => $uid, |
| 2910 | - 'status' => ($topic->hidden) ? 0 : 1, // published or not |
|
| 2910 | + 'status' => ($topic->hidden) ? 0 : 1, // published or not |
|
| 2911 | 2911 | 'promote' => $promote, |
| 2912 | 2912 | 'created' => $topic->create_time, |
| 2913 | 2913 | 'changed' => $topic->timestamp, |
@@ -2921,7 +2921,7 @@ discard block |
||
| 2921 | 2921 | ); |
| 2922 | 2922 | |
| 2923 | 2923 | // Save the team topic node |
| 2924 | - $node = (object) $node; // node_save requires an object form |
|
| 2924 | + $node = (object)$node; // node_save requires an object form |
|
| 2925 | 2925 | node_save($node); |
| 2926 | 2926 | |
| 2927 | 2927 | if ($node->nid) { |
@@ -2967,7 +2967,7 @@ discard block |
||
| 2967 | 2967 | $context['finished'] = 1; |
| 2968 | 2968 | } |
| 2969 | 2969 | else { |
| 2970 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2970 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 2971 | 2971 | } |
| 2972 | 2972 | } |
| 2973 | 2973 | |
@@ -2994,7 +2994,7 @@ discard block |
||
| 2994 | 2994 | // An error occurred. |
| 2995 | 2995 | // $operations contains the operations that remained unprocessed. |
| 2996 | 2996 | $error_operation = reset($operations); |
| 2997 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 2997 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 2998 | 2998 | } |
| 2999 | 2999 | drupal_set_message($message); |
| 3000 | 3000 | |
@@ -3249,7 +3249,7 @@ discard block |
||
| 3249 | 3249 | $context['finished'] = 1; |
| 3250 | 3250 | } |
| 3251 | 3251 | else { |
| 3252 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3252 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 3253 | 3253 | } |
| 3254 | 3254 | } |
| 3255 | 3255 | |
@@ -3276,7 +3276,7 @@ discard block |
||
| 3276 | 3276 | // An error occurred. |
| 3277 | 3277 | // $operations contains the operations that remained unprocessed. |
| 3278 | 3278 | $error_operation = reset($operations); |
| 3279 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 3279 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 3280 | 3280 | } |
| 3281 | 3281 | drupal_set_message($message); |
| 3282 | 3282 | |
@@ -3398,7 +3398,7 @@ discard block |
||
| 3398 | 3398 | $context['finished'] = 1; |
| 3399 | 3399 | } |
| 3400 | 3400 | else { |
| 3401 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3401 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 3402 | 3402 | } |
| 3403 | 3403 | } |
| 3404 | 3404 | |
@@ -3427,7 +3427,7 @@ discard block |
||
| 3427 | 3427 | // An error occurred. |
| 3428 | 3428 | // $operations contains the operations that remained unprocessed. |
| 3429 | 3429 | $error_operation = reset($operations); |
| 3430 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 3430 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 3431 | 3431 | } |
| 3432 | 3432 | drupal_set_message($message); |
| 3433 | 3433 | |
@@ -3503,7 +3503,7 @@ discard block |
||
| 3503 | 3503 | $batch_size = 100; |
| 3504 | 3504 | |
| 3505 | 3505 | // Create node batches to process |
| 3506 | - for ($offset = 0; $offset < $node_count; $offset+=$batch_size) { |
|
| 3506 | + for ($offset = 0; $offset < $node_count; $offset += $batch_size) { |
|
| 3507 | 3507 | $nodes_per_batch = $batch_size; |
| 3508 | 3508 | if ($offset + $batch_size > $node_count) { |
| 3509 | 3509 | $nodes_per_batch = $node_count - $offset; |
@@ -3515,7 +3515,7 @@ discard block |
||
| 3515 | 3515 | ); |
| 3516 | 3516 | } |
| 3517 | 3517 | // Add comment batches |
| 3518 | - for ($offset = 0; $offset < $comment_count; $offset+=$batch_size) { |
|
| 3518 | + for ($offset = 0; $offset < $comment_count; $offset += $batch_size) { |
|
| 3519 | 3519 | $comments_per_batch = $batch_size; |
| 3520 | 3520 | if ($offset + $batch_size > $comment_count) { |
| 3521 | 3521 | $comments_per_batch = $comment_count - $offset; |
@@ -3527,7 +3527,7 @@ discard block |
||
| 3527 | 3527 | ); |
| 3528 | 3528 | } |
| 3529 | 3529 | // And don't forget to process private messages |
| 3530 | - for ($offset = 0; $offset < $pm_count; $offset+=$batch_size) { |
|
| 3530 | + for ($offset = 0; $offset < $pm_count; $offset += $batch_size) { |
|
| 3531 | 3531 | $messages_per_batch = $batch_size; |
| 3532 | 3532 | if ($offset + $batch_size > $pm_count) { |
| 3533 | 3533 | $messages_per_batch = $pm_count - $offset; |
@@ -3616,7 +3616,7 @@ discard block |
||
| 3616 | 3616 | $context['finished'] = 1; |
| 3617 | 3617 | } |
| 3618 | 3618 | else { |
| 3619 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3619 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 3620 | 3620 | } |
| 3621 | 3621 | } |
| 3622 | 3622 | } |
@@ -3680,7 +3680,7 @@ discard block |
||
| 3680 | 3680 | $context['finished'] = 1; |
| 3681 | 3681 | } |
| 3682 | 3682 | else { |
| 3683 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3683 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 3684 | 3684 | } |
| 3685 | 3685 | } |
| 3686 | 3686 | } |
@@ -3743,7 +3743,7 @@ discard block |
||
| 3743 | 3743 | $context['finished'] = 1; |
| 3744 | 3744 | } |
| 3745 | 3745 | else { |
| 3746 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3746 | + $context['finished'] = $context['sandbox']['progress']/$context['sandbox']['max']; |
|
| 3747 | 3747 | } |
| 3748 | 3748 | } |
| 3749 | 3749 | } |
@@ -3812,7 +3812,7 @@ discard block |
||
| 3812 | 3812 | // An error occurred. |
| 3813 | 3813 | // $operations contains the operations that remained unprocessed. |
| 3814 | 3814 | $error_operation = reset($operations); |
| 3815 | - $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
|
| 3815 | + $message = 'An error occurred while processing '.$error_operation[0].' with arguments :'.print_r($error_operation[0], TRUE); |
|
| 3816 | 3816 | } |
| 3817 | 3817 | drupal_set_message($message); |
| 3818 | 3818 | |
@@ -3881,18 +3881,18 @@ discard block |
||
| 3881 | 3881 | $max = db_result(db_query('SELECT MAX(thread) FROM {comments} WHERE nid = %d', $edit['nid'])); |
| 3882 | 3882 | // Strip the "/" from the end of the thread. |
| 3883 | 3883 | $max = rtrim($max, '/'); |
| 3884 | - $thread = int2vancode(vancode2int($max)+1) .'/'; |
|
| 3884 | + $thread = int2vancode(vancode2int($max) + 1).'/'; |
|
| 3885 | 3885 | } else { |
| 3886 | 3886 | // This is comment with a parent comment: we increase the part of the thread |
| 3887 | 3887 | // value at the proper depth. |
| 3888 | 3888 | $parent = db_fetch_object(db_query('SELECT * FROM {comments} WHERE cid = %d', $edit['pid'])); |
| 3889 | 3889 | // Strip the "/" from the end of the parent thread. |
| 3890 | - $parent->thread = (string) rtrim((string) $parent->thread, '/'); |
|
| 3890 | + $parent->thread = (string)rtrim((string)$parent->thread, '/'); |
|
| 3891 | 3891 | // Get the max value in _this_ thread. |
| 3892 | 3892 | $max = db_result(db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE '%s.%%' AND nid = %d", $parent->thread, $edit['nid'])); |
| 3893 | 3893 | if ($max == '') { |
| 3894 | 3894 | // First child of this parent. |
| 3895 | - $thread = $parent->thread .'.'. int2vancode(1) .'/'; |
|
| 3895 | + $thread = $parent->thread.'.'.int2vancode(1).'/'; |
|
| 3896 | 3896 | } else { |
| 3897 | 3897 | // Strip the "/" at the end of the thread. |
| 3898 | 3898 | $max = rtrim($max, '/'); |
@@ -3901,14 +3901,14 @@ discard block |
||
| 3901 | 3901 | $parent_depth = count(explode('.', $parent->thread)); |
| 3902 | 3902 | $last = $parts[$parent_depth]; |
| 3903 | 3903 | // Finally, build the thread field for this new comment. |
| 3904 | - $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/'; |
|
| 3904 | + $thread = $parent->thread.'.'.int2vancode(vancode2int($last) + 1).'/'; |
|
| 3905 | 3905 | } |
| 3906 | 3906 | } |
| 3907 | 3907 | |
| 3908 | 3908 | $status = 0; // 1 - not published, 0 - published |
| 3909 | 3909 | $format = variable_get('boincimport_input_format', 0); |
| 3910 | 3910 | $score = 0; // 0 default value, comments get higher score depending on the author's roles |
| 3911 | - $users = serialize(array(0 => 1)); // default value for everybody!! |
|
| 3911 | + $users = serialize(array(0 => 1)); // default value for everybody!! |
|
| 3912 | 3912 | |
| 3913 | 3913 | if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too |
| 3914 | 3914 | $edit['name'] = $user->name; |
@@ -3942,7 +3942,7 @@ discard block |
||
| 3942 | 3942 | // BBcode to normal html |
| 3943 | 3943 | if (variable_get('boincimport_bbcode', 0)) { |
| 3944 | 3944 | $input_format = variable_get('boincimport_input_format', 0); |
| 3945 | - $text = bbcode_filter('process', 0 , $input_format, $text); |
|
| 3945 | + $text = bbcode_filter('process', 0, $input_format, $text); |
|
| 3946 | 3946 | } |
| 3947 | 3947 | return $text; |
| 3948 | 3948 | } |
@@ -172,8 +172,7 @@ discard block |
||
| 172 | 172 | $out['result'] = $result; |
| 173 | 173 | if ($result == 1) { |
| 174 | 174 | $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>'; |
| 175 | - } |
|
| 176 | - else { |
|
| 175 | + } else { |
|
| 177 | 176 | $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>'; |
| 178 | 177 | } |
| 179 | 178 | $out['html'] .= '</ul>'; |
@@ -201,16 +200,14 @@ discard block |
||
| 201 | 200 | if ($GLOBALS['db_type'] == 'pgsql') { |
| 202 | 201 | // adapt from db_table_exists in database.pgsql.inc |
| 203 | 202 | $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
| 204 | - } |
|
| 205 | - else { |
|
| 203 | + } else { |
|
| 206 | 204 | // adapt from db_table_exists in database.mysql.inc |
| 207 | 205 | $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
| 208 | 206 | } |
| 209 | 207 | db_set_active('default'); |
| 210 | 208 | if ($result) { |
| 211 | 209 | $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
| 212 | - } |
|
| 213 | - else { |
|
| 210 | + } else { |
|
| 214 | 211 | $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
| 215 | 212 | $out['result']= 0; |
| 216 | 213 | } |
@@ -252,8 +249,7 @@ discard block |
||
| 252 | 249 | array('!unlock_it' => l(t('release the lock'), |
| 253 | 250 | 'admin/boinc/import/unlock') |
| 254 | 251 | ), WATCHDOG_WARNING); |
| 255 | - } |
|
| 256 | - else { |
|
| 252 | + } else { |
|
| 257 | 253 | $boincimport_functions = array( |
| 258 | 254 | 'users' => t('Import users'), |
| 259 | 255 | 'teams' => t('Import teams'), |
@@ -288,8 +284,7 @@ discard block |
||
| 288 | 284 | // Lock the import process |
| 289 | 285 | if (!variable_get('boincimport_process_locked', 0)) { |
| 290 | 286 | variable_set('boincimport_process_locked', 1); |
| 291 | - } |
|
| 292 | - else { |
|
| 287 | + } else { |
|
| 293 | 288 | watchdog('boincimport', 'The import process is locked, but another process |
| 294 | 289 | is trying to access it...', array(), WATCHDOG_WARNING); |
| 295 | 290 | } |
@@ -303,8 +298,7 @@ discard block |
||
| 303 | 298 | boincimport_teams(); |
| 304 | 299 | if (!variable_get('boincimport_import_team_successful', 0)) { |
| 305 | 300 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 306 | - } |
|
| 307 | - else { |
|
| 301 | + } else { |
|
| 308 | 302 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 309 | 303 | } |
| 310 | 304 | break; |
@@ -313,8 +307,7 @@ discard block |
||
| 313 | 307 | boincimport_friends(); |
| 314 | 308 | if (!variable_get('boincimport_import_friend_successful', 0)) { |
| 315 | 309 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 316 | - } |
|
| 317 | - else { |
|
| 310 | + } else { |
|
| 318 | 311 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 319 | 312 | } |
| 320 | 313 | break; |
@@ -323,8 +316,7 @@ discard block |
||
| 323 | 316 | boincimport_preferences(); |
| 324 | 317 | if (!variable_get('boincimport_import_preferences_successful', 0)) { |
| 325 | 318 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 326 | - } |
|
| 327 | - else { |
|
| 319 | + } else { |
|
| 328 | 320 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 329 | 321 | } |
| 330 | 322 | break; |
@@ -333,8 +325,7 @@ discard block |
||
| 333 | 325 | boincimport_private_msgs(); |
| 334 | 326 | if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
| 335 | 327 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 336 | - } |
|
| 337 | - else { |
|
| 328 | + } else { |
|
| 338 | 329 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 339 | 330 | } |
| 340 | 331 | break; |
@@ -343,8 +334,7 @@ discard block |
||
| 343 | 334 | boincimport_forum_categories(); |
| 344 | 335 | if (!variable_get('boincimport_import_category_successful', 0)) { |
| 345 | 336 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 346 | - } |
|
| 347 | - else { |
|
| 337 | + } else { |
|
| 348 | 338 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 349 | 339 | } |
| 350 | 340 | break; |
@@ -353,8 +343,7 @@ discard block |
||
| 353 | 343 | boincimport_forum_topics(); |
| 354 | 344 | if (!variable_get('boincimport_import_topic_successful', 0)) { |
| 355 | 345 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 356 | - } |
|
| 357 | - else { |
|
| 346 | + } else { |
|
| 358 | 347 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 359 | 348 | } |
| 360 | 349 | break; |
@@ -363,8 +352,7 @@ discard block |
||
| 363 | 352 | boincimport_forum_posts(); |
| 364 | 353 | if (!variable_get('boincimport_import_post_successful', 0)) { |
| 365 | 354 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 366 | - } |
|
| 367 | - else { |
|
| 355 | + } else { |
|
| 368 | 356 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 369 | 357 | } |
| 370 | 358 | break; |
@@ -373,8 +361,7 @@ discard block |
||
| 373 | 361 | boincimport_team_forums(); |
| 374 | 362 | if (!variable_get('boincimport_team_forum_successful', 0)) { |
| 375 | 363 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 376 | - } |
|
| 377 | - else { |
|
| 364 | + } else { |
|
| 378 | 365 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 379 | 366 | } |
| 380 | 367 | break; |
@@ -383,8 +370,7 @@ discard block |
||
| 383 | 370 | boincimport_team_forum_topics(); |
| 384 | 371 | if (!variable_get('boincimport_team_topic_successful', 0)) { |
| 385 | 372 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 386 | - } |
|
| 387 | - else { |
|
| 373 | + } else { |
|
| 388 | 374 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 389 | 375 | } |
| 390 | 376 | break; |
@@ -393,8 +379,7 @@ discard block |
||
| 393 | 379 | boincimport_team_forum_posts(); |
| 394 | 380 | if (!variable_get('boincimport_team_post_successful', 0)) { |
| 395 | 381 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 396 | - } |
|
| 397 | - else { |
|
| 382 | + } else { |
|
| 398 | 383 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 399 | 384 | } |
| 400 | 385 | break; |
@@ -403,8 +388,7 @@ discard block |
||
| 403 | 388 | boincimport_replace_urls(); |
| 404 | 389 | if (!variable_get('boincimport_replace_url_successful', 0)) { |
| 405 | 390 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 406 | - } |
|
| 407 | - else { |
|
| 391 | + } else { |
|
| 408 | 392 | drupal_set_message('Congratulations. Import Finished'); |
| 409 | 393 | drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
| 410 | 394 | watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
@@ -473,8 +457,7 @@ discard block |
||
| 473 | 457 | ORDER BY id ASC' |
| 474 | 458 | ); |
| 475 | 459 | $user_count = mysqli_num_rows($boinc_accounts); |
| 476 | - } |
|
| 477 | - else { |
|
| 460 | + } else { |
|
| 478 | 461 | // Need to import any user who is currently ignored in order to keep them |
| 479 | 462 | // ignored... not particularly clean (ignored users are stored in a string) |
| 480 | 463 | $ignored_user_list = array(0); |
@@ -550,8 +533,7 @@ discard block |
||
| 550 | 533 | if (isset($existing_users[$boinc_account->id])) { |
| 551 | 534 | // This user has already been imported |
| 552 | 535 | $duplicates[] = $boinc_account->id; |
| 553 | - } |
|
| 554 | - else { |
|
| 536 | + } else { |
|
| 555 | 537 | $operations[] = array( |
| 556 | 538 | 'boincimport_users_op', array( |
| 557 | 539 | $boinc_account->id |
@@ -607,8 +589,7 @@ discard block |
||
| 607 | 589 | // Store some result for post-processing in the finished callback. |
| 608 | 590 | $context['results']['success'][] = $boinc_id; |
| 609 | 591 | $message = "Successfully imported user {$boinc_id}"; |
| 610 | - } |
|
| 611 | - else { |
|
| 592 | + } else { |
|
| 612 | 593 | $context['results']['failure'][] = $boinc_id; |
| 613 | 594 | $message = "Failed to import user {$boinc_id}!"; |
| 614 | 595 | watchdog('boincimport', |
@@ -625,8 +606,7 @@ discard block |
||
| 625 | 606 | // Update the progress for the batch engine |
| 626 | 607 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 627 | 608 | $context['finished'] = 1; |
| 628 | - } |
|
| 629 | - else { |
|
| 609 | + } else { |
|
| 630 | 610 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 631 | 611 | } |
| 632 | 612 | } |
@@ -651,8 +631,7 @@ discard block |
||
| 651 | 631 | // Set the user import successful flag in the variable table |
| 652 | 632 | variable_set('boincimport_import_user_successful', '1'); |
| 653 | 633 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 654 | - } |
|
| 655 | - else { |
|
| 634 | + } else { |
|
| 656 | 635 | // An error occurred. |
| 657 | 636 | // $operations contains the operations that remained unprocessed. |
| 658 | 637 | $error_operation = reset($operations); |
@@ -714,8 +693,7 @@ discard block |
||
| 714 | 693 | $team_type = array( |
| 715 | 694 | 'tid' => $team_type_id |
| 716 | 695 | ); |
| 717 | - } |
|
| 718 | - else { |
|
| 696 | + } else { |
|
| 719 | 697 | if (!$name) continue; |
| 720 | 698 | $team_type = array( |
| 721 | 699 | 'name' => strip_tags($name), |
@@ -778,8 +756,7 @@ discard block |
||
| 778 | 756 | if (isset($existing_teams[$boinc_team->id])) { |
| 779 | 757 | // This team has already been imported |
| 780 | 758 | $duplicates[] = $boinc_team->id; |
| 781 | - } |
|
| 782 | - else { |
|
| 759 | + } else { |
|
| 783 | 760 | $operations[] = array( |
| 784 | 761 | 'boincimport_teams_op', array( |
| 785 | 762 | $boinc_team |
@@ -820,8 +797,7 @@ discard block |
||
| 820 | 797 | // Store some result for post-processing in the finished callback. |
| 821 | 798 | $context['results']['success'][] = $boincteam->id; |
| 822 | 799 | $message = "Successfully imported team {$boincteam->id}"; |
| 823 | - } |
|
| 824 | - else { |
|
| 800 | + } else { |
|
| 825 | 801 | $context['results']['failure'][] = $boincteam->id; |
| 826 | 802 | $message = "Failed to import team {$boincteam->id}!"; |
| 827 | 803 | watchdog('boincimport', |
@@ -838,8 +814,7 @@ discard block |
||
| 838 | 814 | // Update the progress for the batch engine |
| 839 | 815 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 840 | 816 | $context['finished'] = 1; |
| 841 | - } |
|
| 842 | - else { |
|
| 817 | + } else { |
|
| 843 | 818 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 844 | 819 | } |
| 845 | 820 | } |
@@ -862,8 +837,7 @@ discard block |
||
| 862 | 837 | // Set the team import successful flag in the variable table |
| 863 | 838 | variable_set('boincimport_import_team_successful', '1'); |
| 864 | 839 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 865 | - } |
|
| 866 | - else { |
|
| 840 | + } else { |
|
| 867 | 841 | // An error occurred. |
| 868 | 842 | // $operations contains the operations that remained unprocessed. |
| 869 | 843 | $error_operation = reset($operations); |
@@ -984,8 +958,7 @@ discard block |
||
| 984 | 958 | SET uid = '%d', friend_uid = '%d', created = '%d'", |
| 985 | 959 | $uid, $friend_uid, $friendship->create_time |
| 986 | 960 | ); |
| 987 | - } |
|
| 988 | - else { |
|
| 961 | + } else { |
|
| 989 | 962 | $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src; |
| 990 | 963 | $message = "No Drupal account exists for BOINC user {$boinc_id}!"; |
| 991 | 964 | } |
@@ -994,8 +967,7 @@ discard block |
||
| 994 | 967 | // Store some result for post-processing in the finished callback. |
| 995 | 968 | $context['results']['success'][] = $uid; |
| 996 | 969 | $message = "Successfully made users {$uid} and {$friend_uid} friends"; |
| 997 | - } |
|
| 998 | - else { |
|
| 970 | + } else { |
|
| 999 | 971 | $context['results']['failure'][] = $uid; |
| 1000 | 972 | if (!$message) { |
| 1001 | 973 | $message = "Failed to make users {$uid} and {$friend_uid} friends!"; |
@@ -1011,8 +983,7 @@ discard block |
||
| 1011 | 983 | // Update the progress for the batch engine |
| 1012 | 984 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1013 | 985 | $context['finished'] = 1; |
| 1014 | - } |
|
| 1015 | - else { |
|
| 986 | + } else { |
|
| 1016 | 987 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1017 | 988 | } |
| 1018 | 989 | } |
@@ -1036,8 +1007,7 @@ discard block |
||
| 1036 | 1007 | // Set the friend import successful flag in the variable table |
| 1037 | 1008 | variable_set('boincimport_import_friend_successful', '1'); |
| 1038 | 1009 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 1039 | - } |
|
| 1040 | - else { |
|
| 1010 | + } else { |
|
| 1041 | 1011 | // An error occurred. |
| 1042 | 1012 | // $operations contains the operations that remained unprocessed. |
| 1043 | 1013 | $error_operation = reset($operations); |
@@ -1161,8 +1131,7 @@ discard block |
||
| 1161 | 1131 | ); |
| 1162 | 1132 | if ($user_ignored) { |
| 1163 | 1133 | $success = TRUE; |
| 1164 | - } |
|
| 1165 | - else { |
|
| 1134 | + } else { |
|
| 1166 | 1135 | $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
| 1167 | 1136 | watchdog('boincimport', |
| 1168 | 1137 | 'Could not add user @ignored_uid to the ignore list of user @uid', |
@@ -1177,8 +1146,7 @@ discard block |
||
| 1177 | 1146 | // Store some result for post-processing in the finished callback. |
| 1178 | 1147 | $context['results']['success'][] = $uid; |
| 1179 | 1148 | $message = "Successfully imported ignored users for user {$uid}"; |
| 1180 | - } |
|
| 1181 | - else { |
|
| 1149 | + } else { |
|
| 1182 | 1150 | $context['results']['failure'][] = $uid; |
| 1183 | 1151 | $message = "Failed to import any user filter preferences for user {$uid}!"; |
| 1184 | 1152 | watchdog('boincimport', |
@@ -1195,8 +1163,7 @@ discard block |
||
| 1195 | 1163 | // Update the progress for the batch engine |
| 1196 | 1164 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1197 | 1165 | $context['finished'] = 1; |
| 1198 | - } |
|
| 1199 | - else { |
|
| 1166 | + } else { |
|
| 1200 | 1167 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1201 | 1168 | } |
| 1202 | 1169 | } |
@@ -1221,8 +1188,7 @@ discard block |
||
| 1221 | 1188 | // Set the preference import successful flag in the variable table |
| 1222 | 1189 | variable_set('boincimport_import_preferences_successful', '1'); |
| 1223 | 1190 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 1224 | - } |
|
| 1225 | - else { |
|
| 1191 | + } else { |
|
| 1226 | 1192 | // An error occurred. |
| 1227 | 1193 | // $operations contains the operations that remained unprocessed. |
| 1228 | 1194 | $error_operation = reset($operations); |
@@ -1356,8 +1322,7 @@ discard block |
||
| 1356 | 1322 | // Store some result for post-processing in the finished callback. |
| 1357 | 1323 | $context['results']['success'][] = $pm->id; |
| 1358 | 1324 | $message = "Successfully imported private message {$pm->id}"; |
| 1359 | - } |
|
| 1360 | - else { |
|
| 1325 | + } else { |
|
| 1361 | 1326 | $context['results']['failure'][] = $pm->id; |
| 1362 | 1327 | $message = "Failed to import private message {$pm->id}!"; |
| 1363 | 1328 | watchdog('boincimport', |
@@ -1374,8 +1339,7 @@ discard block |
||
| 1374 | 1339 | // Update the progress for the batch engine |
| 1375 | 1340 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1376 | 1341 | $context['finished'] = 1; |
| 1377 | - } |
|
| 1378 | - else { |
|
| 1342 | + } else { |
|
| 1379 | 1343 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1380 | 1344 | } |
| 1381 | 1345 | } |
@@ -1398,8 +1362,7 @@ discard block |
||
| 1398 | 1362 | // Set the private message import successful flag in the variable table |
| 1399 | 1363 | variable_set('boincimport_import_private_msg_successful', '1'); |
| 1400 | 1364 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 1401 | - } |
|
| 1402 | - else { |
|
| 1365 | + } else { |
|
| 1403 | 1366 | // An error occurred. |
| 1404 | 1367 | // $operations contains the operations that remained unprocessed. |
| 1405 | 1368 | $error_operation = reset($operations); |
@@ -1552,8 +1515,7 @@ discard block |
||
| 1552 | 1515 | if (in_array($boinc_forum_category->name, $existing_categories)) { |
| 1553 | 1516 | // This category has already been imported |
| 1554 | 1517 | $duplicate_categories[] = $boinc_forum_category->name; |
| 1555 | - } |
|
| 1556 | - else { |
|
| 1518 | + } else { |
|
| 1557 | 1519 | $operations[] = array( |
| 1558 | 1520 | 'boincimport_forum_categories_op', array( |
| 1559 | 1521 | $boinc_forum_category, $forum_vid, $pre, FALSE |
@@ -1567,8 +1529,7 @@ discard block |
||
| 1567 | 1529 | if (isset($existing_forums[$boinc_forum->id])) { |
| 1568 | 1530 | // This forum has already been imported |
| 1569 | 1531 | $duplicates[] = $boinc_forum->id; |
| 1570 | - } |
|
| 1571 | - else { |
|
| 1532 | + } else { |
|
| 1572 | 1533 | $operations[] = array( |
| 1573 | 1534 | 'boincimport_forums_op', array( |
| 1574 | 1535 | $boinc_forum, $forum_vid, $pre |
@@ -1635,8 +1596,7 @@ discard block |
||
| 1635 | 1596 | $category->name = 'Hidden'; |
| 1636 | 1597 | $category->id = 0; |
| 1637 | 1598 | $hidden = TRUE; |
| 1638 | - } |
|
| 1639 | - else { |
|
| 1599 | + } else { |
|
| 1640 | 1600 | // If this container is empty, put it into the hidden container |
| 1641 | 1601 | db_set_active('boinc_rw'); |
| 1642 | 1602 | $forums_contained = db_result(db_query(' |
@@ -1679,13 +1639,11 @@ discard block |
||
| 1679 | 1639 | // Store some result for post-processing in the finished callback. |
| 1680 | 1640 | if (!$category AND $create_hidden) { |
| 1681 | 1641 | $message = "Created special hidden container"; |
| 1682 | - } |
|
| 1683 | - else { |
|
| 1642 | + } else { |
|
| 1684 | 1643 | $context['results']['categories']['success'][] = $category->id; |
| 1685 | 1644 | $message = "Successfully imported container {$category->id}"; |
| 1686 | 1645 | } |
| 1687 | - } |
|
| 1688 | - else { |
|
| 1646 | + } else { |
|
| 1689 | 1647 | $context['results']['categories']['failure'][] = $category->id; |
| 1690 | 1648 | $message = "Failed to import container {$category->id}!"; |
| 1691 | 1649 | watchdog('boincimport', |
@@ -1702,8 +1660,7 @@ discard block |
||
| 1702 | 1660 | // Update the progress for the batch engine |
| 1703 | 1661 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1704 | 1662 | $context['finished'] = 1; |
| 1705 | - } |
|
| 1706 | - else { |
|
| 1663 | + } else { |
|
| 1707 | 1664 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1708 | 1665 | } |
| 1709 | 1666 | } |
@@ -1739,8 +1696,7 @@ discard block |
||
| 1739 | 1696 | // Save the ID of the News forum for later import |
| 1740 | 1697 | variable_set('boincimport_news_forum_id', $forum_id); |
| 1741 | 1698 | $success = TRUE; |
| 1742 | - } |
|
| 1743 | - else { |
|
| 1699 | + } else { |
|
| 1744 | 1700 | // Save all other forums as taxonomy terms |
| 1745 | 1701 | $forum = array( |
| 1746 | 1702 | 'name' => $name, |
@@ -1766,8 +1722,7 @@ discard block |
||
| 1766 | 1722 | // Store some result for post-processing in the finished callback. |
| 1767 | 1723 | $context['results']['forums']['success'][] = $forum_id; |
| 1768 | 1724 | $message = "Successfully imported forum {$forum_id}"; |
| 1769 | - } |
|
| 1770 | - else { |
|
| 1725 | + } else { |
|
| 1771 | 1726 | $context['results']['forums']['failure'][] = $forum_id; |
| 1772 | 1727 | $message = "Failed to import forum {$forum_id}!"; |
| 1773 | 1728 | } |
@@ -1780,8 +1735,7 @@ discard block |
||
| 1780 | 1735 | // Update the progress for the batch engine |
| 1781 | 1736 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1782 | 1737 | $context['finished'] = 1; |
| 1783 | - } |
|
| 1784 | - else { |
|
| 1738 | + } else { |
|
| 1785 | 1739 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1786 | 1740 | } |
| 1787 | 1741 | } |
@@ -1882,8 +1836,7 @@ discard block |
||
| 1882 | 1836 | // Set the forum import successful flag in the variable table |
| 1883 | 1837 | variable_set('boincimport_import_forum_successful', '1'); |
| 1884 | 1838 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 1885 | - } |
|
| 1886 | - else { |
|
| 1839 | + } else { |
|
| 1887 | 1840 | // An error occurred. |
| 1888 | 1841 | // $operations contains the operations that remained unprocessed. |
| 1889 | 1842 | $error_operation = reset($operations); |
@@ -2037,9 +1990,7 @@ discard block |
||
| 2037 | 1990 | |
| 2038 | 1991 | if ($duplicate OR !$post) { |
| 2039 | 1992 | $success = FALSE; |
| 2040 | - } |
|
| 2041 | - |
|
| 2042 | - else { |
|
| 1993 | + } else { |
|
| 2043 | 1994 | // Get the user and term IDs along with other data to define the topic |
| 2044 | 1995 | $uid = boincuser_lookup_uid($topic->owner); |
| 2045 | 1996 | $tid = db_result(db_query(' |
@@ -2103,12 +2054,10 @@ discard block |
||
| 2103 | 2054 | if (!$success) { |
| 2104 | 2055 | $error_detail = 'topic imported, but failed to set last comment timestamp'; |
| 2105 | 2056 | } |
| 2106 | - } |
|
| 2107 | - else { |
|
| 2057 | + } else { |
|
| 2108 | 2058 | $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table'; |
| 2109 | 2059 | } |
| 2110 | - } |
|
| 2111 | - else { |
|
| 2060 | + } else { |
|
| 2112 | 2061 | $error_detail = 'failed to save topic node to database'; |
| 2113 | 2062 | } |
| 2114 | 2063 | } |
@@ -2119,16 +2068,13 @@ discard block |
||
| 2119 | 2068 | // Store some result for post-processing in the finished callback. |
| 2120 | 2069 | $context['results']['success'][] = $topic->id; |
| 2121 | 2070 | $message = "Successfully imported topic {$topic->id}"; |
| 2122 | - } |
|
| 2123 | - elseif ($duplicate) { |
|
| 2071 | + } elseif ($duplicate) { |
|
| 2124 | 2072 | $context['results']['duplicate'][] = $topic->id; |
| 2125 | 2073 | $message = "Topic {$topic->id} was already imported"; |
| 2126 | - } |
|
| 2127 | - elseif (!$post) { |
|
| 2074 | + } elseif (!$post) { |
|
| 2128 | 2075 | $context['results']['empty'][] = $topic->id; |
| 2129 | 2076 | $message = "Skipping topic {$topic->id} as empty"; |
| 2130 | - } |
|
| 2131 | - else { |
|
| 2077 | + } else { |
|
| 2132 | 2078 | $context['results']['failure'][] = $topic->id; |
| 2133 | 2079 | $message = "Failed to import topic {$topic->id}!"; |
| 2134 | 2080 | watchdog('boincimport', |
@@ -2149,8 +2095,7 @@ discard block |
||
| 2149 | 2095 | // Update the progress for the batch engine |
| 2150 | 2096 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2151 | 2097 | $context['finished'] = 1; |
| 2152 | - } |
|
| 2153 | - else { |
|
| 2098 | + } else { |
|
| 2154 | 2099 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2155 | 2100 | } |
| 2156 | 2101 | } |
@@ -2184,8 +2129,7 @@ discard block |
||
| 2184 | 2129 | // Set the topic import successful flag in the variable table |
| 2185 | 2130 | variable_set('boincimport_import_topic_successful', '1'); |
| 2186 | 2131 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 2187 | - } |
|
| 2188 | - else { |
|
| 2132 | + } else { |
|
| 2189 | 2133 | // An error occurred. |
| 2190 | 2134 | // $operations contains the operations that remained unprocessed. |
| 2191 | 2135 | $error_operation = reset($operations); |
@@ -2433,18 +2377,15 @@ discard block |
||
| 2433 | 2377 | if ($success) { |
| 2434 | 2378 | $posts_imported++; |
| 2435 | 2379 | $context['results']['posts']['success'][] = $post->id; |
| 2436 | - } |
|
| 2437 | - else { |
|
| 2380 | + } else { |
|
| 2438 | 2381 | $context['results']['posts']['failure'][] = $post->id; |
| 2439 | 2382 | $error_posts++; |
| 2440 | 2383 | } |
| 2441 | - } |
|
| 2442 | - else { |
|
| 2384 | + } else { |
|
| 2443 | 2385 | $context['results']['posts']['failure'][] = $post->id; |
| 2444 | 2386 | $error_posts++; |
| 2445 | 2387 | } |
| 2446 | - } |
|
| 2447 | - else { |
|
| 2388 | + } else { |
|
| 2448 | 2389 | $context['results']['posts']['empty'][] = $post->id; |
| 2449 | 2390 | $empty_posts++; |
| 2450 | 2391 | } |
@@ -2455,8 +2396,7 @@ discard block |
||
| 2455 | 2396 | // Store some result for post-processing in the finished callback. |
| 2456 | 2397 | $context['results']['success'][] = $boinc_topic->id; |
| 2457 | 2398 | $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
| 2458 | - } |
|
| 2459 | - else { |
|
| 2399 | + } else { |
|
| 2460 | 2400 | $context['results']['failure'][] = $boinc_topic->id; |
| 2461 | 2401 | $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)"; |
| 2462 | 2402 | watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', |
@@ -2477,8 +2417,7 @@ discard block |
||
| 2477 | 2417 | // Update the progress for the batch engine |
| 2478 | 2418 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2479 | 2419 | $context['finished'] = 1; |
| 2480 | - } |
|
| 2481 | - else { |
|
| 2420 | + } else { |
|
| 2482 | 2421 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2483 | 2422 | } |
| 2484 | 2423 | } |
@@ -2518,8 +2457,7 @@ discard block |
||
| 2518 | 2457 | // Set the post import successful flag in the variable table |
| 2519 | 2458 | variable_set('boincimport_import_post_successful', '1'); |
| 2520 | 2459 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 2521 | - } |
|
| 2522 | - else { |
|
| 2460 | + } else { |
|
| 2523 | 2461 | // An error occurred. |
| 2524 | 2462 | // $operations contains the operations that remained unprocessed. |
| 2525 | 2463 | $error_operation = reset($operations); |
@@ -2606,8 +2544,7 @@ discard block |
||
| 2606 | 2544 | if (isset($existing_team_forums[$boincteam_forum->id])) { |
| 2607 | 2545 | // This team has already been imported |
| 2608 | 2546 | $duplicates[] = $boincteam_forum->id; |
| 2609 | - } |
|
| 2610 | - else { |
|
| 2547 | + } else { |
|
| 2611 | 2548 | $operations[] = array( |
| 2612 | 2549 | 'boincimport_team_forums_op', array( |
| 2613 | 2550 | $boincteam_forum |
@@ -2673,8 +2610,7 @@ discard block |
||
| 2673 | 2610 | // Store some result for post-processing in the finished callback. |
| 2674 | 2611 | $context['results']['success'][] = $forum_id; |
| 2675 | 2612 | $message = "Successfully imported team forum {$forum_id}"; |
| 2676 | - } |
|
| 2677 | - else { |
|
| 2613 | + } else { |
|
| 2678 | 2614 | $context['results']['failure'][] = $forum_id; |
| 2679 | 2615 | $message = "Failed to import team forum {$forum_id}!"; |
| 2680 | 2616 | watchdog('boincimport', |
@@ -2691,8 +2627,7 @@ discard block |
||
| 2691 | 2627 | // Update the progress for the batch engine |
| 2692 | 2628 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2693 | 2629 | $context['finished'] = 1; |
| 2694 | - } |
|
| 2695 | - else { |
|
| 2630 | + } else { |
|
| 2696 | 2631 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2697 | 2632 | } |
| 2698 | 2633 | } |
@@ -2715,8 +2650,7 @@ discard block |
||
| 2715 | 2650 | // Set the team forum import successful flag in the variable table |
| 2716 | 2651 | variable_set('boincimport_import_team_forum_successful', '1'); |
| 2717 | 2652 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 2718 | - } |
|
| 2719 | - else { |
|
| 2653 | + } else { |
|
| 2720 | 2654 | // An error occurred. |
| 2721 | 2655 | // $operations contains the operations that remained unprocessed. |
| 2722 | 2656 | $error_operation = reset($operations); |
@@ -2811,8 +2745,7 @@ discard block |
||
| 2811 | 2745 | if (isset($existing_team_topics[$boincteam_topic->id])) { |
| 2812 | 2746 | // This team topic has already been imported |
| 2813 | 2747 | $duplicates[] = $boincteam_topic->id; |
| 2814 | - } |
|
| 2815 | - else { |
|
| 2748 | + } else { |
|
| 2816 | 2749 | $operations[] = array( |
| 2817 | 2750 | 'boincimport_team_topics_op', array( |
| 2818 | 2751 | $boincteam_topic |
@@ -2859,8 +2792,7 @@ discard block |
||
| 2859 | 2792 | )); |
| 2860 | 2793 | if (!$team_forum_id) { |
| 2861 | 2794 | $missing_parent[] = $topic->id; |
| 2862 | - } |
|
| 2863 | - else { |
|
| 2795 | + } else { |
|
| 2864 | 2796 | // Get the content of the post that started the topic |
| 2865 | 2797 | db_set_active('boinc_rw'); |
| 2866 | 2798 | $query = db_query(' |
@@ -2877,8 +2809,7 @@ discard block |
||
| 2877 | 2809 | // Empty topics should have already been filtered out of the import, so |
| 2878 | 2810 | // consider this an error condition |
| 2879 | 2811 | $empty_topics[] = $topic->id; |
| 2880 | - } |
|
| 2881 | - else { |
|
| 2812 | + } else { |
|
| 2882 | 2813 | // Get the user ID along with other data to define the topic |
| 2883 | 2814 | $uid = boincuser_lookup_uid($topic->owner); |
| 2884 | 2815 | if (!$topic->owner) { |
@@ -2942,8 +2873,7 @@ discard block |
||
| 2942 | 2873 | // Store some result for post-processing in the finished callback. |
| 2943 | 2874 | $context['results']['success'][] = $topic->id; |
| 2944 | 2875 | $message = "Successfully imported team topic {$topic->id}"; |
| 2945 | - } |
|
| 2946 | - else { |
|
| 2876 | + } else { |
|
| 2947 | 2877 | $context['results']['failure'][] = $topic->id; |
| 2948 | 2878 | $message = "Failed to import team topic {$topic->id}!"; |
| 2949 | 2879 | watchdog('boincimport', |
@@ -2960,8 +2890,7 @@ discard block |
||
| 2960 | 2890 | // Update the progress for the batch engine |
| 2961 | 2891 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2962 | 2892 | $context['finished'] = 1; |
| 2963 | - } |
|
| 2964 | - else { |
|
| 2893 | + } else { |
|
| 2965 | 2894 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2966 | 2895 | } |
| 2967 | 2896 | } |
@@ -2984,8 +2913,7 @@ discard block |
||
| 2984 | 2913 | // Set the BLAH import successful flag in the variable table |
| 2985 | 2914 | variable_set('boincimport_import_team_topic_successful', '1'); |
| 2986 | 2915 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 2987 | - } |
|
| 2988 | - else { |
|
| 2916 | + } else { |
|
| 2989 | 2917 | // An error occurred. |
| 2990 | 2918 | // $operations contains the operations that remained unprocessed. |
| 2991 | 2919 | $error_operation = reset($operations); |
@@ -3107,8 +3035,7 @@ discard block |
||
| 3107 | 3035 | if (isset($existing_posts[$boincteam_post->id])) { |
| 3108 | 3036 | // This post has already been imported |
| 3109 | 3037 | $duplicates[] = $boincteam_post->id; |
| 3110 | - } |
|
| 3111 | - else { |
|
| 3038 | + } else { |
|
| 3112 | 3039 | $operations[] = array( |
| 3113 | 3040 | 'boincimport_team_posts_op', array( |
| 3114 | 3041 | $boincteam_post |
@@ -3224,8 +3151,7 @@ discard block |
||
| 3224 | 3151 | // Store some result for post-processing in the finished callback. |
| 3225 | 3152 | $context['results']['success'][] = $post->id; |
| 3226 | 3153 | $message = "Successfully imported team post {$post->id}"; |
| 3227 | - } |
|
| 3228 | - else { |
|
| 3154 | + } else { |
|
| 3229 | 3155 | $context['results']['failure'][] = $post->id; |
| 3230 | 3156 | $message = "Failed to import team post {$post->id}!"; |
| 3231 | 3157 | watchdog('boincimport', |
@@ -3242,8 +3168,7 @@ discard block |
||
| 3242 | 3168 | // Update the progress for the batch engine |
| 3243 | 3169 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3244 | 3170 | $context['finished'] = 1; |
| 3245 | - } |
|
| 3246 | - else { |
|
| 3171 | + } else { |
|
| 3247 | 3172 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3248 | 3173 | } |
| 3249 | 3174 | } |
@@ -3266,8 +3191,7 @@ discard block |
||
| 3266 | 3191 | // Set the team post import successful flag in the variable table |
| 3267 | 3192 | variable_set('boincimport_import_team_post_successful', '1'); |
| 3268 | 3193 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3269 | - } |
|
| 3270 | - else { |
|
| 3194 | + } else { |
|
| 3271 | 3195 | // An error occurred. |
| 3272 | 3196 | // $operations contains the operations that remained unprocessed. |
| 3273 | 3197 | $error_operation = reset($operations); |
@@ -3373,8 +3297,7 @@ discard block |
||
| 3373 | 3297 | $context['results']['success'][] = $boincuser_id; |
| 3374 | 3298 | $context['results']['subscriptions'][$boincuser_id] = $count; |
| 3375 | 3299 | $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}"; |
| 3376 | - } |
|
| 3377 | - else { |
|
| 3300 | + } else { |
|
| 3378 | 3301 | $context['results']['failure'][] = $boincuser_id; |
| 3379 | 3302 | $message = "Failed to import subscriptions for user {$boincuser_id}!"; |
| 3380 | 3303 | watchdog('boincimport', |
@@ -3391,8 +3314,7 @@ discard block |
||
| 3391 | 3314 | // Update the progress for the batch engine |
| 3392 | 3315 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3393 | 3316 | $context['finished'] = 1; |
| 3394 | - } |
|
| 3395 | - else { |
|
| 3317 | + } else { |
|
| 3396 | 3318 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3397 | 3319 | } |
| 3398 | 3320 | } |
@@ -3417,8 +3339,7 @@ discard block |
||
| 3417 | 3339 | // Set the subscription import successful flag in the variable table |
| 3418 | 3340 | variable_set('boincimport_import_subscription_successful', '1'); |
| 3419 | 3341 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3420 | - } |
|
| 3421 | - else { |
|
| 3342 | + } else { |
|
| 3422 | 3343 | // An error occurred. |
| 3423 | 3344 | // $operations contains the operations that remained unprocessed. |
| 3424 | 3345 | $error_operation = reset($operations); |
@@ -3596,8 +3517,7 @@ discard block |
||
| 3596 | 3517 | // Store some result for post-processing in the finished callback. |
| 3597 | 3518 | $context['results']['nodes']['updated'][] = $node->nid; |
| 3598 | 3519 | $message = "Successfully updated node {$node->nid}"; |
| 3599 | - } |
|
| 3600 | - else { |
|
| 3520 | + } else { |
|
| 3601 | 3521 | $message = "No changes made to node {$node->nid}!"; |
| 3602 | 3522 | } |
| 3603 | 3523 | |
@@ -3609,8 +3529,7 @@ discard block |
||
| 3609 | 3529 | // Update the progress for the batch engine |
| 3610 | 3530 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3611 | 3531 | $context['finished'] = 1; |
| 3612 | - } |
|
| 3613 | - else { |
|
| 3532 | + } else { |
|
| 3614 | 3533 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3615 | 3534 | } |
| 3616 | 3535 | } |
@@ -3660,8 +3579,7 @@ discard block |
||
| 3660 | 3579 | // Store some result for post-processing in the finished callback. |
| 3661 | 3580 | $context['results']['comments']['updated'][] = $comment->cid; |
| 3662 | 3581 | $message = "Successfully updated comment {$comment->cid}"; |
| 3663 | - } |
|
| 3664 | - else { |
|
| 3582 | + } else { |
|
| 3665 | 3583 | $message = "No changes made to comment {$comment->cid}!"; |
| 3666 | 3584 | } |
| 3667 | 3585 | |
@@ -3673,8 +3591,7 @@ discard block |
||
| 3673 | 3591 | // Update the progress for the batch engine |
| 3674 | 3592 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3675 | 3593 | $context['finished'] = 1; |
| 3676 | - } |
|
| 3677 | - else { |
|
| 3594 | + } else { |
|
| 3678 | 3595 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3679 | 3596 | } |
| 3680 | 3597 | } |
@@ -3723,8 +3640,7 @@ discard block |
||
| 3723 | 3640 | // Store some result for post-processing in the finished callback. |
| 3724 | 3641 | $context['results']['pm']['updated'][] = $pm->mid; |
| 3725 | 3642 | $message = "Successfully updated private message {$pm->mid}"; |
| 3726 | - } |
|
| 3727 | - else { |
|
| 3643 | + } else { |
|
| 3728 | 3644 | $message = "No changes made to private message {$pm->mid}!"; |
| 3729 | 3645 | } |
| 3730 | 3646 | |
@@ -3736,8 +3652,7 @@ discard block |
||
| 3736 | 3652 | // Update the progress for the batch engine |
| 3737 | 3653 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3738 | 3654 | $context['finished'] = 1; |
| 3739 | - } |
|
| 3740 | - else { |
|
| 3655 | + } else { |
|
| 3741 | 3656 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3742 | 3657 | } |
| 3743 | 3658 | } |
@@ -3802,8 +3717,7 @@ discard block |
||
| 3802 | 3717 | // Set the replace URLs successful flag in the variable table |
| 3803 | 3718 | variable_set('boincimport_replace_urls_successful', '1'); |
| 3804 | 3719 | $_SESSION['boincimport_stage_selected'] = 'users'; |
| 3805 | - } |
|
| 3806 | - else { |
|
| 3720 | + } else { |
|
| 3807 | 3721 | // An error occurred. |
| 3808 | 3722 | // $operations contains the operations that remained unprocessed. |
| 3809 | 3723 | $error_operation = reset($operations); |
@@ -3905,7 +3819,8 @@ discard block |
||
| 3905 | 3819 | $score = 0; // 0 default value, comments get higher score depending on the author's roles |
| 3906 | 3820 | $users = serialize(array(0 => 1)); // default value for everybody!! |
| 3907 | 3821 | |
| 3908 | - if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too |
|
| 3822 | + if ($edit['uid'] === $user->uid) { |
|
| 3823 | +// '===' because we want to modify anonymous users too |
|
| 3909 | 3824 | $edit['name'] = $user->name; |
| 3910 | 3825 | } |
| 3911 | 3826 | |
@@ -4028,13 +3943,11 @@ discard block |
||
| 4028 | 3943 | if (isset($this->boincDomains[$domain])) { |
| 4029 | 3944 | // This is a URL configured to be transformed |
| 4030 | 3945 | return "{$http}://{$this->drupalDomain}{$this->basePath}"; |
| 4031 | - } |
|
| 4032 | - else { |
|
| 3946 | + } else { |
|
| 4033 | 3947 | // This URL should not be transformed |
| 4034 | 3948 | return NULL; |
| 4035 | 3949 | } |
| 4036 | - } |
|
| 4037 | - else { |
|
| 3950 | + } else { |
|
| 4038 | 3951 | // This is a relative URL |
| 4039 | 3952 | return $this->basePath; |
| 4040 | 3953 | } |
@@ -4056,8 +3969,7 @@ discard block |
||
| 4056 | 3969 | )); |
| 4057 | 3970 | if ($id) { |
| 4058 | 3971 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4059 | - } |
|
| 4060 | - else { |
|
| 3972 | + } else { |
|
| 4061 | 3973 | // This post is not in the post import table, so it's probably a topic |
| 4062 | 3974 | $link = $this->transformTopicLinks($matches); |
| 4063 | 3975 | } |
@@ -4081,8 +3993,7 @@ discard block |
||
| 4081 | 3993 | )); |
| 4082 | 3994 | if ($id) { |
| 4083 | 3995 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4084 | - } |
|
| 4085 | - else { |
|
| 3996 | + } else { |
|
| 4086 | 3997 | // This post is not in the post import table, so it's probably a topic |
| 4087 | 3998 | $link = $this->transformTopicLinks($matches); |
| 4088 | 3999 | } |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | * Implementation of hook_menu() |
| 20 | 20 | */ |
| 21 | 21 | function boincimport_menu() { |
| 22 | - $items = array(); |
|
| 22 | + $items = array(); |
|
| 23 | 23 | |
| 24 | - $items['admin/boinc/import'] = array( |
|
| 24 | + $items['admin/boinc/import'] = array( |
|
| 25 | 25 | 'title' => 'Environment: Data import', |
| 26 | 26 | 'description' => 'Overview of the BOINC data import process.', |
| 27 | 27 | 'access callback' => 'user_access', |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | 'page callback' => 'boincimport_main', |
| 30 | 30 | 'file' => 'boincimport.pages.inc', |
| 31 | 31 | 'type' => MENU_NORMAL_ITEM, |
| 32 | - ); |
|
| 33 | - $items['admin/boinc/import/post_configuration'] = array( |
|
| 32 | + ); |
|
| 33 | + $items['admin/boinc/import/post_configuration'] = array( |
|
| 34 | 34 | 'title' => 'Post-migration configuration', |
| 35 | 35 | 'description' => 'Tie up a few odds and ends in the system configuration |
| 36 | 36 | after data importation is complete.', |
@@ -39,44 +39,44 @@ discard block |
||
| 39 | 39 | 'page callback' => 'boincimport_post_configuration', |
| 40 | 40 | 'file' => 'boincimport.pages.inc', |
| 41 | 41 | 'type' => MENU_CALLBACK, |
| 42 | - ); |
|
| 43 | - $items['admin/boinc/import/cleanup'] = array( |
|
| 42 | + ); |
|
| 43 | + $items['admin/boinc/import/cleanup'] = array( |
|
| 44 | 44 | 'title' => 'Cleanup', |
| 45 | 45 | 'access callback' => 'user_access', |
| 46 | 46 | 'access arguments' => array('import boinc data'), |
| 47 | 47 | 'page callback' => 'boincimport_cleanup', |
| 48 | 48 | 'type' => MENU_CALLBACK, |
| 49 | - ); |
|
| 50 | - $items['admin/boinc/import/complete/%'] = array( |
|
| 49 | + ); |
|
| 50 | + $items['admin/boinc/import/complete/%'] = array( |
|
| 51 | 51 | 'title' => 'Complete', |
| 52 | 52 | 'access callback' => 'user_access', |
| 53 | 53 | 'access arguments' => array('import boinc data'), |
| 54 | 54 | 'page callback' => 'boincimport_complete', |
| 55 | 55 | 'page arguments' => array(4), |
| 56 | 56 | 'type' => MENU_CALLBACK, |
| 57 | - ); |
|
| 58 | - $items['admin/boinc/import/process'] = array( |
|
| 57 | + ); |
|
| 58 | + $items['admin/boinc/import/process'] = array( |
|
| 59 | 59 | 'title' => 'Execute migration', |
| 60 | 60 | 'access callback' => 'user_access', |
| 61 | 61 | 'access arguments' => array('import boinc data'), |
| 62 | 62 | 'page callback' => 'boincimport_process', |
| 63 | 63 | 'type' => MENU_CALLBACK, |
| 64 | - ); |
|
| 65 | - $items['admin/boinc/import/reset'] = array( |
|
| 64 | + ); |
|
| 65 | + $items['admin/boinc/import/reset'] = array( |
|
| 66 | 66 | 'title' => 'Reset BOINC database URL', |
| 67 | 67 | 'access callback' => 'user_access', |
| 68 | 68 | 'access arguments' => array('import boinc data'), |
| 69 | 69 | 'page callback' => 'boincimport_reset', |
| 70 | 70 | 'type' => MENU_CALLBACK, |
| 71 | - ); |
|
| 72 | - $items['admin/boinc/import/unlock'] = array( |
|
| 71 | + ); |
|
| 72 | + $items['admin/boinc/import/unlock'] = array( |
|
| 73 | 73 | 'title' => 'Unlock BOINC import process', |
| 74 | 74 | 'access callback' => 'user_access', |
| 75 | 75 | 'access arguments' => array('import boinc data'), |
| 76 | 76 | 'page callback' => 'boincimport_unlock', |
| 77 | 77 | 'type' => MENU_CALLBACK, |
| 78 | - ); |
|
| 79 | - $items['admin/boinc/import/settings'] = array( |
|
| 78 | + ); |
|
| 79 | + $items['admin/boinc/import/settings'] = array( |
|
| 80 | 80 | 'title' => 'BOINC data import settings', |
| 81 | 81 | 'description' => 'Configure the BOINC data import process in preparation |
| 82 | 82 | for pulling user accounts, teams, and forums into Drupal.', |
@@ -86,37 +86,37 @@ discard block |
||
| 86 | 86 | 'page arguments' => array('boincimport_admin_settings'), |
| 87 | 87 | 'file' => 'boincimport.pages.inc', |
| 88 | 88 | 'type' => MENU_CALLBACK, |
| 89 | - ); |
|
| 90 | - return $items; |
|
| 89 | + ); |
|
| 90 | + return $items; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * Implementation of hook_perm() |
| 95 | 95 | */ |
| 96 | 96 | function boincimport_perm() { |
| 97 | - return array('import boinc data'); |
|
| 97 | + return array('import boinc data'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Callback admin/boinc/import/reset |
| 102 | 102 | */ |
| 103 | 103 | function boincimport_reset() { |
| 104 | - global $db_url; |
|
| 105 | - $boinc_db_url = (is_array($db_url)) ? (isset($db_url['boinc_rw']) ? $db_url['boinc_rw'] : $db_url['default']) : $db_url; |
|
| 106 | - variable_set('boincimport_db_url', $boinc_db_url); |
|
| 107 | - variable_set('boincimport_ready', 0); |
|
| 108 | - return '<p>'. t('The BOINC database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.', |
|
| 109 | - array('@configlink' => url('admin/boinc/import/settings'))) .'</p>'; |
|
| 104 | + global $db_url; |
|
| 105 | + $boinc_db_url = (is_array($db_url)) ? (isset($db_url['boinc_rw']) ? $db_url['boinc_rw'] : $db_url['default']) : $db_url; |
|
| 106 | + variable_set('boincimport_db_url', $boinc_db_url); |
|
| 107 | + variable_set('boincimport_ready', 0); |
|
| 108 | + return '<p>'. t('The BOINC database URL has been reset. You may now <a href="@configlink">go back to the configuration page</a>.', |
|
| 109 | + array('@configlink' => url('admin/boinc/import/settings'))) .'</p>'; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * Callback admin/boinc/import/unlock |
| 114 | 114 | */ |
| 115 | 115 | function boincimport_unlock() { |
| 116 | - variable_del('boincimport_process_locked'); |
|
| 117 | - return '<p>'. t('The BOINC data import process has been unlocked. You may |
|
| 116 | + variable_del('boincimport_process_locked'); |
|
| 117 | + return '<p>'. t('The BOINC data import process has been unlocked. You may |
|
| 118 | 118 | now !proceed_with_import.', array( |
| 119 | - '!proceed_with_import' => l(t('proceed with the import'), |
|
| 119 | + '!proceed_with_import' => l(t('proceed with the import'), |
|
| 120 | 120 | 'admin/boinc/import/process') |
| 121 | 121 | )) .'</p>'; |
| 122 | 122 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * Callback admin/boinc/import/cleanup |
| 126 | 126 | */ |
| 127 | 127 | function boincimport_cleanup() { |
| 128 | - return boincimport_process_cleanup() .'<p>'. t('Drupal database cleaned.') .'</p>'; |
|
| 128 | + return boincimport_process_cleanup() .'<p>'. t('Drupal database cleaned.') .'</p>'; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -139,23 +139,23 @@ discard block |
||
| 139 | 139 | * want to test. Therefore, the test part of the code is not used, now. |
| 140 | 140 | */ |
| 141 | 141 | function _boincimport_db_connect($test= 0) { |
| 142 | - global $db_url; |
|
| 143 | - $db_ready = variable_get('boincimport_db_configured', 1); |
|
| 144 | - if (!$db_ready) { |
|
| 142 | + global $db_url; |
|
| 143 | + $db_ready = variable_get('boincimport_db_configured', 1); |
|
| 144 | + if (!$db_ready) { |
|
| 145 | 145 | if (is_array($db_url)) { |
| 146 | - $db_url2 = $db_url; |
|
| 146 | + $db_url2 = $db_url; |
|
| 147 | 147 | } else { |
| 148 | - $db_url2['default'] = $db_url; |
|
| 148 | + $db_url2['default'] = $db_url; |
|
| 149 | 149 | } |
| 150 | 150 | $db_url2['boinc_rw'] = variable_get('boincimport_db_url', $db_url); |
| 151 | 151 | $GLOBALS['db_url'] =& $db_url2; |
| 152 | 152 | if ($test) { |
| 153 | - if (!db_connect($db_url2['boinc_rw'])) { |
|
| 153 | + if (!db_connect($db_url2['boinc_rw'])) { |
|
| 154 | 154 | return 0; |
| 155 | - } |
|
| 155 | + } |
|
| 156 | 156 | } |
| 157 | - } |
|
| 158 | - return 1; |
|
| 157 | + } |
|
| 158 | + return 1; |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
@@ -167,17 +167,17 @@ discard block |
||
| 167 | 167 | * $out['result'] = boolean. |
| 168 | 168 | */ |
| 169 | 169 | function _boincimport_check_module($module) { |
| 170 | - $out['html'] = '<ul>'; |
|
| 171 | - $result = module_exists($module); |
|
| 172 | - $out['result'] = $result; |
|
| 173 | - if ($result == 1) { |
|
| 170 | + $out['html'] = '<ul>'; |
|
| 171 | + $result = module_exists($module); |
|
| 172 | + $out['result'] = $result; |
|
| 173 | + if ($result == 1) { |
|
| 174 | 174 | $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>'; |
| 175 | - } |
|
| 176 | - else { |
|
| 175 | + } |
|
| 176 | + else { |
|
| 177 | 177 | $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>'; |
| 178 | - } |
|
| 179 | - $out['html'] .= '</ul>'; |
|
| 180 | - return $out; |
|
| 178 | + } |
|
| 179 | + $out['html'] .= '</ul>'; |
|
| 180 | + return $out; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -188,259 +188,259 @@ discard block |
||
| 188 | 188 | * $out['result'] = boolean. |
| 189 | 189 | */ |
| 190 | 190 | function _boincimport_check_tables($tables = array(), $db = 'default' , $prefix = 1) { |
| 191 | - _boincimport_db_connect(); |
|
| 191 | + _boincimport_db_connect(); |
|
| 192 | 192 | |
| 193 | - $out['html'] = '<ul>'; |
|
| 194 | - $out['result']= 1; |
|
| 195 | - foreach ($tables as $table) { |
|
| 193 | + $out['html'] = '<ul>'; |
|
| 194 | + $out['result']= 1; |
|
| 195 | + foreach ($tables as $table) { |
|
| 196 | 196 | if ($prefix) { |
| 197 | - $table = db_prefix_tables('{'. $table .'}'); |
|
| 197 | + $table = db_prefix_tables('{'. $table .'}'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | db_set_active($db); |
| 201 | 201 | if ($GLOBALS['db_type'] == 'pgsql') { |
| 202 | - // adapt from db_table_exists in database.pgsql.inc |
|
| 203 | - $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
|
| 202 | + // adapt from db_table_exists in database.pgsql.inc |
|
| 203 | + $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
|
| 204 | 204 | } |
| 205 | 205 | else { |
| 206 | - // adapt from db_table_exists in database.mysql.inc |
|
| 207 | - $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
|
| 206 | + // adapt from db_table_exists in database.mysql.inc |
|
| 207 | + $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
|
| 208 | 208 | } |
| 209 | 209 | db_set_active('default'); |
| 210 | 210 | if ($result) { |
| 211 | - $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
|
| 211 | + $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
|
| 212 | 212 | } |
| 213 | 213 | else { |
| 214 | - $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
|
| 215 | - $out['result']= 0; |
|
| 214 | + $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
|
| 215 | + $out['result']= 0; |
|
| 216 | 216 | } |
| 217 | - } |
|
| 218 | - $out['html'] .= '</ul>'; |
|
| 219 | - return $out; |
|
| 217 | + } |
|
| 218 | + $out['html'] .= '</ul>'; |
|
| 219 | + return $out; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | function boincimport_process() { |
| 225 | - // Start with a quick sanity check on the BOINC environment |
|
| 226 | - boinc_get_path(); |
|
| 225 | + // Start with a quick sanity check on the BOINC environment |
|
| 226 | + boinc_get_path(); |
|
| 227 | 227 | |
| 228 | - if (!variable_get('boincimport_ready', 0)) { |
|
| 228 | + if (!variable_get('boincimport_ready', 0)) { |
|
| 229 | 229 | return '<p>'. t('You cannot import the data now. Please <a href="@settings">complete the setup first</a>', array('@settings' => url('admin/boinc/import/settings'))) .'</p>'; |
| 230 | - } |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - $output = 'BOINC import process form'; |
|
| 233 | - $output .= drupal_get_form('boincimport_process_form'); |
|
| 234 | - return $output; |
|
| 232 | + $output = 'BOINC import process form'; |
|
| 233 | + $output .= drupal_get_form('boincimport_process_form'); |
|
| 234 | + return $output; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | function boincimport_process_form() { |
| 238 | - $form = array(); |
|
| 239 | - _boincimport_db_connect() ; |
|
| 240 | - // Causes problems with form api redirect |
|
| 241 | - //ini_set('display_errors', TRUE); |
|
| 238 | + $form = array(); |
|
| 239 | + _boincimport_db_connect() ; |
|
| 240 | + // Causes problems with form api redirect |
|
| 241 | + //ini_set('display_errors', TRUE); |
|
| 242 | 242 | |
| 243 | - // Adjust how long you want the script to run... |
|
| 244 | - if (!ini_get('safe_mode')) { |
|
| 243 | + // Adjust how long you want the script to run... |
|
| 244 | + if (!ini_get('safe_mode')) { |
|
| 245 | 245 | // This will always be set on PHP7, but not on PHP5 with safe mode |
| 246 | 246 | set_time_limit(variable_get('boincimport_time_limit', 0)); |
| 247 | - } |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - // Check for a lock on the import process |
|
| 250 | - if (variable_get('boincimport_process_locked', 0)) { |
|
| 249 | + // Check for a lock on the import process |
|
| 250 | + if (variable_get('boincimport_process_locked', 0)) { |
|
| 251 | 251 | drupal_set_message(t('The import process is locked. If you are sure that |
| 252 | 252 | it is no longer running, you may !unlock_it', |
| 253 | - array('!unlock_it' => l(t('release the lock'), |
|
| 253 | + array('!unlock_it' => l(t('release the lock'), |
|
| 254 | 254 | 'admin/boinc/import/unlock') |
| 255 | - )), 'warning'); |
|
| 255 | + )), 'warning'); |
|
| 256 | 256 | watchdog('boincimport', 'The import process is locked. If you are sure that |
| 257 | 257 | it is no longer running, you may !unlock_it', |
| 258 | - array('!unlock_it' => l(t('release the lock'), |
|
| 258 | + array('!unlock_it' => l(t('release the lock'), |
|
| 259 | 259 | 'admin/boinc/import/unlock') |
| 260 | - ), WATCHDOG_WARNING); |
|
| 261 | - } |
|
| 262 | - else { |
|
| 260 | + ), WATCHDOG_WARNING); |
|
| 261 | + } |
|
| 262 | + else { |
|
| 263 | 263 | $boincimport_functions = array( |
| 264 | - 'users' => t('Import users'), |
|
| 265 | - 'teams' => t('Import teams'), |
|
| 266 | - 'friends' => t('Import friendships'), |
|
| 267 | - 'preferences' => t('Import user preferences'), |
|
| 268 | - 'private messages' => t('Import private messages'), |
|
| 269 | - 'categories' => t('Import forum containers'), |
|
| 270 | - 'topics' => t('Import topics'), |
|
| 271 | - 'posts' => t('Import posts'), |
|
| 272 | - 'team forums' => t('Import team forums'), |
|
| 273 | - 'team topics' => t('Import team topics'), |
|
| 274 | - 'team posts' => t('Import team posts'), |
|
| 275 | - 'url' => t('Transform URLs'), |
|
| 264 | + 'users' => t('Import users'), |
|
| 265 | + 'teams' => t('Import teams'), |
|
| 266 | + 'friends' => t('Import friendships'), |
|
| 267 | + 'preferences' => t('Import user preferences'), |
|
| 268 | + 'private messages' => t('Import private messages'), |
|
| 269 | + 'categories' => t('Import forum containers'), |
|
| 270 | + 'topics' => t('Import topics'), |
|
| 271 | + 'posts' => t('Import posts'), |
|
| 272 | + 'team forums' => t('Import team forums'), |
|
| 273 | + 'team topics' => t('Import team topics'), |
|
| 274 | + 'team posts' => t('Import team posts'), |
|
| 275 | + 'url' => t('Transform URLs'), |
|
| 276 | 276 | ); |
| 277 | 277 | |
| 278 | 278 | $form['import'] = array( |
| 279 | - '#type' => 'select', |
|
| 280 | - '#title' => t('Next import to perform'), |
|
| 281 | - '#default_value' => $_SESSION['boincimport_stage_selected'], |
|
| 282 | - '#options' => $boincimport_functions, |
|
| 279 | + '#type' => 'select', |
|
| 280 | + '#title' => t('Next import to perform'), |
|
| 281 | + '#default_value' => $_SESSION['boincimport_stage_selected'], |
|
| 282 | + '#options' => $boincimport_functions, |
|
| 283 | 283 | ); |
| 284 | 284 | $form[] = array( |
| 285 | - '#type' => 'submit', |
|
| 286 | - '#value' => t('Import'), |
|
| 285 | + '#type' => 'submit', |
|
| 286 | + '#value' => t('Import'), |
|
| 287 | 287 | ); |
| 288 | - } |
|
| 289 | - return $form; |
|
| 288 | + } |
|
| 289 | + return $form; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | function boincimport_process_form_submit($form, $form_state) { |
| 293 | 293 | |
| 294 | - // Lock the import process |
|
| 295 | - if (!variable_get('boincimport_process_locked', 0)) { |
|
| 294 | + // Lock the import process |
|
| 295 | + if (!variable_get('boincimport_process_locked', 0)) { |
|
| 296 | 296 | variable_set('boincimport_process_locked', 1); |
| 297 | - } |
|
| 298 | - else { |
|
| 297 | + } |
|
| 298 | + else { |
|
| 299 | 299 | watchdog('boincimport', 'The import process is locked, but another process |
| 300 | 300 | is trying to access it...', array(), WATCHDOG_WARNING); |
| 301 | - } |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - switch ($form_state['values']['import']) { |
|
| 303 | + switch ($form_state['values']['import']) { |
|
| 304 | 304 | case 'users': |
| 305 | 305 | boincimport_users(); |
| 306 | - break; |
|
| 306 | + break; |
|
| 307 | 307 | |
| 308 | 308 | case 'teams': |
| 309 | 309 | boincimport_teams(); |
| 310 | - if (!variable_get('boincimport_import_team_successful', 0)) { |
|
| 310 | + if (!variable_get('boincimport_import_team_successful', 0)) { |
|
| 311 | 311 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 312 | - } |
|
| 313 | - else { |
|
| 312 | + } |
|
| 313 | + else { |
|
| 314 | 314 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 315 | - } |
|
| 316 | - break; |
|
| 315 | + } |
|
| 316 | + break; |
|
| 317 | 317 | |
| 318 | 318 | case 'friends': |
| 319 | 319 | boincimport_friends(); |
| 320 | - if (!variable_get('boincimport_import_friend_successful', 0)) { |
|
| 320 | + if (!variable_get('boincimport_import_friend_successful', 0)) { |
|
| 321 | 321 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 322 | - } |
|
| 323 | - else { |
|
| 322 | + } |
|
| 323 | + else { |
|
| 324 | 324 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 325 | - } |
|
| 326 | - break; |
|
| 325 | + } |
|
| 326 | + break; |
|
| 327 | 327 | |
| 328 | 328 | case 'preferences': |
| 329 | 329 | boincimport_preferences(); |
| 330 | - if (!variable_get('boincimport_import_preferences_successful', 0)) { |
|
| 330 | + if (!variable_get('boincimport_import_preferences_successful', 0)) { |
|
| 331 | 331 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 332 | - } |
|
| 333 | - else { |
|
| 332 | + } |
|
| 333 | + else { |
|
| 334 | 334 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 335 | - } |
|
| 336 | - break; |
|
| 335 | + } |
|
| 336 | + break; |
|
| 337 | 337 | |
| 338 | 338 | case 'private messages': |
| 339 | 339 | boincimport_private_msgs(); |
| 340 | - if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
|
| 340 | + if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
|
| 341 | 341 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 342 | - } |
|
| 343 | - else { |
|
| 342 | + } |
|
| 343 | + else { |
|
| 344 | 344 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 345 | - } |
|
| 346 | - break; |
|
| 345 | + } |
|
| 346 | + break; |
|
| 347 | 347 | |
| 348 | 348 | case 'categories': |
| 349 | 349 | boincimport_forum_categories(); |
| 350 | - if (!variable_get('boincimport_import_category_successful', 0)) { |
|
| 350 | + if (!variable_get('boincimport_import_category_successful', 0)) { |
|
| 351 | 351 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 352 | - } |
|
| 353 | - else { |
|
| 352 | + } |
|
| 353 | + else { |
|
| 354 | 354 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 355 | - } |
|
| 356 | - break; |
|
| 355 | + } |
|
| 356 | + break; |
|
| 357 | 357 | |
| 358 | 358 | case 'topics': |
| 359 | 359 | boincimport_forum_topics(); |
| 360 | - if (!variable_get('boincimport_import_topic_successful', 0)) { |
|
| 360 | + if (!variable_get('boincimport_import_topic_successful', 0)) { |
|
| 361 | 361 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 362 | - } |
|
| 363 | - else { |
|
| 362 | + } |
|
| 363 | + else { |
|
| 364 | 364 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 365 | - } |
|
| 366 | - break; |
|
| 365 | + } |
|
| 366 | + break; |
|
| 367 | 367 | |
| 368 | 368 | case 'posts': |
| 369 | 369 | boincimport_forum_posts(); |
| 370 | - if (!variable_get('boincimport_import_post_successful', 0)) { |
|
| 370 | + if (!variable_get('boincimport_import_post_successful', 0)) { |
|
| 371 | 371 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 372 | - } |
|
| 373 | - else { |
|
| 372 | + } |
|
| 373 | + else { |
|
| 374 | 374 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 375 | - } |
|
| 376 | - break; |
|
| 375 | + } |
|
| 376 | + break; |
|
| 377 | 377 | |
| 378 | 378 | case 'team forums': |
| 379 | 379 | boincimport_team_forums(); |
| 380 | - if (!variable_get('boincimport_team_forum_successful', 0)) { |
|
| 380 | + if (!variable_get('boincimport_team_forum_successful', 0)) { |
|
| 381 | 381 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 382 | - } |
|
| 383 | - else { |
|
| 382 | + } |
|
| 383 | + else { |
|
| 384 | 384 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 385 | - } |
|
| 386 | - break; |
|
| 385 | + } |
|
| 386 | + break; |
|
| 387 | 387 | |
| 388 | 388 | case 'team topics': |
| 389 | 389 | boincimport_team_forum_topics(); |
| 390 | - if (!variable_get('boincimport_team_topic_successful', 0)) { |
|
| 390 | + if (!variable_get('boincimport_team_topic_successful', 0)) { |
|
| 391 | 391 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 392 | - } |
|
| 393 | - else { |
|
| 392 | + } |
|
| 393 | + else { |
|
| 394 | 394 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 395 | - } |
|
| 396 | - break; |
|
| 395 | + } |
|
| 396 | + break; |
|
| 397 | 397 | |
| 398 | 398 | case 'team posts': |
| 399 | 399 | boincimport_team_forum_posts(); |
| 400 | - if (!variable_get('boincimport_team_post_successful', 0)) { |
|
| 400 | + if (!variable_get('boincimport_team_post_successful', 0)) { |
|
| 401 | 401 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 402 | - } |
|
| 403 | - else { |
|
| 402 | + } |
|
| 403 | + else { |
|
| 404 | 404 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 405 | - } |
|
| 406 | - break; |
|
| 405 | + } |
|
| 406 | + break; |
|
| 407 | 407 | |
| 408 | 408 | case 'url': |
| 409 | 409 | boincimport_replace_urls(); |
| 410 | - if (!variable_get('boincimport_replace_url_successful', 0)) { |
|
| 410 | + if (!variable_get('boincimport_replace_url_successful', 0)) { |
|
| 411 | 411 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 412 | - } |
|
| 413 | - else { |
|
| 412 | + } |
|
| 413 | + else { |
|
| 414 | 414 | drupal_set_message('Congratulations. Import Finished'); |
| 415 | 415 | drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
| 416 | 416 | watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
| 417 | 417 | unset($_SESSION['boincimport_stage_selected']); |
| 418 | - } |
|
| 419 | - break; |
|
| 418 | + } |
|
| 419 | + break; |
|
| 420 | 420 | default: |
| 421 | 421 | $_SESSION['boincimport_stage_selected'] = 'users'; |
| 422 | - break; |
|
| 423 | - } |
|
| 422 | + break; |
|
| 423 | + } |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | function boincimport_complete($section) { |
| 427 | - switch ($section) { |
|
| 428 | - case 'users': |
|
| 427 | + switch ($section) { |
|
| 428 | + case 'users': |
|
| 429 | 429 | // Set the user import successful flag in the variable table |
| 430 | 430 | variable_set('boincimport_import_user_successful', '1'); |
| 431 | 431 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 432 | 432 | break; |
| 433 | - case 'teams': |
|
| 433 | + case 'teams': |
|
| 434 | 434 | |
| 435 | 435 | break; |
| 436 | 436 | |
| 437 | - default: |
|
| 437 | + default: |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - // Release the lock on the import process |
|
| 441 | - variable_del('boincimport_process_locked'); |
|
| 440 | + // Release the lock on the import process |
|
| 441 | + variable_del('boincimport_process_locked'); |
|
| 442 | 442 | |
| 443 | - drupal_goto('admin/boinc/import/process'); |
|
| 443 | + drupal_goto('admin/boinc/import/process'); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | |
@@ -452,26 +452,26 @@ discard block |
||
| 452 | 452 | * Import users (at least those required for further data import) |
| 453 | 453 | */ |
| 454 | 454 | function boincimport_users() { |
| 455 | - // Check whether the user table has been successfully imported already |
|
| 456 | - if (variable_get('boincimport_import_user_successful', 0)) { |
|
| 455 | + // Check whether the user table has been successfully imported already |
|
| 456 | + if (variable_get('boincimport_import_user_successful', 0)) { |
|
| 457 | 457 | drupal_set_message(t('Note: user import has already run successfully')); |
| 458 | 458 | watchdog( |
| 459 | - 'boincimport', 'Note: user import has already run successfully', |
|
| 460 | - array(), WATCHDOG_INFO |
|
| 459 | + 'boincimport', 'Note: user import has already run successfully', |
|
| 460 | + array(), WATCHDOG_INFO |
|
| 461 | 461 | ); |
| 462 | - } |
|
| 462 | + } |
|
| 463 | 463 | |
| 464 | - if (!variable_get('boincimport_import_user_started', 0)) { |
|
| 464 | + if (!variable_get('boincimport_import_user_started', 0)) { |
|
| 465 | 465 | // Could prepare database tables, if new fields are necessary, etc. |
| 466 | 466 | variable_set('boincimport_import_user_started', 1); |
| 467 | - } |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 470 | - $import_lurkers = variable_get('boincimport_import_lurkers', 1); |
|
| 469 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 470 | + $import_lurkers = variable_get('boincimport_import_lurkers', 1); |
|
| 471 | 471 | |
| 472 | - // Determine which users need to be processed |
|
| 473 | - db_set_active('boinc_rw'); |
|
| 474 | - if ($import_lurkers) { |
|
| 472 | + // Determine which users need to be processed |
|
| 473 | + db_set_active('boinc_rw'); |
|
| 474 | + if ($import_lurkers) { |
|
| 475 | 475 | // Import all users, even those who have no community participation; other |
| 476 | 476 | // users will be imported when they first try to log into the drupal site |
| 477 | 477 | $boinc_accounts = db_query(' |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | ORDER BY id ASC' |
| 480 | 480 | ); |
| 481 | 481 | $user_count = mysqli_num_rows($boinc_accounts); |
| 482 | - } |
|
| 483 | - else { |
|
| 482 | + } |
|
| 483 | + else { |
|
| 484 | 484 | // Need to import any user who is currently ignored in order to keep them |
| 485 | 485 | // ignored... not particularly clean (ignored users are stored in a string) |
| 486 | 486 | $ignored_user_list = array(0); |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | ORDER BY userid ASC" |
| 492 | 492 | ); |
| 493 | 493 | while ($ignoring_user = db_fetch_object($ignoring_users)) { |
| 494 | - $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1); |
|
| 494 | + $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1); |
|
| 495 | 495 | } |
| 496 | 496 | $ignored_user_list = array_keys($ignored_user_list); |
| 497 | 497 | // Get IDs for all users who will need to be imported now |
@@ -507,86 +507,86 @@ discard block |
||
| 507 | 507 | (SELECT DISTINCT userid FROM {private_messages}) UNION |
| 508 | 508 | (SELECT DISTINCT senderid FROM {private_messages}) |
| 509 | 509 | ) AS usersToImport", |
| 510 | - implode(',', $ignored_user_list) |
|
| 510 | + implode(',', $ignored_user_list) |
|
| 511 | 511 | ); |
| 512 | 512 | $user_count = mysqli_num_rows($boinc_accounts); |
| 513 | - } |
|
| 514 | - db_set_active('default'); |
|
| 513 | + } |
|
| 514 | + db_set_active('default'); |
|
| 515 | 515 | |
| 516 | - if (!$user_count) { |
|
| 516 | + if (!$user_count) { |
|
| 517 | 517 | drupal_set_message( |
| 518 | - t('There were no users found: Aborting script'), 'error' |
|
| 518 | + t('There were no users found: Aborting script'), 'error' |
|
| 519 | 519 | ); |
| 520 | 520 | watchdog('boincimport', |
| 521 | - 'There were no users found: Aborting script', array(), WATCHDOG_INFO |
|
| 521 | + 'There were no users found: Aborting script', array(), WATCHDOG_INFO |
|
| 522 | 522 | ); |
| 523 | 523 | // Release the lock on the import process |
| 524 | 524 | variable_del('boincimport_process_locked'); |
| 525 | 525 | return t('There were no users found: Aborting script.'); |
| 526 | - } |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | - watchdog('boincimport', |
|
| 528 | + watchdog('boincimport', |
|
| 529 | 529 | 'Found %user_count users: Beginning import', |
| 530 | 530 | array('%user_count' => $user_count), WATCHDOG_INFO |
| 531 | - ); |
|
| 532 | - |
|
| 533 | - // User import relies on Drupal and BOINC APIs to manage data being read |
|
| 534 | - // from one database and saved to the other. This approach keeps things |
|
| 535 | - // clean and simple, but since a sizable user base will wreak havoc on system |
|
| 536 | - // resources, the job is broken into batches here and each batch is processed |
|
| 537 | - // by a separate process. |
|
| 538 | - |
|
| 539 | - //$batch_size = variable_get('boincimport_user_batch_size', 50); |
|
| 540 | - //$batch_count = $user_count - ($user_count % $batch_size) + $batch_size; |
|
| 541 | - $operations = array(); |
|
| 542 | - $existing_users = array(); |
|
| 543 | - $duplicates = array(); |
|
| 544 | - |
|
| 545 | - // Get the list of users already in Drupal to be sure we're not importing |
|
| 546 | - // any twice |
|
| 547 | - $result = db_query(' |
|
| 531 | + ); |
|
| 532 | + |
|
| 533 | + // User import relies on Drupal and BOINC APIs to manage data being read |
|
| 534 | + // from one database and saved to the other. This approach keeps things |
|
| 535 | + // clean and simple, but since a sizable user base will wreak havoc on system |
|
| 536 | + // resources, the job is broken into batches here and each batch is processed |
|
| 537 | + // by a separate process. |
|
| 538 | + |
|
| 539 | + //$batch_size = variable_get('boincimport_user_batch_size', 50); |
|
| 540 | + //$batch_count = $user_count - ($user_count % $batch_size) + $batch_size; |
|
| 541 | + $operations = array(); |
|
| 542 | + $existing_users = array(); |
|
| 543 | + $duplicates = array(); |
|
| 544 | + |
|
| 545 | + // Get the list of users already in Drupal to be sure we're not importing |
|
| 546 | + // any twice |
|
| 547 | + $result = db_query(' |
|
| 548 | 548 | SELECT uid, boinc_id FROM {boincuser}' |
| 549 | - ); |
|
| 550 | - while ($row = db_fetch_object($result)) { |
|
| 549 | + ); |
|
| 550 | + while ($row = db_fetch_object($result)) { |
|
| 551 | 551 | $existing_users[$row->boinc_id] = $row->uid; |
| 552 | - } |
|
| 552 | + } |
|
| 553 | 553 | |
| 554 | - // Create batches to process |
|
| 555 | - while ($boinc_account = db_fetch_object($boinc_accounts)) { |
|
| 556 | - if (isset($existing_users[$boinc_account->id])) { |
|
| 557 | - // This user has already been imported |
|
| 558 | - $duplicates[] = $boinc_account->id; |
|
| 554 | + // Create batches to process |
|
| 555 | + while ($boinc_account = db_fetch_object($boinc_accounts)) { |
|
| 556 | + if (isset($existing_users[$boinc_account->id])) { |
|
| 557 | + // This user has already been imported |
|
| 558 | + $duplicates[] = $boinc_account->id; |
|
| 559 | 559 | } |
| 560 | 560 | else { |
| 561 | - $operations[] = array( |
|
| 561 | + $operations[] = array( |
|
| 562 | 562 | 'boincimport_users_op', array( |
| 563 | - $boinc_account->id |
|
| 563 | + $boinc_account->id |
|
| 564 | 564 | ) |
| 565 | - ); |
|
| 565 | + ); |
|
| 566 | + } |
|
| 566 | 567 | } |
| 567 | - } |
|
| 568 | 568 | |
| 569 | - if ($duplicates) { |
|
| 569 | + if ($duplicates) { |
|
| 570 | 570 | drupal_set_message(t( |
| 571 | - 'Skipped @count accounts that were already imported', |
|
| 572 | - array('@count' => count($duplicates)) |
|
| 571 | + 'Skipped @count accounts that were already imported', |
|
| 572 | + array('@count' => count($duplicates)) |
|
| 573 | 573 | )); |
| 574 | 574 | watchdog('boincimport', |
| 575 | - 'Skipped @count accounts that were already imported', |
|
| 576 | - array('@count' => count($duplicates)), WATCHDOG_INFO |
|
| 575 | + 'Skipped @count accounts that were already imported', |
|
| 576 | + array('@count' => count($duplicates)), WATCHDOG_INFO |
|
| 577 | 577 | ); |
| 578 | - } |
|
| 578 | + } |
|
| 579 | 579 | |
| 580 | - $batch = array( |
|
| 580 | + $batch = array( |
|
| 581 | 581 | 'operations' => $operations, |
| 582 | 582 | 'finished' => 'boincimport_users_finished', |
| 583 | 583 | 'title' => t('Importing users'), |
| 584 | 584 | 'init_message' => t('Beginning user import...'), |
| 585 | 585 | 'progress_message' => t('Processed @current out of @total users.'), |
| 586 | 586 | 'error_message' => t('User import has encountered an error.'), |
| 587 | - ); |
|
| 587 | + ); |
|
| 588 | 588 | |
| 589 | - batch_set($batch); |
|
| 589 | + batch_set($batch); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | /** |
@@ -594,81 +594,81 @@ discard block |
||
| 594 | 594 | */ |
| 595 | 595 | function boincimport_users_op($boinc_id, &$context) { |
| 596 | 596 | |
| 597 | - // Use the $context['sandbox'] to store information needed to track progress |
|
| 598 | - // between successive calls. |
|
| 599 | - if (!isset($context['sandbox']['progress'])) { |
|
| 597 | + // Use the $context['sandbox'] to store information needed to track progress |
|
| 598 | + // between successive calls. |
|
| 599 | + if (!isset($context['sandbox']['progress'])) { |
|
| 600 | 600 | $context['sandbox']['progress'] = 0; |
| 601 | 601 | $context['sandbox']['current_user'] = 0; |
| 602 | 602 | $context['sandbox']['max'] = 1; |
| 603 | - } |
|
| 603 | + } |
|
| 604 | 604 | |
| 605 | - // Note about batch size: When a batch is processed, the batch update engine |
|
| 606 | - // determines whether it should continue processing in the same request or |
|
| 607 | - // provide progress feedback to the user and wait for the next request. |
|
| 605 | + // Note about batch size: When a batch is processed, the batch update engine |
|
| 606 | + // determines whether it should continue processing in the same request or |
|
| 607 | + // provide progress feedback to the user and wait for the next request. |
|
| 608 | 608 | |
| 609 | - // Grab the BOINC user object and create a Drupal user from it |
|
| 610 | - $account = boincuser_register_make_drupal_user($boinc_id); |
|
| 611 | - $message = ''; |
|
| 612 | - if ($account) { |
|
| 609 | + // Grab the BOINC user object and create a Drupal user from it |
|
| 610 | + $account = boincuser_register_make_drupal_user($boinc_id); |
|
| 611 | + $message = ''; |
|
| 612 | + if ($account) { |
|
| 613 | 613 | // Store some result for post-processing in the finished callback. |
| 614 | 614 | $context['results']['success'][] = $boinc_id; |
| 615 | 615 | $message = "Successfully imported user {$boinc_id}"; |
| 616 | - } |
|
| 617 | - else { |
|
| 616 | + } |
|
| 617 | + else { |
|
| 618 | 618 | $context['results']['failure'][] = $boinc_id; |
| 619 | 619 | $message = "Failed to import user {$boinc_id}!"; |
| 620 | 620 | watchdog('boincimport', |
| 621 | - 'Failed to import user @id!', |
|
| 622 | - array('@id' => $boinc_id), WATCHDOG_WARNING |
|
| 621 | + 'Failed to import user @id!', |
|
| 622 | + array('@id' => $boinc_id), WATCHDOG_WARNING |
|
| 623 | 623 | ); |
| 624 | - } |
|
| 624 | + } |
|
| 625 | 625 | |
| 626 | - // Update our progress information. |
|
| 627 | - $context['sandbox']['progress']++; |
|
| 628 | - $context['sandbox']['current_user'] = $boinc_id; |
|
| 629 | - $context['message'] = $message; |
|
| 626 | + // Update our progress information. |
|
| 627 | + $context['sandbox']['progress']++; |
|
| 628 | + $context['sandbox']['current_user'] = $boinc_id; |
|
| 629 | + $context['message'] = $message; |
|
| 630 | 630 | |
| 631 | - // Update the progress for the batch engine |
|
| 632 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 631 | + // Update the progress for the batch engine |
|
| 632 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 633 | 633 | $context['finished'] = 1; |
| 634 | - } |
|
| 635 | - else { |
|
| 634 | + } |
|
| 635 | + else { |
|
| 636 | 636 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 637 | - } |
|
| 637 | + } |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | /** |
| 641 | 641 | * Batch 'finished' callback |
| 642 | 642 | */ |
| 643 | 643 | function boincimport_users_finished($success, $results, $operations) { |
| 644 | - if ($success) { |
|
| 644 | + if ($success) { |
|
| 645 | 645 | // Let's count our successes |
| 646 | 646 | $total_imported = count($results['success']); |
| 647 | 647 | $total_failures = count($results['failure']); |
| 648 | 648 | $message = t( |
| 649 | - 'Successfully imported @count users (@fail_count failures)', |
|
| 650 | - array('@count' => $total_imported, '@fail_count' => $total_failures) |
|
| 649 | + 'Successfully imported @count users (@fail_count failures)', |
|
| 650 | + array('@count' => $total_imported, '@fail_count' => $total_failures) |
|
| 651 | 651 | ); |
| 652 | 652 | watchdog('boincimport', |
| 653 | - 'Successfully imported @count users (@fail_count failures).', |
|
| 654 | - array('@count' => $total_imported, '@fail_count' => $total_failures), |
|
| 655 | - WATCHDOG_INFO |
|
| 653 | + 'Successfully imported @count users (@fail_count failures).', |
|
| 654 | + array('@count' => $total_imported, '@fail_count' => $total_failures), |
|
| 655 | + WATCHDOG_INFO |
|
| 656 | 656 | ); |
| 657 | 657 | // Set the user import successful flag in the variable table |
| 658 | 658 | variable_set('boincimport_import_user_successful', '1'); |
| 659 | 659 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 660 | - } |
|
| 661 | - else { |
|
| 660 | + } |
|
| 661 | + else { |
|
| 662 | 662 | // An error occurred. |
| 663 | 663 | // $operations contains the operations that remained unprocessed. |
| 664 | 664 | $error_operation = reset($operations); |
| 665 | 665 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 666 | - } |
|
| 667 | - drupal_set_message($message); |
|
| 666 | + } |
|
| 667 | + drupal_set_message($message); |
|
| 668 | 668 | |
| 669 | - // Release the lock on the import process |
|
| 670 | - variable_del('boincimport_process_locked'); |
|
| 671 | - drupal_goto('admin/boinc/import/process'); |
|
| 669 | + // Release the lock on the import process |
|
| 670 | + variable_del('boincimport_process_locked'); |
|
| 671 | + drupal_goto('admin/boinc/import/process'); |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | |
@@ -681,23 +681,23 @@ discard block |
||
| 681 | 681 | */ |
| 682 | 682 | function boincimport_teams() { |
| 683 | 683 | |
| 684 | - // Check whether the team table has been successfully imported already |
|
| 685 | - if (variable_get('boincimport_import_team_successful', 0)) { |
|
| 684 | + // Check whether the team table has been successfully imported already |
|
| 685 | + if (variable_get('boincimport_import_team_successful', 0)) { |
|
| 686 | 686 | drupal_set_message(t('Note: team import has already run successfully')); |
| 687 | 687 | watchdog( |
| 688 | - 'boincimport', 'Note: team import has already run successfully', |
|
| 689 | - array(), WATCHDOG_INFO |
|
| 688 | + 'boincimport', 'Note: team import has already run successfully', |
|
| 689 | + array(), WATCHDOG_INFO |
|
| 690 | 690 | ); |
| 691 | - } |
|
| 691 | + } |
|
| 692 | 692 | |
| 693 | - if (!variable_get('boincimport_import_team_started', 0)) { |
|
| 693 | + if (!variable_get('boincimport_import_team_started', 0)) { |
|
| 694 | 694 | // Could prepare database tables, if new fields are necessary, etc. |
| 695 | 695 | variable_set('boincimport_import_team_started', 1); |
| 696 | - } |
|
| 696 | + } |
|
| 697 | 697 | |
| 698 | - // Initialize the map of BOINC team types to taxonomy IDs, if needed |
|
| 699 | - $team_type_map = variable_get('boincimport_team_types', array()); |
|
| 700 | - if (!$team_type_map) { |
|
| 698 | + // Initialize the map of BOINC team types to taxonomy IDs, if needed |
|
| 699 | + $team_type_map = variable_get('boincimport_team_types', array()); |
|
| 700 | + if (!$team_type_map) { |
|
| 701 | 701 | // Import team types from BOINC to a Drupal vocabulary |
| 702 | 702 | require_boinc('team_types'); |
| 703 | 703 | global $team_types; |
@@ -705,112 +705,112 @@ discard block |
||
| 705 | 705 | // Create vocabulary if it isn't set |
| 706 | 706 | $team_vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name="%s"', 'Teams')); |
| 707 | 707 | if (!$team_vid) { |
| 708 | - $team_vocab = array( |
|
| 708 | + $team_vocab = array( |
|
| 709 | 709 | 'name' => t('Teams'), |
| 710 | 710 | 'description' => t('Types of BOINC teams'), |
| 711 | - ); |
|
| 712 | - taxonomy_save_vocabulary($team_vocab); |
|
| 713 | - $team_vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name="%s"', 'Teams')); |
|
| 711 | + ); |
|
| 712 | + taxonomy_save_vocabulary($team_vocab); |
|
| 713 | + $team_vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name="%s"', 'Teams')); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | foreach ($team_types as $boinc_type_id => $name) { |
| 717 | - // Check for an existing term in the vocabulary |
|
| 718 | - $team_type_id = db_result(db_query("SELECT tid FROM {term_data} WHERE vid = '{$team_vid}' AND LOWER(name) = LOWER('%s')", trim($name))); |
|
| 719 | - if ($team_type_id) { |
|
| 717 | + // Check for an existing term in the vocabulary |
|
| 718 | + $team_type_id = db_result(db_query("SELECT tid FROM {term_data} WHERE vid = '{$team_vid}' AND LOWER(name) = LOWER('%s')", trim($name))); |
|
| 719 | + if ($team_type_id) { |
|
| 720 | 720 | $team_type = array( |
| 721 | - 'tid' => $team_type_id |
|
| 721 | + 'tid' => $team_type_id |
|
| 722 | 722 | ); |
| 723 | - } |
|
| 724 | - else { |
|
| 723 | + } |
|
| 724 | + else { |
|
| 725 | 725 | if (!$name) continue; |
| 726 | 726 | $team_type = array( |
| 727 | - 'name' => strip_tags($name), |
|
| 728 | - 'vid' => $team_vid, |
|
| 729 | - 'description' => '', |
|
| 730 | - 'parent' => 0 |
|
| 727 | + 'name' => strip_tags($name), |
|
| 728 | + 'vid' => $team_vid, |
|
| 729 | + 'description' => '', |
|
| 730 | + 'parent' => 0 |
|
| 731 | 731 | ); |
| 732 | 732 | taxonomy_save_term($team_type); |
| 733 | - } |
|
| 734 | - // Note the taxonomy ID for mapping forums to categories |
|
| 735 | - $team_type_map[$boinc_type_id] = $team_type['tid']; |
|
| 733 | + } |
|
| 734 | + // Note the taxonomy ID for mapping forums to categories |
|
| 735 | + $team_type_map[$boinc_type_id] = $team_type['tid']; |
|
| 736 | 736 | } |
| 737 | 737 | variable_set('boincimport_team_types', $team_type_map); |
| 738 | - } |
|
| 738 | + } |
|
| 739 | 739 | |
| 740 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 740 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 741 | 741 | |
| 742 | - // Get the list of teams to import |
|
| 743 | - db_set_active('boinc_rw'); |
|
| 744 | - $boinc_teams = db_query(' |
|
| 742 | + // Get the list of teams to import |
|
| 743 | + db_set_active('boinc_rw'); |
|
| 744 | + $boinc_teams = db_query(' |
|
| 745 | 745 | SELECT id, name, description, userid, create_time |
| 746 | 746 | FROM %steam', |
| 747 | 747 | $pre |
| 748 | - ); |
|
| 749 | - $team_count = mysqli_num_rows($boinc_teams); |
|
| 750 | - db_set_active('default'); |
|
| 748 | + ); |
|
| 749 | + $team_count = mysqli_num_rows($boinc_teams); |
|
| 750 | + db_set_active('default'); |
|
| 751 | 751 | |
| 752 | - if (!$team_count) { |
|
| 752 | + if (!$team_count) { |
|
| 753 | 753 | drupal_set_message( |
| 754 | - t('There were no teams found: Aborting script'), 'error' |
|
| 754 | + t('There were no teams found: Aborting script'), 'error' |
|
| 755 | 755 | ); |
| 756 | 756 | watchdog('boincimport', |
| 757 | - 'There were no teams found: Aborting script', array(), WATCHDOG_INFO |
|
| 757 | + 'There were no teams found: Aborting script', array(), WATCHDOG_INFO |
|
| 758 | 758 | ); |
| 759 | 759 | // Release the lock on the import process |
| 760 | 760 | variable_del('boincimport_process_locked'); |
| 761 | 761 | return t('There were no teams found: Aborting script.'); |
| 762 | - } |
|
| 762 | + } |
|
| 763 | 763 | |
| 764 | - watchdog('boincimport', |
|
| 764 | + watchdog('boincimport', |
|
| 765 | 765 | 'Found %team_count teams: Beginning Import', |
| 766 | 766 | array('%team_count' => $team_count), WATCHDOG_INFO |
| 767 | - ); |
|
| 767 | + ); |
|
| 768 | 768 | |
| 769 | - $operations = array(); |
|
| 770 | - $existing_teams = array(); |
|
| 771 | - $duplicates = array(); |
|
| 769 | + $operations = array(); |
|
| 770 | + $existing_teams = array(); |
|
| 771 | + $duplicates = array(); |
|
| 772 | 772 | |
| 773 | - // Get the list of teams already in Drupal to be sure we're not importing |
|
| 774 | - // any twice |
|
| 775 | - $result = db_query(' |
|
| 773 | + // Get the list of teams already in Drupal to be sure we're not importing |
|
| 774 | + // any twice |
|
| 775 | + $result = db_query(' |
|
| 776 | 776 | SELECT nid, team_id FROM {boincteam}' |
| 777 | - ); |
|
| 778 | - while ($row = db_fetch_object($result)) { |
|
| 777 | + ); |
|
| 778 | + while ($row = db_fetch_object($result)) { |
|
| 779 | 779 | $existing_teams[$row->team_id] = $row->nid; |
| 780 | - } |
|
| 780 | + } |
|
| 781 | 781 | |
| 782 | - // Create batches to process |
|
| 783 | - while ($boinc_team = db_fetch_object($boinc_teams)) { |
|
| 784 | - if (isset($existing_teams[$boinc_team->id])) { |
|
| 785 | - // This team has already been imported |
|
| 786 | - $duplicates[] = $boinc_team->id; |
|
| 782 | + // Create batches to process |
|
| 783 | + while ($boinc_team = db_fetch_object($boinc_teams)) { |
|
| 784 | + if (isset($existing_teams[$boinc_team->id])) { |
|
| 785 | + // This team has already been imported |
|
| 786 | + $duplicates[] = $boinc_team->id; |
|
| 787 | 787 | } |
| 788 | 788 | else { |
| 789 | - $operations[] = array( |
|
| 789 | + $operations[] = array( |
|
| 790 | 790 | 'boincimport_teams_op', array( |
| 791 | - $boinc_team |
|
| 791 | + $boinc_team |
|
| 792 | 792 | ) |
| 793 | - ); |
|
| 793 | + ); |
|
| 794 | + } |
|
| 794 | 795 | } |
| 795 | - } |
|
| 796 | 796 | |
| 797 | - if ($duplicates) { |
|
| 797 | + if ($duplicates) { |
|
| 798 | 798 | drupal_set_message(t( |
| 799 | - 'Skipped @count teams that were already imported', |
|
| 800 | - array('@count' => count($duplicates)) |
|
| 799 | + 'Skipped @count teams that were already imported', |
|
| 800 | + array('@count' => count($duplicates)) |
|
| 801 | 801 | )); |
| 802 | - } |
|
| 802 | + } |
|
| 803 | 803 | |
| 804 | - $batch = array( |
|
| 804 | + $batch = array( |
|
| 805 | 805 | 'operations' => $operations, |
| 806 | 806 | 'finished' => 'boincimport_teams_finished', |
| 807 | 807 | 'title' => t('Importing teams'), |
| 808 | 808 | 'init_message' => t('Beginning team import...'), |
| 809 | 809 | 'progress_message' => t('Processed @current out of @total teams.'), |
| 810 | 810 | 'error_message' => t('Team import has encountered an error.'), |
| 811 | - ); |
|
| 811 | + ); |
|
| 812 | 812 | |
| 813 | - batch_set($batch); |
|
| 813 | + batch_set($batch); |
|
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | /** |
@@ -819,67 +819,67 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | function boincimport_teams_op($boincteam, &$context) { |
| 821 | 821 | |
| 822 | - $success = boincteam_import($boincteam); |
|
| 822 | + $success = boincteam_import($boincteam); |
|
| 823 | 823 | |
| 824 | - $message = ''; |
|
| 825 | - if ($success) { |
|
| 824 | + $message = ''; |
|
| 825 | + if ($success) { |
|
| 826 | 826 | // Store some result for post-processing in the finished callback. |
| 827 | 827 | $context['results']['success'][] = $boincteam->id; |
| 828 | 828 | $message = "Successfully imported team {$boincteam->id}"; |
| 829 | - } |
|
| 830 | - else { |
|
| 829 | + } |
|
| 830 | + else { |
|
| 831 | 831 | $context['results']['failure'][] = $boincteam->id; |
| 832 | 832 | $message = "Failed to import team {$boincteam->id}!"; |
| 833 | 833 | watchdog('boincimport', |
| 834 | - 'Failed to import team @id!', |
|
| 835 | - array('@id' => $boincteam->id), WATCHDOG_WARNING |
|
| 834 | + 'Failed to import team @id!', |
|
| 835 | + array('@id' => $boincteam->id), WATCHDOG_WARNING |
|
| 836 | 836 | ); |
| 837 | - } |
|
| 837 | + } |
|
| 838 | 838 | |
| 839 | - // Update our progress information. |
|
| 840 | - $context['sandbox']['progress']++; |
|
| 841 | - $context['sandbox']['current_team'] = $boincteam->id; |
|
| 842 | - $context['message'] = $message; |
|
| 839 | + // Update our progress information. |
|
| 840 | + $context['sandbox']['progress']++; |
|
| 841 | + $context['sandbox']['current_team'] = $boincteam->id; |
|
| 842 | + $context['message'] = $message; |
|
| 843 | 843 | |
| 844 | - // Update the progress for the batch engine |
|
| 845 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 844 | + // Update the progress for the batch engine |
|
| 845 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 846 | 846 | $context['finished'] = 1; |
| 847 | - } |
|
| 848 | - else { |
|
| 847 | + } |
|
| 848 | + else { |
|
| 849 | 849 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 850 | - } |
|
| 850 | + } |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | /** |
| 854 | 854 | * Batch 'finished' callback |
| 855 | 855 | */ |
| 856 | 856 | function boincimport_teams_finished($success, $results, $operations) { |
| 857 | - if ($success) { |
|
| 857 | + if ($success) { |
|
| 858 | 858 | // Let's count our successes |
| 859 | 859 | $total_imported = count($results['success']); |
| 860 | 860 | $message = t( |
| 861 | - 'Successfully imported @count teams', |
|
| 862 | - array('@count' => $total_imported) |
|
| 861 | + 'Successfully imported @count teams', |
|
| 862 | + array('@count' => $total_imported) |
|
| 863 | 863 | ); |
| 864 | 864 | watchdog('boincimport', |
| 865 | - 'Successfully imported @count teams.', |
|
| 866 | - array('@count' => $total_imported), WATCHDOG_INFO |
|
| 865 | + 'Successfully imported @count teams.', |
|
| 866 | + array('@count' => $total_imported), WATCHDOG_INFO |
|
| 867 | 867 | ); |
| 868 | 868 | // Set the team import successful flag in the variable table |
| 869 | 869 | variable_set('boincimport_import_team_successful', '1'); |
| 870 | 870 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 871 | - } |
|
| 872 | - else { |
|
| 871 | + } |
|
| 872 | + else { |
|
| 873 | 873 | // An error occurred. |
| 874 | 874 | // $operations contains the operations that remained unprocessed. |
| 875 | 875 | $error_operation = reset($operations); |
| 876 | 876 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 877 | - } |
|
| 878 | - drupal_set_message($message); |
|
| 877 | + } |
|
| 878 | + drupal_set_message($message); |
|
| 879 | 879 | |
| 880 | - // Release the lock on the import process |
|
| 881 | - variable_del('boincimport_process_locked'); |
|
| 882 | - drupal_goto('admin/boinc/import/process'); |
|
| 880 | + // Release the lock on the import process |
|
| 881 | + variable_del('boincimport_process_locked'); |
|
| 882 | + drupal_goto('admin/boinc/import/process'); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | |
@@ -892,25 +892,25 @@ discard block |
||
| 892 | 892 | */ |
| 893 | 893 | function boincimport_friends() { |
| 894 | 894 | |
| 895 | - // Check whether friendships have been successfully imported already |
|
| 896 | - if (variable_get('boincimport_import_friend_successful', 0)) { |
|
| 895 | + // Check whether friendships have been successfully imported already |
|
| 896 | + if (variable_get('boincimport_import_friend_successful', 0)) { |
|
| 897 | 897 | drupal_set_message(t('Note: Friends import has already run successfully')); |
| 898 | 898 | watchdog( |
| 899 | - 'boincimport', 'Note: Friends import has already run successfully', |
|
| 900 | - array(), WATCHDOG_INFO |
|
| 899 | + 'boincimport', 'Note: Friends import has already run successfully', |
|
| 900 | + array(), WATCHDOG_INFO |
|
| 901 | 901 | ); |
| 902 | - } |
|
| 902 | + } |
|
| 903 | 903 | |
| 904 | - if (!variable_get('boincimport_import_friend_started', 0)) { |
|
| 904 | + if (!variable_get('boincimport_import_friend_started', 0)) { |
|
| 905 | 905 | // Could prepare database tables, if new fields are necessary, etc. |
| 906 | 906 | variable_set('boincimport_import_friend_started', 1); |
| 907 | - } |
|
| 907 | + } |
|
| 908 | 908 | |
| 909 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 909 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 910 | 910 | |
| 911 | - // Get stuff to import |
|
| 912 | - db_set_active('boinc_rw'); |
|
| 913 | - $friendships = db_query(' |
|
| 911 | + // Get stuff to import |
|
| 912 | + db_set_active('boinc_rw'); |
|
| 913 | + $friendships = db_query(' |
|
| 914 | 914 | SELECT |
| 915 | 915 | f1.user_src, |
| 916 | 916 | f1.user_dest, |
@@ -924,51 +924,51 @@ discard block |
||
| 924 | 924 | AND (f2.user_src IS NULL OR f1.create_time < f2.create_time) |
| 925 | 925 | ORDER BY create_time', |
| 926 | 926 | $pre, $pre |
| 927 | - ); |
|
| 928 | - $friendship_count = mysqli_num_rows($friendships); |
|
| 929 | - db_set_active('default'); |
|
| 927 | + ); |
|
| 928 | + $friendship_count = mysqli_num_rows($friendships); |
|
| 929 | + db_set_active('default'); |
|
| 930 | 930 | |
| 931 | - if (!$friendship_count) { |
|
| 931 | + if (!$friendship_count) { |
|
| 932 | 932 | drupal_set_message( |
| 933 | - t('There were no friendships found: Aborting script'), 'error' |
|
| 933 | + t('There were no friendships found: Aborting script'), 'error' |
|
| 934 | 934 | ); |
| 935 | 935 | watchdog('boincimport', |
| 936 | - 'There were no friendships found: Aborting script', array(), WATCHDOG_INFO |
|
| 936 | + 'There were no friendships found: Aborting script', array(), WATCHDOG_INFO |
|
| 937 | 937 | ); |
| 938 | 938 | // Release the lock on the import process |
| 939 | 939 | variable_del('boincimport_process_locked'); |
| 940 | 940 | return t('There were no friendships found: Aborting script.'); |
| 941 | - } |
|
| 941 | + } |
|
| 942 | 942 | |
| 943 | - watchdog('boincimport', |
|
| 943 | + watchdog('boincimport', |
|
| 944 | 944 | 'Found %count friend relationships: Beginning Import', |
| 945 | 945 | array('%count' => $friendship_count), WATCHDOG_INFO |
| 946 | - ); |
|
| 946 | + ); |
|
| 947 | 947 | |
| 948 | - $operations = array(); |
|
| 948 | + $operations = array(); |
|
| 949 | 949 | |
| 950 | - // It doesn't matter if a friend relationship has already been imported, just |
|
| 951 | - // do it again if so |
|
| 950 | + // It doesn't matter if a friend relationship has already been imported, just |
|
| 951 | + // do it again if so |
|
| 952 | 952 | |
| 953 | - // Create batches to process |
|
| 954 | - while ($friendship = db_fetch_object($friendships)) { |
|
| 953 | + // Create batches to process |
|
| 954 | + while ($friendship = db_fetch_object($friendships)) { |
|
| 955 | 955 | $operations[] = array( |
| 956 | - 'boincimport_friends_op', array( |
|
| 956 | + 'boincimport_friends_op', array( |
|
| 957 | 957 | $friendship |
| 958 | - ) |
|
| 958 | + ) |
|
| 959 | 959 | ); |
| 960 | - } |
|
| 960 | + } |
|
| 961 | 961 | |
| 962 | - $batch = array( |
|
| 962 | + $batch = array( |
|
| 963 | 963 | 'operations' => $operations, |
| 964 | 964 | 'finished' => 'boincimport_friends_finished', |
| 965 | 965 | 'title' => t('Importing friend relationships'), |
| 966 | 966 | 'init_message' => t('Beginning friend import...'), |
| 967 | 967 | 'progress_message' => t('Processed @current out of @total friendships.'), |
| 968 | 968 | 'error_message' => t('Friend import has encountered an error.'), |
| 969 | - ); |
|
| 969 | + ); |
|
| 970 | 970 | |
| 971 | - batch_set($batch); |
|
| 971 | + batch_set($batch); |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | /** |
@@ -977,83 +977,83 @@ discard block |
||
| 977 | 977 | */ |
| 978 | 978 | function boincimport_friends_op($friendship, &$context) { |
| 979 | 979 | |
| 980 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 981 | - $success = FALSE; |
|
| 982 | - $message = ''; |
|
| 980 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 981 | + $success = FALSE; |
|
| 982 | + $message = ''; |
|
| 983 | 983 | |
| 984 | - // Convert BOINC friends to Drupal friends |
|
| 985 | - $uid = boincuser_lookup_uid($friendship->user_src); |
|
| 986 | - $friend_uid = boincuser_lookup_uid($friendship->user_dest); |
|
| 987 | - if ($uid AND $friend_uid) { |
|
| 984 | + // Convert BOINC friends to Drupal friends |
|
| 985 | + $uid = boincuser_lookup_uid($friendship->user_src); |
|
| 986 | + $friend_uid = boincuser_lookup_uid($friendship->user_dest); |
|
| 987 | + if ($uid AND $friend_uid) { |
|
| 988 | 988 | $success = db_query(" |
| 989 | 989 | INSERT IGNORE INTO {flag_friend} |
| 990 | 990 | SET uid = '%d', friend_uid = '%d', created = '%d'", |
| 991 | - $uid, $friend_uid, $friendship->create_time |
|
| 991 | + $uid, $friend_uid, $friendship->create_time |
|
| 992 | 992 | ); |
| 993 | - } |
|
| 994 | - else { |
|
| 993 | + } |
|
| 994 | + else { |
|
| 995 | 995 | $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src; |
| 996 | 996 | $message = "No Drupal account exists for BOINC user {$boinc_id}!"; |
| 997 | - } |
|
| 997 | + } |
|
| 998 | 998 | |
| 999 | - if ($success) { |
|
| 999 | + if ($success) { |
|
| 1000 | 1000 | // Store some result for post-processing in the finished callback. |
| 1001 | 1001 | $context['results']['success'][] = $uid; |
| 1002 | 1002 | $message = "Successfully made users {$uid} and {$friend_uid} friends"; |
| 1003 | - } |
|
| 1004 | - else { |
|
| 1003 | + } |
|
| 1004 | + else { |
|
| 1005 | 1005 | $context['results']['failure'][] = $uid; |
| 1006 | 1006 | if (!$message) { |
| 1007 | - $message = "Failed to make users {$uid} and {$friend_uid} friends!"; |
|
| 1007 | + $message = "Failed to make users {$uid} and {$friend_uid} friends!"; |
|
| 1008 | 1008 | } |
| 1009 | 1009 | watchdog('boincimport', $message, array(), WATCHDOG_WARNING); |
| 1010 | - } |
|
| 1010 | + } |
|
| 1011 | 1011 | |
| 1012 | - // Update our progress information. |
|
| 1013 | - $context['sandbox']['progress']++; |
|
| 1014 | - $context['sandbox']['current_user'] = $uid; |
|
| 1015 | - $context['message'] = $message; |
|
| 1012 | + // Update our progress information. |
|
| 1013 | + $context['sandbox']['progress']++; |
|
| 1014 | + $context['sandbox']['current_user'] = $uid; |
|
| 1015 | + $context['message'] = $message; |
|
| 1016 | 1016 | |
| 1017 | - // Update the progress for the batch engine |
|
| 1018 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1017 | + // Update the progress for the batch engine |
|
| 1018 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1019 | 1019 | $context['finished'] = 1; |
| 1020 | - } |
|
| 1021 | - else { |
|
| 1020 | + } |
|
| 1021 | + else { |
|
| 1022 | 1022 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1023 | - } |
|
| 1023 | + } |
|
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | /** |
| 1027 | 1027 | * Batch 'finished' callback |
| 1028 | 1028 | */ |
| 1029 | 1029 | function boincimport_friends_finished($success, $results, $operations) { |
| 1030 | - if ($success) { |
|
| 1030 | + if ($success) { |
|
| 1031 | 1031 | // Let's count our successes |
| 1032 | 1032 | $total_imported = count($results['success']); |
| 1033 | 1033 | $failures = count($results['failure']); |
| 1034 | 1034 | $message = t( |
| 1035 | - 'Successfully imported @count friendships (@failed failures)', |
|
| 1036 | - array( |
|
| 1035 | + 'Successfully imported @count friendships (@failed failures)', |
|
| 1036 | + array( |
|
| 1037 | 1037 | '@count' => $total_imported, |
| 1038 | 1038 | '@failed' => $failures, |
| 1039 | - ) |
|
| 1039 | + ) |
|
| 1040 | 1040 | ); |
| 1041 | 1041 | watchdog('boincimport', $message, array(), WATCHDOG_INFO); |
| 1042 | 1042 | // Set the friend import successful flag in the variable table |
| 1043 | 1043 | variable_set('boincimport_import_friend_successful', '1'); |
| 1044 | 1044 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 1045 | - } |
|
| 1046 | - else { |
|
| 1045 | + } |
|
| 1046 | + else { |
|
| 1047 | 1047 | // An error occurred. |
| 1048 | 1048 | // $operations contains the operations that remained unprocessed. |
| 1049 | 1049 | $error_operation = reset($operations); |
| 1050 | 1050 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 1051 | - } |
|
| 1052 | - drupal_set_message($message); |
|
| 1051 | + } |
|
| 1052 | + drupal_set_message($message); |
|
| 1053 | 1053 | |
| 1054 | - // Release the lock on the import process |
|
| 1055 | - variable_del('boincimport_process_locked'); |
|
| 1056 | - drupal_goto('admin/boinc/import/process'); |
|
| 1054 | + // Release the lock on the import process |
|
| 1055 | + variable_del('boincimport_process_locked'); |
|
| 1056 | + drupal_goto('admin/boinc/import/process'); |
|
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | |
@@ -1066,78 +1066,78 @@ discard block |
||
| 1066 | 1066 | */ |
| 1067 | 1067 | function boincimport_preferences() { |
| 1068 | 1068 | |
| 1069 | - // Check whether preferences have been successfully imported already |
|
| 1070 | - if (variable_get('boincimport_import_preferences_successful', 0)) { |
|
| 1069 | + // Check whether preferences have been successfully imported already |
|
| 1070 | + if (variable_get('boincimport_import_preferences_successful', 0)) { |
|
| 1071 | 1071 | drupal_set_message(t('Note: preferences import has already run successfully')); |
| 1072 | 1072 | watchdog( |
| 1073 | - 'boincimport', 'Note: preferences import has already run successfully', |
|
| 1074 | - array(), WATCHDOG_INFO |
|
| 1073 | + 'boincimport', 'Note: preferences import has already run successfully', |
|
| 1074 | + array(), WATCHDOG_INFO |
|
| 1075 | 1075 | ); |
| 1076 | - } |
|
| 1076 | + } |
|
| 1077 | 1077 | |
| 1078 | - if (!variable_get('boincimport_import_preferences_started', 0)) { |
|
| 1078 | + if (!variable_get('boincimport_import_preferences_started', 0)) { |
|
| 1079 | 1079 | // Could prepare database tables, if new fields are necessary, etc. |
| 1080 | 1080 | variable_set('boincimport_import_preferences_started', 1); |
| 1081 | - } |
|
| 1081 | + } |
|
| 1082 | 1082 | |
| 1083 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1083 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1084 | 1084 | |
| 1085 | - // Currently the only preferences being imported are BOINC "filtered users" |
|
| 1086 | - // This concept of users blocking other users when they don't get along maps |
|
| 1087 | - // to the Drupal ignore users module |
|
| 1085 | + // Currently the only preferences being imported are BOINC "filtered users" |
|
| 1086 | + // This concept of users blocking other users when they don't get along maps |
|
| 1087 | + // to the Drupal ignore users module |
|
| 1088 | 1088 | |
| 1089 | - // Find users who are involved in quarrels |
|
| 1090 | - db_set_active('boinc_rw'); |
|
| 1091 | - $quarrelers = db_query(" |
|
| 1089 | + // Find users who are involved in quarrels |
|
| 1090 | + db_set_active('boinc_rw'); |
|
| 1091 | + $quarrelers = db_query(" |
|
| 1092 | 1092 | SELECT userid, ignorelist |
| 1093 | 1093 | FROM %sforum_preferences |
| 1094 | 1094 | WHERE ignorelist <> ''", |
| 1095 | 1095 | $pre |
| 1096 | - ); |
|
| 1097 | - $quarreler_count = mysqli_num_rows($quarrelers); |
|
| 1098 | - db_set_active('default'); |
|
| 1096 | + ); |
|
| 1097 | + $quarreler_count = mysqli_num_rows($quarrelers); |
|
| 1098 | + db_set_active('default'); |
|
| 1099 | 1099 | |
| 1100 | - if (!$quarreler_count) { |
|
| 1100 | + if (!$quarreler_count) { |
|
| 1101 | 1101 | drupal_set_message( |
| 1102 | - t('There were no quarrels found: Moving on...') |
|
| 1102 | + t('There were no quarrels found: Moving on...') |
|
| 1103 | 1103 | ); |
| 1104 | 1104 | watchdog('boincimport', |
| 1105 | - 'There were no quarrels found: Moving on...', array(), WATCHDOG_INFO |
|
| 1105 | + 'There were no quarrels found: Moving on...', array(), WATCHDOG_INFO |
|
| 1106 | 1106 | ); |
| 1107 | 1107 | // Release the lock on the import process |
| 1108 | 1108 | variable_del('boincimport_process_locked'); |
| 1109 | 1109 | return t('There were no quarrels found: Moving on...'); |
| 1110 | - } |
|
| 1110 | + } |
|
| 1111 | 1111 | |
| 1112 | - watchdog('boincimport', |
|
| 1112 | + watchdog('boincimport', |
|
| 1113 | 1113 | 'Found %count quarreling users: Beginning Import', |
| 1114 | 1114 | array('%count' => $quarreler_count), WATCHDOG_INFO |
| 1115 | - ); |
|
| 1115 | + ); |
|
| 1116 | 1116 | |
| 1117 | - $operations = array(); |
|
| 1117 | + $operations = array(); |
|
| 1118 | 1118 | |
| 1119 | - // It doesn't matter if a filtered user preference has already been imported, |
|
| 1120 | - // just do it again if so |
|
| 1119 | + // It doesn't matter if a filtered user preference has already been imported, |
|
| 1120 | + // just do it again if so |
|
| 1121 | 1121 | |
| 1122 | - // Create batches to process |
|
| 1123 | - while ($quarreler = db_fetch_object($quarrelers)) { |
|
| 1122 | + // Create batches to process |
|
| 1123 | + while ($quarreler = db_fetch_object($quarrelers)) { |
|
| 1124 | 1124 | $operations[] = array( |
| 1125 | - 'boincimport_quarrels_op', array( |
|
| 1125 | + 'boincimport_quarrels_op', array( |
|
| 1126 | 1126 | $quarreler |
| 1127 | - ) |
|
| 1127 | + ) |
|
| 1128 | 1128 | ); |
| 1129 | - } |
|
| 1129 | + } |
|
| 1130 | 1130 | |
| 1131 | - $batch = array( |
|
| 1131 | + $batch = array( |
|
| 1132 | 1132 | 'operations' => $operations, |
| 1133 | 1133 | 'finished' => 'boincimport_preferences_finished', |
| 1134 | 1134 | 'title' => t('Importing preferences'), |
| 1135 | 1135 | 'init_message' => t('Beginning preference import...'), |
| 1136 | 1136 | 'progress_message' => t('Processed @current out of @total preferences.'), |
| 1137 | 1137 | 'error_message' => t('Preference import has encountered an error.'), |
| 1138 | - ); |
|
| 1138 | + ); |
|
| 1139 | 1139 | |
| 1140 | - batch_set($batch); |
|
| 1140 | + batch_set($batch); |
|
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | 1143 | /** |
@@ -1146,99 +1146,99 @@ discard block |
||
| 1146 | 1146 | */ |
| 1147 | 1147 | function boincimport_quarrels_op($boinc_user, &$context) { |
| 1148 | 1148 | |
| 1149 | - $success = FALSE; |
|
| 1150 | - $uid = boincuser_lookup_uid($boinc_user->userid); |
|
| 1151 | - $ignored_users = explode('|', trim($boinc_user->ignorelist, '|')); |
|
| 1152 | - foreach ($ignored_users as $ignored_user) { |
|
| 1149 | + $success = FALSE; |
|
| 1150 | + $uid = boincuser_lookup_uid($boinc_user->userid); |
|
| 1151 | + $ignored_users = explode('|', trim($boinc_user->ignorelist, '|')); |
|
| 1152 | + foreach ($ignored_users as $ignored_user) { |
|
| 1153 | 1153 | $ignored_user_uid = boincuser_lookup_uid($ignored_user); |
| 1154 | 1154 | if (!$ignored_user_uid) { |
| 1155 | - $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
|
| 1156 | - watchdog('boincimport', |
|
| 1155 | + $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
|
| 1156 | + watchdog('boincimport', |
|
| 1157 | 1157 | 'Error adding to ignore list of user @uid: No Drupal ID found for BOINC user @boinc_id', |
| 1158 | 1158 | array('@boinc_id' => $ignored_user, '@uid' => $uid), |
| 1159 | 1159 | WATCHDOG_WARNING |
| 1160 | - ); |
|
| 1161 | - continue; |
|
| 1160 | + ); |
|
| 1161 | + continue; |
|
| 1162 | 1162 | } |
| 1163 | 1163 | $user_ignored = db_query(" |
| 1164 | 1164 | INSERT IGNORE INTO {ignore_user} |
| 1165 | 1165 | SET uid = '%d', iuid = '%d'", |
| 1166 | - $uid, $ignored_user_uid |
|
| 1166 | + $uid, $ignored_user_uid |
|
| 1167 | 1167 | ); |
| 1168 | 1168 | if ($user_ignored) { |
| 1169 | - $success = TRUE; |
|
| 1169 | + $success = TRUE; |
|
| 1170 | 1170 | } |
| 1171 | 1171 | else { |
| 1172 | - $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
|
| 1173 | - watchdog('boincimport', |
|
| 1172 | + $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
|
| 1173 | + watchdog('boincimport', |
|
| 1174 | 1174 | 'Could not add user @ignored_uid to the ignore list of user @uid', |
| 1175 | 1175 | array('@ignored_uid' => $ignored_user_uid, '@uid' => $uid), |
| 1176 | 1176 | WATCHDOG_WARNING |
| 1177 | - ); |
|
| 1177 | + ); |
|
| 1178 | + } |
|
| 1178 | 1179 | } |
| 1179 | - } |
|
| 1180 | 1180 | |
| 1181 | - $message = ''; |
|
| 1182 | - if ($success) { |
|
| 1181 | + $message = ''; |
|
| 1182 | + if ($success) { |
|
| 1183 | 1183 | // Store some result for post-processing in the finished callback. |
| 1184 | 1184 | $context['results']['success'][] = $uid; |
| 1185 | 1185 | $message = "Successfully imported ignored users for user {$uid}"; |
| 1186 | - } |
|
| 1187 | - else { |
|
| 1186 | + } |
|
| 1187 | + else { |
|
| 1188 | 1188 | $context['results']['failure'][] = $uid; |
| 1189 | 1189 | $message = "Failed to import any user filter preferences for user {$uid}!"; |
| 1190 | 1190 | watchdog('boincimport', |
| 1191 | - 'Failed to import any user filter preferences for user @id!', |
|
| 1192 | - array('@id' => $uid), WATCHDOG_WARNING |
|
| 1191 | + 'Failed to import any user filter preferences for user @id!', |
|
| 1192 | + array('@id' => $uid), WATCHDOG_WARNING |
|
| 1193 | 1193 | ); |
| 1194 | - } |
|
| 1194 | + } |
|
| 1195 | 1195 | |
| 1196 | - // Update our progress information. |
|
| 1197 | - $context['sandbox']['progress']++; |
|
| 1198 | - $context['sandbox']['current_user'] = $uid; |
|
| 1199 | - $context['message'] = $message; |
|
| 1196 | + // Update our progress information. |
|
| 1197 | + $context['sandbox']['progress']++; |
|
| 1198 | + $context['sandbox']['current_user'] = $uid; |
|
| 1199 | + $context['message'] = $message; |
|
| 1200 | 1200 | |
| 1201 | - // Update the progress for the batch engine |
|
| 1202 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1201 | + // Update the progress for the batch engine |
|
| 1202 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1203 | 1203 | $context['finished'] = 1; |
| 1204 | - } |
|
| 1205 | - else { |
|
| 1204 | + } |
|
| 1205 | + else { |
|
| 1206 | 1206 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1207 | - } |
|
| 1207 | + } |
|
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | /** |
| 1211 | 1211 | * Batch 'finished' callback |
| 1212 | 1212 | */ |
| 1213 | 1213 | function boincimport_preferences_finished($success, $results, $operations) { |
| 1214 | - if ($success) { |
|
| 1214 | + if ($success) { |
|
| 1215 | 1215 | // Let's count our successes |
| 1216 | 1216 | $total_imported = count($results['success']); |
| 1217 | 1217 | $total_warnings = count($results['warning']); |
| 1218 | 1218 | $message = t( |
| 1219 | - 'Successfully imported preferences for @count users (with @warn warnings)', |
|
| 1220 | - array('@count' => $total_imported, '@warn' => $total_warnings) |
|
| 1219 | + 'Successfully imported preferences for @count users (with @warn warnings)', |
|
| 1220 | + array('@count' => $total_imported, '@warn' => $total_warnings) |
|
| 1221 | 1221 | ); |
| 1222 | 1222 | watchdog('boincimport', |
| 1223 | - 'Successfully imported preferences for @count users (with @warn warnings)', |
|
| 1224 | - array('@count' => $total_imported, '@warn' => $total_warnings), |
|
| 1225 | - WATCHDOG_INFO |
|
| 1223 | + 'Successfully imported preferences for @count users (with @warn warnings)', |
|
| 1224 | + array('@count' => $total_imported, '@warn' => $total_warnings), |
|
| 1225 | + WATCHDOG_INFO |
|
| 1226 | 1226 | ); |
| 1227 | 1227 | // Set the preference import successful flag in the variable table |
| 1228 | 1228 | variable_set('boincimport_import_preferences_successful', '1'); |
| 1229 | 1229 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 1230 | - } |
|
| 1231 | - else { |
|
| 1230 | + } |
|
| 1231 | + else { |
|
| 1232 | 1232 | // An error occurred. |
| 1233 | 1233 | // $operations contains the operations that remained unprocessed. |
| 1234 | 1234 | $error_operation = reset($operations); |
| 1235 | 1235 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 1236 | - } |
|
| 1237 | - drupal_set_message($message); |
|
| 1236 | + } |
|
| 1237 | + drupal_set_message($message); |
|
| 1238 | 1238 | |
| 1239 | - // Release the lock on the import process |
|
| 1240 | - variable_del('boincimport_process_locked'); |
|
| 1241 | - drupal_goto('admin/boinc/import/process'); |
|
| 1239 | + // Release the lock on the import process |
|
| 1240 | + variable_del('boincimport_process_locked'); |
|
| 1241 | + drupal_goto('admin/boinc/import/process'); |
|
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | |
@@ -1251,74 +1251,74 @@ discard block |
||
| 1251 | 1251 | */ |
| 1252 | 1252 | function boincimport_private_msgs() { |
| 1253 | 1253 | |
| 1254 | - // Check whether private messages have been successfully imported already |
|
| 1255 | - if (variable_get('boincimport_import_private_msg_successful', 0)) { |
|
| 1254 | + // Check whether private messages have been successfully imported already |
|
| 1255 | + if (variable_get('boincimport_import_private_msg_successful', 0)) { |
|
| 1256 | 1256 | drupal_set_message(t('Private message import has already run successfully -- repeating this process could result in duplicate messages!'), 'warning'); |
| 1257 | 1257 | watchdog( |
| 1258 | - 'boincimport', 'Private message import has already run successfully', |
|
| 1259 | - array(), WATCHDOG_WARNING |
|
| 1258 | + 'boincimport', 'Private message import has already run successfully', |
|
| 1259 | + array(), WATCHDOG_WARNING |
|
| 1260 | 1260 | ); |
| 1261 | 1261 | return; |
| 1262 | - } |
|
| 1262 | + } |
|
| 1263 | 1263 | |
| 1264 | - if (!variable_get('boincimport_import_private_msg_started', 0)) { |
|
| 1264 | + if (!variable_get('boincimport_import_private_msg_started', 0)) { |
|
| 1265 | 1265 | // Could prepare database tables, if new fields are necessary, etc. |
| 1266 | 1266 | variable_set('boincimport_import_private_msg_started', 1); |
| 1267 | - } |
|
| 1267 | + } |
|
| 1268 | 1268 | |
| 1269 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1269 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1270 | 1270 | |
| 1271 | - // Get stuff to import |
|
| 1272 | - db_set_active('boinc_rw'); |
|
| 1273 | - $boinc_private_msgs = db_query(' |
|
| 1271 | + // Get stuff to import |
|
| 1272 | + db_set_active('boinc_rw'); |
|
| 1273 | + $boinc_private_msgs = db_query(' |
|
| 1274 | 1274 | SELECT id, subject, content, userid, senderid, date, opened |
| 1275 | 1275 | FROM %sprivate_messages', |
| 1276 | 1276 | $pre |
| 1277 | - ); |
|
| 1278 | - $private_msg_count = mysqli_num_rows($boinc_private_msgs); |
|
| 1279 | - db_set_active('default'); |
|
| 1277 | + ); |
|
| 1278 | + $private_msg_count = mysqli_num_rows($boinc_private_msgs); |
|
| 1279 | + db_set_active('default'); |
|
| 1280 | 1280 | |
| 1281 | - if (!$private_msg_count) { |
|
| 1281 | + if (!$private_msg_count) { |
|
| 1282 | 1282 | drupal_set_message( |
| 1283 | - t('There were no private messages found: Moving on...') |
|
| 1283 | + t('There were no private messages found: Moving on...') |
|
| 1284 | 1284 | ); |
| 1285 | 1285 | watchdog('boincimport', |
| 1286 | - 'There were no private messages found: Moving on...', array(), WATCHDOG_INFO |
|
| 1286 | + 'There were no private messages found: Moving on...', array(), WATCHDOG_INFO |
|
| 1287 | 1287 | ); |
| 1288 | 1288 | // Release the lock on the import process |
| 1289 | 1289 | variable_del('boincimport_process_locked'); |
| 1290 | 1290 | return t('There were no private messages found: Moving on...'); |
| 1291 | - } |
|
| 1291 | + } |
|
| 1292 | 1292 | |
| 1293 | - watchdog('boincimport', |
|
| 1293 | + watchdog('boincimport', |
|
| 1294 | 1294 | 'Found %count private messages: Beginning Import', |
| 1295 | 1295 | array('%count' => $private_msg_count), WATCHDOG_INFO |
| 1296 | - ); |
|
| 1296 | + ); |
|
| 1297 | 1297 | |
| 1298 | - $operations = array(); |
|
| 1298 | + $operations = array(); |
|
| 1299 | 1299 | |
| 1300 | - // We don't know if a given private message has been imported already or not; |
|
| 1301 | - // if this is needed, a relation table must be added to the Drupal DB |
|
| 1300 | + // We don't know if a given private message has been imported already or not; |
|
| 1301 | + // if this is needed, a relation table must be added to the Drupal DB |
|
| 1302 | 1302 | |
| 1303 | - // Create batches to process |
|
| 1304 | - while ($boinc_private_msg = db_fetch_object($boinc_private_msgs)) { |
|
| 1303 | + // Create batches to process |
|
| 1304 | + while ($boinc_private_msg = db_fetch_object($boinc_private_msgs)) { |
|
| 1305 | 1305 | $operations[] = array( |
| 1306 | - 'boincimport_private_msgs_op', array( |
|
| 1306 | + 'boincimport_private_msgs_op', array( |
|
| 1307 | 1307 | $boinc_private_msg |
| 1308 | - ) |
|
| 1308 | + ) |
|
| 1309 | 1309 | ); |
| 1310 | - } |
|
| 1310 | + } |
|
| 1311 | 1311 | |
| 1312 | - $batch = array( |
|
| 1312 | + $batch = array( |
|
| 1313 | 1313 | 'operations' => $operations, |
| 1314 | 1314 | 'finished' => 'boincimport_private_msgs_finished', |
| 1315 | 1315 | 'title' => t('Importing private messages'), |
| 1316 | 1316 | 'init_message' => t('Beginning private message import...'), |
| 1317 | 1317 | 'progress_message' => t('Processed @current out of @total private messages.'), |
| 1318 | 1318 | 'error_message' => t('Private message import has encountered an error.'), |
| 1319 | - ); |
|
| 1319 | + ); |
|
| 1320 | 1320 | |
| 1321 | - batch_set($batch); |
|
| 1321 | + batch_set($batch); |
|
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | /** |
@@ -1327,95 +1327,95 @@ discard block |
||
| 1327 | 1327 | */ |
| 1328 | 1328 | function boincimport_private_msgs_op($pm, &$context) { |
| 1329 | 1329 | |
| 1330 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 1330 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 1331 | 1331 | |
| 1332 | - $uid = boincuser_lookup_uid($pm->userid); |
|
| 1333 | - $sender_uid = boincuser_lookup_uid($pm->senderid); |
|
| 1332 | + $uid = boincuser_lookup_uid($pm->userid); |
|
| 1333 | + $sender_uid = boincuser_lookup_uid($pm->senderid); |
|
| 1334 | 1334 | |
| 1335 | - $pm->content = _boincimport_strip_bbcode($pm->content); |
|
| 1336 | - $pm->content = _boincimport_text_sanitize($pm->content); |
|
| 1335 | + $pm->content = _boincimport_strip_bbcode($pm->content); |
|
| 1336 | + $pm->content = _boincimport_text_sanitize($pm->content); |
|
| 1337 | 1337 | |
| 1338 | - // First save the message |
|
| 1339 | - $message_added = db_query(" |
|
| 1338 | + // First save the message |
|
| 1339 | + $message_added = db_query(" |
|
| 1340 | 1340 | INSERT INTO {pm_message} (subject, author, body, format, timestamp) |
| 1341 | 1341 | VALUES ('%s', %d, '%s', %d, %d)", |
| 1342 | 1342 | $pm->subject, $sender_uid, $pm->content, $input_format, $pm->date |
| 1343 | - ); |
|
| 1344 | - $mid = db_last_insert_id('pm_message', 'mid'); |
|
| 1343 | + ); |
|
| 1344 | + $mid = db_last_insert_id('pm_message', 'mid'); |
|
| 1345 | 1345 | |
| 1346 | - // Then attach recipients and set status (note that threads are not a BOINC |
|
| 1347 | - // feature, so just consider every message to be a new thread) |
|
| 1348 | - $recipient_added = db_query(" |
|
| 1346 | + // Then attach recipients and set status (note that threads are not a BOINC |
|
| 1347 | + // feature, so just consider every message to be a new thread) |
|
| 1348 | + $recipient_added = db_query(" |
|
| 1349 | 1349 | INSERT INTO {pm_index} (mid, thread_id, uid, is_new, deleted) |
| 1350 | 1350 | VALUES (%d, %d, %d, %d, 0)", |
| 1351 | 1351 | $mid, $mid, $uid, !$pm->opened |
| 1352 | - ); |
|
| 1353 | - // In Drupal, the sender should be attached as well |
|
| 1354 | - $sender_added = db_query(" |
|
| 1352 | + ); |
|
| 1353 | + // In Drupal, the sender should be attached as well |
|
| 1354 | + $sender_added = db_query(" |
|
| 1355 | 1355 | INSERT INTO {pm_index} (mid, thread_id, uid, is_new, deleted) |
| 1356 | 1356 | VALUES (%d, %d, %d, %d, 0)", |
| 1357 | 1357 | $mid, $mid, $sender_uid, 0 |
| 1358 | - ); |
|
| 1358 | + ); |
|
| 1359 | 1359 | |
| 1360 | - $message = ''; |
|
| 1361 | - if ($message_added AND $recipient_added AND $sender_added) { |
|
| 1360 | + $message = ''; |
|
| 1361 | + if ($message_added AND $recipient_added AND $sender_added) { |
|
| 1362 | 1362 | // Store some result for post-processing in the finished callback. |
| 1363 | 1363 | $context['results']['success'][] = $pm->id; |
| 1364 | 1364 | $message = "Successfully imported private message {$pm->id}"; |
| 1365 | - } |
|
| 1366 | - else { |
|
| 1365 | + } |
|
| 1366 | + else { |
|
| 1367 | 1367 | $context['results']['failure'][] = $pm->id; |
| 1368 | 1368 | $message = "Failed to import private message {$pm->id}!"; |
| 1369 | 1369 | watchdog('boincimport', |
| 1370 | - 'Failed to import private message @id!', |
|
| 1371 | - array('@id' => $pm->id), WATCHDOG_WARNING |
|
| 1370 | + 'Failed to import private message @id!', |
|
| 1371 | + array('@id' => $pm->id), WATCHDOG_WARNING |
|
| 1372 | 1372 | ); |
| 1373 | - } |
|
| 1373 | + } |
|
| 1374 | 1374 | |
| 1375 | - // Update our progress information. |
|
| 1376 | - $context['sandbox']['progress']++; |
|
| 1377 | - $context['sandbox']['current_pm'] = $pm->id; |
|
| 1378 | - $context['message'] = $message; |
|
| 1375 | + // Update our progress information. |
|
| 1376 | + $context['sandbox']['progress']++; |
|
| 1377 | + $context['sandbox']['current_pm'] = $pm->id; |
|
| 1378 | + $context['message'] = $message; |
|
| 1379 | 1379 | |
| 1380 | - // Update the progress for the batch engine |
|
| 1381 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1380 | + // Update the progress for the batch engine |
|
| 1381 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1382 | 1382 | $context['finished'] = 1; |
| 1383 | - } |
|
| 1384 | - else { |
|
| 1383 | + } |
|
| 1384 | + else { |
|
| 1385 | 1385 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1386 | - } |
|
| 1386 | + } |
|
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | 1389 | /** |
| 1390 | 1390 | * Batch 'finished' callback |
| 1391 | 1391 | */ |
| 1392 | 1392 | function boincimport_private_msgs_finished($success, $results, $operations) { |
| 1393 | - if ($success) { |
|
| 1393 | + if ($success) { |
|
| 1394 | 1394 | // Let's count our successes |
| 1395 | 1395 | $total_imported = count($results['success']); |
| 1396 | 1396 | $message = t( |
| 1397 | - 'Successfully imported @count private messages', |
|
| 1398 | - array('@count' => $total_imported) |
|
| 1397 | + 'Successfully imported @count private messages', |
|
| 1398 | + array('@count' => $total_imported) |
|
| 1399 | 1399 | ); |
| 1400 | 1400 | watchdog('boincimport', |
| 1401 | - 'Successfully imported @count private messages.', |
|
| 1402 | - array('@count' => $total_imported), WATCHDOG_INFO |
|
| 1401 | + 'Successfully imported @count private messages.', |
|
| 1402 | + array('@count' => $total_imported), WATCHDOG_INFO |
|
| 1403 | 1403 | ); |
| 1404 | 1404 | // Set the private message import successful flag in the variable table |
| 1405 | 1405 | variable_set('boincimport_import_private_msg_successful', '1'); |
| 1406 | 1406 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 1407 | - } |
|
| 1408 | - else { |
|
| 1407 | + } |
|
| 1408 | + else { |
|
| 1409 | 1409 | // An error occurred. |
| 1410 | 1410 | // $operations contains the operations that remained unprocessed. |
| 1411 | 1411 | $error_operation = reset($operations); |
| 1412 | 1412 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 1413 | - } |
|
| 1414 | - drupal_set_message($message); |
|
| 1413 | + } |
|
| 1414 | + drupal_set_message($message); |
|
| 1415 | 1415 | |
| 1416 | - // Release the lock on the import process |
|
| 1417 | - variable_del('boincimport_process_locked'); |
|
| 1418 | - drupal_goto('admin/boinc/import/process'); |
|
| 1416 | + // Release the lock on the import process |
|
| 1417 | + variable_del('boincimport_process_locked'); |
|
| 1418 | + drupal_goto('admin/boinc/import/process'); |
|
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | |
@@ -1428,196 +1428,196 @@ discard block |
||
| 1428 | 1428 | */ |
| 1429 | 1429 | function boincimport_forum_categories() { |
| 1430 | 1430 | |
| 1431 | - // Check whether forums have been successfully imported already |
|
| 1432 | - if (variable_get('boincimport_import_forum_category_successful', 0)) { |
|
| 1431 | + // Check whether forums have been successfully imported already |
|
| 1432 | + if (variable_get('boincimport_import_forum_category_successful', 0)) { |
|
| 1433 | 1433 | drupal_set_message(t('Note: forum container import has already run successfully')); |
| 1434 | 1434 | watchdog( |
| 1435 | - 'boincimport', 'Note: forum container import has already run successfully', |
|
| 1436 | - array(), WATCHDOG_INFO |
|
| 1435 | + 'boincimport', 'Note: forum container import has already run successfully', |
|
| 1436 | + array(), WATCHDOG_INFO |
|
| 1437 | 1437 | ); |
| 1438 | - } |
|
| 1438 | + } |
|
| 1439 | 1439 | |
| 1440 | - if (!variable_get('boincimport_import_forum_category_started', 0)) { |
|
| 1440 | + if (!variable_get('boincimport_import_forum_category_started', 0)) { |
|
| 1441 | 1441 | // Could prepare database tables, if new fields are necessary, etc. |
| 1442 | 1442 | variable_set('boincimport_import_forum_category_started', 1); |
| 1443 | - } |
|
| 1443 | + } |
|
| 1444 | 1444 | |
| 1445 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1445 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1446 | 1446 | |
| 1447 | - // Retrieve the vocabulary vid named "Forums" |
|
| 1448 | - //$forum_vid = variable_get('forum_nav_vocabulary', 0); |
|
| 1449 | - $forum_vid = db_result(db_query(' |
|
| 1447 | + // Retrieve the vocabulary vid named "Forums" |
|
| 1448 | + //$forum_vid = variable_get('forum_nav_vocabulary', 0); |
|
| 1449 | + $forum_vid = db_result(db_query(' |
|
| 1450 | 1450 | SELECT vid FROM {vocabulary} |
| 1451 | 1451 | WHERE name="%s"', |
| 1452 | 1452 | 'Forums' |
| 1453 | - )); |
|
| 1454 | - if (!$forum_vid) { |
|
| 1453 | + )); |
|
| 1454 | + if (!$forum_vid) { |
|
| 1455 | 1455 | $forum_vocab = array( |
| 1456 | - 'name' => t('Forums'), |
|
| 1457 | - 'description' => t('The different forum categories / containers'), |
|
| 1456 | + 'name' => t('Forums'), |
|
| 1457 | + 'description' => t('The different forum categories / containers'), |
|
| 1458 | 1458 | ); |
| 1459 | 1459 | taxonomy_save_vocabulary($forum_vocab); |
| 1460 | 1460 | $forum_vid = db_result(db_query(' |
| 1461 | 1461 | SELECT vid FROM {vocabulary} |
| 1462 | 1462 | WHERE name="%s"', |
| 1463 | - 'Forums' |
|
| 1463 | + 'Forums' |
|
| 1464 | 1464 | )); |
| 1465 | - } |
|
| 1465 | + } |
|
| 1466 | 1466 | |
| 1467 | - // Get both categories and forums from BOINC |
|
| 1468 | - db_set_active('boinc_rw'); |
|
| 1469 | - $boinc_forum_categories = db_query(' |
|
| 1467 | + // Get both categories and forums from BOINC |
|
| 1468 | + db_set_active('boinc_rw'); |
|
| 1469 | + $boinc_forum_categories = db_query(' |
|
| 1470 | 1470 | SELECT id, name |
| 1471 | 1471 | FROM %scategory |
| 1472 | 1472 | ORDER BY orderID', |
| 1473 | 1473 | $pre |
| 1474 | - ); |
|
| 1475 | - $forum_category_count = mysqli_num_rows($boinc_forum_categories); |
|
| 1476 | - $boinc_forums = db_query(' |
|
| 1474 | + ); |
|
| 1475 | + $forum_category_count = mysqli_num_rows($boinc_forum_categories); |
|
| 1476 | + $boinc_forums = db_query(' |
|
| 1477 | 1477 | SELECT id, category, title, description, orderID |
| 1478 | 1478 | FROM %sforum |
| 1479 | 1479 | WHERE parent_type = 0 |
| 1480 | 1480 | ORDER BY category', |
| 1481 | 1481 | $pre |
| 1482 | - ); |
|
| 1483 | - $forum_count = mysqli_num_rows($boinc_forums); |
|
| 1484 | - db_set_active('default'); |
|
| 1482 | + ); |
|
| 1483 | + $forum_count = mysqli_num_rows($boinc_forums); |
|
| 1484 | + db_set_active('default'); |
|
| 1485 | 1485 | |
| 1486 | - if (!$forum_category_count) { |
|
| 1486 | + if (!$forum_category_count) { |
|
| 1487 | 1487 | drupal_set_message( |
| 1488 | - t('There were no forum containers found: Aborting script'), 'warning' |
|
| 1488 | + t('There were no forum containers found: Aborting script'), 'warning' |
|
| 1489 | 1489 | ); |
| 1490 | 1490 | watchdog('boincimport', |
| 1491 | - 'There were no forum containers found: Aborting script', array(), WATCHDOG_WARNING |
|
| 1491 | + 'There were no forum containers found: Aborting script', array(), WATCHDOG_WARNING |
|
| 1492 | 1492 | ); |
| 1493 | 1493 | // Release the lock on the import process |
| 1494 | 1494 | variable_del('boincimport_process_locked'); |
| 1495 | 1495 | return t('There were no forum containers found: Aborting script.'); |
| 1496 | - } |
|
| 1497 | - if (!$forum_count) { |
|
| 1496 | + } |
|
| 1497 | + if (!$forum_count) { |
|
| 1498 | 1498 | drupal_set_message( |
| 1499 | - t('There were no forums found: Aborting script'), 'warning' |
|
| 1499 | + t('There were no forums found: Aborting script'), 'warning' |
|
| 1500 | 1500 | ); |
| 1501 | 1501 | watchdog('boincimport', |
| 1502 | - 'There were no forums found: Aborting script', array(), WATCHDOG_WARNING |
|
| 1502 | + 'There were no forums found: Aborting script', array(), WATCHDOG_WARNING |
|
| 1503 | 1503 | ); |
| 1504 | 1504 | // Release the lock on the import process |
| 1505 | 1505 | variable_del('boincimport_process_locked'); |
| 1506 | 1506 | return t('There were no forums found: Aborting script.'); |
| 1507 | - } |
|
| 1507 | + } |
|
| 1508 | 1508 | |
| 1509 | - watchdog('boincimport', |
|
| 1509 | + watchdog('boincimport', |
|
| 1510 | 1510 | 'Found %forum_count forums in %category_count containers: Beginning Import', |
| 1511 | 1511 | array( |
| 1512 | - '%forum_count' => $forum_count, |
|
| 1513 | - '%category_count' => $forum_category_count, |
|
| 1512 | + '%forum_count' => $forum_count, |
|
| 1513 | + '%category_count' => $forum_category_count, |
|
| 1514 | 1514 | ), WATCHDOG_INFO |
| 1515 | - ); |
|
| 1516 | - |
|
| 1517 | - $operations = array(); |
|
| 1518 | - $existing_categories = array(); |
|
| 1519 | - $existing_forums = array(); |
|
| 1520 | - $duplicate_categories = array(); |
|
| 1521 | - $duplicate_forums = array(); |
|
| 1522 | - $category_map = array(); |
|
| 1523 | - |
|
| 1524 | - // Get the list of categories already in Drupal so as not to import any twice |
|
| 1525 | - $category_tree = taxonomy_get_tree($forum_vid, 0, -1, 1); |
|
| 1526 | - foreach ($category_tree as $term) { |
|
| 1515 | + ); |
|
| 1516 | + |
|
| 1517 | + $operations = array(); |
|
| 1518 | + $existing_categories = array(); |
|
| 1519 | + $existing_forums = array(); |
|
| 1520 | + $duplicate_categories = array(); |
|
| 1521 | + $duplicate_forums = array(); |
|
| 1522 | + $category_map = array(); |
|
| 1523 | + |
|
| 1524 | + // Get the list of categories already in Drupal so as not to import any twice |
|
| 1525 | + $category_tree = taxonomy_get_tree($forum_vid, 0, -1, 1); |
|
| 1526 | + foreach ($category_tree as $term) { |
|
| 1527 | 1527 | $existing_categories[] = $term->name; |
| 1528 | - } |
|
| 1528 | + } |
|
| 1529 | 1529 | |
| 1530 | - // Get the list of forums already in Drupal |
|
| 1531 | - $result = db_query(' |
|
| 1530 | + // Get the list of forums already in Drupal |
|
| 1531 | + $result = db_query(' |
|
| 1532 | 1532 | SELECT forum_id, tid FROM {boincimport_temp_forum}' |
| 1533 | - ); |
|
| 1534 | - while ($row = db_fetch_object($result)) { |
|
| 1533 | + ); |
|
| 1534 | + while ($row = db_fetch_object($result)) { |
|
| 1535 | 1535 | $existing_forums[$row->forum_id] = $row->tid; |
| 1536 | - } |
|
| 1536 | + } |
|
| 1537 | 1537 | |
| 1538 | - // Create batches to process |
|
| 1538 | + // Create batches to process |
|
| 1539 | 1539 | |
| 1540 | - // Set up the "hidden" category, if necessary |
|
| 1541 | - // This is to support automatic hiding of empty categories |
|
| 1542 | - $hidden_forum_tid = db_result(db_query(' |
|
| 1540 | + // Set up the "hidden" category, if necessary |
|
| 1541 | + // This is to support automatic hiding of empty categories |
|
| 1542 | + $hidden_forum_tid = db_result(db_query(' |
|
| 1543 | 1543 | SELECT tid FROM {term_data} |
| 1544 | 1544 | WHERE vid = %d |
| 1545 | 1545 | AND name = "%s"', |
| 1546 | 1546 | $forum_vid, 'Hidden' |
| 1547 | - )); |
|
| 1548 | - if (!$hidden_forum_tid) { |
|
| 1547 | + )); |
|
| 1548 | + if (!$hidden_forum_tid) { |
|
| 1549 | 1549 | $operations[] = array( |
| 1550 | - 'boincimport_forum_categories_op', array( |
|
| 1550 | + 'boincimport_forum_categories_op', array( |
|
| 1551 | 1551 | NULL, $forum_vid, $pre, TRUE |
| 1552 | - ) |
|
| 1552 | + ) |
|
| 1553 | 1553 | ); |
| 1554 | - } |
|
| 1554 | + } |
|
| 1555 | 1555 | |
| 1556 | - // Import categories |
|
| 1557 | - while ($boinc_forum_category = db_fetch_object($boinc_forum_categories)) { |
|
| 1556 | + // Import categories |
|
| 1557 | + while ($boinc_forum_category = db_fetch_object($boinc_forum_categories)) { |
|
| 1558 | 1558 | if (in_array($boinc_forum_category->name, $existing_categories)) { |
| 1559 | - // This category has already been imported |
|
| 1560 | - $duplicate_categories[] = $boinc_forum_category->name; |
|
| 1559 | + // This category has already been imported |
|
| 1560 | + $duplicate_categories[] = $boinc_forum_category->name; |
|
| 1561 | 1561 | } |
| 1562 | 1562 | else { |
| 1563 | - $operations[] = array( |
|
| 1563 | + $operations[] = array( |
|
| 1564 | 1564 | 'boincimport_forum_categories_op', array( |
| 1565 | - $boinc_forum_category, $forum_vid, $pre, FALSE |
|
| 1565 | + $boinc_forum_category, $forum_vid, $pre, FALSE |
|
| 1566 | 1566 | ) |
| 1567 | - ); |
|
| 1567 | + ); |
|
| 1568 | + } |
|
| 1568 | 1569 | } |
| 1569 | - } |
|
| 1570 | 1570 | |
| 1571 | - // Import forums |
|
| 1572 | - while ($boinc_forum = db_fetch_object($boinc_forums)) { |
|
| 1573 | - if (isset($existing_forums[$boinc_forum->id])) { |
|
| 1574 | - // This forum has already been imported |
|
| 1575 | - $duplicates[] = $boinc_forum->id; |
|
| 1571 | + // Import forums |
|
| 1572 | + while ($boinc_forum = db_fetch_object($boinc_forums)) { |
|
| 1573 | + if (isset($existing_forums[$boinc_forum->id])) { |
|
| 1574 | + // This forum has already been imported |
|
| 1575 | + $duplicates[] = $boinc_forum->id; |
|
| 1576 | 1576 | } |
| 1577 | 1577 | else { |
| 1578 | - $operations[] = array( |
|
| 1578 | + $operations[] = array( |
|
| 1579 | 1579 | 'boincimport_forums_op', array( |
| 1580 | - $boinc_forum, $forum_vid, $pre |
|
| 1580 | + $boinc_forum, $forum_vid, $pre |
|
| 1581 | 1581 | ) |
| 1582 | - ); |
|
| 1582 | + ); |
|
| 1583 | + } |
|
| 1583 | 1584 | } |
| 1584 | - } |
|
| 1585 | 1585 | |
| 1586 | - // Report any duplicates that were skipped |
|
| 1587 | - $skipped_message = array(); |
|
| 1588 | - $categories_skipped = count($duplicate_categories); |
|
| 1589 | - $forums_skipped = count($duplicate_forums); |
|
| 1590 | - if ($categories_skipped) { |
|
| 1586 | + // Report any duplicates that were skipped |
|
| 1587 | + $skipped_message = array(); |
|
| 1588 | + $categories_skipped = count($duplicate_categories); |
|
| 1589 | + $forums_skipped = count($duplicate_forums); |
|
| 1590 | + if ($categories_skipped) { |
|
| 1591 | 1591 | $skipped_message[] = format_plural( |
| 1592 | - $categories_skipped, |
|
| 1593 | - '1 container', |
|
| 1594 | - '@count containers' |
|
| 1592 | + $categories_skipped, |
|
| 1593 | + '1 container', |
|
| 1594 | + '@count containers' |
|
| 1595 | 1595 | ); |
| 1596 | - } |
|
| 1597 | - if ($forums_skipped) { |
|
| 1596 | + } |
|
| 1597 | + if ($forums_skipped) { |
|
| 1598 | 1598 | $skipped_message[] = format_plural( |
| 1599 | - $forums_skipped, |
|
| 1600 | - '1 forum', |
|
| 1601 | - '@count forums' |
|
| 1599 | + $forums_skipped, |
|
| 1600 | + '1 forum', |
|
| 1601 | + '@count forums' |
|
| 1602 | 1602 | ); |
| 1603 | - } |
|
| 1604 | - if ($skipped_message) { |
|
| 1603 | + } |
|
| 1604 | + if ($skipped_message) { |
|
| 1605 | 1605 | drupal_set_message(t('Skipped @forums that were already imported', |
| 1606 | - array('@forums' => implode(' and ', $skipped_message)) |
|
| 1606 | + array('@forums' => implode(' and ', $skipped_message)) |
|
| 1607 | 1607 | )); |
| 1608 | - } |
|
| 1608 | + } |
|
| 1609 | 1609 | |
| 1610 | - // Create and run the batch |
|
| 1611 | - $batch = array( |
|
| 1610 | + // Create and run the batch |
|
| 1611 | + $batch = array( |
|
| 1612 | 1612 | 'operations' => $operations, |
| 1613 | 1613 | 'finished' => 'boincimport_forums_finished', |
| 1614 | 1614 | 'title' => t('Importing forums'), |
| 1615 | 1615 | 'init_message' => t('Beginning forum import...'), |
| 1616 | 1616 | 'progress_message' => t('Processed @current out of @total forums.'), |
| 1617 | 1617 | 'error_message' => t('Forum import has encountered an error.'), |
| 1618 | - ); |
|
| 1618 | + ); |
|
| 1619 | 1619 | |
| 1620 | - batch_set($batch); |
|
| 1620 | + batch_set($batch); |
|
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | /** |
@@ -1626,92 +1626,92 @@ discard block |
||
| 1626 | 1626 | */ |
| 1627 | 1627 | function boincimport_forum_categories_op($category, $forum_vid, $pre, $create_hidden, &$context) { |
| 1628 | 1628 | |
| 1629 | - // Set term parameters for categories |
|
| 1630 | - $forum_id = 0; |
|
| 1631 | - $parent_id = 0; |
|
| 1632 | - $description = ''; |
|
| 1633 | - $weight = 0; |
|
| 1634 | - $hidden = FALSE; |
|
| 1629 | + // Set term parameters for categories |
|
| 1630 | + $forum_id = 0; |
|
| 1631 | + $parent_id = 0; |
|
| 1632 | + $description = ''; |
|
| 1633 | + $weight = 0; |
|
| 1634 | + $hidden = FALSE; |
|
| 1635 | 1635 | |
| 1636 | - $category_map = variable_get('boincimport_forum_category_map', array()); |
|
| 1636 | + $category_map = variable_get('boincimport_forum_category_map', array()); |
|
| 1637 | 1637 | |
| 1638 | - if (!$category AND $create_hidden) { |
|
| 1638 | + if (!$category AND $create_hidden) { |
|
| 1639 | 1639 | // Create the special "hidden" container |
| 1640 | 1640 | $category = new stdClass(); |
| 1641 | 1641 | $category->name = 'Hidden'; |
| 1642 | 1642 | $category->id = 0; |
| 1643 | 1643 | $hidden = TRUE; |
| 1644 | - } |
|
| 1645 | - else { |
|
| 1644 | + } |
|
| 1645 | + else { |
|
| 1646 | 1646 | // If this container is empty, put it into the hidden container |
| 1647 | 1647 | db_set_active('boinc_rw'); |
| 1648 | 1648 | $forums_contained = db_result(db_query(' |
| 1649 | 1649 | SELECT count(*) FROM %sforum |
| 1650 | 1650 | WHERE parent_type = 0 |
| 1651 | 1651 | AND category = %d', |
| 1652 | - $pre, $category->id)); |
|
| 1652 | + $pre, $category->id)); |
|
| 1653 | 1653 | db_set_active('default'); |
| 1654 | 1654 | if (!$forums_contained) { |
| 1655 | - $parent_id = $category_map[0]; |
|
| 1656 | - $hidden = TRUE; |
|
| 1655 | + $parent_id = $category_map[0]; |
|
| 1656 | + $hidden = TRUE; |
|
| 1657 | + } |
|
| 1657 | 1658 | } |
| 1658 | - } |
|
| 1659 | 1659 | |
| 1660 | - $forum = array( |
|
| 1660 | + $forum = array( |
|
| 1661 | 1661 | 'name' => $category->name, |
| 1662 | 1662 | 'vid' => $forum_vid, |
| 1663 | 1663 | 'description' => $description, |
| 1664 | 1664 | 'parent' => $parent_id, |
| 1665 | 1665 | 'weight' => $weight, |
| 1666 | - ); |
|
| 1667 | - $forum['description'] = strip_tags($forum['description']); |
|
| 1666 | + ); |
|
| 1667 | + $forum['description'] = strip_tags($forum['description']); |
|
| 1668 | 1668 | |
| 1669 | - taxonomy_save_term($forum); |
|
| 1670 | - $success = isset($forum['tid']); |
|
| 1669 | + taxonomy_save_term($forum); |
|
| 1670 | + $success = isset($forum['tid']); |
|
| 1671 | 1671 | |
| 1672 | - // Serialize the forum containers |
|
| 1673 | - $containers = variable_get('forum_containers', array()); |
|
| 1674 | - $containers[] = $forum['tid']; |
|
| 1675 | - variable_set('forum_containers', $containers); |
|
| 1672 | + // Serialize the forum containers |
|
| 1673 | + $containers = variable_get('forum_containers', array()); |
|
| 1674 | + $containers[] = $forum['tid']; |
|
| 1675 | + variable_set('forum_containers', $containers); |
|
| 1676 | 1676 | |
| 1677 | - // Note the taxonomy ID for mapping forums to categories |
|
| 1678 | - $category_map[$category->id] = $forum['tid']; |
|
| 1679 | - variable_set('boincimport_forum_category_map', $category_map); |
|
| 1677 | + // Note the taxonomy ID for mapping forums to categories |
|
| 1678 | + $category_map[$category->id] = $forum['tid']; |
|
| 1679 | + variable_set('boincimport_forum_category_map', $category_map); |
|
| 1680 | 1680 | |
| 1681 | - boincimport_forum_set_permissions($forum, $hidden); |
|
| 1681 | + boincimport_forum_set_permissions($forum, $hidden); |
|
| 1682 | 1682 | |
| 1683 | - $message = ''; |
|
| 1684 | - if ($success) { |
|
| 1683 | + $message = ''; |
|
| 1684 | + if ($success) { |
|
| 1685 | 1685 | // Store some result for post-processing in the finished callback. |
| 1686 | 1686 | if (!$category AND $create_hidden) { |
| 1687 | - $message = "Created special hidden container"; |
|
| 1687 | + $message = "Created special hidden container"; |
|
| 1688 | 1688 | } |
| 1689 | 1689 | else { |
| 1690 | - $context['results']['categories']['success'][] = $category->id; |
|
| 1691 | - $message = "Successfully imported container {$category->id}"; |
|
| 1690 | + $context['results']['categories']['success'][] = $category->id; |
|
| 1691 | + $message = "Successfully imported container {$category->id}"; |
|
| 1692 | 1692 | } |
| 1693 | - } |
|
| 1694 | - else { |
|
| 1693 | + } |
|
| 1694 | + else { |
|
| 1695 | 1695 | $context['results']['categories']['failure'][] = $category->id; |
| 1696 | 1696 | $message = "Failed to import container {$category->id}!"; |
| 1697 | 1697 | watchdog('boincimport', |
| 1698 | - 'Failed to import container @id!', |
|
| 1699 | - array('@id' => $category->id), WATCHDOG_WARNING |
|
| 1698 | + 'Failed to import container @id!', |
|
| 1699 | + array('@id' => $category->id), WATCHDOG_WARNING |
|
| 1700 | 1700 | ); |
| 1701 | - } |
|
| 1701 | + } |
|
| 1702 | 1702 | |
| 1703 | - // Update our progress information. |
|
| 1704 | - $context['sandbox']['progress']++; |
|
| 1705 | - $context['sandbox']['current_category'] = $category->id; |
|
| 1706 | - $context['message'] = $message; |
|
| 1703 | + // Update our progress information. |
|
| 1704 | + $context['sandbox']['progress']++; |
|
| 1705 | + $context['sandbox']['current_category'] = $category->id; |
|
| 1706 | + $context['message'] = $message; |
|
| 1707 | 1707 | |
| 1708 | - // Update the progress for the batch engine |
|
| 1709 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1708 | + // Update the progress for the batch engine |
|
| 1709 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1710 | 1710 | $context['finished'] = 1; |
| 1711 | - } |
|
| 1712 | - else { |
|
| 1711 | + } |
|
| 1712 | + else { |
|
| 1713 | 1713 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1714 | - } |
|
| 1714 | + } |
|
| 1715 | 1715 | } |
| 1716 | 1716 | |
| 1717 | 1717 | /** |
@@ -1720,40 +1720,40 @@ discard block |
||
| 1720 | 1720 | */ |
| 1721 | 1721 | function boincimport_forums_op($boincforum, $forum_vid, $pre = '', &$context) { |
| 1722 | 1722 | |
| 1723 | - $hidden_forum = FALSE; |
|
| 1724 | - $open_forum = FALSE; |
|
| 1725 | - $category_map = variable_get('boincimport_forum_category_map', array()); |
|
| 1726 | - |
|
| 1727 | - // Set term parameters for forums |
|
| 1728 | - $forum_id = $boincforum->id; |
|
| 1729 | - $parent_id = isset($category_map[$boincforum->category]) ? $category_map[$boincforum->category] : $category_map[0]; |
|
| 1730 | - $name = $boincforum->title; |
|
| 1731 | - $description = $boincforum->description; |
|
| 1732 | - $weight = $boincforum->orderID; |
|
| 1733 | - if ($parent_id == $category_map[0]) { |
|
| 1723 | + $hidden_forum = FALSE; |
|
| 1724 | + $open_forum = FALSE; |
|
| 1725 | + $category_map = variable_get('boincimport_forum_category_map', array()); |
|
| 1726 | + |
|
| 1727 | + // Set term parameters for forums |
|
| 1728 | + $forum_id = $boincforum->id; |
|
| 1729 | + $parent_id = isset($category_map[$boincforum->category]) ? $category_map[$boincforum->category] : $category_map[0]; |
|
| 1730 | + $name = $boincforum->title; |
|
| 1731 | + $description = $boincforum->description; |
|
| 1732 | + $weight = $boincforum->orderID; |
|
| 1733 | + if ($parent_id == $category_map[0]) { |
|
| 1734 | 1734 | // If this forum is hidden, flag for appropriate access controls |
| 1735 | 1735 | $hidden_forum = TRUE; |
| 1736 | - } |
|
| 1737 | - if ($name == 'Getting Started') { |
|
| 1736 | + } |
|
| 1737 | + if ($name == 'Getting Started') { |
|
| 1738 | 1738 | // Must allow users to post in this forum even if they have no credit! |
| 1739 | 1739 | $open_forum = TRUE; |
| 1740 | - } |
|
| 1740 | + } |
|
| 1741 | 1741 | |
| 1742 | - // Try to detect a BOINC news forum and flag it so that news can be |
|
| 1743 | - // imported into a Drupal news content type later |
|
| 1744 | - if ($name == 'News') { |
|
| 1742 | + // Try to detect a BOINC news forum and flag it so that news can be |
|
| 1743 | + // imported into a Drupal news content type later |
|
| 1744 | + if ($name == 'News') { |
|
| 1745 | 1745 | // Save the ID of the News forum for later import |
| 1746 | 1746 | variable_set('boincimport_news_forum_id', $forum_id); |
| 1747 | 1747 | $success = TRUE; |
| 1748 | - } |
|
| 1749 | - else { |
|
| 1748 | + } |
|
| 1749 | + else { |
|
| 1750 | 1750 | // Save all other forums as taxonomy terms |
| 1751 | 1751 | $forum = array( |
| 1752 | - 'name' => $name, |
|
| 1753 | - 'vid' => $forum_vid, |
|
| 1754 | - 'description' => $description, |
|
| 1755 | - 'parent' => $parent_id, |
|
| 1756 | - 'weight' => $weight, |
|
| 1752 | + 'name' => $name, |
|
| 1753 | + 'vid' => $forum_vid, |
|
| 1754 | + 'description' => $description, |
|
| 1755 | + 'parent' => $parent_id, |
|
| 1756 | + 'weight' => $weight, |
|
| 1757 | 1757 | ); |
| 1758 | 1758 | $forum['description'] = strip_tags($forum['description']); |
| 1759 | 1759 | |
@@ -1765,31 +1765,31 @@ discard block |
||
| 1765 | 1765 | |
| 1766 | 1766 | // Set access controls |
| 1767 | 1767 | boincimport_forum_set_permissions($forum, $hidden_forum, $open_forum); |
| 1768 | - } |
|
| 1768 | + } |
|
| 1769 | 1769 | |
| 1770 | - $message = ''; |
|
| 1771 | - if ($success) { |
|
| 1770 | + $message = ''; |
|
| 1771 | + if ($success) { |
|
| 1772 | 1772 | // Store some result for post-processing in the finished callback. |
| 1773 | 1773 | $context['results']['forums']['success'][] = $forum_id; |
| 1774 | 1774 | $message = "Successfully imported forum {$forum_id}"; |
| 1775 | - } |
|
| 1776 | - else { |
|
| 1775 | + } |
|
| 1776 | + else { |
|
| 1777 | 1777 | $context['results']['forums']['failure'][] = $forum_id; |
| 1778 | 1778 | $message = "Failed to import forum {$forum_id}!"; |
| 1779 | - } |
|
| 1779 | + } |
|
| 1780 | 1780 | |
| 1781 | - // Update our progress information. |
|
| 1782 | - $context['sandbox']['progress']++; |
|
| 1783 | - $context['sandbox']['current_forum'] = $forum_id; |
|
| 1784 | - $context['message'] = $message; |
|
| 1781 | + // Update our progress information. |
|
| 1782 | + $context['sandbox']['progress']++; |
|
| 1783 | + $context['sandbox']['current_forum'] = $forum_id; |
|
| 1784 | + $context['message'] = $message; |
|
| 1785 | 1785 | |
| 1786 | - // Update the progress for the batch engine |
|
| 1787 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1786 | + // Update the progress for the batch engine |
|
| 1787 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 1788 | 1788 | $context['finished'] = 1; |
| 1789 | - } |
|
| 1790 | - else { |
|
| 1789 | + } |
|
| 1790 | + else { |
|
| 1791 | 1791 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1792 | - } |
|
| 1792 | + } |
|
| 1793 | 1793 | } |
| 1794 | 1794 | |
| 1795 | 1795 | /** |
@@ -1797,46 +1797,46 @@ discard block |
||
| 1797 | 1797 | */ |
| 1798 | 1798 | function boincimport_forum_set_permissions($forum, $hidden = FALSE, $open = FALSE) { |
| 1799 | 1799 | |
| 1800 | - // Set access controls |
|
| 1801 | - $forum_perms = array(); |
|
| 1802 | - $role_map = array_flip(user_roles()); |
|
| 1803 | - $forum_perms[$role_map['anonymous user']] = array( |
|
| 1800 | + // Set access controls |
|
| 1801 | + $forum_perms = array(); |
|
| 1802 | + $role_map = array_flip(user_roles()); |
|
| 1803 | + $forum_perms[$role_map['anonymous user']] = array( |
|
| 1804 | 1804 | 'view' => (int) !$hidden, |
| 1805 | 1805 | 'update' => 0, |
| 1806 | 1806 | 'delete' => 0, |
| 1807 | 1807 | 'create' => 0, |
| 1808 | - ); |
|
| 1809 | - $forum_perms[$role_map['authenticated user']] = array( |
|
| 1808 | + ); |
|
| 1809 | + $forum_perms[$role_map['authenticated user']] = array( |
|
| 1810 | 1810 | 'view' => (int) !$hidden, |
| 1811 | 1811 | 'update' => 0, |
| 1812 | 1812 | 'delete' => 0, |
| 1813 | 1813 | 'create' => 0, |
| 1814 | - ); |
|
| 1815 | - $forum_perms[$role_map['community member']] = array( |
|
| 1814 | + ); |
|
| 1815 | + $forum_perms[$role_map['community member']] = array( |
|
| 1816 | 1816 | 'view' => (int) !$hidden, |
| 1817 | 1817 | 'update' => 0, |
| 1818 | 1818 | 'delete' => 0, |
| 1819 | 1819 | 'create' => (int) $open, |
| 1820 | - ); |
|
| 1821 | - $forum_perms[$role_map['verified contributor']] = array( |
|
| 1820 | + ); |
|
| 1821 | + $forum_perms[$role_map['verified contributor']] = array( |
|
| 1822 | 1822 | 'view' => (int) !$hidden, |
| 1823 | 1823 | 'update' => 0, |
| 1824 | 1824 | 'delete' => 0, |
| 1825 | 1825 | 'create' => (int) !$hidden, |
| 1826 | - ); |
|
| 1827 | - $forum_perms[$role_map['moderator']] = array( |
|
| 1826 | + ); |
|
| 1827 | + $forum_perms[$role_map['moderator']] = array( |
|
| 1828 | 1828 | 'view' => (int) !$hidden, |
| 1829 | 1829 | 'update' => (int) !$hidden, |
| 1830 | 1830 | 'delete' => 0, |
| 1831 | 1831 | 'create' => (int) !$hidden, |
| 1832 | - ); |
|
| 1833 | - $forum_perms[$role_map['administrator']] = array( |
|
| 1832 | + ); |
|
| 1833 | + $forum_perms[$role_map['administrator']] = array( |
|
| 1834 | 1834 | 'view' => 1, |
| 1835 | 1835 | 'update' => 1, |
| 1836 | 1836 | 'delete' => 1, |
| 1837 | 1837 | 'create' => 1, |
| 1838 | - ); |
|
| 1839 | - foreach ($forum_perms as $role => $perm) { |
|
| 1838 | + ); |
|
| 1839 | + foreach ($forum_perms as $role => $perm) { |
|
| 1840 | 1840 | db_query(' |
| 1841 | 1841 | INSERT INTO {forum_access} |
| 1842 | 1842 | SET tid = %d, rid = %d, |
@@ -1845,61 +1845,61 @@ discard block |
||
| 1845 | 1845 | ON DUPLICATE KEY UPDATE |
| 1846 | 1846 | grant_view = %d, grant_update = %d, |
| 1847 | 1847 | grant_delete = %d, grant_create = %d', |
| 1848 | - $forum['tid'], $role, |
|
| 1849 | - $perm['view'], $perm['update'], |
|
| 1850 | - $perm['delete'], $perm['create'], |
|
| 1851 | - $perm['view'], $perm['update'], |
|
| 1852 | - $perm['delete'], $perm['create']); |
|
| 1853 | - } |
|
| 1848 | + $forum['tid'], $role, |
|
| 1849 | + $perm['view'], $perm['update'], |
|
| 1850 | + $perm['delete'], $perm['create'], |
|
| 1851 | + $perm['view'], $perm['update'], |
|
| 1852 | + $perm['delete'], $perm['create']); |
|
| 1853 | + } |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | /** |
| 1857 | 1857 | * Batch 'finished' callback |
| 1858 | 1858 | */ |
| 1859 | 1859 | function boincimport_forums_finished($success, $results, $operations) { |
| 1860 | - if ($success) { |
|
| 1860 | + if ($success) { |
|
| 1861 | 1861 | // Let's count our successes |
| 1862 | 1862 | $categories_imported = count($results['categories']['success']); |
| 1863 | 1863 | $forums_imported = count($results['forums']['success']); |
| 1864 | 1864 | |
| 1865 | 1865 | $success_message = array(); |
| 1866 | 1866 | if ($categories_imported) { |
| 1867 | - $success_message[] = format_plural( |
|
| 1867 | + $success_message[] = format_plural( |
|
| 1868 | 1868 | $categories_imported, |
| 1869 | 1869 | '1 container', |
| 1870 | 1870 | '@count containers' |
| 1871 | - ); |
|
| 1871 | + ); |
|
| 1872 | 1872 | } |
| 1873 | 1873 | if ($forums_imported) { |
| 1874 | - $success_message[] = format_plural( |
|
| 1874 | + $success_message[] = format_plural( |
|
| 1875 | 1875 | $forums_imported, |
| 1876 | 1876 | '1 forum', |
| 1877 | 1877 | '@count forums' |
| 1878 | - ); |
|
| 1878 | + ); |
|
| 1879 | 1879 | } |
| 1880 | 1880 | $message = t( |
| 1881 | - 'Successfully imported @forums', |
|
| 1882 | - array('@forums' => implode(' and ', $success_message)) |
|
| 1881 | + 'Successfully imported @forums', |
|
| 1882 | + array('@forums' => implode(' and ', $success_message)) |
|
| 1883 | 1883 | ); |
| 1884 | 1884 | watchdog('boincimport', |
| 1885 | - 'Successfully imported @forums', |
|
| 1886 | - array('@forums' => implode(' and ', $success_message)), WATCHDOG_INFO |
|
| 1885 | + 'Successfully imported @forums', |
|
| 1886 | + array('@forums' => implode(' and ', $success_message)), WATCHDOG_INFO |
|
| 1887 | 1887 | ); |
| 1888 | 1888 | // Set the forum import successful flag in the variable table |
| 1889 | 1889 | variable_set('boincimport_import_forum_successful', '1'); |
| 1890 | 1890 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 1891 | - } |
|
| 1892 | - else { |
|
| 1891 | + } |
|
| 1892 | + else { |
|
| 1893 | 1893 | // An error occurred. |
| 1894 | 1894 | // $operations contains the operations that remained unprocessed. |
| 1895 | 1895 | $error_operation = reset($operations); |
| 1896 | 1896 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 1897 | - } |
|
| 1898 | - drupal_set_message($message); |
|
| 1897 | + } |
|
| 1898 | + drupal_set_message($message); |
|
| 1899 | 1899 | |
| 1900 | - // Release the lock on the import process |
|
| 1901 | - variable_del('boincimport_process_locked'); |
|
| 1902 | - drupal_goto('admin/boinc/import/process'); |
|
| 1900 | + // Release the lock on the import process |
|
| 1901 | + variable_del('boincimport_process_locked'); |
|
| 1902 | + drupal_goto('admin/boinc/import/process'); |
|
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 1905 | 1905 | |
@@ -1911,82 +1911,82 @@ discard block |
||
| 1911 | 1911 | */ |
| 1912 | 1912 | function boincimport_forum_topics() { |
| 1913 | 1913 | |
| 1914 | - // Check whether topics have been successfully imported already |
|
| 1915 | - if (variable_get('boincimport_import_topic_successful', 0)) { |
|
| 1914 | + // Check whether topics have been successfully imported already |
|
| 1915 | + if (variable_get('boincimport_import_topic_successful', 0)) { |
|
| 1916 | 1916 | drupal_set_message(t('Topic import has already run successfully'), 'warning'); |
| 1917 | 1917 | watchdog( |
| 1918 | - 'boincimport', 'Topic import has already run successfully', |
|
| 1919 | - array(), WATCHDOG_WARNING |
|
| 1918 | + 'boincimport', 'Topic import has already run successfully', |
|
| 1919 | + array(), WATCHDOG_WARNING |
|
| 1920 | 1920 | ); |
| 1921 | 1921 | // Release the lock on the import process |
| 1922 | 1922 | variable_del('boincimport_process_locked'); |
| 1923 | 1923 | return; |
| 1924 | - } |
|
| 1924 | + } |
|
| 1925 | 1925 | |
| 1926 | - if (!variable_get('boincimport_import_topic_started', 0)) { |
|
| 1926 | + if (!variable_get('boincimport_import_topic_started', 0)) { |
|
| 1927 | 1927 | // Could prepare database tables, if new fields are necessary, etc. |
| 1928 | 1928 | variable_set('boincimport_import_topic_started', 1); |
| 1929 | - } |
|
| 1929 | + } |
|
| 1930 | 1930 | |
| 1931 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1931 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 1932 | 1932 | |
| 1933 | - // Get the count of non-team topics to import |
|
| 1934 | - db_set_active('boinc_rw'); |
|
| 1935 | - $topic_count = db_result(db_query(' |
|
| 1933 | + // Get the count of non-team topics to import |
|
| 1934 | + db_set_active('boinc_rw'); |
|
| 1935 | + $topic_count = db_result(db_query(' |
|
| 1936 | 1936 | SELECT COUNT(DISTINCT t.id) |
| 1937 | 1937 | FROM %sthread t |
| 1938 | 1938 | JOIN %sforum f ON f.id = t.forum |
| 1939 | 1939 | JOIN %spost p ON p.thread = t.id |
| 1940 | 1940 | WHERE f.parent_type = 0', |
| 1941 | 1941 | $pre, $pre, $pre |
| 1942 | - )); |
|
| 1943 | - db_set_active('default'); |
|
| 1942 | + )); |
|
| 1943 | + db_set_active('default'); |
|
| 1944 | 1944 | |
| 1945 | - if (!$topic_count) { |
|
| 1945 | + if (!$topic_count) { |
|
| 1946 | 1946 | drupal_set_message( |
| 1947 | - t('There were no topics found: Aborting script'), 'warning' |
|
| 1947 | + t('There were no topics found: Aborting script'), 'warning' |
|
| 1948 | 1948 | ); |
| 1949 | 1949 | watchdog('boincimport', |
| 1950 | - 'There were no topics found: Aborting script', array(), WATCHDOG_WARNING |
|
| 1950 | + 'There were no topics found: Aborting script', array(), WATCHDOG_WARNING |
|
| 1951 | 1951 | ); |
| 1952 | 1952 | // Release the lock on the import process |
| 1953 | 1953 | variable_del('boincimport_process_locked'); |
| 1954 | 1954 | return t('There were no topics found: Aborting script.'); |
| 1955 | - } |
|
| 1955 | + } |
|
| 1956 | 1956 | |
| 1957 | - watchdog('boincimport', |
|
| 1957 | + watchdog('boincimport', |
|
| 1958 | 1958 | 'Found %count topics: Beginning Import', |
| 1959 | 1959 | array('%count' => $topic_count), WATCHDOG_INFO |
| 1960 | - ); |
|
| 1960 | + ); |
|
| 1961 | 1961 | |
| 1962 | - $operations = array(); |
|
| 1963 | - $batch_size = 100; |
|
| 1962 | + $operations = array(); |
|
| 1963 | + $batch_size = 100; |
|
| 1964 | 1964 | |
| 1965 | - // Create batches to process |
|
| 1966 | - for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) { |
|
| 1965 | + // Create batches to process |
|
| 1966 | + for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) { |
|
| 1967 | 1967 | $topics_per_batch = $batch_size; |
| 1968 | 1968 | if ($offset + $batch_size > $topic_count) { |
| 1969 | - $topics_per_batch = $topic_count - $offset; |
|
| 1969 | + $topics_per_batch = $topic_count - $offset; |
|
| 1970 | 1970 | } |
| 1971 | 1971 | $operations[] = array( |
| 1972 | - 'boincimport_topics_op', array( |
|
| 1972 | + 'boincimport_topics_op', array( |
|
| 1973 | 1973 | $offset, $topics_per_batch, $pre |
| 1974 | - ) |
|
| 1974 | + ) |
|
| 1975 | 1975 | ); |
| 1976 | - } |
|
| 1976 | + } |
|
| 1977 | 1977 | |
| 1978 | - $batch = array( |
|
| 1978 | + $batch = array( |
|
| 1979 | 1979 | 'operations' => $operations, |
| 1980 | 1980 | 'finished' => 'boincimport_topics_finished', |
| 1981 | 1981 | 'title' => t('Importing topics'), |
| 1982 | 1982 | 'init_message' => t('Beginning topic import...'), |
| 1983 | 1983 | 'progress_message' => t('Processed @current out of @total batches (@size topics per batch).', array( |
| 1984 | - '@size' => $batch_size, |
|
| 1984 | + '@size' => $batch_size, |
|
| 1985 | 1985 | )), |
| 1986 | 1986 | 'error_message' => t('Topic import has encountered an error.'), |
| 1987 | - ); |
|
| 1987 | + ); |
|
| 1988 | 1988 | |
| 1989 | - batch_set($batch); |
|
| 1989 | + batch_set($batch); |
|
| 1990 | 1990 | } |
| 1991 | 1991 | |
| 1992 | 1992 | /** |
@@ -1994,18 +1994,18 @@ discard block |
||
| 1994 | 1994 | * Create a Drupal node from the given BOINC topic object |
| 1995 | 1995 | */ |
| 1996 | 1996 | function boincimport_topics_op($offset, $batch_size, $pre = '', &$context) { |
| 1997 | - // Initialize the batch, if needed |
|
| 1998 | - if (!isset($context['sandbox']['progress'])) { |
|
| 1997 | + // Initialize the batch, if needed |
|
| 1998 | + if (!isset($context['sandbox']['progress'])) { |
|
| 1999 | 1999 | $context['sandbox']['progress'] = 0; |
| 2000 | 2000 | $context['sandbox']['max'] = $batch_size; |
| 2001 | - } |
|
| 2001 | + } |
|
| 2002 | 2002 | |
| 2003 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 2004 | - $news_forum_id = variable_get('boincimport_news_forum_id', 0); |
|
| 2003 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 2004 | + $news_forum_id = variable_get('boincimport_news_forum_id', 0); |
|
| 2005 | 2005 | |
| 2006 | - // Get the topic to import |
|
| 2007 | - db_set_active('boinc_rw'); |
|
| 2008 | - $topics = db_query(' |
|
| 2006 | + // Get the topic to import |
|
| 2007 | + db_set_active('boinc_rw'); |
|
| 2008 | + $topics = db_query(' |
|
| 2009 | 2009 | SELECT DISTINCT t.id, t.title, t.owner, t.forum, t.locked, t.hidden, |
| 2010 | 2010 | t.sticky, t.timestamp, t.create_time |
| 2011 | 2011 | FROM %sthread t |
@@ -2015,10 +2015,10 @@ discard block |
||
| 2015 | 2015 | ORDER BY t.id ASC |
| 2016 | 2016 | LIMIT %d,%d', |
| 2017 | 2017 | $pre, $pre, $pre, $offset, $batch_size |
| 2018 | - ); |
|
| 2019 | - db_set_active('default'); |
|
| 2018 | + ); |
|
| 2019 | + db_set_active('default'); |
|
| 2020 | 2020 | |
| 2021 | - while ($topic = db_fetch_object($topics)) { |
|
| 2021 | + while ($topic = db_fetch_object($topics)) { |
|
| 2022 | 2022 | |
| 2023 | 2023 | $error_detail = ''; |
| 2024 | 2024 | |
@@ -2031,52 +2031,52 @@ discard block |
||
| 2031 | 2031 | WHERE thread = %d |
| 2032 | 2032 | ORDER BY timestamp ASC |
| 2033 | 2033 | LIMIT 1', |
| 2034 | - $pre, $topic->id |
|
| 2034 | + $pre, $topic->id |
|
| 2035 | 2035 | )); |
| 2036 | 2036 | db_set_active('default'); |
| 2037 | 2037 | |
| 2038 | 2038 | $duplicate = db_result(db_query(' |
| 2039 | 2039 | SELECT COUNT(*) FROM {boincimport_temp_topic} |
| 2040 | 2040 | WHERE topic_id = %d', |
| 2041 | - $topic->id |
|
| 2041 | + $topic->id |
|
| 2042 | 2042 | )); |
| 2043 | 2043 | |
| 2044 | 2044 | if ($duplicate OR !$post) { |
| 2045 | - $success = FALSE; |
|
| 2045 | + $success = FALSE; |
|
| 2046 | 2046 | } |
| 2047 | 2047 | |
| 2048 | 2048 | else { |
| 2049 | - // Get the user and term IDs along with other data to define the topic |
|
| 2050 | - $uid = boincuser_lookup_uid($topic->owner); |
|
| 2051 | - $tid = db_result(db_query(' |
|
| 2049 | + // Get the user and term IDs along with other data to define the topic |
|
| 2050 | + $uid = boincuser_lookup_uid($topic->owner); |
|
| 2051 | + $tid = db_result(db_query(' |
|
| 2052 | 2052 | SELECT tid FROM {boincimport_temp_forum} |
| 2053 | 2053 | WHERE forum_id = %d', |
| 2054 | 2054 | $topic->forum |
| 2055 | - )); |
|
| 2056 | - if (!$topic->owner) { |
|
| 2055 | + )); |
|
| 2056 | + if (!$topic->owner) { |
|
| 2057 | 2057 | $uid = 0; |
| 2058 | - } |
|
| 2058 | + } |
|
| 2059 | 2059 | |
| 2060 | - $node_type = 'forum'; |
|
| 2061 | - $promote = 0; |
|
| 2062 | - $comment = ($topic->locked) ? 1 : 2; |
|
| 2060 | + $node_type = 'forum'; |
|
| 2061 | + $promote = 0; |
|
| 2062 | + $comment = ($topic->locked) ? 1 : 2; |
|
| 2063 | 2063 | |
| 2064 | - $post->content = _boincimport_strip_bbcode($post->content); |
|
| 2065 | - $post->content = _boincimport_text_sanitize($post->content); |
|
| 2066 | - $teaser = node_teaser($post->content); |
|
| 2064 | + $post->content = _boincimport_strip_bbcode($post->content); |
|
| 2065 | + $post->content = _boincimport_text_sanitize($post->content); |
|
| 2066 | + $teaser = node_teaser($post->content); |
|
| 2067 | 2067 | |
| 2068 | - if ($topic->timestamp < $topic->create_time) { |
|
| 2068 | + if ($topic->timestamp < $topic->create_time) { |
|
| 2069 | 2069 | $topic->timestamp = $topic->create_time; |
| 2070 | - } |
|
| 2070 | + } |
|
| 2071 | 2071 | |
| 2072 | - // If dealing with a News topic, be sure it is imported as such |
|
| 2073 | - if ($news_forum_id AND $topic->forum == $news_forum_id) { |
|
| 2072 | + // If dealing with a News topic, be sure it is imported as such |
|
| 2073 | + if ($news_forum_id AND $topic->forum == $news_forum_id) { |
|
| 2074 | 2074 | $node_type = 'news'; |
| 2075 | 2075 | $promote = 1; |
| 2076 | - } |
|
| 2076 | + } |
|
| 2077 | 2077 | |
| 2078 | - // Construct the thread as a forum topic node |
|
| 2079 | - $node = array( |
|
| 2078 | + // Construct the thread as a forum topic node |
|
| 2079 | + $node = array( |
|
| 2080 | 2080 | 'type' => $node_type, |
| 2081 | 2081 | 'title' => $topic->title, |
| 2082 | 2082 | 'uid' => $uid, |
@@ -2090,61 +2090,61 @@ discard block |
||
| 2090 | 2090 | 'sticky' => $topic->sticky, |
| 2091 | 2091 | 'format' => $input_format, |
| 2092 | 2092 | 'teaser' => $teaser, |
| 2093 | - ); |
|
| 2094 | - $node['tid'] = $tid; |
|
| 2093 | + ); |
|
| 2094 | + $node['tid'] = $tid; |
|
| 2095 | 2095 | |
| 2096 | - // Save the topic node |
|
| 2097 | - $node = (object) $node; // node_save requires an object form |
|
| 2098 | - node_save($node); |
|
| 2099 | - taxonomy_node_save($node, array($tid)); |
|
| 2100 | - $success = ($node->nid) ? TRUE : FALSE; |
|
| 2101 | - if ($success) { |
|
| 2096 | + // Save the topic node |
|
| 2097 | + $node = (object) $node; // node_save requires an object form |
|
| 2098 | + node_save($node); |
|
| 2099 | + taxonomy_node_save($node, array($tid)); |
|
| 2100 | + $success = ($node->nid) ? TRUE : FALSE; |
|
| 2101 | + if ($success) { |
|
| 2102 | 2102 | $success = db_query(' |
| 2103 | 2103 | INSERT INTO {boincimport_temp_topic} (topic_id, post_id, nid) |
| 2104 | 2104 | VALUES (%d, %d, %d)', $topic->id, $post->id, $node->nid |
| 2105 | 2105 | ); |
| 2106 | 2106 | if ($success) { |
| 2107 | - // Hack to keep the topics in correct order |
|
| 2108 | - $success = db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE nid = %d', $node->created, $node->nid); |
|
| 2109 | - if (!$success) { |
|
| 2107 | + // Hack to keep the topics in correct order |
|
| 2108 | + $success = db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE nid = %d', $node->created, $node->nid); |
|
| 2109 | + if (!$success) { |
|
| 2110 | 2110 | $error_detail = 'topic imported, but failed to set last comment timestamp'; |
| 2111 | - } |
|
| 2111 | + } |
|
| 2112 | 2112 | } |
| 2113 | 2113 | else { |
| 2114 | - $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table'; |
|
| 2114 | + $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table'; |
|
| 2115 | 2115 | } |
| 2116 | - } |
|
| 2117 | - else { |
|
| 2116 | + } |
|
| 2117 | + else { |
|
| 2118 | 2118 | $error_detail = 'failed to save topic node to database'; |
| 2119 | - } |
|
| 2119 | + } |
|
| 2120 | 2120 | } |
| 2121 | 2121 | |
| 2122 | 2122 | // See if the import worked |
| 2123 | 2123 | $message = ''; |
| 2124 | 2124 | if ($success) { |
| 2125 | - // Store some result for post-processing in the finished callback. |
|
| 2126 | - $context['results']['success'][] = $topic->id; |
|
| 2127 | - $message = "Successfully imported topic {$topic->id}"; |
|
| 2125 | + // Store some result for post-processing in the finished callback. |
|
| 2126 | + $context['results']['success'][] = $topic->id; |
|
| 2127 | + $message = "Successfully imported topic {$topic->id}"; |
|
| 2128 | 2128 | } |
| 2129 | 2129 | elseif ($duplicate) { |
| 2130 | - $context['results']['duplicate'][] = $topic->id; |
|
| 2131 | - $message = "Topic {$topic->id} was already imported"; |
|
| 2130 | + $context['results']['duplicate'][] = $topic->id; |
|
| 2131 | + $message = "Topic {$topic->id} was already imported"; |
|
| 2132 | 2132 | } |
| 2133 | 2133 | elseif (!$post) { |
| 2134 | - $context['results']['empty'][] = $topic->id; |
|
| 2135 | - $message = "Skipping topic {$topic->id} as empty"; |
|
| 2134 | + $context['results']['empty'][] = $topic->id; |
|
| 2135 | + $message = "Skipping topic {$topic->id} as empty"; |
|
| 2136 | 2136 | } |
| 2137 | 2137 | else { |
| 2138 | - $context['results']['failure'][] = $topic->id; |
|
| 2139 | - $message = "Failed to import topic {$topic->id}!"; |
|
| 2140 | - watchdog('boincimport', |
|
| 2138 | + $context['results']['failure'][] = $topic->id; |
|
| 2139 | + $message = "Failed to import topic {$topic->id}!"; |
|
| 2140 | + watchdog('boincimport', |
|
| 2141 | 2141 | 'Failed to import topic @id! (@error)', |
| 2142 | 2142 | array( |
| 2143 | - '@id' => $topic->id, |
|
| 2144 | - '@error' => $error_detail, |
|
| 2143 | + '@id' => $topic->id, |
|
| 2144 | + '@error' => $error_detail, |
|
| 2145 | 2145 | ), |
| 2146 | 2146 | WATCHDOG_WARNING |
| 2147 | - ); |
|
| 2147 | + ); |
|
| 2148 | 2148 | } |
| 2149 | 2149 | |
| 2150 | 2150 | // Update our progress information. |
@@ -2154,54 +2154,54 @@ discard block |
||
| 2154 | 2154 | |
| 2155 | 2155 | // Update the progress for the batch engine |
| 2156 | 2156 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2157 | - $context['finished'] = 1; |
|
| 2157 | + $context['finished'] = 1; |
|
| 2158 | 2158 | } |
| 2159 | 2159 | else { |
| 2160 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2160 | + $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2161 | + } |
|
| 2161 | 2162 | } |
| 2162 | - } |
|
| 2163 | 2163 | } |
| 2164 | 2164 | |
| 2165 | 2165 | /** |
| 2166 | 2166 | * Batch 'finished' callback |
| 2167 | 2167 | */ |
| 2168 | 2168 | function boincimport_topics_finished($success, $results, $operations) { |
| 2169 | - if ($success) { |
|
| 2169 | + if ($success) { |
|
| 2170 | 2170 | // Let's count our successes |
| 2171 | 2171 | $total_imported = count($results['success']); |
| 2172 | 2172 | $duplicates = count($results['duplicate']); |
| 2173 | 2173 | $empty_topics = count($results['empty']); |
| 2174 | 2174 | $message = t( |
| 2175 | - 'Successfully imported @count topics (skipped @duplicates already imported, @abandoned empty topics)', |
|
| 2176 | - array( |
|
| 2175 | + 'Successfully imported @count topics (skipped @duplicates already imported, @abandoned empty topics)', |
|
| 2176 | + array( |
|
| 2177 | 2177 | '@count' => $total_imported, |
| 2178 | 2178 | '@duplicates' => $duplicates, |
| 2179 | 2179 | '@abandoned' => $empty_topics, |
| 2180 | - ) |
|
| 2180 | + ) |
|
| 2181 | 2181 | ); |
| 2182 | 2182 | watchdog('boincimport', |
| 2183 | - 'Successfully imported @count topics (skipped @duplicates already imported, @abandoned empty topics).', |
|
| 2184 | - array( |
|
| 2183 | + 'Successfully imported @count topics (skipped @duplicates already imported, @abandoned empty topics).', |
|
| 2184 | + array( |
|
| 2185 | 2185 | '@count' => $total_imported, |
| 2186 | 2186 | '@duplicates' => $duplicates, |
| 2187 | 2187 | '@abandoned' => $empty_topics, |
| 2188 | - ), WATCHDOG_INFO |
|
| 2188 | + ), WATCHDOG_INFO |
|
| 2189 | 2189 | ); |
| 2190 | 2190 | // Set the topic import successful flag in the variable table |
| 2191 | 2191 | variable_set('boincimport_import_topic_successful', '1'); |
| 2192 | 2192 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 2193 | - } |
|
| 2194 | - else { |
|
| 2193 | + } |
|
| 2194 | + else { |
|
| 2195 | 2195 | // An error occurred. |
| 2196 | 2196 | // $operations contains the operations that remained unprocessed. |
| 2197 | 2197 | $error_operation = reset($operations); |
| 2198 | 2198 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 2199 | - } |
|
| 2200 | - drupal_set_message($message); |
|
| 2199 | + } |
|
| 2200 | + drupal_set_message($message); |
|
| 2201 | 2201 | |
| 2202 | - // Release the lock on the import process |
|
| 2203 | - variable_del('boincimport_process_locked'); |
|
| 2204 | - drupal_goto('admin/boinc/import/process'); |
|
| 2202 | + // Release the lock on the import process |
|
| 2203 | + variable_del('boincimport_process_locked'); |
|
| 2204 | + drupal_goto('admin/boinc/import/process'); |
|
| 2205 | 2205 | } |
| 2206 | 2206 | |
| 2207 | 2207 | |
@@ -2214,91 +2214,91 @@ discard block |
||
| 2214 | 2214 | */ |
| 2215 | 2215 | function boincimport_forum_posts() { |
| 2216 | 2216 | |
| 2217 | - // Check whether forum posts have been successfully imported already |
|
| 2218 | - if (variable_get('boincimport_import_post_successful', 0)) { |
|
| 2217 | + // Check whether forum posts have been successfully imported already |
|
| 2218 | + if (variable_get('boincimport_import_post_successful', 0)) { |
|
| 2219 | 2219 | drupal_set_message(t('Forum post import has already run successfully'), 'warning'); |
| 2220 | 2220 | watchdog( |
| 2221 | - 'boincimport', 'Forum post import has already run successfully', |
|
| 2222 | - array(), WATCHDOG_WARNING |
|
| 2221 | + 'boincimport', 'Forum post import has already run successfully', |
|
| 2222 | + array(), WATCHDOG_WARNING |
|
| 2223 | 2223 | ); |
| 2224 | 2224 | // Release the lock on the import process |
| 2225 | 2225 | variable_del('boincimport_process_locked'); |
| 2226 | 2226 | return; |
| 2227 | - } |
|
| 2227 | + } |
|
| 2228 | 2228 | |
| 2229 | - if (!variable_get('boincimport_import_post_started', 0)) { |
|
| 2229 | + if (!variable_get('boincimport_import_post_started', 0)) { |
|
| 2230 | 2230 | // Could prepare database tables, if new fields are necessary, etc. |
| 2231 | 2231 | variable_set('boincimport_import_post_started', 1); |
| 2232 | - } |
|
| 2232 | + } |
|
| 2233 | 2233 | |
| 2234 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 2234 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 2235 | 2235 | |
| 2236 | - // Get the BOINC threads and get a count of posts to import |
|
| 2237 | - db_set_active('boinc_rw'); |
|
| 2238 | - $topic_count = db_result(db_query(" |
|
| 2236 | + // Get the BOINC threads and get a count of posts to import |
|
| 2237 | + db_set_active('boinc_rw'); |
|
| 2238 | + $topic_count = db_result(db_query(" |
|
| 2239 | 2239 | SELECT COUNT(DISTINCT t.id) FROM %sthread t |
| 2240 | 2240 | JOIN %sforum f ON f.id = t.forum |
| 2241 | 2241 | JOIN %spost p ON p.thread = t.id |
| 2242 | 2242 | WHERE f.parent_type = 0", $pre, $pre, $pre |
| 2243 | - )); |
|
| 2244 | - $total_post_count = db_result(db_query(" |
|
| 2243 | + )); |
|
| 2244 | + $total_post_count = db_result(db_query(" |
|
| 2245 | 2245 | SELECT COUNT(p.id) FROM %spost p |
| 2246 | 2246 | JOIN %sthread t ON t.id = p.thread |
| 2247 | 2247 | JOIN %sforum f ON f.id = t.forum |
| 2248 | 2248 | WHERE f.parent_type = 0", $pre, $pre, $pre |
| 2249 | - )); |
|
| 2250 | - $post_count = $total_post_count - $topic_count; |
|
| 2251 | - db_set_active('default'); |
|
| 2249 | + )); |
|
| 2250 | + $post_count = $total_post_count - $topic_count; |
|
| 2251 | + db_set_active('default'); |
|
| 2252 | 2252 | |
| 2253 | - if ($post_count <= 0) { |
|
| 2253 | + if ($post_count <= 0) { |
|
| 2254 | 2254 | drupal_set_message( |
| 2255 | - t('There were no posts found: Aborting script'), 'warning' |
|
| 2255 | + t('There were no posts found: Aborting script'), 'warning' |
|
| 2256 | 2256 | ); |
| 2257 | 2257 | watchdog('boincimport', |
| 2258 | - 'There were no posts found: Aborting script', array(), WATCHDOG_WARNING |
|
| 2258 | + 'There were no posts found: Aborting script', array(), WATCHDOG_WARNING |
|
| 2259 | 2259 | ); |
| 2260 | 2260 | // Release the lock on the import process |
| 2261 | 2261 | variable_del('boincimport_process_locked'); |
| 2262 | 2262 | return t('There were no posts found: Aborting script.'); |
| 2263 | - } |
|
| 2263 | + } |
|
| 2264 | 2264 | |
| 2265 | - watchdog('boincimport', |
|
| 2265 | + watchdog('boincimport', |
|
| 2266 | 2266 | 'Found %count posts: Beginning Import', |
| 2267 | 2267 | array('%count' => $post_count), WATCHDOG_INFO |
| 2268 | - ); |
|
| 2268 | + ); |
|
| 2269 | 2269 | |
| 2270 | - $operations = array(); |
|
| 2271 | - $batch_size = 100; |
|
| 2270 | + $operations = array(); |
|
| 2271 | + $batch_size = 100; |
|
| 2272 | 2272 | |
| 2273 | - // Create batches to process |
|
| 2274 | - for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) { |
|
| 2273 | + // Create batches to process |
|
| 2274 | + for ($offset = 0; $offset < $topic_count; $offset+=$batch_size) { |
|
| 2275 | 2275 | $topics_per_batch = $batch_size; |
| 2276 | 2276 | if ($offset + $batch_size > $topic_count) { |
| 2277 | - $topics_per_batch = $topic_count - $offset; |
|
| 2277 | + $topics_per_batch = $topic_count - $offset; |
|
| 2278 | 2278 | } |
| 2279 | 2279 | $operations[] = array( |
| 2280 | - 'boincimport_posts_op', array( |
|
| 2280 | + 'boincimport_posts_op', array( |
|
| 2281 | 2281 | $offset, $topics_per_batch |
| 2282 | - ) |
|
| 2282 | + ) |
|
| 2283 | 2283 | ); |
| 2284 | - } |
|
| 2284 | + } |
|
| 2285 | 2285 | |
| 2286 | - $batch = array( |
|
| 2286 | + $batch = array( |
|
| 2287 | 2287 | 'operations' => $operations, |
| 2288 | 2288 | 'finished' => 'boincimport_posts_finished', |
| 2289 | 2289 | 'title' => t('Importing posts'), |
| 2290 | 2290 | 'init_message' => t('Beginning post import...'), |
| 2291 | 2291 | 'progress_message' => t( |
| 2292 | - 'Processed posts in @current out of @total batches (@size topics per batch).', |
|
| 2293 | - array( |
|
| 2292 | + 'Processed posts in @current out of @total batches (@size topics per batch).', |
|
| 2293 | + array( |
|
| 2294 | 2294 | '@size' => $batch_size, |
| 2295 | 2295 | // @current and @total are managed by the batch API |
| 2296 | - ) |
|
| 2296 | + ) |
|
| 2297 | 2297 | ), |
| 2298 | 2298 | 'error_message' => t('Post import has encountered an error.'), |
| 2299 | - ); |
|
| 2299 | + ); |
|
| 2300 | 2300 | |
| 2301 | - batch_set($batch); |
|
| 2301 | + batch_set($batch); |
|
| 2302 | 2302 | } |
| 2303 | 2303 | |
| 2304 | 2304 | /** |
@@ -2306,17 +2306,17 @@ discard block |
||
| 2306 | 2306 | * Create a Drupal comment from the given BOINC post object |
| 2307 | 2307 | */ |
| 2308 | 2308 | function boincimport_posts_op($offset, $batch_size, &$context) { |
| 2309 | - // Initialize the batch, if needed |
|
| 2310 | - if (!isset($context['sandbox']['progress'])) { |
|
| 2309 | + // Initialize the batch, if needed |
|
| 2310 | + if (!isset($context['sandbox']['progress'])) { |
|
| 2311 | 2311 | $context['sandbox']['progress'] = 0; |
| 2312 | 2312 | $context['sandbox']['max'] = $batch_size; |
| 2313 | - } |
|
| 2313 | + } |
|
| 2314 | 2314 | |
| 2315 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 2315 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 2316 | 2316 | |
| 2317 | - // Get the topics with posts to import |
|
| 2318 | - db_set_active('boinc_rw'); |
|
| 2319 | - $boinc_topic_ids = db_query(' |
|
| 2317 | + // Get the topics with posts to import |
|
| 2318 | + db_set_active('boinc_rw'); |
|
| 2319 | + $boinc_topic_ids = db_query(' |
|
| 2320 | 2320 | SELECT DISTINCT t.id FROM %sthread t |
| 2321 | 2321 | JOIN %sforum f ON f.id = t.forum |
| 2322 | 2322 | JOIN %spost p ON p.thread = t.id |
@@ -2324,10 +2324,10 @@ discard block |
||
| 2324 | 2324 | ORDER BY t.id |
| 2325 | 2325 | LIMIT %d,%d', |
| 2326 | 2326 | $pre, $pre, $pre, $offset, $batch_size |
| 2327 | - ); |
|
| 2328 | - db_set_active('default'); |
|
| 2327 | + ); |
|
| 2328 | + db_set_active('default'); |
|
| 2329 | 2329 | |
| 2330 | - while ($boinc_topic = db_fetch_object($boinc_topic_ids)) { |
|
| 2330 | + while ($boinc_topic = db_fetch_object($boinc_topic_ids)) { |
|
| 2331 | 2331 | // Get the posts in this topic |
| 2332 | 2332 | db_set_active('boinc_rw'); |
| 2333 | 2333 | $boinc_posts = db_query(' |
@@ -2345,29 +2345,29 @@ discard block |
||
| 2345 | 2345 | |
| 2346 | 2346 | while ($post = db_fetch_object($boinc_posts)) { |
| 2347 | 2347 | |
| 2348 | - // Skip the first post as it has already been imported as a topic |
|
| 2349 | - if ($first_post) { |
|
| 2348 | + // Skip the first post as it has already been imported as a topic |
|
| 2349 | + if ($first_post) { |
|
| 2350 | 2350 | $first_post = false; |
| 2351 | 2351 | continue; |
| 2352 | - } |
|
| 2352 | + } |
|
| 2353 | 2353 | |
| 2354 | - // Making it this far confirms that there are posts to import |
|
| 2355 | - $topic_has_responses = TRUE; |
|
| 2354 | + // Making it this far confirms that there are posts to import |
|
| 2355 | + $topic_has_responses = TRUE; |
|
| 2356 | 2356 | |
| 2357 | - $is_duplicate = db_result(db_query(' |
|
| 2357 | + $is_duplicate = db_result(db_query(' |
|
| 2358 | 2358 | SELECT COUNT(*) FROM {boincimport_temp_post} |
| 2359 | 2359 | WHERE post_id = %d', |
| 2360 | 2360 | $post->id |
| 2361 | - )); |
|
| 2362 | - if ($is_duplicate) { |
|
| 2361 | + )); |
|
| 2362 | + if ($is_duplicate) { |
|
| 2363 | 2363 | // This post has already been imported |
| 2364 | 2364 | $context['results']['posts']['duplicate'][] = $post->id; |
| 2365 | 2365 | $duplicate_posts++; |
| 2366 | 2366 | continue; |
| 2367 | - } |
|
| 2367 | + } |
|
| 2368 | 2368 | |
| 2369 | - // Make sure the post is valid |
|
| 2370 | - if ($post->content) { |
|
| 2369 | + // Make sure the post is valid |
|
| 2370 | + if ($post->content) { |
|
| 2371 | 2371 | |
| 2372 | 2372 | // Get user, node, and parent IDs for the post and sanitize |
| 2373 | 2373 | $uid = boincuser_lookup_uid($post->user); |
@@ -2376,14 +2376,14 @@ discard block |
||
| 2376 | 2376 | FROM {boincimport_temp_topic} btt |
| 2377 | 2377 | LEFT JOIN {node_revisions} AS nr ON btt.nid = nr.nid |
| 2378 | 2378 | WHERE btt.topic_id = %d', |
| 2379 | - $post->thread |
|
| 2379 | + $post->thread |
|
| 2380 | 2380 | )); |
| 2381 | 2381 | $nid = $node->nid; |
| 2382 | 2382 | $pid = db_result(db_query(' |
| 2383 | 2383 | SELECT cid |
| 2384 | 2384 | FROM {boincimport_temp_post} |
| 2385 | 2385 | WHERE post_id = %d', |
| 2386 | - $post->parent_post)); |
|
| 2386 | + $post->parent_post)); |
|
| 2387 | 2387 | if (is_null($pid)) $pid = 0; |
| 2388 | 2388 | if (!$uid) $uid = 0; |
| 2389 | 2389 | |
@@ -2394,85 +2394,85 @@ discard block |
||
| 2394 | 2394 | SELECT COUNT(*) |
| 2395 | 2395 | FROM {comments} |
| 2396 | 2396 | WHERE nid = %d', |
| 2397 | - $nid |
|
| 2397 | + $nid |
|
| 2398 | 2398 | )); |
| 2399 | 2399 | $post_reply = $pid; |
| 2400 | 2400 | |
| 2401 | 2401 | if ($post_reply OR $topic_reply) { |
| 2402 | - // Create a subject for the post from the post content. The body may be in |
|
| 2403 | - // any format, so we: |
|
| 2404 | - // 1) Filter it into HTML |
|
| 2405 | - // 2) Strip out all HTML tags |
|
| 2406 | - // 3) Convert entities back to plain-text. |
|
| 2407 | - // Note: format is checked by check_markup(). |
|
| 2408 | - $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, TRUE); |
|
| 2409 | - // Replace "Quote:" with "RE:" |
|
| 2410 | - $subject = str_replace('Quote:', 'RE: ', $subject); |
|
| 2411 | - // Fringe cases where the comment body is populated only by HTML tags |
|
| 2412 | - // will require a default subject... |
|
| 2413 | - if ($subject === '') |
|
| 2402 | + // Create a subject for the post from the post content. The body may be in |
|
| 2403 | + // any format, so we: |
|
| 2404 | + // 1) Filter it into HTML |
|
| 2405 | + // 2) Strip out all HTML tags |
|
| 2406 | + // 3) Convert entities back to plain-text. |
|
| 2407 | + // Note: format is checked by check_markup(). |
|
| 2408 | + $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, TRUE); |
|
| 2409 | + // Replace "Quote:" with "RE:" |
|
| 2410 | + $subject = str_replace('Quote:', 'RE: ', $subject); |
|
| 2411 | + // Fringe cases where the comment body is populated only by HTML tags |
|
| 2412 | + // will require a default subject... |
|
| 2413 | + if ($subject === '') |
|
| 2414 | 2414 | $subject = "RE: {$node->title}"; |
| 2415 | 2415 | } else { |
| 2416 | - // This is the first post in the topic |
|
| 2417 | - $subject = $node->title; |
|
| 2416 | + // This is the first post in the topic |
|
| 2417 | + $subject = $node->title; |
|
| 2418 | 2418 | } |
| 2419 | 2419 | |
| 2420 | 2420 | // Construct the post as a Drupal comment |
| 2421 | 2421 | $comment = array( |
| 2422 | - 'pid' => $pid, |
|
| 2423 | - 'nid' => $nid, |
|
| 2424 | - 'uid' => $uid, |
|
| 2425 | - 'subject' => $subject, |
|
| 2426 | - 'comment' => $post->content, |
|
| 2427 | - 'timestamp' => $post->timestamp, |
|
| 2428 | - 'status' => $post->hidden, |
|
| 2429 | - 'format' => $input_format |
|
| 2422 | + 'pid' => $pid, |
|
| 2423 | + 'nid' => $nid, |
|
| 2424 | + 'uid' => $uid, |
|
| 2425 | + 'subject' => $subject, |
|
| 2426 | + 'comment' => $post->content, |
|
| 2427 | + 'timestamp' => $post->timestamp, |
|
| 2428 | + 'status' => $post->hidden, |
|
| 2429 | + 'format' => $input_format |
|
| 2430 | 2430 | ); |
| 2431 | 2431 | |
| 2432 | 2432 | // Save the comment |
| 2433 | 2433 | if (boincimport_forum_comment_save($comment)) { |
| 2434 | - $success = db_query(' |
|
| 2434 | + $success = db_query(' |
|
| 2435 | 2435 | INSERT INTO {boincimport_temp_post} (post_id, cid) |
| 2436 | 2436 | VALUES (%d, %d)', |
| 2437 | 2437 | $post->id, $comment['cid'] |
| 2438 | - ); |
|
| 2439 | - if ($success) { |
|
| 2438 | + ); |
|
| 2439 | + if ($success) { |
|
| 2440 | 2440 | $posts_imported++; |
| 2441 | 2441 | $context['results']['posts']['success'][] = $post->id; |
| 2442 | - } |
|
| 2443 | - else { |
|
| 2442 | + } |
|
| 2443 | + else { |
|
| 2444 | 2444 | $context['results']['posts']['failure'][] = $post->id; |
| 2445 | 2445 | $error_posts++; |
| 2446 | - } |
|
| 2446 | + } |
|
| 2447 | 2447 | } |
| 2448 | 2448 | else { |
| 2449 | - $context['results']['posts']['failure'][] = $post->id; |
|
| 2450 | - $error_posts++; |
|
| 2449 | + $context['results']['posts']['failure'][] = $post->id; |
|
| 2450 | + $error_posts++; |
|
| 2451 | + } |
|
| 2451 | 2452 | } |
| 2452 | - } |
|
| 2453 | - else { |
|
| 2453 | + else { |
|
| 2454 | 2454 | $context['results']['posts']['empty'][] = $post->id; |
| 2455 | 2455 | $empty_posts++; |
| 2456 | - } |
|
| 2456 | + } |
|
| 2457 | 2457 | } |
| 2458 | 2458 | |
| 2459 | 2459 | $message = ''; |
| 2460 | 2460 | if ($success OR !$topic_has_responses) { |
| 2461 | - // Store some result for post-processing in the finished callback. |
|
| 2462 | - $context['results']['success'][] = $boinc_topic->id; |
|
| 2463 | - $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
|
| 2461 | + // Store some result for post-processing in the finished callback. |
|
| 2462 | + $context['results']['success'][] = $boinc_topic->id; |
|
| 2463 | + $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
|
| 2464 | 2464 | } |
| 2465 | 2465 | else { |
| 2466 | - $context['results']['failure'][] = $boinc_topic->id; |
|
| 2467 | - $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)"; |
|
| 2468 | - watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', |
|
| 2466 | + $context['results']['failure'][] = $boinc_topic->id; |
|
| 2467 | + $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)"; |
|
| 2468 | + watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', |
|
| 2469 | 2469 | array( |
| 2470 | - '@id' => $boinc_topic->id, |
|
| 2471 | - '@error_posts' => $error_posts, |
|
| 2472 | - '@duplicate_posts' => $duplicate_posts, |
|
| 2473 | - '@empty_posts' => $empty_posts, |
|
| 2470 | + '@id' => $boinc_topic->id, |
|
| 2471 | + '@error_posts' => $error_posts, |
|
| 2472 | + '@duplicate_posts' => $duplicate_posts, |
|
| 2473 | + '@empty_posts' => $empty_posts, |
|
| 2474 | 2474 | ), WATCHDOG_WARNING |
| 2475 | - ); |
|
| 2475 | + ); |
|
| 2476 | 2476 | } |
| 2477 | 2477 | |
| 2478 | 2478 | // Update our progress information. |
@@ -2482,19 +2482,19 @@ discard block |
||
| 2482 | 2482 | |
| 2483 | 2483 | // Update the progress for the batch engine |
| 2484 | 2484 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2485 | - $context['finished'] = 1; |
|
| 2485 | + $context['finished'] = 1; |
|
| 2486 | 2486 | } |
| 2487 | 2487 | else { |
| 2488 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2488 | + $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 2489 | + } |
|
| 2489 | 2490 | } |
| 2490 | - } |
|
| 2491 | 2491 | } |
| 2492 | 2492 | |
| 2493 | 2493 | /** |
| 2494 | 2494 | * Batch 'finished' callback |
| 2495 | 2495 | */ |
| 2496 | 2496 | function boincimport_posts_finished($success, $results, $operations) { |
| 2497 | - if ($success) { |
|
| 2497 | + if ($success) { |
|
| 2498 | 2498 | // Let's count our successes |
| 2499 | 2499 | $posts_imported = count($results['posts']['success']); |
| 2500 | 2500 | $topic_count = count($results['success']); |
@@ -2503,39 +2503,39 @@ discard block |
||
| 2503 | 2503 | $empty_posts = count($results['posts']['empty']); |
| 2504 | 2504 | $failed_posts = count($results['posts']['failure']); |
| 2505 | 2505 | $message = t( |
| 2506 | - 'Successfully imported @post_count posts in @topic_count topics ' . |
|
| 2507 | - '(@skipped topics either had no replies or all replies were already imported, ' . |
|
| 2508 | - '@duplicates posts were skipped as already imported, ' . |
|
| 2509 | - '@empty_posts had no content, ' . |
|
| 2510 | - 'and @error_posts encountered errors during import)', |
|
| 2511 | - array( |
|
| 2506 | + 'Successfully imported @post_count posts in @topic_count topics ' . |
|
| 2507 | + '(@skipped topics either had no replies or all replies were already imported, ' . |
|
| 2508 | + '@duplicates posts were skipped as already imported, ' . |
|
| 2509 | + '@empty_posts had no content, ' . |
|
| 2510 | + 'and @error_posts encountered errors during import)', |
|
| 2511 | + array( |
|
| 2512 | 2512 | '@post_count' => $posts_imported, |
| 2513 | 2513 | '@topic_count' => $topic_count, |
| 2514 | 2514 | '@skipped' => $topics_skipped, |
| 2515 | 2515 | '@duplicates' => $duplicates, |
| 2516 | 2516 | '@empty_posts' => $empty_posts, |
| 2517 | 2517 | '@error_posts' => $failed_posts, |
| 2518 | - ) |
|
| 2518 | + ) |
|
| 2519 | 2519 | ); |
| 2520 | 2520 | watchdog('boincimport', |
| 2521 | - $message, |
|
| 2522 | - array(), WATCHDOG_INFO |
|
| 2521 | + $message, |
|
| 2522 | + array(), WATCHDOG_INFO |
|
| 2523 | 2523 | ); |
| 2524 | 2524 | // Set the post import successful flag in the variable table |
| 2525 | 2525 | variable_set('boincimport_import_post_successful', '1'); |
| 2526 | 2526 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 2527 | - } |
|
| 2528 | - else { |
|
| 2527 | + } |
|
| 2528 | + else { |
|
| 2529 | 2529 | // An error occurred. |
| 2530 | 2530 | // $operations contains the operations that remained unprocessed. |
| 2531 | 2531 | $error_operation = reset($operations); |
| 2532 | 2532 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 2533 | - } |
|
| 2534 | - drupal_set_message($message); |
|
| 2533 | + } |
|
| 2534 | + drupal_set_message($message); |
|
| 2535 | 2535 | |
| 2536 | - // Release the lock on the import process |
|
| 2537 | - variable_del('boincimport_process_locked'); |
|
| 2538 | - drupal_goto('admin/boinc/import/process'); |
|
| 2536 | + // Release the lock on the import process |
|
| 2537 | + variable_del('boincimport_process_locked'); |
|
| 2538 | + drupal_goto('admin/boinc/import/process'); |
|
| 2539 | 2539 | } |
| 2540 | 2540 | |
| 2541 | 2541 | |
@@ -2548,97 +2548,97 @@ discard block |
||
| 2548 | 2548 | */ |
| 2549 | 2549 | function boincimport_team_forums() { |
| 2550 | 2550 | |
| 2551 | - // Check whether team forums have been successfully imported already |
|
| 2552 | - if (variable_get('boincimport_import_team_forum_successful', 0)) { |
|
| 2551 | + // Check whether team forums have been successfully imported already |
|
| 2552 | + if (variable_get('boincimport_import_team_forum_successful', 0)) { |
|
| 2553 | 2553 | drupal_set_message(t('Team forum import has already run successfully'), 'warning'); |
| 2554 | 2554 | watchdog( |
| 2555 | - 'boincimport', 'Team forum import has already run successfully', |
|
| 2556 | - array(), WATCHDOG_WARNING |
|
| 2555 | + 'boincimport', 'Team forum import has already run successfully', |
|
| 2556 | + array(), WATCHDOG_WARNING |
|
| 2557 | 2557 | ); |
| 2558 | - } |
|
| 2558 | + } |
|
| 2559 | 2559 | |
| 2560 | - if (!variable_get('boincimport_import_team_forum_started', 0)) { |
|
| 2560 | + if (!variable_get('boincimport_import_team_forum_started', 0)) { |
|
| 2561 | 2561 | // Could prepare database tables, if new fields are necessary, etc. |
| 2562 | 2562 | variable_set('boincimport_import_team_forum_started', 1); |
| 2563 | - } |
|
| 2563 | + } |
|
| 2564 | 2564 | |
| 2565 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 2565 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 2566 | 2566 | |
| 2567 | - // Get team forums from BOINC database |
|
| 2568 | - db_set_active('boinc_rw'); |
|
| 2569 | - $boincteam_forums = db_query(' |
|
| 2567 | + // Get team forums from BOINC database |
|
| 2568 | + db_set_active('boinc_rw'); |
|
| 2569 | + $boincteam_forums = db_query(' |
|
| 2570 | 2570 | SELECT id, title, description, category, timestamp, post_min_interval, |
| 2571 | 2571 | post_min_total_credit, post_min_expavg_credit |
| 2572 | 2572 | FROM %sforum |
| 2573 | 2573 | WHERE parent_type = 1 |
| 2574 | 2574 | ORDER BY id ASC', |
| 2575 | 2575 | $pre |
| 2576 | - ); |
|
| 2577 | - $team_forum_count = mysqli_num_rows($boincteam_forums); |
|
| 2578 | - db_set_active('default'); |
|
| 2576 | + ); |
|
| 2577 | + $team_forum_count = mysqli_num_rows($boincteam_forums); |
|
| 2578 | + db_set_active('default'); |
|
| 2579 | 2579 | |
| 2580 | - if (!$team_forum_count) { |
|
| 2580 | + if (!$team_forum_count) { |
|
| 2581 | 2581 | drupal_set_message( |
| 2582 | - t('There were no team forums found: Aborting script'), 'warning' |
|
| 2582 | + t('There were no team forums found: Aborting script'), 'warning' |
|
| 2583 | 2583 | ); |
| 2584 | 2584 | watchdog('boincimport', |
| 2585 | - 'There were no team forums found: Aborting script', array(), WATCHDOG_WARNING |
|
| 2585 | + 'There were no team forums found: Aborting script', array(), WATCHDOG_WARNING |
|
| 2586 | 2586 | ); |
| 2587 | 2587 | // Release the lock on the import process |
| 2588 | 2588 | variable_del('boincimport_process_locked'); |
| 2589 | 2589 | return t('There were no BLAH found: Aborting script.'); |
| 2590 | - } |
|
| 2590 | + } |
|
| 2591 | 2591 | |
| 2592 | - watchdog('boincimport', |
|
| 2592 | + watchdog('boincimport', |
|
| 2593 | 2593 | 'Found %count team forums: Beginning Import', |
| 2594 | 2594 | array('%count' => $team_forum_count), WATCHDOG_INFO |
| 2595 | - ); |
|
| 2595 | + ); |
|
| 2596 | 2596 | |
| 2597 | - $operations = array(); |
|
| 2598 | - $existing_team_forums = array(); |
|
| 2599 | - $duplicates = array(); |
|
| 2597 | + $operations = array(); |
|
| 2598 | + $existing_team_forums = array(); |
|
| 2599 | + $duplicates = array(); |
|
| 2600 | 2600 | |
| 2601 | - // Get the list of team forums already in Drupal to be sure we're not |
|
| 2602 | - // importing any twice |
|
| 2603 | - $result = db_query(' |
|
| 2601 | + // Get the list of team forums already in Drupal to be sure we're not |
|
| 2602 | + // importing any twice |
|
| 2603 | + $result = db_query(' |
|
| 2604 | 2604 | SELECT nid, boinc_id FROM {boincteam_forum}' |
| 2605 | - ); |
|
| 2606 | - while ($row = db_fetch_object($result)) { |
|
| 2605 | + ); |
|
| 2606 | + while ($row = db_fetch_object($result)) { |
|
| 2607 | 2607 | $existing_team_forums[$row->boinc_id] = $row->nid; |
| 2608 | - } |
|
| 2608 | + } |
|
| 2609 | 2609 | |
| 2610 | - // Create batches to process |
|
| 2611 | - while ($boincteam_forum = db_fetch_object($boincteam_forums)) { |
|
| 2612 | - if (isset($existing_team_forums[$boincteam_forum->id])) { |
|
| 2613 | - // This team has already been imported |
|
| 2614 | - $duplicates[] = $boincteam_forum->id; |
|
| 2610 | + // Create batches to process |
|
| 2611 | + while ($boincteam_forum = db_fetch_object($boincteam_forums)) { |
|
| 2612 | + if (isset($existing_team_forums[$boincteam_forum->id])) { |
|
| 2613 | + // This team has already been imported |
|
| 2614 | + $duplicates[] = $boincteam_forum->id; |
|
| 2615 | 2615 | } |
| 2616 | 2616 | else { |
| 2617 | - $operations[] = array( |
|
| 2617 | + $operations[] = array( |
|
| 2618 | 2618 | 'boincimport_team_forums_op', array( |
| 2619 | - $boincteam_forum |
|
| 2619 | + $boincteam_forum |
|
| 2620 | 2620 | ) |
| 2621 | - ); |
|
| 2621 | + ); |
|
| 2622 | + } |
|
| 2622 | 2623 | } |
| 2623 | - } |
|
| 2624 | 2624 | |
| 2625 | - if ($duplicates) { |
|
| 2625 | + if ($duplicates) { |
|
| 2626 | 2626 | drupal_set_message(t( |
| 2627 | - 'Skipped @count team forums that were already imported', |
|
| 2628 | - array('@count' => count($duplicates)) |
|
| 2627 | + 'Skipped @count team forums that were already imported', |
|
| 2628 | + array('@count' => count($duplicates)) |
|
| 2629 | 2629 | )); |
| 2630 | - } |
|
| 2630 | + } |
|
| 2631 | 2631 | |
| 2632 | - $batch = array( |
|
| 2632 | + $batch = array( |
|
| 2633 | 2633 | 'operations' => $operations, |
| 2634 | 2634 | 'finished' => 'boincimport_team_forums_finished', |
| 2635 | 2635 | 'title' => t('Importing team forums'), |
| 2636 | 2636 | 'init_message' => t('Beginning team forum import...'), |
| 2637 | 2637 | 'progress_message' => t('Processed @current out of @total team forums.'), |
| 2638 | 2638 | 'error_message' => t('Team forum import has encountered an error.'), |
| 2639 | - ); |
|
| 2639 | + ); |
|
| 2640 | 2640 | |
| 2641 | - batch_set($batch); |
|
| 2641 | + batch_set($batch); |
|
| 2642 | 2642 | } |
| 2643 | 2643 | |
| 2644 | 2644 | /** |
@@ -2648,15 +2648,15 @@ discard block |
||
| 2648 | 2648 | */ |
| 2649 | 2649 | function boincimport_team_forums_op($boincteam_forum, &$context) { |
| 2650 | 2650 | |
| 2651 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 2651 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 2652 | 2652 | |
| 2653 | - // Set term parameters for forums |
|
| 2654 | - $forum_id = $boincteam_forum->id; |
|
| 2655 | - $team_id = boincteam_lookup_nid($boincteam_forum->category); |
|
| 2656 | - $name = $boincteam_forum->title; |
|
| 2657 | - $description = strip_tags($boincteam_forum->description); |
|
| 2653 | + // Set term parameters for forums |
|
| 2654 | + $forum_id = $boincteam_forum->id; |
|
| 2655 | + $team_id = boincteam_lookup_nid($boincteam_forum->category); |
|
| 2656 | + $name = $boincteam_forum->title; |
|
| 2657 | + $description = strip_tags($boincteam_forum->description); |
|
| 2658 | 2658 | |
| 2659 | - $success = db_query(" |
|
| 2659 | + $success = db_query(" |
|
| 2660 | 2660 | INSERT INTO {boincteam_forum} SET |
| 2661 | 2661 | boinc_id = %d, |
| 2662 | 2662 | nid = %d, |
@@ -2672,67 +2672,67 @@ discard block |
||
| 2672 | 2672 | time(), 0, $boincteam_forum->post_min_interval, |
| 2673 | 2673 | $boincteam_forum->post_min_total_credit, |
| 2674 | 2674 | $boincteam_forum->post_min_expavg_credit |
| 2675 | - ); |
|
| 2675 | + ); |
|
| 2676 | 2676 | |
| 2677 | - $message = ''; |
|
| 2678 | - if ($success) { |
|
| 2677 | + $message = ''; |
|
| 2678 | + if ($success) { |
|
| 2679 | 2679 | // Store some result for post-processing in the finished callback. |
| 2680 | 2680 | $context['results']['success'][] = $forum_id; |
| 2681 | 2681 | $message = "Successfully imported team forum {$forum_id}"; |
| 2682 | - } |
|
| 2683 | - else { |
|
| 2682 | + } |
|
| 2683 | + else { |
|
| 2684 | 2684 | $context['results']['failure'][] = $forum_id; |
| 2685 | 2685 | $message = "Failed to import team forum {$forum_id}!"; |
| 2686 | 2686 | watchdog('boincimport', |
| 2687 | - 'Failed to import team forum @id!', |
|
| 2688 | - array('@id' => $forum_id), WATCHDOG_WARNING |
|
| 2687 | + 'Failed to import team forum @id!', |
|
| 2688 | + array('@id' => $forum_id), WATCHDOG_WARNING |
|
| 2689 | 2689 | ); |
| 2690 | - } |
|
| 2690 | + } |
|
| 2691 | 2691 | |
| 2692 | - // Update our progress information. |
|
| 2693 | - $context['sandbox']['progress']++; |
|
| 2694 | - $context['sandbox']['current_forum'] = $forum_id; |
|
| 2695 | - $context['message'] = $message; |
|
| 2692 | + // Update our progress information. |
|
| 2693 | + $context['sandbox']['progress']++; |
|
| 2694 | + $context['sandbox']['current_forum'] = $forum_id; |
|
| 2695 | + $context['message'] = $message; |
|
| 2696 | 2696 | |
| 2697 | - // Update the progress for the batch engine |
|
| 2698 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 2697 | + // Update the progress for the batch engine |
|
| 2698 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 2699 | 2699 | $context['finished'] = 1; |
| 2700 | - } |
|
| 2701 | - else { |
|
| 2700 | + } |
|
| 2701 | + else { |
|
| 2702 | 2702 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2703 | - } |
|
| 2703 | + } |
|
| 2704 | 2704 | } |
| 2705 | 2705 | |
| 2706 | 2706 | /** |
| 2707 | 2707 | * Batch 'finished' callback |
| 2708 | 2708 | */ |
| 2709 | 2709 | function boincimport_team_forums_finished($success, $results, $operations) { |
| 2710 | - if ($success) { |
|
| 2710 | + if ($success) { |
|
| 2711 | 2711 | // Let's count our successes |
| 2712 | 2712 | $total_imported = count($results['success']); |
| 2713 | 2713 | $message = t( |
| 2714 | - 'Successfully imported @count team forums', |
|
| 2715 | - array('@count' => $total_imported) |
|
| 2714 | + 'Successfully imported @count team forums', |
|
| 2715 | + array('@count' => $total_imported) |
|
| 2716 | 2716 | ); |
| 2717 | 2717 | watchdog('boincimport', |
| 2718 | - 'Successfully imported @count team forums.', |
|
| 2719 | - array('@count' => $total_imported), WATCHDOG_INFO |
|
| 2718 | + 'Successfully imported @count team forums.', |
|
| 2719 | + array('@count' => $total_imported), WATCHDOG_INFO |
|
| 2720 | 2720 | ); |
| 2721 | 2721 | // Set the team forum import successful flag in the variable table |
| 2722 | 2722 | variable_set('boincimport_import_team_forum_successful', '1'); |
| 2723 | 2723 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 2724 | - } |
|
| 2725 | - else { |
|
| 2724 | + } |
|
| 2725 | + else { |
|
| 2726 | 2726 | // An error occurred. |
| 2727 | 2727 | // $operations contains the operations that remained unprocessed. |
| 2728 | 2728 | $error_operation = reset($operations); |
| 2729 | 2729 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 2730 | - } |
|
| 2731 | - drupal_set_message($message); |
|
| 2730 | + } |
|
| 2731 | + drupal_set_message($message); |
|
| 2732 | 2732 | |
| 2733 | - // Release the lock on the import process |
|
| 2734 | - variable_del('boincimport_process_locked'); |
|
| 2735 | - drupal_goto('admin/boinc/import/process'); |
|
| 2733 | + // Release the lock on the import process |
|
| 2734 | + variable_del('boincimport_process_locked'); |
|
| 2735 | + drupal_goto('admin/boinc/import/process'); |
|
| 2736 | 2736 | } |
| 2737 | 2737 | |
| 2738 | 2738 | |
@@ -2745,25 +2745,25 @@ discard block |
||
| 2745 | 2745 | */ |
| 2746 | 2746 | function boincimport_team_forum_topics() { |
| 2747 | 2747 | |
| 2748 | - // Check whether team forum topics have been successfully imported already |
|
| 2749 | - if (variable_get('boincimport_import_team_topic_successful', 0)) { |
|
| 2748 | + // Check whether team forum topics have been successfully imported already |
|
| 2749 | + if (variable_get('boincimport_import_team_topic_successful', 0)) { |
|
| 2750 | 2750 | drupal_set_message(t('Team topic import has already run successfully'), 'warning'); |
| 2751 | 2751 | watchdog( |
| 2752 | - 'boincimport', 'Team topic import has already run successfully', |
|
| 2753 | - array(), WATCHDOG_WARNING |
|
| 2752 | + 'boincimport', 'Team topic import has already run successfully', |
|
| 2753 | + array(), WATCHDOG_WARNING |
|
| 2754 | 2754 | ); |
| 2755 | - } |
|
| 2755 | + } |
|
| 2756 | 2756 | |
| 2757 | - if (!variable_get('boincimport_import_team_topic_started', 0)) { |
|
| 2757 | + if (!variable_get('boincimport_import_team_topic_started', 0)) { |
|
| 2758 | 2758 | // Could prepare database tables, if new fields are necessary, etc. |
| 2759 | 2759 | variable_set('boincimport_import_team_topic_started', 1); |
| 2760 | - } |
|
| 2760 | + } |
|
| 2761 | 2761 | |
| 2762 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 2762 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 2763 | 2763 | |
| 2764 | - // Get all team topics to import from BOINC |
|
| 2765 | - db_set_active('boinc_rw'); |
|
| 2766 | - $boincteam_topics = db_query(' |
|
| 2764 | + // Get all team topics to import from BOINC |
|
| 2765 | + db_set_active('boinc_rw'); |
|
| 2766 | + $boincteam_topics = db_query(' |
|
| 2767 | 2767 | SELECT DISTINCT t.id, t.title, t.owner, t.forum, t.locked, t.hidden, |
| 2768 | 2768 | t.sticky, t.timestamp, t.create_time |
| 2769 | 2769 | FROM %sthread t |
@@ -2772,78 +2772,78 @@ discard block |
||
| 2772 | 2772 | WHERE f.parent_type = 1 |
| 2773 | 2773 | ORDER BY id', |
| 2774 | 2774 | $pre, $pre, $pre |
| 2775 | - ); |
|
| 2776 | - $boincteam_topic_count = mysqli_num_rows($boincteam_topics); |
|
| 2777 | - $total_team_topic_count = db_result(db_query(' |
|
| 2775 | + ); |
|
| 2776 | + $boincteam_topic_count = mysqli_num_rows($boincteam_topics); |
|
| 2777 | + $total_team_topic_count = db_result(db_query(' |
|
| 2778 | 2778 | SELECT COUNT(*) FROM %sthread t |
| 2779 | 2779 | JOIN %sforum f ON f.id = t.forum |
| 2780 | 2780 | WHERE f.parent_type = 1', $pre, $pre |
| 2781 | - )); |
|
| 2782 | - $empty_topic_count = $total_team_topic_count - $boincteam_topic_count; |
|
| 2783 | - db_set_active('default'); |
|
| 2781 | + )); |
|
| 2782 | + $empty_topic_count = $total_team_topic_count - $boincteam_topic_count; |
|
| 2783 | + db_set_active('default'); |
|
| 2784 | 2784 | |
| 2785 | - if (!$boincteam_topic_count) { |
|
| 2785 | + if (!$boincteam_topic_count) { |
|
| 2786 | 2786 | drupal_set_message( |
| 2787 | - t('There were no team topics found: Aborting script'), 'warning' |
|
| 2787 | + t('There were no team topics found: Aborting script'), 'warning' |
|
| 2788 | 2788 | ); |
| 2789 | 2789 | watchdog('boincimport', |
| 2790 | - 'There were no team topics found: Aborting script', array(), WATCHDOG_WARNING |
|
| 2790 | + 'There were no team topics found: Aborting script', array(), WATCHDOG_WARNING |
|
| 2791 | 2791 | ); |
| 2792 | 2792 | // Release the lock on the import process |
| 2793 | 2793 | variable_del('boincimport_process_locked'); |
| 2794 | 2794 | return t('There were no team topics found: Aborting script.'); |
| 2795 | - } |
|
| 2795 | + } |
|
| 2796 | 2796 | |
| 2797 | - watchdog('boincimport', |
|
| 2797 | + watchdog('boincimport', |
|
| 2798 | 2798 | 'Found %count team topics: Beginning Import', |
| 2799 | 2799 | array('%count' => $boincteam_topic_count), WATCHDOG_INFO |
| 2800 | - ); |
|
| 2800 | + ); |
|
| 2801 | 2801 | |
| 2802 | - $operations = array(); |
|
| 2803 | - $existing_team_topics = array(); |
|
| 2804 | - $duplicates = array(); |
|
| 2802 | + $operations = array(); |
|
| 2803 | + $existing_team_topics = array(); |
|
| 2804 | + $duplicates = array(); |
|
| 2805 | 2805 | |
| 2806 | - // Get the list of team topics already in Drupal to be sure we're not |
|
| 2807 | - // importing any twice |
|
| 2808 | - $result = db_query(' |
|
| 2806 | + // Get the list of team topics already in Drupal to be sure we're not |
|
| 2807 | + // importing any twice |
|
| 2808 | + $result = db_query(' |
|
| 2809 | 2809 | SELECT nid, topic_id FROM {boincimport_temp_topic}' |
| 2810 | - ); |
|
| 2811 | - while ($row = db_fetch_object($result)) { |
|
| 2810 | + ); |
|
| 2811 | + while ($row = db_fetch_object($result)) { |
|
| 2812 | 2812 | $existing_team_topics[$row->topic_id] = $row->nid; |
| 2813 | - } |
|
| 2813 | + } |
|
| 2814 | 2814 | |
| 2815 | - // Create batches to process |
|
| 2816 | - while ($boincteam_topic = db_fetch_object($boincteam_topics)) { |
|
| 2817 | - if (isset($existing_team_topics[$boincteam_topic->id])) { |
|
| 2818 | - // This team topic has already been imported |
|
| 2819 | - $duplicates[] = $boincteam_topic->id; |
|
| 2815 | + // Create batches to process |
|
| 2816 | + while ($boincteam_topic = db_fetch_object($boincteam_topics)) { |
|
| 2817 | + if (isset($existing_team_topics[$boincteam_topic->id])) { |
|
| 2818 | + // This team topic has already been imported |
|
| 2819 | + $duplicates[] = $boincteam_topic->id; |
|
| 2820 | 2820 | } |
| 2821 | 2821 | else { |
| 2822 | - $operations[] = array( |
|
| 2822 | + $operations[] = array( |
|
| 2823 | 2823 | 'boincimport_team_topics_op', array( |
| 2824 | - $boincteam_topic |
|
| 2824 | + $boincteam_topic |
|
| 2825 | 2825 | ) |
| 2826 | - ); |
|
| 2826 | + ); |
|
| 2827 | + } |
|
| 2827 | 2828 | } |
| 2828 | - } |
|
| 2829 | 2829 | |
| 2830 | - if ($duplicates) { |
|
| 2830 | + if ($duplicates) { |
|
| 2831 | 2831 | drupal_set_message(t( |
| 2832 | - 'Skipped @count team topics that were already imported', |
|
| 2833 | - array('@count' => count($duplicates)) |
|
| 2832 | + 'Skipped @count team topics that were already imported', |
|
| 2833 | + array('@count' => count($duplicates)) |
|
| 2834 | 2834 | )); |
| 2835 | - } |
|
| 2835 | + } |
|
| 2836 | 2836 | |
| 2837 | - $batch = array( |
|
| 2837 | + $batch = array( |
|
| 2838 | 2838 | 'operations' => $operations, |
| 2839 | 2839 | 'finished' => 'boincimport_team_topics_finished', |
| 2840 | 2840 | 'title' => t('Importing team topics'), |
| 2841 | 2841 | 'init_message' => t('Beginning team topic import...'), |
| 2842 | 2842 | 'progress_message' => t('Processed @current out of @total team topics.'), |
| 2843 | 2843 | 'error_message' => t('Team topic import has encountered an error.'), |
| 2844 | - ); |
|
| 2844 | + ); |
|
| 2845 | 2845 | |
| 2846 | - batch_set($batch); |
|
| 2846 | + batch_set($batch); |
|
| 2847 | 2847 | } |
| 2848 | 2848 | |
| 2849 | 2849 | /** |
@@ -2852,21 +2852,21 @@ discard block |
||
| 2852 | 2852 | */ |
| 2853 | 2853 | function boincimport_team_topics_op($topic, &$context) { |
| 2854 | 2854 | |
| 2855 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 2856 | - $success = FALSE; |
|
| 2857 | - $missing_parent = array(); |
|
| 2858 | - $empty_topics = array(); |
|
| 2855 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 2856 | + $success = FALSE; |
|
| 2857 | + $missing_parent = array(); |
|
| 2858 | + $empty_topics = array(); |
|
| 2859 | 2859 | |
| 2860 | - // Verify that the team forum container has been imported |
|
| 2861 | - $team_forum_id = db_result(db_query(" |
|
| 2860 | + // Verify that the team forum container has been imported |
|
| 2861 | + $team_forum_id = db_result(db_query(" |
|
| 2862 | 2862 | SELECT tfid FROM {boincteam_forum} |
| 2863 | 2863 | WHERE boinc_id = %d", |
| 2864 | 2864 | $topic->forum |
| 2865 | - )); |
|
| 2866 | - if (!$team_forum_id) { |
|
| 2865 | + )); |
|
| 2866 | + if (!$team_forum_id) { |
|
| 2867 | 2867 | $missing_parent[] = $topic->id; |
| 2868 | - } |
|
| 2869 | - else { |
|
| 2868 | + } |
|
| 2869 | + else { |
|
| 2870 | 2870 | // Get the content of the post that started the topic |
| 2871 | 2871 | db_set_active('boinc_rw'); |
| 2872 | 2872 | $query = db_query(' |
@@ -2875,36 +2875,36 @@ discard block |
||
| 2875 | 2875 | WHERE thread = %d |
| 2876 | 2876 | ORDER BY timestamp ASC |
| 2877 | 2877 | LIMIT 1', |
| 2878 | - $pre, $topic->id); |
|
| 2878 | + $pre, $topic->id); |
|
| 2879 | 2879 | db_set_active('default'); |
| 2880 | 2880 | |
| 2881 | 2881 | // Skip this topic if there are no posts |
| 2882 | 2882 | if (!$post = db_fetch_object($query)) { |
| 2883 | - // Empty topics should have already been filtered out of the import, so |
|
| 2884 | - // consider this an error condition |
|
| 2885 | - $empty_topics[] = $topic->id; |
|
| 2883 | + // Empty topics should have already been filtered out of the import, so |
|
| 2884 | + // consider this an error condition |
|
| 2885 | + $empty_topics[] = $topic->id; |
|
| 2886 | 2886 | } |
| 2887 | 2887 | else { |
| 2888 | - // Get the user ID along with other data to define the topic |
|
| 2889 | - $uid = boincuser_lookup_uid($topic->owner); |
|
| 2890 | - if (!$topic->owner) { |
|
| 2888 | + // Get the user ID along with other data to define the topic |
|
| 2889 | + $uid = boincuser_lookup_uid($topic->owner); |
|
| 2890 | + if (!$topic->owner) { |
|
| 2891 | 2891 | $uid = 0; |
| 2892 | - } |
|
| 2892 | + } |
|
| 2893 | 2893 | |
| 2894 | - $node_type = 'team_forum'; |
|
| 2895 | - $promote = 0; |
|
| 2896 | - $comment = ($topic->locked) ? 1 : 2; |
|
| 2894 | + $node_type = 'team_forum'; |
|
| 2895 | + $promote = 0; |
|
| 2896 | + $comment = ($topic->locked) ? 1 : 2; |
|
| 2897 | 2897 | |
| 2898 | - $post->content = _boincimport_strip_bbcode($post->content); |
|
| 2899 | - $post->content = _boincimport_text_sanitize($post->content); |
|
| 2900 | - $teaser = node_teaser($post->content); |
|
| 2898 | + $post->content = _boincimport_strip_bbcode($post->content); |
|
| 2899 | + $post->content = _boincimport_text_sanitize($post->content); |
|
| 2900 | + $teaser = node_teaser($post->content); |
|
| 2901 | 2901 | |
| 2902 | - if ($topic->timestamp < $topic->create_time) { |
|
| 2902 | + if ($topic->timestamp < $topic->create_time) { |
|
| 2903 | 2903 | $topic->timestamp = $topic->create_time; |
| 2904 | - } |
|
| 2904 | + } |
|
| 2905 | 2905 | |
| 2906 | - // Construct the thread as a team_forum topic node |
|
| 2907 | - $node = array( |
|
| 2906 | + // Construct the thread as a team_forum topic node |
|
| 2907 | + $node = array( |
|
| 2908 | 2908 | 'type' => $node_type, |
| 2909 | 2909 | 'title' => $topic->title, |
| 2910 | 2910 | 'uid' => $uid, |
@@ -2919,89 +2919,89 @@ discard block |
||
| 2919 | 2919 | 'format' => $input_format, |
| 2920 | 2920 | 'teaser' => $teaser, |
| 2921 | 2921 | 'tfid' => $team_forum_id, |
| 2922 | - ); |
|
| 2922 | + ); |
|
| 2923 | 2923 | |
| 2924 | - // Save the team topic node |
|
| 2925 | - $node = (object) $node; // node_save requires an object form |
|
| 2926 | - node_save($node); |
|
| 2924 | + // Save the team topic node |
|
| 2925 | + $node = (object) $node; // node_save requires an object form |
|
| 2926 | + node_save($node); |
|
| 2927 | 2927 | |
| 2928 | - if ($node->nid) { |
|
| 2928 | + if ($node->nid) { |
|
| 2929 | 2929 | db_query(' |
| 2930 | 2930 | INSERT INTO {boincimport_temp_topic} (topic_id, post_id, nid) |
| 2931 | 2931 | VALUES (%d, %d, %d)', |
| 2932 | - $topic->id, $post->id, $node->nid |
|
| 2932 | + $topic->id, $post->id, $node->nid |
|
| 2933 | 2933 | ); |
| 2934 | 2934 | // Hack to keep the topics in correct order |
| 2935 | 2935 | db_query(' |
| 2936 | 2936 | UPDATE {node_comment_statistics} |
| 2937 | 2937 | SET last_comment_timestamp = %d |
| 2938 | 2938 | WHERE nid = %d', |
| 2939 | - $node->created, $node->nid |
|
| 2939 | + $node->created, $node->nid |
|
| 2940 | 2940 | ); |
| 2941 | 2941 | $success = TRUE; |
| 2942 | - } |
|
| 2942 | + } |
|
| 2943 | + } |
|
| 2943 | 2944 | } |
| 2944 | - } |
|
| 2945 | 2945 | |
| 2946 | - $message = ''; |
|
| 2947 | - if ($success) { |
|
| 2946 | + $message = ''; |
|
| 2947 | + if ($success) { |
|
| 2948 | 2948 | // Store some result for post-processing in the finished callback. |
| 2949 | 2949 | $context['results']['success'][] = $topic->id; |
| 2950 | 2950 | $message = "Successfully imported team topic {$topic->id}"; |
| 2951 | - } |
|
| 2952 | - else { |
|
| 2951 | + } |
|
| 2952 | + else { |
|
| 2953 | 2953 | $context['results']['failure'][] = $topic->id; |
| 2954 | 2954 | $message = "Failed to import team topic {$topic->id}!"; |
| 2955 | 2955 | watchdog('boincimport', |
| 2956 | - 'Failed to import team topic @id!', |
|
| 2957 | - array('@id' => $topic->id), WATCHDOG_WARNING |
|
| 2956 | + 'Failed to import team topic @id!', |
|
| 2957 | + array('@id' => $topic->id), WATCHDOG_WARNING |
|
| 2958 | 2958 | ); |
| 2959 | - } |
|
| 2959 | + } |
|
| 2960 | 2960 | |
| 2961 | - // Update our progress information. |
|
| 2962 | - $context['sandbox']['progress']++; |
|
| 2963 | - $context['sandbox']['current_topic'] = $topic->id; |
|
| 2964 | - $context['message'] = $message; |
|
| 2961 | + // Update our progress information. |
|
| 2962 | + $context['sandbox']['progress']++; |
|
| 2963 | + $context['sandbox']['current_topic'] = $topic->id; |
|
| 2964 | + $context['message'] = $message; |
|
| 2965 | 2965 | |
| 2966 | - // Update the progress for the batch engine |
|
| 2967 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 2966 | + // Update the progress for the batch engine |
|
| 2967 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 2968 | 2968 | $context['finished'] = 1; |
| 2969 | - } |
|
| 2970 | - else { |
|
| 2969 | + } |
|
| 2970 | + else { |
|
| 2971 | 2971 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2972 | - } |
|
| 2972 | + } |
|
| 2973 | 2973 | } |
| 2974 | 2974 | |
| 2975 | 2975 | /** |
| 2976 | 2976 | * Batch 'finished' callback |
| 2977 | 2977 | */ |
| 2978 | 2978 | function boincimport_team_topics_finished($success, $results, $operations) { |
| 2979 | - if ($success) { |
|
| 2979 | + if ($success) { |
|
| 2980 | 2980 | // Let's count our successes |
| 2981 | 2981 | $total_imported = count($results['success']); |
| 2982 | 2982 | $message = t( |
| 2983 | - 'Successfully imported @count team topics', |
|
| 2984 | - array('@count' => $total_imported) |
|
| 2983 | + 'Successfully imported @count team topics', |
|
| 2984 | + array('@count' => $total_imported) |
|
| 2985 | 2985 | ); |
| 2986 | 2986 | watchdog('boincimport', |
| 2987 | - 'Successfully imported @count team topics.', |
|
| 2988 | - array('@count' => $total_imported), WATCHDOG_INFO |
|
| 2987 | + 'Successfully imported @count team topics.', |
|
| 2988 | + array('@count' => $total_imported), WATCHDOG_INFO |
|
| 2989 | 2989 | ); |
| 2990 | 2990 | // Set the BLAH import successful flag in the variable table |
| 2991 | 2991 | variable_set('boincimport_import_team_topic_successful', '1'); |
| 2992 | 2992 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 2993 | - } |
|
| 2994 | - else { |
|
| 2993 | + } |
|
| 2994 | + else { |
|
| 2995 | 2995 | // An error occurred. |
| 2996 | 2996 | // $operations contains the operations that remained unprocessed. |
| 2997 | 2997 | $error_operation = reset($operations); |
| 2998 | 2998 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 2999 | - } |
|
| 3000 | - drupal_set_message($message); |
|
| 2999 | + } |
|
| 3000 | + drupal_set_message($message); |
|
| 3001 | 3001 | |
| 3002 | - // Release the lock on the import process |
|
| 3003 | - variable_del('boincimport_process_locked'); |
|
| 3004 | - drupal_goto('admin/boinc/import/process'); |
|
| 3002 | + // Release the lock on the import process |
|
| 3003 | + variable_del('boincimport_process_locked'); |
|
| 3004 | + drupal_goto('admin/boinc/import/process'); |
|
| 3005 | 3005 | } |
| 3006 | 3006 | |
| 3007 | 3007 | |
@@ -3014,81 +3014,81 @@ discard block |
||
| 3014 | 3014 | */ |
| 3015 | 3015 | function boincimport_team_forum_posts() { |
| 3016 | 3016 | |
| 3017 | - // Check whether team forum posts have been successfully imported already |
|
| 3018 | - if (variable_get('boincimport_import_team_post_successful', 0)) { |
|
| 3017 | + // Check whether team forum posts have been successfully imported already |
|
| 3018 | + if (variable_get('boincimport_import_team_post_successful', 0)) { |
|
| 3019 | 3019 | drupal_set_message(t('Team forum post import has already run successfully'), 'warning'); |
| 3020 | 3020 | watchdog( |
| 3021 | - 'boincimport', 'Team forum post import has already run successfully', |
|
| 3022 | - array(), WATCHDOG_WARNING |
|
| 3021 | + 'boincimport', 'Team forum post import has already run successfully', |
|
| 3022 | + array(), WATCHDOG_WARNING |
|
| 3023 | 3023 | ); |
| 3024 | 3024 | // Release the lock on the import process |
| 3025 | 3025 | variable_del('boincimport_process_locked'); |
| 3026 | 3026 | return; |
| 3027 | - } |
|
| 3027 | + } |
|
| 3028 | 3028 | |
| 3029 | - if (!variable_get('boincimport_import_team_post_started', 0)) { |
|
| 3029 | + if (!variable_get('boincimport_import_team_post_started', 0)) { |
|
| 3030 | 3030 | // Could prepare database tables, if new fields are necessary, etc. |
| 3031 | 3031 | variable_set('boincimport_import_team_post_started', 1); |
| 3032 | - } |
|
| 3032 | + } |
|
| 3033 | 3033 | |
| 3034 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 3034 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 3035 | 3035 | |
| 3036 | - // Get the BOINC threads and get a count of team posts to import |
|
| 3037 | - db_set_active('boinc_rw'); |
|
| 3038 | - $team_topic_ids = db_query(' |
|
| 3036 | + // Get the BOINC threads and get a count of team posts to import |
|
| 3037 | + db_set_active('boinc_rw'); |
|
| 3038 | + $team_topic_ids = db_query(' |
|
| 3039 | 3039 | SELECT DISTINCT t.id FROM %sthread t |
| 3040 | 3040 | JOIN %sforum f ON f.id = t.forum |
| 3041 | 3041 | JOIN %spost p ON p.thread = t.id |
| 3042 | 3042 | WHERE f.parent_type = 1 |
| 3043 | 3043 | ORDER BY id', $pre, $pre |
| 3044 | - ); |
|
| 3045 | - $team_topic_count = db_result(db_query(" |
|
| 3044 | + ); |
|
| 3045 | + $team_topic_count = db_result(db_query(" |
|
| 3046 | 3046 | SELECT COUNT(DISTINCT t.id) FROM %sthread t |
| 3047 | 3047 | JOIN %sforum f ON f.id = t.forum |
| 3048 | 3048 | JOIN %spost p ON p.thread = t.id |
| 3049 | 3049 | WHERE f.parent_type = 1", $pre, $pre, $pre |
| 3050 | - )); |
|
| 3051 | - $total_team_post_count = db_result(db_query(" |
|
| 3050 | + )); |
|
| 3051 | + $total_team_post_count = db_result(db_query(" |
|
| 3052 | 3052 | SELECT COUNT(p.id) FROM %spost p |
| 3053 | 3053 | JOIN %sthread t ON t.id = p.thread |
| 3054 | 3054 | JOIN %sforum f ON f.id = t.forum |
| 3055 | 3055 | WHERE f.parent_type = 1", $pre, $pre, $pre |
| 3056 | - )); |
|
| 3057 | - $team_post_count = $total_team_post_count - $team_topic_count; |
|
| 3058 | - db_set_active('default'); |
|
| 3056 | + )); |
|
| 3057 | + $team_post_count = $total_team_post_count - $team_topic_count; |
|
| 3058 | + db_set_active('default'); |
|
| 3059 | 3059 | |
| 3060 | - if ($team_post_count <= 0) { |
|
| 3060 | + if ($team_post_count <= 0) { |
|
| 3061 | 3061 | drupal_set_message( |
| 3062 | - t('There were no team posts found: Aborting script'), 'warning' |
|
| 3062 | + t('There were no team posts found: Aborting script'), 'warning' |
|
| 3063 | 3063 | ); |
| 3064 | 3064 | watchdog('boincimport', |
| 3065 | - 'There were no team posts found: Aborting script', array(), WATCHDOG_WARNING |
|
| 3065 | + 'There were no team posts found: Aborting script', array(), WATCHDOG_WARNING |
|
| 3066 | 3066 | ); |
| 3067 | 3067 | // Release the lock on the import process |
| 3068 | 3068 | variable_del('boincimport_process_locked'); |
| 3069 | 3069 | return t('There were no posts found: Aborting script.'); |
| 3070 | - } |
|
| 3070 | + } |
|
| 3071 | 3071 | |
| 3072 | - watchdog('boincimport', |
|
| 3072 | + watchdog('boincimport', |
|
| 3073 | 3073 | 'Found %count team posts: Beginning Import', |
| 3074 | 3074 | array('%count' => $team_post_count), WATCHDOG_INFO |
| 3075 | - ); |
|
| 3075 | + ); |
|
| 3076 | 3076 | |
| 3077 | - $operations = array(); |
|
| 3078 | - $existing_posts = array(); |
|
| 3079 | - $duplicates = array(); |
|
| 3077 | + $operations = array(); |
|
| 3078 | + $existing_posts = array(); |
|
| 3079 | + $duplicates = array(); |
|
| 3080 | 3080 | |
| 3081 | - // Get the list of team posts already in Drupal to be sure we're not |
|
| 3082 | - // importing any twice |
|
| 3083 | - $result = db_query(' |
|
| 3081 | + // Get the list of team posts already in Drupal to be sure we're not |
|
| 3082 | + // importing any twice |
|
| 3083 | + $result = db_query(' |
|
| 3084 | 3084 | SELECT cid, post_id FROM {boincimport_temp_post}' |
| 3085 | - ); |
|
| 3086 | - while ($row = db_fetch_object($result)) { |
|
| 3085 | + ); |
|
| 3086 | + while ($row = db_fetch_object($result)) { |
|
| 3087 | 3087 | $existing_posts[$row->post_id] = $row->cid; |
| 3088 | - } |
|
| 3088 | + } |
|
| 3089 | 3089 | |
| 3090 | - // Create batches to process |
|
| 3091 | - while ($boincteam_topic = db_fetch_object($team_topic_ids)) { |
|
| 3090 | + // Create batches to process |
|
| 3091 | + while ($boincteam_topic = db_fetch_object($team_topic_ids)) { |
|
| 3092 | 3092 | |
| 3093 | 3093 | db_set_active('boinc_rw'); |
| 3094 | 3094 | $boincteam_posts = db_query(' |
@@ -3096,7 +3096,7 @@ discard block |
||
| 3096 | 3096 | FROM %spost |
| 3097 | 3097 | WHERE thread = %d |
| 3098 | 3098 | ORDER BY timestamp ASC', |
| 3099 | - $pre, $boincteam_topic->id |
|
| 3099 | + $pre, $boincteam_topic->id |
|
| 3100 | 3100 | ); |
| 3101 | 3101 | db_set_active('default'); |
| 3102 | 3102 | |
@@ -3104,43 +3104,43 @@ discard block |
||
| 3104 | 3104 | |
| 3105 | 3105 | while ($boincteam_post = db_fetch_object($boincteam_posts)) { |
| 3106 | 3106 | |
| 3107 | - // Skip the first post as it has already been imported as a topic |
|
| 3108 | - if ($first_post) { |
|
| 3107 | + // Skip the first post as it has already been imported as a topic |
|
| 3108 | + if ($first_post) { |
|
| 3109 | 3109 | $first_post = false; |
| 3110 | 3110 | continue; |
| 3111 | - } |
|
| 3111 | + } |
|
| 3112 | 3112 | |
| 3113 | - if (isset($existing_posts[$boincteam_post->id])) { |
|
| 3113 | + if (isset($existing_posts[$boincteam_post->id])) { |
|
| 3114 | 3114 | // This post has already been imported |
| 3115 | 3115 | $duplicates[] = $boincteam_post->id; |
| 3116 | - } |
|
| 3117 | - else { |
|
| 3116 | + } |
|
| 3117 | + else { |
|
| 3118 | 3118 | $operations[] = array( |
| 3119 | - 'boincimport_team_posts_op', array( |
|
| 3119 | + 'boincimport_team_posts_op', array( |
|
| 3120 | 3120 | $boincteam_post |
| 3121 | - ) |
|
| 3121 | + ) |
|
| 3122 | 3122 | ); |
| 3123 | - } |
|
| 3123 | + } |
|
| 3124 | + } |
|
| 3124 | 3125 | } |
| 3125 | - } |
|
| 3126 | 3126 | |
| 3127 | - if ($duplicates) { |
|
| 3127 | + if ($duplicates) { |
|
| 3128 | 3128 | drupal_set_message(t( |
| 3129 | - 'Skipped @count team posts that were already imported', |
|
| 3130 | - array('@count' => count($duplicates)) |
|
| 3129 | + 'Skipped @count team posts that were already imported', |
|
| 3130 | + array('@count' => count($duplicates)) |
|
| 3131 | 3131 | )); |
| 3132 | - } |
|
| 3132 | + } |
|
| 3133 | 3133 | |
| 3134 | - $batch = array( |
|
| 3134 | + $batch = array( |
|
| 3135 | 3135 | 'operations' => $operations, |
| 3136 | 3136 | 'finished' => 'boincimport_team_posts_finished', |
| 3137 | 3137 | 'title' => t('Importing team posts'), |
| 3138 | 3138 | 'init_message' => t('Beginning team post import...'), |
| 3139 | 3139 | 'progress_message' => t('Processed @current out of @total team posts.'), |
| 3140 | 3140 | 'error_message' => t('Team post import has encountered an error.'), |
| 3141 | - ); |
|
| 3141 | + ); |
|
| 3142 | 3142 | |
| 3143 | - batch_set($batch); |
|
| 3143 | + batch_set($batch); |
|
| 3144 | 3144 | } |
| 3145 | 3145 | |
| 3146 | 3146 | /** |
@@ -3149,11 +3149,11 @@ discard block |
||
| 3149 | 3149 | */ |
| 3150 | 3150 | function boincimport_team_posts_op($post, &$context) { |
| 3151 | 3151 | |
| 3152 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 3153 | - $success = FALSE; |
|
| 3152 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 3153 | + $success = FALSE; |
|
| 3154 | 3154 | |
| 3155 | - // Make sure the post is valid |
|
| 3156 | - if ($post->content) { |
|
| 3155 | + // Make sure the post is valid |
|
| 3156 | + if ($post->content) { |
|
| 3157 | 3157 | |
| 3158 | 3158 | // Get user, node, and parent IDs for the post and sanitize |
| 3159 | 3159 | $uid = boincuser_lookup_uid($post->user); |
@@ -3162,14 +3162,14 @@ discard block |
||
| 3162 | 3162 | FROM {boincimport_temp_topic} btt |
| 3163 | 3163 | LEFT JOIN {node_revisions} AS nr ON btt.nid = nr.nid |
| 3164 | 3164 | WHERE btt.topic_id = %d', |
| 3165 | - $post->thread |
|
| 3165 | + $post->thread |
|
| 3166 | 3166 | )); |
| 3167 | 3167 | $nid = $node->nid; |
| 3168 | 3168 | $pid = db_result(db_query(' |
| 3169 | 3169 | SELECT cid |
| 3170 | 3170 | FROM {boincimport_temp_post} |
| 3171 | 3171 | WHERE post_id = %d', |
| 3172 | - $post->parent_post)); |
|
| 3172 | + $post->parent_post)); |
|
| 3173 | 3173 | if (is_null($pid)) $pid = 0; |
| 3174 | 3174 | if (!$uid) $uid = 0; |
| 3175 | 3175 | |
@@ -3180,110 +3180,110 @@ discard block |
||
| 3180 | 3180 | SELECT COUNT(*) |
| 3181 | 3181 | FROM {comments} |
| 3182 | 3182 | WHERE nid = %d', |
| 3183 | - $nid |
|
| 3183 | + $nid |
|
| 3184 | 3184 | )); |
| 3185 | 3185 | $post_reply = $pid; |
| 3186 | 3186 | |
| 3187 | 3187 | if ($post_reply OR $topic_reply) { |
| 3188 | - // Create a subject for the post from the post content. The body may be in |
|
| 3189 | - // any format, so we: |
|
| 3190 | - // 1) Filter it into HTML |
|
| 3191 | - // 2) Strip out all HTML tags |
|
| 3192 | - // 3) Convert entities back to plain-text. |
|
| 3193 | - // Note: format is checked by check_markup(). |
|
| 3194 | - $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, TRUE); |
|
| 3195 | - // Replace "Quote:" with "RE:" |
|
| 3196 | - $subject = str_replace('Quote:', 'RE: ', $subject); |
|
| 3197 | - // Fringe cases where the comment body is populated only by HTML tags |
|
| 3198 | - // will require a default subject... |
|
| 3199 | - if ($subject === '') |
|
| 3188 | + // Create a subject for the post from the post content. The body may be in |
|
| 3189 | + // any format, so we: |
|
| 3190 | + // 1) Filter it into HTML |
|
| 3191 | + // 2) Strip out all HTML tags |
|
| 3192 | + // 3) Convert entities back to plain-text. |
|
| 3193 | + // Note: format is checked by check_markup(). |
|
| 3194 | + $subject = truncate_utf8(trim(decode_entities(strip_tags(check_markup($post->content, $input_format)))), 29, TRUE); |
|
| 3195 | + // Replace "Quote:" with "RE:" |
|
| 3196 | + $subject = str_replace('Quote:', 'RE: ', $subject); |
|
| 3197 | + // Fringe cases where the comment body is populated only by HTML tags |
|
| 3198 | + // will require a default subject... |
|
| 3199 | + if ($subject === '') |
|
| 3200 | 3200 | $subject = "RE: {$node->title}"; |
| 3201 | 3201 | } else { |
| 3202 | - // This is the first post in the topic |
|
| 3203 | - $subject = $node->title; |
|
| 3202 | + // This is the first post in the topic |
|
| 3203 | + $subject = $node->title; |
|
| 3204 | 3204 | } |
| 3205 | 3205 | |
| 3206 | 3206 | // Construct the post as a Drupal comment |
| 3207 | 3207 | $comment = array( |
| 3208 | - 'pid' => $pid, |
|
| 3209 | - 'nid' => $nid, |
|
| 3210 | - 'uid' => $uid, |
|
| 3211 | - 'subject' => $subject, |
|
| 3212 | - 'comment' => $post->content, |
|
| 3213 | - 'timestamp' => $post->timestamp, |
|
| 3214 | - 'status' => $post->hidden, |
|
| 3215 | - 'format' => $input_format |
|
| 3208 | + 'pid' => $pid, |
|
| 3209 | + 'nid' => $nid, |
|
| 3210 | + 'uid' => $uid, |
|
| 3211 | + 'subject' => $subject, |
|
| 3212 | + 'comment' => $post->content, |
|
| 3213 | + 'timestamp' => $post->timestamp, |
|
| 3214 | + 'status' => $post->hidden, |
|
| 3215 | + 'format' => $input_format |
|
| 3216 | 3216 | ); |
| 3217 | 3217 | |
| 3218 | 3218 | // Save the comment |
| 3219 | 3219 | if (boincimport_forum_comment_save($comment)) { |
| 3220 | - $success = db_query(' |
|
| 3220 | + $success = db_query(' |
|
| 3221 | 3221 | INSERT INTO {boincimport_temp_post} (post_id, cid) |
| 3222 | 3222 | VALUES (%d, %d)', |
| 3223 | 3223 | $post->id, $comment['cid'] |
| 3224 | - ); |
|
| 3224 | + ); |
|
| 3225 | + } |
|
| 3225 | 3226 | } |
| 3226 | - } |
|
| 3227 | 3227 | |
| 3228 | - $message = ''; |
|
| 3229 | - if ($success) { |
|
| 3228 | + $message = ''; |
|
| 3229 | + if ($success) { |
|
| 3230 | 3230 | // Store some result for post-processing in the finished callback. |
| 3231 | 3231 | $context['results']['success'][] = $post->id; |
| 3232 | 3232 | $message = "Successfully imported team post {$post->id}"; |
| 3233 | - } |
|
| 3234 | - else { |
|
| 3233 | + } |
|
| 3234 | + else { |
|
| 3235 | 3235 | $context['results']['failure'][] = $post->id; |
| 3236 | 3236 | $message = "Failed to import team post {$post->id}!"; |
| 3237 | 3237 | watchdog('boincimport', |
| 3238 | - 'Failed to import team post @id!', |
|
| 3239 | - array('@id' => $post->id), WATCHDOG_WARNING |
|
| 3238 | + 'Failed to import team post @id!', |
|
| 3239 | + array('@id' => $post->id), WATCHDOG_WARNING |
|
| 3240 | 3240 | ); |
| 3241 | - } |
|
| 3241 | + } |
|
| 3242 | 3242 | |
| 3243 | - // Update our progress information. |
|
| 3244 | - $context['sandbox']['progress']++; |
|
| 3245 | - $context['sandbox']['current_post'] = $post->id; |
|
| 3246 | - $context['message'] = $message; |
|
| 3243 | + // Update our progress information. |
|
| 3244 | + $context['sandbox']['progress']++; |
|
| 3245 | + $context['sandbox']['current_post'] = $post->id; |
|
| 3246 | + $context['message'] = $message; |
|
| 3247 | 3247 | |
| 3248 | - // Update the progress for the batch engine |
|
| 3249 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 3248 | + // Update the progress for the batch engine |
|
| 3249 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 3250 | 3250 | $context['finished'] = 1; |
| 3251 | - } |
|
| 3252 | - else { |
|
| 3251 | + } |
|
| 3252 | + else { |
|
| 3253 | 3253 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3254 | - } |
|
| 3254 | + } |
|
| 3255 | 3255 | } |
| 3256 | 3256 | |
| 3257 | 3257 | /** |
| 3258 | 3258 | * Batch 'finished' callback |
| 3259 | 3259 | */ |
| 3260 | 3260 | function boincimport_team_posts_finished($success, $results, $operations) { |
| 3261 | - if ($success) { |
|
| 3261 | + if ($success) { |
|
| 3262 | 3262 | // Let's count our successes |
| 3263 | 3263 | $total_imported = count($results['success']); |
| 3264 | 3264 | $message = t( |
| 3265 | - 'Successfully imported @count team posts', |
|
| 3266 | - array('@count' => $total_imported) |
|
| 3265 | + 'Successfully imported @count team posts', |
|
| 3266 | + array('@count' => $total_imported) |
|
| 3267 | 3267 | ); |
| 3268 | 3268 | watchdog('boincimport', |
| 3269 | - 'Successfully imported @count team posts.', |
|
| 3270 | - array('@count' => $total_imported), WATCHDOG_INFO |
|
| 3269 | + 'Successfully imported @count team posts.', |
|
| 3270 | + array('@count' => $total_imported), WATCHDOG_INFO |
|
| 3271 | 3271 | ); |
| 3272 | 3272 | // Set the team post import successful flag in the variable table |
| 3273 | 3273 | variable_set('boincimport_import_team_post_successful', '1'); |
| 3274 | 3274 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3275 | - } |
|
| 3276 | - else { |
|
| 3275 | + } |
|
| 3276 | + else { |
|
| 3277 | 3277 | // An error occurred. |
| 3278 | 3278 | // $operations contains the operations that remained unprocessed. |
| 3279 | 3279 | $error_operation = reset($operations); |
| 3280 | 3280 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 3281 | - } |
|
| 3282 | - drupal_set_message($message); |
|
| 3281 | + } |
|
| 3282 | + drupal_set_message($message); |
|
| 3283 | 3283 | |
| 3284 | - // Release the lock on the import process |
|
| 3285 | - variable_del('boincimport_process_locked'); |
|
| 3286 | - drupal_goto('admin/boinc/import/process'); |
|
| 3284 | + // Release the lock on the import process |
|
| 3285 | + variable_del('boincimport_process_locked'); |
|
| 3286 | + drupal_goto('admin/boinc/import/process'); |
|
| 3287 | 3287 | } |
| 3288 | 3288 | |
| 3289 | 3289 | |
@@ -3296,71 +3296,71 @@ discard block |
||
| 3296 | 3296 | */ |
| 3297 | 3297 | function boincimport_subscriptions() { |
| 3298 | 3298 | |
| 3299 | - // Check whether subscriptions have been successfully imported already |
|
| 3300 | - if (variable_get('boincimport_import_subscription_successful', 0)) { |
|
| 3299 | + // Check whether subscriptions have been successfully imported already |
|
| 3300 | + if (variable_get('boincimport_import_subscription_successful', 0)) { |
|
| 3301 | 3301 | drupal_set_message(t('Subscription import has already run successfully'), 'warning'); |
| 3302 | 3302 | watchdog( |
| 3303 | - 'boincimport', 'Subscription import has already run successfully', |
|
| 3304 | - array(), WATCHDOG_WARNING |
|
| 3303 | + 'boincimport', 'Subscription import has already run successfully', |
|
| 3304 | + array(), WATCHDOG_WARNING |
|
| 3305 | 3305 | ); |
| 3306 | - } |
|
| 3306 | + } |
|
| 3307 | 3307 | |
| 3308 | - if (!variable_get('boincimport_import_subscription_started', 0)) { |
|
| 3308 | + if (!variable_get('boincimport_import_subscription_started', 0)) { |
|
| 3309 | 3309 | // Could prepare database tables, if new fields are necessary, etc. |
| 3310 | 3310 | variable_set('boincimport_import_subscription_started', 1); |
| 3311 | - } |
|
| 3311 | + } |
|
| 3312 | 3312 | |
| 3313 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
| 3313 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
| 3314 | 3314 | |
| 3315 | - // Get users with subscriptions to import |
|
| 3316 | - db_set_active('boinc_rw'); |
|
| 3317 | - $users_with_subscriptions = db_query(' |
|
| 3315 | + // Get users with subscriptions to import |
|
| 3316 | + db_set_active('boinc_rw'); |
|
| 3317 | + $users_with_subscriptions = db_query(' |
|
| 3318 | 3318 | SELECT DISTINCT userid |
| 3319 | 3319 | FROM %ssubscriptions |
| 3320 | 3320 | ORDER BY userid ASC', |
| 3321 | 3321 | $pre |
| 3322 | - ); |
|
| 3323 | - $user_count = mysqli_num_rows($users_with_subscriptions); |
|
| 3324 | - db_set_active('default'); |
|
| 3322 | + ); |
|
| 3323 | + $user_count = mysqli_num_rows($users_with_subscriptions); |
|
| 3324 | + db_set_active('default'); |
|
| 3325 | 3325 | |
| 3326 | - if (!$user_count) { |
|
| 3326 | + if (!$user_count) { |
|
| 3327 | 3327 | drupal_set_message( |
| 3328 | - t('There were no subscriptions found: Aborting script'), 'warning' |
|
| 3328 | + t('There were no subscriptions found: Aborting script'), 'warning' |
|
| 3329 | 3329 | ); |
| 3330 | 3330 | watchdog('boincimport', |
| 3331 | - 'There were no subscriptions found: Aborting script', array(), WATCHDOG_WARNING |
|
| 3331 | + 'There were no subscriptions found: Aborting script', array(), WATCHDOG_WARNING |
|
| 3332 | 3332 | ); |
| 3333 | 3333 | // Release the lock on the import process |
| 3334 | 3334 | variable_del('boincimport_process_locked'); |
| 3335 | 3335 | return t('There were no subscriptions found: Aborting script.'); |
| 3336 | - } |
|
| 3336 | + } |
|
| 3337 | 3337 | |
| 3338 | - watchdog('boincimport', |
|
| 3338 | + watchdog('boincimport', |
|
| 3339 | 3339 | 'Found %count users with subscriptions: Beginning import', |
| 3340 | 3340 | array('%count' => $user_count), WATCHDOG_INFO |
| 3341 | - ); |
|
| 3341 | + ); |
|
| 3342 | 3342 | |
| 3343 | - $operations = array(); |
|
| 3343 | + $operations = array(); |
|
| 3344 | 3344 | |
| 3345 | - // Create batches to process |
|
| 3346 | - while ($subscribed_user = db_fetch_object($users_with_subscriptions)) { |
|
| 3345 | + // Create batches to process |
|
| 3346 | + while ($subscribed_user = db_fetch_object($users_with_subscriptions)) { |
|
| 3347 | 3347 | $operations[] = array( |
| 3348 | - 'boincimport_subscriptions_op', array( |
|
| 3348 | + 'boincimport_subscriptions_op', array( |
|
| 3349 | 3349 | $subscribed_user->userid |
| 3350 | - ) |
|
| 3350 | + ) |
|
| 3351 | 3351 | ); |
| 3352 | - } |
|
| 3352 | + } |
|
| 3353 | 3353 | |
| 3354 | - $batch = array( |
|
| 3354 | + $batch = array( |
|
| 3355 | 3355 | 'operations' => $operations, |
| 3356 | 3356 | 'finished' => 'boincimport_subscriptions_finished', |
| 3357 | 3357 | 'title' => t('Importing subscriptions'), |
| 3358 | 3358 | 'init_message' => t('Beginning subscription import...'), |
| 3359 | 3359 | 'progress_message' => t('Processed @current out of @total subscriptions.'), |
| 3360 | 3360 | 'error_message' => t('Subscription import has encountered an error.'), |
| 3361 | - ); |
|
| 3361 | + ); |
|
| 3362 | 3362 | |
| 3363 | - batch_set($batch); |
|
| 3363 | + batch_set($batch); |
|
| 3364 | 3364 | } |
| 3365 | 3365 | |
| 3366 | 3366 | /** |
@@ -3369,72 +3369,72 @@ discard block |
||
| 3369 | 3369 | */ |
| 3370 | 3370 | function boincimport_subscriptions_op($boincuser_id, &$context) { |
| 3371 | 3371 | |
| 3372 | - // Get the drupal user and pull subscriptions |
|
| 3373 | - $uid = get_drupal_id($boincuser_id); |
|
| 3374 | - $count = boincuser_pull_subscriptions($uid); |
|
| 3372 | + // Get the drupal user and pull subscriptions |
|
| 3373 | + $uid = get_drupal_id($boincuser_id); |
|
| 3374 | + $count = boincuser_pull_subscriptions($uid); |
|
| 3375 | 3375 | |
| 3376 | - $message = ''; |
|
| 3377 | - if ($count) { |
|
| 3376 | + $message = ''; |
|
| 3377 | + if ($count) { |
|
| 3378 | 3378 | // Store some result for post-processing in the finished callback. |
| 3379 | 3379 | $context['results']['success'][] = $boincuser_id; |
| 3380 | 3380 | $context['results']['subscriptions'][$boincuser_id] = $count; |
| 3381 | 3381 | $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}"; |
| 3382 | - } |
|
| 3383 | - else { |
|
| 3382 | + } |
|
| 3383 | + else { |
|
| 3384 | 3384 | $context['results']['failure'][] = $boincuser_id; |
| 3385 | 3385 | $message = "Failed to import subscriptions for user {$boincuser_id}!"; |
| 3386 | 3386 | watchdog('boincimport', |
| 3387 | - 'Failed to import subscriptions for user @id!', |
|
| 3388 | - array('@id' => $boincuser_id), WATCHDOG_WARNING |
|
| 3387 | + 'Failed to import subscriptions for user @id!', |
|
| 3388 | + array('@id' => $boincuser_id), WATCHDOG_WARNING |
|
| 3389 | 3389 | ); |
| 3390 | - } |
|
| 3390 | + } |
|
| 3391 | 3391 | |
| 3392 | - // Update our progress information. |
|
| 3393 | - $context['sandbox']['progress']++; |
|
| 3394 | - $context['sandbox']['current_user'] = $boincuser_id; |
|
| 3395 | - $context['message'] = $message; |
|
| 3392 | + // Update our progress information. |
|
| 3393 | + $context['sandbox']['progress']++; |
|
| 3394 | + $context['sandbox']['current_user'] = $boincuser_id; |
|
| 3395 | + $context['message'] = $message; |
|
| 3396 | 3396 | |
| 3397 | - // Update the progress for the batch engine |
|
| 3398 | - if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 3397 | + // Update the progress for the batch engine |
|
| 3398 | + if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
|
| 3399 | 3399 | $context['finished'] = 1; |
| 3400 | - } |
|
| 3401 | - else { |
|
| 3400 | + } |
|
| 3401 | + else { |
|
| 3402 | 3402 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3403 | - } |
|
| 3403 | + } |
|
| 3404 | 3404 | } |
| 3405 | 3405 | |
| 3406 | 3406 | /** |
| 3407 | 3407 | * Batch 'finished' callback |
| 3408 | 3408 | */ |
| 3409 | 3409 | function boincimport_subscriptions_finished($success, $results, $operations) { |
| 3410 | - if ($success) { |
|
| 3410 | + if ($success) { |
|
| 3411 | 3411 | // Let's count our successes |
| 3412 | 3412 | $user_count = count($results['success']); |
| 3413 | 3413 | $subscriptions_imported = array_sum($results['subscriptions']); |
| 3414 | 3414 | $message = t( |
| 3415 | - 'Successfully imported @count subscriptions for @distinct users', |
|
| 3416 | - array('@count' => $subscriptions_imported, '@distinct' => $user_count) |
|
| 3415 | + 'Successfully imported @count subscriptions for @distinct users', |
|
| 3416 | + array('@count' => $subscriptions_imported, '@distinct' => $user_count) |
|
| 3417 | 3417 | ); |
| 3418 | 3418 | watchdog('boincimport', |
| 3419 | - 'Successfully imported @count subscriptions for @distinct users.', |
|
| 3420 | - array('@count' => $subscriptions_imported, '@distinct' => $user_count), |
|
| 3421 | - WATCHDOG_INFO |
|
| 3419 | + 'Successfully imported @count subscriptions for @distinct users.', |
|
| 3420 | + array('@count' => $subscriptions_imported, '@distinct' => $user_count), |
|
| 3421 | + WATCHDOG_INFO |
|
| 3422 | 3422 | ); |
| 3423 | 3423 | // Set the subscription import successful flag in the variable table |
| 3424 | 3424 | variable_set('boincimport_import_subscription_successful', '1'); |
| 3425 | 3425 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3426 | - } |
|
| 3427 | - else { |
|
| 3426 | + } |
|
| 3427 | + else { |
|
| 3428 | 3428 | // An error occurred. |
| 3429 | 3429 | // $operations contains the operations that remained unprocessed. |
| 3430 | 3430 | $error_operation = reset($operations); |
| 3431 | 3431 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 3432 | - } |
|
| 3433 | - drupal_set_message($message); |
|
| 3432 | + } |
|
| 3433 | + drupal_set_message($message); |
|
| 3434 | 3434 | |
| 3435 | - // Release the lock on the import process |
|
| 3436 | - variable_del('boincimport_process_locked'); |
|
| 3437 | - drupal_goto('admin/boinc/import/process'); |
|
| 3435 | + // Release the lock on the import process |
|
| 3436 | + variable_del('boincimport_process_locked'); |
|
| 3437 | + drupal_goto('admin/boinc/import/process'); |
|
| 3438 | 3438 | } |
| 3439 | 3439 | |
| 3440 | 3440 | |
@@ -3446,112 +3446,112 @@ discard block |
||
| 3446 | 3446 | */ |
| 3447 | 3447 | function boincimport_replace_urls() { |
| 3448 | 3448 | |
| 3449 | - // Check whether URLs have already been fixed |
|
| 3450 | - if (variable_get('boincimport_replace_url_successful', 0)) { |
|
| 3449 | + // Check whether URLs have already been fixed |
|
| 3450 | + if (variable_get('boincimport_replace_url_successful', 0)) { |
|
| 3451 | 3451 | drupal_set_message(t('URLs have already been updated'), 'warning'); |
| 3452 | 3452 | watchdog( |
| 3453 | - 'boincimport', 'URLs have already been updated', |
|
| 3454 | - array(), WATCHDOG_WARNING |
|
| 3453 | + 'boincimport', 'URLs have already been updated', |
|
| 3454 | + array(), WATCHDOG_WARNING |
|
| 3455 | 3455 | ); |
| 3456 | - } |
|
| 3456 | + } |
|
| 3457 | 3457 | |
| 3458 | - if (!variable_get('boincimport_replace_url_started', 0)) { |
|
| 3458 | + if (!variable_get('boincimport_replace_url_started', 0)) { |
|
| 3459 | 3459 | // Could prepare database tables, if new fields are necessary, etc. |
| 3460 | 3460 | variable_set('boincimport_replace_url_started', 1); |
| 3461 | - } |
|
| 3461 | + } |
|
| 3462 | 3462 | |
| 3463 | - // Get the count of nodes and comments to process for URL updates |
|
| 3464 | - $node_count = db_result(db_query(' |
|
| 3463 | + // Get the count of nodes and comments to process for URL updates |
|
| 3464 | + $node_count = db_result(db_query(' |
|
| 3465 | 3465 | SELECT COUNT(DISTINCT btt.nid) |
| 3466 | 3466 | FROM {boincimport_temp_topic} AS btt |
| 3467 | 3467 | LEFT JOIN {node_revisions} AS nr ON btt.nid = nr.nid' |
| 3468 | - )); |
|
| 3468 | + )); |
|
| 3469 | 3469 | |
| 3470 | - $comment_count = db_result(db_query(' |
|
| 3470 | + $comment_count = db_result(db_query(' |
|
| 3471 | 3471 | SELECT COUNT(c.cid) |
| 3472 | 3472 | FROM {boincimport_temp_post} AS p |
| 3473 | 3473 | LEFT JOIN {comments} AS c ON p.cid = c.cid' |
| 3474 | - )); |
|
| 3474 | + )); |
|
| 3475 | 3475 | |
| 3476 | - $pm_count = db_result(db_query(' |
|
| 3476 | + $pm_count = db_result(db_query(' |
|
| 3477 | 3477 | SELECT COUNT(*) |
| 3478 | 3478 | FROM {pm_message} pm' |
| 3479 | - )); |
|
| 3479 | + )); |
|
| 3480 | 3480 | |
| 3481 | - if (!$node_count AND !$comment_count AND !$pm_count) { |
|
| 3481 | + if (!$node_count AND !$comment_count AND !$pm_count) { |
|
| 3482 | 3482 | drupal_set_message( |
| 3483 | - t('There were no nodes, comments, or private messages found: Aborting script'), 'warning' |
|
| 3483 | + t('There were no nodes, comments, or private messages found: Aborting script'), 'warning' |
|
| 3484 | 3484 | ); |
| 3485 | 3485 | watchdog('boincimport', |
| 3486 | - 'There were no nodes,comments, or private messages found: Aborting script', array(), WATCHDOG_WARNING |
|
| 3486 | + 'There were no nodes,comments, or private messages found: Aborting script', array(), WATCHDOG_WARNING |
|
| 3487 | 3487 | ); |
| 3488 | 3488 | // Release the lock on the import process |
| 3489 | 3489 | variable_del('boincimport_process_locked'); |
| 3490 | 3490 | return t('There were no nodes, comments, or private messages found: Aborting script.'); |
| 3491 | - } |
|
| 3491 | + } |
|
| 3492 | 3492 | |
| 3493 | - watchdog('boincimport', |
|
| 3493 | + watchdog('boincimport', |
|
| 3494 | 3494 | 'Found %node_count nodes, %comment_count comments, and %pm_count private messages: Updating URLs...', |
| 3495 | 3495 | array( |
| 3496 | - '%node_count' => $node_count, |
|
| 3497 | - '%comment_count' => $comment_count, |
|
| 3498 | - '%pm_count' => $pm_count, |
|
| 3496 | + '%node_count' => $node_count, |
|
| 3497 | + '%comment_count' => $comment_count, |
|
| 3498 | + '%pm_count' => $pm_count, |
|
| 3499 | 3499 | ), |
| 3500 | 3500 | WATCHDOG_INFO |
| 3501 | - ); |
|
| 3501 | + ); |
|
| 3502 | 3502 | |
| 3503 | - $operations = array(); |
|
| 3504 | - $batch_size = 100; |
|
| 3503 | + $operations = array(); |
|
| 3504 | + $batch_size = 100; |
|
| 3505 | 3505 | |
| 3506 | - // Create node batches to process |
|
| 3507 | - for ($offset = 0; $offset < $node_count; $offset+=$batch_size) { |
|
| 3506 | + // Create node batches to process |
|
| 3507 | + for ($offset = 0; $offset < $node_count; $offset+=$batch_size) { |
|
| 3508 | 3508 | $nodes_per_batch = $batch_size; |
| 3509 | 3509 | if ($offset + $batch_size > $node_count) { |
| 3510 | - $nodes_per_batch = $node_count - $offset; |
|
| 3510 | + $nodes_per_batch = $node_count - $offset; |
|
| 3511 | 3511 | } |
| 3512 | 3512 | $operations[] = array( |
| 3513 | - 'boincimport_replace_urls_node_op', array( |
|
| 3513 | + 'boincimport_replace_urls_node_op', array( |
|
| 3514 | 3514 | $offset, $nodes_per_batch |
| 3515 | - ) |
|
| 3515 | + ) |
|
| 3516 | 3516 | ); |
| 3517 | - } |
|
| 3518 | - // Add comment batches |
|
| 3519 | - for ($offset = 0; $offset < $comment_count; $offset+=$batch_size) { |
|
| 3517 | + } |
|
| 3518 | + // Add comment batches |
|
| 3519 | + for ($offset = 0; $offset < $comment_count; $offset+=$batch_size) { |
|
| 3520 | 3520 | $comments_per_batch = $batch_size; |
| 3521 | 3521 | if ($offset + $batch_size > $comment_count) { |
| 3522 | - $comments_per_batch = $comment_count - $offset; |
|
| 3522 | + $comments_per_batch = $comment_count - $offset; |
|
| 3523 | 3523 | } |
| 3524 | 3524 | $operations[] = array( |
| 3525 | - 'boincimport_replace_urls_comment_op', array( |
|
| 3525 | + 'boincimport_replace_urls_comment_op', array( |
|
| 3526 | 3526 | $offset, $comments_per_batch |
| 3527 | - ) |
|
| 3527 | + ) |
|
| 3528 | 3528 | ); |
| 3529 | - } |
|
| 3530 | - // And don't forget to process private messages |
|
| 3531 | - for ($offset = 0; $offset < $pm_count; $offset+=$batch_size) { |
|
| 3529 | + } |
|
| 3530 | + // And don't forget to process private messages |
|
| 3531 | + for ($offset = 0; $offset < $pm_count; $offset+=$batch_size) { |
|
| 3532 | 3532 | $messages_per_batch = $batch_size; |
| 3533 | 3533 | if ($offset + $batch_size > $pm_count) { |
| 3534 | - $messages_per_batch = $pm_count - $offset; |
|
| 3534 | + $messages_per_batch = $pm_count - $offset; |
|
| 3535 | 3535 | } |
| 3536 | 3536 | $operations[] = array( |
| 3537 | - 'boincimport_replace_urls_pm_op', array( |
|
| 3537 | + 'boincimport_replace_urls_pm_op', array( |
|
| 3538 | 3538 | $offset, $messages_per_batch |
| 3539 | - ) |
|
| 3539 | + ) |
|
| 3540 | 3540 | ); |
| 3541 | - } |
|
| 3541 | + } |
|
| 3542 | 3542 | |
| 3543 | - $batch = array( |
|
| 3543 | + $batch = array( |
|
| 3544 | 3544 | 'operations' => $operations, |
| 3545 | 3545 | 'finished' => 'boincimport_replace_urls_finished', |
| 3546 | 3546 | 'title' => t('Updating URLs...'), |
| 3547 | 3547 | 'init_message' => t('Beginning URL update...'), |
| 3548 | 3548 | 'progress_message' => t('Processed URLs in @current out of @total batches (@size items per batch).', array( |
| 3549 | - '@size' => $batch_size, |
|
| 3549 | + '@size' => $batch_size, |
|
| 3550 | 3550 | )), |
| 3551 | 3551 | 'error_message' => t('URL update has encountered an error.'), |
| 3552 | - ); |
|
| 3552 | + ); |
|
| 3553 | 3553 | |
| 3554 | - batch_set($batch); |
|
| 3554 | + batch_set($batch); |
|
| 3555 | 3555 | } |
| 3556 | 3556 | |
| 3557 | 3557 | /** |
@@ -3559,27 +3559,27 @@ discard block |
||
| 3559 | 3559 | * Find URLs for the old system and update them with Drupal paths |
| 3560 | 3560 | */ |
| 3561 | 3561 | function boincimport_replace_urls_node_op($offset, $batch_size, &$context) { |
| 3562 | - // Initialize the batch, if needed |
|
| 3563 | - if (!isset($context['sandbox']['progress'])) { |
|
| 3562 | + // Initialize the batch, if needed |
|
| 3563 | + if (!isset($context['sandbox']['progress'])) { |
|
| 3564 | 3564 | $context['sandbox']['progress'] = 0; |
| 3565 | 3565 | $context['sandbox']['max'] = $batch_size; |
| 3566 | - } |
|
| 3566 | + } |
|
| 3567 | 3567 | |
| 3568 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 3568 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 3569 | 3569 | |
| 3570 | - // Since topics have just been imported, there should be only one vid for |
|
| 3571 | - // each nid, so we can update node_revisions by nid |
|
| 3572 | - // Get nodes to process |
|
| 3573 | - $nodes = db_query(' |
|
| 3570 | + // Since topics have just been imported, there should be only one vid for |
|
| 3571 | + // each nid, so we can update node_revisions by nid |
|
| 3572 | + // Get nodes to process |
|
| 3573 | + $nodes = db_query(' |
|
| 3574 | 3574 | SELECT btt.nid, nr.body, nr.teaser |
| 3575 | 3575 | FROM {boincimport_temp_topic} AS btt |
| 3576 | 3576 | LEFT JOIN {node_revisions} AS nr ON btt.nid = nr.nid |
| 3577 | 3577 | ORDER BY btt.nid |
| 3578 | 3578 | LIMIT %d,%d', |
| 3579 | 3579 | $offset, $batch_size |
| 3580 | - ); |
|
| 3580 | + ); |
|
| 3581 | 3581 | |
| 3582 | - while ($node = db_fetch_object($nodes)) { |
|
| 3582 | + while ($node = db_fetch_object($nodes)) { |
|
| 3583 | 3583 | $updated = FALSE; |
| 3584 | 3584 | |
| 3585 | 3585 | // Update URLs in node contents |
@@ -3588,23 +3588,23 @@ discard block |
||
| 3588 | 3588 | $node->body = _boincimport_replace_links($node->body); |
| 3589 | 3589 | $node->teaser = _boincimport_replace_links($node->teaser); |
| 3590 | 3590 | if ($node->body != $original_body OR $node->teaser != $original_teaser) { |
| 3591 | - $updated = db_query(" |
|
| 3591 | + $updated = db_query(" |
|
| 3592 | 3592 | UPDATE {node_revisions} |
| 3593 | 3593 | SET body= '%s', teaser = '%s' |
| 3594 | 3594 | WHERE nid = %d", |
| 3595 | 3595 | $node->body, $node->teaser, $node->nid |
| 3596 | - ); |
|
| 3596 | + ); |
|
| 3597 | 3597 | } |
| 3598 | 3598 | |
| 3599 | 3599 | $message = ''; |
| 3600 | 3600 | $context['results']['success'][] = $node->nid; |
| 3601 | 3601 | if ($updated) { |
| 3602 | - // Store some result for post-processing in the finished callback. |
|
| 3603 | - $context['results']['nodes']['updated'][] = $node->nid; |
|
| 3604 | - $message = "Successfully updated node {$node->nid}"; |
|
| 3602 | + // Store some result for post-processing in the finished callback. |
|
| 3603 | + $context['results']['nodes']['updated'][] = $node->nid; |
|
| 3604 | + $message = "Successfully updated node {$node->nid}"; |
|
| 3605 | 3605 | } |
| 3606 | 3606 | else { |
| 3607 | - $message = "No changes made to node {$node->nid}!"; |
|
| 3607 | + $message = "No changes made to node {$node->nid}!"; |
|
| 3608 | 3608 | } |
| 3609 | 3609 | |
| 3610 | 3610 | // Update our progress information. |
@@ -3614,12 +3614,12 @@ discard block |
||
| 3614 | 3614 | |
| 3615 | 3615 | // Update the progress for the batch engine |
| 3616 | 3616 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3617 | - $context['finished'] = 1; |
|
| 3617 | + $context['finished'] = 1; |
|
| 3618 | 3618 | } |
| 3619 | 3619 | else { |
| 3620 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3620 | + $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3621 | + } |
|
| 3621 | 3622 | } |
| 3622 | - } |
|
| 3623 | 3623 | } |
| 3624 | 3624 | |
| 3625 | 3625 | /** |
@@ -3627,48 +3627,48 @@ discard block |
||
| 3627 | 3627 | * Find URLs for the old system and update them with Drupal paths |
| 3628 | 3628 | */ |
| 3629 | 3629 | function boincimport_replace_urls_comment_op($offset, $batch_size, &$context) { |
| 3630 | - // Initialize the batch, if needed |
|
| 3631 | - if (!isset($context['sandbox']['progress'])) { |
|
| 3630 | + // Initialize the batch, if needed |
|
| 3631 | + if (!isset($context['sandbox']['progress'])) { |
|
| 3632 | 3632 | $context['sandbox']['progress'] = 0; |
| 3633 | 3633 | $context['sandbox']['max'] = $batch_size; |
| 3634 | - } |
|
| 3634 | + } |
|
| 3635 | 3635 | |
| 3636 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 3636 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 3637 | 3637 | |
| 3638 | - // Get comments to process |
|
| 3639 | - $comments = db_query(' |
|
| 3638 | + // Get comments to process |
|
| 3639 | + $comments = db_query(' |
|
| 3640 | 3640 | SELECT c.cid, c.comment |
| 3641 | 3641 | FROM {boincimport_temp_post} AS p |
| 3642 | 3642 | LEFT JOIN {comments} AS c ON p.cid = c.cid |
| 3643 | 3643 | ORDER BY c.cid |
| 3644 | 3644 | LIMIT %d,%d', |
| 3645 | 3645 | $offset, $batch_size |
| 3646 | - ); |
|
| 3646 | + ); |
|
| 3647 | 3647 | |
| 3648 | - while ($comment = db_fetch_object($comments)) { |
|
| 3648 | + while ($comment = db_fetch_object($comments)) { |
|
| 3649 | 3649 | $updated = FALSE; |
| 3650 | 3650 | |
| 3651 | 3651 | // Update URLs in comment contents |
| 3652 | 3652 | $original_comment = $comment->comment; |
| 3653 | 3653 | $comment->comment = _boincimport_replace_links($comment->comment); |
| 3654 | 3654 | if ($comment->comment != $original_comment) { |
| 3655 | - $updated = db_query(" |
|
| 3655 | + $updated = db_query(" |
|
| 3656 | 3656 | UPDATE {comments} |
| 3657 | 3657 | SET comment= '%s' |
| 3658 | 3658 | WHERE cid = %d", |
| 3659 | 3659 | $comment->comment, $comment->cid |
| 3660 | - ); |
|
| 3660 | + ); |
|
| 3661 | 3661 | } |
| 3662 | 3662 | |
| 3663 | 3663 | $message = ''; |
| 3664 | 3664 | $context['results']['success'][] = $comment->cid; |
| 3665 | 3665 | if ($updated) { |
| 3666 | - // Store some result for post-processing in the finished callback. |
|
| 3667 | - $context['results']['comments']['updated'][] = $comment->cid; |
|
| 3668 | - $message = "Successfully updated comment {$comment->cid}"; |
|
| 3666 | + // Store some result for post-processing in the finished callback. |
|
| 3667 | + $context['results']['comments']['updated'][] = $comment->cid; |
|
| 3668 | + $message = "Successfully updated comment {$comment->cid}"; |
|
| 3669 | 3669 | } |
| 3670 | 3670 | else { |
| 3671 | - $message = "No changes made to comment {$comment->cid}!"; |
|
| 3671 | + $message = "No changes made to comment {$comment->cid}!"; |
|
| 3672 | 3672 | } |
| 3673 | 3673 | |
| 3674 | 3674 | // Update our progress information. |
@@ -3678,12 +3678,12 @@ discard block |
||
| 3678 | 3678 | |
| 3679 | 3679 | // Update the progress for the batch engine |
| 3680 | 3680 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3681 | - $context['finished'] = 1; |
|
| 3681 | + $context['finished'] = 1; |
|
| 3682 | 3682 | } |
| 3683 | 3683 | else { |
| 3684 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3684 | + $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3685 | + } |
|
| 3685 | 3686 | } |
| 3686 | - } |
|
| 3687 | 3687 | } |
| 3688 | 3688 | |
| 3689 | 3689 | /** |
@@ -3691,47 +3691,47 @@ discard block |
||
| 3691 | 3691 | * Find URLs for the old system and update them with Drupal paths |
| 3692 | 3692 | */ |
| 3693 | 3693 | function boincimport_replace_urls_pm_op($offset, $batch_size, &$context) { |
| 3694 | - // Initialize the batch, if needed |
|
| 3695 | - if (!isset($context['sandbox']['progress'])) { |
|
| 3694 | + // Initialize the batch, if needed |
|
| 3695 | + if (!isset($context['sandbox']['progress'])) { |
|
| 3696 | 3696 | $context['sandbox']['progress'] = 0; |
| 3697 | 3697 | $context['sandbox']['max'] = $batch_size; |
| 3698 | - } |
|
| 3698 | + } |
|
| 3699 | 3699 | |
| 3700 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 3700 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 3701 | 3701 | |
| 3702 | - // Get private messages to process |
|
| 3703 | - $messages = db_query(' |
|
| 3702 | + // Get private messages to process |
|
| 3703 | + $messages = db_query(' |
|
| 3704 | 3704 | SELECT pm.mid, pm.body |
| 3705 | 3705 | FROM {pm_message} pm |
| 3706 | 3706 | ORDER BY pm.mid |
| 3707 | 3707 | LIMIT %d,%d', |
| 3708 | 3708 | $offset, $batch_size |
| 3709 | - ); |
|
| 3709 | + ); |
|
| 3710 | 3710 | |
| 3711 | - while ($pm = db_fetch_object($messages)) { |
|
| 3711 | + while ($pm = db_fetch_object($messages)) { |
|
| 3712 | 3712 | $updated = FALSE; |
| 3713 | 3713 | |
| 3714 | 3714 | // Update URLs in private message body |
| 3715 | 3715 | $original_pm_body = $pm->body; |
| 3716 | 3716 | $pm->body = _boincimport_replace_links($pm->body); |
| 3717 | 3717 | if ($pm->body != $original_pm_body) { |
| 3718 | - $updated = db_query(" |
|
| 3718 | + $updated = db_query(" |
|
| 3719 | 3719 | UPDATE {pm_message} |
| 3720 | 3720 | SET body= '%s' |
| 3721 | 3721 | WHERE mid = %d", |
| 3722 | 3722 | $pm->body, $pm->mid |
| 3723 | - ); |
|
| 3723 | + ); |
|
| 3724 | 3724 | } |
| 3725 | 3725 | |
| 3726 | 3726 | $message = ''; |
| 3727 | 3727 | $context['results']['success'][] = $pm->mid; |
| 3728 | 3728 | if ($updated) { |
| 3729 | - // Store some result for post-processing in the finished callback. |
|
| 3730 | - $context['results']['pm']['updated'][] = $pm->mid; |
|
| 3731 | - $message = "Successfully updated private message {$pm->mid}"; |
|
| 3729 | + // Store some result for post-processing in the finished callback. |
|
| 3730 | + $context['results']['pm']['updated'][] = $pm->mid; |
|
| 3731 | + $message = "Successfully updated private message {$pm->mid}"; |
|
| 3732 | 3732 | } |
| 3733 | 3733 | else { |
| 3734 | - $message = "No changes made to private message {$pm->mid}!"; |
|
| 3734 | + $message = "No changes made to private message {$pm->mid}!"; |
|
| 3735 | 3735 | } |
| 3736 | 3736 | |
| 3737 | 3737 | // Update our progress information. |
@@ -3741,85 +3741,85 @@ discard block |
||
| 3741 | 3741 | |
| 3742 | 3742 | // Update the progress for the batch engine |
| 3743 | 3743 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3744 | - $context['finished'] = 1; |
|
| 3744 | + $context['finished'] = 1; |
|
| 3745 | 3745 | } |
| 3746 | 3746 | else { |
| 3747 | - $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3747 | + $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
|
| 3748 | + } |
|
| 3748 | 3749 | } |
| 3749 | - } |
|
| 3750 | 3750 | } |
| 3751 | 3751 | |
| 3752 | 3752 | /** |
| 3753 | 3753 | * Batch 'finished' callback |
| 3754 | 3754 | */ |
| 3755 | 3755 | function boincimport_replace_urls_finished($success, $results, $operations) { |
| 3756 | - if ($success) { |
|
| 3756 | + if ($success) { |
|
| 3757 | 3757 | // Let's count our successes |
| 3758 | 3758 | $total_processed = count($results['success']); |
| 3759 | 3759 | $nodes_updated = count($results['nodes']['updated']); |
| 3760 | 3760 | $comments_updated = count($results['comments']['updated']); |
| 3761 | 3761 | $private_messages_updated = count($results['pm']['updated']); |
| 3762 | 3762 | $message = t( |
| 3763 | - 'Successfully processed @count nodes, comments, and private messages (@nodes_updated nodes, @comments_updated comments, and @pm_updated private messages were updated)', |
|
| 3764 | - array( |
|
| 3763 | + 'Successfully processed @count nodes, comments, and private messages (@nodes_updated nodes, @comments_updated comments, and @pm_updated private messages were updated)', |
|
| 3764 | + array( |
|
| 3765 | 3765 | '@count' => $total_processed, |
| 3766 | 3766 | '@nodes_updated' => $nodes_updated, |
| 3767 | 3767 | '@comments_updated' => $comments_updated, |
| 3768 | 3768 | '@pm_updated' => $private_messages_updated, |
| 3769 | - ) |
|
| 3769 | + ) |
|
| 3770 | 3770 | ); |
| 3771 | 3771 | if ($private_messages_updated) { |
| 3772 | - watchdog('boincimport', |
|
| 3772 | + watchdog('boincimport', |
|
| 3773 | 3773 | 'Updated URLs in these private_messages: @mid_list', |
| 3774 | 3774 | array( |
| 3775 | - '@mid_list' => implode(', ', $results['pm']['updated']), |
|
| 3775 | + '@mid_list' => implode(', ', $results['pm']['updated']), |
|
| 3776 | 3776 | ), |
| 3777 | 3777 | WATCHDOG_INFO |
| 3778 | - ); |
|
| 3778 | + ); |
|
| 3779 | 3779 | } |
| 3780 | 3780 | if ($comments_updated) { |
| 3781 | - watchdog('boincimport', |
|
| 3781 | + watchdog('boincimport', |
|
| 3782 | 3782 | 'Updated URLs in these comments: @cid_list', |
| 3783 | 3783 | array( |
| 3784 | - '@cid_list' => implode(', ', $results['comments']['updated']), |
|
| 3784 | + '@cid_list' => implode(', ', $results['comments']['updated']), |
|
| 3785 | 3785 | ), |
| 3786 | 3786 | WATCHDOG_INFO |
| 3787 | - ); |
|
| 3787 | + ); |
|
| 3788 | 3788 | } |
| 3789 | 3789 | if ($nodes_updated) { |
| 3790 | - watchdog('boincimport', |
|
| 3790 | + watchdog('boincimport', |
|
| 3791 | 3791 | 'Updated URLs in these nodes: @nid_list', |
| 3792 | 3792 | array( |
| 3793 | - '@nid_list' => implode(', ', $results['nodes']['updated']), |
|
| 3793 | + '@nid_list' => implode(', ', $results['nodes']['updated']), |
|
| 3794 | 3794 | ), |
| 3795 | 3795 | WATCHDOG_INFO |
| 3796 | - ); |
|
| 3796 | + ); |
|
| 3797 | 3797 | } |
| 3798 | 3798 | watchdog('boincimport', |
| 3799 | - 'Successfully processed @count nodes, comments, and private messages (@nodes_updated nodes, @comments_updated comments, and @pm_updated private messages were updated)', |
|
| 3800 | - array( |
|
| 3799 | + 'Successfully processed @count nodes, comments, and private messages (@nodes_updated nodes, @comments_updated comments, and @pm_updated private messages were updated)', |
|
| 3800 | + array( |
|
| 3801 | 3801 | '@count' => $total_processed, |
| 3802 | 3802 | '@nodes_updated' => $nodes_updated, |
| 3803 | 3803 | '@comments_updated' => $comments_updated, |
| 3804 | 3804 | '@pm_updated' => $private_messages_updated, |
| 3805 | - ), |
|
| 3806 | - WATCHDOG_INFO |
|
| 3805 | + ), |
|
| 3806 | + WATCHDOG_INFO |
|
| 3807 | 3807 | ); |
| 3808 | 3808 | // Set the replace URLs successful flag in the variable table |
| 3809 | 3809 | variable_set('boincimport_replace_urls_successful', '1'); |
| 3810 | 3810 | $_SESSION['boincimport_stage_selected'] = 'users'; |
| 3811 | - } |
|
| 3812 | - else { |
|
| 3811 | + } |
|
| 3812 | + else { |
|
| 3813 | 3813 | // An error occurred. |
| 3814 | 3814 | // $operations contains the operations that remained unprocessed. |
| 3815 | 3815 | $error_operation = reset($operations); |
| 3816 | 3816 | $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE); |
| 3817 | - } |
|
| 3818 | - drupal_set_message($message); |
|
| 3817 | + } |
|
| 3818 | + drupal_set_message($message); |
|
| 3819 | 3819 | |
| 3820 | - // Release the lock on the import process |
|
| 3821 | - variable_del('boincimport_process_locked'); |
|
| 3822 | - drupal_goto('admin/boinc/import/process'); |
|
| 3820 | + // Release the lock on the import process |
|
| 3821 | + variable_del('boincimport_process_locked'); |
|
| 3822 | + drupal_goto('admin/boinc/import/process'); |
|
| 3823 | 3823 | } |
| 3824 | 3824 | |
| 3825 | 3825 | |
@@ -3831,43 +3831,43 @@ discard block |
||
| 3831 | 3831 | * Remove temporary variables, clear caches, etc. |
| 3832 | 3832 | */ |
| 3833 | 3833 | function boincimport_process_cleanup() { |
| 3834 | - db_set_active('default'); |
|
| 3835 | - |
|
| 3836 | - variable_del('boincimport_base_url_boinc'); |
|
| 3837 | - variable_del('boincimport_base_url_drupal'); |
|
| 3838 | - variable_del('boincimport_import_user_successful'); |
|
| 3839 | - variable_del('boincimport_import_user_started'); |
|
| 3840 | - variable_del('boincimport_import_team_successful'); |
|
| 3841 | - variable_del('boincimport_import_team_started'); |
|
| 3842 | - variable_del('boincimport_import_category_successful'); |
|
| 3843 | - variable_del('boincimport_replace_url_successful'); |
|
| 3844 | - variable_del('boincimport_import_category_started'); |
|
| 3845 | - variable_del('boincimport_import_topic_successful'); |
|
| 3846 | - variable_del('boincimport_import_topic_started'); |
|
| 3847 | - variable_del('boincimport_import_post_successful'); |
|
| 3848 | - variable_del('boincimport_import_post_started'); |
|
| 3849 | - variable_del('boincimport_team_forum_successful'); |
|
| 3850 | - variable_del('boincimport_team_topic_successful'); |
|
| 3851 | - variable_del('boincimport_team_post_successful'); |
|
| 3852 | - variable_del('boincimport_team_post_started'); |
|
| 3853 | - variable_del('boincimport_ready'); |
|
| 3854 | - variable_del('boincimport_db_url'); |
|
| 3855 | - variable_del('boincimport_tested'); |
|
| 3856 | - variable_del('boincimport_db_configured'); |
|
| 3857 | - variable_del('boincimport_table_prefix'); |
|
| 3858 | - variable_del('boincimport_team_types'); |
|
| 3859 | - variable_del('boincimport_time_limit'); |
|
| 3860 | - variable_del('boincimport_import_lurkers'); |
|
| 3861 | - variable_del('boincimport_import_polls'); |
|
| 3862 | - variable_del('boincimport_import_poll_started'); |
|
| 3863 | - variable_del('boincimport_import_poll_successful'); |
|
| 3864 | - variable_del('boincimport_import_pm_successful'); |
|
| 3865 | - variable_del('boincimport_encode'); |
|
| 3866 | - variable_del('boincimport_encoding_phpbb'); |
|
| 3867 | - variable_del('boincimport_encoding_drupal'); |
|
| 3868 | - variable_del('boincimport_version'); |
|
| 3869 | - |
|
| 3870 | - db_query('DELETE FROM {cache}'); |
|
| 3834 | + db_set_active('default'); |
|
| 3835 | + |
|
| 3836 | + variable_del('boincimport_base_url_boinc'); |
|
| 3837 | + variable_del('boincimport_base_url_drupal'); |
|
| 3838 | + variable_del('boincimport_import_user_successful'); |
|
| 3839 | + variable_del('boincimport_import_user_started'); |
|
| 3840 | + variable_del('boincimport_import_team_successful'); |
|
| 3841 | + variable_del('boincimport_import_team_started'); |
|
| 3842 | + variable_del('boincimport_import_category_successful'); |
|
| 3843 | + variable_del('boincimport_replace_url_successful'); |
|
| 3844 | + variable_del('boincimport_import_category_started'); |
|
| 3845 | + variable_del('boincimport_import_topic_successful'); |
|
| 3846 | + variable_del('boincimport_import_topic_started'); |
|
| 3847 | + variable_del('boincimport_import_post_successful'); |
|
| 3848 | + variable_del('boincimport_import_post_started'); |
|
| 3849 | + variable_del('boincimport_team_forum_successful'); |
|
| 3850 | + variable_del('boincimport_team_topic_successful'); |
|
| 3851 | + variable_del('boincimport_team_post_successful'); |
|
| 3852 | + variable_del('boincimport_team_post_started'); |
|
| 3853 | + variable_del('boincimport_ready'); |
|
| 3854 | + variable_del('boincimport_db_url'); |
|
| 3855 | + variable_del('boincimport_tested'); |
|
| 3856 | + variable_del('boincimport_db_configured'); |
|
| 3857 | + variable_del('boincimport_table_prefix'); |
|
| 3858 | + variable_del('boincimport_team_types'); |
|
| 3859 | + variable_del('boincimport_time_limit'); |
|
| 3860 | + variable_del('boincimport_import_lurkers'); |
|
| 3861 | + variable_del('boincimport_import_polls'); |
|
| 3862 | + variable_del('boincimport_import_poll_started'); |
|
| 3863 | + variable_del('boincimport_import_poll_successful'); |
|
| 3864 | + variable_del('boincimport_import_pm_successful'); |
|
| 3865 | + variable_del('boincimport_encode'); |
|
| 3866 | + variable_del('boincimport_encoding_phpbb'); |
|
| 3867 | + variable_del('boincimport_encoding_drupal'); |
|
| 3868 | + variable_del('boincimport_version'); |
|
| 3869 | + |
|
| 3870 | + db_query('DELETE FROM {cache}'); |
|
| 3871 | 3871 | } |
| 3872 | 3872 | |
| 3873 | 3873 | /** |
@@ -3875,15 +3875,15 @@ discard block |
||
| 3875 | 3875 | */ |
| 3876 | 3876 | |
| 3877 | 3877 | function boincimport_forum_comment_save(&$edit) { |
| 3878 | - // Here we are building the thread field. See the comment in comment_render(). |
|
| 3879 | - if ($edit['pid'] == 0) { |
|
| 3878 | + // Here we are building the thread field. See the comment in comment_render(). |
|
| 3879 | + if ($edit['pid'] == 0) { |
|
| 3880 | 3880 | // This is a comment with no parent comment (depth 0): we start by retrieving |
| 3881 | 3881 | // the maximum thread level. |
| 3882 | 3882 | $max = db_result(db_query('SELECT MAX(thread) FROM {comments} WHERE nid = %d', $edit['nid'])); |
| 3883 | 3883 | // Strip the "/" from the end of the thread. |
| 3884 | 3884 | $max = rtrim($max, '/'); |
| 3885 | 3885 | $thread = int2vancode(vancode2int($max)+1) .'/'; |
| 3886 | - } else { |
|
| 3886 | + } else { |
|
| 3887 | 3887 | // This is comment with a parent comment: we increase the part of the thread |
| 3888 | 3888 | // value at the proper depth. |
| 3889 | 3889 | $parent = db_fetch_object(db_query('SELECT * FROM {comments} WHERE cid = %d', $edit['pid'])); |
@@ -3892,71 +3892,71 @@ discard block |
||
| 3892 | 3892 | // Get the max value in _this_ thread. |
| 3893 | 3893 | $max = db_result(db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE '%s.%%' AND nid = %d", $parent->thread, $edit['nid'])); |
| 3894 | 3894 | if ($max == '') { |
| 3895 | - // First child of this parent. |
|
| 3896 | - $thread = $parent->thread .'.'. int2vancode(1) .'/'; |
|
| 3895 | + // First child of this parent. |
|
| 3896 | + $thread = $parent->thread .'.'. int2vancode(1) .'/'; |
|
| 3897 | 3897 | } else { |
| 3898 | - // Strip the "/" at the end of the thread. |
|
| 3899 | - $max = rtrim($max, '/'); |
|
| 3900 | - // We need to get the value at the correct depth. |
|
| 3901 | - $parts = explode('.', $max); |
|
| 3902 | - $parent_depth = count(explode('.', $parent->thread)); |
|
| 3903 | - $last = $parts[$parent_depth]; |
|
| 3904 | - // Finally, build the thread field for this new comment. |
|
| 3905 | - $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/'; |
|
| 3898 | + // Strip the "/" at the end of the thread. |
|
| 3899 | + $max = rtrim($max, '/'); |
|
| 3900 | + // We need to get the value at the correct depth. |
|
| 3901 | + $parts = explode('.', $max); |
|
| 3902 | + $parent_depth = count(explode('.', $parent->thread)); |
|
| 3903 | + $last = $parts[$parent_depth]; |
|
| 3904 | + // Finally, build the thread field for this new comment. |
|
| 3905 | + $thread = $parent->thread .'.'. int2vancode(vancode2int($last) + 1) .'/'; |
|
| 3906 | + } |
|
| 3906 | 3907 | } |
| 3907 | - } |
|
| 3908 | 3908 | |
| 3909 | - $status = 0; // 1 - not published, 0 - published |
|
| 3910 | - $format = variable_get('boincimport_input_format', 0); |
|
| 3911 | - $score = 0; // 0 default value, comments get higher score depending on the author's roles |
|
| 3912 | - $users = serialize(array(0 => 1)); // default value for everybody!! |
|
| 3909 | + $status = 0; // 1 - not published, 0 - published |
|
| 3910 | + $format = variable_get('boincimport_input_format', 0); |
|
| 3911 | + $score = 0; // 0 default value, comments get higher score depending on the author's roles |
|
| 3912 | + $users = serialize(array(0 => 1)); // default value for everybody!! |
|
| 3913 | 3913 | |
| 3914 | - if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too |
|
| 3914 | + if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too |
|
| 3915 | 3915 | $edit['name'] = $user->name; |
| 3916 | - } |
|
| 3916 | + } |
|
| 3917 | 3917 | |
| 3918 | - $success = db_query("INSERT INTO {comments} (nid, pid, uid, subject, comment, format, hostname, timestamp, status, thread, name) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s')", $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], ip_address(), $edit['timestamp'], $edit['status'], $thread, $edit['name']); |
|
| 3919 | - if ($success) { |
|
| 3918 | + $success = db_query("INSERT INTO {comments} (nid, pid, uid, subject, comment, format, hostname, timestamp, status, thread, name) VALUES (%d, %d, %d, '%s', '%s', %d, '%s', %d, %d, '%s', '%s')", $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], ip_address(), $edit['timestamp'], $edit['status'], $thread, $edit['name']); |
|
| 3919 | + if ($success) { |
|
| 3920 | 3920 | $edit['cid'] = db_last_insert_id('comments', 'cid'); |
| 3921 | 3921 | _comment_update_node_statistics($edit['nid']); |
| 3922 | - } |
|
| 3923 | - return $success; |
|
| 3922 | + } |
|
| 3923 | + return $success; |
|
| 3924 | 3924 | } |
| 3925 | 3925 | |
| 3926 | 3926 | /** |
| 3927 | 3927 | * Strips text of extra phpbb3 markup and if requested, also strips all bbcode from text. |
| 3928 | 3928 | */ |
| 3929 | 3929 | function _boincimport_strip_bbcode($text) { |
| 3930 | - // Strip the text of extra markup - regular expressions taken from phpbb3 includes/function.php, function get_preg_expression(). |
|
| 3931 | - $match = array( |
|
| 3930 | + // Strip the text of extra markup - regular expressions taken from phpbb3 includes/function.php, function get_preg_expression(). |
|
| 3931 | + $match = array( |
|
| 3932 | 3932 | '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', |
| 3933 | 3933 | '#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&|\?)sid=[0-9a-f]{32})?">.*?</a><!\-\- l \-\->#', |
| 3934 | 3934 | '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->#', |
| 3935 | 3935 | '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', |
| 3936 | 3936 | '#<!\-\- .*? \-\->#s', |
| 3937 | 3937 | '#<.*?>#s', |
| 3938 | - ); |
|
| 3939 | - $replace = array('$1', '$1', '$2', '$1', '', ''); |
|
| 3940 | - $text = preg_replace($match, $replace, $text); |
|
| 3938 | + ); |
|
| 3939 | + $replace = array('$1', '$1', '$2', '$1', '', ''); |
|
| 3940 | + $text = preg_replace($match, $replace, $text); |
|
| 3941 | 3941 | |
| 3942 | - // If BBcode conversion to has been selected, the following will convert the |
|
| 3943 | - // BBcode to normal html |
|
| 3944 | - if (variable_get('boincimport_bbcode', 0)) { |
|
| 3942 | + // If BBcode conversion to has been selected, the following will convert the |
|
| 3943 | + // BBcode to normal html |
|
| 3944 | + if (variable_get('boincimport_bbcode', 0)) { |
|
| 3945 | 3945 | $input_format = variable_get('boincimport_input_format', 0); |
| 3946 | 3946 | $text = bbcode_filter('process', 0 , $input_format, $text); |
| 3947 | - } |
|
| 3948 | - return $text; |
|
| 3947 | + } |
|
| 3948 | + return $text; |
|
| 3949 | 3949 | } |
| 3950 | 3950 | |
| 3951 | 3951 | /** |
| 3952 | 3952 | * Function to properly encode strings. |
| 3953 | 3953 | */ |
| 3954 | 3954 | function _boincimport_text_sanitize($text) { |
| 3955 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 3956 | - $text = html_entity_decode($text, ENT_QUOTES, 'utf-8'); |
|
| 3957 | - // Be sure the text is filtered for the default input format |
|
| 3958 | - $text = check_markup($text, $input_format); |
|
| 3959 | - return $text; |
|
| 3955 | + $input_format = variable_get('boincimport_input_format', 0); |
|
| 3956 | + $text = html_entity_decode($text, ENT_QUOTES, 'utf-8'); |
|
| 3957 | + // Be sure the text is filtered for the default input format |
|
| 3958 | + $text = check_markup($text, $input_format); |
|
| 3959 | + return $text; |
|
| 3960 | 3960 | } |
| 3961 | 3961 | |
| 3962 | 3962 | |
@@ -3965,25 +3965,25 @@ discard block |
||
| 3965 | 3965 | */ |
| 3966 | 3966 | function _boincimport_replace_links($html) { |
| 3967 | 3967 | |
| 3968 | - $transformer = new BoincImportUrlTransformer(); |
|
| 3969 | - |
|
| 3970 | - // Update links to posts, threads, and forums |
|
| 3971 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_thread\.php\?id=(\d+)&postid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformPostLinks'), $html); |
|
| 3972 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_thread\.php\?id=(\d+)(&\w+=\w*)*?(#(\d+)?)}i', array($transformer, 'transformOldPostLinks'), $html); |
|
| 3973 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_thread\.php\?id=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformTopicLinks'), $html); |
|
| 3974 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_forum\.php\?id=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformForumLinks'), $html); |
|
| 3975 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)show_user\.php\?userid=(\d+)((&\w+=\w*)+)?}i', array($transformer, 'transformUserLinks'), $html); |
|
| 3976 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)workunit\.php\?wuid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformWorkUnitLinks'), $html); |
|
| 3977 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)result\.php\?resultid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformResultLinks'), $html); |
|
| 3978 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)results\.php\?userid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformUserResultsLinks'), $html); |
|
| 3979 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)results\.php\?hostid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformHostResultsLinks'), $html); |
|
| 3980 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)show_host_detail\.php\?hostid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformHostLinks'), $html); |
|
| 3981 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)hosts_user\.php\?userid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformUserHostsLinks'), $html); |
|
| 3982 | - |
|
| 3983 | - // Update any links to the top level index |
|
| 3984 | - $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_index.php}i', array($transformer, 'transformForumIndexLinks'), $html); |
|
| 3985 | - |
|
| 3986 | - return $html; |
|
| 3968 | + $transformer = new BoincImportUrlTransformer(); |
|
| 3969 | + |
|
| 3970 | + // Update links to posts, threads, and forums |
|
| 3971 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_thread\.php\?id=(\d+)&postid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformPostLinks'), $html); |
|
| 3972 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_thread\.php\?id=(\d+)(&\w+=\w*)*?(#(\d+)?)}i', array($transformer, 'transformOldPostLinks'), $html); |
|
| 3973 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_thread\.php\?id=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformTopicLinks'), $html); |
|
| 3974 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_forum\.php\?id=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformForumLinks'), $html); |
|
| 3975 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)show_user\.php\?userid=(\d+)((&\w+=\w*)+)?}i', array($transformer, 'transformUserLinks'), $html); |
|
| 3976 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)workunit\.php\?wuid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformWorkUnitLinks'), $html); |
|
| 3977 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)result\.php\?resultid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformResultLinks'), $html); |
|
| 3978 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)results\.php\?userid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformUserResultsLinks'), $html); |
|
| 3979 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)results\.php\?hostid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformHostResultsLinks'), $html); |
|
| 3980 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)show_host_detail\.php\?hostid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformHostLinks'), $html); |
|
| 3981 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)hosts_user\.php\?userid=(\d+)(&\w+=\w*)*?}i', array($transformer, 'transformUserHostsLinks'), $html); |
|
| 3982 | + |
|
| 3983 | + // Update any links to the top level index |
|
| 3984 | + $html = preg_replace_callback('{(?:(http|https)://([^\s]*?)|href="(?:/)?)forum_index.php}i', array($transformer, 'transformForumIndexLinks'), $html); |
|
| 3985 | + |
|
| 3986 | + return $html; |
|
| 3987 | 3987 | } |
| 3988 | 3988 | |
| 3989 | 3989 | /** |
@@ -3991,14 +3991,14 @@ discard block |
||
| 3991 | 3991 | */ |
| 3992 | 3992 | class BoincImportUrlTransformer { |
| 3993 | 3993 | |
| 3994 | - var $basePath; |
|
| 3995 | - var $boincDomain; |
|
| 3996 | - var $drupalDomain; |
|
| 3994 | + var $basePath; |
|
| 3995 | + var $boincDomain; |
|
| 3996 | + var $drupalDomain; |
|
| 3997 | 3997 | |
| 3998 | - /** |
|
| 3999 | - * Constructor |
|
| 4000 | - */ |
|
| 4001 | - function __construct() { |
|
| 3998 | + /** |
|
| 3999 | + * Constructor |
|
| 4000 | + */ |
|
| 4001 | + function __construct() { |
|
| 4002 | 4002 | global $base_url; |
| 4003 | 4003 | global $base_path; |
| 4004 | 4004 | $boinc_base_urls = variable_get('boincimport_base_url_boinc', ''); |
@@ -4008,208 +4008,208 @@ discard block |
||
| 4008 | 4008 | $this->boincDomains = array(); |
| 4009 | 4009 | $boinc_base_urls = preg_split('/\s+/', $boinc_base_urls); |
| 4010 | 4010 | foreach ($boinc_base_urls as $url) { |
| 4011 | - $domain = parse_url($url, PHP_URL_HOST); |
|
| 4012 | - if ($domain) { |
|
| 4011 | + $domain = parse_url($url, PHP_URL_HOST); |
|
| 4012 | + if ($domain) { |
|
| 4013 | 4013 | $this->boincDomains[$domain] = TRUE; |
| 4014 | - } |
|
| 4014 | + } |
|
| 4015 | 4015 | } |
| 4016 | 4016 | if (!$this->boincDomains) { |
| 4017 | - watchdog('boincimport', 'No valid BOINC base URLs found to transform!', |
|
| 4017 | + watchdog('boincimport', 'No valid BOINC base URLs found to transform!', |
|
| 4018 | 4018 | array(), WATCHDOG_WARNING); |
| 4019 | 4019 | } |
| 4020 | - } |
|
| 4020 | + } |
|
| 4021 | 4021 | |
| 4022 | - // old-style constructor for backwards compatibility |
|
| 4023 | - function BoincImportUrlTransformer() { |
|
| 4022 | + // old-style constructor for backwards compatibility |
|
| 4023 | + function BoincImportUrlTransformer() { |
|
| 4024 | 4024 | self::__construct(); |
| 4025 | - } |
|
| 4025 | + } |
|
| 4026 | 4026 | |
| 4027 | - /** |
|
| 4028 | - * Get what the new base URL should be (needed for every transformation) |
|
| 4029 | - */ |
|
| 4030 | - function getNewBaseUrl($matches) { |
|
| 4027 | + /** |
|
| 4028 | + * Get what the new base URL should be (needed for every transformation) |
|
| 4029 | + */ |
|
| 4030 | + function getNewBaseUrl($matches) { |
|
| 4031 | 4031 | $http = $matches[1]; |
| 4032 | 4032 | $domain = trim($matches[2], '/'); |
| 4033 | 4033 | if ($http) { |
| 4034 | - if (isset($this->boincDomains[$domain])) { |
|
| 4034 | + if (isset($this->boincDomains[$domain])) { |
|
| 4035 | 4035 | // This is a URL configured to be transformed |
| 4036 | 4036 | return "{$http}://{$this->drupalDomain}{$this->basePath}"; |
| 4037 | - } |
|
| 4038 | - else { |
|
| 4037 | + } |
|
| 4038 | + else { |
|
| 4039 | 4039 | // This URL should not be transformed |
| 4040 | 4040 | return NULL; |
| 4041 | - } |
|
| 4041 | + } |
|
| 4042 | 4042 | } |
| 4043 | 4043 | else { |
| 4044 | - // This is a relative URL |
|
| 4045 | - return $this->basePath; |
|
| 4044 | + // This is a relative URL |
|
| 4045 | + return $this->basePath; |
|
| 4046 | + } |
|
| 4046 | 4047 | } |
| 4047 | - } |
|
| 4048 | 4048 | |
| 4049 | - /** |
|
| 4050 | - * Replace links to specific posts. If the given post is the first in the |
|
| 4051 | - * thread, it is a topic node in Drupal, not a comment. |
|
| 4052 | - */ |
|
| 4053 | - function transformPostLinks($matches) { |
|
| 4049 | + /** |
|
| 4050 | + * Replace links to specific posts. If the given post is the first in the |
|
| 4051 | + * thread, it is a topic node in Drupal, not a comment. |
|
| 4052 | + */ |
|
| 4053 | + function transformPostLinks($matches) { |
|
| 4054 | 4054 | $link = $matches[0]; |
| 4055 | 4055 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4056 | 4056 | if ($newBaseUrl !== NULL) { |
| 4057 | - $id = db_result(db_query(' |
|
| 4057 | + $id = db_result(db_query(' |
|
| 4058 | 4058 | SELECT p.cid |
| 4059 | 4059 | FROM {boincimport_temp_post} p |
| 4060 | 4060 | WHERE p.post_id = %d', |
| 4061 | 4061 | $matches[4] |
| 4062 | - )); |
|
| 4063 | - if ($id) { |
|
| 4062 | + )); |
|
| 4063 | + if ($id) { |
|
| 4064 | 4064 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4065 | - } |
|
| 4066 | - else { |
|
| 4065 | + } |
|
| 4066 | + else { |
|
| 4067 | 4067 | // This post is not in the post import table, so it's probably a topic |
| 4068 | 4068 | $link = $this->transformTopicLinks($matches); |
| 4069 | - } |
|
| 4069 | + } |
|
| 4070 | 4070 | } |
| 4071 | 4071 | return $link; |
| 4072 | - } |
|
| 4072 | + } |
|
| 4073 | 4073 | |
| 4074 | - /** |
|
| 4075 | - * Replace links that include anchors to specific posts. If the given post is |
|
| 4076 | - * the first in the thread, it is a topic node in Drupal, not a comment. |
|
| 4077 | - */ |
|
| 4078 | - function transformOldPostLinks($matches) { |
|
| 4074 | + /** |
|
| 4075 | + * Replace links that include anchors to specific posts. If the given post is |
|
| 4076 | + * the first in the thread, it is a topic node in Drupal, not a comment. |
|
| 4077 | + */ |
|
| 4078 | + function transformOldPostLinks($matches) { |
|
| 4079 | 4079 | $link = $matches[0]; |
| 4080 | 4080 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4081 | 4081 | if ($newBaseUrl !== NULL) { |
| 4082 | - $id = db_result(db_query(' |
|
| 4082 | + $id = db_result(db_query(' |
|
| 4083 | 4083 | SELECT p.cid |
| 4084 | 4084 | FROM {boincimport_temp_post} p |
| 4085 | 4085 | WHERE p.post_id = %d', |
| 4086 | 4086 | $matches[6] |
| 4087 | - )); |
|
| 4088 | - if ($id) { |
|
| 4087 | + )); |
|
| 4088 | + if ($id) { |
|
| 4089 | 4089 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4090 | - } |
|
| 4091 | - else { |
|
| 4090 | + } |
|
| 4091 | + else { |
|
| 4092 | 4092 | // This post is not in the post import table, so it's probably a topic |
| 4093 | 4093 | $link = $this->transformTopicLinks($matches); |
| 4094 | - } |
|
| 4094 | + } |
|
| 4095 | 4095 | } |
| 4096 | 4096 | return $link; |
| 4097 | - } |
|
| 4097 | + } |
|
| 4098 | 4098 | |
| 4099 | - function transformTopicLinks($matches) { |
|
| 4099 | + function transformTopicLinks($matches) { |
|
| 4100 | 4100 | $link = $matches[0]; |
| 4101 | 4101 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4102 | 4102 | if ($newBaseUrl !== NULL) { |
| 4103 | - $id = db_result(db_query(' |
|
| 4103 | + $id = db_result(db_query(' |
|
| 4104 | 4104 | SELECT nid |
| 4105 | 4105 | FROM {boincimport_temp_topic} |
| 4106 | 4106 | WHERE topic_id = %d', |
| 4107 | 4107 | $matches[3] |
| 4108 | - )); |
|
| 4109 | - $link = "{$newBaseUrl}node/{$id}"; |
|
| 4108 | + )); |
|
| 4109 | + $link = "{$newBaseUrl}node/{$id}"; |
|
| 4110 | 4110 | } |
| 4111 | 4111 | return $link; |
| 4112 | - } |
|
| 4112 | + } |
|
| 4113 | 4113 | |
| 4114 | - function transformForumLinks($matches) { |
|
| 4114 | + function transformForumLinks($matches) { |
|
| 4115 | 4115 | $link = $matches[0]; |
| 4116 | 4116 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4117 | 4117 | if ($newBaseUrl !== NULL) { |
| 4118 | - $forum = db_fetch_object(db_query(' |
|
| 4118 | + $forum = db_fetch_object(db_query(' |
|
| 4119 | 4119 | SELECT tid |
| 4120 | 4120 | FROM {boincimport_temp_forum} |
| 4121 | 4121 | WHERE forum_id = %d', |
| 4122 | 4122 | $matches[3] |
| 4123 | - )); |
|
| 4124 | - $link = "{$newBaseUrl}community/forum/{$forum->tid}"; |
|
| 4123 | + )); |
|
| 4124 | + $link = "{$newBaseUrl}community/forum/{$forum->tid}"; |
|
| 4125 | 4125 | } |
| 4126 | 4126 | return $link; |
| 4127 | - } |
|
| 4127 | + } |
|
| 4128 | 4128 | |
| 4129 | - function transformUserLinks($matches) { |
|
| 4129 | + function transformUserLinks($matches) { |
|
| 4130 | 4130 | $link = $matches[0]; |
| 4131 | 4131 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4132 | 4132 | if ($newBaseUrl !== NULL) { |
| 4133 | - // Make sure this isn't an RPC link (no need to transform those) |
|
| 4134 | - if (!$matches[5]) { |
|
| 4133 | + // Make sure this isn't an RPC link (no need to transform those) |
|
| 4134 | + if (!$matches[5]) { |
|
| 4135 | 4135 | // TODO: This regex doesn't seem to capture the format=xml part of the |
| 4136 | 4136 | // URL, making it impossible to distinguish if this is an RPC or not... |
| 4137 | 4137 | //watchdog('DEBUG', 'matches: @m', array('@m' => print_r($matches,true)), WATCHDOG_DEBUG); |
| 4138 | 4138 | $uid = boincuser_lookup_uid($matches[3]); |
| 4139 | 4139 | $link = "{$newBaseUrl}account/{$uid}"; |
| 4140 | - } |
|
| 4140 | + } |
|
| 4141 | 4141 | } |
| 4142 | 4142 | return $link; |
| 4143 | - } |
|
| 4143 | + } |
|
| 4144 | 4144 | |
| 4145 | - function transformWorkUnitLinks($matches) { |
|
| 4145 | + function transformWorkUnitLinks($matches) { |
|
| 4146 | 4146 | $link = $matches[0]; |
| 4147 | 4147 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4148 | 4148 | if ($newBaseUrl !== NULL) { |
| 4149 | - $id = $matches[3]; |
|
| 4150 | - $link = "{$newBaseUrl}workunit/{$id}"; |
|
| 4149 | + $id = $matches[3]; |
|
| 4150 | + $link = "{$newBaseUrl}workunit/{$id}"; |
|
| 4151 | 4151 | } |
| 4152 | 4152 | return $link; |
| 4153 | - } |
|
| 4153 | + } |
|
| 4154 | 4154 | |
| 4155 | - function transformResultLinks($matches) { |
|
| 4155 | + function transformResultLinks($matches) { |
|
| 4156 | 4156 | $link = $matches[0]; |
| 4157 | 4157 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4158 | 4158 | if ($newBaseUrl !== NULL) { |
| 4159 | - $id = $matches[3]; |
|
| 4160 | - $link = "{$newBaseUrl}task/{$id}"; |
|
| 4159 | + $id = $matches[3]; |
|
| 4160 | + $link = "{$newBaseUrl}task/{$id}"; |
|
| 4161 | 4161 | } |
| 4162 | 4162 | return $link; |
| 4163 | - } |
|
| 4163 | + } |
|
| 4164 | 4164 | |
| 4165 | - function transformHostResultsLinks($matches) { |
|
| 4165 | + function transformHostResultsLinks($matches) { |
|
| 4166 | 4166 | $link = $matches[0]; |
| 4167 | 4167 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4168 | 4168 | if ($newBaseUrl !== NULL) { |
| 4169 | - $id = $matches[3]; |
|
| 4170 | - $link = "{$newBaseUrl}host/{$id}/tasks"; |
|
| 4169 | + $id = $matches[3]; |
|
| 4170 | + $link = "{$newBaseUrl}host/{$id}/tasks"; |
|
| 4171 | 4171 | } |
| 4172 | 4172 | return $link; |
| 4173 | - } |
|
| 4173 | + } |
|
| 4174 | 4174 | |
| 4175 | - function transformUserResultsLinks($matches) { |
|
| 4175 | + function transformUserResultsLinks($matches) { |
|
| 4176 | 4176 | $link = $matches[0]; |
| 4177 | 4177 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4178 | 4178 | if ($newBaseUrl !== NULL) { |
| 4179 | - $link = "{$newBaseUrl}account/tasks"; |
|
| 4179 | + $link = "{$newBaseUrl}account/tasks"; |
|
| 4180 | 4180 | } |
| 4181 | 4181 | return $link; |
| 4182 | - } |
|
| 4182 | + } |
|
| 4183 | 4183 | |
| 4184 | - function transformHostLinks($matches) { |
|
| 4184 | + function transformHostLinks($matches) { |
|
| 4185 | 4185 | $link = $matches[0]; |
| 4186 | 4186 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4187 | 4187 | if ($newBaseUrl !== NULL) { |
| 4188 | - $id = $matches[3]; |
|
| 4189 | - $link = "{$newBaseUrl}host/{$id}"; |
|
| 4188 | + $id = $matches[3]; |
|
| 4189 | + $link = "{$newBaseUrl}host/{$id}"; |
|
| 4190 | 4190 | } |
| 4191 | 4191 | return $link; |
| 4192 | - } |
|
| 4192 | + } |
|
| 4193 | 4193 | |
| 4194 | - function transformUserHostsLinks($matches) { |
|
| 4194 | + function transformUserHostsLinks($matches) { |
|
| 4195 | 4195 | $link = $matches[0]; |
| 4196 | 4196 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4197 | 4197 | if ($newBaseUrl !== NULL) { |
| 4198 | - $uid = boincuser_lookup_uid($matches[3]); |
|
| 4199 | - if ($uid) { |
|
| 4198 | + $uid = boincuser_lookup_uid($matches[3]); |
|
| 4199 | + if ($uid) { |
|
| 4200 | 4200 | $link = "{$newBaseUrl}account/{$uid}/computers"; |
| 4201 | - } |
|
| 4201 | + } |
|
| 4202 | 4202 | } |
| 4203 | 4203 | return $link; |
| 4204 | - } |
|
| 4204 | + } |
|
| 4205 | 4205 | |
| 4206 | - function transformForumIndexLinks($matches) { |
|
| 4206 | + function transformForumIndexLinks($matches) { |
|
| 4207 | 4207 | $link = $matches[0]; |
| 4208 | 4208 | $newBaseUrl = $this->getNewBaseUrl($matches); |
| 4209 | 4209 | if ($newBaseUrl !== NULL) { |
| 4210 | - $link = "{$newBaseUrl}community/forum"; |
|
| 4210 | + $link = "{$newBaseUrl}community/forum"; |
|
| 4211 | 4211 | } |
| 4212 | 4212 | return $link; |
| 4213 | - } |
|
| 4213 | + } |
|
| 4214 | 4214 | |
| 4215 | 4215 | } |
@@ -301,7 +301,7 @@ |
||
| 301 | 301 | |
| 302 | 302 | if ($response == '404 NOT FOUND') { |
| 303 | 303 | form_set_error( |
| 304 | - 'boinc_translate_transifex_' . ($project == $boinc_name ? 'standard' : 'project') . '_resources', |
|
| 304 | + 'boinc_translate_transifex_'.($project == $boinc_name ? 'standard' : 'project').'_resources', |
|
| 305 | 305 | t('Resource %name not found in %project.', |
| 306 | 306 | array( |
| 307 | 307 | '%name' => $resource, |
@@ -220,8 +220,7 @@ discard block |
||
| 220 | 220 | if (!$values['boinc_translate_transifex_pass']) { |
| 221 | 221 | if (!variable_get('boinc_translate_transifex_pass', '')) { |
| 222 | 222 | form_set_error('boinc_translate_transifex_pass', t('Password is required.')); |
| 223 | - } |
|
| 224 | - else { |
|
| 223 | + } else { |
|
| 225 | 224 | unset($form_state['values']['boinc_translate_transifex_pass']); |
| 226 | 225 | } |
| 227 | 226 | } |
@@ -260,8 +259,7 @@ discard block |
||
| 260 | 259 | 'boinc_translate_transifex_pass', |
| 261 | 260 | t('Transifex authentication failed.') |
| 262 | 261 | ); |
| 263 | - } |
|
| 264 | - else { |
|
| 262 | + } else { |
|
| 265 | 263 | $authenticated = TRUE; |
| 266 | 264 | } |
| 267 | 265 | } |
@@ -278,14 +276,12 @@ discard block |
||
| 278 | 276 | ); |
| 279 | 277 | if ($project_name AND $project_resources) { |
| 280 | 278 | $transifex_resources[$project_name] = $project_resources; |
| 281 | - } |
|
| 282 | - elseif ($project_name AND !$project_resources) { |
|
| 279 | + } elseif ($project_name AND !$project_resources) { |
|
| 283 | 280 | drupal_set_message( |
| 284 | 281 | t('No project-specific resources were provided'), |
| 285 | 282 | 'warning' |
| 286 | 283 | ); |
| 287 | - } |
|
| 288 | - elseif ($project_resources AND !$project_name) { |
|
| 284 | + } elseif ($project_resources AND !$project_name) { |
|
| 289 | 285 | drupal_set_message( |
| 290 | 286 | t('No project-specific Transifex project name was provided'), |
| 291 | 287 | 'warning' |
@@ -7,85 +7,85 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * The BOINC translation settings form allows configuration of BTS integration |
|
| 11 | - * (and other translation related settings) |
|
| 12 | - */ |
|
| 10 | + * The BOINC translation settings form allows configuration of BTS integration |
|
| 11 | + * (and other translation related settings) |
|
| 12 | + */ |
|
| 13 | 13 | function boinctranslate_admin_settings(&$form_state) { |
| 14 | - $form = array(); |
|
| 15 | - $initialized = FALSE; |
|
| 16 | - $import_enabled = FALSE; |
|
| 17 | - $default = array( |
|
| 14 | + $form = array(); |
|
| 15 | + $initialized = FALSE; |
|
| 16 | + $import_enabled = FALSE; |
|
| 17 | + $default = array( |
|
| 18 | 18 | 'transifex_user' => variable_get('boinc_translate_transifex_user', ''), |
| 19 | 19 | 'transifex_pass' => variable_get('boinc_translate_transifex_pass', ''), |
| 20 | 20 | 'transifex_boinc_name' => variable_get( |
| 21 | - 'boinc_translate_transifex_standard_name', 'boinc' |
|
| 21 | + 'boinc_translate_transifex_standard_name', 'boinc' |
|
| 22 | 22 | ), |
| 23 | 23 | 'transifex_boinc_resources' => variable_get( |
| 24 | - 'boinc_translate_transifex_standard_resources', |
|
| 25 | - "project-generic\nweb" |
|
| 24 | + 'boinc_translate_transifex_standard_resources', |
|
| 25 | + "project-generic\nweb" |
|
| 26 | 26 | ), |
| 27 | 27 | 'transifex_boinc_drupal_resource' => variable_get( |
| 28 | - 'boinc_translate_transifex_boinc_drupal_resource', |
|
| 29 | - 'drupal' |
|
| 28 | + 'boinc_translate_transifex_boinc_drupal_resource', |
|
| 29 | + 'drupal' |
|
| 30 | 30 | ), |
| 31 | 31 | 'transifex_project_name' => variable_get( |
| 32 | - 'boinc_translate_transifex_project_name', '' |
|
| 32 | + 'boinc_translate_transifex_project_name', '' |
|
| 33 | 33 | ), |
| 34 | 34 | 'transifex_project_resources' => variable_get( |
| 35 | - 'boinc_translate_transifex_project_resources', '' |
|
| 35 | + 'boinc_translate_transifex_project_resources', '' |
|
| 36 | 36 | ), |
| 37 | - ); |
|
| 37 | + ); |
|
| 38 | 38 | |
| 39 | - if ($default['transifex_user'] AND $default['transifex_pass']) { |
|
| 39 | + if ($default['transifex_user'] AND $default['transifex_pass']) { |
|
| 40 | 40 | if (trim($default['transifex_boinc_resources']) |
| 41 | 41 | OR trim($default['transifex_project_resources'])) { |
| 42 | - $import_enabled = TRUE; |
|
| 42 | + $import_enabled = TRUE; |
|
| 43 | 43 | } |
| 44 | 44 | if ($default['transifex_boinc_name'] |
| 45 | 45 | AND $default['transifex_project_name'] |
| 46 | 46 | AND trim($default['transifex_boinc_resources']) |
| 47 | 47 | AND trim($default['transifex_project_resources'])) { |
| 48 | - $initialized = TRUE; |
|
| 48 | + $initialized = TRUE; |
|
| 49 | + } |
|
| 49 | 50 | } |
| 50 | - } |
|
| 51 | 51 | |
| 52 | - // Define the form |
|
| 52 | + // Define the form |
|
| 53 | 53 | |
| 54 | - $form['transifex'] = array( |
|
| 54 | + $form['transifex'] = array( |
|
| 55 | 55 | '#title' => t('Transifex settings'), |
| 56 | 56 | '#type' => 'fieldset', |
| 57 | 57 | '#description' => '', |
| 58 | 58 | '#collapsible' => TRUE, |
| 59 | 59 | '#collapsed' => $initialized, |
| 60 | 60 | '#attributes' => array('class' => '') |
| 61 | - ); |
|
| 62 | - $form['transifex']['boinc_translate_transifex_user'] = array( |
|
| 61 | + ); |
|
| 62 | + $form['transifex']['boinc_translate_transifex_user'] = array( |
|
| 63 | 63 | '#type' => 'textfield', |
| 64 | 64 | '#title' => t('User name'), |
| 65 | 65 | '#default_value' => $default['transifex_user'], |
| 66 | - ); |
|
| 67 | - $form['transifex']['boinc_translate_transifex_pass'] = array( |
|
| 66 | + ); |
|
| 67 | + $form['transifex']['boinc_translate_transifex_pass'] = array( |
|
| 68 | 68 | '#type' => 'password', |
| 69 | 69 | '#title' => t('Password'), |
| 70 | 70 | '#attributes' => array( |
| 71 | - 'placeholder' => $default['transifex_pass'] ? '********' : '', |
|
| 71 | + 'placeholder' => $default['transifex_pass'] ? '********' : '', |
|
| 72 | 72 | ), |
| 73 | - ); |
|
| 74 | - $form['transifex']['boinc_translate_transifex_standard_name'] = array( |
|
| 73 | + ); |
|
| 74 | + $form['transifex']['boinc_translate_transifex_standard_name'] = array( |
|
| 75 | 75 | '#type' => 'textfield', |
| 76 | 76 | '#title' => t('BOINC Transifex project'), |
| 77 | 77 | '#default_value' => $default['transifex_boinc_name'], |
| 78 | 78 | '#description' => t('The portion of the Transifex URL that identifies BOINC.'), |
| 79 | - ); |
|
| 80 | - $form['transifex']['boinc_translate_transifex_boinc_drupal_resource'] = array( |
|
| 79 | + ); |
|
| 80 | + $form['transifex']['boinc_translate_transifex_boinc_drupal_resource'] = array( |
|
| 81 | 81 | '#type' => 'textfield', |
| 82 | 82 | '#title' => t('Official BOINC Drupal Resource'), |
| 83 | 83 | '#default_value' => $default['transifex_boinc_drupal_resource'], |
| 84 | 84 | '#description' => t('The portion of the Transifex URL that identifies |
| 85 | 85 | the standard BOINC Resource to use for translation of the public |
| 86 | 86 | content defined in the Drupal system.'), |
| 87 | - ); |
|
| 88 | - $form['transifex']['boinc_translate_transifex_standard_resources'] = array( |
|
| 87 | + ); |
|
| 88 | + $form['transifex']['boinc_translate_transifex_standard_resources'] = array( |
|
| 89 | 89 | '#type' => 'textarea', |
| 90 | 90 | '#title' => t('Additional BOINC Resources'), |
| 91 | 91 | '#default_value' => $default['transifex_boinc_resources'], |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | by any matching translations found in Resources further down the list. |
| 97 | 97 | Note that strings from the Official BOINC Drupal Resource will override |
| 98 | 98 | any strings from these additional Resources.'), |
| 99 | - ); |
|
| 100 | - $form['transifex']['boinc_translate_transifex_project_name'] = array( |
|
| 99 | + ); |
|
| 100 | + $form['transifex']['boinc_translate_transifex_project_name'] = array( |
|
| 101 | 101 | '#type' => 'textfield', |
| 102 | 102 | '#title' => t('Project-specific Transifex project'), |
| 103 | 103 | '#default_value' => $default['transifex_project_name'], |
| 104 | 104 | '#description' => t('The portion of the Transifex URL that identifies this project.'), |
| 105 | - ); |
|
| 106 | - $form['transifex']['boinc_translate_transifex_project_resources'] = array( |
|
| 105 | + ); |
|
| 106 | + $form['transifex']['boinc_translate_transifex_project_resources'] = array( |
|
| 107 | 107 | '#type' => 'textarea', |
| 108 | 108 | '#title' => t('Project-specific Resources'), |
| 109 | 109 | '#default_value' => $default['transifex_project_resources'], |
@@ -116,241 +116,241 @@ discard block |
||
| 116 | 116 | NOTE: The first Resource listed here is considered the primary Resource |
| 117 | 117 | for project-specific translations and will be updated by the "Update |
| 118 | 118 | project-specific Resources" button below!'), |
| 119 | - ); |
|
| 120 | - $form['transifex']['buttons']['submit'] = array( |
|
| 119 | + ); |
|
| 120 | + $form['transifex']['buttons']['submit'] = array( |
|
| 121 | 121 | '#type' => 'submit', |
| 122 | 122 | '#value' => t('Save configuration'), |
| 123 | - ); |
|
| 123 | + ); |
|
| 124 | 124 | |
| 125 | - $form['tools'] = array( |
|
| 125 | + $form['tools'] = array( |
|
| 126 | 126 | '#title' => t('Tools'), |
| 127 | 127 | '#type' => 'fieldset', |
| 128 | 128 | '#description' => '', |
| 129 | 129 | '#collapsible' => TRUE, |
| 130 | 130 | '#collapsed' => FALSE, |
| 131 | 131 | '#attributes' => array('class' => '') |
| 132 | - ); |
|
| 133 | - $form['tools']['initialize_languages_text'] = array( |
|
| 132 | + ); |
|
| 133 | + $form['tools']['initialize_languages_text'] = array( |
|
| 134 | 134 | '#type' => 'item', |
| 135 | 135 | '#title' => t('Install official BOINC languages'), |
| 136 | 136 | '#value' => t('Installs all languages from the BOINC Transifex project. Also installs missing languages in Drupal. <br>Languages must be enabled manually in Administer > Site configuration > Languages.'), |
| 137 | - ); |
|
| 138 | - $form['tools']['initialize_languages'] = array( |
|
| 137 | + ); |
|
| 138 | + $form['tools']['initialize_languages'] = array( |
|
| 139 | 139 | '#type' => 'button', |
| 140 | 140 | '#value' => t('Install official BOINC languages'), |
| 141 | 141 | '#executes_submit_callback' => TRUE, |
| 142 | 142 | '#submit' => array('boinctranslate_admin_settings_initialize_languages'), |
| 143 | 143 | '#disabled' => !$initialized, |
| 144 | - ); |
|
| 145 | - $form['tools']['import_now_text'] = array( |
|
| 144 | + ); |
|
| 145 | + $form['tools']['import_now_text'] = array( |
|
| 146 | 146 | '#type' => 'item', |
| 147 | 147 | '#title' => t('Import all translations'), |
| 148 | 148 | '#value' => t('Imports from Tranifex all configured Resources into their respective text groups.'), |
| 149 | - ); |
|
| 150 | - $form['tools']['import_now'] = array( |
|
| 149 | + ); |
|
| 150 | + $form['tools']['import_now'] = array( |
|
| 151 | 151 | '#type' => 'button', |
| 152 | 152 | '#value' => t('Import all translations'), |
| 153 | 153 | '#executes_submit_callback' => TRUE, |
| 154 | 154 | '#submit' => array('boinctranslate_admin_settings_import_now'), |
| 155 | 155 | '#disabled' => !$import_enabled, |
| 156 | - ); |
|
| 157 | - $form['tools']['download_boinc_pot_text'] = array( |
|
| 156 | + ); |
|
| 157 | + $form['tools']['download_boinc_pot_text'] = array( |
|
| 158 | 158 | '#type' => 'item', |
| 159 | 159 | '#title' => t('Download official BOINC-Drupal .pot'), |
| 160 | 160 | '#value' => t('Downloads the generic BOINC-Drupal .pot file. This is the template file for the boinc text group.'), |
| 161 | - ); |
|
| 162 | - $form['tools']['download_boinc_pot'] = array( |
|
| 161 | + ); |
|
| 162 | + $form['tools']['download_boinc_pot'] = array( |
|
| 163 | 163 | '#type' => 'button', |
| 164 | 164 | '#value' => t('Download official BOINC-Drupal .pot'), |
| 165 | 165 | '#executes_submit_callback' => TRUE, |
| 166 | 166 | '#submit' => array('boinctranslate_admin_settings_download_boinc_pot'), |
| 167 | 167 | '#disabled' => !$import_enabled, |
| 168 | - ); |
|
| 169 | - $form['tools']['download_project_pot_text'] = array( |
|
| 168 | + ); |
|
| 169 | + $form['tools']['download_project_pot_text'] = array( |
|
| 170 | 170 | '#type' => 'item', |
| 171 | 171 | '#title' => t('Download project-specific .pot'), |
| 172 | 172 | '#value' => t('Downloads the project-specific .pot file. This is the template file for the project text group.'), |
| 173 | - ); |
|
| 174 | - $form['tools']['download_project_pot'] = array( |
|
| 173 | + ); |
|
| 174 | + $form['tools']['download_project_pot'] = array( |
|
| 175 | 175 | '#type' => 'button', |
| 176 | 176 | '#value' => t('Download project-specific .pot'), |
| 177 | 177 | '#executes_submit_callback' => TRUE, |
| 178 | 178 | '#submit' => array('boinctranslate_admin_settings_download_project_pot'), |
| 179 | 179 | '#disabled' => !$import_enabled, |
| 180 | - ); |
|
| 181 | - if (user_access('update official BOINC translations')) { |
|
| 180 | + ); |
|
| 181 | + if (user_access('update official BOINC translations')) { |
|
| 182 | 182 | $form['tools']['update_official_boinc_text'] = array( |
| 183 | - '#type' => 'item', |
|
| 184 | - '#title' => t('Update official BOINC translations'), |
|
| 185 | - '#value' => t('Updates the official BOINC-Drupal Resource (translatable strings templates) to the BOINC Transifex project, based on the consolidated imported translations.<br><b>WARNING: Do not use unless you have write-access to the BOINC Transifex project.</b>'), |
|
| 183 | + '#type' => 'item', |
|
| 184 | + '#title' => t('Update official BOINC translations'), |
|
| 185 | + '#value' => t('Updates the official BOINC-Drupal Resource (translatable strings templates) to the BOINC Transifex project, based on the consolidated imported translations.<br><b>WARNING: Do not use unless you have write-access to the BOINC Transifex project.</b>'), |
|
| 186 | 186 | ); |
| 187 | 187 | $form['tools']['update_official_boinc'] = array( |
| 188 | - '#type' => 'button', |
|
| 189 | - '#value' => t('Update official BOINC translations'), |
|
| 190 | - '#executes_submit_callback' => TRUE, |
|
| 191 | - '#submit' => array('boinctranslate_admin_settings_update_official_boinc'), |
|
| 192 | - '#disabled' => !$import_enabled, |
|
| 188 | + '#type' => 'button', |
|
| 189 | + '#value' => t('Update official BOINC translations'), |
|
| 190 | + '#executes_submit_callback' => TRUE, |
|
| 191 | + '#submit' => array('boinctranslate_admin_settings_update_official_boinc'), |
|
| 192 | + '#disabled' => !$import_enabled, |
|
| 193 | 193 | ); |
| 194 | - } |
|
| 195 | - $form['tools']['export_now_text'] = array( |
|
| 194 | + } |
|
| 195 | + $form['tools']['export_now_text'] = array( |
|
| 196 | 196 | '#type' => 'item', |
| 197 | 197 | '#title' => t('Update project-specific Resources'), |
| 198 | 198 | '#value' => t('Updates the configured Resources (translatable strings templates) to the project\'s Transifex project.<br><b>WARNING: Do not use unless you have write-access to your project\'s Transifex project.</b>'), |
| 199 | - ); |
|
| 200 | - $form['tools']['export_now'] = array( |
|
| 199 | + ); |
|
| 200 | + $form['tools']['export_now'] = array( |
|
| 201 | 201 | '#type' => 'button', |
| 202 | 202 | '#value' => t('Update project-specific Resources'), |
| 203 | 203 | '#executes_submit_callback' => TRUE, |
| 204 | 204 | '#submit' => array('boinctranslate_admin_settings_export_now'), |
| 205 | 205 | '#disabled' => !$import_enabled, |
| 206 | - ); |
|
| 206 | + ); |
|
| 207 | 207 | |
| 208 | - $form['#submit'][] = 'system_settings_form_submit'; |
|
| 209 | - $form['#theme'] = 'system_settings_form'; |
|
| 208 | + $form['#submit'][] = 'system_settings_form_submit'; |
|
| 209 | + $form['#theme'] = 'system_settings_form'; |
|
| 210 | 210 | |
| 211 | - return $form; |
|
| 211 | + return $form; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | function boinctranslate_admin_settings_export_now() { |
| 215 | - drupal_goto('admin/boinc/translation/export'); |
|
| 215 | + drupal_goto('admin/boinc/translation/export'); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | function boinctranslate_admin_settings_import_now() { |
| 219 | - drupal_goto('admin/boinc/translation/import'); |
|
| 219 | + drupal_goto('admin/boinc/translation/import'); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | function boinctranslate_admin_settings_initialize_languages() { |
| 223 | - drupal_goto('admin/boinc/translation/initialize-languages'); |
|
| 223 | + drupal_goto('admin/boinc/translation/initialize-languages'); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | function boinctranslate_admin_settings_update_official_boinc() { |
| 227 | - drupal_goto('admin/boinc/translation/update-official-boinc'); |
|
| 227 | + drupal_goto('admin/boinc/translation/update-official-boinc'); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | function boinctranslate_admin_settings_download_boinc_pot() { |
| 231 | - drupal_goto('admin/boinc/translation/download-pot/boinc'); |
|
| 231 | + drupal_goto('admin/boinc/translation/download-pot/boinc'); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | function boinctranslate_admin_settings_download_project_pot() { |
| 235 | - drupal_goto('admin/boinc/translation/download-pot/project'); |
|
| 235 | + drupal_goto('admin/boinc/translation/download-pot/project'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | - * Validate the BOINC translation settings form. |
|
| 241 | - */ |
|
| 240 | + * Validate the BOINC translation settings form. |
|
| 241 | + */ |
|
| 242 | 242 | function boinctranslate_admin_settings_validate($form, &$form_state) { |
| 243 | - $values = $form_state['values']; |
|
| 244 | - $errors = array(); |
|
| 245 | - $api_base_url = 'https://www.transifex.com/api/2'; |
|
| 243 | + $values = $form_state['values']; |
|
| 244 | + $errors = array(); |
|
| 245 | + $api_base_url = 'https://www.transifex.com/api/2'; |
|
| 246 | 246 | |
| 247 | - if (!$values['boinc_translate_transifex_user']) { |
|
| 247 | + if (!$values['boinc_translate_transifex_user']) { |
|
| 248 | 248 | form_set_error('boinc_translate_transifex_user', t('User name is required.')); |
| 249 | - } |
|
| 250 | - if (!$values['boinc_translate_transifex_pass']) { |
|
| 249 | + } |
|
| 250 | + if (!$values['boinc_translate_transifex_pass']) { |
|
| 251 | 251 | if (!variable_get('boinc_translate_transifex_pass', '')) { |
| 252 | - form_set_error('boinc_translate_transifex_pass', t('Password is required.')); |
|
| 252 | + form_set_error('boinc_translate_transifex_pass', t('Password is required.')); |
|
| 253 | 253 | } |
| 254 | 254 | else { |
| 255 | - unset($form_state['values']['boinc_translate_transifex_pass']); |
|
| 255 | + unset($form_state['values']['boinc_translate_transifex_pass']); |
|
| 256 | + } |
|
| 256 | 257 | } |
| 257 | - } |
|
| 258 | - if (!$values['boinc_translate_transifex_standard_name']) { |
|
| 258 | + if (!$values['boinc_translate_transifex_standard_name']) { |
|
| 259 | 259 | form_set_error('boinc_translate_transifex_standard_name', |
| 260 | - t('BOINC Transifex project name is required.') |
|
| 260 | + t('BOINC Transifex project name is required.') |
|
| 261 | 261 | ); |
| 262 | - } |
|
| 263 | - if (!$values['boinc_translate_transifex_standard_resources']) { |
|
| 262 | + } |
|
| 263 | + if (!$values['boinc_translate_transifex_standard_resources']) { |
|
| 264 | 264 | form_set_error('boinc_translate_transifex_standard_resources', |
| 265 | - t('At least one BOINC Transifex project Resource is required.') |
|
| 265 | + t('At least one BOINC Transifex project Resource is required.') |
|
| 266 | 266 | ); |
| 267 | - } |
|
| 268 | - if (!$values['boinc_translate_transifex_project_resources']) { |
|
| 267 | + } |
|
| 268 | + if (!$values['boinc_translate_transifex_project_resources']) { |
|
| 269 | 269 | form_set_error('boinc_translate_transifex_project_resources', |
| 270 | - t('At least one project-specific Transifex Resource is required.') |
|
| 270 | + t('At least one project-specific Transifex Resource is required.') |
|
| 271 | 271 | ); |
| 272 | - } |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - $username = $values['boinc_translate_transifex_user']; |
|
| 275 | - $password = ($values['boinc_translate_transifex_pass']) ? $values['boinc_translate_transifex_pass'] : variable_get('boinc_translate_transifex_pass', ''); |
|
| 276 | - $boinc_name = $values['boinc_translate_transifex_standard_name']; |
|
| 277 | - $boinc_resources = boinctranslate_parse_resources( |
|
| 274 | + $username = $values['boinc_translate_transifex_user']; |
|
| 275 | + $password = ($values['boinc_translate_transifex_pass']) ? $values['boinc_translate_transifex_pass'] : variable_get('boinc_translate_transifex_pass', ''); |
|
| 276 | + $boinc_name = $values['boinc_translate_transifex_standard_name']; |
|
| 277 | + $boinc_resources = boinctranslate_parse_resources( |
|
| 278 | 278 | $values['boinc_translate_transifex_standard_resources'] |
| 279 | - ); |
|
| 279 | + ); |
|
| 280 | 280 | |
| 281 | - if ($username AND $password AND $boinc_name AND $boinc_resources) { |
|
| 281 | + if ($username AND $password AND $boinc_name AND $boinc_resources) { |
|
| 282 | 282 | // Test authentication |
| 283 | 283 | $authenticated = FALSE; |
| 284 | 284 | $path = "project/{$boinc_name}/resource/{$boinc_resources[0]}/translation/en"; |
| 285 | 285 | $response = boinctranslate_transifex_request($path, NULL, TRUE, FALSE, $username, $password); |
| 286 | 286 | |
| 287 | 287 | if ($response) { |
| 288 | - if ($response == '401 UNAUTHORIZED') { |
|
| 288 | + if ($response == '401 UNAUTHORIZED') { |
|
| 289 | 289 | form_set_error( |
| 290 | - 'boinc_translate_transifex_pass', |
|
| 291 | - t('Transifex authentication failed.') |
|
| 290 | + 'boinc_translate_transifex_pass', |
|
| 291 | + t('Transifex authentication failed.') |
|
| 292 | 292 | ); |
| 293 | - } |
|
| 294 | - else { |
|
| 293 | + } |
|
| 294 | + else { |
|
| 295 | 295 | $authenticated = TRUE; |
| 296 | - } |
|
| 296 | + } |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if ($authenticated) { |
| 300 | - // Prepare list of resources to validate |
|
| 301 | - $transifex_resources = array( |
|
| 300 | + // Prepare list of resources to validate |
|
| 301 | + $transifex_resources = array( |
|
| 302 | 302 | 'boinc' => $boinc_resources, |
| 303 | - ); |
|
| 304 | - // Parse project-specific resources |
|
| 305 | - $project_name = trim($values['boinc_translate_transifex_project_name']); |
|
| 306 | - $project_resources = boinctranslate_parse_resources( |
|
| 303 | + ); |
|
| 304 | + // Parse project-specific resources |
|
| 305 | + $project_name = trim($values['boinc_translate_transifex_project_name']); |
|
| 306 | + $project_resources = boinctranslate_parse_resources( |
|
| 307 | 307 | $values['boinc_translate_transifex_project_resources'] |
| 308 | - ); |
|
| 309 | - if ($project_name AND $project_resources) { |
|
| 308 | + ); |
|
| 309 | + if ($project_name AND $project_resources) { |
|
| 310 | 310 | $transifex_resources[$project_name] = $project_resources; |
| 311 | - } |
|
| 312 | - elseif ($project_name AND !$project_resources) { |
|
| 311 | + } |
|
| 312 | + elseif ($project_name AND !$project_resources) { |
|
| 313 | 313 | drupal_set_message( |
| 314 | - t('No project-specific resources were provided'), |
|
| 315 | - 'warning' |
|
| 314 | + t('No project-specific resources were provided'), |
|
| 315 | + 'warning' |
|
| 316 | 316 | ); |
| 317 | - } |
|
| 318 | - elseif ($project_resources AND !$project_name) { |
|
| 317 | + } |
|
| 318 | + elseif ($project_resources AND !$project_name) { |
|
| 319 | 319 | drupal_set_message( |
| 320 | - t('No project-specific Transifex project name was provided'), |
|
| 321 | - 'warning' |
|
| 320 | + t('No project-specific Transifex project name was provided'), |
|
| 321 | + 'warning' |
|
| 322 | 322 | ); |
| 323 | - } |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - // Try to access the given resources |
|
| 326 | - foreach ($transifex_resources as $project => $resources) { |
|
| 325 | + // Try to access the given resources |
|
| 326 | + foreach ($transifex_resources as $project => $resources) { |
|
| 327 | 327 | foreach ($resources as $resource) { |
| 328 | 328 | |
| 329 | - $path = "project/{$project}/resource/{$resource}/translation/en"; |
|
| 330 | - $response = boinctranslate_transifex_request($path); |
|
| 329 | + $path = "project/{$project}/resource/{$resource}/translation/en"; |
|
| 330 | + $response = boinctranslate_transifex_request($path); |
|
| 331 | 331 | |
| 332 | - if ($response == '404 NOT FOUND') { |
|
| 332 | + if ($response == '404 NOT FOUND') { |
|
| 333 | 333 | form_set_error( |
| 334 | - 'boinc_translate_transifex_' . ($project == $boinc_name ? 'standard' : 'project') . '_resources', |
|
| 335 | - t('Resource %name not found in %project.', |
|
| 334 | + 'boinc_translate_transifex_' . ($project == $boinc_name ? 'standard' : 'project') . '_resources', |
|
| 335 | + t('Resource %name not found in %project.', |
|
| 336 | 336 | array( |
| 337 | - '%name' => $resource, |
|
| 338 | - '%project' => $project, |
|
| 337 | + '%name' => $resource, |
|
| 338 | + '%project' => $project, |
|
| 339 | + ) |
|
| 339 | 340 | ) |
| 340 | - ) |
|
| 341 | 341 | ); |
| 342 | - } |
|
| 342 | + } |
|
| 343 | 343 | } |
| 344 | - } |
|
| 344 | + } |
|
| 345 | + } |
|
| 345 | 346 | } |
| 346 | - } |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | - * Handle post-validation submission of BOINC translation settings form. |
|
| 351 | - */ |
|
| 350 | + * Handle post-validation submission of BOINC translation settings form. |
|
| 351 | + */ |
|
| 352 | 352 | function boinctranslate_admin_settings_submit($form, &$form_state) { |
| 353 | - drupal_set_message(t('BOINC translation settings have been updated.')); |
|
| 353 | + drupal_set_message(t('BOINC translation settings have been updated.')); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | function boinctranslate_admin_settings(&$form_state) { |
| 14 | 14 | $form = array(); |
| 15 | - $initialized = FALSE; |
|
| 16 | - $import_enabled = FALSE; |
|
| 15 | + $initialized = false; |
|
| 16 | + $import_enabled = false; |
|
| 17 | 17 | $default = array( |
| 18 | 18 | 'transifex_user' => variable_get('boinc_translate_transifex_user', ''), |
| 19 | 19 | 'transifex_pass' => variable_get('boinc_translate_transifex_pass', ''), |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | ), |
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | - if ($default['transifex_user'] AND $default['transifex_pass']) { |
|
| 39 | + if ($default['transifex_user'] and $default['transifex_pass']) { |
|
| 40 | 40 | if (trim($default['transifex_boinc_resources']) |
| 41 | - OR trim($default['transifex_project_resources'])) { |
|
| 42 | - $import_enabled = TRUE; |
|
| 41 | + or trim($default['transifex_project_resources'])) { |
|
| 42 | + $import_enabled = true; |
|
| 43 | 43 | } |
| 44 | 44 | if ($default['transifex_boinc_name'] |
| 45 | - AND $default['transifex_project_name'] |
|
| 46 | - AND trim($default['transifex_boinc_resources']) |
|
| 47 | - AND trim($default['transifex_project_resources'])) { |
|
| 48 | - $initialized = TRUE; |
|
| 45 | + and $default['transifex_project_name'] |
|
| 46 | + and trim($default['transifex_boinc_resources']) |
|
| 47 | + and trim($default['transifex_project_resources'])) { |
|
| 48 | + $initialized = true; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | '#title' => t('Transifex settings'), |
| 56 | 56 | '#type' => 'fieldset', |
| 57 | 57 | '#description' => '', |
| 58 | - '#collapsible' => TRUE, |
|
| 58 | + '#collapsible' => true, |
|
| 59 | 59 | '#collapsed' => $initialized, |
| 60 | 60 | '#attributes' => array('class' => '') |
| 61 | 61 | ); |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | '#title' => t('Tools'), |
| 127 | 127 | '#type' => 'fieldset', |
| 128 | 128 | '#description' => '', |
| 129 | - '#collapsible' => TRUE, |
|
| 130 | - '#collapsed' => FALSE, |
|
| 129 | + '#collapsible' => true, |
|
| 130 | + '#collapsed' => false, |
|
| 131 | 131 | '#attributes' => array('class' => '') |
| 132 | 132 | ); |
| 133 | 133 | $form['tools']['initialize_languages_text'] = array( |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $form['tools']['initialize_languages'] = array( |
| 139 | 139 | '#type' => 'button', |
| 140 | 140 | '#value' => t('Install official BOINC languages'), |
| 141 | - '#executes_submit_callback' => TRUE, |
|
| 141 | + '#executes_submit_callback' => true, |
|
| 142 | 142 | '#submit' => array('boinctranslate_admin_settings_initialize_languages'), |
| 143 | 143 | '#disabled' => !$initialized, |
| 144 | 144 | ); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $form['tools']['import_now'] = array( |
| 151 | 151 | '#type' => 'button', |
| 152 | 152 | '#value' => t('Import all translations'), |
| 153 | - '#executes_submit_callback' => TRUE, |
|
| 153 | + '#executes_submit_callback' => true, |
|
| 154 | 154 | '#submit' => array('boinctranslate_admin_settings_import_now'), |
| 155 | 155 | '#disabled' => !$import_enabled, |
| 156 | 156 | ); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $form['tools']['download_boinc_pot'] = array( |
| 163 | 163 | '#type' => 'button', |
| 164 | 164 | '#value' => t('Download official BOINC-Drupal .pot'), |
| 165 | - '#executes_submit_callback' => TRUE, |
|
| 165 | + '#executes_submit_callback' => true, |
|
| 166 | 166 | '#submit' => array('boinctranslate_admin_settings_download_boinc_pot'), |
| 167 | 167 | '#disabled' => !$import_enabled, |
| 168 | 168 | ); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $form['tools']['download_project_pot'] = array( |
| 175 | 175 | '#type' => 'button', |
| 176 | 176 | '#value' => t('Download project-specific .pot'), |
| 177 | - '#executes_submit_callback' => TRUE, |
|
| 177 | + '#executes_submit_callback' => true, |
|
| 178 | 178 | '#submit' => array('boinctranslate_admin_settings_download_project_pot'), |
| 179 | 179 | '#disabled' => !$import_enabled, |
| 180 | 180 | ); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $form['tools']['update_official_boinc'] = array( |
| 188 | 188 | '#type' => 'button', |
| 189 | 189 | '#value' => t('Update official BOINC translations'), |
| 190 | - '#executes_submit_callback' => TRUE, |
|
| 190 | + '#executes_submit_callback' => true, |
|
| 191 | 191 | '#submit' => array('boinctranslate_admin_settings_update_official_boinc'), |
| 192 | 192 | '#disabled' => !$import_enabled, |
| 193 | 193 | ); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $form['tools']['export_now'] = array( |
| 201 | 201 | '#type' => 'button', |
| 202 | 202 | '#value' => t('Update project-specific Resources'), |
| 203 | - '#executes_submit_callback' => TRUE, |
|
| 203 | + '#executes_submit_callback' => true, |
|
| 204 | 204 | '#submit' => array('boinctranslate_admin_settings_export_now'), |
| 205 | 205 | '#disabled' => !$import_enabled, |
| 206 | 206 | ); |
@@ -278,11 +278,11 @@ discard block |
||
| 278 | 278 | $values['boinc_translate_transifex_standard_resources'] |
| 279 | 279 | ); |
| 280 | 280 | |
| 281 | - if ($username AND $password AND $boinc_name AND $boinc_resources) { |
|
| 281 | + if ($username and $password and $boinc_name and $boinc_resources) { |
|
| 282 | 282 | // Test authentication |
| 283 | - $authenticated = FALSE; |
|
| 283 | + $authenticated = false; |
|
| 284 | 284 | $path = "project/{$boinc_name}/resource/{$boinc_resources[0]}/translation/en"; |
| 285 | - $response = boinctranslate_transifex_request($path, NULL, TRUE, FALSE, $username, $password); |
|
| 285 | + $response = boinctranslate_transifex_request($path, null, true, false, $username, $password); |
|
| 286 | 286 | |
| 287 | 287 | if ($response) { |
| 288 | 288 | if ($response == '401 UNAUTHORIZED') { |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | ); |
| 293 | 293 | } |
| 294 | 294 | else { |
| 295 | - $authenticated = TRUE; |
|
| 295 | + $authenticated = true; |
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
@@ -306,16 +306,16 @@ discard block |
||
| 306 | 306 | $project_resources = boinctranslate_parse_resources( |
| 307 | 307 | $values['boinc_translate_transifex_project_resources'] |
| 308 | 308 | ); |
| 309 | - if ($project_name AND $project_resources) { |
|
| 309 | + if ($project_name and $project_resources) { |
|
| 310 | 310 | $transifex_resources[$project_name] = $project_resources; |
| 311 | 311 | } |
| 312 | - elseif ($project_name AND !$project_resources) { |
|
| 312 | + elseif ($project_name and !$project_resources) { |
|
| 313 | 313 | drupal_set_message( |
| 314 | 314 | t('No project-specific resources were provided'), |
| 315 | 315 | 'warning' |
| 316 | 316 | ); |
| 317 | 317 | } |
| 318 | - elseif ($project_resources AND !$project_name) { |
|
| 318 | + elseif ($project_resources and !$project_name) { |
|
| 319 | 319 | drupal_set_message( |
| 320 | 320 | t('No project-specific Transifex project name was provided'), |
| 321 | 321 | 'warning' |
@@ -274,7 +274,7 @@ |
||
| 274 | 274 | function boincuser_views_handlers() { |
| 275 | 275 | return array( |
| 276 | 276 | 'info' => array( |
| 277 | - 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
| 277 | + 'path' => drupal_get_path('module', 'boincuser').'/views', |
|
| 278 | 278 | ), |
| 279 | 279 | 'handlers' => array( |
| 280 | 280 | 'views_handler_argument_boincuser_id' => array( |
@@ -34,16 +34,16 @@ discard block |
||
| 34 | 34 | // Primary keys allowed as arguments |
| 35 | 35 | |
| 36 | 36 | $data['user']['id'] = array( |
| 37 | - 'title' => bts('Id', array(), NULL, 'boinc:user-id'), |
|
| 37 | + 'title' => bts('Id', array(), null, 'boinc:user-id'), |
|
| 38 | 38 | 'help' => t('The BOINC ID of the user account.'), |
| 39 | 39 | 'field' => array( |
| 40 | 40 | 'handler' => 'views_handler_field_numeric', |
| 41 | - 'click sortable' => TRUE |
|
| 41 | + 'click sortable' => true |
|
| 42 | 42 | ), |
| 43 | 43 | 'argument' => array( |
| 44 | 44 | 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
| 45 | 45 | 'name field' => 'title', // the field to display in the summary. |
| 46 | - 'numeric' => TRUE, |
|
| 46 | + 'numeric' => true, |
|
| 47 | 47 | 'validate type' => 'id' |
| 48 | 48 | ), |
| 49 | 49 | 'filter' => array( |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | ) |
| 55 | 55 | ); |
| 56 | 56 | $data['user']['teamid'] = array( |
| 57 | - 'title' => bts('Team ID', array(), NULL, 'boinc:team-id'), |
|
| 57 | + 'title' => bts('Team ID', array(), null, 'boinc:team-id'), |
|
| 58 | 58 | 'help' => t('The ID of the user\'s team.'), |
| 59 | 59 | 'field' => array( |
| 60 | 60 | 'handler' => 'views_handler_field_numeric', |
| 61 | - 'click sortable' => TRUE, |
|
| 61 | + 'click sortable' => true, |
|
| 62 | 62 | ), |
| 63 | 63 | 'argument' => array( |
| 64 | 64 | 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
| 65 | 65 | 'name field' => 'title', // the field to display in the summary. |
| 66 | - 'numeric' => TRUE, |
|
| 66 | + 'numeric' => true, |
|
| 67 | 67 | 'validate type' => 'id' |
| 68 | 68 | ), |
| 69 | 69 | 'filter' => array( |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | // Descriptions of general host fields (alphabetized) |
| 78 | 78 | |
| 79 | 79 | $data['user']['authenticator'] = array( |
| 80 | - 'title' => bts('Account Key', array(), NULL, 'boinc:user-info'), |
|
| 80 | + 'title' => bts('Account Key', array(), null, 'boinc:user-info'), |
|
| 81 | 81 | 'help' => t('The BOINC account key of the user.'), |
| 82 | 82 | 'field' => array( |
| 83 | 83 | 'handler' => 'views_handler_field', |
| 84 | - 'click sortable' => TRUE |
|
| 84 | + 'click sortable' => true |
|
| 85 | 85 | ), |
| 86 | 86 | 'filter' => array( |
| 87 | 87 | 'handler' => 'views_handler_filter_string' |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | ) |
| 92 | 92 | ); |
| 93 | 93 | $data['user']['country'] = array( |
| 94 | - 'title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
|
| 94 | + 'title' => bts('Country', array(), null, 'boinc:country-of-origin'), |
|
| 95 | 95 | 'help' => t('The country of the user.'), |
| 96 | 96 | 'field' => array( |
| 97 | 97 | 'handler' => 'views_handler_field', |
| 98 | - 'click sortable' => TRUE |
|
| 98 | + 'click sortable' => true |
|
| 99 | 99 | ), |
| 100 | 100 | 'filter' => array( |
| 101 | 101 | 'handler' => 'views_handler_filter_string' |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | ) |
| 106 | 106 | ); |
| 107 | 107 | $data['user']['create_time'] = array( |
| 108 | - 'title' => bts('Member since', array(), NULL, 'boinc:user-info'), |
|
| 108 | + 'title' => bts('Member since', array(), null, 'boinc:user-info'), |
|
| 109 | 109 | 'help' => t('When the BOINC account was created.'), |
| 110 | 110 | 'field' => array( |
| 111 | 111 | 'handler' => 'views_handler_field_date', |
| 112 | - 'click sortable' => TRUE |
|
| 112 | + 'click sortable' => true |
|
| 113 | 113 | ), |
| 114 | 114 | 'filter' => array( |
| 115 | 115 | 'handler' => 'views_handler_filter_date' |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | ) |
| 120 | 120 | ); |
| 121 | 121 | $data['user']['cross_project_id'] = array( |
| 122 | - 'title' => bts('CPID', array(), NULL, 'boinc:user-info'), |
|
| 122 | + 'title' => bts('CPID', array(), null, 'boinc:user-info'), |
|
| 123 | 123 | 'help' => t('The cross project user identifier.'), |
| 124 | 124 | 'field' => array( |
| 125 | 125 | 'handler' => 'views_handler_field', |
| 126 | - 'click sortable' => TRUE |
|
| 126 | + 'click sortable' => true |
|
| 127 | 127 | ), |
| 128 | 128 | 'filter' => array( |
| 129 | 129 | 'handler' => 'views_handler_filter_string' |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | ) |
| 134 | 134 | ); |
| 135 | 135 | $data['user']['email_addr'] = array( |
| 136 | - 'title' => bts('Email Address', array(), NULL, 'boinc:user-info'), |
|
| 136 | + 'title' => bts('Email Address', array(), null, 'boinc:user-info'), |
|
| 137 | 137 | 'help' => t('The BOINC account email address.'), |
| 138 | 138 | 'field' => array( |
| 139 | 139 | 'handler' => 'views_handler_field', |
| 140 | - 'click sortable' => TRUE |
|
| 140 | + 'click sortable' => true |
|
| 141 | 141 | ), |
| 142 | 142 | 'filter' => array( |
| 143 | 143 | 'handler' => 'views_handler_filter_string' |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | ) |
| 148 | 148 | ); |
| 149 | 149 | $data['user']['expavg_credit'] = array( |
| 150 | - 'title' => bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC'), |
|
| 150 | + 'title' => bts('Recent average credit', array(), null, 'boinc:user-or-team-RAC'), |
|
| 151 | 151 | 'help' => t('A decaying average of credit per day for the user.'), |
| 152 | 152 | 'field' => array( |
| 153 | 153 | 'handler' => 'views_handler_field_numeric', |
| 154 | - 'click sortable' => TRUE, |
|
| 155 | - 'float' => TRUE |
|
| 154 | + 'click sortable' => true, |
|
| 155 | + 'float' => true |
|
| 156 | 156 | ), |
| 157 | 157 | 'filter' => array( |
| 158 | 158 | 'handler' => 'views_handler_filter_numeric' |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | ) |
| 163 | 163 | ); |
| 164 | 164 | $data['user']['name'] = array( |
| 165 | - 'title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
|
| 165 | + 'title' => bts('Name', array(), null, 'boinc:user-or-team-name'), |
|
| 166 | 166 | 'help' => t('The BOINC account user name.'), |
| 167 | 167 | 'field' => array( |
| 168 | 168 | 'handler' => 'views_handler_field', |
| 169 | - 'click sortable' => TRUE |
|
| 169 | + 'click sortable' => true |
|
| 170 | 170 | ), |
| 171 | 171 | 'filter' => array( |
| 172 | 172 | 'handler' => 'views_handler_filter_string' |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | ) |
| 177 | 177 | ); |
| 178 | 178 | $data['user']['passwd_hash'] = array( |
| 179 | - 'title' => bts('Password Hash', array(), NULL, 'boinc:user-info'), |
|
| 179 | + 'title' => bts('Password Hash', array(), null, 'boinc:user-info'), |
|
| 180 | 180 | 'help' => t('The user password hash'), |
| 181 | 181 | 'field' => array( |
| 182 | 182 | 'handler' => 'views_handler_field', |
| 183 | - 'click sortable' => TRUE |
|
| 183 | + 'click sortable' => true |
|
| 184 | 184 | ), |
| 185 | 185 | 'filter' => array( |
| 186 | 186 | 'handler' => 'views_handler_filter_string' |
@@ -190,11 +190,11 @@ discard block |
||
| 190 | 190 | ) |
| 191 | 191 | ); |
| 192 | 192 | $data['user']['postal_code'] = array( |
| 193 | - 'title' => bts('Postal Code', array(), NULL, 'boinc:user-info'), |
|
| 193 | + 'title' => bts('Postal Code', array(), null, 'boinc:user-info'), |
|
| 194 | 194 | 'help' => t('The postal code of the user.'), |
| 195 | 195 | 'field' => array( |
| 196 | 196 | 'handler' => 'views_handler_field', |
| 197 | - 'click sortable' => TRUE |
|
| 197 | + 'click sortable' => true |
|
| 198 | 198 | ), |
| 199 | 199 | 'filter' => array( |
| 200 | 200 | 'handler' => 'views_handler_filter_string' |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | ) |
| 205 | 205 | ); |
| 206 | 206 | $data['user']['send_email'] = array( |
| 207 | - 'title' => bts('Send Email', array(), NULL, 'boinc:user-info'), |
|
| 207 | + 'title' => bts('Send Email', array(), null, 'boinc:user-info'), |
|
| 208 | 208 | 'help' => t('User preference to allow email communications.'), |
| 209 | 209 | 'field' => array( |
| 210 | 210 | 'handler' => 'views_handler_field_numeric', |
| 211 | - 'click sortable' => TRUE |
|
| 211 | + 'click sortable' => true |
|
| 212 | 212 | ), |
| 213 | 213 | 'filter' => array( |
| 214 | 214 | 'handler' => 'views_handler_filter_numeric' |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | ) |
| 219 | 219 | ); |
| 220 | 220 | $data['user']['show_hosts'] = array( |
| 221 | - 'title' => bts('Show Hosts', array(), NULL, 'boinc:user-info'), |
|
| 221 | + 'title' => bts('Show Hosts', array(), null, 'boinc:user-info'), |
|
| 222 | 222 | 'help' => t('User preference to display owned computers.'), |
| 223 | 223 | 'field' => array( |
| 224 | 224 | 'handler' => 'views_handler_field_numeric', |
| 225 | - 'click sortable' => TRUE |
|
| 225 | + 'click sortable' => true |
|
| 226 | 226 | ), |
| 227 | 227 | 'filter' => array( |
| 228 | 228 | 'handler' => 'views_handler_filter_numeric' |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | ) |
| 233 | 233 | ); |
| 234 | 234 | $data['user']['total_credit'] = array( |
| 235 | - 'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'), |
|
| 235 | + 'title' => bts('Total credit', array(), null, 'boinc:user-or-team-total-credits'), |
|
| 236 | 236 | 'help' => t('The total accumulated BOINC credit for the user.'), |
| 237 | 237 | 'field' => array( |
| 238 | 238 | 'handler' => 'views_handler_field_numeric', |
| 239 | - 'click sortable' => TRUE, |
|
| 240 | - 'float' => TRUE |
|
| 239 | + 'click sortable' => true, |
|
| 240 | + 'float' => true |
|
| 241 | 241 | ), |
| 242 | 242 | 'filter' => array( |
| 243 | 243 | 'handler' => 'views_handler_filter_numeric' |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | ) |
| 248 | 248 | ); |
| 249 | 249 | $data['user']['url'] = array( |
| 250 | - 'title' => bts('URL', array(), NULL, 'boinc:website-of-user-or-team'), |
|
| 250 | + 'title' => bts('URL', array(), null, 'boinc:website-of-user-or-team'), |
|
| 251 | 251 | 'help' => t('The URL provided by the user'), |
| 252 | 252 | 'field' => array( |
| 253 | 253 | 'handler' => 'views_handler_field', |
| 254 | - 'click sortable' => TRUE |
|
| 254 | + 'click sortable' => true |
|
| 255 | 255 | ), |
| 256 | 256 | 'filter' => array( |
| 257 | 257 | 'handler' => 'views_handler_filter_string' |
@@ -13,255 +13,255 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function boincuser_views_data() { |
| 15 | 15 | |
| 16 | - // ----------------------------------------------------------------------------------------------- |
|
| 17 | - // Definition for user table |
|
| 18 | - // ----------------------------------------------------------------------------------------------- |
|
| 16 | + // ----------------------------------------------------------------------------------------------- |
|
| 17 | + // Definition for user table |
|
| 18 | + // ----------------------------------------------------------------------------------------------- |
|
| 19 | 19 | |
| 20 | - $data['user']['table']['group'] = t('BOINC'); |
|
| 20 | + $data['user']['table']['group'] = t('BOINC'); |
|
| 21 | 21 | |
| 22 | - $data['user']['table']['base'] = array( |
|
| 23 | - 'field' => 'id', |
|
| 24 | - 'title' => t('BOINC user'), |
|
| 25 | - 'help' => t('BOINC account data for a user'), |
|
| 26 | - 'database' => 'boinc_ro' |
|
| 27 | - ); |
|
| 22 | + $data['user']['table']['base'] = array( |
|
| 23 | + 'field' => 'id', |
|
| 24 | + 'title' => t('BOINC user'), |
|
| 25 | + 'help' => t('BOINC account data for a user'), |
|
| 26 | + 'database' => 'boinc_ro' |
|
| 27 | + ); |
|
| 28 | 28 | |
| 29 | - // Describe each of the individual fields in this table to Views. For |
|
| 30 | - // each field, you may define what field, sort, argument, and/or filter |
|
| 31 | - // handlers it supports. This will determine where in the Views interface you |
|
| 32 | - // may use the field. |
|
| 29 | + // Describe each of the individual fields in this table to Views. For |
|
| 30 | + // each field, you may define what field, sort, argument, and/or filter |
|
| 31 | + // handlers it supports. This will determine where in the Views interface you |
|
| 32 | + // may use the field. |
|
| 33 | 33 | |
| 34 | - // Primary keys allowed as arguments |
|
| 34 | + // Primary keys allowed as arguments |
|
| 35 | 35 | |
| 36 | - $data['user']['id'] = array( |
|
| 36 | + $data['user']['id'] = array( |
|
| 37 | 37 | 'title' => bts('Id', array(), NULL, 'boinc:user-id'), |
| 38 | 38 | 'help' => t('The BOINC ID of the user account.'), |
| 39 | 39 | 'field' => array( |
| 40 | - 'handler' => 'views_handler_field_numeric', |
|
| 41 | - 'click sortable' => TRUE |
|
| 40 | + 'handler' => 'views_handler_field_numeric', |
|
| 41 | + 'click sortable' => TRUE |
|
| 42 | 42 | ), |
| 43 | 43 | 'argument' => array( |
| 44 | - 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
|
| 45 | - 'name field' => 'title', // the field to display in the summary. |
|
| 46 | - 'numeric' => TRUE, |
|
| 47 | - 'validate type' => 'id' |
|
| 44 | + 'handler' => 'views_handler_argument_boincuser_id', // custom handler |
|
| 45 | + 'name field' => 'title', // the field to display in the summary. |
|
| 46 | + 'numeric' => TRUE, |
|
| 47 | + 'validate type' => 'id' |
|
| 48 | 48 | ), |
| 49 | 49 | 'filter' => array( |
| 50 | - 'handler' => 'views_handler_filter_numeric' |
|
| 50 | + 'handler' => 'views_handler_filter_numeric' |
|
| 51 | 51 | ), |
| 52 | 52 | 'sort' => array( |
| 53 | - 'handler' => 'views_handler_sort_numeric' |
|
| 53 | + 'handler' => 'views_handler_sort_numeric' |
|
| 54 | 54 | ) |
| 55 | - ); |
|
| 56 | - $data['user']['teamid'] = array( |
|
| 55 | + ); |
|
| 56 | + $data['user']['teamid'] = array( |
|
| 57 | 57 | 'title' => bts('Team ID', array(), NULL, 'boinc:team-id'), |
| 58 | 58 | 'help' => t('The ID of the user\'s team.'), |
| 59 | 59 | 'field' => array( |
| 60 | - 'handler' => 'views_handler_field_numeric', |
|
| 61 | - 'click sortable' => TRUE, |
|
| 60 | + 'handler' => 'views_handler_field_numeric', |
|
| 61 | + 'click sortable' => TRUE, |
|
| 62 | 62 | ), |
| 63 | 63 | 'argument' => array( |
| 64 | - 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
|
| 65 | - 'name field' => 'title', // the field to display in the summary. |
|
| 66 | - 'numeric' => TRUE, |
|
| 67 | - 'validate type' => 'id' |
|
| 64 | + 'handler' => 'views_handler_argument_boincteam_id', // custom handler |
|
| 65 | + 'name field' => 'title', // the field to display in the summary. |
|
| 66 | + 'numeric' => TRUE, |
|
| 67 | + 'validate type' => 'id' |
|
| 68 | 68 | ), |
| 69 | 69 | 'filter' => array( |
| 70 | - 'handler' => 'views_handler_filter_numeric' |
|
| 70 | + 'handler' => 'views_handler_filter_numeric' |
|
| 71 | 71 | ), |
| 72 | 72 | 'sort' => array( |
| 73 | - 'handler' => 'views_handler_sort_numeric' |
|
| 73 | + 'handler' => 'views_handler_sort_numeric' |
|
| 74 | 74 | ) |
| 75 | - ); |
|
| 75 | + ); |
|
| 76 | 76 | |
| 77 | - // Descriptions of general host fields (alphabetized) |
|
| 77 | + // Descriptions of general host fields (alphabetized) |
|
| 78 | 78 | |
| 79 | - $data['user']['authenticator'] = array( |
|
| 79 | + $data['user']['authenticator'] = array( |
|
| 80 | 80 | 'title' => bts('Account Key', array(), NULL, 'boinc:user-info'), |
| 81 | 81 | 'help' => t('The BOINC account key of the user.'), |
| 82 | 82 | 'field' => array( |
| 83 | - 'handler' => 'views_handler_field', |
|
| 84 | - 'click sortable' => TRUE |
|
| 83 | + 'handler' => 'views_handler_field', |
|
| 84 | + 'click sortable' => TRUE |
|
| 85 | 85 | ), |
| 86 | 86 | 'filter' => array( |
| 87 | - 'handler' => 'views_handler_filter_string' |
|
| 87 | + 'handler' => 'views_handler_filter_string' |
|
| 88 | 88 | ), |
| 89 | 89 | 'sort' => array( |
| 90 | - 'handler' => 'views_handler_sort_string' |
|
| 90 | + 'handler' => 'views_handler_sort_string' |
|
| 91 | 91 | ) |
| 92 | - ); |
|
| 93 | - $data['user']['country'] = array( |
|
| 92 | + ); |
|
| 93 | + $data['user']['country'] = array( |
|
| 94 | 94 | 'title' => bts('Country', array(), NULL, 'boinc:country-of-origin'), |
| 95 | 95 | 'help' => t('The country of the user.'), |
| 96 | 96 | 'field' => array( |
| 97 | - 'handler' => 'views_handler_field', |
|
| 98 | - 'click sortable' => TRUE |
|
| 97 | + 'handler' => 'views_handler_field', |
|
| 98 | + 'click sortable' => TRUE |
|
| 99 | 99 | ), |
| 100 | 100 | 'filter' => array( |
| 101 | - 'handler' => 'views_handler_filter_string' |
|
| 101 | + 'handler' => 'views_handler_filter_string' |
|
| 102 | 102 | ), |
| 103 | 103 | 'sort' => array( |
| 104 | - 'handler' => 'views_handler_sort_string' |
|
| 104 | + 'handler' => 'views_handler_sort_string' |
|
| 105 | 105 | ) |
| 106 | - ); |
|
| 107 | - $data['user']['create_time'] = array( |
|
| 106 | + ); |
|
| 107 | + $data['user']['create_time'] = array( |
|
| 108 | 108 | 'title' => bts('Member since', array(), NULL, 'boinc:user-info'), |
| 109 | 109 | 'help' => t('When the BOINC account was created.'), |
| 110 | 110 | 'field' => array( |
| 111 | - 'handler' => 'views_handler_field_date', |
|
| 112 | - 'click sortable' => TRUE |
|
| 111 | + 'handler' => 'views_handler_field_date', |
|
| 112 | + 'click sortable' => TRUE |
|
| 113 | 113 | ), |
| 114 | 114 | 'filter' => array( |
| 115 | - 'handler' => 'views_handler_filter_date' |
|
| 115 | + 'handler' => 'views_handler_filter_date' |
|
| 116 | 116 | ), |
| 117 | 117 | 'sort' => array( |
| 118 | - 'handler' => 'views_handler_sort_date' |
|
| 118 | + 'handler' => 'views_handler_sort_date' |
|
| 119 | 119 | ) |
| 120 | - ); |
|
| 121 | - $data['user']['cross_project_id'] = array( |
|
| 120 | + ); |
|
| 121 | + $data['user']['cross_project_id'] = array( |
|
| 122 | 122 | 'title' => bts('CPID', array(), NULL, 'boinc:user-info'), |
| 123 | 123 | 'help' => t('The cross project user identifier.'), |
| 124 | 124 | 'field' => array( |
| 125 | - 'handler' => 'views_handler_field', |
|
| 126 | - 'click sortable' => TRUE |
|
| 125 | + 'handler' => 'views_handler_field', |
|
| 126 | + 'click sortable' => TRUE |
|
| 127 | 127 | ), |
| 128 | 128 | 'filter' => array( |
| 129 | - 'handler' => 'views_handler_filter_string' |
|
| 129 | + 'handler' => 'views_handler_filter_string' |
|
| 130 | 130 | ), |
| 131 | 131 | 'sort' => array( |
| 132 | - 'handler' => 'views_handler_sort_string' |
|
| 132 | + 'handler' => 'views_handler_sort_string' |
|
| 133 | 133 | ) |
| 134 | - ); |
|
| 135 | - $data['user']['email_addr'] = array( |
|
| 136 | - 'title' => bts('Email Address', array(), NULL, 'boinc:user-info'), |
|
| 134 | + ); |
|
| 135 | + $data['user']['email_addr'] = array( |
|
| 136 | + 'title' => bts('Email Address', array(), NULL, 'boinc:user-info'), |
|
| 137 | 137 | 'help' => t('The BOINC account email address.'), |
| 138 | 138 | 'field' => array( |
| 139 | - 'handler' => 'views_handler_field', |
|
| 140 | - 'click sortable' => TRUE |
|
| 139 | + 'handler' => 'views_handler_field', |
|
| 140 | + 'click sortable' => TRUE |
|
| 141 | 141 | ), |
| 142 | 142 | 'filter' => array( |
| 143 | - 'handler' => 'views_handler_filter_string' |
|
| 143 | + 'handler' => 'views_handler_filter_string' |
|
| 144 | 144 | ), |
| 145 | 145 | 'sort' => array( |
| 146 | - 'handler' => 'views_handler_sort_string' |
|
| 146 | + 'handler' => 'views_handler_sort_string' |
|
| 147 | 147 | ) |
| 148 | - ); |
|
| 149 | - $data['user']['expavg_credit'] = array( |
|
| 148 | + ); |
|
| 149 | + $data['user']['expavg_credit'] = array( |
|
| 150 | 150 | 'title' => bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC'), |
| 151 | 151 | 'help' => t('A decaying average of credit per day for the user.'), |
| 152 | 152 | 'field' => array( |
| 153 | - 'handler' => 'views_handler_field_numeric', |
|
| 154 | - 'click sortable' => TRUE, |
|
| 155 | - 'float' => TRUE |
|
| 153 | + 'handler' => 'views_handler_field_numeric', |
|
| 154 | + 'click sortable' => TRUE, |
|
| 155 | + 'float' => TRUE |
|
| 156 | 156 | ), |
| 157 | 157 | 'filter' => array( |
| 158 | - 'handler' => 'views_handler_filter_numeric' |
|
| 158 | + 'handler' => 'views_handler_filter_numeric' |
|
| 159 | 159 | ), |
| 160 | 160 | 'sort' => array( |
| 161 | - 'handler' => 'views_handler_sort_numeric' |
|
| 161 | + 'handler' => 'views_handler_sort_numeric' |
|
| 162 | 162 | ) |
| 163 | - ); |
|
| 164 | - $data['user']['name'] = array( |
|
| 163 | + ); |
|
| 164 | + $data['user']['name'] = array( |
|
| 165 | 165 | 'title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
| 166 | 166 | 'help' => t('The BOINC account user name.'), |
| 167 | 167 | 'field' => array( |
| 168 | - 'handler' => 'views_handler_field', |
|
| 169 | - 'click sortable' => TRUE |
|
| 168 | + 'handler' => 'views_handler_field', |
|
| 169 | + 'click sortable' => TRUE |
|
| 170 | 170 | ), |
| 171 | 171 | 'filter' => array( |
| 172 | - 'handler' => 'views_handler_filter_string' |
|
| 172 | + 'handler' => 'views_handler_filter_string' |
|
| 173 | 173 | ), |
| 174 | 174 | 'sort' => array( |
| 175 | - 'handler' => 'views_handler_sort_string' |
|
| 175 | + 'handler' => 'views_handler_sort_string' |
|
| 176 | 176 | ) |
| 177 | - ); |
|
| 178 | - $data['user']['passwd_hash'] = array( |
|
| 177 | + ); |
|
| 178 | + $data['user']['passwd_hash'] = array( |
|
| 179 | 179 | 'title' => bts('Password Hash', array(), NULL, 'boinc:user-info'), |
| 180 | 180 | 'help' => t('The user password hash'), |
| 181 | 181 | 'field' => array( |
| 182 | - 'handler' => 'views_handler_field', |
|
| 183 | - 'click sortable' => TRUE |
|
| 182 | + 'handler' => 'views_handler_field', |
|
| 183 | + 'click sortable' => TRUE |
|
| 184 | 184 | ), |
| 185 | 185 | 'filter' => array( |
| 186 | - 'handler' => 'views_handler_filter_string' |
|
| 186 | + 'handler' => 'views_handler_filter_string' |
|
| 187 | 187 | ), |
| 188 | 188 | 'sort' => array( |
| 189 | - 'handler' => 'views_handler_sort_string' |
|
| 189 | + 'handler' => 'views_handler_sort_string' |
|
| 190 | 190 | ) |
| 191 | - ); |
|
| 192 | - $data['user']['postal_code'] = array( |
|
| 191 | + ); |
|
| 192 | + $data['user']['postal_code'] = array( |
|
| 193 | 193 | 'title' => bts('Postal Code', array(), NULL, 'boinc:user-info'), |
| 194 | 194 | 'help' => t('The postal code of the user.'), |
| 195 | 195 | 'field' => array( |
| 196 | - 'handler' => 'views_handler_field', |
|
| 197 | - 'click sortable' => TRUE |
|
| 196 | + 'handler' => 'views_handler_field', |
|
| 197 | + 'click sortable' => TRUE |
|
| 198 | 198 | ), |
| 199 | 199 | 'filter' => array( |
| 200 | - 'handler' => 'views_handler_filter_string' |
|
| 200 | + 'handler' => 'views_handler_filter_string' |
|
| 201 | 201 | ), |
| 202 | 202 | 'sort' => array( |
| 203 | - 'handler' => 'views_handler_sort_string' |
|
| 203 | + 'handler' => 'views_handler_sort_string' |
|
| 204 | 204 | ) |
| 205 | - ); |
|
| 206 | - $data['user']['send_email'] = array( |
|
| 205 | + ); |
|
| 206 | + $data['user']['send_email'] = array( |
|
| 207 | 207 | 'title' => bts('Send Email', array(), NULL, 'boinc:user-info'), |
| 208 | 208 | 'help' => t('User preference to allow email communications.'), |
| 209 | 209 | 'field' => array( |
| 210 | - 'handler' => 'views_handler_field_numeric', |
|
| 211 | - 'click sortable' => TRUE |
|
| 210 | + 'handler' => 'views_handler_field_numeric', |
|
| 211 | + 'click sortable' => TRUE |
|
| 212 | 212 | ), |
| 213 | 213 | 'filter' => array( |
| 214 | - 'handler' => 'views_handler_filter_numeric' |
|
| 214 | + 'handler' => 'views_handler_filter_numeric' |
|
| 215 | 215 | ), |
| 216 | 216 | 'sort' => array( |
| 217 | - 'handler' => 'views_handler_sort_numeric' |
|
| 217 | + 'handler' => 'views_handler_sort_numeric' |
|
| 218 | 218 | ) |
| 219 | - ); |
|
| 220 | - $data['user']['show_hosts'] = array( |
|
| 219 | + ); |
|
| 220 | + $data['user']['show_hosts'] = array( |
|
| 221 | 221 | 'title' => bts('Show Hosts', array(), NULL, 'boinc:user-info'), |
| 222 | 222 | 'help' => t('User preference to display owned computers.'), |
| 223 | 223 | 'field' => array( |
| 224 | - 'handler' => 'views_handler_field_numeric', |
|
| 225 | - 'click sortable' => TRUE |
|
| 224 | + 'handler' => 'views_handler_field_numeric', |
|
| 225 | + 'click sortable' => TRUE |
|
| 226 | 226 | ), |
| 227 | 227 | 'filter' => array( |
| 228 | - 'handler' => 'views_handler_filter_numeric' |
|
| 228 | + 'handler' => 'views_handler_filter_numeric' |
|
| 229 | 229 | ), |
| 230 | 230 | 'sort' => array( |
| 231 | - 'handler' => 'views_handler_sort_numeric' |
|
| 231 | + 'handler' => 'views_handler_sort_numeric' |
|
| 232 | 232 | ) |
| 233 | - ); |
|
| 234 | - $data['user']['total_credit'] = array( |
|
| 233 | + ); |
|
| 234 | + $data['user']['total_credit'] = array( |
|
| 235 | 235 | 'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'), |
| 236 | 236 | 'help' => t('The total accumulated BOINC credit for the user.'), |
| 237 | 237 | 'field' => array( |
| 238 | - 'handler' => 'views_handler_field_numeric', |
|
| 239 | - 'click sortable' => TRUE, |
|
| 240 | - 'float' => TRUE |
|
| 238 | + 'handler' => 'views_handler_field_numeric', |
|
| 239 | + 'click sortable' => TRUE, |
|
| 240 | + 'float' => TRUE |
|
| 241 | 241 | ), |
| 242 | 242 | 'filter' => array( |
| 243 | - 'handler' => 'views_handler_filter_numeric' |
|
| 243 | + 'handler' => 'views_handler_filter_numeric' |
|
| 244 | 244 | ), |
| 245 | 245 | 'sort' => array( |
| 246 | - 'handler' => 'views_handler_sort_numeric' |
|
| 246 | + 'handler' => 'views_handler_sort_numeric' |
|
| 247 | 247 | ) |
| 248 | - ); |
|
| 249 | - $data['user']['url'] = array( |
|
| 248 | + ); |
|
| 249 | + $data['user']['url'] = array( |
|
| 250 | 250 | 'title' => bts('URL', array(), NULL, 'boinc:website-of-user-or-team'), |
| 251 | 251 | 'help' => t('The URL provided by the user'), |
| 252 | 252 | 'field' => array( |
| 253 | - 'handler' => 'views_handler_field', |
|
| 254 | - 'click sortable' => TRUE |
|
| 253 | + 'handler' => 'views_handler_field', |
|
| 254 | + 'click sortable' => TRUE |
|
| 255 | 255 | ), |
| 256 | 256 | 'filter' => array( |
| 257 | - 'handler' => 'views_handler_filter_string' |
|
| 257 | + 'handler' => 'views_handler_filter_string' |
|
| 258 | 258 | ), |
| 259 | 259 | 'sort' => array( |
| 260 | - 'handler' => 'views_handler_sort_string' |
|
| 260 | + 'handler' => 'views_handler_sort_string' |
|
| 261 | 261 | ) |
| 262 | - ); |
|
| 262 | + ); |
|
| 263 | 263 | |
| 264 | - return $data; |
|
| 264 | + return $data; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /* |
@@ -272,17 +272,17 @@ discard block |
||
| 272 | 272 | */ |
| 273 | 273 | |
| 274 | 274 | function boincuser_views_handlers() { |
| 275 | - return array( |
|
| 275 | + return array( |
|
| 276 | 276 | 'info' => array( |
| 277 | - 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
| 277 | + 'path' => drupal_get_path('module', 'boincuser') . '/views', |
|
| 278 | 278 | ), |
| 279 | 279 | 'handlers' => array( |
| 280 | - 'views_handler_argument_boincuser_id' => array( |
|
| 280 | + 'views_handler_argument_boincuser_id' => array( |
|
| 281 | 281 | 'parent' => 'views_handler_argument_numeric' |
| 282 | - ), |
|
| 283 | - 'views_handler_argument_boincteam_id' => array( |
|
| 282 | + ), |
|
| 283 | + 'views_handler_argument_boincteam_id' => array( |
|
| 284 | 284 | 'parent' => 'views_handler_argument_numeric' |
| 285 | - ), |
|
| 285 | + ), |
|
| 286 | 286 | ) |
| 287 | - ); |
|
| 287 | + ); |
|
| 288 | 288 | } |
@@ -157,13 +157,11 @@ discard block |
||
| 157 | 157 | if (!$values['boinc_root_dir']) { |
| 158 | 158 | form_set_error('boinc_root_dir', t('BOINC project root directory must be |
| 159 | 159 | defined!')); |
| 160 | - } |
|
| 161 | - elseif (!is_dir($values['boinc_root_dir'])) { |
|
| 160 | + } elseif (!is_dir($values['boinc_root_dir'])) { |
|
| 162 | 161 | form_set_error('boinc_root_dir', t('BOINC project root not found at %directory', |
| 163 | 162 | array('%directory' => $values['boinc_root_dir']) |
| 164 | 163 | )); |
| 165 | - } |
|
| 166 | - else { |
|
| 164 | + } else { |
|
| 167 | 165 | // By default, try to automatically set specific directories from the root |
| 168 | 166 | if (!$values['boinc_config_xml_dir']) { |
| 169 | 167 | $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
@@ -285,8 +283,7 @@ discard block |
||
| 285 | 283 | if (!$values['boinc_scheduler_urls']) { |
| 286 | 284 | form_set_error('boinc_scheduler_urls', t('At least one scheduling server |
| 287 | 285 | URL must be specified.')); |
| 288 | - } |
|
| 289 | - else { |
|
| 286 | + } else { |
|
| 290 | 287 | $urls = explode("\r\n", $values['boinc_scheduler_urls']); |
| 291 | 288 | foreach ($urls as $key => $url) { |
| 292 | 289 | if (!$url) { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | '#default_value' => $default['boinc_server_status_url'], |
| 121 | 121 | '#description' => t('An absolute URL or path relative to the site base to the server status page (e.g. %full_url or just %relative_url).', |
| 122 | 122 | array( |
| 123 | - '%full_url' => $base_url . '/server_status.php', |
|
| 123 | + '%full_url' => $base_url.'/server_status.php', |
|
| 124 | 124 | '%relative_url' => 'server_status.php', |
| 125 | 125 | ) |
| 126 | 126 | ), |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | '#default_value' => $default['boinc_app_list_url'], |
| 132 | 132 | '#description' => t('An absolute URL or path relative to the site base to the applications page (e.g. %full_url or just %relative_url).', |
| 133 | 133 | array( |
| 134 | - '%full_url' => $base_url . '/apps.php', |
|
| 134 | + '%full_url' => $base_url.'/apps.php', |
|
| 135 | 135 | '%relative_url' => 'apps.php', |
| 136 | 136 | ) |
| 137 | 137 | ), |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | '#type' => 'checkbox', |
| 355 | 355 | '#title' => t('Enable create_account.php RPC'), |
| 356 | 356 | '#default_value' => $default['boinc_weboptions_enableaccountcreateRPC'], |
| 357 | - '#description' => t('If checked, users will be able to create an account remotely using the create_account.php RPC. This option is independent of the user regsitration option found in ') . l(t('User management -> User settings'), '/admin/user/settings') . '. If enabled, user <b>may not be able to see and agree to the terms-of-use</b> to your site\'s privacy and data retention policies!', |
|
| 357 | + '#description' => t('If checked, users will be able to create an account remotely using the create_account.php RPC. This option is independent of the user regsitration option found in ').l(t('User management -> User settings'), '/admin/user/settings').'. If enabled, user <b>may not be able to see and agree to the terms-of-use</b> to your site\'s privacy and data retention policies!', |
|
| 358 | 358 | ); |
| 359 | 359 | |
| 360 | 360 | $form['boinc_weboptions_registrationtitle'] = array( |
@@ -409,32 +409,32 @@ discard block |
||
| 409 | 409 | '#rows' => 8, |
| 410 | 410 | '#description' => t('A list of Drupal URLs/paths to ignore for Terms of Use (ToU). If the option above \'Are existing users forced to agree to the Terms of Use?\' is activated, then some paths need to be ignored when checking if a user has agreed to the ToU. A good example is the logout path, "logout", or else users will not be able to logout! |
| 411 | 411 | <p>There is a default list of paths that must be ignored or else the site will not function. They are not included in this box. Here you may provide additional paths to be ignored, for example the privacy policy page may be accessible so that users may read it before agreeing to the site\'s ToU. |
| 412 | -<p>Paths should be entered one per line. All paths should be <em>lower-case</em> and should not include a leading \'/\'. Example: account/info/edit will allow the user to visit ' . $base_url . '/account/info/edit without first agreeing to the ToU. Regexp are allowed. Example: account/* will allow the user to visit any path starting with ' . $base_url . '/account/.'), |
|
| 412 | +<p>Paths should be entered one per line. All paths should be <em>lower-case</em> and should not include a leading \'/\'. Example: account/info/edit will allow the user to visit ' . $base_url.'/account/info/edit without first agreeing to the ToU. Regexp are allowed. Example: account/* will allow the user to visit any path starting with '.$base_url.'/account/.'), |
|
| 413 | 413 | ); |
| 414 | 414 | |
| 415 | 415 | $form['pathtitle'] = array( |
| 416 | 416 | '#value' => '<h3>Path Options</h3>', |
| 417 | 417 | ); |
| 418 | 418 | |
| 419 | - $form['boinc_weboptions_accountfinish'] = array ( |
|
| 419 | + $form['boinc_weboptions_accountfinish'] = array( |
|
| 420 | 420 | '#type' => 'textfield', |
| 421 | 421 | '#title' => t('Path to a custom account_finish.php page, should be a path to a node'), |
| 422 | 422 | '#description' => t('Provide a path to a node which will serve as your site\'s landing page for users create an account using the BOINC client manager. They will be directed to this page after the account is created. If blank, a default account_finish page will be used.<br>Examples: account_finish, content/welcome, node/123'), |
| 423 | 423 | '#default_value' => $default['boinc_weboptions_accountfinish'], |
| 424 | 424 | ); |
| 425 | - $form['boinc_weboptions_moderationpage'] = array ( |
|
| 425 | + $form['boinc_weboptions_moderationpage'] = array( |
|
| 426 | 426 | '#type' => 'textfield', |
| 427 | 427 | '#title' => t('Path to the site\'s content moderation info page, should be a path to a node'), |
| 428 | 428 | '#description' => t('Provide a path to a node which will serve as your site\'s page for account/content moderation information. This will be used on the default account_finish page. If blank, no link to a moderation page will be provided. If a path is provided to the custom account_finish.php page (above), this field will be ignored.<br>Examples: moderation, content/moderation, node/456'), |
| 429 | 429 | '#default_value' => $default['boinc_weboptions_moderationpage'], |
| 430 | 430 | ); |
| 431 | - $form['boinc_weboptions_rulespolicies'] = array ( |
|
| 431 | + $form['boinc_weboptions_rulespolicies'] = array( |
|
| 432 | 432 | '#type' => 'textfield', |
| 433 | 433 | '#title' => t('Path to the site\'s rule and policies page, should be a path to a node'), |
| 434 | 434 | '#description' => t('Provide a path to a node which will serve as your site\'s rules and policies page. This will be used on the Join page shown to new users. If blank, no link to a rules and policies page will be provided.<br>Examples: rules-and-policies, node/789'), |
| 435 | 435 | '#default_value' => $default['boinc_weboptions_rulespolicies'], |
| 436 | 436 | ); |
| 437 | - $form['boinc_other_frontpage'] = array ( |
|
| 437 | + $form['boinc_other_frontpage'] = array( |
|
| 438 | 438 | '#type' => 'textarea', |
| 439 | 439 | '#title' => bts('Message for site\'s Home Page', array(), NULL, 'boinc:admin-boinc-other-options'), |
| 440 | 440 | '#default_value' => $default['boinc_other_frontpage'], |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | '#value' => '<h3>Other Options</h3>', |
| 448 | 448 | ); |
| 449 | 449 | |
| 450 | - $form['boinc_weboptions_blacklisted_usernames'] = array ( |
|
| 450 | + $form['boinc_weboptions_blacklisted_usernames'] = array( |
|
| 451 | 451 | '#type' => 'textarea', |
| 452 | 452 | '#title' => t('BOINC username blacklist'), |
| 453 | 453 | '#default_value' => $default['boinc_weboptions_blacklisted_usernames'], |
@@ -466,17 +466,17 @@ discard block |
||
| 466 | 466 | $values = $form_state['values']; |
| 467 | 467 | |
| 468 | 468 | $accountfinish = $values['boinc_weboptions_accountfinish']; |
| 469 | - if ( ($accountfinish) AND (!drupal_lookup_path('source', $accountfinish)) ) { |
|
| 469 | + if (($accountfinish) AND (!drupal_lookup_path('source', $accountfinish))) { |
|
| 470 | 470 | form_set_error('boinc weboptions_accountfinish', t('Path to custom account finish page not found. Please provide a valid path, or leave blank to unset.')); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | $moderationpage = $values['boinc_weboptions_moderationpage']; |
| 474 | - if ( ($moderationpage) AND (!drupal_lookup_path('source', $moderationpage)) ) { |
|
| 474 | + if (($moderationpage) AND (!drupal_lookup_path('source', $moderationpage))) { |
|
| 475 | 475 | form_set_error('boinc weboptions_moderationpage', t('Path to moderation page not found. Please provide a valid path, or leave blank to unset.')); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | $rulespolicies = $values['boinc_weboptions_rulespolicies']; |
| 479 | - if ( ($rulespolicies) AND (!drupal_lookup_path('source', $rulespolicies)) ) { |
|
| 479 | + if (($rulespolicies) AND (!drupal_lookup_path('source', $rulespolicies))) { |
|
| 480 | 480 | form_set_error('boinc weboptions_rulespolicies', t('Path to rules and policies page not found. Please provide a valid path, or leave blank to unset.')); |
| 481 | 481 | } |
| 482 | 482 | } |
@@ -485,5 +485,5 @@ discard block |
||
| 485 | 485 | * Submit BOINC other form |
| 486 | 486 | */ |
| 487 | 487 | function boincuser_admin_weboptions_submit($form, &$form_state) { |
| 488 | - drupal_set_message( bts("Status: Drupa-BOINC Web site options have been updated", array(), NULL, 'boinc:admin-boinc-website-options') ); |
|
| 488 | + drupal_set_message(bts("Status: Drupa-BOINC Web site options have been updated", array(), NULL, 'boinc:admin-boinc-website-options')); |
|
| 489 | 489 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | //drupal_set_message(print_r($default, true)); |
| 50 | 50 | //drupal_set_message(print_r($form_state, true)); |
| 51 | 51 | // Show overrides if the root dir is set and others have not been detected |
| 52 | - $show_overrides = FALSE; |
|
| 52 | + $show_overrides = false; |
|
| 53 | 53 | if ($default['boinc_root_dir']) { |
| 54 | 54 | foreach ($default as $key => $dir) { |
| 55 | 55 | switch ($key) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // If any of these values are not set, show the overrides section |
| 61 | 61 | if (!$dir) { |
| 62 | 62 | $default[$key] = $form_state['values'][$key]; |
| 63 | - $show_overrides = TRUE; |
|
| 63 | + $show_overrides = true; |
|
| 64 | 64 | break; |
| 65 | 65 | } |
| 66 | 66 | break; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | '#title' => t('Overrides'), |
| 85 | 85 | '#type' => 'fieldset', |
| 86 | 86 | '#description' => '', |
| 87 | - '#collapsible' => TRUE, |
|
| 87 | + '#collapsible' => true, |
|
| 88 | 88 | '#collapsed' => !$show_overrides, |
| 89 | 89 | '#attributes' => array('class' => 'advanced-settings') |
| 90 | 90 | ); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | )); |
| 223 | 223 | } |
| 224 | 224 | if ($values['boinc_host_sched_logs_dir'] |
| 225 | - AND !is_dir($values['boinc_host_sched_logs_dir']) |
|
| 225 | + and !is_dir($values['boinc_host_sched_logs_dir']) |
|
| 226 | 226 | ) { |
| 227 | 227 | form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
| 228 | 228 | directory not found at %directory', |
@@ -330,13 +330,13 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | //form defaults |
| 332 | 332 | $default = array( |
| 333 | - 'boinc_weboptions_enableaccountcreateRPC' => variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE), |
|
| 333 | + 'boinc_weboptions_enableaccountcreateRPC' => variable_get('boinc_weboptions_enableaccountcreateRPC', true), |
|
| 334 | 334 | 'boinc_weboptions_registrationtitle' => variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), |
| 335 | 335 | 'boinc_weboptions_termsofuse' => variable_get('boinc_weboptions_termsofuse', ''), |
| 336 | - 'boinc_weboptions_overrideboinctou' => variable_get('boinc_weboptions_overrideboinctou', FALSE), |
|
| 336 | + 'boinc_weboptions_overrideboinctou' => variable_get('boinc_weboptions_overrideboinctou', false), |
|
| 337 | 337 | 'boinc_weboptions_agreequestion' => variable_get('boinc_weboptions_agreequestion', 'Do you agree with the above terms of use?'), |
| 338 | 338 | 'boinc_weboptions_registrationtitle2' => variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), |
| 339 | - 'boinc_weboptions_existinguser_tou' => variable_get('boinc_weboptions_existinguser_tou', FALSE), |
|
| 339 | + 'boinc_weboptions_existinguser_tou' => variable_get('boinc_weboptions_existinguser_tou', false), |
|
| 340 | 340 | 'boinc_weboptions_pathstoignore' => variable_get('boinc_weboptions_pathstoignore', "moderation\ncontent/moderation\nprivacy"), |
| 341 | 341 | 'boinc_weboptions_accountfinish' => variable_get('boinc_weboptions_accountfinish', ''), |
| 342 | 342 | 'boinc_weboptions_moderationpage' => variable_get('boinc_weboptions_moderationpage', ''), |
@@ -436,11 +436,11 @@ discard block |
||
| 436 | 436 | ); |
| 437 | 437 | $form['boinc_other_frontpage'] = array ( |
| 438 | 438 | '#type' => 'textarea', |
| 439 | - '#title' => bts('Message for site\'s Home Page', array(), NULL, 'boinc:admin-boinc-other-options'), |
|
| 439 | + '#title' => bts('Message for site\'s Home Page', array(), null, 'boinc:admin-boinc-other-options'), |
|
| 440 | 440 | '#default_value' => $default['boinc_other_frontpage'], |
| 441 | 441 | '#cols' => 60, |
| 442 | 442 | '#rows' => 8, |
| 443 | - '#description' => bts('Text to be displayed on the site\'s Home landing page.', array(), NULL, 'boinc:admin-boinc-other-options'), |
|
| 443 | + '#description' => bts('Text to be displayed on the site\'s Home landing page.', array(), null, 'boinc:admin-boinc-other-options'), |
|
| 444 | 444 | ); |
| 445 | 445 | |
| 446 | 446 | $form['Othertitle'] = array( |
@@ -466,17 +466,17 @@ discard block |
||
| 466 | 466 | $values = $form_state['values']; |
| 467 | 467 | |
| 468 | 468 | $accountfinish = $values['boinc_weboptions_accountfinish']; |
| 469 | - if ( ($accountfinish) AND (!drupal_lookup_path('source', $accountfinish)) ) { |
|
| 469 | + if ( ($accountfinish) and (!drupal_lookup_path('source', $accountfinish)) ) { |
|
| 470 | 470 | form_set_error('boinc weboptions_accountfinish', t('Path to custom account finish page not found. Please provide a valid path, or leave blank to unset.')); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | $moderationpage = $values['boinc_weboptions_moderationpage']; |
| 474 | - if ( ($moderationpage) AND (!drupal_lookup_path('source', $moderationpage)) ) { |
|
| 474 | + if ( ($moderationpage) and (!drupal_lookup_path('source', $moderationpage)) ) { |
|
| 475 | 475 | form_set_error('boinc weboptions_moderationpage', t('Path to moderation page not found. Please provide a valid path, or leave blank to unset.')); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | $rulespolicies = $values['boinc_weboptions_rulespolicies']; |
| 479 | - if ( ($rulespolicies) AND (!drupal_lookup_path('source', $rulespolicies)) ) { |
|
| 479 | + if ( ($rulespolicies) and (!drupal_lookup_path('source', $rulespolicies)) ) { |
|
| 480 | 480 | form_set_error('boinc weboptions_rulespolicies', t('Path to rules and policies page not found. Please provide a valid path, or leave blank to unset.')); |
| 481 | 481 | } |
| 482 | 482 | } |
@@ -485,5 +485,5 @@ discard block |
||
| 485 | 485 | * Submit BOINC other form |
| 486 | 486 | */ |
| 487 | 487 | function boincuser_admin_weboptions_submit($form, &$form_state) { |
| 488 | - drupal_set_message( bts("Status: Drupa-BOINC Web site options have been updated", array(), NULL, 'boinc:admin-boinc-website-options') ); |
|
| 488 | + drupal_set_message( bts("Status: Drupa-BOINC Web site options have been updated", array(), null, 'boinc:admin-boinc-website-options') ); |
|
| 489 | 489 | } |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | }*/ |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * The BOINC environment form allows paths to be set to connect Drupal to an |
|
| 32 | - * existing BOINC web interface. |
|
| 33 | - */ |
|
| 31 | + * The BOINC environment form allows paths to be set to connect Drupal to an |
|
| 32 | + * existing BOINC web interface. |
|
| 33 | + */ |
|
| 34 | 34 | function boincuser_admin_environment(&$form_state) { |
| 35 | - global $base_url; |
|
| 36 | - $form = array(); |
|
| 37 | - $default = array( |
|
| 35 | + global $base_url; |
|
| 36 | + $form = array(); |
|
| 37 | + $default = array( |
|
| 38 | 38 | 'boinc_root_dir' => variable_get('boinc_root_dir', ''), |
| 39 | 39 | 'boinc_config_xml_dir' => variable_get('boinc_config_xml_dir', ''), |
| 40 | 40 | 'boinc_html_inc_dir' => variable_get('boinc_html_inc_dir', ''), |
@@ -47,303 +47,303 @@ discard block |
||
| 47 | 47 | 'boinc_admin_mailing_list_subject_tag' => variable_get('boinc_admin_mailing_list_subject_tag', ''), |
| 48 | 48 | 'boinc_debug_mode' => variable_get('boinc_debug_mode', 0), |
| 49 | 49 | 'boinc_project_config_keywords' => variable_get('boinc_project_config_keywords', ''), |
| 50 | - ); |
|
| 51 | - //drupal_set_message(print_r($default, true)); |
|
| 52 | - //drupal_set_message(print_r($form_state, true)); |
|
| 53 | - // Show overrides if the root dir is set and others have not been detected |
|
| 54 | - $show_overrides = FALSE; |
|
| 55 | - if ($default['boinc_root_dir']) { |
|
| 50 | + ); |
|
| 51 | + //drupal_set_message(print_r($default, true)); |
|
| 52 | + //drupal_set_message(print_r($form_state, true)); |
|
| 53 | + // Show overrides if the root dir is set and others have not been detected |
|
| 54 | + $show_overrides = FALSE; |
|
| 55 | + if ($default['boinc_root_dir']) { |
|
| 56 | 56 | foreach ($default as $key => $dir) { |
| 57 | - switch ($key) { |
|
| 58 | - case 'boinc_config_xml_dir': |
|
| 57 | + switch ($key) { |
|
| 58 | + case 'boinc_config_xml_dir': |
|
| 59 | 59 | case 'boinc_html_inc_dir': |
| 60 | 60 | case 'boinc_project_config_dir': |
| 61 | 61 | case 'boinc_user_image_dir': |
| 62 | 62 | // If any of these values are not set, show the overrides section |
| 63 | 63 | if (!$dir) { |
| 64 | - $default[$key] = $form_state['values'][$key]; |
|
| 65 | - $show_overrides = TRUE; |
|
| 66 | - break; |
|
| 64 | + $default[$key] = $form_state['values'][$key]; |
|
| 65 | + $show_overrides = TRUE; |
|
| 66 | + break; |
|
| 67 | 67 | } |
| 68 | 68 | break; |
| 69 | - default: |
|
| 69 | + default: |
|
| 70 | 70 | } |
| 71 | - if ($show_overrides) { |
|
| 71 | + if ($show_overrides) { |
|
| 72 | 72 | break; |
| 73 | - } |
|
| 73 | + } |
|
| 74 | + } |
|
| 74 | 75 | } |
| 75 | - } |
|
| 76 | - // Define the form |
|
| 77 | - $form['boinc_root_dir'] = array( |
|
| 76 | + // Define the form |
|
| 77 | + $form['boinc_root_dir'] = array( |
|
| 78 | 78 | '#type' => 'textfield', |
| 79 | 79 | '#title' => t('BOINC project root directory'), |
| 80 | 80 | '#default_value' => $default['boinc_root_dir'], |
| 81 | 81 | '#description' => t('The filesystem path to the BOINC project root. This |
| 82 | 82 | directory should contain config.xml as well as the html subdirectory, |
| 83 | 83 | which itself contains inc/, project/, and user_profile/.'), |
| 84 | - ); |
|
| 85 | - $form['overrides'] = array( |
|
| 84 | + ); |
|
| 85 | + $form['overrides'] = array( |
|
| 86 | 86 | '#title' => t('Overrides'), |
| 87 | 87 | '#type' => 'fieldset', |
| 88 | 88 | '#description' => '', |
| 89 | 89 | '#collapsible' => TRUE, |
| 90 | 90 | '#collapsed' => !$show_overrides, |
| 91 | 91 | '#attributes' => array('class' => 'advanced-settings') |
| 92 | - ); |
|
| 93 | - $form['overrides']['boinc_config_xml_dir'] = array( |
|
| 92 | + ); |
|
| 93 | + $form['overrides']['boinc_config_xml_dir'] = array( |
|
| 94 | 94 | '#type' => 'textfield', |
| 95 | 95 | '#title' => t('BOINC config.xml directory'), |
| 96 | 96 | '#default_value' => $default['boinc_config_xml_dir'], |
| 97 | 97 | '#description' => t('The filesystem path that contains config.xml'), |
| 98 | - ); |
|
| 99 | - $form['overrides']['boinc_html_inc_dir'] = array( |
|
| 98 | + ); |
|
| 99 | + $form['overrides']['boinc_html_inc_dir'] = array( |
|
| 100 | 100 | '#type' => 'textfield', |
| 101 | 101 | '#title' => t('BOINC web includes directory'), |
| 102 | 102 | '#default_value' => $default['boinc_html_inc_dir'], |
| 103 | 103 | '#description' => t('The filesystem path to the html/inc/ directory that |
| 104 | 104 | contains util.inc'), |
| 105 | - ); |
|
| 106 | - $form['overrides']['boinc_project_config_dir'] = array( |
|
| 105 | + ); |
|
| 106 | + $form['overrides']['boinc_project_config_dir'] = array( |
|
| 107 | 107 | '#type' => 'textfield', |
| 108 | 108 | '#title' => t('BOINC project config directory'), |
| 109 | 109 | '#default_value' => $default['boinc_project_config_dir'], |
| 110 | 110 | '#description' => t('The filesystem path to the project/ directory that |
| 111 | 111 | contains project.inc'), |
| 112 | - ); |
|
| 113 | - $form['overrides']['boinc_user_image_dir'] = array( |
|
| 112 | + ); |
|
| 113 | + $form['overrides']['boinc_user_image_dir'] = array( |
|
| 114 | 114 | '#type' => 'textfield', |
| 115 | 115 | '#title' => t('BOINC user profile image directory'), |
| 116 | 116 | '#default_value' => $default['boinc_user_image_dir'], |
| 117 | 117 | '#description' => t('The filesystem directory that contains user images'), |
| 118 | - ); |
|
| 119 | - $form['boinc_server_status_url'] = array( |
|
| 118 | + ); |
|
| 119 | + $form['boinc_server_status_url'] = array( |
|
| 120 | 120 | '#type' => 'textfield', |
| 121 | 121 | '#title' => t('BOINC server status page URL (optional)'), |
| 122 | 122 | '#default_value' => $default['boinc_server_status_url'], |
| 123 | 123 | '#description' => t('An absolute URL or path relative to the site base to the server status page (e.g. %full_url or just %relative_url).', |
| 124 | - array( |
|
| 124 | + array( |
|
| 125 | 125 | '%full_url' => $base_url . '/server_status.php', |
| 126 | 126 | '%relative_url' => 'server_status.php', |
| 127 | - ) |
|
| 127 | + ) |
|
| 128 | 128 | ), |
| 129 | - ); |
|
| 130 | - $form['boinc_app_list_url'] = array( |
|
| 129 | + ); |
|
| 130 | + $form['boinc_app_list_url'] = array( |
|
| 131 | 131 | '#type' => 'textfield', |
| 132 | 132 | '#title' => t('BOINC applications page URL (optional)'), |
| 133 | 133 | '#default_value' => $default['boinc_app_list_url'], |
| 134 | 134 | '#description' => t('An absolute URL or path relative to the site base to the applications page (e.g. %full_url or just %relative_url).', |
| 135 | - array( |
|
| 135 | + array( |
|
| 136 | 136 | '%full_url' => $base_url . '/apps.php', |
| 137 | 137 | '%relative_url' => 'apps.php', |
| 138 | - ) |
|
| 138 | + ) |
|
| 139 | 139 | ), |
| 140 | - ); |
|
| 141 | - $form['boinc_host_sched_logs_dir'] = array( |
|
| 140 | + ); |
|
| 141 | + $form['boinc_host_sched_logs_dir'] = array( |
|
| 142 | 142 | '#type' => 'textfield', |
| 143 | 143 | '#title' => t('BOINC host scheduler log directory (optional)'), |
| 144 | 144 | '#default_value' => $default['boinc_host_sched_logs_dir'], |
| 145 | 145 | '#description' => t('The filesystem directory that contains host scheduler logs'), |
| 146 | - ); |
|
| 147 | - $form['boinc_admin_mailing_list'] = array( |
|
| 146 | + ); |
|
| 147 | + $form['boinc_admin_mailing_list'] = array( |
|
| 148 | 148 | '#type' => 'textfield', |
| 149 | 149 | '#title' => t('Admin mailing list'), |
| 150 | 150 | '#default_value' => $default['boinc_admin_mailing_list'], |
| 151 | 151 | '#description' => t('Enter an email-address which will be used to contact admisistrators. If empty, the site email configured in Settings -> Site Information will be used.'), |
| 152 | - ); |
|
| 153 | - $form['boinc_admin_mailing_list_subject_tag'] = array( |
|
| 152 | + ); |
|
| 153 | + $form['boinc_admin_mailing_list_subject_tag'] = array( |
|
| 154 | 154 | '#type' => 'textfield', |
| 155 | 155 | '#title' => t('Admin mailing list - subject tag'), |
| 156 | 156 | '#default_value' => $default['boinc_admin_mailing_list_subject_tag'], |
| 157 | 157 | '#description' => t('Text which will appear at the beginning of the subject for any admin notification emails. If empty, no tag will be included. Examples: [drupal-error].'), |
| 158 | - ); |
|
| 159 | - $form['boinc_debug_mode'] = array( |
|
| 158 | + ); |
|
| 159 | + $form['boinc_debug_mode'] = array( |
|
| 160 | 160 | '#type' => 'checkbox', |
| 161 | 161 | '#title' => t('Show debug messages in system log'), |
| 162 | 162 | '#default_value' => $default['boinc_debug_mode'] |
| 163 | - ); |
|
| 164 | - $form['boinc_project_config_keywords'] = array( |
|
| 163 | + ); |
|
| 164 | + $form['boinc_project_config_keywords'] = array( |
|
| 165 | 165 | '#type' => 'textarea', |
| 166 | 166 | '#title' => t('Project/Job Keywords for get_project_config RPC'), |
| 167 | 167 | '#default_value' => $default['boinc_project_config_keywords'], |
| 168 | 168 | '#description' => t('XML from this text box will be appended to the XML output from the get_project_config RPC. There is no check for XML validity! See !link for more details. It is okay to leave this blank.', |
| 169 | 169 | array( |
| 170 | - '!link' => l('BOINC wiki page', 'https://boinc.berkeley.edu/trac/wiki/JobKeywords') |
|
| 170 | + '!link' => l('BOINC wiki page', 'https://boinc.berkeley.edu/trac/wiki/JobKeywords') |
|
| 171 | 171 | )), |
| 172 | - ); |
|
| 173 | - return system_settings_form($form); |
|
| 172 | + ); |
|
| 173 | + return system_settings_form($form); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * Validate the BOINC environment form. |
|
| 178 | - */ |
|
| 177 | + * Validate the BOINC environment form. |
|
| 178 | + */ |
|
| 179 | 179 | function boincuser_admin_environment_validate($form, &$form_state) { |
| 180 | - $values = $form_state['values']; |
|
| 181 | - if (!$values['boinc_root_dir']) { |
|
| 180 | + $values = $form_state['values']; |
|
| 181 | + if (!$values['boinc_root_dir']) { |
|
| 182 | 182 | form_set_error('boinc_root_dir', t('BOINC project root directory must be |
| 183 | 183 | defined!')); |
| 184 | - } |
|
| 185 | - elseif (!is_dir($values['boinc_root_dir'])) { |
|
| 184 | + } |
|
| 185 | + elseif (!is_dir($values['boinc_root_dir'])) { |
|
| 186 | 186 | form_set_error('boinc_root_dir', t('BOINC project root not found at %directory', |
| 187 | - array('%directory' => $values['boinc_root_dir']) |
|
| 187 | + array('%directory' => $values['boinc_root_dir']) |
|
| 188 | 188 | )); |
| 189 | - } |
|
| 190 | - else { |
|
| 189 | + } |
|
| 190 | + else { |
|
| 191 | 191 | // By default, try to automatically set specific directories from the root |
| 192 | 192 | if (!$values['boinc_config_xml_dir']) { |
| 193 | - $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
|
| 194 | - form_set_value($form['overrides']['boinc_config_xml_dir'], $values['boinc_config_xml_dir'], $form_state); |
|
| 193 | + $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
|
| 194 | + form_set_value($form['overrides']['boinc_config_xml_dir'], $values['boinc_config_xml_dir'], $form_state); |
|
| 195 | 195 | } |
| 196 | 196 | if (!$values['boinc_html_inc_dir']) { |
| 197 | - $values['boinc_html_inc_dir'] = "{$values['boinc_root_dir']}/html/inc"; |
|
| 198 | - form_set_value($form['overrides']['boinc_html_inc_dir'], $values['boinc_html_inc_dir'], $form_state); |
|
| 197 | + $values['boinc_html_inc_dir'] = "{$values['boinc_root_dir']}/html/inc"; |
|
| 198 | + form_set_value($form['overrides']['boinc_html_inc_dir'], $values['boinc_html_inc_dir'], $form_state); |
|
| 199 | 199 | } |
| 200 | 200 | if (!$values['boinc_project_config_dir']) { |
| 201 | - $values['boinc_project_config_dir'] = "{$values['boinc_root_dir']}/html/project"; |
|
| 202 | - form_set_value($form['overrides']['boinc_project_config_dir'], $values['boinc_project_config_dir'], $form_state); |
|
| 201 | + $values['boinc_project_config_dir'] = "{$values['boinc_root_dir']}/html/project"; |
|
| 202 | + form_set_value($form['overrides']['boinc_project_config_dir'], $values['boinc_project_config_dir'], $form_state); |
|
| 203 | 203 | } |
| 204 | 204 | if (!$values['boinc_user_image_dir']) { |
| 205 | - $values['boinc_user_image_dir'] = "{$values['boinc_root_dir']}/html/user_profile/images"; |
|
| 206 | - form_set_value($form['overrides']['boinc_user_image_dir'], $values['boinc_user_image_dir'], $form_state); |
|
| 205 | + $values['boinc_user_image_dir'] = "{$values['boinc_root_dir']}/html/user_profile/images"; |
|
| 206 | + form_set_value($form['overrides']['boinc_user_image_dir'], $values['boinc_user_image_dir'], $form_state); |
|
| 207 | 207 | } |
| 208 | 208 | // Validate that required BOINC content is found |
| 209 | 209 | if (!is_readable("{$values['boinc_config_xml_dir']}/config.xml")) { |
| 210 | - form_set_error('boinc_config_xml_dir', t('@file not found in %directory', |
|
| 210 | + form_set_error('boinc_config_xml_dir', t('@file not found in %directory', |
|
| 211 | 211 | array( |
| 212 | - '@file' => 'config.xml', |
|
| 213 | - '%directory' => "{$values['boinc_config_xml_dir']}/" |
|
| 212 | + '@file' => 'config.xml', |
|
| 213 | + '%directory' => "{$values['boinc_config_xml_dir']}/" |
|
| 214 | 214 | ) |
| 215 | - )); |
|
| 215 | + )); |
|
| 216 | 216 | } |
| 217 | 217 | if (!is_readable("{$values['boinc_html_inc_dir']}/util.inc")) { |
| 218 | - form_set_error('boinc_html_inc_dir', t('@file not found in %directory', |
|
| 218 | + form_set_error('boinc_html_inc_dir', t('@file not found in %directory', |
|
| 219 | 219 | array( |
| 220 | - '@file' => 'util.inc', |
|
| 221 | - '%directory' => "{$values['boinc_html_inc_dir']}/" |
|
| 220 | + '@file' => 'util.inc', |
|
| 221 | + '%directory' => "{$values['boinc_html_inc_dir']}/" |
|
| 222 | 222 | ) |
| 223 | - )); |
|
| 223 | + )); |
|
| 224 | 224 | } |
| 225 | 225 | if (!is_readable("{$values['boinc_project_config_dir']}/project.inc")) { |
| 226 | - form_set_error('boinc_project_config_dir', t('@file not found in %directory', |
|
| 226 | + form_set_error('boinc_project_config_dir', t('@file not found in %directory', |
|
| 227 | 227 | array( |
| 228 | - '@file' => 'project.inc', |
|
| 229 | - '%directory' => "{$values['boinc_project_config_dir']}/" |
|
| 228 | + '@file' => 'project.inc', |
|
| 229 | + '%directory' => "{$values['boinc_project_config_dir']}/" |
|
| 230 | 230 | ) |
| 231 | - )); |
|
| 231 | + )); |
|
| 232 | 232 | } |
| 233 | 233 | if (!is_dir($values['boinc_user_image_dir'])) { |
| 234 | - form_set_error('boinc_user_image_dir', t('Profile image directory not found |
|
| 234 | + form_set_error('boinc_user_image_dir', t('Profile image directory not found |
|
| 235 | 235 | at %directory', array('%directory' => $values['boinc_user_image_dir']) |
| 236 | - )); |
|
| 236 | + )); |
|
| 237 | 237 | } |
| 238 | 238 | if ($values['boinc_host_sched_logs_dir'] |
| 239 | 239 | AND !is_dir($values['boinc_host_sched_logs_dir']) |
| 240 | - ) { |
|
| 241 | - form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
|
| 240 | + ) { |
|
| 241 | + form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
|
| 242 | 242 | directory not found at %directory', |
| 243 | 243 | array('%directory' => $values['boinc_host_sched_logs_dir']) |
| 244 | - )); |
|
| 244 | + )); |
|
| 245 | + } |
|
| 245 | 246 | } |
| 246 | - } |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | - * Handle post-validation submission of BOINC environment form. |
|
| 251 | - */ |
|
| 250 | + * Handle post-validation submission of BOINC environment form. |
|
| 251 | + */ |
|
| 252 | 252 | function boincuser_admin_environment_submit($form, &$form_state) { |
| 253 | - unset($_SESSION['boinc_env']); |
|
| 254 | - drupal_set_message(t('BOINC environment settings have been updated.')); |
|
| 253 | + unset($_SESSION['boinc_env']); |
|
| 254 | + drupal_set_message(t('BOINC environment settings have been updated.')); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | - * The BOINC scheduler form provides options for how scheduler tags are |
|
| 259 | - * inserted into the front page |
|
| 260 | - */ |
|
| 258 | + * The BOINC scheduler form provides options for how scheduler tags are |
|
| 259 | + * inserted into the front page |
|
| 260 | + */ |
|
| 261 | 261 | function boincuser_admin_scheduler(&$form_state) { |
| 262 | - $form = array(); |
|
| 263 | - $config_cgi_url = ''; |
|
| 264 | - if ($config_xml_dir = variable_get('boinc_config_xml_dir', '')) { |
|
| 262 | + $form = array(); |
|
| 263 | + $config_cgi_url = ''; |
|
| 264 | + if ($config_xml_dir = variable_get('boinc_config_xml_dir', '')) { |
|
| 265 | 265 | // Get the cgi_url option from the config file as the default scheduler URL |
| 266 | 266 | $xml = new DOMDocument(); |
| 267 | 267 | if ($xml->load("{$config_xml_dir}/config.xml")) { |
| 268 | - $config = xml_to_array($xml); |
|
| 269 | - if (isset($config['boinc']['config']['cgi_url']['@value'])) { |
|
| 268 | + $config = xml_to_array($xml); |
|
| 269 | + if (isset($config['boinc']['config']['cgi_url']['@value'])) { |
|
| 270 | 270 | $config_cgi_url = rtrim(trim($config['boinc']['config']['cgi_url']['@value']), '/'); |
| 271 | 271 | $config_cgi_url .= '/cgi'; |
| 272 | - } |
|
| 272 | + } |
|
| 273 | 273 | } |
| 274 | - } |
|
| 275 | - $default = array( |
|
| 274 | + } |
|
| 275 | + $default = array( |
|
| 276 | 276 | 'boinc_scheduler_urls' => variable_get('boinc_scheduler_urls', $config_cgi_url), |
| 277 | 277 | 'boinc_scheduler_tag_format_old' => variable_get('boinc_scheduler_tag_format_old', 1), |
| 278 | 278 | 'boinc_scheduler_tag_format_new' => variable_get('boinc_scheduler_tag_format_new', 1) |
| 279 | - ); |
|
| 279 | + ); |
|
| 280 | 280 | |
| 281 | - // Define the form |
|
| 282 | - $form['boinc_scheduler_urls'] = array( |
|
| 281 | + // Define the form |
|
| 282 | + $form['boinc_scheduler_urls'] = array( |
|
| 283 | 283 | '#type' => 'textarea', |
| 284 | 284 | '#title' => t('Scheduling server URLs'), |
| 285 | 285 | '#default_value' => $default['boinc_scheduler_urls'], |
| 286 | 286 | '#cols' => 60, |
| 287 | 287 | '#rows' => 5, |
| 288 | 288 | '#description' => t('If there are multiple URLs, please enter one per line.'), |
| 289 | - ); |
|
| 290 | - $form['boinc_scheduler_tag_format_old'] = array( |
|
| 289 | + ); |
|
| 290 | + $form['boinc_scheduler_tag_format_old'] = array( |
|
| 291 | 291 | '#type' => 'checkbox', |
| 292 | 292 | '#title' => t('Old format (@scheduler tag)', array('@scheduler' => '<scheduler>')), |
| 293 | 293 | '#default_value' => $default['boinc_scheduler_tag_format_old'] |
| 294 | - ); |
|
| 295 | - $form['boinc_scheduler_tag_format_new'] = array( |
|
| 294 | + ); |
|
| 295 | + $form['boinc_scheduler_tag_format_new'] = array( |
|
| 296 | 296 | '#type' => 'checkbox', |
| 297 | 297 | '#title' => t('New format (@link tag)', array('@link' => '<link>')), |
| 298 | 298 | '#default_value' => $default['boinc_scheduler_tag_format_new'] |
| 299 | - ); |
|
| 299 | + ); |
|
| 300 | 300 | |
| 301 | - return system_settings_form($form); |
|
| 301 | + return system_settings_form($form); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | - * Validate the BOINC scheduler form. |
|
| 306 | - */ |
|
| 305 | + * Validate the BOINC scheduler form. |
|
| 306 | + */ |
|
| 307 | 307 | function boincuser_admin_scheduler_validate($form, &$form_state) { |
| 308 | - $values = $form_state['values']; |
|
| 309 | - if (!$values['boinc_scheduler_urls']) { |
|
| 308 | + $values = $form_state['values']; |
|
| 309 | + if (!$values['boinc_scheduler_urls']) { |
|
| 310 | 310 | form_set_error('boinc_scheduler_urls', t('At least one scheduling server |
| 311 | 311 | URL must be specified.')); |
| 312 | - } |
|
| 313 | - else { |
|
| 312 | + } |
|
| 313 | + else { |
|
| 314 | 314 | $urls = explode("\r\n", $values['boinc_scheduler_urls']); |
| 315 | 315 | foreach ($urls as $key => $url) { |
| 316 | - if (!$url) { |
|
| 316 | + if (!$url) { |
|
| 317 | 317 | unset($urls[$key]); |
| 318 | 318 | continue; |
| 319 | - } |
|
| 320 | - if (!filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 319 | + } |
|
| 320 | + if (!filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 321 | 321 | form_set_error('boinc_scheduler_urls', t('@url is not a valid URL |
| 322 | 322 | format.', array('@url' => $url))); |
| 323 | 323 | break; |
| 324 | - } |
|
| 324 | + } |
|
| 325 | 325 | } |
| 326 | 326 | $form_state['values']['boinc_scheduler_urls'] = implode("\r\n", $urls); |
| 327 | - } |
|
| 327 | + } |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
| 331 | - * Handle post-validation submission of BOINC scheduler form. |
|
| 332 | - */ |
|
| 331 | + * Handle post-validation submission of BOINC scheduler form. |
|
| 332 | + */ |
|
| 333 | 333 | function boincuser_admin_scheduler_submit($form, &$form_state) { |
| 334 | - drupal_set_message(t('BOINC scheduling server settings have been updated.')); |
|
| 334 | + drupal_set_message(t('BOINC scheduling server settings have been updated.')); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | |
| 338 | 338 | /** |
| 339 | - * Drupal-BOINC Web site related options. |
|
| 340 | - */ |
|
| 339 | + * Drupal-BOINC Web site related options. |
|
| 340 | + */ |
|
| 341 | 341 | function boincuser_admin_weboptions(&$form_state) { |
| 342 | - global $base_url; |
|
| 343 | - $form = array(); |
|
| 342 | + global $base_url; |
|
| 343 | + $form = array(); |
|
| 344 | 344 | |
| 345 | - //form defaults |
|
| 346 | - $default = array( |
|
| 345 | + //form defaults |
|
| 346 | + $default = array( |
|
| 347 | 347 | 'boinc_weboptions_enableaccountcreateRPC' => variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE), |
| 348 | 348 | 'boinc_weboptions_registrationtitle' => variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), |
| 349 | 349 | 'boinc_weboptions_termsofuse' => variable_get('boinc_weboptions_termsofuse', ''), |
@@ -357,65 +357,65 @@ discard block |
||
| 357 | 357 | 'boinc_weboptions_rulespolicies' => variable_get('boinc_weboptions_rulespolicies', ''), |
| 358 | 358 | 'boinc_other_frontpage' => variable_get('boinc_other_frontpage', ''), |
| 359 | 359 | 'boinc_weboptions_blacklisted_usernames' => variable_get('boinc_weboptions_blacklisted_usernames', "admin\nadministrator\nmoderator"), |
| 360 | - ); |
|
| 360 | + ); |
|
| 361 | 361 | |
| 362 | - // Define the form |
|
| 363 | - $form['registrationtitle'] = array( |
|
| 362 | + // Define the form |
|
| 363 | + $form['registrationtitle'] = array( |
|
| 364 | 364 | '#value' => '<h3>BOINC Registration</h3>', |
| 365 | - ); |
|
| 365 | + ); |
|
| 366 | 366 | |
| 367 | - $form['boinc_weboptions_enableaccountcreateRPC'] = array( |
|
| 367 | + $form['boinc_weboptions_enableaccountcreateRPC'] = array( |
|
| 368 | 368 | '#type' => 'checkbox', |
| 369 | 369 | '#title' => t('Enable create_account.php RPC'), |
| 370 | 370 | '#default_value' => $default['boinc_weboptions_enableaccountcreateRPC'], |
| 371 | 371 | '#description' => t('If checked, users will be able to create an account remotely using the create_account.php RPC. This option is independent of the user regsitration option found in ') . l(t('User management -> User settings'), '/admin/user/settings') . '. If enabled, user <b>may not be able to see and agree to the terms-of-use</b> to your site\'s privacy and data retention policies!', |
| 372 | - ); |
|
| 372 | + ); |
|
| 373 | 373 | |
| 374 | - $form['boinc_weboptions_registrationtitle'] = array( |
|
| 374 | + $form['boinc_weboptions_registrationtitle'] = array( |
|
| 375 | 375 | '#type' => 'textfield', |
| 376 | 376 | '#title' => t('Title of regsistration page'), |
| 377 | 377 | '#description' => t('Title text presented above the terms of use text.'), |
| 378 | 378 | '#default_value' => $default['boinc_weboptions_registrationtitle'], |
| 379 | - ); |
|
| 379 | + ); |
|
| 380 | 380 | |
| 381 | - $form['boinc_weboptions_termsofuse'] = array( |
|
| 381 | + $form['boinc_weboptions_termsofuse'] = array( |
|
| 382 | 382 | '#type' => 'textarea', |
| 383 | 383 | '#title' => t('Terms of Use Message for User Registration Page'), |
| 384 | 384 | '#default_value' => $default['boinc_weboptions_termsofuse'], |
| 385 | 385 | '#cols' => 60, |
| 386 | 386 | '#rows' => 8, |
| 387 | 387 | '#description' => t('Text to be displayed on site\'s user registration page. Privacy policy and other data retention information goes here. If empty, there will be no terms of use message, and the title above and checkbox below will not be shown.'), |
| 388 | - ); |
|
| 388 | + ); |
|
| 389 | 389 | |
| 390 | - $form['boinc_weboptions_overrideboinctou'] = array( |
|
| 390 | + $form['boinc_weboptions_overrideboinctou'] = array( |
|
| 391 | 391 | '#type' => 'checkbox', |
| 392 | 392 | '#title' => t('Override BOINC terms of use.'), |
| 393 | 393 | '#default_value' => $default['boinc_weboptions_overrideboinctou'], |
| 394 | 394 | '#description' => t('Override the BOINC terms_of_use.txt file for get_profject_config.php RPC. If TRUE, the get_project_config.php RPC will use the above terms of use text entered above. Otherwise, the original terms_of_use.txt text file in the project directory is used. And you will need to be responsible for keeping both the text file and the above terms of use text up-to-date and in sync with each other.'), |
| 395 | - ); |
|
| 395 | + ); |
|
| 396 | 396 | |
| 397 | - $form['boinc_weboptions_agreequestion'] = array( |
|
| 397 | + $form['boinc_weboptions_agreequestion'] = array( |
|
| 398 | 398 | '#type' => 'textfield', |
| 399 | 399 | '#title' => t('Terms of use agreement question'), |
| 400 | 400 | '#description' => t('This text is presented to the user as the question next to the \'I agree\' checkbox.'), |
| 401 | 401 | '#default_value' => $default['boinc_weboptions_agreequestion'], |
| 402 | - ); |
|
| 402 | + ); |
|
| 403 | 403 | |
| 404 | - $form['boinc_weboptions_registrationtitle2'] = array( |
|
| 404 | + $form['boinc_weboptions_registrationtitle2'] = array( |
|
| 405 | 405 | '#type' => 'textfield', |
| 406 | 406 | '#title' => t('Instructions for username/email/password questions'), |
| 407 | 407 | '#description' => t('Title text presented below terms of use and above username/email/password textfields.'), |
| 408 | 408 | '#default_value' => $default['boinc_weboptions_registrationtitle2'], |
| 409 | - ); |
|
| 409 | + ); |
|
| 410 | 410 | |
| 411 | - $form['boinc_weboptions_existinguser_tou'] = array( |
|
| 411 | + $form['boinc_weboptions_existinguser_tou'] = array( |
|
| 412 | 412 | '#type' => 'checkbox', |
| 413 | 413 | '#title' => t('Are existing users forced to agree to the Terms of Use?'), |
| 414 | 414 | '#default_value' => $default['boinc_weboptions_existinguser_tou'], |
| 415 | 415 | '#description' => t('If TRUE, existing users are forced to agree to a terms of use (if present) when the login and the system has detected they have not agreed. Otherwise they may login as normal. This option has no affect on whether or not new users must agree to the terms of use.'), |
| 416 | - ); |
|
| 416 | + ); |
|
| 417 | 417 | |
| 418 | - $form['boinc_weboptions_pathstoignore'] = array( |
|
| 418 | + $form['boinc_weboptions_pathstoignore'] = array( |
|
| 419 | 419 | '#type' => 'textarea', |
| 420 | 420 | '#title' => t('Paths to ignore the Terms of Use page'), |
| 421 | 421 | '#default_value' => $default['boinc_weboptions_pathstoignore'], |
@@ -424,80 +424,80 @@ discard block |
||
| 424 | 424 | '#description' => t('A list of Drupal URLs/paths to ignore for Terms of Use (ToU). If the option above \'Are existing users forced to agree to the Terms of Use?\' is activated, then some paths need to be ignored when checking if a user has agreed to the ToU. A good example is the logout path, "logout", or else users will not be able to logout! |
| 425 | 425 | <p>There is a default list of paths that must be ignored or else the site will not function. They are not included in this box. Here you may provide additional paths to be ignored, for example the privacy policy page may be accessible so that users may read it before agreeing to the site\'s ToU. |
| 426 | 426 | <p>Paths should be entered one per line. All paths should be <em>lower-case</em> and should not include a leading \'/\'. Example: account/info/edit will allow the user to visit ' . $base_url . '/account/info/edit without first agreeing to the ToU. Regexp are allowed. Example: account/* will allow the user to visit any path starting with ' . $base_url . '/account/.'), |
| 427 | - ); |
|
| 427 | + ); |
|
| 428 | 428 | |
| 429 | - $form['pathtitle'] = array( |
|
| 429 | + $form['pathtitle'] = array( |
|
| 430 | 430 | '#value' => '<h3>Path Options</h3>', |
| 431 | - ); |
|
| 431 | + ); |
|
| 432 | 432 | |
| 433 | - $form['boinc_weboptions_accountfinish'] = array ( |
|
| 433 | + $form['boinc_weboptions_accountfinish'] = array ( |
|
| 434 | 434 | '#type' => 'textfield', |
| 435 | 435 | '#title' => t('Path to a custom account_finish.php page, should be a path to a node'), |
| 436 | 436 | '#description' => t('Provide a path to a node which will serve as your site\'s landing page for users create an account using the BOINC client manager. They will be directed to this page after the account is created. If blank, a default account_finish page will be used.<br>Examples: account_finish, content/welcome, node/123'), |
| 437 | 437 | '#default_value' => $default['boinc_weboptions_accountfinish'], |
| 438 | - ); |
|
| 439 | - $form['boinc_weboptions_moderationpage'] = array ( |
|
| 438 | + ); |
|
| 439 | + $form['boinc_weboptions_moderationpage'] = array ( |
|
| 440 | 440 | '#type' => 'textfield', |
| 441 | 441 | '#title' => t('Path to the site\'s content moderation info page, should be a path to a node'), |
| 442 | 442 | '#description' => t('Provide a path to a node which will serve as your site\'s page for account/content moderation information. This will be used on the default account_finish page. If blank, no link to a moderation page will be provided. If a path is provided to the custom account_finish.php page (above), this field will be ignored.<br>Examples: moderation, content/moderation, node/456'), |
| 443 | 443 | '#default_value' => $default['boinc_weboptions_moderationpage'], |
| 444 | - ); |
|
| 445 | - $form['boinc_weboptions_rulespolicies'] = array ( |
|
| 444 | + ); |
|
| 445 | + $form['boinc_weboptions_rulespolicies'] = array ( |
|
| 446 | 446 | '#type' => 'textfield', |
| 447 | 447 | '#title' => t('Path to the site\'s rule and policies page, should be a path to a node'), |
| 448 | 448 | '#description' => t('Provide a path to a node which will serve as your site\'s rules and policies page. This will be used on the Join page shown to new users. If blank, no link to a rules and policies page will be provided.<br>Examples: rules-and-policies, node/789'), |
| 449 | 449 | '#default_value' => $default['boinc_weboptions_rulespolicies'], |
| 450 | - ); |
|
| 451 | - $form['boinc_other_frontpage'] = array ( |
|
| 450 | + ); |
|
| 451 | + $form['boinc_other_frontpage'] = array ( |
|
| 452 | 452 | '#type' => 'textarea', |
| 453 | 453 | '#title' => bts('Message for site\'s Home Page', array(), NULL, 'boinc:admin-boinc-other-options'), |
| 454 | 454 | '#default_value' => $default['boinc_other_frontpage'], |
| 455 | 455 | '#cols' => 60, |
| 456 | 456 | '#rows' => 8, |
| 457 | 457 | '#description' => bts('Text to be displayed on the site\'s Home landing page.', array(), NULL, 'boinc:admin-boinc-other-options'), |
| 458 | - ); |
|
| 458 | + ); |
|
| 459 | 459 | |
| 460 | - $form['Othertitle'] = array( |
|
| 460 | + $form['Othertitle'] = array( |
|
| 461 | 461 | '#value' => '<h3>Other Options</h3>', |
| 462 | - ); |
|
| 462 | + ); |
|
| 463 | 463 | |
| 464 | - $form['boinc_weboptions_blacklisted_usernames'] = array ( |
|
| 464 | + $form['boinc_weboptions_blacklisted_usernames'] = array ( |
|
| 465 | 465 | '#type' => 'textarea', |
| 466 | 466 | '#title' => t('BOINC username blacklist'), |
| 467 | 467 | '#default_value' => $default['boinc_weboptions_blacklisted_usernames'], |
| 468 | 468 | '#cols' => 60, |
| 469 | 469 | '#rows' => 7, |
| 470 | 470 | '#description' => t('Username blacklist: List of names that users will not be able to choose as their BOINC username. This will only affect Web registration and when a user changes their name using the Web site. Names should be entered one per line.<p>All names should be <em>lower-case</em>. The comparison made is case-insensitive.<p>If you wish to <em>disable</em> this feature, remove all names from this textbox; the blacklist will be empty.'), |
| 471 | - ); |
|
| 471 | + ); |
|
| 472 | 472 | |
| 473 | - return system_settings_form($form); |
|
| 473 | + return system_settings_form($form); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
| 477 | - * Validate BOINC other form |
|
| 478 | - */ |
|
| 477 | + * Validate BOINC other form |
|
| 478 | + */ |
|
| 479 | 479 | function boincuser_admin_weboptions_validate($form, &$form_state) { |
| 480 | - $values = $form_state['values']; |
|
| 480 | + $values = $form_state['values']; |
|
| 481 | 481 | |
| 482 | - $accountfinish = $values['boinc_weboptions_accountfinish']; |
|
| 483 | - if ( ($accountfinish) AND (!drupal_lookup_path('source', $accountfinish)) ) { |
|
| 482 | + $accountfinish = $values['boinc_weboptions_accountfinish']; |
|
| 483 | + if ( ($accountfinish) AND (!drupal_lookup_path('source', $accountfinish)) ) { |
|
| 484 | 484 | form_set_error('boinc weboptions_accountfinish', t('Path to custom account finish page not found. Please provide a valid path, or leave blank to unset.')); |
| 485 | - } |
|
| 485 | + } |
|
| 486 | 486 | |
| 487 | - $moderationpage = $values['boinc_weboptions_moderationpage']; |
|
| 488 | - if ( ($moderationpage) AND (!drupal_lookup_path('source', $moderationpage)) ) { |
|
| 487 | + $moderationpage = $values['boinc_weboptions_moderationpage']; |
|
| 488 | + if ( ($moderationpage) AND (!drupal_lookup_path('source', $moderationpage)) ) { |
|
| 489 | 489 | form_set_error('boinc weboptions_moderationpage', t('Path to moderation page not found. Please provide a valid path, or leave blank to unset.')); |
| 490 | - } |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - $rulespolicies = $values['boinc_weboptions_rulespolicies']; |
|
| 493 | - if ( ($rulespolicies) AND (!drupal_lookup_path('source', $rulespolicies)) ) { |
|
| 492 | + $rulespolicies = $values['boinc_weboptions_rulespolicies']; |
|
| 493 | + if ( ($rulespolicies) AND (!drupal_lookup_path('source', $rulespolicies)) ) { |
|
| 494 | 494 | form_set_error('boinc weboptions_rulespolicies', t('Path to rules and policies page not found. Please provide a valid path, or leave blank to unset.')); |
| 495 | - } |
|
| 495 | + } |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /** |
| 499 | - * Submit BOINC other form |
|
| 500 | - */ |
|
| 499 | + * Submit BOINC other form |
|
| 500 | + */ |
|
| 501 | 501 | function boincuser_admin_weboptions_submit($form, &$form_state) { |
| 502 | - drupal_set_message( bts("Status: Drupa-BOINC Web site options have been updated", array(), NULL, 'boinc:admin-boinc-website-options') ); |
|
| 502 | + drupal_set_message( bts("Status: Drupa-BOINC Web site options have been updated", array(), NULL, 'boinc:admin-boinc-website-options') ); |
|
| 503 | 503 | } |
@@ -15,42 +15,42 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | function boinc_settings($saved_settings) { |
| 17 | 17 | |
| 18 | - // Get the default values from the .info file. |
|
| 19 | - $defaults = zen_theme_get_default_settings('boinc'); |
|
| 18 | + // Get the default values from the .info file. |
|
| 19 | + $defaults = zen_theme_get_default_settings('boinc'); |
|
| 20 | 20 | |
| 21 | - // Merge the saved variables and their default values. |
|
| 22 | - $settings = array_merge($defaults, $saved_settings); |
|
| 21 | + // Merge the saved variables and their default values. |
|
| 22 | + $settings = array_merge($defaults, $saved_settings); |
|
| 23 | 23 | |
| 24 | - /* |
|
| 24 | + /* |
|
| 25 | 25 | * Create the form using Forms API: http://api.drupal.org/api/6 |
| 26 | 26 | */ |
| 27 | - $form = array(); |
|
| 28 | - $form['boinc_stats_charts'] = array( |
|
| 27 | + $form = array(); |
|
| 28 | + $form['boinc_stats_charts'] = array( |
|
| 29 | 29 | '#type' => 'fieldset', |
| 30 | 30 | '#title' => t('Chart settings'), |
| 31 | 31 | '#attributes' => array( |
| 32 | - 'class' => 'zen-settings', |
|
| 32 | + 'class' => 'zen-settings', |
|
| 33 | 33 | ), |
| 34 | - ); |
|
| 35 | - $form['boinc_stats_charts']['boinc_stats_chart_color'] = array( |
|
| 34 | + ); |
|
| 35 | + $form['boinc_stats_charts']['boinc_stats_chart_color'] = array( |
|
| 36 | 36 | '#type' => 'textfield', |
| 37 | 37 | '#title' => t('Chart color'), |
| 38 | 38 | '#default_value' => $settings['boinc_stats_chart_color'], |
| 39 | 39 | '#description' => t('The primary color of the stats chart in hex format (e.g. #FAA341).'), |
| 40 | - ); |
|
| 41 | - $form['boinc_stats_charts']['boinc_stats_chart_bcolor'] = array( |
|
| 40 | + ); |
|
| 41 | + $form['boinc_stats_charts']['boinc_stats_chart_bcolor'] = array( |
|
| 42 | 42 | '#type' => 'textfield', |
| 43 | 43 | '#title' => t('Chart background color'), |
| 44 | 44 | '#default_value' => $settings['boinc_stats_chart_bcolor'], |
| 45 | 45 | '#description' => t('The background color of the stats chart in hex format (e.g. #FFFFFF).'), |
| 46 | - ); |
|
| 46 | + ); |
|
| 47 | 47 | |
| 48 | - // Add the base theme's settings. |
|
| 49 | - $form += zen_settings($saved_settings, $defaults); |
|
| 48 | + // Add the base theme's settings. |
|
| 49 | + $form += zen_settings($saved_settings, $defaults); |
|
| 50 | 50 | |
| 51 | - // Remove some of the base theme's settings. |
|
| 52 | - unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
| 51 | + // Remove some of the base theme's settings. |
|
| 52 | + unset($form['themedev']['zen_layout']); // We don't need to select the base stylesheet. |
|
| 53 | 53 | |
| 54 | - // Return the form |
|
| 55 | - return $form; |
|
| 54 | + // Return the form |
|
| 55 | + return $form; |
|
| 56 | 56 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | // $Id: theme-settings.php,v 1.7 2008/09/11 09:36:50 johnalbin Exp $ |
| 3 | 3 | |
| 4 | 4 | // Include the definition of zen_settings() and zen_theme_get_default_settings(). |
| 5 | -include_once './' . drupal_get_path('theme', 'zen') . '/theme-settings.php'; |
|
| 5 | +include_once './'.drupal_get_path('theme', 'zen').'/theme-settings.php'; |
|
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | /** |
@@ -4,34 +4,34 @@ |
||
| 4 | 4 | * Implementation of hook_strongarm(). |
| 5 | 5 | */ |
| 6 | 6 | function internationalization_strongarm() { |
| 7 | - $export = array(); |
|
| 7 | + $export = array(); |
|
| 8 | 8 | |
| 9 | - $strongarm = new stdClass; |
|
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | - $strongarm->api_version = 1; |
|
| 12 | - $strongarm->name = 'i18nstrings_allowed_formats'; |
|
| 13 | - $strongarm->value = array( |
|
| 9 | + $strongarm = new stdClass; |
|
| 10 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | + $strongarm->api_version = 1; |
|
| 12 | + $strongarm->name = 'i18nstrings_allowed_formats'; |
|
| 13 | + $strongarm->value = array( |
|
| 14 | 14 | 0 => 4, |
| 15 | 15 | 1 => 5, |
| 16 | - ); |
|
| 17 | - $export['i18nstrings_allowed_formats'] = $strongarm; |
|
| 16 | + ); |
|
| 17 | + $export['i18nstrings_allowed_formats'] = $strongarm; |
|
| 18 | 18 | |
| 19 | - $strongarm = new stdClass; |
|
| 20 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 21 | - $strongarm->api_version = 1; |
|
| 22 | - $strongarm->name = 'i18ntaxonomy_vocabulary'; |
|
| 23 | - $strongarm->value = array( |
|
| 19 | + $strongarm = new stdClass; |
|
| 20 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 21 | + $strongarm->api_version = 1; |
|
| 22 | + $strongarm->name = 'i18ntaxonomy_vocabulary'; |
|
| 23 | + $strongarm->value = array( |
|
| 24 | 24 | 2 => '1', |
| 25 | 25 | 1 => '0', |
| 26 | - ); |
|
| 27 | - $export['i18ntaxonomy_vocabulary'] = $strongarm; |
|
| 26 | + ); |
|
| 27 | + $export['i18ntaxonomy_vocabulary'] = $strongarm; |
|
| 28 | 28 | |
| 29 | - $strongarm = new stdClass; |
|
| 30 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 31 | - $strongarm->api_version = 1; |
|
| 32 | - $strongarm->name = 'language_negotiation'; |
|
| 33 | - $strongarm->value = '2'; |
|
| 34 | - $export['language_negotiation'] = $strongarm; |
|
| 29 | + $strongarm = new stdClass; |
|
| 30 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 31 | + $strongarm->api_version = 1; |
|
| 32 | + $strongarm->name = 'language_negotiation'; |
|
| 33 | + $strongarm->value = '2'; |
|
| 34 | + $export['language_negotiation'] = $strongarm; |
|
| 35 | 35 | |
| 36 | - return $export; |
|
| 36 | + return $export; |
|
| 37 | 37 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | $export = array(); |
| 8 | 8 | |
| 9 | 9 | $strongarm = new stdClass; |
| 10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 10 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 11 | 11 | $strongarm->api_version = 1; |
| 12 | 12 | $strongarm->name = 'i18nstrings_allowed_formats'; |
| 13 | 13 | $strongarm->value = array( |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $export['i18nstrings_allowed_formats'] = $strongarm; |
| 18 | 18 | |
| 19 | 19 | $strongarm = new stdClass; |
| 20 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 20 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 21 | 21 | $strongarm->api_version = 1; |
| 22 | 22 | $strongarm->name = 'i18ntaxonomy_vocabulary'; |
| 23 | 23 | $strongarm->value = array( |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $export['i18ntaxonomy_vocabulary'] = $strongarm; |
| 28 | 28 | |
| 29 | 29 | $strongarm = new stdClass; |
| 30 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 30 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
| 31 | 31 | $strongarm->api_version = 1; |
| 32 | 32 | $strongarm->name = 'language_negotiation'; |
| 33 | 33 | $strongarm->value = '2'; |