@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | break; |
| 139 | 139 | default: |
| 140 | 140 | end($page_list); |
| 141 | - $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)]; |
|
| 141 | + $page_list[key($page_list)] = 'and '.$page_list[key($page_list)]; |
|
| 142 | 142 | $page_list = implode(', ', $page_list); |
| 143 | 143 | } |
| 144 | 144 | drupal_set_message(t('Default content has been generated for the @listed |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | 'type' => 'page', |
| 196 | 196 | 'title' => t('Help'), |
| 197 | 197 | 'uid' => 1, |
| 198 | - 'status' => 1, // published |
|
| 198 | + 'status' => 1, // published |
|
| 199 | 199 | 'promote' => 0, // not promoted to front page |
| 200 | 200 | 'path' => 'help', |
| 201 | 201 | 'pathauto_perform_alias' => FALSE, |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | 'format' => 4, |
| 217 | 217 | //'teaser' => $teaser, |
| 218 | 218 | ); |
| 219 | - $node = (object) $node; // node_save requires an object |
|
| 219 | + $node = (object)$node; // node_save requires an object |
|
| 220 | 220 | node_save($node); |
| 221 | 221 | |
| 222 | 222 | $item = array( |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | 'type' => 'page', |
| 238 | 238 | 'title' => t('Rules and Policies'), |
| 239 | 239 | 'uid' => 1, |
| 240 | - 'status' => 1, // published |
|
| 240 | + 'status' => 1, // published |
|
| 241 | 241 | 'promote' => 0, // not promoted to front page |
| 242 | 242 | 'path' => 'rules-and-policies', |
| 243 | 243 | 'pathauto_perform_alias' => FALSE, |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | 'format' => 4, |
| 252 | 252 | //'teaser' => $teaser, |
| 253 | 253 | ); |
| 254 | - $node = (object) $node; // node_save requires an object |
|
| 254 | + $node = (object)$node; // node_save requires an object |
|
| 255 | 255 | node_save($node); |
| 256 | 256 | |
| 257 | 257 | // Create menu item to node |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | 'type' => 'page', |
| 274 | 274 | 'title' => t('Moderation'), |
| 275 | 275 | 'uid' => 1, |
| 276 | - 'status' => 1, // published |
|
| 276 | + 'status' => 1, // published |
|
| 277 | 277 | 'promote' => 0, // not promoted to front page |
| 278 | 278 | 'path' => 'moderation', |
| 279 | 279 | 'pathauto_perform_alias' => FALSE, |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | 'format' => 4, |
| 288 | 288 | //'teaser' => $teaser, |
| 289 | 289 | ); |
| 290 | - $node = (object) $node; // node_save requires an object |
|
| 290 | + $node = (object)$node; // node_save requires an object |
|
| 291 | 291 | node_save($node); |
| 292 | 292 | |
| 293 | 293 | // Create menu item to node |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | function boinc_solr_search_block_view($delta = 0) { |
| 54 | 54 | $block = array(); |
| 55 | - switch($delta) { |
|
| 55 | + switch ($delta) { |
|
| 56 | 56 | case 'boinc_solr_search_0': |
| 57 | 57 | $items = array( |
| 58 | 58 | bts('By default a search matches ANY search term. Results with more than one term will be presented higher in the search results.', array(), NULL, 'boinc:search-help-sidebar-block'), |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | // Build confirm form from elements, depending on node type. |
| 19 | - $description = bts('This action cannot be undone.', array(), NULL, 'boinc:delete-node'); |
|
| 19 | + $description = bts('This action cannot be undone.', array(), NULL, 'boinc:delete-node'); |
|
| 20 | 20 | $no = bts('Cancel', array(), NULL, 'boinc:form-cancel'); |
| 21 | 21 | |
| 22 | - switch($node->type) { |
|
| 22 | + switch ($node->type) { |
|
| 23 | 23 | case 'profile': |
| 24 | 24 | $question = bts('Are you sure you want to clear your profile?', array(), NULL, 'boinc:delete-node'); |
| 25 | 25 | $path = isset($_GET['destination']) ? $_GET['destination'] : 'account'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | default: |
| 30 | 30 | $question = bts('Are you sure you want to Delete %title?', array('%title' => $node->title), NULL, 'boinc:delete-node'); |
| 31 | - $path = isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid; |
|
| 31 | + $path = isset($_GET['destination']) ? $_GET['destination'] : 'node/'.$node->nid; |
|
| 32 | 32 | $yes = bts('Delete', array(), NULL, 'boinc:form-delete'); |
| 33 | 33 | } |
| 34 | 34 | return confirm_form($form, $question, $path, $description, $yes, $no); |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * Callback admin/boinc/import/settings |
| 6 | 6 | */ |
| 7 | 7 | function boincimport_admin_settings() { |
| 8 | - global $conf ; |
|
| 8 | + global $conf; |
|
| 9 | 9 | global $db_url; |
| 10 | 10 | global $base_url; |
| 11 | 11 | $stage = variable_get('boincimport_config_stage', 0); |
@@ -27,17 +27,17 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $output = ''; |
| 29 | 29 | if (!variable_get('boincimport_tested', 0)) { |
| 30 | - $form['test']['#collapsed']= FALSE; |
|
| 30 | + $form['test']['#collapsed'] = FALSE; |
|
| 31 | 31 | $output = '<span class="marker">'; |
| 32 | 32 | $ready_for_migration = 0; |
| 33 | 33 | } |
| 34 | - $output .= '<p>' . t('The migration will modify and even destroy some data. You |
|
| 34 | + $output .= '<p>'.t('The migration will modify and even destroy some data. You |
|
| 35 | 35 | must test this module on a copy of your data first, several times if necessary. |
| 36 | 36 | Only use this module on your live data when you are familiar with the procedure |
| 37 | - and you\'re confident everything will run smoothly.') . '</p><p>' . t('Also, you |
|
| 37 | + and you\'re confident everything will run smoothly.').'</p><p>'.t('Also, you |
|
| 38 | 38 | should make a full backup of your database just prior to performing the |
| 39 | 39 | migration on the live data. It is better to turn off both the BOINC site and the |
| 40 | - Drupal site during the migration.') . '</p>'; |
|
| 40 | + Drupal site during the migration.').'</p>'; |
|
| 41 | 41 | if (!variable_get('boincimport_tested', 0)) { |
| 42 | 42 | $output .= '</span>'; |
| 43 | 43 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | // Where is BOINC data? |
| 57 | 57 | $pre = variable_get('boincimport_table_prefix', ''); |
| 58 | - $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user'); |
|
| 58 | + $tables = array($pre.'forum', $pre.'post', $pre.'thread', $pre.'user'); |
|
| 59 | 59 | $db = (is_array($db_url) AND isset($db_url['boinc_rw'])) ? 'boinc_rw' : 'default'; |
| 60 | 60 | $result = _boincimport_check_tables($tables, $db, 0); |
| 61 | 61 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | $default_db_url = is_array($db_url) ? end($db_url) : $db_url; |
| 80 | 80 | $url = variable_get('boincimport_db_url', $default_db_url); |
| 81 | 81 | if (!preg_match('{(mysql|pgsql):\/\/(.+):(.*?)@(.+)/(\w+)}i', $url)) { |
| 82 | - $output = '<p class="marker">'. t('Set the address of the BOINC database |
|
| 83 | - according to the following format:') . '<br /><pre> |
|
| 82 | + $output = '<p class="marker">'.t('Set the address of the BOINC database |
|
| 83 | + according to the following format:').'<br /><pre> |
|
| 84 | 84 | mysql://boinc_username:boinc_password@localhost/boinc_database |
| 85 | 85 | </pre></p>'; |
| 86 | 86 | $ready_for_migration = 0; |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $output = '<p>' . t('Note that due to a limitation within Drupal core, we cannot |
|
| 101 | + $output = '<p>'.t('Note that due to a limitation within Drupal core, we cannot |
|
| 102 | 102 | import messages from one database type to another database type. E.g, we |
| 103 | 103 | cannot import BOINC from a myqsl DB, to a postgresql DB. You need to import |
| 104 | 104 | the data into the same type of database first (import all the BOINC data, as is, |
| 105 | - from mysql to postgresql).') . '</p><p>' . t('If both BOINC and Drupal are on |
|
| 105 | + from mysql to postgresql).').'</p><p>'.t('If both BOINC and Drupal are on |
|
| 106 | 106 | postgresql, see !this_issue.', array('!this_issue' => l(t('this issue'), |
| 107 | - 'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))) . '</p>'; |
|
| 107 | + 'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))).'</p>'; |
|
| 108 | 108 | $form['boinc_data']['note'] = array('#value' => $output); |
| 109 | 109 | |
| 110 | 110 | // BOINC table prefix |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $output = $result['html']; |
| 122 | 122 | if ($result['result'] != 1) { |
| 123 | 123 | $ready_for_migration = 0; |
| 124 | - $form['boinc_data']['#collapsed']= FALSE; |
|
| 124 | + $form['boinc_data']['#collapsed'] = FALSE; |
|
| 125 | 125 | $output .= '<span class="marker">'; |
| 126 | 126 | $output .= t('Some tables couldn\'t be found. Are the database settings correct? |
| 127 | 127 | Please correct the errors so that the BOINC tables can be accessed.'); |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | '#collapsible' => TRUE, |
| 170 | 170 | '#collapsed' => TRUE |
| 171 | 171 | ); |
| 172 | - $output = '<p>'. t('Select which !input_format should be used for the imported |
|
| 172 | + $output = '<p>'.t('Select which !input_format should be used for the imported |
|
| 173 | 173 | messages. It is highly-recommended that this value be left as it is, as the |
| 174 | 174 | Full HTML and PHP code formats can be very dangerous!', |
| 175 | - array('!input_format' => l(t('input format'), 'admin/settings/filters'))) .'</p>'; |
|
| 175 | + array('!input_format' => l(t('input format'), 'admin/settings/filters'))).'</p>'; |
|
| 176 | 176 | $form['input']['intro'] = array('#value' => $output); |
| 177 | 177 | |
| 178 | 178 | $formats = db_query('SELECT format, name FROM {filter_formats}'); |
| 179 | 179 | while ($format = db_fetch_array($formats)) { |
| 180 | - $input_formats[$format['format']]= $format['name']; |
|
| 180 | + $input_formats[$format['format']] = $format['name']; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // By default, use the format named "Rich text"; fall back to Filtered HTML |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | ); |
| 195 | 195 | if (!$input_format) { |
| 196 | 196 | $ready_for_migration = 0; |
| 197 | - $form['input']['#collapsed']= FALSE; |
|
| 197 | + $form['input']['#collapsed'] = FALSE; |
|
| 198 | 198 | } |
| 199 | - $output = '<p><em>'. t('This setting will be applied to all posts and private |
|
| 200 | - messages.') .'</em></p>'; |
|
| 199 | + $output = '<p><em>'.t('This setting will be applied to all posts and private |
|
| 200 | + messages.').'</em></p>'; |
|
| 201 | 201 | $form['input']['result'] = array('#value' => $output); |
| 202 | 202 | |
| 203 | 203 | // BBcode settings |
@@ -208,23 +208,23 @@ discard block |
||
| 208 | 208 | '#collapsed' => TRUE, |
| 209 | 209 | ); |
| 210 | 210 | |
| 211 | - $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the |
|
| 212 | - import process, BBcode can be handled in two diffent ways') . ':</p>'; |
|
| 213 | - $output .= '<ul><li>' . t('Leave the BBcode as is and use the !bbcode_module |
|
| 211 | + $output = '<p>'.t('BOINC posts are often formatted in BBcode. During the |
|
| 212 | + import process, BBcode can be handled in two diffent ways').':</p>'; |
|
| 213 | + $output .= '<ul><li>'.t('Leave the BBcode as is and use the !bbcode_module |
|
| 214 | 214 | after the migration to filter the imported posts. In this case, the module |
| 215 | 215 | is not required during the migration, but will need to be installed and |
| 216 | 216 | configured later.', |
| 217 | 217 | array('!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', |
| 218 | - array('attributes' => array('target' => '_blank'))))) . '</li>'; |
|
| 219 | - $output .= '<li>' . t('Filter the BBcode now and replace it with plain HTML. |
|
| 218 | + array('attributes' => array('target' => '_blank'))))).'</li>'; |
|
| 219 | + $output .= '<li>'.t('Filter the BBcode now and replace it with plain HTML. |
|
| 220 | 220 | The BBcode module will be required during the migration process, but can |
| 221 | - be disabled afterwards.') . '</li></ul>'; |
|
| 222 | - $output .= '<p>' . t('An appropriate input filter should be chosen, as well, |
|
| 221 | + be disabled afterwards.').'</li></ul>'; |
|
| 222 | + $output .= '<p>'.t('An appropriate input filter should be chosen, as well, |
|
| 223 | 223 | as it will affect how the post is displayed. For example, if BBcode is |
| 224 | 224 | removed and replaced by HTML, some HTML tags will be stripped by the |
| 225 | 225 | "Filtered HTML" input format unless they are first added to the list of |
| 226 | 226 | allowed tags in that format. See the !input_formats page.', |
| 227 | - array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))) . '</p>'; |
|
| 227 | + array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))).'</p>'; |
|
| 228 | 228 | |
| 229 | 229 | $form['bbcode']['intro'] = array('#value' => $output); |
| 230 | 230 | $form['bbcode']['boincimport_bbcode'] = array( |
@@ -254,28 +254,28 @@ discard block |
||
| 254 | 254 | $result = db_query($sql, $input_format); |
| 255 | 255 | if (!db_result($result)) { |
| 256 | 256 | $form['bbcode']['#collapsed'] = FALSE; |
| 257 | - $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and |
|
| 257 | + $output .= '<p class="marker">'.t('You need to !enable_bbcode_input and |
|
| 258 | 258 | then !configure_bbcode_options', array( |
| 259 | 259 | '!enable_bbcode_input' => l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"), |
| 260 | - '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) .'</p>'; |
|
| 260 | + '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))).'</p>'; |
|
| 261 | 261 | } |
| 262 | - $output .= '<p>'. t('For best results, !disable_all_options', |
|
| 263 | - array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))) . '.</p>'; |
|
| 262 | + $output .= '<p>'.t('For best results, !disable_all_options', |
|
| 263 | + array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))).'.</p>'; |
|
| 264 | 264 | } else { |
| 265 | 265 | if ($bbcode_disabled) { |
| 266 | 266 | $form['bbcode']['#collapsed'] = FALSE; |
| 267 | - $output .= '<p>'. t('The !bbcode_module is recommended, but not required. |
|
| 267 | + $output .= '<p>'.t('The !bbcode_module is recommended, but not required. |
|
| 268 | 268 | You may !enable_bbcode after having installed it.', array( |
| 269 | 269 | '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))), |
| 270 | - '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))) .'</p>'; |
|
| 270 | + '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))).'</p>'; |
|
| 271 | 271 | } |
| 272 | - $output .= '<p>' . t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array( |
|
| 272 | + $output .= '<p>'.t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array( |
|
| 273 | 273 | '!enable_bbcode_input' => l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"), |
| 274 | - '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) . '</p>'; |
|
| 275 | - $output .= '<p>' . t('You may want to enable it for other input formats, too.') . '</p>'; |
|
| 274 | + '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))).'</p>'; |
|
| 275 | + $output .= '<p>'.t('You may want to enable it for other input formats, too.').'</p>'; |
|
| 276 | 276 | } |
| 277 | - $output .= '<p><em>'. t('This setting will be applied to all posts, private |
|
| 278 | - messages and the users\' signature.') .'</em></p>'; |
|
| 277 | + $output .= '<p><em>'.t('This setting will be applied to all posts, private |
|
| 278 | + messages and the users\' signature.').'</em></p>'; |
|
| 279 | 279 | |
| 280 | 280 | $form['bbcode']['result'] = array('#value' => $output); |
| 281 | 281 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | '#collapsed' => TRUE, |
| 288 | 288 | ); |
| 289 | 289 | if (!variable_get('boincimport_base_url_boinc', 0)) { |
| 290 | - $form['url_transforms']['#collapsed']= FALSE; |
|
| 290 | + $form['url_transforms']['#collapsed'] = FALSE; |
|
| 291 | 291 | $output = '<span class="marker">'; |
| 292 | 292 | $ready_for_migration = 0; |
| 293 | 293 | } |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | ); |
| 321 | 321 | variable_set('boincimport_ready', $ready_for_migration); |
| 322 | 322 | if ($ready_for_migration) { |
| 323 | - $output = '<p>'. t('Check the settings above one more time. If everything |
|
| 324 | - is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))) .'</p>'; |
|
| 323 | + $output = '<p>'.t('Check the settings above one more time. If everything |
|
| 324 | + is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))).'</p>'; |
|
| 325 | 325 | } else { |
| 326 | - $output = '<p class="marker">'. t('You are not ready for the migration yet. |
|
| 327 | - Please check the settings above.') .'</p>'; |
|
| 326 | + $output = '<p class="marker">'.t('You are not ready for the migration yet. |
|
| 327 | + Please check the settings above.').'</p>'; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $form['migration']['info'] = array('#value' => $output); |
@@ -335,23 +335,23 @@ discard block |
||
| 335 | 335 | * Callback admin/boinc/import/post_configuration |
| 336 | 336 | */ |
| 337 | 337 | function boincimport_post_configuration() { |
| 338 | - $output = '<p>'. t('This page will help to tie up any loose ends following |
|
| 338 | + $output = '<p>'.t('This page will help to tie up any loose ends following |
|
| 339 | 339 | the BOINC data import process. Before continuing, it may be best to have |
| 340 | - already:') .'</p>'; |
|
| 340 | + already:').'</p>'; |
|
| 341 | 341 | $output .= '<ul>'; |
| 342 | - $output .= '<li>'. t('Imported users, teams, and forums using the BOINC |
|
| 343 | - import module') .'</li>'; |
|
| 344 | - $output .= '<li>'. t('Imported any additional data using add on modules if |
|
| 345 | - available.') .'</li>'; |
|
| 342 | + $output .= '<li>'.t('Imported users, teams, and forums using the BOINC |
|
| 343 | + import module').'</li>'; |
|
| 344 | + $output .= '<li>'.t('Imported any additional data using add on modules if |
|
| 345 | + available.').'</li>'; |
|
| 346 | 346 | $output .= '</ul>'; |
| 347 | 347 | //User Set up |
| 348 | - $output .= '<h2>'. t('User settings') .'</h2>'; |
|
| 349 | - $output .= '<p>'. t('Make sure your !user_settings are correct. Specifically, |
|
| 348 | + $output .= '<h2>'.t('User settings').'</h2>'; |
|
| 349 | + $output .= '<p>'.t('Make sure your !user_settings are correct. Specifically, |
|
| 350 | 350 | you can enable or disable signatures there. ', array( |
| 351 | 351 | '!user_settings' => l(t('user settings'), 'admin/user/settings') |
| 352 | - )) .'</p>'; |
|
| 353 | - $output .= '<p>' . t('Note that avatar/picture support is not tied to user |
|
| 354 | - settings Picture support at this time.') . '</p>'; |
|
| 352 | + )).'</p>'; |
|
| 353 | + $output .= '<p>'.t('Note that avatar/picture support is not tied to user |
|
| 354 | + settings Picture support at this time.').'</p>'; |
|
| 355 | 355 | /*$output .= '<p>' . t('In order to activate avatar/picture support, you need to |
| 356 | 356 | enable pictures on this page and also:') . '</p>'; |
| 357 | 357 | $output .= '<ul>'; |
@@ -366,15 +366,15 @@ discard block |
||
| 366 | 366 | $output .= '</ul>'; */ |
| 367 | 367 | |
| 368 | 368 | // Forum Set up |
| 369 | - $output .= '<h2>'. t('Forum settings') .'</h2>'; |
|
| 370 | - $output .= '<p>'. t('Check any additional changes to make on the |
|
| 369 | + $output .= '<h2>'.t('Forum settings').'</h2>'; |
|
| 370 | + $output .= '<p>'.t('Check any additional changes to make on the |
|
| 371 | 371 | !forum_settings page.', array( |
| 372 | 372 | '!forum_settings' => l(t('forum settings'), 'admin/content/forum/settings') |
| 373 | - )) .'</p>'; |
|
| 374 | - $output .= '<p>'. t('It also may be a good idea to look at the !forum_list to |
|
| 373 | + )).'</p>'; |
|
| 374 | + $output .= '<p>'.t('It also may be a good idea to look at the !forum_list to |
|
| 375 | 375 | verify that all necessary containers and forums are in place.', array( |
| 376 | 376 | '!forum_list' => l(t('forum list'), 'admin/content/forum') |
| 377 | - )) .'</p>'; |
|
| 377 | + )).'</p>'; |
|
| 378 | 378 | /*$output .= '<p>'. t('If need be, set up the private forums as explained in the |
| 379 | 379 | !documentation.', array( |
| 380 | 380 | '!documentation' => l(t('documentation'), 'http://drupal.org/node/58969', array('attributes' => array('target' => '_blank'))) |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | // BBcode |
| 391 | 391 | $bbcode = variable_get('boincimport_bbcode', 0); |
| 392 | 392 | if ($bbcode) { |
| 393 | - $output .= '<h2>'. t('Remove BBcode module') .'</h2>'; |
|
| 394 | - $output .= '<p>'. t('The BBcode has been cleaned from the posts. You shouldn\'t |
|
| 395 | - need the bbcode module anymore. You can disable it.') .'</p>'; |
|
| 393 | + $output .= '<h2>'.t('Remove BBcode module').'</h2>'; |
|
| 394 | + $output .= '<p>'.t('The BBcode has been cleaned from the posts. You shouldn\'t |
|
| 395 | + need the bbcode module anymore. You can disable it.').'</p>'; |
|
| 396 | 396 | } else { |
| 397 | - $output .= '<h2>'. t('Configure BBcode module') .'</h2>'; |
|
| 398 | - $output .= '<p>'. t('Most likely, there are many BOINC forum postings |
|
| 397 | + $output .= '<h2>'.t('Configure BBcode module').'</h2>'; |
|
| 398 | + $output .= '<p>'.t('Most likely, there are many BOINC forum postings |
|
| 399 | 399 | formatted in BBcode. It would be a good idea to verify that BBcode is |
| 400 | 400 | being formatted correctly in the imported posts. Have a look around |
| 401 | 401 | !the_forum.', array( |
| 402 | 402 | '!the_forum' => l(t('the forum'), 'community') |
| 403 | - )) . '</p>'; |
|
| 403 | + )).'</p>'; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | return $output; |
@@ -445,11 +445,11 @@ discard block |
||
| 445 | 445 | $output .= '</ol>'; |
| 446 | 446 | |
| 447 | 447 | // process will die() if the link to the BOINC database is wrong: |
| 448 | - $output .= '<p>'. t('If the BOINC data is in another database, but you made a |
|
| 448 | + $output .= '<p>'.t('If the BOINC data is in another database, but you made a |
|
| 449 | 449 | mistake while setting up the data base url, you may be unable to access the |
| 450 | 450 | setting page due to some limitations of the core of Drupal. !reset_db_url.', array( |
| 451 | 451 | '!reset_db_url' => l(t('Click here to reset the database url'), 'admin/boinc/import/reset') |
| 452 | - )) .'</p>'; |
|
| 452 | + )).'</p>'; |
|
| 453 | 453 | |
| 454 | 454 | return $output; |
| 455 | 455 | } |
@@ -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 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $post_owner = BoincUser::lookup_id($post->user); |
| 46 | 46 | if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $forum, $logged_in_user) == false)) { |
| 47 | - error_page (tra("You are not authorized to edit this post.")); |
|
| 47 | + error_page(tra("You are not authorized to edit this post.")); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $thread_owner = BoincUser::lookup_id($thread->owner); |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | // (ie. not a response to another post) |
| 54 | 54 | // allow the user to modify the thread title |
| 55 | 55 | // |
| 56 | -$can_edit_title = ($post->parent_post==0 && $thread_owner->id==$logged_in_user->id && !is_banished($logged_in_user)); |
|
| 56 | +$can_edit_title = ($post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user)); |
|
| 57 | 57 | |
| 58 | 58 | $content = post_str("content", true); |
| 59 | 59 | $title = post_str("title", true); |
| 60 | 60 | $preview = post_str("preview", true); |
| 61 | 61 | |
| 62 | -if (post_str('submit',true) && (!$preview)) { |
|
| 62 | +if (post_str('submit', true) && (!$preview)) { |
|
| 63 | 63 | if (POST_MAX_LINKS |
| 64 | 64 | && link_count($content) > POST_MAX_LINKS |
| 65 | 65 | && !is_moderator($logged_in_user, $forum) |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | check_tokens($logged_in_user->authenticator); |
| 70 | 70 | |
| 71 | - $add_signature = (post_str('add_signature', true) == "1")?1:0; |
|
| 71 | + $add_signature = (post_str('add_signature', true) == "1") ? 1 : 0; |
|
| 72 | 72 | $content = substr($content, 0, 64000); |
| 73 | 73 | $content = trim($content); |
| 74 | 74 | if (strlen($content)) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $now = time(); |
| 77 | 77 | $post->update("signature=$add_signature, content='$content', modified=$now"); |
| 78 | 78 | |
| 79 | - if ($can_edit_title){ |
|
| 79 | + if ($can_edit_title) { |
|
| 80 | 80 | $title = trim($title); |
| 81 | 81 | $title = sanitize_tags($title); |
| 82 | 82 | $title = BoincDb::escape_string($title); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | -page_head(tra("Edit post"),'','','', $bbcode_js); |
|
| 92 | +page_head(tra("Edit post"), '', '', '', $bbcode_js); |
|
| 93 | 93 | |
| 94 | 94 | show_forum_header($logged_in_user); |
| 95 | 95 | switch ($forum->parent_type) { |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if ($post->signature) { |
| 147 | - $enable_signature="checked=\"true\""; |
|
| 147 | + $enable_signature = "checked=\"true\""; |
|
| 148 | 148 | } else { |
| 149 | - $enable_signature=""; |
|
| 149 | + $enable_signature = ""; |
|
| 150 | 150 | } |
| 151 | 151 | row2("", "<input id=\"add_signature\" name=\"add_signature\" value=\"1\" ".$enable_signature." type=\"checkbox\"> |
| 152 | 152 | <label for=\"add_signature\">".tra("Add my signature to this post")."</label>"); |
@@ -159,5 +159,5 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | page_tail(); |
| 161 | 161 | |
| 162 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 162 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 163 | 163 | ?> |
@@ -176,8 +176,8 @@ |
||
| 176 | 176 | echo "<tr><th>WU ID</th><th>WU name</th><th>App ID</th><th>Quorum</th><th>Unsent</th><th>In Progress</th><th>Success</th>"; |
| 177 | 177 | echo "<th>Download Errors</th><th>Compute Errors</th><th>Validate Errors</th><th>Error mask</th></tr>\n"; |
| 178 | 178 | |
| 179 | -$hidden=0; |
|
| 180 | -foreach($row_array as $row) { |
|
| 179 | +$hidden = 0; |
|
| 180 | +foreach ($row_array as $row) { |
|
| 181 | 181 | if ($hide_canceled == 'on' && (($row->error_mask & WU_ERROR_CANCELLED) == WU_ERROR_CANCELLED)) { |
| 182 | 182 | $hidden++; |
| 183 | 183 | continue; |
@@ -138,25 +138,25 @@ discard block |
||
| 138 | 138 | "VU", "WF", "WS", "YE", "YT", "CS", "ZA", "ZM", "ZR", "ZW", "A1", "A2", "O1" |
| 139 | 139 | ); |
| 140 | 140 | var $GEOIP_COUNTRY_CODES3 = array( |
| 141 | -"","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT","AGO","AQ","ARG", |
|
| 142 | -"ASM","AUT","AUS","ABW","AZE","BIH","BRB","BGD","BEL","BFA","BGR","BHR","BDI", |
|
| 143 | -"BEN","BMU","BRN","BOL","BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC", |
|
| 144 | -"COD","CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI","CUB","CPV", |
|
| 145 | -"CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM","DZA","ECU","EST","EGY","ESH", |
|
| 146 | -"ERI","ESP","ETH","FIN","FJI","FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD", |
|
| 147 | -"GEO","GUF","GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM","GUM", |
|
| 148 | -"GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN","IRL","ISR","IND","IO", |
|
| 149 | -"IRQ","IRN","ISL","ITA","JAM","JOR","JPN","KEN","KGZ","KHM","KIR","COM","KNA", |
|
| 150 | -"PRK","KOR","KWT","CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", |
|
| 151 | -"LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI","MMR","MNG","MAC", |
|
| 152 | -"MNP","MTQ","MRT","MSR","MLT","MUS","MDV","MWI","MEX","MYS","MOZ","NAM","NCL", |
|
| 153 | -"NER","NFK","NGA","NIC","NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER", |
|
| 154 | -"PYF","PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW","PRY","QAT", |
|
| 155 | -"REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN","SWE","SGP","SHN","SVN","SJM", |
|
| 156 | -"SVK","SLE","SMR","SEN","SOM","SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF", |
|
| 157 | -"TGO","THA","TJK","TKL","TLS","TKM","TUN","TON","TUR","TTO","TUV","TWN","TZA", |
|
| 158 | -"UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT", |
|
| 159 | - "WLF","WSM","YEM","YT","SCG","ZAF","ZMB","ZR","ZWE","A1","A2","O1" |
|
| 141 | +"", "AP", "EU", "AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", "ANT", "AGO", "AQ", "ARG", |
|
| 142 | +"ASM", "AUT", "AUS", "ABW", "AZE", "BIH", "BRB", "BGD", "BEL", "BFA", "BGR", "BHR", "BDI", |
|
| 143 | +"BEN", "BMU", "BRN", "BOL", "BRA", "BHS", "BTN", "BV", "BWA", "BLR", "BLZ", "CAN", "CC", |
|
| 144 | +"COD", "CAF", "COG", "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI", "CUB", "CPV", |
|
| 145 | +"CX", "CYP", "CZE", "DEU", "DJI", "DNK", "DMA", "DOM", "DZA", "ECU", "EST", "EGY", "ESH", |
|
| 146 | +"ERI", "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", "FRA", "FX", "GAB", "GBR", "GRD", |
|
| 147 | +"GEO", "GUF", "GHA", "GIB", "GRL", "GMB", "GIN", "GLP", "GNQ", "GRC", "GS", "GTM", "GUM", |
|
| 148 | +"GNB", "GUY", "HKG", "HM", "HND", "HRV", "HTI", "HUN", "IDN", "IRL", "ISR", "IND", "IO", |
|
| 149 | +"IRQ", "IRN", "ISL", "ITA", "JAM", "JOR", "JPN", "KEN", "KGZ", "KHM", "KIR", "COM", "KNA", |
|
| 150 | +"PRK", "KOR", "KWT", "CYM", "KAZ", "LAO", "LBN", "LCA", "LIE", "LKA", "LBR", "LSO", "LTU", |
|
| 151 | +"LUX", "LVA", "LBY", "MAR", "MCO", "MDA", "MDG", "MHL", "MKD", "MLI", "MMR", "MNG", "MAC", |
|
| 152 | +"MNP", "MTQ", "MRT", "MSR", "MLT", "MUS", "MDV", "MWI", "MEX", "MYS", "MOZ", "NAM", "NCL", |
|
| 153 | +"NER", "NFK", "NGA", "NIC", "NLD", "NOR", "NPL", "NRU", "NIU", "NZL", "OMN", "PAN", "PER", |
|
| 154 | +"PYF", "PNG", "PHL", "PAK", "POL", "SPM", "PCN", "PRI", "PSE", "PRT", "PLW", "PRY", "QAT", |
|
| 155 | +"REU", "ROU", "RUS", "RWA", "SAU", "SLB", "SYC", "SDN", "SWE", "SGP", "SHN", "SVN", "SJM", |
|
| 156 | +"SVK", "SLE", "SMR", "SEN", "SOM", "SUR", "STP", "SLV", "SYR", "SWZ", "TCA", "TCD", "TF", |
|
| 157 | +"TGO", "THA", "TJK", "TKL", "TLS", "TKM", "TUN", "TON", "TUR", "TTO", "TUV", "TWN", "TZA", |
|
| 158 | +"UKR", "UGA", "UM", "USA", "URY", "UZB", "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", |
|
| 159 | + "WLF", "WSM", "YEM", "YT", "SCG", "ZAF", "ZMB", "ZR", "ZWE", "A1", "A2", "O1" |
|
| 160 | 160 | ); |
| 161 | 161 | var $GEOIP_COUNTRY_NAMES = array( |
| 162 | 162 | "", "Asia/Pacific Region", "Europe", "Andorra", "United Arab Emirates", |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | Grenadines", "Venezuela", "Virgin Islands, British", "Virgin Islands, U.S.", |
| 209 | 209 | "Vietnam", "Vanuatu", "Wallis and Futuna", "Samoa", "Yemen", "Mayotte", |
| 210 | 210 | "Serbia and Montenegro", "South Africa", "Zambia", "Zaire", "Zimbabwe", |
| 211 | -"Anonymous Proxy","Satellite Provider","Other" |
|
| 211 | +"Anonymous Proxy", "Satellite Provider", "Other" |
|
| 212 | 212 | ); |
| 213 | 213 | } |
| 214 | -function geoip_load_shared_mem ($file) { |
|
| 214 | +function geoip_load_shared_mem($file) { |
|
| 215 | 215 | |
| 216 | 216 | $fp = fopen($file, "rb"); |
| 217 | 217 | if (!$fp) { |
@@ -220,42 +220,42 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | $s_array = fstat($fp); |
| 222 | 222 | $size = $s_array['size']; |
| 223 | - if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { |
|
| 224 | - shmop_delete ($shmid); |
|
| 225 | - shmop_close ($shmid); |
|
| 223 | + if ($shmid = @shmop_open(GEOIP_SHM_KEY, "w", 0, 0)) { |
|
| 224 | + shmop_delete($shmid); |
|
| 225 | + shmop_close($shmid); |
|
| 226 | 226 | } |
| 227 | - $shmid = shmop_open (GEOIP_SHM_KEY, "c", 0644, $size); |
|
| 228 | - shmop_write ($shmid, fread($fp, $size), 0); |
|
| 229 | - shmop_close ($shmid); |
|
| 227 | + $shmid = shmop_open(GEOIP_SHM_KEY, "c", 0644, $size); |
|
| 228 | + shmop_write($shmid, fread($fp, $size), 0); |
|
| 229 | + shmop_close($shmid); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | -function _setup_segments($gi){ |
|
| 232 | +function _setup_segments($gi) { |
|
| 233 | 233 | $gi->databaseType = GEOIP_COUNTRY_EDITION; |
| 234 | 234 | $gi->record_length = STANDARD_RECORD_LENGTH; |
| 235 | 235 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
| 236 | - $offset = @shmop_size ($gi->shmid) - 3; |
|
| 236 | + $offset = @shmop_size($gi->shmid) - 3; |
|
| 237 | 237 | for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { |
| 238 | - $delim = @shmop_read ($gi->shmid, $offset, 3); |
|
| 238 | + $delim = @shmop_read($gi->shmid, $offset, 3); |
|
| 239 | 239 | $offset += 3; |
| 240 | 240 | if ($delim == (chr(255).chr(255).chr(255))) { |
| 241 | - $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); |
|
| 241 | + $gi->databaseType = ord(@shmop_read($gi->shmid, $offset, 1)); |
|
| 242 | 242 | $offset++; |
| 243 | 243 | |
| 244 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
| 244 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
| 245 | 245 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
| 246 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
| 246 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
| 247 | 247 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
| 248 | - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| |
|
| 248 | + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
| 249 | 249 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) |
| 250 | 250 | || ($gi->databaseType == GEOIP_ORG_EDITION) |
| 251 | 251 | || ($gi->databaseType == GEOIP_ISP_EDITION) |
| 252 | - || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
| 252 | + || ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
| 253 | 253 | $gi->databaseSegments = 0; |
| 254 | - $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); |
|
| 255 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
| 256 | - $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
|
| 254 | + $buf = @shmop_read($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); |
|
| 255 | + for ($j = 0; $j < SEGMENT_RECORD_LENGTH; $j++) { |
|
| 256 | + $gi->databaseSegments += (ord($buf[$j]) << ($j*8)); |
|
| 257 | 257 | } |
| 258 | - if (($gi->databaseType == GEOIP_ORG_EDITION)|| |
|
| 258 | + if (($gi->databaseType == GEOIP_ORG_EDITION) || |
|
| 259 | 259 | ($gi->databaseType == GEOIP_ISP_EDITION)) { |
| 260 | 260 | $gi->record_length = ORG_RECORD_LENGTH; |
| 261 | 261 | } |
@@ -265,32 +265,32 @@ discard block |
||
| 265 | 265 | $offset -= 4; |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | - if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
|
| 269 | - ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
|
| 270 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
| 268 | + if (($gi->databaseType == GEOIP_COUNTRY_EDITION) || |
|
| 269 | + ($gi->databaseType == GEOIP_PROXY_EDITION) || |
|
| 270 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
| 271 | 271 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
| 272 | 272 | } |
| 273 | 273 | } else { |
| 274 | 274 | $filepos = ftell($gi->filehandle); |
| 275 | 275 | fseek($gi->filehandle, -3, SEEK_END); |
| 276 | 276 | for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { |
| 277 | - $delim = fread($gi->filehandle,3); |
|
| 278 | - if ($delim == (chr(255).chr(255).chr(255))){ |
|
| 279 | - $gi->databaseType = ord(fread($gi->filehandle,1)); |
|
| 280 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
| 277 | + $delim = fread($gi->filehandle, 3); |
|
| 278 | + if ($delim == (chr(255).chr(255).chr(255))) { |
|
| 279 | + $gi->databaseType = ord(fread($gi->filehandle, 1)); |
|
| 280 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
| 281 | 281 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
| 282 | 282 | } |
| 283 | - else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
| 283 | + else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
| 284 | 284 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
| 285 | - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
| 285 | + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
| 286 | 286 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) || |
| 287 | 287 | ($gi->databaseType == GEOIP_ORG_EDITION) || |
| 288 | 288 | ($gi->databaseType == GEOIP_ISP_EDITION) || |
| 289 | - ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
| 289 | + ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
| 290 | 290 | $gi->databaseSegments = 0; |
| 291 | - $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); |
|
| 292 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
| 293 | - $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
|
| 291 | + $buf = fread($gi->filehandle, SEGMENT_RECORD_LENGTH); |
|
| 292 | + for ($j = 0; $j < SEGMENT_RECORD_LENGTH; $j++) { |
|
| 293 | + $gi->databaseSegments += (ord($buf[$j]) << ($j*8)); |
|
| 294 | 294 | } |
| 295 | 295 | if ($gi->databaseType == GEOIP_ORG_EDITION) { |
| 296 | 296 | $gi->record_length = ORG_RECORD_LENGTH; |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | fseek($gi->filehandle, -4, SEEK_CUR); |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | - if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
|
| 305 | - ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
|
| 306 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
| 304 | + if (($gi->databaseType == GEOIP_COUNTRY_EDITION) || |
|
| 305 | + ($gi->databaseType == GEOIP_PROXY_EDITION) || |
|
| 306 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
| 307 | 307 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
| 308 | 308 | } |
| 309 | - fseek($gi->filehandle,$filepos,SEEK_SET); |
|
| 309 | + fseek($gi->filehandle, $filepos, SEEK_SET); |
|
| 310 | 310 | } |
| 311 | 311 | return $gi; |
| 312 | 312 | } |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | $gi = new GeoIP; |
| 316 | 316 | $gi->flags = $flags; |
| 317 | 317 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
| 318 | - $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0); |
|
| 318 | + $gi->shmid = @shmop_open(GEOIP_SHM_KEY, "a", 0, 0); |
|
| 319 | 319 | } else { |
| 320 | - $gi->filehandle = fopen($filename,"rb"); |
|
| 320 | + $gi->filehandle = fopen($filename, "rb"); |
|
| 321 | 321 | if ($gi->flags & GEOIP_MEMORY_CACHE) { |
| 322 | 322 | $s_array = fstat($gi->filehandle); |
| 323 | 323 | $gi->memory_buffer = fread($gi->filehandle, $s_array[size]); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | function geoip_country_code_by_name($gi, $name) { |
| 348 | - $country_id = geoip_country_id_by_name($gi,$name); |
|
| 348 | + $country_id = geoip_country_id_by_name($gi, $name); |
|
| 349 | 349 | if ($country_id !== false) { |
| 350 | 350 | return $gi->GEOIP_COUNTRY_CODES[$country_id]; |
| 351 | 351 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | function geoip_country_name_by_name($gi, $name) { |
| 356 | - $country_id = geoip_country_id_by_name($gi,$name); |
|
| 356 | + $country_id = geoip_country_id_by_name($gi, $name); |
|
| 357 | 357 | if ($country_id !== false) { |
| 358 | 358 | return $gi->GEOIP_COUNTRY_NAMES[$country_id]; |
| 359 | 359 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | function geoip_country_code_by_addr($gi, $addr) { |
| 369 | - $country_id = geoip_country_id_by_addr($gi,$addr); |
|
| 369 | + $country_id = geoip_country_id_by_addr($gi, $addr); |
|
| 370 | 370 | if ($country_id !== false) { |
| 371 | 371 | return $gi->GEOIP_COUNTRY_CODES[$country_id]; |
| 372 | 372 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | function geoip_country_name_by_addr($gi, $addr) { |
| 377 | - $country_id = geoip_country_id_by_addr($gi,$addr); |
|
| 377 | + $country_id = geoip_country_id_by_addr($gi, $addr); |
|
| 378 | 378 | if ($country_id !== false) { |
| 379 | 379 | return $gi->GEOIP_COUNTRY_NAMES[$country_id]; |
| 380 | 380 | } |
@@ -386,24 +386,24 @@ discard block |
||
| 386 | 386 | for ($depth = 31; $depth >= 0; --$depth) { |
| 387 | 387 | if ($gi->flags & GEOIP_MEMORY_CACHE) { |
| 388 | 388 | $buf = substr($gi->memory_buffer, |
| 389 | - 2 * $gi->record_length * $offset, |
|
| 390 | - 2 * $gi->record_length); |
|
| 389 | + 2*$gi->record_length*$offset, |
|
| 390 | + 2*$gi->record_length); |
|
| 391 | 391 | } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { |
| 392 | - $buf = @shmop_read ($gi->shmid, |
|
| 393 | - 2 * $gi->record_length * $offset, |
|
| 394 | - 2 * $gi->record_length ); |
|
| 392 | + $buf = @shmop_read($gi->shmid, |
|
| 393 | + 2*$gi->record_length*$offset, |
|
| 394 | + 2*$gi->record_length); |
|
| 395 | 395 | } else { |
| 396 | - fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0 |
|
| 396 | + fseek($gi->filehandle, 2*$gi->record_length*$offset, SEEK_SET) == 0 |
|
| 397 | 397 | or die("fseek failed"); |
| 398 | - $buf = fread($gi->filehandle, 2 * $gi->record_length); |
|
| 398 | + $buf = fread($gi->filehandle, 2*$gi->record_length); |
|
| 399 | 399 | } |
| 400 | - $x = array(0,0); |
|
| 400 | + $x = array(0, 0); |
|
| 401 | 401 | for ($i = 0; $i < 2; ++$i) { |
| 402 | 402 | for ($j = 0; $j < $gi->record_length; ++$j) { |
| 403 | - $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); |
|
| 403 | + $x[$i] += ord($buf[$gi->record_length*$i + $j]) << ($j*8); |
|
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | - if ($ipnum & (1 << $depth)) { |
|
| 406 | + if ($ipnum&(1 << $depth)) { |
|
| 407 | 407 | if ($x[1] >= $gi->databaseSegments) { |
| 408 | 408 | return $x[1]; |
| 409 | 409 | } |
@@ -419,23 +419,23 @@ discard block |
||
| 419 | 419 | return false; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | -function _get_org($gi,$ipnum){ |
|
| 423 | - $seek_org = _geoip_seek_country($gi,$ipnum); |
|
| 422 | +function _get_org($gi, $ipnum) { |
|
| 423 | + $seek_org = _geoip_seek_country($gi, $ipnum); |
|
| 424 | 424 | if ($seek_org == $gi->databaseSegments) { |
| 425 | 425 | return NULL; |
| 426 | 426 | } |
| 427 | - $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; |
|
| 427 | + $record_pointer = $seek_org + (2*$gi->record_length - 1)*$gi->databaseSegments; |
|
| 428 | 428 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
| 429 | - $org_buf = @shmop_read ($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); |
|
| 429 | + $org_buf = @shmop_read($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); |
|
| 430 | 430 | } else { |
| 431 | 431 | fseek($gi->filehandle, $record_pointer, SEEK_SET); |
| 432 | - $org_buf = fread($gi->filehandle,MAX_ORG_RECORD_LENGTH); |
|
| 432 | + $org_buf = fread($gi->filehandle, MAX_ORG_RECORD_LENGTH); |
|
| 433 | 433 | } |
| 434 | 434 | $org_buf = substr($org_buf, 0, strpos($org_buf, 0)); |
| 435 | 435 | return $org_buf; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | -function geoip_org_by_addr ($gi,$addr) { |
|
| 438 | +function geoip_org_by_addr($gi, $addr) { |
|
| 439 | 439 | if ($addr == NULL) { |
| 440 | 440 | return 0; |
| 441 | 441 | } |
@@ -443,38 +443,38 @@ discard block |
||
| 443 | 443 | return _get_org($gi, $ipnum); |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | -function _get_region($gi,$ipnum){ |
|
| 447 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
| 448 | - $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; |
|
| 449 | - if ($seek_region >= 1000){ |
|
| 446 | +function _get_region($gi, $ipnum) { |
|
| 447 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
| 448 | + $seek_region = _geoip_seek_country($gi, $ipnum) - GEOIP_STATE_BEGIN_REV0; |
|
| 449 | + if ($seek_region >= 1000) { |
|
| 450 | 450 | $country_code = "US"; |
| 451 | - $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); |
|
| 451 | + $region = chr(($seek_region - 1000)/26 + 65).chr(($seek_region - 1000)%26 + 65); |
|
| 452 | 452 | } else { |
| 453 | 453 | $country_code = $gi->GEOIP_COUNTRY_CODES[$seek_region]; |
| 454 | 454 | $region = ""; |
| 455 | 455 | } |
| 456 | - return array ($country_code,$region); |
|
| 457 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
| 458 | - $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; |
|
| 456 | + return array($country_code, $region); |
|
| 457 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
| 458 | + $seek_region = _geoip_seek_country($gi, $ipnum) - GEOIP_STATE_BEGIN_REV1; |
|
| 459 | 459 | //print $seek_region; |
| 460 | - if ($seek_region < US_OFFSET){ |
|
| 460 | + if ($seek_region < US_OFFSET) { |
|
| 461 | 461 | $country_code = ""; |
| 462 | 462 | $region = ""; |
| 463 | 463 | } else if ($seek_region < CANADA_OFFSET) { |
| 464 | 464 | $country_code = "US"; |
| 465 | - $region = chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65); |
|
| 465 | + $region = chr(($seek_region - US_OFFSET)/26 + 65).chr(($seek_region - US_OFFSET)%26 + 65); |
|
| 466 | 466 | } else if ($seek_region < WORLD_OFFSET) { |
| 467 | 467 | $country_code = "CA"; |
| 468 | - $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); |
|
| 468 | + $region = chr(($seek_region - CANADA_OFFSET)/26 + 65).chr(($seek_region - CANADA_OFFSET)%26 + 65); |
|
| 469 | 469 | } else { |
| 470 | - $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET) / FIPS_RANGE]; |
|
| 470 | + $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET)/FIPS_RANGE]; |
|
| 471 | 471 | $region = ""; |
| 472 | 472 | } |
| 473 | - return array ($country_code,$region); |
|
| 473 | + return array($country_code, $region); |
|
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | -function geoip_region_by_addr ($gi,$addr) { |
|
| 477 | +function geoip_region_by_addr($gi, $addr) { |
|
| 478 | 478 | if ($addr == NULL) { |
| 479 | 479 | return 0; |
| 480 | 480 | } |
@@ -482,12 +482,12 @@ discard block |
||
| 482 | 482 | return _get_region($gi, $ipnum); |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | -function getdnsattributes ($l,$ip){ |
|
| 485 | +function getdnsattributes($l, $ip) { |
|
| 486 | 486 | $r = new Net_DNS_Resolver(); |
| 487 | 487 | $r->nameservers = array("ws1.maxmind.com"); |
| 488 | - $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); |
|
| 489 | - $str = is_object($p->answer[0])?$p->answer[0]->string():''; |
|
| 490 | - ereg("\"(.*)\"",$str,$regs); |
|
| 488 | + $p = $r->search($l.".".$ip.".s.maxmind.com", "TXT", "IN"); |
|
| 489 | + $str = is_object($p->answer[0]) ? $p->answer[0]->string() : ''; |
|
| 490 | + ereg("\"(.*)\"", $str, $regs); |
|
| 491 | 491 | $str = $regs[1]; |
| 492 | 492 | return $str; |
| 493 | 493 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | function default_mode($item) { |
| 80 | - return $item->is_exercise()?BOLT_MODE_SHOW:BOLT_MODE_LESSON; |
|
| 80 | + return $item->is_exercise() ?BOLT_MODE_SHOW:BOLT_MODE_LESSON; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // A page is being shown to the user; make a record of it |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | // show an item (lesson, exercise, answer page) |
| 172 | 172 | // |
| 173 | -function show_item($iter, $view_id, $prev_view_id, $mode, $repeat=null) { |
|
| 173 | +function show_item($iter, $view_id, $prev_view_id, $mode, $repeat = null) { |
|
| 174 | 174 | global $user; |
| 175 | 175 | global $course; |
| 176 | 176 | global $bolt_ex; |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $bolt_ex->score = 0; |
| 463 | 463 | $bolt_query_string = $item->query_string; |
| 464 | 464 | srand($view_id); |
| 465 | - ob_start(); // buffer output to avoid showing exercise text |
|
| 465 | + ob_start(); // buffer output to avoid showing exercise text |
|
| 466 | 466 | require($item->filename); |
| 467 | 467 | ob_end_clean(); |
| 468 | 468 | |