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

@ -289,6 +289,7 @@ define('TABLE_OPTION', 'option');
define('TABLE_LDAP', 'ldap');
define('TABLE_CUSTOMER_SETTINGS', 'customer_settings');
define('TABLE_ONLINE', 'online');
define('TABLE_IMPORT', 'import');
define('TABLE_GOOGLE', 'google');
define('TABLE_GOOGLE_IMAP', 'google_imap');
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');
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('partitions_to_monitor', $partitions_to_monitor);
Registry::set('actions', $actions);
Registry::set('import_status', $import_status);
if(Registry::get('username')) {

View File

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

View File

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

View File

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

View File

@ -151,6 +151,7 @@ $_['text_group_membership'] = "Csoport tagság";
$_['text_image'] = "kép";
$_['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_from_LDAP'] = "Felhasználók importálása LDAP-ból";
$_['text_inbound'] = "bejövő";
@ -245,6 +246,7 @@ $_['text_policy_group'] = "Házirend azonosító";
$_['text_policy_name'] = "Házirend neve";
$_['text_previous'] = "Előző";
$_['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_selected_messages'] = "Kiválasztott üzenetek eltávolítása";
$_['text_purged'] = "Eltávolítva";
@ -339,6 +341,7 @@ $_['text_total'] = "összes";
$_['text_total_ratio'] = "összes arány";
$_['text_total_query_time'] = "SQL lekérdezések összideje";
$_['text_total_users'] = "összes";
$_['text_type'] = "Típus";
$_['text_uids'] = "Felhasználó azonosítók";
$_['text_unknown'] = "ismeretlen";
@ -370,6 +373,7 @@ $_['text_view_journal'] = "journal";
$_['text_view_journal_envelope'] = "Journal envelope";
$_['text_view_message'] = "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_user_quarantine'] = "Felhasználó karantén megtekintése";

View File

@ -147,6 +147,7 @@ $_['text_home'] = "Home";
$_['text_image'] = "imagem";
$_['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_from_LDAP'] = "Importar usuários de LDAP";
$_['text_inbound'] = "interno";
@ -240,6 +241,7 @@ $_['text_policy_group'] = "Grupo de política";
$_['text_policy_name'] = "Nome da política";
$_['text_previous'] = "Anterior";
$_['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_selected_messages'] = "Expurgar mensagens selecionadas";
$_['text_purged'] = "Expurgado";
@ -332,6 +334,7 @@ $_['text_total'] = "total";
$_['text_total_ratio'] = "proporção total";
$_['text_total_query_time'] = "Tempo total de consulta SQL";
$_['text_total_users'] = "total";
$_['text_type'] = "Type";
$_['text_uids'] = "UIDs";
$_['text_unauthorized_domain'] = "Domínio não autorizado";
@ -363,6 +366,7 @@ $_['text_view_journal'] = "envelope";
$_['text_view_journal_envelope'] = "Visualizar envelope";
$_['text_view_message'] = "Visualizar mensagem";
$_['text_view_message2'] = "visualizar mensagem";
$_['text_view_progress'] = "visualizar progress";
$_['text_view_raw_email'] = "Visualizar email em formar RAW";
$_['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()
{
$('#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'] == '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) { ?>
<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=import/list"><i class="icon-lightbulb"></i>&nbsp;<?php print $text_import; ?></a></li>
<?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/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'] == '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) { ?>
<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=import/list"><?php print $text_import; ?></a></li>
<?php } ?>
<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>

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>