|
From: Benjamin C. <bc...@us...> - 2003-08-30 21:59:22
|
Update of /cvsroot/phpbt/phpbt/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv20953
Modified Files:
Tag: htmltemplates
configure.php database.php group.php os.php project.php
resolution.php severity.php site.php status.php user.php
Log Message:
Switching to html templates and gettext
Index: configure.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/configure.php,v
retrieving revision 1.12
retrieving revision 1.12.4.1
diff -u -r1.12 -r1.12.4.1
--- configure.php 18 Nov 2002 14:32:28 -0000 1.12
+++ configure.php 30 Aug 2003 21:59:16 -0000 1.12.4.1
@@ -2,7 +2,7 @@
// configure.php - Interface for configuration options
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -28,8 +28,8 @@
$perm->check('Admin');
-if (isset($_pv['submit'])) {
- foreach ($_pv as $k => $v) {
+if (isset($_POST['submit'])) {
+ foreach ($_POST as $k => $v) {
// Check the jpgraph path to make sure it has a trailing /
if ($k == 'JPGRAPH_PATH' and strlen($v) and substr($v, -1) != '/') $v .= '/';
@@ -43,7 +43,7 @@
}
$t->assign('vars', $db->getAll('select * from '.TBL_CONFIGURATION));
-$t->wrap('admin/configure.html', 'configuration');
+$t->render('configure.html', translate("Configuration"));
?>
Index: database.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/database.php,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -r1.3 -r1.3.6.1
--- database.php 30 Sep 2002 18:02:05 -0000 1.3
+++ database.php 30 Aug 2003 21:59:16 -0000 1.3.6.1
@@ -2,7 +2,7 @@
// database.php - Interface to the database table
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -31,11 +31,9 @@
if ($databaseid) {
// Make sure we are going after a valid record
- $itemexists = $db->getOne('select count(*) from '.TBL_DATABASE.
- " where database_id = $databaseid");
+ $itemexists = $db->getOne('select count(*) from '.TBL_DATABASE." where database_id = $databaseid");
// Are there any bugs tied to this one?
- $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
- " where database_id = $databaseid");
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG." where database_id = $databaseid");
if ($itemexists and !$bugcount) {
$db->query('delete from '.TBL_DATABASE." where database_id = $databaseid");
}
@@ -44,59 +42,53 @@
}
function do_form($databaseid = 0) {
- global $db, $me, $_pv, $STRING, $t;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
$error = '';
// Validation
if (!$database_name = trim($database_name))
- $error = $STRING['givename'];
+ $error = translate("Please enter a name");
if ($error) { show_form($databaseid, $error); return; }
if (empty($sort_order)) $sort_order = 0;
if (!$databaseid) {
- $db->query("insert into ".TBL_DATABASE.
- " (database_id, database_name, sort_order)
- values (".$db->nextId(TBL_DATABASE).', '.
- $db->quote(stripslashes($database_name)).
- ", $sort_order)");
+ $db->query("insert into ".TBL_DATABASE." (database_id, database_name, sort_order) values (".$db->nextId(TBL_DATABASE).', '.$db->quote(stripslashes($database_name)).", $sort_order)");
} else {
- $db->query("update ".TBL_DATABASE.
- " set database_name = ".$db->quote(stripslashes($database_name)).
- ", sort_order = $sort_order where database_id = $database_id");
+ $db->query("update ".TBL_DATABASE." set database_name = ".$db->quote(stripslashes($database_name)).", sort_order = $sort_order where database_id = $database_id");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html');
} else {
header("Location: $me?");
}
}
function show_form($databaseid = 0, $error = '') {
- global $db, $me, $t, $_pv, $STRING;
+ global $db, $me, $t;
if ($databaseid && !$error) {
- $t->assign($db->getRow("select * from ".TBL_DATABASE.
- " where database_id = '$databaseid'"));
+ $t->assign($db->getRow("select * from ".TBL_DATABASE." where database_id = '$databaseid'"));
} else {
- $t->assign($_pv);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/database-edit.html', ($databaseid ? 'editdatabase' : 'adddatabase'));
+ $t->render('database-edit.html', translate("Edit Database"),
+ !empty($_GET['use_js']) ? 'wrap-popup.html' : '');
}
function list_items($databaseid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
+ global $me, $db, $t, $QUERY;
- if (empty($_gv['order'])) {
+ if (empty($_GET['order'])) {
$order = 'sort_order';
$sort = 'asc';
} else {
- $order = $_gv['order'];
- $sort = $_gv['sort'];
+ $order = $_GET['order'];
+ $sort = $_GET['sort'];
}
- $page = isset($_gv['page']) ? $_gv['page'] : 0;
+ $page = isset($_GET['page']) ? $_GET['page'] : 0;
$nr = $db->getOne("select count(*) from ".TBL_DATABASE);
@@ -112,17 +104,18 @@
sorting_headers($me, $headers, $order, $sort);
- $t->wrap('admin/databaselist.html', 'database');
+ $t->render('databaselist.html', translate("Database List"));
}
$perm->check('Admin');
-if (isset($_gv['op'])) switch($_gv['op']) {
- case 'add' : list_items(); break;
- case 'edit' : show_form($_gv['database_id']); break;
- case 'del' : del_item($_gv['database_id']); break;
-} elseif(isset($_pv['submit'])) {
- do_form($_pv['database_id']);
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'add' : list_items(); break;
+ case 'edit' : show_form($_GET['database_id']); break;
+ case 'save' : do_form($_POST['database_id']); break;
+ case 'del' : del_item($_GET['database_id']); break;
+ }
} else list_items();
?>
Index: group.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/group.php,v
retrieving revision 1.12
retrieving revision 1.12.4.1
diff -u -r1.12 -r1.12.4.1
--- group.php 25 Jun 2003 02:11:10 -0000 1.12
+++ group.php 30 Aug 2003 21:59:16 -0000 1.12.4.1
@@ -2,7 +2,7 @@
// group.php - Administer the user groups
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -40,58 +40,52 @@
}
function do_form($groupid = 0) {
- global $db, $me, $_pv, $STRING, $u, $now, $t;
+ global $db, $me, $u, $now, $t;
- extract($_pv);
+ extract($_POST);
$error = '';
// Validation
if (!$group_name = trim($group_name))
- $error = $STRING['givename'];
+ $error = translate("Please enter a name");
if ($error) { show_form($groupid, $error); return; }
if (!$groupid) {
- $db->query("insert into ".TBL_AUTH_GROUP.
- " (group_id, group_name, created_by, created_date, last_modified_by, last_modified_date, assignable)"
- ." values (".$db->nextId(TBL_AUTH_GROUP).", ".
- $db->quote(stripslashes($group_name)).", $u, $now, $u, $now, ". ((int)$assignable).')');
+ $db->query("insert into ".TBL_AUTH_GROUP." (group_id, group_name, created_by, created_date, last_modified_by, last_modified_date, assignable) values (".$db->nextId(TBL_AUTH_GROUP).", ".$db->quote(stripslashes($group_name)).", $u, $now, $u, $now, ". ((int)$assignable).')');
} else {
- $db->query("update ".TBL_AUTH_GROUP.
- " set group_name = ".$db->quote(stripslashes($group_name)).
- ", last_modified_by = $u, last_modified_date = $now, assignable = ".($assignable?1:0)." where group_id = '$groupid'");
+ $db->query("update ".TBL_AUTH_GROUP." set group_name = ".$db->quote(stripslashes($group_name)).", last_modified_by = $u, last_modified_date = $now, assignable = ".($assignable?1:0)." where group_id = '$groupid'");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html', '', 'wrap-popup.html');
} else {
header("Location: $me?");
}
}
function show_form($groupid = 0, $error = '') {
- global $db, $me, $t, $_pv, $STRING;
+ global $db, $me, $t;
if ($groupid && !$error) {
- $t->assign($db->getRow("select * from ".TBL_AUTH_GROUP.
- " where group_id = '$groupid'"));
+ $t->assign($db->getRow("select * from ".TBL_AUTH_GROUP." where group_id = '$groupid'"));
} else {
- $t->assign($_pv);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/group-edit.html', ($groupid ? 'editgroup' : 'addgroup'));
+ $t->render('group-edit.html', translate("Edit Group"), (!empty($_GET['use_js']) ? 'wrap-popup.html' : 'wrap.html'));
}
function list_items($groupid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
+ global $me, $db, $t, $QUERY;
- if (empty($_gv['order'])) {
+ if (empty($_GET['order'])) {
$order = 'group_name';
$sort = 'asc';
} else {
- $order = $_gv['order'];
- $sort = $_gv['sort'];
+ $order = $_GET['order'];
+ $sort = $_GET['sort'];
}
- $page = isset($_gv['page']) ? $_gv['page'] : 0;
+ $page = isset($_GET['page']) ? $_GET['page'] : 0;
$nr = $db->getOne("select count(*) from ".TBL_AUTH_GROUP);
@@ -107,17 +101,18 @@
sorting_headers($me, $headers, $order, $sort, "page=$page");
- $t->wrap('admin/grouplist.html', 'group');
+ $t->render('grouplist.html', translate("Group List"));
}
$perm->check('Admin');
-if (isset($_gv['op'])) switch($_gv['op']) {
- case 'edit' : show_form($_gv['group_id']); break;
- case 'del' : del_group($_gv['group_id']); list_items($_gv['group_id']); break;
- case 'purge' : purge_group($_gv['group_id']); list_items($_gv['group_id']); break;
-} elseif(isset($_pv['submit'])) {
- do_form($_pv['group_id']);
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'save' : do_form($_POST['group_id']); break;
+ case 'edit' : show_form($_GET['group_id']); break;
+ case 'del' : del_group($_GET['group_id']); list_items($_GET['group_id']); break;
+ case 'purge' : purge_group($_GET['group_id']); list_items($_GET['group_id']); break;
+ }
} else list_items();
?>
Index: os.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/os.php,v
retrieving revision 1.28
retrieving revision 1.28.6.1
diff -u -r1.28 -r1.28.6.1
--- os.php 26 Aug 2002 18:11:13 -0000 1.28
+++ os.php 30 Aug 2003 21:59:16 -0000 1.28.6.1
@@ -2,7 +2,7 @@
// os.php - Interface to the OS table
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -31,11 +31,9 @@
if ($osid) {
// Make sure we are going after a valid record
- $itemexists = $db->getOne('select count(*) from '.TBL_OS.
- " where os_id = $osid");
+ $itemexists = $db->getOne('select count(*) from '.TBL_OS." where os_id = $osid");
// Are there any bugs tied to this one?
- $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
- " where os_id = $osid");
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG." where os_id = $osid");
if ($itemexists and !$bugcount) {
$db->query('delete from '.TBL_OS." where os_id = $osid");
}
@@ -44,57 +42,55 @@
}
function do_form($osid = 0) {
- global $db, $me, $_pv, $STRING, $t;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
$error = '';
// Validation
if (!$os_name = trim($os_name))
- $error = $STRING['givename'];
+ $error = translate("Please enter a name");
if ($error) { show_form($osid, $error); return; }
if (empty($sort_order)) $sort_order = 0;
if (!$osid) {
- $db->query("insert into ".TBL_OS." (os_id, os_name, regex, sort_order) ".
- "values (".$db->nextId(TBL_OS).", ".$db->quote(stripslashes($os_name)).
- ", '$regex', '$sort_order')");
+ $db->query("insert into ".TBL_OS." (os_id, os_name, regex, sort_order) values (".$db->nextId(TBL_OS).", ".$db->quote(stripslashes($os_name)).", '$regex', '$sort_order')");
} else {
- $db->query("update ".TBL_OS." set os_name = ".$db->quote(stripslashes($os_name)).
- ", regex = '$regex', sort_order = '$sort_order' where os_id = '$os_id'");
+ $db->query("update ".TBL_OS." set os_name = ".$db->quote(stripslashes($os_name)).", regex = '$regex', sort_order = '$sort_order' where os_id = '$os_id'");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html', '', 'wrap-popup.html');
} else {
header("Location: $me?");
}
}
function show_form($osid = 0, $error = '') {
- global $db, $me, $t, $_pv, $STRING;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
if ($osid && !$error) {
$t->assign($db->getRow("select * from ".TBL_OS." where os_id = '$osid'"));
} else {
- $t->assign($_pv);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/os-edit.html', ($osid ? 'editos' : 'addos'));
+ $t->render('os-edit.html', translate("Edit Operating System"),
+ !empty($_REQUEST['use_js']) ? 'wrap-popup.html' : 'wrap.html');
}
function list_items($osid = 0, $error = '') {
- global $db, $me, $t, $_gv, $STRING, $TITLE, $QUERY;
+ global $db, $me, $t, $QUERY;
- if (empty($_gv['order'])) {
+ if (empty($_GET['order'])) {
$order = 'sort_order';
$sort = 'asc';
} else {
- $order = $_gv['order'];
- $sort = $_gv['sort'];
+ $order = $_GET['order'];
+ $sort = $_GET['sort'];
}
- $page = isset($_gv['page']) ? $_gv['page'] : 0;
+ $page = isset($_GET['page']) ? $_GET['page'] : 0;
$nr = $db->getOne("select count(*) from ".TBL_OS);
@@ -111,16 +107,17 @@
sorting_headers($me, $headers, $order, $sort, "page=$page");
- $t->wrap('admin/oslist.html', 'os');
+ $t->render('oslist.html', translate("Operating System List"));
}
$perm->check('Admin');
-if (isset($_gv['op'])) switch($_gv['op']) {
- case 'edit' : show_form($_gv['os_id']); break;
- case 'del' : del_item($_gv['os_id']); break;
-} elseif(isset($_pv['submit'])) {
- do_form($_pv['os_id']);
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'save' : do_form($_POST['os_id']); break;
+ case 'edit' : show_form($_GET['os_id']); break;
+ case 'del' : del_item($_GET['os_id']); break;
+ }
} else list_items();
?>
Index: project.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/project.php,v
retrieving revision 1.46
retrieving revision 1.46.4.1
diff -u -r1.46 -r1.46.4.1
--- project.php 7 Jun 2003 02:52:24 -0000 1.46
+++ project.php 30 Aug 2003 21:59:16 -0000 1.46.4.1
@@ -2,7 +2,7 @@
// project.php - Create and update projects
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -38,51 +38,46 @@
}
function save_version($version_id = 0) {
- global $db, $me, $_pv, $STRING, $now, $u, $t, $perm;
+ global $db, $me, $now, $u, $t, $perm;
$perm->check_proj($projectid);
$error = '';
// Validation
- if (!$_pv['version_name'] = trim($_pv['version_name']))
- $error = $STRING['giveversion'];
+ if (!$_POST['version_name'] = trim($_POST['version_name']))
+ $error = translate("Please enter a version");
if ($error) {
- show_version($_pv['version_id'], $error); return;
+ show_version($_POST['version_id'], $error); return;
}
- extract($_pv);
+ extract($_POST);
if (!isset($active)) $active = 0;
if (!$version_id) {
- $db->query('insert into '.TBL_VERSION
- ." (version_id, project_id, version_name, active, created_by, created_date)
- values (".$db->nextId(TBL_VERSION).", $project_id, ".
- $db->quote(stripslashes($version_name)).", $active, $u, $now)");
+ $db->query('insert into '.TBL_VERSION." (version_id, project_id, version_name, active, created_by, created_date) values (".$db->nextId(TBL_VERSION).", $project_id, ".$db->quote(stripslashes($version_name)).", $active, $u, $now)");
} else {
- $db->query('update '.TBL_VERSION
- ." set project_id = $project_id, version_name = ".
- $db->quote(stripslashes($version_name)).
- ", active = $active where version_id = '$version_id'");
+ $db->query('update '.TBL_VERSION." set project_id = $project_id, version_name = ".$db->quote(stripslashes($version_name)).", active = $active where version_id = '$version_id'");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html');
} else {
header("Location:$me?op=edit&id=$project_id");
}
}
function show_version($versionid = 0, $error = '') {
- global $db, $t, $_pv, $STRING, $QUERY, $_gv;
-
- foreach ($_pv as $k => $v) $$k = $v;
+ global $db, $t, $QUERY;
+ extract($_POST);
if ($versionid) {
$t->assign($db->getRow(sprintf($QUERY['admin-show-version'], $versionid)));
} else {
- if (!empty($_gv['project_id'])) $t->assign('project_id', $_gv['project_id']);
- $t->assign($_pv);
+ if (!empty($_GET['project_id']))
+ $t->assign('project_id', $_GET['project_id']);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/version-edit.html', ($versionid ? 'editversion' : 'addversion'));
+ $t->render('version-edit.html', translate("Edit Version"),
+ !empty($_REQUEST['use_js']) ? 'wrap-popup.html' : 'wrap.html');
}
function del_component($componentid, $projectid) {
@@ -97,139 +92,120 @@
}
function save_component($component_id = 0) {
- global $db, $me, $_pv, $u, $STRING, $now, $t, $perm;
+ global $db, $me, $u, $now, $t, $perm;
$perm->check_proj($projectid);
$error = '';
// Validation
- if (!$_pv['component_name'] = trim($_pv['component_name']))
- $error = $STRING['givename'];
- elseif (!$_pv['component_desc'] = trim($_pv['component_desc']))
- $error = $STRING['givedesc'];
- if ($error) { show_component($_pv['component_id'], $error); return; }
+ if (!$_POST['component_name'] = trim($_POST['component_name'])) {
+ $error = translate("Please enter a name");
+ } elseif (!$_POST['component_desc'] = trim($_POST['component_desc'])) {
+ $error = translate("Please enter a description");
+ }
+ if ($error) {
+ show_component($_POST['component_id'], $error);
+ return;
+ }
- foreach ($_pv as $k => $v) $$k = $v;
+ extract($_POST);
if (!$owner) $owner = 0;
if (!$active) $active = 0;
if (!$component_id) {
- $db->query('insert into '.TBL_COMPONENT
- ." (component_id, project_id, component_name, component_desc, owner,
- active, created_by, created_date, last_modified_by, last_modified_date)
- values (".$db->nextId(TBL_COMPONENT).", $project_id, ".
- $db->quote(stripslashes($component_name)).", ".
- $db->quote(stripslashes($component_desc)).
- ", $owner, $active, $u, $now, $u, $now)");
+ $db->query('insert into '.TBL_COMPONENT." (component_id, project_id, component_name, component_desc, owner, active, created_by, created_date, last_modified_by, last_modified_date) values (".$db->nextId(TBL_COMPONENT).", $project_id, ".$db->quote(stripslashes($component_name)).", ".$db->quote(stripslashes($component_desc)).", $owner, $active, $u, $now, $u, $now)");
} else {
- $db->query('update '.TBL_COMPONENT
- ." set component_name = ".$db->quote(stripslashes($component_name)).
- ', component_desc = '.$db->quote(stripslashes($component_desc)).
- ", owner = $owner, active = $active, last_modified_by = $u, ".
- "last_modified_date = $now where component_id = $component_id");
+ $db->query('update '.TBL_COMPONENT." set component_name = ".$db->quote(stripslashes($component_name)).', component_desc = '.$db->quote(stripslashes($component_desc)).", owner = $owner, active = $active, last_modified_by = $u, "."last_modified_date = $now where component_id = $component_id");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html');
} else {
header("Location: $me?op=edit&id=$project_id");
}
}
function show_component($componentid = 0, $error = '') {
- global $db, $t, $_pv, $STRING, $QUERY, $_gv;
+ global $db, $t, $QUERY;
if ($componentid) {
$t->assign($db->getRow(sprintf($QUERY['admin-show-component'], $componentid)));
} else {
- if (!empty($_gv['project_id'])) $t->assign('project_id', $_gv['project_id']);
- $t->assign($_pv);
+ if (!empty($_GET['project_id'])) $t->assign('project_id', $_GET['project_id']);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/component-edit.html', ($componentid ? 'editcomponent' : 'addcomponent'));
+ $t->render('component-edit.html', translate("Edit Component"),
+ !empty($_REQUEST['use_js']) ? 'wrap-popup.html' : 'wrap.html');
}
function save_project($projectid = 0) {
- global $db, $me, $u, $STRING, $now, $_pv, $perm;
+ global $db, $me, $u, $now, $perm;
$perm->check_proj($projectid);
$error = '';
- // Validation
- if (!$_pv['project_name'] = htmlspecialchars(trim($_pv['project_name']))) {
- $error = $STRING['givename'];
- } elseif (!$_pv['project_desc'] = htmlspecialchars(trim($_pv['project_desc']))) {
- $error = $STRING['givedesc'];
- } elseif (isset($_pv['usergroup']) and is_array($_pv['usergroup']) and
- in_array('all', $_pv['usergroup']) and count($_pv['usergroup']) > 1) {
- $error = $STRING['project_only_all_groups'];
+ // Validation
+ if (!$_POST['project_name'] = htmlspecialchars(trim($_POST['project_name']))) {
+ $error = translate("Please enter a name");
+ } elseif (!$_POST['project_desc'] = htmlspecialchars(trim($_POST['project_desc']))) {
+ $error = translate("Please enter a description");
+ } elseif (isset($_POST['usergroup']) and is_array($_POST['usergroup']) and
+ in_array('all', $_POST['usergroup']) and count($_POST['usergroup']) > 1) {
+ $error = translate("You cannot choose specific groups when \"All Groups\" is chosen");
+ }
+ if ($error) {
+ show_project($projectid, $error);
+ return;
}
- if ($error) { show_project($projectid, $error); return; }
if (!$projectid) {
- if (!$_pv['version_name'] = htmlspecialchars(trim($_pv['version_name']))) {
- $error['version_error'] = $STRING['giveversion'];
- } elseif (!$_pv['component_name'] = trim($_pv['component_name'])) {
- $error['component_error'] = $STRING['givename'];
- } elseif (!$_pv['component_desc'] = trim($_pv['component_desc'])) {
- $error['component_error'] = $STRING['givedesc'];
+ if (!$_POST['version_name'] = htmlspecialchars(trim($_POST['version_name']))) {
+ $error['version_error'] = translate("Please enter a version");
+ } elseif (!$_POST['component_name'] = trim($_POST['component_name'])) {
+ $error['component_error'] = translate("Please enter a name");
+ } elseif (!$_POST['component_desc'] = trim($_POST['component_desc'])) {
+ $error['component_error'] = translate("Please enter a description");
}
}
- if ($error) { show_project($projectid, $error); return; }
+ if ($error) {
+ show_project($projectid, $error);
+ return;
+ }
- foreach ($_pv as $k => $v) $$k = $v;
- if (!isset($active)) $active = 0;
- if (!$projectid) {
- $projectid = $db->nextId(TBL_PROJECT);
- $db->query('insert into '.TBL_PROJECT
- ." (project_id, project_name, project_desc, active, created_by, created_date)
- values ($projectid , ".$db->quote(stripslashes($project_name)).", ".
- $db->quote(stripslashes($project_desc)).", $active, $u, $now)");
- $db->query('insert into '.TBL_VERSION
- ." (version_id, project_id, version_name, active, created_by, created_date)
- values (".$db->nextId(TBL_VERSION).", $projectid, ".
- $db->quote(stripslashes($version_name)).", 1, $u, $now)");
- $db->query('insert into '.TBL_COMPONENT
- ." (component_id, project_id, component_name, component_desc, owner,
- active, created_by, created_date, last_modified_by, last_modified_date)
- values (".$db->nextId(TBL_COMPONENT).", $projectid, ".
- $db->quote(stripslashes($component_name)).", ".
- $db->quote(stripslashes($component_desc)).
- ", $owner, 1, $u, $now, $u, $now)");
- } else {
- $db->query('update '.TBL_PROJECT
- ." set project_name = ".$db->quote(stripslashes($project_name)).
- ", project_desc = ".$db->quote(stripslashes($project_desc)).
- ", active = $active where project_id = $projectid");
- }
- // project -> user relationship
- $old_useradmin = $db->getCol('select user_id from '.TBL_PROJECT_PERM.
- " where project_id = $projectid");
- if (isset($useradmin) and is_array($useradmin) and count($useradmin)) {
- // Compute differences between old and new
- $remove_from = array_diff($old_useradmin, $useradmin);
- $add_to = array_diff($useradmin, $old_useradmin);
-
- if (count($remove_from)) {
- foreach ($remove_from as $user) {
- $db->query('delete from '.TBL_PROJECT_PERM." where project_id = $projectid
- and user_id = $user");
- }
- }
- if (count($add_to)) {
- foreach ($add_to as $user) {
- $db->query("insert into ".TBL_PROJECT_PERM
- ." (project_id, user_id)
- values ('$projectid', $user)");
- }
- }
- } elseif (count($old_useradmin)) {
- // user killed em all
- $db->query('delete from '.TBL_PROJECT_PERM." where project_id = $projectid");
- }
+ extract($_POST);
+ if (!isset($active)) $active = 0;
+ if (!$projectid) {
+ $projectid = $db->nextId(TBL_PROJECT);
+ $db->query('insert into '.TBL_PROJECT." (project_id, project_name, project_desc, active, created_by, created_date) values ($projectid , ".$db->quote(stripslashes($project_name)).", ".$db->quote(stripslashes($project_desc)).", $active, $u, $now)");
+ $db->query('insert into '.TBL_VERSION." (version_id, project_id, version_name, active, created_by, created_date) values (".$db->nextId(TBL_VERSION).", $projectid, ".$db->quote(stripslashes($version_name)).", 1, $u, $now)");
+ $db->query('insert into '.TBL_COMPONENT." (component_id, project_id, component_name, component_desc, owner, active, created_by, created_date, last_modified_by, last_modified_date) values (".$db->nextId(TBL_COMPONENT).", $projectid, ".$db->quote(stripslashes($component_name)).", ".$db->quote(stripslashes($component_desc)).", $owner, 1, $u, $now, $u, $now)");
+ } else {
+ $db->query('update '.TBL_PROJECT." set project_name = ".$db->quote(stripslashes($project_name)).", project_desc = ".$db->quote(stripslashes($project_desc)).", active = $active where project_id = $projectid");
+ }
+ // project -> user relationship
+ $old_useradmin = $db->getCol('select user_id from '.TBL_PROJECT_PERM." where project_id = $projectid");
+ if (isset($useradmin) and is_array($useradmin) and count($useradmin)) {
+ // Compute differences between old and new
+ $remove_from = array_diff($old_useradmin, $useradmin);
+ $add_to = array_diff($useradmin, $old_useradmin);
+
+ if (count($remove_from)) {
+ foreach ($remove_from as $user) {
+ $db->query('delete from '.TBL_PROJECT_PERM." where project_id = $projectid and user_id = $user");
+ }
+ }
+ if (count($add_to)) {
+ foreach ($add_to as $user) {
+ $db->query("insert into ".TBL_PROJECT_PERM." (project_id, user_id) values ('$projectid', $user)");
+ }
+ }
+ } elseif (count($old_useradmin)) {
+ // user killed em all
+ $db->query('delete from '.TBL_PROJECT_PERM." where project_id = $projectid");
+ }
// Handle project -> group relationship
- $old_usergroup = $db->getCol('select group_id from '.TBL_PROJECT_GROUP.
- " where project_id = $projectid");
+ $old_usergroup = $db->getCol('select group_id from '.TBL_PROJECT_GROUP." where project_id = $projectid");
if (isset($usergroup) and is_array($usergroup) and count($usergroup)) {
if (in_array('all', $usergroup)) {
// User selected 'All groups'
@@ -239,111 +215,107 @@
} else {
// Compute differences between old and new
$remove_from = array_diff($old_usergroup, $usergroup);
- $add_to = array_diff($usergroup, $old_usergroup);
+ $add_to = array_diff($usergroup, $old_usergroup);
if (count($remove_from)) {
foreach ($remove_from as $group) {
- $db->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid
- and group_id = $group");
+ $db->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid and group_id = $group");
}
}
if (count($add_to)) {
- foreach ($add_to as $group) {
- $db->query("insert into ".TBL_PROJECT_GROUP
- ." (project_id, group_id, created_by, created_date)
- values ('$projectid' ,'$group', $u, $now)");
- }
- }
+ foreach ($add_to as $group) {
+ $db->query("insert into ".TBL_PROJECT_GROUP." (project_id, group_id, created_by, created_date) values ('$projectid' ,'$group', $u, $now)");
+ }
+ }
}
} elseif (count($old_usergroup)) {
// User selected nothing, so consider it 'All groups'
$db->query('delete from '.TBL_PROJECT_GROUP." where project_id = $projectid");
}
- header("Location: $me?op=edit&id=$projectid");
+ header("Location: $me?op=edit&id=$projectid");
}
function show_project($projectid = 0, $error = null) {
- global $db, $me, $t, $TITLE, $_gv, $_pv, $QUERY, $perm;
+ global $db, $me, $t, $QUERY, $perm;
if (is_array($error)) $t->assign($error);
else $t->assign('error', $error);
- $t->assign('project_groups', $db->getCol('select group_id from '.
- TBL_PROJECT_GROUP." where project_id = $projectid"));
+ $t->assign('project_groups',
+ $db->getCol('select group_id from '.TBL_PROJECT_GROUP." where project_id = $projectid"));
if ($perm->have_perm('Administrator')) {
- $t->assign('project_admins', $db->getCol('select user_id from '.
- TBL_PROJECT_PERM." where project_id = $projectid"));
-
+ $t->assign('project_admins',
+ $db->getCol('select user_id from '.TBL_PROJECT_PERM." where project_id = $projectid"));
+
} else {
- $t->assign('project_admins', $db->getCol('select u.login from '.TBL_AUTH_USER.' as u, '.TBL_PROJECT_PERM.' as p where u.user_id = p.user_id and p.project_id = '.$projectid));
+ $t->assign('project_admins',
+ $db->getCol('select u.login from '.TBL_AUTH_USER.' as u, '.TBL_PROJECT_PERM.' as p where u.user_id = p.user_id and p.project_id = '.$projectid));
}
if ($projectid) {
- $t->assign($db->getRow('select * from '.TBL_PROJECT
- ." where project_id = $projectid"));
- $t->assign(array(
- 'components' => $db->getAll(sprintf($QUERY['admin-list-components'],
- $projectid)),
- 'versions' => $db->getAll(sprintf($QUERY['admin-list-versions'],
- $projectid))
- ));
-
- $t->wrap('admin/project-edit.html', 'editproject');
+ $t->assign($db->getRow('select * from '.TBL_PROJECT." where project_id = $projectid"));
+ $t->assign(array(
+ 'components' => $db->getAll(sprintf($QUERY['admin-list-components'], $projectid)),
+ 'versions' => $db->getAll(sprintf($QUERY['admin-list-versions'], $projectid))
+ ));
+
+ $t->render('project-edit.html', translate("Edit Project"));
} else {
- if (!empty($_pv)) {
- $t->assign($_pv);
- } else {
- $t->assign('active', 1);
- }
- $t->wrap('admin/project-add.html', 'addproject');
+ if (!empty($_POST)) {
+ $t->assign($_POST);
+ } else {
+ $t->assign('active', 1);
+ }
+ $t->render('project-add.html', translate("Edit Project"));
}
}
function list_projects() {
- global $me, $db, $t, $selrange, $_gv, $STRING, $TITLE;
+ global $me, $db, $t, $selrange;
- if (!isset($_gv['order'])) { $order = 'created_date'; $sort = 'asc'; }
- else { $order = $_gv['order']; $sort = $_gv['sort']; }
- $page = isset($_gv['page']) ? $_gv['page'] : 1;
+ if (!isset($_GET['order'])) {
+ $order = 'created_date'; $sort = 'asc';
+ }
+ else {
+ $order = $_GET['order']; $sort = $_GET['sort'];
+ }
+ $page = isset($_GET['page']) ? $_GET['page'] : 1;
- $nr = $db->getOne("select count(*) from ".TBL_PROJECT);
+ $nr = $db->getOne("select count(*) from ".TBL_PROJECT);
- list($selrange, $llimit) = multipages($nr, $page, "order=$order&sort=$sort");
+ list($selrange, $llimit) = multipages($nr, $page, "order=$order&sort=$sort");
- $t->assign('projects', $db->getAll($db->modifyLimitQuery(
- "select * from ".TBL_PROJECT." order by $order $sort", $llimit, $selrange)));
+ $t->assign('projects',
+ $db->getAll($db->modifyLimitQuery("select * from ".TBL_PROJECT." order by $order $sort", $llimit, $selrange)));
- $headers = array(
- 'projectid' => 'project_id',
- 'name' => 'project_name',
- 'description' => 'project_desc',
- 'active' => 'active',
- 'createdby' => 'created_by',
- 'createddate' => 'created_date'
- );
+ $headers = array(
+ 'projectid' => 'project_id',
+ 'name' => 'project_name',
+ 'description' => 'project_desc',
+ 'active' => 'active',
+ 'createdby' => 'created_by',
+ 'createddate' => 'created_date'
+ );
- sorting_headers($me, $headers, $order, $sort);
+ sorting_headers($me, $headers, $order, $sort);
- $t->wrap('admin/projectlist.html', 'project');
+ $t->render('projectlist.html', translate("Project List"));
}
// $perm->check('Admin');
-if (isset($_gv['op'])) {
- switch($_gv['op']) {
- case 'add' : show_project(); break;
- case 'edit' : show_project($_gv['id']); break;
- case 'edit_component' : show_component($_gv['id']); break;
- case 'edit_version' : show_version($_gv['id']); break;
- case 'del_component' : del_component($_gv['id'], $_gv['project_id']); break;
- case 'del_version' : del_version($_gv['id'], $_gv['project_id']); break;
- }
-} elseif (isset($_pv['do'])) {
- switch($_pv['do']) {
- case 'project' : save_project($_pv['id']); break;
- case 'version' : save_version($_pv['version_id']); break;
- case 'component' : save_component($_pv['component_id']); break;
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'add' : show_project(); break;
+ case 'edit' : show_project($_REQUEST['id']); break;
+ case 'edit_component' : show_component($_REQUEST['id']); break;
+ case 'edit_version' : show_version($_REQUEST['id']); break;
+ case 'del_component' : del_component($_REQUEST['id'], $_REQUEST['project_id']); break;
+ case 'del_version' : del_version($_REQUEST['id'], $_REQUEST['project_id']); break;
+ case 'save_project' : save_project($_POST['id']); break;
+ case 'save_version' : save_version($_POST['version_id']); break;
+ case 'save_component' : save_component($_POST['component_id']); break;
}
} else list_projects();
Index: resolution.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/resolution.php,v
retrieving revision 1.30
retrieving revision 1.30.6.1
diff -u -r1.30 -r1.30.6.1
--- resolution.php 26 Aug 2002 18:06:01 -0000 1.30
+++ resolution.php 30 Aug 2003 21:59:16 -0000 1.30.6.1
@@ -2,7 +2,7 @@
// resolution.php - Interface to the Resolution table
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -31,11 +31,9 @@
if ($resolutionid) {
// Make sure we are going after a valid record
- $itemexists = $db->getOne('select count(*) from '.TBL_RESOLUTION.
- " where resolution_id = $resolutionid");
+ $itemexists = $db->getOne('select count(*) from '.TBL_RESOLUTION." where resolution_id = $resolutionid");
// Are there any bugs tied to this one?
- $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
- " where resolution_id = $resolutionid");
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG." where resolution_id = $resolutionid");
if ($itemexists and !$bugcount) {
$db->query('delete from '.TBL_RESOLUTION." where resolution_id = $resolutionid");
}
@@ -44,64 +42,59 @@
}
function do_form($resolutionid = 0) {
- global $db, $me, $_pv, $STRING, $t;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
$error = '';
// Validation
if (!$resolution_name = trim($resolution_name))
- $error = $STRING['givename'];
+ $error = translate("Please enter a name");
elseif (!$resolution_desc = trim($resolution_desc))
- $error = $STRING['givedesc'];
+ $error = translate("Please enter a description");
if ($error) { show_form($resolutionid, $error); return; }
if (empty($sort_order)) $sort_order = 0;
if (!$resolutionid) {
$db->query("insert into ".TBL_RESOLUTION.
- " (resolution_id, resolution_name, resolution_desc, sort_order)"
- ." values (".$db->nextId(TBL_RESOLUTION).", ".
- $db->quote(stripslashes($resolution_name)).', '.
- $db->quote(stripslashes($resolution_desc)).', '.$sort_order.')');
+ " (resolution_id, resolution_name, resolution_desc, sort_order) values (".$db->nextId(TBL_RESOLUTION).", ".$db->quote(stripslashes($resolution_name)).', '.$db->quote(stripslashes($resolution_desc)).', '.$sort_order.')');
} else {
$db->query("update ".TBL_RESOLUTION.
- ' set resolution_name = '.$db->quote(stripslashes($resolution_name)).
- ', resolution_desc = '.$db->quote(stripslashes($resolution_desc)).
- ", sort_order = $sort_order where resolution_id = $resolutionid");
+ ' set resolution_name = '.$db->quote(stripslashes($resolution_name)).', resolution_desc = '.$db->quote(stripslashes($resolution_desc)).", sort_order = $sort_order where resolution_id = $resolutionid");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html');
} else {
header("Location: $me?");
}
}
function show_form($resolutionid = 0, $error = '') {
- global $db, $me, $t, $_pv, $STRING;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
if ($resolutionid && !$error) {
- $t->assign($db->getRow("select * from ".TBL_RESOLUTION.
- " where resolution_id = '$resolutionid'"));
+ $t->assign($db->getRow("select * from ".TBL_RESOLUTION." where resolution_id = '$resolutionid'"));
} else {
- $t->assign($_pv);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/resolution-edit.html', ($resolutionid ? 'editresolution' : 'addresolution'));
+ $t->render('resolution-edit.html', translate("Edit Resolution"),
+ !empty($_REQUEST['use_js']) ? 'wrap-popup.html' : 'wrap.html');
}
function list_items($resolutionid = 0, $error = '') {
- global $me, $db, $t, $STRING, $TITLE, $_gv, $QUERY;
+ global $me, $db, $t, $QUERY;
- if (empty($_gv['order'])) {
+ if (empty($_GET['order'])) {
$order = 'sort_order';
$sort = 'asc';
} else {
- $order = $_gv['order'];
- $sort = $_gv['sort'];
+ $order = $_GET['order'];
+ $sort = $_GET['sort'];
}
- $page = isset($_gv['page']) ? $_gv['page'] : 0;
+ $page = isset($_GET['page']) ? $_GET['page'] : 0;
$nr = $db->getOne("select count(*) from ".TBL_RESOLUTION);
@@ -118,16 +111,17 @@
sorting_headers($me, $headers, $order, $sort, "page=$page");
- $t->wrap('admin/resolutionlist.html', 'resolution');
+ $t->render('resolutionlist.html', translate("Resolution List"));
}
$perm->check('Admin');
-if (isset($_gv['op'])) switch($_gv['op']) {
- case 'edit' : show_form($_gv['resolution_id']); break;
- case 'del' : del_item($_gv['resolution_id']); break;
-} elseif(isset($_pv['submit'])) {
- do_form($_pv['resolution_id']);
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'edit' : show_form($_GET['resolution_id']); break;
+ case 'del' : del_item($_GET['resolution_id']); break;
+ case 'save' : do_form($_POST['resolution_id']); break;
+ }
} else list_items();
?>
Index: severity.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/severity.php,v
retrieving revision 1.25
retrieving revision 1.25.6.1
diff -u -r1.25 -r1.25.6.1
--- severity.php 26 Aug 2002 18:11:13 -0000 1.25
+++ severity.php 30 Aug 2003 21:59:16 -0000 1.25.6.1
@@ -2,7 +2,7 @@
// severity.php - Interface to the severity table
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -31,11 +31,9 @@
if ($severityid) {
// Make sure we are going after a valid record
- $itemexists = $db->getOne('select count(*) from '.TBL_SEVERITY.
- " where severity_id = $severityid");
+ $itemexists = $db->getOne('select count(*) from '.TBL_SEVERITY." where severity_id = $severityid");
// Are there any bugs tied to this one?
- $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
- " where severity_id = $severityid");
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG." where severity_id = $severityid");
if ($itemexists and !$bugcount) {
$db->query('delete from '.TBL_SEVERITY." where severity_id = $severityid");
}
@@ -44,65 +42,56 @@
}
function do_form($severityid = 0) {
- global $db, $me, $_pv, $STRING, $t;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
$error = '';
// Validation
if (!$severity_name = trim($severity_name))
- $error = $STRING['givename'];
+ $error = translate("Please enter a name");
elseif (!$severity_desc = trim($severity_desc))
- $error = $STRING['givedesc'];
+ $error = translate("Please enter a description");
if ($error) { show_form($severityid, $error); return; }
if (empty($sort_order)) $sort_order = 0;
if (!$severityid) {
- $db->query("insert into ".TBL_SEVERITY.
- " (severity_id, severity_name, severity_desc, sort_order, severity_color)
- values (".$db->nextId(TBL_SEVERITY).', '.
- $db->quote(stripslashes($severity_name)).', '.
- $db->quote(stripslashes($severity_desc)).", $sort_order, ".
- $db->quote(stripslashes($severity_color)).')');
+ $db->query("insert into ".TBL_SEVERITY." (severity_id, severity_name, severity_desc, sort_order, severity_color) values (".$db->nextId(TBL_SEVERITY).', '.$db->quote(stripslashes($severity_name)).', '.$db->quote(stripslashes($severity_desc)).", $sort_order, ".$db->quote(stripslashes($severity_color)).')');
} else {
- $db->query("update ".TBL_SEVERITY.
- " set severity_name = ".$db->quote(stripslashes($severity_name)).
- ', severity_desc = '.$db->quote(stripslashes($severity_desc)).
- ", sort_order = $sort_order, severity_color = ".
- $db->quote(stripslashes($severity_color))." where severity_id = $severity_id");
+ $db->query("update ".TBL_SEVERITY." set severity_name = ".$db->quote(stripslashes($severity_name)).', severity_desc = '.$db->quote(stripslashes($severity_desc)).", sort_order = $sort_order, severity_color = ".$db->quote(stripslashes($severity_color))." where severity_id = $severity_id");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html');
} else {
header("Location: $me?");
}
}
function show_form($severityid = 0, $error = '') {
- global $db, $me, $t, $_pv, $STRING;
+ global $db, $me, $t;
if ($severityid && !$error) {
- $t->assign($db->getRow("select * from ".TBL_SEVERITY.
- " where severity_id = '$severityid'"));
+ $t->assign($db->getRow("select * from ".TBL_SEVERITY." where severity_id = '$severityid'"));
} else {
- $t->assign($_pv);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/severity-edit.html', ($severityid ? 'editseverity' : 'addseverity'));
+ $t->render('severity-edit.html', translate("Edit Severity"),
+ !empty($_REQUEST['use_js']) ? 'wrap-popup.html' : 'wrap.html');
}
function list_items($severityid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
+ global $me, $db, $t, $QUERY;
- if (empty($_gv['order'])) {
+ if (empty($_GET['order'])) {
$order = 'sort_order';
$sort = 'asc';
} else {
- $order = $_gv['order'];
- $sort = $_gv['sort'];
+ $order = $_GET['order'];
+ $sort = $_GET['sort'];
}
- $page = isset($_gv['page']) ? $_gv['page'] : 0;
+ $page = isset($_GET['page']) ? $_GET['page'] : 0;
$nr = $db->getOne("select count(*) from ".TBL_SEVERITY);
@@ -121,17 +110,18 @@
sorting_headers($me, $headers, $order, $sort);
- $t->wrap('admin/severitylist.html', 'severity');
+ $t->render('severitylist.html', translate("Severity List"));
}
$perm->check('Admin');
-if (isset($_gv['op'])) switch($_gv['op']) {
- case 'add' : list_items(); break;
- case 'edit' : show_form($_gv['severity_id']); break;
- case 'del' : del_item($_gv['severity_id']); break;
-} elseif(isset($_pv['submit'])) {
- do_form($_pv['severity_id']);
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'add' : list_items(); break;
+ case 'edit' : show_form($_GET['severity_id']); break;
+ case 'del' : del_item($_GET['severity_id']); break;
+ case 'save' : do_form($_POST['severity_id']);
+ }
} else list_items();
?>
Index: site.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/site.php,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -r1.2 -r1.2.6.1
--- site.php 26 Aug 2002 18:11:13 -0000 1.2
+++ site.php 30 Aug 2003 21:59:16 -0000 1.2.6.1
@@ -44,57 +44,53 @@
}
function do_form($siteid = 0) {
- global $db, $me, $_pv, $STRING, $t;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
$error = '';
// Validation
if (!$site_name = trim($site_name))
- $error = $STRING['givename'];
+ $error = translate("Please enter a name");
if ($error) { show_form($siteid, $error); return; }
if (empty($sort_order)) $sort_order = 0;
if (!$siteid) {
- $db->query('insert into '.TBL_SITE.' (site_id, site_name, sort_order) '.
- 'values ('.$db->nextId(TBL_SITE).', '.$db->quote(stripslashes($site_name)).
- ', '.$sort_order.')');
+ $db->query('insert into '.TBL_SITE.' (site_id, site_name, sort_order) values ('.$db->nextId(TBL_SITE).', '.$db->quote(stripslashes($site_name)).', '.$sort_order.')');
} else {
- $db->query('update '.TBL_SITE.' set site_name = '.
- $db->quote(stripslashes($site_name)).', sort_order = '.
- $sort_order.' where site_id = '.$site_id);
+ $db->query('update '.TBL_SITE.' set site_name = '.$db->quote(stripslashes($site_name)).', sort_order = '.$sort_order.' where site_id = '.$site_id);
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html');
} else {
header("Location: $me?");
}
}
function show_form($siteid = 0, $error = '') {
- global $db, $me, $t, $_pv, $STRING;
+ global $db, $me, $t;
if ($siteid && !$error) {
- $t->assign($db->getRow("select * from ".TBL_SITE.
- " where site_id = '$siteid'"));
+ $t->assign($db->getRow("select * from ".TBL_SITE." where site_id = '$siteid'"));
} else {
- $t->assign($_pv);
+ $t->assign($_POST);
}
$t->assign('error', $error);
- $t->wrap('admin/site-edit.html', ($siteid ? 'editsite' : 'addsite'));
+ $t->render('site-edit.html', translate("Edit Site"),
+ !empty($_REQUEST['use_js']) ? 'wrap-popup.html' : 'wrap.html');
}
function list_items($siteid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
+ global $me, $db, $t, $QUERY;
- if (empty($_gv['order'])) {
+ if (empty($_GET['order'])) {
$order = 'sort_order';
$sort = 'asc';
} else {
- $order = $_gv['order'];
- $sort = $_gv['sort'];
+ $order = $_GET['order'];
+ $sort = $_GET['sort'];
}
- $page = isset($_gv['page']) ? $_gv['page'] : 0;
+ $page = isset($_GET['page']) ? $_GET['page'] : 0;
$nr = $db->getOne("select count(*) from ".TBL_SITE);
@@ -110,25 +106,18 @@
sorting_headers($me, $headers, $order, $sort);
- $t->wrap('admin/sitelist.html', 'site');
+ $t->render('sitelist.html', translate("Site List"));
}
$perm->check('Admin');
-if (isset($_gv['op'])) {
- switch($_gv['op']) {
- case 'add':
- list_items();
- break;
- case 'edit':
- show_form($_gv['site_id']);
- break;
- case 'del':
- del_item($_gv['site_id']);
- break;
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'add' : list_items(); break;
+ case 'edit' : show_form($_REQUEST['site_id']); break;
+ case 'del' : del_item($_REQUEST['site_id']); break;
+ case 'save' : do_form($_POST['site_id']); break;
}
-} elseif(isset($_pv['submit'])) {
- do_form($_pv['site_id']);
} else {
list_items();
}
Index: status.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/status.php,v
retrieving revision 1.30
retrieving revision 1.30.2.1
diff -u -r1.30 -r1.30.2.1
--- status.php 24 Jul 2003 04:47:13 -0000 1.30
+++ status.php 30 Aug 2003 21:59:16 -0000 1.30.2.1
@@ -2,7 +2,7 @@
// status.php - Interface to the Status table
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -31,11 +31,9 @@
if ($statusid) {
// Make sure we are going after a valid record
- $itemexists = $db->getOne('select count(*) from '.TBL_STATUS.
- " where status_id = $statusid");
+ $itemexists = $db->getOne('select count(*) from '.TBL_STATUS." where status_id = $statusid");
// Are there any bugs tied to this one?
- $bugcount = $db->getOne('select count(*) from '.TBL_BUG.
- " where status_id = $statusid");
+ $bugcount = $db->getOne('select count(*) from '.TBL_BUG." where status_id = $statusid");
if ($itemexists and !$bugcount) {
$db->query('delete from '.TBL_STATUS." where status_id = $statusid");
}
@@ -44,67 +42,58 @@
}
function do_form($statusid = 0) {
- global $db, $me, $_pv, $STRING, $t;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
$error = '';
// Validation
if (!$status_name = trim($status_name))
- $error = $STRING['givename'];
+ $error = translate("Please enter a name");
elseif (!$status_desc = trim($status_desc))
- $error = $STRING['givedesc'];
+ $error = translate("Please enter a description");
if ($error) { show_form($statusid, $error); return; }
if (empty($sort_order)) $sort_order = 0;
if (!$statusid) {
- $db->query("insert into ".TBL_STATUS.
- " (status_id, status_name, status_desc, bug_open, sort_order) values (".
- $db->nextId(TBL_STATUS).', '.
- $db->quote(stripslashes($status_name)).', '.
- $db->quote(stripslashes($status_desc)).', '.
- (int)$bug_open.", '$sort_order')");
+ $db->query("insert into ".TBL_STATUS." (status_id, status_name, status_desc, bug_open, sort_order) values (".$db->nextId(TBL_STATUS).', '.$db->quote(stripslashes($status_name)).', '.$db->quote(stripslashes($status_desc)).', '.(int)$bug_open.", '$sort_order')");
} else {
- $db->query("update ".TBL_STATUS.
- " set status_name = ".$db->quote(stripslashes($status_name)).
- ', status_desc = '.$db->quote(stripslashes($status_desc)).
- ', bug_open = '.(int)$bug_open.
- ", sort_order = $sort_order where status_id = $statusid");
+ $db->query("update ".TBL_STATUS." set status_name = ".$db->quote(stripslashes($status_name)).', status_desc = '.$db->quote(stripslashes($status_desc)).', bug_open = '.(int)$bug_open.", sort_order = $sort_order where status_id = $statusid");
}
if ($use_js) {
- $t->display('admin/edit-submit.html');
+ $t->render('edit-submit.html');
} else {
header("Location: $me?");
}
}
function show_form($statusid = 0, $error = '') {
- global $db, $me, $t, $_pv, $STRING;
+ global $db, $me, $t;
- extract($_pv);
+ extract($_POST);
if ($statusid && !$error) {
- $t->assign($db->getRow("select * from ".TBL_STATUS.
- " where status_id = '$statusid'"));
+ $t->assign($db->getRow("select * from ".TBL_STATUS." where status_id = '$statusid'"));
} else {
- $t->assign($_pv);
- $t->assign(array('bug_open' => 1)); // new bugs def. open :)
+ $t->assign($_POST);
+ if (empty($_POST)) $t->assign('bug_open', 1); // new bugs def. open :)
}
$t->assign('error', $error);
- $t->wrap('admin/status-edit.html', ($statusid ? 'editstatus' : 'addstatus'));
+ $t->render('status-edit.html', translate("Edit Status"),
+ !empty($_REQUEST['use_js']) ? 'wrap-popup.html' : 'wrap.html');
}
function list_items($statusid = 0, $error = '') {
- global $me, $db, $t, $_gv, $STRING, $TITLE, $QUERY;
+ global $me, $db, $t, $QUERY;
- if (empty($_gv['order'])) {
+ if (empty($_GET['order'])) {
$order = 'sort_order';
$sort = 'asc';
} else {
- $order = $_gv['order'];
- $sort = $_gv['sort'];
+ $order = $_GET['order'];
+ $sort = $_GET['sort'];
}
- $page = isset($_gv['page']) ? $_gv['page'] : 0;
+ $page = isset($_GET['page']) ? $_GET['page'] : 0;
$nr = $db->getOne("select count(*) from ".TBL_STATUS);
@@ -121,17 +110,18 @@
sorting_headers($me, $headers, $order, $sort);
- $t->wrap('admin/statuslist.html', 'status');
+ $t->render('statuslist.html', translate("Status List"));
}
$perm->check('Admin');
-if (isset($_gv['op'])) switch($_gv['op']) {
- case 'add' : list_items(); break;
- case 'edit' : show_form($_gv['status_id']); break;
- case 'del' : del_item($_gv['status_id']); break;
-} elseif(isset($_pv['submit'])) {
- do_form($_pv['status_id']);
+if (isset($_REQUEST['op'])) {
+ switch($_REQUEST['op']) {
+ case 'add' : list_items(); break;
+ case 'edit' : show_form($_REQUEST['status_id']); break;
+ case 'del' : del_item($_REQUEST['status_id']); break;
+ case 'save' : do_form($_POST['status_id']); break;
+ }
} else list_items();
?>
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v
retrieving revision 1.49
retrieving revision 1.49.6.1
diff -u -r1.49 -r1.49.6.1
--- user.php 18 May 2002 03:00:00 -0000 1.49
+++ user.php 30 Aug 2003 21:59:16 -0000 1.49.6.1
@@ -2,7 +2,7 @@
// user.php - Create and update users
// ------------------------------------------------------------------------
-// Copyright (c) 2001, 2002 The phpBugTracker Group
+// Copyright (c) 2001 - 2003 The phpBugTracker Group
// ------------------------------------------------------------------------
// This file is part of phpBugTracker
//
@@ -27,82 +27,62 @@
include 'include.php';
function do_form($userid = 0) {
- global $db, $me, $_pv, $STRING, $now, $u, $QUERY, $t;
+ global $db, $me, $now, $u, $QUERY, $t;
$error = '';
// Validation
- if (!EMAIL_IS_LOGIN && !$_pv['login'] = trim($_pv['login'])) {
- $error = $STRING['givelogin'];
- } elseif (!bt_valid_email($_pv['email'])) {
- $error = $STRING['giveemail'];
- } elseif (!$_pv['password'] = trim($_pv['password'])) {
- $error = $STRING['givepassword'];
+ if (!EMAIL_IS_LOGIN && !$_POST['login'] = trim($_POST['login'])) {
+ $error = translate("Please enter a login");
+ } elseif (!bt_valid_email($_POST['email'])) {
+ $error = translate("Please enter an email");
+ } elseif (!$_POST['password'] = trim($_POST['password'])) {
+ $error = translate("Please enter a password");
}
if ($error) {
show_form($userid, $error);
return;
}
- if (!isset($_pv['active'])) $_pv['active'] = 0;
- if (!isset($_pv['fe_notice'])) $_pv['fe_notice'] = 0;
+ if (!isset($_POST['active'])) $_POST['active'] = 0;
+ if (!isset($_POST['fe_notice'])) $_POST['fe_notice'] = 0;
if (EMAIL_IS_LOGIN) {
- $login = $_pv['email'];
+ $login = $_POST['email'];
} else {
- $login = $_pv['login'];
+ $login = $_POST['login'];
}
if (!$userid) {
- if (ENCRYPT_PASS) $mpassword = $db->quote(md5($_pv['password']));
- else $mpassword = $db->quote(stripslashes($_pv['password']));
+ if (ENCRYPT_PASS) $mpassword = $db->quote(md5($_POST['password']));
+ else $mpassword = $db->quote(stripslashes($_POST['password']));
$new_user_id = $db->nextId(TBL_AUTH_USER);
- $db->query('insert into '.TBL_AUTH_USER
- ." (user_id, first_name, last_name, login, email, password, active,
- created_by, created_date, last_modified_by, last_modified_date)
- values (".join(', ', array($new_user_id,
- $db->quote(stripslashes($_pv['first_name'])),
- $db->quote(stripslashes($_pv['last_name'])),
- $db->quote(stripslashes($login)), $db->quote($_pv['email']), $mpassword,
- $_pv['active'], $u, $now, $u, $now)).')');
+ $db->query('insert into '.TBL_AUTH_USER." (user_id, first_name, last_name, login, email, password, active,created_by, created_date, last_modified_by, last_modified_date) values (".join(', ', array($new_user_id, $db->quote(stripslashes($_POST['first_name'])), $db->quote(stripslashes($_POST['last_name'])), $db->quote(stripslashes($login)), $db->quote($_POST['email']), $mpassword, $_POST['active'], $u, $now, $u, $now)).')');
// Add to the selected groups
- if (isset($_pv['fusergroup']) and is_array($_pv['fusergroup']) and
- $_pv['fusergroup'][0]) {
- foreach ($_pv['fusergroup'] as $group) {
- $db->query("insert into ".TBL_USER_GROUP
- ." (user_id, group_id, created_by, created_date)
- values ('$new_user_id' ,'$group', $u, $now)");
+ if (isset($_POST['fusergroup']) and is_array($_POST['fusergroup']) and
+ $_POST['fusergroup'][0]) {
+ foreach ($_POST['fusergroup'] as $group) {
+ $db->query("insert into ".TBL_USER_GROUP." (user_id, group_id, created_by, created_date) values ('$new_user_id' ,'$group', $u, $now)");
}
}
// Add to prefs
- $db->query("INSERT INTO ".TBL_USER_PREF." (user_id, email_notices)
- VALUES ($new_user_id, '{$_pv['fe_notice']}')");
+ $db->query("INSERT INTO ".TBL_USER_PREF." (user_id, email_notices) VALUES ($new_user_id, '{$_POST['fe_notice']}')");
// And add to the user group
- $db->query("insert into ".TBL_USER_GROUP.
- " (user_id, group_id, created_by, created_date)
- select $new_user_id, group_id, $u, $now from ".TBL_AUTH_GROUP.
- " where group_name = 'User'");
+ $db->query("insert into ".TBL_USER_GROUP." (user_id, group_id, created_by, created_date) select $new_user_id, group_id, $u, $now from ".TBL_AUTH_GROUP." where group_name = 'User'");
} else {
if (ENCRYPT_PASS) {
- $oldpass = $db->getOne("select password from ".TBL_AUTH_USER
- ." where user_id = $userid");
- if ($oldpass != $_pv['password']) {
- $pquery = "password = '".md5($_pv['password'])."',";
+ $oldpass = $db->getOne("select password from ".TBL_AUTH_USER." where user_id = $userid");
+ if ($oldpass != $_POST['password']) {
+ $pquery = "password = '".md5($_POST['password'])."',";
} else {
$pquery = '';
}
} else {
- $pquery = "password = ".$db->quote(stripslashes($_pv['password'])).",";
+ $pquery = "password = ".$db->quote(stripslashes($_POST['password'])).",";
}
- $db->query("update ".TBL_AUTH_USER.
- " set first_name = ".$db->quote(stripslashes($_pv['first_name'])).
- ", last_name = ".$db->quote(stripslashes($_pv['last_name'])).
- ", login = ".$db->quote(stripslashes($login)).
- ", email = '{$_pv['email']}', $pquery active = {$_pv['active']} ".
- "where user_id = $userid");
+ $db->query("update ".TBL_AUTH_USER." set first_name = ".$db->quote(stripslashes($_POST['first_name'])).", last_name = ".$db->quote(stripslashes($_POST['last_name'])).", login = ".$db->quote(stripslashes($login)).", email = '{$_POST['email']}', $pquery active = {$_POST['active']} where user_id = $userid");
// Update preferences
- $db->query("update ".TBL_USER_PREF.
- " set email_notices = {$_pv['fe_notice']} where user_id = $userid");
+ $db->query("update ".TBL_USER_PREF." set email_notices = {$_POST['fe_notice']} where user_id = $userid");
// Update group memberships
// Get user's groups (without dropping the user group)
@@ -112,82 +92,79 @@
if (!isset($user_groups) or !is_array($user_groups)) {
$user_groups = array();
}
- if (!isset($_pv['fusergroup']) or !is_array($_pv['fusergroup']) or
- !$_pv['fusergroup'][0]) {
- $_pv['fusergroup'] = array();
+ if (!isset($_POST['fusergroup']) or !is_array($_POST['fusergroup']) or
+ !$_POST['fusergroup'][0]) {
+ $_POST['fusergroup'] = array();
}
- $remove_from = array_diff($user_groups, $_pv['fusergroup']);
- $add_to = array_diff($_pv['fusergroup'], $user_groups);
+ $remove_from = array_diff($user_groups, $_POST['fusergroup']);
+ $add...
[truncated message content] |