[enh] option pour ajouter les contacts dans le carnet du plugin "automatic_addressbook"
Parent
efe64f2c79
révision
f947ad24dd
11
common.php
11
common.php
|
@ -192,7 +192,7 @@ class rcmail_contacts_utils
|
|||
* @param string $user User name
|
||||
* @param string $host Optional user host
|
||||
*/
|
||||
public function __construct($user, $host = null)
|
||||
public function __construct($user, $host = null, $collected_contacts = false)
|
||||
{
|
||||
$this->db = rcmail_utils::db();
|
||||
|
||||
|
@ -200,7 +200,14 @@ class rcmail_contacts_utils
|
|||
$this->username = $user;
|
||||
|
||||
$this->user_id = $this->get_user_id($this->username, $this->host);
|
||||
$this->contacts = new rcube_contacts($this->db, $this->user_id);
|
||||
if ($collected_contacts) {
|
||||
log_msg('INFO', 'working on collected_contacts - if script stop here you probably need to install automatic_addressbook plugin');
|
||||
require_once INSTALL_PATH . 'plugins/automatic_addressbook/automatic_addressbook_backend.php';
|
||||
$this->contacts = new automatic_addressbook_backend($this->db, $this->user_id);
|
||||
} else {
|
||||
log_msg('INFO', 'working on contacts');
|
||||
$this->contacts = new rcube_contacts($this->db, $this->user_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,6 +35,8 @@ function print_usage()
|
|||
echo " -d, --debug Enable debug mode\n";
|
||||
echo " -c, --create_user Create user account if needed\n";
|
||||
echo " -b, --batch Do not prompt for user, proceed anyway\n";
|
||||
echo " -a, --aa_contacts Use automatic_addressbook instead of std\n";
|
||||
echo " contacts. Need plugin automatic_adressbook\n";
|
||||
}
|
||||
|
||||
// get arguments
|
||||
|
@ -47,6 +49,7 @@ $args = rcube_utils::get_opt(array(
|
|||
'h' => 'help:bool',
|
||||
'c' => 'create_user:bool',
|
||||
'b' => 'batch:bool',
|
||||
'a' => 'aa_contacts:bool',
|
||||
));
|
||||
|
||||
if ('help' == $_SERVER['argv'][1] || $args['help']) {
|
||||
|
@ -99,7 +102,7 @@ if (!is_object($rc_user))
|
|||
}
|
||||
}
|
||||
|
||||
$contacts = new rcmail_contacts_utils($username, $args['host']);
|
||||
$contacts = new rcmail_contacts_utils($username, $args['host'], $args['aa_contacts']);
|
||||
$contacts->import($in, $args['replace'], !$args['batch']);
|
||||
|
||||
if (!empty($args['input'])) {
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket