|
From: Benjamin C. <bc...@us...> - 2002-01-19 16:29:55
|
Update of /cvsroot/phpbt/phpbt/admin
In directory usw-pr-cvs1:/tmp/cvs-serv5866
Modified Files:
group.php
Log Message:
Converting spaces to tabs :)
Index: group.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/group.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- group.php 2001/12/04 14:32:46 1.2
+++ group.php 2002/01/19 16:29:51 1.3
@@ -39,56 +39,56 @@
}
function do_form($groupid = 0) {
- global $q, $me, $_pv, $STRING, $u, $now;
+ global $q, $me, $_pv, $STRING, $u, $now;
extract($_pv);
$error = '';
- // Validation
- if (!$fname = trim($fname))
- $error = $STRING['givename'];
- if ($error) { list_items($groupid, $error); return; }
+ // Validation
+ if (!$fname = trim($fname))
+ $error = $STRING['givename'];
+ if ($error) { list_items($groupid, $error); return; }
- if (!$groupid) {
- $q->query("insert into ".TBL_AUTH_GROUP.
+ if (!$groupid) {
+ $q->query("insert into ".TBL_AUTH_GROUP.
" (group_id, group_name, created_by, created_date, last_modified_by, last_modified_date)"
." values (".$q->nextid(TBL_AUTH_GROUP).", '$fname', $u, $now, $u, $now)");
- } else {
- $q->query("update ".TBL_AUTH_GROUP.
+ } else {
+ $q->query("update ".TBL_AUTH_GROUP.
" set group_name = '$fname', last_modified_by = $u,
last_modified_date = $now where group_id = '$groupid'");
- }
- header("Location: $me?");
+ }
+ header("Location: $me?");
}
function show_form($groupid = 0, $error = '') {
- global $q, $me, $t, $_pv, $STRING;
+ global $q, $me, $t, $_pv, $STRING;
- if ($groupid && !$error) {
- $row = $q->grab("select * from ".TBL_AUTH_GROUP.
+ if ($groupid && !$error) {
+ $row = $q->grab("select * from ".TBL_AUTH_GROUP.
" where group_id = '$groupid'");
- $t->set_var(array(
- 'action' => $STRING['edit'],
- 'fgroupid' => $row['group_id'],
- 'fname' => $row['group_name']));
- } else {
- $t->set_var(array(
- 'action' => $groupid ? $STRING['edit'] : $STRING['addnew'],
- 'error' => $error,
- 'fgroupid' => $groupid,
- 'fname' => isset($fname) ? $fname : ''));
- }
+ $t->set_var(array(
+ 'action' => $STRING['edit'],
+ 'fgroupid' => $row['group_id'],
+ 'fname' => $row['group_name']));
+ } else {
+ $t->set_var(array(
+ 'action' => $groupid ? $STRING['edit'] : $STRING['addnew'],
+ 'error' => $error,
+ 'fgroupid' => $groupid,
+ 'fname' => isset($fname) ? $fname : ''));
+ }
}
function list_items($groupid = 0, $error = '') {
- global $me, $q, $t, $_gv, $STRING, $TITLE;
+ global $me, $q, $t, $_gv, $STRING, $TITLE;
- $t->set_file('content','grouplist.html');
- $t->set_block('content','row','rows');
- $t->set_block('row','lockedblock','lockedb');
- $t->set_block('row','unlockedblock','unlockedb');
+ $t->set_file('content','grouplist.html');
+ $t->set_block('content','row','rows');
+ $t->set_block('row','lockedblock','lockedb');
+ $t->set_block('row','unlockedblock','unlockedb');
- if (empty($_gv['order'])) {
+ if (empty($_gv['order'])) {
$order = 'group_name';
$sort = 'asc';
} else {
@@ -98,42 +98,42 @@
$page = isset($_gv['page']) ? $_gv['page'] : 0;
- $nr = $q->grab_field("select count(*) from ".TBL_AUTH_GROUP);
+ $nr = $q->grab_field("select count(*) from ".TBL_AUTH_GROUP);
- list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
- "order=$order&sort=$sort");
+ list($selrange, $llimit, $npages, $pages) = multipages($nr,$page,
+ "order=$order&sort=$sort");
- $t->set_var(array(
- 'pages' => '[ '.$pages.' ]',
- 'first' => $llimit+1,
- 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
- 'records' => $nr));
+ $t->set_var(array(
+ 'pages' => '[ '.$pages.' ]',
+ 'first' => $llimit+1,
+ 'last' => $llimit+$selrange > $nr ? $nr : $llimit+$selrange,
+ 'records' => $nr));
- $q->limit_query("select ag.group_id, group_name, locked, count(ug.group_id) as count from ".
+ $q->limit_query("select ag.group_id, group_name, locked, count(ug.group_id) as count from ".
TBL_AUTH_GROUP." ag left join ".TBL_USER_GROUP." ug using (group_id) left join ".
TBL_AUTH_USER." using (user_id) group by ag.group_id, group_name, locked order by $order $sort",
$selrange, $llimit);
- if (!$q->num_rows()) {
+ if (!$q->num_rows()) {
// This should never happen, as admin, user, and developer groups must exist
- $t->set_var('rows',"");
- return;
- }
-
- $headers = array(
- 'groupid' => 'group_id',
- 'name' => 'group_name',
+ $t->set_var('rows',"");
+ return;
+ }
+
+ $headers = array(
+ 'groupid' => 'group_id',
+ 'name' => 'group_name',
'count' => '4');
- sorting_headers($me, $headers, $order, $sort);
+ sorting_headers($me, $headers, $order, $sort);
$i = 0;
- while ($row = $q->grab()) {
- $t->set_var(array(
- 'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
+ while ($row = $q->grab()) {
+ $t->set_var(array(
+ 'bgcolor' => (++$i % 2 == 0) ? '#dddddd' : '#ffffff',
'trclass' => $i % 2 ? '' : 'alt',
- 'groupid' => $row['group_id'],
- 'name' => $row['group_name'],
+ 'groupid' => $row['group_id'],
+ 'name' => $row['group_name'],
'count' => $row['count']
));
@@ -145,11 +145,11 @@
$t->parse('unlockedb', 'unlockedblock', false);
$t->set_var('lockedb', '');
}
- $t->parse('rows','row',true);
- }
+ $t->parse('rows','row',true);
+ }
- show_form($groupid, $error);
- $t->set_var('TITLE',$TITLE['group']);
+ show_form($groupid, $error);
+ $t->set_var('TITLE',$TITLE['group']);
}
$t->set_file('wrap','wrap.html');
@@ -157,12 +157,12 @@
$perm->check('Admin');
if (isset($_gv['op'])) switch($_gv['op']) {
- case 'add' : list_items(); break;
- case 'edit' : list_items($_gv['id']); break;
+ case 'add' : list_items(); break;
+ case 'edit' : list_items($_gv['id']); break;
case 'del' : del_group($_gv['id']); list_items($_gv['id']); break;
case 'purge' : purge_group($_gv['id']); list_items($_gv['id']); break;
} elseif(isset($_pv['submit'])) {
- do_form($_pv['id']);
+ do_form($_pv['id']);
} else list_items();
$t->pparse('main',array('content','wrap','main'));
|