Skip to content

Commit

Permalink
Fixed: When creating a new customer, All hosting plans should be sele…
Browse files Browse the repository at this point in the history
…ctable (displayed) even if some of their features are not available for the reseller

Small fixes + cleanup
  • Loading branch information
nuxwin committed Sep 16, 2013
1 parent 6ac90f9 commit 43fd3bd
Show file tree
Hide file tree
Showing 23 changed files with 250 additions and 211 deletions.
1 change: 0 additions & 1 deletion gui/public/admin/domain_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,6 @@ function _admin_isValidServiceLimit($newCustomerLimit, $customerConsumption,
'ISP_LOGO' => layout_getUserLogo(),
'TR_EDIT_DOMAIN' => tr('Edit domain'),
'EDIT_ID' => tohtml($domainId),
'TR_HELP' => tr('Help'),
'TR_DOMAIN_OVERVIEW' => tr('Domain overview'),
'TR_DOMAIN_NAME' => tr('Domain name'),
'DOMAIN_NAME' => tohtml(decode_idna($data['domain_name'])),
Expand Down
2 changes: 1 addition & 1 deletion gui/public/admin/hosting_plan_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function admin_checkData($phpini)
$php = ($php == '_yes_') ? '_yes_' : '_no_';
$cgi = ($cgi == '_yes_') ? '_yes_' : '_no_';
$dns = ($dns == '_yes_') ? '_yes_' : '_no_';
$backup = (in_array($backup, array('_full_', '_dmn_', '_sql_'))) ? $backup : '_no_';
$backup = ($cfg->BACKUP_DOMAINS != 'no' && in_array($backup, array('_full_', '_dmn_', '_sql_'))) ? $backup : '_no_';
$aps = ($aps == '_yes_') ? '_yes_' : '_no_';
$extMail = ($extMail == '_yes_') ? '_yes_' : '_no_';
$webFolderProtection = ($webFolderProtection == '_yes_') ? '_yes_' : '_no_';
Expand Down
35 changes: 18 additions & 17 deletions gui/public/admin/hosting_plan_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ function admin_generatePage($tpl, $id, $phpini)


list(
$php, $cgi, $sub, $als, $mail, $ftp, $sqld, $sqlu, $monthlyTraffic, $diskspace, $bkp, $dns, $aps, $phpEditor,
$php, $cgi, $sub, $als, $mail, $ftp, $sqld, $sqlu, $monthlyTraffic, $diskspace, $backup, $dns, $aps, $phpEditor,
$phpAllowUrlFopenPerm, $phpDisplayErrorsPerm, $phpDisableFunctionsPerm, $phpPostMaxSizeValue,
$phpUploadMaxFilesizeValue, $phpMaxExecutionTimeValue, $phpMaxInputTimeValue, $phpMemoryLimitValue, $hpExtMail, $hpProtectedWebFolders
$phpUploadMaxFilesizeValue, $phpMaxExecutionTimeValue, $phpMaxInputTimeValue, $phpMemoryLimitValue,
$hpExtMail, $hpProtectedWebFolders
) = explode(';', $data['props']);

$phpini->setClPerm('phpiniSystem', $phpEditor);
Expand Down Expand Up @@ -182,7 +183,7 @@ function admin_generatePage($tpl, $id, $phpini)
'DNS_YES' => ($dns == '_yes_') ? $checked : '',
'DNS_NO' => ($dns == '_no_') ? $checked : '',
'SOFTWARE_YES' => ($aps == '_yes_') ? $checked : '',
'SOFTWARE_NO' => ($aps == '_no_' || !$aps) ? $checked : '',
'SOFTWARE_NO' => ($aps == '_no_') ? $checked : '',
'EXTMAIL_YES' => ($hpExtMail == '_yes_') ? $checked : '',
'EXTMAIL_NO' => ($hpExtMail == '_no_') ? $checked : '',
'PROTECT_WEB_FOLDERS_YES' => ($hpProtectedWebFolders == '_yes_') ? $checked : '',
Expand All @@ -195,10 +196,10 @@ function admin_generatePage($tpl, $id, $phpini)
if ($cfg->BACKUP_DOMAINS != 'no') {
$tpl->assign(
array(
'BACKUPD' => '',
'BACKUPS' => '',
'BACKUPF' => '',
'BACKUPN' => $checked,
'BACKUPD' => ($backup == '_dmn_') ? $checked : '',
'BACKUPS' => ($backup == '_sql_') ? $checked : '',
'BACKUPF' => ($backup == '_full_') ? $checked : '',
'BACKUPN' => ($backup == '_no_') ? $checked : ''
)
);
} else {
Expand All @@ -222,7 +223,7 @@ function admin_generatePage($tpl, $id, $phpini)
function admin_generateErrorPage($tpl, $phpini)
{
global $id, $name, $description, $sub, $als, $mail, $ftp, $sqld, $sqlu, $monthlyTraffic, $diskspace, $php, $cgi,
$bkp, $dns, $aps, $hpExtMail, $hpProtectedWebFolders, $status;
$backup, $dns, $aps, $hpExtMail, $hpProtectedWebFolders, $status;

/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
Expand Down Expand Up @@ -261,10 +262,10 @@ function admin_generateErrorPage($tpl, $phpini)
if ($cfg->BACKUP_DOMAINS != 'no') {
$tpl->assign(
array(
'BACKUPD' => ($bkp == '_dmn_') ? $checked : '',
'BACKUPS' => ($bkp == '_sql_') ? $checked : '',
'BACKUPF' => ($bkp == '_full_') ? $checked : '',
'BACKUPN' => ($bkp == '_no_') ? $checked : '',
'BACKUPD' => ($backup == '_dmn_') ? $checked : '',
'BACKUPS' => ($backup == '_sql_') ? $checked : '',
'BACKUPF' => ($backup == '_full_') ? $checked : '',
'BACKUPN' => ($backup == '_no_') ? $checked : '',
)
);
} else {
Expand All @@ -287,7 +288,7 @@ function admin_generateErrorPage($tpl, $phpini)
function admin_checkData($phpini)
{
global $name, $description, $sub, $als, $mail, $ftp, $sqld, $sqlu, $monthlyTraffic, $diskspace, $php, $cgi, $dns,
$bkp, $aps, $hpExtMail, $hpProtectedWebFolders, $status;
$backup, $aps, $hpExtMail, $hpProtectedWebFolders, $status;

/** @var iMSCP_Config_Handler_File $cfg */
$cfg = iMSCP_Registry::get('config');
Expand All @@ -307,7 +308,7 @@ function admin_checkData($phpini)
$php = isset($_POST['hp_php']) ? clean_input($_POST['hp_php']) : '_no_';
$cgi = isset($_POST['hp_cgi']) ? clean_input($_POST['hp_cgi']) : '_no_';
$dns = isset($_POST['hp_dns']) ? clean_input($_POST['hp_dns']) : '_no_';
$bkp = isset($_POST['hp_backup']) ? clean_input($_POST['hp_backup']) : '_no_';
$backup = isset($_POST['hp_backup']) ? clean_input($_POST['hp_backup']) : '_no_';
$aps = isset($_POST['hp_softwares_installer']) ? clean_input($_POST['hp_softwares_installer']) : '_no_';
$hpExtMail = isset($_POST['hp_external_mail']) ? clean_input($_POST['hp_external_mail']) : '_no_';

Expand All @@ -322,7 +323,7 @@ function admin_checkData($phpini)
$php = ($php == '_yes_') ? '_yes_' : '_no_';
$cgi = ($cgi == '_yes_') ? '_yes_' : '_no_';
$dns = ($dns == '_yes_') ? '_yes_' : '_no_';
$bkp = (in_array($bkp, array('_full_', '_dmn_', '_sql_'))) ? $bkp : '_no_';
$backup = ($cfg->BACKUP_DOMAINS != 'no' && in_array($backup, array('_full_', '_dmn_', '_sql_'))) ? $backup : '_no_';
$aps = ($aps == '_yes_') ? '_yes_' : '_no_';
$hpExtMail = ($hpExtMail == '_yes_') ? '_yes_' : '_no_';
$hpProtectedWebFolders = ($hpProtectedWebFolders == '_yes_') ? '_yes_' : '_no_';
Expand Down Expand Up @@ -437,7 +438,7 @@ function admin_checkData($phpini)
function admin_UpdateHostingPlan($phpini)
{
global $id, $name, $description, $sub, $als, $mail, $ftp, $sqld, $sqlu, $monthlyTraffic, $diskspace, $php, $cgi,
$dns, $bkp, $aps, $hpExtMail, $hpProtectedWebFolders, $status;
$dns, $backup, $aps, $hpExtMail, $hpProtectedWebFolders, $status;

$query = "
SELECT
Expand All @@ -459,7 +460,7 @@ function admin_UpdateHostingPlan($phpini)
return false;
}

$hpProps = "$php;$cgi;$sub;$als;$mail;$ftp;$sqld;$sqlu;$monthlyTraffic;$diskspace;$bkp;$dns;$aps";
$hpProps = "$php;$cgi;$sub;$als;$mail;$ftp;$sqld;$sqlu;$monthlyTraffic;$diskspace;$backup;$dns;$aps";
$hpProps .= ';' . $phpini->getClPermVal('phpiniSystem') . ';' . $phpini->getClPermVal('phpiniAllowUrlFopen');
$hpProps .= ';' . $phpini->getClPermVal('phpiniDisplayErrors') . ';' . $phpini->getClPermVal('phpiniDisableFunctions');
$hpProps .= ';' . $phpini->getDataVal('phpiniPostMaxSize') . ';' . $phpini->getDataVal('phpiniUploadMaxFileSize');
Expand Down
14 changes: 8 additions & 6 deletions gui/public/admin/multilanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL v2
*/

/*******************************************************************************
/***********************************************************************************************************************
* Script functions
*/

Expand Down Expand Up @@ -63,8 +63,8 @@ function admin_generateLanguagesList($tpl)
}
}

/*******************************************************************************
* Main script
/***********************************************************************************************************************
* Main
*/

// Include needed libraries
Expand Down Expand Up @@ -105,7 +105,8 @@ function admin_generateLanguagesList($tpl)
'page' => 'admin/multilanguage.tpl',
'page_message' => 'layout',
'languages_block' => 'page',
'language_block' => 'languages_block'));
'language_block' => 'languages_block')
);

