Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7313369
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
32 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/accounts.phtml b/accounts.phtml
index 04c56c2..d34ac47 100644
--- a/accounts.phtml
+++ b/accounts.phtml
@@ -1,473 +1,463 @@
<?php
require '/etc/cdrtool/global.inc';
page_open(
array(
"sess" => "CDRTool_Session",
"auth" => "CDRTool_Auth",
"perm" => "CDRTool_Perm"
)
);
$title = "Login accounts";
require 'login_accounts.php';
if (is_readable("/etc/cdrtool/local/header.phtml")) {
include '/etc/cdrtool/local/header.phtml';
} else {
include 'header.phtml';
}
function log_accounts_action($action)
{
global $auth;
$location = "Unknown";
$_loc = geoip_record_by_name($_SERVER['REMOTE_ADDR']);
if ($_loc['country_name']) {
$location = $_loc['country_name'];
}
$log = sprintf(
"CDRTool login username=%s, IP=%s, location=%s, action=%s, script=%s",
$auth->auth["uname"],
$_SERVER['REMOTE_ADDR'],
$location,
$action,
$_SERVER['PHP_SELF']
);
syslog(LOG_NOTICE, $log);
}
$loginname = $auth->auth["uname"];
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$next = isset($_REQUEST['next']) ? $_REQUEST['next'] : '';
$search_text = isset($_REQUEST['search_text']) ? $_REQUEST['search_text'] : '';
$username = isset($_REQUEST['username']) ? $_REQUEST['username'] : '';
$password = isset($_REQUEST['password']) ? $_REQUEST['password'] : '';
$name = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
$organization = isset($_REQUEST['organization']) ? $_REQUEST['organization'] : '';
$tel = isset($_REQUEST['tel']) ? $_REQUEST['tel'] : '';
$email = isset($_REQUEST['email']) ? $_REQUEST['email'] : '';
$expire = isset($_REQUEST['expire']) ? $_REQUEST['expire'] : '';
$gatewayFilter = isset($_REQUEST['gatewayFilter']) ? $_REQUEST['gatewayFilter'] : '';
$domainFilter = isset($_REQUEST['domainFilter']) ? $_REQUEST['domainFilter'] : '';
$serviceFilter = isset($_REQUEST['serviceFilter']) ? $_REQUEST['serviceFilter'] : '';
$compidFilter = isset($_REQUEST['compidFilter']) ? $_REQUEST['compidFilter'] : '';
$aNumberFilter = isset($_REQUEST['aNumberFilter']) ? $_REQUEST['aNumberFilter'] : '';
$cscodeFilter = isset($_REQUEST['cscodeFilter']) ? $_REQUEST['cscodeFilter'] : '';
$afterDateFilter = isset($_REQUEST['afterDateFilter']) ? $_REQUEST['afterDateFilter'] : '';
$aclFilter = isset($_REQUEST['aclFilter']) ? $_REQUEST['aclFilter'] : '';
$impersonate = isset($_REQUEST['impersonate']) ? $_REQUEST['impersonate'] : '';
$perms = isset($_REQUEST['perms']) ? $_REQUEST['perms'] : '';
$sources = isset($_REQUEST['sources']) ? $_REQUEST['sources'] : '';
$delete = isset($_REQUEST['delete']) ? $_REQUEST['delete'] : '';
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : '';
$check = isset($_REQUEST['check']) ? $_REQUEST['check'] : '';
$mailsettings = isset($_REQUEST['mailsettings']) ? $_REQUEST['mailsettings'] : '';
-$otp_yubikey = isset($_REQUEST["yubikey"]) ? $_REQUEST["yubikey"] : '';
$auth_method = isset($_REQUEST["auth_method"]) ? $_REQUEST["auth_method"] : '';
$PHP_SELF = htmlentities($_SERVER['PHP_SELF']);
$db = new DB_CDRTool;
$layout = new pageLayoutLocal();
$layout->showTopMenu($title);
if ($action == "edit" && $id) {
print "
<ul class=\"breadcrumb\">
<li><a href=accounts.phtml>Accounts</a> <span class=\"divider\">/</span> </li>
<li class='active'>Edit account</li>
</ul>
";
$uid = $auth->auth["uid"];
if (!$perm->have_perm("admin")) {
$id = $uid;
}
if ($check || $delete) {
if ($err = $f->validate()) {
print "<div class=\"alert alert-error\">
$err
</div>";
$perms = implode($perms, ",");
$sources = implode($sources, ",");
showForm($id);
} else {
$perms_text = implode($perms, ",");
$sources_text = implode($sources, ",");
if ($delete && $perm->have_perm("admin")) {
$query = "delete from auth_user";
} else {
//print "<p>Updating user";
$query = sprintf(
"update auth_user set
username = '%s',
name = '%s',
organization = '%s',
tel = '%s',
email = '%s',
- yubikey = '%s',
auth_method = '%s'
",
addslashes($username),
addslashes($name),
addslashes($organization),
addslashes($tel),
addslashes($email),
- addslashes($otp_yubikey),
addslashes($auth_method)
);
if (strlen($password)) {
if ($CDRTool['provider']['clear_text_passwords'] != 1) {
$query .= sprintf(
",
password = '',
password_hashed = '%s'",
addslashes(md5($password))
);
} else {
$query .= sprintf(
",
password = '%s',
password_hashed = ''",
addslashes($password)
);
}
}
if ($perm->have_perm("admin")) {
if (strlen($impersonate)) {
if (!preg_match("/^[0-9]*\.[0-9]*$/", $impersonate)) {
printf("<div class=\"alert\"><strong>Warning!</strong> Impersonate must be formated as CustomerId.ResellerId</div>");
unset($impersonate);
}
}
$query.= sprintf(
",
perms = '%s',
sources = '%s',
expire = '%s',
gatewayFilter = '%s',
domainFilter = '%s',
serviceFilter = '%s',
compidFilter = '%s',
aNumberFilter = '%s',
cscodeFilter = '%s',
afterDateFilter = '%s',
aclFilter = '%s',
impersonate = '%s'
",
addslashes($perms_text),
addslashes($sources_text),
addslashes($expire),
addslashes($gatewayFilter),
addslashes($domainFilter),
addslashes($serviceFilter),
addslashes($compidFilter),
addslashes($aNumberFilter),
addslashes($cscodeFilter),
addslashes($afterDateFilter),
addslashes($aclFilter),
addslashes($impersonate)
);
}
}
$query .= sprintf(" where user_id = '%s'", addslashes($id));
// print $query;
if (!$db->query($query)) {
print "<p>Failed to update user $id";
print "The error is $db->Error";
} else {
if ($delete) {
log_accounts_action(sprintf("account %s deleted", $username));
print "<p>User <b>$name</b> deleted";
} else {
log_accounts_action(sprintf("account %s updated", $username));
print "<p>User <b>$name</b> updated";
if ($mailsettings) {
if ($_SERVER['HTTPS']=="on") {
$protocolURL="https://";
} else {
$protocolURL="http://";
}
$body .= sprintf("The following login account for CDRTool has been created for you:\n\n");
$body .= sprintf("Username: %s\n", $username);
$body .= sprintf("Password: %s\n", $password);
$body .= sprintf("URL: %s%s%s\n\n", $protocolURL, $_SERVER['HTTP_HOST'], $CDRTool['tld']);
$body .= sprintf("You may use your CDRTool account to access call detail records and \n");
$body .= sprintf("traces from OpenSIPs, MediaProxy and Asterisk servers.\n");
$from = sprintf("From: %s", $CDRTool['provider']['fromEmail']);
mail($email, "CDRTool login account", $body, $from);
}
}
accountList();
}
}
} else {
$query = "select * from auth_user";
if (!$perm->have_perm("admin")) {
$query .= sprintf(" where user_id = '%s'", addslashes($uid));
$id=$uid;
} else {
$query .= sprintf(" where user_id = '%s'", addslashes($id));
}
dprint($query);
$db->query($query);
$db->next_record();
$username = $db->f('username');
$name = $db->f('name');
$email = $db->f('email');
$tel = $db->f('tel');
$password = $db->f('password');
$organization = $db->f('organization');
$perms = $db->f('perms');
$sources = $db->f('sources');
$expire = $db->f('expire');
$aNumberFilter = $db->f('aNumberFilter');
$gatewayFilter = $db->f('gatewayFilter');
$domainFilter = $db->f('domainFilter');
$serviceFilter = $db->f('serviceFilter');
$compidFilter = $db->f('compidFilter');
$cscodeFilter = $db->f('cscodeFilter');
$afterDateFilter = $db->f('afterDateFilter');
$aclFilter = $db->f('aclFilter');
$impersonate = $db->f('impersonate');
- $yubikey = $db->f('yubikey');
$auth_method = $db->f('auth_method');
showForm($id);
}
} elseif ($action=="insert" && $perm->have_perm("admin")) {
print "<ul class=\"breadcrumb\">
<li><a href=accounts.phtml>Accounts</a> <span class=\"divider\">/</span> </li>
<li class='active'>Add account</li>
</ul>";
$uid = $auth->auth["uid"];
if (!$password) $password = random_passwd_gen();
if ($check) {
if ($perms) $perms = implode($perms,",");
if ($sources) $sources = implode($sources,",");
if (strlen($impersonate)) {
if (!preg_match("/^[0-9]*\.[0-9]*$/", $impersonate)) {
printf("<p><font color=blue>Warning: Impersonate must be formated as CustomerId.ResellerId</font>");
unset($impersonate);
}
}
if ($err = $f->validate()) {
print "<p><font color=red>$err</font>
<p>";
showForm();
} else {
//print "<p>Adding user";
$hash_secret = "ffdsdsd__ky...";
$user_id = md5(uniqid($hash_secret));
if ($CDRTool['provider']['clear_text_passwords']!=1) {
$query = sprintf(
"insert into auth_user
(
user_id,
username,
password,
password_hashed,
name,
organization,
tel,
email,
perms,
sources,
expire,
domainFilter,
aNumberFilter,
serviceFilter,
compidFilter,
cscodeFilter,
gatewayFilter,
afterDateFilter,
aclFilter,
impersonate,
- yubikey,
auth_method
) values (
'%s',
'%s',
'',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
- '%s',
'%s'
)",
addslashes($user_id),
addslashes($username),
addslashes(md5($password)),
addslashes($name),
addslashes($organization),
addslashes($tel),
addslashes($email),
addslashes($perms),
addslashes($sources),
addslashes($expire),
addslashes($domainFilter),
addslashes($aNumberFilter),
addslashes($serviceFilter),
addslashes($compidFilter),
addslashes($cscodeFilter),
addslashes($gatewayFilter),
addslashes($afterDateFilter),
addslashes($aclFilter),
addslashes($impersonate),
- addslashes($yubikey),
addslashes($auth_method)
);
} else {
$query = sprintf(
"insert into auth_user
(
user_id,
username,
password,
name,
organization,
tel,
email,
perms,
sources,
expire,
domainFilter,
aNumberFilter,
serviceFilter,
compidFilter,
cscodeFilter,
gatewayFilter,
afterDateFilter,
aclFilter,
impersonate,
- yubikey,
auth_method
) values (
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
- '%s',
'%s'
)",
addslashes($user_id),
addslashes($username),
addslashes($password),
addslashes($name),
addslashes($organization),
addslashes($tel),
addslashes($email),
addslashes($perms),
addslashes($sources),
addslashes($expire),
addslashes($domainFilter),
addslashes($aNumberFilter),
addslashes($serviceFilter),
addslashes($compidFilter),
addslashes($cscodeFilter),
addslashes($gatewayFilter),
addslashes($afterDateFilter),
addslashes($aclFilter),
addslashes($impersonate),
- addslashes($yubikey),
addslashes($auth_method)
);
}
dprint($query);
if (!$db->query($query)) {
printf("<p>Failed to add user: %s(%s) %s", $db->Error, $db->Errno, $query);
} else {
log_accounts_action(sprintf("account %s added", $username));
print "<p>User <b>$name</b> created";
if ($mailsettings) {
if ($_SERVER['HTTPS']=="on") {
$protocolURL="https://";
} else {
$protocolURL="http://";
}
$body .= sprintf("The following login account for CDRTool has been created for you:\n\n");
$body .= sprintf("Username: %s\n", $username);
$body .= sprintf("Password: %s\n", $password);
$body .= sprintf("URL: %s%s%s\n\n", $protocolURL, $_SERVER['HTTP_HOST'], $CDRTool['tld']);
$body .= sprintf("You may use your CDRTool account to access call detail records and \n");
$body .= sprintf("traces from OpenSIPs, MediaProxy and Asterisk servers.\n");
$from = sprintf("From: %s", $CDRTool['provider']['fromEmail']);
mail($email, "CDRTool login account", $body, $from);
}
}
}
} else {
showForm();
}
print "</td></tr></table></center>";
} else {
print "<h3>Account list</h3>";
if ($perm->have_perm("admin")) {
print "<center><a class=btn href=$PHP_SELF?action=insert>Add account</a></center>";
}
accountList();
}
$layout->showFooter();
page_close();
?>
</body>
</html>
diff --git a/library/login_accounts.php b/library/login_accounts.php
index 599fca7..2ddd239 100644
--- a/library/login_accounts.php
+++ b/library/login_accounts.php
@@ -1,621 +1,560 @@
<?php
function check_telephone($tel, $country)
{
global $err;
if ($country == "NL") {
if (preg_match("/^\+31\-\d{2}-\d{7}$/", $tel)
|| preg_match("/^\+31\-\d{3}-\d{6}$/", $tel)
) {
} else {
$err = "NL numbers must be in format +31-DD-DDDDDDD or +31-DDD-DDDDDD";
return 0;
}
}
return 1;
}
# subscriber form
$f = new form;
$f->add_element(
array(
"name"=>"username",
"type"=>"text",
"size"=>"25",
"length_e"=>"2",
"minlength"=>"2",
"maxlength"=>"25",
"valid_regex"=>"^[-a-zA-Z0-9@_\.]{2,}$",
"valid_e"=>"Username required: - mininum 2 chars (letters, digits, _, -, @, .)"
)
);
$f->add_element(
array(
"name"=>"password",
"type"=>"text",
"size"=>"25",
"minlength"=>"5",
"maxlength"=>"25",
"pass"=>1,
//"valid_regex"=>"^.{5,}",
//"valid_e"=>"Password: Letters, digits _ - only - minim 5 characters",
"value"=>"$password"
)
);
$f->add_element(
array(
"name"=>"name",
"type"=>"text",
"length_e"=>"3",
"minlength"=>"3",
"maxlength"=>"100",
"size"=>"30",
"valid_regex"=>"^[-a-zA-Z0-9|_|\.|\s ]*$",
"valid_e"=>"Name required - min 1 chars (letters, digits _ - . spaces only)",
"icase"=>1
)
);
$f->add_element(
array(
"name"=>"organization",
"type"=>"text",
"length_e"=>"6",
"maxlength"=>"100",
"size"=>"30",
"valid_regex"=>"^[-a-zA-Z0-9|_|\.|\s ]*$",
"valid_e"=>"Organization required - min 6 chars (letters, digits _ - . spaces only)",
"icase"=>1
)
);
$f->add_element(
array(
"name"=>"email",
"type"=>"text",
"length_e"=>6,
"minlength"=>"6",
"maxlength"=>"100",
"size"=>"30",
"valid_e"=>"Syntax error in E-Mail address.",
"valid_regex"=>"^([-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+(\.[-a-zA-Z0-9_]+)+)*$"
)
);
$f->add_element(
array(
"name"=>"aNumberFilter",
"type"=>"text",
"maxlength"=>"100",
"size"=>"60"
)
);
$f->add_element(
array(
"name"=>"domainFilter",
"type"=>"text",
"maxlength"=>"255",
"size"=>"60"
)
);
$f->add_element(
array(
"name"=>"impersonate",
"type"=>"text",
"maxlength"=>"255",
"size"=>"11"
)
);
$f->add_element(
array(
"name"=>"gatewayFilter",
"type"=>"text",
"maxlength"=>"255",
"size"=>"60"
)
);
$f->add_element(
array(
"name"=>"compidFilter",
"type"=>"text",
"maxlength"=>"255",
"size"=>"60"
)
);
$f->add_element(
array(
"name"=>"cscodeFilter",
"type"=>"text",
"maxlength"=>"255",
"size"=>"60"
)
);
$f->add_element(
array(
"name"=>"serviceFilter",
"type"=>"text",
"maxlength"=>"255",
"size"=>"60"
)
);
$f->add_element(
array(
"name"=>"afterDateFilter",
"type"=>"text",
"maxlength"=>"10",
"size"=>"11"
)
);
$f->add_element(
array(
"name"=>"aclFilter",
"type"=>"text",
"maxlength"=>"100",
"size"=>"20"
)
);
$f->add_element(
array(
"name"=>"tel",
"type"=>"text",
"size"=>"30"
)
);
$f->add_element(
array(
"name"=>"expire",
"type"=>"text",
"size"=>"11"
)
);
-$use_yubikey = 0;
-if (stream_resolve_include_path('Auth/Yubico.php')) {
- require_once 'Auth/Yubico.php';
- $use_yubikey = 1;
-}
-
-if ($use_yubikey) {
- $f->add_element(
- array(
- "name"=>"yubikey",
- "type"=>"text",
- "size"=>"12",
- "minlength"=>"12",
- "maxlength"=>"12",
- "valid_regex"=>"^[a-zA-Z0-9|_|-]*$"
- )
- );
-}
-
$blocked_els=array(
array("label"=>"","value"=>"0"),
array("label"=>gettext("Blocked"),"value"=>"1")
);
$f->add_element(
array(
"type"=>"select",
"name"=>"blocked",
"options"=>$blocked_els,
"size"=>1,
"value"=>""
)
);
$f->add_element(
array(
"type"=>"submit",
"name"=>"submit",
"extrahtml"=>"class=btn",
"value"=>"Submit"
)
);
while (list($k,$v) = each($DATASOURCES)) {
if ($k != "unknown") {
$cdrSourcesEls[] = array(
"label" => $v[name],
"value" => $k
);
}
}
$f->add_element(
array(
"type"=>"select",
"name"=>"sources",
"options"=>$cdrSourcesEls,
"size"=>8,
"multiple"=>"1",
"value"=>""
)
);
-if ($use_yubikey) {
- $f->add_element(
- array(
- "type"=>"select",
- "name"=>"auth_method",
- "options"=> array(
- array("label"=>"Username+Password+Yubikey","value"=>"7"),
- array("label"=>"Username+Yubikey","value"=>"5"),
- array("label"=>"Yubikey","value"=>"4"),
- ),
- "multiple"=>"0",
- "value"=>""
- )
- );
-}
-
function wrapFormElement($label, $element)
{
if (is_array($label)) {
$label = implode('', $label);
}
if (is_array($element)) {
$element = implode('', $element);
}
printf('
<div class="control-group">
<label class="control-label">%s</label>
<div class="controls">
%s
</div>
</div>',
$label,
$element
);
}
function showForm($id = "")
{
global $CDRTool, $verbose, $perm, $auth, $sess, $cdr, $f,
$perms, $source, $sources, $action;
$sources = explode(",", $sources);
- $use_yubikey = 0;
- if (stream_resolve_include_path('Auth/Yubico.php')) {
- require_once 'Auth/Yubico.php';
- $use_yubikey = 1;
- }
-
global $afterDateFilter;
if (preg_match("/^0000-00-00$/", $afterDateFilter)) {
$afterDateFilter = "";
}
$f->load_defaults();
$f->start("", "GET", "", "", "", "form-horizontal");
print "<input type=hidden name=check value=yes>";
print "<input type=hidden name=action value=\"$action\">";
if ($frzall) {
$f->freeze();
}
if (!$perm->have_perm("admin")) {
$ff = array(
"sources",
"gatewayFilter",
"domainFilter",
"aNumberFilter",
"serviceFilter",
"compidFilter",
"cscodeFilter",
"afterDateFilter",
"aclFilter",
"impersonate"
);
$f->freeze($ff);
}
print "
<div class=\"row-fluid\">
<div class=\"span6\">
<h3>Contact details</h3>
<p>";
print _("The fields marked with ");
print " <font color=orange>*</font> ";
print _("are mandatory");
print ":</font>
</p>
";
$f->show_element("action", "");
if ($id) {
$f->add_element(
array(
"type"=>"hidden",
"name"=>"id",
"value"=>"$id"
)
);
}
wrapFormElement(
array(
_("Name"),
"<font color=orange> *</font>"
),
array(
"<font color=$formelcolor>",
$f->get_element("name", ""),
"</font>"
)
);
wrapFormElement(
_("Organization"),
array(
"<font color=$formelcolor>",
$f->get_element("organization", ""),
"</font>"
)
);
wrapFormElement(
array(
_("E-mail"),
"<font color=orange> *</font>"
),
array(
"<font color=$formelcolor>",
$f->get_element("email", ""),
"</font>"
)
);
wrapFormElement(
_("Telephone"),
array(
"<font color=$labelcolor>",
$f->get_element("tel", ""),
"</font>"
)
);
wrapFormElement(
array(
_("Username"),
"<font color=orange>*</font>"
),
array(
"<font color=$labelcolor>",
$f->get_element("username", ""),
"</font>"
)
);
wrapFormElement(
array(
_("Password"),
"<font color=orange>*</font>"
),
array(
"<font color=$labelcolor>",
$f->get_element("password", ""),
"</font>"
)
);
- if ($use_yubikey) {
- wrapFormElement(
- _("Yubikey"),
- array(
- "<font color=$formelcolor>",
- $f->get_element("yubikey", ""),
- "</font>"
- )
- );
-
- wrapFormElement(
- _("Yubikey usage"),
- array(
- "<font color=$formelcolor>",
- $f->get_element("auth_method", ""),
- "</font>"
- )
- );
- }
-
wrapFormElement(
array(
"<font color=$labelcolor>",
"E-mail settings",
"</font>"
),
array(
"<font color=$labelcolor>",
"<input type=checkbox name=mailsettings value=1>",
"</font>"
)
);
if ($perm->have_perm("admin")) {
print "<hr>";
wrapFormElement(
array(
"<font color=$labelcolor>",
"Expire date",
"</font>"
),
array(
"<font color=$labelcolor>",
$f->get_element("expire", ""),
"</font>"
)
);
wrapFormElement(
array(
"<font color=$labelcolor>",
"Impersonate",
"</font>"
),
array(
"<font color=$labelcolor>",
$f->get_element("impersonate", ""),
"</font>"
)
);
wrapFormElement(
array(
"<font color=$labelcolor>",
"Delete",
"</font>"
),
array(
"<font color=$labelcolor>",
"<input type=checkbox name=delete value=1>",
"</font>"
)
);
/*
print "
<tr>
<td valign=top><font color=$labelcolor>
Lock </td>
<td colspan=2 valign=top><font color=$labelcolor>
";
$f->show_element("blocked","");
print "
</font>
</td>
</tr>
";
*/
print "
<hr>
";
}
print "
</div>";
print "<div class=span6>
";
print "
<h3>Permissions</h3>
<div class='row-fluid'>";
if ($perm->have_perm("admin")) {
print "<div class='span6'>
<p><b>Functions</b></p>";
print $perm->perm_sel("perms", $perms);
print "</div>";
}
print "<div class='span6'><p><strong>Data sources</strong></p>";
$f->show_element("sources", "");
print "
</div></div>";
print "
<hr noshade size=1>
<p>
<strong>Filters</strong></p>
";
wrapFormElement("IP ACL", $f->get_element("aclFilter", ""));
wrapFormElement("Trusted peers", $f->get_element("gatewayFilter", ""));
wrapFormElement("Domains", $f->get_element("domainFilter", ""));
wrapFormElement("Subscribers", $f->get_element("aNumberFilter", ""));
wrapFormElement("After date", $f->get_element("afterDateFilter", ""));
print "</div></div>";
if (!$frzall) {
print "<div class='form-actions'>";
$f->show_element("submit", "", "btn");
print "</div>";
}
$f->finish(); // Finish form
}
function accountList()
{
global $auth, $perm, $verbose, $search_text, $PHP_SELF;
$uid = $auth->auth["uid"];
$db = new DB_CDRTool;
$query = "select * from auth_user";
if (!$perm->have_perm("admin")) {
$query .= sprintf(" where user_id = '%s'", addslashes($uid));
}
$query .= " order by name asc";
$db->query($query);
dprint_sql($query);
$rows = $db->num_rows();
print "
<p>
<center>
<table class='table table-hover table-condensed table-striped' width=100%>
<thead>
<tr>
";
print "<th class=h>";
print _("Name");
print "</th><th class=h>";
print _("Organization");
print "</th><th class=h>";
print _("Username");
print "</th><th class=h>";
print _("E-mail");
print "</th><th class=h>";
print _("Tel");
print "</th><th class=h>";
print _("Sources");
print "</th><th class=h>";
print _("Expire");
print "</th>
</tr></thead>
";
while ($db->next_record()) {
$id_db = $db->f('user_id');
$name = $db->f('name');
$username = $db->f('username');
$email = $db->f('email');
$organization = $db->f('organization');
$password = $db->f('password');
$tel = $db->f('tel');
$domainFilter = $db->f('domainFilter');
$aNumberFilter = $db->f('aNumberFilter');
$expire = $db->f('expire');
$sources = preg_replace("/,/", ", ", $db->f('sources'));
$bgcolor = "";
if (date('Y-m-d') > $expire) {
$bgcolor = "error";
}
print "
<tr class=$bgcolor>
<td><a href=\"$PHP_SELF?id=$id_db&action=edit\">$name</a></td>
<td>$organization</td>
<td>$username</td>
<td><nobr><a href=mailto:$email>$email</a></nobr></td>
<td><nobr>$tel</nobr></td>
<td>$sources</td>
<td>$expire</td>
</tr>
";
}
print "</table>
</center>
";
}
?>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Feb 1, 12:04 PM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3489329
Default Alt Text
(32 KB)
Attached To
Mode
rCDRT CDRTool
Attached
Detach File
Event Timeline
Log In to Comment