3 * FusionForge top-level information
5 * Copyright 2002, GForge, LLC
6 * Copyright 2009-2011, 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 require_once $gfcommon.'include/Error.class.php';
28 if (file_exists($gfcommon.'pkginfo.inc.php')) {
29 require $gfcommon.'pkginfo.inc.php';
32 class FusionForge extends Error {
36 var $software_version ;
39 * FusionForge - FusionForge object constructor
41 function FusionForge() {
42 global $forge_pkg_name, $forge_pkg_version;
46 $this->software_name = 'FusionForge' ;
47 $this->software_version = '5.1.50' ;
49 if (isset($forge_pkg_name) && isset($forge_pkg_version)) {
50 $this->software_name = $forge_pkg_name;
51 $this->software_version = $forge_pkg_version;
54 $this->software_type = $this->software_name;
55 if (isset($forge_pkg_type)) {
56 $this->software_type = $forge_pkg_type;
62 function getNumberOfPublicHostedProjects() {
63 $res = db_query_params ('SELECT group_id FROM groups WHERE status=$1',
66 $this->setError('Unable to get hosted project count: '.db_error());
70 $ra = RoleAnonymous::getInstance() ;
71 while ($row = db_fetch_array($res)) {
72 if ($ra->hasPermission('project_read', $row['group_id'])) {
79 function getNumberOfHostedProjects() {
80 $res = db_query_params ('SELECT group_id FROM groups WHERE status=$1',
83 $this->setError('Unable to get hosted project count: '.db_error());
87 $ra = RoleAnonymous::getInstance() ;
88 while ($row = db_fetch_array($res)) {
89 if ($ra->hasPermission('project_read', $row['group_id'])) {
96 function getNumberOfActiveUsers() {
97 $res = db_query_params ('SELECT count(*) AS count FROM users WHERE status=$1 and user_id != 100',
99 if (!$res || db_numrows($res) < 1) {
100 $this->setError('Unable to get user count: '.db_error());
103 return $this->parseCount($res);
107 function getPublicProjectNames() {
108 $res = db_query_params ('SELECT unix_group_name, group_id FROM groups WHERE status=$1 ORDER BY unix_group_name',
111 $this->setError('Unable to get list of public projects: '.db_error());
115 $ra = RoleAnonymous::getInstance() ;
116 while ($row = db_fetch_array($res)) {
117 if ($ra->hasPermission('project_read', $row['group_id'])) {
118 $result[] = $row['unix_group_name'];
124 function parseCount($res) {
125 $row_count = db_fetch_array($res);
126 return $row_count['count'];
132 // c-file-style: "bsd"