Issues (1963)

html/ops/block_host.php (2 issues)

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
// limit a given host to 1 job per day
20
21
// TODO: document; use new DB interface
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
22
23
include_once( "../inc/db.inc" );
24
include_once( "../inc/util.inc" );
25
include_once( "../inc/db_ops.inc" );
26
include_once( "../inc/util_ops.inc" );
27
include_once( "../inc/prefs.inc" );
28
29
db_init();
30
31
if (get_int('hostid')) {
32
    $hostid = get_int( 'hostid' );
33
} else {
34
    error_page("no hostid");
35
}
36
37
$timestr = time_str(time(0));
0 ignored issues
show
The call to time() has too many arguments starting with 0. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
$timestr = time_str(/** @scrutinizer ignore-call */ time(0));

This check compares calls to functions or methods with their respective definitions. If the call has more 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.

Loading history...
38
$title = "host ".$hostid." max_results_day set to 1 at ".$timestr;
39
40
admin_page_head($title);
41
42
if($hostid > 0) {
43
    $result = _mysql_query("UPDATE host SET max_results_day=1 WHERE id=".$hostid);
44
}
45
46
echo $title;
47
48
admin_page_tail();
49
50
?>
51