$nbFtpAccounts = 0; while (!$stmt->EOF) { $userid = $stmt->fields['userid']; $tpl->assign(array('FTP_ACCOUNT' => tohtml($userid), 'UID' => urlencode($userid))); $tpl->parse('FTP_ITEM', '.ftp_item'); $stmt->moveNext(); $nbFtpAccounts++; } $tpl->assign('TOTAL_FTP_ACCOUNTS', $nbFtpAccounts); } } /*********************************************************************************************************************** * Main script */ // Include core library require_once 'imscp-lib.php'; iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart); check_login('user'); customerHasFeature('ftp') 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/ftp_accounts.tpl', 'page_message' => 'layout', 'ftp_message' => 'page', 'ftp_accounts' => 'page', 'ftp_item' => 'ftp_accounts', 'ftp_easy_login' => 'ftp_item')); $tpl->assign(array('TR_PAGE_TITLE' => tr('Client / FTP / Overview'), 'TR_TOTAL_FTP_ACCOUNTS' => tr('FTPs total'), 'TR_FTP_USERS' => tr('FTP Users'), 'TR_FTP_ACCOUNT' => tr('FTP account'), 'TR_FTP_ACTION' => tr('Actions'), 'TR_LOGINAS' => tr('Login As'), 'TR_EDIT' => tr('Edit'), 'TR_DELETE' => tr('Delete'), 'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete the %s FTP user?', '%s'))); generateNavigation($tpl); ftp_generatePageData($tpl); generatePageMessage($tpl); $tpl->parse('LAYOUT_CONTENT', 'page'); iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptEnd, array('templateEngine' => $tpl)); $tpl->prnt(); unsetMessages();
$mainDmnProps = get_domain_default_props($_SESSION['user_id']); $mainDmnId = $mainDmnProps['domain_id']; $mainDmnName = $mainDmnProps['domain_name']; $ftpAccountLimit = $mainDmnProps['domain_ftpacc_limit']; if (is_xhr() && isset($_POST['domain_type'])) { echo json_encode(ftp_getDomainList($mainDmnName, $mainDmnId, clean_input($_POST['domain_type']))); exit; } elseif (!empty($_POST)) { // Check for ftp account limit (only on new account submission to avoid too many query each time the page // is displayed $nbFtpAccounts = get_customer_running_ftp_acc_cnt($_SESSION['user_id']); if ($ftpAccountLimit && $nbFtpAccounts >= $ftpAccountLimit) { set_page_message(tr('FTP account limit reached.'), 'error'); redirectTo('ftp_accounts.php'); } if (ftp_addAccount($mainDmnName)) { redirectTo('ftp_accounts.php'); } } /** @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/ftp_add.tpl', 'page_message' => 'layout', 'domain_list' => 'page', 'domain_types' => 'page')); $tpl->assign(array('TR_PAGE_TITLE' => tr('Client / FTP / Add FTP Account'), 'TR_FTP_DIRECTORIES' => tojs('Ftp directories'), 'TR_CLOSE' => tojs(tr('Close')), 'TR_FTP_ACCOUNT_DATA' => tr('Ftp account data'), 'TR_DOMAIN_TYPE_LABEL' => tr('Domain type'), 'TR_USERNAME' => tr('Username'), 'TR_PASSWORD' => tr('Password'), 'TR_PASSWORD_REPEAT' => tr('Repeat password'), 'TR_HOME_DIR' => tr('Home directory'), 'TR_CHOOSE_DIR' => tr('Choose dir'), 'TR_ADD' => tr('Add'), 'TR_CANCEL' => tr('Cancel'))); ftp_generatePageData($mainDmnName, $mainDmnId, $tpl); generateNavigation($tpl); generatePageMessage($tpl); $tpl->parse('LAYOUT_CONTENT', 'page'); iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptEnd, array('templateEngine' => $tpl)); $tpl->prnt(); unsetMessages();