1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173
|
<?php
// IPplan v4.92a
// Aug 24, 2001
//
// 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
require_once("../ipplanlib.php");
require_once("../adodb/adodb.inc.php");
require_once("../class.dbflib.php");
require_once("../layout/class.layout");
require_once '../menus/lib/PHPLIB.php';
require_once '../menus/lib/layersmenu-common.inc.php';
require_once '../menus/lib/treemenu.inc.php';
require_once("../auth.php");
$auth = new BasicAuthenticator(ADMINREALM, REALMERROR);
$auth->addUser(ADMINUSER, ADMINPASSWD);
// And now perform the authentication
$auth->authenticate();
// set language
isset($_COOKIE["ipplanLanguage"]) && myLanguage($_COOKIE['ipplanLanguage']);
newhtml($p);
$myWwwPath='../menus/';
$w=myheading($p,my_("User Manager"));
insert($w, generic("link",array("rel"=>"stylesheet","href"=>"$myWwwPath"."layerstreemenu.css")));
insert($w, generic("link",array("rel"=>"stylesheet","href"=>"$myWwwPath"."layerstreemenu-hidden.css")));
insert($w, script("",array("language"=>"JavaScript","type"=>"text/javascript","src"=> $myWwwPath . 'libjs/layerstreemenu-cookies.js')));
//Make this a stylesheet soon.
insert($w, $t=table(
array(
"cols" =>"2",
"width" =>"100%",
"border" =>"1",
"cellspacing" =>"2",
"frame" =>"void",
"rules" =>"ALL",
"cellpadding" =>"5")));
// Create the view and editor containers.
insert($t, $view = cell(array("align"=>"left" ,"width"=>"27%" ,"valign"=>"top")));
insert($t, $editor1= cell(array("align"=>"left" ,"width"=>"73%" ,"valign"=>"top")));
insert($editor1, $editor = container("div",array("class"=>"usermanager")));
// We just do this once and pass the variable around.
$ds=new IPplanDbf() or myError($w,$p, my_("Could not connect to database"));
// Next we check to see if the POST variables have been sent.
// If so we handle this first.
// For example, if we change the user information,
// we want this to be immediately reflected in the user/group control in
// the left hand part of the screen.
list($action)=myRegister("S:action");
$formerror="";
if ($_GET || $_POST) {
if ($action == "deletegroupboundary") { $formerror .= parseDeleteBounds($editor,$ds); }
if ($action == "parsecreateuserform") { $formerror .= parseCreateUserForm($editor, $ds); }
if ($action == "parsecreategroupform") { $formerror .= parseCreateGroupForm($editor, $ds); }
if ($action == "deleteuser") { $formerror .= parseDeleteForms($editor, $ds); }
if ($action == "deletegroup") { $formerror .= parseDeleteForms($editor, $ds); }
if ($action == "deleteuserfromgroup") { $formerror .= parseDeleteUserFromGroup($editor, $ds); }
if ($action == "changeuserpw") { $formerror .= parseChangeUserPassword($editor, $ds); }
if ($action == "addusertogroup") { $formerror .= parseAddUserToGroupForm($editor,$ds); }
if ($action == "modifygroup") { $formerror .= parseModifyGroupForm($editor, $ds); }
if ($action == "modifyuser") { $formerror .= parseModifyUserForm($editor, $ds); }
if ($action == "addgroupboundary") { $formerror .= parseAddGroupBoundaryForm($editor, $ds);}
}
list($usersearch)=myRegister("S:usersearch");
$MENU="";
// This generates the results for the search bar.
if ($usersearch != "") {
$result=&$ds->ds->Execute("SELECT userid, userdescrip
FROM users
WHERE userid LIKE ".$ds->ds->qstr("%".$usersearch."%")
." OR userdescrip LIKE ".$ds->ds->qstr("%".$usersearch."%"));
$MENU=".|".my_("Search Result")."\n";
$count=0;
while ($row = $result->FetchRow()) {
$MENU .="..|".$row["userid"]."|".$_SERVER["PHP_SELF"]."?action=usereditform&userid=".$row["userid"]."\n";
$count++;
}
if ($count==0) {$MENU .="..|".my_("No Matches Found")."\n";}
}
$result=&$ds->ds->Execute("SELECT userid, grp
FROM usergrp
ORDER BY grp");
// Build a group mapper.
$lst=array();
$mgrp="";
$muid="";
while($row = $result->FetchRow()) {
$mgrp=$row["grp"];
$muid=$row["userid"];
if (isset($lst["$mgrp"])) {
$lst["$mgrp"] .= "...|$muid|".$_SERVER["PHP_SELF"]."?action=usereditform&userid=$muid"."\n";
}
else {
$lst["$mgrp"] = "...|$muid|".$_SERVER["PHP_SELF"]."?action=usereditform&userid=$muid"."\n";
}
}
// We now have a list of each userid->grp mapping...
$result=$ds->GetGrps();
$cnt=0;
while ($row = $result->FetchRow()) {
if ($cnt++ == 0) {
$MENU.=".|".my_("All Groups")."\n";
}
$grp=$row["grp"];
$MENU .= "..|$grp|".$_SERVER["PHP_SELF"]."?action=groupeditform&grp=".$row["grp"]."\n";
if (array_key_exists($grp,$lst)) {
$MENU .= $lst[$grp];
}
else {
$MENU .= "...|".my_("No users in group")."\n";
}
}
if ($cnt == 0) {
$MENU .= ".|No groups have been created.\n";
}
$result=&$ds->ds->Execute("SELECT users.userdescrip, users.userid
FROM users
LEFT JOIN usergrp
ON users.userid = usergrp.userid
WHERE usergrp.userid IS NULL
ORDER BY users.userid");
$cnt=0;
while($row = $result->FetchRow()) {
if ($cnt++ == 0) {
$MENU.=".|".my_("Orphan Users")."\n";
}
$MENU .="..|".$row["userid"]."|".$_SERVER["PHP_SELF"]."?action=usereditform&userid=".$row["userid"]."\n";
}
insert($view, block("<center><b>".my_("Current Users/Groups")."</b></center>"));
insert($view, $cc = container("center"));
insert($cc,block("| "));
insert($cc,anchor($_SERVER["PHP_SELF"]."?action=newuserform",
my_("New User")));
insert($cc,block(" | "));
insert($cc,anchor($_SERVER["PHP_SELF"]."?action=newgroupform",
my_("New Group")));
insert($cc,block(" |"));
//insert($view, $cc = container("center"));
insert($view, $searchform = form(array("method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($searchform, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($legend, text(my_("Search")));
insert($con,input_text(array("name"=>"usersearch",
"value"=>"$usersearch",
"size"=>"20",
"maxlength"=>"40")));
insert($con,submit(array("value"=>my_("Search"))));
insert($view, textb(my_("Edit Users/Groups")));
insert($view, textbr());
insert($view, block("<i>".my_("Click on a group or user")."</i>"));
$mid = new TreeMenu();
$mid->setDirroot('../menus');
$mid->setLibjsdir('../menus/libjs/');
$mid->setImgdir('../menus/menuimages/');
$mid->setImgwww('../menus/menuimages/');
$mid->setIcondir('../menus/menuicons/');
$mid->setIconwww('../menus/menuicons/');
$mid->SetMenuStructureString($MENU);
$mid->setIconsize(16, 16);
$mid->parseStructureForMenu('treemenu1');
$mid->newTreeMenu('treemenu1');
insert($view, block($mid->getTreeMenu('treemenu1')));
insert($view, block('<br><br>'));
// If any of the parsing generates an error, we insert that error and then reinsert the form that generated the error.
// The two group functions can come from multiple forms so we don't bother.
// Since all the possible inputs are generated by the code this should rarely happen anyways
// (assuming this is all bug free ;)
if ($formerror != "") {
myError($editor,$p,$formerror,FALSE);
if ($action == "parsecreateuserform") { insertCreateUserForm($editor, $ds); }
if ($action == "parsecreategroupform") { insertCreateGroupForm($editor, $ds); }
if ($action == "deleteuser") { insertEditUserForm($editor, $ds); }
if ($action == "deletegroup") { insetrEditGroupForm($editor, $ds); }
if ($action == "deleteuserfromgroup") { /* done in function with ref var */ }
if ($action == "changeuserpw") { insertEditUserForm($editor, $ds); }
if ($action == "modifyuser") { insertEditUserForm($editor, $ds); }
if ($action == "addusertogroup") { }
if ($action == "modifygroup") { insertEditGroupForm($editor, $ds); }
if ($action == "addgroupboundary") { insertEditGroupForm($editor, $ds); }
if ($action == "changeuserpw") { insertEditUserForm($editor, $ds); }
}
// Ok From here Everything is all set to go. We've built the tree menu thingy and now we're looking
// Check for actions passed as a POST.
if ($action) {
if ($action == "usereditform" ) { insertEditUserForm($editor,$ds);}
if ($action == "groupeditform") { insertEditGroupForm($editor,$ds);}
if ($action == "newuserform") { insertCreateUserForm($editor,$ds);}
if ($action == "newgroupform") { insertCreateGroupForm($editor);}
}
else {
insert ($editor, block(" "));
}
printhtml($p); // The code should exit after this line.
////
// START FUNCTIONS
function insertCreateGroupForm($w) {
list($grp, $grpdescrip,$createcust, $grpview)=myRegister("S:grp S:grpdescrip S:createcust S:grpview");
$grp=trim($grp);
$grpdescrip=trim($grpdescrip);
insert($w, $f = form(array("method"=>"post",
"action"=>$_SERVER["PHP_SELF"])));
insert($f, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($f, generic("br"));
insert($legend, text(my_("Create group")));
insert($con,hidden(array("name"=>"action","value"=>"parsecreategroupform")));
insert($con,textbr(my_("Group name:")));
insert($con,input_text(array("name"=>"grp",
"value"=>"$grp",
"size"=>"40",
"maxlength"=>"40")));
insert($con,textbrbr(my_("Group description:")));
insert($con,input_text(array("name"=>"grpdescrip",
"value"=>"$grpdescrip",
"size"=>"40",
"maxlength"=>"80")));
insert($con, $t=table(array("cols"=>"2","border"=>"0","cellspacing"=>"2","width"=>"100%")));
insert($t, $c=cell());
insert($c,textbrbr(my_("Group can create/modify/delete customers?")));
insert($c,selectbox(array("N"=>my_("No"),
"Y"=>my_("Yes")),
array("name"=>"createcust"),$createcust));
insert($t, $c=cell());
insert($c,textbrbr(my_("Group can view any customers data?")));
insert($c,selectbox(array("Y"=>my_("Yes"),
"N"=>my_("No")),
array("name"=>"grpview"),$grpview));
insert($f,submit(array("value"=>my_("Create group"))));
}
// Changed function to allow the user to be passed as a variable.
// This is the easiest/cleanest way to enable passing the userid
// after an action has been parsed and we want to redisplay the
// same screen for user ease.
function insertEditUserForm($w,$ds) {
list($ipaddr, $userid, $grp, $grpdescrip, $createcust, $grpview) = myRegister("S:ipaddr S:userid S:grp S:grpdescrip S:createcust S:grpview");
$grp=trim($grp);
$grpdescrip=trim($grpdescrip);
$result=&$ds->ds->Execute("SELECT * FROM users WHERE userid=".$ds->ds->qstr($userid));
if ($result) {
$row=$result->FetchRow();
}
// First off we insert the user information and delete button.
insert($w, $t=table(array("cols"=>"2","border"=>"0","cellspacing"=>"2","width"=>"100%")));
insert($t, $c=cell());
insert($c ,block("<b>"));
insert($c ,text(my_("Editing User: ").$userid));
insert($c ,block("</b><br>"));
insert($c, block("<i>"));
insert($c, text(my_("Real Name: ").$row["userdescrip"]));
insert($c, block("</i><br>"));
insert($c, text(my_("e-mail: ").$row["useremail"]));
insert($t, $c=cell(array("align"=>"right")));
insert($c, $f = form(array("method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f,hidden(array("name"=>"action","value"=>"deleteuser")));
insert($f,hidden(array("name"=>"userid" ,"value"=>"$userid")));
insert($f,submit(array("value"=>my_("Delete User"))));
// Modify User Form
insert($w, $f1 = form(array("method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f1, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($legend, text(my_("Modify user")));
insert($con,hidden(array("name"=>"userid" ,"value"=>"$userid")));
insert($con,hidden(array("name"=>"action","value"=>"modifyuser")));
insert($con,textbr(my_("Real Name: ")));
insert($con,input_text(array("name"=>"userdescrip","value"=>$row["userdescrip"],"size"=>"80","maxlength"=>"80")));
insert($con,generic("br"));
insert($con,textbr(my_("E-mail address:")));
insert($con,input_text(array("name"=>"useremail","value"=>$row["useremail"],"size"=>"80","maxlength"=>"64")));
insert($con,generic("br"));
insert($con,generic("br"));
insert($con,submit(array("value"=>my_("Update"))));
insert($con,generic("br"));
// Next we add the change password form.
insert($w, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($legend, text(my_("Change Password")));
insert($con, $pwform = form(array("method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($pwform,hidden(array("name"=>"userid","value"=>"$userid")));
insert($pwform,hidden(array("name"=>"action","value"=>"changeuserpw")));
insert($pwform,textbr(my_("New password (case sensitive!):")));
insert($pwform,password(array("name"=>"password1",
"size"=>"40",
"maxlength"=>"40")));
insert($pwform,textbrbr(my_("New password (again):")));
insert($pwform,password(array("name"=>"password2",
"size"=>"40",
"maxlength"=>"40")));
insert($pwform,generic("br"));
insert($pwform,submit(array("value"=>my_("Change Password"))));
insert($w,generic("br"));
// START Add User to Group
$result2=$ds->GetGrps();
$lst=array();
$c=0;
while($row = $result2->FetchRow()) {
$col=$row["grp"];
$lst["$col"]=$row["grp"];
$c++;
}
// We count how many groups exist....
// and add group code if necessary.
if ($c > 0) {
insert($w, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($legend, text(my_("Groups")));
insert($con, $f2 = form(array("method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f2,hidden(array("name"=>"action","value"=>"addusertogroup")));
insert($f2,hidden(array("name"=>"refpage","value"=>"user")));
insert($f2,hidden(array("name"=>"userid" ,"value"=>"$userid")));
insert($f2,selectbox($lst, array("name"=>"grp")));
insert($f2,submit(array("value"=>my_("Add User to Group"))));
// START User Group Listing
// Here we check to see if any of the user is
// in any groups and if so we print them out
// in a table and allow the user to delete them.
insert($con, generic("br"));
$result=&$ds->ds->Execute("SELECT * FROM usergrp WHERE userid=".$ds->ds->qstr($userid));
$lst=array();
while($row = $result->FetchRow()) {
$col=$row["grp"];
$lst["$col"]=$row["grp"];
}
if (!empty($lst)) {
insert($con, $t = table(array("cols"=>"2","border"=>"0","cellspacing"=>"0")));
// draw heading
insert($t,$c = cell());
insert($c,text(my_("Group Membership")));
insert($t,$c = cell());
$count=0;
foreach($lst as $g) {
$count++;
insert($t,$c=cell());
insert($c,block("$g"));
insert($t,$c=cell());
insert($c,$f= form(array("name"=>"userkill$count","method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f,hidden(array("name"=>"action","value"=>"deleteuserfromgroup")));
insert($f,hidden(array("name"=>"userid" ,"value"=>"$userid")));
insert($f,hidden(array("name"=>"grp" ,"value"=>"$g")));
insert($f,hidden(array("name"=>"refpage","value"=>"user")));
insert($f,block("<a href='#' onclick='userkill$count.submit();'>".my_(" Remove From Group")."</a>"));
}
}
}
insert($w, generic("br"));
}
function insertEditGroupForm($w,$ds) {
list($ipaddr, $size, $grp) = myRegister("S:ipaddr S:size S:grp");
$result=&$ds->ds->Execute("SELECT * FROM grp WHERE grp=".$ds->ds->qstr($grp));
$row=$result->FetchRow();
$grpdescrip=$row["grpdescrip"];
$createcust=$row["createcust"];
$grpopt =$row["grpopt"];
$resaddr =$row["resaddr"];
insert($w, $t=table(array("width"=>"100%","cols"=>"2","border"=>"0","cellspacing"=>"0","valign"=>"middle")));
insert($t, $c = cell());
insert($c, block("<b>"));
insert($c, text(my_("Editing Group:")." $grp"));
insert($c, block("</b><br>"));
insert($c, block("<i>".my_(" Description: ")."</i>"));
insert($c, text($grpdescrip));
insert($w,generic("br"));
insert($t,$c = cell (array("align"=>"right")));
insert($c, $f = form(array("method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f,hidden(array("name"=>"action","value"=>"deletegroup")));
insert($f,hidden(array("name"=>"grp" ,"value"=>"$grp")));
insert($f,submit(array("value"=>my_("Delete Group"))));
// MODIFY GROUP FORM
insert($w, $f1 = form(array("method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f1, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($legend, text(my_("Modify group")));
insert($con,hidden(array("name"=>"grp","value"=>"$grp")));
insert($con,hidden(array("name"=>"action","value"=>"modifygroup")));
insert($con,textbr(my_("Group description:")));
insert($con,input_text(array("name"=>"grpdescrip","value"=>"$grpdescrip","size"=>"80","maxlength"=>"80")));
insert($con,textbrbr(my_("Group can create/modify/delete customers?")));
insert($con,selectbox(array("N"=>my_("No"),
"Y"=>my_("Yes")),
array("name"=>"createcust"),
$createcust));
insert($con,textbrbr(my_("Group can view any customers data?")));
// first bit defines view capability
insert($con,selectbox(array("N"=>my_("No"),
"Y"=>my_("Yes")),
array("name"=>"grpview"),
$grpopt & 1 ? "Y" : "N" ));
insert($con,textbrbr(my_("Number of reserved addresses at start of subnets:")));
insert($con,span(my_("NOTE: if the user belongs to multiple groups and one of the groups does not contain a reserved limit, then the user is allowed all actions"), array("class"=>"textSmall")));
insert($con,input_text(array("name"=>"resaddr",
"value"=>"$resaddr",
"size"=>"4",
"maxlength"=>"4")));
insert($con,generic("br"));
insert($con,generic("br"));
insert($con,submit(array("value"=>my_("Update"))));
insert($con,generic("br"));
// START Add User Form
$result1=&$ds->ds->Execute("SELECT userid
FROM users
ORDER BY userid");
$c=0;
$lst=array();
while($row = $result1->FetchRow()) {
$col=$row["userid"];
$lst["$col"]=$row["userid"];
$c++; // here
}
if ($c > 0) {
insert($w, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($legend, text(my_("User Membership")));
insert($con, $f2 = form(array("name"=>"ENTRY",
"method"=>"post",
"action"=>$_SERVER["PHP_SELF"])));
insert($f2,selectbox($lst, array("name"=>"userid")));
insert($f2,hidden(array("name"=>"action","value"=>"addusertogroup")));
insert($f2,hidden(array("name"=>"refpage","value"=>"grp")));
insert($f2,hidden(array("name"=>"grp","value"=>"$grp")));
insert($f2,submit(array("value"=>my_("Add User"))));
// Edit users assigned to the group.
$result=&$ds->ds->Execute("SELECT * FROM usergrp WHERE grp=".$ds->ds->qstr($grp));
$lst=array();
while($row = $result->FetchRow()) {
$col=$row["userid"];
$lst["$col"]=$row["userid"];
}
if (!empty($lst)) {
insert($con,$t = table(array("cols"=>"2")));
//insert($con,$t = table(array("cols"=>"2", "class"=>"outputtable")));
//setdefault("cell",array("class"=>"heading"));
insert($t,$c = cell());
insert($c,text(my_("Current Members")));
insert($t,$c = cell());
$icecream=0;
foreach($lst as $u) {
//setdefault("cell",array("class"=>color_flip_flop()));
$icecream++;
insert($t,$c=cell());
insert($c,block("$u"));
insert($t,$c=cell());
insert($c,$f= form(array("name"=>"userkill$icecream","method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f,hidden(array("name"=>"action","value"=>"deleteuserfromgroup")));
insert($f,hidden(array("name"=>"userid" ,"value"=>"$u")));
insert($f,hidden(array("name"=>"grp" ,"value"=>"$grp")));
insert($f,hidden(array("name"=>"refpage","value"=>"grp")));
insert($c,block("<a href='#' onclick='userkill$icecream.submit();'>".my_("Remove From Group")."</a>"));
}
}
}
insert($w,generic("br"));
// Ok. How bout adding bounds to the group???
insert($w, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($con,textbr(my_("NOTE: if the user belongs to multiple groups and one of the groups does not contain authority boundaries, then the user is allowed all actions")));
insert($legend, text(my_("Authority Boundaries")));
insert($con, $f2 = form(array("name"=>"ENTRY",
"method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f2,hidden(array("name"=>"grp","value"=>"$grp")));
insert($f2,hidden(array("name"=>"action","value"=>"addgroupboundary")));
insert($f2,text(my_("Authority boundary start address")));
// from previous post?
if ($ipaddr == "0.0.0.0") {
$ipaddr="";
}
insert($f2,input_text(array("name"=>"ipaddr",
"value"=>"$ipaddr",
"size"=>"15",
"maxlength"=>"15")));
insert($f2,generic("br"));
insert($f2,text(my_("Authority size/mask")));
insert($f2,selectbox(array("4"=>"255.255.255.252/30 - 4 hosts",
"8"=>"255.255.255.248/29 - 8 hosts",
"16"=>"255.255.255.240/28 - 16 hosts",
"32"=>"255.255.255.224/27 - 32 hosts",
"64"=>"255.255.255.192/26 - 64 hosts",
"128"=>"255.255.255.128/25 - 128 hosts",
"256"=>"255.255.255.0/24 - 256 hosts (class C)",
"512"=>"255.255.254.0/23 - 512 hosts",
"1024"=>"255.255.252.0/22 - 1k hosts",
"2048"=>"255.255.248.0/21 - 2k hosts",
"4096"=>"255.255.240.0/20 - 4k hosts",
"8192"=>"255.255.224.0/19 - 8k hosts",
"16384"=>"255.255.192.0/18 - 16k hosts",
"32768"=>"255.255.128.0/17 - 32k hosts",
"65536"=>"255.255.0.0/16 - 64k hosts (class B)",
"16777216"=>"255.0.0.0/8 - 16m hosts (class A)"),
array("name"=>"size"),
$size));
insert($f2,submit(array("value"=>my_("Add Boundary"))));
// add readonly button
insert($con, $f2 = form(array("name"=>"READONLY",
"method"=>"post","action"=>$_SERVER["PHP_SELF"])));
insert($f2,hidden(array("name"=>"ipaddr","value"=>"0.0.0.0")));
insert($f2,hidden(array("name"=>"size","value"=>"0")));
insert($f2,hidden(array("name"=>"grp","value"=>"$grp")));
insert($f2,hidden(array("name"=>"action","value"=>"addgroupboundary")));
insert($f2,submit(array("value"=>my_("Read only group"))));
insert($f2, generic("br"));
$result=&$ds->ds->Execute("SELECT boundsaddr, boundssize, grp
FROM bounds
WHERE grp=".$ds->ds->qstr($grp)."
ORDER BY boundsaddr");
// logic here is:
// boundsaddr=0 and boundssize=0 -> then this is a read only group
// boundsaddr=0 and boundssize>0 -> number of addresses this group is not allowed to edit
// at start of subnets
// boundsaddr>1 and boundssize>0 -> normal bounds within which this group can edit subnets
// and ip addresses
$tricky=0;
while($row = $result->FetchRow()) {
// create a table
if ($tricky == 0) {
++$tricky;
insert($con,$t = table(array("cols"=>"3")));
// draw heading
insert($t,$c = cell());
insert($c,text(my_("Current Boundaries")));
insert($t,$c = cell());
insert($t,$c = cell());
}
insert($t,$c = cell());
if ($row["boundsaddr"] == 0) {
insert($c,text(my_("Read only group")));
insert($t,$c = cell());
}
else {
insert($c,text(inet_ntoa($row["boundsaddr"])));
insert($t,$c = cell());
insert($c,text(inet_ntoa(inet_aton(ALLNETS)+1 -
$row["boundssize"])."/".inet_bits($row["boundssize"])));
}
insert($t,$c = cell());
list($ipplanParanoid)=myRegister("I:ipplanParanoid");
insert($c,anchor("usermanager.php?action=deletegroupboundary&grp=".urlencode($row["grp"]).
"&boundsaddr=".$row["boundsaddr"],
my_("Delete boundary"),
$ipplanParanoid ? array("onclick"=>"return confirm('".my_("Are you sure?")."')") : FALSE));
if ($row["boundsaddr"] == 0) {
break;
}
}
insert($w,generic("br"));
}
function insertCreateUserForm($w,$ds) {
list($userid, $userdescrip, $useremail, $grp)= myRegister("S:userid S:userdescrip S:useremail S:grp");
insert($w, $f = form(array("method"=>"post",
"action"=>$_SERVER["PHP_SELF"])));
insert($f,hidden(array("name"=>"action","value"=>"parsecreateuserform")));
insert($f, $con=container("fieldset",array("class"=>"fieldset")));
insert($con, $legend=container("legend",array("class"=>"legend")));
insert($legend, text(my_("Create new user")));
insert($con,textbr(my_("User-id (case sensitive!):")));
insert($con,input_text(array("name"=>"userid",
"value"=>"$userid",
"size"=>"20",
"maxlength"=>"40")));
insert($con,textbrbr(my_("User's fullname:")));
insert($con,input_text(array("name"=>"userdescrip",
"value"=>"$userdescrip",
"size"=>"40",
"maxlength"=>"80")));
insert($con,textbrbr(my_("User's e-mail:")));
insert($con,input_text(array("name"=>"useremail",
"value"=>"$useremail",
"size"=>"40",
"maxlength"=>"64")));
if (AUTH_INTERNAL) {
insert($con,textbrbr(my_("Password (case sensitive!):")));
insert($con,password(array("name"=>"password1",
"size"=>"20",
"maxlength"=>"40")));
insert($con,textbrbr(my_("Password (again):")));
insert($con,password(array("name"=>"password2",
"size"=>"20",
"maxlength"=>"40")));
}
$result2=$ds->GetGrps();
$lst=array(""=>"No group");
while($row = $result2->FetchRow()) {
$col=$row["grp"];
$lst["$col"]=$row["grp"]." - ".$row["grpdescrip"];
}
insert($con,textbrbr(my_("Group")));
insert($con,selectbox($lst,
array("name"=>"grp"),$grp));
insert($f, generic("br"));
insert($f,submit(array("value"=>my_("Create User"))));
insert($f,freset(array("value"=>my_("Clear"))));
}
function parseCreateUserForm($w,$ds) {
list($userid, $userdescrip, $useremail, $password1, $password2, $grp, $search)=myRegister("S:userid S:userdescrip S:useremail S:password1 S:password2 S:grp S:search");
$formerror="";
$userid=trim($userid);
$userdescrip=trim($userdescrip);
$useremail=trim($useremail);
$search=trim($search);
if (AUTH_INTERNAL) {
$password1=trim($password1);
$password2=trim($password2);
}
else {
// generate random password in case user changes authentication
// from external to internal at some point
$password1=$password2=rand(10000, 1000000);
}
if (strlen($userid) < 2 or strlen($userid) > 40) {
$formerror .= my_("The user-id must be longer")."\n";
}
if (strlen($userdescrip) < 2 or strlen($userdescrip) > 80) {
$formerror .= my_("The user description must be longer")."\n";
}
if (strlen($password1) < 5 or strlen($password2) < 5) {
$formerror .= my_("The password entered must be at least five characters")."\n";
}
if ($password1 != $password2) {
$formerror .= my_("The passwords entered do not match")."\n";
}
if (!$formerror) {
$password=crypt($password1, 'xq');
$ds->DbfTransactionStart();
// emulates mysql REPLACE
$result=&$ds->ds->Execute("DELETE FROM users
WHERE userid=".$ds->ds->qstr($userid));
$result=&$ds->ds->Execute("INSERT INTO users
(userid, userdescrip, useremail, password)
VALUES
(".$ds->ds->qstr($userid).",
".$ds->ds->qstr($userdescrip).",
".$ds->ds->qstr($useremail).",
".$ds->ds->qstr($password).")");
// add group if user selected a group other than "No group"
if (!empty($grp)) {
$result=&$ds->ds->Execute("DELETE FROM usergrp
WHERE userid=".$ds->ds->qstr($userid)." AND
grp=".$ds->ds->qstr($grp));
$result=&$ds->ds->Execute("INSERT INTO usergrp
(userid, grp)
VALUES
(".$ds->ds->qstr($userid).",
".$ds->ds->qstr($grp).")");
}
if ($result) {
$ds->DbfTransactionEnd();
if ($ds->ds->Affected_Rows() == 2)
insert($w,text(my_("Existing user overwritten")));
else
insert($w,text(my_("User created")));
insertEditUserForm($w, $ds);
}
else {
$formerror .= my_("User could not be created")."\n";
}
}
return($formerror);
}
function parseCreateGroupForm($w,$ds) {
list($grp, $grpdescrip, $createcust, $grpview, $resaddr) = myRegister("S:grp S:grpdescrip S:createcust S:grpview I:resaddr");
$grp=trim($grp);
$grpdescrip=trim($grpdescrip);
$formerror="";
if (strlen($grp) < 2 or strlen($grp) > 40) {
$formerror .= my_("The group name must be longer")."\n";
}
if ($resaddr < 0 or $resaddr > 9999) {
$formerror .= my_("Reserved addresses out of range")."\n";
}
if (strlen($grpdescrip) < 2 or strlen($grpdescrip) > 80) {
$formerror .= my_("The group description must be longer")."\n";
}
if (ereg("[^[:alnum:]-]", $grp)) {
$formerror .= my_("Only numbers and digits are allowed in the group name")."\n";
}
if (!$formerror) {
$ds->DbfTransactionStart();
// grpopt is a bit encoded field which will contain true/false type
// options on groups - currently only one bit is used to define if
// customers can view others data
// bit 1 : 1 = user can view all customers info
// 0 = user can view only groups customers
$grpbit=0;
if ($grpview == "Y") {
$grpbit=1;
}
$result=&$ds->ds->Execute("INSERT INTO grp
(grp, createcust, grpdescrip, grpopt, resaddr)
VALUES
(".$ds->ds->qstr($grp).",
".$ds->ds->qstr($createcust).",
".$ds->ds->qstr($grpdescrip).",
".$grpbit.", $resaddr)");
if ($result) {
$ds->DbfTransactionEnd();
insert($w,textbr(my_("Group created")));
insertEditGroupForm($w, $ds);
}
else {
$ds->DbfTransactionRollback();
$formerror .= my_("Group could not be created - possibly a duplicate")."\n";
}
}
return($formerror);
}
function parseDeleteUserFromGroup($w, $ds) {
// Added 6/29/2005 to avoid accidentally loosing groups.
list($userid, $grp, $ref)=myRegister("S:userid S:grp S:refpage");
$ds->DbfTransactionStart();
$result=&$ds->ds->Execute("DELETE FROM usergrp
WHERE userid=".$ds->ds->qstr($userid)." AND
grp=".$ds->ds->qstr($grp));
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(my_("User deleted from group")));
if ($ref == "user") {
insertEditUserForm($w, $ds);
}
if ($ref == "grp") {
insertEditGroupForm($w, $ds);
}
}
else {
$formerror .=my_("User could not be deleted from group");
}
}
function parseDeleteForms($w, $ds) {
// NOTE: don't change order of if's!!!
// This code is a crime against humanity and needs to be fixed ASAP.
//
// THIS FUNCTION PARTIALLY DEPRECATED. SEE BELOW.
list($userid, $usergrp, $grp, $ref)=myRegister("S:userid S:usergrp S:grp S:ref");
$formerror="";
// delete a user
if ($userid) {
$ds->DbfTransactionStart();
$result=&$ds->ds->Execute("DELETE FROM users
WHERE userid=".$ds->ds->qstr($userid)) and
$result=&$ds->ds->Execute("DELETE FROM usergrp
WHERE userid=".$ds->ds->qstr($userid));
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(my_("User $userid deleted")));
}
else {
$formerror .=my_("User could not be deleted");
}
}
// THIS SECTION IS DEPRECATED BY DELETEUSERFROMGROUP()
// Left only to be sure we don't break the rest of this.
else if ($usergrp) {
$userid=$usergrp;
$ds->DbfTransactionStart();
$result=&$ds->ds->Execute("DELETE FROM usergrp
WHERE userid=".$ds->ds->qstr($userid)." AND
grp=".$ds->ds->qstr($grp));
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(sprintf(my_("User %s deleted from group"), $userid)));
if ($ref == "user")
insertEditUserForm($w, $ds);
if ($ref == "grp")
insertEditGroupForm($w, $ds);
}
else {
$formerror .=my_("User could not be deleted from group");
}
}
// END DEPRECATION
else if ($grp and !$usergrp) {
// check if grp has customers
$result=&$ds->ds->Execute("SELECT custdescrip
FROM customer
WHERE admingrp=".$ds->ds->qstr($grp));
if ($row=$result->FetchRow()) {
$formerror .=my_("Cannot delete group because the following customers are assigned to the group:");
do {
$formerror .= $row["custdescrip"];
} while($row=$result->FetchRow());
}
// check if grp has subnets
$result=&$ds->ds->Execute("SELECT baseaddr, descrip
FROM base
WHERE admingrp=".$ds->ds->qstr($grp)."
ORDER BY baseaddr");
if ($row=$result->FetchRow()) {
$formerror .= my_("Cannot delete group because the following subnets are assigned to the group:");
do {
$formerror .= inet_ntoa($row["baseaddr"])." - ".$row["descrip"];
} while($row = $result->FetchRow());
}
$ds->DbfTransactionStart();
$result=&$ds->ds->Execute("DELETE FROM grp
WHERE grp=".$ds->ds->qstr($grp)) and
$result=&$ds->ds->Execute("DELETE FROM usergrp
WHERE grp=".$ds->ds->qstr($grp)) and
$result=&$ds->ds->Execute("DELETE FROM bounds
WHERE grp=".$ds->ds->qstr($grp));
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(sprintf(my_("Group %s deleted"), $grp)));
}
else {
$formerror .= my_("Group could not be deleted");
}
} // endif
} // end function
function parseModifyUserForm($w, $ds) {
list($userid, $userdescrip, $useremail) = myRegister("S:userid S:userdescrip S:useremail");
$formerror="";
if ((strlen($useremail) > 0) && (!preg_match('/^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$/', $useremail))) {
$formerror .= my_("Not a valid email address!")."\n";
}
if ($formerror == "" ) {
$ds->DbfTransactionStart();
$result=&$ds->ds->Execute("UPDATE users
SET userdescrip=".$ds->ds->qstr($userdescrip).",
useremail=".$ds->ds->qstr($useremail)."
WHERE userid=".$ds->ds->qstr($userid));
$ds->AuditLog(sprintf(my_("User %s modified"), $userid));
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(my_("User modified")));
insertEditUserForm($w,$ds);
}
else {
$formerror .= my_("User could not be modified")."\n";
}
}
return($formerror);
}
function parseChangeUserPassword($w, $ds) {
list($password1, $password2, $userid) = myRegister("S:password1 S:password2 S:userid");
$formerror="";
if (strlen($password1) < 5 or strlen($password2) < 5) {
$formerror .= my_("The password entered must be at least five characters")."\n";
}
if ($password1 != $password2) {
$formerror .= my_("The passwords entered do not match")."\n";
}
if ($formerror == "" ) { // Whoops, missed this first time through. Otherwise pw changes no matter what.
$password=crypt($password1, 'xq');
$ds->DbfTransactionStart();
$result=&$ds->ds->Execute("UPDATE users
SET password=".$ds->ds->qstr($password)."
WHERE userid=".$ds->ds->qstr($userid));
$ds->AuditLog(sprintf(my_("User %s changed password"), $userid));
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(my_("Password changed")));
insertEditUserForm($w,$ds);
}
else {
$formerror .= my_("Password could not be changed")."\n";
}
}
return($formerror);
}
function parseAddUserToGroupForm($w, $ds) {
$formerror="";
list($userid, $grp, $refpage, $grp)=myRegister("S:userid S:grp S:refpage S:grp");
//REG is from insert($f2,hidden(array("name"=>"refpage","value"=>"user")));
// It lets us reprint the edit page after we parse.
$ds->DbfTransactionStart();
// emulate mysql REPLACE
$result=&$ds->ds->Execute("DELETE FROM usergrp
WHERE userid=".$ds->ds->qstr($userid)." AND
grp=".$ds->ds->qstr($grp));
$result=&$ds->ds->Execute("INSERT INTO usergrp
(userid, grp)
VALUES
(".$ds->ds->qstr($userid).",
".$ds->ds->qstr($grp).")");
if ($result) {
$ds->DbfTransactionEnd();
insert($w,textbr(my_("User added to group")));
if ($refpage == "user")
insertEditUserForm($w, $ds);
if ($refpage == "grp")
insertEditGroupForm($w, $ds);
}
else {
$formerror .= my_("User could not be added to group")."\n";
}
return $formerror;
}
function parseModifyGroupForm($w, $ds) {
$formerror="";
list($grpdescrip, $grp, $grpview, $createcust, $resaddr) = myRegister("S:grpdescrip S:grp S:grpview S:createcust I:resaddr");
$grpdescrip=trim($grpdescrip);
if (strlen($grpdescrip) < 2) {
$formerror .= my_("The group description must be longer")."\n";
}
if ($resaddr < 0 or $resaddr > 9999) {
$formerror .= my_("Reserved addresses out of range")."\n";
}
if (!$formerror) {
$ds->DbfTransactionStart();
// grpopt is a bit encoded field which will contain true/false type
// options on groups - currently only one bit is used to define if
// customers can view others data
$grpbit=0;
if ($grpview=="Y") {
$grpbit=1;
}
$result=&$ds->ds->Execute("UPDATE grp
SET grpdescrip=".$ds->ds->qstr($grpdescrip).",
createcust=".$ds->ds->qstr($createcust).",
grpopt=".$grpbit.",
resaddr=".$resaddr."
WHERE grp=".$ds->ds->qstr($grp));
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(sprintf(my_("Group %s details modified"), $grp)));
insertEditGroupForm($w, $ds);
}
else {
$formerror .= my_("Group details could not be modified")."\n";
}
}
}
function parseAddGroupBoundaryForm($w, $ds) {
list($grp, $ipaddr, $size) = myRegister("S:grp S:ipaddr S:size");
// explicitly cast variables as security measure against SQL injection
$formerror="";
$size=floor($size);
if ($_POST) {
$base=inet_aton($ipaddr);
// creating readonly group?
if ($base == 0 and $size == 0) {
if ($ds->ds->GetOne("SELECT count(*) AS cnt FROM bounds WHERE grp=".$ds->ds->qstr($grp))) {
$formerror .= my_("Boundary cannot be created - overlaps with existing boundary")."\n";
}
}
else {
if (!$ipaddr)
$formerror .= my_("Boundary address may not be blank")."\n";
else if (testIP($ipaddr))
$formerror .= my_("Invalid boundary address")."\n";
else if (!$size)
$formerror .= my_("Size may not be zero")."\n";
else if (TestDuplicateBounds($ds, $base, $size, $grp))
$formerror .= my_("Boundary cannot be created - overlaps with existing boundary")."\n";
if ($size > 1) {
if (TestBaseAddr(inet_aton3($ipaddr), $size)) {
$formerror .= my_("Invalid base address")."\n";
}
}
}
if (!$formerror) {
$ds->DbfTransactionStart();
// the fact that the range is unique prevents the range
// being added to more than one area!
$result=&$ds->ds->Execute("INSERT INTO bounds
(boundsaddr, boundssize, grp)
VALUES
($base, $size, ".$ds->ds->qstr($grp).")");
if ($result) {
$ds->DbfTransactionEnd();
insert($w,textbr(my_("Boundary created")));
insertEditGroupForm($w, $ds);
}
else {
$formerror .= my_("Boundary could not be created")."\n";
}
}
}
return($formerror);
}
function TestDuplicateBounds($ds, $boundsaddr, $boundssize, $grp) {
$result=&$ds->ds->Execute("SELECT boundsaddr
FROM bounds
WHERE (($boundsaddr BETWEEN boundsaddr AND
boundsaddr + boundssize - 1) OR
($boundsaddr < boundsaddr AND
$boundsaddr+$boundssize >
boundsaddr + boundssize - 1)) AND
grp=".$ds->ds->qstr($grp));
if ($result->FetchRow()) {
return 1;
}
}
function parseDeleteBounds($w, $ds) {
list($grp, $boundsaddr) = myRegister("S:grp S:boundsaddr");
$result=&$ds->ds->Execute("DELETE FROM bounds
WHERE grp=".$ds->ds->qstr($grp)." AND boundsaddr=$boundsaddr");
if ($result) {
$ds->DbfTransactionEnd();
insert($w,text(my_("Boundary deleted")));
}
else {
insert($w,text(my_("Boundary could not be deleted")));
}
insertEditGroupForm($w, $ds);
}
?>
|