From baa7f2736bc91ca3feaed685e8a67a46db4fbb98 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Mon, 17 Feb 2014 05:02:38 -0500
Subject: [PATCH] Fixed vhostsubdomain not empty regex check to allow 1 char subdomains.
---
interface/web/tools/resync.php | 78 ++++++++++++++++++++++++++++++++++-----
1 files changed, 68 insertions(+), 10 deletions(-)
diff --git a/interface/web/tools/resync.php b/interface/web/tools/resync.php
index 86ba27d..1191585 100644
--- a/interface/web/tools/resync.php
+++ b/interface/web/tools/resync.php
@@ -27,8 +27,8 @@
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('admin');
@@ -45,7 +45,7 @@
//* load language file
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_resync.lng';
-include($lng_file);
+include $lng_file;
$app->tpl->setVar($wb);
//* Resyncing websites
@@ -106,6 +106,16 @@
//* Resyncing Databases
if(isset($_POST['resync_db']) && $_POST['resync_db'] == 1) {
+ $db_table = 'web_database_user';
+ $index_field = 'database_user_id';
+ $sql = "SELECT * FROM ".$db_table." WHERE 1";
+ $records = $app->db->queryAllRecords($sql);
+ if(is_array($records)) {
+ foreach($records as $rec) {
+ $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true);
+ $msg .= "Resynced Database user: ".$rec['database_user'].'<br />';
+ }
+ }
$db_table = 'web_database';
$index_field = 'database_id';
$sql = "SELECT * FROM ".$db_table." WHERE active = 'y'";
@@ -118,11 +128,25 @@
}
}
+//* Resyncing Mailbox Domains
+if(isset($_POST['resync_mailbox']) && $_POST['resync_mailbox'] == 1) {
+ $db_table = 'mail_domain';
+ $index_field = 'domain_id';
+ $sql = "SELECT * FROM ".$db_table." WHERE active = 'y'";
+ $records = $app->db->queryAllRecords($sql);
+ if(is_array($records)) {
+ foreach($records as $rec) {
+ $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true);
+ $msg .= "Resynced Mail Domain: ".$rec['domain'].'<br />';
+ }
+ }
+}
+
//* Resyncing Mailboxes
if(isset($_POST['resync_mailbox']) && $_POST['resync_mailbox'] == 1) {
$db_table = 'mail_user';
$index_field = 'mailuser_id';
- $sql = "SELECT * FROM ".$db_table." WHERE active = 'y'";
+ $sql = "SELECT * FROM ".$db_table;
$records = $app->db->queryAllRecords($sql);
if(is_array($records)) {
foreach($records as $rec) {
@@ -130,8 +154,17 @@
$msg .= "Resynced Mailbox: ".$rec['email'].'<br />';
}
}
+ $db_table = 'mail_forwarding';
+ $index_field = 'forwarding_id';
+ $sql = "SELECT * FROM ".$db_table;
+ $records = $app->db->queryAllRecords($sql);
+ if(is_array($records)) {
+ foreach($records as $rec) {
+ $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true);
+ $msg .= "Resynced Alias: ".$rec['source'].'<br />';
+ }
+ }
}
-
//* Resyncing dns zones
if(isset($_POST['resync_dns']) && $_POST['resync_dns'] == 1) {
@@ -143,7 +176,7 @@
foreach($records as $rec) {
$new_serial = $app->validate_dns->increase_serial($rec["serial"]);
$app->db->datalogUpdate('dns_rr', "serial = '".$new_serial."'", 'id', $rec['id']);
-
+
}
}
$new_serial = $app->validate_dns->increase_serial($zone["serial"]);
@@ -153,14 +186,39 @@
} else {
$error .= "No zones found to sync.<br />";
}
-
+
}
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+//* Resyncing Clients
+if(isset($_POST['resync_client']) && $_POST['resync_client'] == 1) {
+ $tform_def_file = "form/client.tform.php";
+ $app->uses('tpl,tform,tform_actions');
+ $app->load('tform_actions');
+
+ $db_table = 'client';
+ $index_field = 'client_id';
+ $sql = "SELECT * FROM ".$db_table;
+ $records = $app->db->queryAllRecords($sql);
+ if(is_array($records)) {
+ foreach($records as $rec) {
+ $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true);
+ $tmp = new tform_actions;
+ $tmp->id = $rec[$index_field];
+ $tmp->dataRecord = $rec;
+ $tmp->oldDataRecord = $rec;
+ $app->plugin->raiseEvent('client:client:on_after_update', $tmp);
+ $msg .= "Resynced Client: ".$rec['contact_name'].'<br />';
+ unset($tmp);
+ }
+ }
+}
+
+
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
$app->tpl_defaults();
$app->tpl->pparse();
-?>
\ No newline at end of file
+?>
--
Gitblit v1.9.1