1 | <?php |
||||||
2 | // This file is part of BOINC. |
||||||
3 | // http://boinc.berkeley.edu |
||||||
4 | // Copyright (C) 2008 University of California |
||||||
5 | // |
||||||
6 | // BOINC is free software; you can redistribute it and/or modify it |
||||||
7 | // under the terms of the GNU Lesser General Public License |
||||||
8 | // as published by the Free Software Foundation, |
||||||
9 | // either version 3 of the License, or (at your option) any later version. |
||||||
10 | // |
||||||
11 | // BOINC is distributed in the hope that it will be useful, |
||||||
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||||
14 | // See the GNU Lesser General Public License for more details. |
||||||
15 | // |
||||||
16 | // You should have received a copy of the GNU Lesser General Public License |
||||||
17 | // along with BOINC. If not, see <http://www.gnu.org/licenses/>. |
||||||
18 | |||||||
19 | require_once("../inc/util_ops.inc"); |
||||||
20 | |||||||
21 | function draw_graph($xarr, $arr) { |
||||||
22 | require_once ("jpgraph/jpgraph.php"); |
||||||
23 | require_once ("jpgraph/jpgraph_line.php"); |
||||||
24 | require_once ("jpgraph/jpgraph_bar.php"); |
||||||
25 | require_once ("jpgraph/jpgraph_log.php"); |
||||||
26 | |||||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||||
27 | |||||||
28 | // Create the graph. These two calls are always required |
||||||
29 | $graph = new Graph(350,250,"auto"); |
||||||
0 ignored issues
–
show
The type
Graph was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
30 | //$graph->SetScale("lin"); |
||||||
31 | //$graph->SetScale("textlin"); |
||||||
32 | $graph->SetScale("loglin"); |
||||||
33 | |||||||
34 | // Create the linear plot |
||||||
35 | $lineplot=new BarPlot($arr, $xarr); |
||||||
0 ignored issues
–
show
The type
BarPlot was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
36 | $lineplot->SetColor("blue"); |
||||||
37 | |||||||
38 | // Add the plot to the graph |
||||||
39 | $graph->Add($lineplot); |
||||||
40 | |||||||
41 | // Display the graph |
||||||
42 | $graph->Stroke(); |
||||||
43 | } |
||||||
44 | |||||||
45 | function show_text($xarr, $yarr) { |
||||||
46 | $n = sizeof($xarr); |
||||||
47 | for ($i=0; $i<$n; $i++) { |
||||||
48 | echo "<br>$xarr[$i] $yarr[$i]\n"; |
||||||
49 | } |
||||||
50 | } |
||||||
51 | |||||||
52 | function show_graph() { |
||||||
53 | db_init(); |
||||||
54 | |||||||
55 | $xaxis = $_GET['xaxis']; |
||||||
56 | $yaxis = $_GET['yaxis']; |
||||||
57 | $granularity = $_GET['granularity']; |
||||||
58 | $active = $_GET['active']; |
||||||
59 | $inactive = $_GET['inactive']; |
||||||
60 | $show_text = $_GET['show_text']; |
||||||
61 | |||||||
62 | if (!$active && !$inactive) { |
||||||
63 | echo "You must select at least one of (active, inactive)"; |
||||||
64 | exit(); |
||||||
0 ignored issues
–
show
|
|||||||
65 | } |
||||||
66 | |||||||
67 | $fields = 'host.id, user.create_time'; |
||||||
68 | if ($xaxis == 'active' || !$active || !$inactive) { |
||||||
69 | $query = "select $fields, max(rpc_time) as max_rpc_time from host, user where host.userid=user.id group by userid"; |
||||||
70 | } else { |
||||||
71 | $query = 'select $fields from user'; |
||||||
72 | } |
||||||
73 | $result = _mysql_query($query); |
||||||
74 | $yarr = array(); |
||||||
75 | $now = time(); |
||||||
76 | $maxind = 0; |
||||||
77 | $active_thresh = time() - 30*86400; |
||||||
78 | while ($user = _mysql_fetch_object($result)) { |
||||||
79 | $val = $now - $user->max_rpc_time; |
||||||
80 | if (!$active) { |
||||||
81 | if ($user->max_rpc_time > $active_thresh) continue; |
||||||
82 | } |
||||||
83 | if (!$inactive) { |
||||||
84 | if ($user->max_rpc_time < $active_thresh) continue; |
||||||
85 | } |
||||||
86 | $life = $user->max_rpc_time - $user->create_time; |
||||||
87 | $ind = $life/$granularity; |
||||||
88 | $ind = (int)$ind; |
||||||
89 | $yarr[$ind]++; |
||||||
90 | if ($ind > $maxind) $maxind = $ind; |
||||||
91 | } |
||||||
92 | $xarr = array(); |
||||||
93 | for ($i=0; $i<=$maxind; $i++) { |
||||||
94 | $xarr[$i] = $i; |
||||||
95 | if (is_null($yarr[$i])) $yarr[$i]=0; |
||||||
96 | } |
||||||
97 | if ($show_text) { |
||||||
98 | show_text($xarr, $yarr); |
||||||
99 | } else { |
||||||
100 | draw_graph($xarr, $yarr); |
||||||
101 | } |
||||||
102 | } |
||||||
103 | |||||||
104 | function show_form() { |
||||||
105 | echo " |
||||||
106 | <form action=user_graph.php> |
||||||
107 | X axis: |
||||||
108 | <select name=xaxis> |
||||||
109 | <option value=active>Active time |
||||||
110 | </select> |
||||||
111 | |||||||
112 | <p> |
||||||
113 | Y axis: |
||||||
114 | <select name=yaxis> |
||||||
115 | <option value='count'>Count |
||||||
116 | <option value='rac'>RAC |
||||||
117 | <option value='tc'>Total credit |
||||||
118 | </select> |
||||||
119 | |||||||
120 | <p> |
||||||
121 | Show active users? |
||||||
122 | <input type=checkbox name=active> |
||||||
123 | |||||||
124 | <p> |
||||||
125 | Show inactive users? |
||||||
126 | <input type=checkbox name=inactive> |
||||||
127 | |||||||
128 | <p> |
||||||
129 | Granularity: |
||||||
130 | <input name=granularity value=86400> |
||||||
131 | |||||||
132 | <p> |
||||||
133 | Show as text? |
||||||
134 | <input type=checkbox name=show_text> |
||||||
135 | |||||||
136 | <p> |
||||||
137 | <input class=\"btn btn-default\" type=submit name=submit value=OK> |
||||||
138 | </form> |
||||||
139 | "; |
||||||
140 | } |
||||||
141 | |||||||
142 | if ($_GET['submit']) { |
||||||
143 | show_graph(); |
||||||
144 | } else { |
||||||
145 | show_form(); |
||||||
0 ignored issues
–
show
The call to
show_form() has too few arguments starting with appid .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
146 | } |
||||||
147 | |||||||
148 | ?> |
||||||
149 |