mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 23:01:58 +01:00
domain add fix
This commit is contained in:
parent
25623dda1c
commit
a9d464ab17
@ -106,7 +106,7 @@ class ControllerDomainDomain extends Controller {
|
||||
$domains = explode("\n", $this->request->post['domain']);
|
||||
foreach ($domains as $domain) {
|
||||
$domain = rtrim($domain);
|
||||
if(!preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5})$/', $domain) ) {
|
||||
if(!preg_match('/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,5})$/', $domain) ) {
|
||||
$this->error['domain'] = $this->data['text_field_domain'];
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ class ControllerDomainDomain extends Controller {
|
||||
if(!isset($this->request->post['mapped']) || strlen($this->request->post['mapped']) < 3) {
|
||||
$this->data['text_field_length'] = str_replace("?",3,$this->data['text_field_length']);
|
||||
$this->error['mapped'] = $this->data['text_field_length'];
|
||||
} elseif( !preg_match('/^[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5})$/', $this->request->post['mapped']) ) {
|
||||
} elseif( !preg_match('/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,5})$/', $this->request->post['mapped']) ) {
|
||||
$this->error['mapped'] = $this->data['text_field_domain'];
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,8 @@ class ModelDomainDomain extends Model {
|
||||
public function addDomain($domain = '', $mapped = '', $ldap_id = 0) {
|
||||
if($domain == "" || $mapped == "") { return 0; }
|
||||
|
||||
$mapped = strtolower($mapped);
|
||||
|
||||
$query = $this->db->query("INSERT INTO " . TABLE_DOMAIN . " (domain, mapped, ldap_id) VALUES (?,?,?)", array($mapped, $mapped, $ldap_id));
|
||||
$rc = $this->db->countAffected();
|
||||
if($rc == 1) {
|
||||
@ -108,7 +110,7 @@ class ModelDomainDomain extends Model {
|
||||
$domains = explode("\n", $domain);
|
||||
|
||||
foreach ($domains as $domain) {
|
||||
$domain = rtrim($domain);
|
||||
$domain = strtolower(rtrim($domain));
|
||||
if($domain != $mapped) {
|
||||
$query = $this->db->query("INSERT INTO " . TABLE_DOMAIN . " (domain, mapped, ldap_id) VALUES (?,?,?)", array($domain, $mapped, $ldap_id));
|
||||
$rc = $this->db->countAffected();
|
||||
|
Loading…
Reference in New Issue
Block a user