Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • smradius/smradius
  • centiva-shail/smradius
  • nkukard/smradius
3 results
Show changes
Showing
with 0 additions and 1582 deletions
webui/images/strips_onside.jpg

392 B

webui/images/top2.jpg

2.06 KiB

webui/images/valid-css2.png

1.55 KiB

webui/images/valid-xhtml10.png

1.84 KiB

webui/images/wcag1AAA.png

1.56 KiB

<?php
# Header
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/config.php");
# Print out HTML header
function printHeader($params = NULL)
{
global $DB_POSTFIX_DSN;
# Pull in params
if (!is_null($params)) {
if (isset($params['Tabs'])) {
$tabs = $params['Tabs'];
}
if (isset($params['js.onLoad'])) {
$jsOnLoad = $params['js.onLoad'];
}
if (isset($params['Title'])) {
$title = $params['Title'];
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>SMRadiusd Web Administration</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript" src="library.js"></script>
<script type="text/javascript" src="tooltips/BubbleTooltips.js"></script>
<script type="text/javascript">
window.onload=function(){enableTooltips(null,"img")};
</script>
</head>
<body<?php if (!empty($jsOnLoad)) { echo " onLoad=\"".$jsOnLoad."\""; } ?>>
<table id="maintable">
<tr>
<td id="header">SMRadiusd Web Administration</td>
</tr>
<tr>
<td>
<table>
<tr>
<td id="menu">
<img style="margin-top:-1px; margin-left:-1px;" src="images/top2.jpg" alt="" />
<p><a href=".">Home</a></p>
<p>Control Panel</p>
<ul>
<li><a href="user-main.php">User List</a></li>
<li><a href="group-main.php">Groups</a></li>
<li><a href="realms-main.php">Realms</a></li>
</ul>
<p>WiSP</p>
<ul>
<li><a href="wisp-user-list.php">User List</a></li>
<li><a href="wisp-user-add.php">Add User</a></li>
<li><a href="wisp-multiuser-add.php">Add Many Users</a></li>
<li><a href="wisp-locations-main.php">Locations</a></li>
</ul>
<!-- <img style="margin-left:-1px; margin-bottom: -6px" src="images/specs_bottom.jpg" alt="" />-->
</td>
<td class="content">
<table class="content">
<?php
# Check if we must display tabs or not
if (!empty($tabs)) {
?>
<tr><td id="topmenu"><ul>
<?php
foreach ($tabs as $key => $value) {
?> <li>
<a href="<?php echo $value ?>"
title="<?php echo $key ?>">
<span><?php echo $key ?></span></a>
</li>
<?php
}
?>
</ul></td></tr>
<?php
}
?>
<tr>
<td>
<?php
}
# vim: ts=4
?>
<?php
# Radius term code mappings
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Return string for radius term code
function strRadiusTermCode($errCode) {
if (is_numeric($errCode)) {
switch ($errCode) {
case 0:
return "Still logged in";
case 45: # Unknown
case 46: # Unknown
case 63: # Unknown
case 1:
return "User request";
case 2:
case 816: # TCP connection reset? unknown
return "Carrier loss";
case 5:
return "Session timeout";
case 6: # Admin reset
case 10: # NAS request
case 11: # NAS reboot
case 831: # NAS request? unknown
case 841: # NAS request? unknown
return "Router reset/reboot";
case 8: # Port error
return "Port error";
case 180: # Unknown
return "Local hangup";
case 827: # Unknown
return "Service unavailable";
default:
return "Unkown";
}
} else {
return "Unknown";
}
}
?>
function rand ( n )
{
return ( Math.floor ( Math.random ( ) * n + 1 ) );
}
<?php
# Radius Realms Add
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to realms" => "realms-main.php",
),
));
if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add Realm</p>
<form method="post" action="realms-add.php">
<input type="hidden" name="frmaction" value="add2" />
<table class="entry">
<tr>
<td class="entrytitle">Name</td>
<td><input type="text" name="realms_name" /></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td>
<select name="realms_disabled">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "add2") {
?>
<p class="pageheader">Realm Add Results</p>
<?php
if (!empty($_POST['realms_name'])) {
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}realms (Name,Disabled) VALUES (?,?)");
$res = $stmt->execute(array(
$_POST['realms_name'],
$_POST['realms_disabled']
));
if ($res !== FALSE) {
?>
<div class="notice">Realm added</div>
<?php
} else {
?>
<div class="warning">Failed to add realm</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
} else {
?>
<div class="warning">Need a realm name!</dv>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Radius Realms Attribute Add
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to realm list" => "realms-main.php"
),
));
if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add attribute</p>
<form method="post" action="realms-attribute-add.php">
<input type="hidden" name="frmaction" value="add2" />
<table class="entry">
<tr>
<td class="entrytitle">Attribute Name</td>
<td><input type="text" name="attr_name" /></td>
</tr>
<tr>
<td class="entrytitle">Operator</td>
<td>
<select name="attr_operator">
<option value="=">=</option>
<option value="==">==</option>
<option value=":=">:=</option>
<option value="+=">+=</option>
<option value="!=">!=</option>
<option value=">">&gt;</option>
<option value="<">&lt;</option>
<option value=">=">&gt;=</option>
<option value="<=">&lt;=</option>
<option value="=~">=~</option>
<option value="!~">!~</option>
<option value="=*">=*</option>
<option value="!*">!*</option>
<option value="||=">||=</option>
<option value="||==">||==</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle">Value</td>
<td><input type="text" name="attr_value" /></td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="realms_id" value="<?php echo $_POST['realms_id']; ?>" />
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} 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 {
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}realm_attributes (RealmID,Name,Operator,Value) VALUES (?,?,?,?)");
$res = $stmt->execute(array(
$_POST['realms_id'],
$_POST['attr_name'],
$_POST['attr_operator'],
$_POST['attr_value']
));
if ($res !== FALSE) {
?>
<div class="notice">Attribute added</div>
<?php
} else {
?>
<div class="warning">Failed to add attribute</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Radius Realms Attribute Change
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to realm list" => "realms-main.php",
),
));
# 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}realm_attributes WHERE ID = ".$db->quote($_POST['attr_id']);
$res = $db->query($sql);
$row = $res->fetchObject();
?>
<p class="pageheader">Update Realm Attribute</p>
<form action="realms-attribute-change.php" method="post">
<input type="hidden" name="frmaction" value="change2" />
<input type="hidden" name="attr_id" value="<?php echo $_POST['attr_id']; ?>" />
<table class="entry" style="width: 75%;">
<tr>
<td></td>
<td class="entrytitle textcenter">Old Value</td>
<td class="entrytitle textcenter">New Value</td>
</tr>
<tr>
<td class="entrytitle texttop">
Name
</td>
<td class="oldval texttop"><?php echo $row->name; ?></td>
<td><textarea name="realm_attributes_name" cols="40" rows="1"></textarea></td>
</tr>
<tr>
<td class="entrytitle texttop">
Operator
</td>
<td class="oldval texttop"><?php echo $row->operator; ?></td>
<td>
<select name="realm_attributes_operator">
<option value="=">=</option>
<option value="==">==</option>
<option value=":=">:=</option>
<option value="+=">+=</option>
<option value="!=">!=</option>
<option value=">">&gt;</option>
<option value="<">&lt;</option>
<option value=">=">&gt;=</option>
<option value="<=">&lt;=</option>
<option value="=~">=~</option>
<option value="!~">!~</option>
<option value="=*">=*</option>
<option value="!*">!*</option>
<option value="||=">||=</option>
<option value="||==">||==</option>
</select>
</td>
</tr>
<tr>
<td class="entrytitle texttop">Value</td>
<td class="oldval texttop"><?php echo $row->value; ?></td>
<td><textarea name="realm_attributes_value" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="entrytitle">Disabled</td>
<td class="oldval"><?php echo $row->disabled ? 'yes' : 'no'; ?></td>
<td>
<select name="realm_attributes_disabled" />
<option value="">--</option>
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</td>
</tr>
</table>
<p />
<div class="textcenter">
<input type="submit" />
</div>
</form>
<?php
$res->closeCursor();
} 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
if (isset($_POST['attr_id'])) {
$updates = array();
if (!empty($_POST['realm_attributes_name'])) {
array_push($updates,"Name = ".$db->quote($_POST['realm_attributes_name']));
}
if (isset($_POST['realm_attributes_operator']) && $_POST['realm_attributes_operator'] != "") {
array_push($updates,"Operator = ".$db->quote($_POST['realm_attributes_operator']));
}
if (!empty($_POST['realm_attributes_value'])) {
array_push($updates,"Value = ".$db->quote($_POST['realm_attributes_value']));
}
if (isset($_POST['realm_attributes_disabled']) && $_POST['realm_attributes_disabled'] != "") {
array_push($updates ,"Disabled = ".$db->quote($_POST['realm_attributes_disabled']));
}
# Check if we have updates
if (sizeof($updates) > 0) {
$updateStr = implode(', ',$updates);
$res = $db->exec("
UPDATE
${DB_TABLE_PREFIX}realm_attributes
SET
$updateStr
WHERE
ID = ".$db->quote($_POST['attr_id']."
"));
if ($res !== FALSE) {
?>
<div class="notice">Attribute updated</div>
<?php
} else {
?>
<div class="warning">Error updating attribute</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
# Warn
} else {
?>
<div class="warning">No attribute updates</div>
<?php
}
# Warn
} else {
?>
<div class="error">No attribute data available</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Radius Realms Attribute Delete
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to realm list" => "realms-main.php",
),
));
# 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="realms-attribute-delete.php" method="post">
<div>
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="attr_id" value="<?php echo $_POST['attr_id']; ?>" />
</div>
<div class="textcenter">
Are you very sure? <br />
<input type="submit" name="confirm" value="yes" />
<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
if (isset($_POST['attr_id'])) {
# And make sure user confirmed
if (isset($_POST['confirm']) && $_POST['confirm'] == "yes") {
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}realm_attributes WHERE ID = ".$db->quote($_POST['attr_id']));
if ($res !== FALSE) {
?>
<div class="notice">Attribute with ID: <?php print_r($_POST['attr_id']);?> deleted</div>
<?php
} else {
?>
<div class="warning">Error deleting attribute</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
# Warn
} else {
?>
<div class="warning">Delete attribute aborted</div>
<?php
}
} else {
?>
<div class="warning">Invocation error, no attribute ID selected</div>
<?php
}
}
printFooter();
# vim: ts=4
?>
<?php
# Radius Realm Attributes
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to realm list" => "realms-main.php"
),
));
?>
<p class="pageheader">Attribute List</p>
<form id="main_form" action="realms-attributes.php" method="post">
<div class="textcenter">
Action
<select id="main_form_action" name="frmaction"
onchange="
var myform = document.getElementById('main_form');
var myobj = document.getElementById('main_form_action');
if (myobj.selectedIndex == 2) {
myform.action = 'realms-attribute-add.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'realms-attribute-change.php';
} else if (myobj.selectedIndex == 3) {
myform.action = 'realms-attribute-delete.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add Attribute</option>
<option value="delete">Delete Attribute</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="change">Change Attribute</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td class="textcenter">ID</td>
<td class="textcenter">Name</td>
<td class="textcenter">Operator</td>
<td class="textcenter">Value</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
if (isset($_POST['realms_id'])) {
$sql = "
SELECT
ID,
Name,
Operator,
Value,
Disabled
FROM
${DB_TABLE_PREFIX}realm_attributes
WHERE
RealmID = ".$db->quote($_POST['realms_id'])."
ORDER BY
Name
";
$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>
<td><?php echo $row->operator; ?></td>
<td><?php echo $row->value; ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no'; ?></td>
</tr>
<?php
}
$res->closeCursor();
if ($res->rowCount() == 0) {
?>
<p />
<tr>
<td colspan="5" class="textcenter">Realm attribute list is empty</td>
</tr>
<?php
}
?>
<input type="hidden" name="realms_id" value="<?php echo $_POST['realms_id']; ?>" />
<?php
} else {
?>
<tr class="resultitem">
<td colspan="5" class="textcenter">No realm ID selected</td>
</tr>
<?php
}
?>
</table>
</form>
<?php
printFooter();
# vim: ts=4
?>
<?php
# Radius Realms Delete
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to realms" => "realms-main.php",
),
));
# Display delete confirm screen
if (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete") {
# Check a policy group was selected
if (isset($_POST['realms_id'])) {
?>
<p class="pageheader">Delete Realm</p>
<form action="realms-delete.php" method="post">
<input type="hidden" name="frmaction" value="delete2" />
<input type="hidden" name="realms_id" value="<?php echo $_POST['realms_id']; ?>" />
<div class="textcenter">
Are you very sure? <br />
<input type="submit" name="confirm" value="yes" />
<input type="submit" name="confirm" value="no" />
</div>
</form>
<?php
} else {
?>
<div class="warning">No realm selected</div>
<?php
}
# SQL Updates
} elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "delete2") {
?>
<p class="pageheader">Realm Delete Results</p>
<?php
if (isset($_POST['realms_id'])) {
if (isset($_POST['confirm']) && $_POST['confirm'] == "yes") {
$db->beginTransaction();
$res = $db->exec("
DELETE FROM
${DB_TABLE_PREFIX}realm_attributes
WHERE
RealmID = ".$db->quote($_POST['realms_id'])."
");
if ($res !== FALSE) {
?>
<div class="notice">Realm attributes removed</div>
<?php
} else {
?>
<div class="warning">Error removing realm attributes</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
if ($res !== FALSE) {
$res = $db->exec("
DELETE FROM
${DB_TABLE_PREFIX}realms
WHERE
ID = ".$db->quote($_POST['realms_id'])."
");
if ($res !== FALSE) {
?>
<div class="notice">Realm removed</div>
<?php
} else {
?>
<div class="warning">Error removing realm attributes</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php
}
}
# Check if all is ok, if so, we can commit, else must rollback
if ($res !== FALSE) {
$db->commit();
?>
<div class="notice">Changes comitted.</div>
<?php
} else {
$db->rollback();
?>
<div class="notice">Changes reverted.</div>
<?php
}
} else {
?>
<div class="notice">Realm not deleted, aborted by user</div>
<?php
}
# Warn
} else {
?>
<div class="warning">Invocation error, no realm ID</div>
<?php
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>
<?php
# Radius Realms Main
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
$db = connect_db();
printHeader(array(
));
?>
<p class="pageheader">Realms</p>
<form id="main_form" action="realms-main.php" method="post">
<div class="textcenter">
Action
<select id="main_form_action" name="frmaction"
onchange="
var myform = document.getElementById('main_form');
var myobj = document.getElementById('main_form_action');
if (myobj.selectedIndex == 2) {
myform.action = 'realms-add.php';
} else if (myobj.selectedIndex == 3) {
myform.action = 'realms-delete.php';
} else if (myobj.selectedIndex == 5) {
myform.action = 'realms-attributes.php';
}
myform.submit();
">
<option selected="selected">select action</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="add">Add Realm</option>
<option value="delete">Delete Realm</option>
<option disabled="disabled"> - - - - - - - - - - - </option>
<option value="members">Attributes</option>
</select>
</div>
<p />
<table class="results" style="width: 75%;">
<tr class="resultstitle">
<td class="textcenter">ID</td>
<td class="textcenter">Name</td>
<td class="textcenter">Disabled</td>
</tr>
<?php
$sql = "SELECT ID, Name, Disabled FROM ${DB_TABLE_PREFIX}realms ORDER BY ID";
$res = $db->query($sql);
if ($res->rowCount() > 0) {
while ($row = $res->fetchObject()) {
?>
<tr class="resultsitem">
<td><input type="radio" name="realms_id" value="<?php echo $row->id; ?>" /></td>
<td><?php echo $row->name; ?></td>
<td class="textcenter"><?php echo $row->disabled ? 'yes' : 'no'; ?></td>
</tr>
<?php
}
} else {
?>
<p />
<tr>
<td colspan="5" class="textcenter">Realms list is empty</td>
</tr>
<?php
}
$res->closeCursor();
?>
</table>
</form>
<?php
printFooter();
# vim: ts=4
?>
/*
*
* Web interfce stylesheet
* Copyright (C) 2007-2009, AllWorldIT
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
body{
color:#999999;
font-family: Arial, Sans-Serif;
}
/*
* Main table
*/
#maintable {
width: 100%;
}
/*
* Header
*/
#header{
background: #000000 url('images/bg.jpg') bottom center repeat-x;
text-align: center;
font-size: 150%;
font-weight: bold;
}
/*
* Left hand menu
*/
#menu {
background-image: url("images/strips_onside.jpg");
background-repeat: repeat-y;
vertical-align: top;
}
#menu img {
border: none;
}
#menu p {
padding-right: 10px;
margin-left: 5px;
color:#888;
}
#menu a:link, a:visited {
color:#888;
text-decoration: none;
}
#menu a:hover, a:active {
color:#FF6666;
}
#menu ul {
margin-top: 0px;
list-style: url(images/bullet.jpg) disc;
}
#menu p {
font-size: 110%;
font-weight: bold;
margin-bottom: 0;
margin-top: 10px;
}
/*
* Footer
*/
#footer{
background: #000000 url('images/bg.jpg') top center repeat-x;
text-align: center;
font-weight: bold;
}
#footer a, a:link {
color: #999999;
text-decoration: none;
}
#footer a:hover {
color: #A5CE77;
text-decoration: none;
}
#footerimages {
border: none;
text-align: center;
}
/*
* Top Menu (tabs)
*/
#topmenu ul {
margin: 0;
padding: 0 0 0 0;
list-style: none;
}
#topmenu li {
display: inline;
margin: 0;
padding: 0;
}
#topmenu a {
float: left;
background: url(images/menuleft.gif) no-repeat left top;
margin: 0 5px 0 0;
padding: 0 0 0 4px;
text-decoration: none;
}
#topmenu a span {
float: left;
display: block;
background: url(images/menuright.gif) no-repeat right top;
padding: 5px 15px 4px 6px;
color: #000888;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
#topmenu a span {
float: none;
}
/* End IE5-Mac hack */
#topmenu a:hover span {
color: #999999;
}
#topmenu a:hover {
background-position: 0% -42px;
}
#topmenu a:hover span {
background-position: 100% -42px;
}
/*
* Main content
*/
.content {
width: 100%;
vertical-align: top;
}
/*
* Main window content
*/
.pageheader {
background-color: #999999;
color: #000000;
width: 100%;
border: 1px solid black;
text-align: center;
font-weight: bold;
font-size: 110%;
}
/*
* Results table
*/
.results {
border: none;
margin-left: auto;
margin-right: auto;
}
.resultstitle td {
font-weight: bolder;
border: 1px solid black;
padding-left: 5px;
padding-right: 5px;
}
.resultsitem td {
border-bottom: 1px dashed black;
}
/*
* Entry tables
*/
.entry {
border: solid black 1px;
margin-left: auto;
margin-right: auto;
}
.entrytitle {
font-weight: bolder;
}
.oldval {
background-color: #eeeeee;
}
/*
* Misc
*/
.texttop {
vertical-align: top;
}
.textcenter {
text-align: center;
}
#noborder {
border: none;
}
a.help img {
border: none;
}
#tooltip {
position: absolute;
z-index: 200;
}
/*
* vim: ts=4
*/
/*Javascript for Bubble Tooltips by Alessandro Fulciniti
http://pro.html.it - http://web-graphics.com */
function enableTooltips(id,element){
var links,i,h;
if (!element) element = "a";
if(!document.getElementById || !document.getElementsByTagName) return;
AddCss();
h=document.createElement("span");
h.id="btc";
h.setAttribute("id","btc");
h.style.position="absolute";
document.getElementsByTagName("body")[0].appendChild(h);
if(id==null) links=document.getElementsByTagName(element);
else links=document.getElementById(id).getElementsByTagName(element);
for(i=0;i<links.length;i++){
Prepare(links[i]);
}
}
function Prepare(el){
var tooltip,t,b,s,l;
t=el.getAttribute("title");
//if(t==null || t.length==0) t="link:";
if (t == null) return;
el.removeAttribute("title");
tooltip=CreateEl("span","tooltip");
s=CreateEl("span","top");
s.appendChild(document.createTextNode(t));
tooltip.appendChild(s);
b=CreateEl("b","bottom");
//l=el.getAttribute("href");
//if(l.length>28) l=l.substr(0,25)+"...";
//b.appendChild(document.createTextNode(l));
//b.appendChild(document.createTextNode("hello world"));
tooltip.appendChild(b);
setOpacity(tooltip);
el.tooltip=tooltip;
el.onmouseover=showTooltip;
el.onmouseout=hideTooltip;
el.onmousemove=Locate;
}
function showTooltip(e){
document.getElementById("btc").appendChild(this.tooltip);
Locate(e);
}
function hideTooltip(e){
var d=document.getElementById("btc");
if(d.childNodes.length>0) d.removeChild(d.firstChild);
}
function setOpacity(el){
el.style.filter="alpha(opacity:95)";
el.style.KHTMLOpacity="0.95";
el.style.MozOpacity="0.95";
el.style.opacity="0.95";
}
function CreateEl(t,c){
var x=document.createElement(t);
x.className=c;
x.style.display="block";
return(x);
}
function AddCss(){
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","tooltips/bt.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}
function Locate(e){
var posx=0,posy=0;
if(e==null) e=window.event;
if(e.pageX || e.pageY){
posx=e.pageX; posy=e.pageY;
}
else if(e.clientX || e.clientY){
if(document.documentElement.scrollTop){
posx=e.clientX+document.documentElement.scrollLeft;
posy=e.clientY+document.documentElement.scrollTop;
}
else{
posx=e.clientX+document.body.scrollLeft;
posy=e.clientY+document.body.scrollTop;
}
}
document.getElementById("btc").style.top=(posy+10)+"px";
document.getElementById("btc").style.left=(posx-20)+"px";
}
.tooltip {
width: 200px;
color: #00000;
font: 11px Arial, sans-serif;
font-weight: bold;
text-decoration: none;
text-align: center
}
.tooltip span.top {
padding: 30px 8px 0;
background: url(bt.gif) no-repeat top;
}
.tooltip b.bottom {
padding:3px 8px 15px;
color: #548912;
background: url(bt.gif) no-repeat bottom;
}
webui/tooltips/bt.gif

