member listing now includes a form to search amoung domains rather than logins
This commit is contained in:
parent
4f603deb80
commit
14bb794dd0
|
@ -39,6 +39,7 @@ $fields = array (
|
|||
"creator" => array("request", "integer", 0),
|
||||
"short" => array("request", "integer", -1),
|
||||
"pattern" => array("request", "string", FALSE),
|
||||
"pattern_type" => array("request", "string", FALSE),
|
||||
);
|
||||
getFields($fields);
|
||||
|
||||
|
@ -57,13 +58,12 @@ if ($show=="all" && !$subadmin==1 && $cuid != 2000) {
|
|||
exit();
|
||||
}
|
||||
|
||||
|
||||
if ($pattern)
|
||||
$r=$admin->get_list($show == 'all' ? 1 : 0, $creator, $pattern);
|
||||
if ($pattern && $pattern_type) {
|
||||
$r=$admin->get_list($show == 'all' ? 1 : 0, $creator, $pattern, $pattern_type);
|
||||
}
|
||||
else
|
||||
$r = FALSE;
|
||||
?>
|
||||
|
||||
<h3><?php __("AlternC account list"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
|
@ -73,7 +73,10 @@ else
|
|||
<p>
|
||||
|
||||
<form method="get">
|
||||
<label for="pattern"><?php __("Login pattern"); ?></label>
|
||||
<span><?php __("Pattern"); ?></span>
|
||||
<label for="pattern_type_login">Login</label><input type="radio" name="pattern_type" value="login" id="pattern_type_login" <?php if ($pattern_type === 'login') echo ' checked="checked" '; ?>/>
|
||||
<label for="pattern_type_domain">Domaine</label><input type="radio" name="pattern_type" value="domaine" id="pattern_type_domain" <?php if ($pattern_type === 'domaine') echo ' checked="checked" '; ?>/>
|
||||
<!-- <label for="pattern"><?php __("Login pattern"); ?></label> -->
|
||||
<input type="text" id="pattern" name="pattern" value="<?php echo $pattern ? $pattern : '*'; ?>"/> <input type="submit" class="inb" value="<?php __("submit"); ?>" />
|
||||
</form>
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ class m_admin {
|
|||
* table <code>membres</code> and <code>local</code> of all the accounts.
|
||||
* Returns FALSE if an error occurs.
|
||||
*/
|
||||
function get_list($all=0,$creator=0,$pattern=FALSE) {
|
||||
function get_list($all=0,$creator=0,$pattern=FALSE,$pattern_type=FALSE) {
|
||||
global $err,$mem,$cuid;
|
||||
$err->log("admin","get_list");
|
||||
if (!$this->enabled) {
|
||||
|
@ -290,28 +290,50 @@ class m_admin {
|
|||
}
|
||||
$db=new DB_System();
|
||||
|
||||
$request = 'SELECT uid FROM membres WHERE 1';
|
||||
|
||||
if ($pattern && preg_match('/[a-zA-Z0-9]+/', $pattern))
|
||||
$request .= sprintf(' AND login LIKE "%%%s%%"', $pattern);
|
||||
if ($pattern) {
|
||||
|
||||
if ($creator)
|
||||
$request .= sprintf(' AND creator = "%s"', $creator);
|
||||
if ($mem->user['uid']!=2000 && !$all)
|
||||
$request .= sprintf(' AND creator = "%s"', $cuid);
|
||||
if ($pattern_type === 'domaine') {
|
||||
|
||||
$request .= ' ORDER BY login;';
|
||||
$request = 'SELECT compte AS uid FROM domaines WHERE 1';
|
||||
|
||||
if ($pattern && preg_match('/[.a-zA-Z0-9]+/', $pattern))
|
||||
$request .= sprintf(' AND domaine LIKE "%%%s%%"', $pattern);
|
||||
|
||||
} elseif ($pattern_type === 'login') {
|
||||
|
||||
$request = 'SELECT uid FROM membres WHERE 1';
|
||||
|
||||
if ($pattern && preg_match('/[a-zA-Z0-9]+/', $pattern))
|
||||
$request .= sprintf(' AND login LIKE "%%%s%%"', $pattern);
|
||||
|
||||
if ($creator)
|
||||
$request .= sprintf(' AND creator = "%s"', $creator);
|
||||
|
||||
if ($mem->user['uid']!=2000 && !$all)
|
||||
$request .= sprintf(' AND creator = "%s"', $cuid);
|
||||
|
||||
$request .= ' ORDER BY login;';
|
||||
|
||||
} else {
|
||||
|
||||
$err->raise("admin", _("Invalid pattern type provided. Are you even performing a legitimate action?"));
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
/* if ($creator)
|
||||
{
|
||||
// Limit listing to a specific reseller
|
||||
$db->query("SELECT uid FROM membres WHERE creator='".$creator."' ORDER BY login;");
|
||||
} elseif ($mem->user['uid']==2000 || $all) {
|
||||
$db->query("SELECT uid FROM membres ORDER BY login;");
|
||||
} else {
|
||||
$db->query("SELECT uid FROM membres WHERE creator='".$cuid."' ORDER BY login;");
|
||||
|
||||
if ($creator)
|
||||
{
|
||||
// Limit listing to a specific reseller
|
||||
$request = "SELECT uid FROM membres WHERE creator='".$creator."' ORDER BY login;";
|
||||
} elseif ($mem->user['uid']==2000 || $all) {
|
||||
$request = "SELECT uid FROM membres ORDER BY login;";
|
||||
} else {
|
||||
$request = "SELECT uid FROM membres WHERE creator='".$cuid."' ORDER BY login;";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$db->query($request);
|
||||
|
||||
|
|
Loading…
Reference in New Issue