Dovecot avance (un peu)

This commit is contained in:
Alan Garcia 2011-06-15 21:58:26 +00:00
parent e41c217c99
commit 391ef496d0
2 changed files with 64 additions and 2 deletions

View File

@ -91,7 +91,7 @@ class m_mail {
function enum_doms_mails_letters($dom) { function enum_doms_mails_letters($dom) {
global $err,$cuid,$db; global $err,$cuid,$db;
$err->log("mail","enum_doms_mails_letters",$dom); $err->log("mail","enum_doms_mails_letters",$dom);
$db->query("SELECT LEFT(mail,1) as letter FROM mail_domain where uid='$cuid' AND type=0 and mail like '%@".addslashes($dom)."' GROUP BY letter ORDER BY letter;"); $db->query("select distinct left(ad.address,1) as letter from address ad, domaines d where address like '%@".addslashes($dom)."' and ad.domain_id = d.compte and d.compte='$cuid' order by letter;");
$res=array(); $res=array();
while($db->next_record()) { while($db->next_record()) {
$res[]=$db->f("letter"); $res[]=$db->f("letter");
@ -206,7 +206,7 @@ class m_mail {
* @param string $mail the email address (with its fqdn domain) * @param string $mail the email address (with its fqdn domain)
* @return boolean true if this email is available, false if it is already defined. * @return boolean true if this email is available, false if it is already defined.
*/ */
function available($mail) { function available($mail) { // NEW OK
global $err,$db,$cuid; global $err,$db,$cuid;
$err->log("mail","available",$mail); $err->log("mail","available",$mail);
$db->query("SELECT address FROM address WHERE address='$mail';"); $db->query("SELECT address FROM address WHERE address='$mail';");

View File

@ -78,6 +78,68 @@ VALUES (
'This variable set if you want to allow all IP address to access FTP by default. If the user start to define some IP or subnet in the allow list, only those he defined will be allowed. This variable can take two value : 0 or 1.' 'This variable set if you want to allow all IP address to access FTP by default. If the user start to define some IP or subnet in the allow list, only those he defined will be allowed. This variable can take two value : 0 or 1.'
); );
--
-- Main address table.
--
-- Addresses for domain.
CREATE TABLE `address` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id.
`domain_id` bigint(20) unsigned DEFAULT NULL REFERENCES `sub_domain`(`id`), -- FK to sub_domains.
`address` varchar(255) NOT NULL, -- The address.
`password` varchar(255) DEFAULT NULL, -- The password associated to the address.
`enabled` int(1) unsigned NOT NULL DEFAULT '1', -- Enabled flag.
`expire_date` datetime DEFAULT NULL, -- Expiration date, used for temporary addresses.
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Update date, for technical usage only.
PRIMARY KEY (`id`),
UNIQUE KEY `address` (`address`)
) COMMENT = 'This is the main address table. It represents an address as in RFC2822';
--
-- Mailbox table.
--
-- Local delivered mailboxes.
CREATE TABLE `mailbox` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id.
`address_id` bigint(20) unsigned NOT NULL REFERENCES `address`(`id`), -- Reference to address.
`path` varchar(255) NOT NULL, -- Relative path to the mailbox.
`quota` bigint(20) unsigned DEFAULT NULL, -- Quota for this mailbox.
`delivery` varchar(255) NOT NULL, -- Delivery transport.
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Update date, for technical usage only.
PRIMARY KEY (`id`),
UNIQUE KEY `address_id` (`address_id`)
) COMMENT = 'Table containing local deliverd mailboxes.';
--
-- Other recipients.
--
-- Other recipients for an address (aliases)
CREATE TABLE `recipient` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id.
`address_id` bigint(20) unsigned NOT NULL REFERENCES `address`(`id`), -- Reference to address
`recipients` text NOT NULL, -- Recipients
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Update date, for technical usage only.
PRIMARY KEY (`id`),
UNIQUE KEY `address_id` (`address_id`)
) COMMENT = 'Table containing other recipients (aliases) for an address.';
--
-- Mailman table.
--
-- Table containing mailman addresses
CREATE TABLE `mailman` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, -- Technical id.
`address_id` bigint(20) unsigned NOT NULL REFERENCES `address`(`id`), -- Reference to address
`delivery` varchar(255) NOT NULL, -- Delivery transport.
`update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- Update date, for technical usage only.
PRIMARY KEY (`id`),
UNIQUE KEY `address_id` (`address_id`)
) COMMENT = 'Table containing mailman list addresses.';
-- Regenerate apache conf to enable mpm-itk -- Regenerate apache conf to enable mpm-itk
update sub_domaines set web_action = 'UPDATE'; update sub_domaines set web_action = 'UPDATE';