当前位置: 首页>>代码示例>>PHP>>正文


PHP decode_idna函数代码示例

本文整理汇总了PHP中decode_idna函数的典型用法代码示例。如果您正苦于以下问题:PHP decode_idna函数的具体用法?PHP decode_idna怎么用?PHP decode_idna使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了decode_idna函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gen_page_ftp_list

function gen_page_ftp_list(&$tpl, &$sql, $dmn_id, $dmn_name)
{
    $query = <<<SQL_QUERY
        select gid, members from ftp_group where groupname = ?
SQL_QUERY;
    $rs = exec_query($sql, $query, array($dmn_name));
    if ($rs->RecordCount() == 0) {
        $tpl->assign(array('FTP_MSG' => tr('FTP list is empty!'), 'FTP_ITEM' => '', 'FTPS_TOTAL' => ''));
        $tpl->parse('FTP_MESSAGE', 'ftp_message');
    } else {
        $tpl->assign('FTP_MESSAGE', '');
        $ftp_accs = split(',', $rs->fields['members']);
        for ($i = 0; $i < count($ftp_accs); $i++) {
            if ($i % 2 == 0) {
                $tpl->assign('ITEM_CLASS', 'content');
            } else {
                $tpl->assign('ITEM_CLASS', 'content2');
            }
            $ftp_accs_encode[$i] = decode_idna($ftp_accs[$i]);
            $tpl->assign(array('FTP_ACCOUNT' => $ftp_accs_encode[$i], 'UID' => $ftp_accs[$i]));
            $tpl->parse('FTP_ITEM', '.ftp_item');
        }
        $tpl->assign('TOTAL_FTP_ACCOUNTS', count($ftp_accs));
    }
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:25,代码来源:ftp_accounts.php

示例2: client_generatePage

/**
 * Generate page
 *
 * @param $tpl iMSCP_pTemplate
 * @return void
 */
function client_generatePage($tpl)
{
    if (isset($_GET['id'])) {
        $domainAliasId = clean_input($_GET['id']);
        if (!($domainAliasData = _client_getAliasData($domainAliasId))) {
            showBadRequestErrorPage();
        }
        if (empty($_POST)) {
            if ($domainAliasData['forward_url'] != 'no') {
                $urlForwarding = true;
                $uri = iMSCP_Uri_Redirect::fromString($domainAliasData['forward_url']);
                $forwardUrlScheme = $uri->getScheme();
                $forwardUrl = substr($uri->getUri(), strlen($forwardUrlScheme) + 3);
            } else {
                $urlForwarding = false;
                $forwardUrlScheme = 'http://';
                $forwardUrl = '';
            }
        } else {
            $urlForwarding = isset($_POST['url_forwarding']) && $_POST['url_forwarding'] == 'yes' ? true : false;
            $forwardUrlScheme = isset($_POST['forward_url_scheme']) ? $_POST['forward_url_scheme'] : 'http://';
            $forwardUrl = isset($_POST['forward_url']) ? $_POST['forward_url'] : '';
        }
        /** @var iMSCP_Config_Handler_File $cfg */
        $cfg = iMSCP_Registry::get('config');
        $checked = $cfg->HTML_CHECKED;
        $selected = $cfg->HTML_SELECTED;
        $tpl->assign(array('DOMAIN_ALIAS_ID' => $domainAliasId, 'DOMAIN_ALIAS_NAME' => tohtml($domainAliasData['alias_name_utf8']), 'FORWARD_URL_YES' => $urlForwarding ? $checked : '', 'FORWARD_URL_NO' => $urlForwarding ? '' : $checked, 'HTTP_YES' => $forwardUrlScheme == 'http://' ? $selected : '', 'HTTPS_YES' => $forwardUrlScheme == 'https://' ? $selected : '', 'FTP_YES' => $forwardUrlScheme == 'ftp://' ? $selected : '', 'FORWARD_URL' => tohtml(decode_idna($forwardUrl))));
    } else {
        showBadRequestErrorPage();
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:38,代码来源:alias_edit.php

示例3: generatePage

/**
 * Generate domain statistics for the given period
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @param int $userId User unique identifier
 * @return void
 */
function generatePage($tpl, $userId)
{
    $stmt = exec_query('
			SELECT
				admin_name, domain_id
			FROM
				admin
			INNER JOIN
				domain ON(domain_admin_id = admin_id)
			WHERE
				admin_id = ?
			AND
				created_by = ?
		', array($userId, $_SESSION['user_id']));
    if (!$stmt->rowCount()) {
        showBadRequestErrorPage();
    }
    $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
    $domainId = $row['domain_id'];
    $adminName = decode_idna($row['admin_name']);
    if (isset($_POST['month']) && isset($_POST['year'])) {
        $year = intval($_POST['year']);
        $month = intval($_POST['month']);
    } else {
        $month = date('m');
        $year = date('Y');
    }
    $stmt = exec_query('SELECT dtraff_time FROM domain_traffic WHERE domain_id = ? ORDER BY dtraff_time ASC LIMIT 1', $domainId);
    if ($stmt->rowCount()) {
        $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
        $numberYears = date('y') - date('y', $row['dtraff_time']);
        $numberYears = $numberYears ? $numberYears + 1 : 1;
    } else {
        $numberYears = 1;
    }
    generateMonthsAndYearsHtmlList($tpl, $month, $year, $numberYears);
    $stmt = exec_query('SELECT domain_id FROM domain_traffic WHERE dtraff_time BETWEEN ? AND ? LIMIT 1', array(getFirstDayOfMonth($month, $year), getLastDayOfMonth($month, $year)));
    if ($stmt->rowCount()) {
        $requestedPeriod = getLastDayOfMonth($month, $year);
        $toDay = $requestedPeriod < time() ? date('j', $requestedPeriod) : date('j');
        $all = array_fill(0, 8, 0);
        $dateFormat = iMSCP_Registry::get('config')->DATE_FORMAT;
        for ($fromDay = 1; $fromDay <= $toDay; $fromDay++) {
            $beginTime = mktime(0, 0, 0, $month, $fromDay, $year);
            $endTime = mktime(23, 59, 59, $month, $fromDay, $year);
            list($webTraffic, $ftpTraffic, $smtpTraffic, $popTraffic) = _getDomainTraffic($domainId, $beginTime, $endTime);
            $tpl->assign(array('DATE' => date($dateFormat, strtotime($year . '-' . $month . '-' . $fromDay)), 'WEB_TRAFFIC' => bytesHuman($webTraffic), 'FTP_TRAFFIC' => bytesHuman($ftpTraffic), 'SMTP_TRAFFIC' => bytesHuman($smtpTraffic), 'POP3_TRAFFIC' => bytesHuman($popTraffic), 'ALL_TRAFFIC' => bytesHuman($webTraffic + $ftpTraffic + $smtpTraffic + $popTraffic)));
            $all[0] += $webTraffic;
            $all[1] += $ftpTraffic;
            $all[2] += $smtpTraffic;
            $all[3] += $popTraffic;
            $tpl->parse('TRAFFIC_TABLE_ITEM', '.traffic_table_item');
        }
        $tpl->assign(array('USER_ID' => tohtml($userId), 'USERNAME' => tohtml($adminName), 'ALL_WEB_TRAFFIC' => tohtml(bytesHuman($all[0])), 'ALL_FTP_TRAFFIC' => tohtml(bytesHuman($all[1])), 'ALL_SMTP_TRAFFIC' => tohtml(bytesHuman($all[2])), 'ALL_POP3_TRAFFIC' => tohtml(bytesHuman($all[3])), 'ALL_ALL_TRAFFIC' => tohtml(bytesHuman(array_sum($all)))));
    } else {
        set_page_message(tr('No statistics found for the given period. Try another period.'), 'static_info');
        $tpl->assign(array('USERNAME' => tohtml($adminName), 'USER_ID' => tohtml($userId), 'USER_STATISTICS_DETAILS_BLOCK' => ''));
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:66,代码来源:user_statistics_details.php

示例4: generatePage

/**
 * Generates page
 *
 * @param  iMSCP_pTemplate $tpl Template engine
 * @return void
 */
function generatePage($tpl)
{
    global $hpId, $dmnName, $adminName, $email, $customerId, $firstName, $lastName, $gender, $firm, $zip, $city, $state, $country, $street1, $street2, $phone, $fax, $domainIp;
    $adminName = decode_idna($adminName);
    $tpl->assign(array('VL_USERNAME' => tohtml($adminName, 'htmlAttr'), 'VL_MAIL' => tohtml($email, 'htmlAttr'), 'VL_USR_ID' => tohtml($customerId, 'htmlAttr'), 'VL_USR_NAME' => tohtml($firstName, 'htmlAttr'), 'VL_LAST_USRNAME' => tohtml($lastName, 'htmlAttr'), 'VL_USR_FIRM' => tohtml($firm, 'htmlAttr'), 'VL_USR_POSTCODE' => tohtml($zip, 'htmlAttr'), 'VL_USRCITY' => tohtml($city, 'htmlAttr'), 'VL_USRSTATE' => tohtml($state, 'htmlAttr'), 'VL_MALE' => $gender == 'M' ? ' selected' : '', 'VL_FEMALE' => $gender == 'F' ? ' selected' : '', 'VL_UNKNOWN' => $gender == 'U' ? ' selected' : '', 'VL_COUNTRY' => tohtml($country, 'htmlAttr'), 'VL_STREET1' => tohtml($street1, 'htmlAttr'), 'VL_STREET2' => tohtml($street2, 'htmlAttr'), 'VL_PHONE' => tohtml($phone, 'htmlAttr'), 'VL_FAX' => tohtml($fax, 'htmlAttr')));
    reseller_generate_ip_list($tpl, $_SESSION['user_id'], $domainIp);
    $_SESSION['local_data'] = "{$dmnName};{$hpId}";
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:14,代码来源:user_add3.php

示例5: _generateUserStatistics

/**
 * Generates statistics for the given user
 *
 * @access private
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @param int $adminId User unique identifier
 * @return void
 */
function _generateUserStatistics($tpl, $adminId)
{
    list($adminName, , $webTraffic, $ftpTraffic, $smtpTraffic, $popImapTraffic, $trafficUsageBytes, $diskspaceUsageBytes) = shared_getCustomerStats($adminId);
    list($subCount, $subMax, $alsCount, $alsMax, $mailCount, $mailMax, $ftpUserCount, $FtpUserMax, $sqlDbCount, $sqlDbMax, $sqlUserCount, $sqlUserMax, $trafficLimit, $diskspaceLimit) = shared_getCustomerProps($adminId);
    $trafficLimitBytes = $trafficLimit * 1048576;
    $diskspaceLimitBytes = $diskspaceLimit * 1048576;
    $trafficPercent = make_usage_vals($trafficUsageBytes, $trafficLimitBytes);
    $diskPercent = make_usage_vals($diskspaceUsageBytes, $diskspaceLimitBytes);
    $tpl->assign(array('USER_ID' => tohtml($adminId), 'USERNAME' => tohtml(decode_idna($adminName)), 'TRAFF_PERCENT' => tohtml($trafficPercent), 'TRAFF_MSG' => $trafficLimitBytes ? tohtml(tr('%1$s / %2$s', bytesHuman($trafficUsageBytes), bytesHuman($trafficLimitBytes))) : tohtml(tr('%s / unlimited', bytesHuman($trafficUsageBytes))), 'DISK_PERCENT' => tohtml($diskPercent), 'DISK_MSG' => $diskspaceLimitBytes ? tohtml(tr('%1$s / %2$s', bytesHuman($diskspaceUsageBytes), bytesHuman($diskspaceLimitBytes))) : tohtml(tr('%s / unlimited', bytesHuman($diskspaceUsageBytes))), 'WEB' => tohtml(bytesHuman($webTraffic)), 'FTP' => tohtml(bytesHuman($ftpTraffic)), 'SMTP' => tohtml(bytesHuman($smtpTraffic)), 'POP3' => tohtml(bytesHuman($popImapTraffic)), 'SUB_MSG' => $subMax ? $subMax > 0 ? tohtml(tr('%1$d / %2$d', $subCount, $subMax)) : tohtml(tr('disabled')) : tohtml(tr('%d / unlimited', $subCount)), 'ALS_MSG' => $alsMax ? $alsMax > 0 ? tohtml(tr('%1$d / %2$d', $alsCount, $alsMax)) : tohtml(tr('disabled')) : tohtml(tr('%d / unlimited', $alsCount)), 'MAIL_MSG' => $mailMax ? $mailMax > 0 ? tohtml(tr('%1$d / %2$d', $mailCount, $mailMax)) : tohtml(tr('disabled')) : tohtml(tr('%d / unlimited', $mailCount)), 'FTP_MSG' => $FtpUserMax ? $FtpUserMax > 0 ? tohtml(tr('%1$d / %2$d', $ftpUserCount, $FtpUserMax)) : tohtml(tr('disabled')) : tohtml(tr('%d / unlimited', $ftpUserCount)), 'SQL_DB_MSG' => $sqlDbMax ? $sqlDbMax > 0 ? tohtml(tr('%1$d / %2$d', $sqlDbCount, $sqlDbMax)) : tohtml(tr('disabled')) : tohtml(tr('%d / unlimited', $sqlDbCount)), 'SQL_USER_MSG' => $sqlUserMax ? $sqlUserMax > 0 ? tohtml(tr('%1$d / %2$d', $sqlUserCount, $sqlUserMax)) : tohtml(tr('disabled')) : tohtml(tr('%d / unlimited', $sqlUserCount))));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:18,代码来源:user_statistics.php

示例6: _generateUserStatistics

/**
 * Genrate statistics entry for the given user
 *
 * @param iMSCP_pTemplate $tpl Template engine instance
 * @param int $adminId User unique identifier
 * @return void
 */
function _generateUserStatistics($tpl, $adminId)
{
    list($adminName, $domainId, $web, $ftp, $smtp, $pop3, $trafficUsageBytes, $diskspaceUsageBytes) = shared_getCustomerStats($adminId);
    list($usub_current, $usub_max, $uals_current, $uals_max, $umail_current, $umail_max, $uftp_current, $uftp_max, $usql_db_current, $usql_db_max, $usql_user_current, $usql_user_max, $trafficMaxMebimytes, $diskspaceMaxMebibytes) = shared_getCustomerProps($adminId);
    $trafficLimitBytes = $trafficMaxMebimytes * 1048576;
    $diskspaceLimitBytes = $diskspaceMaxMebibytes * 1048576;
    $trafficUsagePercent = make_usage_vals($trafficUsageBytes, $trafficLimitBytes);
    $diskspaceUsagePercent = make_usage_vals($diskspaceUsageBytes, $diskspaceLimitBytes);
    $tpl->assign(array('USER_NAME' => tohtml(decode_idna($adminName)), 'USER_ID' => tohtml($adminId), 'TRAFF_PERCENT' => tohtml($trafficUsagePercent), 'TRAFF_MSG' => $trafficLimitBytes ? tohtml(tr('%s of %s', bytesHuman($trafficUsageBytes), bytesHuman($trafficLimitBytes))) : tohtml(tr('%s of unlimited', bytesHuman($trafficUsageBytes))), 'DISK_PERCENT' => tohtml($diskspaceUsagePercent), 'DISK_MSG' => $diskspaceLimitBytes ? tohtml(tr('%s of %s', bytesHuman($diskspaceUsageBytes), bytesHuman($diskspaceLimitBytes))) : tohtml(tr('%s of unlimited', bytesHuman($diskspaceUsageBytes))), 'WEB' => tohtml(bytesHuman($web)), 'FTP' => tohtml(bytesHuman($ftp)), 'SMTP' => tohtml(bytesHuman($smtp)), 'POP3' => tohtml(bytesHuman($pop3)), 'SUB_MSG' => $usub_max ? tohtml(tr('%d of %s', $usub_current, translate_limit_value($usub_max))) : tohtml(translate_limit_value($usub_max)), 'ALS_MSG' => $uals_max ? tohtml(tr('%d of %s', $uals_current, translate_limit_value($uals_max))) : tohtml(translate_limit_value($uals_max)), 'MAIL_MSG' => $umail_max ? tohtml(tr('%d of %s', $umail_current, translate_limit_value($umail_max))) : tohtml(translate_limit_value($umail_max)), 'FTP_MSG' => $uftp_max ? tohtml(tr('%d of %s', $uftp_current, translate_limit_value($uftp_max))) : tohtml(translate_limit_value($uftp_max)), 'SQL_DB_MSG' => $usql_db_max ? tohtml(tr('%d of %s', $usql_db_current, translate_limit_value($usql_db_max))) : tohtml(translate_limit_value($usql_db_max)), 'SQL_USER_MSG' => $usql_user_max ? tohtml(tr('%1$d of %2$d', $usql_user_current, translate_limit_value($usql_user_max))) : tohtml(translate_limit_value($usql_user_max))));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:17,代码来源:reseller_user_statistics.php

示例7: onAfterAddDomainAlias

 /**
  * onAfterAddDomainAlias listener
  *
  * @throws iMSCP_Exception
  * @throws iMSCP_Exception_Database
  * @param iMSCP_Events_Event $event
  * @throws Exception
  */
 public function onAfterAddDomainAlias(iMSCP_Events_Event $event)
 {
     $userIdentity = iMSCP_Authentication::getInstance()->getIdentity();
     if ($userIdentity->admin_type == 'user') {
         $disallowedDomains = (array) $this->getConfigParam('ignored_domains', array());
         $domainAliasNameAscii = $event->getParam('domainAliasName');
         # Only domain aliases which are not listed in the ignored_domains list are auto-approved
         if (!in_array(decode_idna($domainAliasNameAscii), $disallowedDomains)) {
             $username = decode_idna($userIdentity->admin_name);
             $approvalRule = $this->getConfigParam('approval_rule', true);
             $userAccounts = (array) $this->getConfigParam('user_accounts', array());
             if ($approvalRule) {
                 # Only domain aliases added by user accounts which are listed in the user_accounts list are
                 # auto-approved
                 if (!in_array($username, $userAccounts)) {
                     $username = false;
                 }
             } elseif (in_array($username, $userAccounts)) {
                 # Only domain aliases added by user accounts which are not listed in the user_accounts list are
                 # auto-approved
                 $username = false;
             }
             if ($username !== false) {
                 $db = iMSCP_Database::getInstance();
                 try {
                     $db->beginTransaction();
                     $domainAliasId = $event->getParam('domainAliasId');
                     exec_query('UPDATE domain_aliasses SET alias_status = ? WHERE alias_id = ?', array('toadd', $domainAliasId));
                     if (iMSCP_Registry::get('config')->CREATE_DEFAULT_EMAIL_ADDRESSES) {
                         if ($userIdentity->email) {
                             client_mail_add_default_accounts(get_user_domain_id($userIdentity->admin_id), $userIdentity->email, $domainAliasNameAscii, 'alias', $domainAliasId);
                         }
                     }
                     $db->commit();
                     send_request();
                     $domainAliasName = decode_idna($domainAliasNameAscii);
                     $username = decode_idna($username);
                     write_log(sprintf('DomainAutoApproval: The %s domain alias has been auto-approved', $domainAliasName), E_USER_NOTICE);
                     write_log(sprintf('DomainAutoApproval: %s scheduled addition of domain alias: %s', $username, $domainAliasName), E_USER_NOTICE);
                     set_page_message(tr('Domain alias successfully scheduled for addition.'), 'success');
                     redirectTo('domains_manage.php');
                 } catch (iMSCP_Exception $e) {
                     $db->rollBack();
                     throw $e;
                 }
             }
         }
     }
 }
开发者ID:nciftci,项目名称:plugins,代码行数:57,代码来源:DomainAutoApproval.php

示例8: 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', '');
        }
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:28,代码来源:mail_catchall.php

示例9: _client_generateDatabaseSqlUserList

/**
 * Generates database sql users list
 *
 * @access private
 * @param iMSCP_pTemplate $tpl Template engine
 * @param int $dbId Database unique identifier
 * @return void
 */
function _client_generateDatabaseSqlUserList($tpl, $dbId)
{
    $stmt = exec_query('SELECT sqlu_id, sqlu_name, sqlu_host FROM sql_user WHERE sqld_id = ? ORDER BY sqlu_name', $dbId);
    if (!$stmt->rowCount()) {
        $tpl->assign('SQL_USERS_LIST', '');
    } else {
        $tpl->assign('SQL_USERS_LIST', '');
        $tpl->assign(array('TR_DB_USER' => 'User', 'TR_DB_USER_HOST' => 'Host', 'TR_DB_USER_HOST_TOOLTIP' => tr('Host from which SQL user is allowed to connect to SQL server')));
        while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
            $sqlUserName = $row['sqlu_name'];
            $tpl->assign(array('DB_USER' => tohtml($sqlUserName), 'DB_USER_HOST' => tohtml(decode_idna($row['sqlu_host'])), 'DB_USER_JS' => tojs($sqlUserName), 'USER_ID' => $row['sqlu_id']));
            $tpl->parse('SQL_USERS_LIST', '.sql_users_list');
        }
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:23,代码来源:sql_manage.php

示例10: 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');
    }
}
开发者ID:nciftci,项目名称:plugins,代码行数:52,代码来源:opendkim.php

示例11: _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');
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:29,代码来源:mail_external.php

示例12: gen_page_ftp_list

/**
 * @param EasySCP_TemplateEngine $tpl
 * @param EasySCP_Database $sql
 * @param int $dmn_id
 * @param string $dmn_name
 */
function gen_page_ftp_list($tpl, $sql, $dmn_id, $dmn_name)
{
    $query = "\n\t\tSELECT\n\t\t\t`gid`,\n\t\t\t`members`\n\t\tFROM\n\t\t\t`ftp_group`\n\t\tWHERE\n\t\t\t`groupname` = ?\n\t;";
    $rs = exec_query($sql, $query, $dmn_name);
    if ($rs->recordCount() == 0) {
        $tpl->assign(array('FTP_MSG' => tr('FTP list is empty!'), 'FTP_MSG_TYPE' => 'info', 'FTP_ITEM' => '', 'FTPS_TOTAL' => '', 'TABLE_LIST' => ''));
    } else {
        $ftp_accs = explode(',', $rs->fields['members']);
        sort($ftp_accs);
        reset($ftp_accs);
        for ($i = 0, $cnt_ftp_accs = count($ftp_accs); $i < $cnt_ftp_accs; $i++) {
            $tpl->assign('ITEM_CLASS', $i % 2 == 0 ? 'content' : 'content2');
            $ftp_accs_encode[$i] = decode_idna($ftp_accs[$i]);
            $query = "\n\t\t\t\tSELECT\n\t\t\t\t\t`net2ftppasswd`\n\t\t\t\tFROM\n\t\t\t\t\t`ftp_users`\n\t\t\t\tWHERE\n\t\t\t\t\t`userid` = ?\n\t\t\t;";
            $rs = exec_query($sql, $query, $ftp_accs[$i]);
            $tpl->append(array('FTP_ACCOUNT' => tohtml($ftp_accs_encode[$i]), 'UID' => urlencode($ftp_accs[$i]), 'FTP_LOGIN_AVAILABLE' => !is_null($rs->fields['net2ftppasswd'])));
        }
        $tpl->assign('TOTAL_FTP_ACCOUNTS', count($ftp_accs));
    }
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:26,代码来源:ftp_accounts.php

示例13: onAfterAddDomainAlias

 /**
  * onAfterAddDomainAlias listener
  *
  * @throws iMSCP_Exception
  * @throws iMSCP_Exception_Database
  * @param iMSCP_Events_Event $event
  * @throws Exception
  * @return void
  */
 public function onAfterAddDomainAlias(iMSCP_Events_Event $event)
 {
     $userIdentity = iMSCP_Authentication::getInstance()->getIdentity();
     // 1. Do not act if the logged-in user is not the real client (due to changes in i-MSCP v1.2.12)
     // 2. Do not act if the event has been triggered from reseller interface
     if (isset($_SESSION['logged_from_type']) || $userIdentity->admin_type == 'reseller') {
         return;
     }
     $disallowedDomains = (array) $this->getConfigParam('ignored_domains', array());
     $domainAliasNameAscii = $event->getParam('domainAliasName');
     if (in_array(decode_idna($domainAliasNameAscii), $disallowedDomains)) {
         return;
         # Only domain aliases which are not listed in the ignored_domains list are auto-approved
     }
     $username = decode_idna($userIdentity->admin_name);
     $approvalRule = $this->getConfigParam('approval_rule', true);
     $userAccounts = (array) $this->getConfigParam('user_accounts', array());
     # 1. Only domain aliases added by user which are listed in the 'user_accounts' list are auto-approved
     # 2. Only domain aliases added by user which are not listed in the 'user_accounts' list are auto-approved
     if ($approvalRule && !in_array($username, $userAccounts) || in_array($username, $userAccounts)) {
         return;
     }
     $db = iMSCP_Database::getInstance();
     try {
         $db->beginTransaction();
         $domainAliasId = $event->getParam('domainAliasId');
         exec_query('UPDATE domain_aliasses SET alias_status = ? WHERE alias_id = ?', array('toadd', $domainAliasId));
         $config = iMSCP_Registry::get('config');
         if ($config['CREATE_DEFAULT_EMAIL_ADDRESSES'] && $userIdentity->email !== '') {
             client_mail_add_default_accounts(get_user_domain_id($userIdentity->admin_id), $userIdentity->email, $domainAliasNameAscii, 'alias', $domainAliasId);
         }
         $db->commit();
         send_request();
         write_log(sprintf('DomainAutoApproval plugin: The `%s` domain alias has been auto-approved', decode_idna($domainAliasNameAscii)), E_USER_NOTICE);
         set_page_message(tr('Domain alias auto-approved.'), 'success');
     } catch (iMSCP_Exception $e) {
         $db->rollBack();
         throw $e;
     }
 }
开发者ID:reneschuster,项目名称:plugins,代码行数:49,代码来源:DomainAutoApproval.php

示例14: gen_user_sub_list

function gen_user_sub_list(&$tpl, &$sql, $user_id)
{
    $domain_id = get_user_domain_id($sql, $user_id);
    $query = <<<SQL_QUERY
        select
            subdomain_id, subdomain_name, subdomain_mount, subdomain_status
        from
            subdomain
        where
            domain_id = ?
        order by
            subdomain_name
SQL_QUERY;
    $rs = exec_query($sql, $query, array($domain_id));
    if ($rs->RecordCount() == 0) {
        $tpl->assign(array('SUB_MSG' => tr('Subdomain list is empty!'), 'SUB_LIST' => ''));
        $tpl->parse('SUB_MESSAGE', 'sub_message');
    } else {
        $counter = 0;
        while (!$rs->EOF) {
            if ($counter % 2 == 0) {
                $tpl->assign('ITEM_CLASS', 'content');
            } else {
                $tpl->assign('ITEM_CLASS', 'content2');
            }
            list($sub_action, $sub_action_script) = gen_user_sub_action($rs->fields['subdomain_id'], $rs->fields['subdomain_status']);
            $sbd_name = decode_idna($rs->fields['subdomain_name']);
            $tpl->assign(array('SUB_NAME' => $sbd_name, 'SUB_MOUNT' => $rs->fields['subdomain_mount'], 'SUB_STATUS' => translate_dmn_status($rs->fields['subdomain_status']), 'SUB_ACTION' => $sub_action, 'SUB_ACTION_SCRIPT' => $sub_action_script));
            $tpl->parse('SUB_ITEM', '.sub_item');
            $rs->MoveNext();
            $counter++;
        }
        $tpl->parse('SUB_LIST', 'sub_list');
        $tpl->assign('SUB_MESSAGE', '');
    }
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:36,代码来源:manage_domains.php

示例15: client_deleteMailAccount

/**
 * Schedule deletion of the given mail account
 *
 * @throws iMSCP_Exception on error
 * @param int $mailId Mail account unique identifier
 * @param array $dmnProps Main domain properties
 * @return void
 */
function client_deleteMailAccount($mailId, $dmnProps)
{
    $stmt = exec_query('SELECT `mail_addr` FROM `mail_users` WHERE `mail_id` = ? AND `domain_id` = ?', array($mailId, $dmnProps['domain_id']));
    if ($stmt->rowCount()) {
        $mailAddr = $stmt->fields['mail_addr'];
        $toDeleteStatus = 'todelete';
        iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onBeforeDeleteMail, array('mailId' => $mailId));
        exec_query('UPDATE `mail_users` SET `status` = ? WHERE `mail_id` = ?', array($toDeleteStatus, $mailId));
        // Schedule deleltion of all catchall which belong to the mail account
        exec_query('
				UPDATE
					`mail_users`
				SET
					`status` = ?
				WHERE
					`mail_acc` = ? OR `mail_acc` LIKE ? OR `mail_acc` LIKE ? OR `mail_acc` LIKE ?
			', array($toDeleteStatus, $mailAddr, "{$mailAddr},%", "%,{$mailAddr},%", "%,{$mailAddr}"));
        delete_autoreplies_log_entries($mailAddr);
        iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAfterDeleteMail, array('mailId' => $mailId));
        set_page_message(tr('Mail account %s successfully scheduled for deletion.', '<strong>' . decode_idna($mailAddr) . '</strong>'), 'success');
    } else {
        throw new iMSCP_Exception('Bad request.', 400);
    }
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:32,代码来源:mail_delete.php


注:本文中的decode_idna函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。