$tpl->assign(
array(
Expand All @@ -123,9 +124,10 @@ function admin_generateLanguagesList($tpl)
'DATATABLE_TRANSLATIONS' => getDataTablesPluginTranslations(),
'TR_REBUILD_INDEX' => tr('Rebuild languages index'),
'TR_UPLOAD_HELP' => tr('Only gettext Machine Object files (MO files) are accepted.'),
'TR_HELP' => tr('Help'),
'TR_INSTALL' => tr('Install'),
'TR_CANCEL' => tr('Cancel')));
'TR_CANCEL' => tr('Cancel')
)
);

generateNavigation($tpl);
admin_generateLanguagesList($tpl);
Expand Down
1 change: 0 additions & 1 deletion gui/public/admin/reseller_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ function _admin_generateFeaturesForm($tpl, &$data)
'SUPPORT_SYSTEM_NO' => ($data['support_system'] != 'yes') ? $htmlChecked : '',

'TR_PHP_INI_PERMISSION_HELP' => tr('Yes means that the reseller can allow his customers to edit this directive'),
'TR_HELP' => tr('Help'),
'TR_YES' => tr('Yes'),
'TR_NO' => tr('No'),
'TR_MIB' => tr('MiB'),
Expand Down
1 change: 0 additions & 1 deletion gui/public/admin/reseller_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ function _admin_generateFeaturesForm($tpl, &$data)
'SUPPORT_SYSTEM_NO' => ($data['support_system'] != 'yes') ? $htmlChecked : '',

