diff --git a/html/inc/account.inc b/html/inc/account.inc index 4db6ea2481..e1ad3f0849 100644 --- a/html/inc/account.inc +++ b/html/inc/account.inc @@ -102,7 +102,7 @@ function create_account_form($teamid, $next_url) { ), "passwd", "", "password",'id="passwd"',passwd_visible_checkbox("passwd") ); - if (!NO_USER_COUNTRY) { + if (USER_COUNTRY) { form_select( sprintf('%s', tra("Select the country you want to represent, if any."), diff --git a/html/inc/forum.inc b/html/inc/forum.inc index 80c0d5ccaf..72f8f5425e 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -628,7 +628,7 @@ function show_post( // - put the .png's in html/user/flags/ // - put define("COUNTRY_FLAGS", 1); in your html/project/project.inc // - if (!NO_USER_COUNTRY && defined("COUNTRY_FLAGS")) { + if (USER_COUNTRY && defined("COUNTRY_FLAGS")) { if (array_key_exists($user->country, $country_to_iso3166_2)) { $code = $country_to_iso3166_2[$user->country]; echo "\"$user-country\" title=\"$user->country\" src=flags/$code.png>\n"; diff --git a/html/inc/user.inc b/html/inc/user.inc index 2c23c21a82..606a148224 100644 --- a/html/inc/user.inc +++ b/html/inc/user.inc @@ -243,13 +243,13 @@ function show_user_info_private($user) { } row2(tra("Email address"), $email_text); } - if (!NO_USER_URL) { + if (USER_URL) { if (strlen($user->url)) { $u = normalize_user_url($user->url); row2(tra("URL"), sprintf('%s', $u, $u)); } } - if (!NO_USER_COUNTRY) { + if (USER_COUNTRY) { row2(tra("Country"), $user->country); } if (POSTAL_CODE) { @@ -437,10 +437,10 @@ function show_user_summary_public($user) { global $g_logged_in_user; row2(tra("User ID"), $user->id); row2(tra("%1 member since", PROJECT), date_str($user->create_time)); - if (!NO_USER_COUNTRY) { + if (USER_COUNTRY) { row2(tra("Country"), $user->country); } - if (!NO_USER_URL) { + if (USER_URL) { // don't show URL if user has no recent credit (spam suppression) // if (strlen($user->url)) { diff --git a/html/inc/user_util.inc b/html/inc/user_util.inc index 37067b79c8..9d238ce75a 100644 --- a/html/inc/user_util.inc +++ b/html/inc/user_util.inc @@ -260,7 +260,7 @@ function validate_post_make_user() { $passwd_hash = md5($passwd.$new_email_addr); $country = ""; - if (!NO_USER_COUNTRY) { + if (USER_COUNTRY) { $country = post_str("country", true); if ($country && !is_valid_country($country)) { error_page("bad country"); diff --git a/html/inc/util.inc b/html/inc/util.inc index 62b107704a..befed7c2ce 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -34,7 +34,7 @@ require_once("../inc/translation.inc"); require_once("../inc/profile.inc"); require_once("../inc/bootstrap.inc"); -// parse some stuff from config (do it here for efficiency) +// parse some stuff from config.xml (do it here for efficiency) // $config = get_config(); global $master_url; @@ -42,8 +42,16 @@ $master_url = parse_config($config , ""); $recaptcha_public_key = parse_config($config, ""); $recaptcha_private_key = parse_config($config, ""); -// don't allow /... at the end of URL +// the following default to on +// +$x = parse_config($config, ""); +define('USER_COUNTRY', ($x===null)?1:(int)$x); +$x = parse_config($config, ""); +define('USER_URL', ($x===null)?1:(int)$x); + +// don't allow /... at the end of URL +// if (array_key_exists("PATH_INFO", $_SERVER)) { die("bad URL"); } @@ -101,12 +109,6 @@ if (!defined('USER_HOME')) { if (!defined('POST_MAX_LINKS')) { define('POST_MAX_LINKS', 0); } -if (!defined('NO_USER_COUNTRY')) { - define('NO_USER_COUNTRY', 0); -} -if (!defined('NO_USER_URL')) { - define('NO_USER_URL', 0); -} // sleep this long on any login failure // (slow the rate of hacker attacks) diff --git a/html/inc/util_basic.inc b/html/inc/util_basic.inc index 33337ce9d7..8e51ef12fd 100644 --- a/html/inc/util_basic.inc +++ b/html/inc/util_basic.inc @@ -95,7 +95,6 @@ function get_config() { // If it's a single-tag element, and it's present, just return the tag // function parse_element($xml, $tag) { - $element = null; $closetag = "$user->country\n"; } - if (!NO_USER_URL) { + if (USER_URL) { $url = normalize_user_url($user->url); echo " ".htmlspecialchars($url)."\n"; } @@ -138,10 +138,10 @@ function show_team_member($user, $creditonly = false) { $user->expavg_time $user->has_profile "; - if (!NO_USER_COUNTRY) { + if (USER_COUNTRY) { echo " $user->country\n"; } - if (!NO_USER_URL) { + if (USER_URL) { $url = normalize_user_url($user->url); echo " ".htmlspecialchars($url)."\n"; } diff --git a/html/user/am_set_info.php b/html/user/am_set_info.php index 67613d5f32..350c895d26 100644 --- a/html/user/am_set_info.php +++ b/html/user/am_set_info.php @@ -100,7 +100,7 @@ if (!$user) { } $name = BoincDb::escape_string($name); -if (NO_USER_COUNTRY) { +if (!USER_COUNTRY) { $country = ""; } if (!is_valid_country($country)) { @@ -121,7 +121,7 @@ if (stripos($project_prefs, "") === false) { $project_prefs = str_ireplace("", "\n".$orig_project_specific, $project_prefs); } -if (NO_USER_URL) { +if (!USER_URL) { $url = ""; } $url = BoincDb::escape_string($url); diff --git a/html/user/edit_user_info_action.php b/html/user/edit_user_info_action.php index 77d5cdfec9..6494f2db24 100644 --- a/html/user/edit_user_info_action.php +++ b/html/user/edit_user_info_action.php @@ -38,12 +38,12 @@ $name = BoincDb::escape_string($name); $url = ""; $country = ""; $postal_code = ""; -if (!NO_USER_URL) { +if (USER_URL) { $url = post_str("url", true); $url = sanitize_tags($url); $url = BoincDb::escape_string($url); } -if (!NO_USER_COUNTRY) { +if (USER_COUNTRY) { $country = post_str("country"); if (!is_valid_country($country)) { error_page("bad country"); diff --git a/html/user/edit_user_info_form.php b/html/user/edit_user_info_form.php index 773c42f2e1..f19e11cb0f 100644 --- a/html/user/edit_user_info_form.php +++ b/html/user/edit_user_info_form.php @@ -35,7 +35,7 @@ form_input_text( $user->name ); -if (!NO_USER_URL) { +if (USER_URL) { form_input_text( tra("URL %1 of your personal web page; optional%2", "

", "

"), 'url', @@ -43,7 +43,7 @@ if (!NO_USER_URL) { ); } -if (!NO_USER_COUNTRY) { +if (USER_COUNTRY) { form_select( tra("Country"), 'country', diff --git a/lib/util.cpp b/lib/util.cpp index c51418a8b2..5a38f4ff3e 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -484,6 +484,7 @@ int run_program( FCGI::perror("execvp"); #else perror("execvp"); + fprintf(stderr, "couldn't exec %s: %d\n", file, errno); #endif exit(errno); } diff --git a/sched/db_dump.cpp b/sched/db_dump.cpp index d155facf6f..04f349eb69 100644 --- a/sched/db_dump.cpp +++ b/sched/db_dump.cpp @@ -582,7 +582,6 @@ void write_user(USER& user, ZFILE* f, bool /*detail*/) { "\n" " %lu\n" " %s\n" - " %s\n" " %d\n" " %f\n" " %f\n" @@ -597,7 +596,13 @@ void write_user(USER& user, ZFILE* f, bool /*detail*/) { user.expavg_time, cpid ); - if (strlen(user.url)) { + if (config.user_country && strlen(user.country)) { + f->write( + " %s\n", + user.country + ); + } + if (config.user_url && strlen(user.url)) { f->write( " %s\n", url diff --git a/sched/sched_config.cpp b/sched/sched_config.cpp index b5a72bf187..eb4ceb6a99 100644 --- a/sched/sched_config.cpp +++ b/sched/sched_config.cpp @@ -95,6 +95,8 @@ int SCHED_CONFIG::parse(FILE* f) { scheduler_log_buffer = 32768; version_select_random_factor = 1.; maintenance_delay = 3600; + user_url = true; + user_country = true; if (!xp.parse_start("boinc")) return ERR_XML_PARSE; if (!xp.parse_start("config")) return ERR_XML_PARSE; @@ -194,6 +196,8 @@ int SCHED_CONFIG::parse(FILE* f) { if (xp.parse_bool("job_size_matching", job_size_matching)) continue; if (xp.parse_bool("dont_send_jobs", dont_send_jobs)) continue; if (xp.parse_bool("estimate_flops_from_hav_pfc", estimate_flops_from_hav_pfc)) continue; + if (xp.parse_bool("user_url", user_url)) continue; + if (xp.parse_bool("user_country", user_country)) continue; //////////// STUFF RELEVANT ONLY TO SCHEDULER STARTS HERE /////// diff --git a/sched/sched_config.h b/sched/sched_config.h index f210057d56..96ec0b6489 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -101,6 +101,8 @@ struct SCHED_CONFIG { bool enable_assignment_multi; bool job_size_matching; bool dont_send_jobs; + bool user_url; // whether to export user.url in db dump + bool user_country; //////////// STUFF RELEVANT ONLY TO SCHEDULER FOLLOWS ///////////