Permalink
Browse files

Update dnszones-poller.php

fix php script directory when looking for conf/schema files. 

As errors will occur if in a seperate dir to the update_zone file.
  • Loading branch information...
jammin84 committed Oct 21, 2014
1 parent 71f267c commit 039aa0a65f0d24a2cfd4437eab68489b36ed0763
Showing with 4 additions and 3 deletions.
  1. +4 −3 tools/dnszones-poller/dnszones-poller.php
@@ -1,7 +1,8 @@
<?php
if (isset($argv[1])) {
- $conf_file = basename($argv[1]).'.conf';
+ $basedir = dirname($_SERVER['PHP_SELF']);
+ $conf_file = $basedir.'/'.basename($argv[1]).'.conf';
} else {
$conf_file = basename($_GET['zonefile']).'.conf';
}
@@ -37,7 +38,7 @@ function replace($array, $string) {
ORDER BY nodes.name_ns ASC, dns_nameservers.name ASC";
$q = mysql_query($query, $mysql_link);
while ($ret = mysql_fetch_assoc($q)) {
- $replace['NAMESERVERS'] .= $conf['notify']?
+ $replace['NAMESERVERS'] .= isset($conf['notify'])?
long2ip($ret['ns_ip']).";\n":
" NS ".$ret['ns_num'].".".$ret['name_ns'].$conf['ns_domain']."\n";
}
@@ -103,7 +104,7 @@ function replace($array, $string) {
}
## ECHO ZONE
-echo replace($replace, file_get_contents($conf['shema']));
+echo replace($replace, file_get_contents($basedir.'/'.$conf['shema']));
mysql_close($mysql_link);

0 comments on commit 039aa0a

Please sign in to comment.