|
From: Javier S. <ja...@us...> - 2001-09-03 17:00:30
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv21337
Modified Files:
include.php
Log Message:
Add group to build_select()
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- include.php 2001/09/03 15:05:29 1.47
+++ include.php 2001/09/03 17:00:27 1.48
@@ -23,9 +23,9 @@
// $Id$
if (defined("INCLUDE_PATH")) {
- require INCLUDE_PATH."config.php";
+ require INCLUDE_PATH."config.php";
} else {
- require "config.php";
+ require "config.php";
}
// Edit this class with your database information
@@ -123,17 +123,17 @@
return 'nobody';
} else {
$this->auth['db_fields'] = unserialize($u['bug_list_fields']);
-
- // Grab group assignments and permissions based on groups
- $q->query("select group_name, perm_name"
- ." from ".TBL_AUTH_PERM." ap, ".TBL_GROUP_PERM." gp, ".TBL_AUTH_GROUP." ag, ".TBL_USER_GROUP." ug"
- ." where ap.perm_id = gp.perm_id and gp.group_id = ag.group_id"
- ." and ag.group_id = ug.group_id and ug.user_id = {$u['user_id']}");
- while (list($group, $perm) = $q->grab()) {
- $this->auth['perm'][$perm] = true;
- $this->auth['group'][$group] = true;
- }
-
+
+ // Grab group assignments and permissions based on groups
+ $q->query("select group_name, perm_name"
+ ." from ".TBL_AUTH_PERM." ap, ".TBL_GROUP_PERM." gp, ".TBL_AUTH_GROUP." ag, ".TBL_USER_GROUP." ug"
+ ." where ap.perm_id = gp.perm_id and gp.group_id = ag.group_id"
+ ." and ag.group_id = ug.group_id and ug.user_id = {$u['user_id']}");
+ while (list($group, $perm) = $q->grab()) {
+ $this->auth['perm'][$perm] = true;
+ $this->auth['group'][$group] = true;
+ }
+
return $u['user_id'];
}
}
@@ -146,42 +146,42 @@
class uperm extends Perm {
var $classname = 'uperm';
-
- function check_auth($auth_var, $reqs) {
- global $auth;
-
- // Administrators always pass
- if ($auth->auth[$auth_var]['admin']) {
- return true;
- }
-
- if (is_array($reqs)) {
- foreach ($reqs as $req) {
- if (!$auth->auth[$auth_var][$req]) {
- return false;
- }
- }
- } else {
- if (!$auth->auth[$auth_var][$req]) {
- return false;
- }
- }
-
- // Didn't fail on any requirements? Then the user passes the check
- return true;
- }
-
-
- function in_group($req_groups) {
- return $this->check_auth('group', $req_groups);
- }
-
-
- function have_perm($req_perms) {
- return $this->check_auth('perm', $req_perms);
- }
-
-
+
+ function check_auth($auth_var, $reqs) {
+ global $auth;
+
+ // Administrators always pass
+ if ($auth->auth[$auth_var]['admin']) {
+ return true;
+ }
+
+ if (is_array($reqs)) {
+ foreach ($reqs as $req) {
+ if (!$auth->auth[$auth_var][$req]) {
+ return false;
+ }
+ }
+ } else {
+ if (!$auth->auth[$auth_var][$req]) {
+ return false;
+ }
+ }
+
+ // Didn't fail on any requirements? Then the user passes the check
+ return true;
+ }
+
+
+ function in_group($req_groups) {
+ return $this->check_auth('group', $req_groups);
+ }
+
+
+ function have_perm($req_perms) {
+ return $this->check_auth('perm', $req_perms);
+ }
+
+
function perm_invalid() {
global $t, $auth;
$t->set_file('content','badperm.html');
@@ -200,13 +200,13 @@
if ($u && $u != 'nobody') {
list($owner_open, $owner_closed) =
$q->grab("select sum(if(status_name in ('Unconfirmed','New','Assigned','Reopened'),1,0)),"
- ." sum(if(status_name not in ('Unconfirmed','New','Assigned','Reopened'),1,0))"
- ." from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id)"
- ." where assigned_to = $u");
+ ." sum(if(status_name not in ('Unconfirmed','New','Assigned','Reopened'),1,0))"
+ ." from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id)"
+ ." where assigned_to = $u");
list($reporter_open, $reporter_closed) =
- $q->grab("select sum(if(status_name in ('Unconfirmed','New','Assigned','Reopened'),1,0)),"
- ." sum(if(status_name not in ('Unconfirmed','New','Assigned','Reopened'),1,0))"
- ." from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) where created_by = $u");
+ $q->grab("select sum(if(status_name in ('Unconfirmed','New','Assigned','Reopened'),1,0)),"
+ ." sum(if(status_name not in ('Unconfirmed','New','Assigned','Reopened'),1,0))"
+ ." from ".TBL_BUG." b left join ".TBL_STATUS." s using(status_id) where created_by = $u");
$this->set_var(array(
'loggedinas' => $auth->auth['uname'],
'liblock' => '',
@@ -269,6 +269,7 @@
//create hash to map tablenames
$cfgDatabase=array(
+ 'group' => TBL_AUTH_GROUP,
'project' => TBL_PROJECT,
'component' => TBL_COMPONENT,
'status' => TBL_STATUS,
@@ -278,8 +279,9 @@
);
$text = '';
- $querystart = "select {$box}_id, {$box}_name from $cfgDatabase[$box]";
+ $querystart = "select {$box}_id, {$box}_name from $cfgDatabase[$box]";
$queries = array(
+ 'group' => $querystart.' order by group_name',
'severity' => $querystart.' where sort_order > 0 order by sort_order',
'status' => $querystart.' where sort_order > 0 order by sort_order',
'resolution' => $querystart.' where sort_order > 0 order by sort_order',
@@ -289,6 +291,15 @@
);
switch($box) {
+ case 'group' :
+ $q->query($queries[$box]);
+ while ($row = $q->grab()) {
+ if ($value == $row[$box.'_id'] and $value != '') $sel = ' selected';
+ else $sel = '';
+ $text .= '<option value="'.
+ $row[$box.'_id']."\"$sel>".$row[$box.'_name'].'</option>';
+ }
+ break;
case 'severity' :
case 'status' :
case 'resolution' :
@@ -315,11 +326,11 @@
}
break;
case 'owner' :
- $q->query('select u.user_id, login from '.TBL_AUTH_USER.' u, '.TBL_USER_GROUP.' ug, '.TBL_AUTH_GROUP.' g where active > 0 and u.user_id = ug.user_id and ug.group_id = g.group_id and group_name = "Developer" order by login');
+ $q->query("select user_id, email from ".TBL_AUTH_USER." where user_level > 1 order by email");
while ($row = $q->grab()) {
if ($value == $row['user_id']) $sel = ' selected';
else $sel = '';
- $text .= "<option value=\"{$row['user_id']}\"$sel>{$row['login']}</option>";
+ $text .= "<option value=\"{$row['user_id']}\"$sel>{$row['email']}</option>";
}
break;
default :
@@ -491,4 +502,4 @@
}
}
-?>
+?>
\ No newline at end of file
|