3 * FusionForge license functions
5 * Copyright 2004, GForge, LLC
6 * Copyright 2009, Roland Mas
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published
12 * by the Free Software Foundation; either version 2 of the License,
13 * or (at your option) any later version.
15 * FusionForge is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with FusionForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26 function license_getname($id) {
28 if (!isset($license_arr[$id])) {
29 $res = db_query_params ('SELECT * FROM licenses WHERE license_id=$1',
31 $license_arr[$id]=db_result($res,0,'license_name');
33 return $license_arr[$id];
36 function license_add($name) {
38 $res = db_query_params ('INSERT INTO licenses (license_name) VALUES ($1)',
39 array (htmlspecialchars ($name))) ;
41 $feedback .= ' Error adding License: '.db_error();
48 function license_update($id,$name) {
50 $res = db_query_params ('UPDATE licenses SET license_name=$1 WHERE license_id=$2',
51 array (htmlspecialchars($name),
54 $feedback .= ' Error updating License: '.db_error();
61 function license_delete($id) {
63 $res = db_query_params ('UPDATE groups SET license_id=100 WHERE license_id=$1',
66 $feedback .= ' Error deleting License: '.db_error();
69 $res = db_query_params ('DELETE FROM licenses WHERE license_id=$1',
72 $feedback .= ' Error deleting License: '.db_error();
80 function license_selectbox($title='license_id',$selected='xzxz') {
81 $res = db_query_params ('SELECT license_id, license_name FROM licenses ORDER BY license_name',
83 return html_build_select_box($res,$title,$selected,false);
88 // c-file-style: "bsd"