1 | <?php |
||
2 | |||
3 | // Sample BOINC project web config file. |
||
4 | // Modify it to suit your project. |
||
5 | // Put your version in html/project/project.inc |
||
6 | // |
||
7 | // add tra() around visible strings to make them translatable |
||
8 | // see inc/translation.inc and |
||
9 | // https://github.com/BOINC/boinc/wiki/TranslateProject for details |
||
10 | |||
11 | require_once("../inc/util.inc"); |
||
12 | |||
13 | //-------------- Project name and owner |
||
14 | |||
15 | define("PROJECT", "REPLACE WITH PROJECT NAME"); |
||
16 | define("COPYRIGHT_HOLDER", "REPLACE WITH COPYRIGHT HOLDER"); |
||
17 | |||
18 | //-------------- URLs and directories |
||
19 | |||
20 | $master_url = parse_config(get_config(), "<master_url>"); |
||
21 | define("URL_BASE", $master_url); |
||
22 | define("IMAGE_PATH", "../user_profile/images/"); |
||
23 | define("IMAGE_URL", "user_profile/images/"); |
||
24 | define("PROFILE_PATH", "../user_profile/"); |
||
25 | define("PROFILE_URL", "user_profile/"); |
||
26 | define("LANGUAGE_FILE", "languages.txt"); |
||
27 | |||
28 | //-------------- contact info |
||
29 | |||
30 | define("SYS_ADMIN_EMAIL", "admin@$master_url"); |
||
31 | define("UOTD_ADMIN_EMAIL", "admin@$master_url"); |
||
32 | // who gets emails about user of the day pool running low? |
||
33 | define("POST_REPORT_EMAILS", "moderator1@$master_url|moderator2@$master_url"); |
||
34 | // Email addresses separated by pipe ( | ) that will receive user reports |
||
35 | // of offensive forum posts. |
||
36 | |||
37 | //-------------- PHP error reporting |
||
38 | // Show PHP errors in web pages. |
||
39 | // Comment this out when your project is public. |
||
40 | display_errors(); |
||
41 | |||
42 | //-------------- CSS styling |
||
43 | |||
44 | // add your own stylesheets (included after bootstrap) |
||
45 | //define("STYLESHEET", "aaa.css"); |
||
46 | //define("STYLESHEET2", "bbb.css"); |
||
47 | //define("SHORTCUT_ICON", "f.gif"); // browser tab icon |
||
48 | define('DARK_MODE', true); // enable dark mode if selected by user |
||
49 | |||
50 | //-------------- enable/disable web features |
||
51 | |||
52 | define('UNIQUE_USER_NAME', true); |
||
53 | define("FORUM_QA_MERGED_MODE", true); |
||
54 | // Set to true to merge Message boards and Q&A section |
||
55 | define ("DISABLE_PROFILES", true); |
||
56 | // enable profiles only after enabling reCAPTCHA |
||
57 | // https://github.com/BOINC/boinc/wiki/ProtectionFromSpam |
||
58 | define("USE_STOPFORUMSPAM", true); |
||
59 | // use http://www.stopforumspam.com to suppress spammer accounts |
||
60 | define("RPC_DEBUG", false); |
||
61 | // Enables PHP error messages in public Web RPCs |
||
62 | define("TERMSOFUSE_FILE", "../../terms_of_use.txt"); |
||
63 | // Defines the location of the terms of use file. Default location is in the project directory. |
||
64 | |||
65 | //-------------- Project-specific preferences |
||
66 | |||
67 | define('COLOR_PREFS', false); |
||
68 | // user can select screensaver color scheme |
||
69 | define('GFX_CPU_PREFS', false); |
||
70 | // user can limit % CPU used by screensaver |
||
71 | // (lower frame rate if exceeded) |
||
72 | // This is probably irrelevant if your screensaver uses OpenGL |
||
73 | define('APP_SELECT_PREFS', false); |
||
74 | // user can choose which apps to run |
||
75 | define('NON_GRAPHICAL_PREF', false); |
||
76 | // user can choose to run faster non-graphical app versions if available |
||
77 | define('MAX_JOBS_PREF', false); |
||
78 | // user can choose max # of jobs in progress |
||
79 | define('MAX_CPUS_PREF', false); |
||
80 | // user can choose max # of CPUs to use |
||
81 | |||
82 | //-------------- PHPMailer |
||
83 | |||
84 | // If you use PHPMailer, uncomment the following |
||
85 | // and complete the function definition based on your SMTP server |
||
86 | // (not all fields may be needed) |
||
87 | // |
||
88 | if (0) { |
||
89 | function make_php_mailer() { |
||
90 | $mail = new PHPMailer(); |
||
0 ignored issues
–
show
|
|||
91 | $mail->IsSMTP(); |
||
92 | //$mail->Mailer = 'smtp'; |
||
93 | $mail->SMTPAuth = true; |
||
94 | $mail->SMTPSecure = "tls"; |
||
95 | $mail->Host = "smtp.gmail.com"; |
||
96 | $mail->Port = 587; |
||
97 | $mail->Username = "[email protected]"; |
||
98 | $mail->Password = "xxx"; |
||
99 | // Google's application-specific password, |
||
100 | // if you are using the 2-Step Verification: 16 characters, no spaces. |
||
101 | // OR: Put here the regular Gmail password if you are not using the |
||
102 | // 2-Step Verification with your Gmail account. |
||
103 | // See https://support.google.com/accounts/answer/185833?hl=en"; |
||
104 | $mail->SetFrom('[email protected]', 'John Doe'); |
||
105 | $mail->AddReplyTo("[email protected]", "John Doe"); |
||
106 | $mail->From = "[email protected]"; |
||
107 | return $mail; |
||
108 | } |
||
109 | } |
||
110 | |||
111 | //-------------- Header and footer |
||
112 | |||
113 | // Put your project title and logo here |
||
114 | // If you include any links, prepend URL with $prefix |
||
115 | // if you need to open divs here close them in project_footer() |
||
116 | // |
||
117 | function project_banner($title, $prefix, $is_main) { |
||
118 | if ($is_main) { |
||
119 | echo '<img class="img-responsive" style="width:100%" src="img/water.jpg">'; |
||
120 | } |
||
121 | sample_navbar(secure_url_base(), get_logged_in_user(false), false); |
||
0 ignored issues
–
show
Are you sure the usage of
get_logged_in_user(false) is correct as it seems to always return null .
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
122 | if ($title) { |
||
123 | echo "<h2>$title</h2>\n"; |
||
124 | } |
||
125 | } |
||
126 | //$fixed_navbar = true; |
||
127 | |||
128 | function project_footer($show_return, $show_date, $prefix) { |
||
129 | echo sprintf( |
||
130 | '<center><a href="%s"><img src=%s/%s alt="%s"></a></center>', |
||
131 | 'https://boinc.berkeley.edu', |
||
132 | secure_url_base(), |
||
133 | 'img/pb_boinc.gif', |
||
134 | 'Powered by BOINC' |
||
135 | ); |
||
136 | echo sprintf('<p><center>© %s %s</center>', |
||
137 | gmdate("Y "), |
||
138 | COPYRIGHT_HOLDER |
||
139 | ); |
||
140 | if ($show_date) { |
||
141 | echo sprintf('<center><small>%s %s</small><center>', |
||
142 | tra('Generated'), |
||
143 | time_str(time()) |
||
144 | ); |
||
145 | } |
||
146 | } |
||
147 | |||
148 | //-------------- Caching |
||
149 | // format: "host:port:weight" |
||
150 | //define("MEMCACHE_SERVERS", "127.0.0.1:11211:50"); |
||
151 | |||
152 | //-------------- Ops access control |
||
153 | |||
154 | // Authorize access to administrative pages. |
||
155 | // You can check for login, IP address, or whatever you want. |
||
156 | // |
||
157 | function auth_ops_example() { |
||
158 | // if running from cmdline, skip checks |
||
159 | // |
||
160 | if (!$_SERVER['REMOTE_ADDR']) { |
||
161 | return; |
||
162 | } |
||
163 | |||
164 | // example: require login as a particular user (id 1 in this case) |
||
165 | // |
||
166 | if (0) { |
||
167 | auth_ops_userid(array(1)); |
||
168 | return; |
||
169 | } |
||
170 | |||
171 | // example: require that logged-in user have ADMIN or DEV flags |
||
172 | // set in their forum_prefs.privilege |
||
173 | // |
||
174 | if (0) { |
||
175 | auth_ops_privilege(); |
||
176 | return; |
||
177 | } |
||
178 | } |
||
179 | |||
180 | //-------------- Customizable functions |
||
181 | |||
182 | function show_profile_heading1() { |
||
183 | return tra("Your personal background."); |
||
184 | } |
||
185 | |||
186 | function show_profile_question1() { |
||
187 | return tra("Tell us about yourself. You could tell us where you're from, your age, occupation, hobbies, or anything else about yourself."); |
||
188 | } |
||
189 | |||
190 | function show_profile_heading2() { |
||
191 | return tra("Your opinions about %1", PROJECT); |
||
192 | } |
||
193 | |||
194 | function show_profile_question2() { |
||
195 | return tra("Tell us your thoughts about %1<ol> |
||
196 | <li>Why do you run %1? |
||
197 | <li>What are your views about the project? |
||
198 | <li>Any suggestions? |
||
199 | </ol>", PROJECT); |
||
200 | } |
||
201 | |||
202 | function project_workunit($wu){ |
||
203 | // shown in the workunit page |
||
204 | } |
||
205 | |||
206 | function project_user_summary($user){ |
||
207 | // shown in the user summary page |
||
208 | } |
||
209 | |||
210 | function project_user_page_private($user){ |
||
211 | // shown in the private account page |
||
212 | } |
||
213 | |||
214 | function project_forum_post_rules() { |
||
215 | // additional forum post rules |
||
216 | return ""; |
||
217 | } |
||
218 | |||
219 | function project_delete_account($user) { |
||
220 | // a project defined function for deleting users if neither |
||
221 | // obfuscate_account($user) or wipe_account($user) in |
||
222 | // inc/delete_account.inc meets the need of the project |
||
223 | die("This function must be implemented before it can be used"); |
||
0 ignored issues
–
show
|
|||
224 | } |
||
225 | |||
226 | //-------------- Delete Account |
||
227 | // TODO: get rid of this. Doesn't need to be configurable, or even exist. |
||
0 ignored issues
–
show
|
|||
228 | //define("DELETE_DELAY", 2); |
||
229 | // When deleting an account, invalidate the authenticator and then wait this |
||
230 | // many seconds before proceeding with the delete. This is intended to give the |
||
231 | // an existing scheduler request sufficient time to complete. Some projects |
||
232 | // might want to increase this to a longer time. Simply uncomment and set the |
||
233 | // delay to what the project needs. |
||
234 | |||
235 | //-------------- Support for per-app credit |
||
236 | |||
237 | if (0) { |
||
238 | |||
239 | // show project-specific credit on user/team pages |
||
240 | // |
||
241 | function show_app_credit_user($user, $app_name, $appids) { |
||
242 | $t = 0; |
||
243 | $a = 0; |
||
244 | $n = 0; |
||
245 | foreach ($appids as $appid) { |
||
246 | $cu = BoincCreditUser::lookup( |
||
247 | "userid=$user->id and appid=$appid and credit_type=0" |
||
248 | ); |
||
249 | if ($cu) { |
||
250 | $t += $cu->total; |
||
251 | $a += $cu->expavg; |
||
252 | $n += $cu->njobs; |
||
253 | } |
||
254 | } |
||
255 | row2("$app_name credit", |
||
256 | format_credit_large($t)." total, ". |
||
257 | format_credit($a)." average". |
||
258 | " ($n tasks)" |
||
259 | ); |
||
260 | } |
||
261 | function show_app_credit_team($team, $app_name, $appids) { |
||
262 | $t = 0; |
||
263 | $a = 0; |
||
264 | $n = 0; |
||
265 | foreach ($appids as $appid) { |
||
266 | $ct = BoincCreditTeam::lookup( |
||
267 | "teamid=$team->id and appid=$appid and credit_type=0" |
||
268 | ); |
||
269 | if ($ct) { |
||
270 | $t += $ct->total; |
||
271 | $a += $ct->expavg; |
||
272 | $n += $ct->njobs; |
||
273 | } |
||
274 | } |
||
275 | row2("$app_name credit", |
||
276 | format_credit_large($t)." total, ". |
||
277 | format_credit($a)." average". |
||
278 | " ($n tasks)" |
||
279 | ); |
||
280 | } |
||
281 | |||
282 | // a list of "sub-projects", used in the display of per-app credit and badges. |
||
283 | // A subproject is: |
||
284 | // - a set of 1 or more apps; an app can belong to at most 1 subproject. |
||
285 | // - a name, shown on the web site |
||
286 | // - a short name, used in badge names. Don't use "total". |
||
287 | // |
||
288 | $sub_projects = array( |
||
289 | array("name" => "Remote Test", "short_name" => "RT", "appids" => array(16)), |
||
290 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
||
291 | ); |
||
292 | |||
293 | function project_user_credit($user){ |
||
294 | global $sub_projects; |
||
295 | foreach ($sub_projects as $sp) { |
||
296 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
||
297 | } |
||
298 | } |
||
299 | |||
300 | function project_team_credit($team) { |
||
301 | global $sub_projects; |
||
302 | foreach ($sub_projects as $sp) { |
||
303 | show_app_credit_team($team, $sp["name"], $sp["appids"]); |
||
304 | } |
||
305 | } |
||
306 | |||
307 | } // if(0) |
||
308 | |||
309 | ?> |
||
310 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths