1<html> 2<?php 3/*========================================================================= 4 5 Program: CDash - Cross-Platform Dashboard System 6 Module: $Id$ 7 Language: PHP 8 Date: $Date$ 9 Version: $Revision$ 10 11 Copyright (c) 2002 Kitware, Inc. All rights reserved. 12 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. 13 14 This software is distributed WITHOUT ANY WARRANTY; without even 15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 16 PURPOSE. See the above copyright notices for more information. 17 18=========================================================================*/ 19 20// To be able to access files in this CDash installation regardless 21// of getcwd() value: 22// 23$cdashpath = str_replace('\\', '/', dirname(dirname(__FILE__))); 24set_include_path($cdashpath . PATH_SEPARATOR . get_include_path()); 25 26require_once("cdash/config.php"); 27require_once("cdash/pdo.php"); 28require_once("cdash/common.php"); 29 30$db = pdo_connect("$CDASH_DB_HOST", "$CDASH_DB_LOGIN","$CDASH_DB_PASS"); 31pdo_select_db("$CDASH_DB_NAME",$db); 32 33$siteid = pdo_real_escape_numeric($_GET["siteid"]); 34$buildname = htmlspecialchars(pdo_real_escape_string($_GET["buildname"])); 35$projectid = pdo_real_escape_numeric($_GET["projectid"]); 36$buildtype = htmlspecialchars(pdo_real_escape_string($_GET["buildtype"])); 37$currenttime = htmlspecialchars(pdo_real_escape_string($_GET["currenttime"])); 38 39// Checks 40if(!isset($siteid) || !is_numeric($siteid)) 41 { 42 echo "Not a valid siteid!"; 43 return; 44 } 45if(!isset($projectid) || !is_numeric($projectid)) 46 { 47 echo "Not a valid projectid!"; 48 return; 49 } 50 51$project = pdo_query("SELECT name FROM project WHERE id='$projectid'"); 52$project_array = pdo_fetch_array($project); 53 54$currentUTCtime = gmdate(FMT_DATETIME,$currenttime); 55 56// Find the last build corresponding to thie siteid and buildid 57$lastbuild = pdo_query("SELECT starttime FROM build 58 WHERE siteid='$siteid' AND type='$buildtype' AND name='$buildname' 59 AND projectid='$projectid' AND starttime<='$currentUTCtime' ORDER BY starttime DESC LIMIT 1"); 60 61if(pdo_num_rows($lastbuild)>0) 62 { 63 $lastbuild_array = pdo_fetch_array($lastbuild); 64 $datelastbuild = $lastbuild_array["starttime"]; 65 $lastsbuilddays = round(($currenttime-strtotime($datelastbuild))/(3600*24)); 66 } 67else 68 { 69 $lastsbuilddays = -1; 70 } 71?> 72 <table width="100%" border="0"> 73 <tr> 74 <td bgcolor="#DDDDDD" id="nob"><font size="2"> 75 <?php 76 if($lastsbuilddays == -1) 77 { 78 echo "This build has never submitted."; 79 } 80 else if($lastsbuilddays>=0) 81 { 82 $date = date2year($datelastbuild).date2month($datelastbuild).date2day($datelastbuild); 83 echo "This build has not been submitting since <b><a href=\"index.php?project=".urlencode($project_array["name"])."&date=".$date."\">".date('M j, Y ',strtotime($datelastbuild))."</a> (".$lastsbuilddays." days)</b>"; 84 } 85 ?> 86 </font></td> 87 </tr> 88</table> 89</html> 90 91