added pop3 import to the gui

This commit is contained in:
SJ 2013-08-23 13:02:51 +02:00
parent d7faf096f1
commit eb826537dd
30 changed files with 1010 additions and 24 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.24-master-branch" #define VERSION "0.1.24-master-branch"
#define BUILD 835 #define BUILD 836
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"
@ -87,6 +87,7 @@
#define SQL_OPTION_TABLE "option" #define SQL_OPTION_TABLE "option"
#define SQL_DOMAIN_TABLE "domain" #define SQL_DOMAIN_TABLE "domain"
#define SQL_CUSTOMER_TABLE "customer" #define SQL_CUSTOMER_TABLE "customer"
#define SQL_IMPORT_TABLE "import"
#define SQL_MESSAGES_VIEW "v_messages" #define SQL_MESSAGES_VIEW "v_messages"
#define SQL_ATTACHMENTS_VIEW "v_attachment" #define SQL_ATTACHMENTS_VIEW "v_attachment"
@ -109,6 +110,7 @@
#define SQL_PREPARED_STMT_GET_FOLDER_ID "SELECT `id` FROM " SQL_FOLDER_TABLE " WHERE `name`=? AND `parent_id`=?" #define SQL_PREPARED_STMT_GET_FOLDER_ID "SELECT `id` FROM " SQL_FOLDER_TABLE " WHERE `name`=? AND `parent_id`=?"
#define SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE "INSERT INTO `" SQL_FOLDER_TABLE "` (`name`, `parent_id`) VALUES(?,?)" #define SQL_PREPARED_STMT_INSERT_INTO_FOLDER_TABLE "INSERT INTO `" SQL_FOLDER_TABLE "` (`name`, `parent_id`) VALUES(?,?)"
#define SQL_PREPARED_STMT_UPDATE_METADATA_REFERENCE "UPDATE " SQL_METADATA_TABLE " SET reference=? WHERE message_id=? AND reference=''" #define SQL_PREPARED_STMT_UPDATE_METADATA_REFERENCE "UPDATE " SQL_METADATA_TABLE " SET reference=? WHERE message_id=? AND reference=''"
#define SQL_PREPARED_STMT_GET_GUI_IMPORT_JOBS "SELECT id, type, username, password, server FROM " SQL_IMPORT_TABLE " WHERE started=0 ORDER BY id LIMIT 0,1"
/* Error codes */ /* Error codes */

View File