1.55 KiB

<?php
# Radius User Add
# Copyright (C) 2007-2009, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
include_once("includes/header.php");
include_once("includes/footer.php");
include_once("includes/db.php");
include_once("includes/tooltips.php");
$db = connect_db();
printHeader(array(
"Tabs" => array(
"Back to user list" => "user-main.php"
),
));
if (isset($_POST['frmaction']) && $_POST['frmaction'] == "add") {
?>
<p class="pageheader">Add user</p>
<form method="post" action="user-add.php">
<div>
<input type="hidden" name="frmaction" value="add2" />
</div>
<table class="entry">
<tr>
<td class="entrytitle">Username</td>
<td><input type="text" name="user_name" /></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
<?php
# Check we have all params
} elseif (isset($_POST['frmaction']) && $_POST['frmaction'] == "add2") {
?>
<p class="pageheader">User Add Results</p>
<?php
# Check name
if (empty($_POST['user_name'])) {
?>
<div class="warning">Username cannot be empty</div>
<?php
}
else if (!preg_match('/^[a-z0-9]+$/i', $_POST['user_name'])) {
?>
<div class="warning">Username invalid: must be alphanumeric</div>
<?php
# Add to database
} else {
$stmt = $db->prepare("INSERT INTO ${DB_TABLE_PREFIX}users (Username) VALUES (?)");
$res = $stmt->execute(array(
$_POST['user_name'],
));
# Was it successful?
if ($res) {
?>
<div class="notice">User added</div>
<?php
} else {
?>
<div class="warning">Failed to add user</div>
<div class="warning"><?php print_r($stmt->errorInfo()) ?></div>
<?php
}
}
} else {
?>
<div class="warning">Invalid invocation</div>
<?php
}
printFooter();
# vim: ts=4
?>