3 * FusionForge license functions
5 * Copyright 2004, GForge, LLC
6 * Copyright 2009, Roland Mas
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 function license_getname($id) {
26 if (!isset($license_arr[$id])) {
27 $res = db_query_params ('SELECT * FROM licenses WHERE license_id=$1',
29 $license_arr[$id]=db_result($res,0,'license_name');
31 return $license_arr[$id];
34 function license_add($name) {
36 $res = db_query_params ('INSERT INTO licenses (license_name) VALUES ($1)',
37 array (htmlspecialchars ($name))) ;
39 $feedback .= ' Error adding License: '.db_error();
46 function license_update($id,$name) {
48 $res = db_query_params ('UPDATE licenses SET license_name=$1 WHERE license_id=$2',
49 array (htmlspecialchars($name),
52 $feedback .= ' Error updating License: '.db_error();
59 function license_delete($id) {
61 $res = db_query_params ('UPDATE groups SET license_id=100 WHERE license_id=$1',
64 $feedback .= ' Error deleting License: '.db_error();
67 $res = db_query_params ('DELETE FROM licenses WHERE license_id=$1',
70 $feedback .= ' Error deleting License: '.db_error();
78 function license_selectbox($title='license_id',$selected='xzxz') {
79 $res = db_query_params ('SELECT license_id, license_name FROM licenses ORDER BY license_name',
81 return html_build_select_box($res,$title,$selected,false);
86 // c-file-style: "bsd"