'TR_PHP_INI_PERMISSION_HELP' => tr('Yes means that the reseller can allow his customers to edit this directive'),
'TR_HELP' => tr('Help'),
'TR_YES' => tr('Yes'),
'TR_NO' => tr('No'),
'TR_MIB' => tr('MiB'),
Expand Down
5 changes: 3 additions & 2 deletions gui/public/client/mail_catchall_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,9 @@ function create_catchall_mail_account($id) {
'TR_CREATE_CATCHALL' => tr('Create catch all'),
'TR_FORWARD_MAIL' => tr('Forward mail'),
'TR_FORWARD_TO' => tr('Forward to'),
'TR_FWD_HELP' => tr('Separate multiple email addresses with a line-break.'),
'TR_HELP' => tr('Help')));
'TR_FWD_HELP' => tr('Separate multiple email addresses with a line-break.')
)
);

generatePageMessage($tpl);

Expand Down
41 changes: 25 additions & 16 deletions gui/public/client/mail_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
* Portions created by the i-MSCP Team are Copyright (C) 2010-2013 by
* i-MSCP - internet Multi Server Control Panel. All Rights Reserved.
*
* @category i-MSCP
* @package iMSCP_Core
* @subpackage Client
* @category i-MSCP
* @package iMSCP_Core
* @subpackage Client
* @copyright 2001-2006 by moleSoftware GmbH
* @copyright 2006-2010 by ispCP | http://isp-control.net
* @copyright 2010-2013 by i-MSCP | http://i-mscp.net
Expand All @@ -35,7 +35,7 @@
* @link http://i-mscp.net
*/

