@@ -44,8 +44,7 @@ discard block |
||
44 | 44 | $nid = $existing_teams[$boinc_team->id]; |
45 | 45 | $success = boincteam_import($boinc_team, $nid); |
46 | 46 | } |
47 | - } |
|
48 | - else { |
|
47 | + } else { |
|
49 | 48 | // Import new teams created by RPC or ops/team_import.php |
50 | 49 | $success = boincteam_import($boinc_team); |
51 | 50 | } |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | $node->body = $boincteam->description; |
78 | 77 | $node->teaser = $teaser; |
79 | 78 | $node->uid = boincuser_lookup_uid($boincteam->userid); |
80 | - } |
|
81 | - else { |
|
79 | + } else { |
|
82 | 80 | // Construct the team as a new node |
83 | 81 | $node = array( |
84 | 82 | 'type' => 'team', |
@@ -132,8 +130,7 @@ discard block |
||
132 | 130 | } |
133 | 131 | if ($boincid) { |
134 | 132 | return $ids; |
135 | - } |
|
136 | - else { |
|
133 | + } else { |
|
137 | 134 | return array_map('boincuser_lookup_uid', $ids); |
138 | 135 | } |
139 | 136 | } |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | 'teaser' => $teaser, |
88 | 88 | 'uid' => boincuser_lookup_uid($boincteam->userid), |
89 | 89 | 'path' => null, |
90 | - 'status' => 1, // published or not - always publish |
|
90 | + 'status' => 1, // published or not - always publish |
|
91 | 91 | 'promote' => 0, |
92 | 92 | 'created' => $boincteam->create_time, |
93 | - 'comment' => 0, // comments disabled |
|
93 | + 'comment' => 0, // comments disabled |
|
94 | 94 | 'moderate' => 0, |
95 | 95 | 'sticky' => 0, |
96 | 96 | 'format' => $input_format |
97 | 97 | ); |
98 | - $node = (object) $node; // node_save requires an object form |
|
98 | + $node = (object)$node; // node_save requires an object form |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $node->taxonomy[] = taxonomy_get_term($team_type_tid); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * flag send_email=1, meaning their notification privacy will be |
126 | 126 | * respected. This is useful the list of users are to be contacted. |
127 | 127 | */ |
128 | -function _boincteam_userids($boincteamid, $boincid=TRUE, $respectprivacy=TRUE) { |
|
128 | +function _boincteam_userids($boincteamid, $boincid = TRUE, $respectprivacy = TRUE) { |
|
129 | 129 | $sql = 'SELECT user.id as id FROM {user} user WHERE user.teamid=%s'; |
130 | 130 | if ($respectprivacy) { |
131 | 131 | $sql .= ' AND user.send_email=1'; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * flag send_email=1, meaning their notification privacy will be |
158 | 158 | * respected. This is useful the list of users are to be contacted. |
159 | 159 | */ |
160 | -function _boincteam_emails($boincteamid, $respectprivacy=TRUE) { |
|
160 | +function _boincteam_emails($boincteamid, $respectprivacy = TRUE) { |
|
161 | 161 | $sql = 'SELECT user.email_addr as email_addr FROM {user} user WHERE user.teamid=%s'; |
162 | 162 | if ($respectprivacy) { |
163 | 163 | $sql .= ' AND user.send_email=1'; |
@@ -15,41 +15,41 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function boincteam_sync() { |
17 | 17 | |
18 | - // Get the list of teams to import |
|
19 | - db_set_active('boinc_rw'); |
|
20 | - $boinc_teams = db_query(' |
|
18 | + // Get the list of teams to import |
|
19 | + db_set_active('boinc_rw'); |
|
20 | + $boinc_teams = db_query(' |
|
21 | 21 | SELECT id, name, description, userid, create_time, seti_id |
22 | 22 | FROM team |
23 | 23 | WHERE mod_time > FROM_UNIXTIME(%d)', |
24 | 24 | variable_get('boincteam_last_sync', 0) |
25 | - ); |
|
26 | - db_set_active('default'); |
|
25 | + ); |
|
26 | + db_set_active('default'); |
|
27 | 27 | |
28 | - $existing_teams = array(); |
|
28 | + $existing_teams = array(); |
|
29 | 29 | |
30 | - // Get the list of teams already in Drupal to be sure we're not importing |
|
31 | - // any twice |
|
32 | - $result = db_query(' |
|
30 | + // Get the list of teams already in Drupal to be sure we're not importing |
|
31 | + // any twice |
|
32 | + $result = db_query(' |
|
33 | 33 | SELECT nid, team_id FROM {boincteam}' |
34 | - ); |
|
35 | - while ($row = db_fetch_object($result)) { |
|
34 | + ); |
|
35 | + while ($row = db_fetch_object($result)) { |
|
36 | 36 | $existing_teams[$row->team_id] = $row->nid; |
37 | - } |
|
37 | + } |
|
38 | 38 | |
39 | - while ($boinc_team = db_fetch_object($boinc_teams)) { |
|
39 | + while ($boinc_team = db_fetch_object($boinc_teams)) { |
|
40 | 40 | $success = NULL; |
41 | 41 | if (isset($existing_teams[$boinc_team->id])) { |
42 | - if ($boinc_team->seti_id > 0) { |
|
42 | + if ($boinc_team->seti_id > 0) { |
|
43 | 43 | // Sync BOINC-wide teams |
44 | 44 | $nid = $existing_teams[$boinc_team->id]; |
45 | 45 | $success = boincteam_import($boinc_team, $nid); |
46 | - } |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | else { |
49 | - // Import new teams created by RPC or ops/team_import.php |
|
50 | - $success = boincteam_import($boinc_team); |
|
49 | + // Import new teams created by RPC or ops/team_import.php |
|
50 | + $success = boincteam_import($boinc_team); |
|
51 | + } |
|
51 | 52 | } |
52 | - } |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -58,58 +58,58 @@ discard block |
||
58 | 58 | */ |
59 | 59 | function boincteam_import($boincteam, $nid = NULL) { |
60 | 60 | |
61 | - $input_format = variable_get('boincimport_input_format', 0); |
|
62 | - $team_type_map = variable_get('boincimport_team_types', array()); |
|
61 | + $input_format = variable_get('boincimport_input_format', 0); |
|
62 | + $team_type_map = variable_get('boincimport_team_types', array()); |
|
63 | 63 | |
64 | - // Save the team type affiliation |
|
65 | - $team_type_tid = $team_type_map[$boincteam->type]; |
|
64 | + // Save the team type affiliation |
|
65 | + $team_type_tid = $team_type_map[$boincteam->type]; |
|
66 | 66 | |
67 | - $boincteam->description = html_entity_decode($boincteam->description, ENT_QUOTES, 'utf-8'); |
|
68 | - // Be sure the text is filtered for the default input format |
|
69 | - $boincteam->description = check_markup($boincteam->description, $input_format); |
|
67 | + $boincteam->description = html_entity_decode($boincteam->description, ENT_QUOTES, 'utf-8'); |
|
68 | + // Be sure the text is filtered for the default input format |
|
69 | + $boincteam->description = check_markup($boincteam->description, $input_format); |
|
70 | 70 | |
71 | - $teaser = node_teaser($boincteam->description); |
|
71 | + $teaser = node_teaser($boincteam->description); |
|
72 | 72 | |
73 | - if ($nid) { |
|
73 | + if ($nid) { |
|
74 | 74 | // Update an existing node |
75 | 75 | $node = node_load($nid); |
76 | 76 | $node->title = $boincteam->name; |
77 | 77 | $node->body = $boincteam->description; |
78 | 78 | $node->teaser = $teaser; |
79 | 79 | $node->uid = boincuser_lookup_uid($boincteam->userid); |
80 | - } |
|
81 | - else { |
|
80 | + } |
|
81 | + else { |
|
82 | 82 | // Construct the team as a new node |
83 | 83 | $node = array( |
84 | - 'type' => 'team', |
|
85 | - 'title' => $boincteam->name, |
|
86 | - 'body' => $boincteam->description, |
|
87 | - 'teaser' => $teaser, |
|
88 | - 'uid' => boincuser_lookup_uid($boincteam->userid), |
|
89 | - 'path' => null, |
|
90 | - 'status' => 1, // published or not - always publish |
|
91 | - 'promote' => 0, |
|
92 | - 'created' => $boincteam->create_time, |
|
93 | - 'comment' => 0, // comments disabled |
|
94 | - 'moderate' => 0, |
|
95 | - 'sticky' => 0, |
|
96 | - 'format' => $input_format |
|
84 | + 'type' => 'team', |
|
85 | + 'title' => $boincteam->name, |
|
86 | + 'body' => $boincteam->description, |
|
87 | + 'teaser' => $teaser, |
|
88 | + 'uid' => boincuser_lookup_uid($boincteam->userid), |
|
89 | + 'path' => null, |
|
90 | + 'status' => 1, // published or not - always publish |
|
91 | + 'promote' => 0, |
|
92 | + 'created' => $boincteam->create_time, |
|
93 | + 'comment' => 0, // comments disabled |
|
94 | + 'moderate' => 0, |
|
95 | + 'sticky' => 0, |
|
96 | + 'format' => $input_format |
|
97 | 97 | ); |
98 | 98 | $node = (object) $node; // node_save requires an object form |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - $node->taxonomy[] = taxonomy_get_term($team_type_tid); |
|
101 | + $node->taxonomy[] = taxonomy_get_term($team_type_tid); |
|
102 | 102 | |
103 | - // Save the team node |
|
104 | - node_save($node); |
|
105 | - $success = ($node->nid) ? TRUE : FALSE; |
|
103 | + // Save the team node |
|
104 | + node_save($node); |
|
105 | + $success = ($node->nid) ? TRUE : FALSE; |
|
106 | 106 | |
107 | - if (!$nid) { |
|
107 | + if (!$nid) { |
|
108 | 108 | // Save the team IDs to a BOINC <--> Drupal reference table, if needed |
109 | 109 | db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam->id, $node->nid); |
110 | - } |
|
110 | + } |
|
111 | 111 | |
112 | - return $success; |
|
112 | + return $success; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -126,25 +126,25 @@ discard block |
||
126 | 126 | * respected. This is useful the list of users are to be contacted. |
127 | 127 | */ |
128 | 128 | function _boincteam_userids($boincteamid, $boincid=TRUE, $respectprivacy=TRUE) { |
129 | - $sql = 'SELECT user.id as id FROM {user} user WHERE user.teamid=%s'; |
|
130 | - if ($respectprivacy) { |
|
129 | + $sql = 'SELECT user.id as id FROM {user} user WHERE user.teamid=%s'; |
|
130 | + if ($respectprivacy) { |
|
131 | 131 | $sql .= ' AND user.send_email=1'; |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | - db_set_active('boinc_ro'); |
|
135 | - $dbres = db_query($sql, $boincteamid); |
|
136 | - db_set_active('default'); |
|
134 | + db_set_active('boinc_ro'); |
|
135 | + $dbres = db_query($sql, $boincteamid); |
|
136 | + db_set_active('default'); |
|
137 | 137 | |
138 | - $ids = array(); |
|
139 | - while (($result = db_fetch_object($dbres)) != FALSE) { |
|
138 | + $ids = array(); |
|
139 | + while (($result = db_fetch_object($dbres)) != FALSE) { |
|
140 | 140 | $ids[] = $result->id; |
141 | - } |
|
142 | - if ($boincid) { |
|
141 | + } |
|
142 | + if ($boincid) { |
|
143 | 143 | return $ids; |
144 | - } |
|
145 | - else { |
|
144 | + } |
|
145 | + else { |
|
146 | 146 | return array_map('boincuser_lookup_uid', $ids); |
147 | - } |
|
147 | + } |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -158,18 +158,18 @@ discard block |
||
158 | 158 | * respected. This is useful the list of users are to be contacted. |
159 | 159 | */ |
160 | 160 | function _boincteam_emails($boincteamid, $respectprivacy=TRUE) { |
161 | - $sql = 'SELECT user.email_addr as email_addr FROM {user} user WHERE user.teamid=%s'; |
|
162 | - if ($respectprivacy) { |
|
161 | + $sql = 'SELECT user.email_addr as email_addr FROM {user} user WHERE user.teamid=%s'; |
|
162 | + if ($respectprivacy) { |
|
163 | 163 | $sql .= ' AND user.send_email=1'; |
164 | - } |
|
164 | + } |
|
165 | 165 | |
166 | - db_set_active('boinc_ro'); |
|
167 | - $dbres = db_query($sql, $boincteamid); |
|
168 | - db_set_active('default'); |
|
166 | + db_set_active('boinc_ro'); |
|
167 | + $dbres = db_query($sql, $boincteamid); |
|
168 | + db_set_active('default'); |
|
169 | 169 | |
170 | - $emails = array(); |
|
171 | - while (($result = db_fetch_object($dbres)) != FALSE) { |
|
170 | + $emails = array(); |
|
171 | + while (($result = db_fetch_object($dbres)) != FALSE) { |
|
172 | 172 | $emails[] = $result->email_addr; |
173 | - } |
|
174 | - return $emails; |
|
173 | + } |
|
174 | + return $emails; |
|
175 | 175 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | while ($boinc_team = db_fetch_object($boinc_teams)) { |
40 | - $success = NULL; |
|
40 | + $success = null; |
|
41 | 41 | if (isset($existing_teams[$boinc_team->id])) { |
42 | 42 | if ($boinc_team->seti_id > 0) { |
43 | 43 | // Sync BOINC-wide teams |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Import a given BOINC team object into Drupal |
58 | 58 | */ |
59 | -function boincteam_import($boincteam, $nid = NULL) { |
|
59 | +function boincteam_import($boincteam, $nid = null) { |
|
60 | 60 | |
61 | 61 | $input_format = variable_get('boincimport_input_format', 0); |
62 | 62 | $team_type_map = variable_get('boincimport_team_types', array()); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | // Save the team node |
104 | 104 | node_save($node); |
105 | - $success = ($node->nid) ? TRUE : FALSE; |
|
105 | + $success = ($node->nid) ? true : false; |
|
106 | 106 | |
107 | 107 | if (!$nid) { |
108 | 108 | // Save the team IDs to a BOINC <--> Drupal reference table, if needed |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * flag send_email=1, meaning their notification privacy will be |
126 | 126 | * respected. This is useful the list of users are to be contacted. |
127 | 127 | */ |
128 | -function _boincteam_userids($boincteamid, $boincid=TRUE, $respectprivacy=TRUE) { |
|
128 | +function _boincteam_userids($boincteamid, $boincid=true, $respectprivacy=true) { |
|
129 | 129 | $sql = 'SELECT user.id as id FROM {user} user WHERE user.teamid=%s'; |
130 | 130 | if ($respectprivacy) { |
131 | 131 | $sql .= ' AND user.send_email=1'; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | db_set_active('default'); |
137 | 137 | |
138 | 138 | $ids = array(); |
139 | - while (($result = db_fetch_object($dbres)) != FALSE) { |
|
139 | + while (($result = db_fetch_object($dbres)) != false) { |
|
140 | 140 | $ids[] = $result->id; |
141 | 141 | } |
142 | 142 | if ($boincid) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * flag send_email=1, meaning their notification privacy will be |
158 | 158 | * respected. This is useful the list of users are to be contacted. |
159 | 159 | */ |
160 | -function _boincteam_emails($boincteamid, $respectprivacy=TRUE) { |
|
160 | +function _boincteam_emails($boincteamid, $respectprivacy=true) { |
|
161 | 161 | $sql = 'SELECT user.email_addr as email_addr FROM {user} user WHERE user.teamid=%s'; |
162 | 162 | if ($respectprivacy) { |
163 | 163 | $sql .= ' AND user.send_email=1'; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | db_set_active('default'); |
169 | 169 | |
170 | 170 | $emails = array(); |
171 | - while (($result = db_fetch_object($dbres)) != FALSE) { |
|
171 | + while (($result = db_fetch_object($dbres)) != false) { |
|
172 | 172 | $emails[] = $result->email_addr; |
173 | 173 | } |
174 | 174 | return $emails; |
@@ -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_rw'])) ? 'boinc_rw' : 'default'; |
|
59 | + $db = (is_array($db_url) and isset($db_url['boinc_rw'])) ? 'boinc_rw' : 'default'; |
|
60 | 60 | $result = _boincimport_check_tables($tables, $db, 0); |
61 | 61 | |
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) { |
@@ -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_rw'])) ? 'boinc_rw' : '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_rw'])) ? 'boinc_rw' : '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_rw'])) ? 'boinc_rw' : 'default'; |
60 | 60 | $result = _boincimport_check_tables($tables, $db, 0); |
61 | 61 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | $default_db_url = is_array($db_url) ? end($db_url) : $db_url; |
80 | 80 | $url = variable_get('boincimport_db_url', $default_db_url); |
81 | 81 | if (!preg_match('{(mysql|pgsql):\/\/(.+):(.*?)@(.+)/(\w+)}i', $url)) { |
82 | - $output = '<p class="marker">'. t('Set the address of the BOINC database |
|
83 | - according to the following format:') . '<br /><pre> |
|
82 | + $output = '<p class="marker">'.t('Set the address of the BOINC database |
|
83 | + according to the following format:').'<br /><pre> |
|
84 | 84 | mysql://boinc_username:boinc_password@localhost/boinc_database |
85 | 85 | </pre></p>'; |
86 | 86 | $ready_for_migration = 0; |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | - $output = '<p>' . t('Note that due to a limitation within Drupal core, we cannot |
|
101 | + $output = '<p>'.t('Note that due to a limitation within Drupal core, we cannot |
|
102 | 102 | import messages from one database type to another database type. E.g, we |
103 | 103 | cannot import BOINC from a myqsl DB, to a postgresql DB. You need to import |
104 | 104 | the data into the same type of database first (import all the BOINC data, as is, |
105 | - from mysql to postgresql).') . '</p><p>' . t('If both BOINC and Drupal are on |
|
105 | + from mysql to postgresql).').'</p><p>'.t('If both BOINC and Drupal are on |
|
106 | 106 | postgresql, see !this_issue.', array('!this_issue' => l(t('this issue'), |
107 | - 'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))) . '</p>'; |
|
107 | + 'http://drupal.org/node/64877', array('attributes' => array('target' => '_blank'))))).'</p>'; |
|
108 | 108 | $form['boinc_data']['note'] = array('#value' => $output); |
109 | 109 | |
110 | 110 | // BOINC table prefix |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $output = $result['html']; |
122 | 122 | if ($result['result'] != 1) { |
123 | 123 | $ready_for_migration = 0; |
124 | - $form['boinc_data']['#collapsed']= FALSE; |
|
124 | + $form['boinc_data']['#collapsed'] = FALSE; |
|
125 | 125 | $output .= '<span class="marker">'; |
126 | 126 | $output .= t('Some tables couldn\'t be found. Are the database settings correct? |
127 | 127 | Please correct the errors so that the BOINC tables can be accessed.'); |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | '#collapsible' => TRUE, |
170 | 170 | '#collapsed' => TRUE |
171 | 171 | ); |
172 | - $output = '<p>'. t('Select which !input_format should be used for the imported |
|
172 | + $output = '<p>'.t('Select which !input_format should be used for the imported |
|
173 | 173 | messages. It is highly-recommended that this value be left as it is, as the |
174 | 174 | Full HTML and PHP code formats can be very dangerous!', |
175 | - array('!input_format' => l(t('input format'), 'admin/settings/filters'))) .'</p>'; |
|
175 | + array('!input_format' => l(t('input format'), 'admin/settings/filters'))).'</p>'; |
|
176 | 176 | $form['input']['intro'] = array('#value' => $output); |
177 | 177 | |
178 | 178 | $formats = db_query('SELECT format, name FROM {filter_formats}'); |
179 | 179 | while ($format = db_fetch_array($formats)) { |
180 | - $input_formats[$format['format']]= $format['name']; |
|
180 | + $input_formats[$format['format']] = $format['name']; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // By default, use the format named "Rich text"; fall back to Filtered HTML |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | ); |
195 | 195 | if (!$input_format) { |
196 | 196 | $ready_for_migration = 0; |
197 | - $form['input']['#collapsed']= FALSE; |
|
197 | + $form['input']['#collapsed'] = FALSE; |
|
198 | 198 | } |
199 | - $output = '<p><em>'. t('This setting will be applied to all posts and private |
|
200 | - messages.') .'</em></p>'; |
|
199 | + $output = '<p><em>'.t('This setting will be applied to all posts and private |
|
200 | + messages.').'</em></p>'; |
|
201 | 201 | $form['input']['result'] = array('#value' => $output); |
202 | 202 | |
203 | 203 | // BBcode settings |
@@ -208,23 +208,23 @@ discard block |
||
208 | 208 | '#collapsed' => TRUE, |
209 | 209 | ); |
210 | 210 | |
211 | - $output = '<p>' . t('BOINC posts are often formatted in BBcode. During the |
|
212 | - import process, BBcode can be handled in two diffent ways') . ':</p>'; |
|
213 | - $output .= '<ul><li>' . t('Leave the BBcode as is and use the !bbcode_module |
|
211 | + $output = '<p>'.t('BOINC posts are often formatted in BBcode. During the |
|
212 | + import process, BBcode can be handled in two diffent ways').':</p>'; |
|
213 | + $output .= '<ul><li>'.t('Leave the BBcode as is and use the !bbcode_module |
|
214 | 214 | after the migration to filter the imported posts. In this case, the module |
215 | 215 | is not required during the migration, but will need to be installed and |
216 | 216 | configured later.', |
217 | 217 | array('!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', |
218 | - array('attributes' => array('target' => '_blank'))))) . '</li>'; |
|
219 | - $output .= '<li>' . t('Filter the BBcode now and replace it with plain HTML. |
|
218 | + array('attributes' => array('target' => '_blank'))))).'</li>'; |
|
219 | + $output .= '<li>'.t('Filter the BBcode now and replace it with plain HTML. |
|
220 | 220 | The BBcode module will be required during the migration process, but can |
221 | - be disabled afterwards.') . '</li></ul>'; |
|
222 | - $output .= '<p>' . t('An appropriate input filter should be chosen, as well, |
|
221 | + be disabled afterwards.').'</li></ul>'; |
|
222 | + $output .= '<p>'.t('An appropriate input filter should be chosen, as well, |
|
223 | 223 | as it will affect how the post is displayed. For example, if BBcode is |
224 | 224 | removed and replaced by HTML, some HTML tags will be stripped by the |
225 | 225 | "Filtered HTML" input format unless they are first added to the list of |
226 | 226 | allowed tags in that format. See the !input_formats page.', |
227 | - array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))) . '</p>'; |
|
227 | + array('!input_formats' => l(t('input formats'), 'admin/settings/filters'))).'</p>'; |
|
228 | 228 | |
229 | 229 | $form['bbcode']['intro'] = array('#value' => $output); |
230 | 230 | $form['bbcode']['boincimport_bbcode'] = array( |
@@ -254,28 +254,28 @@ discard block |
||
254 | 254 | $result = db_query($sql, $input_format); |
255 | 255 | if (!db_result($result)) { |
256 | 256 | $form['bbcode']['#collapsed'] = FALSE; |
257 | - $output .= '<p class="marker">'. t('You need to !enable_bbcode_input and |
|
257 | + $output .= '<p class="marker">'.t('You need to !enable_bbcode_input and |
|
258 | 258 | then !configure_bbcode_options', array( |
259 | 259 | '!enable_bbcode_input' => l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"), |
260 | - '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) .'</p>'; |
|
260 | + '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))).'</p>'; |
|
261 | 261 | } |
262 | - $output .= '<p>'. t('For best results, !disable_all_options', |
|
263 | - array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))) . '.</p>'; |
|
262 | + $output .= '<p>'.t('For best results, !disable_all_options', |
|
263 | + array('!disable_all_options' => l(t('all four BBcode configure options should be disabled'), "admin/settings/filters/{$input_format}/configure"))).'.</p>'; |
|
264 | 264 | } else { |
265 | 265 | if ($bbcode_disabled) { |
266 | 266 | $form['bbcode']['#collapsed'] = FALSE; |
267 | - $output .= '<p>'. t('The !bbcode_module is recommended, but not required. |
|
267 | + $output .= '<p>'.t('The !bbcode_module is recommended, but not required. |
|
268 | 268 | You may !enable_bbcode after having installed it.', array( |
269 | 269 | '!bbcode_module' => l(t('bbcode module'), 'http://drupal.org/project/bbcode', array('attributes' => array('target' => '_blank'))), |
270 | - '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))) .'</p>'; |
|
270 | + '!enable_bbcode' => l(t('enable the bbcode module'), 'admin/build/modules'))).'</p>'; |
|
271 | 271 | } |
272 | - $output .= '<p>' . t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array( |
|
272 | + $output .= '<p>'.t('Don\'t forget to !enable_bbcode_input and then !configure_bbcode_options.', array( |
|
273 | 273 | '!enable_bbcode_input' => l(t('enable BBcode in the selected input format'), "admin/settings/filters/{$input_format}"), |
274 | - '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))) . '</p>'; |
|
275 | - $output .= '<p>' . t('You may want to enable it for other input formats, too.') . '</p>'; |
|
274 | + '!configure_bbcode_options' => l(t('configure BBcode options'), "admin/settings/filters/{$input_format}/configure"))).'</p>'; |
|
275 | + $output .= '<p>'.t('You may want to enable it for other input formats, too.').'</p>'; |
|
276 | 276 | } |
277 | - $output .= '<p><em>'. t('This setting will be applied to all posts, private |
|
278 | - messages and the users\' signature.') .'</em></p>'; |
|
277 | + $output .= '<p><em>'.t('This setting will be applied to all posts, private |
|
278 | + messages and the users\' signature.').'</em></p>'; |
|
279 | 279 | |
280 | 280 | $form['bbcode']['result'] = array('#value' => $output); |
281 | 281 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | '#collapsed' => TRUE, |
288 | 288 | ); |
289 | 289 | if (!variable_get('boincimport_base_url_boinc', 0)) { |
290 | - $form['url_transforms']['#collapsed']= FALSE; |
|
290 | + $form['url_transforms']['#collapsed'] = FALSE; |
|
291 | 291 | $output = '<span class="marker">'; |
292 | 292 | $ready_for_migration = 0; |
293 | 293 | } |
@@ -320,11 +320,11 @@ discard block |
||
320 | 320 | ); |
321 | 321 | variable_set('boincimport_ready', $ready_for_migration); |
322 | 322 | if ($ready_for_migration) { |
323 | - $output = '<p>'. t('Check the settings above one more time. If everything |
|
324 | - is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))) .'</p>'; |
|
323 | + $output = '<p>'.t('Check the settings above one more time. If everything |
|
324 | + is ok, !proceed.', array('!proceed' => l(t('you can now proceed with the migration'), 'admin/boinc/import/process'))).'</p>'; |
|
325 | 325 | } else { |
326 | - $output = '<p class="marker">'. t('You are not ready for the migration yet. |
|
327 | - Please check the settings above.') .'</p>'; |
|
326 | + $output = '<p class="marker">'.t('You are not ready for the migration yet. |
|
327 | + Please check the settings above.').'</p>'; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | $form['migration']['info'] = array('#value' => $output); |
@@ -335,23 +335,23 @@ discard block |
||
335 | 335 | * Callback admin/boinc/import/post_configuration |
336 | 336 | */ |
337 | 337 | function boincimport_post_configuration() { |
338 | - $output = '<p>'. t('This page will help to tie up any loose ends following |
|
338 | + $output = '<p>'.t('This page will help to tie up any loose ends following |
|
339 | 339 | the BOINC data import process. Before continuing, it may be best to have |
340 | - already:') .'</p>'; |
|
340 | + already:').'</p>'; |
|
341 | 341 | $output .= '<ul>'; |
342 | - $output .= '<li>'. t('Imported users, teams, and forums using the BOINC |
|
343 | - import module') .'</li>'; |
|
344 | - $output .= '<li>'. t('Imported any additional data using add on modules if |
|
345 | - available.') .'</li>'; |
|
342 | + $output .= '<li>'.t('Imported users, teams, and forums using the BOINC |
|
343 | + import module').'</li>'; |
|
344 | + $output .= '<li>'.t('Imported any additional data using add on modules if |
|
345 | + available.').'</li>'; |
|
346 | 346 | $output .= '</ul>'; |
347 | 347 | //User Set up |
348 | - $output .= '<h2>'. t('User settings') .'</h2>'; |
|
349 | - $output .= '<p>'. t('Make sure your !user_settings are correct. Specifically, |
|
348 | + $output .= '<h2>'.t('User settings').'</h2>'; |
|
349 | + $output .= '<p>'.t('Make sure your !user_settings are correct. Specifically, |
|
350 | 350 | you can enable or disable signatures there. ', array( |
351 | 351 | '!user_settings' => l(t('user settings'), 'admin/user/settings') |
352 | - )) .'</p>'; |
|
353 | - $output .= '<p>' . t('Note that avatar/picture support is not tied to user |
|
354 | - settings Picture support at this time.') . '</p>'; |
|
352 | + )).'</p>'; |
|
353 | + $output .= '<p>'.t('Note that avatar/picture support is not tied to user |
|
354 | + settings Picture support at this time.').'</p>'; |
|
355 | 355 | /*$output .= '<p>' . t('In order to activate avatar/picture support, you need to |
356 | 356 | enable pictures on this page and also:') . '</p>'; |
357 | 357 | $output .= '<ul>'; |
@@ -366,15 +366,15 @@ discard block |
||
366 | 366 | $output .= '</ul>'; */ |
367 | 367 | |
368 | 368 | // Forum Set up |
369 | - $output .= '<h2>'. t('Forum settings') .'</h2>'; |
|
370 | - $output .= '<p>'. t('Check any additional changes to make on the |
|
369 | + $output .= '<h2>'.t('Forum settings').'</h2>'; |
|
370 | + $output .= '<p>'.t('Check any additional changes to make on the |
|
371 | 371 | !forum_settings page.', array( |
372 | 372 | '!forum_settings' => l(t('forum settings'), 'admin/content/forum/settings') |
373 | - )) .'</p>'; |
|
374 | - $output .= '<p>'. t('It also may be a good idea to look at the !forum_list to |
|
373 | + )).'</p>'; |
|
374 | + $output .= '<p>'.t('It also may be a good idea to look at the !forum_list to |
|
375 | 375 | verify that all necessary containers and forums are in place.', array( |
376 | 376 | '!forum_list' => l(t('forum list'), 'admin/content/forum') |
377 | - )) .'</p>'; |
|
377 | + )).'</p>'; |
|
378 | 378 | /*$output .= '<p>'. t('If need be, set up the private forums as explained in the |
379 | 379 | !documentation.', array( |
380 | 380 | '!documentation' => l(t('documentation'), 'http://drupal.org/node/58969', array('attributes' => array('target' => '_blank'))) |
@@ -390,17 +390,17 @@ discard block |
||
390 | 390 | // BBcode |
391 | 391 | $bbcode = variable_get('boincimport_bbcode', 0); |
392 | 392 | if ($bbcode) { |
393 | - $output .= '<h2>'. t('Remove BBcode module') .'</h2>'; |
|
394 | - $output .= '<p>'. t('The BBcode has been cleaned from the posts. You shouldn\'t |
|
395 | - need the bbcode module anymore. You can disable it.') .'</p>'; |
|
393 | + $output .= '<h2>'.t('Remove BBcode module').'</h2>'; |
|
394 | + $output .= '<p>'.t('The BBcode has been cleaned from the posts. You shouldn\'t |
|
395 | + need the bbcode module anymore. You can disable it.').'</p>'; |
|
396 | 396 | } else { |
397 | - $output .= '<h2>'. t('Configure BBcode module') .'</h2>'; |
|
398 | - $output .= '<p>'. t('Most likely, there are many BOINC forum postings |
|
397 | + $output .= '<h2>'.t('Configure BBcode module').'</h2>'; |
|
398 | + $output .= '<p>'.t('Most likely, there are many BOINC forum postings |
|
399 | 399 | formatted in BBcode. It would be a good idea to verify that BBcode is |
400 | 400 | being formatted correctly in the imported posts. Have a look around |
401 | 401 | !the_forum.', array( |
402 | 402 | '!the_forum' => l(t('the forum'), 'community') |
403 | - )) . '</p>'; |
|
403 | + )).'</p>'; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | return $output; |
@@ -445,11 +445,11 @@ discard block |
||
445 | 445 | $output .= '</ol>'; |
446 | 446 | |
447 | 447 | // process will die() if the link to the BOINC database is wrong: |
448 | - $output .= '<p>'. t('If the BOINC data is in another database, but you made a |
|
448 | + $output .= '<p>'.t('If the BOINC data is in another database, but you made a |
|
449 | 449 | mistake while setting up the data base url, you may be unable to access the |
450 | 450 | setting page due to some limitations of the core of Drupal. !reset_db_url.', array( |
451 | 451 | '!reset_db_url' => l(t('Click here to reset the database url'), 'admin/boinc/import/reset') |
452 | - )) .'</p>'; |
|
452 | + )).'</p>'; |
|
453 | 453 | |
454 | 454 | return $output; |
455 | 455 | } |
@@ -4,48 +4,48 @@ |
||
4 | 4 | * Implementation of hook_user_default_permissions(). |
5 | 5 | */ |
6 | 6 | function private_messages_user_default_permissions() { |
7 | - $permissions = array(); |
|
7 | + $permissions = array(); |
|
8 | 8 | |
9 | - // Exported permission: administer privatemsg settings |
|
10 | - $permissions['administer privatemsg settings'] = array( |
|
9 | + // Exported permission: administer privatemsg settings |
|
10 | + $permissions['administer privatemsg settings'] = array( |
|
11 | 11 | 'name' => 'administer privatemsg settings', |
12 | 12 | 'roles' => array( |
13 | - '0' => 'administrator', |
|
13 | + '0' => 'administrator', |
|
14 | 14 | ), |
15 | - ); |
|
15 | + ); |
|
16 | 16 | |
17 | - // Exported permission: delete privatemsg |
|
18 | - $permissions['delete privatemsg'] = array( |
|
17 | + // Exported permission: delete privatemsg |
|
18 | + $permissions['delete privatemsg'] = array( |
|
19 | 19 | 'name' => 'delete privatemsg', |
20 | 20 | 'roles' => array( |
21 | - '0' => 'administrator', |
|
22 | - '1' => 'authenticated user', |
|
21 | + '0' => 'administrator', |
|
22 | + '1' => 'authenticated user', |
|
23 | 23 | ), |
24 | - ); |
|
24 | + ); |
|
25 | 25 | |
26 | - // Exported permission: read all private messages |
|
27 | - $permissions['read all private messages'] = array( |
|
26 | + // Exported permission: read all private messages |
|
27 | + $permissions['read all private messages'] = array( |
|
28 | 28 | 'name' => 'read all private messages', |
29 | 29 | 'roles' => array(), |
30 | - ); |
|
30 | + ); |
|
31 | 31 | |
32 | - // Exported permission: read privatemsg |
|
33 | - $permissions['read privatemsg'] = array( |
|
32 | + // Exported permission: read privatemsg |
|
33 | + $permissions['read privatemsg'] = array( |
|
34 | 34 | 'name' => 'read privatemsg', |
35 | 35 | 'roles' => array( |
36 | - '0' => 'administrator', |
|
37 | - '1' => 'authenticated user', |
|
36 | + '0' => 'administrator', |
|
37 | + '1' => 'authenticated user', |
|
38 | 38 | ), |
39 | - ); |
|
39 | + ); |
|
40 | 40 | |
41 | - // Exported permission: write privatemsg |
|
42 | - $permissions['write privatemsg'] = array( |
|
41 | + // Exported permission: write privatemsg |
|
42 | + $permissions['write privatemsg'] = array( |
|
43 | 43 | 'name' => 'write privatemsg', |
44 | 44 | 'roles' => array( |
45 | - '0' => 'administrator', |
|
46 | - '1' => 'community member', |
|
45 | + '0' => 'administrator', |
|
46 | + '1' => 'community member', |
|
47 | 47 | ), |
48 | - ); |
|
48 | + ); |
|
49 | 49 | |
50 | - return $permissions; |
|
50 | + return $permissions; |
|
51 | 51 | } |
@@ -176,8 +176,8 @@ |
||
176 | 176 | echo "<tr><th>WU ID</th><th>WU name</th><th>App ID</th><th>Quorum</th><th>Unsent</th><th>In Progress</th><th>Success</th>"; |
177 | 177 | echo "<th>Download Errors</th><th>Compute Errors</th><th>Validate Errors</th><th>Error mask</th></tr>\n"; |
178 | 178 | |
179 | -$hidden=0; |
|
180 | -foreach($row_array as $row) { |
|
179 | +$hidden = 0; |
|
180 | +foreach ($row_array as $row) { |
|
181 | 181 | if ($hide_canceled == 'on' && (($row->error_mask & WU_ERROR_CANCELLED) == WU_ERROR_CANCELLED)) { |
182 | 182 | $hidden++; |
183 | 183 | continue; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | // with an existing web framework can more easily do so. |
208 | 208 | // To do so, define page_head() in the project include file. |
209 | 209 | // |
210 | -if (!function_exists("page_head")){ |
|
210 | +if (!function_exists("page_head")) { |
|
211 | 211 | function page_head( |
212 | 212 | $title, |
213 | 213 | // page title. Put in <title>, used as title for browser tab. |
@@ -293,7 +293,8 @@ discard block |
||
293 | 293 | echo '<div class="container-fluid"> |
294 | 294 | '; |
295 | 295 | |
296 | - switch($title) { //kludge |
|
296 | + switch($title) { |
|
297 | +//kludge |
|
297 | 298 | case tra("Log in"): |
298 | 299 | case tra("Create an account"): |
299 | 300 | case tra("Server status page"): |
@@ -309,7 +310,7 @@ discard block |
||
309 | 310 | |
310 | 311 | // See the comments for page_head() |
311 | 312 | // |
312 | -if (!function_exists("page_tail")){ |
|
313 | +if (!function_exists("page_tail")) { |
|
313 | 314 | function page_tail( |
314 | 315 | $show_date=false, |
315 | 316 | // true for pages that are generated periodically rather than on the fly |
@@ -330,7 +331,7 @@ discard block |
||
330 | 331 | } |
331 | 332 | } |
332 | 333 | |
333 | -function display_cvs_versions(){ |
|
334 | +function display_cvs_versions() { |
|
334 | 335 | global $cvs_version_tracker; |
335 | 336 | echo "\n<!-- SVN VERSIONS -->\n"; |
336 | 337 | for ($i=0;$i<sizeof($cvs_version_tracker);$i++) { |
@@ -816,7 +817,7 @@ discard block |
||
816 | 817 | return $str; |
817 | 818 | } |
818 | 819 | |
819 | -function strip_bbcode($string){ |
|
820 | +function strip_bbcode($string) { |
|
820 | 821 | return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
821 | 822 | } |
822 | 823 | |
@@ -1047,7 +1048,7 @@ discard block |
||
1047 | 1048 | // Otherwise return 0. |
1048 | 1049 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
1049 | 1050 | // |
1050 | -function boinc_client_version(){ |
|
1051 | +function boinc_client_version() { |
|
1051 | 1052 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
1052 | 1053 | $x = $_SERVER['HTTP_USER_AGENT']; |
1053 | 1054 | $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
@@ -556,14 +556,14 @@ |
||
556 | 556 | $tnow = get_str('tnow', true); |
557 | 557 | $ttok = get_str('ttok', true); |
558 | 558 | if (!$tnow) { |
559 | - if (isset($_POST['tnow'])) { |
|
560 | - $tnow = $_POST['tnow']; |
|
561 | - } |
|
559 | + if (isset($_POST['tnow'])) { |
|
560 | + $tnow = $_POST['tnow']; |
|
561 | + } |
|
562 | 562 | } |
563 | 563 | if (!$ttok) { |
564 | - if (isset($_POST['ttok'])) { |
|
565 | - $ttok = $_POST['ttok']; |
|
566 | - } |
|
564 | + if (isset($_POST['ttok'])) { |
|
565 | + $ttok = $_POST['ttok']; |
|
566 | + } |
|
567 | 567 | } |
568 | 568 | if (!$tnow) return false; |
569 | 569 | if (!$ttok) return false; |
@@ -306,7 +306,7 @@ |
||
306 | 306 | <link rel="stylesheet" href="custom_dark.css" media="(prefers-color-scheme: dark)"> |
307 | 307 | <link rel="stylesheet" href="sample_bootstrap.min.css" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: light)"> |
308 | 308 | <link rel="stylesheet" href="custom.css" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: light)"> |
309 | -EOT; |
|
309 | +eot; |
|
310 | 310 | } else { |
311 | 311 | echo ' |
312 | 312 | <link type="text/css" rel="stylesheet" href="'.secure_url_base().'/bootstrap.min.css" media="all"> |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | // |
34 | 34 | $config = get_config(); |
35 | 35 | global $master_url; |
36 | -$master_url = parse_config($config , "<master_url>"); |
|
36 | +$master_url = parse_config($config, "<master_url>"); |
|
37 | 37 | $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>"); |
38 | 38 | $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>"); |
39 | 39 | |
40 | 40 | // Set parameters to defaults if not defined in config.xml |
41 | 41 | |
42 | 42 | $x = parse_config($config, "<user_country>"); |
43 | -define('USER_COUNTRY', ($x===null)?1:(int)$x); |
|
43 | +define('USER_COUNTRY', ($x === null) ? 1 : (int)$x); |
|
44 | 44 | |
45 | 45 | $x = parse_config($config, "<user_url>"); |
46 | -define('USER_URL', ($x===null)?1:(int)$x); |
|
46 | +define('USER_URL', ($x === null) ? 1 : (int)$x); |
|
47 | 47 | |
48 | 48 | // Set parameters to defaults if not defined in project.inc |
49 | 49 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | function url_base() { |
154 | - return is_https()?secure_url_base():URL_BASE; |
|
154 | + return is_https() ?secure_url_base() : URL_BASE; |
|
155 | 155 | } |
156 | 156 | |
157 | -function send_cookie($name, $value, $permanent, $ops=false) { |
|
157 | +function send_cookie($name, $value, $permanent, $ops = false) { |
|
158 | 158 | global $master_url; |
159 | 159 | |
160 | 160 | // the following allows independent login for projects on the same server |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | $path = substr($path, 0, -1); |
166 | 166 | $path .= "_ops/"; |
167 | 167 | } |
168 | - $expire = $permanent?time()+3600*24*365:0; |
|
168 | + $expire = $permanent ?time() + 3600*24*365 : 0; |
|
169 | 169 | setcookie($name, $value, $expire, $path); |
170 | 170 | } |
171 | 171 | |
172 | -function clear_cookie($name, $ops=false) { |
|
172 | +function clear_cookie($name, $ops = false) { |
|
173 | 173 | global $master_url; |
174 | 174 | $url = parse_url($master_url); |
175 | 175 | $path = $url['path']; |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | $path = substr($path, 0, -1); |
178 | 178 | $path .= "_ops/"; |
179 | 179 | } |
180 | - setcookie($name, '', time()-3600, $path); |
|
180 | + setcookie($name, '', time() - 3600, $path); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $g_logged_in_user = null; |
184 | 184 | $got_logged_in_user = false; |
185 | 185 | |
186 | -function get_logged_in_user($must_be_logged_in=true) { |
|
186 | +function get_logged_in_user($must_be_logged_in = true) { |
|
187 | 187 | global $g_logged_in_user, $got_logged_in_user; |
188 | 188 | if ($got_logged_in_user) { |
189 | 189 | // this could have been called earlier with $must_be_logged_in false |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $next_url = $_SERVER['REQUEST_URI']; |
210 | 210 | $n = strrpos($next_url, "/"); |
211 | 211 | if ($n) { |
212 | - $next_url = substr($next_url, $n+1); |
|
212 | + $next_url = substr($next_url, $n + 1); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | $next_url = urlencode($next_url); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | return $g_logged_in_user; |
221 | 221 | } |
222 | 222 | |
223 | -function show_login_info($prefix="") { |
|
223 | +function show_login_info($prefix = "") { |
|
224 | 224 | $user = get_logged_in_user(false); |
225 | 225 | if ($user) { |
226 | 226 | $url_tokens = url_tokens($user->authenticator); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | -$cache_control_extra=""; |
|
233 | +$cache_control_extra = ""; |
|
234 | 234 | $is_login_page = false; |
235 | 235 | |
236 | 236 | // Call this to start pages. |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | // with an existing web framework can more easily do so. |
243 | 243 | // To do so, define page_head() in the project include file. |
244 | 244 | // |
245 | -if (!function_exists("page_head")){ |
|
245 | +if (!function_exists("page_head")) { |
|
246 | 246 | function page_head( |
247 | 247 | $title, |
248 | 248 | // page title. Put in <title>, used as title for browser tab. |
249 | - $body_attrs=null, |
|
249 | + $body_attrs = null, |
|
250 | 250 | // <body XXXX> |
251 | 251 | // e.g. Javascript to put focus in an input field |
252 | 252 | // (onload="document.form.foo.focus()") |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | // if set, include schedulers.txt. |
256 | 256 | // also pass to project_banner() in case you want a different |
257 | 257 | // header for your main page. |
258 | - $url_prefix="", |
|
258 | + $url_prefix = "", |
|
259 | 259 | // prepend this to links. |
260 | 260 | // Use for web pages not in the top directory |
261 | - $head_extra=null |
|
261 | + $head_extra = null |
|
262 | 262 | // extra stuff to put in <head>. E.g.: |
263 | 263 | // reCAPTCHA code (create_profile.php) |
264 | 264 | // bbcode javascript (forums) |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | header("Content-type: text/html; charset=utf-8"); |
281 | 281 | header("Expires: Mon, 26 Jul 1997 05:00:00 UTC"); |
282 | 282 | // Date in the past |
283 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC"); |
|
283 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC"); |
|
284 | 284 | // always modified |
285 | 285 | header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0"); |
286 | 286 | // for HTTP/1.1 |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | if ($head_extra) { |
302 | 302 | echo "\n$head_extra\n"; |
303 | 303 | } |
304 | - if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) { |
|
304 | + if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) { |
|
305 | 305 | readfile("schedulers.txt"); |
306 | 306 | } |
307 | 307 | |
308 | - $t = $title?$title:PROJECT; |
|
308 | + $t = $title ? $title : PROJECT; |
|
309 | 309 | echo "<title>$t</title>\n"; |
310 | 310 | echo ' |
311 | 311 | <meta charset="utf-8"> |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | echo '<div class="container-fluid"> |
363 | 363 | '; |
364 | 364 | |
365 | - switch($title) { //kludge |
|
365 | + switch ($title) { //kludge |
|
366 | 366 | case tra("Log in"): |
367 | 367 | case tra("Create an account"): |
368 | 368 | case tra("Server status page"): |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | |
378 | 378 | // See the comments for page_head() |
379 | 379 | // |
380 | -if (!function_exists("page_tail")){ |
|
380 | +if (!function_exists("page_tail")) { |
|
381 | 381 | function page_tail( |
382 | - $show_date=false, |
|
382 | + $show_date = false, |
|
383 | 383 | // true for pages that are generated periodically rather than on the fly |
384 | - $url_prefix="", |
|
384 | + $url_prefix = "", |
|
385 | 385 | // use for pages not at top level |
386 | - $is_main=false |
|
386 | + $is_main = false |
|
387 | 387 | // passed to project_footer; |
388 | 388 | ) { |
389 | 389 | echo "<br>\n"; |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
401 | -function display_cvs_versions(){ |
|
401 | +function display_cvs_versions() { |
|
402 | 402 | global $cvs_version_tracker; |
403 | 403 | echo "\n<!-- SVN VERSIONS -->\n"; |
404 | - for ($i=0;$i<sizeof($cvs_version_tracker);$i++) { |
|
404 | + for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) { |
|
405 | 405 | echo "<!-- ".$cvs_version_tracker[$i]." -->\n"; |
406 | 406 | } |
407 | 407 | } |
@@ -426,24 +426,24 @@ discard block |
||
426 | 426 | // convert time interval in seconds to a string of the form |
427 | 427 | // 'D days h hours m min s sec'. |
428 | 428 | |
429 | -function time_diff($x, $res=3) { |
|
429 | +function time_diff($x, $res = 3) { |
|
430 | 430 | $x = (int)$x; |
431 | 431 | $days = (int)($x/86400); |
432 | - $hours = (int)(($x-$days*86400)/3600); |
|
433 | - $minutes = (int)(($x-$days*86400-$hours*3600)/60); |
|
434 | - $seconds = $x % 60; |
|
432 | + $hours = (int)(($x - $days*86400)/3600); |
|
433 | + $minutes = (int)(($x - $days*86400 - $hours*3600)/60); |
|
434 | + $seconds = $x%60; |
|
435 | 435 | |
436 | 436 | $s = ""; |
437 | 437 | if ($days) { |
438 | 438 | $s .= "$days ".tra("days")." "; |
439 | 439 | } |
440 | - if ($res>0 && ($hours || strlen($s))) { |
|
440 | + if ($res > 0 && ($hours || strlen($s))) { |
|
441 | 441 | $s .= "$hours ".tra("hours")." "; |
442 | 442 | } |
443 | - if ($res>1 && ($minutes || strlen($s))) { |
|
443 | + if ($res > 1 && ($minutes || strlen($s))) { |
|
444 | 444 | $s .= "$minutes ".tra("min")." "; |
445 | 445 | } |
446 | - if ($res>2) { |
|
446 | + if ($res > 2) { |
|
447 | 447 | $s .= "$seconds ".tra("sec")." "; |
448 | 448 | } |
449 | 449 | return $s; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | function time_str($x) { |
459 | 459 | if ($x == 0) return "---"; |
460 | - return gmdate('j M Y, G:i:s', (int)$x) . " UTC"; |
|
460 | + return gmdate('j M Y, G:i:s', (int)$x)." UTC"; |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | function local_time_str($x) { |
@@ -469,14 +469,14 @@ discard block |
||
469 | 469 | return time_str($x); |
470 | 470 | } |
471 | 471 | |
472 | -function start_table_str($class="", $style="") { |
|
473 | - $s = $style?'style="'.$style.'"':''; |
|
472 | +function start_table_str($class = "", $style = "") { |
|
473 | + $s = $style ? 'style="'.$style.'"' : ''; |
|
474 | 474 | return '<div class="table"> |
475 | 475 | <table '.$s.' width="100%" class="table table-condensed '.$class.'" > |
476 | 476 | '; |
477 | 477 | } |
478 | 478 | |
479 | -function start_table($class="", $style="") { |
|
479 | +function start_table($class = "", $style = "") { |
|
480 | 480 | echo start_table_str($class, $style); |
481 | 481 | } |
482 | 482 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | echo "</tr>\n"; |
522 | 522 | } |
523 | 523 | |
524 | -function row1($x, $ncols=2, $class="heading") { |
|
524 | +function row1($x, $ncols = 2, $class = "heading") { |
|
525 | 525 | if ($class == "heading") { |
526 | 526 | echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n"; |
527 | 527 | } else { |
@@ -535,10 +535,10 @@ discard block |
||
535 | 535 | |
536 | 536 | // a table row with 2 columns, with the left on right-aligned |
537 | 537 | |
538 | -function row2($x, $y, $show_error=false, $lwidth='40%') { |
|
539 | - if ($x==="") $x="<br>"; |
|
540 | - if ($y==="") $y="<br>"; |
|
541 | - $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
538 | +function row2($x, $y, $show_error = false, $lwidth = '40%') { |
|
539 | + if ($x === "") $x = "<br>"; |
|
540 | + if ($y === "") $y = "<br>"; |
|
541 | + $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS; |
|
542 | 542 | echo "<tr> |
543 | 543 | <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td> |
544 | 544 | <td $attrs >$y</td> |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | // output the first part of row2(); |
550 | 550 | // then write the content, followed by </td></tr> |
551 | 551 | |
552 | -function row2_init($x, $lwidth='40%') { |
|
552 | +function row2_init($x, $lwidth = '40%') { |
|
553 | 553 | echo sprintf('<tr> |
554 | 554 | <td width="%s" %s>%s</td> |
555 | 555 | <td %s>', |
@@ -565,31 +565,31 @@ discard block |
||
565 | 565 | echo "<tr><td>$string</td></tr>"; |
566 | 566 | } |
567 | 567 | |
568 | -function row_array($x, $attrs=null) { |
|
568 | +function row_array($x, $attrs = null) { |
|
569 | 569 | echo "<tr>\n"; |
570 | 570 | $i = 0; |
571 | 571 | foreach ($x as $h) { |
572 | - $a = $attrs?$attrs[$i]:""; |
|
572 | + $a = $attrs ? $attrs[$i] : ""; |
|
573 | 573 | echo "<td $a>$h</td>\n"; |
574 | 574 | $i++; |
575 | 575 | } |
576 | 576 | echo "</tr>\n"; |
577 | 577 | } |
578 | 578 | |
579 | -define ('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
579 | +define('ALIGN_RIGHT', 'style="text-align:right;"'); |
|
580 | 580 | |
581 | -function row_heading_array($x, $attrs=null, $class='bg-primary') { |
|
581 | +function row_heading_array($x, $attrs = null, $class = 'bg-primary') { |
|
582 | 582 | echo "<tr>"; |
583 | 583 | $i = 0; |
584 | 584 | foreach ($x as $h) { |
585 | - $a = $attrs?$attrs[$i]:""; |
|
585 | + $a = $attrs ? $attrs[$i] : ""; |
|
586 | 586 | echo "<th $a class=\"$class\">$h</th>"; |
587 | 587 | $i++; |
588 | 588 | } |
589 | 589 | echo "</tr>\n"; |
590 | 590 | } |
591 | 591 | |
592 | -function row_heading($x, $class='bg-primary') { |
|
592 | +function row_heading($x, $class = 'bg-primary') { |
|
593 | 593 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
594 | 594 | ', $class, $x |
595 | 595 | ); |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
650 | 650 | // is cut short. |
651 | 651 | |
652 | -function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
|
652 | +function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) { |
|
653 | 653 | $words = explode($delimiter, $sentence); |
654 | 654 | $total_chars = 0; |
655 | 655 | $trunc = false; |
@@ -732,8 +732,8 @@ discard block |
||
732 | 732 | |
733 | 733 | // returns null if the arg is optional and missing |
734 | 734 | // |
735 | -function get_int($name, $optional=false) { |
|
736 | - $x=null; |
|
735 | +function get_int($name, $optional = false) { |
|
736 | + $x = null; |
|
737 | 737 | if (isset($_GET[$name])) $x = $_GET[$name]; |
738 | 738 | if (!is_numeric($x)) { |
739 | 739 | if ($optional) { |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | |
753 | 753 | // returns null if the arg is optional and missing |
754 | 754 | // |
755 | -function post_num($name, $optional=false) { |
|
755 | +function post_num($name, $optional = false) { |
|
756 | 756 | $x = null; |
757 | 757 | if (isset($_POST[$name])) $x = $_POST[$name]; |
758 | 758 | if (!is_numeric($x)) { |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | |
768 | 768 | // returns null if the arg is optional and missing |
769 | 769 | // |
770 | -function post_int($name, $optional=false) { |
|
770 | +function post_int($name, $optional = false) { |
|
771 | 771 | $x = post_num($name, $optional); |
772 | 772 | if (is_null($x)) return null; |
773 | 773 | $y = (int)$x; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
788 | -function get_str($name, $optional=false) { |
|
788 | +function get_str($name, $optional = false) { |
|
789 | 789 | if (isset($_GET[$name])) { |
790 | 790 | $x = $_GET[$name]; |
791 | 791 | } else { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | return undo_magic_quotes($x); |
798 | 798 | } |
799 | 799 | |
800 | -function post_str($name, $optional=false) { |
|
800 | +function post_str($name, $optional = false) { |
|
801 | 801 | if (isset($_POST[$name])) { |
802 | 802 | $x = $_POST[$name]; |
803 | 803 | } else { |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | return undo_magic_quotes($x); |
810 | 810 | } |
811 | 811 | |
812 | -function post_arr($name, $optional=false) { |
|
812 | +function post_arr($name, $optional = false) { |
|
813 | 813 | if (isset($_POST[$name]) && is_array($_POST[$name])) { |
814 | 814 | $x = $_POST[$name]; |
815 | 815 | } else { |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | // the mb_* functions are not included by default |
826 | 826 | // return (mb_detect_encoding($passwd) -= 'ASCII'); |
827 | 827 | |
828 | - for ($i=0; $i<strlen($str); $i++) { |
|
828 | + for ($i = 0; $i < strlen($str); $i++) { |
|
829 | 829 | $c = ord(substr($str, $i)); |
830 | 830 | if ($c < 32 || $c > 127) return false; |
831 | 831 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $number = str_replace(',', '.', $number); // replace the german decimal separator |
850 | 850 | // if no value was entered and this is ok |
851 | 851 | // |
852 | - if ($number=='' && !$low) return true; |
|
852 | + if ($number == '' && !$low) return true; |
|
853 | 853 | |
854 | 854 | // the supplied value contains alphabetic characters |
855 | 855 | // |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | |
867 | 867 | // Generate a "select" element from an array of values |
868 | 868 | // |
869 | -function select_from_array($name, $array, $selection=null, $width=240) { |
|
869 | +function select_from_array($name, $array, $selection = null, $width = 240) { |
|
870 | 870 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
871 | 871 | |
872 | 872 | foreach ($array as $key => $value) { |
@@ -891,8 +891,8 @@ discard block |
||
891 | 891 | return $str; |
892 | 892 | } |
893 | 893 | |
894 | -function strip_bbcode($string){ |
|
895 | - return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
|
894 | +function strip_bbcode($string) { |
|
895 | + return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | function current_url() { |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | // the colors for bootstrap's btn-success are almost illegible; |
918 | 918 | // the green is too light. Use a darker green. |
919 | 919 | // |
920 | -function button_style($color='green', $font_size=null) { |
|
920 | +function button_style($color = 'green', $font_size = null) { |
|
921 | 921 | $fs = ''; |
922 | 922 | if ($font_size) { |
923 | 923 | $fs = sprintf('; font-size:%dpx', $font_size); |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | // class: class of the button, e.g. btn |
937 | 937 | // extra: Additional text in href tag |
938 | 938 | // |
939 | -function button_text($url, $text, $desc=null, $class=null, $extra='') { |
|
939 | +function button_text($url, $text, $desc = null, $class = null, $extra = '') { |
|
940 | 940 | if (!$desc) { |
941 | 941 | $desc = $text; |
942 | 942 | } |
@@ -951,23 +951,23 @@ discard block |
||
951 | 951 | ); |
952 | 952 | } |
953 | 953 | |
954 | -function button_text_small($url, $text, $desc=null) { |
|
954 | +function button_text_small($url, $text, $desc = null) { |
|
955 | 955 | return button_text($url, $text, $desc, "btn btn-xs", button_style()); |
956 | 956 | } |
957 | 957 | |
958 | -function show_button($url, $text, $desc=null, $class=null, $extra=null) { |
|
958 | +function show_button($url, $text, $desc = null, $class = null, $extra = null) { |
|
959 | 959 | echo button_text($url, $text, $desc, $class, $extra); |
960 | 960 | } |
961 | 961 | |
962 | 962 | // for places with a bunch of buttons, like forum posts |
963 | 963 | // |
964 | -function show_button_small($url, $text, $desc=null) { |
|
964 | +function show_button_small($url, $text, $desc = null) { |
|
965 | 965 | echo button_text_small($url, $text, $desc); |
966 | 966 | } |
967 | 967 | |
968 | 968 | // used for showing icons |
969 | 969 | // |
970 | -function show_image($src, $title, $alt, $height=null) { |
|
970 | +function show_image($src, $title, $alt, $height = null) { |
|
971 | 971 | $h = ""; |
972 | 972 | if ($height) { |
973 | 973 | $h = "height=\"$height\""; |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | // tries instead to connect to <replica_db_host> if tag exists. |
1005 | 1005 | // DEPRECATED - use boinc_db.inc |
1006 | 1006 | // |
1007 | -function db_init($try_replica=false) { |
|
1007 | +function db_init($try_replica = false) { |
|
1008 | 1008 | check_web_stopped(); |
1009 | 1009 | $retval = db_init_aux($try_replica); |
1010 | 1010 | if ($retval == 1) { |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | // Check this to avoid XSS vulnerability |
1121 | 1121 | // |
1122 | 1122 | function sanitize_sort_by($x) { |
1123 | - switch($x) { |
|
1123 | + switch ($x) { |
|
1124 | 1124 | case 'expavg_credit': |
1125 | 1125 | case 'total_credit': |
1126 | 1126 | return; |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | function do_download($path) { |
1141 | - $name=basename($path); |
|
1141 | + $name = basename($path); |
|
1142 | 1142 | header('Content-Description: File Transfer'); |
1143 | 1143 | header('Content-Type: application/octet-stream'); |
1144 | 1144 | header('Content-Disposition: attachment; filename='.$name); |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | header('Expires: 0'); |
1147 | 1147 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
1148 | 1148 | header('Pragma: public'); |
1149 | - header('Content-Length: ' . filesize($path)); |
|
1149 | + header('Content-Length: '.filesize($path)); |
|
1150 | 1150 | flush(); |
1151 | 1151 | readfile($path); |
1152 | 1152 | } |
@@ -1195,10 +1195,10 @@ discard block |
||
1195 | 1195 | // Otherwise return 0. |
1196 | 1196 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
1197 | 1197 | // |
1198 | -function boinc_client_version(){ |
|
1198 | +function boinc_client_version() { |
|
1199 | 1199 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
1200 | 1200 | $x = $_SERVER['HTTP_USER_AGENT']; |
1201 | - $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1201 | + $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
|
1202 | 1202 | if (preg_match($e, $x, $matches)) { |
1203 | 1203 | return $matches[1]*10000 + $matches[2]*100 + $matches[3]; |
1204 | 1204 | } |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $rem_name = $name."_remaining"; |
1228 | 1228 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
1229 | 1229 | onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea> |
1230 | - <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1230 | + <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining") |
|
1231 | 1231 | ; |
1232 | 1232 | } |
1233 | 1233 | |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | // use the following around text with long lines, |
1258 | 1258 | // to limit the width and make it more readable. |
1259 | 1259 | // |
1260 | -function text_start($width=640) { |
|
1260 | +function text_start($width = 640) { |
|
1261 | 1261 | echo sprintf("<div style=\"max-width: %dpx;\">\n", $width); |
1262 | 1262 | } |
1263 | 1263 | function text_end() { |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | function cert_filename() { |
1286 | - return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php"; |
|
1286 | + return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php"; |
|
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | // if user hasn't validated their email addr, tell them to |
@@ -1300,6 +1300,6 @@ discard block |
||
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | |
1303 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
1303 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
1304 | 1304 | |
1305 | 1305 | ?> |
@@ -18,7 +18,7 @@ |
||
18 | 18 | function boinccore_rules_event_info() { |
19 | 19 | return array( |
20 | 20 | 'boinccore_comment_convert' => array( |
21 | - 'label' => bts('A comment was converted to a new forum topic.', array(), NULL, 'boinc:rule-event'), |
|
21 | + 'label' => bts('A comment was converted to a new forum topic.', array(), null, 'boinc:rule-event'), |
|
22 | 22 | 'module' => 'BOINCcore', |
23 | 23 | 'arguments' => rules_events_hook_comment_arguments(t('converted comment')), |
24 | 24 | ), |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | function boinccore_rules_event_info() { |
19 | - return array( |
|
19 | + return array( |
|
20 | 20 | 'boinccore_comment_convert' => array( |
21 | - 'label' => bts('A comment was converted to a new forum topic.', array(), NULL, 'boinc:rule-event'), |
|
22 | - 'module' => 'BOINCcore', |
|
23 | - 'arguments' => rules_events_hook_comment_arguments(t('converted comment')), |
|
21 | + 'label' => bts('A comment was converted to a new forum topic.', array(), NULL, 'boinc:rule-event'), |
|
22 | + 'module' => 'BOINCcore', |
|
23 | + 'arguments' => rules_events_hook_comment_arguments(t('converted comment')), |
|
24 | 24 | ), |
25 | 25 | 'boinccore_comment_unhidden' => array( |
26 | - 'label' => bts('A comment was unhidden.', array(), 'boinc:rule-event'), |
|
27 | - 'module' => 'BOINCcore', |
|
28 | - 'arguments' => rules_events_hook_comment_arguments(t('unhidden comment')), |
|
26 | + 'label' => bts('A comment was unhidden.', array(), 'boinc:rule-event'), |
|
27 | + 'module' => 'BOINCcore', |
|
28 | + 'arguments' => rules_events_hook_comment_arguments(t('unhidden comment')), |
|
29 | 29 | ), |
30 | - ); |
|
30 | + ); |
|
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -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_rw'); |
|
30 | - $subscribed_boinc_users = db_query(" |
|
28 | + // Get the users with subscriptions to import |
|
29 | + db_set_active('boinc_rw'); |
|
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; |
|
42 | + } |
|
43 | + echo "\n"; |
|
44 | + echo $total_count; |
@@ -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_rw'); |
|
30 | - if ($import_lurkers) { |
|
29 | + db_set_active('boinc_rw'); |
|
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; |
|
71 | + echo $count; |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | */ |
115 | 115 | require_once('dbconfig.php'); |
116 | 116 | if (!isset($dbserver) || empty($dbserver)) |
117 | - $dbserver='localhost'; |
|
117 | + $dbserver='localhost'; |
|
118 | 118 | $db_url = array( |
119 | - 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
|
120 | - 'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}" |
|
119 | + 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
|
120 | + 'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}" |
|
121 | 121 | ); |
122 | 122 | $db_prefix = ''; |
123 | 123 | |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | // 'boinc_rw' entry as 'boinc_ro'. |
126 | 126 | |
127 | 127 | if (isset($boinc_ro_dbtype) && isset($boinc_ro_dbuser) && isset($boinc_ro_dbpass) && isset($boinc_ro_dbserver) && isset($boinc_ro_dbname)) { |
128 | - $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}"; |
|
128 | + $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}"; |
|
129 | 129 | } |
130 | 130 | else { |
131 | - $db_url['boinc_ro'] = $db_url['boinc_rw']; |
|
131 | + $db_url['boinc_ro'] = $db_url['boinc_rw']; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -216,5 +216,5 @@ discard block |
||
216 | 216 | */ |
217 | 217 | |
218 | 218 | if (stream_resolve_include_path('settings.local.php')) { |
219 | - include 'settings.local.php'; |
|
219 | + include 'settings.local.php'; |
|
220 | 220 | } |
@@ -126,8 +126,7 @@ |
||
126 | 126 | |
127 | 127 | if (isset($boinc_ro_dbtype) && isset($boinc_ro_dbuser) && isset($boinc_ro_dbpass) && isset($boinc_ro_dbserver) && isset($boinc_ro_dbname)) { |
128 | 128 | $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}"; |
129 | -} |
|
130 | -else { |
|
129 | +} else { |
|
131 | 130 | $db_url['boinc_ro'] = $db_url['boinc_rw']; |
132 | 131 | } |
133 | 132 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | require_once('dbconfig.php'); |
116 | 116 | if (!isset($dbserver) || empty($dbserver)) |
117 | - $dbserver='localhost'; |
|
117 | + $dbserver = 'localhost'; |
|
118 | 118 | $db_url = array( |
119 | 119 | 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
120 | 120 | 'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}" |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | * settings are used there. Settings defined here should not be |
163 | 163 | * duplicated there so as to avoid conflict issues. |
164 | 164 | */ |
165 | -ini_set('session.cache_expire', 200000); |
|
166 | -ini_set('session.cache_limiter', 'none'); |
|
167 | -ini_set('session.cookie_lifetime', 2000000); |
|
168 | -ini_set('session.gc_maxlifetime', 200000); |
|
169 | -ini_set('session.save_handler', 'user'); |
|
165 | +ini_set('session.cache_expire', 200000); |
|
166 | +ini_set('session.cache_limiter', 'none'); |
|
167 | +ini_set('session.cookie_lifetime', 2000000); |
|
168 | +ini_set('session.gc_maxlifetime', 200000); |
|
169 | +ini_set('session.save_handler', 'user'); |
|
170 | 170 | ini_set('session.use_only_cookies', 1); |
171 | -ini_set('session.use_trans_sid', 0); |
|
172 | -ini_set('url_rewriter.tags', ''); |
|
171 | +ini_set('session.use_trans_sid', 0); |
|
172 | +ini_set('url_rewriter.tags', ''); |
|
173 | 173 | ini_set('memory_limit', '128M'); |
174 | 174 | ini_set('post_max_size', '8MB'); |
175 | 175 | ini_set('upload_max_filesize', '8MB'); |