diff --git a/webui/group-add.php b/webui/group-add.php index c34bd352a9db3f7981748e1edb609111e700eca3..ad0cc3b543ef10883e4726e08a45cd49cf9c0bd4 100644 --- a/webui/group-add.php +++ b/webui/group-add.php @@ -102,18 +102,18 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") { <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> <?php } + } else { ?> <div class="warning">Group name cannot be empty!</div> <?php } + } else { ?> - <div class="warning">Invalid invocation</div> - <?php } diff --git a/webui/group-attribute-add.php b/webui/group-attribute-add.php index d573fb8fab00171199394b5e685d05631d09e698..9920129bf123fe57bab0e07b2be01ce0e62aba7a 100644 --- a/webui/group-attribute-add.php +++ b/webui/group-attribute-add.php @@ -16,8 +16,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -session_start(); - include_once("includes/header.php"); include_once("includes/footer.php"); include_once("includes/db.php"); @@ -86,18 +84,13 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") { } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "add2") { ?> - <p class="pageheader">Attribute Add Results</p> - <?php # Check for empty values if (empty($_POST['attr_name']) || empty($_POST['attr_operator']) || empty($_POST['attr_value'])) { - ?> - <div class="warning">Submission cannot have empty value</div> - <?php } else { @@ -121,17 +114,13 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") { <div class="warning"><?php print_r($stmt->errorInfo()) ?></div> <?php - } + } } else { - ?> - <div class="warning">Invalid invocation</div> - <?php - } printFooter(); diff --git a/webui/group-attribute-change.php b/webui/group-attribute-change.php index 86d2136d776cbeb198aa1dc0816fafb81bc8d450..f7c2d492e56453c04ffd552dd674caae40eecc34 100644 --- a/webui/group-attribute-change.php +++ b/webui/group-attribute-change.php @@ -37,15 +37,14 @@ printHeader(array( # Display change screen if (isset($_POST['frmaction']) && $_POST['frmaction'] == "change") { + # Check an attribute was selected if (isset($_POST['attr_id'])) { # Prepare statement $sql = "SELECT ID, Name, Operator, Value, Disabled FROM ${DB_TABLE_PREFIX}group_attributes WHERE ID = ".$db->quote($_POST['attr_id']); $res = $db->query($sql); $row = $res->fetchObject(); - ?> - <p class="pageheader">Update Group Attribute</p> <form action="group-attribute-change.php" method="post"> @@ -113,26 +112,21 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "change") { <input type="submit" /> </div> </form> - <?php $res->closeCursor(); - } else { + } else { ?> - <div class="warning">No attribute selected</div> - <?php - } + # SQL Updates } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "change2") { ?> - <p class="pageheader">Attribute Update Results</p> - <?php # Check an attribute was selected @@ -175,6 +169,7 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "change") { <div class="warning"><?php print_r($db->errorInfo()) ?></div> <?php } + # Warn } else { ?> @@ -190,13 +185,9 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "change") { } } else { - ?> - <div class="warning">Invalid invocation</div> - <?php - } diff --git a/webui/group-attribute-delete.php b/webui/group-attribute-delete.php index e77ae3c47c1d1f874ee1cd9c9cd8d503168094bb..598d80a56375e56a3f5a36680b209f46d26ff7a8 100644 --- a/webui/group-attribute-delete.php +++ b/webui/group-attribute-delete.php @@ -37,11 +37,10 @@ printHeader(array( # Display delete confirm screen if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") { + # Check a user was selected if (isset($_POST['attr_id'])) { - ?> - <p class="pageheader">Delete Attribute</p> <form action="group-attribute-delete.php" method="post"> @@ -55,25 +54,19 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") { <input type="submit" name="confirm" value="no" /> </div> </form> - <?php } else { - ?> - <div class="warning">No attribute selected</div> - <?php - } + # SQL Updates } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete2") { ?> - <p class="pageheader">Attribute Delete Results</p> - <?php # Make sure we have the attribute ID set diff --git a/webui/group-attributes.php b/webui/group-attributes.php index 2c9d228fed669c9b53f5a5d6532ecef475141c8c..eb13bd0f1aa512eb3b0197a028dd01c363189c63 100644 --- a/webui/group-attributes.php +++ b/webui/group-attributes.php @@ -17,8 +17,6 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -session_start(); - include_once("includes/header.php"); include_once("includes/footer.php"); include_once("includes/db.php"); @@ -76,30 +74,27 @@ printHeader(array( </tr> <?php - - $_SESSION['attr_group_id'] = $_POST['group_id']; if (isset($_POST['group_id'])) { - $sql = "SELECT - ID, - Name, - Operator, - Value, - Disabled - FROM - ${DB_TABLE_PREFIX}group_attributes - WHERE - GroupID = ".$db->quote($_POST['group_id'])." - ORDER BY - ID - "; + $sql = " + SELECT + ID, + Name, + Operator, + Value, + Disabled + FROM + ${DB_TABLE_PREFIX}group_attributes + WHERE + GroupID = ".$db->quote($_POST['group_id'])." + ORDER BY + ID + "; $res = $db->query($sql); while ($row = $res->fetchObject()) { - ?> - <tr class="resultsitem"> <td><input type="radio" name="attr_id" value="<?php echo $row->id; ?>"/><?php echo $row->id; ?></td> <td><?php echo $row->name; ?></td> @@ -107,37 +102,31 @@ printHeader(array( <td><?php echo $row->value; ?></td> <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no'; ?></td> </tr> - <?php } + $res->closeCursor(); - if ($res->rowCount() == 0) { + if ($res->rowCount() == 0) { ?> - <p /> <tr> <td colspan="5" class="textcenter">Group attribute list is empty</td> </tr> - <?php } - } else { + } else { ?> <tr class="resultitem"> <td colspan="5" class="textcenter">No Group ID selected</td> </tr> - <?php - } - ?> - </table> </form> diff --git a/webui/group-delete.php b/webui/group-delete.php index b4b70e3849274d8749d6b38932168e6e37be4326..1a19e1c22898bf80c590e28453aaef639bd41b0b 100644 --- a/webui/group-delete.php +++ b/webui/group-delete.php @@ -37,11 +37,10 @@ printHeader(array( # Display delete confirm screen if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") { + # Check a policy group was selected if (isset($_POST['group_id'])) { - ?> - <p class="pageheader">Delete Group</p> <form action="group-delete.php" method="post"> @@ -53,28 +52,22 @@ if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") { <input type="submit" name="confirm" value="no" /> </div> </form> - <?php } else { - ?> - <div class="warning">No group selected</div> - <?php - } + # SQL Updates } elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete2") { - ?> - <p class="pageheader">Group Delete Results</p> - <?php if (isset($_POST['group_id'])) { + if (isset($_POST['confirm']) && $_POST['confirm'] == "yes") { $db->beginTransaction(); diff --git a/webui/group-main.php b/webui/group-main.php index 2787aea4047b7b619092672a4388c1de80e9d850..fb802bed85bdbfc676d8e334330a8d1b04544986 100644 --- a/webui/group-main.php +++ b/webui/group-main.php @@ -79,12 +79,10 @@ printHeader(array( </tr> <?php - $sql = "SELECT ID, Name, Priority, Disabled, Comment FROM ${DB_TABLE_PREFIX}groups ORDER BY ID"; $res = $db->query($sql); while ($row = $res->fetchObject()) { - ?> <tr class="resultsitem"> <td><input type="radio" name="group_id" value="<?php echo $row->id; ?>" /></td> @@ -93,29 +91,23 @@ printHeader(array( <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no'; ?></td> <td><?php echo $row->comment; ?></td> </tr> - <?php - } - if ($res->rowCount() == 0) { + if ($res->rowCount() == 0) { ?> - <p /> <tr> <td colspan="5" class="textcenter">Group list is empty</td> </tr> - <?php - } + $res->closeCursor(); ?> - </table> </form> - <?php printFooter(); diff --git a/webui/group-users.php b/webui/group-users.php index 850b7e38ea9bcd96087b395741a7861828f47ab5..7cc9c1fde5ea9b572be74abcad396b0c616c8a08 100644 --- a/webui/group-users.php +++ b/webui/group-users.php @@ -56,9 +56,7 @@ if (isset($_POST['group_id'])) { <td class="textcenter">Member</td> <td class="textcenter">Disabled</td> </tr> - <?php - # Get list of members belonging to this group $stmt = $db->prepare("SELECT UserID FROM ${DB_TABLE_PREFIX}users_to_groups WHERE GroupID = ?"); $stmtResult = $stmt->execute(array($_REQUEST['group_id'])); @@ -71,50 +69,38 @@ if (isset($_POST['group_id'])) { # List users while ($row = $res->fetchObject()) { - ?> - <tr class="resultsitem"> <td><?php echo $row->id; ?></td> <td><?php echo $row->username; ?></td> <td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no'; ?></td> </tr> - <?php - } + $res->closeCursor(); } # Did we get any results? if ($stmt->rowCount() == 0) { - ?> - <p /> <tr> <td colspan="3" class="textcenter">Group has no users</td> </tr> - <?php - } + $stmt->closeCursor(); ?> - </table> - <?php } else { - ?> - <div class="warning">Invalid invocation</div> - <?php - } printFooter();