INFRA 2127 - Links to individual machines on Eclipse Infras Status page
return a 404
Signed-off-by: Christopher Guindon <chris.guindon@eclipse.org>
diff --git a/committers/loadstats/dailyloadstats.php b/committers/loadstats/dailyloadstats.php
index c8e013f..2951f49 100755
--- a/committers/loadstats/dailyloadstats.php
+++ b/committers/loadstats/dailyloadstats.php
@@ -1,9 +1,8 @@
<?php
-
+
require_once($_SERVER['DOCUMENT_ROOT'] ."/eclipse.org-common/system/app.class.php");
- require_once("/home/data/httpd/eclipse-php-classes/people/ldapperson.class.php");
require_once("/home/data/httpd/eclipse-php-classes/menu/menu.class.php");
-
+
#*****************************************************************************
#
# loadstats.php
@@ -13,7 +12,7 @@
#
# Description: show the load stats for the last 24 hours on the servers.
#
- #
+ #
#
#
# HISTORY:
@@ -25,22 +24,26 @@
define('BASEPATH','/home/data/common/monitor/loadstats/');
$App = new App();
- $App->runStdWebAppCacheable();
-
+ $App->preventCaching();
+
//connect to ldap
- $LDAPPerson = new LDAPPerson();
- $LDAPPerson = $LDAPPerson->redirectIfNotLoggedIn();
-
+ $Session = $this->App->useSession('required');
+ $Friend = $this->Session->getFriend();
+ if (!$Friend->getIsCommitter()){
+ header("HTTP/1.1 403 Forbidden");
+ exit;
+ }
+
include "../html/header.php";
$Menu = new Menu("en");
- include("../modules/menu.php");
+ include("../modules/menu.php");
//var_dump(gd_info());
-
+
//current date info
$today=date('d');
$month = date ('n');
$year = date('Y');
-
+
//now the main processing loop.
//get all of the directory entries
foreach( glob(BASEPATH . "*") as $server ){
@@ -52,5 +55,5 @@
}
}
include "../html/footer.php";
-
+
?>
diff --git a/committers/loadstats/showmonthstats.php b/committers/loadstats/showmonthstats.php
index 6e12841..b13e5d3 100755
--- a/committers/loadstats/showmonthstats.php
+++ b/committers/loadstats/showmonthstats.php
@@ -1,9 +1,8 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'] ."/eclipse.org-common/system/app.class.php");
- require_once("/home/data/httpd/eclipse-php-classes/people/ldapperson.class.php");
require_once("/home/data/httpd/eclipse-php-classes/menu/menu.class.php");
-
+
#*****************************************************************************
#
# loadstats.php
@@ -13,7 +12,7 @@
#
# Description: show the load stats for the last month on the given server.
#
- #
+ #
#
#
# HISTORY:
@@ -25,19 +24,22 @@
//define('BASEPATH','/tmp/')
$App = new App();
- $App->runStdWebAppCacheable();
-
- //connect to ldap
- $LDAPPerson = new LDAPPerson();
- $LDAPPerson = $LDAPPerson->redirectIfNotLoggedIn();
-
+ $App->preventCaching();
+
+ $Session = $this->App->useSession('required');
+ $Friend = $this->Session->getFriend();
+ if (!$Friend->getIsCommitter()){
+ header("HTTP/1.1 403 Forbidden");
+ exit;
+ }
+
include "../html/header.php";
//do menu stuff
$Menu = new Menu("en");
$Menu->addMenuItem("Main stats page", "dailyloadstats.php", "_self");
include("../modules/menu.php");
-
- //build a calendar
+
+ //build a calendar
//get the passed values, if they haven't been passed, then use the current values
//start with the month
if( isset($_REQUEST['day']) && $_REQUEST['day'] != '' && is_numeric($_REQUEST['day']) && $_REQUEST['day'] >= 0 && $_REQUEST['day'] <= 31 ){
@@ -60,7 +62,7 @@
}else{ //if whatever the passed failed the above get the current year so that we can open the files.
$year = date ('Y');
}
-
+
//pre set the previous and next month and make sure they wrap around.
$prevyear = $nextyear = $year;
$prevmonth = $month-1;
@@ -77,25 +79,25 @@
$month_name = date( 'M', mktime( 0,0,0,$month,1,$year));
//get the servername
$server= $_REQUEST['server'];
-
+
//use showmonth to adjust the image
if( isset($_REQUEST['showmonth']) && is_numeric($_REQUEST['showmonth']) && $_REQUEST['showmonth'] >= 1 ){
$html = "<img src='drawmonthstats.php?server=$server&month=$month&year=$year'></br></br></br>";
} else {
$html = "<img src='drawstats.php?server=$server&year=$year&month=$month&day=$today'></br></br></br>";
}
-
-
+
+
//now build the calendar(borrowed from a tutorial at zend.net)
- $daysOfWeek = array('Su','Mo','Tu','We','Th','Fr','Sa');
+ $daysOfWeek = array('Su','Mo','Tu','We','Th','Fr','Sa');
$firstday = mktime(0,0,0,$month,1,$year);
$numberofdays = date('t',$firstday);
$dateComponents = getdate($firstday);
$dayOfWeek = $dateComponents['wday'];
//$calendar = "<table align=center><caption> $month_name, $year</caption><tr>\n\r";
- $calendar = "<table align=center><td><a href=\"showmonthstats.php?server=$server&year=$prevyear&month=$prevmonth&showmonth=1\">Prev</href></td><td colspan=5 align=center><a href=\"showmonthstats.php?server=$server&month=$month&showmonth=1\">$month_name, $year</a></td><td><a href=\"showmonthstats.php?server=$server&year=$nextyear&month=$nextmonth&showmonth=1\">Next</href></td><tr>\n\r";
-
- foreach($daysOfWeek as $day) {
+ $calendar = "<table align=center><td><a href=\"showmonthstats.php?server=$server&year=$prevyear&month=$prevmonth&showmonth=1\">Prev</href></td><td colspan=5 align=center><a href=\"showmonthstats.php?server=$server&month=$month&showmonth=1\">$month_name, $year</a></td><td><a href=\"showmonthstats.php?server=$server&year=$nextyear&month=$nextmonth&showmonth=1\">Next</href></td><tr>\n\r";
+
+ foreach($daysOfWeek as $day) {
$calendar .= "<th>$day</th>\n\r";
}
$currentDay = 1;
@@ -116,22 +118,22 @@
}
$currentDay++;
$dayOfWeek++;
- }
+ }
if ($dayOfWeek != 7) {
$remainingDays = 7 - $dayOfWeek;
$calendar .= "<td colspan='$remainingDays'> </td>\n\r";
}
$calendar .= "<tr><td colspan=7><a href=\"showyearlystats.php?server=$server\">Yearly Summaries</a></td></tr>\n\r";
$calendar .= "</table>\n\r";
-
+
echo $html;
-
+
echo $calendar;
-
+
$html = "</br></br><img src='drawyearstats.php?server=$server&year=$year'></br></br></br>";
-
+
echo $html;
-
+
include "../html/footer.php";
-
+
?>
diff --git a/committers/loadstats/showyearlystats.php b/committers/loadstats/showyearlystats.php
index fffea66..fa55248 100755
--- a/committers/loadstats/showyearlystats.php
+++ b/committers/loadstats/showyearlystats.php
@@ -1,9 +1,8 @@
<?php
require_once($_SERVER['DOCUMENT_ROOT'] ."/eclipse.org-common/system/app.class.php");
- require_once("/home/data/httpd/eclipse-php-classes/people/ldapperson.class.php");
require_once("/home/data/httpd/eclipse-php-classes/menu/menu.class.php");
-
+
#*****************************************************************************
#
# showyearlystats.php
@@ -13,7 +12,7 @@
#
# Description: show the load stats for the all available years on the given server.
#
- #
+ #
#
#
# HISTORY:
@@ -24,26 +23,26 @@
define('DEBUG',0);
//define('BASEPATH','/tmp/')
- $App = new App();
- $App->runStdWebAppCacheable();
-
- //connect to ldap
- $LDAPPerson = new LDAPPerson();
- $LDAPPerson = $LDAPPerson->redirectIfNotLoggedIn();
-
+ $Session = $this->App->useSession('required');
+ $Friend = $this->Session->getFriend();
+ if (!$Friend->getIsCommitter()){
+ header("HTTP/1.1 403 Forbidden");
+ exit;
+ }
+
include "../html/header.php";
//do menu stuff
$Menu = new Menu("en");
$Menu->addMenuItem("Main stats page", "dailyloadstats.php", "_self");
include("../modules/menu.php");
-
+
//get the servername
$server= $_REQUEST['server'];
//get directory data
$contents = scandir($server);
-
+
$html = "<h2>Yearly Summaries</h2>";
-
+
foreach( $contents as $entry) {
//is it a directory?
if ( $entry != "." && $entry != ".." ){
@@ -54,9 +53,9 @@
}
}
}
-
+
echo $html;
-
+
include "../html/footer.php";
-
+
?>