| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
require '../include/ispcp-lib.php'; |
|---|
| 22 |
|
|---|
| 23 |
check_login(__FILE__); |
|---|
| 24 |
|
|---|
| 25 |
$tpl = new pTemplate(); |
|---|
| 26 |
|
|---|
| 27 |
$tpl->define_dynamic('page', Config::get('CLIENT_TEMPLATE_PATH') . '/mail_add.tpl'); |
|---|
| 28 |
$tpl->define_dynamic('page_message', 'page'); |
|---|
| 29 |
$tpl->define_dynamic('logged_from', 'page'); |
|---|
| 30 |
$tpl->define_dynamic('als_list', 'page'); |
|---|
| 31 |
$tpl->define_dynamic('sub_list', 'page'); |
|---|
| 32 |
$tpl->define_dynamic('als_sub_list', 'page'); |
|---|
| 33 |
$tpl->define_dynamic('to_alias_domain', 'page'); |
|---|
| 34 |
$tpl->define_dynamic('to_subdomain', 'page'); |
|---|
| 35 |
$tpl->define_dynamic('to_als_subdomain', 'page'); |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
function gen_page_form_data(&$tpl, $dmn_name, $post_check) { |
|---|
| 40 |
$dmn_name = decode_idna($dmn_name); |
|---|
| 41 |
|
|---|
| 42 |
if ($post_check === 'no') { |
|---|
| 43 |
|
|---|
| 44 |
$tpl->assign( |
|---|
| 45 |
array( |
|---|
| 46 |
'USERNAME' => "", |
|---|
| 47 |
'DOMAIN_NAME' => $dmn_name, |
|---|
| 48 |
'MAIL_DMN_CHECKED' => "checked=\"checked\"", |
|---|
| 49 |
'MAIL_ALS_CHECKED' => "", |
|---|
| 50 |
'MAIL_SUB_CHECKED' => "", |
|---|
| 51 |
'MAIL_ALS_SUB_CHECKED' => "", |
|---|
| 52 |
'NORMAL_MAIL_CHECKED' => "checked=\"checked\"", |
|---|
| 53 |
'FORWARD_MAIL_CHECKED' => "", |
|---|
| 54 |
'FORWARD_LIST' => "" |
|---|
| 55 |
) |
|---|
| 56 |
); |
|---|
| 57 |
|
|---|
| 58 |
} else { |
|---|
| 59 |
if (!isset($_POST['forward_list'])) { |
|---|
| 60 |
$f_list = ''; |
|---|
| 61 |
} else { |
|---|
| 62 |
$f_list = $_POST['forward_list']; |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
$tpl->assign( |
|---|
| 66 |
array( |
|---|
| 67 |
'USERNAME' => clean_input($_POST['username']), |
|---|
| 68 |
'DOMAIN_NAME' => $dmn_name, |
|---|
| 69 |
'MAIL_DMN_CHECKED' => ($_POST['dmn_type'] === 'dmn') ? "checked=\"checked\"" : "", |
|---|
| 70 |
'MAIL_ALS_CHECKED' => ($_POST['dmn_type'] === 'als') ? "checked=\"checked\"" : "", |
|---|
| 71 |
'MAIL_SUB_CHECKED' => ($_POST['dmn_type'] === 'sub') ? "checked=\"checked\"" : "", |
|---|
| 72 |
'MAIL_ALS_SUB_CHECKED' => ($_POST['dmn_type'] === 'als_sub') ? "checked=\"checked\"" : "", |
|---|
| 73 |
'NORMAL_MAIL_CHECKED' => (isset($_POST['mail_type_normal'])) ? "checked=\"checked\"" : "", |
|---|
| 74 |
'FORWARD_MAIL_CHECKED' => (isset($_POST['mail_type_forward'])) ? "checked=\"checked\"" : "", |
|---|
| 75 |
'FORWARD_LIST' => $f_list |
|---|
| 76 |
) |
|---|
| 77 |
); |
|---|
| 78 |
} |
|---|
| 79 |
} |
|---|
| 80 |
|
|---|
| 81 |
function gen_dmn_als_list(&$tpl, &$sql, $dmn_id, $post_check) { |
|---|
| 82 |
$ok_status = Config::get('ITEM_OK_STATUS'); |
|---|
| 83 |
|
|---|
| 84 |
$query = " |
|---|
| 85 |
SELECT |
|---|
| 86 |
`alias_id`, `alias_name` |
|---|
| 87 |
FROM |
|---|
| 88 |
`domain_aliasses` |
|---|
| 89 |
WHERE |
|---|
| 90 |
`domain_id` = ? |
|---|
| 91 |
AND |
|---|
| 92 |
`alias_status` = ? |
|---|
| 93 |
ORDER BY |
|---|
| 94 |
`alias_name` |
|---|
| 95 |
"; |
|---|
| 96 |
|
|---|
| 97 |
$rs = exec_query($sql, $query, array($dmn_id, $ok_status)); |
|---|
| 98 |
if ($rs->RecordCount() == 0) { |
|---|
| 99 |
$tpl->assign( |
|---|
| 100 |
array( |
|---|
| 101 |
'ALS_ID' => '0', |
|---|
| 102 |
'ALS_SELECTED' => 'selected', |
|---|
| 103 |
'ALS_NAME' => tr('Empty list') |
|---|
| 104 |
) |
|---|
| 105 |
); |
|---|
| 106 |
$tpl->parse('ALS_LIST', 'als_list'); |
|---|
| 107 |
$tpl->assign('TO_ALIAS_DOMAIN', ''); |
|---|
| 108 |
} else { |
|---|
| 109 |
$first_passed = false; |
|---|
| 110 |
while (!$rs->EOF) { |
|---|
| 111 |
if ($post_check === 'yes') { |
|---|
| 112 |
if (!isset($_POST['als_id'])) { |
|---|
| 113 |
$als_id = ""; |
|---|
| 114 |
} else { |
|---|
| 115 |
$als_id = $_POST['als_id']; |
|---|
| 116 |
} |
|---|
| 117 |
|
|---|
| 118 |
if ($als_id == $rs->fields['alias_id']) { |
|---|
| 119 |
$als_selected = 'selected'; |
|---|
| 120 |
} else { |
|---|
| 121 |
$als_selected = ''; |
|---|
| 122 |
} |
|---|
| 123 |
} else { |
|---|
| 124 |
if (!$first_passed) { |
|---|
| 125 |
$als_selected = 'selected'; |
|---|
| 126 |
} else { |
|---|
| 127 |
$als_selected = ''; |
|---|
| 128 |
} |
|---|
| 129 |
} |
|---|
| 130 |
|
|---|
| 131 |
$alias_name = decode_idna($rs->fields['alias_name']); |
|---|
| 132 |
$tpl->assign( |
|---|
| 133 |
array( |
|---|
| 134 |
'ALS_ID' => $rs->fields['alias_id'], |
|---|
| 135 |
'ALS_SELECTED' => $als_selected, |
|---|
| 136 |
'ALS_NAME' => $alias_name |
|---|
| 137 |
) |
|---|
| 138 |
); |
|---|
| 139 |
$tpl->parse('ALS_LIST', '.als_list'); |
|---|
| 140 |
$rs->MoveNext(); |
|---|
| 141 |
|
|---|
| 142 |
if (!$first_passed) |
|---|
| 143 |
$first_passed = true; |
|---|
| 144 |
} |
|---|
| 145 |
} |
|---|
| 146 |
} |
|---|
| 147 |
|
|---|
| 148 |
function gen_dmn_sub_list(&$tpl, &$sql, $dmn_id, $dmn_name, $post_check) { |
|---|
| 149 |
$ok_status = Config::get('ITEM_OK_STATUS'); |
|---|
| 150 |
|
|---|
| 151 |
$query = " |
|---|
| 152 |
SELECT |
|---|
| 153 |
`subdomain_id` as sub_id, `subdomain_name` as sub_name |
|---|
| 154 |
FROM |
|---|
| 155 |
`subdomain` |
|---|
| 156 |
WHERE |
|---|
| 157 |
`domain_id` = ? |
|---|
| 158 |
AND |
|---|
| 159 |
`subdomain_status` = ? |
|---|
| 160 |
ORDER BY |
|---|
| 161 |
`subdomain_name` |
|---|
| 162 |
"; |
|---|
| 163 |
|
|---|
| 164 |
$rs = exec_query($sql, $query, array($dmn_id, $ok_status)); |
|---|
| 165 |
|
|---|
| 166 |
if ($rs->RecordCount() == 0) { |
|---|
| 167 |
$tpl->assign( |
|---|
| 168 |
array( |
|---|
| 169 |
'SUB_ID' => '0', |
|---|
| 170 |
'SUB_SELECTED' => 'selected', |
|---|
| 171 |
'SUB_NAME' => tr('Empty list') |
|---|
| 172 |
) |
|---|
| 173 |
); |
|---|
| 174 |
$tpl->parse('SUB_LIST', 'sub_list'); |
|---|
| 175 |
$tpl->assign('TO_SUBDOMAIN', ''); |
|---|
| 176 |
} else { |
|---|
| 177 |
$first_passed = false; |
|---|
| 178 |
|
|---|
| 179 |
while (!$rs->EOF) { |
|---|
| 180 |
if ($post_check === 'yes') { |
|---|
| 181 |
if (!isset($_POST['sub_id'])) { |
|---|
| 182 |
$sub_id = ""; |
|---|
| 183 |
} else { |
|---|
| 184 |
$sub_id = $_POST['sub_id']; |
|---|
| 185 |
} |
|---|
| 186 |
|
|---|
| 187 |
if ($sub_id == $rs->fields['sub_id']) { |
|---|
| 188 |
$sub_selected = 'selected'; |
|---|
| 189 |
} else { |
|---|
| 190 |
$sub_selected = ''; |
|---|
| 191 |
} |
|---|
| 192 |
} else { |
|---|
| 193 |
if (!$first_passed) { |
|---|
| 194 |
$sub_selected = 'selected'; |
|---|
| 195 |
} else { |
|---|
| 196 |
$sub_selected = ''; |
|---|
| 197 |
} |
|---|
| 198 |
} |
|---|
| 199 |
|
|---|
| 200 |
$sub_name = decode_idna($rs->fields['sub_name']); |
|---|
| 201 |
$dmn_name = decode_idna($dmn_name); |
|---|
| 202 |
$tpl->assign( |
|---|
| 203 |
array( |
|---|
| 204 |
'SUB_ID' => $rs->fields['sub_id'], |
|---|
| 205 |
'SUB_SELECTED' => $sub_selected, |
|---|
| 206 |
'SUB_NAME' => $sub_name . '.' . $dmn_name |
|---|
| 207 |
) |
|---|
| 208 |
); |
|---|
| 209 |
$tpl->parse('SUB_LIST', '.sub_list'); |
|---|
| 210 |
$rs->MoveNext(); |
|---|
| 211 |
|
|---|
| 212 |
if (!$first_passed) |
|---|
| 213 |
$first_passed = true; |
|---|
| 214 |
} |
|---|
| 215 |
} |
|---|
| 216 |
} |
|---|
| 217 |
|
|---|
| 218 |
function gen_dmn_als_sub_list(&$tpl, &$sql, $dmn_id, $post_check) { |
|---|
| 219 |
$ok_status = Config::get('ITEM_OK_STATUS'); |
|---|
| 220 |
|
|---|
| 221 |
$query = " |
|---|
| 222 |
SELECT |
|---|
| 223 |
t1.`subdomain_alias_id` as als_sub_id, t1.`subdomain_alias_name` as als_sub_name, t2.`alias_name` as als_name |
|---|
| 224 |
FROM |
|---|
| 225 |
`subdomain_alias` as t1 |
|---|
| 226 |
LEFT JOIN (`domain_aliasses` as t2) ON (t1.`alias_id`=t2.`alias_id`) |
|---|
| 227 |
WHERE |
|---|
| 228 |
t1.`alias_id` in (SELECT `alias_id` FROM `domain_aliasses` WHERE `domain_id` = ?) |
|---|
| 229 |
AND |
|---|
| 230 |
t1.`subdomain_alias_status` = ? |
|---|
| 231 |
ORDER BY |
|---|
| 232 |
t1.`subdomain_alias_name` |
|---|
| 233 |
"; |
|---|
| 234 |
|
|---|
| 235 |
$rs = exec_query($sql, $query, array($dmn_id, $ok_status)); |
|---|
| 236 |
|
|---|
| 237 |
if ($rs->RecordCount() == 0) { |
|---|
| 238 |
$tpl->assign( |
|---|
| 239 |
array( |
|---|
| 240 |
'SUB_ALS_ID' => '0', |
|---|
| 241 |
'SUB_ALS_SELECTED' => 'selected', |
|---|
| 242 |
'SUB_ALS_NAME' => tr('Empty list') |
|---|
| 243 |
) |
|---|
| 244 |
); |
|---|
| 245 |
$tpl->parse('SUB_ALS_LIST', 'sub_list'); |
|---|
| 246 |
$tpl->assign('TO_ALS_SUBDOMAIN', ''); |
|---|
| 247 |
} else { |
|---|
| 248 |
$first_passed = false; |
|---|
| 249 |
|
|---|
| 250 |
while (!$rs->EOF) { |
|---|
| 251 |
if ($post_check === 'yes') { |
|---|
| 252 |
if (!isset($_POST['als_sub_id'])) { |
|---|
| 253 |
$als_sub_id = ""; |
|---|
| 254 |
} else { |
|---|
| 255 |
$als_sub_id = $_POST['als_sub_id']; |
|---|
| 256 |
} |
|---|
| 257 |
|
|---|
| 258 |
if ($als_sub_id == $rs->fields['als_sub_id']) { |
|---|
| 259 |
$als_sub_selected = 'selected'; |
|---|
| 260 |
} else { |
|---|
| 261 |
$als_sub_selected = ''; |
|---|
| 262 |
} |
|---|
| 263 |
} else { |
|---|
| 264 |
if (!$first_passed) { |
|---|
| 265 |
$als_sub_selected = 'selected'; |
|---|
| 266 |
} else { |
|---|
| 267 |
$als_sub_selected = ''; |
|---|
| 268 |
} |
|---|
| 269 |
} |
|---|
| 270 |
|
|---|
| 271 |
$als_sub_name = decode_idna($rs->fields['als_sub_name']); |
|---|
| 272 |
$als_name = decode_idna($rs->fields['als_name']); |
|---|
| 273 |
$tpl->assign( |
|---|
| 274 |
array( |
|---|
| 275 |
'ALS_SUB_ID' => $rs->fields['als_sub_id'], |
|---|
| 276 |
'ALS_SUB_SELECTED' => $als_sub_selected, |
|---|
| 277 |
'ALS_SUB_NAME' => $als_sub_name . '.' . $als_name |
|---|
| 278 |
) |
|---|
| 279 |
); |
|---|
| 280 |
$tpl->parse('ALS_SUB_LIST', '.als_sub_list'); |
|---|
| 281 |
$rs->MoveNext(); |
|---|
| 282 |
|
|---|
| 283 |
if (!$first_passed) |
|---|
| 284 |
$first_passed = true; |
|---|
| 285 |
} |
|---|
| 286 |
} |
|---|
| 287 |
} |
|---|
| 288 |
|
|---|
| 289 |
function schedule_mail_account(&$sql, $domain_id, $dmn_name, $mail_acc) { |
|---|
| 290 |
|
|---|
| 291 |
$mail_auto_respond = false; |
|---|
| 292 |
$mail_auto_respond_text = ''; |
|---|
| 293 |
$mail_addr = ''; |
|---|
| 294 |
|
|---|
| 295 |
if (array_key_exists('mail_type_normal',$_POST)) { |
|---|
| 296 |
$mail_pass = $_POST['pass']; |
|---|
| 297 |
$mail_forward = '_no_'; |
|---|
| 298 |
if ($_POST['dmn_type'] === 'dmn') { |
|---|
| 299 |
$mail_type[] = MT_NORMAL_MAIL; |
|---|
| 300 |
$sub_id = '0'; |
|---|
| 301 |
$mail_addr = $mail_acc.'@'.$dmn_name; |
|---|
| 302 |
} else if ($_POST['dmn_type'] === 'sub') { |
|---|
| 303 |
$mail_type[] = MT_SUBDOM_MAIL; |
|---|
| 304 |
$sub_id = $_POST['sub_id']; |
|---|
| 305 |
$mail_addr = $mail_acc.'@'.decode_idna($dmn_name); |
|---|
| 306 |
} else if ($_POST['dmn_type'] === 'als_sub') { |
|---|
| 307 |
$mail_type[] = MT_ALSSUB_MAIL; |
|---|
| 308 |
$sub_id = $_POST['als_sub_id']; |
|---|
| 309 |
$mail_addr = $mail_acc.'@'.decode_idna($dmn_name); |
|---|
| 310 |
} else if ($_POST['dmn_type'] === 'als') { |
|---|
| 311 |
$mail_type[] = MT_ALIAS_MAIL; |
|---|
| 312 |
$sub_id = $_POST['als_id']; |
|---|
| 313 |
$mail_addr = $mail_acc.'@'.decode_idna($dmn_name); |
|---|
| 314 |
} else { |
|---|
| 315 |
set_page_message(tr('Unknown domain type')); |
|---|
| 316 |
return false; |
|---|
| 317 |
} |
|---|
| 318 |
} |
|---|
| 319 |
|
|---|
| 320 |
if (array_key_exists('mail_type_forward',$_POST)) { |
|---|
| 321 |
if ($_POST['dmn_type'] === 'dmn') { |
|---|
| 322 |
$mail_type[] = MT_NORMAL_FORWARD; |
|---|
| 323 |
$sub_id = '0'; |
|---|
| 324 |
} else if ($_POST['dmn_type'] === 'sub') { |
|---|
| 325 |
$mail_type[] = MT_SUBDOM_FORWARD; |
|---|
| 326 |
$sub_id = $_POST['sub_id']; |
|---|
| 327 |
} else if ($_POST['dmn_type'] === 'als_sub') { |
|---|
| 328 |
$mail_type[] = MT_ALSSUB_FORWARD; |
|---|
| 329 |
$sub_id = $_POST['als_sub_id']; |
|---|
| 330 |
} else if ($_POST['dmn_type'] === 'als') { |
|---|
| 331 |
$mail_type[] = MT_ALIAS_FORWARD; |
|---|
| 332 |
$sub_id = $_POST['als_id']; |
|---|
| 333 |
} else { |
|---|
| 334 |
set_page_message(tr('Unknown domain type')); |
|---|
| 335 |
return false; |
|---|
| 336 |
} |
|---|
| 337 |
|
|---|
| 338 |
if (!isset($_POST['mail_type_normal'])) { |
|---|
| 339 |
$mail_pass = '_no_'; |
|---|
| 340 |
} |
|---|
| 341 |
|
|---|
| 342 |
$mail_forward = $_POST['forward_list']; |
|---|
| 343 |
$farray = preg_split("/[\n,]+/", $mail_forward); |
|---|
| 344 |
$mail_accs = array(); |
|---|
| 345 |
|
|---|
| 346 |
foreach ($farray as $value) { |
|---|
| 347 |
$value = trim($value); |
|---|
| 348 |
if (!chk_email($value) && $value !== '') { |
|---|
| 349 |
|
|---|
| 350 |
set_page_message(tr("Mailformat of an address in your forward list is incorrect!")); |
|---|
| 351 |
return false; |
|---|
| 352 |
} else if ($value === '') { |
|---|
| 353 |
set_page_message(tr("Mail forward list empty!")); |
|---|
| 354 |
return false; |
|---|
| 355 |
} |
|---|
| 356 |
$mail_accs[] = $value; |
|---|
| 357 |
} |
|---|
| 358 |
$mail_forward = implode(',', $mail_accs); |
|---|
| 359 |
} |
|---|
| 360 |
|
|---|
| 361 |
$mail_type = implode(',', $mail_type); |
|---|
| 362 |
list($dmn_type, $type) = explode('_', $mail_type, 2); |
|---|
| 363 |
|
|---|
| 364 |
$check_acc_query = " |
|---|
| 365 |
SELECT |
|---|
| 366 |
COUNT(mail_id) AS cnt |
|---|
| 367 |
FROM |
|---|
| 368 |
`mail_users` |
|---|
| 369 |
WHERE |
|---|
| 370 |
`mail_acc` = ? |
|---|
| 371 |
AND |
|---|
| 372 |
`domain_id` = ? |
|---|
| 373 |
AND |
|---|
| 374 |
`sub_id` = ? |
|---|
| 375 |
AND |
|---|
| 376 |
LEFT (`mail_type`, LOCATE('_', `mail_type`)-1) = ? |
|---|
| 377 |
"; |
|---|
| 378 |
|
|---|
| 379 |
$rs = exec_query($sql, $check_acc_query, array($mail_acc, $domain_id, $sub_id, $dmn_type)); |
|---|
| 380 |
|
|---|
| 381 |
if ($rs->fields['cnt'] > 0) { |
|---|
| 382 |
set_page_message(tr('Mail account already exists!')); |
|---|
| 383 |
return false; |
|---|
| 384 |
} |
|---|
| 385 |
|
|---|
| 386 |
if (preg_match("/^normal_mail/",$mail_type)||preg_match("/^alias_mail/",$mail_type)||preg_match("/^subdom_mail/",$mail_type)||preg_match("/^alssub_mail/",$mail_type)){ |
|---|
| 387 |
$mail_pass=encrypt_db_password($mail_pass); |
|---|
| 388 |
} |
|---|
| 389 |
|
|---|
| 390 |
check_for_lock_file(); |
|---|
| 391 |
|
|---|
| 392 |
$query = " |
|---|
| 393 |
INSERT INTO mail_users ( |
|---|
| 394 |
mail_acc, |
|---|
| 395 |
mail_pass, |
|---|
| 396 |
mail_forward, |
|---|
| 397 |
domain_id, |
|---|
| 398 |
mail_type, |
|---|
| 399 |
sub_id, |
|---|
| 400 |
status, |
|---|
| 401 |
mail_auto_respond, |
|---|
| 402 |
mail_auto_respond_text, |
|---|
| 403 |
mail_addr |
|---|
| 404 |
) VALUES |
|---|
| 405 |
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?) |
|---|
| 406 |
"; |
|---|
| 407 |
|
|---|
| 408 |
$rs = exec_query($sql, $query, array($mail_acc, |
|---|
| 409 |
$mail_pass, |
|---|
| 410 |
$mail_forward, |
|---|
| 411 |
$domain_id, |
|---|
| 412 |
$mail_type, |
|---|
| 413 |
$sub_id, |
|---|
| 414 |
Config::get('ITEM_ADD_STATUS'), |
|---|
| 415 |
$mail_auto_respond, |
|---|
| 416 |
$mail_auto_respond_text, |
|---|
| 417 |
$mail_addr)); |
|---|
| 418 |
|
|---|
| 419 |
write_log($_SESSION['user_logged'] . ": adds new mail account: " . (isset($mail_addr) ? $mail_addr : $mail_acc)); |
|---|
| 420 |
set_page_message(tr('Mail account scheduled for addition!')); |
|---|
| 421 |
send_request(); |
|---|
| 422 |
header("Location: mail_accounts.php"); |
|---|
| 423 |
exit(0); |
|---|
| 424 |
} |
|---|
| 425 |
|
|---|
| 426 |
function check_mail_acc_data(&$sql, $dmn_id, $dmn_name) { |
|---|
| 427 |
|
|---|
| 428 |
$mail_type_normal = isset($_POST['mail_type_normal']) ? $_POST['mail_type_normal'] : false; |
|---|
| 429 |
$mail_type_forward = isset($_POST['mail_type_forward']) ? $_POST['mail_type_forward'] : false; |
|---|
| 430 |
|
|---|
| 431 |
if (($mail_type_normal == false) && ($mail_type_forward == false)) { |
|---|
| 432 |
set_page_message(tr('Please select at least one mail type!')); |
|---|
| 433 |
return false; |
|---|
| 434 |
} |
|---|
| 435 |
|
|---|
| 436 |
if ($mail_type_normal) { |
|---|
| 437 |
$pass = clean_input($_POST['pass']); |
|---|
| 438 |
$pass_rep = clean_input($_POST['pass_rep']); |
|---|
| 439 |
} |
|---|
| 440 |
|
|---|
| 441 |
if (!isset($_POST['username']) || $_POST['username'] === '') { |
|---|
| 442 |
set_page_message(tr('Please enter mail account username!')); |
|---|
| 443 |
return false; |
|---|
| 444 |
} |
|---|
| 445 |
|
|---|
| 446 |
$mail_acc = strtolower(clean_input($_POST['username'])); |
|---|
| 447 |
if (ispcp_check_local_part($mail_acc) == "0") { |
|---|
| 448 |
set_page_message(tr("Invalid Mail Localpart Format used!")); |
|---|
| 449 |
return false; |
|---|
| 450 |
} |
|---|
| 451 |
|
|---|
| 452 |
if ($mail_type_normal) { |
|---|
| 453 |
if (trim($pass) === '' || trim($pass_rep) === '') { |
|---|
| 454 |
set_page_message(tr('Password data is missing!')); |
|---|
| 455 |
return false; |
|---|
| 456 |
} else if ($pass !== $pass_rep) { |
|---|
| 457 |
set_page_message(tr('Entered passwords differ!')); |
|---|
| 458 |
return false; |
|---|
| 459 |
} else if (!chk_password($pass, 50, "/[`\xb4'\"\\\\\x01-\x1f\015\012|<>^$]/i")) { |
|---|
| 460 |
|
|---|
| 461 |
if(Config::get('PASSWD_STRONG')){ |
|---|
| 462 |
set_page_message(sprintf(tr('The password must be at least %s long and contain letters and numbers to be valid.'), Config::get('PASSWD_CHARS'))); |
|---|
| 463 |
} else { |
|---|
| 464 |
set_page_message(sprintf(tr('Password data is shorter than %s signs or includes not permitted signs!'), Config::get('PASSWD_CHARS'))); |
|---|
| 465 |
} |
|---|
| 466 |
return false; |
|---|
| 467 |
} |
|---|
| 468 |
} |
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
if ($_POST['dmn_type'] === 'sub'){ |
|---|
| 472 |
$id='sub_id'; |
|---|
| 473 |
$query=' |
|---|
| 474 |
SELECT |
|---|
| 475 |
CONCAT(t1.`subdomain_name`,\'.\',t2.`domain_name`) as name |
|---|
| 476 |
FROM |
|---|
| 477 |
`subdomain` as t1,`domain` as t2 |
|---|
| 478 |
WHERE |
|---|
| 479 |
t1.`domain_id`=t2.`domain_id` |
|---|
| 480 |
AND |
|---|
| 481 |
t1.`subdomain_id`=? |
|---|
| 482 |
AND |
|---|
| 483 |
t1.`domain_id`=? |
|---|
| 484 |
'; |
|---|
| 485 |
$type=tr('Subdomain'); |
|---|
| 486 |
} |
|---|
| 487 |
|
|---|
| 488 |
if ($_POST['dmn_type'] === 'als_sub'){ |
|---|