本文整理汇总了PHP中translate_dmn_status函数的典型用法代码示例。如果您正苦于以下问题:PHP translate_dmn_status函数的具体用法?PHP translate_dmn_status怎么用?PHP translate_dmn_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了translate_dmn_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gen_htaccess_entries
function gen_htaccess_entries(&$tpl, &$sql, &$dmn_id)
{
$query = <<<SQL_QUERY
select
*
from
htaccess
where
dmn_id = ?
SQL_QUERY;
$rs = exec_query($sql, $query, array($dmn_id));
if ($rs->RecordCount() == 0) {
$tpl->assign('PROTECTED_AREAS', '');
set_page_message(tr('You do not have protected areas'));
} else {
$counter = 0;
while (!$rs->EOF) {
if ($counter % 2 == 0) {
$tpl->assign('CLASS', 'content');
} else {
$tpl->assign('CLASS', 'content2');
}
$id = $rs->fields['id'];
$user_id = $rs->fields['user_id'];
$group_id = $rs->fields['group_id'];
$status = $rs->fields['status'];
$path = $rs->fields['path'];
$auth_name = $rs->fields['auth_name'];
$tpl->assign(array('AREA_NAME' => $auth_name, 'AREA_PATH' => $path, 'PID' => $id, 'STATUS' => translate_dmn_status($status)));
$tpl->parse('DIR_ITEM', '.dir_item');
$rs->MoveNext();
$counter++;
}
}
}
示例2: gen_pgroups
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $dmn_id
*/
function gen_pgroups($tpl, $sql, &$dmn_id)
{
$cfg = EasySCP_Registry::get('Config');
$query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t`htaccess_groups`\n\t\tWHERE\n\t\t\t`dmn_id` = ?\n\t\tORDER BY\n\t\t\t`dmn_id` DESC\n\t";
$rs = exec_query($sql, $query, $dmn_id);
if ($rs->recordCount() == 0) {
$tpl->assign('GROUP_MESSAGE', tr('You have no groups!'));
} else {
while (!$rs->EOF) {
$tpl->append(array('GNAME' => tohtml($rs->fields['ugroup']), 'GSTATUS' => translate_dmn_status($rs->fields['status']), 'GROUP_ID' => $rs->fields['id'], 'GROUP_DELETE' => tr('Delete'), 'GROUP_DELETE_SCRIPT' => $rs->fields['status'] === $cfg->ITEM_OK_STATUS && $rs->fields['ugroup'] != $cfg->AWSTATS_GROUP_AUTH ? "action_delete('protected_group_delete.php?gname=" . $rs->fields['id'] . "', '" . $rs->fields['ugroup'] . "')" : tr('N/A')));
if ($rs->fields['members'] != '') {
$group_members = '';
$members = explode(',', $rs->fields['members']);
$cnt_members = count($members);
for ($i = 0; $i < $cnt_members; $i++) {
$query = "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`uname`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`htaccess_users`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`id` = ?\n\t\t\t\t\t";
$rs_members = exec_query($sql, $query, $members[$i]);
if ($cnt_members == 1 || $cnt_members == $i + 1) {
$group_members .= tohtml($rs_members->fields['uname']);
} else {
$group_members .= tohtml($rs_members->fields['uname']) . ', ';
}
}
$tpl->append('MEMBER', $group_members);
} else {
$tpl->append('MEMBER', '');
}
$rs->moveNext();
}
}
}
示例3: reseller_generatePage
/**
* Generates page
*
* @param iMSCP_pTemplate $tpl Template instance engine
* @param int $domainId Domain unique identifier
* @return void
*/
function reseller_generatePage($tpl, $domainId)
{
$stmt = exec_query('
SELECT
domain_admin_id
FROM
domain
INNER JOIN
admin ON(admin_id = domain_admin_id)
WHERE
domain_id = ?
AND
created_by = ?
', array($domainId, $_SESSION['user_id']));
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
$domainAdminId = $stmt->fields['domain_admin_id'];
$domainProperties = get_domain_default_props($domainAdminId, $_SESSION['user_id']);
// Domain IP address info
$stmt = exec_query("SELECT ip_number FROM server_ips WHERE ip_id = ?", $domainProperties['domain_ip_id']);
if (!$stmt->rowCount()) {
$domainIpAddr = tr('Not found.');
} else {
$domainIpAddr = $stmt->fields['ip_number'];
}
$domainStatus = $domainProperties['domain_status'];
// Domain status
if ($domainStatus == 'ok' || $domainStatus == 'disabled' || $domainStatus == 'todelete' || $domainStatus == 'toadd' || $domainStatus == 'torestore' || $domainStatus == 'tochange' || $domainStatus == 'toenable' || $domainStatus == 'todisable') {
$domainStatus = '<span style="color:green">' . tohtml(translate_dmn_status($domainStatus)) . '</span>';
} else {
$domainStatus = '<b><font size="3" color="red">' . $domainStatus . "</font></b>";
}
// Get total domain traffic usage in bytes
$query = "\n SELECT\n IFNULL(SUM(dtraff_web), 0) AS dtraff_web, IFNULL(SUM(dtraff_ftp), 0) AS dtraff_ftp,\n IFNULL(SUM(dtraff_mail), 0) AS dtraff_mail, IFNULL(SUM(dtraff_pop), 0) AS dtraff_pop\n FROM\n domain_traffic\n WHERE\n domain_id = ?\n AND\n dtraff_time BETWEEN ? AND ?\n ";
$stmt = exec_query($query, array($domainProperties['domain_id'], getFirstDayOfMonth(), getLastDayOfMonth()));
if ($stmt->rowCount()) {
$trafficUsageBytes = $stmt->fields['dtraff_web'] + $stmt->fields['dtraff_ftp'] + $stmt->fields['dtraff_mail'] + $stmt->fields['dtraff_pop'];
} else {
$trafficUsageBytes = 0;
}
// Get limits in bytes
$trafficLimitBytes = $domainProperties['domain_traffic_limit'] * 1048576;
$diskspaceLimitBytes = $domainProperties['domain_disk_limit'] * 1048576;
// Get usages in percent
$trafficUsagePercent = make_usage_vals($trafficUsageBytes, $trafficLimitBytes);
$diskspaceUsagePercent = make_usage_vals($domainProperties['domain_disk_usage'], $diskspaceLimitBytes);
// Get Email quota info
list($quota, $quotaLimit) = reseller_gen_mail_quota_limit_mgs($domainAdminId);
# Features
$trEnabled = '<span style="color:green">' . tr('Enabled') . '</span>';
$trDisabled = '<span style="color:red">' . tr('Disabled') . '</span>';
$tpl->assign(array('DOMAIN_ID' => $domainId, 'VL_DOMAIN_NAME' => tohtml(decode_idna($domainProperties['domain_name'])), 'VL_DOMAIN_IP' => tohtml($domainIpAddr), 'VL_STATUS' => $domainStatus, 'VL_PHP_SUPP' => $domainProperties['domain_php'] == 'yes' ? $trEnabled : $trDisabled, 'VL_PHP_EDITOR_SUPP' => $domainProperties['phpini_perm_system'] == 'yes' ? $trEnabled : $trDisabled, 'VL_CGI_SUPP' => $domainProperties['domain_cgi'] == 'yes' ? $trEnabled : $trDisabled, 'VL_DNS_SUPP' => $domainProperties['domain_dns'] == 'yes' ? $trEnabled : $trDisabled, 'VL_EXT_MAIL_SUPP' => $domainProperties['domain_external_mail'] == 'yes' ? $trEnabled : $trDisabled, 'VL_SOFTWARE_SUPP' => $domainProperties['domain_software_allowed'] == 'yes' ? $trEnabled : $trDisabled, 'VL_BACKUP_SUP' => translate_limit_value($domainProperties['allowbackup']), 'VL_TRAFFIC_PERCENT' => $trafficUsagePercent, 'VL_TRAFFIC_USED' => bytesHuman($trafficUsageBytes), 'VL_TRAFFIC_LIMIT' => bytesHuman($trafficLimitBytes), 'VL_DISK_PERCENT' => $diskspaceUsagePercent, 'VL_DISK_USED' => bytesHuman($domainProperties['domain_disk_usage']), 'VL_DISK_LIMIT' => bytesHuman($diskspaceLimitBytes), 'VL_MAIL_ACCOUNTS_USED' => get_domain_running_mail_acc_cnt($domainId), 'VL_MAIL_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_mailacc_limit']), 'VL_MAIL_QUOTA_USED' => $quota, 'VL_MAIL_QUOTA_LIMIT' => $domainProperties['domain_mailacc_limit'] != '-1' ? $quotaLimit : tr('Disabled'), 'VL_FTP_ACCOUNTS_USED' => get_customer_running_ftp_acc_cnt($domainAdminId), 'VL_FTP_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_ftpacc_limit']), 'VL_SQL_DB_ACCOUNTS_USED' => get_domain_running_sqld_acc_cnt($domainId), 'VL_SQL_DB_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_sqld_limit']), 'VL_SQL_USER_ACCOUNTS_USED' => get_domain_running_sqlu_acc_cnt($domainId), 'VL_SQL_USER_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_sqlu_limit']), 'VL_SUBDOM_ACCOUNTS_USED' => get_domain_running_sub_cnt($domainId), 'VL_SUBDOM_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_subd_limit']), 'VL_DOMALIAS_ACCOUNTS_USED' => get_domain_running_als_cnt($domainId), 'VL_DOMALIAS_ACCOUNTS_LIMIT' => translate_limit_value($domainProperties['domain_alias_limit'])));
}
示例4: gen_htaccess_entries
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $dmn_id
*/
function gen_htaccess_entries($tpl, $sql, &$dmn_id)
{
$query = "\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t`htaccess`\n\t\tWHERE\n\t\t\t`dmn_id` = ?\n\t";
$rs = exec_query($sql, $query, $dmn_id);
if ($rs->recordCount() == 0) {
set_page_message(tr('You do not have protected areas'), 'info');
} else {
while (!$rs->EOF) {
$auth_name = $rs->fields['auth_name'];
$tpl->append(array('AREA_NAME' => tohtml($auth_name), 'JS_AREA_NAME' => addslashes($auth_name), 'AREA_PATH' => tohtml($rs->fields['path']), 'PID' => $rs->fields['id'], 'STATUS' => translate_dmn_status($rs->fields['status'])));
$rs->moveNext();
}
}
}
示例5: client_generateCatchallItem
/**
* Generate catchall item
*
* @param iMSCP_pTemplate $tpl
* @param string $action Action
* @param int $dmnId Domain unique identifier
* @param string $dmnName Domain name
* @param int $mailId Mail unique identifier
* @param string $mailAcc Mail account
* @param string $mailStatus Mail account status
* @param string $catchallType Catchall type
* @return void
*/
function client_generateCatchallItem($tpl, $action, $dmnId, $dmnName, $mailId, $mailAcc, $mailStatus, $catchallType)
{
$showDmnName = decode_idna($dmnName);
if ($action == 'create') {
$tpl->assign(array('CATCHALL_DOMAIN' => tohtml($showDmnName), 'CATCHALL_ACC' => tr('None'), 'TR_CATCHALL_STATUS' => tr('N/A'), 'TR_CATCHALL_ACTION' => tr('Create catch all'), 'CATCHALL_ACTION' => $action, 'CATCHALL_ACTION_SCRIPT' => "mail_catchall_add.php?id={$dmnId};{$catchallType}", 'DEL_ICON' => ''));
} else {
list($catchallAction, $catchallActionScript) = client_generateAction($mailId, $mailStatus);
$showDmnName = decode_idna($dmnName);
$showMailAcc = decode_idna($mailAcc);
$tpl->assign(array('CATCHALL_DOMAIN' => tohtml($showDmnName), 'CATCHALL_ACC' => tohtml($showMailAcc), 'TR_CATCHALL_STATUS' => translate_dmn_status($mailStatus), 'TR_CATCHALL_ACTION' => $catchallAction, 'CATCHALL_ACTION' => $catchallAction, 'CATCHALL_ACTION_SCRIPT' => $catchallActionScript));
if ($catchallActionScript == '#') {
$tpl->assign('DEL_ICON', '');
}
}
}
示例6: opendkim_generatePage
/**
* Generate page
*
* @param $tpl TemplateEngine
* @return void
*/
function opendkim_generatePage($tpl)
{
$stmt = exec_query('
SELECT
opendkim_id, domain_name, opendkim_status, domain_dns, domain_text
FROM
opendkim
LEFT JOIN domain_dns ON(
domain_dns.domain_id = opendkim.domain_id
AND
domain_dns.alias_id = IFNULL(opendkim.alias_id, 0)
AND
owned_by = ?
)
WHERE
admin_id = ?
', array('OpenDKIM_Plugin', $_SESSION['user_id']));
if ($stmt->rowCount()) {
while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
if ($row['opendkim_status'] == 'ok') {
$statusIcon = 'ok';
} elseif ($row['opendkim_status'] == 'disabled') {
$statusIcon = 'disabled';
} elseif (in_array($row['opendkim_status'], array('toadd', 'tochange', 'todelete', 'torestore', 'tochange', 'toenable', 'todisable', 'todelete'))) {
$statusIcon = 'reload';
} else {
$statusIcon = 'error';
}
if ($row['domain_text']) {
if (strpos($row['domain_dns'], ' ') !== false) {
$dnsName = explode(' ', $row['domain_dns']);
$dnsName = $dnsName[0];
} else {
$dnsName = $row['domain_dns'];
}
} else {
$dnsName = '';
}
$tpl->assign(array('DOMAIN_NAME' => decode_idna($row['domain_name']), 'DOMAIN_KEY' => $row['domain_text'] ? tohtml($row['domain_text']) : tr('Generation in progress.'), 'OPENDKIM_ID' => $row['opendkim_id'], 'DNS_NAME' => $dnsName ? tohtml($dnsName) : tr('n/a'), 'KEY_STATUS' => translate_dmn_status($row['opendkim_status']), 'STATUS_ICON' => $statusIcon));
$tpl->parse('DOMAINKEY_ITEM', '.domainkey_item');
}
} else {
$tpl->assign('CUSTOMER_LIST', '');
set_page_message(tr('No domain with OpenDKIM support has been found.'), 'static_info');
}
}
示例7: _client_generateItem
/**
* Generate an external mail server item
*
* @access private
* @param iMSCP_pTemplate $tpl Template instance
* @param string $externalMail Status of external mail for the domain
* @param int $domainId Domain id
* @param string $domainName Domain name
* @param string $status Item status
* @param string $type Domain type (normal for domain or alias for domain alias)
* @return void
*/
function _client_generateItem($tpl, $externalMail, $domainId, $domainName, $status, $type)
{
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$idnDomainName = decode_idna($domainName);
$statusOk = 'ok';
$queryParam = urlencode("{$domainId};{$type}");
$htmlDisabled = $cfg['HTML_DISABLED'];
if ($externalMail == 'off') {
$tpl->assign(array('DOMAIN' => $idnDomainName, 'STATUS' => $status == $statusOk ? tr('Deactivated') : translate_dmn_status($status), 'DISABLED' => $htmlDisabled, 'ITEM_TYPE' => $type, 'ITEM_ID' => $domainId, 'ACTIVATE_URL' => $status == $statusOk ? "mail_external_add.php?item={$queryParam}" : '#', 'TR_ACTIVATE' => $status == $statusOk ? tr('Activate') : tr('N/A'), 'EDIT_LINK' => '', 'DEACTIVATE_LINK' => ''));
$tpl->parse('ACTIVATE_LINK', 'activate_link');
} elseif (in_array($externalMail, array('domain', 'wildcard', 'filter'))) {
$tpl->assign(array('DOMAIN' => $idnDomainName, 'STATUS' => $status == $statusOk ? tr('Activated') : translate_dmn_status($status), 'DISABLED' => $status == $statusOk ? '' : $htmlDisabled, 'ITEM_TYPE' => $type, 'ITEM_ID' => $domainId, 'ACTIVATE_LINK' => '', 'TR_EDIT' => $status == $statusOk ? tr('Edit') : tr('N/A'), 'EDIT_URL' => $status == $statusOk ? "mail_external_edit.php?item={$queryParam}" : '#', 'TR_DEACTIVATE' => $status == $statusOk ? tr('Deactivate') : tr('N/A'), 'DEACTIVATE_URL' => $status == $statusOk ? "mail_external_delete.php?item={$queryParam}" : '#'));
$tpl->parse('EDIT_LINK', 'edit_link');
$tpl->parse('DEACTIVATE_LINK', 'deactivate_link');
}
}
示例8: gen_htaccess_entries
/**
* @param iMSCP_pTemplate $tpl
* @param $dmn_id
* @return void
*/
function gen_htaccess_entries($tpl, &$dmn_id)
{
$query = "SELECT * FROM `htaccess` WHERE `dmn_id` = ?";
$rs = exec_query($query, $dmn_id);
if ($rs->recordCount() == 0) {
$tpl->assign('PROTECTED_AREAS', '');
set_page_message(tr('You do not have protected areas.'), 'static_info');
} else {
$counter = 0;
while (!$rs->EOF) {
$tpl->assign('CLASS', $counter % 2 == 0 ? 'content' : 'content2');
$id = $rs->fields['id'];
$user_id = $rs->fields['user_id'];
$group_id = $rs->fields['group_id'];
$status = $rs->fields['status'];
$path = $rs->fields['path'];
$auth_name = $rs->fields['auth_name'];
$tpl->assign(array('AREA_NAME' => tohtml($auth_name), 'JS_AREA_NAME' => addslashes($auth_name), 'AREA_PATH' => tohtml($path), 'PID' => $id, 'STATUS' => translate_dmn_status($status)));
$tpl->parse('DIR_ITEM', '.dir_item');
$rs->moveNext();
$counter++;
}
}
}
示例9: generate_users_list
/**
* Generates users list.
*
* @param iMSCP_pTemplate $tpl Template engine
* @param int $resellerId Reseller unique identifier
* @return void
*/
function generate_users_list($tpl, $resellerId)
{
$cfg = iMSCP_Registry::get('config');
$rowsPerPage = $cfg['DOMAIN_ROWS_PER_PAGE'];
if (isset($_POST['details']) && !empty($_POST['details'])) {
$_SESSION['details'] = $_POST['details'];
} else {
if (!isset($_SESSION['details'])) {
$_SESSION['details'] = 'hide';
}
}
if (isset($_GET['psi']) && $_GET['psi'] == 'last') {
if (isset($_SESSION['search_page'])) {
$_GET['psi'] = $_SESSION['search_page'];
} else {
unset($_GET['psi']);
}
}
// Search request generated?
if (isset($_POST['search_for']) && !empty($_POST['search_for'])) {
$_SESSION['search_for'] = trim(clean_input($_POST['search_for']));
$_SESSION['search_common'] = $_POST['search_common'];
$_SESSION['search_status'] = $_POST['search_status'];
$startIndex = 0;
} else {
$startIndex = isset($_GET['psi']) ? (int) $_GET['psi'] : 0;
if (isset($_SESSION['search_for']) && !isset($_GET['psi'])) {
// He have not got scroll through patient records.
unset($_SESSION['search_for']);
unset($_SESSION['search_common']);
unset($_SESSION['search_status']);
}
}
$_SESSION['search_page'] = $startIndex;
$searchQuery = '';
$countQuery = '';
if (isset($_SESSION['search_for'])) {
gen_manage_domain_query($searchQuery, $countQuery, $resellerId, $startIndex, $rowsPerPage, $_SESSION['search_for'], $_SESSION['search_common'], $_SESSION['search_status']);
gen_manage_domain_search_options($tpl, $_SESSION['search_for'], $_SESSION['search_common'], $_SESSION['search_status']);
} else {
gen_manage_domain_query($searchQuery, $countQuery, $resellerId, $startIndex, $rowsPerPage, 'n/a', 'n/a', 'n/a');
gen_manage_domain_search_options($tpl, 'n/a', 'n/a', 'n/a');
}
$stmt = execute_query($countQuery);
$rowCount = $stmt->fields['cnt'];
$stmt = execute_query($searchQuery);
if ($rowCount == 0) {
if (isset($_SESSION['search_for'])) {
$tpl->assign(array('USR_MESSAGE' => tr('No records found matching the search criteria.'), 'USERS_LIST' => '', 'SCROLL_PREV' => '', 'SCROLL_NEXT' => '', 'TR_VIEW_DETAILS' => tr('View aliases'), 'SHOW_DETAILS' => tr('Show')));
unset($_SESSION['search_for']);
unset($_SESSION['search_common']);
unset($_SESSION['search_status']);
} else {
$tpl->assign(array('USERS_SEARCH' => '', 'USR_MESSAGE' => tr('No customer accounts found.'), 'USERS_LIST' => '', 'SCROLL_PREV' => '', 'SCROLL_PREV_GRAY' => '', 'SCROLL_NEXT' => '', 'SCROLL_NEXT_GRAY' => '', 'TR_VIEW_DETAILS' => tr('View aliases'), 'SHOW_DETAILS' => tr('Show')));
}
$tpl->parse('USR_MESSAGE', 'usr_message');
} else {
$prevSi = $startIndex - $rowsPerPage;
if ($startIndex == 0) {
$tpl->assign('SCROLL_PREV', '');
} else {
$tpl->assign(array('SCROLL_PREV_GRAY' => '', 'PREV_PSI' => $prevSi));
}
$nextSi = $startIndex + $rowsPerPage;
if ($nextSi + 1 > $rowCount) {
$tpl->assign('SCROLL_NEXT', '');
} else {
$tpl->assign(array('SCROLL_NEXT_GRAY' => '', 'NEXT_PSI' => $nextSi));
}
while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
if ($row['admin_status'] == 'ok' && $row['domain_status'] == 'ok') {
$statusIcon = 'ok';
$statusDomain = translate_dmn_status($row['domain_status']);
$domainStatusTooltip = tr('Click to deactivate');
$statusBool = true;
$canChange = true;
} else {
if ($row['domain_status'] == 'disabled') {
$statusIcon = 'disabled';
$statusDomain = translate_dmn_status($row['domain_status']);
$domainStatusTooltip = tr('Click to activate');
$statusBool = false;
$canChange = true;
} else {
if ($row['domain_status'] == 'toadd' || $row['domain_status'] == 'torestore' || $row['domain_status'] == 'tochange' || $row['domain_status'] == 'toenable' || $row['domain_status'] == 'todisable' || $row['domain_status'] == 'todelete') {
$statusIcon = 'reload';
$statusDomain = $domainStatusTooltip = translate_dmn_status($row['admin_status'] != 'ok' ? $row['admin_status'] : $row['domain_status']);
$statusBool = false;
$canChange = false;
} else {
$statusIcon = 'error';
$statusDomain = translate_dmn_status($row['admin_status'] != 'ok' ? $row['admin_status'] : $row['domain_status']);
$domainStatusTooltip = tr('An unexpected error occurred. Please contact your administrator.');
//.........这里部分代码省略.........
示例10: gen_al_page
function gen_al_page(&$tpl, $reseller_id)
{
global $sql;
$dmn_id = $_SESSION['dmn_id'];
$query = <<<SQL_QUERY
select
alias_id,
alias_name,
alias_status
from
domain_aliasses
where
domain_id = ?
SQL_QUERY;
$rs = exec_query($sql, $query, array($dmn_id));
if ($rs->RecordCount() == 0) {
$tpl->assign('ALIAS_LIST', '');
} else {
$i = 0;
while (!$rs->EOF) {
$alias_name = decode_idna($rs->fields['alias_name']);
$alias_status = translate_dmn_status($rs->fields['alias_status']);
if ($i % 2 == 0) {
$page_cont = 'content';
} else {
$page_cont = 'content2';
}
$tpl->assign(array('DOMAIN_ALIS' => $alias_name, 'STATUS' => $alias_status, 'CLASS' => $page_cont));
$i++;
$tpl->parse('ALIAS_ENTRY', '.alias_entry');
$rs->MoveNext();
}
}
}
示例11: gen_user_list
/**
* Helper function to generate a user list
*
* @param iMSCP_pTemplate $tpl iMSCP_pTemplate instance
* @return void
*/
function gen_user_list($tpl)
{
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$startIndex = 0;
$rowsPerPage = $cfg['DOMAIN_ROWS_PER_PAGE'];
if (isset($_GET['psi']) && $_GET['psi'] == 'last') {
if (isset($_SESSION['search_page'])) {
$_GET['psi'] = $_SESSION['search_page'];
} else {
unset($_GET['psi']);
}
}
if (isset($_GET['psi'])) {
$startIndex = $_GET['psi'];
}
// Search request generated ?
if (isset($_POST['uaction']) && !empty($_POST['uaction'])) {
$_SESSION['search_for'] = clean_input($_POST['search_for']);
$_SESSION['search_common'] = $_POST['search_common'];
$_SESSION['search_status'] = $_POST['search_status'];
$startIndex = 0;
} elseif (isset($_SESSION['search_for']) && !isset($_GET['psi'])) {
// He have not got scroll through patient records
unset($_SESSION['search_for']);
unset($_SESSION['search_common']);
unset($_SESSION['search_status']);
}
$searchQuery = $countQuery = '';
if (isset($_SESSION['search_for'])) {
gen_admin_domain_query($searchQuery, $countQuery, $startIndex, $rowsPerPage, $_SESSION['search_for'], $_SESSION['search_common'], $_SESSION['search_status']);
gen_admin_domain_search_options($tpl, $_SESSION['search_for'], $_SESSION['search_common'], $_SESSION['search_status']);
$stmt = exec_query($countQuery);
} else {
gen_admin_domain_query($searchQuery, $countQuery, $startIndex, $rowsPerPage, 'n/a', 'n/a', 'n/a');
gen_admin_domain_search_options($tpl, 'n/a', 'n/a', 'n/a');
$stmt = exec_query($countQuery);
}
$recordCount = $stmt->fields['cnt'];
$stmt = execute_query($searchQuery);
if (!$stmt->rowCount()) {
if (isset($_SESSION['search_for'])) {
$tpl->assign(array('USR_MESSAGE' => tr('No records found matching the search criteria.'), 'USR_LIST' => '', 'SCROLL_PREV' => '', 'SCROLL_NEXT' => '', 'TR_VIEW_DETAILS' => tr('view aliases'), 'SHOW_DETAILS' => 'show'));
unset($_SESSION['search_for']);
unset($_SESSION['search_common']);
unset($_SESSION['search_status']);
} else {
$tpl->assign(array('SEARCH_FORM' => '', 'USR_MESSAGE' => tr('No customer accounts found.'), 'USR_LIST' => '', 'SCROLL_PREV' => '', 'SCROLL_NEXT' => '', 'TR_VIEW_DETAILS' => tr('view aliases'), 'SHOW_DETAILS' => 'show'));
}
$tpl->parse('USR_MESSAGE', 'usr_message');
} else {
$prevSi = $startIndex - $rowsPerPage;
if ($startIndex == 0) {
$tpl->assign('SCROLL_PREV', '');
} else {
$tpl->assign(array('SCROLL_PREV_GRAY' => '', 'PREV_PSI' => $prevSi));
}
$nextSi = $startIndex + $rowsPerPage;
if ($nextSi + 1 > $recordCount) {
$tpl->assign('SCROLL_NEXT', '');
} else {
$tpl->assign(array('SCROLL_NEXT_GRAY' => '', 'NEXT_PSI' => $nextSi));
}
$tpl->assign(array('TR_USR_USERNAME' => tr('Username'), 'TR_USR_CREATED_BY' => tr('Created by'), 'TR_USR_ACTIONS' => tr('Actions'), 'TR_USER_STATUS' => tr('Status'), 'TR_DETAILS' => tr('Details')));
while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
// user status icon
$domainCreatedBy = $row['created_by'];
$stmt2 = exec_query('SELECT admin_name, admin_status FROM admin WHERE admin_id = ?', $domainCreatedBy);
if (!isset($stmt2->fields['admin_name'])) {
$createdByName = tr('N/A');
} else {
$createdByName = $stmt2->fields['admin_name'];
}
$tpl->assign(array('USR_DELETE_SHOW' => '', 'USER_ID' => $row['admin_id'], 'DOMAIN_ID' => $row['domain_id'], 'TR_DELETE' => tr('Delete'), 'URL_DELETE_USR' => 'user_delete.php?domain_id=' . $row['domain_id'], 'TR_CHANGE_USER_INTERFACE' => tr('Switch to user interface'), 'GO_TO_USER_INTERFACE' => tr('Switch'), 'URL_CHANGE_INTERFACE' => 'change_user_interface.php?to_id=' . $row['domain_admin_id'], 'USR_USERNAME' => tohtml($row['domain_name']), 'TR_EDIT_DOMAIN' => tr('Edit domain'), 'TR_EDIT_USR' => tr('Edit user')));
$tpl->parse('USR_DELETE_LINK', 'usr_delete_link');
if ($row['admin_status'] == 'ok' && $row['domain_status'] == 'ok') {
$status = 'ok';
$statusTooltip = tr('Click to deactivate');
$statusTxt = translate_dmn_status($row['domain_status']);
$statusBool = true;
$canChange = true;
} elseif ($row['domain_status'] == 'disabled') {
$status = 'disabled';
$statusTooltip = tr('Click to activate');
$statusTxt = translate_dmn_status($row['domain_status']);
$statusBool = false;
$canChange = true;
} elseif ($row['domain_status'] == 'toadd' || $row['domain_status'] == 'torestore' || $row['domain_status'] == 'tochange' || $row['domain_status'] == 'toenable' || $row['domain_status'] == 'todisable' || $row['domain_status'] == 'todelete') {
$status = 'reload';
$statusTxt = $statusTooltip = translate_dmn_status($row['admin_status'] != 'ok' ? $row['admin_status'] : $row['domain_status']);
$statusBool = false;
$canChange = false;
} else {
$status = 'error';
//.........这里部分代码省略.........
示例12: client_genetateGroupsList
/**
* Generates groups list.
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @param int $domainId Domain unique identifier
* @return void
*/
function client_genetateGroupsList($tpl, $domainId)
{
$query = "SELECT * FROM `htaccess_groups` WHERE `dmn_id` = ? ORDER BY `dmn_id` DESC";
$stmt = exec_query($query, $domainId);
if (!$stmt->rowCount()) {
$tpl->assign(array('GROUPS_MESSAGE' => tr('No group found.'), 'GROUPS_BLOCK' => ''));
} else {
$tpl->assign('GROUPS_MESSAGE_BLOCK', '');
foreach ($stmt->fetchAll() as $group) {
list($groupDeleteTranslation, $groupDeleteJsScript) = _client_generateHtgroupAction($group['status'], $group['ugroup']);
$tpl->assign(array('GNAME' => tohtml($group['ugroup']), 'GSTATUS' => translate_dmn_status($group['status']), 'GROUP_ID' => $group['id'], 'GROUP_DELETE' => $groupDeleteTranslation, 'GROUP_DELETE_SCRIPT' => $groupDeleteJsScript));
if (empty($group['members'])) {
$tpl->assign('GROUP_MEMBERS', '');
} else {
$query = "SELECT `uname` FROM `htaccess_users` WHERE `id` IN({$group['members']})";
$stmt = execute_query($query);
$tpl->assign('MEMBER', tohtml(implode(', ', $stmt->fetchAll(PDO::FETCH_COLUMN))));
$tpl->parse('GROUP_MEMBERS', '.group_members');
}
$tpl->parse('GROUP_BLOCK', '.group_block');
$tpl->assign('GROUP_MEMBERS', '');
$stmt->moveNext();
}
}
}
示例13: _client_generateIpAction
/**
* Generates Ips action.
*
* @access private
* @param int $ipId Ip address unique identifier
* @param string $status
* @return array
*/
function _client_generateIpAction($ipId, $status)
{
if ($status == 'ok') {
return array(tr('Remove IP'), 'ip_delete.php?delete_id=' . $ipId);
} elseif ($status == 'todelete') {
return array(translate_dmn_status('todelete'), '#');
} elseif ($status == 'toadd') {
return array(translate_dmn_status('toadd'), '#');
} elseif (!in_array($status, array('toadd', 'tochange', 'ok', 'todelete'))) {
return array(tr('Unknown Error'), '#');
} else {
return array(tr('N/A'), '#');
}
}
示例14: gen_user_als_list
/**
* @param EasySCP_TemplateEngine $tpl
* @param int $user_id
*/
function gen_user_als_list($tpl, $user_id)
{
$sql = EasySCP_Registry::get('Db');
$domain_id = get_user_domain_id($user_id);
$query = "\n\t\tSELECT\n\t\t\t`alias_id`,\n\t\t\t`alias_name`,\n\t\t\t`status`,\n\t\t\t`alias_mount`,\n\t\t\t`alias_ip_id`,\n\t\t\t`url_forward`\n\t\tFROM\n\t\t\t`domain_aliasses`\n\t\tWHERE\n\t\t\t`domain_id` = ?\n\t\tORDER BY\n\t\t\t`alias_mount`,\n\t\t\t`alias_name`\n\t;";
$rs = exec_query($sql, $query, $domain_id);
if ($rs->recordCount() == 0) {
$tpl->assign(array('ALS_MSG' => tr('Alias list is empty!'), 'ALS_MSG_TYPE' => 'info', 'ALS_LIST' => ''));
} else {
while (!$rs->EOF) {
list($als_action, $als_action_script) = gen_user_als_action($rs->fields['alias_id'], $rs->fields['status']);
list($als_forward, $alias_edit_link, $als_edit) = gen_user_als_forward($rs->fields['alias_id'], $rs->fields['status'], $rs->fields['url_forward']);
$alias_name = decode_idna($rs->fields['alias_name']);
$als_forward = decode_idna($als_forward);
$tpl->append(array('ALS_NAME' => tohtml($alias_name), 'ALS_MOUNT' => tohtml($rs->fields['alias_mount']), 'ALS_STATUS' => translate_dmn_status($rs->fields['status']), 'ALS_FORWARD' => tohtml($als_forward), 'ALS_EDIT_LINK' => $alias_edit_link, 'ALS_EDIT' => $als_edit, 'ALS_ACTION' => $als_action, 'ALS_ACTION_SCRIPT' => $als_action_script));
$rs->moveNext();
}
$tpl->assign('ALS_MESSAGE', '');
}
}
示例15: generateSubdomainsList
/**
* Generates subdomains list
*
* @param iMSCP_pTemplate $tpl Template engine
* @return void
*/
function generateSubdomainsList($tpl)
{
if (!customerHasFeature('subdomains')) {
$tpl->assign('SUBDOMAINS_BLOCK', '');
return;
}
$domainId = get_user_domain_id($_SESSION['user_id']);
// Subdomains
$stmt1 = exec_query('
SELECT subdomain_id, subdomain_name, subdomain_mount, subdomain_status, subdomain_url_forward, domain_name
FROM subdomain JOIN domain ON (subdomain.domain_id = domain.domain_id)
WHERE subdomain.domain_id = ? ORDER BY subdomain_name
', $domainId);
// Domain aliases subdomains
$stmt2 = exec_query('
SELECT subdomain_alias_id, subdomain_alias_name, subdomain_alias_mount, subdomain_alias_url_forward,
subdomain_alias_status, alias_name
FROM subdomain_alias JOIN domain_aliasses ON subdomain_alias.alias_id = domain_aliasses.alias_id
WHERE domain_id = ?
ORDER BY subdomain_alias_name
', $domainId);
if (!$stmt1->rowCount() && !$stmt2->rowCount()) {
$tpl->assign(array('SUB_MSG' => tr('You do not have subdomains.'), 'SUB_LIST' => ''));
return;
}
while ($row = $stmt1->fetchRow()) {
$domainName = $row['domain_name'];
$subId = $row['subdomain_id'];
$subName = $row['subdomain_name'];
$subStatus = $row['subdomain_status'];
$subUrlForward = $row['subdomain_url_forward'];
$subMountPoint = $row['subdomain_mount'];
list($action, $actionScript, $isStatusOk, $certText, $certScript) = generateSubdomainAction($subId, $subStatus);
list($redirectUrl, $editLink, $edit) = generateSubdomainRedirect($subId, $subStatus, $subUrlForward, 'dmn');
$domainName = decode_idna($domainName);
$subName = decode_idna($subName);
$redirectUrl = decode_idna($redirectUrl);
if ($isStatusOk) {
$tpl->assign(array('SUB_NAME' => tohtml($subName), 'SUB_ALIAS_NAME' => tohtml($domainName), 'SUB_STATUS_RELOAD_FALSE' => ''));
$tpl->parse('SUB_STATUS_RELOAD_TRUE', 'sub_status_reload_true');
} else {
$tpl->assign(array('SUB_NAME' => tohtml($subName), 'SUB_ALIAS_NAME' => tohtml($domainName), 'SUB_STATUS_RELOAD_TRUE' => ''));
$tpl->parse('SUB_STATUS_RELOAD_FALSE', 'sub_status_reload_false');
}
$tpl->assign(array('SUB_MOUNT' => tohtml($subMountPoint), 'SUB_REDIRECT' => $redirectUrl, 'SUB_STATUS' => translate_dmn_status($subStatus), 'SUB_EDIT_LINK' => $editLink, 'SUB_EDIT' => $edit, 'CERT_SCRIPT' => $certScript, 'VIEW_CERT' => $certText, 'SUB_ACTION' => $action, 'SUB_ACTION_SCRIPT' => $actionScript));
$tpl->parse('SUB_ITEM', '.sub_item');
}
while ($row = $stmt2->fetchRow(PDO::FETCH_ASSOC)) {
$alsName = $row['alias_name'];
$alssubId = $row['subdomain_alias_id'];
$alssubName = $row['subdomain_alias_name'];
$alssubStatus = $row['subdomain_alias_status'];
$alssubMountPoint = $row['subdomain_alias_mount'];
$alssubUrlForward = $row['subdomain_alias_url_forward'];
list($action, $actionScript, $isStatusOk, $certText, $certScript) = generateSubdomainAliasAction($alssubId, $alssubStatus);
list($redirectUrl, $editLink, $edit) = generateSubdomainRedirect($alssubId, $alssubStatus, $alssubUrlForward, 'als');
$alsName = decode_idna($alsName);
$name = decode_idna($alssubName);
$redirectUrl = decode_idna($redirectUrl);
if ($isStatusOk) {
$tpl->assign(array('SUB_NAME' => tohtml($name), 'SUB_ALIAS_NAME' => tohtml($alsName), 'SUB_STATUS_RELOAD_FALSE' => ''));
$tpl->parse('SUB_STATUS_RELOAD_TRUE', 'sub_status_reload_true');
} else {
$tpl->assign(array('SUB_NAME' => tohtml($name), 'SUB_ALIAS_NAME' => tohtml($alsName), 'SUB_STATUS_RELOAD_TRUE' => ''));
$tpl->parse('SUB_STATUS_RELOAD_FALSE', 'sub_status_reload_false');
}
$tpl->assign(array('SUB_NAME' => tohtml($name), 'SUB_MOUNT' => tohtml($alssubMountPoint), 'SUB_REDIRECT' => $redirectUrl, 'SUB_STATUS' => translate_dmn_status($alssubStatus), 'SUB_EDIT_LINK' => $editLink, 'SUB_EDIT' => $edit, 'CERT_SCRIPT' => $certScript, 'VIEW_CERT' => $certText, 'SUB_ACTION' => $action, 'SUB_ACTION_SCRIPT' => $actionScript));
$tpl->parse('SUB_ITEM', '.sub_item');
}
$tpl->assign('SUB_MESSAGE', '');
}