3 * FusionForge license functions
5 * Copyright 2004, GForge, LLC
7 * This file is part of FusionForge.
9 * FusionForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License,
12 * or (at your option) any later version.
14 * FusionForge is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with FusionForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 function license_getname($id) {
27 if (!isset($license_arr[$id])) {
28 $res=db_query("SELECT * FROM licenses WHERE license_id='$id'");
29 $license_arr[$id]=db_result($res,0,'license_name');
31 return $license_arr[$id];
34 function license_add($name) {
36 $res=db_query("INSERT INTO licenses(license_name)
37 values ('".htmlspecialchars($name)."')");
39 $feedback .= ' Error adding License: '.db_error();
46 function license_update($id,$name) {
48 $res=db_query("UPDATE licenses
49 SET license_name='".htmlspecialchars($name)."'
50 WHERE license_id='$id'");
52 $feedback .= ' Error adding License: '.db_error();
59 function license_delete($id) {
61 $res=db_query("UPDATE groups
63 WHERE license_id='$id'");
65 $feedback .= ' Error deleting License: '.db_error();
68 $res=db_query("DELETE FROM licenses WHERE license_id='$id'");
70 $feedback .= ' Error deleting License: '.db_error();
78 function license_selectbox($title='license_id',$selected='xzxz') {
79 $res=db_query("SELECT license_id, license_name FROM licenses ORDER BY license_name");
80 return html_build_select_box($res,$title,$selected,false);
85 // c-file-style: "bsd"