/** * Check input data * * @return void */ function reseller_checkData() { $cfg = iMSCP_Registry::get('config'); if (!isset($_POST['dmn_name']) || $_POST['dmn_name'] === '') { set_page_message(tr('Domain name cannot be empty.'), 'error'); return; } $dmnName = clean_input($_POST['dmn_name']); global $dmnNameValidationErrMsg; if (!isValidDomainName($dmnName)) { set_page_message($dmnNameValidationErrMsg, 'error'); return; } // www is considered as an alias of the domain while (strpos($dmnName, 'www.') !== false) { $dmnName = substr($dmnName, 4); } $asciiDmnName = encode_idna($dmnName); if (imscp_domain_exists($asciiDmnName, $_SESSION['user_id']) || $asciiDmnName == $cfg['BASE_SERVER_VHOST']) { set_page_message(tr('Domain %s is unavailable.', "<strong>{$dmnName}</strong>"), 'error'); return; } if ((!isset($_POST['datepicker']) || $_POST['datepicker'] === '') && !isset($_POST['never_expire'])) { set_page_message(tr('Domain expiration date must be filled.'), 'error'); return; } $dmnExpire = isset($_POST['datepicker']) ? @strtotime(clean_input($_POST['datepicker'])) : 0; if ($dmnExpire === false) { set_page_message('Invalid expiration date.', 'error'); return; } $hpId = isset($_POST['dmn_tpl']) ? clean_input($_POST['dmn_tpl']) : 0; $customizeHp = $hpId > 0 && isset($_POST['chtpl']) ? $_POST['chtpl'] : '_no_'; if ($hpId == 0 || $customizeHp == '_yes_') { $_SESSION['dmn_name'] = $asciiDmnName; $_SESSION['dmn_expire'] = $dmnExpire; $_SESSION['dmn_tpl'] = $hpId; $_SESSION['chtpl'] = '_yes_'; $_SESSION['step_one'] = '_yes_'; redirectTo('user_add2.php'); } if (reseller_limits_check($_SESSION['user_id'], $hpId)) { $_SESSION['dmn_name'] = $asciiDmnName; $_SESSION['dmn_expire'] = $dmnExpire; $_SESSION['dmn_tpl'] = $hpId; $_SESSION['chtpl'] = $customizeHp; $_SESSION['step_one'] = '_yes_'; redirectTo('user_add3.php'); } set_page_message(tr('Hosting plan limits exceed reseller limits.'), 'error'); }
/** * Add new host plan to DB */ function save_data_to_db() { global $tpl; global $hp_name, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl; global $hp_sub, $hp_als, $hp_mail; global $hp_ftp, $hp_sql_db, $hp_sql_user; global $hp_traff, $hp_disk, $hp_countbackup; global $hpid; global $hp_backup, $hp_dns; // global $tos; $sql = EasySCP_Registry::get('Db'); $err_msg = ''; $description = clean_input($_POST['hp_description']); $price = clean_input($_POST['hp_price']); $setup_fee = clean_input($_POST['hp_setupfee']); $value = clean_input($_POST['hp_value']); $payment = clean_input($_POST['hp_payment']); $status = clean_input($_POST['status']); $tos = clean_input($_POST['hp_tos']); //$hp_props = "$hp_php;$hp_cgi;$hp_sub;$hp_als;$hp_mail;$hp_ftp;$hp_sql_db;" . // "$hp_sql_user;$hp_traff;$hp_disk;$hp_backup;$hp_dns;$hp_ssl"; $newProps = array('allow_php' => $hp_php, 'allow_phpe' => $hp_phpe, 'allow_cgi' => $hp_cgi, 'subdomain_cnt' => $hp_sub, 'alias_cnt' => $hp_als, 'mail_cnt' => $hp_mail, 'ftp_cnt' => $hp_ftp, 'db_cnt' => $hp_sql_db, 'sqluser_cnt' => $hp_sql_user, 'traffic' => $hp_traff, 'disk' => $hp_disk, 'disk_countbackup' => $hp_countbackup, 'allow_backup' => $hp_backup, 'allow_dns' => $hp_dns, 'allow_ssl' => $hp_ssl); $hp_props = serialize($newProps); $admin_id = $_SESSION['user_id']; if (reseller_limits_check($sql, $err_msg, $admin_id, $hpid, $hp_props)) { if (!empty($err_msg)) { set_page_message($err_msg, 'error'); restore_form($tpl, $sql); return false; } else { $query = "\n\t\t\t\tUPDATE\n\t\t\t\t\t`hosting_plans`\n\t\t\t\tSET\n\t\t\t\t\t`name` = ?,\n\t\t\t\t\t`description` = ?,\n\t\t\t\t\t`props` = ?,\n\t\t\t\t\t`price` = ?,\n\t\t\t\t\t`setup_fee` = ?,\n\t\t\t\t\t`value` = ?,\n\t\t\t\t\t`payment` = ?,\n\t\t\t\t\t`status` = ?,\n\t\t\t\t\t`tos` = ?\n\t\t\t\tWHERE\n\t\t\t\t\t`id` = ?\n\t\t\t\t;\n\t\t\t"; exec_query($sql, $query, array($hp_name, $description, $hp_props, $price, $setup_fee, $value, $payment, $status, $tos, $hpid)); $_SESSION['hp_updated'] = '_yes_'; user_goto('hosting_plan.php'); } } else { set_page_message(tr("Hosting plan values exceed reseller maximum values!"), 'warning'); restore_form($tpl, $sql); return false; } }
/** * Update hosting plan * * @return bool TRUE on success, FALSE otherwise */ function updateHostingPlan() { global $id, $name, $description, $sub, $als, $mail, $mailQuota, $ftp, $sqld, $sqlu, $traffic, $diskSpace, $php, $cgi, $dns, $backup, $aps, $extMail, $webFolderProtection, $status; $phpini = iMSCP_PHPini::getInstance(); $props = "{$php};{$cgi};{$sub};{$als};{$mail};{$ftp};{$sqld};{$sqlu};{$traffic};{$diskSpace};" . implode('|', $backup) . ";{$dns};{$aps}"; $props .= ';' . $phpini->getClientPermission('phpiniSystem'); $props .= ';' . $phpini->getClientPermission('phpiniAllowUrlFopen'); $props .= ';' . $phpini->getClientPermission('phpiniDisplayErrors'); $props .= ';' . $phpini->getClientPermission('phpiniDisableFunctions'); $props .= ';' . $phpini->getClientPermission('phpiniMailFunction'); $props .= ';' . $phpini->getDomainIni('phpiniPostMaxSize'); $props .= ';' . $phpini->getDomainIni('phpiniUploadMaxFileSize'); $props .= ';' . $phpini->getDomainIni('phpiniMaxExecutionTime'); $props .= ';' . $phpini->getDomainIni('phpiniMaxInputTime'); $props .= ';' . $phpini->getDomainIni('phpiniMemoryLimit'); $props .= ';' . $extMail . ';' . $webFolderProtection . ';' . $mailQuota * 1048576; if (reseller_limits_check($_SESSION['user_id'], $props)) { exec_query('UPDATE hosting_plans SET name = ?, description = ?, props = ?, status = ? WHERE id = ?', array($name, $description, $props, $status, $id)); return true; } set_page_message(tr('Hosting plan limits exceed your limits.'), 'error'); return false; }
function add_user_data($reseller_id) { global $sql, $cfg; global $dmn_name, $hpid, $dmn_user_name; global $user_email, $customer_id, $first_name; global $last_name, $firm, $zip; global $city, $country, $street_one; global $street_two, $mail, $phone; global $fax, $inpass, $domain_ip; global $admin_login; // Let's get Desired Hosting Plan Data; // $err_msg = '_off_'; reseller_limits_check($sql, $err_msg, $reseller_id, $hpid); if ($err_msg != '_off_') { set_page_message($err_msg); return; } if (isset($_SESSION["ch_hpprops"])) { $props = $_SESSION["ch_hpprops"]; unset($_SESSION["ch_hpprops"]); } else { $query = "select props from hosting_plans where reseller_id = ? and id = ?"; $res = exec_query($sql, $query, array($reseller_id, $hpid)); $data = $res->FetchRow(); $props = $data['props']; } list($php, $cgi, $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk) = explode(";", $props); $php = preg_replace("/\\_/", "", $php); $cgi = preg_replace("/\\_/", "", $cgi); $pure_user_pass = $inpass; $inpass = crypt_user_pass($inpass); // $first_name = escape_user_data($first_name); // $last_name = escape_user_data($last_name); // $firm = escape_user_data($firm); // $zip = escape_user_data($zip); // $city = escape_user_data($city); // $country = escape_user_data($country); // $phone = escape_user_data($phone); // $fax = escape_user_data($fax); // $street_one = escape_user_data($street_one); // $street_two = escape_user_data($street_two); // $customer_id = escape_user_data($customer_id); if (!vhcs_domain_check($dmn_user_name)) { //set_page_message = tr("Wrong domain name syntax!"); return; } check_for_lock_file(); $query = <<<VHCS_SQL_QUERY insert into admin ( admin_name, admin_pass, admin_type, domain_created, created_by, fname, lname, firm, zip, city, country, email, phone, fax, street1, street2, customer_id ) values ( ?, ?, 'user', unix_timestamp(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) VHCS_SQL_QUERY; $res = exec_query($sql, $query, array($dmn_user_name, $inpass, $reseller_id, $first_name, $last_name, $firm, $zip, $city, $country, $user_email, $phone, $fax, $street_one, $street_two, $customer_id)); print $sql->ErrorMsg(); $record_id = $sql->Insert_ID(); $query = <<<VHCS_SQL_QUERY insert into domain ( domain_name, domain_admin_id, domain_created_id, domain_created, domain_mailacc_limit, domain_ftpacc_limit, domain_traffic_limit, domain_sqld_limit, domain_sqlu_limit, domain_status, domain_subd_limit, domain_alias_limit, domain_ip_id, domain_disk_limit, domain_disk_usage, domain_php, domain_cgi ) values ( ?, ?, ?, unix_timestamp(), ?, ?, ?, ?, ?, 'toadd', ?, ?, ?, ?, '0', ?, ? ) VHCS_SQL_QUERY; $res = exec_query($sql, $query, array($dmn_name, $record_id, $reseller_id, $mail, $ftp, $traff, $sql_db, $sql_user, $sub, $als, $domain_ip, $disk, $php, $cgi)); $dmn_id = $sql->Insert_ID(); // vhcs 2.5 feature //add_domain_extras($dmn_id, $record_id, $sql); // lets send mail to user send_add_user_auto_msg($reseller_id, $dmn_user_name, $pure_user_pass, $user_email, $first_name, $last_name, tr('Domain account')); // send query to the vhcs2 daemon // add user into user_gui_props => domain looser needs language and skin too :-) $user_def_lang = $_SESSION['user_def_lang']; $user_theme_color = $_SESSION['user_theme_color']; $query = <<<SQL_QUERY insert into user_gui_props (user_id, lang, layout) values (?, ?, ?) SQL_QUERY; $res = exec_query($sql, $query, array($record_id, $user_def_lang, $user_theme_color)); send_request(); $admin_login = $_SESSION['user_logged']; write_log("{$admin_login}: add user -> {$dmn_user_name} (for domain {$dmn_name})"); write_log("{$admin_login}: add domain -> {$dmn_name}"); au_update_reseller_props($reseller_id, $props); if (isset($_POST['add_alias']) && $_POST['add_alias'] === 'on') { //we have to add some aliases for this looser $_SESSION['dmn_id'] = $dmn_id; $_SESSION['dmn_ip'] = $domain_ip; header("Location: rau4.php?accout={$dmn_id}"); die; } else { //we have not to add alias $_SESSION['rau3_added'] = "_yes_"; header("Location: users.php"); die; } }
// static page messages. gen_logged_from($tpl); $tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - User/Add user(step2)'), 'TR_ADD_USER' => tr('Add user'), 'TR_HOSTING_PLAN_PROPERTIES' => tr('Hosting plan properties'), 'TR_TEMPLATE_NAME' => tr('Template name'), 'TR_MAX_DOMAIN' => tr('Max domains<br /><em>(-1 disabled, 0 unlimited)</em>'), 'TR_MAX_SUBDOMAIN' => tr('Max subdomains<br /><em>(-1 disabled, 0 unlimited)</em>'), 'TR_MAX_DOMAIN_ALIAS' => tr('Max aliases<br /><em>(-1 disabled, 0 unlimited)</em>'), 'TR_MAX_MAIL_COUNT' => tr('Mail accounts limit<br /><em>(-1 disabled, 0 unlimited)</em>'), 'TR_MAX_FTP' => tr('FTP accounts limit<br /><em>(-1 disabled, 0 unlimited)</em>'), 'TR_MAX_SQL_DB' => tr('SQL databases limit<br /><em>(-1 disabled, 0 unlimited)</em>'), 'TR_MAX_SQL_USERS' => tr('SQL users limit<br /><em>(-1 disabled, 0 unlimited)</em>'), 'TR_MAX_TRAFFIC' => tr('Traffic limit [MB]<br /><em>(0 unlimited)</em>'), 'TR_MAX_DISK_USAGE' => tr('Disk limit [MB]<br /><em>(0 unlimited)</em>'), 'TR_PHP' => tr('PHP'), 'TR_PHP_EDIT' => tr('PHP editor'), 'TR_CGI' => tr('CGI / Perl'), 'TR_SSL' => tr('SSL support'), 'TR_BACKUP' => tr('Backup'), 'TR_BACKUP_DOMAIN' => tr('Domain'), 'TR_BACKUP_SQL' => tr('SQL'), 'TR_BACKUP_FULL' => tr('Full'), 'TR_BACKUP_NO' => tr('No'), 'TR_BACKUP_COUNT' => tr('Count backups to disk usage'), 'TR_DNS' => tr('Manual DNS support'), 'TR_YES' => tr('Yes'), 'TR_NO' => tr('No'), 'TR_NEXT_STEP' => tr('Next step'))); gen_reseller_mainmenu($tpl, 'reseller/main_menu_users_manage.tpl'); gen_reseller_menu($tpl, 'reseller/menu_users_manage.tpl'); if (!get_pageone_param()) { set_page_message(tr("Domain data has been altered. Please enter again."), 'warning'); unset_messages(); user_goto('user_add1.php'); } if (isset($_POST['uaction']) && "user_add2_nxt" === $_POST['uaction'] && !isset($_SESSION['step_one'])) { if (check_user_data()) { $_SESSION["step_two_data"] = "{$dmn_name};0;"; $newProps = array('allow_php' => $hp_php, 'allow_phpe' => $hp_phpe, 'allow_cgi' => $hp_cgi, 'subdomain_cnt' => $hp_sub, 'alias_cnt' => $hp_als, 'mail_cnt' => $hp_mail, 'ftp_cnt' => $hp_ftp, 'db_cnt' => $hp_sql_db, 'sqluser_cnt' => $hp_sql_user, 'traffic' => $hp_traff, 'disk' => $hp_disk, 'disk_countbackup' => $hp_countbackup, 'allow_backup' => $hp_backup, 'allow_dns' => $hp_dns, 'allow_ssl' => $hp_ssl); $_SESSION["ch_hpprops"] = $newProps; if (reseller_limits_check($sql, $ehp_error, $_SESSION['user_id'], 0, $_SESSION["ch_hpprops"])) { user_goto('user_add3.php'); } } } else { unset($_SESSION['step_one']); global $dmn_chp; get_hp_data($dmn_chp, $_SESSION['user_id']); } get_init_au2_page($tpl); gen_page_message($tpl); list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions'); if ($rsub_max == "-1") { $tpl->assign('ALIAS_ADD', ''); } if ($rals_max == "-1") {
/** * Check correction of entered users data */ function check_user_data() { global $dmn_name; // domain name global $dmn_expire; // Domain expire date global $dmn_chp; // choosed hosting plan global $dmn_pt; global $validation_err_msg; $sql = EasySCP_Registry::get('Db'); $cfg = EasySCP_Registry::get('Config'); // personal template $event_txt = ''; if (isset($_POST['dmn_name'])) { $dmn_name = strtolower(trim($_POST['dmn_name'])); } if (isset($_POST['dmn_expire_date'])) { $dmn_expire = clean_input($_POST['dmn_expire_date']); } if (isset($_POST['dmn_tpl'])) { $dmn_chp = $_POST['dmn_tpl']; } if (isset($_POST['chtpl'])) { $dmn_pt = $_POST['chtpl']; } // Check if input string is a valid domain names if (!validates_dname($dmn_name)) { set_page_message($validation_err_msg, 'warning'); return false; } // Should be perfomed after domain names syntax validation now $dmn_name = encode_idna($dmn_name); if (easyscp_domain_exists($dmn_name, $_SESSION['user_id'])) { $event_txt = tr('Domain with that name already exists on the system!'); } else { if ($dmn_name == $cfg->BASE_SERVER_VHOST) { $event_txt = tr('Master domain cannot be used!'); } } // we have plans only for admins if (isset($cfg->HOSTING_PLANS_LEVEL) && $cfg->HOSTING_PLANS_LEVEL === 'admin') { $dmn_pt = '_no_'; } if (!empty($event_txt)) { // There are wrong input data set_page_message($event_txt, 'error'); return false; } else { if ($dmn_pt == '_yes_' || !isset($_POST['dmn_tpl'])) { // send through the session the data $_SESSION['dmn_name'] = $dmn_name; $_SESSION['dmn_expire_date'] = $dmn_expire; $_SESSION['dmn_tpl'] = $dmn_chp; $_SESSION['chtpl'] = $dmn_pt; $_SESSION['step_one'] = "_yes_"; user_goto('user_add2.php'); } else { // check if reseller limits are not touched $ehp_error = ''; // fill dummy to satisfy warning... if (reseller_limits_check($sql, $ehp_error, $_SESSION['user_id'], $dmn_chp)) { // send through the session the data $_SESSION['dmn_name'] = $dmn_name; $_SESSION['dmn_expire_date'] = $dmn_expire; $_SESSION['dmn_tpl'] = $dmn_chp; $_SESSION['chtpl'] = $dmn_pt; $_SESSION['step_one'] = "_yes_"; user_goto('user_add3.php'); } else { set_page_message(tr("Hosting plan values exceed reseller maximum values!"), 'warning'); return false; } } } }
$hpid = $rs->fields['plan_id']; $customer_id = $rs->fields['customer_id']; $dmn_id = get_user_domain_id($sql, $customer_id); //lets check the reseller limits $err_msg = '_off_'; if (isset($cfg['HOSTING_PLANS_LEVEL']) && $cfg['HOSTING_PLANS_LEVEL'] === 'admin') { $query = "select props from hosting_plans where id = ?"; $res = exec_query($sql, $query, array($hpid)); } else { $query = "select props from hosting_plans where reseller_id = ? and id = ?"; $res = exec_query($sql, $query, array($reseller_id, $hpid)); } $data = $res->FetchRow(); $props = $data['props']; $_SESSION["ch_hpprops"] = $props; reseller_limits_check($sql, $err_msg, $reseller_id, $hpid); if ($err_msg != '_off_') { set_page_message($err_msg); unset($_SESSION['domain_ip']); header('Location: orders.php'); die; } unset($_SESSION["ch_hpprops"]); list($domain_php, $domain_cgi, $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk) = explode(";", $props); $domain_php = preg_replace("/\\_/", "", $domain_php); $domain_cgi = preg_replace("/\\_/", "", $domain_cgi); $ed_error = '_off_'; if (!vhcs_limit_check($sub, 999)) { $ed_error = tr('Incorrect subdomain range or syntax!'); } else { if (!vhcs_limit_check($als, 999)) {
/** * Add hosting plan * * @return bool TRUE on success, FALSE otherwise */ function addHostingPlan() { global $name, $description, $sub, $als, $mail, $mailQuota, $ftp, $sqld, $sqlu, $traffic, $diskSpace, $php, $cgi, $dns, $backup, $aps, $extMail, $webFolderProtection, $status; $stmt = exec_query('SELECT id FROM hosting_plans WHERE name = ? AND reseller_id = ? LIMIT 1', array($name, $_SESSION['user_id'])); if ($stmt->rowCount()) { set_page_message(tr('An hosting plan with same name already exists.'), 'error'); return false; } $phpini = iMSCP_PHPini::getInstance(); $props = "{$php};{$cgi};{$sub};{$als};{$mail};{$ftp};{$sqld};{$sqlu};{$traffic};{$diskSpace};" . implode('|', $backup) . ";{$dns};{$aps}"; $props .= ';' . $phpini->getClientPermission('phpiniSystem'); $props .= ';' . $phpini->getClientPermission('phpiniAllowUrlFopen'); $props .= ';' . $phpini->getClientPermission('phpiniDisplayErrors'); $props .= ';' . $phpini->getClientPermission('phpiniDisableFunctions'); $props .= ';' . $phpini->getClientPermission('phpiniMailFunction'); $props .= ';' . $phpini->getDomainIni('phpiniPostMaxSize'); $props .= ';' . $phpini->getDomainIni('phpiniUploadMaxFileSize'); $props .= ';' . $phpini->getDomainIni('phpiniMaxExecutionTime'); $props .= ';' . $phpini->getDomainIni('phpiniMaxInputTime'); $props .= ';' . $phpini->getDomainIni('phpiniMemoryLimit'); $props .= ';' . $extMail . ';' . $webFolderProtection . ';' . $mailQuota * 1048576; if (!reseller_limits_check($_SESSION['user_id'], $props)) { set_page_message(tr('Hosting plan limits exceed your limits.'), 'error'); return false; } exec_query('INSERT INTO hosting_plans(reseller_id, name, description, props, status) VALUES (?, ?, ?, ?, ?)', array($_SESSION['user_id'], $name, $description, $props, $status)); return true; }
/** * Add new host plan to DB * @param EasySCP_TemplateEngine $tpl * @param int $admin_id */ function save_data_to_db($tpl, $admin_id) { global $hp_name, $description, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl; global $hp_sub, $hp_als, $hp_mail; global $hp_ftp, $hp_sql_db, $hp_sql_user; global $hp_traff, $hp_disk, $hp_countbackup; global $price, $setup_fee, $value, $payment, $status; global $hp_backup, $hp_dns; global $tos; $sql = EasySCP_Registry::get('Db'); $err_msg = ''; $query = "SELECT `id` FROM `hosting_plans` WHERE `name` = ? AND `reseller_id` = ?"; $res = exec_query($sql, $query, array($hp_name, $admin_id)); if ($res->rowCount() == 1) { set_page_message(tr('Hosting plan with entered name already exists!'), 'error'); } else { //$hp_props = "$hp_php;$hp_cgi;$hp_sub;$hp_als;$hp_mail;$hp_ftp;$hp_sql_db;$hp_sql_user;$hp_traff;$hp_disk;$hp_backup;$hp_dns;$hp_ssl"; $newProps = array('allow_php' => $hp_php, 'allow_phpe' => $hp_phpe, 'allow_cgi' => $hp_cgi, 'subdomain_cnt' => $hp_sub, 'alias_cnt' => $hp_als, 'mail_cnt' => $hp_mail, 'ftp_cnt' => $hp_ftp, 'db_cnt' => $hp_sql_db, 'sqluser_cnt' => $hp_sql_user, 'traffic' => $hp_traff, 'disk' => $hp_disk, 'disk_countbackup' => $hp_countbackup, 'allow_backup' => $hp_backup, 'allow_dns' => $hp_dns, 'allow_ssl' => $hp_ssl); $hp_props = serialize($newProps); // this id is just for fake and is not used in reseller_limits_check. $hpid = 0; if (reseller_limits_check($sql, $err_msg, $admin_id, $hpid, $hp_props)) { if (!empty($err_msg)) { set_page_message($err_msg, 'error'); return false; } else { $query = "\n\t\t\t\t\tINSERT INTO\n\t\t\t\t\t\t`hosting_plans`(\n\t\t\t\t\t\t\t`reseller_id`,\n\t\t\t\t\t\t\t`name`,\n\t\t\t\t\t\t\t`description`,\n\t\t\t\t\t\t\t`props`,\n\t\t\t\t\t\t\t`price`,\n\t\t\t\t\t\t\t`setup_fee`,\n\t\t\t\t\t\t\t`value`,\n\t\t\t\t\t\t\t`payment`,\n\t\t\t\t\t\t\t`status`,\n\t\t\t\t\t\t\t`tos`\n\t\t\t\t\t\t)\n\t\t\t\t\tVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n\t\t\t\t"; exec_query($sql, $query, array($admin_id, $hp_name, $description, $hp_props, $price, $setup_fee, $value, $payment, $status, $tos)); $_SESSION['hp_added'] = '_yes_'; user_goto('hosting_plan.php'); } } else { set_page_message(tr("Hosting plan values exceed reseller maximum values!"), 'warning'); return false; } } }
set_page_message(tr('Domain data were altered. Please try again.'), 'error'); unsetMessages(); redirectTo('user_add1.php'); } $phpini = iMSCP_PHPini::getInstance(); $phpini->loadResellerPermissions($_SESSION['user_id']); // Load reseller PHP permissions $phpini->loadClientPermissions(); // Load client default PHP permissions $phpini->loadDomainIni(); // Load domain default PHP configuration options if (isset($_POST['uaction']) && 'user_add2_nxt' == $_POST['uaction'] && !isset($_SESSION['step_one'])) { if (checkInputData()) { $_SESSION['step_two_data'] = "{$dmnName};0"; $_SESSION['ch_hpprops'] = "{$php};{$cgi};{$sub};{$als};{$mail};{$ftp};{$sqld};{$sqlu};{$traffic};{$diskspace};" . implode('|', $backup) . ";{$dns};{$aps};" . $phpini->getClientPermission('phpiniSystem') . ';' . $phpini->getClientPermission('phpiniAllowUrlFopen') . ';' . $phpini->getClientPermission('phpiniDisplayErrors') . ';' . $phpini->getClientPermission('phpiniDisableFunctions') . ';' . $phpini->getClientPermission('phpiniMailFunction') . ';' . $phpini->getDomainIni('phpiniPostMaxSize') . ';' . $phpini->getDomainIni('phpiniUploadMaxFileSize') . ';' . $phpini->getDomainIni('phpiniMaxExecutionTime') . ';' . $phpini->getDomainIni('phpiniMaxInputTime') . ';' . $phpini->getDomainIni('phpiniMemoryLimit') . ';' . $extMail . ';' . $webFolderProtection . ';' . $mailQuota * 1048576; if (reseller_limits_check($_SESSION['user_id'], $_SESSION['ch_hpprops'])) { redirectTo('user_add3.php'); } } } else { unset($_SESSION['step_one']); getHostingPlanData(); } $tpl = new iMSCP_pTemplate(); $tpl->define_dynamic(array('layout' => 'shared/layouts/ui.tpl', 'page' => 'reseller/user_add2.tpl', 'page_message' => 'layout', 'subdomain_feature' => 'page', 'alias_feature' => 'page', 'mail_feature' => 'page', 'custom_dns_records_feature' => 'page', 'ext_mail_feature' => 'page', 'ftp_feature' => 'page', 'sql_feature' => 'page', 'aps_feature' => 'page', 'backup_feature' => 'page', 'php_editor_block' => 'page', 'php_editor_permissions_block' => 'php_editor_block', 'php_editor_allow_url_fopen_block' => 'php_editor_permissions_block', 'php_editor_display_errors_block' => 'php_editor_permissions_block', 'php_editor_disable_functions_block' => 'php_editor_permissions_block', "php_mail_function_block" => 'php_editor_permissions_block', 'php_editor_default_values_block' => 'php_editor_block')); $tpl->assign(array('TR_PAGE_TITLE' => tr('Reseller / Customers / Add Customer - Next Step'), 'TR_ADD_USER' => tr('Add user'), 'TR_HOSTING_PLAN' => tr('Hosting plan'), 'TR_NAME' => tr('Name'), 'TR_MAX_DOMAIN' => tr('Domain limit') . '<br/><i>(-1 ' . tr('disabled') . ', 0 ' . tr('unlimited') . ')</i>', 'TR_MAX_SUBDOMAIN' => tr('Subdomain limit') . '<br/><i>(-1 ' . tr('disabled') . ', 0 ' . tr('unlimited') . ')</i>', 'TR_MAX_DOMAIN_ALIAS' => tr('Domain alias limit') . '<br/><i>(-1 ' . tr('disabled') . ', 0 ' . tr('unlimited') . ')</i>', 'TR_MAX_MAIL_COUNT' => tr('Email account limit') . '<br/><i>(-1 ' . tr('disabled') . ', 0 ' . tr('unlimited') . ')</i>', 'TR_MAIL_QUOTA' => tr('Email quota [MiB]') . '<br/><i>(0 ' . tr('unlimited') . ')</i>', 'TR_MAX_FTP' => tr('FTP account limit') . '<br/><i>(-1 ' . tr('disabled') . ', 0 ' . tr('unlimited') . ')</i>', 'TR_MAX_SQL_DB' => tr('SQL database limit') . '<br/><i>(-1 ' . tr('disabled') . ', 0 ' . tr('unlimited') . ')</i>', 'TR_MAX_SQL_USERS' => tr('SQL user limit') . '<br/><i>(-1 ' . tr('disabled') . ', 0 ' . tr('unlimited') . ')</i>', 'TR_MAX_TRAFFIC' => tr('Monthly traffic limit [MiB]') . '<br/><i>(0 ' . tr('unlimited') . ')</i>', 'TR_MAX_DISK_USAGE' => tr('Disk space limit [MiB]') . '<br/><i>(0 ' . tr('unlimited') . ')</i>', 'TR_EXTMAIL' => tr('External mail server'), 'TR_PHP' => tr('PHP'), 'TR_CGI' => tr('CGI'), 'TR_BACKUP' => tr('Backup'), 'TR_BACKUP_DOMAIN' => tr('Domain'), 'TR_BACKUP_SQL' => tr('SQL'), 'TR_BACKUP_MAIL' => tr('Mail'), 'TR_DNS' => tr('Custom DNS records'), 'TR_YES' => tr('yes'), 'TR_NO' => tr('no'), 'TR_NEXT_STEP' => tr('Next step'), 'TR_FEATURES' => tr('Features'), 'TR_LIMITS' => tr('Limits'), 'TR_WEB_FOLDER_PROTECTION' => tr('Web folder protection'), 'TR_WEB_FOLDER_PROTECTION_HELP' => tr('If set to `yes`, Web folders will be protected against deletion.'), 'TR_SOFTWARE_SUPP' => tr('Software installer'))); generateNavigation($tpl); generatePage($tpl); generatePageMessage($tpl); $tpl->parse('LAYOUT_CONTENT', 'page'); iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onResellerScriptEnd, array('templateEngine' => $tpl));