<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14947] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14947">14947</a></dd>
<dt>Author</dt> <dd>intralanman</dd>
<dt>Date</dt> <dd>2009-09-21 21:59:03 -0500 (Mon, 21 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>start adding db field quoters to actually support multiple DBs</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribintralanmanPHPfs_curlfs_curlphp">freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_curl.php</a></li>
<li><a href="#freeswitchtrunkcontribintralanmanPHPfs_curlfs_dialplanphp">freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_dialplan.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribintralanmanPHPfs_curlfs_curlphp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_curl.php (14946 => 14947)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_curl.php        2009-09-22 02:55:26 UTC (rev 14946)
+++ freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_curl.php        2009-09-22 02:59:03 UTC (rev 14947)
</span><span class="lines">@@ -17,13 +17,13 @@
</span><span class="cx">  * Base class for all curl XML output, contains methods for XML output and
</span><span class="cx">  * connecting to a database
</span><span class="cx">  * @return void
</span><del>-*/
</del><ins>+ */
</ins><span class="cx"> class fs_curl {
</span><del>-    /**
-     * FS_PDO Object
-     * @link http://www.php.net/pdo
-     * @var $db FS_PDO
-     */
</del><ins>+/**
+ * FS_PDO Object
+ * @link http://www.php.net/pdo
+ * @var $db FS_PDO
+ */
</ins><span class="cx">     public $db;
</span><span class="cx">     /**
</span><span class="cx">      * Array of _REQUEST parameters passed
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">      * This method will instantiate the FS_PDO and XMLWriter classes for use
</span><span class="cx">      * in child classes
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function fs_curl() {
</span><span class="cx">         openlog('fs_curl', LOG_NDELAY | LOG_PID, LOG_USER);
</span><span class="cx">         header('Content-Type: text/xml');
</span><span class="lines">@@ -59,14 +59,14 @@
</span><span class="cx">         $this -&gt; include_files($inc);
</span><span class="cx">         $this -&gt; connect_db(DEFAULT_DSN, DEFAULT_DSN_LOGIN, DEFAULT_DSN_PASSWORD );
</span><span class="cx">         set_error_handler(array($this, 'error_handler'));
</span><del>-        //trigger_error('blah', E_USER_ERROR);
</del><ins>+    //trigger_error('blah', E_USER_ERROR);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     /**
</span><span class="cx">      * Connect to a database via FS_PDO
</span><span class="cx">      * @param mixed $dsn data source for database connection (array or string)
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function connect_db($dsn, $login, $password) {
</span><span class="cx">         try {
</span><span class="cx">             $this -&gt; db = new FS_PDO($dsn, $login, $password);
</span><span class="lines">@@ -74,6 +74,20 @@
</span><span class="cx">             $this -&gt; comment($e-&gt;getMessage());
</span><span class="cx">             $this -&gt; file_not_found(); //program terminates in function file_not_found()
</span><span class="cx">         }
</span><ins>+        $driver = $this-&gt;db-&gt;getAttribute(constant(&quot;PDO::ATTR_DRIVER_NAME&quot;));
+        $this-&gt;debug(&quot;our driver is $driver&quot;);
+        switch ($driver) {
+            case 'mysql':
+                $quoter = '`';
+                break;
+            case 'postgres':
+                $quoter = '&quot;';
+                break;
+            default:
+                $quoter = '';
+                break;
+        }
+        define('DB_FIELD_QUOTE', $quoter);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     /**
</span><span class="lines">@@ -81,7 +95,7 @@
</span><span class="cx">      * Adds a comment to be displayed in the final XML
</span><span class="cx">      * @param string $comment comment string to be output in XML
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function comment($comment) {
</span><span class="cx">         $this -&gt; comments[] = $comment;
</span><span class="cx">     }
</span><span class="lines">@@ -91,10 +105,10 @@
</span><span class="cx">      * Generates an array from the _REQUEST parameters that were passed, keeping
</span><span class="cx">      * all key =&gt; value combinations intact
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     private function generate_request_array() {
</span><span class="cx">         while (list($req_key, $req_val) = each($_REQUEST)) {
</span><del>-            //$this -&gt; comment(&quot;$req_key =&gt; $req_val&quot;);
</del><ins>+        //$this -&gt; comment(&quot;$req_key =&gt; $req_val&quot;);
</ins><span class="cx">             $this -&gt; request[$req_key] = $req_val;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -103,7 +117,7 @@
</span><span class="cx">      * Actual Instantiation of XMLWriter Object
</span><span class="cx">      * This method creates an XMLWriter Object and sets some needed options
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     private function open_xml() {
</span><span class="cx">         $this -&gt; xmlw = new XMLWriter();
</span><span class="cx">         $this -&gt; xmlw -&gt; openMemory();
</span><span class="lines">@@ -127,7 +141,7 @@
</span><span class="cx">      * in the event that we are unable to generate a valid configuration file
</span><span class="cx">      * from the passed information
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function file_not_found() {
</span><span class="cx">         $this -&gt; comment('Include Path = ' . ini_get('include_path'));
</span><span class="cx">         $not_found = new XMLWriter();
</span><span class="lines">@@ -160,7 +174,7 @@
</span><span class="cx">      * @param array $comments [Multi-dementional] Array of comments to be added
</span><span class="cx">      * @param integer $space_pad Number of spaces to indent the comments
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     private function comments2xml($xml_obj, $comments, $space_pad=0) {
</span><span class="cx">         $comment_count = count($comments);
</span><span class="cx">         for ($i = 0; $i &lt; $comment_count; $i++) {
</span><span class="lines">@@ -177,7 +191,7 @@
</span><span class="cx">     /**
</span><span class="cx">      * End open XML elments in XMLWriter object
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     private function close_xml() {
</span><span class="cx">         $this -&gt; xmlw -&gt; endElement();
</span><span class="cx">         $this -&gt; xmlw -&gt; endElement();
</span><span class="lines">@@ -187,15 +201,15 @@
</span><span class="cx">     /**
</span><span class="cx">      * Close and Output XML and stop script execution
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function output_xml() {
</span><span class="cx">         $this-&gt;comment(
</span><span class="cx">             sprintf('Total # of Queries Run: %d', $this-&gt;db-&gt;counter)
</span><span class="cx">         );
</span><span class="cx">         $this -&gt; comment(sprintf(&quot;Estimated Execution Time Is: %s&quot;
</span><del>-                , (preg_replace(
-                '/^0\.(\d+) (\d+)$/', '\2.\1', microtime()) - START_TIME)
-            ));
</del><ins>+            , (preg_replace(
+            '/^0\.(\d+) (\d+)$/', '\2.\1', microtime()) - START_TIME)
+        ));
</ins><span class="cx"> 
</span><span class="cx">         $this -&gt; comments2xml($this -&gt; xmlw, $this -&gt; comments);
</span><span class="cx">         $this -&gt; close_xml();
</span><span class="lines">@@ -210,7 +224,7 @@
</span><span class="cx">     /**
</span><span class="cx">      * Recursive method to add an array of comments
</span><span class="cx">      * @return void
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function comment_array($array, $spacepad=0) {
</span><span class="cx">         $spaces = str_repeat(' ', $spacepad);
</span><span class="cx">         foreach ($array as $key =&gt; $val) {
</span><span class="lines">@@ -231,14 +245,14 @@
</span><span class="cx">      * @param array $file_array associative array of files to include
</span><span class="cx">      * @return void
</span><span class="cx">      * @todo add other types for different levels of errors
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function include_files($file_array) {
</span><span class="cx">         $return = FS_CURL_SUCCESS;
</span><span class="cx">         while (list($type, $file) = each($file_array)) {
</span><span class="cx">             $inc = @include_once($file);
</span><span class="cx">             if (!$inc) {
</span><span class="cx">                 $comment = sprintf(
</span><del>-                'Unable To Include %s File %s', $type, $file
</del><ins>+                    'Unable To Include %s File %s', $type, $file
</ins><span class="cx">                 );
</span><span class="cx">                 $this -&gt; comment($comment);
</span><span class="cx">                 if ($type == 'required') {
</span><span class="lines">@@ -264,7 +278,7 @@
</span><span class="cx">      * @see RETURN_ON_WARN
</span><span class="cx">      * @return void
</span><span class="cx">      * @todo add other defines that control what, if any, comments gets output
</span><del>-    */
</del><ins>+     */
</ins><span class="cx">     public function error_handler($no, $str, $file, $line) {
</span><span class="cx">         if ($no == E_STRICT) {
</span><span class="cx">             return true;
</span><span class="lines">@@ -274,20 +288,20 @@
</span><span class="cx"> 
</span><span class="cx">         switch ($no) {
</span><span class="cx">             case E_USER_NOTICE:
</span><del>-                case E_NOTICE:
</del><ins>+            case E_NOTICE:
+                break;
+            case E_USER_WARNING:
+            case E_WARNING:
+                if (defined('RETURN_ON_WARN') &amp;&amp; RETURN_ON_WARN == true) {
</ins><span class="cx">                     break;
</span><del>-                case E_USER_WARNING:
-                    case E_WARNING:
-                        if (defined('RETURN_ON_WARN') &amp;&amp; RETURN_ON_WARN == true) {
-                            break;
-                        }
-                        case E_ERROR:
-                            case E_USER_ERROR:
-                                default:
-                                    $this -&gt; file_not_found();
-                                }
-                                return true;
-                            }
</del><ins>+                }
+            case E_ERROR:
+            case E_USER_ERROR:
+            default:
+                $this -&gt; file_not_found();
+        }
+        return true;
+    }
</ins><span class="cx"> 
</span><span class="cx">     /**
</span><span class="cx">      * Function to print out debugging info
</span><span class="lines">@@ -297,42 +311,42 @@
</span><span class="cx">      * @param integer $debug_level debug if $debug_level &lt;= FS_CURL_DEBUG
</span><span class="cx">      * @param integer $spaces
</span><span class="cx">      */
</span><del>-                            public function debug($input, $debug_level=0, $spaces=0) {
-                                if (defined('FS_CURL_DEBUG') &amp;&amp; $debug_level &lt;= FS_CURL_DEBUG ) {
-                                    if (is_array($input)) {
-                                        $this -&gt; debug('Array (', $debug_level, $spaces);
-                                        foreach ($input as $key=&gt;$val) {
-                                            if (is_array($val) || is_object($val)) {
-                                                $this -&gt; debug(&quot;[$key] =&gt; $val&quot;, $debug_level, $spaces+4);
-                                                $this -&gt; debug('(', $debug_level, $spaces + 8);
-                                                $this -&gt; debug($val, $debug_level, $spaces + 8);
-                                            } else {
-                                                $this -&gt; debug(&quot;[$key] =&gt; '$val'&quot;, $debug_level, $spaces + 4);
-                                            }
-                                        }
-                                        $this -&gt; debug(&quot;)&quot;, $debug_level, $spaces);
-                                    } else {
-                                        $debug_str = sprintf(&quot;%s%s&quot;
-                                            , str_repeat(' ', $spaces), $input
-                                        );
-                                        switch (FS_DEBUG_TYPE) {
-                                            case 0:
-                                                syslog(LOG_NOTICE, $debug_str);
-                                                break;
-                                            case 1:
-                                                $debug_str = preg_replace('/--/', '- - ', $debug_str);
-                                                $this -&gt; comment($debug_str);
-                                                break;
-                                            case 2:
-                                                $ptr = fopen(FS_DEBUG_FILE, 'a');
-                                                fputs($ptr, &quot;$debug_str\r\n&quot;);
-                                                fclose($ptr);
-                                                break;
-                                            default:
-                                                return;
-                                            }
-                                        }
-                                    }
-                                }
-                            }
</del><ins>+    public function debug($input, $debug_level=0, $spaces=0) {
+        if (defined('FS_CURL_DEBUG') &amp;&amp; $debug_level &lt;= FS_CURL_DEBUG ) {
+            if (is_array($input)) {
+                $this -&gt; debug('Array (', $debug_level, $spaces);
+                foreach ($input as $key=&gt;$val) {
+                    if (is_array($val) || is_object($val)) {
+                        $this -&gt; debug(&quot;[$key] =&gt; $val&quot;, $debug_level, $spaces+4);
+                        $this -&gt; debug('(', $debug_level, $spaces + 8);
+                        $this -&gt; debug($val, $debug_level, $spaces + 8);
+                    } else {
+                        $this -&gt; debug(&quot;[$key] =&gt; '$val'&quot;, $debug_level, $spaces + 4);
+                    }
+                }
+                $this -&gt; debug(&quot;)&quot;, $debug_level, $spaces);
+            } else {
+                $debug_str = sprintf(&quot;%s%s&quot;
+                    , str_repeat(' ', $spaces), $input
+                );
+                switch (FS_DEBUG_TYPE) {
+                    case 0:
+                        syslog(LOG_NOTICE, $debug_str);
+                        break;
+                    case 1:
+                        $debug_str = preg_replace('/--/', '- - ', $debug_str);
+                        $this -&gt; comment($debug_str);
+                        break;
+                    case 2:
+                        $ptr = fopen(FS_DEBUG_FILE, 'a');
+                        fputs($ptr, &quot;$debug_str\r\n&quot;);
+                        fclose($ptr);
+                        break;
+                    default:
+                        return;
+                }
+            }
+        }
+    }
+}
</ins><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunkcontribintralanmanPHPfs_curlfs_dialplanphp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_dialplan.php (14946 => 14947)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_dialplan.php        2009-09-22 02:55:26 UTC (rev 14946)
+++ freeswitch/trunk/contrib/intralanman/PHP/fs_curl/fs_dialplan.php        2009-09-22 02:59:03 UTC (rev 14947)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">  * @author Raymond Chandler (intralanman) &lt;intralanman@gmail.com&gt;
</span><span class="cx">  * @version 0.1
</span><span class="cx">  * Class for XML dialplan
</span><del>-*/
</del><ins>+ */
</ins><span class="cx"> class fs_dialplan extends fs_curl {
</span><span class="cx">     private $special_class_file;
</span><span class="cx"> 
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx">     public function is_specialized_dialplan($context) {
</span><span class="cx">         $query = sprintf(
</span><del>-        &quot;SELECT * FROM dialplan_special WHERE context='%s'&quot;, $context
</del><ins>+            &quot;SELECT * FROM dialplan_special WHERE context='%s'&quot;, $context
</ins><span class="cx">         );
</span><span class="cx">         $res = $this -&gt; db -&gt; query($query);
</span><span class="cx">         if (FS_PDO::isError($res)) {
</span><span class="lines">@@ -81,23 +81,28 @@
</span><span class="cx">      */
</span><span class="cx">     private function get_dialplan($context) {
</span><span class="cx">         $dp_array = array();
</span><del>-                $dpQuery = sprintf(&quot;SELECT
-                        `context`,
-                        `name` as extension,
-                        `application` as application_name,
-                        `data` as application_data,
-                        `field` as condition_field,
-                        `expression` as condition_expression,
-                        `continue` as ext_continue,
-                        `type`
</del><ins>+        $dpQuery = sprintf('SELECT
+                        %1$scontext%1$s,
+                        %1$sname%1$s as extension,
+                        %1$sapplication%1$s as application_name,
+                        %1$sdata%1$s as application_data,
+                        %1$sfield%1$s as condition_field,
+                        %1$sexpression%1$s as condition_expression,
+                        %1$scontinue%1$s as ext_continue,
+                        %1$stype%1$s
</ins><span class="cx">                 FROM dialplan
</span><span class="cx">                         INNER JOIN dialplan_context USING(dialplan_id)
</span><span class="cx">                         INNER JOIN dialplan_extension USING(context_id)
</span><span class="cx">                         INNER JOIN dialplan_condition USING(extension_id)
</span><span class="cx">                         INNER JOIN dialplan_actions USING(condition_id)
</span><del>-                WHERE context = '%s'
-                ORDER BY dialplan_context.weight, dialplan_extension.weight, dialplan_condition.weight, dialplan_actions.weight&quot;, $context);
-
</del><ins>+                WHERE context = \'%2$s\'
+                ORDER BY dialplan_context.weight,
+                 dialplan_extension.weight,
+                 dialplan_condition.weight,
+                 dialplan_actions.weight'
+            , DB_FIELD_QUOTE, $context
+        );
+        $this-&gt;debug($dpQuery);
</ins><span class="cx">         $res = $this -&gt; db -&gt; query($dpQuery);
</span><span class="cx">         if (FS_PDO::isError($res)) {
</span><span class="cx">             $this -&gt; comment($this -&gt; db -&gt; getMessage());
</span><span class="lines">@@ -117,10 +122,10 @@
</span><span class="cx">             //$rcd = $row['re_cdata'];
</span><span class="cx">             $cc = empty($row['cond_break']) ? '0' : $row['cond_break'];
</span><span class="cx">             $dp_array[$ct][&quot;$et;$ec&quot;][&quot;$cf;$ce;$cc&quot;][] = array(
</span><del>-            'type'=&gt;$type,
-            'application'=&gt;$app,
-            'data'=&gt;$data,
-            'is_cdata'=&gt;(empty($app_cdata) ? '' : $app_cdata)
</del><ins>+                'type'=&gt;$type,
+                'application'=&gt;$app,
+                'data'=&gt;$data,
+                'is_cdata'=&gt;(empty($app_cdata) ? '' : $app_cdata)
</ins><span class="cx">             );
</span><span class="cx">         }
</span><span class="cx">         return $dp_array;
</span><span class="lines">@@ -134,21 +139,21 @@
</span><span class="cx">      *
</span><span class="cx">      */
</span><span class="cx">     private function writeDialplan($dpArray) {
</span><del>-        //print_r($dpArray);
</del><ins>+    //print_r($dpArray);
</ins><span class="cx">         if (is_array($dpArray)) {
</span><span class="cx">             $this -&gt; xmlw -&gt; startElement('section');
</span><span class="cx">             $this -&gt; xmlw -&gt; writeAttribute('name', 'dialplan');
</span><span class="cx">             $this -&gt; xmlw -&gt; writeAttribute('description', 'FreeSWITCH Dialplan');
</span><span class="cx">             //$this -&gt; comment('dpArray is an array');
</span><span class="cx">             foreach ($dpArray as $context =&gt; $extensions_array) {
</span><del>-                //$this -&gt; comment($context);
-                //start the context
</del><ins>+            //$this -&gt; comment($context);
+            //start the context
</ins><span class="cx">                 $this -&gt; xmlw -&gt; startElement('context');
</span><span class="cx">                 $this -&gt; xmlw -&gt; writeAttribute('name', $context);
</span><span class="cx">                 if (is_array($extensions_array)) {
</span><span class="cx">                     foreach ($extensions_array as $extension =&gt; $conditions) {
</span><del>-                        //start an extension
-                        $ex_split = split(';', $extension);
</del><ins>+                    //start an extension
+                        $ex_split = preg_split('/;/', $extension);
</ins><span class="cx">                         $this -&gt; xmlw -&gt; startElement('extension');
</span><span class="cx">                         $this -&gt; xmlw -&gt; writeAttribute('name', $ex_split[0]);
</span><span class="cx">                         if (strlen($ex_split[1]) &gt; 0) {
</span><span class="lines">@@ -156,50 +161,51 @@
</span><span class="cx">                         }
</span><span class="cx">                         $this -&gt; debug($conditions);
</span><span class="cx">                         foreach ($conditions as $condition =&gt; $app_array) {
</span><del>-                            $c_split = split(';', $condition);
</del><ins>+                            $c_split = preg_split('/;/', $condition);
</ins><span class="cx">                             $this -&gt; xmlw -&gt; startElement('condition');
</span><span class="cx">                             if (!empty($c_split[0])) {
</span><span class="cx">                                 $this -&gt; xmlw -&gt; writeAttribute('field', $c_split[0]);
</span><span class="cx">                             }
</span><span class="cx">                             if (!empty($c_split[1])) {
</span><span class="cx">                                 if (array_key_exists(3, $c_split)
</span><del>-                                &amp;&amp; $c_split[3] == true) {
</del><ins>+                                    &amp;&amp; $c_split[3] == true) {
</ins><span class="cx">                                     $this -&gt; xmlw -&gt; startElement('expression');
</span><span class="cx">                                     $this -&gt; xmlw -&gt; writeCdata($c_split[1]);
</span><span class="cx">                                     $this -&gt; xmlw -&gt; endElement();
</span><span class="cx">                                 } else {
</span><span class="cx">                                     $this -&gt; xmlw -&gt; writeAttribute(
</span><del>-                                    'expression', $c_split[1]
</del><ins>+                                        'expression', $c_split[1]
</ins><span class="cx">                                     );
</span><span class="cx">                                 }
</span><span class="cx">                             }
</span><span class="cx">                             //$this -&gt; debug($c_split[2]);
</span><span class="cx">                             if ($c_split[2] != '0') {
</span><span class="cx">                                 $this -&gt; xmlw -&gt; writeAttribute(
</span><del>-                                'break', $c_split[2]
</del><ins>+                                    'break', $c_split[2]
</ins><span class="cx">                                 );
</span><span class="cx">                             }
</span><span class="cx">                             //$this -&gt; debug($app_array);
</span><span class="cx">                             foreach ($app_array as $app) {
</span><span class="cx">                                 if (empty($app['application'])) {
</span><del>-                                        continue;
</del><ins>+                                    continue;
</ins><span class="cx">                                 }
</span><span class="cx">                                 $this -&gt; xmlw -&gt; startElement($app['type']);
</span><span class="cx">                                 $this -&gt; xmlw -&gt; writeAttribute(
</span><del>-                                'application', $app['application']
</del><ins>+                                    'application', $app['application']
</ins><span class="cx">                                 );
</span><span class="cx">                                 if (!empty($app['data'])) {
</span><span class="cx">                                     if (array_key_exists('is_cdata', $app)
</span><del>-                                    &amp;&amp; $app['is_cdata'] == true) {
-                                        //$this -&gt; xmlw -&gt; startElement('data');
</del><ins>+                                        &amp;&amp; $app['is_cdata'] == true) {
</ins><span class="cx">                                         $this -&gt; xmlw -&gt; writeCdata($app['data']);
</span><del>-                                        //$this -&gt; xmlw -&gt; endElement();
</del><span class="cx">                                     } else {
</span><span class="cx">                                         $this -&gt; xmlw -&gt; writeAttribute(
</span><del>-                                        'data', $app['data']
</del><ins>+                                            'data', $app['data']
</ins><span class="cx">                                         );
</span><span class="cx">                                     }
</span><span class="cx">                                 }
</span><ins>+                                if ($app['application'] == 'set') {
+                                    $this-&gt;xmlw-&gt;writeAttribute('inline', 'true');
+                                }
</ins><span class="cx">                                 $this -&gt; xmlw -&gt; endElement();
</span><span class="cx">                             }
</span><span class="cx">                             //&lt;/condition&gt;
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>