<?xml version="1.0"?>
<?xml-stylesheet
href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=File_DNS</link>
    <description>Search Results</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bug/11521" />
      <rdf:li rdf:resource="http://pear.php.net/bug/8487" />
      <rdf:li rdf:resource="http://pear.php.net/bug/6275" />
      <rdf:li rdf:resource="http://pear.php.net/bug/4528" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/11521">
      <title>File_DNS: Feature/Change Request 11521 [Assigned] Added missing functionality</title>
      <link>http://pear.php.net/bugs/11521</link>
      <content:encoded><![CDATA[<pre>File_DNS Feature/Change Request
Reported by cstdenis
2007-07-04T12:00:02+00:00
PHP: 5.2.3 OS: FreeBSD 6.2 Package Version: 0.0.8

Description:
------------
New methods:
getSOA($type = null)
getRR()
create($filename = null, $soa = null)
addRecord($name, $type, $data, $ttl = null, $pref = null)
delRecord($id = null, $name = null, $type = null, $data = null)</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_DNS Feature/Change Request
Reported by cstdenis
2007-07-04T12:00:02+00:00
PHP: 5.2.3 OS: FreeBSD 6.2 Package Version: 0.0.8

Description:
------------
New methods:
getSOA($type = null)
getRR()
create($filename = null, $soa = null)
addRecord($name, $type, $data, $ttl = null, $pref = null)
delRecord($id = null, $name = null, $type = null, $data = null)</pre>]]></description>
      <dc:date>2007-09-20T04:39:56+00:00</dc:date>
      <dc:creator>cstdenis &amp;#x61;&amp;#116; ctgameinfo &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>File_DNS Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/8487">
      <title>File_DNS: Bug 8487 [Assigned] $ORIGIN not honoured in SOA records</title>
      <link>http://pear.php.net/bugs/8487</link>
      <content:encoded><![CDATA[<pre>File_DNS Bug
Reported by cipri
2006-08-17T05:34:32+00:00
PHP: Irrelevant OS:  Package Version: 0.0.8

Description:
------------
The following SOA isn't recognized properly:

--- 
$ORIGIN eu.
example        14400   IN      SOA     ns1.example.com. hostmaster.example.com. (
                2006072708 3600 900 604800 14400 )
---

$ORIGIN isn't honoured, and it just gets 'example' instead of 'example.eu.'</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_DNS Bug
Reported by cipri
2006-08-17T05:34:32+00:00
PHP: Irrelevant OS:  Package Version: 0.0.8

Description:
------------
The following SOA isn't recognized properly:

--- 
$ORIGIN eu.
example        14400   IN      SOA     ns1.example.com. hostmaster.example.com. (
                2006072708 3600 900 604800 14400 )
---

$ORIGIN isn't honoured, and it just gets 'example' instead of 'example.eu.'</pre>]]></description>
      <dc:date>2007-03-12T17:19:14+00:00</dc:date>
      <dc:creator>cipri &amp;#x61;&amp;#116; php &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>File_DNS Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/6275">
      <title>File_DNS: Feature/Change Request 6275 [Assigned] Added features/Patch</title>
      <link>http://pear.php.net/bugs/6275</link>
      <content:encoded><![CDATA[<pre>File_DNS Feature/Change Request
Reported by pear@...
2005-12-17T17:09:24+00:00
PHP: 4.3.11 OS: Linux Package Version: 

Description:
------------
A patch including bug 4528, plus Add/Remove items.  Also expanded the allowed record types.


--- DNS.php.orig        2004-06-29 06:52:26.000000000 +1000
+++ DNS.php     2005-12-18 09:05:01.000000000 +1100
@@ -200,10 +200,17 @@
      * CNAME
      * PTR
      *
+     * // bekar@20050326 updates //
+     *  Added support for a few extra record types:
+     *      TXT
+     *      NXT
+     *      HINFO
+     * // end of updates //
+     *
      * @var array
      * @see _parseRR
      */
-    var $_types = array('SOA', 'A', 'AAAA', 'NS', 'MX', 'CNAME', 'PTR');
+    var $_types = array('SOA', 'A', 'AAAA', 'NS', 'MX', 'CNAME', 'PTR', 'TXT', 'NXT', 'HINFO');
 
     /**
      * zonefile modification check
@@ -490,16 +497,31 @@
                 case 'NS':
                 case 'CNAME':
                 case 'PTR':
-                    $record['data'] = $item;
+                    $zone[] = implode(&quot;\t&quot;, array(
+                        $record['name'],
+                        $record['ttl'],
+                        $record['class'],
+                        $record['type'],
+                        $record['data']));
                     break;
-
                 case 'MX':
                     //MX have an extra element. Save both right away.
                     //The setting itself is in the next item.
                     $record['data'] = $items[$key+1];
                     $record['options'] = array('MXPreference' =&gt; $item);
                     break;
-
+// bekar@20050326 updates //
+                case 'TXT':
+                case 'NXT':
+                case 'HINFO':
+                    //TXT and HINFO records are quoted text strings
+                    if ( preg_match( '/TXT (.*)$/i', $line, $data ) ) {
+                        $record['data'] = $data[1];
+                    } else {
+                        $record['data'] = $items[$key+1];
+                    }
+                    break;
+// end updates //
                 default:
                     return PEAR::raiseError('Unable to parse RR. ' .
                                             $record['type'] .
@@ -1127,6 +1149,88 @@
     }
 
     // }}}
+    // {{{ addRecord()
+
+    /**
+     * quick hack to add a record to the zone
+     *
+     * @param   string  $name       The new record name
+     * @param   int     $ttl        TTL for record  (Defaults to SOA TTL)
+     * @param   string  $class      Class of record (Default of 'IN')
+     * @param   string  $type       record type
+     * @param   string  $data       the data
+     * @param   string  $mx         MX priority
+     * @return  bool                true/false based on validity of passed data
+     */
+    function addRecord($name = NULL, $ttl = NULL, $class = &quot;IN&quot;, $type, $data, $mx = 0)
+    {
+        if (array_search($type, $this-&gt;_types) &amp;&amp; (($ttl == NULL) || is_int($ttl))) {
+            $quotedDomain = preg_quote($this-&gt;_domain);
+            if (ereg(&quot;[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}&quot;, $data)) {
+            } else {
+                if (substr($data, -1) == '.') {
+                    //String already correct.
+                } elseif (preg_match(&quot;/$quotedDomain&quot; . '$/i', $data)) {
+                    //String ends with this domain. Append a .
+                    $data .= '.';
+                } else {
+                    //Subdomain specified. Append domainname
+                    $data .= '.' . $this-&gt;_domain . '.';
+                }
+            }
+            if ($name != null) {
+                if (substr($name, -1) == '.') {
+                    //String already correct.
+                } elseif (preg_match(&quot;/$quotedDomain&quot; . '$/i', $name)) {
+                    //String ends with this domain. Append a .
+                    $name .= '.';
+                } else {
+                    //Subdomain specified. Append domainname
+                    $name .= '.' . $this-&gt;_domain . '.';
+                }
+            } else {
+                $name = $this-&gt;_domain . '.';
+            }
+            $this-&gt;_records[]    = Array(
+                    'name'  =&gt; $name,
+                    'ttl'   =&gt; ( $ttl == NULL ? $this-&gt;_SOA['ttl'] : $ttl ),
+                    'class' =&gt; $class,
+                    'type'  =&gt; $type,
+                    'data'  =&gt; $data
+                );
+            if ($type == &quot;MX&quot;) {
+                $this-&gt;setMXPref($mx, $data, $name);
+            }
+        } else {
+            return false;
+        }
+        $this-&gt;_isModified = true;
+        return true;
+    }
+    // }}}
+    // {{{ delRecord()
+
+    /**
+     * quick hack to remove a single named record from zone
+     *
+     * @param   string  $name       name of record to remove
+     * @return  bool                true/falase based on whether a record was removed or not
+     */
+
+    function delRecord($name, $class = &quot;IN&quot;, $type = null, $data = null)
+    {
+        foreach ($this-&gt;_records as $key =&gt; $record) {
+            if ( (strcasecmp($record['name'], $name) == 0) || (strcasecmp(&quot;$name.{$this-&gt;_domain}.&quot;, $record['name']) == 0) ) {
+                    if ((($type == null) || ($type == $record['type'])) &amp;&amp; (($data == null) || ($data == $record['data']))) {
+                        unset($this-&gt;_records[$key]);
+                        $this-&gt;_isModified = true;
+                        return true;
+                    }
+            }
+        }
+        return false;
+    }
+    // }}}
     // {{{ isIP()</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_DNS Feature/Change Request
Reported by pear@...
2005-12-17T17:09:24+00:00
PHP: 4.3.11 OS: Linux Package Version: 

Description:
------------
A patch including bug 4528, plus Add/Remove items.  Also expanded the allowed record types.


--- DNS.php.orig        2004-06-29 06:52:26.000000000 +1000
+++ DNS.php     2005-12-18 09:05:01.000000000 +1100
@@ -200,10 +200,17 @@
      * CNAME
      * PTR
      *
+     * // bekar@20050326 updates //
+     *  Added support for a few extra record types:
+     *      TXT
+     *      NXT
+     *      HINFO
+     * // end of updates //
+     *
      * @var array
      * @see _parseRR
      */
-    var $_types = array('SOA', 'A', 'AAAA', 'NS', 'MX', 'CNAME', 'PTR');
+    var $_types = array('SOA', 'A', 'AAAA', 'NS', 'MX', 'CNAME', 'PTR', 'TXT', 'NXT', 'HINFO');
 
     /**
      * zonefile modification check
@@ -490,16 +497,31 @@
                 case 'NS':
                 case 'CNAME':
                 case 'PTR':
-                    $record['data'] = $item;
+                    $zone[] = implode(&quot;\t&quot;, array(
+                        $record['name'],
+                        $record['ttl'],
+                        $record['class'],
+                        $record['type'],
+                        $record['data']));
                     break;
-
                 case 'MX':
                     //MX have an extra element. Save both right away.
                     //The setting itself is in the next item.
                     $record['data'] = $items[$key+1];
                     $record['options'] = array('MXPreference' =&gt; $item);
                     break;
-
+// bekar@20050326 updates //
+                case 'TXT':
+                case 'NXT':
+                case 'HINFO':
+                    //TXT and HINFO records are quoted text strings
+                    if ( preg_match( '/TXT (.*)$/i', $line, $data ) ) {
+                        $record['data'] = $data[1];
+                    } else {
+                        $record['data'] = $items[$key+1];
+                    }
+                    break;
+// end updates //
                 default:
                     return PEAR::raiseError('Unable to parse RR. ' .
                                             $record['type'] .
@@ -1127,6 +1149,88 @@
     }
 
     // }}}
+    // {{{ addRecord()
+
+    /**
+     * quick hack to add a record to the zone
+     *
+     * @param   string  $name       The new record name
+     * @param   int     $ttl        TTL for record  (Defaults to SOA TTL)
+     * @param   string  $class      Class of record (Default of 'IN')
+     * @param   string  $type       record type
+     * @param   string  $data       the data
+     * @param   string  $mx         MX priority
+     * @return  bool                true/false based on validity of passed data
+     */
+    function addRecord($name = NULL, $ttl = NULL, $class = &quot;IN&quot;, $type, $data, $mx = 0)
+    {
+        if (array_search($type, $this-&gt;_types) &amp;&amp; (($ttl == NULL) || is_int($ttl))) {
+            $quotedDomain = preg_quote($this-&gt;_domain);
+            if (ereg(&quot;[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}&quot;, $data)) {
+            } else {
+                if (substr($data, -1) == '.') {
+                    //String already correct.
+                } elseif (preg_match(&quot;/$quotedDomain&quot; . '$/i', $data)) {
+                    //String ends with this domain. Append a .
+                    $data .= '.';
+                } else {
+                    //Subdomain specified. Append domainname
+                    $data .= '.' . $this-&gt;_domain . '.';
+                }
+            }
+            if ($name != null) {
+                if (substr($name, -1) == '.') {
+                    //String already correct.
+                } elseif (preg_match(&quot;/$quotedDomain&quot; . '$/i', $name)) {
+                    //String ends with this domain. Append a .
+                    $name .= '.';
+                } else {
+                    //Subdomain specified. Append domainname
+                    $name .= '.' . $this-&gt;_domain . '.';
+                }
+            } else {
+                $name = $this-&gt;_domain . '.';
+            }
+            $this-&gt;_records[]    = Array(
+                    'name'  =&gt; $name,
+                    'ttl'   =&gt; ( $ttl == NULL ? $this-&gt;_SOA['ttl'] : $ttl ),
+                    'class' =&gt; $class,
+                    'type'  =&gt; $type,
+                    'data'  =&gt; $data
+                );
+            if ($type == &quot;MX&quot;) {
+                $this-&gt;setMXPref($mx, $data, $name);
+            }
+        } else {
+            return false;
+        }
+        $this-&gt;_isModified = true;
+        return true;
+    }
+    // }}}
+    // {{{ delRecord()
+
+    /**
+     * quick hack to remove a single named record from zone
+     *
+     * @param   string  $name       name of record to remove
+     * @return  bool                true/falase based on whether a record was removed or not
+     */
+
+    function delRecord($name, $class = &quot;IN&quot;, $type = null, $data = null)
+    {
+        foreach ($this-&gt;_records as $key =&gt; $record) {
+            if ( (strcasecmp($record['name'], $name) == 0) || (strcasecmp(&quot;$name.{$this-&gt;_domain}.&quot;, $record['name']) == 0) ) {
+                    if ((($type == null) || ($type == $record['type'])) &amp;&amp; (($data == null) || ($data == $record['data']))) {
+                        unset($this-&gt;_records[$key]);
+                        $this-&gt;_isModified = true;
+                        return true;
+                    }
+            }
+        }
+        return false;
+    }
+    // }}}
     // {{{ isIP()</pre>]]></description>
      <dc:date>2008-04-05T15:16:52+00:00</dc:date>
      <dc:creator>pear &amp;#x61;&amp;#116; bekar &amp;#x64;&amp;#111;&amp;#x74; id &amp;#x64;&amp;#111;&amp;#x74; au</dc:creator>
      <dc:subject>File_DNS Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/4528">
      <title>File_DNS: Bug 4528 [Assigned] GenerateZone uses fixed order in associative array</title>
      <link>http://pear.php.net/bugs/4528</link>
      <content:encoded><![CDATA[<pre>File_DNS Bug
Reported by metz@...
2005-06-04T15:00:18+00:00
PHP: 4.3.11 OS:  Package Version: 

Description:
------------
If the order of the associative array _records isn't 100% the zone will be corrupt.

try fixing:
--- DNS.php.orig        2005-06-04 21:52:03.000000000 +0200
+++ DNS.php     2005-06-04 21:52:34.000000000 +0200
@@ -667,7 +667,12 @@
             case 'CNAME':
             case 'PTR':
             default:
-                $zone[] = implode(&quot;\t&quot;, $record);
+                $zone[] = implode(&quot;\t&quot;, array(
+                                  $record['name'],
+                                  $record['ttl'],
+                                  $record['class'],
+                                  $record['type'],
+                                  $record['data']));
                 break;
             }
         }</pre>]]></content:encoded>
      <description><![CDATA[<pre>File_DNS Bug
Reported by metz@...
2005-06-04T15:00:18+00:00
PHP: 4.3.11 OS:  Package Version: 

Description:
------------
If the order of the associative array _records isn't 100% the zone will be corrupt.

try fixing:
--- DNS.php.orig        2005-06-04 21:52:03.000000000 +0200
+++ DNS.php     2005-06-04 21:52:34.000000000 +0200
@@ -667,7 +667,12 @@
             case 'CNAME':
             case 'PTR':
             default:
-                $zone[] = implode(&quot;\t&quot;, $record);
+                $zone[] = implode(&quot;\t&quot;, array(
+                                  $record['name'],
+                                  $record['ttl'],
+                                  $record['class'],
+                                  $record['type'],
+                                  $record['data']));
                 break;
             }
         }</pre>]]></description>
      <dc:date>2007-04-22T11:31:33+00:00</dc:date>
      <dc:creator>metz &amp;#x61;&amp;#116; php &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>File_DNS Bug</dc:subject>
    </item>
</rdf:RDF>
