本文整理汇总了PHP中iMSCP_pTemplate::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP iMSCP_pTemplate::parse方法的具体用法?PHP iMSCP_pTemplate::parse怎么用?PHP iMSCP_pTemplate::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iMSCP_pTemplate
的用法示例。
在下文中一共展示了iMSCP_pTemplate::parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _client_generateUserMailAutoRespond
/**
* Generate auto-resonder action links
*
* @param iMSCP_pTemplate $tpl pTemplate instance
* @param int $mailId Mail uique identifier
* @param string $mailStatus Mail status
* @param bool $mailAutoRespond
* @return void
*/
function _client_generateUserMailAutoRespond($tpl, $mailId, $mailStatus, $mailAutoRespond)
{
if ($mailStatus == 'ok') {
if (!$mailAutoRespond) {
$tpl->assign(array('AUTO_RESPOND' => tr('Enable'), 'AUTO_RESPOND_SCRIPT' => "mail_autoresponder_enable.php?mail_account_id={$mailId}", 'AUTO_RESPOND_EDIT_LINK' => ''));
} else {
$tpl->assign(array('AUTO_RESPOND' => tr('Disable'), 'AUTO_RESPOND_SCRIPT' => "mail_autoresponder_disable.php?mail_account_id={$mailId}", 'AUTO_RESPOND_EDIT' => tr('Edit'), 'AUTO_RESPOND_EDIT_SCRIPT' => "mail_autoresponder_edit.php?mail_account_id={$mailId}"));
$tpl->parse('AUTO_RESPOND_EDIT_LINK', 'auto_respond_edit_link');
}
$tpl->parse('AUTO_RESPOND_ITEM', 'auto_respond_item');
} else {
$tpl->assign('AUTO_RESPOND_ITEM', '');
}
}
示例2: listIPDomains
/**
* Generate List of Domains assigned to IPs
*
* @param iMSCP_pTemplate $tpl Template engine
* @return void
*/
function listIPDomains($tpl)
{
$resellerId = $_SESSION['user_id'];
$stmt = exec_query('SELECT reseller_ips FROM reseller_props WHERE reseller_id = ?', $resellerId);
$data = $stmt->fetchRow();
$resellerIps = explode(';', substr($data['reseller_ips'], 0, -1));
$stmt = execute_query('SELECT ip_id, ip_number FROM server_ips WHERE ip_id IN (' . implode(',', $resellerIps) . ')');
while ($ip = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
$stmt2 = exec_query('
SELECT
domain_name
FROM
domain
INNER JOIN
admin ON(admin_id = domain_admin_id)
WHERE
domain_ip_id = :ip_id
AND
created_by = :reseller_id
UNION
SELECT
alias_name AS domain_name
FROM
domain_aliasses
INNER JOIN
domain USING(domain_id)
INNER JOIN
admin ON(admin_id = domain_admin_id)
WHERE
alias_ip_id = :ip_id
AND
created_by = :reseller_id
', array('ip_id' => $ip['ip_id'], 'reseller_id' => $resellerId));
$domainsCount = $stmt2->rowCount();
$tpl->assign(array('IP' => tohtml($ip['ip_number']), 'RECORD_COUNT' => tr('Total Domains') . ': ' . $domainsCount));
if ($domainsCount) {
while ($data = $stmt2->fetchRow(PDO::FETCH_ASSOC)) {
$tpl->assign('DOMAIN_NAME', tohtml(idn_to_utf8($data['domain_name'])));
$tpl->parse('DOMAIN_ROW', '.domain_row');
}
} else {
$tpl->assign('DOMAIN_NAME', tr('No used yet'));
$tpl->parse('DOMAIN_ROW', 'domain_row');
}
$tpl->parse('IP_ROW', '.ip_row');
$tpl->assign('DOMAIN_ROW', '');
}
}
示例3: client_generateDirectoriesList
/**
* Generates directories list.
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @return void
*/
function client_generateDirectoriesList($tpl)
{
// Initialize variables
$path = isset($_GET['cur_dir']) ? clean_input($_GET['cur_dir']) : '';
$domain = $_SESSION['user_logged'];
// Create the virtual file system and open it so it can be used
$vfs = new iMSCP_VirtualFileSystem($domain);
// Get the directory listing
$list = $vfs->ls($path);
if (!$list) {
set_page_message(tr('Unable to retrieve directories list for your domain. Please contact your reseller.'), 'error');
$tpl->assign('FTP_CHOOSER', '');
return;
}
// Show parent directory link
$parent = explode('/', $path);
array_pop($parent);
$parent = implode('/', $parent);
$tpl->assign(array('ACTION_LINK' => '', 'ACTION' => '', 'ICON' => 'parent', 'DIR_NAME' => tr('Parent directory'), 'LINK' => "ftp_choose_dir.php?cur_dir={$parent}"));
$tpl->parse('DIR_ITEM', '.dir_item');
// 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');
}
}
示例4: selectedGraphic
/**
* Generate graph list
*
* @param TemplateEngine $tpl
* @param string $graphName Graphic name
* @param string $showWhen Period to show
*/
function selectedGraphic($tpl, $graphName, $showWhen)
{
$cfg = Registry::get('config');
/** @var PluginManager $pluginManager */
$pluginManager = Registry::get('pluginManager');
$graphDirectory = $pluginManager->pluginGetDirectory() . '/Monitorix/themes/default/assets/images/graphs';
$monitorixGraphics = array();
if ($dirHandle = @opendir($graphDirectory)) {
while (($file = @readdir($dirHandle)) !== false) {
if (!is_dir($file) && preg_match("/^{$graphName}\\d+[a-y]?[z]\\.\\d{$showWhen}\\.png/", $file)) {
array_push($monitorixGraphics, $file);
}
}
closedir($dirHandle);
if (count($monitorixGraphics) > 0) {
sort($monitorixGraphics);
foreach ($monitorixGraphics as $graphValue) {
$tpl->assign('MONITORIXGRAPH', pathinfo($graphValue, PATHINFO_FILENAME) . '.png');
$tpl->parse('MONITORIX_GRAPH_ITEM', '.monitorix_graph_item');
}
$tpl->assign('MONITORIXGRAPH_ERROR', '');
} else {
$tpl->assign(array('MONITORIXGRAPH_SELECTED' => '', 'MONITORIXGRAPHIC_ERROR' => tr("No graph for your selection is available")));
}
} else {
$tpl->assign(array('MONITORIXGRAPH_SELECTED' => '', 'MONITORIXGRAPHIC_ERROR' => tr("An error occured while opening the directory: %s", $graphDirectory)));
}
$htmlSelected = $cfg['HTML_SELECTED'];
$tpl->assign(array('M_HOUR_SELECTED' => $showWhen == 'hour' ? $htmlSelected : '', 'M_DAY_SELECTED' => $showWhen == 'day' ? $htmlSelected : '', 'M_WEEK_SELECTED' => $showWhen == 'week' ? $htmlSelected : '', 'M_MONTH_SELECTED' => $showWhen == 'month' ? $htmlSelected : '', 'M_YEAR_SELECTED' => $showWhen == 'year' ? $htmlSelected : '', 'MONITORIXGRAPH_NOT_SELECTED' => ''));
}
示例5: _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');
}
}
示例6: client_generatePage
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl
* @return void
*/
function client_generatePage($tpl)
{
$cfg = iMSCP_Registry::get('config');
if ($cfg['MYSQL_PREFIX'] == 'yes') {
$tpl->assign('MYSQL_PREFIX_YES', '');
if ($cfg['MYSQL_PREFIX_TYPE'] == 'behind') {
$tpl->assign('MYSQL_PREFIX_INFRONT', '');
$tpl->parse('MYSQL_PREFIX_BEHIND', 'mysql_prefix_behind');
$tpl->assign('MYSQL_PREFIX_ALL', '');
} else {
$tpl->parse('MYSQL_PREFIX_INFRONT', 'mysql_prefix_infront');
$tpl->assign(array('MYSQL_PREFIX_BEHIND' => '', 'MYSQL_PREFIX_ALL' => ''));
}
} else {
$tpl->assign(array('MYSQL_PREFIX_NO' => '', 'MYSQL_PREFIX_INFRONT' => '', 'MYSQL_PREFIX_BEHIND' => ''));
$tpl->parse('MYSQL_PREFIX_ALL', 'mysql_prefix_all');
}
if (isset($_POST['uaction']) && $_POST['uaction'] == 'add_db') {
$tpl->assign(array('DB_NAME' => clean_input($_POST['db_name'], true), 'USE_DMN_ID' => isset($_POST['use_dmn_id']) && $_POST['use_dmn_id'] === 'on' ? $cfg['HTML_CHECKED'] : '', 'START_ID_POS_SELECTED' => isset($_POST['id_pos']) && $_POST['id_pos'] !== 'end' ? $cfg['HTML_CHECKED'] : '', 'END_ID_POS_SELECTED' => isset($_POST['id_pos']) && $_POST['id_pos'] === 'end' ? $cfg['HTML_CHECKED'] : ''));
return;
}
$tpl->assign(array('DB_NAME' => '', 'USE_DMN_ID' => '', 'START_ID_POS_SELECTED' => $cfg['HTML_SELECTED'], 'END_ID_POS_SELECTED' => ''));
}
示例7: admin_generateLanguagesList
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl Template engine
* @return void
*/
function admin_generateLanguagesList($tpl)
{
$cfg = iMSCP_Registry::get('config');
$defaultLanguage = $cfg['USER_INITIAL_LANG'];
$availableLanguages = i18n_getAvailableLanguages();
if (!empty($availableLanguages)) {
foreach ($availableLanguages as $languageDefinition) {
$tpl->assign(array('LANGUAGE_NAME' => tohtml($languageDefinition['language']), 'NUMBER_TRANSLATED_STRINGS' => tohtml(tr('%d strings translated', $languageDefinition['translatedStrings'])), 'LANGUAGE_REVISION' => tohtml($languageDefinition['revision']), 'LOCALE_CHECKED' => $languageDefinition['locale'] == $defaultLanguage ? 'checked' : '', 'LOCALE' => tohtml($languageDefinition['locale'], 'htmlAttr')));
$tpl->parse('LANGUAGE_BLOCK', '.language_block');
}
} else {
$tpl->assign('LANGUAGES_BLOCK', '');
}
}
示例8: _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');
}
}
}
示例9: ftp_generateDomainTypeList
/**
* Generate domain type list
*
* @throws iMSCP_Exception
* @param int $mainDmnId Customer main domain id
* @param iMSCP_pTemplate $tpl
* @return void
*/
function ftp_generateDomainTypeList($mainDmnId, $tpl)
{
$query = "\n\t\tSELECT\n\t\t\tcount(`t2`.`subdomain_id`) AS `sub_count`, count(`t3`.`alias_id`) AS `als_count`,\n\t\t\tcount(`t4`.`subdomain_alias_id`) AS `alssub_count`\n\t\tFROM\n\t\t\t`domain` AS `t1`\n\t\tLEFT JOIN\n\t\t\t`subdomain` AS `t2` ON(`t2`.`domain_id` = `t1`.`domain_id`)\n\t\tLEFT JOIN\n\t\t\t`domain_aliasses` AS `t3` ON(`t3`.`domain_id` = `t1`.`domain_id`)\n\t\tLEFT JOIN\n\t\t\t`subdomain_alias` AS `t4` ON(`t4`.`alias_id` = `t3`.`alias_id`)\n\t\tWHERE\n\t\t\t`t1`.`domain_id` = ?\n\t";
$stmt = exec_query($query, $mainDmnId);
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$selected = $cfg->HTML_SELECTED;
$dmns = array(array('count' => '1', 'type' => 'dmn', 'tr' => tr('Domain')), array('count' => $stmt->fields['sub_count'], 'type' => 'sub', 'tr' => tr('Subdomain')), array('count' => $stmt->fields['als_count'], 'type' => 'als', 'tr' => tr('Domain alias')), array('count' => $stmt->fields['alssub_count'], 'type' => 'alssub', 'tr' => tr('Subdomain alias')));
foreach ($dmns as $dmn) {
if ($dmn['count']) {
$tpl->assign(array('DOMAIN_TYPE' => tohtml($dmn['type']), 'DOMAIN_TYPE_SELECTED' => isset($_POST['domain_type']) && $_POST['domain_type'] == $dmn['type'] ? $selected : $dmn['type'] == 'dmn' ? $selected : '', 'TR_DOMAIN_TYPE' => $dmn['tr']));
$tpl->parse('DOMAIN_TYPES', '.domain_types');
}
}
}
示例10: generatePageMessage
/**
* Generates the page messages to display on client browser
*
* Note: The default level for message is sets to 'info'.
* See the {@link set_page_message()} function for more information.
*
* @param iMSCP_pTemplate $tpl iMSCP_pTemplate instance
* @return void
*/
function generatePageMessage($tpl)
{
$namespace = new Zend_Session_Namespace('pageMessages');
if (Zend_Session::namespaceIsset('pageMessages')) {
foreach (array('success', 'error', 'warning', 'info', 'static_success', 'static_error', 'static_warning', 'static_info') as $level) {
if (isset($namespace->{$level})) {
$tpl->assign(array('MESSAGE_CLS' => $level, 'MESSAGE' => $namespace->{$level}));
$tpl->parse('PAGE_MESSAGE', '.page_message');
}
}
Zend_Session::namespaceUnset('pageMessages');
} else {
$tpl->assign('PAGE_MESSAGE', '');
}
}
示例11: generatePage
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl
* @return void
*/
function generatePage($tpl)
{
$stmt = exec_query('SELECT id, name, status FROM hosting_plans WHERE reseller_id = ? ORDER BY id', $_SESSION['user_id']);
if (!$stmt->rowCount()) {
$tpl->assign('HOSTING_PLANS', '');
set_page_message(tr('No hosting plan available.'), 'static_info');
return;
}
$tpl->assign(array('TR_ID' => tr('Id'), 'TR_NAME' => tr('Name'), 'TR_STATUS' => tr('Status'), 'TR_EDIT' => tr('Edit'), 'TR_ACTION' => tr('Actions'), 'TR_DELETE' => tr('Delete')));
iMSCP_Events_Aggregator::getInstance()->registerListener('onGetJsTranslations', function ($e) {
/** @var iMSCP_Events_Event $e */
$translations = $e->getParam('translations');
$translations['core']['hp_delete_confirmation'] = tr('Are you sure you want to delete this hosting plan?');
});
while ($row = $stmt->fetchRow()) {
$tpl->assign(array('ID' => $row['id'], 'NAME' => tohtml($row['name']), 'STATUS' => $row['status'] ? tr('Available') : tr('Unavailable')));
$tpl->parse('HOSTING_PLAN', '.hosting_plan');
}
}
示例12: generatePage
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl
* @param int $year Year
* @param int $month Month
* @param int $day Day
* @return void
*/
function generatePage($tpl, $year, $month, $day)
{
$firstHourOfDay = mktime(0, 0, 0, $month, $day, $year);
$lastHourOfDay = mktime(23, 59, 59, $month, $day, $year);
$stmt = exec_query('
SELECT
traff_time AS period, bytes_in AS all_in, bytes_out AS all_out, bytes_mail_in AS mail_in,
bytes_mail_out AS mail_out, bytes_pop_in AS pop_in, bytes_pop_out AS pop_out, bytes_web_in AS web_in,
bytes_web_out AS web_out
FROM
server_traffic
WHERE
traff_time BETWEEN ? AND ?
', array($firstHourOfDay, $lastHourOfDay));
if ($stmt->rowCount()) {
$all = array_fill(0, 8, 0);
while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
$otherIn = $row['all_in'] - ($row['mail_in'] + $row['pop_in'] + $row['web_in']);
$otherOut = $row['all_out'] - ($row['mail_out'] + $row['pop_out'] + $row['web_out']);
$tpl->assign(array('HOUR' => tohtml(date('H:i', $row['period'])), 'WEB_IN' => tohtml(bytesHuman($row['web_in'])), 'WEB_OUT' => tohtml(bytesHuman($row['web_out'])), 'SMTP_IN' => tohtml(bytesHuman($row['mail_in'])), 'SMTP_OUT' => tohtml(bytesHuman($row['mail_out'])), 'POP_IN' => tohtml(bytesHuman($row['pop_in'])), 'POP_OUT' => tohtml(bytesHuman($row['pop_out'])), 'OTHER_IN' => tohtml(bytesHuman($otherIn)), 'OTHER_OUT' => tohtml(bytesHuman($otherOut)), 'ALL_IN' => tohtml(bytesHuman($row['all_in'])), 'ALL_OUT' => tohtml(bytesHuman($row['all_out'])), 'ALL' => tohtml(bytesHuman($row['all_in'] + $row['all_out']))));
$all[0] += $row['web_in'];
$all[1] += $row['web_out'];
$all[2] += $row['mail_in'];
$all[3] += $row['mail_out'];
$all[4] += $row['pop_in'];
$all[5] += $row['pop_out'];
$all[6] += $row['all_in'];
$all[7] += $row['all_out'];
$tpl->parse('HOUR_LIST', '.hour_list');
}
$allOtherIn = $all[6] - ($all[0] + $all[2] + $all[4]);
$allOtherOut = $all[7] - ($all[1] + $all[3] + $all[5]);
$tpl->assign(array('WEB_IN_ALL' => tohtml(bytesHuman($all[0])), 'WEB_OUT_ALL' => tohtml(bytesHuman($all[1])), 'SMTP_IN_ALL' => tohtml(bytesHuman($all[2])), 'SMTP_OUT_ALL' => tohtml(bytesHuman($all[3])), 'POP_IN_ALL' => tohtml(bytesHuman($all[4])), 'POP_OUT_ALL' => tohtml(bytesHuman($all[5])), 'OTHER_IN_ALL' => tohtml(bytesHuman($allOtherIn)), 'OTHER_OUT_ALL' => tohtml(bytesHuman($allOtherOut)), 'ALL_IN_ALL' => tohtml(bytesHuman($all[6])), 'ALL_OUT_ALL' => tohtml(bytesHuman($all[7])), 'ALL_ALL' => tohtml(bytesHuman($all[6] + $all[7]))));
} else {
set_page_message(tr('No statistics found for the given period. Try another period.'), 'static_info');
$tpl->assign('DAY_SERVER_STATISTICS_BLOCK', '');
}
}
示例13: gen_htaccess_entries
/**
* @param iMSCP_pTemplate $tpl
* @param $dmn_id
* @return void
*/
function gen_htaccess_entries($tpl, &$dmn_id)
{
$query = "SELECT * FROM `htaccess` WHERE `dmn_id` = ?";
$rs = exec_query($query, $dmn_id);
if ($rs->recordCount() == 0) {
$tpl->assign('PROTECTED_AREAS', '');
set_page_message(tr('You do not have protected areas.'), 'static_info');
} else {
$counter = 0;
while (!$rs->EOF) {
$tpl->assign('CLASS', $counter % 2 == 0 ? 'content' : 'content2');
$id = $rs->fields['id'];
$user_id = $rs->fields['user_id'];
$group_id = $rs->fields['group_id'];
$status = $rs->fields['status'];
$path = $rs->fields['path'];
$auth_name = $rs->fields['auth_name'];
$tpl->assign(array('AREA_NAME' => tohtml($auth_name), 'JS_AREA_NAME' => addslashes($auth_name), 'AREA_PATH' => tohtml($path), 'PID' => $id, 'STATUS' => translate_dmn_status($status)));
$tpl->parse('DIR_ITEM', '.dir_item');
$rs->moveNext();
$counter++;
}
}
}
示例14: ftp_generatePageData
/**
* Generates page data
*
* @param iMSCP_pTemplate $tpl
* @return void
*/
function ftp_generatePageData($tpl)
{
$query = "SELECT `userid` FROM `ftp_users` WHERE `admin_id` = ? ORDER BY LENGTH(`userid`) DESC";
$stmt = exec_query($query, $_SESSION['user_id']);
if (!$stmt->rowCount()) {
set_page_message(tr('You do not have FTP accounts.'), 'static_info');
$tpl->assign('FTP_ACCOUNTS', '');
} else {
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
if (!(isset($cfg->FILEMANAGER_PACKAGE) && $cfg->FILEMANAGER_PACKAGE == 'Pydio')) {
$tpl->assign('FTP_EASY_LOGIN', '');
}
$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);
}
}
示例15: _client_generateNetcardsList
/**
* Generates network cards list.
*
* @access private
* @param iMSCP_pTemplate $tpl Template engine
* @return void
*/
function _client_generateNetcardsList($tpl)
{
/** @var $networkCardObject iMSCP_NetworkCard */
$networkCardObject = iMSCP_Registry::get('networkCardObject');
if ($networkCardObject->getErrors() != '') {
set_page_message($networkCardObject->getErrors(), 'error');
}
$networkCards = $networkCardObject->getAvailableInterface();
sort($networkCards);
if (!empty($networkCards)) {
foreach ($networkCards as $networkCard) {
$tpl->assign('NETWORK_CARD', $networkCard);
$tpl->parse('NETWORK_CARD_BLOCK', '.network_card_block');
}
} else {
// Should never occur but who knows.
set_page_message(tr('Unable to find any network interface. You cannot add new IP address.'), 'error');
$tpl->assign('IP_ADDRESS_FORM_BLOCK', '');
}
}