diff --git a/Frx.inc b/Frx.inc
index b86eb16..0785518 100755
--- a/Frx.inc
+++ b/Frx.inc
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file Frx.incL
  * General Forena Reporting Class
diff --git a/plugins/FrxMSSQL.inc b/plugins/FrxMSSQL.inc
index 0b1c9f9..008b943 100644
--- a/plugins/FrxMSSQL.inc
+++ b/plugins/FrxMSSQL.inc
@@ -1,10 +1,17 @@
 <?php
-// $Id$
+
+/**
+ * @file
+ * $Id$
+ */
+
 /**
  * @file
- * Oracle specific driver that takes advantage of oracles native XML support
+ * Oracle specific driver that takes advantage of oracles native XML support.
  *
- * In order to take advantage of XML support the following XML
+ * In order to take advantage of XML support the following XML.
+ */
+/**
  *
  */
 class FrxMSSQL extends FrxDataSource {
@@ -14,10 +21,12 @@ class FrxMSSQL extends FrxDataSource {
   private $use_mssql_xml;
 
   /**
-   * Object constructor
+   * Object constructor.
    *
-   * @param unknown_type $uri Database connection string.
-   * @param string $repos_path Path to location of data block definitions
+   * @param unknown_type $uri
+   *   Database connection string.
+   * @param string $repos_path
+   *   Path to location of data block definitions.
    */
   public function __construct($conf, $repos_path, $name) {
 
@@ -26,9 +35,11 @@ class FrxMSSQL extends FrxDataSource {
     $this->use_mssql_xml = FALSE;
     $uri = $conf['uri'];
     $this->debug = $conf['debug'];
-    if ($conf['mssql_xml']) $this->use_mssql_xml = TRUE;
+    if ($conf['mssql_xml']) {
+      $this->use_mssql_xml = TRUE;
+    }
     if ($uri) {
-      // Test for mssql suport
+      // Test for mssql suport.
       if (!is_callable('mssql_connect')) {
         Frx::error('MSSQL support not installed.', 'MSSQL mssql support not installed.');
         return;
@@ -36,14 +47,15 @@ class FrxMSSQL extends FrxDataSource {
       try {
         ini_set('mssql.textlimit', 2147483647);
         ini_set('mssql.textsize', 2147483647);
-        $db = mssql_connect($uri, $conf['user'], $conf['password']);
+        $db = sybase_connect($uri, $conf['user'], $conf['password']);
         $this->db = $db;
 
         if ($db) {
-          mssql_select_db($conf['database'], $db);
-          mssql_query("SET QUOTED_IDENTIFIER ON");
+          sybase_select_db($conf['database'], $db);
+          sybase_query("SET QUOTED_IDENTIFIER ON");
         }
-      } catch (Exception $e) {
+      }
+      catch (Exception $e) {
         Frx::error('Unable to connect to database ' . $conf['title'], $e->getMessage());
       }
 
@@ -55,24 +67,24 @@ class FrxMSSQL extends FrxDataSource {
     // Set up the stuff required to translate.
     $this->te = new FrxSyntaxEngine(FRX_SQL_TOKEN, ':', $this);
   }
+
   /**
    * Get data based on file data block in the repository.
    *
-   * @param String $block_name
-   * @param Array $parm_data
+   * @param string $block_name
+   * @param array $parm_data
    * @param Query $subQuery
    */
   public function sqlData($sql, $options = array()) {
-    // Load the block from the file
-
+    // Load the block from the file.
     $db = $this->db;
 
-    // Load the types array based on data
-    $this->types = isset($options['type']) ? $options['type'] : array();
+    // Load the types array based on data.
+    $this->types = $options['type'] ?? array();
 
-    $xml ='';
-    // Load the types array based on data
-    $this->types = isset($options['type']) ? $options['type'] : array();
+    $xml = '';
+    // Load the types array based on data.
+    $this->types = $options['type'] ?? array();
     if ($sql && $db) {
       $sql = $this->te->replace($sql);
 
@@ -83,7 +95,9 @@ class FrxMSSQL extends FrxDataSource {
         $xml = $this->php_xml($sql);
       }
       if ($this->debug) {
-        if ($xml) $d = htmlspecialchars($xml->asXML());
+        if ($xml) {
+          $d = htmlspecialchars($xml->asXML());
+        }
         FRx::debug('SQL: ' . $sql, '<pre> SQL:' . $sql . "\n XML: " . $d . "\n</pre>");
       }
       return $xml;
@@ -92,37 +106,43 @@ class FrxMSSQL extends FrxDataSource {
   }
 
   /**
-   * Generate xml from sql using the provided f_forena
+   * Generate xml from sql using the provided f_forena.
    *
    * @param unknown_type $sql
+   *
    * @return unknown
    */
   private function mssql_xml($sql, $block) {
     $db = $this->db;
 
-    //$rs->debugDumpParams();
+    // $rs->debugDumpParams();
     $fsql = $sql . ' FOR XML AUTO';
-    $rs = mssql_query($db, $fsql, array($sql, ''));
+    $rs = sybase_query($db, $fsql, array($sql, ''));
     if ($rs) {
-      $row = mssql_fetch_row($rs);
+      $row = sybase_fetch_row($rs);
       $xml_text = $row[0];
     }
     if ($xml_text) {
       $xml = new SimpleXMLElement($xml_text);
       if ($xml->getName() == 'error') {
-        $msg = (string)$xml . ' in ' . $block . '.sql. ';
+        $msg = (string) $xml . ' in ' . $block . '.sql. ';
         Frx::error($msg . 'See logs for more info', $msg . ' in <pre> ' . $sql . '</pre>');
       }
     }
-    if ($rs) mssql_free_result($rs);
+    if ($rs) {
+      sybase_free_result($rs);
+    }
     return $xml;
   }
 
+  /**
+   *
+   */
   private function php_xml($sql) {
     $db = $this->db;
     $xml = new SimpleXMLElement('<table/>');
 
-    $rs = mssql_query($sql, $db);
+    $rs = sybase_query($sql, $db);
     $rownum = 0;
     while ($row = mssql_fetch_assoc($rs)) {
       $rownum++;
@@ -132,13 +152,16 @@ class FrxMSSQL extends FrxDataSource {
         $row_node->addChild(strtolower($key), htmlspecialchars($value));
       }
     }
-    if ($rs) mssql_free_result($rs);
+    if ($rs) {
+      sybase_free_result($rs);
+    }
     return $xml;
 
   }
 
   /**
    * Perform search of tables.
+   *
    * @see FrxDataSource::searchTables()
    */
   public function searchTables($str) {
@@ -148,18 +171,21 @@ class FrxMSSQL extends FrxDataSource {
     $str = "'" . str_replace("'", "''", $str) . "'";
     $sql = str_replace(':str', $str, $sql);
     $rownum = 0;
-    $rs = mssql_query($sql, $db);
+    $rs = sybase_query($sql, $db);
     $tables = array();
     while ($row = mssql_fetch_assoc($rs)) {
       $tables[] = $row['table_name'];
     }
-    if ($rs) mssql_free_result($rs);
+    if ($rs) {
+      sybase_free_result($rs);
+    }
     return $tables;
 
   }
 
   /**
    * Perform search of tables.
+   *
    * @see FrxDataSource::searchTables()
    */
   public function searchTableColumns($table, $str) {
@@ -173,12 +199,16 @@ class FrxMSSQL extends FrxDataSource {
     $sql = str_replace(':table', $table, $sql);
     $rownum = 0;
 
-    $rs = mssql_query($sql, $db);
+    $rs = sybase_query($sql, $db);
     $columns = array();
-    if ($rs) while ($row = mssql_fetch_assoc($rs)) {
-      $columns[] = $row['COLUMN_NAME'];
+    if ($rs) {
+      while ($row = mssql_fetch_assoc($rs)) {
+        $columns[] = $row['COLUMN_NAME'];
+      }
+    }
+    if ($rs) {
+      sybase_free_result($rs);
     }
-    if ($rs) mssql_free_result($rs);
     return $columns;
 
   }
@@ -193,9 +223,11 @@ class FrxMSSQL extends FrxDataSource {
    * @param unknown_type $data
    */
   public function format($value, $key, $raw = FALSE) {
-    if ($raw) return $value;
+    if ($raw) {
+      return $value;
+    }
     $value = $this->parmConvert($key, $value);
-    if ($value===''||$value===NULL) {
+    if ($value === ''||$value === NULL) {
       $value = 'NULL';
     }
     elseif (is_array($value)) {
@@ -203,39 +235,41 @@ class FrxMSSQL extends FrxDataSource {
         $value = 'NULL';
       }
       else {
-        // Build a array of values string
-        $i=0;
+        // Build a array of values string.
+        $i = 0;
         $val = '';
         foreach ($value as $v) {
           $i++;
-          if ($i>1) {
+          if ($i > 1) {
             $val .= ',';
           }
-          $val .=  "'" . str_replace("'", "''", $v) . "'";
+          $val .= "'" . str_replace("'", "''", $v) . "'";
         }
         $value = $val;
       }
     }
     elseif (is_int($value)) {
-      $value = (int)$value;
-      $value = (string)$value;
+      $value = (int) $value;
+      $value = (string) $value;
     }
     elseif (is_float($value)) {
-      $value = (float)$value;
-      $value = (string)$value;
+      $value = (float) $value;
+      $value = (string) $value;
+    }
+    else {
+      $value = "'" . str_replace("'", "''", $value) . "'";
     }
-    else $value = "'" . str_replace("'", "''", $value) . "'";
     return $value;
   }
 
   /**
    * Destructor - Closes database connections.
-   *
    */
   public function __destruct() {
     $db = $this->db;
     if ($db) {
-      mssql_close($db);
+      sybase_close($db);
     }
   }
-}
\ No newline at end of file
+
+}
