-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlnl.php
152 lines (127 loc) · 4.62 KB
/
lnl.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/**
* TestLink Open Source Project - http://testlink.sourceforge.net/
* This script is distributed under the GNU General Public License 2 or later.
*
* Direct links for external access to reports
*
*
* How this feature works:
*
* @package TestLink
* @author franciscom
* @copyright 2012, TestLink community
* @link http://www.teamst.org/index.php
* @since 1.9.5
*
* @internal revisions
*
*/
// some session and settings stuff from original index.php
require_once('config.inc.php');
require_once('./cfg/reports.cfg.php');
require_once('common.php');
$args = init_args($db);
$user = tlUser::getByAPIKey($db,$args->apikey);
$userCount = count($user);
switch($userCount)
{
case 0:
// can not find user
break;
case 1:
$reportCfg = config_get('reports_list');
$what2launch = null;
$cfg = isset($reportCfg[$args->type]) ? $reportCfg[$args->type] : null;
//new dBug($args);
//die();
switch($args->type)
{
case 'metricsdashboard':
$param = "&tproject_id={$args->tproject_id}";
$what2launch = "lib/results/metricsDashboard.php?apikey=$args->apikey{$param}";
break;
case 'test_report':
$param = "&type={$args->type}&level=testproject" .
"&tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}" .
"&header=y&summary=y&toc=y&body=y&passfail=y&cfields=y&metrics=y&author=y" .
"&requirement=y&keyword=y¬es=y&headerNumbering=y&format=0";
$what2launch = "lib/results/printDocument.php?apikey=$args->apikey{$param}";
break;
case 'test_plan':
$param = "&type={$args->type}&level=testproject" .
"&tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}" .
"&header=y&summary=y&toc=y&body=y&passfail=y&cfields=y&metrics=y&author=y" .
"&requirement=y&keyword=y¬es=y&headerNumbering=y&format=0";
$what2launch = "lib/results/printDocument.php?apikey=$args->apikey{$param}";
break;
case 'testspec':
$param = "&type={$args->type}&level=testproject&id={$args->tproject_id}" .
"&tproject_id={$args->tproject_id}" .
"&header=y&summary=y&toc=y&body=y&cfields=y&author=y".
"&requirement=y&keyword=y&headerNumbering=y&format=0";
$what2launch = $cfg['url'] . "?apikey=$args->apikey{$param}";
break;
case 'metrics_tp_general':
$param = "&tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}" .
"&format=0";
$what2launch = $cfg['url'] . "?apikey=$args->apikey{$param}";
break;
case 'list_tc_failed':
case 'list_tc_blocked':
case 'list_tc_norun':
$param = "&tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}&format=0";
$what2launch = $cfg['url'] ."&apikey=$args->apikey{$param}";
break;
case 'results_matrix';
$param = "&tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}";
$what2launch = $cfg['url'] ."?apikey=$args->apikey{$param}";
break;
case 'results_by_tester_per_build';
$param = "&tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}&format=0";
$what2launch = $cfg['url'] ."?apikey=$args->apikey{$param}";
break;
case 'charts_basic':
$param = "&tproject_id={$args->tproject_id}&tplan_id={$args->tplan_id}&format=0";
$what2launch = $cfg['url'] ."?apikey=$args->apikey{$param}";
break;
default:
echo 'ABORTING - UNKNOWN TYPE:' . $args->type;
die();
break;
}
if(!is_null($what2launch))
{
// file_put_contents('/tmp/lnl.txt',TL_BASE_HREF . $what2launch);
redirect(TL_BASE_HREF . $what2launch);
exit();
}
break;
default:
// too many users
break;
}
function init_args(&$dbHandler)
{
$_REQUEST = strings_stripSlashes($_REQUEST);
$args = new stdClass();
try
{
// ATTENTION - give a look to $tlCfg->reports_list
$typeSize = 30;
$iParams = array("apikey" => array(tlInputParameter::STRING_N,32,32),
"tproject_id" => array(tlInputParameter::INT_N),
"tplan_id" => array(tlInputParameter::INT_N),
"level" => array(tlInputParameter::STRING_N,0,16),
"type" => array(tlInputParameter::STRING_N,0,$typeSize));
}
catch (Exception $e)
{
echo $e->getMessage();
exit();
}
R_PARAMS($iParams,$args);
setUpEnvForRemoteAccess($dbHandler,$args->apikey,null,array('setPaths' => true,'clearSession' => true));
return $args;
}
?>