2004-02-04 01:21:51 +00:00
< ? php
2016-12-19 23:47:52 +00:00
// Sample BOINC project web config file.
2004-02-04 01:21:51 +00:00
// Modify it to suit your project.
2004-06-11 18:50:15 +00:00
// Put your version in html/project/project.inc
2016-12-19 23:47:52 +00:00
//
2010-02-16 01:06:03 +00:00
// add tra() around visible strings to make them translatable
2016-12-19 23:47:52 +00:00
// see inc/translation.inc and
// https://boinc.berkeley.edu/trac/wiki/TranslateProject for details
2004-02-04 01:21:51 +00:00
2006-09-14 00:18:13 +00:00
require_once ( " ../inc/util.inc " );
2016-12-19 23:47:52 +00:00
//-------------- Project name and owner
2007-12-30 22:02:16 +00:00
define ( " PROJECT " , " REPLACE WITH PROJECT NAME " );
2016-12-19 23:47:52 +00:00
define ( " COPYRIGHT_HOLDER " , " REPLACE WITH COPYRIGHT HOLDER " );
//-------------- contact info
define ( " SYS_ADMIN_EMAIL " , " admin@ $master_url " );
define ( " UOTD_ADMIN_EMAIL " , " admin@ $master_url " );
// who gets emails about user of the day pool running low?
define ( " POST_REPORT_EMAILS " , " moderator1@ $master_url |moderator2@ $master_url " );
// Email addresses separated by pipe ( | ) that will receive user reports
// of offensive forum posts.
//-------------- URLs and directories
$master_url = parse_config ( get_config (), " <master_url> " );
2006-05-09 18:25:15 +00:00
define ( " URL_BASE " , $master_url );
2004-02-24 04:05:13 +00:00
define ( " IMAGE_PATH " , " ../user_profile/images/ " );
define ( " IMAGE_URL " , " user_profile/images/ " );
define ( " PROFILE_PATH " , " ../user_profile/ " );
define ( " PROFILE_URL " , " user_profile/ " );
define ( " LANGUAGE_FILE " , " languages.txt " );
2016-12-19 23:47:52 +00:00
//-------------- Caching
//define("MEMCACHE_SERVERS", "127.0.0.1:11211");
//-------------- CSS styling
// add your own stylesheets (included after bootstrap)
2016-11-11 20:36:27 +00:00
//define("STYLESHEET", "aaa.css");
//define("STYLESHEET2", "bbb.css");
2016-12-19 23:47:52 +00:00
//-------------- enable/disable web features
2016-11-11 20:36:27 +00:00
define ( " FORUM_QA_MERGED_MODE " , true );
// Set to true to merge Message boards and Q&A section
define ( " DISABLE_PROFILES " , true );
// enable profiles only after enabling reCAPTCHA
// http://boinc.berkeley.edu/trac/wiki/ProtectionFromSpam
define ( " USE_STOPFORUMSPAM " , true );
// use http://www.stopforumspam.com to suppress spammer accounts
2016-08-04 08:31:12 +00:00
define ( " RPC_DEBUG " , false );
2016-11-11 20:36:27 +00:00
// Enables PHP error messages in public Web RPCs
2016-08-04 08:31:12 +00:00
2016-12-19 23:47:52 +00:00
//-------------- Project-specific preferences
define ( 'COLOR_PREFS' , false );
// user can select screensaver color scheme
define ( 'GFX_CPU_PREFS' , false );
// user can limit % CPU used by screensaver
// (lower frame rate if exceeded)
// This is probably irrelevant if your screensaver uses OpenGL
define ( 'APP_SELECT_PREFS' , false );
// user can choose which apps to run
define ( 'NON_GRAPHICAL_PREF' , false );
// user can choose to run faster non-graphical app versions if available
define ( 'MAX_JOBS_PREF' , false );
// user can choose max # of jobs in progress
define ( 'MAX_CPUS_PREF' , false );
// user can choose max # of CPUs to use
//-------------- PHPMailer
2014-04-30 17:36:04 +00:00
// If you use PHPMailer, uncomment the following
// and complete the function definition based on your SMTP server
// (not all fields may be needed)
//
if ( 0 ) {
function make_php_mailer () {
$mail = new PHPMailer ();
$mail -> IsSMTP ();
//$mail->Mailer = 'smtp';
$mail -> SMTPAuth = true ;
$mail -> SMTPSecure = " tls " ;
$mail -> Host = " smtp.gmail.com " ;
$mail -> Port = 587 ;
$mail -> Username = " john.doe@gmail.com " ;
$mail -> Password = " xxx " ;
// Google's application-specific password,
// if you are using the 2-Step Verification: 16 characters, no spaces.
// OR: Put here the regular Gmail password if you are not using the
// 2-Step Verification with your Gmail account.
// See https://support.google.com/accounts/answer/185833?hl=en";
$mail -> SetFrom ( 'admin@boincproject.com' , 'John Doe' );
$mail -> AddReplyTo ( " admin@boincproject.com " , " John Doe " );
$mail -> From = " admin@boincproject.com " ;
return $mail ;
}
}
2016-12-19 23:47:52 +00:00
//-------------- Header and footer
2016-11-11 20:36:27 +00:00
2016-11-22 09:20:07 +00:00
// Put your project title and logo here
// If you include any links, prepend URL with $prefix
// if you need to open divs here close them in project_footer()
//
function project_banner ( $title , $prefix , $is_main ) {
if ( $is_main ) {
echo '<img class="img-responsive" src="img/water.jpg">' ;
}
2016-11-20 23:38:19 +00:00
sample_navbar ( secure_url_base (), get_logged_in_user ( false ), false );
2016-11-11 20:36:27 +00:00
if ( $title ) {
echo " <h2> $title </h2> \n " ;
}
2004-02-04 01:21:51 +00:00
}
2016-11-20 23:38:19 +00:00
//$fixed_navbar = true;
2004-02-04 01:21:51 +00:00
2008-06-12 04:50:10 +00:00
function project_footer ( $show_return , $show_date , $prefix ) {
// If you include any links, prepend URL with $prefix
2016-11-11 20:36:27 +00:00
//
2016-12-19 09:15:48 +00:00
echo ' < p ></ p >
2016-11-11 20:36:27 +00:00
< a class = " brand boinc-logo " href = " http://boinc.berkeley.edu/ " >< img align = " middle " border = " 0 " src = " '.secure_url_base().'img/pb_boinc.gif " alt = " Powered by BOINC " ></ a >
2016-11-22 09:20:07 +00:00
< br >
2016-11-11 20:36:27 +00:00
< p class = " text-center " > & copy ; '.gmdate("Y ").COPYRIGHT_HOLDER.' </ p >
' ;
2005-01-24 14:45:51 +00:00
if ( $show_date ) {
2008-07-18 20:59:59 +00:00
$t = time_str ( time ());
2016-11-11 20:36:27 +00:00
echo " <center><small> " . tra ( " Generated " ) . " $t </small><center> \n " ;
2005-01-24 14:45:51 +00:00
}
}
2016-12-19 23:47:52 +00:00
//-------------- Ops access control
2009-09-15 18:14:37 +00:00
// Authorize access to administrative pages.
2009-09-15 04:48:08 +00:00
// You can check for login, IP address, or whatever you want.
//
2010-02-21 04:45:52 +00:00
function auth_ops_example () {
2009-09-15 18:14:37 +00:00
// if running from cmdline, skip checks
//
if ( ! $_SERVER [ 'REMOTE_ADDR' ]) {
return ;
2009-09-15 04:48:08 +00:00
}
2009-09-15 18:14:37 +00:00
// example: require login as a particular user (id 1 in this case)
//
2009-09-15 04:48:08 +00:00
if ( 0 ) {
2009-09-15 18:14:37 +00:00
auth_ops_userid ( array ( 1 ));
return ;
2009-09-15 04:48:08 +00:00
}
2009-09-15 18:14:37 +00:00
// example: require that logged-in user have ADMIN or DEV flags
// set in their forum_prefs.privilege
//
if ( 0 ) {
auth_ops_privilege ();
return ;
2009-09-15 04:48:08 +00:00
}
}
2016-12-19 23:47:52 +00:00
//-------------- Customizable functions
2004-02-04 01:21:51 +00:00
function show_profile_heading1 () {
2010-02-16 01:06:03 +00:00
return tra ( " Your personal background. " );
2004-02-04 01:21:51 +00:00
}
function show_profile_question1 () {
2010-02-16 01:06:03 +00:00
return tra ( " Tell us about yourself. You could tell us where you're from, your age, occupation, hobbies, or anything else about yourself. " );
2004-02-04 01:21:51 +00:00
}
function show_profile_heading2 () {
2010-02-16 01:06:03 +00:00
return tra ( " Your opinions about %1 " , PROJECT );
2004-02-04 01:21:51 +00:00
}
function show_profile_question2 () {
2010-02-16 01:06:03 +00:00
return tra ( " Tell us your thoughts about %1<ol>
< li > Why do you run % 1 ?
< li > What are your views about the project ?
< li > Any suggestions ?
</ ol > " , PROJECT);
2004-04-23 01:42:09 +00:00
}
2004-03-09 23:20:52 +00:00
2005-03-09 01:02:36 +00:00
function project_workunit ( $wu ){
2008-07-18 20:59:59 +00:00
// shown in the workunit page
2005-03-09 01:02:36 +00:00
}
function project_user_summary ( $user ){
2008-07-18 20:59:59 +00:00
// shown in the user summary page
2005-03-09 01:02:36 +00:00
}
function project_user_page_private ( $user ){
2008-07-18 20:59:59 +00:00
// shown in the private account page
2005-03-09 01:02:36 +00:00
}
2016-12-19 23:47:52 +00:00
function project_forum_post_rules () {
// additional forum post rules
return " " ;
}
//-------------- Support for per-app credit
2014-08-15 23:20:40 +00:00
if ( 0 ) {
2014-08-15 21:01:32 +00:00
// show project-specific credit on user/team pages
//
function show_app_credit_user ( $user , $app_name , $appids ) {
$t = 0 ;
$a = 0 ;
$n = 0 ;
foreach ( $appids as $appid ) {
$cu = BoincCreditUser :: lookup (
" userid= $user->id and appid= $appid and credit_type=0 "
);
if ( $cu ) {
$t += $cu -> total ;
$a += $cu -> expavg ;
$n += $cu -> njobs ;
}
}
row2 ( " $app_name credit " ,
format_credit_large ( $t ) . " total, " .
format_credit ( $a ) . " average " .
" ( $n tasks) "
);
}
function show_app_credit_team ( $team , $app_name , $appids ) {
$t = 0 ;
$a = 0 ;
$n = 0 ;
foreach ( $appids as $appid ) {
$ct = BoincCreditTeam :: lookup (
" teamid= $team->id and appid= $appid and credit_type=0 "
);
if ( $ct ) {
$t += $ct -> total ;
$a += $ct -> expavg ;
$n += $ct -> njobs ;
}
}
row2 ( " $app_name credit " ,
format_credit_large ( $t ) . " total, " .
format_credit ( $a ) . " average " .
" ( $n tasks) "
);
}
2014-08-18 20:48:27 +00:00
// a list of "sub-projects", used in the display of per-app credit and badges.
// A subproject is:
// - a set of 1 or more apps; an app can belong to at most 1 subproject.
// - a name, shown on the web site
// - a short name, used in badge names. Don't use "total".
//
2014-08-15 23:20:40 +00:00
$sub_projects = array (
2014-08-18 20:48:27 +00:00
array ( " name " => " Remote Test " , " short_name " => " RT " , " appids " => array ( 16 )),
array ( " name " => " Uppercase " , " short_name " => " UC " , " appids " => array ( 1 , 25 )),
2014-08-15 23:20:40 +00:00
);
2005-03-09 01:02:36 +00:00
function project_user_credit ( $user ){
2014-08-15 23:20:40 +00:00
global $sub_projects ;
foreach ( $sub_projects as $sp ) {
show_app_credit_user ( $user , $sp [ " name " ], $sp [ " appids " ]);
}
2014-08-15 21:01:32 +00:00
}
function project_team_credit ( $team ) {
2014-08-15 23:20:40 +00:00
global $sub_projects ;
foreach ( $sub_projects as $sp ) {
show_app_credit_team ( $team , $sp [ " name " ], $sp [ " appids " ]);
}
2005-03-09 01:02:36 +00:00
}
2014-08-15 23:20:40 +00:00
} // if(0)
2004-02-04 01:21:51 +00:00
?>