Files
Testing/mailservices/admin/usermgr/groups.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

152 lines
5.6 KiB
PHP

<?php header('Content-type: text/html; charset=utf-8');
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/mailservices/includes/');
include(PATHTOINCLUDES."base.php");
include(PATHTOINCLUDES."record_set.php");
$dconn=dbconnect2();
$em="";
$_SESSION["user_uri"]="/mailservices/admin/usermgr/groups.php";
$_SESSION["pagename"]="List Groups";
$_SESSION["the_section_location"] = "/mailservices/admin/usermgr/groups.php";
$_SESSION["the_section_container"]="section_content";
$_SESSION["the_tab"]="two";
$_SESSION["group_id"]="";
if(!isset($_SESSION["group_limit"])) {$_SESSION["group_limit"]=20;}
if(!isset($_SESSION["group_offset"])) {$_SESSION["group_offset"]=0;}
if(!isset($_SESSION["group_searchstring"])){$_SESSION["group_searchstring"]="";}
if(isset($_POST["gosearch"])){$_SESSION["group_offset"]=0;}
if(isset($offset)){$_SESSION["group_offset"]=$offset;}
if(isset($_POST["limit"])){$_SESSION["group_limit"]=$_POST["limit"];$_SESSION["group_offset"]=0;}
$limit=$_SESSION["group_limit"];
$offset=$_SESSION["group_offset"];
$conda=" WHERE 1>0";
if(isset($_POST["searchstring"]))
{
$_SESSION["group_searchstring"]=$_POST["searchstring"];
}
if($_SESSION["group_searchstring"] != "")
{
$condb=" AND `groups`.`group` LIKE '".$_SESSION["group_searchstring"]."%'";
}
else
{
$condb="";
}
$sql="SELECT
`groups`.`gid`,
`groups`.`group`,
`groups`.`description`,
`groups`.`rights`
FROM groups
".$conda.$condb."
ORDER BY
`groups`.`group` ASC
LIMIT ".$limit." OFFSET ".$offset;
$result= mysql_query($sql) or $em=$em.mysql_error();
$sql2="SELECT count(gid) AS cgid FROM groups".$conda.$condb;
$rcount=mysql_query($sql2);
$thecount = mysql_result($rcount,0);
mysql_free_result($rcount);
?>
<div id="groups" class="list-container">
<div id="searchform" class="search-form-container">
<form
action="javascript:search_accounts('/mailservices/admin/usermgr/groups.php','content');"
method="post" name="frmsearch" id="frmsearch">
<fieldset>
<label for="searchstring">Group:</label><input type="text"
name="searchstring" id="searchstring" size="20"
value="<?php echo $_SESSION["group_searchstring"]; ?>" /> <label
for="limit">Rows:</label><select name="limit" id="limit">
<option value="1"
<?php if($_SESSION["group_limit"]==1){echo "selected=\"selected\"";} ?>>
1 Row</option>
<option value="5"
<?php if($_SESSION["group_limit"]==5){echo "selected=\"selected\"";} ?>>
5 Rows</option>
<option value="10"
<?php if($_SESSION["group_limit"]==10){echo "selected=\"selected\"";} ?>>
10 Rows</option>
<option value="20"
<?php if($_SESSION["group_limit"]==20){echo "selected=\"selected\"";} ?>>
20 Rows</option>
<option value="50"
<?php if($_SESSION["group_limit"]==50){echo "selected=\"selected\"";} ?>>
50 Rows</option>
</select> <input type="submit" name="gosearch" id="gosearch"
value="Search" class="redbutton search-btn" />
</fieldset>
</form>
</div>
<?php //end searchform ?>
<div id="groups_list" class="list-wrap" style="position:relative">
<h1>Groups <?php echo @$_SESSION["add_group_id"];?>
<span style="float:right;text-align;right;padding:0px 10px 0 10px;letter-spacing:0px;text-shadow:none;">
<?php if(isset($_SESSION["add_group_id"]))
{
if($_SESSION["add_group_id"] != "")
{
$sqlnewgroup="SELECT `groups`.`group` FROM `groups` WHERE `group`.`gid` = ".$_SESSION["add_group_id"];
$querynewgroup=mysql_query($sqlnewgroup) or $em=$em.mysql_error();
$ng=mysql_fetch_assoc($querynewgroup);
}
}
?>
</span>
</h1>
<table width="100%" cellpadding="0" cellspacing="1" id="tb-full"
class="tb-full">
<thead>
<tr>
<th class="th-first">Group</th>
<th align="left">Description</th>
<th class="th-last" style="text-align:right;padding-right:3px;"><a href="#" class="redbutton add-record"
onclick="getmenucontent('/mailservices/admin/usermgr/group_add.php','section_content','admin_tabs','five',this.parentNode,'h')">add&nbsp;group</a></th>
</tr>
</thead>
<tbody>
<?php
$rownum=0;
while ($row = mysql_fetch_assoc($result)) {
$rownum=$rownum+1;
if($rownum % 2 != 0){$rc="#ffff99";} else{$rc="#fff";}
echo "<tr valign=\"top\" style=\"background:".$rc.";vertical-align:top;\" onmouseover=\"this.style.background='#ccffcc';\" onmouseout=\"this.style.background='".$rc."';\" class=\"trr\" valign=\"top\">";
echo "<td nowrap=\"nowrap\" class=\"tdd tdd-first \" style=\"vertical-align:middle;\">".$row["group"]."</td>";
echo "<td width=\"100%\" class=\"tdd\">".$row["description"]."</td>";
echo "<td align=\"right\" nowrap=\"nowrap\" class=\"tdd tdd-last\">";
echo "<image src=\"/images/icons/chat-small.png\" style=\"margin-right:10px;\" /> ";
echo "<a href=\"group_delete.php?gid=".$row["gid"]."\" class=\"delred\">Delete</a> l ";
echo '<a href="#" onclick="getmenucontent(\'/mailservices/admin/usermgr/group_edit.php?gid='.$row["gid"].'\',\'section_content\',\'admin_tabs\',\'six\',this.parentNode,\'h\')">Edit</a></td>';
echo "</tr>";
}
mysql_free_result($result);
if($rownum==0)
{
echo "<tr>";
echo "<td class=\"nrr\" colspan=\"3\">No Records Returned.</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<div style="position:absolute;top:0px;left:10px;width:400px;height:40px;background:blue;display:none;">&nbsp;</div>
</div>
<?php // end groups_list?>
<div class="page-nav">
<div style="float: right;">
<?php recordsetNav($thecount,$_SERVER['PHP_SELF'],$_SESSION['the_section_container'],$offset,$limit,1);?>
</div>
</div>
</div>
<?php //end groups ?>