Marius Cramer
2015-08-06 37b29231e47a0c4458dc1c15d98588f16f07e1e2
interface/web/tools/resync.php
@@ -97,6 +97,11 @@
                 'server_type' => 'mail',
               'server_id' => $server_id,
             ),
            'mail_get' => array (
               'index_field' =>  'mailget_id',
               'server_type' => 'mail',
               'server_id' => $server_id,
            ),
             'mail_mailinglist' => array (
                 'index_field' =>  'mailinglist_id',
                 'server_type' => 'mail',
@@ -145,6 +150,7 @@
             'web_domain' => array (
                 'index_field' => 'domain_id',
                 'server_type' => 'web',
               'server_id' => $server_id,
             ),
             'shell_user' => array (
                 'index_field' => 'shell_user_id',
@@ -241,6 +247,17 @@
            unset($options_servers);
         }
         //* mail-get
         $server_list = $this->create_list($mail_server_rec, 'mail', 'mail_get');
         $options_servers = $server_list[0];$server_count = $server_list[1];
         unset($server_list);
         if (isset($options_servers)) {   //* server with data found
            if ($server_count > 1) $options_servers = "<option value='0'>".$app->tform->wordbook['all_active_mail_txt']."</option>" . $options_servers;
            $app->tpl->setVar('mailget_server_id', $options_servers);
            $app->tpl->setVar('mail_get_found', 1);
            unset($options_servers);
         }
         //* mailbox
         $server_list = $this->create_list($mail_server_rec, 'mail', 'mail_user');
         $options_servers = $server_list[0];$server_count = $server_list[1];
@@ -260,6 +277,17 @@
            if ($server_count > 1) $options_servers = "<option value='0'>".$app->tform->wordbook['all_active_mail_txt']."</option>" . $options_servers;
            $app->tpl->setVar('mailfilter_server_id', $options_servers);
            $app->tpl->setVar('mail_filter_found', 1);
            unset($options_servers);
         }
         //* mailinglist
         $server_list = $this->create_list($mail_server_rec, 'mail', 'mail_mailinglist');
         $options_servers = $server_list[0];$server_count = $server_list[1];
         unset($server_list);
         if (isset($options_servers)) {   //* server with data found
            if ($server_count > 1) $options_servers = "<option value='0'>".$app->tform->wordbook['all_active_mail_txt']."</option>" . $options_servers;
            $app->tpl->setVar('mailinglist_server_id', $options_servers);
            $app->tpl->setVar('mailinglist_found', 1);
            unset($options_servers);
         }
@@ -379,6 +407,10 @@
         }
      }
      $csrf_token = $app->auth->csrf_token_get('tools_resync');
      $app->tpl->setVar('_csrf_id', $csrf_token['csrf_id']);
      $app->tpl->setVar('_csrf_key', $csrf_token['csrf_key']);
      parent::onShowEnd();
   }
         
@@ -429,7 +461,12 @@
    function onSubmit() {
        global $app;
      if(isset($_POST) && count($_POST) > 1) {
         //* CSRF Check
         $app->auth->csrf_token_check();
      }
      //* all services
      if($this->dataRecord['resync_all'] == 1) {
         $this->dataRecord['resync_sites'] = 1;
@@ -439,6 +476,7 @@
         $this->dataRecord['resync_cron'] = 1;
         $this->dataRecord['resync_db'] = 1;
         $this->dataRecord['resync_mail'] = 1;
         $this->dataRecord['resync_mailget'] = 1;
         $this->dataRecord['resync_mailbox'] = 1;
         $this->dataRecord['resync_mailfilter'] = 1;
         $this->dataRecord['resync_mailinglist'] = 1;
@@ -484,9 +522,15 @@
      }
      //* maildomains
      if($this->dataRecord['resync_mail'] == 1)
      if($this->dataRecord['resync_mail'] == 1) {
         $msg .= $this->do_resync('mail_domain', 'domain_id', 'mail', $this->dataRecord['mail_server_id'], 'domain',  $app->tform->wordbook['do_mail_txt']);
         $msg .= $this->do_resync('spamfilter_policy', 'id', 'mail', $this->dataRecord['mail_server_id'], '',  $app->tform->wordbook['do_mail_spamfilter_policy_txt'], false);
      }
      //* mailget
      if($this->dataRecord['resync_mailget'] == 1) {
         $msg .= $this->do_resync('mail_get', 'mailget_id', 'mail', $this->dataRecord['mail_server_id'], 'source_username',  $app->tform->wordbook['do_mailget_txt']);
      }
      //* mailbox
      if($this->dataRecord['resync_mailbox'] == 1) {