@@ -29,26 +29,22 @@ require_once("../inc/translation.inc");
2929require_once ("../inc/profile.inc " );
3030require_once ("../inc/bootstrap.inc " );
3131
32- // parse config.xml (do it here for efficiency)
33- //
34- global $ config ;
35- $ config = get_config ();
36-
37- global $ master_url ;
38- $ master_url = parse_config ($ config , "<master_url> " );
39-
40- // the above 'globals' are solely for Drupal; see
41- // https://stackoverflow.com/questions/29216392/scope-of-a-global-variable-in-drupal-module
42-
43- $ recaptcha_public_key = parse_config ($ config , "<recaptcha_public_key> " );
44- $ recaptcha_private_key = parse_config ($ config , "<recaptcha_private_key> " );
32+ function master_url () {
33+ return parse_config (get_config () , "<master_url> " );
34+ }
35+ function recaptcha_public_key () {
36+ return parse_config (get_config (), "<recaptcha_public_key> " );
37+ }
38+ function recaptcha_private_key () {
39+ return parse_config (get_config (), "<recaptcha_private_key> " );
40+ }
4541
4642// Set parameters to defaults if not defined in config.xml
4743
48- $ x = parse_config ($ config , "<user_country> " );
44+ $ x = parse_config (get_config () , "<user_country> " );
4945define ('USER_COUNTRY ' , ($ x ===null )?1 :(int )$ x );
5046
51- $ x = parse_config ($ config , "<user_url> " );
47+ $ x = parse_config (get_config () , "<user_url> " );
5248define ('USER_URL ' , ($ x ===null )?1 :(int )$ x );
5349
5450// Set parameters to defaults if not defined in project.inc
@@ -163,11 +159,9 @@ function url_base() {
163159}
164160
165161function send_cookie ($ name , $ value , $ permanent , $ ops =false ) {
166- global $ master_url ;
167-
168162 // the following allows independent login for projects on the same server
169163 //
170- $ url = parse_url ($ master_url );
164+ $ url = parse_url (master_url () );
171165 $ path = $ url ['path ' ];
172166 if ($ ops ) {
173167 $ path = substr ($ path , 0 , -1 );
@@ -182,8 +176,7 @@ function send_cookie($name, $value, $permanent, $ops=false) {
182176}
183177
184178function clear_cookie ($ name , $ ops =false ) {
185- global $ master_url ;
186- $ url = parse_url ($ master_url );
179+ $ url = parse_url (master_url ());
187180 $ path = $ url ['path ' ];
188181 if ($ ops ) {
189182 $ path = substr ($ path , 0 , -1 );
0 commit comments