1
|
|
|
<?php |
2
|
|
|
// This file is part of BOINC. |
3
|
|
|
// http://boinc.berkeley.edu |
4
|
|
|
// Copyright (C) 2011 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
|
|
|
// app management interface |
20
|
|
|
// - deprecate app versions |
21
|
|
|
|
22
|
|
|
require_once("../inc/submit_util.inc"); |
23
|
|
|
require_once("../inc/util.inc"); |
24
|
|
|
|
25
|
|
|
function app_version_form($app) { |
26
|
|
|
page_head("Manage versions of $app->name"); |
27
|
|
|
echo " |
28
|
|
|
<form action=manage_app.php> |
29
|
|
|
<input type=hidden name=action value=app_version_action> |
30
|
|
|
<input type=hidden name=app_id value=$app->id> |
31
|
|
|
"; |
32
|
|
|
$avs = BoincAppVersion::enum("appid=$app->id"); |
33
|
|
|
start_table('table-striped'); |
34
|
|
|
table_header("platform", "plan class", "version#", "deprecated"); |
35
|
|
|
foreach ($avs as $av) { |
36
|
|
|
$platform = BoincPlatform::lookup_id($av->platformid); |
37
|
|
|
$c = $av->deprecated?"checked":""; |
38
|
|
|
echo " |
39
|
|
|
<tr> |
40
|
|
|
<td>$platform->name</td> |
41
|
|
|
<td>$av->plan_class</td> |
42
|
|
|
<td>$av->version_num</td> |
43
|
|
|
<td><input type=checkbox name=dep_$av->id $c></td> |
44
|
|
|
</tr> |
45
|
|
|
"; |
46
|
|
|
} |
47
|
|
|
echo " |
48
|
|
|
<tr> |
49
|
|
|
<td><br></td> |
50
|
|
|
<td><br></td> |
51
|
|
|
<td><br></td> |
52
|
|
|
<td><input class=\"btn\" type=submit value=Update></td> |
53
|
|
|
</tr> |
54
|
|
|
"; |
55
|
|
|
end_table(); |
56
|
|
|
echo "<form>\n"; |
57
|
|
|
page_tail(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
function app_version_action($app) { |
61
|
|
|
$avs = BoincAppVersion::enum("appid=$app->id"); |
62
|
|
|
foreach ($avs as $av) { |
63
|
|
|
$x = get_str("dep_$av->id", true); |
64
|
|
|
if ($x) { |
65
|
|
|
if (!$av->deprecated) { |
66
|
|
|
$av->update("deprecated=1"); |
67
|
|
|
} |
68
|
|
|
} else { |
69
|
|
|
if ($av->deprecated) { |
70
|
|
|
$av->update("deprecated=0"); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
page_head("Update successful"); |
75
|
|
|
echo " |
76
|
|
|
<a href=submit.php>Return to job submission page</a> |
77
|
|
|
"; |
78
|
|
|
page_tail(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
$user = get_logged_in_user(); |
|
|
|
|
82
|
|
|
$app_id = get_int("app_id"); |
83
|
|
|
$app = BoincApp::lookup_id($app_id); |
84
|
|
|
if (!$app) error_page("no such app"); |
85
|
|
|
$bus = BoincUserSubmit::lookup_userid($user->id); |
86
|
|
|
if (!$bus) error_page("no access"); |
87
|
|
|
if (!$bus->manage_all) { |
88
|
|
|
$busa = BoincUserSubmitApp::lookup("user_id=$user->id and app_id=$app_id"); |
89
|
|
|
if (!$busa || !$busa->manage) error_page("no access"); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
$action = get_str("action", true); |
93
|
|
|
switch ($action) { |
94
|
|
|
case "app_version_form": |
95
|
|
|
app_version_form($app); break; |
96
|
|
|
case "app_version_action": |
97
|
|
|
app_version_action($app); break; |
98
|
|
|
default: |
|
|
|
|
99
|
|
|
error_page("unknown action"); |
100
|
|
|
} |
101
|
|
|
?> |
102
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.