forked from Kitware/CDash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewConfigure.php
122 lines (101 loc) · 3.66 KB
/
viewConfigure.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/*=========================================================================
Program: CDash - Cross-Platform Dashboard System
Module: $Id$
Language: PHP
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Kitware, Inc. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
$noforcelogin = 1;
include("cdash/config.php");
require_once("cdash/pdo.php");
include('login.php');
include_once("cdash/common.php");
include("cdash/version.php");
@$buildid = $_GET["buildid"];
if ($buildid != NULL)
{
$buildid = pdo_real_escape_numeric($buildid);
}
@$date = $_GET["date"];
if ($date != NULL)
{
$date = htmlspecialchars(pdo_real_escape_string($date));
}
// Checks
if(!isset($buildid) || !is_numeric($buildid))
{
echo "Not a valid buildid!";
return;
}
$db = pdo_connect("$CDASH_DB_HOST", "$CDASH_DB_LOGIN","$CDASH_DB_PASS");
pdo_select_db("$CDASH_DB_NAME",$db);
$build_array = pdo_fetch_array(pdo_query("SELECT * FROM build WHERE id='$buildid'"));
$projectid = $build_array["projectid"];
if(!isset($projectid) || $projectid==0)
{
echo "This build doesn't exist. Maybe it has been deleted.";
exit();
}
checkUserPolicy(@$_SESSION['cdash']['loginid'],$projectid);
$project = pdo_query("SELECT * FROM project WHERE id='$projectid'");
if(pdo_num_rows($project)>0)
{
$project_array = pdo_fetch_array($project);
$projectname = $project_array["name"];
}
$xml = begin_XML_for_XSLT();
$xml .= "<title>CDash : ".$projectname."</title>";
$date = get_dashboard_date_from_build_starttime($build_array["starttime"],$project_array["nightlytime"]);
$xml .= get_cdash_dashboard_xml_by_name($projectname,$date);
$siteid = $build_array["siteid"];
$buildtype = $build_array["type"];
$buildname = $build_array["name"];
$starttime = $build_array["starttime"];
// Menu
$xml .= "<menu>";
$xml .= add_XML_value("back","index.php?project=".urlencode($projectname)."&date=".$date);
$previousbuildid = get_previous_buildid($projectid,$siteid,$buildtype,$buildname,$starttime);
if($previousbuildid>0)
{
$xml .= add_XML_value("previous","viewConfigure.php?buildid=".$previousbuildid);
}
else
{
$xml .= add_XML_value("noprevious","1");
}
$xml .= add_XML_value("current","viewConfigure.php?buildid=".get_last_buildid($projectid,$siteid,$buildtype,$buildname,$starttime));
$nextbuildid = get_next_buildid($projectid,$siteid,$buildtype,$buildname,$starttime);
if($nextbuildid>0)
{
$xml .= add_XML_value("next","viewConfigure.php?buildid=".$nextbuildid);
}
else
{
$xml .= add_XML_value("nonext","1");
}
$xml .= "</menu>";
// Build
$xml .= "<build>";
$site_array = pdo_fetch_array(pdo_query("SELECT name FROM site WHERE id='$siteid'"));
$xml .= add_XML_value("site",$site_array["name"]);
$xml .= add_XML_value("siteid",$siteid);
$xml .= add_XML_value("buildname",$build_array["name"]);
$xml .= add_XML_value("buildid",$build_array["id"]);
$xml .= "</build>";
$xml .= "<configure>";
$configure = pdo_query("SELECT * FROM configure WHERE buildid='$buildid'");
$configure_array = pdo_fetch_array($configure);
$xml .= add_XML_value("status",$configure_array["status"]);
$xml .= add_XML_value("command",$configure_array["command"]);
$xml .= add_XML_value("output",$configure_array["log"]);
$xml .= "</configure>";
$xml .= "</cdash>";
// Now doing the xslt transition
generate_XSLT($xml,"viewConfigure");
?>