/************************************************************************************
/***********************************************************************************************************************
* script functions
*/

Expand Down Expand Up @@ -215,12 +215,16 @@ function client_UpdateMailAccount($mailAccountData)
WHERE
`mail_id` = ?
";
exec_query($query, array(
$mailAccountData['mail_pass'],
$mailAccountData['mail_forward'],
$mailAccountData['mail_type'],
$cfg->ITEM_TOCHANGE_STATUS,
$mailAccountData['mail_id']));
exec_query(
$query,
array(
$mailAccountData['mail_pass'],
$mailAccountData['mail_forward'],
$mailAccountData['mail_type'],
$cfg->ITEM_TOCHANGE_STATUS,
$mailAccountData['mail_id']
)
);

iMSCP_Events_Manager::getInstance()->dispatch(
iMSCP_Events::onAfterEditMail, array('mailId' => $mailAccountData['mail_id'])
Expand Down Expand Up @@ -265,11 +269,13 @@ function client_generateEditForm($tpl, $mailAccountData)
'TR_MAIL_ACCOUNT' => tr('Email account'),
'FORWARD_ACCOUNT_CHECKED' => ($mailAccountData['mail_forward'] != '_no_') ? $htmlChecked : '',
'FORWARD_LIST_VAL' => ($mailAccountData['mail_forward'] != '_no_' && $mailAccountData['mail_forward'] != '')
? tohtml(implode("\n", _client_normalizeForwardAddresses($mailAccountData['mail_forward'], 'decode_idna'))) : ''));
? tohtml(implode("\n", _client_normalizeForwardAddresses($mailAccountData['mail_forward'], 'decode_idna'))) : ''
)
);
}

/************************************************************************************
* Main script
/***********************************************************************************************************************
* Main
*/

// Include core library
Expand Down Expand Up @@ -301,7 +307,9 @@ function client_generateEditForm($tpl, $mailAccountData)
'page' => 'client/mail_edit.tpl',
'page_message' => 'layout',
'logged_frm' => 'page',
'password_frm' => 'page'));
'password_frm' => 'page'
)
);

$tpl->assign(
array(
Expand All @@ -313,10 +321,11 @@ function client_generateEditForm($tpl, $mailAccountData)
'TR_FORWARD_TO' => tr('Forward to'),
'TR_YES' => tr('yes'),
'TR_NO' => tr('no'),
'TR_HELP' => tr('help'),
'TR_FWD_HELP' => tr('Separate multiple email addresses with a space, a comma or a line-break.'),
'TR_UPDATE' => tr('Update'),
'TR_CANCEL' => tr('Cancel')));
'TR_CANCEL' => tr('Cancel')
)
);

generateNavigation($tpl);
client_generateEditForm($tpl, $mailAccountData);
Expand Down
1 change: 0 additions & 1 deletion gui/public/reseller/domain_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,6 @@ function _reseller_isValidServiceLimit($newCustomerLimit, $customerConsumption,
'TR_PAGE_TITLE' => tr('Reseller / Customers / Overview / Edit Domain'),
'ISP_LOGO' => layout_getUserLogo(),
'EDIT_ID' => tohtml($domainId),
'TR_HELP' => tr('Help'),
'TR_DOMAIN_OVERVIEW' => tr('Domain overview'),
'TR_DOMAIN_NAME' => tr('Domain name'),
'DOMAIN_NAME' => tohtml(decode_idna($data['domain_name'])),
Expand Down
33 changes: 22 additions & 11 deletions gui/public/reseller/hosting_plan_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,9 @@ function reseller_generatePage($tpl, $phpini)
'TR_DNS_YES' => '',
'TR_DNS_NO' => $checked,

'TR_SOFTWARE_YES' => '',
'TR_SOFTWARE_NO' => $checked,
'TR_EXTMAIL_YES' => '',
'TR_EXTMAIL_NO' => $checked,

'TR_PROTECT_WEB_FOLDERS_YES' => $checked,
'TR_PROTECT_WEB_FOLDERS_NO' => '',

Expand All @@ -189,6 +188,15 @@ function reseller_generatePage($tpl, $phpini)
)
);

