2007-06-04 20:32:47 +00:00
< ? php
2008-08-05 22:43:14 +00:00
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
2007-06-04 20:32:47 +00:00
2018-10-23 16:06:55 +00:00
require_once ( " ../inc/consent.inc " );
2007-06-04 20:32:47 +00:00
require_once ( " ../inc/util.inc " );
require_once ( " ../inc/xml.inc " );
2018-10-09 11:06:52 +00:00
if ( file_exists ( '../../release.inc' ))
include '../../release.inc' ;
2007-06-04 20:32:47 +00:00
2016-06-20 13:14:55 +00:00
BoincDb :: get ( true );
2007-06-04 20:32:47 +00:00
xml_header ();
// This all needs to work even when DB is down.
// So cache list of platforms in a file,
// and update it every hour if possible.
//
function show_platforms () {
2014-01-09 01:17:07 +00:00
$xmlFragment = unserialize ( get_cached_data ( 3600 , " project_config_platform_xml " ));
if ( $xmlFragment == false ){
2014-02-03 06:08:09 +00:00
$platforms = BoincDB :: get () -> enum_fields ( " platform, DBNAME.app_version, DBNAME.app " , " BoincPlatform " , " platform.name, platform.user_friendly_name, plan_class " , " app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class " , " " );
2014-01-09 01:17:07 +00:00
$xmlFragment = " <platforms> " ;
foreach ( $platforms as $platform ){
$xmlFragment .= "
< platform >
< platform_name > $platform -> name </ platform_name >
< user_friendly_name > $platform -> user_friendly_name </ user_friendly_name > " ;
if ( $platform -> plan_class ) $xmlFragment .= "
< plan_class > $platform -> plan_class </ plan_class > \n " ;
$xmlFragment .= "
</ platform > " ;
2007-06-04 20:32:47 +00:00
}
2014-01-09 01:17:07 +00:00
$xmlFragment .= " \n </platforms> \n " ;
set_cached_data ( 3600 , serialize ( $xmlFragment ), " project_config_platform_xml " );
2007-06-04 20:32:47 +00:00
}
2014-01-09 01:17:07 +00:00
echo $xmlFragment ;
2007-06-04 20:32:47 +00:00
}
$config = get_config ();
2018-06-27 18:51:38 +00:00
global $master_url ;
2007-06-04 20:32:47 +00:00
$long_name = parse_config ( $config , " <long_name> " );
2008-11-28 19:03:05 +00:00
2007-06-04 20:32:47 +00:00
$min_passwd_length = parse_config ( $config , " <min_passwd_length> " );
if ( ! $min_passwd_length ) {
$min_passwd_length = 6 ;
}
$disable_account_creation = parse_bool ( $config , " disable_account_creation " );
echo " <project_config>
< name > $long_name </ name >
< master_url > $master_url </ master_url >
client/manager/server: use HTTPS for web RPCs if possible
The web RPCs done by the client during project attach
(lookup_account, create_account)
have an email address and password hash in their request.
Network sniffers could potentially see these,
so we should use HTTPS for these RPCs if possible.
However, not all BOINC projects have SSL-enabled web servers.
So I did the following:
- Change get_project_config.php to return an additional
<web_rpc_url_base> element.
This is SECURE_URL_BASE (if specified in the project's
project.inc config file) or, if not, the master URL.
- This new element is parsed into the PROJECT_CONFIG structure.
- In calls to create_account and lookup_account,
the Manager uses PROJECT_CONFIG::web_rpc_url_base
if it's available, else the master URL.
So, the new Manager/client uses HTTPS for RPCs to projects
that have updated their get_project_config.php,
and specify a SECURE_URL_BASE with https:// prefix.
Android note: I added code to parse the new config element,
but didn't change the higher-level code;
Joachim will need to do this.
2014-01-28 21:25:59 +00:00
< web_rpc_url_base > " .secure_url_base(). " </ web_rpc_url_base >
2007-06-04 20:32:47 +00:00
" ;
2018-10-05 13:03:54 +00:00
if ( isset ( $git_commit ) ) {
echo " <git_commit> $git_commit </git_commit> \n " ;
}
if ( isset ( $server_version ) ) {
echo " <server_version> $server_version </server_version> \n " ;
}
2018-03-10 06:15:03 +00:00
if ( parse_config ( $config , " <account_manager> " )) {
echo " <account_manager/> \n " ;
}
2014-01-09 01:17:07 +00:00
$local_revision = @ trim ( file_get_contents ( " ../../local.revision " ));
2007-06-04 20:32:47 +00:00
if ( $local_revision ) {
echo " <local_revision> $local_revision </local_revision> \n " ;
}
if ( web_stopped ()) {
echo "
2013-12-29 06:50:59 +00:00
< error_num > " .ERR_PROJECT_DOWN. " </ error_num >
2007-06-04 20:32:47 +00:00
< web_stopped > 1 </ web_stopped >
" ;
} else {
2014-01-09 01:17:07 +00:00
echo " <web_stopped>0</web_stopped> \n " ;
2007-06-04 20:32:47 +00:00
}
2011-09-27 15:22:34 +00:00
2009-01-13 19:34:04 +00:00
if ( $disable_account_creation || defined ( 'INVITE_CODES' )) {
2011-09-27 15:22:34 +00:00
echo " <account_creation_disabled/> \n " ;
}
if ( defined ( 'INVITE_CODES' )) {
echo " <invite_code_required/> \n " ;
2009-01-13 19:34:04 +00:00
}
2014-01-09 01:17:07 +00:00
echo " <min_passwd_length> $min_passwd_length </min_passwd_length> \n " ;
2009-01-13 19:34:04 +00:00
2007-06-04 20:32:47 +00:00
if ( sched_stopped ()) {
2014-01-09 01:17:07 +00:00
echo " <sched_stopped>1</sched_stopped> \n " ;
2007-06-04 20:32:47 +00:00
} else {
2014-01-09 01:17:07 +00:00
echo " <sched_stopped>0</sched_stopped> \n " ;
2007-06-04 20:32:47 +00:00
}
2009-01-13 19:34:04 +00:00
$min_core_client_version = parse_config ( $config , " <min_core_client_version> " );
if ( $min_core_client_version ) {
echo " <min_client_version> $min_core_client_version </min_client_version> \n " ;
}
2007-06-04 20:32:47 +00:00
show_platforms ();
2018-06-11 15:42:31 +00:00
// Conditional added to allow for backwards-compatability. If a
// project has not defined the constant TERMSOFUSE_FILE, then look for
// the terms_of_use.txt file in the project base directory.
if ( defined ( 'TERMSOFUSE_FILE' )) {
$tou_file = TERMSOFUSE_FILE ;
}
else {
$tou_file = " ../../terms_of_use.txt " ;
}
2009-01-08 00:41:15 +00:00
if ( file_exists ( $tou_file )) {
$terms_of_use = trim ( file_get_contents ( $tou_file ));
2018-10-23 16:06:55 +00:00
// Also check consent type ENROLL is enabled.
list ( $checkct , $ctid ) = check_consent_type ( CONSENT_TYPE_ENROLL );
if ( $terms_of_use and $checkct ) {
2014-01-09 01:17:07 +00:00
echo " <terms_of_use> \n $terms_of_use\n </terms_of_use> \n " ;
2009-01-08 00:41:15 +00:00
}
2008-11-26 03:28:48 +00:00
}
2014-10-19 06:53:27 +00:00
if ( LDAP_HOST ) {
echo " <ldap_auth/> \n " ;
}
2017-08-01 17:24:19 +00:00
if ( file_exists ( " ../../project_keywords.xml " )) {
readfile ( " ../../project_keywords.xml " );
}
2014-01-09 01:17:07 +00:00
echo " </project_config> " ;
2007-06-04 20:32:47 +00:00
?>