@ -248,11 +248,21 @@ struct memcached_server {
#endif #endif
struct import {
int status;
int total_messages;
int processed_messages;
int import_job_id;
time_t started, updated, finished;
};
struct __data { struct __data {
int folder; int folder;
char recursive_folder_names; char recursive_folder_names;
char starttls[TINYBUFSIZE]; char starttls[TINYBUFSIZE];
struct node *mydomains[MAXHASH]; struct node *mydomains[MAXHASH];
struct import *import;
#ifdef NEED_MYSQL #ifdef NEED_MYSQL
MYSQL_STMT *stmt_generic; MYSQL_STMT *stmt_generic;

View File

@ -91,7 +91,7 @@ int read_response(int sd, char *buf, int buflen, char *tagok, struct __data *dat
} }
int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sdata, struct __data *data, int use_ssl, struct __config *cfg){ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg){
int rc=ERR, i, n, pos, endpos, messages=0, len, readlen, fd, lastpos, nreads, processed_messages=0; int rc=ERR, i, n, pos, endpos, messages=0, len, readlen, fd, lastpos, nreads, processed_messages=0;
char *p, tag[SMALLBUFSIZE], tagok[SMALLBUFSIZE], tagbad[SMALLBUFSIZE], buf[MAXBUFSIZE], filename[SMALLBUFSIZE]; char *p, tag[SMALLBUFSIZE], tagok[SMALLBUFSIZE], tagbad[SMALLBUFSIZE], buf[MAXBUFSIZE], filename[SMALLBUFSIZE];
char aggrbuf[3*MAXBUFSIZE]; char aggrbuf[3*MAXBUFSIZE];
@ -199,7 +199,8 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
close(fd); close(fd);
rc = import_message(filename, sdata, data, cfg); if(dryrun == 0) rc = import_message(filename, sdata, data, cfg);
else rc = OK;
if(rc == ERR) printf("error importing '%s'\n", filename); if(rc == ERR) printf("error importing '%s'\n", filename);
else unlink(filename); else unlink(filename);

View File

@ -177,3 +177,13 @@ int add_new_folder(struct session_data *sdata, struct __data *data, char *folder
} }
void update_import_job_stat(struct __data *data){
char buf[SMALLBUFSIZE];
snprintf(buf, sizeof(buf)-1, "update import set status=%d, started=%ld, updated=%ld, finished=%ld, total=%d, imported=%d where id=%d", data->import->status, data->import->started, data->import->updated, data->import->finished, data->import->total_messages, data->import->processed_messages, data->import->import_job_id);
p_query(sdata, buf);
}

View File

@ -31,16 +31,20 @@ extern char *optarg;
extern int optind; extern int optind;
int quiet=0; int quiet=0;
int dryrun=0;
int remove_after_successful_import = 0; int remove_after_successful_import = 0;
int import_from_gui=0;
int connect_to_imap_server(int sd, int *seq, char *username, char *password, int port, struct __data *data, int use_ssl); int connect_to_imap_server(int sd, int *seq, char *username, char *password, int port, struct __data *data, int use_ssl);
int list_folders(int sd, int *seq, char *folders, int foldersize, int use_ssl, struct __data *data); int list_folders(int sd, int *seq, char *folders, int foldersize, int use_ssl, struct __data *data);
int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sdata, struct __data *data, int use_ssl, struct __config *cfg); int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg);
int connect_to_pop3_server(int sd, char *username, char *password, int port, struct __data *data, int use_ssl); int connect_to_pop3_server(int sd, char *username, char *password, int port, struct __data *data, int use_ssl);
int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, int use_ssl, struct __config *cfg); int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg);
void close_connection(int sd, struct __data *data, int use_ssl); void close_connection(int sd, struct __data *data, int use_ssl);
void update_import_job_stat(struct __data *data);
int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data *data, struct __config *cfg){ int import_from_mailbox(char *mailbox, struct session_data *sdata, struct __data *data, struct __config *cfg){
FILE *F, *f=NULL; FILE *F, *f=NULL;
@ -252,7 +256,7 @@ int import_from_maildir(char *directory, struct session_data *sdata, struct __da
} }
int import_from_imap_server(char *server, char *username, char *password, int port, struct session_data *sdata, struct __data *data, char *skiplist, struct __config *cfg){ int import_from_imap_server(char *server, char *username, char *password, int port, struct session_data *sdata, struct __data *data, char *skiplist, int dryrun, struct __config *cfg){
int rc=ERR, ret=OK, sd, seq=1, skipmatch, use_ssl=0; int rc=ERR, ret=OK, sd, seq=1, skipmatch, use_ssl=0;
char *p, puf[SMALLBUFSIZE]; char *p, puf[SMALLBUFSIZE];
char muf[SMALLBUFSIZE]; char muf[SMALLBUFSIZE];
@ -317,7 +321,7 @@ int import_from_imap_server(char *server, char *username, char *password, int po
if(quiet == 0) printf("processing folder: %s... ", puf); if(quiet == 0) printf("processing folder: %s... ", puf);
if(process_imap_folder(sd, &seq, puf, sdata, data, use_ssl, cfg) == ERR) ret = ERR; if(process_imap_folder(sd, &seq, puf, sdata, data, use_ssl, dryrun, cfg) == ERR) ret = ERR;
} while(p); } while(p);
@ -331,7 +335,7 @@ ENDE_IMAP:
} }
int import_from_pop3_server(char *server, char *username, char *password, int port, struct session_data *sdata, struct __data *data, struct __config *cfg){ int import_from_pop3_server(char *server, char *username, char *password, int port, struct session_data *sdata, struct __data *data, int dryrun, struct __config *cfg){
int rc, ret=OK, sd, use_ssl=0; int rc, ret=OK, sd, use_ssl=0;
char port_string[6]; char port_string[6];
struct addrinfo hints, *res; struct addrinfo hints, *res;
@ -368,7 +372,7 @@ int import_from_pop3_server(char *server, char *username, char *password, int po
goto ENDE_POP3; goto ENDE_POP3;
} }
if(process_pop3_emails(sd, sdata, data, use_ssl, cfg) == ERR) ret = ERR; if(process_pop3_emails(sd, sdata, data, use_ssl, dryrun, cfg) == ERR) ret = ERR;
close_connection(sd, data, use_ssl); close_connection(sd, data, use_ssl);
@ -379,6 +383,56 @@ ENDE_POP3:
} }
int read_gui_import_data(struct session_data *sdata, struct __data *data, int dryrun, struct __config *cfg){
int rc=ERR;
char s_type[SMALLBUFSIZE], s_username[SMALLBUFSIZE], s_password[SMALLBUFSIZE], s_server[SMALLBUFSIZE];
memset(s_type, 0, sizeof(s_type));
memset(s_username, 0, sizeof(s_username));
memset(s_password, 0, sizeof(s_password));
memset(s_server, 0, sizeof(s_server));
if(prepare_sql_statement(sdata, &(data->stmt_generic), SQL_PREPARED_STMT_GET_GUI_IMPORT_JOBS) == ERR) return ERR;
p_bind_init(data);
if(p_exec_query(sdata, data->stmt_generic, data) == ERR) goto ENDE;
p_bind_init(data);
data->sql[data->pos] = (char *)&(data->import->import_job_id); data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(int); data->pos++;
data->sql[data->pos] = &s_type[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(s_type)-2; data->pos++;
data->sql[data->pos] = &s_username[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(s_username)-2; data->pos++;
data->sql[data->pos] = &s_password[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(s_password)-2; data->pos++;
data->sql[data->pos] = &s_server[0]; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = sizeof(s_server)-2; data->pos++;
p_store_results(sdata, data->stmt_generic, data);
if(p_fetch_results(data->stmt_generic) == OK) rc = OK;
p_free_results(data->stmt_generic);
ENDE:
close_prepared_statement(data->stmt_generic);
time(&(data->import->started));
data->import->status = 1;
update_import_job_stat(data);
if(strcmp(s_type, "pop3") == 0){
import_from_pop3_server(s_server, s_username, s_password, 110, sdata, data, dryrun, cfg);
}
return rc;
}
void usage(){ void usage(){
printf("usage: pilerimport [-c <config file>] -e <eml file> | -m <mailbox file> | -d <directory> | -i <imap server> | -K <pop3 server> | -u <imap username> -p <imap password> -P <imap port> [-F <foldername>] [-R] [-r] [-q]\n"); printf("usage: pilerimport [-c <config file>] -e <eml file> | -m <mailbox file> | -d <directory> | -i <imap server> | -K <pop3 server> | -u <imap username> -p <imap password> -P <imap port> [-F <foldername>] [-R] [-r] [-q]\n");
exit(0); exit(0);
@ -392,11 +446,18 @@ int main(int argc, char **argv){
struct session_data sdata; struct session_data sdata;
struct __config cfg; struct __config cfg;
struct __data data; struct __data data;
struct import import;
for(i=0; i<MBOX_ARGS; i++) mbox[i] = NULL; for(i=0; i<MBOX_ARGS; i++) mbox[i] = NULL;
data.folder = 0; data.folder = 0;
data.recursive_folder_names = 0; data.recursive_folder_names = 0;
import.import_job_id = import.total_messages = import.processed_messages = 0;
import.started = import.updated = import.finished = 0;
data.import = &import;
inithash(data.mydomains); inithash(data.mydomains);
initrules(data.archiving_rules); initrules(data.archiving_rules);
initrules(data.retention_rules); initrules(data.retention_rules);
@ -421,15 +482,17 @@ int main(int argc, char **argv){
{"quiet", required_argument, 0, 'q' }, {"quiet", required_argument, 0, 'q' },
{"recursive", required_argument, 0, 'R' }, {"recursive", required_argument, 0, 'R' },
{"remove-after-import", required_argument, 0, 'r' }, {"remove-after-import", required_argument, 0, 'r' },
{"gui-import", required_argument, 0, 'G' },
{"dry-run", required_argument, 0, 'D' },
{"help", no_argument, 0, 'h' }, {"help", no_argument, 0, 'h' },
{0,0,0,0} {0,0,0,0}
}; };
int option_index = 0; int option_index = 0;
c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:Rrqh?", long_options, &option_index); c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:GDRrqh?", long_options, &option_index);
#else #else
c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:Rrqh?"); c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:GDRrqh?");
#endif #endif
if(c == -1) break; if(c == -1) break;
@ -498,6 +561,14 @@ int main(int argc, char **argv){
remove_after_successful_import = 1; remove_after_successful_import = 1;
break; break;
case 'G' :
import_from_gui = 1;
break;
case 'D' :
dryrun = 1;
break;
case 'q' : case 'q' :
quiet = 1; quiet = 1;
break; break;
@ -515,7 +586,7 @@ int main(int argc, char **argv){
if(!mbox[0] && !mboxdir && !emlfile && !directory && !imapserver && !pop3server) usage(); if(!mbox[0] && !mboxdir && !emlfile && !directory && !imapserver && !pop3server && import_from_gui == 0) usage();
cfg = read_config(configfile); cfg = read_config(configfile);
@ -565,9 +636,9 @@ int main(int argc, char **argv){
} }
if(mboxdir) rc = import_mbox_from_dir(mboxdir, &sdata, &data, &tot_msgs, &cfg); if(mboxdir) rc = import_mbox_from_dir(mboxdir, &sdata, &data, &tot_msgs, &cfg);
if(directory) rc = import_from_maildir(directory, &sdata, &data, &tot_msgs, &cfg); if(directory) rc = import_from_maildir(directory, &sdata, &data, &tot_msgs, &cfg);
if(imapserver && username && password) rc = import_from_imap_server(imapserver, username, password, port, &sdata, &data, skiplist, &cfg); if(imapserver && username && password) rc = import_from_imap_server(imapserver, username, password, port, &sdata, &data, skiplist, dryrun, &cfg);
if(pop3server && username && password) rc = import_from_pop3_server(pop3server, username, password, port, &sdata, &data, &cfg); if(pop3server && username && password) rc = import_from_pop3_server(pop3server, username, password, port, &sdata, &data, dryrun, &cfg);
if(import_from_gui == 1) rc = read_gui_import_data(&sdata, &data, dryrun, &cfg);
clearrules(data.archiving_rules); clearrules(data.archiving_rules);
clearrules(data.retention_rules); clearrules(data.retention_rules);

View File

@ -23,6 +23,9 @@
#include <piler.h> #include <piler.h>
void update_import_job_stat(struct __data *data);
int is_last_complete_pop3_packet(char *s, int len){ int is_last_complete_pop3_packet(char *s, int len){
if(*(s+len-5) == '\r' && *(s+len-4) == '\n' && *(s+len-3) == '.' && *(s+len-2) == '\r' && *(s+len-1) == '\n'){ if(*(s+len-5) == '\r' && *(s+len-4) == '\n' && *(s+len-3) == '.' && *(s+len-2) == '\r' && *(s+len-1) == '\n'){
@ -90,11 +93,14 @@ int connect_to_pop3_server(int sd, char *username, char *password, int port, str
} }
int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, int use_ssl, struct __config *cfg){ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data, int use_ssl, int dryrun, struct __config *cfg){
int i, rc=ERR, n, messages=0, processed_messages=0, pos, readlen, fd, lastpos, nreads; int i=0, rc=ERR, n, pos, readlen, fd, lastpos, nreads;
char *p, buf[MAXBUFSIZE], filename[SMALLBUFSIZE]; char *p, buf[MAXBUFSIZE], filename[SMALLBUFSIZE];
char aggrbuf[3*MAXBUFSIZE]; char aggrbuf[3*MAXBUFSIZE];
data->import->processed_messages = 0;
data->import->total_messages = 0;
snprintf(buf, sizeof(buf)-1, "STAT\r\n"); snprintf(buf, sizeof(buf)-1, "STAT\r\n");
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl); n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
@ -104,19 +110,19 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
p = strchr(&buf[4], ' '); p = strchr(&buf[4], ' ');
if(p){ if(p){
*p = '\0'; *p = '\0';
messages = atoi(&buf[4]); data->import->total_messages = atoi(&buf[4]);
} }
} }
else return ERR; else return ERR;
printf("found %d messages\n", messages); printf("found %d messages\n", data->import->total_messages);
if(messages <= 0) return rc; if(data->import->total_messages <= 0) return rc;
for(i=1; i<=messages; i++){ for(i=1; i<=data->import->total_messages; i++){
processed_messages++; data->import->processed_messages++;
printf("processed: %7d\r", processed_messages); fflush(stdout); printf("processed: %7d\r", data->import->processed_messages); fflush(stdout);
snprintf(buf, sizeof(buf)-1, "RETR %d\r\n", i); snprintf(buf, sizeof(buf)-1, "RETR %d\r\n", i);
@ -188,7 +194,13 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
close(fd); close(fd);
rc = import_message(filename, sdata, data, cfg); if(dryrun == 0) rc = import_message(filename, sdata, data, cfg);
else rc = OK;
if(i % 100 == 0){
time(&(data->import->updated));
update_import_job_stat(data);
}
unlink(filename); unlink(filename);
} }
@ -199,6 +211,11 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
printf("\n"); printf("\n");
time(&(data->import->finished));
data->import->status = 2;
update_import_job_stat(data);
return OK; return OK;
} }

View File

@ -386,3 +386,23 @@ create table if not exists `online` (
unique(`username`,`ipaddr`) unique(`username`,`ipaddr`)
) Engine=InnoDB; ) Engine=InnoDB;
create table if not exists `import` (
`id` int not null auto_increment primary key,
`type` varchar(255) not null,
`username` varchar(255) not null,
`password` varchar(255) not null,
`server` varchar(255) not null,
`created` int default 0,
`started` int default 0,
`finished` int default 0,
`updated` int default 0,
`status` int default 0,
`total` int default 0,
`imported` int default 0,
`duplicate` int default 0,
`error` int default 0,
`cleared` int default 0
) Engine=InnoDB;

View File

@ -289,6 +289,7 @@ define('TABLE_OPTION', 'option');
define('TABLE_LDAP', 'ldap'); define('TABLE_LDAP', 'ldap');
define('TABLE_CUSTOMER_SETTINGS', 'customer_settings'); define('TABLE_CUSTOMER_SETTINGS', 'customer_settings');
define('TABLE_ONLINE', 'online'); define('TABLE_ONLINE', 'online');
define('TABLE_IMPORT', 'import');
define('TABLE_GOOGLE', 'google'); define('TABLE_GOOGLE', 'google');
define('TABLE_GOOGLE_IMAP', 'google_imap'); define('TABLE_GOOGLE_IMAP', 'google_imap');
define('VIEW_MESSAGES', 'v_messages'); define('VIEW_MESSAGES', 'v_messages');
@ -376,6 +377,13 @@ $actions = array(
); );
$import_status = array(
0 => 'PENDING',
1 => 'RUNNING',
2 => 'FINISHED'
);
$counters = array(MEMCACHED_PREFIX . 'rcvd', MEMCACHED_PREFIX . 'virus', MEMCACHED_PREFIX . 'duplicate', MEMCACHED_PREFIX . 'ignore', MEMCACHED_PREFIX . 'counters_last_update'); $counters = array(MEMCACHED_PREFIX . 'rcvd', MEMCACHED_PREFIX . 'virus', MEMCACHED_PREFIX . 'duplicate', MEMCACHED_PREFIX . 'ignore', MEMCACHED_PREFIX . 'counters_last_update');
if(!isset($health_smtp_servers)) { if(!isset($health_smtp_servers)) {

View File

@ -0,0 +1,126 @@
<?php
class ControllerImportJobs extends Controller {
private $error = array();
public function index(){
$this->id = "content";
$this->template = "import/jobs.tpl";
$this->layout = "common/layout";
$request = Registry::get('request');
$db = Registry::get('db');
$this->load->model('saas/import');
$this->document->title = $this->data['text_import'] . " jobs";
$this->data['username'] = Registry::get('username');
$this->data['page'] = 0;
$this->data['page_len'] = get_page_length();
$this->data['total'] = 0;
$this->data['entries'] = array();
$this->data['id'] = -1;
if(isset($this->request->get['id'])) { $this->data['id'] = $this->request->get['id']; }
$this->data['import_status'] = Registry::get('import_status');
/* check if we are admin */
if(Registry::get('admin_user') == 1) {
if($this->request->server['REQUEST_METHOD'] == 'POST') {
if($this->validate() == true) {
if(isset($this->request->post['id'])) {
if($this->model_saas_import->update($this->request->post) == 1) {
$this->data['x'] = $this->data['text_successfully_modified'];
} else {
$this->data['errorstring'] = $this->data['text_failed_to_modify'];
// set ID to be the submitted id
if (isset($this->request->post['id'])) { $this->data['id'] = $this->request->post['id']; }
}
}
else {
if($this->model_saas_import->add($this->request->post) == 1) {
$this->data['x'] = $this->data['text_successfully_added'];
} else {
$this->data['errorstring'] = $this->data['text_failed_to_add'];
}
}
}
else {
$this->data['errorstring'] = $this->data['text_error_message'];
$this->data['errors'] = $this->error;
// set ID to be the submitted id
if (isset($this->request->post['id'])) { $this->data['id'] = $this->request->post['id']; }
}
}
if(isset($this->request->get['id'])) {
$this->data['a'] = $this->model_saas_import->get($this->data['id']);
}
else {
$this->data['entries'] = $this->model_saas_import->get();
}
if ( isset($this->data['errorstring']) ) {
// use posted values if they differ from database values (ie - form was submitted but failed validation)
if (isset($this->request->post['server'])) { $this->data['a']['server'] = $this->request->post['server'];}
if (isset($this->request->post['username'])) { $this->data['a']['username'] = $this->request->post['username'];}
if (isset($this->request->post['type'])) { $this->data['a']['type'] = $this->request->post['type'];}
}
}
else {
$this->template = "common/error.tpl";
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
}
$this->render();
}
private function validate() {
if(!isset($this->request->post['type']) || strlen($this->request->post['type']) < 1) {
$this->error['type'] = $this->data['text_field_required'];
}
if(!isset($this->request->post['server']) || strlen($this->request->post['server']) < 1) {
$this->error['server'] = $this->data['text_field_required'];
}
if(!isset($this->request->post['username']) || strlen($this->request->post['username']) < 1) {
$this->error['username'] = $this->data['text_field_required'];
}
if(!isset($this->request->post['password']) || strlen($this->request->post['password']) < 1) {
$this->error['password'] = $this->data['text_field_required'];
}
if (!$this->error) {
return true;
} else {
return false;
}
}
}
?>

View File

@ -0,0 +1,124 @@
<?php
class ControllerImportList extends Controller {
private $error = array();
public function index(){
$this->id = "content";
$this->template = "import/list.tpl";
$this->layout = "common/layout";
$request = Registry::get('request');
$db = Registry::get('db');
$this->load->model('saas/import');
$this->document->title = $this->data['text_import'];
$this->data['username'] = Registry::get('username');
$this->data['page'] = 0;
$this->data['page_len'] = get_page_length();
$this->data['total'] = 0;
$this->data['entries'] = array();
$this->data['id'] = -1;
if(isset($this->request->get['id'])) { $this->data['id'] = $this->request->get['id']; }
/* check if we are admin */
if(Registry::get('admin_user') == 1) {
if($this->request->server['REQUEST_METHOD'] == 'POST') {
if($this->validate() == true) {
if(isset($this->request->post['id'])) {
if($this->model_saas_import->update($this->request->post) == 1) {
$this->data['x'] = $this->data['text_successfully_modified'];
} else {
$this->data['errorstring'] = $this->data['text_failed_to_modify'];
// set ID to be the submitted id
if (isset($this->request->post['id'])) { $this->data['id'] = $this->request->post['id']; }
}
}
else {
if($this->model_saas_import->add($this->request->post) == 1) {
$this->data['x'] = $this->data['text_successfully_added'];
} else {
$this->data['errorstring'] = $this->data['text_failed_to_add'];
}
}
}
else {
$this->data['errorstring'] = $this->data['text_error_message'];
$this->data['errors'] = $this->error;
// set ID to be the submitted id
if (isset($this->request->post['id'])) { $this->data['id'] = $this->request->post['id']; }
}
}
if(isset($this->request->get['id'])) {
$this->data['a'] = $this->model_saas_import->get($this->data['id']);
}
else {
$this->data['entries'] = $this->model_saas_import->get();
}
if ( isset($this->data['errorstring']) ) {
// use posted values if they differ from database values (ie - form was submitted but failed validation)
if (isset($this->request->post['server'])) { $this->data['a']['server'] = $this->request->post['server'];}
if (isset($this->request->post['username'])) { $this->data['a']['username'] = $this->request->post['username'];}
if (isset($this->request->post['type'])) { $this->data['a']['type'] = $this->request->post['type'];}
}
}
else {
$this->template = "common/error.tpl";
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
}
$this->render();
}
private function validate() {
if(!isset($this->request->post['type']) || strlen($this->request->post['type']) < 1) {
$this->error['type'] = $this->data['text_field_required'];
}
if(!isset($this->request->post['server']) || strlen($this->request->post['server']) < 1) {
$this->error['server'] = $this->data['text_field_required'];
}
if(!isset($this->request->post['username']) || strlen($this->request->post['username']) < 1) {
$this->error['username'] = $this->data['text_field_required'];
}
if(!isset($this->request->post['password']) || strlen($this->request->post['password']) < 1) {
$this->error['password'] = $this->data['text_field_required'];
}
if (!$this->error) {
return true;
} else {
return false;
}
}
}
?>

View File

@ -0,0 +1,79 @@
<?php
class ControllerImportRemove extends Controller {
private $error = array();
private $domains = array();
private $d = array();
public function index(){
$this->id = "content";
$this->template = "import/remove.tpl";
$this->layout = "common/layout";
$request = Registry::get('request');
$db = Registry::get('db');
$this->load->model('saas/import');
$this->document->title = $this->data['text_import'];
$this->data['username'] = Registry::get('username');
$this->data['id'] = $this->request->get['id'];
$this->data['description'] = $this->request->get['name'];
$this->data['confirmed'] = (int)$this->request->get['confirmed'];
if($this->validate() == true) {
if($this->data['confirmed'] == 1) {
$ret = $this->model_saas_import->delete($this->data['id'], $this->data['description']);
if($ret == 1){
$this->data['x'] = $this->data['text_successfully_removed'];
}
else {
$this->data['x'] = $this->data['text_failed_to_remove'];
}
}
}
else {
$this->template = "common/error.tpl";
$this->data['errorstring'] = array_pop($this->error);
}
$this->render();
}
private function validate() {
if(Registry::get('admin_user') == 0) {
$this->error['admin'] = $this->data['text_you_are_not_admin'];
}
if(!isset($this->request->get['name']) || strlen($this->request->get['name']) < 1) {
$this->error['description'] = $this->data['text_invalid_data'];
}
if(!isset($this->request->get['id']) || !is_numeric($this->request->get['id'])) {
$this->error['id'] = $this->data['text_invalid_data'];
}
if (!$this->error) {
return true;
} else {
return false;
}
}
}
?>

View File

@ -0,0 +1,59 @@
<?php
class ControllerImportTest extends Controller {
private $error = array();
public function index(){
$this->id = "content";
$this->template = "import/list.tpl";
$this->layout = "common/layout";
require_once 'Zend/Mail/Protocol/Imap.php';
require_once 'Zend/Mail/Protocol/Pop3.php';
$request = Registry::get('request');
$db = Registry::get('db');
$lang = Registry::get('language');
if($this->request->post['type'] == 'pop3') {
try {
$conn = new Zend_Mail_Protocol_Pop3($this->request->post['server'], '110', false);
} catch (Zend_Mail_Protocol_Exception $e) {
print "<span class=\"text-error\">" . $this->request->post['server'] . ": " . $lang->data['text_connection_failed'] . "</span> ";
}
if($conn) {
$s = $conn->connect($this->request->post['server']);
if($s) {
try {
$conn->login($this->request->post['username'], $this->request->post['password']);
print "<span class=\"text-success\">" . $lang->data['text_connection_ok'] . "</span> ";
}
catch (Zend_Mail_Protocol_Exception $e) {
print "<span class=\"text-error\">" . $this->request->post['username'] . ": " . $lang->data['text_login_failed'] . "</span> ";
}
}
}
}
else {
print "<span class=\"text-error\">" . $lang->data['text_error'] . "</span> ";
}
}
}
?>

View File

@ -67,6 +67,7 @@ Registry::set('ldap_types', array("AD", "iredmail", "lotus", "zimbra"));
Registry::set('health_smtp_servers', $health_smtp_servers); Registry::set('health_smtp_servers', $health_smtp_servers);
Registry::set('partitions_to_monitor', $partitions_to_monitor); Registry::set('partitions_to_monitor', $partitions_to_monitor);
Registry::set('actions', $actions); Registry::set('actions', $actions);
Registry::set('import_status', $import_status);
if(Registry::get('username')) { if(Registry::get('username')) {

View File

@ -151,6 +151,7 @@ $_['text_home'] = "Startseite";
$_['text_image'] = "Bild"; $_['text_image'] = "Bild";
$_['text_import'] = "Import"; $_['text_import'] = "Import";
$_['text_import_job_delete_confirm_message'] = "Do you wish to delete import job";
$_['text_import_users'] = "Benutzer importieren"; $_['text_import_users'] = "Benutzer importieren";
$_['text_import_users_from_LDAP'] = "Benutzer aus LDAP importieren"; $_['text_import_users_from_LDAP'] = "Benutzer aus LDAP importieren";
$_['text_inbound'] = "eingehend"; $_['text_inbound'] = "eingehend";
@ -245,6 +246,7 @@ $_['text_policy_group'] = "Methodengruppe";
$_['text_policy_name'] = "Methodenname"; $_['text_policy_name'] = "Methodenname";
$_['text_previous'] = "Vorherige"; $_['text_previous'] = "Vorherige";
$_['text_processed_emails'] = "Bearbeitete Nachrichten"; $_['text_processed_emails'] = "Bearbeitete Nachrichten";
$_['text_progress'] = "Progress";
$_['text_purge_all_messages_from_quarantine'] = "Alle eigenen Nachrichten im Quarantänebereich löschen"; $_['text_purge_all_messages_from_quarantine'] = "Alle eigenen Nachrichten im Quarantänebereich löschen";
$_['text_purge_selected_messages'] = "Ausgewählte Nachrichten löschen"; $_['text_purge_selected_messages'] = "Ausgewählte Nachrichten löschen";
$_['text_purged'] = "Gelöscht"; $_['text_purged'] = "Gelöscht";
@ -339,6 +341,7 @@ $_['text_total'] = "insgesamt";
$_['text_total_ratio'] = "Verhältnis (insgesamt)"; $_['text_total_ratio'] = "Verhältnis (insgesamt)";
$_['text_total_query_time'] = "Dauer SQL-Abfrage"; $_['text_total_query_time'] = "Dauer SQL-Abfrage";
$_['text_total_users'] = "insgesamt"; $_['text_total_users'] = "insgesamt";
$_['text_type'] = "Type";
$_['text_uids'] = "Benutzerkennungen"; $_['text_uids'] = "Benutzerkennungen";
$_['text_unauthorized_domain'] = "Unauthorized domain"; $_['text_unauthorized_domain'] = "Unauthorized domain";
@ -370,6 +373,7 @@ $_['text_view_journal'] = "Envelope";
$_['text_view_journal_envelope'] = "Envelope anzeigen"; $_['text_view_journal_envelope'] = "Envelope anzeigen";
$_['text_view_message'] = "Nachrichtentext anzeigen"; $_['text_view_message'] = "Nachrichtentext anzeigen";
$_['text_view_message2'] = "Nachricht anzeigen"; $_['text_view_message2'] = "Nachricht anzeigen";
$_['text_view_progress'] = "view progress";
$_['text_view_raw_email'] = "Quelltext anzeigen"; $_['text_view_raw_email'] = "Quelltext anzeigen";
$_['text_view_user_quarantine'] = "Quarantänebereich Benutzer anzeigen"; $_['text_view_user_quarantine'] = "Quarantänebereich Benutzer anzeigen";

View File

@ -151,6 +151,7 @@ $_['text_home'] = "Home";
$_['text_image'] = "image"; $_['text_image'] = "image";
$_['text_import'] = "Import"; $_['text_import'] = "Import";
$_['text_import_job_delete_confirm_message'] = "Do you wish to delete import job";
$_['text_import_users'] = "Import users"; $_['text_import_users'] = "Import users";
$_['text_import_users_from_LDAP'] = "Import users from LDAP"; $_['text_import_users_from_LDAP'] = "Import users from LDAP";
$_['text_inbound'] = "inbound"; $_['text_inbound'] = "inbound";
@ -245,6 +246,7 @@ $_['text_policy_group'] = "Policy group";
$_['text_policy_name'] = "Policy name"; $_['text_policy_name'] = "Policy name";
$_['text_previous'] = "Previous"; $_['text_previous'] = "Previous";
$_['text_processed_emails'] = "Processed emails"; $_['text_processed_emails'] = "Processed emails";
$_['text_progress'] = "Progress";
$_['text_purge_all_messages_from_quarantine'] = "Purge all your own messages from quarantine"; $_['text_purge_all_messages_from_quarantine'] = "Purge all your own messages from quarantine";
$_['text_purge_selected_messages'] = "Purge selected messages"; $_['text_purge_selected_messages'] = "Purge selected messages";
$_['text_purged'] = "Purged"; $_['text_purged'] = "Purged";
@ -339,6 +341,7 @@ $_['text_total'] = "total";
$_['text_total_ratio'] = "total ratio"; $_['text_total_ratio'] = "total ratio";
$_['text_total_query_time'] = "Total SQL query time"; $_['text_total_query_time'] = "Total SQL query time";
$_['text_total_users'] = "total"; $_['text_total_users'] = "total";
$_['text_type'] = "Type";
$_['text_uids'] = "uids"; $_['text_uids'] = "uids";
$_['text_unauthorized_domain'] = "Unauthorized domain"; $_['text_unauthorized_domain'] = "Unauthorized domain";
@ -370,6 +373,7 @@ $_['text_view_journal'] = "journal";
$_['text_view_journal_envelope'] = "View envelope"; $_['text_view_journal_envelope'] = "View envelope";
$_['text_view_message'] = "View message"; $_['text_view_message'] = "View message";
$_['text_view_message2'] = "view message"; $_['text_view_message2'] = "view message";
$_['text_view_progress'] = "view progress";
$_['text_view_raw_email'] = "View raw email"; $_['text_view_raw_email'] = "View raw email";
$_['text_view_user_quarantine'] = "View user's quarantine"; $_['text_view_user_quarantine'] = "View user's quarantine";

View File

@ -151,6 +151,7 @@ $_['text_group_membership'] = "Csoport tags
$_['text_image'] = "kép"; $_['text_image'] = "kép";
$_['text_import'] = "Import"; $_['text_import'] = "Import";
$_['text_import_job_delete_confirm_message'] = "Törölni akarja ezt az import job-ot?";
$_['text_import_users'] = "Felhasználók importálása"; $_['text_import_users'] = "Felhasználók importálása";
$_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból"; $_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból";
$_['text_inbound'] = "bejövő"; $_['text_inbound'] = "bejövő";
@ -245,6 +246,7 @@ $_['text_policy_group'] = "H
$_['text_policy_name'] = "Házirend neve"; $_['text_policy_name'] = "Házirend neve";
$_['text_previous'] = "Előző"; $_['text_previous'] = "Előző";
$_['text_processed_emails'] = "Feldolgozott levelek"; $_['text_processed_emails'] = "Feldolgozott levelek";
$_['text_progress'] = "Státusz";
$_['text_purge_all_messages_from_quarantine'] = "Összes saját üzenet törlése a karanténból"; $_['text_purge_all_messages_from_quarantine'] = "Összes saját üzenet törlése a karanténból";
$_['text_purge_selected_messages'] = "Kiválasztott üzenetek eltávolítása"; $_['text_purge_selected_messages'] = "Kiválasztott üzenetek eltávolítása";
$_['text_purged'] = "Eltávolítva"; $_['text_purged'] = "Eltávolítva";
@ -339,6 +341,7 @@ $_['text_total'] = "
$_['text_total_ratio'] = "összes arány"; $_['text_total_ratio'] = "összes arány";
$_['text_total_query_time'] = "SQL lekérdezések összideje"; $_['text_total_query_time'] = "SQL lekérdezések összideje";
$_['text_total_users'] = "összes"; $_['text_total_users'] = "összes";
$_['text_type'] = "Típus";
$_['text_uids'] = "Felhasználó azonosítók"; $_['text_uids'] = "Felhasználó azonosítók";
$_['text_unknown'] = "ismeretlen"; $_['text_unknown'] = "ismeretlen";
@ -370,6 +373,7 @@ $_['text_view_journal'] = "journal";
$_['text_view_journal_envelope'] = "Journal envelope"; $_['text_view_journal_envelope'] = "Journal envelope";
$_['text_view_message'] = "Levél megtekintése"; $_['text_view_message'] = "Levél megtekintése";
$_['text_view_message2'] = "levél megtekintése"; $_['text_view_message2'] = "levél megtekintése";
$_['text_view_progress'] = "folyamatban lévő importálások";
$_['text_view_raw_email'] = "Formázatlan levél megtekintése"; $_['text_view_raw_email'] = "Formázatlan levél megtekintése";
$_['text_view_user_quarantine'] = "Felhasználó karantén megtekintése"; $_['text_view_user_quarantine'] = "Felhasználó karantén megtekintése";

View File

@ -151,6 +151,7 @@ $_['text_group_membership'] = "Csoport tagság";
$_['text_image'] = "kép"; $_['text_image'] = "kép";
$_['text_import'] = "Import"; $_['text_import'] = "Import";
$_['text_import_job_delete_confirm_message'] = "Törölni akarja ezt az import job-ot?";
$_['text_import_users'] = "Felhasználók importálása"; $_['text_import_users'] = "Felhasználók importálása";
$_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból"; $_['text_import_users_from_LDAP'] = "Felhasználók importálása LDAP-ból";
$_['text_inbound'] = "bejövő"; $_['text_inbound'] = "bejövő";
@ -245,6 +246,7 @@ $_['text_policy_group'] = "Házirend azonosító";
$_['text_policy_name'] = "Házirend neve"; $_['text_policy_name'] = "Házirend neve";
$_['text_previous'] = "Előző"; $_['text_previous'] = "Előző";
$_['text_processed_emails'] = "Feldolgozott levelek"; $_['text_processed_emails'] = "Feldolgozott levelek";
$_['text_progress'] = "Státusz";
$_['text_purge_all_messages_from_quarantine'] = "Összes saját üzenet törlése a karanténból"; $_['text_purge_all_messages_from_quarantine'] = "Összes saját üzenet törlése a karanténból";
$_['text_purge_selected_messages'] = "Kiválasztott üzenetek eltávolítása"; $_['text_purge_selected_messages'] = "Kiválasztott üzenetek eltávolítása";
$_['text_purged'] = "Eltávolítva"; $_['text_purged'] = "Eltávolítva";
@ -339,6 +341,7 @@ $_['text_total'] = "összes";
$_['text_total_ratio'] = "összes arány"; $_['text_total_ratio'] = "összes arány";
$_['text_total_query_time'] = "SQL lekérdezések összideje"; $_['text_total_query_time'] = "SQL lekérdezések összideje";
$_['text_total_users'] = "összes"; $_['text_total_users'] = "összes";
$_['text_type'] = "Típus";
$_['text_uids'] = "Felhasználó azonosítók"; $_['text_uids'] = "Felhasználó azonosítók";
$_['text_unknown'] = "ismeretlen"; $_['text_unknown'] = "ismeretlen";
@ -370,6 +373,7 @@ $_['text_view_journal'] = "journal";
$_['text_view_journal_envelope'] = "Journal envelope"; $_['text_view_journal_envelope'] = "Journal envelope";
$_['text_view_message'] = "Levél megtekintése"; $_['text_view_message'] = "Levél megtekintése";
$_['text_view_message2'] = "levél megtekintése"; $_['text_view_message2'] = "levél megtekintése";
$_['text_view_progress'] = "folyamatban lévő importálások";
$_['text_view_raw_email'] = "Formázatlan levél megtekintése"; $_['text_view_raw_email'] = "Formázatlan levél megtekintése";
$_['text_view_user_quarantine'] = "Felhasználó karantén megtekintése"; $_['text_view_user_quarantine'] = "Felhasználó karantén megtekintése";

View File

@ -147,6 +147,7 @@ $_['text_home'] = "Home";
$_['text_image'] = "imagem"; $_['text_image'] = "imagem";
$_['text_import'] = "Importar"; $_['text_import'] = "Importar";
$_['text_import_job_delete_confirm_message'] = "Do you wish to delete import job";
$_['text_import_users'] = "Importar usuários"; $_['text_import_users'] = "Importar usuários";
$_['text_import_users_from_LDAP'] = "Importar usuários de LDAP"; $_['text_import_users_from_LDAP'] = "Importar usuários de LDAP";
$_['text_inbound'] = "interno"; $_['text_inbound'] = "interno";
@ -240,6 +241,7 @@ $_['text_policy_group'] = "Grupo de política";
$_['text_policy_name'] = "Nome da política"; $_['text_policy_name'] = "Nome da política";
$_['text_previous'] = "Anterior"; $_['text_previous'] = "Anterior";
$_['text_processed_emails'] = "Emails processados"; $_['text_processed_emails'] = "Emails processados";
$_['text_progress'] = "Progress";
$_['text_purge_all_messages_from_quarantine'] = "Expurgar todos as suas próprias mensagens da quarentena"; $_['text_purge_all_messages_from_quarantine'] = "Expurgar todos as suas próprias mensagens da quarentena";
$_['text_purge_selected_messages'] = "Expurgar mensagens selecionadas"; $_['text_purge_selected_messages'] = "Expurgar mensagens selecionadas";
$_['text_purged'] = "Expurgado"; $_['text_purged'] = "Expurgado";
@ -332,6 +334,7 @@ $_['text_total'] = "total";
$_['text_total_ratio'] = "proporção total"; $_['text_total_ratio'] = "proporção total";
$_['text_total_query_time'] = "Tempo total de consulta SQL"; $_['text_total_query_time'] = "Tempo total de consulta SQL";
$_['text_total_users'] = "total"; $_['text_total_users'] = "total";
$_['text_type'] = "Type";
$_['text_uids'] = "UIDs"; $_['text_uids'] = "UIDs";
$_['text_unauthorized_domain'] = "Domínio não autorizado"; $_['text_unauthorized_domain'] = "Domínio não autorizado";
@ -363,6 +366,7 @@ $_['text_view_journal'] = "envelope";
$_['text_view_journal_envelope'] = "Visualizar envelope"; $_['text_view_journal_envelope'] = "Visualizar envelope";
$_['text_view_message'] = "Visualizar mensagem"; $_['text_view_message'] = "Visualizar mensagem";
$_['text_view_message2'] = "visualizar mensagem"; $_['text_view_message2'] = "visualizar mensagem";
$_['text_view_progress'] = "visualizar progress";
$_['text_view_raw_email'] = "Visualizar email em formar RAW"; $_['text_view_raw_email'] = "Visualizar email em formar RAW";
$_['text_view_user_quarantine'] = "Visualizar quarentena do usuário"; $_['text_view_user_quarantine'] = "Visualizar quarentena do usuário";

View File

@ -0,0 +1,58 @@
<?php
class ModelSaasImport extends Model
{
public function get($id = -1) {
if($id >= 0) {
$query = $this->db->query("SELECT * FROM " . TABLE_IMPORT . " WHERE id=?", array($id));
if($query->num_rows > 0) { return $query->row; }
}
$query = $this->db->query("SELECT * FROM " . TABLE_IMPORT . " ORDER BY id ASC");
if($query->num_rows > 0) { return $query->rows; }
return array();
}
public function delete($id = 0, $description = '') {
if($id == 0) { return 0; }
$query = $this->db->query("DELETE FROM " . TABLE_IMPORT . " WHERE id=?", array($id));
$rc = $this->db->countAffected();
LOGGER("remove import entry: #$id, $description (rc=$rc)");
return $rc;
}
public function add($arr = array()) {
if(!isset($arr['type']) || !isset($arr['username'])) { return 0; }
$query = $this->db->query("INSERT INTO " . TABLE_IMPORT . " (type, username, password, server) VALUES (?,?,?,?)", array($arr['type'], $arr['username'], $arr['password'], $arr['server']));
$rc = $this->db->countAffected();
if($rc == 1){ return 1; }
return 0;
}
public function update($arr = array()) {
if(!isset($arr['id']) || !isset($arr['username']) || !isset($arr['password'])) { return 0; }
$query = $this->db->query("UPDATE " . TABLE_IMPORT . " SET type=?, server=?, username=?, password=? WHERE id=?", array($arr['type'], $arr['server'], $arr['username'], $arr['password'], $arr['id']));
return $this->db->countAffected();
}
}
?>

View File

@ -969,6 +969,26 @@ var Piler =
}, },
test_pop3_connection:function()
{
Piler.log("[test_pop3_connection]");
jQuery.ajax('index.php?route=import/test', {
data: {
type: $('#type').val(),
server: $('#server').val(),
username: $('#username').val(),
password: $('#password').val()
},
type: "POST"
})
.done( function(a) {
$('#LDAPTEST').html(a);
})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
},
clear_ldap_test: function() clear_ldap_test: function()
{ {
$('#LDAPTEST').html(''); $('#LDAPTEST').html('');

View File

@ -38,6 +38,7 @@ if(isset($this->request->get['route'])) {
if($this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health(); setInterval('Piler.load_health()', Piler.health_refresh * 1000);"<?php } if($this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health(); setInterval('Piler.load_health()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'stat/online') { ?> onload="setInterval('Piler.reload_page()', Piler.health_refresh * 1000);"<?php } if($this->request->get['route'] == 'stat/online') { ?> onload="setInterval('Piler.reload_page()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'import/jobs') { ?> onload="setInterval('Piler.reload_page()', 10 * 1000);"<?php }
} ?>> } ?>>

View File

@ -37,6 +37,7 @@
<?php if(ENABLE_SAAS == 1) { ?> <?php if(ENABLE_SAAS == 1) { ?>
<li><a href="index.php?route=ldap/list"><i class="icon-key"></i>&nbsp;<?php print $text_ldap; ?></a></li> <li><a href="index.php?route=ldap/list"><i class="icon-key"></i>&nbsp;<?php print $text_ldap; ?></a></li>
<li><a href="index.php?route=customer/list"><i class="icon-wrench"></i>&nbsp;<?php print $text_customers; ?></a></li> <li><a href="index.php?route=customer/list"><i class="icon-wrench"></i>&nbsp;<?php print $text_customers; ?></a></li>
<li><a href="index.php?route=import/list"><i class="icon-lightbulb"></i>&nbsp;<?php print $text_import; ?></a></li>
<?php } ?> <?php } ?>
<li><a href="index.php?route=policy/archiving"><i class="icon-folder-open"></i>&nbsp;<?php print $text_archiving_rules; ?></a></li> <li><a href="index.php?route=policy/archiving"><i class="icon-folder-open"></i>&nbsp;<?php print $text_archiving_rules; ?></a></li>
<li><a href="index.php?route=policy/retention"><i class="icon-time"></i>&nbsp;<?php print $text_retention_rules; ?></a></li> <li><a href="index.php?route=policy/retention"><i class="icon-time"></i>&nbsp;<?php print $text_retention_rules; ?></a></li>

View File

@ -0,0 +1,61 @@
<div id="deleteconfirm-modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" role="dialog" aria-hidden="true"><i class="icon-remove"></i></button>
<h3><?php print $text_confirm; ?> <?php print $text_delete; ?></h3>
</div>
<div class="modal-body">
<p><?php print $text_import_job_delete_confirm_message; ?> <span id="name">ERROR</span>?</p>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php print $text_close; ?></a>
<a href="index.php?route=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<?php if(isset($errorstring)){ ?><div class="alert alert-danger"><?php print $text_error; ?>: <?php print $errorstring; ?></div><?php } ?>
<?php if(isset($x)){ ?>
<div class="alert alert-success"><?php print $x; ?></div>
<?php } ?>
<?php if($id == -1) { ?>
<h4><?php print $text_progress; ?></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_server_name; ?></td>
<th><?php print $text_progress; ?></td>
<th><?php print $text_status; ?></td>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td><?php print $e['server']; ?></td>
<td><?php print $e['imported']; ?> / <?php print $e['total']; ?></td>
<td><?php print $import_status[$e['status']]; ?></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,104 @@
<div id="deleteconfirm-modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" role="dialog" aria-hidden="true"><i class="icon-remove"></i></button>
<h3><?php print $text_confirm; ?> <?php print $text_delete; ?></h3>
</div>
<div class="modal-body">
<p><?php print $text_import_job_delete_confirm_message; ?> <span id="name">ERROR</span>?</p>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php print $text_close; ?></a>
<a href="index.php?route=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<h4><?php if(isset($id) && ($id > 0)) { print $text_edit_entry; } else { print $text_add_new_entry; } ?></h4>
<?php if(isset($errorstring)){ ?><div class="alert alert-danger"><?php print $text_error; ?>: <?php print $errorstring; ?></div><?php } ?>
<?php if(isset($x)){ ?>
<div class="alert alert-success"><?php print $x; ?></div>
<?php } ?>
<form method="post" name="add1" action="index.php?route=import/list" class="form-horizontal">
<?php if(isset($id) && ($id > 0)) { ?>
<input type="hidden" name="id" id="id" value="<?php print $id; ?>" />
<?php } ?>
<input type="hidden" name="type" id="type" value="pop3" />
<div class="control-group<?php if(isset($errors['server'])){ print " error"; } ?>">
<label class="control-label" for="server"><?php print $text_server_name; ?>:</label>
<div class="controls">
<input type="text" class="text" name="server" id="server" placeholder="" value="<?php if(isset($a['server'])) { print $a['server']; } ?>" />
<?php if ( isset($errors['server']) ) { ?><span class="help-inline"><?php print $errors['server']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['username'])){ print " error"; } ?>">
<label class="control-label" for="username"><?php print $text_username; ?>:</label>
<div class="controls">
<input type="text" class="text" name="username" id="username" placeholder="" value="<?php if(isset($a['username'])) { print $a['username']; } ?>" />
<?php if ( isset($errors['username']) ) { ?><span class="help-inline"><?php print $errors['username']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['password'])){ print " error"; } ?>">
<label class="control-label" for="password"><?php print $text_password; ?>:</label>
<div class="controls">
<input type="password" class="password" name="password" id="password" placeholder="" value="<?php if(isset($a['password'])) { print $a['password']; } ?>" /> <input type="button" value="<?php print $text_test_connection; ?>" class="btn btn-danger" onclick="Piler.test_pop3_connection(); return false;" /> <span id="LDAPTEST"></span>
<?php if ( isset($errors['password']) ) { ?><span class="help-inline"><?php print $errors['password']; ?></span><?php } ?>
</div>
</div>
<div class="form-actions">
<input type="submit" value="<?php if(isset($id) && ($id > 0)) { print $text_modify; } else { print $text_add; } ?>" class="btn btn-primary" />
<?php if(isset($id) && ($id > 0)) { ?>
<a href="index.php?route=import/list" class="btn"><?php print $text_cancel; ?></a>
<?php } else { ?>
<input type="reset" value="<?php print $text_clear; ?>" class="btn" onclick="Piler.clear_ldap_test();" />
<?php } ?>
</div>
</form>
<?php if($id == -1) { ?>
<h4><?php print $text_existing_entries; ?> <a href="index.php?route=import/jobs"><?php print $text_view_progress; ?></a></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_password; ?></th>
<th><?php print $text_server_name; ?></td>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td>*******</td>
<td><?php print $e['server']; ?></td>
<td><a href="index.php?route=import/list&amp;id=<?php print $e['id']; ?>"><i class="icon-edit"></i>&nbsp;<?php print $text_edit; ?></a></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,13 @@
<div>
<?php if($confirmed){ ?>
<div class="alert alert-success"><?php print $x; ?>.</div>
<?php } ?>
<p><a href="index.php?route=import/list"><i class="icon-circle-arrow-left"></i>&nbsp;<?php print $text_back; ?></a></p>
</div>

View File

@ -35,6 +35,7 @@ if(isset($this->request->get['route'])) {
if($this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health(); setInterval('Piler.load_health()', Piler.health_refresh * 1000);"<?php } if($this->request->get['route'] == 'health/health') { ?> onload="Piler.load_health(); setInterval('Piler.load_health()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'stat/online') { ?> onload="setInterval('Piler.reload_page()', Piler.health_refresh * 1000);"<?php } if($this->request->get['route'] == 'stat/online') { ?> onload="setInterval('Piler.reload_page()', Piler.health_refresh * 1000);"<?php }
if($this->request->get['route'] == 'import/jobs') { ?> onload="setInterval('Piler.reload_page()', 10 * 1000);"<?php }
} ?>> } ?>>

View File

@ -33,6 +33,7 @@
<?php if(ENABLE_SAAS == 1) { ?> <?php if(ENABLE_SAAS == 1) { ?>
<li><a href="index.php?route=ldap/list"><?php print $text_ldap; ?></a></li> <li><a href="index.php?route=ldap/list"><?php print $text_ldap; ?></a></li>
<li><a href="index.php?route=customer/list"><?php print $text_customers; ?></a></li> <li><a href="index.php?route=customer/list"><?php print $text_customers; ?></a></li>
<li><a href="index.php?route=import/list"><?php print $text_import; ?></a></li>
<?php } ?> <?php } ?>
<li><a href="index.php?route=policy/archiving"><?php print $text_archiving_rules; ?></a></li> <li><a href="index.php?route=policy/archiving"><?php print $text_archiving_rules; ?></a></li>
<li><a href="index.php?route=policy/retention"><?php print $text_retention_rules; ?></a></li> <li><a href="index.php?route=policy/retention"><?php print $text_retention_rules; ?></a></li>

View File

@ -0,0 +1,61 @@
<div id="deleteconfirm-modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" role="dialog" aria-hidden="true"><i class="icon-remove"></i></button>
<h3><?php print $text_confirm; ?> <?php print $text_delete; ?></h3>
</div>
<div class="modal-body">
<p><?php print $text_import_job_delete_confirm_message; ?> <span id="name">ERROR</span>?</p>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php print $text_close; ?></a>
<a href="index.php?route=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<?php if(isset($errorstring)){ ?><div class="alert alert-danger"><?php print $text_error; ?>: <?php print $errorstring; ?></div><?php } ?>
<?php if(isset($x)){ ?>
<div class="alert alert-success"><?php print $x; ?></div>
<?php } ?>
<?php if($id == -1) { ?>
<h4><?php print $text_progress; ?></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_server_name; ?></td>
<th><?php print $text_progress; ?></td>
<th><?php print $text_status; ?></td>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td><?php print $e['server']; ?></td>
<td><?php print $e['imported']; ?> / <?php print $e['total']; ?></td>
<td><?php print $import_status[$e['status']]; ?></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,104 @@
<div id="deleteconfirm-modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" role="dialog" aria-hidden="true"><i class="icon-remove"></i></button>
<h3><?php print $text_confirm; ?> <?php print $text_delete; ?></h3>
</div>
<div class="modal-body">
<p><?php print $text_import_job_delete_confirm_message; ?> <span id="name">ERROR</span>?</p>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php print $text_close; ?></a>
<a href="index.php?route=import/remove&amp;id=-1&amp;name=Error&amp;confirmed=0" class="btn btn-primary" id="id"><?php print $text_delete; ?></a>
</div>
</div>
<h4><?php if(isset($id) && ($id > 0)) { print $text_edit_entry; } else { print $text_add_new_entry; } ?></h4>
<?php if(isset($errorstring)){ ?><div class="alert alert-danger"><?php print $text_error; ?>: <?php print $errorstring; ?></div><?php } ?>
<?php if(isset($x)){ ?>
<div class="alert alert-success"><?php print $x; ?></div>
<?php } ?>
<form method="post" name="add1" action="index.php?route=import/list" class="form-horizontal">
<?php if(isset($id) && ($id > 0)) { ?>
<input type="hidden" name="id" id="id" value="<?php print $id; ?>" />
<?php } ?>
<input type="hidden" name="type" id="type" value="pop3" />
<div class="control-group<?php if(isset($errors['server'])){ print " error"; } ?>">
<label class="control-label" for="server"><?php print $text_server_name; ?>:</label>
<div class="controls">
<input type="text" class="text" name="server" id="server" placeholder="" value="<?php if(isset($a['server'])) { print $a['server']; } ?>" />
<?php if ( isset($errors['server']) ) { ?><span class="help-inline"><?php print $errors['server']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['username'])){ print " error"; } ?>">
<label class="control-label" for="username"><?php print $text_username; ?>:</label>
<div class="controls">
<input type="text" class="text" name="username" id="username" placeholder="" value="<?php if(isset($a['username'])) { print $a['username']; } ?>" />
<?php if ( isset($errors['username']) ) { ?><span class="help-inline"><?php print $errors['username']; ?></span><?php } ?>
</div>
</div>
<div class="control-group<?php if(isset($errors['password'])){ print " error"; } ?>">
<label class="control-label" for="password"><?php print $text_password; ?>:</label>
<div class="controls">
<input type="password" class="password" name="password" id="password" placeholder="" value="<?php if(isset($a['password'])) { print $a['password']; } ?>" /> <input type="button" value="<?php print $text_test_connection; ?>" class="btn btn-danger" onclick="Piler.test_pop3_connection(); return false;" /> <span id="LDAPTEST"></span>
<?php if ( isset($errors['password']) ) { ?><span class="help-inline"><?php print $errors['password']; ?></span><?php } ?>
</div>
</div>
<div class="form-actions">
<input type="submit" value="<?php if(isset($id) && ($id > 0)) { print $text_modify; } else { print $text_add; } ?>" class="btn btn-primary" />
<?php if(isset($id) && ($id > 0)) { ?>
<a href="index.php?route=import/list" class="btn"><?php print $text_cancel; ?></a>
<?php } else { ?>
<input type="reset" value="<?php print $text_clear; ?>" class="btn" onclick="Piler.clear_ldap_test();" />
<?php } ?>
</div>
</form>
<?php if($id == -1) { ?>
<h4><?php print $text_existing_entries; ?> <a href="index.php?route=import/jobs"><?php print $text_view_progress; ?></a></h4>
<div class="listarea">
<?php if(isset($entries)){ ?>
<table id="ss1" class="table table-striped table-condensed">
<tr>
<th><?php print $text_type; ?></th>
<th><?php print $text_username; ?></th>
<th><?php print $text_password; ?></th>
<th><?php print $text_server_name; ?></td>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<?php foreach($entries as $e) { ?>
<tr>
<td><?php print $e['type']; ?></td>
<td><?php print $e['username']; ?></td>
<td>*******</td>
<td><?php print $e['server']; ?></td>
<td><a href="index.php?route=import/list&amp;id=<?php print $e['id']; ?>"><i class="icon-edit"></i>&nbsp;<?php print $text_edit; ?></a></td>
<td><a href="index.php?route=import/remove&amp;id=<?php print $e['id']; ?>&amp;name=<?php print urlencode($e['username']); ?>&amp;confirmed=1" class="confirm-delete" data-id="<?php print $e['id']; ?>" data-name="<?php print $e['username']; ?>"><i class="icon-remove-sign"></i>&nbsp;<?php print $text_remove; ?></a></td>
</tr>
<?php } ?>
</table>
<?php } else { ?>
<div class="alert alert-error lead">
<?php print $text_not_found; ?>
</div>
<?php } ?>
<?php } ?>
</div>

View File

@ -0,0 +1,13 @@
<div>
<?php if($confirmed){ ?>
<div class="alert alert-success"><?php print $x; ?>.</div>
<?php } ?>
<p><a href="index.php?route=import/list"><i class="icon-circle-arrow-left"></i>&nbsp;<?php print $text_back; ?></a></p>
</div>