本文整理汇总了PHP中iMSCP_pTemplate类的典型用法代码示例。如果您正苦于以下问题:PHP iMSCP_pTemplate类的具体用法?PHP iMSCP_pTemplate怎么用?PHP iMSCP_pTemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iMSCP_pTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gen_reseller_personal_data
/**
* @param iMSCP_pTemplate $tpl
* @param $user_id
*/
function gen_reseller_personal_data($tpl, $user_id)
{
$cfg = iMSCP_Registry::get('config');
$query = "\n\t\tSELECT\n\t\t\t`fname`,\n\t\t\t`lname`,\n\t\t\t`gender`,\n\t\t\t`firm`,\n\t\t\t`zip`,\n\t\t\t`city`,\n\t\t\t`state`,\n\t\t\t`country`,\n\t\t\t`street1`,\n\t\t\t`street2`,\n\t\t\t`email`,\n\t\t\t`phone`,\n\t\t\t`fax`\n\t\tFROM\n\t\t\t`admin`\n\t\tWHERE\n\t\t\t`admin_id` = ?\n\t";
$rs = exec_query($query, $user_id);
$tpl->assign(array('FIRST_NAME' => $rs->fields['fname'] == null ? '' : tohtml($rs->fields['fname']), 'LAST_NAME' => $rs->fields['lname'] == null ? '' : tohtml($rs->fields['lname']), 'FIRM' => $rs->fields['firm'] == null ? '' : tohtml($rs->fields['firm']), 'ZIP' => $rs->fields['zip'] == null ? '' : tohtml($rs->fields['zip']), 'CITY' => $rs->fields['city'] == null ? '' : tohtml($rs->fields['city']), 'STATE' => $rs->fields['state'] == null ? '' : tohtml($rs->fields['state']), 'COUNTRY' => $rs->fields['country'] == null ? '' : tohtml($rs->fields['country']), 'STREET_1' => $rs->fields['street1'] == null ? '' : tohtml($rs->fields['street1']), 'STREET_2' => $rs->fields['street2'] == null ? '' : tohtml($rs->fields['street2']), 'EMAIL' => $rs->fields['email'] == null ? '' : tohtml($rs->fields['email']), 'PHONE' => $rs->fields['phone'] == null ? '' : tohtml($rs->fields['phone']), 'FAX' => $rs->fields['fax'] == null ? '' : tohtml($rs->fields['fax']), 'VL_MALE' => $rs->fields['gender'] == 'M' ? $cfg->HTML_SELECTED : '', 'VL_FEMALE' => $rs->fields['gender'] == 'F' ? $cfg->HTML_SELECTED : '', 'VL_UNKNOWN' => $rs->fields['gender'] == 'U' || empty($rs->fields['gender']) ? $cfg->HTML_SELECTED : ''));
}
示例2: 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');
}
}
示例3: admin_generatePage
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl
* @return void
*/
function admin_generatePage($tpl)
{
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
if (!isset($cfg['CHECK_FOR_UPDATES']) || !$cfg['CHECK_FOR_UPDATES']) {
set_page_message(tr('i-MSCP version update checking is disabled'), 'static_warning');
} else {
/** @var iMSCP_Update_Version $updateVersion */
$updateVersion = iMSCP_Update_Version::getInstance();
if ($updateVersion->isAvailableUpdate()) {
if ($updateInfo = $updateVersion->getUpdateInfo()) {
$date = new DateTime($updateInfo['published_at']);
$tpl->assign(array('TR_UPDATE_INFO' => tr('Update info'), 'TR_RELEASE_VERSION' => tr('Release version'), 'RELEASE_VERSION' => tohtml($updateInfo['tag_name']), 'TR_RELEASE_DATE' => tr('Release date'), 'RELEASE_DATE' => tohtml($date->format($cfg['DATE_FORMAT'])), 'TR_RELEASE_DESCRIPTION' => tr('Release description'), 'RELEASE_DESCRIPTION' => tohtml($updateInfo['body']), 'TR_DOWNLOAD_LINKS' => tr('Download links'), 'TR_DOWNLOAD_ZIP' => tr('Download ZIP'), 'TR_DOWNLOAD_TAR' => tr('Download TAR'), 'TARBALL_URL' => tohtml($updateInfo['tarball_url']), 'ZIPBALL_URL' => tohtml($updateInfo['zipball_url'])));
return;
} else {
set_page_message($updateVersion->getError(), 'error');
}
} elseif ($updateVersion->getError()) {
set_page_message($updateVersion, 'error');
} else {
set_page_message(tr('No update available'), 'static_info');
}
}
$tpl->assign('UPDATE_INFO', '');
}
示例4: reseller_generatePage
/**
* Generates page.
*
* @param iMSCP_pTemplate $tpl Template engine instance
*/
function reseller_generatePage($tpl)
{
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$query = "SELECT domain_created from admin where admin_id = ?";
$stmt = exec_query($query, (int) $_SESSION['user_id']);
$tpl->assign(array('TR_ACCOUNT_SUMMARY' => tr('Account summary'), 'TR_USERNAME' => tr('Username'), 'USERNAME' => tohtml($_SESSION['user_logged']), 'TR_ACCOUNT_TYPE' => tr('Account type'), 'ACCOUNT_TYPE' => $_SESSION['user_type'], 'TR_REGISTRATION_DATE' => tr('Registration date'), 'REGISTRATION_DATE' => $stmt->fields['domain_created'] != 0 ? date($cfg->DATE_FORMAT, $stmt->fields['domain_created']) : tr('Unknown')));
}
示例5: 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}";
}
示例6: client_generatePage
/**
* Generates page.
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @param int $dmn_id Domain unique identifier
* @return void
*/
function client_generatePage($tpl, &$dmn_id)
{
if (isset($_GET['uname']) && $_GET['uname'] !== '' && is_numeric($_GET['uname'])) {
$uuser_id = $_GET['uname'];
$tpl->assign('UNAME', tohtml(client_getHtaccessUsername($uuser_id, $dmn_id)));
$tpl->assign('UID', $uuser_id);
} else {
if (isset($_POST['nadmin_name']) && !empty($_POST['nadmin_name']) && is_numeric($_POST['nadmin_name'])) {
$uuser_id = $_POST['nadmin_name'];
$tpl->assign('UNAME', tohtml(client_getHtaccessUsername($uuser_id, $dmn_id)));
$tpl->assign('UID', $uuser_id);
} else {
redirectTo('protected_user_manage.php');
exit;
// Useless but avoid stupid IDE warning about possibled undefined variable
}
}
// get groups
$query = "SELECT * FROM `htaccess_groups` WHERE `dmn_id` = ?";
$stmt = exec_query($query, $dmn_id);
if ($stmt->rowCount() == 0) {
set_page_message(tr('You have no groups.'), 'error');
redirectTo('protected_user_manage.php');
} else {
$added_in = 0;
$not_added_in = 0;
while (!$stmt->EOF) {
$group_id = $stmt->fields['id'];
$group_name = $stmt->fields['ugroup'];
$members = $stmt->fields['members'];
$members = explode(",", $members);
$grp_in = 0;
// let's generete all groups wher the user is assigned
for ($i = 0, $cnt_members = count($members); $i < $cnt_members; $i++) {
if ($uuser_id == $members[$i]) {
$tpl->assign(array('GRP_IN' => tohtml($group_name), 'GRP_IN_ID' => $group_id));
$tpl->parse('ALREADY_IN', '.already_in');
$grp_in = $group_id;
$added_in++;
}
}
if ($grp_in !== $group_id) {
$tpl->assign(array('GRP_NAME' => tohtml($group_name), 'GRP_ID' => $group_id));
$tpl->parse('GRP_AVLB', '.grp_avlb');
$not_added_in++;
}
$stmt->moveNext();
}
// generate add/remove buttons
if ($added_in < 1) {
$tpl->assign('IN_GROUP', '');
}
if ($not_added_in < 1) {
$tpl->assign('NOT_IN_GROUP', '');
}
}
}
示例7: _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))));
}
示例8: client_generatePage
/**
* Generate page
*
* @param iMSCP_pTemplate $tpl
* @param int $id Sql user id
* @return array
*/
function client_generatePage($tpl, $id)
{
$stmt = exec_query('SELECT sqlu_name, sqlu_host, sqlu_pass FROM sql_user WHERE sqlu_id = ?', $id);
if (!$stmt->rowCount()) {
showBadRequestErrorPage();
}
$row = $stmt->fetchRow(PDO::FETCH_ASSOC);
$tpl->assign(array('USER_NAME' => tohtml($row['sqlu_name']), 'ID' => tohtml($id)));
return array($row['sqlu_name'], $row['sqlu_host'], $row['sqlu_pass']);
}
示例9: _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))));
}
示例10: _generateResellerStatistics
/**
* Generates statistics for the given reseller
*
* @param iMSCP_pTemplate $tpl Template engine instance
* @param int $resellerId Reseller unique identifier
* @param string $resellerName Reseller name
* @return void
*/
function _generateResellerStatistics($tpl, $resellerId, $resellerName)
{
$resellerProps = imscp_getResellerProperties($resellerId, true);
list($udmn_current, , , $usub_current, , , $uals_current, , , $umail_current, , , $uftp_current, , , $usql_db_current, , , $usql_user_current, , , $utraff_current, , , $udisk_current, ) = generate_reseller_users_props($resellerId);
$trafficLimitBytes = $resellerProps['max_traff_amnt'] * 1048576;
$trafficUsageBytes = $resellerProps['current_traff_amnt'] * 1048576;
$diskspaceLimitBytes = $resellerProps['max_disk_amnt'] * 1048576;
$diskspaceUsageBytes = $resellerProps['current_disk_amnt'] * 1048576;
$trafficUsagePercent = make_usage_vals($trafficUsageBytes, $trafficLimitBytes);
$diskspaceUsagePercent = make_usage_vals($diskspaceUsageBytes, $diskspaceLimitBytes);
$tpl->assign(array('RESELLER_NAME' => tohtml($resellerName), 'RESELLER_ID' => tohtml($resellerId), 'TRAFFIC_PERCENT' => tohtml($trafficUsagePercent), 'TRAFFIC_MSG' => $trafficLimitBytes ? tohtml(tr('%1$s / %2$s of %3$s', bytesHuman($utraff_current), bytesHuman($trafficUsageBytes), bytesHuman($trafficLimitBytes))) : tohtml(tr('%1$s / %2$s of unlimited', bytesHuman($utraff_current), bytesHuman($trafficUsageBytes))), 'DISK_PERCENT' => tohtml($diskspaceUsagePercent), 'DISK_MSG' => $diskspaceLimitBytes ? tohtml(tr('%1$s / %2$s of %3$s', bytesHuman($udisk_current), bytesHuman($diskspaceUsageBytes), bytesHuman($diskspaceLimitBytes))) : tohtml(tr('%1$s / %2$s of unlimited', bytesHuman($udisk_current), bytesHuman($diskspaceUsageBytes))), 'DMN_MSG' => $resellerProps['max_dmn_cnt'] ? tohtml(tr('%1$d / %2$d of %3$d', $udmn_current, $resellerProps['current_dmn_cnt'], $resellerProps['max_dmn_cnt'])) : tohtml(tr('%1$d / %2$d of unlimited', $udmn_current, $resellerProps['current_dmn_cnt'])), 'SUB_MSG' => $resellerProps['max_sub_cnt'] > 0 ? tohtml(tr('%1$d / %2$d of %3$d', $usub_current, $resellerProps['current_sub_cnt'], $resellerProps['max_sub_cnt'])) : ($resellerProps['max_sub_cnt'] == '-1' ? tohtml(tr('disabled')) : tohtml(tr('%1$d / %2$d of unlimited', $usub_current, $resellerProps['current_sub_cnt']))), 'ALS_MSG' => $resellerProps['max_als_cnt'] > 0 ? tohtml(tr('%1$d / %2$d of %3$d', $uals_current, $resellerProps['current_als_cnt'], $resellerProps['max_als_cnt'])) : ($resellerProps['max_als_cnt'] == '-1' ? tohtml(tr('disabled')) : tohtml(tr('%1$d / %2$d of unlimited', $uals_current, $resellerProps['current_als_cnt']))), 'MAIL_MSG' => $resellerProps['max_mail_cnt'] > 0 ? tohtml(tr('%1$d / %2$d of %3$d', $umail_current, $resellerProps['current_mail_cnt'], $resellerProps['max_mail_cnt'])) : ($resellerProps['max_mail_cnt'] == '-1' ? tohtml(tr('disabled')) : tohtml(tr('%1$d / %2$d of unlimited', $umail_current, $resellerProps['current_mail_cnt']))), 'FTP_MSG' => $resellerProps['max_ftp_cnt'] > 0 ? tohtml(tr('%1$d / %2$d of %3$d', $uftp_current, $resellerProps['current_ftp_cnt'], $resellerProps['max_ftp_cnt'])) : ($resellerProps['max_ftp_cnt'] == '-1' ? tohtml(tr('disabled')) : tohtml(tr('%1$d / %2$d of unlimited', $uftp_current, $resellerProps['current_ftp_cnt']))), 'SQL_DB_MSG' => $resellerProps['max_sql_db_cnt'] > 0 ? tohtml(tr('%1$d / %2$d of %3$d', $usql_db_current, $resellerProps['current_sql_db_cnt'], $resellerProps['max_sql_db_cnt'])) : ($resellerProps['max_sql_db_cnt'] == '-1' ? tohtml(tr('disabled')) : tohtml(tr('%1$d / %2$d of unlimited', $usql_db_current, $resellerProps['current_sql_db_cnt']))), 'SQL_USER_MSG' => $resellerProps['max_sql_user_cnt'] > 0 ? tohtml(tr('%1$d / %2$d of %3$d', $usql_user_current, $resellerProps['current_sql_user_cnt'], $resellerProps['max_sql_user_cnt'])) : ($resellerProps['max_sql_user_cnt'] == '-1' ? tohtml(tr('disabled')) : tohtml(tr('%1$d / %2$d of unlimited', $usql_user_current, $resellerProps['current_sql_user_cnt'])))));
}
示例11: generatePhpBlock
/**
* Generate PHP editor block
*
* @param iMSCP_pTemplate $tpl
* @return void
*/
function generatePhpBlock($tpl)
{
$phpini = iMSCP_PHPini::getInstance();
if (!$phpini->resellerHasPermission('phpiniSystem')) {
$tpl->assign('PHP_EDITOR_BLOCK', '');
}
$tpl->assign(array('PHP_EDITOR_YES' => $phpini->clientHasPermission('phpiniSystem') ? ' checked' : '', 'PHP_EDITOR_NO' => $phpini->clientHasPermission('phpiniSystem') ? '' : ' checked', 'TR_PHP_EDITOR' => tr('PHP Editor'), 'TR_PHP_EDITOR_SETTINGS' => tr('PHP Settings'), 'TR_SETTINGS' => tr('PHP Settings'), 'TR_DIRECTIVES_VALUES' => tr('PHP Configuration options'), 'TR_FIELDS_OK' => tr('All fields are valid.'), 'TR_MIB' => tr('MiB'), 'TR_SEC' => tr('Sec.')));
iMSCP_Events_Aggregator::getInstance()->registerListener('onGetJsTranslations', function ($e) {
/** @var iMSCP_Events_Event $e */
$translations = $e->getParam('translations');
$translations['core']['close'] = tr('Close');
$translations['core']['fields_ok'] = tr('All fields are valid.');
$translations['core']['out_of_range_value_error'] = tr('Value for the PHP %%s directive must be in range %%d to %%d.');
$translations['core']['lower_value_expected_error'] = tr('%%s must be lower than %%s.');
});
$permissionsBlock = false;
if (!$phpini->resellerHasPermission('phpiniAllowUrlFopen')) {
$tpl->assign('PHP_EDITOR_ALLOW_URL_FOPEN_BLOCK', '');
} else {
$tpl->assign(array('TR_CAN_EDIT_ALLOW_URL_FOPEN' => tr('Can edit the PHP %s configuration option', '<b>allow_url_fopen</b>'), 'ALLOW_URL_FOPEN_YES' => $phpini->clientHasPermission('phpiniAllowUrlFopen') ? ' checked' : '', 'ALLOW_URL_FOPEN_NO' => $phpini->clientHasPermission('phpiniAllowUrlFopen') ? '' : ' checked'));
$permissionsBlock = true;
}
if (!$phpini->resellerHasPermission('phpiniDisplayErrors')) {
$tpl->assign('PHP_EDITOR_DISPLAY_ERRORS_BLOCK', '');
} else {
$tpl->assign(array('TR_CAN_EDIT_DISPLAY_ERRORS' => tr('Can edit the PHP %s configuration option', '<b>display_errors</b>'), 'DISPLAY_ERRORS_YES' => $phpini->clientHasPermission('phpiniDisplayErrors') ? ' checked' : '', 'DISPLAY_ERRORS_NO' => $phpini->clientHasPermission('phpiniDisplayErrors') ? '' : ' checked'));
$permissionsBlock = true;
}
$cfg = iMSCP_Registry::get('config');
if ($cfg['HTTPD_SERVER'] == 'apache_itk') {
$tpl->assign(array('PHP_EDITOR_DISABLE_FUNCTIONS_BLOCK' => '', 'PHP_EDITOR_MAIL_FUNCTION_BLOCK' => ''));
} else {
if ($phpini->resellerHasPermission('phpiniDisableFunctions')) {
$tpl->assign(array('TR_CAN_EDIT_DISABLE_FUNCTIONS' => tr('Can edit the PHP %s configuration option', '<b>disable_functions</b>'), 'DISABLE_FUNCTIONS_YES' => $phpini->getClientPermission('phpiniDisableFunctions') == 'yes' ? ' checked' : '', 'DISABLE_FUNCTIONS_NO' => $phpini->getClientPermission('phpiniDisableFunctions') == 'no' ? ' checked' : '', 'TR_ONLY_EXEC' => tr('Only exec'), 'DISABLE_FUNCTIONS_EXEC' => $phpini->getClientPermission('phpiniDisableFunctions') == 'exec' ? ' checked' : ''));
} else {
$tpl->assign('PHP_EDITOR_DISABLE_FUNCTIONS_BLOCK', '');
}
if ($phpini->resellerHasPermission('phpiniMailFunction')) {
$tpl->assign(array('TR_CAN_USE_MAIL_FUNCTION' => tr('Can use the PHP %s function', '<b>mail</b>'), 'MAIL_FUNCTION_YES' => $phpini->clientHasPermission('phpiniMailFunction') ? ' checked' : '', 'MAIL_FUNCTION_NO' => $phpini->clientHasPermission('phpiniMailFunction') ? '' : ' checked'));
} else {
$tpl->assign('PHP_EDITOR_MAIL_FUNCTION_BLOCK', '');
}
$permissionsBlock = true;
}
if (!$permissionsBlock) {
$tpl->assign('PHP_EDITOR_PERMISSIONS_BLOCK', '');
} else {
$tpl->assign(array('TR_PERMISSIONS' => tr('PHP Permissions'), 'TR_ONLY_EXEC' => tr('Only exec')));
}
$tpl->assign(array('TR_POST_MAX_SIZE' => tr('PHP %s configuration option', '<b>post_max_size</b>'), 'POST_MAX_SIZE' => tohtml($phpini->getDomainIni('phpiniPostMaxSize'), 'htmlAttr'), 'TR_UPLOAD_MAX_FILEZISE' => tr('PHP %s configuration option', '<b>upload_max_filesize</b>'), 'UPLOAD_MAX_FILESIZE' => tohtml($phpini->getDomainIni('phpiniUploadMaxFileSize'), 'htmlAttr'), 'TR_MAX_EXECUTION_TIME' => tr('PHP %s configuration option', '<b>max_execution_time</b>'), 'MAX_EXECUTION_TIME' => tohtml($phpini->getDomainIni('phpiniMaxExecutionTime'), 'htmlAttr'), 'TR_MAX_INPUT_TIME' => tr('PHP %s configuration option', '<b>max_input_time</b>'), 'MAX_INPUT_TIME' => tohtml($phpini->getDomainIni('phpiniMaxInputTime'), 'htmlAttr'), 'TR_MEMORY_LIMIT' => tr('PHP %s configuration option', '<b>memory_limit</b>'), 'MEMORY_LIMIT' => tohtml($phpini->getDomainIni('phpiniMemoryLimit'), 'htmlAttr'), 'POST_MAX_SIZE_LIMIT' => tohtml($phpini->getResellerPermission('phpiniPostMaxSize'), 'htmlAttr'), 'UPLOAD_MAX_FILESIZE_LIMIT' => tohtml($phpini->getResellerPermission('phpiniUploadMaxFileSize'), 'htmlAttr'), 'MAX_EXECUTION_TIME_LIMIT' => tohtml($phpini->getResellerPermission('phpiniMaxExecutionTime'), 'htmlAttr'), 'MAX_INPUT_TIME_LIMIT' => tohtml($phpini->getResellerPermission('phpiniMaxInputTime'), 'htmlAttr'), 'MEMORY_LIMIT_LIMIT' => tohtml($phpini->getResellerPermission('phpiniMemoryLimit'), 'htmlAttr')));
}
示例12: client_databasesList
/**
* Generates databases list
*
* @param iMSCP_pTemplate $tpl Template engine
* @param int $dmnId Domain unique identifier
* @return void
*/
function client_databasesList($tpl, $dmnId)
{
$stmt = exec_query('SELECT sqld_id, sqld_name FROM sql_database WHERE domain_id = ? ORDER BY sqld_name ', $dmnId);
if (!$stmt->rowCount()) {
set_page_message(tr('You do not have databases.'), 'static_info');
$tpl->assign('SQL_DATABASES_USERS_LIST', '');
} else {
while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
$tpl->assign(array('DB_ID' => $row['sqld_id'], 'DB_NAME' => tohtml($row['sqld_name']), 'DB_NAME_JS' => tojs($row['sqld_name'])));
_client_generateDatabaseSqlUserList($tpl, $row['sqld_id']);
$tpl->parse('SQL_DATABASES_LIST', '.sql_databases_list');
}
}
}
示例13: 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', '');
}
}
示例14: 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', '');
}
}
示例15: 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', '');
}
}