本文整理汇总了PHP中customerHasFeature函数的典型用法代码示例。如果您正苦于以下问题:PHP customerHasFeature函数的具体用法?PHP customerHasFeature怎么用?PHP customerHasFeature使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了customerHasFeature函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: client_hideDisabledFeatures
/**
* Hide disabled feature.
*
* @param iMSCP_pTemplate $tpl Template engine instance
*/
function client_hideDisabledFeatures($tpl)
{
if (!customerHasFeature('backup')) {
$tpl->assign('BACKUP_FEATURE', '');
}
$webmails = getWebmailList();
if (!customerHasFeature('mail') || empty($webmails)) {
$tpl->assign('MAIL_FEATURE', '');
} else {
if (in_array('Roundcube', $webmails)) {
$tpl->assign('WEBMAIL_RPATH', '/webmail');
} else {
$tpl->assign('WEBMAIL_RPATH', '/' . strtolower($webmails[0]));
}
}
if (!customerHasFeature('ftp')) {
$tpl->assign('FTP_FEATURE', '');
}
if (!customerHasFeature('aps')) {
$tpl->assign('APS_FEATURE', '');
}
if (!customerHasFeature('webstats')) {
$tpl->assign('WEBSTATS_FEATURE', '');
}
}
示例2: generateCustomDnsRecordsList
/**
* Generates custom DNS records list
*
* @param iMSCP_pTemplate $tpl Template engine
* @return void
*/
function generateCustomDnsRecordsList($tpl)
{
$filterCond = '';
if (!customerHasFeature('custom_dns_records')) {
$filterCond = "AND owned_by <> 'custom_dns_feature'";
}
$stmt = exec_query("\n SELECT t1.*, IFNULL(t3.alias_name, t2.domain_name) zone_name\n FROM domain_dns AS t1 LEFT JOIN domain AS t2 USING (domain_id) LEFT JOIN domain_aliasses AS t3 USING (alias_id)\n WHERE t1.domain_id = ? {$filterCond} ORDER BY t1.domain_id, t1.alias_id, t1.domain_dns, t1.domain_type\n ", get_user_domain_id($_SESSION['user_id']));
if ($stmt->rowCount()) {
while ($row = $stmt->fetchRow()) {
list($actionEdit, $actionScriptEdit) = generateCustomDnsRecordAction('edit', $row['owned_by'] === 'custom_dns_feature' ? $row['domain_dns_id'] : ($row['owned_by'] === 'ext_mail_feature' ? $row['alias_id'] ? $row['alias_id'] . ';alias' : $row['domain_id'] . ';normal' : null), $row['domain_dns_status'], $row['owned_by']);
if ($row['owned_by'] !== 'custom_dns_feature') {
$tpl->assign('DNS_DELETE_LINK', '');
} else {
list($actionDelete, $actionScriptDelete) = generateCustomDnsRecordAction('Delete', $row['domain_dns_id'], $row['domain_dns_status']);
$tpl->assign(array('DNS_ACTION_SCRIPT_DELETE' => $actionScriptDelete, 'DNS_ACTION_DELETE' => $actionDelete, 'DNS_TYPE_RECORD' => tr("%s record", $row['domain_type'])));
$tpl->parse('DNS_DELETE_LINK', '.dns_delete_link');
}
// Remove TTL part if any
# FIXME TTL must be in dedicated column
if (strpos($row['domain_dns'], ' ') !== false) {
$dnsName = explode(' ', $row['domain_dns']);
$dnsName = $dnsName[0];
} else {
$dnsName = $row['domain_dns'];
}
$tpl->assign(array('DNS_DOMAIN' => tohtml(decode_idna($row['zone_name'])), 'DNS_NAME' => tohtml(decode_idna($dnsName)), 'DNS_CLASS' => tohtml($row['domain_class']), 'DNS_TYPE' => tohtml($row['domain_type']), 'LONG_DNS_DATA' => tohtml(wordwrap(decode_idna($row['domain_text']), 80, "\n", true)), 'SHORT_DNS_DATA' => decode_idna(strlen($row['domain_text']) > 20 ? substr($row['domain_text'], 0, 17) . '...' : $row['domain_text']), 'DNS_ACTION_SCRIPT_EDIT' => $actionScriptEdit, 'DNS_ACTION_EDIT' => $actionEdit));
$tpl->parse('DNS_ITEM', '.dns_item');
$tpl->assign('DNS_DELETE_LINK', '');
}
$tpl->parse('DNS_LIST', 'dns_list');
$tpl->assign('DNS_MESSAGE', '');
} else {
if (customerHasFeature('custom_dns_records')) {
$tpl->assign(array('DNS_MSG' => tr('You do not have DNS resource records.'), 'DNS_LIST' => ''));
} else {
$tpl->assign('CUSTOM_DNS_RECORDS_BLOCK', '');
}
}
}
示例3: check_login
* Portions created by Initial Developer are Copyright (C) 2001-2006
* by moleSoftware GmbH. All Rights Reserved.
*
* Portions created by the ispCP Team are Copyright (C) 2006-2010 by
* isp Control Panel. All Rights Reserved.
*
* Portions created by the i-MSCP Team are Copyright (C) 2010-2016 by
* i-MSCP - internet Multi Server Control Panel. All Rights Reserved.
*/
/***********************************************************************************************************************
* Main
*/
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
if (!customerHasFeature('domain_aliases') || !isset($_GET['id'])) {
showBadRequestErrorPage();
}
$id = clean_input($_GET['id']);
$stmt = exec_query("\n SELECT\n t1.subdomain_alias_id, CONCAT(t1.subdomain_alias_name, '.', t2.alias_name) AS subdomain_alias_name\n FROM\n subdomain_alias AS t1\n INNER JOIN\n domain_aliasses AS t2 ON (t2.alias_id = t1.alias_id)\n WHERE\n t2.domain_id = ?\n AND\n t1.subdomain_alias_id = ?\n ", array(get_user_domain_id($_SESSION['user_id']), $id));
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
$row = $stmt->fetchRow(PDO::FETCH_ASSOC);
$name = $row['subdomain_alias_name'];
$stmt = exec_query('SELECT mail_id FROM mail_users WHERE (mail_type LIKE ? OR mail_type = ?) AND sub_id = ? LIMIT 1', array(MT_ALSSUB_MAIL . '%', MT_ALSSUB_FORWARD, $id));
if ($stmt->rowCount()) {
set_page_message(tr('Subdomain you are trying to remove has email accounts. Please remove them first.'), 'error');
redirectTo('domains_manage.php');
}
$stmt = exec_query('SELECT userid FROM ftp_users WHERE userid LIKE ? LIMIT 1', "%@{$name}");
示例4: client_generatePage
* @return void
*/
function client_generatePage($tpl, $mailAccountId)
{
$query = "SELECT `mail_auto_respond_text`, `mail_acc` FROM `mail_users` WHERE `mail_id` = ?";
$stmt = exec_query($query, $mailAccountId);
$tpl->assign('AUTORESPONDER_MESSAGE', tohtml($stmt->fields['mail_auto_respond_text']));
}
/***********************************************************************************************************************
* Main
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
if (customerHasFeature('mail') && (isset($_REQUEST['mail_account_id']) && is_numeric($_REQUEST['mail_account_id']))) {
$mailAccountId = intval($_REQUEST['mail_account_id']);
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
if (client_checkMailAccountOwner($mailAccountId)) {
if (!isset($_POST['mail_account_id'])) {
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'client/mail_autoresponder.tpl', 'page_message' => 'layout'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Email / Overview / Enable Auto Responder'), 'TR_AUTORESPONDER_MESSAGE' => tr('Please enter your auto-responder message below'), 'TR_ACTION' => tr('Activate'), 'TR_CANCEL' => tr('Cancel'), 'MAIL_ACCOUNT_ID' => $mailAccountId));
generateNavigation($tpl);
client_generatePage($tpl, $mailAccountId, !isset($_POST['uaction']));
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
unsetMessages();
示例5: tohtml
$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));
}
/***********************************************************************************************************************
* Main
*/
// Include core library
require 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
if (isset($_GET['id']) && customerHasFeature('mail')) {
if (!empty($_POST)) {
if (client_editMailAccount()) {
redirectTo('mail_accounts.php');
}
}
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'client/mail_edit.tpl', 'page_message' => 'layout'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Email / Edit Email Account'), 'TR_MAIl_ACCOUNT_DATA' => tr('Email account data'), 'TR_USERNAME' => tr('Username'), 'TR_DOMAIN_NAME' => tr('Domain name'), 'TR_MAIL_ACCOUNT_TYPE' => tr('Mail account type'), 'TR_NORMAL_MAIL' => tr('Normal'), 'TR_FORWARD_MAIL' => tr('Forward'), 'TR_FORWARD_NORMAL_MAIL' => tr('Normal + Forward'), 'TR_PASSWORD' => tr('Password'), 'TR_PASSWORD_REPEAT' => tr('Password confirmation'), 'TR_FORWARD_TO' => tr('Forward to'), 'TR_FWD_HELP' => tr('Separate multiple email addresses by comma or a line-break.'), 'TR_UPDATE' => tr('Update'), 'TR_CANCEL' => tr('Cancel')));
client_generatePage($tpl, $_SESSION['user_id']);
generateNavigation($tpl);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
} else {
示例6: scheduleBackupRestoration
*/
function scheduleBackupRestoration($userId)
{
exec_query("UPDATE `domain` SET `domain_status` = ? WHERE `domain_admin_id` = ?", array('torestore', $userId));
send_request();
write_log($_SESSION['user_logged'] . ": scheduled backup restoration.", E_USER_NOTICE);
set_page_message(tr('Backup has been successfully scheduled for restoration.'), 'success');
}
/***********************************************************************************************************************
* Main
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
customerHasFeature('backup') or showBadRequestErrorPage();
if (isset($_POST['uaction']) && $_POST['uaction'] == 'bk_restore') {
scheduleBackupRestoration($_SESSION['user_id']);
}
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'client/backup.tpl', 'page_message' => 'layout'));
if ($cfg->ZIP == 'gzip') {
$name = '.*-backup-%Y.%m.%d-%H-%M.tar..tar.gz';
} else {
if ($cfg->ZIP == 'bzip2' || $cfg->ZIP == 'pbzip2') {
$name = '.*-backup-%Y.%m.%d-%H-%M.tar.tar.bz2';
} else {
$name = '.*-backup-%Y.%m.%d-%H-%M.tar.lzma';
}
示例7: stream_context_create
$context = stream_context_create(array_merge($contextOptions, array('http' => array('method' => 'GET', 'protocol_version' => '1.1', 'header' => array('Host: ' . $_SERVER['SERVER_NAME'] . ($port ? ':' . $port : ''), 'User-Agent: i-MSCP', 'Connection: close')))));
# Getting secure token
$secureToken = file_get_contents("{$pydioBaseUrl}/index.php?action=get_secure_token", false, $context);
$postData = http_build_query(array('get_action' => 'login', 'userid' => $credentials[0], 'login_seed' => '-1', "remember_me" => 'false', 'password' => stripcslashes($credentials[1]), '_method' => 'put'));
$contextOptions = array_merge($contextOptions, array('http' => array('method' => 'POST', 'protocol_version' => '1.1', 'header' => array('Host: ' . $_SERVER['SERVER_NAME'] . ($port ? ':' . $port : ''), 'Content-Type: application/x-www-form-urlencoded', 'X-Requested-With: XMLHttpRequest', 'Content-Length: ' . strlen($postData), 'User-Agent: i-MSCP', 'Connection: close'), 'content' => $postData)));
stream_context_set_default($contextOptions);
# TODO Parse the full response and display error message on authentication failure
$headers = get_headers("{$pydioBaseUrl}?secure_token={$secureToken}", true);
_client_pydioCreateCookies($headers['Set-Cookie']);
redirectTo($pydioBaseUrl);
exit;
}
/***********************************************************************************************************************
* Main
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
/** @var $cg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
if (!customerHasFeature('ftp') || !(isset($cfg['FILEMANAGER_PACKAGE']) && $cfg['FILEMANAGER_PACKAGE'] == 'Pydio')) {
showBadRequestErrorPage();
}
if (isset($_GET['id'])) {
if (!client_pydioAuth(clean_input($_GET['id']))) {
redirectTo('ftp_accounts.php');
}
} else {
redirectTo('/index.php');
}
示例8: generateNavigation
/**
* Helper function to generate navigation
*
* @throws iMSCP_Exception
* @param iMSCP_pTemplate $tpl iMSCP_pTemplate instance
* @return void
*/
function generateNavigation($tpl)
{
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onBeforeGenerateNavigation, array('templateEngine' => $tpl));
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$tpl->define_dynamic(array('main_menu' => 'layout', 'main_menu_block' => 'main_menu', 'menu' => 'layout', 'left_menu_block' => 'menu', 'breadcrumbs' => 'layout', 'breadcrumb_block' => 'breadcrumbs'));
generateLoggedFrom($tpl);
/** @var $navigation Zend_Navigation */
$navigation = iMSCP_Registry::get('navigation');
// Dynamic links (only at customer level)
if ($_SESSION['user_type'] == 'user') {
$domainProperties = get_domain_default_props($_SESSION['user_id']);
$tpl->assign('WEBSTATS_PATH', 'http://' . decode_idna($domainProperties['domain_name']) . '/stats');
if (customerHasFeature('mail')) {
$webmails = getWebmailList();
if (!empty($webmails)) {
$page1 = $navigation->findOneBy('class', 'email');
$page2 = $navigation->findOneBy('class', 'webtools');
foreach ($webmails as $webmail) {
$page = array('label' => tr('%s webmail', $webmail), 'uri' => '/' . ($webmail == 'Roundcube' ? 'webmail' : strtolower($webmail)), 'target' => '_blank');
$page1->addPage($page);
$page2->addPage($page);
}
}
}
}
// Dynamic links (All levels)
$tpl->assign(array('SUPPORT_SYSTEM_PATH' => 'ticket_system.php', 'SUPPORT_SYSTEM_TARGET' => '_self'));
// Remove support system page if feature is globally disabled
if (!$cfg['IMSCP_SUPPORT_SYSTEM']) {
$navigation->removePage($navigation->findOneBy('class', 'support'));
}
// Custom menus
if (null != ($customMenus = getCustomMenus($_SESSION['user_type']))) {
foreach ($customMenus as $customMenu) {
$navigation->addPage(array('order' => $customMenu['menu_order'], 'label' => tohtml($customMenu['menu_name']), 'uri' => get_menu_vars($customMenu['menu_link']), 'target' => !empty($customMenu['menu_target']) ? tohtml($customMenu['menu_target']) : '_self', 'class' => 'custom_link'));
}
}
/** @var $activePage Zend_Navigation_Page_Uri */
foreach ($navigation->findAllBy('uri', $_SERVER['SCRIPT_NAME']) as $activePage) {
$activePage->setActive();
}
if (!empty($_GET)) {
$query = '?' . http_build_query($_GET);
} else {
$query = '';
}
/** @var $page Zend_Navigation_Page */
foreach ($navigation as $page) {
if (null !== ($callbacks = $page->get('privilege_callback'))) {
$callbacks = isset($callbacks['name']) ? array($callbacks) : $callbacks;
foreach ($callbacks as $callback) {
if (is_callable($callback['name'])) {
if (!call_user_func_array($callback['name'], isset($callback['param']) ? (array) $callback['param'] : array())) {
continue 2;
}
} else {
$name = is_array($callback['name']) ? $callback['name'][1] : $callback['name'];
throw new iMSCP_Exception(sprintf('Privileges callback is not callable: %s', $name));
}
}
}
if ($page->isVisible()) {
$tpl->assign(array('HREF' => $page->getHref(), 'CLASS' => $page->getClass() . ($_SESSION['show_main_menu_labels'] ? ' show_labels' : ''), 'IS_ACTIVE_CLASS' => $page->isActive(true) ? 'active' : 'dummy', 'TARGET' => $page->getTarget() ? tohtml($page->getTarget()) : '_self', 'MAIN_MENU_LABEL_TOOLTIP' => tohtml($page->getLabel(), 'htmlAttr'), 'MAIN_MENU_LABEL' => $_SESSION['show_main_menu_labels'] ? tohtml($page->getLabel()) : ''));
// Add page to main menu
$tpl->parse('MAIN_MENU_BLOCK', '.main_menu_block');
if ($page->isActive(true)) {
$tpl->assign(array('TR_SECTION_TITLE' => tohtml($page->getLabel()), 'SECTION_TITLE_CLASS' => $page->getClass()));
// Add page to breadcrumb
$tpl->assign('BREADCRUMB_LABEL', tohtml($page->getLabel()));
$tpl->parse('BREADCRUMB_BLOCK', '.breadcrumb_block');
if ($page->hasPages()) {
$iterator = new RecursiveIteratorIterator($page, RecursiveIteratorIterator::SELF_FIRST);
/** @var $subpage Zend_Navigation_Page_Uri */
foreach ($iterator as $subpage) {
if (null !== ($callbacks = $subpage->get('privilege_callback'))) {
$callbacks = isset($callbacks['name']) ? array($callbacks) : $callbacks;
foreach ($callbacks as $callback) {
if (is_callable($callback['name'])) {
if (!call_user_func_array($callback['name'], isset($callback['param']) ? (array) $callback['param'] : array())) {
continue 2;
}
} else {
$name = is_array($callback['name']) ? $callback['name'][1] : $callback['name'];
throw new iMSCP_Exception(sprintf('Privileges callback is not callable: %s', $name));
}
}
}
$tpl->assign(array('HREF' => $subpage->getHref(), 'IS_ACTIVE_CLASS' => $subpage->isActive(true) ? 'active' : 'dummy', 'LEFT_MENU_LABEL' => tohtml($subpage->getLabel()), 'TARGET' => $subpage->getTarget() ? $subpage->getTarget() : '_self'));
if ($subpage->isVisible()) {
// Add subpage to left menu
$tpl->parse('LEFT_MENU_BLOCK', '.left_menu_block');
}
//.........这里部分代码省略.........
示例9: client_generatePage
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl Reference to the pTemplate object
* @return void
*/
function client_generatePage($tpl)
{
if (customerHasFeature('mail')) {
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$dmnProps = get_domain_default_props($_SESSION['user_id']);
$mainDmnId = $dmnProps['domain_id'];
$dmnMailAccLimit = $dmnProps['domain_mailacc_limit'];
$countedMails = _client_generateMailAccountsList($tpl, $mainDmnId);
$defaultMails = _client_countDefaultMails($mainDmnId);
if (!$cfg->COUNT_DEFAULT_EMAIL_ADDRESSES) {
$countedMails -= $defaultMails;
}
$totalMails = tr('Total mails: %s / %s %s', $countedMails, translate_limit_value($dmnMailAccLimit), $defaultMails ? $cfg->COUNT_DEFAULT_EMAIL_ADDRESSES ? '(' . tr('Incl. default mails') . ')' : '(' . tr('Excl. default mails') . ')' : '');
if ($countedMails || $defaultMails) {
$tpl->assign('TOTAL_MAIL_ACCOUNTS', $totalMails);
} else {
$tpl->assign('MAIL_ITEMS', '');
set_page_message(tr('Mail accounts list is empty.'), 'static_info');
}
} else {
$tpl->assign('MAIL_FEATURE', '');
set_page_message(tr('Mail feature is disabled.'), 'static_info');
}
}
示例10: set_page_message
if ($postRequest) {
set_page_message(tr('You must select a least one item to deactivate.'), 'warning');
} else {
showBadRequestErrorPage();
}
}
}
/***********************************************************************************************************************
* Main
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
// If the feature is disabled, redirects in silent way
if (customerHasFeature('external_mail')) {
if (!empty($_POST)) {
$items['normal'] = isset($_POST['normal']) ? $_POST['normal'] : null;
$items['alias'] = isset($_POST['alias']) ? $_POST['alias'] : null;
$postRequest = true;
} else {
if (isset($_GET['item']) && count($item = explode(';', $_GET['item'], 2)) == 2) {
$items[$item[1]][] = $item[0];
$postRequest = false;
} else {
showBadRequestErrorPage();
exit;
}
}
client_deleteExternalMailServers($items, $postRequest);
redirectTo('mail_external.php');
示例11: check_login
*
* The Initial Developer of the Original Code is moleSoftware GmbH.
* Portions created by Initial Developer are Copyright (C) 2001-2006
* by moleSoftware GmbH. All Rights Reserved.
*
* Portions created by the ispCP Team are Copyright (C) 2006-2010 by
* isp Control Panel. All Rights Reserved.
*
* Portions created by the i-MSCP Team are Copyright (C) 2010-2015 by
* i-MSCP - internet Multi Server Control Panel. All Rights Reserved.
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
customerHasFeature('custom_error_pages') or showBadRequestErrorPage();
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'client/error_pages.tpl', 'page_message' => 'layout'));
// page functions.
/**
* @param $user_id
* @param $eid
* @return bool
*/
function write_error_page($user_id, $eid)
{
$error = $_POST['error'];
$file = '/errors/' . $eid . '.html';
$vfs = new iMSCP_VirtualFileSystem($_SESSION['user_logged']);
示例12: check_login
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/***********************************************************************************************************************
* Main
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
if (customerHasFeature('ftp') && isset($_GET['id'])) {
$ftpUserId = clean_input($_GET['id']);
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onBeforeDeleteFtp, array('ftpUserId' => $ftpUserId));
$query = "SELECT `gid` FROM `ftp_users` WHERE `userid` = ? AND `admin_id` = ?";
$stmt = exec_query($query, array($ftpUserId, $_SESSION['user_id']));
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
$ftpUserGid = $stmt->fields['gid'];
/** @var $db iMSCP_Database */
$db = iMSCP_Database::getInstance();
try {
$db->beginTransaction();
$stmt = exec_query("SELECT `groupname`, `members` FROM `ftp_group` WHERE `gid` = ?", $ftpUserGid);
if ($stmt->rowCount()) {
$groupName = $stmt->fields['groupname'];
示例13: foreach
// Show directories only
foreach ($list as $entry) {
$directory = $path . '/' . $entry['file'];
if ($entry['type'] != iMSCP_VirtualFileSystem::VFS_TYPE_DIR || ($entry['file'] == '.' || $entry['file'] == '..') || !isAllowedDir(get_user_domain_id($_SESSION['user_id']), $directory)) {
continue;
}
// Create the directory link
$tpl->assign(array('DIR_NAME' => tohtml($entry['file']), 'CHOOSE_IT' => $directory, 'LINK' => 'ftp_choose_dir.php?cur_dir=' . $directory));
$tpl->parse('ACTION_LINK', 'action_link');
$tpl->parse('DIR_ITEM', '.dir_item');
}
}
/***********************************************************************************************************************
* Main
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
if (!customerHasFeature('ftp') && !customerHasFeature('protected_areas')) {
showBadRequestErrorPage();
}
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic(array('layout' => 'shared/layouts/simple.tpl', 'page' => 'client/ftp_choose_dir.tpl', 'page_message' => 'layout', 'ftp_chooser' => 'page', 'dir_item' => 'ftp_chooser', 'list_item' => 'dir_item', 'action_link' => 'list_item'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Choose Directory'), 'CONTEXT_CLASS' => ' no_header', 'productLongName' => tr('internet Multi Server Control Panel'), 'productLink' => 'http://www.i-mscp.net', 'productCopyright' => tr('© 2010-2015 i-MSCP Team<br/>All Rights Reserved'), 'TR_DIRECTORY_TREE' => tr('Directory tree'), 'TR_DIRECTORIES' => tr('Directories'), 'CHOOSE' => tr('Choose')));
client_generateDirectoriesList($tpl);
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptEnd, array('templateEngine' => $tpl));
$tpl->prnt();
unsetMessages();
示例14: client_generateView
/**
* Generate view
*
* @param array $verifiedData Verified data
* @param array $data Page data
* @return void
*/
function client_generateView($verifiedData, $data)
{
/** @var $tpl iMSCP_pTemplate */
$tpl = iMSCP_Registry::get('templateEngine');
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$selectedOption = $cfg['HTML_SELECTED'];
$idnItemName = $verifiedData['item_name'];
$entriesCount = isset($data['type']) ? count($data['type']) : 0;
$mxTypes = array(tr('Domain') => 'domain', tr('wildcard') => 'wildcard');
if (customerHasFeature('mail')) {
$mxTypes[tr('Spam Filter')] = 'filter';
}
$tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Email / External Mail Server / Edit External Mail Server for {DOMAIN_UTF8}'), 'TR_MX_TYPE' => tr('Type'), 'DOMAIN_UTF8' => decode_idna($idnItemName), 'TR_PRIORITY' => tr('Priority'), 'TR_HOST' => tr('External Mail Host'), 'TR_SELECT_ENTRY_MESSAGE' => tr('Select this entry for deletion.'), 'TR_SELECT_ALL_ENTRIES_MESSAGE' => tr('Select all entries for deletion.'), 'TR_ADD_NEW_ENTRY' => tr('Add new entry'), 'TR_REMOVE_LAST_ENTRY' => tr('Remove last entry'), 'TR_RESET_ENTRIES' => tr('Reset entries'), 'TR_TRIGGER_REMOVE_ALERT' => tr('You cannot remove this entry.'), 'TR_CANCEL' => tr('Cancel'), 'TR_UPDATE' => tr('Update'), 'TR_MX_TYPE_TOOLTIP' => tr('Domain: Setup an external MX host to relay mail of your entire domain.') . '<br><br>' . (customerHasFeature('mail') ? tr('Wildcard: Setup an external MX host to relay mail for inexistent subdomains.') . '<br><br>' : '') . tr('Spam Filter: Setup an external MX host to relay mail of your entire domain but retains our server as final mailhost.') . '<br><br>' . tr("Note: You cannot mix 'Spam Filter' and 'Domain' options"), 'ITEM' => $verifiedData['item_id'] . ';' . $verifiedData['item_type']));
iMSCP_Events_Aggregator::getInstance()->registerListener('onGetJsTranslations', function ($e) {
/** @var iMSCP_Events_Event $e */
$translations = $e->getParam('translations');
$translations['core']['all_entries_alert'] = tr('Selecting all entries for deletion will cause deactivation of external mail server.');
});
for ($index = 0; $index < $entriesCount; $index++) {
// Generates html option elements for the name
foreach ($mxTypes as $optionName => $optionValue) {
$tpl->assign(array('INDEX' => $index, 'OPTION_VALUE' => $optionValue, 'SELECTED' => $optionValue == $data['type'][$index] ? $selectedOption : '', 'OPTION_NAME' => $optionName));
$tpl->parse('TYPE_OPTIONS', '.type_options');
}
// Generates html option elements for the MX priority
foreach (range(5, 50, 5) as $option) {
$tpl->assign(array('INDEX' => $index, 'OPTION_VALUE' => $option, 'SELECTED' => $option == $data['priority'][$index] ? $selectedOption : '', 'OPTION_NAME' => $option));
$tpl->parse('PRIORITY_OPTIONS', '.priority_options');
}
$tpl->assign(array('INDEX' => $index, 'HOST' => $data['host'][$index], 'ENTRY_ID' => isset($data['to_update'][$index]) ? $data['to_update'][$index] : ''));
$tpl->parse('ITEM_ENTRIES', '.item_entries');
$tpl->assign('TYPE_OPTIONS', '');
// Reset name options stack for next record
$tpl->assign('PRIORITY_OPTIONS', '');
// Reset priority options stack for next record
}
}
示例15: check_login
*
* The Initial Developer of the Original Code is moleSoftware GmbH.
* Portions created by Initial Developer are Copyright (C) 2001-2006
* by moleSoftware GmbH. All Rights Reserved.
*
* Portions created by the ispCP Team are Copyright (C) 2006-2010 by
* isp Control Panel. All Rights Reserved.
*
* Portions created by the i-MSCP Team are Copyright (C) 2010-2015 by
* i-MSCP - internet Multi Server Control Panel. All Rights Reserved.
*/
// Include core library
require_once 'imscp-lib.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
customerHasFeature('custom_dns_records') or showBadRequestErrorPage();
if (isset($_GET['id'])) {
$dnsRecordId = intval($_GET['id']);
$stmt = exec_query('
UPDATE
domain_dns
INNER JOIN
domain USING(domain_id)
SET
domain_dns_status = ?
WHERE
domain_dns_id = ?
AND
domain_admin_id = ?
', array('todelete', $dnsRecordId, $_SESSION['user_id']));
if ($stmt->rowCount()) {