if(resellerHasFeature('aps')) {
$tpl->assign(
array(
'TR_SOFTWARE_YES' => '',
'TR_SOFTWARE_NO' => $checked,
)
);
}

if (resellerHasFeature('backup')) {
$tpl->assign(
array(
Expand All @@ -198,8 +206,6 @@ function reseller_generatePage($tpl, $phpini)
'VL_BACKUPN' => $checked,
)
);
} else {
$tpl->assign('BACKUP_FEATURE', '');
}

if(!$cfg->WEB_FOLDER_PROTECTION) {
Expand Down Expand Up @@ -245,8 +251,6 @@ function reseller_generateErrorPage($tpl, $phpini)
'TR_CGI_NO' => ($cgi == '_no_') ? $checked : '',
'TR_DNS_YES' => ($dns == '_yes_') ? $checked : '',
'TR_DNS_NO' => ($dns == '_no_') ? $checked : '',
'TR_SOFTWARE_YES' => ($aps == '_yes_') ? $checked : '',
'TR_SOFTWARE_NO' => ($aps == '_no_') ? $checked : '',
'TR_EXTMAIL_YES' => ($extMail == '_yes_') ? $checked : '',
'TR_EXTMAIL_NO' => ($extMail == '_no_') ? $checked : '',
'TR_PROTECT_WEB_FOLDERS_YES' => ($webFolderProtection == '_yes_') ? $checked : '',
Expand All @@ -259,6 +263,15 @@ function reseller_generateErrorPage($tpl, $phpini)
)
);

if(resellerHasFeature('aps')) {
$tpl->assign(
array(
'TR_SOFTWARE_YES' => ($aps == '_yes_') ? $checked : '',
'TR_SOFTWARE_NO' => ($aps == '_no_') ? $checked : '',
)
);
}

if (resellerHasFeature('backup')) {
$tpl->assign(
array(
Expand All @@ -268,8 +281,6 @@ function reseller_generateErrorPage($tpl, $phpini)
'VL_BACKUPN' => ($backup == '_no_') ? $checked : '',
)
);
} else {
$tpl->assign('BACKUP_FEATURE', '');
}

if(!$cfg->WEB_FOLDER_PROTECTION) {
Expand Down Expand Up @@ -324,8 +335,8 @@ function reseller_checkData($phpini)
$php = ($php == '_yes_') ? '_yes_' : '_no_';
$cgi = ($cgi == '_yes_') ? '_yes_' : '_no_';
$dns = ($dns == '_yes_') ? '_yes_' : '_no_';
$backup = (in_array($backup, array('_full_', '_dmn_', '_sql_'))) ? $backup : '_no_';
$aps = ($aps == '_yes_') ? '_yes_' : '_no_';
$backup = (resellerHasFeature('backup') && in_array($backup, array('_full_', '_dmn_', '_sql_'))) ? $backup : '_no_';
$aps = (resellerHasFeature('aps') && $aps == '_yes_') ? '_yes_' : '_no_';
$extMail = ($extMail == '_yes_') ? '_yes_' : '_no_';
$webFolderProtection = ($webFolderProtection == '_yes_') ? '_yes_' : '_no_';

Expand Down Expand Up @@ -601,7 +612,7 @@ function reseller_addHostingPlan($resellerId, $phpini)
if (!resellerHasFeature('php_editor')) $tpl->assign('PHP_EDITOR_FEATURE', '');
if (!resellerHasFeature('cgi')) $tpl->assign('CGI_FEATURE', '');
if (!resellerHasFeature('custom_dns_records')) $tpl->assign('CUSTOM_DNS_FEATURE', '');
if (!resellerHasFeature('aps')) $tpl->assign('EXT_MAIL_FEATURE', '');
if (!resellerHasFeature('aps')) $tpl->assign('APS_FEATURE', '');
if (!resellerHasFeature('external_mail')) $tpl->assign('EXT_MAIL_FEATURE', '');
if (!resellerHasFeature('backup')) $tpl->assign('BACKUP_FEATURE', '');

Expand Down

0 comments on commit 43fd3bd

Please sign in to comment.