43
43
* Get the base URL path from the SCRIPT_NAME.
44
44
*/
45
45
$ base_path = rtrim (dirname ($ _SERVER ['SCRIPT_NAME ' ]), '/ \\' );
46
-
46
+ $ base_url = htmlentities ( $ _SERVER [ ' SCRIPT_NAME ' ]);
47
47
48
48
/**
49
49
* Generate references to required stylesheets & javascript.
56
56
*
57
57
*/
58
58
function xhprof_include_js_css ($ ui_dir_url_path = null ) {
59
+ global $ base_path ;
59
60
60
61
if (empty ($ ui_dir_url_path )) {
61
- $ ui_dir_url_path = rtrim ( dirname ( $ _SERVER [ ' SCRIPT_NAME ' ]), ' / \\' ) ;
62
+ $ ui_dir_url_path = $ base_path ;
62
63
}
63
64
64
65
// style sheets
@@ -453,7 +454,7 @@ function profiler_report ($url_params,
453
454
global $ stats ;
454
455
global $ pc_stats ;
455
456
global $ diff_mode ;
456
- global $ base_path ;
457
+ global $ base_url ;
457
458
458
459
// if we are reporting on a specific function, we can trim down
459
460
// the report(s) to just stuff that is relevant to this function.
@@ -482,22 +483,22 @@ function profiler_report ($url_params,
482
483
'symbol ' ),
483
484
'all ' );
484
485
485
- $ top_link_query_string = "$ base_path / ? " . http_build_query ($ base_url_params );
486
+ $ top_link_query_string = "$ base_url ? " . http_build_query ($ base_url_params );
486
487
487
488
if ($ diff_mode ) {
488
489
$ diff_text = "Diff " ;
489
490
$ base_url_params = xhprof_array_unset ($ base_url_params , 'run1 ' );
490
491
$ base_url_params = xhprof_array_unset ($ base_url_params , 'run2 ' );
491
492
$ run1_link = xhprof_render_link ('View Run # ' . $ run1 ,
492
- "$ base_path / ? " .
493
+ "$ base_url ? " .
493
494
http_build_query (xhprof_array_set ($ base_url_params ,
494
495
'run ' ,
495
496
$ run1 )));
496
497
$ run2_txt = sprintf ("<b>Run #%s:</b> %s " ,
497
498
$ run2 , $ run2_desc );
498
499
499
500
$ run2_link = xhprof_render_link ('View Run # ' . $ run2 ,
500
- "$ base_path / ? " .
501
+ "$ base_url ? " .
501
502
http_build_query (xhprof_array_set ($ base_url_params ,
502
503
'run ' ,
503
504
$ run2 )));
@@ -519,7 +520,7 @@ function profiler_report ($url_params,
519
520
$ links [] = $ run1_link ;
520
521
$ links [] = $ run2_link ;
521
522
$ links [] = xhprof_render_link ('Invert ' . $ diff_text . ' Report ' ,
522
- "$ base_path / ? " .
523
+ "$ base_url ? " .
523
524
http_build_query ($ inverted_params ));
524
525
}
525
526
@@ -660,7 +661,7 @@ function print_function_info($url_params, $info, $sort, $run1, $run2) {
660
661
global $ metrics ;
661
662
global $ format_cbk ;
662
663
global $ display_calls ;
663
- global $ base_path ;
664
+ global $ base_url ;
664
665
665
666
// Toggle $odd_or_even
666
667
$ odd_even = 1 - $ odd_even ;
@@ -672,7 +673,7 @@ function print_function_info($url_params, $info, $sort, $run1, $run2) {
672
673
print ('<tr bgcolor="#e5e5e5"> ' );
673
674
}
674
675
675
- $ href = "$ base_path / ? " .
676
+ $ href = "$ base_url ? " .
676
677
http_build_query (xhprof_array_set ($ url_params ,
677
678
'symbol ' , $ info ["fn " ]));
678
679
@@ -717,15 +718,15 @@ function print_flat_data($url_params, $title, $flat_data, $sort, $run1, $run2, $
717
718
global $ stats ;
718
719
global $ sortable_columns ;
719
720
global $ vwbar ;
720
- global $ base_path ;
721
+ global $ base_url ;
721
722
722
723
$ size = count ($ flat_data );
723
724
if (!$ limit ) { // no limit
724
725
$ limit = $ size ;
725
726
$ display_link = "" ;
726
727
} else {
727
728
$ display_link = xhprof_render_link (" [ <b class=bubble>display all </b>] " ,
728
- "$ base_path / ? " .
729
+ "$ base_url ? " .
729
730
http_build_query (xhprof_array_set ($ url_params ,
730
731
'all ' , 1 )));
731
732
}
@@ -739,7 +740,7 @@ function print_flat_data($url_params, $title, $flat_data, $sort, $run1, $run2, $
739
740
foreach ($ stats as $ stat ) {
740
741
$ desc = stat_description ($ stat );
741
742
if (array_key_exists ($ stat , $ sortable_columns )) {
742
- $ href = "$ base_path / ? "
743
+ $ href = "$ base_url ? "
743
744
. http_build_query (xhprof_array_set ($ url_params , 'sort ' , $ stat ));
744
745
$ header = xhprof_render_link ($ desc , $ href );
745
746
} else {
@@ -791,6 +792,7 @@ function full_report($url_params, $symbol_tab, $sort, $run1, $run2) {
791
792
global $ format_cbk ;
792
793
global $ display_calls ;
793
794
global $ base_path ;
795
+ global $ base_url ;
794
796
795
797
$ possible_metrics = xhprof_get_possible_metrics ();
796
798
@@ -799,10 +801,10 @@ function full_report($url_params, $symbol_tab, $sort, $run1, $run2) {
799
801
$ base_url_params = xhprof_array_unset (xhprof_array_unset ($ url_params ,
800
802
'run1 ' ),
801
803
'run2 ' );
802
- $ href1 = "$ base_path / ? " .
804
+ $ href1 = "$ base_url ? " .
803
805
http_build_query (xhprof_array_set ($ base_url_params ,
804
806
'run ' , $ run1 ));
805
- $ href2 = "$ base_path / ? " .
807
+ $ href2 = "$ base_url ? " .
806
808
http_build_query (xhprof_array_set ($ base_url_params ,
807
809
'run ' , $ run2 ));
808
810
@@ -961,7 +963,7 @@ function pc_info($info, $base_ct, $base_info, $parent) {
961
963
962
964
function print_pc_array ($ url_params , $ results , $ base_ct , $ base_info , $ parent ,
963
965
$ run1 , $ run2 ) {
964
- global $ base_path ;
966
+ global $ base_url ;
965
967
966
968
// Construct section title
967
969
if ($ parent ) {
@@ -980,7 +982,7 @@ function print_pc_array($url_params, $results, $base_ct, $base_info, $parent,
980
982
981
983
$ odd_even = 0 ;
982
984
foreach ($ results as $ info ) {
983
- $ href = "$ base_path / ? " .
985
+ $ href = "$ base_url ? " .
984
986
http_build_query (xhprof_array_set ($ url_params ,
985
987
'symbol ' , $ info ["fn " ]));
986
988
@@ -1051,6 +1053,7 @@ function symbol_report($url_params,
1051
1053
global $ sort_col ;
1052
1054
global $ display_calls ;
1053
1055
global $ base_path ;
1056
+ global $ base_url ;
1054
1057
1055
1058
$ possible_metrics = xhprof_get_possible_metrics ();
1056
1059
@@ -1067,9 +1070,9 @@ function symbol_report($url_params,
1067
1070
$ base_url_params = xhprof_array_unset (xhprof_array_unset ($ url_params ,
1068
1071
'run1 ' ),
1069
1072
'run2 ' );
1070
- $ href1 = "$ base_path ? "
1073
+ $ href1 = "$ base_url ? "
1071
1074
. http_build_query (xhprof_array_set ($ base_url_params , 'run ' , $ run1 ));
1072
- $ href2 = "$ base_path ? "
1075
+ $ href2 = "$ base_url ? "
1073
1076
. http_build_query (xhprof_array_set ($ base_url_params , 'run ' , $ run2 ));
1074
1077
1075
1078
print ("<h3 align=center> $ regr_impr summary for $ rep_symbol<br><br></h3> " );
@@ -1157,7 +1160,7 @@ function symbol_report($url_params,
1157
1160
$ desc = stat_description ($ stat );
1158
1161
if (array_key_exists ($ stat , $ sortable_columns )) {
1159
1162
1160
- $ href = "$ base_path / ? " .
1163
+ $ href = "$ base_url ? " .
1161
1164
http_build_query (xhprof_array_set ($ url_params ,
1162
1165
'sort ' , $ stat ));
1163
1166
$ header = xhprof_render_link ($ desc , $ href );
0 commit comments