Index: screen.inc =================================================================== --- screen.inc (revision 939) +++ screen.inc (working copy) @@ -16,8 +16,11 @@ # # +include_once("$topdir/google-analytics.inc"); + # Print user dash-board function dump_query_screen($nogo, $sql_cmd) { + global $mtt_body_html_prefix; $phases = process_phase_field($_GET); $defaults = setup_mainwin_fields($phases); @@ -70,7 +73,7 @@ print "" . html_head("Open MPI Test Reporter") . "\n" . - "\n" . + "\n" . $mtt_body_html_prefix . print_ga() . "\n
" . "\n$prefs" . "\n
" . @@ -1205,6 +1208,8 @@ # Load up some CSS and Javascript function html_head($title) { + global $mtt_head_html; + global $mtt_body_html_suffix; $javascript = <<' + script + '' + title + ''); - tmp.write('' + content + ''); + tmp.write('
' + content + '
$mtt_body_html_suffix'); tmp.close(); } @@ -1284,15 +1289,13 @@ EOT; # Return html head - return "\n" . + return "\n" . "\n$title" . "\n" . "\n" . + "\n" . $mtt_head_html . "\n"; } - -?> Index: reporter.php =================================================================== --- reporter.php (revision 939) +++ reporter.php (working copy) @@ -10,6 +10,11 @@ # $HEADER$ # +$topdir = "."; +if (file_exists("$topdir/config.inc")) { + include_once("$topdir/config.inc"); +} + # # # Web-based Open MPI Tests Querying Tool @@ -30,9 +35,6 @@ include_once("$topdir/report.inc"); include_once("$topdir/database.inc"); -# Deny mirrors access to MTT results -deny_mirror(); - # 'debug' is an aggregate trace if (isset($_GET['debug'])) { $_GET['verbose'] = 'on'; @@ -77,7 +79,7 @@ debug_cgi($_COOKIE, "COOKIE " . __LINE__); print hidden_carryover($_GET) . - "\n
"; + "\n
$mtt_body_html_suffix"; exit; Index: stats/index.php =================================================================== --- stats/index.php (revision 939) +++ stats/index.php (working copy) @@ -11,11 +11,16 @@ # $topdir = '..'; -$ompi_home = '/l/osl/www/doc/www.open-mpi.org'; -include_once("$ompi_home/dbpassword.inc"); +if (file_exists("$topdir/config.inc")) { + include_once("$topdir/config.inc"); +} +include_once("$topdir/google-analytics.inc"); include_once("$topdir/reporter.inc"); -$dbname = isset($_GET['db']) ? $_GET['db'] : "mtt"; +if (array_key_exists("db", $_GET) && + preg_match("/mtt/i", $_GET['db'])) { + $mtt_database_name = $_GET['db']; +} $pgsql_conn; $start_collection_date = "DATE '2007-05-01'"; @@ -35,9 +40,9 @@ print("" . "\n" . - "\nOpen MPI Test Statistics" . + "\nOpen MPI Test Statistics" . $head_html . "\n". - "\n". + "\n". $body_html_prefix . print_ga() . "\n"); process_stat_dates(); @@ -52,7 +57,7 @@ # All done pg_close(); -print("\n
". +print("\n
". $body_html_suffix . "\n". "\n"); @@ -704,15 +709,15 @@ function do_pg_connect() { - global $dbname; - global $user; - global $pass; + global $mtt_database_name; + global $mtt_database_username; + global $mtt_database_password; global $pgsql_conn; static $connected = false; if (!$connected) { $pgsql_conn = - pg_connect("host=localhost port=5432 dbname=$dbname user=$user password=$pass"); + pg_connect("host=localhost port=5432 dbname=$mtt_database_name user=$mtt_database_username password=$mtt_database_password"); # Exit if we cannot connect if (!$pgsql_conn) Index: submit/index.php =================================================================== --- submit/index.php (revision 939) +++ submit/index.php (working copy) @@ -11,6 +11,14 @@ # # +$topdir = ".."; +if (file_exists("$topdir/config.inc")) { + include_once("$topdir/config.inc"); +} + +# Note that Google Analytics is not performed here because the MTT +# client doesn't understand javascript to report back to GA. + # A large test run submission could overload the PHP 16MB limit # (The following line increases the limit for this script only) ini_set("memory_limit", "32M"); Index: google-analytics.inc =================================================================== --- google-analytics.inc (revision 0) +++ google-analytics.inc (revision 0) @@ -0,0 +1,21 @@ + + + +"; +} Index: reporter.inc =================================================================== --- reporter.inc (revision 939) +++ reporter.inc (working copy) @@ -898,26 +898,4 @@ return $_GET; } -# Deny mirrors access to MTT results -function deny_mirror() { - - $mother_site = "www.open-mpi.org"; - $server_dir = "/"; - - # Are we the "mother site" or a mirror? - if ($_SERVER["SERVER_NAME"] == $mother_site) - $is_mirror = false; - else - $is_mirror = true; - - if ($is_mirror) { - $equiv_dir = ereg_replace("^$server_dir", '', $_SERVER["REQUEST_URI"]); - print "Sorry, this page is not mirrored. " . - "Please see the " . - "original version of this page " . - "on the main Open MPI web site.\n"; - exit(); - } -} - ?> Index: curl_get.inc =================================================================== --- curl_get.inc (revision 939) +++ curl_get.inc (working copy) @@ -1,10 +1,10 @@ " . + "original version of this page " . + "on the main Open MPI web site.\n"; + exit(); +} + +########################################################################### + +# If you are tracking MTT usaging through Google Analytics, fill in +# your account number here. +$mtt_google_analytics_account = ""; + +# If you want some data output during the ... , put it +# in this variable. +$mtt_head_html = " + \n"; + +# If you want some data output at the beginning of the , put it +# in this variable. +$mtt_body_html_prefix = ""; + +# If you want some data output at the end of the , put it +# in this variable. +$mtt_body_html_suffix = ""; + +# Database name +$mtt_database_name = "mtt"; + +# Database username +$mtt_database_username = "mtt"; + +# Database password +$mtt_database_password = rtrim(file_get_contents("/l/osl/www/doc/www.open-mpi.org/mtt-db-password.txt")); + +# HTTP username +$mtt_http_username = "sun"; + +# HTTP password +$mtt_http_password = rtrim(file_get_contents("/l/osl/www/doc/www.open-mpi.org/mtt-http-password.txt"));