@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | function export_item($item, $is_user, $f) { |
29 | 29 | global $sub_projects; |
30 | 30 | |
31 | - fprintf($f, $is_user?"<user>\n":"<team>\n"); |
|
31 | + fprintf($f, $is_user ? "<user>\n" : "<team>\n"); |
|
32 | 32 | fprintf($f, " <id>$item->id</id>\n"); |
33 | - $crs = $is_user? |
|
33 | + $crs = $is_user ? |
|
34 | 34 | BoincCreditUser::enum("userid=$item->id") |
35 | 35 | : BoincCreditTeam::enum("teamid=$item->id") |
36 | 36 | ; |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - fprintf($f, $is_user?"</user>\n":"</team>\n"); |
|
59 | + fprintf($f, $is_user ? "</user>\n" : "</team>\n"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | function export($is_user, $dir) { |
63 | 63 | $n = 0; |
64 | - $filename = $is_user?"$dir/user_work":"$dir/team_work"; |
|
64 | + $filename = $is_user ? "$dir/user_work" : "$dir/team_work"; |
|
65 | 65 | $f = fopen($filename, "w"); |
66 | 66 | if (!$f) die("fopen"); |
67 | - $is_user? fprintf($f, "<users>\n"): fprintf($f, "<teams>\n"); |
|
68 | - $maxid = $is_user?BoincUser::max("id"):BoincTeam::max("id"); |
|
67 | + $is_user ? fprintf($f, "<users>\n") : fprintf($f, "<teams>\n"); |
|
68 | + $maxid = $is_user ?BoincUser::max("id") : BoincTeam::max("id"); |
|
69 | 69 | while ($n <= $maxid) { |
70 | 70 | $m = $n + 1000; |
71 | 71 | if ($is_user) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | $n = $m; |
80 | 80 | } |
81 | - $is_user? fprintf($f, "</users>\n"): fprintf($f, "</teams>\n"); |
|
81 | + $is_user ? fprintf($f, "</users>\n") : fprintf($f, "</teams>\n"); |
|
82 | 82 | fclose($f); |
83 | 83 | system("gzip -f $filename"); |
84 | 84 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // Also error-check values, and return errors in $errors->* |
34 | 34 | |
35 | 35 | function option($name, $val) { |
36 | - $x = ($name == $val) ? "selected" : ""; |
|
36 | + $x = ($name == $val) ? "selected" : ""; |
|
37 | 37 | return "<option name='$name' $x>$name\n"; |
38 | 38 | } |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (APP_SELECT_PREFS) { |
54 | 54 | $app_array = array(); |
55 | 55 | $apps = BoincApp::enum("deprecated=0"); |
56 | - foreach($apps as $app) { |
|
56 | + foreach ($apps as $app) { |
|
57 | 57 | $app_array[] = array($app->id, $app->user_friendly_name); |
58 | 58 | } |
59 | 59 | } else { |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | function number_select($name, $max, $n) { |
94 | - $sel = ($n == 0) ? "selected":""; |
|
94 | + $sel = ($n == 0) ? "selected" : ""; |
|
95 | 95 | $x = "<select class=\"form-control input-sm\" name=$name> <option value=0 $sel>".tra("No limit")."</option>"; |
96 | - for ($i=1; $i<=$max; $i++) { |
|
97 | - $sel = ($n == $i) ? "selected":""; |
|
96 | + for ($i = 1; $i <= $max; $i++) { |
|
97 | + $sel = ($n == $i) ? "selected" : ""; |
|
98 | 98 | $x .= "<option value=$i $sel>$i</option>"; |
99 | 99 | } |
100 | 100 | $x .= "</select>"; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | return tra("No limit"); |
107 | 107 | } |
108 | 108 | |
109 | -function project_specific_prefs_edit($prefs, $error=false) { |
|
109 | +function project_specific_prefs_edit($prefs, $error = false) { |
|
110 | 110 | global $app_array; |
111 | 111 | if (COLOR_PREFS) { |
112 | 112 | $x = $prefs->color_scheme; |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | } else { |
133 | 133 | $present = true; |
134 | 134 | } |
135 | - $checked = $present?"checked":""; |
|
135 | + $checked = $present ? "checked" : ""; |
|
136 | 136 | $x .= "<input type=checkbox name=app_id_$app_id $checked> $app_name<br>"; |
137 | 137 | } |
138 | 138 | tooltip_row2(APP_SELECT_TOOLTIP, APP_SELECT_DESC, $x); |
139 | - $checked = $prefs->allow_non_preferred_apps?"checked":""; |
|
139 | + $checked = $prefs->allow_non_preferred_apps ? "checked" : ""; |
|
140 | 140 | row2(ACCEPT_ANY_DESC, "<input type=checkbox name=allow_non_preferred_apps $checked>"); |
141 | 141 | } |
142 | 142 | if (NON_GRAPHICAL_PREF) { |
143 | - $checked = $prefs->non_graphical?"checked":""; |
|
143 | + $checked = $prefs->non_graphical ? "checked" : ""; |
|
144 | 144 | row2( |
145 | 145 | NON_GRAPHICAL_DESC, |
146 | 146 | "<input type=checkbox name=non_graphical $checked>" |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | return $x; |
217 | 217 | } |
218 | 218 | |
219 | -function project_specific_prefs_show($prefs, $columns=false) { |
|
219 | +function project_specific_prefs_show($prefs, $columns = false) { |
|
220 | 220 | global $app_array; |
221 | 221 | if ($columns) { |
222 | 222 | if (COLOR_PREFS) { |
223 | - row_defs(COLOR_DESC,"color_scheme", "", "", $prefs); |
|
223 | + row_defs(COLOR_DESC, "color_scheme", "", "", $prefs); |
|
224 | 224 | } |
225 | 225 | if (GFX_CPU_PREFS) { |
226 | 226 | row_defs(MAX_GFX_CPU_PCT_DESC, "max_gfx_cpu_pct", "", "", $prefs); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | row2(ACCEPT_ANY_DESC, $prefs->allow_non_preferred_apps_text); |
255 | 255 | } |
256 | 256 | if (NON_GRAPHICAL_PREF) { |
257 | - row2(NON_GRAPHICAL_DESC, $prefs->non_graphical?tra("yes"):tra("no")); |
|
257 | + row2(NON_GRAPHICAL_DESC, $prefs->non_graphical ?tra("yes") : tra("no")); |
|
258 | 258 | } |
259 | 259 | if (MAX_JOBS_PREF) { |
260 | 260 | row2(tra("Max # jobs"), limit_string($prefs->max_jobs)); |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | $cursor = 0; |
278 | 278 | while ($thisxml = parse_next_element($prefs_xml, "<app_id>", $cursor)) { |
279 | 279 | if (is_numeric($thisxml)) { |
280 | - $n = (int) $thisxml; |
|
280 | + $n = (int)$thisxml; |
|
281 | 281 | $prefs->app_ids[] = $n; |
282 | 282 | } |
283 | 283 | } |
284 | 284 | $prefs->allow_non_preferred_apps = parse_element($prefs_xml, "<allow_non_preferred_apps>"); |
285 | - $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps?"yes":"no"; |
|
285 | + $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps ? "yes" : "no"; |
|
286 | 286 | } |
287 | 287 | if (NON_GRAPHICAL_PREF) { |
288 | 288 | $prefs->non_graphical = parse_bool($prefs_xml, "non_graphical"); |
@@ -296,6 +296,6 @@ discard block |
||
296 | 296 | return $prefs; |
297 | 297 | } |
298 | 298 | |
299 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
299 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
300 | 300 | |
301 | 301 | ?> |
@@ -26,38 +26,38 @@ |
||
26 | 26 | |
27 | 27 | page_head(tra("Teams")); |
28 | 28 | |
29 | -echo "<p>".tra("%1 participants may form %2 teams %3.", PROJECT, "<b>", "</b>") ." |
|
29 | +echo "<p>".tra("%1 participants may form %2 teams %3.", PROJECT, "<b>", "</b>")." |
|
30 | 30 | <p> |
31 | - ". tra("You may belong to only one team. You can join or quit a team at any time."). " |
|
31 | + ". tra("You may belong to only one team. You can join or quit a team at any time.")." |
|
32 | 32 | <p>" . |
33 | - tra("Each team has a %1 founder %2 who may:", "<b>", "</b>") . " |
|
33 | + tra("Each team has a %1 founder %2 who may:", "<b>", "</b>")." |
|
34 | 34 | <ul> |
35 | - <li> " . tra("edit the team's name and description") . " |
|
36 | - <li> " . tra("add or remove team admins") . " |
|
37 | - <li> " . tra("remove members from the team") . " |
|
38 | - <li> " . tra("disband a team if it has no members") . " |
|
35 | + <li> " . tra("edit the team's name and description")." |
|
36 | + <li> " . tra("add or remove team admins")." |
|
37 | + <li> " . tra("remove members from the team")." |
|
38 | + <li> " . tra("disband a team if it has no members")." |
|
39 | 39 | </ul> |
40 | 40 | <p>" . |
41 | - tra("To join a team, visit its team page and click %1 Join this team %2.", "<b>", "</b>") . " |
|
42 | - <h3>" . tra("Find a team") . "</h3> |
|
41 | + tra("To join a team, visit its team page and click %1 Join this team %2.", "<b>", "</b>")." |
|
42 | + <h3>" . tra("Find a team")."</h3> |
|
43 | 43 | "; |
44 | 44 | team_search_form(null); |
45 | 45 | echo " |
46 | 46 | |
47 | - <h3>" . tra("Top teams") . "</h3> |
|
47 | + <h3>" . tra("Top teams")."</h3> |
|
48 | 48 | <ul> |
49 | - <li> <a href=\"top_teams.php\">" . tra("All teams") . "</a> |
|
49 | + <li> <a href=\"top_teams.php\">" . tra("All teams")."</a> |
|
50 | 50 | "; |
51 | 51 | |
52 | -for ($i=1; $i<count($team_types); $i++) { |
|
52 | +for ($i = 1; $i < count($team_types); $i++) { |
|
53 | 53 | echo "<li> <a href=\"top_teams.php?type=".$i."\">".tra("%1 teams", team_type_name($i))."</a> |
54 | 54 | "; |
55 | 55 | } |
56 | 56 | |
57 | 57 | echo " |
58 | 58 | </ul> |
59 | - <h3>" . tra("Create a new team") . "</h3> |
|
60 | - " . tra("If you cannot find a team that is right for you, you can %1 create a team %2.", "<a href=\"team_create_form.php\">","</a>"); |
|
59 | + <h3>" . tra("Create a new team")."</h3> |
|
60 | + " . tra("If you cannot find a team that is right for you, you can %1 create a team %2.", "<a href=\"team_create_form.php\">", "</a>"); |
|
61 | 61 | page_tail(); |
62 | 62 | |
63 | 63 | ?> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $postid = get_int('postid', true); |
31 | 31 | $filter = get_str('filter', true); |
32 | 32 | |
33 | -if ($filter != "false"){ |
|
33 | +if ($filter != "false") { |
|
34 | 34 | $filter = true; |
35 | 35 | } else { |
36 | 36 | $filter = false; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | if ($temp_sort_style) { |
80 | 80 | $sort_style = $temp_sort_style; |
81 | 81 | } else if ($sort_style) { |
82 | - $forum_style = 0; // this is deprecated |
|
83 | - if ($logged_in_user){ |
|
82 | + $forum_style = 0; // this is deprecated |
|
83 | + if ($logged_in_user) { |
|
84 | 84 | $logged_in_user->prefs->thread_sorting = $sort_style; |
85 | 85 | $logged_in_user->prefs->update("thread_sorting=$sort_style"); |
86 | 86 | } else { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | } else { |
94 | 94 | // get the sorting style from the user or a cookie |
95 | - if ($logged_in_user){ |
|
95 | + if ($logged_in_user) { |
|
96 | 96 | $sort_style = $logged_in_user->prefs->thread_sorting; |
97 | 97 | } else { |
98 | 98 | list($forum_style, $sort_style) = parse_forum_cookie(); |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | |
121 | 121 | if (false) { |
122 | 122 | if ($forum->parent_type == 0) { |
123 | - if ($category->is_helpdesk && !$thread->status){ |
|
124 | - if ($logged_in_user){ |
|
125 | - if ($thread->owner == $logged_in_user->id){ |
|
126 | - if ($thread->replies !=0) { |
|
123 | + if ($category->is_helpdesk && !$thread->status) { |
|
124 | + if ($logged_in_user) { |
|
125 | + if ($thread->owner == $logged_in_user->id) { |
|
126 | + if ($thread->replies != 0) { |
|
127 | 127 | // Show a "this question has been answered" to the author |
128 | 128 | echo "<p>"; |
129 | 129 | show_button( |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // If logged in user is moderator, enable some extra features |
190 | 190 | // |
191 | 191 | if (is_moderator($logged_in_user, $forum)) { |
192 | - if ($thread->hidden){ |
|
192 | + if ($thread->hidden) { |
|
193 | 193 | show_button_small( |
194 | 194 | "forum_moderate_thread_action.php?action=unhide&thread=".$thread->id."$tokens", |
195 | 195 | tra("Unhide"), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | tra("Hide this thread") |
203 | 203 | ); |
204 | 204 | } |
205 | - if ($thread->sticky){ |
|
205 | + if ($thread->sticky) { |
|
206 | 206 | show_button_small( |
207 | 207 | "forum_moderate_thread_action.php?action=desticky&thread=".$thread->id."$tokens", |
208 | 208 | tra("Make unsticky"), |
@@ -308,5 +308,5 @@ discard block |
||
308 | 308 | $thread->update("views=views+1"); |
309 | 309 | |
310 | 310 | page_tail(); |
311 | -$cvs_version_tracker[]="\$Id$"; |
|
311 | +$cvs_version_tracker[] = "\$Id$"; |
|
312 | 312 | ?> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $postid = get_int('postid', true); |
31 | 31 | $filter = get_str('filter', true); |
32 | 32 | |
33 | -if ($filter != "false"){ |
|
33 | +if ($filter != "false") { |
|
34 | 34 | $filter = true; |
35 | 35 | } else { |
36 | 36 | $filter = false; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $sort_style = $temp_sort_style; |
81 | 81 | } else if ($sort_style) { |
82 | 82 | $forum_style = 0; // this is deprecated |
83 | - if ($logged_in_user){ |
|
83 | + if ($logged_in_user) { |
|
84 | 84 | $logged_in_user->prefs->thread_sorting = $sort_style; |
85 | 85 | $logged_in_user->prefs->update("thread_sorting=$sort_style"); |
86 | 86 | } else { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | ); |
93 | 93 | } else { |
94 | 94 | // get the sorting style from the user or a cookie |
95 | - if ($logged_in_user){ |
|
95 | + if ($logged_in_user) { |
|
96 | 96 | $sort_style = $logged_in_user->prefs->thread_sorting; |
97 | 97 | } else { |
98 | 98 | list($forum_style, $sort_style) = parse_forum_cookie(); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | |
121 | 121 | if (false) { |
122 | 122 | if ($forum->parent_type == 0) { |
123 | - if ($category->is_helpdesk && !$thread->status){ |
|
124 | - if ($logged_in_user){ |
|
125 | - if ($thread->owner == $logged_in_user->id){ |
|
123 | + if ($category->is_helpdesk && !$thread->status) { |
|
124 | + if ($logged_in_user) { |
|
125 | + if ($thread->owner == $logged_in_user->id) { |
|
126 | 126 | if ($thread->replies !=0) { |
127 | 127 | // Show a "this question has been answered" to the author |
128 | 128 | echo "<p>"; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // If logged in user is moderator, enable some extra features |
190 | 190 | // |
191 | 191 | if (is_moderator($logged_in_user, $forum)) { |
192 | - if ($thread->hidden){ |
|
192 | + if ($thread->hidden) { |
|
193 | 193 | show_button_small( |
194 | 194 | "forum_moderate_thread_action.php?action=unhide&thread=".$thread->id."$tokens", |
195 | 195 | tra("Unhide"), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | tra("Hide this thread") |
203 | 203 | ); |
204 | 204 | } |
205 | - if ($thread->sticky){ |
|
205 | + if ($thread->sticky) { |
|
206 | 206 | show_button_small( |
207 | 207 | "forum_moderate_thread_action.php?action=desticky&thread=".$thread->id."$tokens", |
208 | 208 | tra("Make unsticky"), |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | if ($app_types->cpu) { |
71 | - $project_pref_descs[] = new PREF_BOOL ( |
|
71 | + $project_pref_descs[] = new PREF_BOOL( |
|
72 | 72 | tra("Use CPU"), |
73 | 73 | "Request CPU-only tasks from this project.", |
74 | 74 | "no_cpu", |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ); |
78 | 78 | } |
79 | 79 | if ($app_types->ati) { |
80 | - $project_pref_descs[] = new PREF_BOOL ( |
|
80 | + $project_pref_descs[] = new PREF_BOOL( |
|
81 | 81 | tra("Use AMD GPU"), |
82 | 82 | "Request AMD GPU tasks from this project.", |
83 | 83 | "no_ati", |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ); |
87 | 87 | } |
88 | 88 | if ($app_types->cuda) { |
89 | - $project_pref_descs[] = new PREF_BOOL ( |
|
89 | + $project_pref_descs[] = new PREF_BOOL( |
|
90 | 90 | tra("Use NVIDIA GPU"), |
91 | 91 | "Request NVIDIA GPU tasks from this project.", |
92 | 92 | "no_cuda", |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | } |
97 | 97 | if ($app_types->intel_gpu) { |
98 | - $project_pref_descs[] = new PREF_BOOL ( |
|
98 | + $project_pref_descs[] = new PREF_BOOL( |
|
99 | 99 | tra("Use Intel GPU"), |
100 | 100 | "Request Intel GPU tasks from this project.", |
101 | 101 | "no_intel_gpu", |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $x = ""; |
121 | 121 | } |
122 | 122 | |
123 | -$privacy_pref_descs = array ( |
|
123 | +$privacy_pref_descs = array( |
|
124 | 124 | new PREF_BOOL( |
125 | 125 | tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x, |
126 | 126 | "", |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | global $in_project_specific; |
153 | 153 | global $venue_name; |
154 | 154 | |
155 | - switch($name) { |
|
155 | + switch ($name) { |
|
156 | 156 | case "venue": |
157 | 157 | $venue_name = $attrs["name"]; |
158 | 158 | $top_parse_result = $parse_result; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | break; |
165 | 165 | default: |
166 | 166 | if ($in_project_specific) { |
167 | - $text= $text."<$name>"; |
|
167 | + $text = $text."<$name>"; |
|
168 | 168 | } else { |
169 | 169 | $text = ""; |
170 | 170 | } |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | global $venue_name; |
180 | 180 | global $project_pref_descs; |
181 | 181 | |
182 | - foreach($project_pref_descs as $p) { |
|
182 | + foreach ($project_pref_descs as $p) { |
|
183 | 183 | if ($p->xml_parse($parse_result, $name, $text)) { |
184 | 184 | return; |
185 | 185 | } |
186 | 186 | } |
187 | - switch($name) { |
|
187 | + switch ($name) { |
|
188 | 188 | case "venue": |
189 | 189 | $top_parse_result->$venue_name = $parse_result; |
190 | 190 | $parse_result = $top_parse_result; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | return $parse_result; |
229 | 229 | } |
230 | 230 | |
231 | -function prefs_show_project($prefs, $columns=false) { |
|
231 | +function prefs_show_project($prefs, $columns = false) { |
|
232 | 232 | global $project_pref_descs; |
233 | 233 | if ($columns) { |
234 | 234 | foreach ($project_pref_descs as $p) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | -function prefs_show_project_specific($prefs, $columns=false) { |
|
257 | +function prefs_show_project_specific($prefs, $columns = false) { |
|
258 | 258 | if ($columns) { |
259 | 259 | $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific); |
260 | 260 | $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : ""; |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | project_specific_prefs_show($project_specific_prefs, $columns); |
267 | 267 | } |
268 | 268 | |
269 | -function print_prefs_display_project($user, $columns=false) { |
|
269 | +function print_prefs_display_project($user, $columns = false) { |
|
270 | 270 | $project_prefs = prefs_parse_project($user->project_prefs); |
271 | 271 | |
272 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>"; |
|
272 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>"; |
|
273 | 273 | if ($columns) { |
274 | 274 | start_table(); |
275 | 275 | row_heading(tra("Combined preferences").$switch_link); |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | -function prefs_form_project($prefs, $error=false) { |
|
314 | +function prefs_form_project($prefs, $error = false) { |
|
315 | 315 | global $project_pref_descs; |
316 | 316 | foreach ($project_pref_descs as $p) { |
317 | 317 | $p->show_form_row($prefs, $error); |
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | -function prefs_form_project_specific($prefs_xml, $error=false) { |
|
321 | +function prefs_form_project_specific($prefs_xml, $error = false) { |
|
322 | 322 | $prefs = project_specific_prefs_parse($prefs_xml); |
323 | 323 | project_specific_prefs_edit($prefs, $error); |
324 | 324 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | // given a prefs structure, return the corresponding XML string |
359 | 359 | // |
360 | -function project_prefs_make_xml($prefs, $primary=true) { |
|
360 | +function project_prefs_make_xml($prefs, $primary = true) { |
|
361 | 361 | global $project_pref_descs; |
362 | 362 | $xml = ""; |
363 | 363 | if ($primary) { |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | // |
393 | 393 | function project_prefs_update(&$user, $prefs) { |
394 | 394 | $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs)); |
395 | - $send_email = $user->send_email?1:0; |
|
396 | - $show_hosts = $user->show_hosts?1:0; |
|
395 | + $send_email = $user->send_email ? 1 : 0; |
|
396 | + $show_hosts = $user->show_hosts ? 1 : 0; |
|
397 | 397 | $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts"); |
398 | 398 | if (!$retval) { |
399 | 399 | return 1; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $b->create_time = (double)($batch->create_time); |
171 | 171 | $b->est_completion_time = (double)($batch->est_completion_time); |
172 | 172 | $b->njobs = (int)($batch->njobs); |
173 | - $b->fraction_done = (double) $batch->fraction_done; |
|
173 | + $b->fraction_done = (double)$batch->fraction_done; |
|
174 | 174 | $b->nerror_jobs = (int)($batch->nerror_jobs); |
175 | 175 | $b->state = (int)($batch->state); |
176 | 176 | $b->completion_time = (double)($batch->completion_time); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | </result> |
399 | 399 | </output_template> |
400 | 400 | "; |
401 | - for ($i=0; $i<2; $i++) { |
|
401 | + for ($i = 0; $i < 2; $i++) { |
|
402 | 402 | $job = new StdClass; |
403 | 403 | $job->input_files = array(); |
404 | 404 | $job->input_files[] = $f; |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | * Implementation of hook_strongarm(). |
5 | 5 | */ |
6 | 6 | function private_messages_strongarm() { |
7 | - $export = array(); |
|
7 | + $export = array(); |
|
8 | 8 | |
9 | - $strongarm = new stdClass; |
|
10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | - $strongarm->api_version = 1; |
|
12 | - $strongarm->name = 'pm_email_notify_body'; |
|
13 | - $strongarm->value = 'Hi !boincuser_name, |
|
9 | + $strongarm = new stdClass; |
|
10 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | + $strongarm->api_version = 1; |
|
12 | + $strongarm->name = 'pm_email_notify_body'; |
|
13 | + $strongarm->value = 'Hi !boincuser_name, |
|
14 | 14 | |
15 | 15 | This is an automatic reminder from the site !site. You have received a new private message from !author_boincuser_name. |
16 | 16 | |
@@ -19,21 +19,21 @@ discard block |
||
19 | 19 | |
20 | 20 | If you don\'t want to receive these emails again, change your preferences here: |
21 | 21 | !settings'; |
22 | - $export['pm_email_notify_body'] = $strongarm; |
|
23 | - |
|
24 | - $strongarm = new stdClass; |
|
25 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
26 | - $strongarm->api_version = 1; |
|
27 | - $strongarm->name = 'pm_email_notify_default'; |
|
28 | - $strongarm->value = 1; |
|
29 | - $export['pm_email_notify_default'] = $strongarm; |
|
30 | - |
|
31 | - $strongarm = new stdClass; |
|
32 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
33 | - $strongarm->api_version = 1; |
|
34 | - $strongarm->name = 'pm_email_notify_subject'; |
|
35 | - $strongarm->value = 'New private message at !site.'; |
|
36 | - $export['pm_email_notify_subject'] = $strongarm; |
|
37 | - |
|
38 | - return $export; |
|
22 | + $export['pm_email_notify_body'] = $strongarm; |
|
23 | + |
|
24 | + $strongarm = new stdClass; |
|
25 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
26 | + $strongarm->api_version = 1; |
|
27 | + $strongarm->name = 'pm_email_notify_default'; |
|
28 | + $strongarm->value = 1; |
|
29 | + $export['pm_email_notify_default'] = $strongarm; |
|
30 | + |
|
31 | + $strongarm = new stdClass; |
|
32 | + $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
33 | + $strongarm->api_version = 1; |
|
34 | + $strongarm->name = 'pm_email_notify_subject'; |
|
35 | + $strongarm->value = 'New private message at !site.'; |
|
36 | + $export['pm_email_notify_subject'] = $strongarm; |
|
37 | + |
|
38 | + return $export; |
|
39 | 39 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $export = array(); |
8 | 8 | |
9 | 9 | $strongarm = new stdClass; |
10 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
10 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
11 | 11 | $strongarm->api_version = 1; |
12 | 12 | $strongarm->name = 'pm_email_notify_body'; |
13 | 13 | $strongarm->value = 'Hi !boincuser_name, |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | $export['pm_email_notify_body'] = $strongarm; |
23 | 23 | |
24 | 24 | $strongarm = new stdClass; |
25 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
25 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
26 | 26 | $strongarm->api_version = 1; |
27 | 27 | $strongarm->name = 'pm_email_notify_default'; |
28 | 28 | $strongarm->value = 1; |
29 | 29 | $export['pm_email_notify_default'] = $strongarm; |
30 | 30 | |
31 | 31 | $strongarm = new stdClass; |
32 | - $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */ |
|
32 | + $strongarm->disabled = false; /* Edit this to true to make a default strongarm disabled initially */ |
|
33 | 33 | $strongarm->api_version = 1; |
34 | 34 | $strongarm->name = 'pm_email_notify_subject'; |
35 | 35 | $strongarm->value = 'New private message at !site.'; |
@@ -4,11 +4,11 @@ |
||
4 | 4 | * Implementation of hook_ctools_plugin_api(). |
5 | 5 | */ |
6 | 6 | function private_messages_ctools_plugin_api() { |
7 | - list($module, $api) = func_get_args(); |
|
8 | - if ($module == "panels_mini" && $api == "panels_default") { |
|
7 | + list($module, $api) = func_get_args(); |
|
8 | + if ($module == "panels_mini" && $api == "panels_default") { |
|
9 | 9 | return array("version" => 1); |
10 | - } |
|
11 | - else if ($module == "strongarm" && $api == "strongarm") { |
|
10 | + } |
|
11 | + else if ($module == "strongarm" && $api == "strongarm") { |
|
12 | 12 | return array("version" => 1); |
13 | - } |
|
13 | + } |
|
14 | 14 | } |
@@ -7,8 +7,7 @@ |
||
7 | 7 | list($module, $api) = func_get_args(); |
8 | 8 | if ($module == "panels_mini" && $api == "panels_default") { |
9 | 9 | return array("version" => 1); |
10 | - } |
|
11 | - else if ($module == "strongarm" && $api == "strongarm") { |
|
10 | + } else if ($module == "strongarm" && $api == "strongarm") { |
|
12 | 11 | return array("version" => 1); |
13 | 12 | } |
14 | 13 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | break; |
139 | 139 | default: |
140 | 140 | end($page_list); |
141 | - $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)]; |
|
141 | + $page_list[key($page_list)] = 'and '.$page_list[key($page_list)]; |
|
142 | 142 | $page_list = implode(', ', $page_list); |
143 | 143 | } |
144 | 144 | drupal_set_message(t('Default content has been generated for the @listed |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'type' => 'page', |
196 | 196 | 'title' => t('Help'), |
197 | 197 | 'uid' => 1, |
198 | - 'status' => 1, // published |
|
198 | + 'status' => 1, // published |
|
199 | 199 | 'promote' => 0, // not promoted to front page |
200 | 200 | 'path' => 'help', |
201 | 201 | 'pathauto_perform_alias' => FALSE, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | 'format' => 4, |
217 | 217 | //'teaser' => $teaser, |
218 | 218 | ); |
219 | - $node = (object) $node; // node_save requires an object |
|
219 | + $node = (object)$node; // node_save requires an object |
|
220 | 220 | node_save($node); |
221 | 221 | |
222 | 222 | $item = array( |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | 'type' => 'page', |
238 | 238 | 'title' => t('Rules and Policies'), |
239 | 239 | 'uid' => 1, |
240 | - 'status' => 1, // published |
|
240 | + 'status' => 1, // published |
|
241 | 241 | 'promote' => 0, // not promoted to front page |
242 | 242 | 'path' => 'rules-and-policies', |
243 | 243 | 'pathauto_perform_alias' => FALSE, |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | 'format' => 4, |
252 | 252 | //'teaser' => $teaser, |
253 | 253 | ); |
254 | - $node = (object) $node; // node_save requires an object |
|
254 | + $node = (object)$node; // node_save requires an object |
|
255 | 255 | node_save($node); |
256 | 256 | |
257 | 257 | // Create menu item to node |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | 'type' => 'page', |
274 | 274 | 'title' => t('Moderation'), |
275 | 275 | 'uid' => 1, |
276 | - 'status' => 1, // published |
|
276 | + 'status' => 1, // published |
|
277 | 277 | 'promote' => 0, // not promoted to front page |
278 | 278 | 'path' => 'moderation', |
279 | 279 | 'pathauto_perform_alias' => FALSE, |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | 'format' => 4, |
288 | 288 | //'teaser' => $teaser, |
289 | 289 | ); |
290 | - $node = (object) $node; // node_save requires an object |
|
290 | + $node = (object)$node; // node_save requires an object |
|
291 | 291 | node_save($node); |
292 | 292 | |
293 | 293 | // Create menu item to node |
@@ -147,13 +147,11 @@ discard block |
||
147 | 147 | '@pages' => format_plural($pages_generated, 'page', 'pages'), |
148 | 148 | ) |
149 | 149 | )); |
150 | - } |
|
151 | - else { |
|
150 | + } else { |
|
152 | 151 | if ($option) { |
153 | 152 | drupal_set_message(t('The @specified page already exists.', |
154 | 153 | array('@specified' => $option)), 'warning'); |
155 | - } |
|
156 | - else { |
|
154 | + } else { |
|
157 | 155 | drupal_set_message(t('All pages already exist, so none can be recreated |
158 | 156 | automatically.'), 'warning'); |
159 | 157 | } |
@@ -174,8 +172,7 @@ discard block |
||
174 | 172 | 'rules', |
175 | 173 | 'moderation', |
176 | 174 | ); |
177 | - } |
|
178 | - elseif (!is_array($pages)) { |
|
175 | + } elseif (!is_array($pages)) { |
|
179 | 176 | $pages = array($pages); |
180 | 177 | } |
181 | 178 |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | '#title' => t('Tools'), |
55 | 55 | '#type' => 'fieldset', |
56 | 56 | '#description' => '', |
57 | - '#collapsible' => TRUE, |
|
58 | - '#collapsed' => FALSE, |
|
57 | + '#collapsible' => true, |
|
58 | + '#collapsed' => false, |
|
59 | 59 | '#attributes' => array('class' => '') |
60 | 60 | ); |
61 | 61 | $form['tools']['reset_uotd'] = array( |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'status' => 1, // published |
199 | 199 | 'promote' => 0, // not promoted to front page |
200 | 200 | 'path' => 'help', |
201 | - 'pathauto_perform_alias' => FALSE, |
|
201 | + 'pathauto_perform_alias' => false, |
|
202 | 202 | 'created' => time(), |
203 | 203 | 'changed' => time(), |
204 | 204 | 'comment' => 0, // disable comments |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | 'status' => 1, // published |
241 | 241 | 'promote' => 0, // not promoted to front page |
242 | 242 | 'path' => 'rules-and-policies', |
243 | - 'pathauto_perform_alias' => FALSE, |
|
243 | + 'pathauto_perform_alias' => false, |
|
244 | 244 | 'created' => time(), |
245 | 245 | 'changed' => time(), |
246 | 246 | 'comment' => 0, // disable comments |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | 'status' => 1, // published |
277 | 277 | 'promote' => 0, // not promoted to front page |
278 | 278 | 'path' => 'moderation', |
279 | - 'pathauto_perform_alias' => FALSE, |
|
279 | + 'pathauto_perform_alias' => false, |
|
280 | 280 | 'created' => time(), |
281 | 281 | 'changed' => time(), |
282 | 282 | 'comment' => 0, // disable comments |
@@ -7,191 +7,191 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** |
10 | - * The BOINC community form allows the setting of requirements for interaction |
|
11 | - * in the community sections of the site. |
|
12 | - */ |
|
10 | + * The BOINC community form allows the setting of requirements for interaction |
|
11 | + * in the community sections of the site. |
|
12 | + */ |
|
13 | 13 | function boinccore_admin_community(&$form_state) { |
14 | - $form = array(); |
|
15 | - $default = array( |
|
14 | + $form = array(); |
|
15 | + $default = array( |
|
16 | 16 | 'min_credit_to_post' => variable_get('boinc_comment_min_credit', 0), |
17 | 17 | 'penalty_period' => variable_get('boinc_penalty_period', 7*24*60*60), |
18 | 18 | 'moderator_mailing_list' => variable_get('boinc_moderator_mailing_list', ''), |
19 | 19 | 'moderator_force_individual_notifications' => variable_get('boinc_moderator_force_individual_notifications', 0), |
20 | - ); |
|
20 | + ); |
|
21 | 21 | |
22 | - // Define the form |
|
23 | - $form['boinc_comment_min_credit'] = array( |
|
22 | + // Define the form |
|
23 | + $form['boinc_comment_min_credit'] = array( |
|
24 | 24 | '#type' => 'textfield', |
25 | 25 | '#title' => t('Credit required for community participation'), |
26 | 26 | '#default_value' => $default['min_credit_to_post'], |
27 | 27 | '#description' => t('Set a minimum threshold of credit a user must have |
28 | 28 | earned before being allowed to create a profile, post comments or participate in forums.'), |
29 | - ); |
|
30 | - $form['boinc_penalty_period'] = array( |
|
29 | + ); |
|
30 | + $form['boinc_penalty_period'] = array( |
|
31 | 31 | '#type' => 'textfield', |
32 | 32 | '#title' => t('Penalty period'), |
33 | 33 | '#default_value' => $default['penalty_period'], |
34 | 34 | '#description' => t('The amount of time (in seconds) that user privileges |
35 | 35 | are revoked when a user is banned from community participation.'), |
36 | - ); |
|
37 | - $form['boinc_moderator_mailing_list'] = array( |
|
36 | + ); |
|
37 | + $form['boinc_moderator_mailing_list'] = array( |
|
38 | 38 | '#type' => 'textfield', |
39 | 39 | '#title' => t('Moderator mailing list'), |
40 | 40 | '#default_value' => $default['moderator_mailing_list'], |
41 | 41 | '#description' => t('As an alternative to sending moderator notifications |
42 | 42 | to individual users with the moderator role, enter a mailing list address |
43 | 43 | here to be the only target of the notification emails.'), |
44 | - ); |
|
45 | - $form['boinc_moderator_force_individual_notifications'] = array( |
|
44 | + ); |
|
45 | + $form['boinc_moderator_force_individual_notifications'] = array( |
|
46 | 46 | '#type' => 'checkbox', |
47 | 47 | '#title' => t('Always send individual notifications'), |
48 | 48 | '#default_value' => $default['moderator_force_individual_notifications'], |
49 | 49 | '#description' => t('Continue to send individual moderator notification |
50 | 50 | emails even when a mailing list is provided.'), |
51 | - ); |
|
51 | + ); |
|
52 | 52 | |
53 | - $form['tools'] = array( |
|
53 | + $form['tools'] = array( |
|
54 | 54 | '#title' => t('Tools'), |
55 | 55 | '#type' => 'fieldset', |
56 | 56 | '#description' => '', |
57 | 57 | '#collapsible' => TRUE, |
58 | 58 | '#collapsed' => FALSE, |
59 | 59 | '#attributes' => array('class' => '') |
60 | - ); |
|
61 | - $form['tools']['reset_uotd'] = array( |
|
60 | + ); |
|
61 | + $form['tools']['reset_uotd'] = array( |
|
62 | 62 | '#type' => 'submit', |
63 | 63 | '#value' => t('Force new UOTD'), |
64 | 64 | '#submit' => array('boinccore_reset_user_of_the_day'), |
65 | - ); |
|
65 | + ); |
|
66 | 66 | |
67 | - return system_settings_form($form); |
|
67 | + return system_settings_form($form); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * Validate the BOINC community form. |
|
72 | - */ |
|
71 | + * Validate the BOINC community form. |
|
72 | + */ |
|
73 | 73 | function boinccore_admin_community_validate($form, &$form_state) { |
74 | - $values = $form_state['values']; |
|
75 | - if (!is_numeric($values['boinc_comment_min_credit'])) { |
|
74 | + $values = $form_state['values']; |
|
75 | + if (!is_numeric($values['boinc_comment_min_credit'])) { |
|
76 | 76 | form_set_error('boinc_comment_min_credit', t('The minimum credit value must be a number.')); |
77 | - } |
|
77 | + } |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | - * Handle post-validation submission of BOINC community form. |
|
82 | - */ |
|
81 | + * Handle post-validation submission of BOINC community form. |
|
82 | + */ |
|
83 | 83 | function boinccore_admin_community_submit($form, &$form_state) { |
84 | - drupal_set_message(t('BOINC community settings have been updated.')); |
|
84 | + drupal_set_message(t('BOINC community settings have been updated.')); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Force a reset of the user of the day |
89 | 89 | */ |
90 | 90 | function boinccore_reset_user_of_the_day() { |
91 | - if (boincuser_select_user_of_the_day()) { |
|
91 | + if (boincuser_select_user_of_the_day()) { |
|
92 | 92 | drupal_set_message(t('The user of the day has been reset.')); |
93 | - } |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | - * The standard page generator form provides an interface to create standard |
|
98 | - * pages, such as a Help or About page. |
|
99 | - */ |
|
97 | + * The standard page generator form provides an interface to create standard |
|
98 | + * pages, such as a Help or About page. |
|
99 | + */ |
|
100 | 100 | function boinccore_admin_default_content(&$form_state) { |
101 | - $form = array(); |
|
101 | + $form = array(); |
|
102 | 102 | |
103 | - // Define the form |
|
104 | - $form['page'] = array( |
|
103 | + // Define the form |
|
104 | + $form['page'] = array( |
|
105 | 105 | '#type' => 'select', |
106 | 106 | '#title' => t('Generate default content for'), |
107 | 107 | '#description' => t('Generate some standard pages for a Drupal-BOINC Web site. You may generate all pages or specific pages. If a page already exists, it will <b>not</b> be overwritten. Pages will be generated with the path \'/page\', e.g., \'/help\'. Note the absense of \'content/\'.<p>The pages generated here will have very limited content. Most will have content such as \'Add a link to your FAQ here.\', and it is the admin or editors responsibility to add the necessary content.'), |
108 | 108 | '#options' => array( |
109 | - 0 => t('All standard pages'), |
|
109 | + 0 => t('All standard pages'), |
|
110 | 110 | // 'about' => t('About page'), |
111 | - 'help' => t('Help page'), |
|
112 | - 'rules' => t('Rules and Policies page'), |
|
113 | - 'moderation' => t('Moderation information page'), |
|
111 | + 'help' => t('Help page'), |
|
112 | + 'rules' => t('Rules and Policies page'), |
|
113 | + 'moderation' => t('Moderation information page'), |
|
114 | 114 | ), |
115 | - ); |
|
116 | - $form['submit'] = array( |
|
115 | + ); |
|
116 | + $form['submit'] = array( |
|
117 | 117 | '#type' => 'submit', |
118 | 118 | '#value' => 'Generate content', |
119 | - ); |
|
119 | + ); |
|
120 | 120 | |
121 | - return $form; |
|
121 | + return $form; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | - * Generate content based on the selection made on the form |
|
126 | - */ |
|
125 | + * Generate content based on the selection made on the form |
|
126 | + */ |
|
127 | 127 | function boinccore_admin_default_content_submit($form, &$form_state) { |
128 | - $option = $form_state['values']['page']; |
|
129 | - $page_list = boinccore_admin_default_content_generate($option); |
|
130 | - $pages_generated = count($page_list); |
|
131 | - if ($pages_generated > 0) { |
|
128 | + $option = $form_state['values']['page']; |
|
129 | + $page_list = boinccore_admin_default_content_generate($option); |
|
130 | + $pages_generated = count($page_list); |
|
131 | + if ($pages_generated > 0) { |
|
132 | 132 | switch ($pages_generated) { |
133 | 133 | case 1: |
134 | 134 | $page_list = reset($page_list); |
135 | - break; |
|
135 | + break; |
|
136 | 136 | case 2: |
137 | 137 | $page_list = implode(' and ', $page_list); |
138 | - break; |
|
138 | + break; |
|
139 | 139 | default: |
140 | 140 | end($page_list); |
141 | - $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)]; |
|
142 | - $page_list = implode(', ', $page_list); |
|
141 | + $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)]; |
|
142 | + $page_list = implode(', ', $page_list); |
|
143 | 143 | } |
144 | 144 | drupal_set_message(t('Default content has been generated for the @listed |
145 | 145 | @pages.', array( |
146 | 146 | '@listed' => $page_list, |
147 | 147 | '@pages' => format_plural($pages_generated, 'page', 'pages'), |
148 | - ) |
|
148 | + ) |
|
149 | 149 | )); |
150 | - } |
|
151 | - else { |
|
150 | + } |
|
151 | + else { |
|
152 | 152 | if ($option) { |
153 | - drupal_set_message(t('The @specified page already exists.', |
|
153 | + drupal_set_message(t('The @specified page already exists.', |
|
154 | 154 | array('@specified' => $option)), 'warning'); |
155 | 155 | } |
156 | 156 | else { |
157 | - drupal_set_message(t('All pages already exist, so none can be recreated |
|
157 | + drupal_set_message(t('All pages already exist, so none can be recreated |
|
158 | 158 | automatically.'), 'warning'); |
159 | 159 | } |
160 | 160 | drupal_set_message(t('To recreate a page, first delete the existing page (or |
161 | 161 | remove its URL alias), then try this function again.'), 'warning'); |
162 | - } |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * |
|
167 | - */ |
|
166 | + * |
|
167 | + */ |
|
168 | 168 | function boinccore_admin_default_content_generate($pages = array()) { |
169 | - if (!$pages) { |
|
169 | + if (!$pages) { |
|
170 | 170 | // If not specified, attempt to generate all pages by default |
171 | 171 | $pages = array( |
172 | - 'help', |
|
172 | + 'help', |
|
173 | 173 | // 'about', |
174 | - 'rules', |
|
175 | - 'moderation', |
|
174 | + 'rules', |
|
175 | + 'moderation', |
|
176 | 176 | ); |
177 | - } |
|
178 | - elseif (!is_array($pages)) { |
|
177 | + } |
|
178 | + elseif (!is_array($pages)) { |
|
179 | 179 | $pages = array($pages); |
180 | - } |
|
180 | + } |
|
181 | 181 | |
182 | - $pages_generated = array(); |
|
183 | - if (in_array('about', $pages)) { |
|
182 | + $pages_generated = array(); |
|
183 | + if (in_array('about', $pages)) { |
|
184 | 184 | // Create the default About page, if it doesn't exist |
185 | 185 | // TODO: what is the default About page...? |
186 | 186 | if (!drupal_lookup_path('source', 'about')) { |
187 | - drupal_set_message('The about page doesn\'t yet have a definition...', 'warning'); |
|
188 | - //$pages_generated[] = 'about'; |
|
187 | + drupal_set_message('The about page doesn\'t yet have a definition...', 'warning'); |
|
188 | + //$pages_generated[] = 'about'; |
|
189 | + } |
|
189 | 190 | } |
190 | - } |
|
191 | - if (in_array('help', $pages)) { |
|
191 | + if (in_array('help', $pages)) { |
|
192 | 192 | // Create the default Help page, if it doesn't exist |
193 | 193 | if (!drupal_lookup_path('source', 'help')) { |
194 | - $node = array( |
|
194 | + $node = array( |
|
195 | 195 | 'type' => 'page', |
196 | 196 | 'title' => t('Help'), |
197 | 197 | 'uid' => 1, |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'comment' => 0, // disable comments |
205 | 205 | 'moderate' => 0, |
206 | 206 | 'body' => preg_replace('/>\s+</', '><', |
207 | - '<p>Use this page to provide help and support for your site\'s |
|
207 | + '<p>Use this page to provide help and support for your site\'s |
|
208 | 208 | visitors:</p> |
209 | 209 | <ul> |
210 | 210 | <li>Add a link to your primary forum for getting help</li> |
@@ -215,25 +215,25 @@ discard block |
||
215 | 215 | 'sticky' => 0, |
216 | 216 | 'format' => 4, |
217 | 217 | //'teaser' => $teaser, |
218 | - ); |
|
219 | - $node = (object) $node; // node_save requires an object |
|
220 | - node_save($node); |
|
218 | + ); |
|
219 | + $node = (object) $node; // node_save requires an object |
|
220 | + node_save($node); |
|
221 | 221 | |
222 | - $item = array( |
|
222 | + $item = array( |
|
223 | 223 | 'link_path' => drupal_get_normal_path('help'), |
224 | 224 | 'link_title' => t('Help'), |
225 | 225 | 'menu_name' => 'primary-links', |
226 | 226 | 'weight' => 50, |
227 | - ); |
|
228 | - menu_link_save($item); |
|
229 | - $pages_generated[] = 'help'; |
|
227 | + ); |
|
228 | + menu_link_save($item); |
|
229 | + $pages_generated[] = 'help'; |
|
230 | 230 | } |
231 | - } |
|
232 | - if (in_array('rules', $pages)) { |
|
231 | + } |
|
232 | + if (in_array('rules', $pages)) { |
|
233 | 233 | // Create the default Rules page, if it doesn't exist |
234 | 234 | if (!drupal_lookup_path('source', 'rules-and-policies')) { |
235 | - // Create node |
|
236 | - $node = array( |
|
235 | + // Create node |
|
236 | + $node = array( |
|
237 | 237 | 'type' => 'page', |
238 | 238 | 'title' => t('Rules and Policies'), |
239 | 239 | 'uid' => 1, |
@@ -246,30 +246,30 @@ discard block |
||
246 | 246 | 'comment' => 0, // disable comments |
247 | 247 | 'moderate' => 0, |
248 | 248 | 'body' => preg_replace('/>\s+</', '><', |
249 | - '<p>Use this page to list your sites rules and policies.</p>'), |
|
249 | + '<p>Use this page to list your sites rules and policies.</p>'), |
|
250 | 250 | 'sticky' => 0, |
251 | 251 | 'format' => 4, |
252 | 252 | //'teaser' => $teaser, |
253 | - ); |
|
254 | - $node = (object) $node; // node_save requires an object |
|
255 | - node_save($node); |
|
253 | + ); |
|
254 | + $node = (object) $node; // node_save requires an object |
|
255 | + node_save($node); |
|
256 | 256 | |
257 | - // Create menu item to node |
|
258 | - $item = array( |
|
257 | + // Create menu item to node |
|
258 | + $item = array( |
|
259 | 259 | 'link_path' => drupal_get_normal_path('rules-and-policies'), |
260 | 260 | 'link_title' => t('Rules and Policies'), |
261 | 261 | 'menu_name' => 'menu-footer-links', |
262 | 262 | 'weight' => 0, |
263 | - ); |
|
264 | - menu_link_save($item); |
|
265 | - $pages_generated[] = 'rules-and-policies'; |
|
263 | + ); |
|
264 | + menu_link_save($item); |
|
265 | + $pages_generated[] = 'rules-and-policies'; |
|
266 | + } |
|
266 | 267 | } |
267 | - } |
|
268 | - if (in_array('moderation', $pages)) { |
|
268 | + if (in_array('moderation', $pages)) { |
|
269 | 269 | // Create the default Moderation page, if it doesn't exist |
270 | 270 | if (!drupal_lookup_path('source', 'moderation')) { |
271 | - // Create node |
|
272 | - $node = array( |
|
271 | + // Create node |
|
272 | + $node = array( |
|
273 | 273 | 'type' => 'page', |
274 | 274 | 'title' => t('Moderation'), |
275 | 275 | 'uid' => 1, |
@@ -282,27 +282,27 @@ discard block |
||
282 | 282 | 'comment' => 0, // disable comments |
283 | 283 | 'moderate' => 0, |
284 | 284 | 'body' => preg_replace('/>\s+</', '><', |
285 | - '<p>Use this page to describe your sites moderation policy.</p>'), |
|
285 | + '<p>Use this page to describe your sites moderation policy.</p>'), |
|
286 | 286 | 'sticky' => 0, |
287 | 287 | 'format' => 4, |
288 | 288 | //'teaser' => $teaser, |
289 | - ); |
|
290 | - $node = (object) $node; // node_save requires an object |
|
291 | - node_save($node); |
|
289 | + ); |
|
290 | + $node = (object) $node; // node_save requires an object |
|
291 | + node_save($node); |
|
292 | 292 | |
293 | - // Create menu item to node |
|
294 | - $item = array( |
|
293 | + // Create menu item to node |
|
294 | + $item = array( |
|
295 | 295 | 'link_path' => drupal_get_normal_path('moderation'), |
296 | 296 | 'link_title' => t('Moderation'), |
297 | 297 | 'menu_name' => 'menu-footer-links', |
298 | 298 | 'weight' => 0, |
299 | - ); |
|
300 | - menu_link_save($item); |
|
301 | - $pages_generated[] = 'moderation'; |
|
299 | + ); |
|
300 | + menu_link_save($item); |
|
301 | + $pages_generated[] = 'moderation'; |
|
302 | + } |
|
302 | 303 | } |
303 | - } |
|
304 | 304 | |
305 | - // Rebuild drupal menus |
|
306 | - menu_rebuild(); |
|
307 | - return $pages_generated; |
|
305 | + // Rebuild drupal menus |
|
306 | + menu_rebuild(); |
|
307 | + return $pages_generated; |
|
308 | 308 | } |