本文整理汇总了PHP中get_domain_default_props函数的典型用法代码示例。如果您正苦于以下问题:PHP get_domain_default_props函数的具体用法?PHP get_domain_default_props怎么用?PHP get_domain_default_props使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_domain_default_props函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: client_generatePageLists
/**
* client_generatePageLists.
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @return void
*/
function client_generatePageLists($tpl)
{
$domainProperties = get_domain_default_props($_SESSION['user_id']);
$stmt = exec_query('SELECT created_by FROM admin WHERE admin_id = ?', $_SESSION['user_id']);
$software_poss = gen_software_list($tpl, $domainProperties['domain_id'], $stmt->fields['created_by']);
$tpl->assign('TOTAL_SOFTWARE_AVAILABLE', $software_poss);
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:13,代码来源:software.php
示例2: gen_editalias_page
function gen_editalias_page(&$tpl, $edit_id)
{
global $sql;
//Get data from sql
list($domain_id) = get_domain_default_props($sql, $_SESSION['user_id']);
$res = exec_query($sql, "select * from domain_aliasses where alias_id=? and domain_id = ?", array($edit_id, $domain_id));
if ($res->RecordCount() <= 0) {
$_SESSION['aledit'] = '_no_';
header('Location: manage_domains.php');
die;
}
$data = $res->FetchRow();
$alias_ip_id = $data['alias_ip_id'];
// Get ip -data
$ipres = exec_query($sql, "select * from server_ips where ip_id=?", array($alias_ip_id));
$ipdat = $ipres->FetchRow();
$ip_data = $ipdat['ip_number'] . ' (' . $ipdat['ip_alias'] . ')';
if (isset($_POST['uaction']) && $_POST['uaction'] == 'modify') {
$url_forward = $_POST['forward'];
} else {
$url_forward = $data['url_forward'];
}
// Fill in the fileds
$tpl->assign(array('ALIAS_NAME' => $data['alias_name'], 'DOMAIN_IP' => $ip_data, 'FORWARD' => $url_forward == 'no' ? '' : $url_forward, 'ID' => $edit_id));
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:25,代码来源:enable_als_fwd.php
示例3: check_client_domainalias_counts
/**
*
* @param <type> $sql
* @param <type> $user_id
*/
function check_client_domainalias_counts($sql, $user_id)
{
$dmn_props = get_domain_default_props($user_id);
$als_cnt = get_domain_running_als_cnt($sql, $dmn_props['domain_id']);
if ($dmn_props['domain_alias_limit'] != 0 && $als_cnt >= $dmn_props['domain_alias_limit']) {
set_page_message(tr('Domain alias limit reached!'), 'warning');
user_goto('domains_manage.php');
}
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:14,代码来源:alias_add.php
示例4: check_domainalias_permissions
function check_domainalias_permissions($sql, $user_id)
{
list($dmn_id, $dmn_name, $dmn_gid, $dmn_uid, $dmn_created_id, $dmn_created, $dmn_last_modified, $dmn_mailacc_limit, $dmn_ftpacc_limit, $dmn_traff_limit, $dmn_sqld_limit, $dmn_sqlu_limit, $dmn_status, $dmn_als_limit, $dmn_subd_limit, $dmn_ip_id, $dmn_disk_limit, $dmn_disk_usage, $dmn_php, $dmn_cgi) = get_domain_default_props($sql, $user_id);
$als_cnt = get_domain_running_als_cnt($sql, $dmn_id);
if ($dmn_als_limit != 0 && $als_cnt >= $dmn_als_limit) {
set_page_message(tr('Domain alias limit expired!'));
header("Location: manage_domains.php");
die;
}
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:10,代码来源:add_alias.php
示例5: 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'])));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:61,代码来源:domain_details.php
示例6: client_generatePage
/**
* Generate Page
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @param int $softwareId Software uique identifier
* @return int Software unique identifier
*/
function client_generatePage($tpl, $softwareId)
{
$customerId = $_SESSION['user_id'];
$domainProperties = get_domain_default_props($customerId);
$stmt = exec_query('SELECT created_by FROM admin WHERE admin_id = ?', $customerId);
if ($stmt->rowCount()) {
$row = $stmt->fetchRow(PDO::FETCH_ASSOC);
get_software_props_install($tpl, $domainProperties['domain_id'], $softwareId, $row['created_by'], $domainProperties['domain_sqld_limit']);
} else {
throw new iMSCP_Exception('An unexpected error occurred. Please contact your reseller.');
}
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:19,代码来源:software_install.php
示例7: _client_getSubdomainData
/**
* Get subdomain data
*
* @access private
* @param int $subdomainId Subdomain unique identifier
* @param string $subdomainType Subdomain Type
* @return array Subdomain data. If any error occurs FALSE is returned
*/
function _client_getSubdomainData($subdomainId, $subdomainType)
{
static $subdomainData = null;
if (null === $subdomainData) {
$mainDmnProps = get_domain_default_props($_SESSION['user_id']);
$domainId = $mainDmnProps['domain_id'];
$domainName = $mainDmnProps['domain_name'];
if ($subdomainType == 'dmn') {
$query = '
SELECT
`subdomain_name` AS `subdomain_name` , `subdomain_url_forward` AS `forward_url`
FROM
`subdomain`
WHERE
`subdomain_id` = ?
AND
`domain_id` = ?
AND
`subdomain_status` = ?
';
} else {
$query = '
SELECT
`t1`.`subdomain_alias_name` AS `subdomain_name`, `t1`.`subdomain_alias_url_forward` AS `forward_url`,
`t2`.`alias_name` `aliasName`
FROM
`subdomain_alias` AS `t1`
INNER JOIN
`domain_aliasses` AS `t2` USING(`alias_id`)
WHERE
`subdomain_alias_id` = ?
AND
`t2`.`domain_id` = ?
AND
`t1`.`subdomain_alias_status` = ?
';
}
$stmt = exec_query($query, array($subdomainId, $domainId, 'ok'));
if (!$stmt->rowCount()) {
return false;
}
$subdomainData = $stmt->fetchRow(PDO::FETCH_ASSOC);
if ($subdomainType == 'dmn') {
$subdomainData['subdomain_name'] .= '.' . $domainName;
$subdomainData['subdomain_name_utf8'] = decode_idna($subdomainData['subdomain_name']);
} else {
$subdomainData['subdomain_name'] .= '.' . $subdomainData['aliasName'];
$subdomainData['subdomain_name_utf8'] = decode_idna($subdomainData['subdomain_name']);
}
}
return $subdomainData;
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:60,代码来源:subdomain_edit.php
示例8: client_generatePage
/**
* Generate page and return software unique identifier.
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @return int software unique identifier
*/
function client_generatePage($tpl)
{
if (!isset($_GET['id']) || $_GET['id'] === '' || !is_numeric($_GET['id'])) {
showBadRequestErrorPage();
exit;
// Useless but avoid IDE warning about possible undefined variable
} else {
$softwareId = intval($_GET['id']);
}
$domainProperties = get_domain_default_props($_SESSION['user_id']);
$stmt = exec_query('SELECT created_by FROM admin WHERE admin_id = ?', $_SESSION['user_id']);
get_software_props($tpl, $domainProperties['domain_id'], $softwareId, $stmt->fields['created_by'], $domainProperties['domain_sqld_limit']);
return $softwareId;
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:20,代码来源:software_view.php
示例9: client_checkSqlUserPermissions
/**
* Check SQL permissions
*
* @param iMSCP_pTemplate $tpl
* @param int $databaseId Database unique identifier
*/
function client_checkSqlUserPermissions($tpl, $databaseId)
{
$domainProperties = get_domain_default_props($_SESSION['user_id']);
$domainSqlUsersLimit = $domainProperties['domain_sqlu_limit'];
$limits = get_domain_running_sql_acc_cnt($domainProperties['domain_id']);
if ($domainSqlUsersLimit != 0 && $limits[1] >= $domainSqlUsersLimit) {
$tpl->assign('CREATE_SQLUSER', '');
}
$stmt = exec_query('
SELECT domain_id FROM domain INNER JOIN sql_database USING(domain_id)
WHERE domain_id = ? AND sqld_id = ? LIMIT 1
', array($domainProperties['domain_id'], $databaseId));
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:22,代码来源:sql_user_add.php
示例10: _client_getAliasData
/**
* Get domain alias data
*
* @access private
* @param int $domainAliasId Subdomain unique identifier
* @return array Domain alias data. If any error occurs FALSE is returned
*/
function _client_getAliasData($domainAliasId)
{
static $domainAliasData = null;
if (null === $domainAliasData) {
$mainDmnProps = get_domain_default_props($_SESSION['user_id']);
$domainId = $mainDmnProps['domain_id'];
$query = "\n\t\t\tSELECT\n\t\t\t\t`alias_name`, `url_forward` AS `forward_url`\n\t\t\tFROM\n\t\t\t\t`domain_aliasses`\n\t\t\tWHERE\n\t\t\t\t`alias_id` = ?\n\t\t\tAND\n\t\t\t\t`domain_id` = ?\n\t\t\tAND\n\t\t\t\t`alias_status` = ?\n\t\t";
$stmt = exec_query($query, array($domainAliasId, $domainId, 'ok'));
if (!$stmt->rowCount()) {
return false;
}
$domainAliasData = $stmt->fetchRow(PDO::FETCH_ASSOC);
$domainAliasData['alias_name_utf8'] = decode_idna($domainAliasData['alias_name']);
}
return $domainAliasData;
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:23,代码来源:alias_edit.php
示例11: getDomainsList
/**
* Get domains list
*
* @return array Domains list
*/
function getDomainsList()
{
static $domainsList = null;
if (null !== $domainsList) {
return $domainsList;
}
$mainDmnProps = get_domain_default_props($_SESSION['user_id']);
$domainsList = array(array('name' => $mainDmnProps['domain_name'], 'id' => $mainDmnProps['domain_id'], 'type' => 'dmn', 'mount_point' => '/'));
$stmt = exec_query("\n SELECT CONCAT(t1.subdomain_name, '.', t2.domain_name) AS name, t1.subdomain_mount AS mount_point\n FROM subdomain AS t1 INNER JOIN domain AS t2 USING(domain_id)\n WHERE t1.domain_id = :domain_id AND t1.subdomain_status = :status_ok\n UNION ALL\n SELECT alias_name AS name, alias_mount AS mount_point\n FROM domain_aliasses\n WHERE domain_id = :domain_id AND alias_status = :status_ok\n UNION ALL\n SELECT CONCAT(t1.subdomain_alias_name, '.', t2.alias_name) AS name, t1.subdomain_alias_mount AS mount_point\n FROM subdomain_alias AS t1 INNER JOIN domain_aliasses AS t2 USING(alias_id)\n WHERE t2.domain_id = :domain_id AND subdomain_alias_status = :status_ok\n ", array('domain_id' => $mainDmnProps['domain_id'], 'status_ok' => 'ok'));
if ($stmt->rowCount()) {
$domainsList = array_merge($domainsList, $stmt->fetchAll(PDO::FETCH_ASSOC));
usort($domainsList, function ($a, $b) {
return strnatcmp(decode_idna($a['name']), decode_idna($b['name']));
});
}
return $domainsList;
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:22,代码来源:alias_add.php
示例12: _client_getVerifiedData
/**
* Returns verified data
*
* @access private
* @param int $itemId Item id (Domain ID or domain alias id)
* @param string $itemType Item type (normal or alias
* @return array An array that holds verified data
*/
function _client_getVerifiedData($itemId, $itemType)
{
$domainProps = get_domain_default_props($_SESSION['user_id']);
$domainId = $domainProps['domain_id'];
if ($itemType == 'normal') {
$stmt = exec_query('
SELECT
domain_id, domain_name AS name, external_mail, external_mail_dns_ids
FROM
domain WHERE domain_id = ?
', $domainId);
if ($stmt->rowCount()) {
$row = $stmt->fetchRow(PDO::FETCH_ASSOC);
if ($row['domain_id'] !== $itemId) {
showBadRequestErrorPage();
exit;
}
} else {
showBadRequestErrorPage();
exit;
}
} elseif ($itemType == 'alias') {
$stmt = exec_query('
SELECT
domain_id, alias_name AS name, external_mail, external_mail_dns_ids
FROM
domain_aliasses
WHERE
alias_id = ?
AND
domain_id = ?
', array($itemId, $domainId));
if ($stmt->rowCount()) {
$row = $stmt->fetchRow(PDO::FETCH_ASSOC);
} else {
showBadRequestErrorPage();
exit;
}
} else {
showBadRequestErrorPage();
exit;
}
return array('domain_id' => $domainId, 'item_id' => $itemId, 'item_name' => $row['name'], 'item_type' => $itemType, 'external_mail_type' => $row['external_mail'], 'external_mail_dns_ids' => explode(',', $row['external_mail_dns_ids']));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:52,代码来源:mail_external_edit.php
示例13: check_sql_permissions
/**
* @param EasySCP_TemplateEngine $tpl
* @param EasySCP_Database $sql
* @param int $user_id
* @param int $db_id
* @param bool $sqluser_available
* @return void
*/
function check_sql_permissions($tpl, $sql, $user_id, $db_id, $sqluser_available)
{
$dmn_props = get_domain_default_props($user_id);
list(, $sqlu_acc_cnt) = get_domain_running_sql_acc_cnt($sql, $dmn_props['domain_id']);
if ($dmn_props['domain_sqlu_limit'] != 0 && $sqlu_acc_cnt >= $dmn_props['domain_sqlu_limit']) {
if (!$sqluser_available) {
set_page_message(tr('SQL users limit reached!'), 'warning');
user_goto('sql_manage.php');
}
} else {
$tpl->assign('CREATE_SQLUSER', true);
}
$dmn_name = $_SESSION['user_logged'];
$query = "\n\t\tSELECT\n\t\t\tt1.`sqld_id`, t2.`domain_id`, t2.`domain_name`\n\t\tFROM\n\t\t\t`sql_database` AS t1,\n\t\t\t`domain` AS t2\n\t\tWHERE\n\t\t\tt1.`sqld_id` = ?\n\t\tAND\n\t\t\tt2.`domain_id` = t1.`domain_id`\n\t\tAND\n\t\t\tt2.`domain_name` = ?\n\t";
$rs = exec_query($sql, $query, array($db_id, $dmn_name));
if ($rs->recordCount() == 0) {
set_page_message(tr('User does not exist or you do not have permission to access this interface!'), 'warning');
user_goto('sql_manage.php');
}
}
开发者ID:gOOvER,项目名称:EasySCP,代码行数:28,代码来源:sql_user_add.php
示例14: _client_getVerifiedData
/**
* Returns verified data
*
* @access private
* @param int $itemId Item id (Domain ID or domain alias id)
* @param string $itemType Item type (normal or alias
* @return array An array that holds verified data (main domain id and item name)
*/
function _client_getVerifiedData($itemId, $itemType)
{
$domainProps = get_domain_default_props($_SESSION['user_id']);
$domainId = $domainProps['domain_id'];
if ($itemType == 'normal') {
$stmt = exec_query('SELECT domain_id, domain_name AS name FROM domain WHERE domain_id = ?', $domainId);
if (!$stmt->rowCount() || $stmt->fields['domain_id'] !== $itemId) {
showBadRequestErrorPage();
}
} elseif ($itemType == 'alias') {
$stmt = exec_query('SELECT domain_id, alias_name AS name FROM domain_aliasses WHERE alias_id = ? AND domain_id = ?', array($itemId, $domainId));
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
} else {
showBadRequestErrorPage();
exit;
// Only to make some IDE happy
}
return array('domain_id' => $domainId, 'item_id' => $itemId, 'item_name' => $stmt->fields['name'], 'item_type' => $itemType);
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:29,代码来源:mail_external_add.php
示例15: client_checkMailAccountOwner
/**
* Checks that the given mail account is owned by current customer and its responder is not active
*
* @param int $mailAccountId Mail account id to check
* @return bool TRUE if the mail account is owned by the current customer, FALSE otherwise
*/
function client_checkMailAccountOwner($mailAccountId)
{
$domainProps = get_domain_default_props($_SESSION['user_id']);
$query = '
SELECT
`t1`.*, `t2`.`domain_id`, `t2`.`domain_name`
FROM
`mail_users` AS `t1`, `domain` AS `t2`
WHERE
`t1`.`mail_id` = ?
AND
`t2`.`domain_id` = `t1`.`domain_id`
AND
`t2`.`domain_id` = ?
AND
`t1`.`mail_auto_respond` = ?
AND
`t1`.`status` = ?
';
$stmt = exec_query($query, array($mailAccountId, $domainProps['domain_id'], 0, 'ok'));
return (bool) $stmt->rowCount();
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:28,代码来源:mail_autoresponder_enable.php
示例16: check_sql_permissions
function check_sql_permissions(&$tpl, $sql, $user_id, $db_id, $sqluser_available)
{
if (isset($_SESSION['sql_support']) && $_SESSION['sql_support'] == "no") {
header("Location: index.php");
}
list($dmn_id, $dmn_name, $dmn_gid, $dmn_uid, $dmn_created_id, $dmn_created, $dmn_last_modified, $dmn_mailacc_limit, $dmn_ftpacc_limit, $dmn_traff_limit, $dmn_sqld_limit, $dmn_sqlu_limit, $dmn_status, $dmn_als_limit, $dmn_subd_limit, $dmn_ip_id, $dmn_disk_limit, $dmn_disk_usage, $dmn_php, $dmn_cgi) = get_domain_default_props($sql, $user_id);
list($sqld_acc_cnt, $sqlu_acc_cnt) = get_domain_running_sql_acc_cnt($sql, $dmn_id);
if ($dmn_sqlu_limit != 0 && $sqlu_acc_cnt >= $dmn_sqlu_limit) {
if (!$sqluser_available) {
set_page_message(tr('SQL-user limit expired!'));
header("Location: manage_sql.php");
die;
} else {
$tpl->assign('CREATE_SQLUSER', '');
}
}
$dmn_name = $_SESSION['user_logged'];
$query = <<<SQL_QUERY
select
t1.sqld_id, t2.domain_id, t2.domain_name
from
sql_database as t1,
domain as t2
where
t1.sqld_id = ?
and
t2.domain_id = t1.domain_id
and
t2.domain_name = ?
SQL_QUERY;
$rs = exec_query($sql, $query, array($db_id, $dmn_name));
if ($rs->RecordCount() == 0) {
set_page_message(tr('User does not exist or you do not have permission to access this interface!'));
header('Location: manage_sql.php');
die;
}
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:37,代码来源:sql_add_user.php
示例17: client_generatePage
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl
*/
function client_generatePage($tpl)
{
$mailId = clean_input($_GET['id']);
$mainDmnProps = get_domain_default_props($_SESSION['user_id']);
$mailData = client_getEmailAccountData($mailId);
list($username, $domainName) = explode('@', $mailData['mail_addr']);
$stmt = exec_query('SELECT SUM(`quota`) AS `quota` FROM `mail_users` WHERE `domain_id` = ? AND `quota` IS NOT NULL', $mainDmnProps['domain_id']);
$quota = $stmt->fields['quota'];
/** @var iMSCP_Config_Handler_File $cfg */
$cfg = iMSCP_Registry::get('config');
$checked = $cfg->HTML_CHECKED;
$selected = $cfg->HTML_SELECTED;
$mailType = '';
if (!isset($_POST['account_type']) || !in_array($_POST['account_type'], array('1', '2', '3'))) {
if (preg_match('/_mail/', $mailData['mail_type'])) {
$mailType = '1';
}
if (preg_match('/_forward/', $mailData['mail_type'])) {
$mailType = $mailType == '1' ? '3' : '2';
}
} else {
$mailType = $_POST['account_type'];
}
$tpl->assign(array('MAIL_ID' => tohtml($mailId), 'USERNAME' => tohtml($username), 'NORMAL_CHECKED' => $mailType == '1' ? $checked : '', 'FORWARD_CHECKED' => $mailType == '2' ? $checked : '', 'NORMAL_FORWARD_CHECKED' => $mailType == '3' ? $checked : '', 'PASSWORD' => isset($_POST['password']) ? tohtml($_POST['password']) : '', 'PASSWORD_REP' => isset($_POST['password_rep']) ? tohtml($_POST['password_rep']) : '', 'TR_QUOTA' => $mainDmnProps['mail_quota'] == '0' ? tr('Quota in MiB (0 for unlimited)') : tr('Quota in MiB (Max: %s)', bytesHuman($mainDmnProps['mail_quota'] - ($quota - $mailData['quota']), 'MiB')), 'QUOTA' => isset($_POST['quota']) ? tohtml($_POST['quota']) : ($quota !== NULL ? floor($mailData['quota'] / 1048576) : ''), 'FORWARD_LIST' => isset($_POST['forward_list']) ? tohtml($_POST['forward_list']) : ($mailData['mail_forward'] != '_no_' ? tohtml($mailData['mail_forward']) : '')));
$tpl->assign(array('DOMAIN_NAME' => tohtml($domainName), 'DOMAIN_NAME_UNICODE' => tohtml(decode_idna($domainName)), 'DOMAIN_NAME_SELECTED' => $selected));
}
开发者ID:svenjantzen,项目名称:imscp,代码行数:31,代码来源:mail_edit.php
示例18: addDomainAlias
/**
* Add new domain alias
*
* @return bool
* @throws Exception
* @throws iMSCP_Exception
* @throws iMSCP_Exception_Database
*/
function addDomainAlias()
{
// Basic check
if (empty($_POST['customer_id'])) {
showBadRequestErrorPage();
}
$customerId = clean_input($_POST['customer_id']);
if (empty($_POST['domain_alias_name'])) {
set_page_message(tr('You must enter a domain alias name.'), 'error');
return false;
}
$domainAliasName = clean_input(strtolower($_POST['domain_alias_name']));
// Check for domain alias name syntax
global $dmnNameValidationErrMsg;
if (!isValidDomainName($domainAliasName)) {
set_page_message($dmnNameValidationErrMsg, 'error');
return false;
}
// www is considered as an alias of the domain alias
while (strpos($domainAliasName, 'www.') !== false) {
$domainAliasName = substr($domainAliasName, 4);
}
// Check for domain alias existence
if (imscp_domain_exists($domainAliasName, $_SESSION['user_id'])) {
set_page_message(tr('Domain %s is unavailable.', "<strong>{$domainAliasName}</strong>"), 'error');
return false;
}
$domainAliasNameAscii = encode_idna($domainAliasName);
// Set default mount point
$mountPoint = "/{$domainAliasNameAscii}";
// Check for shared mount point option
if (isset($_POST['shared_mount_point']) && $_POST['shared_mount_point'] == 'yes') {
if (!isset($_POST['shared_mount_point_domain'])) {
showBadRequestErrorPage();
}
$sharedMountPointDomain = clean_input($_POST['shared_mount_point_domain']);
$domainList = getDomainsList($customerId);
// Get shared mount point
foreach ($domainList as $domain) {
if ($domain['name'] == $sharedMountPointDomain) {
$mountPoint = $domain['mount_point'];
}
}
}
// Check for URL forwarding option
$forwardUrl = 'no';
if (isset($_POST['url_forwarding']) && $_POST['url_forwarding'] == 'yes') {
if (!isset($_POST['forward_url_scheme']) || !isset($_POST['forward_url'])) {
showBadRequestErrorPage();
}
$forwardUrl = clean_input($_POST['forward_url_scheme']) . clean_input($_POST['forward_url']);
try {
try {
$uri = iMSCP_Uri_Redirect::fromString($forwardUrl);
} catch (Zend_Uri_Exception $e) {
throw new iMSCP_Exception(tr('Forward URL %s is not valid.', "<strong>{$forwardUrl}</strong>"));
}
$uri->setHost(encode_idna($uri->getHost()));
if ($uri->getHost() == $domainAliasNameAscii && $uri->getPath() == '/') {
throw new iMSCP_Exception(tr('Forward URL %s is not valid.', "<strong>{$forwardUrl}</strong>") . ' ' . tr('Domain alias %s cannot be forwarded on itself.', "<strong>{$domainAliasName}</strong>"));
}
$forwardUrl = $uri->getUri();
} catch (Exception $e) {
set_page_message($e->getMessage(), 'error');
return false;
}
}
$mainDmnProps = get_domain_default_props($customerId, $_SESSION['user_id']);
$cfg = iMSCP_Registry::get('config');
$db = iMSCP_Database::getInstance();
try {
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onBeforeAddDomainAlias, array('domainId' => $mainDmnProps['domain_id'], 'domainAliasName' => $domainAliasNameAscii));
$db->beginTransaction();
exec_query('
INSERT INTO domain_aliasses (
domain_id, alias_name, alias_mount, alias_status, alias_ip_id, url_forward
) VALUES (
?, ?, ?, ?, ?, ?
)
', array($mainDmnProps['domain_id'], $domainAliasNameAscii, $mountPoint, 'toadd', $mainDmnProps['domain_ip_id'], $forwardUrl));
$id = $db->insertId();
// Create the phpini entry for that domain alias
$phpini = iMSCP_PHPini::getInstance();
$phpini->loadResellerPermissions($_SESSION['user_id']);
// Load reseller PHP permissions
$phpini->loadClientPermissions($mainDmnProps['admin_id']);
// Load client PHP permissions
$phpini->loadDomainIni($mainDmnProps['admin_id'], $mainDmnProps['domain_id'], 'dmn');
// Load main domain PHP configuration options
$phpini->saveDomainIni($mainDmnProps['admin_id'], $id, 'als');
// Create default email addresses if needed
if ($cfg['CREATE_DEFAULT_EMAIL_ADDRESSES'] && $mainDmnProps['admin_email'] !== '') {
//.........这里部分代码省略.........
开发者ID:svenjantzen,项目名称:imscp,代码行数:101,代码来源:alias_add.php
示例19: check_fwd_data
/**
* @throws EasySCP_Exception_Database
* @param int $edit_id
* @return bool
*/
function check_fwd_data($edit_id)
{
$sql = EasySCP_Registry::get('Db');
$add_mode = $edit_id === true;
// unset errors
$ed_error = '_off_';
$err = '';
$_text = '';
$_type = $_POST['type'];
$dmn_props = get_domain_default_props($_SESSION['user_id']);
if ($add_mode) {
$query = "\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM (\n\t\t\t\tSELECT\n\t\t\t\t\t'0' AS `alias_id`,\n\t\t\t\t\t`domain`.`domain_name` AS `domain_name`\n\t\t\t\tFROM\n\t\t\t\t\t`domain`\n\t\t\t\tWHERE\n\t\t\t\t\t`domain_id` = ?\n\t\t\t\tUNION\n\t\t\t\tSELECT\n\t\t\t\t\t`domain_aliasses`.`alias_id`,\n\t\t\t\t\t`domain_aliasses`.`alias_name`\n\t\t\t\tFROM\n\t\t\t\t\t`domain_aliasses`\n\t\t\t\tWHERE\n\t\t\t\t\t`domain_aliasses`.`domain_id` = ?\n\t\t\t) AS `tbl`\n\t\t\tWHERE\n\t\t\t\tIFNULL(`tbl`.`alias_id`, 0) = ?\n\t\t";
$res = exec_query($sql, $query, array($dmn_props['domain_id'], $dmn_props['domain_id'], $_POST['alias_id']));
if ($res->recordCount() <= 0) {
not_allowed();
}
$data = $res->fetchRow();
$record_domain = $data['domain_name'];
// if no alias is selected, ID is 0 else the real alias_id
$alias_id = $data['alias_id'];
$_dns = $data['domain_name'];
} else {
$sql_query = "\n\t\t\t\tSELECT\n\t\t\t\t\td.id,\n\t\t\t\t\td.easyscp_domain_id,\n\t\t\t\t\td.easyscp_domain_alias_id,\n\t\t\t\t\td.name\n\t\t\t\tFROM\n\t\t\t\t\tpowerdns.domains d,\n\t\t\t\t\tpowerdns.records r\n\t\t\t\tWHERE\n\t\t\t\t\tr.id = :record_id\n\t\t\t\tAND\n\t\t\t\t\tr.domain_id = d.id;\n\t\t";
$sql_param = array('record_id' => $edit_id);
DB::prepare($sql_query);
$stmt = DB::execute($sql_param);
if ($stmt->rowCount() <= 0) {
not_allowed();
}
$data = $stmt->fetch();
$record_domain = $data['name'];
$alias_id = $data['easyscp_domain_alias_id'];
$_dns = $data['name'];
$domain_id = $data['id'];
}
if (!validate_NAME(array('name' => $_POST['dns_name'], 'domain' => $record_domain), $err)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
$_ttl = null;
$_dns_srv_prio = null;
switch ($_POST['type']) {
case 'CNAME':
if (!validate_CNAME($_POST, $err)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
$_text = $_POST['dns_cname'];
$_dns = $_POST['dns_name'];
break;
case 'A':
if (!validate_A($_POST, $err)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
if (!check_CNAME_conflict($_POST['dns_name'] . '.' . $record_domain, $err)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
$_text = $_POST['dns_A_address'];
$_dns = $_POST['dns_name'];
$_ttl = '7200';
break;
case 'AAAA':
if (!validate_AAAA($_POST, $err)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
if (!check_CNAME_conflict($_POST['dns_name'] . '.' . $record_domain, $err)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
$_text = $_POST['dns_AAAA_address'];
$_dns = $_POST['dns_name'];
break;
case 'SRV':
if (!validate_SRV($_POST, $err, $_dns, $_text)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
break;
case 'MX':
if (!validate_MX($_POST, $err, $_dns_srv_prio, $_text)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
} else {
// $_dns = $record_domain . '.';
$_dns = $record_domain;
}
break;
case 'NS':
if (!validate_NS($_POST, $err)) {
$ed_error = sprintf(tr('Cannot validate %s record. Reason \'%s\'.'), $_POST['type'], $err);
}
$_text = $_POST['dns_ns'];
$_ttl = '28800';
break;
case 'SOA':
$_ttl = '3600';
break;
default:
$ed_error = sprintf(tr('Unknown zone type %s!'), $_POST['type']);
}
//.........这里部分代码省略.........
开发者ID:gOOvER,项目名称:EasySCP,代码行数:101,代码来源:dns_edit.php
示例20: check_login
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @link http://www.easyscp.net
* @author EasySCP Team
* @since 1.2.0
*/
require '../../include/easyscp-lib.php';
check_login(__FILE__);
$cfg = EasySCP_Registry::get('Config');
$html_selected = $cfg->HTML_SELECTED;
$tpl = EasySCP_TemplateEngine::getInstance();
$template = 'client/domain_manage_ssl.tpl';
// static page messages.
gen_logged_from($tpl);
check_permissions($tpl);
$dmn_props = get_domain_default_props($_SESSION['user_id']);
if (isset($_SESSION['ssl_configuration_updated']) && $_SESSION['ssl_configuration_updated'] == "_yes_") {
unset($_POST);
unset($_SESSION['ssl_configuration_updated']);
}
if (isset($_POST['Submit']) && isset($_POST['uaction']) && $_POST['uaction'] === 'apply') {
$sslkey = clean_input(filter_input(INPUT_POST, 'ssl_key'));
$sslcert = clean_input(filter_input(INPUT_POST, 'ssl_cert'));
$sslcacert = clean_input(filter_input(INPUT_POST, 'ssl_cacert'));
$sslstatus = clean_input(filter_input(INPUT_POST, 'ssl_status'));
$rs = EasySSL::storeSSLData($_POST['ssl_domain'], $sslstatus, $sslkey, $sslcert, $sslcacert);
if ($rs === false) {
set_page_message(tr("SSL Certificate and key don't match!"), 'error');
} else {
if ($rs->rowCount() == 0) {
set_page_message(tr("SSL configuration unchanged"), 'info');
开发者ID:gOOvER,项目名称:EasySCP,代码行数:31,代码来源:domain_manage_ssl.php
注:本文中的get_domain_default_props函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论