@@ -12,33 +12,33 @@ |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | |
15 | - require_once('./includes/bootstrap.inc'); |
|
16 | - drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); |
|
17 | - require_boinc('db'); |
|
15 | + require_once('./includes/bootstrap.inc'); |
|
16 | + drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); |
|
17 | + require_boinc('db'); |
|
18 | 18 | |
19 | - // Parse arguments |
|
20 | - $record_offset = isset($argv[1]) ? $argv[1] : 0; |
|
21 | - $chunk_size = isset($argv[2]) ? $argv[2] : 100; |
|
19 | + // Parse arguments |
|
20 | + $record_offset = isset($argv[1]) ? $argv[1] : 0; |
|
21 | + $chunk_size = isset($argv[2]) ? $argv[2] : 100; |
|
22 | 22 | |
23 | - // Construct sql conditions |
|
24 | - $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size); |
|
23 | + // Construct sql conditions |
|
24 | + $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size); |
|
25 | 25 | |
26 | - $total_count = 0; |
|
26 | + $total_count = 0; |
|
27 | 27 | |
28 | - // Get the users with subscriptions to import |
|
29 | - db_set_active('boinc'); |
|
30 | - $subscribed_boinc_users = db_query(" |
|
28 | + // Get the users with subscriptions to import |
|
29 | + db_set_active('boinc'); |
|
30 | + $subscribed_boinc_users = db_query(" |
|
31 | 31 | SELECT DISTINCT userid FROM {subscriptions} |
32 | 32 | ORDER BY userid ASC %s", $limit |
33 | - ); |
|
34 | - db_set_active('default'); |
|
33 | + ); |
|
34 | + db_set_active('default'); |
|
35 | 35 | |
36 | - // Import subscriptions |
|
37 | - while ($boinc_subscription = db_fetch_object($subscribed_boinc_users)) { |
|
36 | + // Import subscriptions |
|
37 | + while ($boinc_subscription = db_fetch_object($subscribed_boinc_users)) { |
|
38 | 38 | $uid = get_drupal_id($boinc_subscription->userid); |
39 | 39 | $count = boincuser_pull_subscriptions($uid); |
40 | 40 | $total_count += $count; |
41 | 41 | echo "\nuser: {$uid}; boinc_id: {$boinc_subscription->userid}; {$count} subscriptions"; |
42 | - } |
|
43 | - echo "\n"; |
|
44 | - echo $total_count; |
|
45 | 42 | \ No newline at end of file |
43 | + } |
|
44 | + echo "\n"; |
|
45 | + echo $total_count; |
|
46 | 46 | \ No newline at end of file |
@@ -12,26 +12,26 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | |
15 | - require_once('./includes/bootstrap.inc'); |
|
16 | - drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); |
|
17 | - require_boinc('db'); |
|
15 | + require_once('./includes/bootstrap.inc'); |
|
16 | + drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); |
|
17 | + require_boinc('db'); |
|
18 | 18 | |
19 | - // Parse arguments |
|
20 | - $import_lurkers = isset($argv[1]) ? $argv[1] : false; |
|
21 | - $record_offset = isset($argv[2]) ? $argv[2] : 0; |
|
22 | - $chunk_size = isset($argv[3]) ? $argv[3] : 100; |
|
19 | + // Parse arguments |
|
20 | + $import_lurkers = isset($argv[1]) ? $argv[1] : false; |
|
21 | + $record_offset = isset($argv[2]) ? $argv[2] : 0; |
|
22 | + $chunk_size = isset($argv[3]) ? $argv[3] : 100; |
|
23 | 23 | |
24 | - // Construct sql conditions |
|
25 | - $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size); |
|
24 | + // Construct sql conditions |
|
25 | + $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size); |
|
26 | 26 | |
27 | - $count = 0; |
|
27 | + $count = 0; |
|
28 | 28 | |
29 | - db_set_active('boinc'); |
|
30 | - if ($import_lurkers) { |
|
29 | + db_set_active('boinc'); |
|
30 | + if ($import_lurkers) { |
|
31 | 31 | $boinc_accounts = db_query('SELECT id FROM user ORDER BY id %s', $limit); |
32 | - } |
|
33 | - //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit); |
|
34 | - else { |
|
32 | + } |
|
33 | + //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit); |
|
34 | + else { |
|
35 | 35 | // Need to import any user who is currently ignored in order to keep them |
36 | 36 | // ignored... not particularly clean (ignored users are stored in a string) |
37 | 37 | $ignored_user_list = array(); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ORDER BY userid ASC" |
43 | 43 | ); |
44 | 44 | while ($ignoring_user = db_fetch_object($ignoring_users)) { |
45 | - $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1); |
|
45 | + $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1); |
|
46 | 46 | } |
47 | 47 | $ignored_user_list = array_keys($ignored_user_list); |
48 | 48 | $boinc_accounts = db_query(" |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | (SELECT DISTINCT senderid FROM {private_messages}) |
59 | 59 | ) AS usersToImport ORDER BY id ASC %s", implode(',', $ignored_user_list), $limit |
60 | 60 | ); |
61 | - } |
|
62 | - db_set_active('default'); |
|
61 | + } |
|
62 | + db_set_active('default'); |
|
63 | 63 | |
64 | - while ($boinc_account = db_fetch_object($boinc_accounts)) { |
|
64 | + while ($boinc_account = db_fetch_object($boinc_accounts)) { |
|
65 | 65 | // Grab the BOINC user object and create a Drupal user from it |
66 | 66 | if (boincuser_register_make_drupal_user($boinc_account->id)) { |
67 | - $count++; |
|
67 | + $count++; |
|
68 | + } |
|
68 | 69 | } |
69 | - } |
|
70 | 70 | |
71 | - echo $count; |
|
72 | 71 | \ No newline at end of file |
72 | + echo $count; |
|
73 | 73 | \ No newline at end of file |
@@ -5,45 +5,45 @@ discard block |
||
5 | 5 | * Callback admin/boinc/import/settings |
6 | 6 | */ |
7 | 7 | function boincimport_admin_settings() { |
8 | - global $conf ; |
|
9 | - global $db_url; |
|
10 | - global $base_url; |
|
11 | - $stage = variable_get('boincimport_config_stage', 0); |
|
8 | + global $conf ; |
|
9 | + global $db_url; |
|
10 | + global $base_url; |
|
11 | + $stage = variable_get('boincimport_config_stage', 0); |
|
12 | 12 | |
13 | - // Start with a quick sanity check on the BOINC environment |
|
14 | - boinc_get_path(); |
|
13 | + // Start with a quick sanity check on the BOINC environment |
|
14 | + boinc_get_path(); |
|
15 | 15 | |
16 | - //We'll be checking that the setup is complete. |
|
17 | - //If it is not complete, the migration will not go ahead. |
|
18 | - $ready_for_migration = 1; |
|
16 | + //We'll be checking that the setup is complete. |
|
17 | + //If it is not complete, the migration will not go ahead. |
|
18 | + $ready_for_migration = 1; |
|
19 | 19 | |
20 | - // Checking that the migration has been tested on a copy first. |
|
21 | - $form['test'] = array( |
|
20 | + // Checking that the migration has been tested on a copy first. |
|
21 | + $form['test'] = array( |
|
22 | 22 | '#type' => 'fieldset', |
23 | 23 | '#title' => t('Test on copy first'), |
24 | 24 | '#collapsible' => TRUE, |
25 | 25 | '#collapsed' => TRUE, |
26 | - ); |
|
26 | + ); |
|
27 | 27 | |
28 | - $output = ''; |
|
29 | - if (!variable_get('boincimport_tested', 0)) { |
|
28 | + $output = ''; |
|
29 | + if (!variable_get('boincimport_tested', 0)) { |
|
30 | 30 | $form['test']['#collapsed']= FALSE; |
31 | 31 | $output = '<span class="marker">'; |
32 | 32 | $ready_for_migration = 0; |
33 | - } |
|
34 | - $output .= '<p>' . t('The migration will modify and even destroy some data. You |
|
33 | + } |
|
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 | 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 | 40 | Drupal site during the migration.') . '</p>'; |
41 | - if (!variable_get('boincimport_tested', 0)) { |
|
41 | + if (!variable_get('boincimport_tested', 0)) { |
|
42 | 42 | $output .= '</span>'; |
43 | - } |
|
44 | - $form['test']['intro'] = array('#value' => $output); |
|
43 | + } |
|
44 | + $form['test']['intro'] = array('#value' => $output); |
|
45 | 45 | |
46 | - $form['test']['boincimport_tested'] = array( |
|
46 | + $form['test']['boincimport_tested'] = array( |
|
47 | 47 | '#type' => 'checkbox', |
48 | 48 | '#title' => t('I am running a trial migration on a disposable copy of the database |
49 | 49 | OR I have already done so and I am running this on my live site, confident that |
@@ -51,64 +51,64 @@ discard block |
||
51 | 51 | '#return_value' => 1, |
52 | 52 | '#default_value' => variable_get('boincimport_tested', 0), |
53 | 53 | '#description' => '', |
54 | - ); |
|
54 | + ); |
|
55 | 55 | |
56 | - // Where is BOINC data? |
|
57 | - $pre = variable_get('boincimport_table_prefix', ''); |
|
58 | - $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user'); |
|
59 | - $db = (is_array($db_url) AND isset($db_url['boinc'])) ? 'boinc' : 'default'; |
|
60 | - $result = _boincimport_check_tables($tables, $db, 0); |
|
56 | + // Where is BOINC data? |
|
57 | + $pre = variable_get('boincimport_table_prefix', ''); |
|
58 | + $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user'); |
|
59 | + $db = (is_array($db_url) AND isset($db_url['boinc'])) ? 'boinc' : 'default'; |
|
60 | + $result = _boincimport_check_tables($tables, $db, 0); |
|
61 | 61 | |
62 | - $config_path = conf_path(); |
|
63 | - $form['boinc_data'] = array( |
|
62 | + $config_path = conf_path(); |
|
63 | + $form['boinc_data'] = array( |
|
64 | 64 | '#type' => 'fieldset', |
65 | 65 | '#title' => t('Location of BOINC data'), |
66 | 66 | '#collapsible' => TRUE, |
67 | 67 | '#collapsed' => TRUE, |
68 | - ); |
|
69 | - $form['boinc_data']['boincimport_db_configured'] = array( |
|
68 | + ); |
|
69 | + $form['boinc_data']['boincimport_db_configured'] = array( |
|
70 | 70 | '#type' => 'checkbox', |
71 | 71 | '#title' => t('There is a \'boinc\' database connection string configured in %file', |
72 | - array('%file' => "{$config_path}/settings.php")), |
|
72 | + array('%file' => "{$config_path}/settings.php")), |
|
73 | 73 | '#return_value' => 1, |
74 | 74 | '#default_value' => variable_get('boincimport_db_configured', 1), |
75 | 75 | '#description' => '', |
76 | 76 | '#disabled' => ($result['result']) ? TRUE : FALSE |
77 | - ); |
|
78 | - if (variable_get('boincimport_db_configured', 1) != 1) { |
|
77 | + ); |
|
78 | + if (variable_get('boincimport_db_configured', 1) != 1) { |
|
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 |
|
82 | + $output = '<p class="marker">'. t('Set the address of the BOINC database |
|
83 | 83 | according to the following format:') . '<br /><pre> |
84 | 84 | mysql://boinc_username:boinc_password@localhost/boinc_database |
85 | 85 | </pre></p>'; |
86 | - $ready_for_migration = 0; |
|
87 | - $form['boinc_data']['#collapsed'] = FALSE; |
|
88 | - $form['boinc_data']['db_connect_string_note'] = array('#value' => $output); |
|
86 | + $ready_for_migration = 0; |
|
87 | + $form['boinc_data']['#collapsed'] = FALSE; |
|
88 | + $form['boinc_data']['db_connect_string_note'] = array('#value' => $output); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $form['boinc_data']['boincimport_db_url'] = array( |
92 | - '#type' => 'textfield', |
|
93 | - '#title' => t('BOINC database location'), |
|
94 | - '#default_value' => variable_get('boincimport_db_url', $default_db_url), |
|
95 | - '#size' => 80, |
|
96 | - '#maxlength' => 255, |
|
97 | - '#description' => '', |
|
92 | + '#type' => 'textfield', |
|
93 | + '#title' => t('BOINC database location'), |
|
94 | + '#default_value' => variable_get('boincimport_db_url', $default_db_url), |
|
95 | + '#size' => 80, |
|
96 | + '#maxlength' => 255, |
|
97 | + '#description' => '', |
|
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 | 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 | 107 | 'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))) . '</p>'; |
108 | - $form['boinc_data']['note'] = array('#value' => $output); |
|
108 | + $form['boinc_data']['note'] = array('#value' => $output); |
|
109 | 109 | |
110 | - // BOINC table prefix |
|
111 | - $form['boinc_data']['boincimport_table_prefix'] = array( |
|
110 | + // BOINC table prefix |
|
111 | + $form['boinc_data']['boincimport_table_prefix'] = array( |
|
112 | 112 | '#type' => 'textfield', |
113 | 113 | '#title' => t('BOINC table prefix'), |
114 | 114 | '#default_value' => variable_get('boincimport_table_prefix', ''), |
@@ -116,30 +116,30 @@ discard block |
||
116 | 116 | '#maxlength' => 255, |
117 | 117 | '#description' => t('What prefix is used for your BOINC tables?'), |
118 | 118 | '#disabled' => ($result['result']) ? TRUE : FALSE |
119 | - ); |
|
119 | + ); |
|
120 | 120 | |
121 | - $output = $result['html']; |
|
122 | - if ($result['result'] != 1) { |
|
121 | + $output = $result['html']; |
|
122 | + if ($result['result'] != 1) { |
|
123 | 123 | $ready_for_migration = 0; |
124 | 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.'); |
128 | 128 | $output .= '</span>'; |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | - $form['boinc_data']['result'] = array('#value' => $output); |
|
131 | + $form['boinc_data']['result'] = array('#value' => $output); |
|
132 | 132 | |
133 | - // USERS settings |
|
134 | - $form['users'] = array( |
|
133 | + // USERS settings |
|
134 | + $form['users'] = array( |
|
135 | 135 | '#type' => 'fieldset', |
136 | 136 | '#title' => t('User import'), |
137 | 137 | '#collapsible' => TRUE, |
138 | 138 | '#collapsed' => TRUE, |
139 | - ); |
|
139 | + ); |
|
140 | 140 | |
141 | - // User import batch size |
|
142 | - $form['users']['boincimport_user_batch_size'] = array( |
|
141 | + // User import batch size |
|
142 | + $form['users']['boincimport_user_batch_size'] = array( |
|
143 | 143 | '#type' => 'textfield', |
144 | 144 | '#title' => t('Number of accounts to process at a time'), |
145 | 145 | '#default_value' => variable_get('boincimport_user_batch_size', 50), |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | '#description' => t('Due to memory intensive API calls, this value may have to |
149 | 149 | be adjusted to avoid exhausting system resources. The default value is a |
150 | 150 | balance between performance and reliability.') |
151 | - ); |
|
151 | + ); |
|
152 | 152 | |
153 | - // Import users who have never posted? |
|
154 | - $form['users']['boincimport_import_lurkers'] = array( |
|
153 | + // Import users who have never posted? |
|
154 | + $form['users']['boincimport_import_lurkers'] = array( |
|
155 | 155 | '#type' => 'checkbox', |
156 | 156 | '#title' => t('Import users who have never posted?'), |
157 | 157 | '#return_value' => 1, |
@@ -160,199 +160,199 @@ discard block |
||
160 | 160 | involvement? This may not be desired, as it can take a very long time to |
161 | 161 | import tens or hundreds of thousands of accounts. (note that users who |
162 | 162 | are not imported now will still be imported on-the-fly upon login)'), |
163 | - ); |
|
163 | + ); |
|
164 | 164 | |
165 | - // Input format settings |
|
166 | - $form['input'] = array( |
|
165 | + // Input format settings |
|
166 | + $form['input'] = array( |
|
167 | 167 | '#type' => 'fieldset', |
168 | 168 | '#title' => t('Input format settings'), |
169 | 169 | '#collapsible' => TRUE, |
170 | 170 | '#collapsed' => TRUE |
171 | - ); |
|
172 | - $output = '<p>'. t('Select which !input_format should be used for the imported |
|
171 | + ); |
|
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 | 175 | array('!input_format' => l(t('input format'), 'admin/settings/filters'))) .'</p>'; |
176 | - $form['input']['intro'] = array('#value' => $output); |
|
176 | + $form['input']['intro'] = array('#value' => $output); |
|
177 | 177 | |
178 | - $formats = db_query('SELECT format, name FROM {filter_formats}'); |
|
179 | - while ($format = db_fetch_array($formats)) { |
|
178 | + $formats = db_query('SELECT format, name FROM {filter_formats}'); |
|
179 | + while ($format = db_fetch_array($formats)) { |
|
180 | 180 | $input_formats[$format['format']]= $format['name']; |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | - // By default, use the format named "Rich text"; fall back to Filtered HTML |
|
184 | - $default_input_format = db_result(db_query(" |
|
183 | + // By default, use the format named "Rich text"; fall back to Filtered HTML |
|
184 | + $default_input_format = db_result(db_query(" |
|
185 | 185 | SELECT format FROM {filter_formats} WHERE name = '%s'", 'Rich text')); |
186 | - if (!$default_input_format) $default_input_format = 1; |
|
186 | + if (!$default_input_format) $default_input_format = 1; |
|
187 | 187 | |
188 | - $input_format = variable_get('boincimport_input_format', $default_input_format); |
|
189 | - $form['input']['boincimport_input_format'] = array( |
|
188 | + $input_format = variable_get('boincimport_input_format', $default_input_format); |
|
189 | + $form['input']['boincimport_input_format'] = array( |
|
190 | 190 | '#type' => 'radios', |
191 | 191 | '#title' => t('Input format'), |
192 | 192 | '#default_value' => $input_format, |
193 | 193 | '#options' => $input_formats |
194 | - ); |
|
195 | - if (!$input_format) { |
|
194 | + ); |
|
195 | + if (!$input_format) { |
|
196 | 196 | $ready_for_migration = 0; |
197 | 197 | $form['input']['#collapsed']= FALSE; |
198 | - } |
|
199 | - $output = '<p><em>'. t('This setting will be applied to all posts and private |
|
198 | + } |
|
199 | + $output = '<p><em>'. t('This setting will be applied to all posts and private |
|
200 | 200 | messages.') .'</em></p>'; |
201 | - $form['input']['result'] = array('#value' => $output); |
|
201 | + $form['input']['result'] = array('#value' => $output); |
|
202 | 202 | |
203 | - // BBcode settings |
|
204 | - $form['bbcode'] = array( |
|
203 | + // BBcode settings |
|
204 | + $form['bbcode'] = array( |
|
205 | 205 | '#type' => 'fieldset', |
206 | 206 | '#title' => t('BBcode settings'), |
207 | 207 | '#collapsible' => TRUE, |
208 | 208 | '#collapsed' => TRUE, |
209 | - ); |
|
209 | + ); |
|
210 | 210 | |
211 | - $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the |
|
211 | + $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the |
|
212 | 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 |
|
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 | 218 | array('attributes' => array('target' => '_blank'))))) . '</li>'; |
219 | - $output .= '<li>' . t('Filter the BBcode now and replace it with plain HTML. |
|
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 | 221 | be disabled afterwards.') . '</li></ul>'; |
222 | - $output .= '<p>' . t('An appropriate input filter should be chosen, as well, |
|
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 | 227 | array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))) . '</p>'; |
228 | 228 | |
229 | - $form['bbcode']['intro'] = array('#value' => $output); |
|
230 | - $form['bbcode']['boincimport_bbcode'] = array( |
|
229 | + $form['bbcode']['intro'] = array('#value' => $output); |
|
230 | + $form['bbcode']['boincimport_bbcode'] = array( |
|
231 | 231 | '#type' => 'radios', |
232 | 232 | '#title' => t('BBcode handling'), |
233 | 233 | '#default_value' => variable_get('boincimport_bbcode', 0), |
234 | 234 | '#options' => array(t('Leave BBcode as is.'), t('Transform BBcode into HTML.')), |
235 | 235 | '#description' => '', |
236 | - ); |
|
236 | + ); |
|
237 | 237 | |
238 | - $module_status = _boincimport_check_module('bbcode'); |
|
239 | - $bbcode_disabled = ($module_status['result'] == 0) ? true : false; |
|
240 | - $output = $module_status['html']; |
|
238 | + $module_status = _boincimport_check_module('bbcode'); |
|
239 | + $bbcode_disabled = ($module_status['result'] == 0) ? true : false; |
|
240 | + $output = $module_status['html']; |
|
241 | 241 | |
242 | - if (variable_get('boincimport_bbcode', 0)) { |
|
242 | + if (variable_get('boincimport_bbcode', 0)) { |
|
243 | 243 | if ($bbcode_disabled) { |
244 | - $ready_for_migration = 0; |
|
245 | - $form['bbcode']['#collapsed'] = FALSE; |
|
246 | - $output .= '<p><span class="marker">'; |
|
247 | - $output .= t('The !bbcode_module is required to transform BBcode into HTML. |
|
244 | + $ready_for_migration = 0; |
|
245 | + $form['bbcode']['#collapsed'] = FALSE; |
|
246 | + $output .= '<p><span class="marker">'; |
|
247 | + $output .= t('The !bbcode_module is required to transform BBcode into HTML. |
|
248 | 248 | You first need to !enable_bbcode', array( |
249 | - '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))), |
|
250 | - '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))); |
|
251 | - $output .= '</span></p>'; |
|
249 | + '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))), |
|
250 | + '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))); |
|
251 | + $output .= '</span></p>'; |
|
252 | 252 | } |
253 | 253 | $sql = "SELECT COUNT(*) FROM {filters} WHERE module = 'bbcode' AND format = %d"; |
254 | 254 | $result = db_query($sql, $input_format); |
255 | 255 | if (!db_result($result)) { |
256 | - $form['bbcode']['#collapsed'] = FALSE; |
|
257 | - $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and |
|
256 | + $form['bbcode']['#collapsed'] = FALSE; |
|
257 | + $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and |
|
258 | 258 | then !configure_bbcode_options', array( |
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>'; |
|
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>'; |
|
261 | 261 | } |
262 | 262 | $output .= '<p>'. t('For best results, !disable_all_options', |
263 | 263 | array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))) . '.</p>'; |
264 | - } else { |
|
264 | + } else { |
|
265 | 265 | if ($bbcode_disabled) { |
266 | - $form['bbcode']['#collapsed'] = FALSE; |
|
267 | - $output .= '<p>'. t('The !bbcode_module is recommended, but not required. |
|
266 | + $form['bbcode']['#collapsed'] = FALSE; |
|
267 | + $output .= '<p>'. t('The !bbcode_module is recommended, but not required. |
|
268 | 268 | You may !enable_bbcode after having installed it.', array( |
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>'; |
|
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>'; |
|
271 | 271 | } |
272 | 272 | $output .= '<p>' . t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array( |
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>'; |
|
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 | 275 | $output .= '<p>' . t('You may want to enable it for other input formats, too.') . '</p>'; |
276 | - } |
|
277 | - $output .= '<p><em>'. t('This setting will be applied to all posts, private |
|
276 | + } |
|
277 | + $output .= '<p><em>'. t('This setting will be applied to all posts, private |
|
278 | 278 | messages and the users\' signature.') .'</em></p>'; |
279 | 279 | |
280 | - $form['bbcode']['result'] = array('#value' => $output); |
|
280 | + $form['bbcode']['result'] = array('#value' => $output); |
|
281 | 281 | |
282 | - // URL transform settings |
|
283 | - $form['url_transforms'] = array( |
|
282 | + // URL transform settings |
|
283 | + $form['url_transforms'] = array( |
|
284 | 284 | '#type' => 'fieldset', |
285 | 285 | '#title' => t('URL transforms'), |
286 | 286 | '#collapsible' => TRUE, |
287 | 287 | '#collapsed' => TRUE, |
288 | - ); |
|
289 | - if (!variable_get('boincimport_base_url_boinc', 0)) { |
|
288 | + ); |
|
289 | + if (!variable_get('boincimport_base_url_boinc', 0)) { |
|
290 | 290 | $form['url_transforms']['#collapsed']= FALSE; |
291 | 291 | $output = '<span class="marker">'; |
292 | 292 | $ready_for_migration = 0; |
293 | - } |
|
293 | + } |
|
294 | 294 | |
295 | - // List of BOINC domains possible in URLs to transform |
|
296 | - $form['url_transforms']['boincimport_base_url_boinc'] = array( |
|
295 | + // List of BOINC domains possible in URLs to transform |
|
296 | + $form['url_transforms']['boincimport_base_url_boinc'] = array( |
|
297 | 297 | '#type' => 'textarea', |
298 | 298 | '#title' => t('BOINC base URLs to transform'), |
299 | 299 | '#default_value' => variable_get('boincimport_base_url_boinc', ''), |
300 | 300 | '#description' => t('List URL bases that should be transformed from |
301 | 301 | BOINC format to Drupal format (enter one domain per line, including http://).'), |
302 | - ); |
|
302 | + ); |
|
303 | 303 | |
304 | - // The Drupal domain to use in URL transform results |
|
305 | - $form['url_transforms']['boincimport_base_url_drupal'] = array( |
|
304 | + // The Drupal domain to use in URL transform results |
|
305 | + $form['url_transforms']['boincimport_base_url_drupal'] = array( |
|
306 | 306 | '#type' => 'textfield', |
307 | 307 | '#title' => t('Target Drupal base URL'), |
308 | 308 | '#default_value' => variable_get('boincimport_base_url_drupal', ''), |
309 | 309 | '#description' => t('Specify the URL base to use in transform results. If |
310 | 310 | left blank, the base_url configured in this Drupal environment will be |
311 | 311 | used (currently: %url)', array('%url' =>$base_url)), |
312 | - ); |
|
312 | + ); |
|
313 | 313 | |
314 | - // Are we ready for migration? |
|
315 | - $form['migration'] = array( |
|
314 | + // Are we ready for migration? |
|
315 | + $form['migration'] = array( |
|
316 | 316 | '#type' => 'fieldset', |
317 | 317 | '#title' => 'Migration', |
318 | 318 | '#collapsible' => TRUE, |
319 | 319 | '#collapsed' => FALSE, |
320 | - ); |
|
321 | - variable_set('boincimport_ready', $ready_for_migration); |
|
322 | - if ($ready_for_migration) { |
|
320 | + ); |
|
321 | + variable_set('boincimport_ready', $ready_for_migration); |
|
322 | + if ($ready_for_migration) { |
|
323 | 323 | $output = '<p>'. t('Check the settings above one more time. If everything |
324 | 324 | is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))) .'</p>'; |
325 | - } else { |
|
325 | + } else { |
|
326 | 326 | $output = '<p class="marker">'. t('You are not ready for the migration yet. |
327 | 327 | Please check the settings above.') .'</p>'; |
328 | - } |
|
328 | + } |
|
329 | 329 | |
330 | - $form['migration']['info'] = array('#value' => $output); |
|
331 | - return system_settings_form($form); |
|
330 | + $form['migration']['info'] = array('#value' => $output); |
|
331 | + return system_settings_form($form); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
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 | 340 | already:') .'</p>'; |
341 | - $output .= '<ul>'; |
|
342 | - $output .= '<li>'. t('Imported users, teams, and forums using the BOINC |
|
341 | + $output .= '<ul>'; |
|
342 | + $output .= '<li>'. t('Imported users, teams, and forums using the BOINC |
|
343 | 343 | import module') .'</li>'; |
344 | - $output .= '<li>'. t('Imported any additional data using add on modules if |
|
344 | + $output .= '<li>'. t('Imported any additional data using add on modules if |
|
345 | 345 | available.') .'</li>'; |
346 | - $output .= '</ul>'; |
|
347 | - //User Set up |
|
348 | - $output .= '<h2>'. t('User settings') .'</h2>'; |
|
349 | - $output .= '<p>'. t('Make sure your !user_settings are correct. Specifically, |
|
346 | + $output .= '</ul>'; |
|
347 | + //User Set up |
|
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 | - '!user_settings' => l(t('user settings'), 'admin/user/settings') |
|
351 | + '!user_settings' => l(t('user settings'), 'admin/user/settings') |
|
352 | 352 | )) .'</p>'; |
353 | - $output .= '<p>' . t('Note that avatar/picture support is not tied to user |
|
353 | + $output .= '<p>' . t('Note that avatar/picture support is not tied to user |
|
354 | 354 | settings Picture support at this time.') . '</p>'; |
355 | - /*$output .= '<p>' . t('In order to activate avatar/picture support, you need to |
|
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>'; |
358 | 358 | $output .= '<li>'. t('Tick the checkboxes to allow "User pictures in posts" and/or |
@@ -365,73 +365,73 @@ discard block |
||
365 | 365 | )) .'</li>'; |
366 | 366 | $output .= '</ul>'; */ |
367 | 367 | |
368 | - // Forum Set up |
|
369 | - $output .= '<h2>'. t('Forum settings') .'</h2>'; |
|
370 | - $output .= '<p>'. t('Check any additional changes to make on the |
|
368 | + // Forum Set up |
|
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 | - '!forum_settings' => l(t('forum settings'), 'admin/content/forum/settings') |
|
372 | + '!forum_settings' => l(t('forum settings'), 'admin/content/forum/settings') |
|
373 | 373 | )) .'</p>'; |
374 | - $output .= '<p>'. t('It also may be a good idea to look at the !forum_list to |
|
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 | - '!forum_list' => l(t('forum list'), 'admin/content/forum') |
|
376 | + '!forum_list' => l(t('forum list'), 'admin/content/forum') |
|
377 | 377 | )) .'</p>'; |
378 | - /*$output .= '<p>'. t('If need be, set up the private forums as explained in the |
|
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'))) |
381 | 381 | )) .'</p>'; |
382 | 382 | */ |
383 | - /* |
|
383 | + /* |
|
384 | 384 | // Redirection from old URLs: |
385 | 385 | $output .= '<h2>'. t('Redirection from BOINC forum URLs to new Drupal forum URLs') .'</h2>'; |
386 | 386 | $output .= '<p>'. t('Enable the boincforum_redirect.module. This way, users |
387 | 387 | accessing URLs from your old BOINC installation will be redirected to your new |
388 | 388 | Drupal forum.') .'</p>'; |
389 | 389 | */ |
390 | - // BBcode |
|
391 | - $bbcode = variable_get('boincimport_bbcode', 0); |
|
392 | - if ($bbcode) { |
|
390 | + // BBcode |
|
391 | + $bbcode = variable_get('boincimport_bbcode', 0); |
|
392 | + if ($bbcode) { |
|
393 | 393 | $output .= '<h2>'. t('Remove BBcode module') .'</h2>'; |
394 | 394 | $output .= '<p>'. t('The BBcode has been cleaned from the posts. You shouldn\'t |
395 | 395 | need the bbcode module anymore. You can disable it.') .'</p>'; |
396 | - } else { |
|
396 | + } else { |
|
397 | 397 | $output .= '<h2>'. t('Configure BBcode module') .'</h2>'; |
398 | 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>'; |
|
404 | - } |
|
403 | + )) . '</p>'; |
|
404 | + } |
|
405 | 405 | |
406 | - return $output; |
|
406 | + return $output; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
410 | 410 | * Callback admin/boinc/import |
411 | 411 | */ |
412 | 412 | function boincimport_main() { |
413 | - // Start with a quick sanity check on the BOINC environment |
|
414 | - boinc_get_path(); |
|
415 | - // If that's ok, on with the show |
|
416 | - $output .= t('You may want to !check_documentation before starting.', array( |
|
413 | + // Start with a quick sanity check on the BOINC environment |
|
414 | + boinc_get_path(); |
|
415 | + // If that's ok, on with the show |
|
416 | + $output .= t('You may want to !check_documentation before starting.', array( |
|
417 | 417 | '!check_documentation' => l(t('check the documentation'), 'http://boinc.berkeley.edu/trac/wiki/InstallDrupal', array('attributes' =>array('target' => '_blank'))) |
418 | - )); |
|
419 | - $output = '<ol><li>'; |
|
420 | - $output .= l(t('Configure the migration'), 'admin/boinc/import/settings'); |
|
421 | - $output .= '</li>'; |
|
422 | - $output .= '<li>'; |
|
423 | - $output .= l(t('Execute the migration'), 'admin/boinc/import/process'); |
|
424 | - $output .= '</li>'; |
|
425 | - $output .= '<li>'; |
|
426 | - $output .= l(t('Post migration configuration'), 'admin/boinc/import/post_configuration'); |
|
427 | - $output .= '</li>'; |
|
428 | - $output .= '<li>'; |
|
429 | - $output .= t('!cleanup (Accessing this link will delete all the saved BOINC forum |
|
418 | + )); |
|
419 | + $output = '<ol><li>'; |
|
420 | + $output .= l(t('Configure the migration'), 'admin/boinc/import/settings'); |
|
421 | + $output .= '</li>'; |
|
422 | + $output .= '<li>'; |
|
423 | + $output .= l(t('Execute the migration'), 'admin/boinc/import/process'); |
|
424 | + $output .= '</li>'; |
|
425 | + $output .= '<li>'; |
|
426 | + $output .= l(t('Post migration configuration'), 'admin/boinc/import/post_configuration'); |
|
427 | + $output .= '</li>'; |
|
428 | + $output .= '<li>'; |
|
429 | + $output .= t('!cleanup (Accessing this link will delete all the saved BOINC forum |
|
430 | 430 | conversion settings: click only when you\'re done with all the above.)', array( |
431 | - '!cleanup' => l(t('Cleanup'), 'admin/boinc/import/cleanup') |
|
431 | + '!cleanup' => l(t('Cleanup'), 'admin/boinc/import/cleanup') |
|
432 | 432 | )); |
433 | - $output .= '</li>'; |
|
434 | - /*$output .= '<li>'; |
|
433 | + $output .= '</li>'; |
|
434 | + /*$output .= '<li>'; |
|
435 | 435 | $output .= t('Enable the boincforum_redirect module for seamless redirection |
436 | 436 | from the old forums to the new. This module requires !clean_urls to be active.', array( |
437 | 437 | '!clean_urls' => l(t('Clean URLs'), 'admin/settings/clean-urls') |
@@ -442,14 +442,14 @@ discard block |
||
442 | 442 | uninstall BOINC forum - This will delete tables necessary for redirection. You can, |
443 | 443 | however, deactivate the module safely.'); |
444 | 444 | $output .= '</li>';*/ |
445 | - $output .= '</ol>'; |
|
445 | + $output .= '</ol>'; |
|
446 | 446 | |
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 |
|
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 |
|
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 | - '!reset_db_url' => l(t('Click here to reset the database url'), 'admin/boinc/import/reset') |
|
451 | + '!reset_db_url' => l(t('Click here to reset the database url'), 'admin/boinc/import/reset') |
|
452 | 452 | )) .'</p>'; |
453 | 453 | |
454 | - return $output; |
|
454 | + return $output; |
|
455 | 455 | } |
@@ -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'])) ? 'boinc' : '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 | } |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | $form['test'] = array( |
22 | 22 | '#type' => 'fieldset', |
23 | 23 | '#title' => t('Test on copy first'), |
24 | - '#collapsible' => TRUE, |
|
25 | - '#collapsed' => TRUE, |
|
24 | + '#collapsible' => true, |
|
25 | + '#collapsed' => true, |
|
26 | 26 | ); |
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 | } |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | // Where is BOINC data? |
57 | 57 | $pre = variable_get('boincimport_table_prefix', ''); |
58 | 58 | $tables = array($pre .'forum', $pre .'post', $pre .'thread', $pre .'user'); |
59 | - $db = (is_array($db_url) AND isset($db_url['boinc'])) ? 'boinc' : 'default'; |
|
59 | + $db = (is_array($db_url) and isset($db_url['boinc'])) ? 'boinc' : 'default'; |
|
60 | 60 | $result = _boincimport_check_tables($tables, $db, 0); |
61 | 61 | |
62 | 62 | $config_path = conf_path(); |
63 | 63 | $form['boinc_data'] = array( |
64 | 64 | '#type' => 'fieldset', |
65 | 65 | '#title' => t('Location of BOINC data'), |
66 | - '#collapsible' => TRUE, |
|
67 | - '#collapsed' => TRUE, |
|
66 | + '#collapsible' => true, |
|
67 | + '#collapsed' => true, |
|
68 | 68 | ); |
69 | 69 | $form['boinc_data']['boincimport_db_configured'] = array( |
70 | 70 | '#type' => 'checkbox', |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | '#return_value' => 1, |
74 | 74 | '#default_value' => variable_get('boincimport_db_configured', 1), |
75 | 75 | '#description' => '', |
76 | - '#disabled' => ($result['result']) ? TRUE : FALSE |
|
76 | + '#disabled' => ($result['result']) ? true : false |
|
77 | 77 | ); |
78 | 78 | if (variable_get('boincimport_db_configured', 1) != 1) { |
79 | 79 | $default_db_url = is_array($db_url) ? end($db_url) : $db_url; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | mysql://boinc_username:boinc_password@localhost/boinc_database |
85 | 85 | </pre></p>'; |
86 | 86 | $ready_for_migration = 0; |
87 | - $form['boinc_data']['#collapsed'] = FALSE; |
|
87 | + $form['boinc_data']['#collapsed'] = false; |
|
88 | 88 | $form['boinc_data']['db_connect_string_note'] = array('#value' => $output); |
89 | 89 | } |
90 | 90 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | '#size' => 20, |
116 | 116 | '#maxlength' => 255, |
117 | 117 | '#description' => t('What prefix is used for your BOINC tables?'), |
118 | - '#disabled' => ($result['result']) ? TRUE : FALSE |
|
118 | + '#disabled' => ($result['result']) ? true : false |
|
119 | 119 | ); |
120 | 120 | |
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.'); |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | $form['users'] = array( |
135 | 135 | '#type' => 'fieldset', |
136 | 136 | '#title' => t('User import'), |
137 | - '#collapsible' => TRUE, |
|
138 | - '#collapsed' => TRUE, |
|
137 | + '#collapsible' => true, |
|
138 | + '#collapsed' => true, |
|
139 | 139 | ); |
140 | 140 | |
141 | 141 | // User import batch size |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $form['input'] = array( |
167 | 167 | '#type' => 'fieldset', |
168 | 168 | '#title' => t('Input format settings'), |
169 | - '#collapsible' => TRUE, |
|
170 | - '#collapsed' => TRUE |
|
169 | + '#collapsible' => true, |
|
170 | + '#collapsed' => true |
|
171 | 171 | ); |
172 | 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 |
@@ -194,7 +194,7 @@ 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 | 199 | $output = '<p><em>'. t('This setting will be applied to all posts and private |
200 | 200 | messages.') .'</em></p>'; |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | $form['bbcode'] = array( |
205 | 205 | '#type' => 'fieldset', |
206 | 206 | '#title' => t('BBcode settings'), |
207 | - '#collapsible' => TRUE, |
|
208 | - '#collapsed' => TRUE, |
|
207 | + '#collapsible' => true, |
|
208 | + '#collapsed' => true, |
|
209 | 209 | ); |
210 | 210 | |
211 | 211 | $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | if (variable_get('boincimport_bbcode', 0)) { |
243 | 243 | if ($bbcode_disabled) { |
244 | 244 | $ready_for_migration = 0; |
245 | - $form['bbcode']['#collapsed'] = FALSE; |
|
245 | + $form['bbcode']['#collapsed'] = false; |
|
246 | 246 | $output .= '<p><span class="marker">'; |
247 | 247 | $output .= t('The !bbcode_module is required to transform BBcode into HTML. |
248 | 248 | You first need to !enable_bbcode', array( |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $sql = "SELECT COUNT(*) FROM {filters} WHERE module = 'bbcode' AND format = %d"; |
254 | 254 | $result = db_query($sql, $input_format); |
255 | 255 | if (!db_result($result)) { |
256 | - $form['bbcode']['#collapsed'] = FALSE; |
|
256 | + $form['bbcode']['#collapsed'] = false; |
|
257 | 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}"), |
@@ -263,7 +263,7 @@ discard block |
||
263 | 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 | - $form['bbcode']['#collapsed'] = FALSE; |
|
266 | + $form['bbcode']['#collapsed'] = false; |
|
267 | 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'))), |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | $form['url_transforms'] = array( |
284 | 284 | '#type' => 'fieldset', |
285 | 285 | '#title' => t('URL transforms'), |
286 | - '#collapsible' => TRUE, |
|
287 | - '#collapsed' => TRUE, |
|
286 | + '#collapsible' => true, |
|
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 | } |
@@ -315,8 +315,8 @@ discard block |
||
315 | 315 | $form['migration'] = array( |
316 | 316 | '#type' => 'fieldset', |
317 | 317 | '#title' => 'Migration', |
318 | - '#collapsible' => TRUE, |
|
319 | - '#collapsed' => FALSE, |
|
318 | + '#collapsible' => true, |
|
319 | + '#collapsed' => false, |
|
320 | 320 | ); |
321 | 321 | variable_set('boincimport_ready', $ready_for_migration); |
322 | 322 | if ($ready_for_migration) { |
@@ -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( |
@@ -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' |
|
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' |
|
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 | } |
@@ -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' |
@@ -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) { |
@@ -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', ''), |
@@ -44,306 +44,306 @@ discard block |
||
44 | 44 | 'boinc_server_status_url' => variable_get('boinc_server_status_url', ''), |
45 | 45 | 'boinc_app_list_url' => variable_get('boinc_app_list_url', ''), |
46 | 46 | 'boinc_debug_mode' => variable_get('boinc_debug_mode', 0), |
47 | - ); |
|
48 | - //drupal_set_message(print_r($default, true)); |
|
49 | - //drupal_set_message(print_r($form_state, true)); |
|
50 | - // Show overrides if the root dir is set and others have not been detected |
|
51 | - $show_overrides = FALSE; |
|
52 | - if ($default['boinc_root_dir']) { |
|
47 | + ); |
|
48 | + //drupal_set_message(print_r($default, true)); |
|
49 | + //drupal_set_message(print_r($form_state, true)); |
|
50 | + // Show overrides if the root dir is set and others have not been detected |
|
51 | + $show_overrides = FALSE; |
|
52 | + if ($default['boinc_root_dir']) { |
|
53 | 53 | foreach ($default as $key => $dir) { |
54 | - switch ($key) { |
|
55 | - case 'boinc_config_xml_dir': |
|
54 | + switch ($key) { |
|
55 | + case 'boinc_config_xml_dir': |
|
56 | 56 | case 'boinc_html_inc_dir': |
57 | 57 | case 'boinc_project_config_dir': |
58 | 58 | case 'boinc_user_image_dir': |
59 | 59 | // If any of these values are not set, show the overrides section |
60 | 60 | if (!$dir) { |
61 | - $default[$key] = $form_state['values'][$key]; |
|
62 | - $show_overrides = TRUE; |
|
63 | - break; |
|
61 | + $default[$key] = $form_state['values'][$key]; |
|
62 | + $show_overrides = TRUE; |
|
63 | + break; |
|
64 | 64 | } |
65 | 65 | break; |
66 | - default: |
|
66 | + default: |
|
67 | 67 | } |
68 | - if ($show_overrides) { |
|
68 | + if ($show_overrides) { |
|
69 | 69 | break; |
70 | - } |
|
70 | + } |
|
71 | 71 | } |
72 | - } |
|
73 | - // Define the form |
|
74 | - $form['boinc_root_dir'] = array( |
|
72 | + } |
|
73 | + // Define the form |
|
74 | + $form['boinc_root_dir'] = array( |
|
75 | 75 | '#type' => 'textfield', |
76 | 76 | '#title' => t('BOINC project root directory'), |
77 | 77 | '#default_value' => $default['boinc_root_dir'], |
78 | 78 | '#description' => t('The filesystem path to the BOINC project root. This |
79 | 79 | directory should contain config.xml as well as the html subdirectory, |
80 | 80 | which itself contains inc/, project/, and user_profile/.'), |
81 | - ); |
|
82 | - $form['overrides'] = array( |
|
81 | + ); |
|
82 | + $form['overrides'] = array( |
|
83 | 83 | '#title' => t('Overrides'), |
84 | 84 | '#type' => 'fieldset', |
85 | 85 | '#description' => '', |
86 | 86 | '#collapsible' => TRUE, |
87 | 87 | '#collapsed' => !$show_overrides, |
88 | 88 | '#attributes' => array('class' => 'advanced-settings') |
89 | - ); |
|
90 | - $form['overrides']['boinc_config_xml_dir'] = array( |
|
89 | + ); |
|
90 | + $form['overrides']['boinc_config_xml_dir'] = array( |
|
91 | 91 | '#type' => 'textfield', |
92 | 92 | '#title' => t('BOINC config.xml directory'), |
93 | 93 | '#default_value' => $default['boinc_config_xml_dir'], |
94 | 94 | '#description' => t('The filesystem path that contains config.xml'), |
95 | - ); |
|
96 | - $form['overrides']['boinc_html_inc_dir'] = array( |
|
95 | + ); |
|
96 | + $form['overrides']['boinc_html_inc_dir'] = array( |
|
97 | 97 | '#type' => 'textfield', |
98 | 98 | '#title' => t('BOINC web includes directory'), |
99 | 99 | '#default_value' => $default['boinc_html_inc_dir'], |
100 | 100 | '#description' => t('The filesystem path to the html/inc/ directory that |
101 | 101 | contains util.inc'), |
102 | - ); |
|
103 | - $form['overrides']['boinc_project_config_dir'] = array( |
|
102 | + ); |
|
103 | + $form['overrides']['boinc_project_config_dir'] = array( |
|
104 | 104 | '#type' => 'textfield', |
105 | 105 | '#title' => t('BOINC project config directory'), |
106 | 106 | '#default_value' => $default['boinc_project_config_dir'], |
107 | 107 | '#description' => t('The filesystem path to the project/ directory that |
108 | 108 | contains project.inc'), |
109 | - ); |
|
110 | - $form['overrides']['boinc_user_image_dir'] = array( |
|
109 | + ); |
|
110 | + $form['overrides']['boinc_user_image_dir'] = array( |
|
111 | 111 | '#type' => 'textfield', |
112 | 112 | '#title' => t('BOINC user profile image directory'), |
113 | 113 | '#default_value' => $default['boinc_user_image_dir'], |
114 | 114 | '#description' => t('The filesystem directory that contains user images'), |
115 | - ); |
|
116 | - $form['boinc_server_status_url'] = array( |
|
115 | + ); |
|
116 | + $form['boinc_server_status_url'] = array( |
|
117 | 117 | '#type' => 'textfield', |
118 | 118 | '#title' => t('BOINC server status page URL (optional)'), |
119 | 119 | '#default_value' => $default['boinc_server_status_url'], |
120 | 120 | '#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).', |
121 | - array( |
|
121 | + array( |
|
122 | 122 | '%full_url' => $base_url . '/server_status.php', |
123 | 123 | '%relative_url' => 'server_status.php', |
124 | - ) |
|
124 | + ) |
|
125 | 125 | ), |
126 | - ); |
|
127 | - $form['boinc_app_list_url'] = array( |
|
126 | + ); |
|
127 | + $form['boinc_app_list_url'] = array( |
|
128 | 128 | '#type' => 'textfield', |
129 | 129 | '#title' => t('BOINC applications page URL (optional)'), |
130 | 130 | '#default_value' => $default['boinc_app_list_url'], |
131 | 131 | '#description' => t('An absolute URL or path relative to the site base to the applications page (e.g. %full_url or just %relative_url).', |
132 | - array( |
|
132 | + array( |
|
133 | 133 | '%full_url' => $base_url . '/apps.php', |
134 | 134 | '%relative_url' => 'apps.php', |
135 | - ) |
|
135 | + ) |
|
136 | 136 | ), |
137 | - ); |
|
138 | - $form['boinc_host_sched_logs_dir'] = array( |
|
137 | + ); |
|
138 | + $form['boinc_host_sched_logs_dir'] = array( |
|
139 | 139 | '#type' => 'textfield', |
140 | 140 | '#title' => t('BOINC host scheduler log directory (optional)'), |
141 | 141 | '#default_value' => $default['boinc_host_sched_logs_dir'], |
142 | 142 | '#description' => t('The filesystem directory that contains host scheduler logs'), |
143 | - ); |
|
144 | - $form['boinc_debug_mode'] = array( |
|
143 | + ); |
|
144 | + $form['boinc_debug_mode'] = array( |
|
145 | 145 | '#type' => 'checkbox', |
146 | 146 | '#title' => t('Show debug messages in system log'), |
147 | 147 | '#default_value' => $default['boinc_debug_mode'] |
148 | - ); |
|
149 | - return system_settings_form($form); |
|
148 | + ); |
|
149 | + return system_settings_form($form); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
153 | - * Validate the BOINC environment form. |
|
154 | - */ |
|
153 | + * Validate the BOINC environment form. |
|
154 | + */ |
|
155 | 155 | function boincuser_admin_environment_validate($form, &$form_state) { |
156 | - $values = $form_state['values']; |
|
157 | - if (!$values['boinc_root_dir']) { |
|
156 | + $values = $form_state['values']; |
|
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 | + } |
|
161 | + elseif (!is_dir($values['boinc_root_dir'])) { |
|
162 | 162 | form_set_error('boinc_root_dir', t('BOINC project root not found at %directory', |
163 | - array('%directory' => $values['boinc_root_dir']) |
|
163 | + array('%directory' => $values['boinc_root_dir']) |
|
164 | 164 | )); |
165 | - } |
|
166 | - else { |
|
165 | + } |
|
166 | + else { |
|
167 | 167 | // By default, try to automatically set specific directories from the root |
168 | 168 | if (!$values['boinc_config_xml_dir']) { |
169 | - $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
|
170 | - form_set_value($form['overrides']['boinc_config_xml_dir'], $values['boinc_config_xml_dir'], $form_state); |
|
169 | + $values['boinc_config_xml_dir'] = $values['boinc_root_dir']; |
|
170 | + form_set_value($form['overrides']['boinc_config_xml_dir'], $values['boinc_config_xml_dir'], $form_state); |
|
171 | 171 | } |
172 | 172 | if (!$values['boinc_html_inc_dir']) { |
173 | - $values['boinc_html_inc_dir'] = "{$values['boinc_root_dir']}/html/inc"; |
|
174 | - form_set_value($form['overrides']['boinc_html_inc_dir'], $values['boinc_html_inc_dir'], $form_state); |
|
173 | + $values['boinc_html_inc_dir'] = "{$values['boinc_root_dir']}/html/inc"; |
|
174 | + form_set_value($form['overrides']['boinc_html_inc_dir'], $values['boinc_html_inc_dir'], $form_state); |
|
175 | 175 | } |
176 | 176 | if (!$values['boinc_project_config_dir']) { |
177 | - $values['boinc_project_config_dir'] = "{$values['boinc_root_dir']}/html/project"; |
|
178 | - form_set_value($form['overrides']['boinc_project_config_dir'], $values['boinc_project_config_dir'], $form_state); |
|
177 | + $values['boinc_project_config_dir'] = "{$values['boinc_root_dir']}/html/project"; |
|
178 | + form_set_value($form['overrides']['boinc_project_config_dir'], $values['boinc_project_config_dir'], $form_state); |
|
179 | 179 | } |
180 | 180 | if (!$values['boinc_user_image_dir']) { |
181 | - $values['boinc_user_image_dir'] = "{$values['boinc_root_dir']}/html/user_profile/images"; |
|
182 | - form_set_value($form['overrides']['boinc_user_image_dir'], $values['boinc_user_image_dir'], $form_state); |
|
181 | + $values['boinc_user_image_dir'] = "{$values['boinc_root_dir']}/html/user_profile/images"; |
|
182 | + form_set_value($form['overrides']['boinc_user_image_dir'], $values['boinc_user_image_dir'], $form_state); |
|
183 | 183 | } |
184 | 184 | // Validate that required BOINC content is found |
185 | 185 | if (!is_readable("{$values['boinc_config_xml_dir']}/config.xml")) { |
186 | - form_set_error('boinc_config_xml_dir', t('@file not found in %directory', |
|
186 | + form_set_error('boinc_config_xml_dir', t('@file not found in %directory', |
|
187 | 187 | array( |
188 | - '@file' => 'config.xml', |
|
189 | - '%directory' => "{$values['boinc_config_xml_dir']}/" |
|
188 | + '@file' => 'config.xml', |
|
189 | + '%directory' => "{$values['boinc_config_xml_dir']}/" |
|
190 | 190 | ) |
191 | - )); |
|
191 | + )); |
|
192 | 192 | } |
193 | 193 | if (!is_readable("{$values['boinc_html_inc_dir']}/util.inc")) { |
194 | - form_set_error('boinc_html_inc_dir', t('@file not found in %directory', |
|
194 | + form_set_error('boinc_html_inc_dir', t('@file not found in %directory', |
|
195 | 195 | array( |
196 | - '@file' => 'util.inc', |
|
197 | - '%directory' => "{$values['boinc_html_inc_dir']}/" |
|
196 | + '@file' => 'util.inc', |
|
197 | + '%directory' => "{$values['boinc_html_inc_dir']}/" |
|
198 | 198 | ) |
199 | - )); |
|
199 | + )); |
|
200 | 200 | } |
201 | 201 | if (!is_readable("{$values['boinc_project_config_dir']}/project.inc")) { |
202 | - form_set_error('boinc_project_config_dir', t('@file not found in %directory', |
|
202 | + form_set_error('boinc_project_config_dir', t('@file not found in %directory', |
|
203 | 203 | array( |
204 | - '@file' => 'project.inc', |
|
205 | - '%directory' => "{$values['boinc_project_config_dir']}/" |
|
204 | + '@file' => 'project.inc', |
|
205 | + '%directory' => "{$values['boinc_project_config_dir']}/" |
|
206 | 206 | ) |
207 | - )); |
|
207 | + )); |
|
208 | 208 | } |
209 | 209 | if (!is_dir($values['boinc_user_image_dir'])) { |
210 | - form_set_error('boinc_user_image_dir', t('Profile image directory not found |
|
210 | + form_set_error('boinc_user_image_dir', t('Profile image directory not found |
|
211 | 211 | at %directory', array('%directory' => $values['boinc_user_image_dir']) |
212 | - )); |
|
212 | + )); |
|
213 | 213 | } |
214 | 214 | if ($values['boinc_host_sched_logs_dir'] |
215 | 215 | AND !is_dir($values['boinc_host_sched_logs_dir']) |
216 | - ) { |
|
217 | - form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
|
216 | + ) { |
|
217 | + form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
|
218 | 218 | directory not found at %directory', |
219 | 219 | array('%directory' => $values['boinc_host_sched_logs_dir']) |
220 | - )); |
|
220 | + )); |
|
221 | + } |
|
221 | 222 | } |
222 | - } |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
226 | - * Handle post-validation submission of BOINC environment form. |
|
227 | - */ |
|
226 | + * Handle post-validation submission of BOINC environment form. |
|
227 | + */ |
|
228 | 228 | function boincuser_admin_environment_submit($form, &$form_state) { |
229 | - unset($_SESSION['boinc_env']); |
|
230 | - drupal_set_message(t('BOINC environment settings have been updated.')); |
|
229 | + unset($_SESSION['boinc_env']); |
|
230 | + drupal_set_message(t('BOINC environment settings have been updated.')); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
234 | - * The BOINC scheduler form provides options for how scheduler tags are |
|
235 | - * inserted into the front page |
|
236 | - */ |
|
234 | + * The BOINC scheduler form provides options for how scheduler tags are |
|
235 | + * inserted into the front page |
|
236 | + */ |
|
237 | 237 | function boincuser_admin_scheduler(&$form_state) { |
238 | - $form = array(); |
|
239 | - $config_cgi_url = ''; |
|
240 | - if ($config_xml_dir = variable_get('boinc_config_xml_dir', '')) { |
|
238 | + $form = array(); |
|
239 | + $config_cgi_url = ''; |
|
240 | + if ($config_xml_dir = variable_get('boinc_config_xml_dir', '')) { |
|
241 | 241 | // Get the cgi_url option from the config file as the default scheduler URL |
242 | 242 | $xml = new DOMDocument(); |
243 | 243 | if ($xml->load("{$config_xml_dir}/config.xml")) { |
244 | - $config = xml_to_array($xml); |
|
245 | - if (isset($config['boinc']['config']['cgi_url']['@value'])) { |
|
244 | + $config = xml_to_array($xml); |
|
245 | + if (isset($config['boinc']['config']['cgi_url']['@value'])) { |
|
246 | 246 | $config_cgi_url = rtrim(trim($config['boinc']['config']['cgi_url']['@value']), '/'); |
247 | 247 | $config_cgi_url .= '/cgi'; |
248 | - } |
|
248 | + } |
|
249 | + } |
|
249 | 250 | } |
250 | - } |
|
251 | - $default = array( |
|
251 | + $default = array( |
|
252 | 252 | 'boinc_scheduler_urls' => variable_get('boinc_scheduler_urls', $config_cgi_url), |
253 | 253 | 'boinc_scheduler_tag_format_old' => variable_get('boinc_scheduler_tag_format_old', 1), |
254 | 254 | 'boinc_scheduler_tag_format_new' => variable_get('boinc_scheduler_tag_format_new', 1) |
255 | - ); |
|
255 | + ); |
|
256 | 256 | |
257 | - // Define the form |
|
258 | - $form['boinc_scheduler_urls'] = array( |
|
257 | + // Define the form |
|
258 | + $form['boinc_scheduler_urls'] = array( |
|
259 | 259 | '#type' => 'textarea', |
260 | 260 | '#title' => t('Scheduling server URLs'), |
261 | 261 | '#default_value' => $default['boinc_scheduler_urls'], |
262 | 262 | '#cols' => 60, |
263 | 263 | '#rows' => 5, |
264 | 264 | '#description' => t('If there are multiple URLs, please enter one per line.'), |
265 | - ); |
|
266 | - $form['boinc_scheduler_tag_format_old'] = array( |
|
265 | + ); |
|
266 | + $form['boinc_scheduler_tag_format_old'] = array( |
|
267 | 267 | '#type' => 'checkbox', |
268 | 268 | '#title' => t('Old format (@scheduler tag)', array('@scheduler' => '<scheduler>')), |
269 | 269 | '#default_value' => $default['boinc_scheduler_tag_format_old'] |
270 | - ); |
|
271 | - $form['boinc_scheduler_tag_format_new'] = array( |
|
270 | + ); |
|
271 | + $form['boinc_scheduler_tag_format_new'] = array( |
|
272 | 272 | '#type' => 'checkbox', |
273 | 273 | '#title' => t('New format (@link tag)', array('@link' => '<link>')), |
274 | 274 | '#default_value' => $default['boinc_scheduler_tag_format_new'] |
275 | - ); |
|
275 | + ); |
|
276 | 276 | |
277 | - return system_settings_form($form); |
|
277 | + return system_settings_form($form); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
281 | - * Validate the BOINC scheduler form. |
|
282 | - */ |
|
281 | + * Validate the BOINC scheduler form. |
|
282 | + */ |
|
283 | 283 | function boincuser_admin_scheduler_validate($form, &$form_state) { |
284 | - $values = $form_state['values']; |
|
285 | - if (!$values['boinc_scheduler_urls']) { |
|
284 | + $values = $form_state['values']; |
|
285 | + if (!$values['boinc_scheduler_urls']) { |
|
286 | 286 | form_set_error('boinc_scheduler_urls', t('At least one scheduling server |
287 | 287 | URL must be specified.')); |
288 | - } |
|
289 | - else { |
|
288 | + } |
|
289 | + else { |
|
290 | 290 | $urls = explode("\r\n", $values['boinc_scheduler_urls']); |
291 | 291 | foreach ($urls as $key => $url) { |
292 | - if (!$url) { |
|
292 | + if (!$url) { |
|
293 | 293 | unset($urls[$key]); |
294 | 294 | continue; |
295 | - } |
|
296 | - if (!filter_var($url, FILTER_VALIDATE_URL)) { |
|
295 | + } |
|
296 | + if (!filter_var($url, FILTER_VALIDATE_URL)) { |
|
297 | 297 | form_set_error('boinc_scheduler_urls', t('@url is not a valid URL |
298 | 298 | format.', array('@url' => $url))); |
299 | 299 | break; |
300 | - } |
|
300 | + } |
|
301 | 301 | } |
302 | 302 | $form_state['values']['boinc_scheduler_urls'] = implode("\r\n", $urls); |
303 | - } |
|
303 | + } |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
307 | - * Handle post-validation submission of BOINC scheduler form. |
|
308 | - */ |
|
307 | + * Handle post-validation submission of BOINC scheduler form. |
|
308 | + */ |
|
309 | 309 | function boincuser_admin_scheduler_submit($form, &$form_state) { |
310 | - drupal_set_message(t('BOINC scheduling server settings have been updated.')); |
|
310 | + drupal_set_message(t('BOINC scheduling server settings have been updated.')); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
314 | 314 | /** |
315 | - * Other BOINC options that don't fit elsewhere |
|
316 | - */ |
|
315 | + * Other BOINC options that don't fit elsewhere |
|
316 | + */ |
|
317 | 317 | function boincuser_admin_other(&$form_state) { |
318 | - $form = array(); |
|
318 | + $form = array(); |
|
319 | 319 | |
320 | - //form defaults |
|
321 | - $default = array( |
|
322 | - 'boinc_other_frontpage' => variable_get('boinc_other_frontpage', ''), |
|
323 | - ); |
|
320 | + //form defaults |
|
321 | + $default = array( |
|
322 | + 'boinc_other_frontpage' => variable_get('boinc_other_frontpage', ''), |
|
323 | + ); |
|
324 | 324 | |
325 | - // Define the form |
|
326 | - $form['boinc_other_frontpage'] = array ( |
|
325 | + // Define the form |
|
326 | + $form['boinc_other_frontpage'] = array ( |
|
327 | 327 | '#type' => 'textarea', |
328 | 328 | '#title' => bts('Message for site\'s Home Page', array(), NULL, 'boinc:admin-boinc-other-options'), |
329 | 329 | '#default_value' => $default['boinc_other_frontpage'], |
330 | 330 | '#cols' => 60, |
331 | 331 | '#rows' => 8, |
332 | 332 | '#description' => bts('Text to be displayed on the site\'s Home landing page.', array(), NULL, 'boinc:admin-boinc-other-options'), |
333 | - ); |
|
333 | + ); |
|
334 | 334 | |
335 | - return system_settings_form($form); |
|
335 | + return system_settings_form($form); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
339 | - * Validate BOINC other form |
|
340 | - */ |
|
339 | + * Validate BOINC other form |
|
340 | + */ |
|
341 | 341 | function boincuser_admin_other_validate($form, &$form_state) { |
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
345 | - * Submit BOINC other form |
|
346 | - */ |
|
345 | + * Submit BOINC other form |
|
346 | + */ |
|
347 | 347 | function boincuser_admin_other_submit($form, &$form_state) { |
348 | - drupal_set_message( bts("Status: BOINC other settings have been updated", array(), NULL, 'boinc:admin-boinc-other-options') ); |
|
348 | + drupal_set_message( bts("Status: BOINC other settings have been updated", array(), NULL, 'boinc:admin-boinc-other-options') ); |
|
349 | 349 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | '#default_value' => $default['boinc_server_status_url'], |
120 | 120 | '#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).', |
121 | 121 | array( |
122 | - '%full_url' => $base_url . '/server_status.php', |
|
122 | + '%full_url' => $base_url.'/server_status.php', |
|
123 | 123 | '%relative_url' => 'server_status.php', |
124 | 124 | ) |
125 | 125 | ), |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | '#default_value' => $default['boinc_app_list_url'], |
131 | 131 | '#description' => t('An absolute URL or path relative to the site base to the applications page (e.g. %full_url or just %relative_url).', |
132 | 132 | array( |
133 | - '%full_url' => $base_url . '/apps.php', |
|
133 | + '%full_url' => $base_url.'/apps.php', |
|
134 | 134 | '%relative_url' => 'apps.php', |
135 | 135 | ) |
136 | 136 | ), |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | ); |
324 | 324 | |
325 | 325 | // Define the form |
326 | - $form['boinc_other_frontpage'] = array ( |
|
326 | + $form['boinc_other_frontpage'] = array( |
|
327 | 327 | '#type' => 'textarea', |
328 | 328 | '#title' => bts('Message for site\'s Home Page', array(), NULL, 'boinc:admin-boinc-other-options'), |
329 | 329 | '#default_value' => $default['boinc_other_frontpage'], |
@@ -345,5 +345,5 @@ discard block |
||
345 | 345 | * Submit BOINC other form |
346 | 346 | */ |
347 | 347 | function boincuser_admin_other_submit($form, &$form_state) { |
348 | - drupal_set_message( bts("Status: BOINC other settings have been updated", array(), NULL, 'boinc:admin-boinc-other-options') ); |
|
348 | + drupal_set_message(bts("Status: BOINC other settings have been updated", array(), NULL, 'boinc:admin-boinc-other-options')); |
|
349 | 349 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | //drupal_set_message(print_r($default, true)); |
49 | 49 | //drupal_set_message(print_r($form_state, true)); |
50 | 50 | // Show overrides if the root dir is set and others have not been detected |
51 | - $show_overrides = FALSE; |
|
51 | + $show_overrides = false; |
|
52 | 52 | if ($default['boinc_root_dir']) { |
53 | 53 | foreach ($default as $key => $dir) { |
54 | 54 | switch ($key) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // If any of these values are not set, show the overrides section |
60 | 60 | if (!$dir) { |
61 | 61 | $default[$key] = $form_state['values'][$key]; |
62 | - $show_overrides = TRUE; |
|
62 | + $show_overrides = true; |
|
63 | 63 | break; |
64 | 64 | } |
65 | 65 | break; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | '#title' => t('Overrides'), |
84 | 84 | '#type' => 'fieldset', |
85 | 85 | '#description' => '', |
86 | - '#collapsible' => TRUE, |
|
86 | + '#collapsible' => true, |
|
87 | 87 | '#collapsed' => !$show_overrides, |
88 | 88 | '#attributes' => array('class' => 'advanced-settings') |
89 | 89 | ); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | )); |
213 | 213 | } |
214 | 214 | if ($values['boinc_host_sched_logs_dir'] |
215 | - AND !is_dir($values['boinc_host_sched_logs_dir']) |
|
215 | + and !is_dir($values['boinc_host_sched_logs_dir']) |
|
216 | 216 | ) { |
217 | 217 | form_set_error('boinc_host_sched_logs_dir', t('Host scheduler log |
218 | 218 | directory not found at %directory', |
@@ -325,11 +325,11 @@ discard block |
||
325 | 325 | // Define the form |
326 | 326 | $form['boinc_other_frontpage'] = array ( |
327 | 327 | '#type' => 'textarea', |
328 | - '#title' => bts('Message for site\'s Home Page', array(), NULL, 'boinc:admin-boinc-other-options'), |
|
328 | + '#title' => bts('Message for site\'s Home Page', array(), null, 'boinc:admin-boinc-other-options'), |
|
329 | 329 | '#default_value' => $default['boinc_other_frontpage'], |
330 | 330 | '#cols' => 60, |
331 | 331 | '#rows' => 8, |
332 | - '#description' => bts('Text to be displayed on the site\'s Home landing page.', array(), NULL, 'boinc:admin-boinc-other-options'), |
|
332 | + '#description' => bts('Text to be displayed on the site\'s Home landing page.', array(), null, 'boinc:admin-boinc-other-options'), |
|
333 | 333 | ); |
334 | 334 | |
335 | 335 | return system_settings_form($form); |
@@ -345,5 +345,5 @@ discard block |
||
345 | 345 | * Submit BOINC other form |
346 | 346 | */ |
347 | 347 | function boincuser_admin_other_submit($form, &$form_state) { |
348 | - drupal_set_message( bts("Status: BOINC other settings have been updated", array(), NULL, 'boinc:admin-boinc-other-options') ); |
|
348 | + drupal_set_message( bts("Status: BOINC other settings have been updated", array(), null, 'boinc:admin-boinc-other-options') ); |
|
349 | 349 | } |
@@ -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'; |
@@ -4,47 +4,47 @@ |
||
4 | 4 | * Implementation of hook_user_default_permissions(). |
5 | 5 | */ |
6 | 6 | function internationalization_user_default_permissions() { |
7 | - $permissions = array(); |
|
7 | + $permissions = array(); |
|
8 | 8 | |
9 | - // Exported permission: administer all languages |
|
10 | - $permissions['administer all languages'] = array( |
|
9 | + // Exported permission: administer all languages |
|
10 | + $permissions['administer all languages'] = array( |
|
11 | 11 | 'name' => 'administer all languages', |
12 | 12 | 'roles' => array( |
13 | - '0' => 'administrator', |
|
13 | + '0' => 'administrator', |
|
14 | 14 | ), |
15 | - ); |
|
15 | + ); |
|
16 | 16 | |
17 | - // Exported permission: administer languages |
|
18 | - $permissions['administer languages'] = array( |
|
17 | + // Exported permission: administer languages |
|
18 | + $permissions['administer languages'] = array( |
|
19 | 19 | 'name' => 'administer languages', |
20 | 20 | 'roles' => array( |
21 | - '0' => 'administrator', |
|
21 | + '0' => 'administrator', |
|
22 | 22 | ), |
23 | - ); |
|
23 | + ); |
|
24 | 24 | |
25 | - // Exported permission: administer translations |
|
26 | - $permissions['administer translations'] = array( |
|
25 | + // Exported permission: administer translations |
|
26 | + $permissions['administer translations'] = array( |
|
27 | 27 | 'name' => 'administer translations', |
28 | 28 | 'roles' => array( |
29 | - '0' => 'administrator', |
|
29 | + '0' => 'administrator', |
|
30 | 30 | ), |
31 | - ); |
|
31 | + ); |
|
32 | 32 | |
33 | - // Exported permission: translate content |
|
34 | - $permissions['translate content'] = array( |
|
33 | + // Exported permission: translate content |
|
34 | + $permissions['translate content'] = array( |
|
35 | 35 | 'name' => 'translate content', |
36 | 36 | 'roles' => array( |
37 | - '0' => 'administrator', |
|
37 | + '0' => 'administrator', |
|
38 | 38 | ), |
39 | - ); |
|
39 | + ); |
|
40 | 40 | |
41 | - // Exported permission: translate interface |
|
42 | - $permissions['translate interface'] = array( |
|
41 | + // Exported permission: translate interface |
|
42 | + $permissions['translate interface'] = array( |
|
43 | 43 | 'name' => 'translate interface', |
44 | 44 | 'roles' => array( |
45 | - '0' => 'administrator', |
|
45 | + '0' => 'administrator', |
|
46 | 46 | ), |
47 | - ); |
|
47 | + ); |
|
48 | 48 | |
49 | - return $permissions; |
|
49 | + return $permissions; |
|
50 | 50 | } |