1+ <?php
2+ /*
3+ Copyright (c) 2008, Till Brehm, projektfarm Gmbh
4+ All rights reserved.
5+
6+ Redistribution and use in source and binary forms, with or without modification,
7+ are permitted provided that the following conditions are met:
8+
9+ * Redistributions of source code must retain the above copyright notice,
10+ this list of conditions and the following disclaimer.
11+ * Redistributions in binary form must reproduce the above copyright notice,
12+ this list of conditions and the following disclaimer in the documentation
13+ and/or other materials provided with the distribution.
14+ * Neither the name of ISPConfig nor the names of its contributors
15+ may be used to endorse or promote products derived from this software without
16+ specific prior written permission.
17+
18+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+ IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+ */
29+
30+ require_once ('../../lib/config.inc.php ' );
31+ require_once ('../../lib/app.inc.php ' );
32+
33+ //* Check permissions for module
34+ $ app ->auth ->check_module_permissions ('admin ' );
35+
36+ //* This is only allowed for administrators
37+ if (!$ app ->auth ->is_admin ()) die ('only allowed for administrators. ' );
38+
39+ $ app ->uses ('tpl,validate_dns ' );
40+
41+ $ app ->tpl ->newTemplate ('form.tpl.htm ' );
42+ $ app ->tpl ->setInclude ('content_tpl ' , 'templates/dns_resync.htm ' );
43+ $ msg = '' ;
44+ $ error = '' ;
45+
46+ // Resyncing dns zones
47+ if (isset ($ _POST ['resync ' ]) && $ _POST ['resync ' ] == 1 ) {
48+ $ zones = $ app ->db ->queryAllRecords ("SELECT id,origin,serial FROM dns_soa WHERE active = 'Y' " );
49+ if (is_array ($ zones )) {
50+ foreach ($ zones as $ zone ) {
51+ $ records = $ app ->db ->queryAllRecords ("SELECT id,serial FROM dns_rr WHERE zone = " .$ zone ['id ' ]." AND active = 'Y' " );
52+ if (is_array ($ records )) {
53+ foreach ($ records as $ rec ) {
54+ $ new_serial = $ app ->validate_dns ->increase_serial ($ rec ["serial " ]);
55+ $ app ->db ->datalogUpdate ('dns_rr ' , "serial = ' " .$ new_serial ."' " , 'id ' , $ rec ['id ' ]);
56+
57+ }
58+ }
59+ $ new_serial = $ app ->validate_dns ->increase_serial ($ zone ["serial " ]);
60+ $ app ->db ->datalogUpdate ('dns_soa ' , "serial = ' " .$ new_serial ."' " , 'id ' , $ zone ['id ' ]);
61+ $ msg .= "Resynced: " .$ zone ['origin ' ].'<br /> ' ;
62+ }
63+ }
64+
65+ }
66+
67+ $ app ->tpl ->setVar ('msg ' ,$ msg );
68+ $ app ->tpl ->setVar ('error ' ,$ error );
69+
70+
71+ //* load language file
72+ /*
73+ $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_mailbox_import.lng';
74+ include($lng_file);
75+ $app->tpl->setVar($wb);
76+ */
77+
78+ $ app ->tpl_defaults ();
79+ $ app ->tpl ->pparse ();
80+
81+
82+ ?>
0 commit comments